aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig3
-rw-r--r--arch/alpha/include/asm/mman.h4
-rw-r--r--arch/alpha/include/asm/pci.h7
-rw-r--r--arch/alpha/kernel/binfmt_loader.c3
-rw-r--r--arch/alpha/kernel/pci.c86
-rw-r--r--arch/alpha/kernel/pci_impl.h3
-rw-r--r--arch/alpha/kernel/sys_marvel.c3
-rw-r--r--arch/alpha/kernel/sys_titan.c3
-rw-r--r--arch/arm/Kconfig43
-rw-r--r--arch/arm/Kconfig.debug164
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/boot/compressed/head.S2
-rw-r--r--arch/arm/boot/dts/am3517_mt_ventoux.dts27
-rw-r--r--arch/arm/boot/dts/at91sam9g20.dtsi68
-rw-r--r--arch/arm/boot/dts/at91sam9g25ek.dts37
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi87
-rw-r--r--arch/arm/boot/dts/at91sam9m10g45ek.dts72
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi176
-rw-r--r--arch/arm/boot/dts/at91sam9x5cm.dtsi29
-rw-r--r--arch/arm/boot/dts/highbank.dts8
-rw-r--r--arch/arm/boot/dts/imx27-phytec-phycore.dts76
-rw-r--r--arch/arm/boot/dts/imx27.dtsi217
-rw-r--r--arch/arm/boot/dts/imx51-babbage.dts91
-rw-r--r--arch/arm/boot/dts/imx6q-arm2.dts14
-rw-r--r--arch/arm/boot/dts/imx6q-sabrelite.dts34
-rw-r--r--arch/arm/boot/dts/imx6q.dtsi6
-rw-r--r--arch/arm/boot/dts/kirkwood-dreamplug.dts25
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi6
-rw-r--r--arch/arm/boot/dts/omap3-beagle.dts9
-rw-r--r--arch/arm/boot/dts/omap3-evm.dts20
-rw-r--r--arch/arm/boot/dts/omap3.dtsi35
-rw-r--r--arch/arm/boot/dts/omap4-panda.dts9
-rw-r--r--arch/arm/boot/dts/omap4-sdp.dts9
-rw-r--r--arch/arm/boot/dts/omap4.dtsi38
-rw-r--r--arch/arm/boot/dts/pxa168-aspenite.dts38
-rw-r--r--arch/arm/boot/dts/pxa168.dtsi98
-rw-r--r--arch/arm/boot/dts/tegra-cardhu.dts18
-rw-r--r--arch/arm/boot/dts/tegra-harmony.dts45
-rw-r--r--arch/arm/boot/dts/tegra-paz00.dts57
-rw-r--r--arch/arm/boot/dts/tegra-seaboard.dts78
-rw-r--r--arch/arm/boot/dts/tegra-trimslice.dts12
-rw-r--r--arch/arm/boot/dts/tegra-ventana.dts42
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi49
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi61
-rw-r--r--arch/arm/boot/dts/usb_a9g20.dts23
-rw-r--r--arch/arm/boot/dts/vexpress-v2m-rs1.dtsi201
-rw-r--r--arch/arm/boot/dts/vexpress-v2m.dtsi200
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts157
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca5s.dts162
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca9.dts192
-rw-r--r--arch/arm/common/it8152.c4
-rw-r--r--arch/arm/common/timer-sp.c17
-rw-r--r--arch/arm/configs/at91cap9_defconfig108
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig19
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig39
-rw-r--r--arch/arm/configs/lpc32xx_defconfig145
-rw-r--r--arch/arm/configs/magician_defconfig2
-rw-r--r--arch/arm/configs/mini2440_defconfig2
-rw-r--r--arch/arm/configs/mxs_defconfig20
-rw-r--r--arch/arm/configs/s3c2410_defconfig57
-rw-r--r--arch/arm/configs/tct_hammer_defconfig2
-rw-r--r--arch/arm/configs/tegra_defconfig33
-rw-r--r--arch/arm/include/asm/hardware/arm_timer.h5
-rw-r--r--arch/arm/include/asm/hardware/entry-macro-iomd.S8
-rw-r--r--arch/arm/include/asm/hardware/timer-sp.h15
-rw-r--r--arch/arm/include/asm/localtimer.h37
-rw-r--r--arch/arm/include/asm/pci.h8
-rw-r--r--arch/arm/include/asm/pgtable-nommu.h1
-rw-r--r--arch/arm/include/asm/smp_twd.h25
-rw-r--r--arch/arm/include/asm/system.h1
-rw-r--r--arch/arm/kernel/Makefile3
-rw-r--r--arch/arm/kernel/bios32.c75
-rw-r--r--arch/arm/kernel/entry-armv.S3
-rw-r--r--arch/arm/kernel/entry-common.S8
-rw-r--r--arch/arm/kernel/process.c30
-rw-r--r--arch/arm/kernel/smp.c22
-rw-r--r--arch/arm/kernel/smp_twd.c123
-rw-r--r--arch/arm/mach-at91/Kconfig23
-rw-r--r--arch/arm/mach-at91/Makefile5
-rw-r--r--arch/arm/mach-at91/Makefile.boot14
-rw-r--r--arch/arm/mach-at91/at91cap9.c396
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c1273
-rw-r--r--arch/arm/mach-at91/at91rm9200.c16
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c14
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c37
-rw-r--r--arch/arm/mach-at91/at91sam9260.c24
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c59
-rw-r--r--arch/arm/mach-at91/at91sam9261.c4
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c31
-rw-r--r--arch/arm/mach-at91/at91sam9263.c5
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c72
-rw-r--r--arch/arm/mach-at91/at91sam926x_time.c68
-rw-r--r--arch/arm/mach-at91/at91sam9_alt_reset.S12
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c7
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c146
-rw-r--r--arch/arm/mach-at91/at91sam9g45_reset.S12
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c4
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c31
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c368
-rw-r--r--arch/arm/mach-at91/at91x40.c12
-rw-r--r--arch/arm/mach-at91/at91x40_time.c28
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c396
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c5
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c1
-rw-r--r--arch/arm/mach-at91/board-dt.c21
-rw-r--r--arch/arm/mach-at91/board-eco920.c5
-rw-r--r--arch/arm/mach-at91/board-flexibity.c12
-rw-r--r--arch/arm/mach-at91/board-kb9202.c1
-rw-r--r--arch/arm/mach-at91/board-picotux200.c1
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c1
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c1
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c80
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c10
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c3
-rw-r--r--arch/arm/mach-at91/clock.c176
-rw-r--r--arch/arm/mach-at91/cpuidle.c11
-rw-r--r--arch/arm/mach-at91/generic.h17
-rw-r--r--arch/arm/mach-at91/gpio.c625
-rw-r--r--arch/arm/mach-at91/include/mach/at91_matrix.h23
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pio.h25
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc.h118
-rw-r--r--arch/arm/mach-at91/include/mach/at91_ramc.h32
-rw-r--r--arch/arm/mach-at91/include/mach/at91_st.h32
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9.h122
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9_matrix.h137
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200.h10
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200_mc.h58
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h63
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9260.h14
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9260_matrix.h36
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9261.h10
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9261_matrix.h18
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9263.h12
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9263_matrix.h74
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h16
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_sdramc.h6
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9g45.h12
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9g45_matrix.h84
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9rl.h7
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h42
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9x5.h79
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9x5_matrix.h53
-rw-r--r--arch/arm/mach-at91/include/mach/at91x40.h18
-rw-r--r--arch/arm/mach-at91/include/mach/board.h6
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h21
-rw-r--r--arch/arm/mach-at91/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h17
-rw-r--r--arch/arm/mach-at91/include/mach/hardware.h9
-rw-r--r--arch/arm/mach-at91/include/mach/io.h18
-rw-r--r--arch/arm/mach-at91/include/mach/system.h50
-rw-r--r--arch/arm/mach-at91/irq.c132
-rw-r--r--arch/arm/mach-at91/pm.c52
-rw-r--r--arch/arm/mach-at91/pm.h96
-rw-r--r--arch/arm/mach-at91/pm_slowclock.S275
-rw-r--r--arch/arm/mach-at91/setup.c26
-rw-r--r--arch/arm/mach-at91/soc.h5
-rw-r--r--arch/arm/mach-bcmring/core.c23
-rw-r--r--arch/arm/mach-bcmring/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-bcmring/include/mach/system.h28
-rw-r--r--arch/arm/mach-clps711x/common.c16
-rw-r--r--arch/arm/mach-clps711x/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-clps711x/include/mach/system.h35
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/entry-macro.S15
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/system.h25
-rw-r--r--arch/arm/mach-cns3xxx/pcie.c4
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c3
-rw-r--r--arch/arm/mach-davinci/board-dm355-leopard.c3
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c3
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c28
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c32
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c3
-rw-r--r--arch/arm/mach-davinci/board-sffsdr.c3
-rw-r--r--arch/arm/mach-davinci/cpufreq.c2
-rw-r--r--arch/arm/mach-davinci/da850.c2
-rw-r--r--arch/arm/mach-davinci/davinci.h96
-rw-r--r--arch/arm/mach-davinci/devices.c32
-rw-r--r--arch/arm/mach-davinci/dm355.c3
-rw-r--r--arch/arm/mach-davinci/dm365.c19
-rw-r--r--arch/arm/mach-davinci/dm644x.c53
-rw-r--r--arch/arm/mach-davinci/dm646x.c21
-rw-r--r--arch/arm/mach-davinci/dma.c6
-rw-r--r--arch/arm/mach-davinci/include/mach/dm355.h32
-rw-r--r--arch/arm/mach-davinci/include/mach/dm365.h53
-rw-r--r--arch/arm/mach-davinci/include/mach/dm644x.h47
-rw-r--r--arch/arm/mach-davinci/include/mach/dm646x.h42
-rw-r--r--arch/arm/mach-davinci/include/mach/edma.h5
-rw-r--r--arch/arm/mach-davinci/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-davinci/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/system.h21
-rw-r--r--arch/arm/mach-dove/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-dove/include/mach/system.h17
-rw-r--r--arch/arm/mach-dove/pcie.c4
-rw-r--r--arch/arm/mach-ebsa110/core.c25
-rw-r--r--arch/arm/mach-ebsa110/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-ebsa110/include/mach/system.h37
-rw-r--r--arch/arm/mach-ep93xx/Makefile3
-rw-r--r--arch/arm/mach-ep93xx/adssphere.c1
-rw-r--r--arch/arm/mach-ep93xx/clock.c1
-rw-r--r--arch/arm/mach-ep93xx/core.c100
-rw-r--r--arch/arm/mach-ep93xx/crunch-bits.S (renamed from arch/arm/kernel/crunch-bits.S)0
-rw-r--r--arch/arm/mach-ep93xx/crunch.c (renamed from arch/arm/kernel/crunch.c)4
-rw-r--r--arch/arm/mach-ep93xx/dma.c2
-rw-r--r--arch/arm/mach-ep93xx/edb93xx.c1
-rw-r--r--arch/arm/mach-ep93xx/gesbc9312.c1
-rw-r--r--arch/arm/mach-ep93xx/include/mach/entry-macro.S17
-rw-r--r--arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h191
-rw-r--r--arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h10
-rw-r--r--arch/arm/mach-ep93xx/include/mach/hardware.h1
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h16
-rw-r--r--arch/arm/mach-ep93xx/include/mach/system.h7
-rw-r--r--arch/arm/mach-ep93xx/micro9.c1
-rw-r--r--arch/arm/mach-ep93xx/simone.c2
-rw-r--r--arch/arm/mach-ep93xx/snappercl15.c2
-rw-r--r--arch/arm/mach-ep93xx/soc.h213
-rw-r--r--arch/arm/mach-ep93xx/ts72xx.c1
-rw-r--r--arch/arm/mach-ep93xx/vision_ep9307.c2
-rw-r--r--arch/arm/mach-exynos/Kconfig13
-rw-r--r--arch/arm/mach-exynos/Makefile3
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.c1577
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.h30
-rw-r--r--arch/arm/mach-exynos/clock-exynos4210.c48
-rw-r--r--arch/arm/mach-exynos/clock-exynos4212.c32
-rw-r--r--arch/arm/mach-exynos/clock.c1564
-rw-r--r--arch/arm/mach-exynos/common.c74
-rw-r--r--arch/arm/mach-exynos/common.h9
-rw-r--r--arch/arm/mach-exynos/cpuidle.c151
-rw-r--r--arch/arm/mach-exynos/dma.c153
-rw-r--r--arch/arm/mach-exynos/include/mach/cpufreq.h2
-rw-r--r--arch/arm/mach-exynos/include/mach/entry-macro.S16
-rw-r--r--arch/arm/mach-exynos/include/mach/exynos4-clock.h43
-rw-r--r--arch/arm/mach-exynos/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h10
-rw-r--r--arch/arm/mach-exynos/include/mach/pmu.h2
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-clock.h416
-rw-r--r--arch/arm/mach-exynos/include/mach/system.h20
-rw-r--r--arch/arm/mach-exynos/mach-nuri.c84
-rw-r--r--arch/arm/mach-exynos/mach-origen.c39
-rw-r--r--arch/arm/mach-exynos/mach-smdkv310.c3
-rw-r--r--arch/arm/mach-exynos/mach-universal_c210.c84
-rw-r--r--arch/arm/mach-exynos/mct.c39
-rw-r--r--arch/arm/mach-exynos/pm.c55
-rw-r--r--arch/arm/mach-footbridge/dc21285.c8
-rw-r--r--arch/arm/mach-footbridge/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-footbridge/include/mach/system.h13
-rw-r--r--arch/arm/mach-gemini/Makefile2
-rw-r--r--arch/arm/mach-gemini/idle.c29
-rw-r--r--arch/arm/mach-gemini/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-gemini/include/mach/system.h14
-rw-r--r--arch/arm/mach-gemini/irq.c4
-rw-r--r--arch/arm/mach-h720x/common.c18
-rw-r--r--arch/arm/mach-h720x/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-h720x/include/mach/system.h27
-rw-r--r--arch/arm/mach-highbank/Makefile1
-rw-r--r--arch/arm/mach-highbank/highbank.c5
-rw-r--r--arch/arm/mach-highbank/include/mach/entry-macro.S5
-rw-r--r--arch/arm/mach-highbank/include/mach/memory.h1
-rw-r--r--arch/arm/mach-highbank/localtimer.c40
-rw-r--r--arch/arm/mach-imx/Kconfig20
-rw-r--r--arch/arm/mach-imx/Makefile6
-rw-r--r--arch/arm/mach-imx/Makefile.boot3
-rw-r--r--arch/arm/mach-imx/clock-imx27.c20
-rw-r--r--arch/arm/mach-imx/clock-imx31.c2
-rw-r--r--arch/arm/mach-imx/clock-imx35.c166
-rw-r--r--arch/arm/mach-imx/clock-imx6q.c74
-rw-r--r--arch/arm/mach-imx/cpu-imx5.c36
-rw-r--r--arch/arm/mach-imx/cpu_op-mx51.c1
-rw-r--r--arch/arm/mach-imx/crmregs-imx3.h (renamed from arch/arm/mach-imx/crmregs-imx31.h)16
-rw-r--r--arch/arm/mach-imx/devices-imx27.h2
-rw-r--r--arch/arm/mach-imx/eukrea_mbimx27-baseboard.c20
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c1
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c17
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c17
-rw-r--r--arch/arm/mach-imx/imx27-dt.c89
-rw-r--r--arch/arm/mach-imx/imx51-dt.c1
-rw-r--r--arch/arm/mach-imx/imx53-dt.c1
-rw-r--r--arch/arm/mach-imx/lluart.c2
-rw-r--r--arch/arm/mach-imx/localtimer.c35
-rw-r--r--arch/arm/mach-imx/mach-armadillo5x0.c2
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c140
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c3
-rw-r--r--arch/arm/mach-imx/mach-mx21ads.c16
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c108
-rw-r--r--arch/arm/mach-imx/mach-mx31ads.c35
-rw-r--r--arch/arm/mach-imx/mach-mx31moboard.c6
-rw-r--r--arch/arm/mach-imx/mach-mx35_3ds.c216
-rw-r--r--arch/arm/mach-imx/mach-pca100.c13
-rw-r--r--arch/arm/mach-imx/mach-pcm038.c2
-rw-r--r--arch/arm/mach-imx/mach-pcm043.c13
-rw-r--r--arch/arm/mach-imx/mm-imx21.c6
-rw-r--r--arch/arm/mach-imx/mm-imx25.c7
-rw-r--r--arch/arm/mach-imx/mm-imx27.c7
-rw-r--r--arch/arm/mach-imx/mm-imx3.c78
-rw-r--r--arch/arm/mach-imx/mm-imx5.c60
-rw-r--r--arch/arm/mach-imx/pm-imx27.c3
-rw-r--r--arch/arm/mach-imx/pm-imx3.c37
-rw-r--r--arch/arm/mach-imx/pm-imx5.c4
-rw-r--r--arch/arm/mach-integrator/core.c70
-rw-r--r--arch/arm/mach-integrator/impd1.c9
-rw-r--r--arch/arm/mach-integrator/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-integrator/include/mach/system.h33
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c49
-rw-r--r--arch/arm/mach-integrator/pci_v3.c7
-rw-r--r--arch/arm/mach-iop13xx/include/mach/entry-macro.S3
-rw-r--r--arch/arm/mach-iop13xx/include/mach/system.h13
-rw-r--r--arch/arm/mach-iop13xx/pci.c4
-rw-r--r--arch/arm/mach-iop32x/include/mach/entry-macro.S3
-rw-r--r--arch/arm/mach-iop32x/include/mach/system.h13
-rw-r--r--arch/arm/mach-iop33x/include/mach/entry-macro.S3
-rw-r--r--arch/arm/mach-iop33x/include/mach/system.h13
-rw-r--r--arch/arm/mach-ixp2000/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-ixp2000/include/mach/system.h14
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c4
-rw-r--r--arch/arm/mach-ixp2000/ixdp2800.c4
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x00.c4
-rw-r--r--arch/arm/mach-ixp2000/pci.c6
-rw-r--r--arch/arm/mach-ixp23xx/core.c3
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/system.h16
-rw-r--r--arch/arm/mach-ixp23xx/pci.c6
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c4
-rw-r--r--arch/arm/mach-ixp4xx/common.c6
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/system.h19
-rw-r--r--arch/arm/mach-kirkwood/Kconfig14
-rw-r--r--arch/arm/mach-kirkwood/Makefile1
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot2
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c180
-rw-r--r--arch/arm/mach-kirkwood/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-kirkwood/include/mach/system.h17
-rw-r--r--arch/arm/mach-kirkwood/openrd-setup.c6
-rw-r--r--arch/arm/mach-kirkwood/pcie.c4
-rw-r--r--arch/arm/mach-kirkwood/t5325-setup.c6
-rw-r--r--arch/arm/mach-ks8695/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-ks8695/include/mach/system.h27
-rw-r--r--arch/arm/mach-ks8695/pci.c4
-rw-r--r--arch/arm/mach-lpc32xx/clock.c98
-rw-r--r--arch/arm/mach-lpc32xx/common.c22
-rw-r--r--arch/arm/mach-lpc32xx/common.h2
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/platform.h51
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/system.h27
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c35
-rw-r--r--arch/arm/mach-lpc32xx/pm.c2
-rw-r--r--arch/arm/mach-lpc32xx/timer.c48
-rw-r--r--arch/arm/mach-mmp/Kconfig10
-rw-r--r--arch/arm/mach-mmp/Makefile1
-rw-r--r--arch/arm/mach-mmp/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa910.h1
-rw-r--r--arch/arm/mach-mmp/include/mach/regs-apbc.h1
-rw-r--r--arch/arm/mach-mmp/include/mach/regs-rtc.h23
-rw-r--r--arch/arm/mach-mmp/include/mach/system.h16
-rw-r--r--arch/arm/mach-mmp/mmp-dt.c75
-rw-r--r--arch/arm/mach-mmp/mmp2.c1
-rw-r--r--arch/arm/mach-mmp/pxa168.c3
-rw-r--r--arch/arm/mach-mmp/pxa910.c28
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c1
-rw-r--r--arch/arm/mach-msm/idle.S36
-rw-r--r--arch/arm/mach-msm/idle.c49
-rw-r--r--arch/arm/mach-msm/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-msm/include/mach/system.h1
-rw-r--r--arch/arm/mach-msm/timer.c79
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/system.h17
-rw-r--r--arch/arm/mach-mv78xx0/pcie.c4
-rw-r--r--arch/arm/mach-mxs/Kconfig16
-rw-r--r--arch/arm/mach-mxs/Makefile1
-rw-r--r--arch/arm/mach-mxs/clock-mx23.c35
-rw-r--r--arch/arm/mach-mxs/clock-mx28.c58
-rw-r--r--arch/arm/mach-mxs/devices-mx23.h4
-rw-r--r--arch/arm/mach-mxs/devices-mx28.h4
-rw-r--r--arch/arm/mach-mxs/devices.c8
-rw-r--r--arch/arm/mach-mxs/devices/Kconfig3
-rw-r--r--arch/arm/mach-mxs/devices/Makefile1
-rw-r--r--arch/arm/mach-mxs/devices/amba-duart.c2
-rw-r--r--arch/arm/mach-mxs/devices/platform-gpmi-nand.c81
-rw-r--r--arch/arm/mach-mxs/devices/platform-mxs-mmc.c2
-rw-r--r--arch/arm/mach-mxs/include/mach/common.h2
-rw-r--r--arch/arm/mach-mxs/include/mach/devices-common.h10
-rw-r--r--arch/arm/mach-mxs/include/mach/digctl.h1
-rw-r--r--arch/arm/mach-mxs/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-mxs/include/mach/mxs.h29
-rw-r--r--arch/arm/mach-mxs/include/mach/system.h25
-rw-r--r--arch/arm/mach-mxs/include/mach/uncompress.h13
-rw-r--r--arch/arm/mach-mxs/mach-apx4devkit.c260
-rw-r--r--arch/arm/mach-mxs/mach-m28evk.c7
-rw-r--r--arch/arm/mach-mxs/mach-mx28evk.c80
-rw-r--r--arch/arm/mach-mxs/pm.c3
-rw-r--r--arch/arm/mach-mxs/system.c16
-rw-r--r--arch/arm/mach-netx/fb.c13
-rw-r--r--arch/arm/mach-netx/include/mach/entry-macro.S26
-rw-r--r--arch/arm/mach-netx/include/mach/system.h28
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c24
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c9
-rw-r--r--arch/arm/mach-nomadik/include/mach/entry-macro.S13
-rw-r--r--arch/arm/mach-nomadik/include/mach/setup.h19
-rw-r--r--arch/arm/mach-nomadik/include/mach/system.h32
-rw-r--r--arch/arm/mach-omap1/Kconfig7
-rw-r--r--arch/arm/mach-omap1/Makefile4
-rw-r--r--arch/arm/mach-omap1/ams-delta-fiq-handler.S3
-rw-r--r--arch/arm/mach-omap1/ams-delta-fiq.c1
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c327
-rw-r--r--arch/arm/mach-omap1/board-fsample.c22
-rw-r--r--arch/arm/mach-omap1/board-h2.c21
-rw-r--r--arch/arm/mach-omap1/board-h3.c17
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c14
-rw-r--r--arch/arm/mach-omap1/board-innovator.c18
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c25
-rw-r--r--arch/arm/mach-omap1/board-osk.c21
-rw-r--r--arch/arm/mach-omap1/board-palmte.c14
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c19
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c19
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c22
-rw-r--r--arch/arm/mach-omap1/board-sx1.c22
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c6
-rw-r--r--arch/arm/mach-omap1/clock.c5
-rw-r--r--arch/arm/mach-omap1/clock_data.c5
-rw-r--r--arch/arm/mach-omap1/common.h1
-rw-r--r--arch/arm/mach-omap1/devices.c17
-rw-r--r--arch/arm/mach-omap1/dma.c2
-rw-r--r--arch/arm/mach-omap1/flash.c4
-rw-r--r--arch/arm/mach-omap1/fpga.c5
-rw-r--r--arch/arm/mach-omap1/gpio15xx.c7
-rw-r--r--arch/arm/mach-omap1/gpio16xx.c47
-rw-r--r--arch/arm/mach-omap1/gpio7xx.c14
-rw-r--r--arch/arm/mach-omap1/id.c3
-rw-r--r--arch/arm/mach-omap1/include/mach/entry-macro.S8
-rw-r--r--arch/arm/mach-omap1/include/mach/hardware.h36
-rw-r--r--arch/arm/mach-omap1/include/mach/io.h43
-rw-r--r--arch/arm/mach-omap1/include/mach/memory.h3
-rw-r--r--arch/arm/mach-omap1/include/mach/system.h5
-rw-r--r--arch/arm/mach-omap1/io.c5
-rw-r--r--arch/arm/mach-omap1/iomap.h42
-rw-r--r--arch/arm/mach-omap1/irq.c4
-rw-r--r--arch/arm/mach-omap1/lcd_dma.c3
-rw-r--r--arch/arm/mach-omap1/mcbsp.c19
-rw-r--r--arch/arm/mach-omap1/pm.c23
-rw-r--r--arch/arm/mach-omap1/reset.c3
-rw-r--r--arch/arm/mach-omap1/sleep.S4
-rw-r--r--arch/arm/mach-omap1/sram.S4
-rw-r--r--arch/arm/mach-omap1/time.c3
-rw-r--r--arch/arm/mach-omap1/timer32k.c7
-rw-r--r--arch/arm/mach-omap2/Kconfig8
-rw-r--r--arch/arm/mach-omap2/Makefile17
-rw-r--r--arch/arm/mach-omap2/am35xx-emac.c117
-rw-r--r--arch/arm/mach-omap2/am35xx-emac.h15
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c5
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c39
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c119
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c6
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c2
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c4
-rw-r--r--arch/arm/mach-omap2/board-flash.c2
-rw-r--r--arch/arm/mach-omap2/board-generic.c111
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c6
-rw-r--r--arch/arm/mach-omap2/board-ldp.c3
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c9
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c10
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c7
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c4
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c26
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c15
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c17
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c72
-rw-r--r--arch/arm/mach-omap2/board-overo.c3
-rw-r--r--arch/arm/mach-omap2/board-rm680.c16
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c30
-rw-r--r--arch/arm/mach-omap2/board-zoom-display.c5
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c4
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c1
-rw-r--r--arch/arm/mach-omap2/clkt_clksel.c1
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c1
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c3
-rw-r--r--arch/arm/mach-omap2/clock2430.c2
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c2
-rw-r--r--arch/arm/mach-omap2/clock2xxx.c1
-rw-r--r--arch/arm/mach-omap2/clock3xxx.c1
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c3
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c3
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.c4
-rw-r--r--arch/arm/mach-omap2/cm44xx.c2
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c2
-rw-r--r--arch/arm/mach-omap2/common-board-devices.c9
-rw-r--r--arch/arm/mach-omap2/common.c5
-rw-r--r--arch/arm/mach-omap2/common.h19
-rw-r--r--arch/arm/mach-omap2/control.c4
-rw-r--r--arch/arm/mach-omap2/control.h6
-rw-r--r--arch/arm/mach-omap2/devices.c40
-rw-r--r--arch/arm/mach-omap2/display.c9
-rw-r--r--arch/arm/mach-omap2/dma.c2
-rw-r--r--arch/arm/mach-omap2/emu.c30
-rw-r--r--arch/arm/mach-omap2/gpio.c38
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c1
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.c1
-rw-r--r--arch/arm/mach-omap2/gpmc-smsc911x.c11
-rw-r--r--arch/arm/mach-omap2/gpmc.c2
-rw-r--r--arch/arm/mach-omap2/hsmmc.c123
-rw-r--r--arch/arm/mach-omap2/hsmmc.h12
-rw-r--r--arch/arm/mach-omap2/id.c188
-rw-r--r--arch/arm/mach-omap2/include/mach/entry-macro.S18
-rw-r--r--arch/arm/mach-omap2/include/mach/io.h46
-rw-r--r--arch/arm/mach-omap2/include/mach/system.h5
-rw-r--r--arch/arm/mach-omap2/io.c69
-rw-r--r--arch/arm/mach-omap2/iomap.h (renamed from arch/arm/plat-omap/include/plat/io.h)80
-rw-r--r--arch/arm/mach-omap2/irq.c65
-rw-r--r--arch/arm/mach-omap2/mcbsp.c56
-rw-r--r--arch/arm/mach-omap2/mux.c16
-rw-r--r--arch/arm/mach-omap2/mux.h2
-rw-r--r--arch/arm/mach-omap2/omap-hotplug.c2
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c4
-rw-r--r--arch/arm/mach-omap2/omap-smp.c3
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.c53
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c31
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c20
-rw-r--r--arch/arm/mach-omap2/opp2420_data.c2
-rw-r--r--arch/arm/mach-omap2/opp2430_data.c2
-rw-r--r--arch/arm/mach-omap2/pm-debug.c6
-rw-r--r--arch/arm/mach-omap2/pm.c125
-rw-r--r--arch/arm/mach-omap2/pm.h3
-rw-r--r--arch/arm/mach-omap2/pm24xx.c104
-rw-r--r--arch/arm/mach-omap2/pm34xx.c94
-rw-r--r--arch/arm/mach-omap2/pm44xx.c65
-rw-r--r--arch/arm/mach-omap2/powerdomain-common.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain2xxx_3xxx.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain44xx.c1
-rw-r--r--arch/arm/mach-omap2/powerdomains3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.c2
-rw-r--r--arch/arm/mach-omap2/prm44xx.c3
-rw-r--r--arch/arm/mach-omap2/prm_common.c1
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c2
-rw-r--r--arch/arm/mach-omap2/sdram-nokia.c1
-rw-r--r--arch/arm/mach-omap2/sdrc2xxx.c6
-rw-r--r--arch/arm/mach-omap2/serial.c4
-rw-r--r--arch/arm/mach-omap2/sleep24xx.S1
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S5
-rw-r--r--arch/arm/mach-omap2/smartreflex-class3.c1
-rw-r--r--arch/arm/mach-omap2/smartreflex.c229
-rw-r--r--arch/arm/mach-omap2/smartreflex.h10
-rw-r--r--arch/arm/mach-omap2/sr_device.c13
-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.S5
-rw-r--r--arch/arm/mach-omap2/timer-mpu.c39
-rw-r--r--arch/arm/mach-omap2/timer.c22
-rw-r--r--arch/arm/mach-omap2/vc.c1
-rw-r--r--arch/arm/mach-omap2/vp.c4
-rw-r--r--arch/arm/mach-orion5x/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-orion5x/include/mach/system.h19
-rw-r--r--arch/arm/mach-orion5x/pci.c14
-rw-r--r--arch/arm/mach-picoxcell/include/mach/entry-macro.S16
-rw-r--r--arch/arm/mach-picoxcell/include/mach/system.h26
-rw-r--r--arch/arm/mach-pnx4008/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-pnx4008/include/mach/system.h29
-rw-r--r--arch/arm/mach-prima2/include/mach/entry-macro.S7
-rw-r--r--arch/arm/mach-prima2/include/mach/system.h17
-rw-r--r--arch/arm/mach-pxa/devices.c28
-rw-r--r--arch/arm/mach-pxa/hx4700.c77
-rw-r--r--arch/arm/mach-pxa/include/mach/balloon3.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/entry-macro.S15
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa27x.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/system.h15
-rw-r--r--arch/arm/mach-pxa/magician.c33
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c1
-rw-r--r--arch/arm/mach-pxa/pxa95x.c1
-rw-r--r--arch/arm/mach-realview/core.h20
-rw-r--r--arch/arm/mach-realview/include/mach/entry-macro.S16
-rw-r--r--arch/arm/mach-realview/include/mach/irqs-eb.h23
-rw-r--r--arch/arm/mach-realview/include/mach/irqs-pb1176.h2
-rw-r--r--arch/arm/mach-realview/include/mach/system.h33
-rw-r--r--arch/arm/mach-realview/realview_eb.c105
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c78
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c99
-rw-r--r--arch/arm/mach-realview/realview_pba8.c78
-rw-r--r--arch/arm/mach-realview/realview_pbx.c98
-rw-r--r--arch/arm/mach-rpc/Makefile2
-rw-r--r--arch/arm/mach-rpc/fiq.S16
-rw-r--r--arch/arm/mach-rpc/include/mach/entry-macro.S4
-rw-r--r--arch/arm/mach-rpc/include/mach/system.h13
-rw-r--r--arch/arm/mach-rpc/irq.c6
-rw-r--r--arch/arm/mach-s3c2410/Kconfig154
-rw-r--r--arch/arm/mach-s3c2410/Makefile26
-rw-r--r--arch/arm/mach-s3c2410/common.h17
-rw-r--r--arch/arm/mach-s3c2410/include/mach/spi.h38
-rw-r--r--arch/arm/mach-s3c2410/include/mach/system.h54
-rw-r--r--arch/arm/mach-s3c2410/usb-simtec.h16
-rw-r--r--arch/arm/mach-s3c2412/Kconfig85
-rw-r--r--arch/arm/mach-s3c2412/Makefile12
-rw-r--r--arch/arm/mach-s3c2416/Kconfig60
-rw-r--r--arch/arm/mach-s3c2416/Makefile22
-rw-r--r--arch/arm/mach-s3c2440/Kconfig165
-rw-r--r--arch/arm/mach-s3c2440/Makefile26
-rw-r--r--arch/arm/mach-s3c2440/common.h17
-rw-r--r--arch/arm/mach-s3c2443/Kconfig32
-rw-r--r--arch/arm/mach-s3c2443/Makefile20
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig538
-rw-r--r--arch/arm/mach-s3c24xx/Makefile95
-rw-r--r--arch/arm/mach-s3c24xx/Makefile.boot (renamed from arch/arm/mach-s3c2410/Makefile.boot)0
-rw-r--r--arch/arm/mach-s3c24xx/bast-ide.c (renamed from arch/arm/mach-s3c2410/bast-ide.c)0
-rw-r--r--arch/arm/mach-s3c24xx/bast-irq.c (renamed from arch/arm/mach-s3c2410/bast-irq.c)0
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2412.c (renamed from arch/arm/mach-s3c2412/clock.c)0
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2416.c (renamed from arch/arm/mach-s3c2416/clock.c)7
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2440.c (renamed from arch/arm/mach-s3c2440/clock.c)0
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2443.c (renamed from arch/arm/mach-s3c2443/clock.c)7
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c244x.c (renamed from arch/arm/mach-s3c2440/s3c244x-clock.c)0
-rw-r--r--arch/arm/mach-s3c24xx/common-s3c2443.c (renamed from arch/arm/plat-s3c24xx/s3c2443-clock.c)90
-rw-r--r--arch/arm/mach-s3c24xx/common-smdk.c (renamed from arch/arm/plat-s3c24xx/common-smdk.c)0
-rw-r--r--arch/arm/mach-s3c24xx/dma-s3c2410.c (renamed from arch/arm/mach-s3c2410/dma.c)0
-rw-r--r--arch/arm/mach-s3c24xx/dma-s3c2412.c (renamed from arch/arm/mach-s3c2412/dma.c)0
-rw-r--r--arch/arm/mach-s3c24xx/dma-s3c2440.c (renamed from arch/arm/mach-s3c2440/dma.c)0
-rw-r--r--arch/arm/mach-s3c24xx/dma-s3c2443.c (renamed from arch/arm/mach-s3c2443/dma.c)30
-rw-r--r--arch/arm/mach-s3c24xx/h1940-bluetooth.c (renamed from arch/arm/mach-s3c2410/h1940-bluetooth.c)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/anubis-cpld.h (renamed from arch/arm/mach-s3c2410/include/mach/anubis-cpld.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/anubis-irq.h (renamed from arch/arm/mach-s3c2410/include/mach/anubis-irq.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/anubis-map.h (renamed from arch/arm/mach-s3c2410/include/mach/anubis-map.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/bast-cpld.h (renamed from arch/arm/mach-s3c2410/include/mach/bast-cpld.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/bast-irq.h (renamed from arch/arm/mach-s3c2410/include/mach/bast-irq.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/bast-map.h (renamed from arch/arm/mach-s3c2410/include/mach/bast-map.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/bast-pmu.h (renamed from arch/arm/mach-s3c2410/include/mach/bast-pmu.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/debug-macro.S (renamed from arch/arm/mach-s3c2410/include/mach/debug-macro.S)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/dma.h (renamed from arch/arm/mach-s3c2410/include/mach/dma.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/entry-macro.S (renamed from arch/arm/mach-s3c2410/include/mach/entry-macro.S)8
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/fb.h (renamed from arch/arm/mach-s3c2410/include/mach/fb.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/gpio-fns.h (renamed from arch/arm/mach-s3c2410/include/mach/gpio-fns.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/gpio-nrs.h (renamed from arch/arm/mach-s3c2410/include/mach/gpio-nrs.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/gpio-track.h (renamed from arch/arm/mach-s3c2410/include/mach/gpio-track.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/gpio.h (renamed from arch/arm/mach-s3c2410/include/mach/gpio.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/gta02.h (renamed from arch/arm/mach-s3c2440/include/mach/gta02.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/h1940-latch.h (renamed from arch/arm/mach-s3c2410/include/mach/h1940-latch.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/h1940.h (renamed from arch/arm/mach-s3c2410/include/mach/h1940.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/hardware.h (renamed from arch/arm/mach-s3c2410/include/mach/hardware.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/idle.h (renamed from arch/arm/mach-s3c2410/include/mach/idle.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/io.h (renamed from arch/arm/mach-s3c2410/include/mach/io.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/irqs.h (renamed from arch/arm/mach-s3c2410/include/mach/irqs.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/leds-gpio.h (renamed from arch/arm/mach-s3c2410/include/mach/leds-gpio.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/map.h (renamed from arch/arm/mach-s3c2410/include/mach/map.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/osiris-cpld.h (renamed from arch/arm/mach-s3c2410/include/mach/osiris-cpld.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/osiris-map.h (renamed from arch/arm/mach-s3c2410/include/mach/osiris-map.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/otom-map.h (renamed from arch/arm/mach-s3c2410/include/mach/otom-map.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/pm-core.h (renamed from arch/arm/mach-s3c2410/include/mach/pm-core.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-clock.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-clock.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-dsc.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-dsc.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-gpio.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-gpio.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-gpioj.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-gpioj.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-irq.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-irq.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-lcd.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-lcd.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-mem.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-mem.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-power.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-power.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-s3c2412-mem.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-s3c2412.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-s3c2412.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-s3c2416-mem.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-s3c2416-mem.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-s3c2416.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-s3c2416.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-sdi.h (renamed from arch/arm/mach-s3c2410/include/mach/regs-sdi.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/tick.h (renamed from arch/arm/mach-s3c2410/include/mach/tick.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/timex.h (renamed from arch/arm/mach-s3c2410/include/mach/timex.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/uncompress.h (renamed from arch/arm/mach-s3c2410/include/mach/uncompress.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/vr1000-cpld.h (renamed from arch/arm/mach-s3c2410/include/mach/vr1000-cpld.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/vr1000-irq.h (renamed from arch/arm/mach-s3c2410/include/mach/vr1000-irq.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/vr1000-map.h (renamed from arch/arm/mach-s3c2410/include/mach/vr1000-map.h)0
-rw-r--r--arch/arm/mach-s3c24xx/irq-s3c2412.c (renamed from arch/arm/mach-s3c2412/irq.c)0
-rw-r--r--arch/arm/mach-s3c24xx/irq-s3c2416.c (renamed from arch/arm/mach-s3c2416/irq.c)0
-rw-r--r--arch/arm/mach-s3c24xx/irq-s3c2440.c (renamed from arch/arm/mach-s3c2440/irq.c)0
-rw-r--r--arch/arm/mach-s3c24xx/irq-s3c2443.c (renamed from arch/arm/mach-s3c2443/irq.c)0
-rw-r--r--arch/arm/mach-s3c24xx/irq-s3c244x.c (renamed from arch/arm/mach-s3c2440/s3c244x-irq.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-amlm5900.c (renamed from arch/arm/mach-s3c2410/mach-amlm5900.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-anubis.c (renamed from arch/arm/mach-s3c2440/mach-anubis.c)1
-rw-r--r--arch/arm/mach-s3c24xx/mach-at2440evb.c (renamed from arch/arm/mach-s3c2440/mach-at2440evb.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-bast.c (renamed from arch/arm/mach-s3c2410/mach-bast.c)3
-rw-r--r--arch/arm/mach-s3c24xx/mach-gta02.c (renamed from arch/arm/mach-s3c2440/mach-gta02.c)6
-rw-r--r--arch/arm/mach-s3c24xx/mach-h1940.c (renamed from arch/arm/mach-s3c2410/mach-h1940.c)12
-rw-r--r--arch/arm/mach-s3c24xx/mach-jive.c (renamed from arch/arm/mach-s3c2412/mach-jive.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-mini2440.c (renamed from arch/arm/mach-s3c2440/mach-mini2440.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-n30.c (renamed from arch/arm/mach-s3c2410/mach-n30.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-nexcoder.c (renamed from arch/arm/mach-s3c2440/mach-nexcoder.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris-dvs.c (renamed from arch/arm/mach-s3c2440/mach-osiris-dvs.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris.c (renamed from arch/arm/mach-s3c2440/mach-osiris.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-otom.c (renamed from arch/arm/mach-s3c2410/mach-otom.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-qt2410.c (renamed from arch/arm/mach-s3c2410/mach-qt2410.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx1950.c (renamed from arch/arm/mach-s3c2440/mach-rx1950.c)12
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx3715.c (renamed from arch/arm/mach-s3c2440/mach-rx3715.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2410.c (renamed from arch/arm/mach-s3c2410/mach-smdk2410.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2413.c (renamed from arch/arm/mach-s3c2412/mach-smdk2413.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2416.c (renamed from arch/arm/mach-s3c2416/mach-smdk2416.c)8
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2440.c (renamed from arch/arm/mach-s3c2440/mach-smdk2440.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2443.c (renamed from arch/arm/mach-s3c2443/mach-smdk2443.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-tct_hammer.c (renamed from arch/arm/mach-s3c2410/mach-tct_hammer.c)0
-rw-r--r--arch/arm/mach-s3c24xx/mach-vr1000.c (renamed from arch/arm/mach-s3c2410/mach-vr1000.c)3
-rw-r--r--arch/arm/mach-s3c24xx/mach-vstms.c (renamed from arch/arm/mach-s3c2412/mach-vstms.c)0
-rw-r--r--arch/arm/mach-s3c24xx/pm-h1940.S (renamed from arch/arm/mach-s3c2410/pm-h1940.S)0
-rw-r--r--arch/arm/mach-s3c24xx/pm-s3c2410.c (renamed from arch/arm/mach-s3c2410/pm.c)0
-rw-r--r--arch/arm/mach-s3c24xx/pm-s3c2412.c (renamed from arch/arm/mach-s3c2412/pm.c)0
-rw-r--r--arch/arm/mach-s3c24xx/pm-s3c2416.c (renamed from arch/arm/mach-s3c2416/pm.c)0
-rw-r--r--arch/arm/mach-s3c24xx/s3c2410.c (renamed from arch/arm/mach-s3c2410/s3c2410.c)0
-rw-r--r--arch/arm/mach-s3c24xx/s3c2412.c (renamed from arch/arm/mach-s3c2412/s3c2412.c)4
-rw-r--r--arch/arm/mach-s3c24xx/s3c2416.c (renamed from arch/arm/mach-s3c2416/s3c2416.c)5
-rw-r--r--arch/arm/mach-s3c24xx/s3c2440.c (renamed from arch/arm/mach-s3c2440/s3c2440.c)0
-rw-r--r--arch/arm/mach-s3c24xx/s3c2442.c (renamed from arch/arm/mach-s3c2440/s3c2442.c)0
-rw-r--r--arch/arm/mach-s3c24xx/s3c2443.c (renamed from arch/arm/mach-s3c2443/s3c2443.c)2
-rw-r--r--arch/arm/mach-s3c24xx/s3c244x.c (renamed from arch/arm/mach-s3c2440/s3c244x.c)0
-rw-r--r--arch/arm/mach-s3c24xx/setup-i2c.c (renamed from arch/arm/plat-s3c24xx/setup-i2c.c)0
-rw-r--r--arch/arm/mach-s3c24xx/setup-sdhci-gpio.c (renamed from arch/arm/mach-s3c2416/setup-sdhci-gpio.c)0
-rw-r--r--arch/arm/mach-s3c24xx/setup-ts.c (renamed from arch/arm/plat-s3c24xx/setup-ts.c)0
-rw-r--r--arch/arm/mach-s3c24xx/simtec-audio.c (renamed from arch/arm/plat-s3c24xx/simtec-audio.c)2
-rw-r--r--arch/arm/mach-s3c24xx/simtec-nor.c (renamed from arch/arm/mach-s3c2410/nor-simtec.c)2
-rw-r--r--arch/arm/mach-s3c24xx/simtec-pm.c (renamed from arch/arm/plat-s3c24xx/pm-simtec.c)0
-rw-r--r--arch/arm/mach-s3c24xx/simtec-usb.c (renamed from arch/arm/mach-s3c2410/usb-simtec.c)2
-rw-r--r--arch/arm/mach-s3c24xx/simtec.h (renamed from arch/arm/mach-s3c2410/nor-simtec.h)9
-rw-r--r--arch/arm/mach-s3c24xx/sleep-s3c2410.S (renamed from arch/arm/mach-s3c2410/sleep.S)0
-rw-r--r--arch/arm/mach-s3c24xx/sleep-s3c2412.S (renamed from arch/arm/mach-s3c2412/sleep.S)0
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig9
-rw-r--r--arch/arm/mach-s3c64xx/Makefile2
-rw-r--r--arch/arm/mach-s3c64xx/clock.c121
-rw-r--r--arch/arm/mach-s3c64xx/common.h2
-rw-r--r--arch/arm/mach-s3c64xx/cpuidle.c91
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/entry-macro.S19
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/system.h19
-rw-r--r--arch/arm/mach-s3c64xx/irq-pm.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410-module.c32
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c71
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq.c3
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c4
-rw-r--r--arch/arm/mach-s3c64xx/setup-usb-phy.c90
-rw-r--r--arch/arm/mach-s5p64x0/clock.c11
-rw-r--r--arch/arm/mach-s5p64x0/common.c15
-rw-r--r--arch/arm/mach-s5p64x0/dma.c30
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/entry-macro.S17
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h7
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/system.h21
-rw-r--r--arch/arm/mach-s5pc100/clock.c28
-rw-r--r--arch/arm/mach-s5pc100/common.c12
-rw-r--r--arch/arm/mach-s5pc100/dma.c46
-rw-r--r--arch/arm/mach-s5pc100/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-s5pc100/include/mach/system.h19
-rw-r--r--arch/arm/mach-s5pv210/Kconfig15
-rw-r--r--arch/arm/mach-s5pv210/Makefile1
-rw-r--r--arch/arm/mach-s5pv210/clock.c5
-rw-r--r--arch/arm/mach-s5pv210/common.c12
-rw-r--r--arch/arm/mach-s5pv210/dma.c46
-rw-r--r--arch/arm/mach-s5pv210/include/mach/entry-macro.S17
-rw-r--r--arch/arm/mach-s5pv210/include/mach/map.h4
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-sys.h4
-rw-r--r--arch/arm/mach-s5pv210/include/mach/system.h21
-rw-r--r--arch/arm/mach-s5pv210/mach-aquila.c1
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c2
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkc110.c14
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c17
-rw-r--r--arch/arm/mach-s5pv210/setup-usb-phy.c90
-rw-r--r--arch/arm/mach-sa1100/clock.c82
-rw-r--r--arch/arm/mach-sa1100/generic.c8
-rw-r--r--arch/arm/mach-sa1100/include/mach/assabet.h15
-rw-r--r--arch/arm/mach-sa1100/include/mach/cerf.h15
-rw-r--r--arch/arm/mach-sa1100/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-sa1100/include/mach/nanoengine.h12
-rw-r--r--arch/arm/mach-sa1100/include/mach/shannon.h12
-rw-r--r--arch/arm/mach-sa1100/include/mach/simpad.h6
-rw-r--r--arch/arm/mach-sa1100/include/mach/system.h9
-rw-r--r--arch/arm/mach-sa1100/pci-nanoengine.c8
-rw-r--r--arch/arm/mach-shark/core.c6
-rw-r--r--arch/arm/mach-shark/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-shark/include/mach/system.h13
-rw-r--r--arch/arm/mach-shmobile/Makefile1
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c63
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c376
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c50
-rw-r--r--arch/arm/mach-shmobile/board-g3evm.c38
-rw-r--r--arch/arm/mach-shmobile/board-g4evm.c38
-rw-r--r--arch/arm/mach-shmobile/board-kota2.c38
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c163
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c62
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c8
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/clock-sh7367.c8
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c10
-rw-r--r--arch/arm/mach-shmobile/clock-sh7377.c8
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c14
-rw-r--r--arch/arm/mach-shmobile/clock.c2
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h11
-rw-r--r--arch/arm/mach-shmobile/include/mach/entry-macro.S22
-rw-r--r--arch/arm/mach-shmobile/include/mach/system.h5
-rw-r--r--arch/arm/mach-shmobile/localtimer.c26
-rw-r--r--arch/arm/mach-shmobile/platsmp.c1
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c45
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c54
-rw-r--r--arch/arm/mach-shmobile/setup-sh7367.c32
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c32
-rw-r--r--arch/arm/mach-shmobile/setup-sh7377.c32
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c32
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c8
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c8
-rw-r--r--arch/arm/mach-shmobile/timer.c16
-rw-r--r--arch/arm/mach-spear3xx/include/mach/entry-macro.S18
-rw-r--r--arch/arm/mach-spear3xx/include/mach/system.h19
-rw-r--r--arch/arm/mach-spear3xx/spear300.c14
-rw-r--r--arch/arm/mach-spear3xx/spear3xx.c27
-rw-r--r--arch/arm/mach-spear6xx/include/mach/entry-macro.S18
-rw-r--r--arch/arm/mach-spear6xx/include/mach/system.h19
-rw-r--r--arch/arm/mach-spear6xx/spear6xx.c10
-rw-r--r--arch/arm/mach-tegra/Kconfig22
-rw-r--r--arch/arm/mach-tegra/Makefile8
-rw-r--r--arch/arm/mach-tegra/apbio.c145
-rw-r--r--arch/arm/mach-tegra/apbio.h (renamed from arch/arm/mach-tegra/include/mach/system.h)29
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra20.c6
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra30.c26
-rw-r--r--arch/arm/mach-tegra/board-harmony-pinmux.c6
-rw-r--r--arch/arm/mach-tegra/board-harmony-power.c18
-rw-r--r--arch/arm/mach-tegra/board-harmony.c2
-rw-r--r--arch/arm/mach-tegra/board-seaboard.c5
-rw-r--r--arch/arm/mach-tegra/clock.c22
-rw-r--r--arch/arm/mach-tegra/clock.h15
-rw-r--r--arch/arm/mach-tegra/common.c22
-rw-r--r--arch/arm/mach-tegra/cpuidle.c107
-rw-r--r--arch/arm/mach-tegra/dma.c128
-rw-r--r--arch/arm/mach-tegra/flowctrl.h37
-rw-r--r--arch/arm/mach-tegra/fuse.c109
-rw-r--r--arch/arm/mach-tegra/fuse.h34
-rw-r--r--arch/arm/mach-tegra/include/mach/clk.h10
-rw-r--r--arch/arm/mach-tegra/include/mach/debug-macro.S88
-rw-r--r--arch/arm/mach-tegra/include/mach/entry-macro.S20
-rw-r--r--arch/arm/mach-tegra/include/mach/gpio-tegra.h2
-rw-r--r--arch/arm/mach-tegra/include/mach/iomap.h3
-rw-r--r--arch/arm/mach-tegra/include/mach/irammap.h35
-rw-r--r--arch/arm/mach-tegra/include/mach/irqs.h7
-rw-r--r--arch/arm/mach-tegra/include/mach/kbc.h13
-rw-r--r--arch/arm/mach-tegra/include/mach/pinconf-tegra.h63
-rw-r--r--arch/arm/mach-tegra/include/mach/smmu.h63
-rw-r--r--arch/arm/mach-tegra/include/mach/uncompress.h120
-rw-r--r--arch/arm/mach-tegra/irq.c20
-rw-r--r--arch/arm/mach-tegra/localtimer.c26
-rw-r--r--arch/arm/mach-tegra/pcie.c22
-rw-r--r--arch/arm/mach-tegra/pmc.c76
-rw-r--r--arch/arm/mach-tegra/pmc.h (renamed from arch/arm/mach-highbank/include/mach/system.h)17
-rw-r--r--arch/arm/mach-tegra/sleep.S91
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c32
-rw-r--r--arch/arm/mach-tegra/tegra2_emc.c224
-rw-r--r--arch/arm/mach-tegra/tegra2_emc.h11
-rw-r--r--arch/arm/mach-tegra/tegra30_clocks.c3099
-rw-r--r--arch/arm/mach-tegra/timer.c22
-rw-r--r--arch/arm/mach-tegra/usb_phy.c11
-rw-r--r--arch/arm/mach-u300/Makefile1
-rw-r--r--arch/arm/mach-u300/core.c193
-rw-r--r--arch/arm/mach-u300/include/mach/entry-macro.S16
-rw-r--r--arch/arm/mach-u300/include/mach/gpio-u300.h2
-rw-r--r--arch/arm/mach-u300/include/mach/system.h14
-rw-r--r--arch/arm/mach-u300/mmc.c52
-rw-r--r--arch/arm/mach-u300/mmc.h18
-rw-r--r--arch/arm/mach-ux500/Kconfig44
-rw-r--r--arch/arm/mach-ux500/Makefile3
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c1
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.c28
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c21
-rw-r--r--arch/arm/mach-ux500/board-mop500-u8500uib.c1
-rw-r--r--arch/arm/mach-ux500/board-mop500.c2
-rw-r--r--arch/arm/mach-ux500/board-mop500.h2
-rw-r--r--arch/arm/mach-ux500/clock.c7
-rw-r--r--arch/arm/mach-ux500/clock.h1
-rw-r--r--arch/arm/mach-ux500/cpu.c1
-rw-r--r--arch/arm/mach-ux500/devices-common.c13
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c6
-rw-r--r--arch/arm/mach-ux500/include/mach/entry-macro.S18
-rw-r--r--arch/arm/mach-ux500/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-ux500/include/mach/setup.h3
-rw-r--r--arch/arm/mach-ux500/include/mach/system.h20
-rw-r--r--arch/arm/mach-ux500/localtimer.c29
-rw-r--r--arch/arm/mach-ux500/timer.c39
-rw-r--r--arch/arm/mach-versatile/core.c70
-rw-r--r--arch/arm/mach-versatile/core.h20
-rw-r--r--arch/arm/mach-versatile/include/mach/entry-macro.S15
-rw-r--r--arch/arm/mach-versatile/include/mach/system.h33
-rw-r--r--arch/arm/mach-versatile/pci.c6
-rw-r--r--arch/arm/mach-versatile/versatile_pb.c18
-rw-r--r--arch/arm/mach-vexpress/Kconfig47
-rw-r--r--arch/arm/mach-vexpress/Makefile.boot6
-rw-r--r--arch/arm/mach-vexpress/core.h24
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c75
-rw-r--r--arch/arm/mach-vexpress/include/mach/ct-ca9x4.h5
-rw-r--r--arch/arm/mach-vexpress/include/mach/debug-macro.S30
-rw-r--r--arch/arm/mach-vexpress/include/mach/entry-macro.S5
-rw-r--r--arch/arm/mach-vexpress/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-vexpress/include/mach/motherboard.h58
-rw-r--r--arch/arm/mach-vexpress/include/mach/system.h33
-rw-r--r--arch/arm/mach-vexpress/include/mach/uncompress.h22
-rw-r--r--arch/arm/mach-vexpress/platsmp.c160
-rw-r--r--arch/arm/mach-vexpress/v2m.c301
-rw-r--r--arch/arm/mach-vt8500/include/mach/entry-macro.S6
-rw-r--r--arch/arm/mach-vt8500/include/mach/system.h5
-rw-r--r--arch/arm/mach-w90x900/dev.c1
-rw-r--r--arch/arm/mach-w90x900/include/mach/entry-macro.S8
-rw-r--r--arch/arm/mach-w90x900/include/mach/system.h19
-rw-r--r--arch/arm/mach-zynq/include/mach/entry-macro.S27
-rw-r--r--arch/arm/mach-zynq/include/mach/system.h23
-rw-r--r--arch/arm/mm/iomap.c3
-rw-r--r--arch/arm/plat-iop/pci.c4
-rw-r--r--arch/arm/plat-mxc/Kconfig6
-rw-r--r--arch/arm/plat-mxc/Makefile2
-rw-r--r--arch/arm/plat-mxc/audmux-v1.c64
-rw-r--r--arch/arm/plat-mxc/audmux-v2.c219
-rw-r--r--arch/arm/plat-mxc/avic.c2
-rw-r--r--arch/arm/plat-mxc/cpu.c24
-rw-r--r--arch/arm/plat-mxc/devices/platform-ahci-imx.c16
-rw-r--r--arch/arm/plat-mxc/devices/platform-mx2-camera.c18
-rw-r--r--arch/arm/plat-mxc/epit.c2
-rw-r--r--arch/arm/plat-mxc/include/mach/audmux.h60
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31ads.h33
-rw-r--r--arch/arm/plat-mxc/include/mach/common.h10
-rw-r--r--arch/arm/plat-mxc/include/mach/debug-macro.S2
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/dma.h3
-rw-r--r--arch/arm/plat-mxc/include/mach/entry-macro.S16
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx25.h42
-rw-r--r--arch/arm/plat-mxc/include/mach/system.h25
-rw-r--r--arch/arm/plat-mxc/pwm.c4
-rw-r--r--arch/arm/plat-mxc/system.c2
-rw-r--r--arch/arm/plat-mxc/time.c2
-rw-r--r--arch/arm/plat-nomadik/include/plat/mtu.h4
-rw-r--r--arch/arm/plat-nomadik/timer.c33
-rw-r--r--arch/arm/plat-omap/Kconfig11
-rw-r--r--arch/arm/plat-omap/Makefile2
-rw-r--r--arch/arm/plat-omap/clock.c1
-rw-r--r--arch/arm/plat-omap/common.c2
-rw-r--r--arch/arm/plat-omap/counter_32k.c1
-rw-r--r--arch/arm/plat-omap/dma.c4
-rw-r--r--arch/arm/plat-omap/dmtimer.c21
-rw-r--r--arch/arm/plat-omap/fb.c334
-rw-r--r--arch/arm/plat-omap/fb.h10
-rw-r--r--arch/arm/plat-omap/include/plat/blizzard.h12
-rw-r--r--arch/arm/plat-omap/include/plat/board-ams-delta.h49
-rw-r--r--arch/arm/plat-omap/include/plat/board.h2
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h9
-rw-r--r--arch/arm/plat-omap/include/plat/gpio.h29
-rw-r--r--arch/arm/plat-omap/include/plat/hardware.h6
-rw-r--r--arch/arm/plat-omap/include/plat/hwa742.h8
-rw-r--r--arch/arm/plat-omap/include/plat/keypad.h2
-rw-r--r--arch/arm/plat-omap/include/plat/mcbsp.h333
-rw-r--r--arch/arm/plat-omap/include/plat/mcspi.h3
-rw-r--r--arch/arm/plat-omap/include/plat/omap4-keypad.h9
-rw-r--r--arch/arm/plat-omap/include/plat/omap_device.h9
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h2
-rw-r--r--arch/arm/plat-omap/include/plat/remoteproc.h57
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h1
-rw-r--r--arch/arm/plat-omap/include/plat/sram.h1
-rw-r--r--arch/arm/plat-omap/include/plat/system.h15
-rw-r--r--arch/arm/plat-omap/include/plat/tc.h17
-rw-r--r--arch/arm/plat-omap/include/plat/uncompress.h1
-rw-r--r--arch/arm/plat-omap/include/plat/usb.h41
-rw-r--r--arch/arm/plat-omap/include/plat/vram.h21
-rw-r--r--arch/arm/plat-omap/mailbox.c2
-rw-r--r--arch/arm/plat-omap/mcbsp.c1361
-rw-r--r--arch/arm/plat-omap/mux.c5
-rw-r--r--arch/arm/plat-omap/omap-pm-noop.c2
-rw-r--r--arch/arm/plat-omap/omap_device.c46
-rw-r--r--arch/arm/plat-omap/sram.c23
-rw-r--r--arch/arm/plat-omap/usb.c4
-rw-r--r--arch/arm/plat-s3c24xx/Kconfig57
-rw-r--r--arch/arm/plat-s3c24xx/Makefile19
-rw-r--r--arch/arm/plat-s3c24xx/cpu.c27
-rw-r--r--arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c36
-rw-r--r--arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c38
-rw-r--r--arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c36
-rw-r--r--arch/arm/plat-s5p/Kconfig10
-rw-r--r--arch/arm/plat-s5p/irq-eint.c2
-rw-r--r--arch/arm/plat-s5p/irq-gpioint.c2
-rw-r--r--arch/arm/plat-s5p/sleep.S44
-rw-r--r--arch/arm/plat-samsung/Kconfig4
-rw-r--r--arch/arm/plat-samsung/clock.c12
-rw-r--r--arch/arm/plat-samsung/dev-backlight.c4
-rw-r--r--arch/arm/plat-samsung/devs.c81
-rw-r--r--arch/arm/plat-samsung/dma-ops.c2
-rw-r--r--arch/arm/plat-samsung/include/plat/audio-simtec.h3
-rw-r--r--arch/arm/plat-samsung/include/plat/clock.h22
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/dma-pl330.h16
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-dma.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-fb.h33
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-rtc.h81
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h7
-rw-r--r--arch/arm/plat-samsung/include/plat/rtc-core.h27
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c2410.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c2443.h20
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/udc-hs.h5
-rw-r--r--arch/arm/plat-samsung/platformdata.c2
-rw-r--r--arch/arm/plat-spear/include/plat/keyboard.h66
-rw-r--r--arch/arm/plat-spear/include/plat/system.h26
-rw-r--r--arch/arm/plat-versatile/Makefile1
-rw-r--r--arch/arm/plat-versatile/localtimer.c27
-rw-r--r--arch/avr32/include/asm/io.h1
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c2
-rw-r--r--arch/avr32/mach-at32ap/include/mach/cpu.h3
-rw-r--r--arch/blackfin/Kconfig1
-rw-r--r--arch/blackfin/configs/BF518F-EZBRD_defconfig25
-rw-r--r--arch/blackfin/configs/BF526-EZBRD_defconfig26
-rw-r--r--arch/blackfin/configs/BF527-EZKIT-V2_defconfig27
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig28
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig23
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig22
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig27
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig15
-rw-r--r--arch/blackfin/configs/BF561-EZKIT-SMP_defconfig35
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig23
-rw-r--r--arch/blackfin/include/asm/atomic.h2
-rw-r--r--arch/blackfin/include/asm/barrier.h48
-rw-r--r--arch/blackfin/include/asm/bfin5xx_spi.h1
-rw-r--r--arch/blackfin/include/asm/bfin_simple_timer.h10
-rw-r--r--arch/blackfin/include/asm/bfin_sport.h3
-rw-r--r--arch/blackfin/include/asm/blackfin.h44
-rw-r--r--arch/blackfin/include/asm/cmpxchg.h132
-rw-r--r--arch/blackfin/include/asm/exec.h1
-rw-r--r--arch/blackfin/include/asm/irq.h4
-rw-r--r--arch/blackfin/include/asm/irq_handler.h1
-rw-r--r--arch/blackfin/include/asm/kgdb.h1
-rw-r--r--arch/blackfin/include/asm/mmu_context.h5
-rw-r--r--arch/blackfin/include/asm/switch_to.h39
-rw-r--r--arch/blackfin/include/asm/system.h197
-rw-r--r--arch/blackfin/include/asm/thread_info.h2
-rw-r--r--arch/blackfin/include/asm/unistd.h4
-rw-r--r--arch/blackfin/kernel/Makefile2
-rw-r--r--arch/blackfin/kernel/asm-offsets.c1
-rw-r--r--arch/blackfin/kernel/bfin_dma.c (renamed from arch/blackfin/kernel/bfin_dma_5xx.c)8
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cplbmgr.c2
-rw-r--r--arch/blackfin/kernel/ipipe.c1
-rw-r--r--arch/blackfin/kernel/kgdb_test.c1
-rw-r--r--arch/blackfin/kernel/process.c1
-rw-r--r--arch/blackfin/kernel/ptrace.c1
-rw-r--r--arch/blackfin/kernel/reboot.c1
-rw-r--r--arch/blackfin/kernel/setup.c1
-rw-r--r--arch/blackfin/kernel/trace.c1
-rw-r--r--arch/blackfin/kernel/traps.c1
-rw-r--r--arch/blackfin/lib/ins.S2
-rw-r--r--arch/blackfin/mach-bf537/boards/pnav10.c1
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c24
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c49
-rw-r--r--arch/blackfin/mach-bf561/atomic.S7
-rw-r--r--arch/blackfin/mach-bf561/include/mach/defBF561.h227
-rw-r--r--arch/blackfin/mach-common/entry.S4
-rw-r--r--arch/c6x/include/asm/pgtable.h3
-rw-r--r--arch/hexagon/kernel/signal.c12
-rw-r--r--arch/hexagon/kernel/vdso.c3
-rw-r--r--arch/ia64/include/asm/pci.h6
-rw-r--r--arch/ia64/include/asm/xen/interface.h1
-rw-r--r--arch/ia64/kernel/acpi.c8
-rw-r--r--arch/ia64/kernel/machine_kexec.c2
-rw-r--r--arch/ia64/kernel/mca.c2
-rw-r--r--arch/ia64/pci/pci.c55
-rw-r--r--arch/ia64/sn/kernel/huberror.c2
-rw-r--r--arch/ia64/sn/kernel/io_common.c1
-rw-r--r--arch/ia64/sn/kernel/io_init.c16
-rw-r--r--arch/ia64/sn/kernel/irq.c2
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c1
-rw-r--r--arch/ia64/sn/kernel/tiocx.c7
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c1
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c1
-rw-r--r--arch/ia64/sn/pci/tioce_provider.c1
-rw-r--r--arch/m68k/Kconfig7
-rw-r--r--arch/m68k/include/asm/m5206sim.h10
-rw-r--r--arch/m68k/include/asm/m520xsim.h33
-rw-r--r--arch/m68k/include/asm/m523xsim.h42
-rw-r--r--arch/m68k/include/asm/m5249sim.h18
-rw-r--r--arch/m68k/include/asm/m5272sim.h17
-rw-r--r--arch/m68k/include/asm/m527xsim.h53
-rw-r--r--arch/m68k/include/asm/m528xsim.h40
-rw-r--r--arch/m68k/include/asm/m5307sim.h10
-rw-r--r--arch/m68k/include/asm/m532xsim.h35
-rw-r--r--arch/m68k/include/asm/m5407sim.h6
-rw-r--r--arch/m68k/include/asm/m54xxsim.h16
-rw-r--r--arch/m68k/include/asm/machdep.h5
-rw-r--r--arch/m68k/include/asm/mcfqspi.h11
-rw-r--r--arch/m68k/include/asm/mcfuart.h5
-rw-r--r--arch/m68k/include/asm/system.h1
-rw-r--r--arch/m68k/kernel/process.c377
-rw-r--r--arch/m68k/kernel/process_mm.c367
-rw-r--r--arch/m68k/kernel/process_no.c404
-rw-r--r--arch/m68k/kernel/ptrace.c306
-rw-r--r--arch/m68k/kernel/ptrace_mm.c295
-rw-r--r--arch/m68k/kernel/ptrace_no.c255
-rw-r--r--arch/m68k/kernel/setup_no.c3
-rw-r--r--arch/m68k/kernel/time.c116
-rw-r--r--arch/m68k/kernel/time_mm.c114
-rw-r--r--arch/m68k/kernel/time_no.c90
-rw-r--r--arch/m68k/kernel/vmlinux-nommu.lds200
-rw-r--r--arch/m68k/platform/5206/config.c91
-rw-r--r--arch/m68k/platform/520x/config.c256
-rw-r--r--arch/m68k/platform/523x/config.c235
-rw-r--r--arch/m68k/platform/5249/config.c244
-rw-r--r--arch/m68k/platform/5272/config.c84
-rw-r--r--arch/m68k/platform/527x/config.c296
-rw-r--r--arch/m68k/platform/528x/config.c230
-rw-r--r--arch/m68k/platform/5307/config.c91
-rw-r--r--arch/m68k/platform/532x/config.c221
-rw-r--r--arch/m68k/platform/5407/config.c91
-rw-r--r--arch/m68k/platform/54xx/config.c77
-rw-r--r--arch/m68k/platform/68328/config.c5
-rw-r--r--arch/m68k/platform/68328/ints.c2
-rw-r--r--arch/m68k/platform/68328/timers.c18
-rw-r--r--arch/m68k/platform/68360/config.c8
-rw-r--r--arch/m68k/platform/68360/ints.c2
-rw-r--r--arch/m68k/platform/68EZ328/config.c5
-rw-r--r--arch/m68k/platform/68VZ328/config.c5
-rw-r--r--arch/m68k/platform/coldfire/Makefile22
-rw-r--r--arch/m68k/platform/coldfire/device.c318
-rw-r--r--arch/m68k/platform/coldfire/head.S4
-rw-r--r--arch/m68k/platform/coldfire/pit.c2
-rw-r--r--arch/m68k/platform/coldfire/reset.c50
-rw-r--r--arch/m68k/platform/coldfire/sltimers.c7
-rw-r--r--arch/m68k/platform/coldfire/timers.c27
-rw-r--r--arch/m68k/platform/coldfire/vectors.c2
-rw-r--r--arch/m68k/q40/config.c13
-rw-r--r--arch/microblaze/include/asm/pci-bridge.h1
-rw-r--r--arch/microblaze/include/asm/pci.h8
-rw-r--r--arch/microblaze/include/asm/pgtable.h2
-rw-r--r--arch/microblaze/pci/pci-common.c117
-rw-r--r--arch/mips/fw/arc/cmdline.c1
-rw-r--r--arch/mips/fw/arc/identify.c1
-rw-r--r--arch/mips/include/asm/mman.h4
-rw-r--r--arch/mips/include/asm/pci.h9
-rw-r--r--arch/mips/jz4740/board-qi_lb60.c6
-rw-r--r--arch/mips/kernel/vdso.c3
-rw-r--r--arch/mips/pci/fixup-cobalt.c61
-rw-r--r--arch/mips/pci/pci-bcm1480.c2
-rw-r--r--arch/mips/pci/pci-ip27.c2
-rw-r--r--arch/mips/pci/pci-lantiq.c3
-rw-r--r--arch/mips/pci/pci-sb1250.c2
-rw-r--r--arch/mips/pci/pci-xlr.c2
-rw-r--r--arch/mips/pci/pci.c86
-rw-r--r--arch/mn10300/Kconfig1
-rw-r--r--arch/mn10300/include/asm/pci.h16
-rw-r--r--arch/mn10300/include/asm/reset-regs.h4
-rw-r--r--arch/mn10300/unit-asb2305/pci.c62
-rw-r--r--arch/openrisc/Kconfig1
-rw-r--r--arch/openrisc/include/asm/page.h6
-rw-r--r--arch/openrisc/include/asm/pgtable.h1
-rw-r--r--arch/openrisc/include/asm/processor.h4
-rw-r--r--arch/openrisc/include/asm/ptrace.h6
-rw-r--r--arch/openrisc/include/asm/syscall.h7
-rw-r--r--arch/openrisc/include/asm/uaccess.h1
-rw-r--r--arch/openrisc/kernel/entry.S16
-rw-r--r--arch/openrisc/kernel/head.S17
-rw-r--r--arch/openrisc/kernel/ptrace.c4
-rw-r--r--arch/openrisc/kernel/setup.c18
-rw-r--r--arch/openrisc/kernel/signal.c47
-rw-r--r--arch/openrisc/kernel/time.c13
-rw-r--r--arch/openrisc/kernel/traps.c9
-rw-r--r--arch/openrisc/mm/init.c3
-rw-r--r--arch/parisc/include/asm/mman.h4
-rw-r--r--arch/parisc/include/asm/pci.h38
-rw-r--r--arch/parisc/kernel/pci.c52
-rw-r--r--arch/parisc/math-emu/fpudispatch.c1
-rw-r--r--arch/powerpc/Kconfig18
-rw-r--r--arch/powerpc/Kconfig.debug7
-rw-r--r--arch/powerpc/Makefile1
-rw-r--r--arch/powerpc/boot/Makefile11
-rw-r--r--arch/powerpc/boot/dts/a4m072.dts168
-rw-r--r--arch/powerpc/boot/dts/bluestone.dts127
-rw-r--r--arch/powerpc/boot/dts/fsl/mpc8536si-post.dtsi4
-rw-r--r--arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi16
-rw-r--r--arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi4
-rw-r--r--arch/powerpc/boot/dts/fsl/p1010si-post.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p1020si-post.dtsi6
-rw-r--r--arch/powerpc/boot/dts/fsl/p1021si-post.dtsi7
-rw-r--r--arch/powerpc/boot/dts/fsl/p1022si-post.dtsi12
-rw-r--r--arch/powerpc/boot/dts/fsl/p1023si-post.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p2020si-post.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p2041si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/p3041si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/p3060si-post.dtsi6
-rw-r--r--arch/powerpc/boot/dts/fsl/p5020si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/pq3-etsec1-0.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/pq3-etsec1-1.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/pq3-etsec1-2.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/pq3-etsec1-3.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi10
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-mpic.dtsi6
-rw-r--r--arch/powerpc/boot/dts/ge_imp3a.dts255
-rw-r--r--arch/powerpc/boot/dts/mpc836x_mds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds.dts6
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds.dtsi93
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds_36b.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc8548cds.dts306
-rw-r--r--arch/powerpc/boot/dts/mpc8548cds.dtsi306
-rw-r--r--arch/powerpc/boot/dts/mpc8548cds_32b.dts86
-rw-r--r--arch/powerpc/boot/dts/mpc8548cds_36b.dts86
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds.dtsi50
-rw-r--r--arch/powerpc/boot/dts/p1010rdb.dtsi4
-rw-r--r--arch/powerpc/boot/dts/p1020rdb-pc.dtsi247
-rw-r--r--arch/powerpc/boot/dts/p1020rdb-pc_32b.dts90
-rw-r--r--arch/powerpc/boot/dts/p1020rdb-pc_36b.dts90
-rw-r--r--arch/powerpc/boot/dts/p1020rdb-pc_camp_core0.dts64
-rw-r--r--arch/powerpc/boot/dts/p1020rdb-pc_camp_core1.dts142
-rw-r--r--arch/powerpc/boot/dts/p1021rdb.dts96
-rw-r--r--arch/powerpc/boot/dts/p1021rdb.dtsi236
-rw-r--r--arch/powerpc/boot/dts/p1021rdb_36b.dts96
-rw-r--r--arch/powerpc/boot/dts/p1022ds.dts274
-rw-r--r--arch/powerpc/boot/dts/p1022ds.dtsi234
-rw-r--r--arch/powerpc/boot/dts/p1022ds_32b.dts103
-rw-r--r--arch/powerpc/boot/dts/p1022ds_36b.dts103
-rw-r--r--arch/powerpc/boot/dts/p1025rdb.dtsi286
-rw-r--r--arch/powerpc/boot/dts/p1025rdb_32b.dts135
-rw-r--r--arch/powerpc/boot/dts/p1025rdb_36b.dts88
-rw-r--r--arch/powerpc/boot/dts/p2020rdb-pc.dtsi241
-rw-r--r--arch/powerpc/boot/dts/p2020rdb-pc_32b.dts96
-rw-r--r--arch/powerpc/boot/dts/p2020rdb-pc_36b.dts96
-rw-r--r--arch/powerpc/boot/dts/p2020rdb.dts4
-rwxr-xr-xarch/powerpc/boot/wrapper22
-rw-r--r--arch/powerpc/configs/85xx/ge_imp3a_defconfig257
-rw-r--r--arch/powerpc/configs/86xx/gef_ppc9a_defconfig1
-rw-r--r--arch/powerpc/configs/86xx/gef_sbc310_defconfig1
-rw-r--r--arch/powerpc/configs/86xx/gef_sbc610_defconfig2
-rw-r--r--arch/powerpc/configs/iseries_defconfig236
-rw-r--r--arch/powerpc/configs/mpc5200_defconfig27
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig1
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig1
-rw-r--r--arch/powerpc/include/asm/abs_addr.h21
-rw-r--r--arch/powerpc/include/asm/atomic.h59
-rw-r--r--arch/powerpc/include/asm/cputable.h12
-rw-r--r--arch/powerpc/include/asm/device.h3
-rw-r--r--arch/powerpc/include/asm/dma.h4
-rw-r--r--arch/powerpc/include/asm/eeh.h134
-rw-r--r--arch/powerpc/include/asm/eeh_event.h33
-rw-r--r--arch/powerpc/include/asm/exception-64s.h113
-rw-r--r--arch/powerpc/include/asm/fadump.h218
-rw-r--r--arch/powerpc/include/asm/firmware.h9
-rw-r--r--arch/powerpc/include/asm/fsl_guts.h6
-rw-r--r--arch/powerpc/include/asm/hw_irq.h63
-rw-r--r--arch/powerpc/include/asm/irqflags.h37
-rw-r--r--arch/powerpc/include/asm/iseries/alpaca.h31
-rw-r--r--arch/powerpc/include/asm/iseries/hv_call.h111
-rw-r--r--arch/powerpc/include/asm/iseries/hv_call_event.h201
-rw-r--r--arch/powerpc/include/asm/iseries/hv_call_sc.h50
-rw-r--r--arch/powerpc/include/asm/iseries/hv_call_xm.h61
-rw-r--r--arch/powerpc/include/asm/iseries/hv_lp_config.h128
-rw-r--r--arch/powerpc/include/asm/iseries/hv_lp_event.h162
-rw-r--r--arch/powerpc/include/asm/iseries/hv_types.h112
-rw-r--r--arch/powerpc/include/asm/iseries/iommu.h37
-rw-r--r--arch/powerpc/include/asm/iseries/it_lp_queue.h78
-rw-r--r--arch/powerpc/include/asm/iseries/lpar_map.h85
-rw-r--r--arch/powerpc/include/asm/iseries/mf.h51
-rw-r--r--arch/powerpc/include/asm/iseries/vio.h265
-rw-r--r--arch/powerpc/include/asm/lppaca.h8
-rw-r--r--arch/powerpc/include/asm/mpic.h9
-rw-r--r--arch/powerpc/include/asm/mpic_msgr.h132
-rw-r--r--arch/powerpc/include/asm/paca.h2
-rw-r--r--arch/powerpc/include/asm/pci.h9
-rw-r--r--arch/powerpc/include/asm/phyp_dump.h47
-rw-r--r--arch/powerpc/include/asm/ppc-pci.h91
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h2
-rw-r--r--arch/powerpc/include/asm/reg.h22
-rw-r--r--arch/powerpc/include/asm/reg_booke.h1
-rw-r--r--arch/powerpc/include/asm/spinlock.h5
-rw-r--r--arch/powerpc/include/asm/system.h38
-rw-r--r--arch/powerpc/include/asm/thread_info.h9
-rw-r--r--arch/powerpc/include/asm/time.h15
-rw-r--r--arch/powerpc/kernel/Makefile10
-rw-r--r--arch/powerpc/kernel/asm-offsets.c16
-rw-r--r--arch/powerpc/kernel/cputable.c20
-rw-r--r--arch/powerpc/kernel/dbell.c2
-rw-r--r--arch/powerpc/kernel/entry_64.S250
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S236
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S314
-rw-r--r--arch/powerpc/kernel/fadump.c1315
-rw-r--r--arch/powerpc/kernel/head_32.S4
-rw-r--r--arch/powerpc/kernel/head_40x.S4
-rw-r--r--arch/powerpc/kernel/head_64.S62
-rw-r--r--arch/powerpc/kernel/head_8xx.S4
-rw-r--r--arch/powerpc/kernel/head_booke.h4
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S2
-rw-r--r--arch/powerpc/kernel/idle.c6
-rw-r--r--arch/powerpc/kernel/idle_book3e.S25
-rw-r--r--arch/powerpc/kernel/idle_power4.S24
-rw-r--r--arch/powerpc/kernel/idle_power7.S23
-rw-r--r--arch/powerpc/kernel/iommu.c8
-rw-r--r--arch/powerpc/kernel/irq.c212
-rw-r--r--arch/powerpc/kernel/isa-bridge.c3
-rw-r--r--arch/powerpc/kernel/lparcfg.c108
-rw-r--r--arch/powerpc/kernel/misc.S1
-rw-r--r--arch/powerpc/kernel/of_platform.c6
-rw-r--r--arch/powerpc/kernel/paca.c12
-rw-r--r--arch/powerpc/kernel/pci-common.c101
-rw-r--r--arch/powerpc/kernel/pci_32.c6
-rw-r--r--arch/powerpc/kernel/pci_64.c7
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c12
-rw-r--r--arch/powerpc/kernel/pmc.c1
-rw-r--r--arch/powerpc/kernel/process.c27
-rw-r--r--arch/powerpc/kernel/prom.c98
-rw-r--r--arch/powerpc/kernel/prom_init.c15
-rw-r--r--arch/powerpc/kernel/rtas_pci.c13
-rw-r--r--arch/powerpc/kernel/setup-common.c14
-rw-r--r--arch/powerpc/kernel/signal.c13
-rw-r--r--arch/powerpc/kernel/signal_32.c11
-rw-r--r--arch/powerpc/kernel/sysfs.c7
-rw-r--r--arch/powerpc/kernel/time.c116
-rw-r--r--arch/powerpc/kernel/traps.c6
-rw-r--r--arch/powerpc/kernel/vdso.c10
-rw-r--r--arch/powerpc/kernel/vio.c18
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S5
-rw-r--r--arch/powerpc/kvm/book3s_hv.c1
-rw-r--r--arch/powerpc/lib/locks.c24
-rw-r--r--arch/powerpc/mm/fault.c181
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c19
-rw-r--r--arch/powerpc/mm/hash_utils_64.c20
-rw-r--r--arch/powerpc/mm/icswx.c23
-rw-r--r--arch/powerpc/mm/icswx.h6
-rw-r--r--arch/powerpc/mm/pgtable_32.c2
-rw-r--r--arch/powerpc/mm/slb.c6
-rw-r--r--arch/powerpc/mm/slb_low.S16
-rw-r--r--arch/powerpc/mm/stab.c9
-rw-r--r--arch/powerpc/oprofile/common.c3
-rw-r--r--arch/powerpc/perf/Makefile14
-rw-r--r--arch/powerpc/perf/callchain.c (renamed from arch/powerpc/kernel/perf_callchain.c)2
-rw-r--r--arch/powerpc/perf/core-book3s.c (renamed from arch/powerpc/kernel/perf_event.c)0
-rw-r--r--arch/powerpc/perf/core-fsl-emb.c (renamed from arch/powerpc/kernel/perf_event_fsl_emb.c)0
-rw-r--r--arch/powerpc/perf/e500-pmu.c (renamed from arch/powerpc/kernel/e500-pmu.c)0
-rw-r--r--arch/powerpc/perf/mpc7450-pmu.c (renamed from arch/powerpc/kernel/mpc7450-pmu.c)0
-rw-r--r--arch/powerpc/perf/power4-pmu.c (renamed from arch/powerpc/kernel/power4-pmu.c)0
-rw-r--r--arch/powerpc/perf/power5+-pmu.c (renamed from arch/powerpc/kernel/power5+-pmu.c)0
-rw-r--r--arch/powerpc/perf/power5-pmu.c (renamed from arch/powerpc/kernel/power5-pmu.c)0
-rw-r--r--arch/powerpc/perf/power6-pmu.c (renamed from arch/powerpc/kernel/power6-pmu.c)2
-rw-r--r--arch/powerpc/perf/power7-pmu.c (renamed from arch/powerpc/kernel/power7-pmu.c)0
-rw-r--r--arch/powerpc/perf/ppc970-pmu.c (renamed from arch/powerpc/kernel/ppc970-pmu.c)2
-rw-r--r--arch/powerpc/platforms/44x/Kconfig1
-rw-r--r--arch/powerpc/platforms/44x/currituck.c2
-rw-r--r--arch/powerpc/platforms/44x/iss4xx.c3
-rw-r--r--arch/powerpc/platforms/44x/ppc44x_simple.c2
-rw-r--r--arch/powerpc/platforms/52xx/mpc5200_simple.c1
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c10
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig27
-rw-r--r--arch/powerpc/platforms/85xx/Makefile1
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.c4
-rw-r--r--arch/powerpc/platforms/85xx/ge_imp3a.c246
-rw-r--r--arch/powerpc/platforms/85xx/ksi8560.c3
-rw-r--r--arch/powerpc/platforms/85xx/mpc8536_ds.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c3
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c84
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c6
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c40
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_rdb.c222
-rw-r--r--arch/powerpc/platforms/85xx/p1010rdb.c5
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c207
-rw-r--r--arch/powerpc/platforms/85xx/p1023_rds.c5
-rw-r--r--arch/powerpc/platforms/85xx/sbc8548.c3
-rw-r--r--arch/powerpc/platforms/85xx/sbc8560.c3
-rw-r--r--arch/powerpc/platforms/85xx/socrates.c3
-rw-r--r--arch/powerpc/platforms/85xx/stx_gp3.c3
-rw-r--r--arch/powerpc/platforms/85xx/tqm85xx.c2
-rw-r--r--arch/powerpc/platforms/85xx/xes_mpc85xx.c4
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig3
-rw-r--r--arch/powerpc/platforms/86xx/Makefile7
-rw-r--r--arch/powerpc/platforms/86xx/gef_gpio.c171
-rw-r--r--arch/powerpc/platforms/86xx/gef_ppc9a.c2
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc310.c2
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc610.c2
-rw-r--r--arch/powerpc/platforms/86xx/pic.c5
-rw-r--r--arch/powerpc/platforms/Kconfig11
-rw-r--r--arch/powerpc/platforms/Makefile1
-rw-r--r--arch/powerpc/platforms/cell/setup.c3
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c15
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c2
-rw-r--r--arch/powerpc/platforms/chrp/setup.c3
-rw-r--r--arch/powerpc/platforms/embedded6xx/holly.c6
-rw-r--r--arch/powerpc/platforms/embedded6xx/linkstation.c3
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c6
-rw-r--r--arch/powerpc/platforms/embedded6xx/storcenter.c3
-rw-r--r--arch/powerpc/platforms/iseries/Kconfig39
-rw-r--r--arch/powerpc/platforms/iseries/Makefile9
-rw-r--r--arch/powerpc/platforms/iseries/call_hpt.h102
-rw-r--r--arch/powerpc/platforms/iseries/call_pci.h309
-rw-r--r--arch/powerpc/platforms/iseries/call_sm.h37
-rw-r--r--arch/powerpc/platforms/iseries/dt.c643
-rw-r--r--arch/powerpc/platforms/iseries/exception.S311
-rw-r--r--arch/powerpc/platforms/iseries/exception.h58
-rw-r--r--arch/powerpc/platforms/iseries/htab.c257
-rw-r--r--arch/powerpc/platforms/iseries/hvcall.S94
-rw-r--r--arch/powerpc/platforms/iseries/hvlog.c35
-rw-r--r--arch/powerpc/platforms/iseries/hvlpconfig.c39
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c260
-rw-r--r--arch/powerpc/platforms/iseries/ipl_parms.h68
-rw-r--r--arch/powerpc/platforms/iseries/irq.c399
-rw-r--r--arch/powerpc/platforms/iseries/irq.h13
-rw-r--r--arch/powerpc/platforms/iseries/it_exp_vpd_panel.h51
-rw-r--r--arch/powerpc/platforms/iseries/it_lp_naca.h80
-rw-r--r--arch/powerpc/platforms/iseries/ksyms.c21
-rw-r--r--arch/powerpc/platforms/iseries/lpardata.c318
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c341
-rw-r--r--arch/powerpc/platforms/iseries/main_store.h165
-rw-r--r--arch/powerpc/platforms/iseries/mf.c1275
-rw-r--r--arch/powerpc/platforms/iseries/misc.S26
-rw-r--r--arch/powerpc/platforms/iseries/naca.h24
-rw-r--r--arch/powerpc/platforms/iseries/pci.c919
-rw-r--r--arch/powerpc/platforms/iseries/pci.h58
-rw-r--r--arch/powerpc/platforms/iseries/proc.c120
-rw-r--r--arch/powerpc/platforms/iseries/processor_vpd.h85
-rw-r--r--arch/powerpc/platforms/iseries/release_data.h63
-rw-r--r--arch/powerpc/platforms/iseries/setup.c718
-rw-r--r--arch/powerpc/platforms/iseries/setup.h27
-rw-r--r--arch/powerpc/platforms/iseries/smp.c88
-rw-r--r--arch/powerpc/platforms/iseries/spcomm_area.h34
-rw-r--r--arch/powerpc/platforms/iseries/vio.c556
-rw-r--r--arch/powerpc/platforms/iseries/viopath.c677
-rw-r--r--arch/powerpc/platforms/iseries/vpd_areas.h88
-rw-r--r--arch/powerpc/platforms/maple/pci.c2
-rw-r--r--arch/powerpc/platforms/maple/setup.c2
-rw-r--r--arch/powerpc/platforms/pasemi/pci.c3
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c2
-rw-r--r--arch/powerpc/platforms/powermac/nvram.c42
-rw-r--r--arch/powerpc/platforms/powermac/pci.c3
-rw-r--r--arch/powerpc/platforms/powermac/pic.c1
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c5
-rw-r--r--arch/powerpc/platforms/powernv/pci.c6
-rw-r--r--arch/powerpc/platforms/powernv/setup.c1
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig2
-rw-r--r--arch/powerpc/platforms/pseries/Makefile4
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c1044
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c44
-rw-r--r--arch/powerpc/platforms/pseries/eeh_dev.c102
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c213
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c55
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pseries.c565
-rw-r--r--arch/powerpc/platforms/pseries/eeh_sysfs.c25
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c1
-rw-r--r--arch/powerpc/platforms/pseries/msi.c2
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c5
-rw-r--r--arch/powerpc/platforms/pseries/phyp_dump.c513
-rw-r--r--arch/powerpc/platforms/pseries/processor_idle.c18
-rw-r--r--arch/powerpc/platforms/pseries/setup.c15
-rw-r--r--arch/powerpc/platforms/wsp/wsp_pci.c1
-rw-r--r--arch/powerpc/sysdev/Kconfig4
-rw-r--r--arch/powerpc/sysdev/Makefile4
-rw-r--r--arch/powerpc/sysdev/fsl_85xx_cache_sram.c1
-rw-r--r--arch/powerpc/sysdev/fsl_85xx_l2ctlr.c4
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c1
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c4
-rw-r--r--arch/powerpc/sysdev/fsl_rmu.c42
-rw-r--r--arch/powerpc/sysdev/ge/Makefile1
-rw-r--r--arch/powerpc/sysdev/ge/ge_pic.c (renamed from arch/powerpc/platforms/86xx/gef_pic.c)2
-rw-r--r--arch/powerpc/sysdev/ge/ge_pic.h (renamed from arch/powerpc/platforms/86xx/gef_pic.h)0
-rw-r--r--arch/powerpc/sysdev/mpic.c104
-rw-r--r--arch/powerpc/sysdev/mpic_msgr.c282
-rw-r--r--arch/powerpc/sysdev/mpic_msi.c4
-rw-r--r--arch/powerpc/sysdev/ppc4xx_pci.c70
-rw-r--r--arch/powerpc/xmon/ppc-opc.c1
-rw-r--r--arch/powerpc/xmon/spu-opc.c1
-rw-r--r--arch/powerpc/xmon/xmon.c33
-rw-r--r--arch/s390/hypfs/inode.c6
-rw-r--r--arch/s390/include/asm/cputime.h9
-rw-r--r--arch/s390/include/asm/debug.h1
-rw-r--r--arch/s390/include/asm/hardirq.h1
-rw-r--r--arch/s390/include/asm/ipl.h1
-rw-r--r--arch/s390/include/asm/irq.h7
-rw-r--r--arch/s390/include/asm/lowcore.h119
-rw-r--r--arch/s390/include/asm/os_info.h50
-rw-r--r--arch/s390/include/asm/sigp.h132
-rw-r--r--arch/s390/include/asm/smp.h63
-rw-r--r--arch/s390/include/asm/system.h34
-rw-r--r--arch/s390/include/asm/timer.h4
-rw-r--r--arch/s390/include/asm/vdso.h4
-rw-r--r--arch/s390/kernel/Makefile4
-rw-r--r--arch/s390/kernel/asm-offsets.c27
-rw-r--r--arch/s390/kernel/compat_signal.c6
-rw-r--r--arch/s390/kernel/crash_dump.c37
-rw-r--r--arch/s390/kernel/debug.c40
-rw-r--r--arch/s390/kernel/early.c22
-rw-r--r--arch/s390/kernel/entry.S159
-rw-r--r--arch/s390/kernel/entry.h17
-rw-r--r--arch/s390/kernel/entry64.S139
-rw-r--r--arch/s390/kernel/ipl.c99
-rw-r--r--arch/s390/kernel/irq.c14
-rw-r--r--arch/s390/kernel/lgr.c200
-rw-r--r--arch/s390/kernel/machine_kexec.c52
-rw-r--r--arch/s390/kernel/nmi.c2
-rw-r--r--arch/s390/kernel/os_info.c169
-rw-r--r--arch/s390/kernel/process.c7
-rw-r--r--arch/s390/kernel/setup.c61
-rw-r--r--arch/s390/kernel/signal.c6
-rw-r--r--arch/s390/kernel/smp.c1147
-rw-r--r--arch/s390/kernel/switch_cpu.S58
-rw-r--r--arch/s390/kernel/switch_cpu64.S51
-rw-r--r--arch/s390/kernel/swsusp_asm64.S19
-rw-r--r--arch/s390/kernel/time.c4
-rw-r--r--arch/s390/kernel/topology.c8
-rw-r--r--arch/s390/kernel/traps.c6
-rw-r--r--arch/s390/kernel/vdso.c38
-rw-r--r--arch/s390/kernel/vtime.c168
-rw-r--r--arch/s390/kvm/interrupt.c6
-rw-r--r--arch/s390/lib/delay.c31
-rw-r--r--arch/s390/lib/spinlock.c30
-rw-r--r--arch/s390/mm/fault.c4
-rw-r--r--arch/s390/oprofile/hwsampler.c6
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c22
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c24
-rw-r--r--arch/sh/boards/mach-highlander/setup.c2
-rw-r--r--arch/sh/boards/mach-kfr2r09/lcd_wqvga.c10
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c8
-rw-r--r--arch/sh/boards/mach-migor/lcd_qvga.c3
-rw-r--r--arch/sh/boards/mach-migor/setup.c16
-rw-r--r--arch/sh/boards/mach-sdk7786/setup.c2
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c16
-rw-r--r--arch/sh/drivers/pci/pci.c75
-rw-r--r--arch/sh/include/asm/clock.h2
-rw-r--r--arch/sh/include/asm/pci.h6
-rw-r--r--arch/sh/include/mach-kfr2r09/mach/kfr2r09.h16
-rw-r--r--arch/sh/include/mach-migor/mach/migor.h2
-rw-r--r--arch/sh/kernel/cpu/sh2/clock-sh7619.c12
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7201.c12
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7203.c12
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7206.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh3.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7705.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7706.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7709.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7710.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7712.c10
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh4-202.c6
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh4.c12
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7343.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7366.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7723.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7724.c6
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7757.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7763.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7770.c12
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7780.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7785.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7786.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-shx3.c2
-rw-r--r--arch/sh/kernel/cpu/sh5/clock-sh5.c12
-rw-r--r--arch/sh/kernel/vsyscall/vsyscall.c3
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/include/asm/irq_64.h1
-rw-r--r--arch/sparc/include/asm/pci_32.h8
-rw-r--r--arch/sparc/include/asm/pci_64.h8
-rw-r--r--arch/sparc/include/asm/vga.h1
-rw-r--r--arch/sparc/kernel/leon_pci.c47
-rw-r--r--arch/sparc/kernel/pci.c106
-rw-r--r--arch/sparc/kernel/signal32.c7
-rw-r--r--arch/sparc/kernel/signal_32.c7
-rw-r--r--arch/sparc/kernel/signal_64.c6
-rw-r--r--arch/tile/mm/elf.c8
-rw-r--r--arch/um/include/asm/mmu.h2
-rw-r--r--arch/um/include/asm/mmu_context.h11
-rw-r--r--arch/um/kernel/signal.c26
-rw-r--r--arch/um/kernel/skas/mmu.c25
-rw-r--r--arch/unicore32/include/asm/pci.h1
-rw-r--r--arch/unicore32/kernel/pci.c5
-rw-r--r--arch/unicore32/kernel/process.c2
-rw-r--r--arch/x86/Kconfig28
-rw-r--r--arch/x86/Kconfig.cpu5
-rw-r--r--arch/x86/boot/Makefile3
-rw-r--r--arch/x86/boot/boot.h2
-rw-r--r--arch/x86/boot/compressed/Makefile1
-rw-r--r--arch/x86/boot/compressed/eboot.c8
-rw-r--r--arch/x86/boot/compressed/mkpiggy.c11
-rw-r--r--arch/x86/boot/compressed/relocs.c6
-rw-r--r--arch/x86/boot/tools/build.c40
-rw-r--r--arch/x86/crypto/camellia_glue.c4
-rw-r--r--arch/x86/crypto/twofish_glue_3way.c4
-rw-r--r--arch/x86/ia32/ia32_aout.c4
-rw-r--r--arch/x86/ia32/ia32_signal.c1
-rw-r--r--arch/x86/include/asm/alternative.h6
-rw-r--r--arch/x86/include/asm/apic.h6
-rw-r--r--arch/x86/include/asm/atomic64_32.h146
-rw-r--r--arch/x86/include/asm/cpufeature.h3
-rw-r--r--arch/x86/include/asm/debugreg.h67
-rw-r--r--arch/x86/include/asm/efi.h2
-rw-r--r--arch/x86/include/asm/fpu-internal.h520
-rw-r--r--arch/x86/include/asm/i387.h590
-rw-r--r--arch/x86/include/asm/kgdb.h10
-rw-r--r--arch/x86/include/asm/mce.h2
-rw-r--r--arch/x86/include/asm/mrst.h4
-rw-r--r--arch/x86/include/asm/paravirt.h1
-rw-r--r--arch/x86/include/asm/processor.h64
-rw-r--r--arch/x86/include/asm/spinlock.h4
-rw-r--r--arch/x86/include/asm/spinlock_types.h1
-rw-r--r--arch/x86/include/asm/xen/interface.h1
-rw-r--r--arch/x86/kernel/acpi/boot.c2
-rw-r--r--arch/x86/kernel/apic/apic_flat_64.c2
-rw-r--r--arch/x86/kernel/apic/apic_noop.c1
-rw-r--r--arch/x86/kernel/apic/apic_numachip.c10
-rw-r--r--arch/x86/kernel/apic/bigsmp_32.c1
-rw-r--r--arch/x86/kernel/apic/es7000_32.c2
-rw-r--r--arch/x86/kernel/apic/io_apic.c40
-rw-r--r--arch/x86/kernel/apic/numaq_32.c1
-rw-r--r--arch/x86/kernel/apic/probe_32.c1
-rw-r--r--arch/x86/kernel/apic/summit_32.c1
-rw-r--r--arch/x86/kernel/apic/x2apic_cluster.c1
-rw-r--r--arch/x86/kernel/apic/x2apic_phys.c1
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c1
-rw-r--r--arch/x86/kernel/cpu/common.c18
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-severity.c26
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c195
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c9
-rw-r--r--arch/x86/kernel/cpu/perf_event.c4
-rw-r--r--arch/x86/kernel/dumpstack_32.c2
-rw-r--r--arch/x86/kernel/entry_32.S17
-rw-r--r--arch/x86/kernel/entry_64.S73
-rw-r--r--arch/x86/kernel/i387.c83
-rw-r--r--arch/x86/kernel/irqinit.c6
-rw-r--r--arch/x86/kernel/kgdb.c6
-rw-r--r--arch/x86/kernel/nmi_selftest.c37
-rw-r--r--arch/x86/kernel/paravirt.c1
-rw-r--r--arch/x86/kernel/pci-dma.c5
-rw-r--r--arch/x86/kernel/probe_roms.c1
-rw-r--r--arch/x86/kernel/process.c1
-rw-r--r--arch/x86/kernel/process_32.c1
-rw-r--r--arch/x86/kernel/process_64.c2
-rw-r--r--arch/x86/kernel/ptrace.c1
-rw-r--r--arch/x86/kernel/setup.c10
-rw-r--r--arch/x86/kernel/signal.c1
-rw-r--r--arch/x86/kernel/smpboot.c9
-rw-r--r--arch/x86/kernel/sys_x86_64.c34
-rw-r--r--arch/x86/kernel/traps.c1
-rw-r--r--arch/x86/kernel/vm86_32.c2
-rw-r--r--arch/x86/kernel/xsave.c1
-rw-r--r--arch/x86/kvm/vmx.c2
-rw-r--r--arch/x86/kvm/x86.c1
-rw-r--r--arch/x86/lib/atomic64_32.c59
-rw-r--r--arch/x86/lib/atomic64_386_32.S6
-rw-r--r--arch/x86/lib/atomic64_cx8_32.S29
-rw-r--r--arch/x86/lib/copy_page_64.S12
-rw-r--r--arch/x86/lib/memcpy_64.S44
-rw-r--r--arch/x86/lib/memset_64.S33
-rw-r--r--arch/x86/mm/hugetlbpage.c28
-rw-r--r--arch/x86/mm/kmemcheck/selftest.c1
-rw-r--r--arch/x86/mm/numa_emulation.c4
-rw-r--r--arch/x86/pci/acpi.c7
-rw-r--r--arch/x86/pci/fixup.c12
-rw-r--r--arch/x86/pci/i386.c85
-rw-r--r--arch/x86/pci/mrst.c40
-rw-r--r--arch/x86/pci/xen.c27
-rw-r--r--arch/x86/platform/efi/efi.c377
-rw-r--r--arch/x86/platform/geode/Makefile1
-rw-r--r--arch/x86/platform/geode/alix.c76
-rw-r--r--arch/x86/platform/geode/net5501.c154
-rw-r--r--arch/x86/platform/mrst/Makefile1
-rw-r--r--arch/x86/platform/mrst/mrst.c86
-rw-r--r--arch/x86/platform/mrst/pmu.c817
-rw-r--r--arch/x86/platform/mrst/pmu.h234
-rw-r--r--arch/x86/platform/olpc/olpc-xo15-sci.c72
-rw-r--r--arch/x86/platform/uv/uv_time.c6
-rw-r--r--arch/x86/power/cpu.c1
-rw-r--r--arch/x86/syscalls/syscall_32.tbl2
-rw-r--r--arch/x86/um/mem_32.c8
-rw-r--r--arch/x86/um/vdso/vma.c3
-rw-r--r--arch/x86/vdso/vdso32-setup.c17
-rw-r--r--arch/x86/vdso/vma.c3
-rw-r--r--arch/x86/xen/enlighten.c99
-rw-r--r--arch/x86/xen/irq.c8
-rw-r--r--arch/x86/xen/mmu.c20
-rw-r--r--arch/x86/xen/multicalls.h2
-rw-r--r--arch/x86/xen/setup.c3
-rw-r--r--arch/x86/xen/smp.c8
-rw-r--r--arch/xtensa/include/asm/mman.h4
-rw-r--r--arch/xtensa/kernel/pci.c17
-rw-r--r--arch/xtensa/kernel/signal.c35
1654 files changed, 37314 insertions, 39094 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 5b448a74d0f..a6f14f622d1 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -120,6 +120,9 @@ config HAVE_KRETPROBES
120 120
121config HAVE_OPTPROBES 121config HAVE_OPTPROBES
122 bool 122 bool
123
124config HAVE_NMI_WATCHDOG
125 bool
123# 126#
124# An arch should select this if it provides all these things: 127# An arch should select this if it provides all these things:
125# 128#
diff --git a/arch/alpha/include/asm/mman.h b/arch/alpha/include/asm/mman.h
index 72db984f878..cbeb3616a28 100644
--- a/arch/alpha/include/asm/mman.h
+++ b/arch/alpha/include/asm/mman.h
@@ -56,6 +56,10 @@
56#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ 56#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
57#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ 57#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
58 58
59#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
60 overrides the coredump filter bits */
61#define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */
62
59/* compatibility flags */ 63/* compatibility flags */
60#define MAP_FILE 0 64#define MAP_FILE 0
61 65
diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index 28d0497fd3c..d01afb78919 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -7,6 +7,7 @@
7#include <linux/dma-mapping.h> 7#include <linux/dma-mapping.h>
8#include <asm/scatterlist.h> 8#include <asm/scatterlist.h>
9#include <asm/machvec.h> 9#include <asm/machvec.h>
10#include <asm-generic/pci-bridge.h>
10 11
11/* 12/*
12 * The following structure is used to manage multiple PCI busses. 13 * The following structure is used to manage multiple PCI busses.
@@ -99,12 +100,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
99 return channel ? 15 : 14; 100 return channel ? 15 : 14;
100} 101}
101 102
102extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *,
103 struct resource *);
104
105extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
106 struct pci_bus_region *region);
107
108#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 103#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
109 104
110static inline int pci_proc_domain(struct pci_bus *bus) 105static inline int pci_proc_domain(struct pci_bus *bus)
diff --git a/arch/alpha/kernel/binfmt_loader.c b/arch/alpha/kernel/binfmt_loader.c
index 3fcfad41013..d1f474d1d44 100644
--- a/arch/alpha/kernel/binfmt_loader.c
+++ b/arch/alpha/kernel/binfmt_loader.c
@@ -46,6 +46,7 @@ static struct linux_binfmt loader_format = {
46 46
47static int __init init_loader_binfmt(void) 47static int __init init_loader_binfmt(void)
48{ 48{
49 return insert_binfmt(&loader_format); 49 insert_binfmt(&loader_format);
50 return 0;
50} 51}
51arch_initcall(init_loader_binfmt); 52arch_initcall(init_loader_binfmt);
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 8c723c1b086..1a629636cc1 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -43,12 +43,10 @@ const char *const pci_mem_names[] = {
43 43
44const char pci_hae0_name[] = "HAE0"; 44const char pci_hae0_name[] = "HAE0";
45 45
46/* Indicate whether we respect the PCI setup left by console. */
47/* 46/*
48 * Make this long-lived so that we know when shutting down 47 * If PCI_PROBE_ONLY in pci_flags is set, we don't change any PCI resource
49 * whether we probed only or not. 48 * assignments.
50 */ 49 */
51int pci_probe_only;
52 50
53/* 51/*
54 * The PCI controller list. 52 * The PCI controller list.
@@ -215,7 +213,7 @@ pdev_save_srm_config(struct pci_dev *dev)
215 struct pdev_srm_saved_conf *tmp; 213 struct pdev_srm_saved_conf *tmp;
216 static int printed = 0; 214 static int printed = 0;
217 215
218 if (!alpha_using_srm || pci_probe_only) 216 if (!alpha_using_srm || pci_has_flag(PCI_PROBE_ONLY))
219 return; 217 return;
220 218
221 if (!printed) { 219 if (!printed) {
@@ -242,7 +240,7 @@ pci_restore_srm_config(void)
242 struct pdev_srm_saved_conf *tmp; 240 struct pdev_srm_saved_conf *tmp;
243 241
244 /* No need to restore if probed only. */ 242 /* No need to restore if probed only. */
245 if (pci_probe_only) 243 if (pci_has_flag(PCI_PROBE_ONLY))
246 return; 244 return;
247 245
248 /* Restore SRM config. */ 246 /* Restore SRM config. */
@@ -253,46 +251,17 @@ pci_restore_srm_config(void)
253#endif 251#endif
254 252
255void __devinit 253void __devinit
256pcibios_fixup_resource(struct resource *res, struct resource *root)
257{
258 res->start += root->start;
259 res->end += root->start;
260}
261
262void __devinit
263pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus)
264{
265 /* Update device resources. */
266 struct pci_controller *hose = (struct pci_controller *)bus->sysdata;
267 int i;
268
269 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
270 if (!dev->resource[i].start)
271 continue;
272 if (dev->resource[i].flags & IORESOURCE_IO)
273 pcibios_fixup_resource(&dev->resource[i],
274 hose->io_space);
275 else if (dev->resource[i].flags & IORESOURCE_MEM)
276 pcibios_fixup_resource(&dev->resource[i],
277 hose->mem_space);
278 }
279}
280
281void __devinit
282pcibios_fixup_bus(struct pci_bus *bus) 254pcibios_fixup_bus(struct pci_bus *bus)
283{ 255{
284 struct pci_dev *dev = bus->self; 256 struct pci_dev *dev = bus->self;
285 257
286 if (pci_probe_only && dev && 258 if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
287 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { 259 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
288 pci_read_bridge_bases(bus); 260 pci_read_bridge_bases(bus);
289 pcibios_fixup_device_resources(dev, bus);
290 } 261 }
291 262
292 list_for_each_entry(dev, &bus->devices, bus_list) { 263 list_for_each_entry(dev, &bus->devices, bus_list) {
293 pdev_save_srm_config(dev); 264 pdev_save_srm_config(dev);
294 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
295 pcibios_fixup_device_resources(dev, bus);
296 } 265 }
297} 266}
298 267
@@ -302,42 +271,6 @@ pcibios_update_irq(struct pci_dev *dev, int irq)
302 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); 271 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
303} 272}
304 273
305void
306pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
307 struct resource *res)
308{
309 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
310 unsigned long offset = 0;
311
312 if (res->flags & IORESOURCE_IO)
313 offset = hose->io_space->start;
314 else if (res->flags & IORESOURCE_MEM)
315 offset = hose->mem_space->start;
316
317 region->start = res->start - offset;
318 region->end = res->end - offset;
319}
320
321void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
322 struct pci_bus_region *region)
323{
324 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
325 unsigned long offset = 0;
326
327 if (res->flags & IORESOURCE_IO)
328 offset = hose->io_space->start;
329 else if (res->flags & IORESOURCE_MEM)
330 offset = hose->mem_space->start;
331
332 res->start = region->start + offset;
333 res->end = region->end + offset;
334}
335
336#ifdef CONFIG_HOTPLUG
337EXPORT_SYMBOL(pcibios_resource_to_bus);
338EXPORT_SYMBOL(pcibios_bus_to_resource);
339#endif
340
341int 274int
342pcibios_enable_device(struct pci_dev *dev, int mask) 275pcibios_enable_device(struct pci_dev *dev, int mask)
343{ 276{
@@ -374,7 +307,8 @@ pcibios_claim_one_bus(struct pci_bus *b)
374 307
375 if (r->parent || !r->start || !r->flags) 308 if (r->parent || !r->start || !r->flags)
376 continue; 309 continue;
377 if (pci_probe_only || (r->flags & IORESOURCE_PCI_FIXED)) 310 if (pci_has_flag(PCI_PROBE_ONLY) ||
311 (r->flags & IORESOURCE_PCI_FIXED))
378 pci_claim_resource(dev, i); 312 pci_claim_resource(dev, i);
379 } 313 }
380 } 314 }
@@ -416,8 +350,10 @@ common_init_pci(void)
416 hose->mem_space->end = end; 350 hose->mem_space->end = end;
417 351
418 INIT_LIST_HEAD(&resources); 352 INIT_LIST_HEAD(&resources);
419 pci_add_resource(&resources, hose->io_space); 353 pci_add_resource_offset(&resources, hose->io_space,
420 pci_add_resource(&resources, hose->mem_space); 354 hose->io_space->start);
355 pci_add_resource_offset(&resources, hose->mem_space,
356 hose->mem_space->start);
421 357
422 bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops, 358 bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
423 hose, &resources); 359 hose, &resources);
diff --git a/arch/alpha/kernel/pci_impl.h b/arch/alpha/kernel/pci_impl.h
index 85457b2d451..2b0ac429f5e 100644
--- a/arch/alpha/kernel/pci_impl.h
+++ b/arch/alpha/kernel/pci_impl.h
@@ -173,9 +173,6 @@ extern void pci_restore_srm_config(void);
173extern struct pci_controller *hose_head, **hose_tail; 173extern struct pci_controller *hose_head, **hose_tail;
174extern struct pci_controller *pci_isa_hose; 174extern struct pci_controller *pci_isa_hose;
175 175
176/* Indicate that we trust the console to configure things properly. */
177extern int pci_probe_only;
178
179extern unsigned long alpha_agpgart_size; 176extern unsigned long alpha_agpgart_size;
180 177
181extern void common_init_pci(void); 178extern void common_init_pci(void);
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 95cfc83ece8..fc8b1250861 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -384,7 +384,8 @@ marvel_init_pci(void)
384 384
385 marvel_register_error_handlers(); 385 marvel_register_error_handlers();
386 386
387 pci_probe_only = 1; 387 /* Indicate that we trust the console to configure things properly */
388 pci_set_flags(PCI_PROBE_ONLY);
388 common_init_pci(); 389 common_init_pci();
389 locate_and_init_vga(NULL); 390 locate_and_init_vga(NULL);
390 391
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index f47b30a2a11..b8eafa05353 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -331,7 +331,8 @@ titan_init_pci(void)
331 */ 331 */
332 titan_late_init(); 332 titan_late_init();
333 333
334 pci_probe_only = 1; 334 /* Indicate that we trust the console to configure things properly */
335 pci_set_flags(PCI_PROBE_ONLY);
335 common_init_pci(); 336 common_init_pci();
336 SMC669_Init(0); 337 SMC669_Init(0);
337 locate_and_init_vga(NULL); 338 locate_and_init_vga(NULL);
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index dfb0312f4e7..94422601ea5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -186,6 +186,9 @@ config GENERIC_ISA_DMA
186config FIQ 186config FIQ
187 bool 187 bool
188 188
189config NEED_RET_TO_USER
190 bool
191
189config ARCH_MTD_XIP 192config ARCH_MTD_XIP
190 bool 193 bool
191 194
@@ -322,9 +325,10 @@ config ARCH_AT91
322 select ARCH_REQUIRE_GPIOLIB 325 select ARCH_REQUIRE_GPIOLIB
323 select HAVE_CLK 326 select HAVE_CLK
324 select CLKDEV_LOOKUP 327 select CLKDEV_LOOKUP
328 select IRQ_DOMAIN
325 help 329 help
326 This enables support for systems based on the Atmel AT91RM9200, 330 This enables support for systems based on the Atmel AT91RM9200,
327 AT91SAM9 and AT91CAP9 processors. 331 AT91SAM9 processors.
328 332
329config ARCH_BCMRING 333config ARCH_BCMRING
330 bool "Broadcom BCMRING" 334 bool "Broadcom BCMRING"
@@ -479,6 +483,7 @@ config ARCH_IOP13XX
479 select ARCH_SUPPORTS_MSI 483 select ARCH_SUPPORTS_MSI
480 select VMSPLIT_1G 484 select VMSPLIT_1G
481 select NEED_MACH_MEMORY_H 485 select NEED_MACH_MEMORY_H
486 select NEED_RET_TO_USER
482 help 487 help
483 Support for Intel's IOP13XX (XScale) family of processors. 488 Support for Intel's IOP13XX (XScale) family of processors.
484 489
@@ -486,6 +491,7 @@ config ARCH_IOP32X
486 bool "IOP32x-based" 491 bool "IOP32x-based"
487 depends on MMU 492 depends on MMU
488 select CPU_XSCALE 493 select CPU_XSCALE
494 select NEED_RET_TO_USER
489 select PLAT_IOP 495 select PLAT_IOP
490 select PCI 496 select PCI
491 select ARCH_REQUIRE_GPIOLIB 497 select ARCH_REQUIRE_GPIOLIB
@@ -497,6 +503,7 @@ config ARCH_IOP33X
497 bool "IOP33x-based" 503 bool "IOP33x-based"
498 depends on MMU 504 depends on MMU
499 select CPU_XSCALE 505 select CPU_XSCALE
506 select NEED_RET_TO_USER
500 select PLAT_IOP 507 select PLAT_IOP
501 select PCI 508 select PCI
502 select ARCH_REQUIRE_GPIOLIB 509 select ARCH_REQUIRE_GPIOLIB
@@ -754,7 +761,7 @@ config ARCH_SA1100
754 select ARCH_HAS_CPUFREQ 761 select ARCH_HAS_CPUFREQ
755 select CPU_FREQ 762 select CPU_FREQ
756 select GENERIC_CLOCKEVENTS 763 select GENERIC_CLOCKEVENTS
757 select HAVE_CLK 764 select CLKDEV_LOOKUP
758 select HAVE_SCHED_CLOCK 765 select HAVE_SCHED_CLOCK
759 select TICK_ONESHOT 766 select TICK_ONESHOT
760 select ARCH_REQUIRE_GPIOLIB 767 select ARCH_REQUIRE_GPIOLIB
@@ -763,22 +770,21 @@ config ARCH_SA1100
763 help 770 help
764 Support for StrongARM 11x0 based boards. 771 Support for StrongARM 11x0 based boards.
765 772
766config ARCH_S3C2410 773config ARCH_S3C24XX
767 bool "Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443, S3C2450" 774 bool "Samsung S3C24XX SoCs"
768 select GENERIC_GPIO 775 select GENERIC_GPIO
769 select ARCH_HAS_CPUFREQ 776 select ARCH_HAS_CPUFREQ
770 select HAVE_CLK 777 select HAVE_CLK
771 select CLKDEV_LOOKUP 778 select CLKDEV_LOOKUP
772 select ARCH_USES_GETTIMEOFFSET 779 select ARCH_USES_GETTIMEOFFSET
773 select HAVE_S3C2410_I2C if I2C 780 select HAVE_S3C2410_I2C if I2C
781 select HAVE_S3C_RTC if RTC_CLASS
782 select HAVE_S3C2410_WATCHDOG if WATCHDOG
774 help 783 help
775 Samsung S3C2410X CPU based systems, such as the Simtec Electronics 784 Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443
776 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or 785 and S3C2450 SoCs based systems, such as the Simtec Electronics BAST
777 the Samsung SMDK2410 development board (and derivatives). 786 (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or the
778 787 Samsung SMDK2410 development board (and derivatives).
779 Note, the S3C2416 and the S3C2450 are so close that they even share
780 the same SoC ID code. This means that there is no separate machine
781 directory (no arch/arm/mach-s3c2450) as the S3C2416 was first.
782 788
783config ARCH_S3C64XX 789config ARCH_S3C64XX
784 bool "Samsung S3C64XX" 790 bool "Samsung S3C64XX"
@@ -901,6 +907,7 @@ config ARCH_U300
901 907
902config ARCH_U8500 908config ARCH_U8500
903 bool "ST-Ericsson U8500 Series" 909 bool "ST-Ericsson U8500 Series"
910 depends on MMU
904 select CPU_V7 911 select CPU_V7
905 select ARM_AMBA 912 select ARM_AMBA
906 select GENERIC_CLOCKEVENTS 913 select GENERIC_CLOCKEVENTS
@@ -1066,12 +1073,10 @@ source "arch/arm/plat-s5p/Kconfig"
1066 1073
1067source "arch/arm/plat-spear/Kconfig" 1074source "arch/arm/plat-spear/Kconfig"
1068 1075
1069if ARCH_S3C2410 1076source "arch/arm/mach-s3c24xx/Kconfig"
1070source "arch/arm/mach-s3c2410/Kconfig" 1077if ARCH_S3C24XX
1071source "arch/arm/mach-s3c2412/Kconfig" 1078source "arch/arm/mach-s3c2412/Kconfig"
1072source "arch/arm/mach-s3c2416/Kconfig"
1073source "arch/arm/mach-s3c2440/Kconfig" 1079source "arch/arm/mach-s3c2440/Kconfig"
1074source "arch/arm/mach-s3c2443/Kconfig"
1075endif 1080endif
1076 1081
1077if ARCH_S3C64XX 1082if ARCH_S3C64XX
@@ -1127,6 +1132,7 @@ config PLAT_VERSATILE
1127config ARM_TIMER_SP804 1132config ARM_TIMER_SP804
1128 bool 1133 bool
1129 select CLKSRC_MMIO 1134 select CLKSRC_MMIO
1135 select HAVE_SCHED_CLOCK
1130 1136
1131source arch/arm/mm/Kconfig 1137source arch/arm/mm/Kconfig
1132 1138
@@ -1577,7 +1583,8 @@ config LOCAL_TIMERS
1577config ARCH_NR_GPIO 1583config ARCH_NR_GPIO
1578 int 1584 int
1579 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA 1585 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
1580 default 350 if ARCH_U8500 1586 default 355 if ARCH_U8500
1587 default 264 if MACH_H4700
1581 default 0 1588 default 0
1582 help 1589 help
1583 Maximum number of GPIOs in the system. 1590 Maximum number of GPIOs in the system.
@@ -1588,7 +1595,7 @@ source kernel/Kconfig.preempt
1588 1595
1589config HZ 1596config HZ
1590 int 1597 int
1591 default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P64X0 || \ 1598 default 200 if ARCH_EBSA110 || ARCH_S3C24XX || ARCH_S5P64X0 || \
1592 ARCH_S5PV210 || ARCH_EXYNOS4 1599 ARCH_S5PV210 || ARCH_EXYNOS4
1593 default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER 1600 default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER
1594 default AT91_TIMER_HZ if ARCH_AT91 1601 default AT91_TIMER_HZ if ARCH_AT91
@@ -2114,7 +2121,7 @@ config CPU_FREQ_S3C
2114 2121
2115config CPU_FREQ_S3C24XX 2122config CPU_FREQ_S3C24XX
2116 bool "CPUfreq driver for Samsung S3C24XX series CPUs (EXPERIMENTAL)" 2123 bool "CPUfreq driver for Samsung S3C24XX series CPUs (EXPERIMENTAL)"
2117 depends on ARCH_S3C2410 && CPU_FREQ && EXPERIMENTAL 2124 depends on ARCH_S3C24XX && CPU_FREQ && EXPERIMENTAL
2118 select CPU_FREQ_S3C 2125 select CPU_FREQ_S3C
2119 help 2126 help
2120 This enables the CPUfreq driver for the Samsung S3C24XX family 2127 This enables the CPUfreq driver for the Samsung S3C24XX family
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index e0d236d7ff7..66ca8014ff3 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -81,47 +81,14 @@ choice
81 prompt "Kernel low-level debugging port" 81 prompt "Kernel low-level debugging port"
82 depends on DEBUG_LL 82 depends on DEBUG_LL
83 83
84 config DEBUG_LL_UART_NONE
85 bool "No low-level debugging UART"
86 help
87 Say Y here if your platform doesn't provide a UART option
88 below. This relies on your platform choosing the right UART
89 definition internally in order for low-level debugging to
90 work.
91
92 config DEBUG_ICEDCC
93 bool "Kernel low-level debugging via EmbeddedICE DCC channel"
94 help
95 Say Y here if you want the debug print routines to direct
96 their output to the EmbeddedICE macrocell's DCC channel using
97 co-processor 14. This is known to work on the ARM9 style ICE
98 channel and on the XScale with the PEEDI.
99
100 Note that the system will appear to hang during boot if there
101 is nothing connected to read from the DCC.
102
103 config AT91_DEBUG_LL_DBGU0 84 config AT91_DEBUG_LL_DBGU0
104 bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl" 85 bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl"
105 depends on HAVE_AT91_DBGU0 86 depends on HAVE_AT91_DBGU0
106 87
107 config AT91_DEBUG_LL_DBGU1 88 config AT91_DEBUG_LL_DBGU1
108 bool "Kernel low-level debugging on 9263, 9g45 and cap9" 89 bool "Kernel low-level debugging on 9263 and 9g45"
109 depends on HAVE_AT91_DBGU1 90 depends on HAVE_AT91_DBGU1
110 91
111 config DEBUG_FOOTBRIDGE_COM1
112 bool "Kernel low-level debugging messages via footbridge 8250 at PCI COM1"
113 depends on FOOTBRIDGE
114 help
115 Say Y here if you want the debug print routines to direct
116 their output to the 8250 at PCI COM1.
117
118 config DEBUG_DC21285_PORT
119 bool "Kernel low-level debugging messages via footbridge serial port"
120 depends on FOOTBRIDGE
121 help
122 Say Y here if you want the debug print routines to direct
123 their output to the serial port in the DC21285 (Footbridge).
124
125 config DEBUG_CLPS711X_UART1 92 config DEBUG_CLPS711X_UART1
126 bool "Kernel low-level debugging messages via UART1" 93 bool "Kernel low-level debugging messages via UART1"
127 depends on ARCH_CLPS711X 94 depends on ARCH_CLPS711X
@@ -136,6 +103,20 @@ choice
136 Say Y here if you want the debug print routines to direct 103 Say Y here if you want the debug print routines to direct
137 their output to the second serial port on these devices. 104 their output to the second serial port on these devices.
138 105
106 config DEBUG_DC21285_PORT
107 bool "Kernel low-level debugging messages via footbridge serial port"
108 depends on FOOTBRIDGE
109 help
110 Say Y here if you want the debug print routines to direct
111 their output to the serial port in the DC21285 (Footbridge).
112
113 config DEBUG_FOOTBRIDGE_COM1
114 bool "Kernel low-level debugging messages via footbridge 8250 at PCI COM1"
115 depends on FOOTBRIDGE
116 help
117 Say Y here if you want the debug print routines to direct
118 their output to the 8250 at PCI COM1.
119
139 config DEBUG_HIGHBANK_UART 120 config DEBUG_HIGHBANK_UART
140 bool "Kernel low-level debugging messages via Highbank UART" 121 bool "Kernel low-level debugging messages via Highbank UART"
141 depends on ARCH_HIGHBANK 122 depends on ARCH_HIGHBANK
@@ -199,45 +180,49 @@ choice
199 Say Y here if you want kernel low-level debugging support 180 Say Y here if you want kernel low-level debugging support
200 on i.MX50 or i.MX53. 181 on i.MX50 or i.MX53.
201 182
202 config DEBUG_IMX6Q_UART 183 config DEBUG_IMX6Q_UART4
203 bool "i.MX6Q Debug UART" 184 bool "i.MX6Q Debug UART4"
204 depends on SOC_IMX6Q 185 depends on SOC_IMX6Q
205 help 186 help
206 Say Y here if you want kernel low-level debugging support 187 Say Y here if you want kernel low-level debugging support
207 on i.MX6Q. 188 on i.MX6Q UART4.
208 189
209 config DEBUG_S3C_UART0 190 config DEBUG_MSM_UART1
210 depends on PLAT_SAMSUNG 191 bool "Kernel low-level debugging messages via MSM UART1"
211 bool "Use S3C UART 0 for low-level debug" 192 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
212 help 193 help
213 Say Y here if you want the debug print routines to direct 194 Say Y here if you want the debug print routines to direct
214 their output to UART 0. The port must have been initialised 195 their output to the first serial port on MSM devices.
215 by the boot-loader before use.
216
217 The uncompressor code port configuration is now handled
218 by CONFIG_S3C_LOWLEVEL_UART_PORT.
219 196
220 config DEBUG_S3C_UART1 197 config DEBUG_MSM_UART2
221 depends on PLAT_SAMSUNG 198 bool "Kernel low-level debugging messages via MSM UART2"
222 bool "Use S3C UART 1 for low-level debug" 199 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
223 help 200 help
224 Say Y here if you want the debug print routines to direct 201 Say Y here if you want the debug print routines to direct
225 their output to UART 1. The port must have been initialised 202 their output to the second serial port on MSM devices.
226 by the boot-loader before use.
227 203
228 The uncompressor code port configuration is now handled 204 config DEBUG_MSM_UART3
229 by CONFIG_S3C_LOWLEVEL_UART_PORT. 205 bool "Kernel low-level debugging messages via MSM UART3"
206 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
207 help
208 Say Y here if you want the debug print routines to direct
209 their output to the third serial port on MSM devices.
230 210
231 config DEBUG_S3C_UART2 211 config DEBUG_MSM8660_UART
232 depends on PLAT_SAMSUNG 212 bool "Kernel low-level debugging messages via MSM 8660 UART"
233 bool "Use S3C UART 2 for low-level debug" 213 depends on ARCH_MSM8X60
214 select MSM_HAS_DEBUG_UART_HS
234 help 215 help
235 Say Y here if you want the debug print routines to direct 216 Say Y here if you want the debug print routines to direct
236 their output to UART 2. The port must have been initialised 217 their output to the serial port on MSM 8660 devices.
237 by the boot-loader before use.
238 218
239 The uncompressor code port configuration is now handled 219 config DEBUG_MSM8960_UART
240 by CONFIG_S3C_LOWLEVEL_UART_PORT. 220 bool "Kernel low-level debugging messages via MSM 8960 UART"
221 depends on ARCH_MSM8960
222 select MSM_HAS_DEBUG_UART_HS
223 help
224 Say Y here if you want the debug print routines to direct
225 their output to the serial port on MSM 8960 devices.
241 226
242 config DEBUG_REALVIEW_STD_PORT 227 config DEBUG_REALVIEW_STD_PORT
243 bool "RealView Default UART" 228 bool "RealView Default UART"
@@ -255,42 +240,57 @@ choice
255 their output to the standard serial port on the RealView 240 their output to the standard serial port on the RealView
256 PB1176 platform. 241 PB1176 platform.
257 242
258 config DEBUG_MSM_UART1 243 config DEBUG_S3C_UART0
259 bool "Kernel low-level debugging messages via MSM UART1" 244 depends on PLAT_SAMSUNG
260 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 245 bool "Use S3C UART 0 for low-level debug"
261 help 246 help
262 Say Y here if you want the debug print routines to direct 247 Say Y here if you want the debug print routines to direct
263 their output to the first serial port on MSM devices. 248 their output to UART 0. The port must have been initialised
249 by the boot-loader before use.
264 250
265 config DEBUG_MSM_UART2 251 The uncompressor code port configuration is now handled
266 bool "Kernel low-level debugging messages via MSM UART2" 252 by CONFIG_S3C_LOWLEVEL_UART_PORT.
267 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 253
254 config DEBUG_S3C_UART1
255 depends on PLAT_SAMSUNG
256 bool "Use S3C UART 1 for low-level debug"
268 help 257 help
269 Say Y here if you want the debug print routines to direct 258 Say Y here if you want the debug print routines to direct
270 their output to the second serial port on MSM devices. 259 their output to UART 1. The port must have been initialised
260 by the boot-loader before use.
271 261
272 config DEBUG_MSM_UART3 262 The uncompressor code port configuration is now handled
273 bool "Kernel low-level debugging messages via MSM UART3" 263 by CONFIG_S3C_LOWLEVEL_UART_PORT.
274 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 264
265 config DEBUG_S3C_UART2
266 depends on PLAT_SAMSUNG
267 bool "Use S3C UART 2 for low-level debug"
275 help 268 help
276 Say Y here if you want the debug print routines to direct 269 Say Y here if you want the debug print routines to direct
277 their output to the third serial port on MSM devices. 270 their output to UART 2. The port must have been initialised
271 by the boot-loader before use.
278 272
279 config DEBUG_MSM8660_UART 273 The uncompressor code port configuration is now handled
280 bool "Kernel low-level debugging messages via MSM 8660 UART" 274 by CONFIG_S3C_LOWLEVEL_UART_PORT.
281 depends on ARCH_MSM8X60 275
282 select MSM_HAS_DEBUG_UART_HS 276 config DEBUG_LL_UART_NONE
277 bool "No low-level debugging UART"
283 help 278 help
284 Say Y here if you want the debug print routines to direct 279 Say Y here if your platform doesn't provide a UART option
285 their output to the serial port on MSM 8660 devices. 280 below. This relies on your platform choosing the right UART
281 definition internally in order for low-level debugging to
282 work.
286 283
287 config DEBUG_MSM8960_UART 284 config DEBUG_ICEDCC
288 bool "Kernel low-level debugging messages via MSM 8960 UART" 285 bool "Kernel low-level debugging via EmbeddedICE DCC channel"
289 depends on ARCH_MSM8960
290 select MSM_HAS_DEBUG_UART_HS
291 help 286 help
292 Say Y here if you want the debug print routines to direct 287 Say Y here if you want the debug print routines to direct
293 their output to the serial port on MSM 8960 devices. 288 their output to the EmbeddedICE macrocell's DCC channel using
289 co-processor 14. This is known to work on the ARM9 style ICE
290 channel and on the XScale with the PEEDI.
291
292 Note that the system will appear to hang during boot if there
293 is nothing connected to read from the DCC.
294 294
295endchoice 295endchoice
296 296
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 1683bfb9166..0106f75530c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -174,7 +174,7 @@ machine-$(CONFIG_ARCH_PRIMA2) := prima2
174machine-$(CONFIG_ARCH_PXA) := pxa 174machine-$(CONFIG_ARCH_PXA) := pxa
175machine-$(CONFIG_ARCH_REALVIEW) := realview 175machine-$(CONFIG_ARCH_REALVIEW) := realview
176machine-$(CONFIG_ARCH_RPC) := rpc 176machine-$(CONFIG_ARCH_RPC) := rpc
177machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2412 s3c2416 s3c2440 s3c2443 177machine-$(CONFIG_ARCH_S3C24XX) := s3c24xx s3c2412 s3c2440
178machine-$(CONFIG_ARCH_S3C64XX) := s3c64xx 178machine-$(CONFIG_ARCH_S3C64XX) := s3c64xx
179machine-$(CONFIG_ARCH_S5P64X0) := s5p64x0 179machine-$(CONFIG_ARCH_S5P64X0) := s5p64x0
180machine-$(CONFIG_ARCH_S5PC100) := s5pc100 180machine-$(CONFIG_ARCH_S5PC100) := s5pc100
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index c5d60250d43..5f6045f1766 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -58,7 +58,7 @@
58 add \rb, \rb, #0x00010000 @ Ser1 58 add \rb, \rb, #0x00010000 @ Ser1
59#endif 59#endif
60 .endm 60 .endm
61#elif defined(CONFIG_ARCH_S3C2410) 61#elif defined(CONFIG_ARCH_S3C24XX)
62 .macro loadsp, rb, tmp 62 .macro loadsp, rb, tmp
63 mov \rb, #0x50000000 63 mov \rb, #0x50000000
64 add \rb, \rb, #0x4000 * CONFIG_S3C_LOWLEVEL_UART_PORT 64 add \rb, \rb, #0x4000 * CONFIG_S3C_LOWLEVEL_UART_PORT
diff --git a/arch/arm/boot/dts/am3517_mt_ventoux.dts b/arch/arm/boot/dts/am3517_mt_ventoux.dts
new file mode 100644
index 00000000000..5eb26d7d9b4
--- /dev/null
+++ b/arch/arm/boot/dts/am3517_mt_ventoux.dts
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2011 Ilya Yanok, EmCraft Systems
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 = "TeeJet Mt.Ventoux";
14 compatible = "teejet,mt_ventoux", "ti,omap3";
15
16 memory {
17 device_type = "memory";
18 reg = <0x80000000 0x10000000>; /* 256 MB */
19 };
20
21 /* AM35xx doesn't have IVA */
22 soc {
23 iva {
24 status = "disabled";
25 };
26 };
27};
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi
index 07603b8c950..a100db03ec9 100644
--- a/arch/arm/boot/dts/at91sam9g20.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20.dtsi
@@ -23,6 +23,11 @@
23 serial4 = &usart3; 23 serial4 = &usart3;
24 serial5 = &usart4; 24 serial5 = &usart4;
25 serial6 = &usart5; 25 serial6 = &usart5;
26 gpio0 = &pioA;
27 gpio1 = &pioB;
28 gpio2 = &pioC;
29 tcb0 = &tcb0;
30 tcb1 = &tcb1;
26 }; 31 };
27 cpus { 32 cpus {
28 cpu@0 { 33 cpu@0 {
@@ -47,24 +52,69 @@
47 ranges; 52 ranges;
48 53
49 aic: interrupt-controller@fffff000 { 54 aic: interrupt-controller@fffff000 {
50 #interrupt-cells = <1>; 55 #interrupt-cells = <2>;
51 compatible = "atmel,at91rm9200-aic"; 56 compatible = "atmel,at91rm9200-aic";
52 interrupt-controller; 57 interrupt-controller;
53 interrupt-parent; 58 interrupt-parent;
54 reg = <0xfffff000 0x200>; 59 reg = <0xfffff000 0x200>;
55 }; 60 };
56 61
62 pit: timer@fffffd30 {
63 compatible = "atmel,at91sam9260-pit";
64 reg = <0xfffffd30 0xf>;
65 interrupts = <1 4>;
66 };
67
68 tcb0: timer@fffa0000 {
69 compatible = "atmel,at91rm9200-tcb";
70 reg = <0xfffa0000 0x100>;
71 interrupts = <17 4 18 4 19 4>;
72 };
73
74 tcb1: timer@fffdc000 {
75 compatible = "atmel,at91rm9200-tcb";
76 reg = <0xfffdc000 0x100>;
77 interrupts = <26 4 27 4 28 4>;
78 };
79
80 pioA: gpio@fffff400 {
81 compatible = "atmel,at91rm9200-gpio";
82 reg = <0xfffff400 0x100>;
83 interrupts = <2 4>;
84 #gpio-cells = <2>;
85 gpio-controller;
86 interrupt-controller;
87 };
88
89 pioB: gpio@fffff600 {
90 compatible = "atmel,at91rm9200-gpio";
91 reg = <0xfffff600 0x100>;
92 interrupts = <3 4>;
93 #gpio-cells = <2>;
94 gpio-controller;
95 interrupt-controller;
96 };
97
98 pioC: gpio@fffff800 {
99 compatible = "atmel,at91rm9200-gpio";
100 reg = <0xfffff800 0x100>;
101 interrupts = <4 4>;
102 #gpio-cells = <2>;
103 gpio-controller;
104 interrupt-controller;
105 };
106
57 dbgu: serial@fffff200 { 107 dbgu: serial@fffff200 {
58 compatible = "atmel,at91sam9260-usart"; 108 compatible = "atmel,at91sam9260-usart";
59 reg = <0xfffff200 0x200>; 109 reg = <0xfffff200 0x200>;
60 interrupts = <1>; 110 interrupts = <1 4>;
61 status = "disabled"; 111 status = "disabled";
62 }; 112 };
63 113
64 usart0: serial@fffb0000 { 114 usart0: serial@fffb0000 {
65 compatible = "atmel,at91sam9260-usart"; 115 compatible = "atmel,at91sam9260-usart";
66 reg = <0xfffb0000 0x200>; 116 reg = <0xfffb0000 0x200>;
67 interrupts = <6>; 117 interrupts = <6 4>;
68 atmel,use-dma-rx; 118 atmel,use-dma-rx;
69 atmel,use-dma-tx; 119 atmel,use-dma-tx;
70 status = "disabled"; 120 status = "disabled";
@@ -73,7 +123,7 @@
73 usart1: serial@fffb4000 { 123 usart1: serial@fffb4000 {
74 compatible = "atmel,at91sam9260-usart"; 124 compatible = "atmel,at91sam9260-usart";
75 reg = <0xfffb4000 0x200>; 125 reg = <0xfffb4000 0x200>;
76 interrupts = <7>; 126 interrupts = <7 4>;
77 atmel,use-dma-rx; 127 atmel,use-dma-rx;
78 atmel,use-dma-tx; 128 atmel,use-dma-tx;
79 status = "disabled"; 129 status = "disabled";
@@ -82,7 +132,7 @@
82 usart2: serial@fffb8000 { 132 usart2: serial@fffb8000 {
83 compatible = "atmel,at91sam9260-usart"; 133 compatible = "atmel,at91sam9260-usart";
84 reg = <0xfffb8000 0x200>; 134 reg = <0xfffb8000 0x200>;
85 interrupts = <8>; 135 interrupts = <8 4>;
86 atmel,use-dma-rx; 136 atmel,use-dma-rx;
87 atmel,use-dma-tx; 137 atmel,use-dma-tx;
88 status = "disabled"; 138 status = "disabled";
@@ -91,7 +141,7 @@
91 usart3: serial@fffd0000 { 141 usart3: serial@fffd0000 {
92 compatible = "atmel,at91sam9260-usart"; 142 compatible = "atmel,at91sam9260-usart";
93 reg = <0xfffd0000 0x200>; 143 reg = <0xfffd0000 0x200>;
94 interrupts = <23>; 144 interrupts = <23 4>;
95 atmel,use-dma-rx; 145 atmel,use-dma-rx;
96 atmel,use-dma-tx; 146 atmel,use-dma-tx;
97 status = "disabled"; 147 status = "disabled";
@@ -100,7 +150,7 @@
100 usart4: serial@fffd4000 { 150 usart4: serial@fffd4000 {
101 compatible = "atmel,at91sam9260-usart"; 151 compatible = "atmel,at91sam9260-usart";
102 reg = <0xfffd4000 0x200>; 152 reg = <0xfffd4000 0x200>;
103 interrupts = <24>; 153 interrupts = <24 4>;
104 atmel,use-dma-rx; 154 atmel,use-dma-rx;
105 atmel,use-dma-tx; 155 atmel,use-dma-tx;
106 status = "disabled"; 156 status = "disabled";
@@ -109,7 +159,7 @@
109 usart5: serial@fffd8000 { 159 usart5: serial@fffd8000 {
110 compatible = "atmel,at91sam9260-usart"; 160 compatible = "atmel,at91sam9260-usart";
111 reg = <0xfffd8000 0x200>; 161 reg = <0xfffd8000 0x200>;
112 interrupts = <25>; 162 interrupts = <25 4>;
113 atmel,use-dma-rx; 163 atmel,use-dma-rx;
114 atmel,use-dma-tx; 164 atmel,use-dma-tx;
115 status = "disabled"; 165 status = "disabled";
@@ -118,7 +168,7 @@
118 macb0: ethernet@fffc4000 { 168 macb0: ethernet@fffc4000 {
119 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 169 compatible = "cdns,at32ap7000-macb", "cdns,macb";
120 reg = <0xfffc4000 0x100>; 170 reg = <0xfffc4000 0x100>;
121 interrupts = <21>; 171 interrupts = <21 4>;
122 status = "disabled"; 172 status = "disabled";
123 }; 173 };
124 }; 174 };
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
new file mode 100644
index 00000000000..e64eb932083
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -0,0 +1,37 @@
1/*
2 * at91sam9g25ek.dts - Device Tree file for AT91SAM9G25-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/ "at91sam9x5.dtsi"
11/include/ "at91sam9x5cm.dtsi"
12
13/ {
14 model = "Atmel AT91SAM9G25-EK";
15 compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16
17 chosen {
18 bootargs = "128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) 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 };
37};
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index fffa005300a..f779667159b 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -22,6 +22,13 @@
22 serial2 = &usart1; 22 serial2 = &usart1;
23 serial3 = &usart2; 23 serial3 = &usart2;
24 serial4 = &usart3; 24 serial4 = &usart3;
25 gpio0 = &pioA;
26 gpio1 = &pioB;
27 gpio2 = &pioC;
28 gpio3 = &pioD;
29 gpio4 = &pioE;
30 tcb0 = &tcb0;
31 tcb1 = &tcb1;
25 }; 32 };
26 cpus { 33 cpus {
27 cpu@0 { 34 cpu@0 {
@@ -46,30 +53,94 @@
46 ranges; 53 ranges;
47 54
48 aic: interrupt-controller@fffff000 { 55 aic: interrupt-controller@fffff000 {
49 #interrupt-cells = <1>; 56 #interrupt-cells = <2>;
50 compatible = "atmel,at91rm9200-aic"; 57 compatible = "atmel,at91rm9200-aic";
51 interrupt-controller; 58 interrupt-controller;
52 interrupt-parent; 59 interrupt-parent;
53 reg = <0xfffff000 0x200>; 60 reg = <0xfffff000 0x200>;
54 }; 61 };
55 62
63 pit: timer@fffffd30 {
64 compatible = "atmel,at91sam9260-pit";
65 reg = <0xfffffd30 0xf>;
66 interrupts = <1 4>;
67 };
68
69
70 tcb0: timer@fff7c000 {
71 compatible = "atmel,at91rm9200-tcb";
72 reg = <0xfff7c000 0x100>;
73 interrupts = <18 4>;
74 };
75
76 tcb1: timer@fffd4000 {
77 compatible = "atmel,at91rm9200-tcb";
78 reg = <0xfffd4000 0x100>;
79 interrupts = <18 4>;
80 };
81
56 dma: dma-controller@ffffec00 { 82 dma: dma-controller@ffffec00 {
57 compatible = "atmel,at91sam9g45-dma"; 83 compatible = "atmel,at91sam9g45-dma";
58 reg = <0xffffec00 0x200>; 84 reg = <0xffffec00 0x200>;
59 interrupts = <21>; 85 interrupts = <21 4>;
86 };
87
88 pioA: gpio@fffff200 {
89 compatible = "atmel,at91rm9200-gpio";
90 reg = <0xfffff200 0x100>;
91 interrupts = <2 4>;
92 #gpio-cells = <2>;
93 gpio-controller;
94 interrupt-controller;
95 };
96
97 pioB: gpio@fffff400 {
98 compatible = "atmel,at91rm9200-gpio";
99 reg = <0xfffff400 0x100>;
100 interrupts = <3 4>;
101 #gpio-cells = <2>;
102 gpio-controller;
103 interrupt-controller;
104 };
105
106 pioC: gpio@fffff600 {
107 compatible = "atmel,at91rm9200-gpio";
108 reg = <0xfffff600 0x100>;
109 interrupts = <4 4>;
110 #gpio-cells = <2>;
111 gpio-controller;
112 interrupt-controller;
113 };
114
115 pioD: gpio@fffff800 {
116 compatible = "atmel,at91rm9200-gpio";
117 reg = <0xfffff800 0x100>;
118 interrupts = <5 4>;
119 #gpio-cells = <2>;
120 gpio-controller;
121 interrupt-controller;
122 };
123
124 pioE: gpio@fffffa00 {
125 compatible = "atmel,at91rm9200-gpio";
126 reg = <0xfffffa00 0x100>;
127 interrupts = <5 4>;
128 #gpio-cells = <2>;
129 gpio-controller;
130 interrupt-controller;
60 }; 131 };
61 132
62 dbgu: serial@ffffee00 { 133 dbgu: serial@ffffee00 {
63 compatible = "atmel,at91sam9260-usart"; 134 compatible = "atmel,at91sam9260-usart";
64 reg = <0xffffee00 0x200>; 135 reg = <0xffffee00 0x200>;
65 interrupts = <1>; 136 interrupts = <1 4>;
66 status = "disabled"; 137 status = "disabled";
67 }; 138 };
68 139
69 usart0: serial@fff8c000 { 140 usart0: serial@fff8c000 {
70 compatible = "atmel,at91sam9260-usart"; 141 compatible = "atmel,at91sam9260-usart";
71 reg = <0xfff8c000 0x200>; 142 reg = <0xfff8c000 0x200>;
72 interrupts = <7>; 143 interrupts = <7 4>;
73 atmel,use-dma-rx; 144 atmel,use-dma-rx;
74 atmel,use-dma-tx; 145 atmel,use-dma-tx;
75 status = "disabled"; 146 status = "disabled";
@@ -78,7 +149,7 @@
78 usart1: serial@fff90000 { 149 usart1: serial@fff90000 {
79 compatible = "atmel,at91sam9260-usart"; 150 compatible = "atmel,at91sam9260-usart";
80 reg = <0xfff90000 0x200>; 151 reg = <0xfff90000 0x200>;
81 interrupts = <8>; 152 interrupts = <8 4>;
82 atmel,use-dma-rx; 153 atmel,use-dma-rx;
83 atmel,use-dma-tx; 154 atmel,use-dma-tx;
84 status = "disabled"; 155 status = "disabled";
@@ -87,7 +158,7 @@
87 usart2: serial@fff94000 { 158 usart2: serial@fff94000 {
88 compatible = "atmel,at91sam9260-usart"; 159 compatible = "atmel,at91sam9260-usart";
89 reg = <0xfff94000 0x200>; 160 reg = <0xfff94000 0x200>;
90 interrupts = <9>; 161 interrupts = <9 4>;
91 atmel,use-dma-rx; 162 atmel,use-dma-rx;
92 atmel,use-dma-tx; 163 atmel,use-dma-tx;
93 status = "disabled"; 164 status = "disabled";
@@ -96,7 +167,7 @@
96 usart3: serial@fff98000 { 167 usart3: serial@fff98000 {
97 compatible = "atmel,at91sam9260-usart"; 168 compatible = "atmel,at91sam9260-usart";
98 reg = <0xfff98000 0x200>; 169 reg = <0xfff98000 0x200>;
99 interrupts = <10>; 170 interrupts = <10 4>;
100 atmel,use-dma-rx; 171 atmel,use-dma-rx;
101 atmel,use-dma-tx; 172 atmel,use-dma-tx;
102 status = "disabled"; 173 status = "disabled";
@@ -105,7 +176,7 @@
105 macb0: ethernet@fffbc000 { 176 macb0: ethernet@fffbc000 {
106 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 177 compatible = "cdns,at32ap7000-macb", "cdns,macb";
107 reg = <0xfffbc000 0x100>; 178 reg = <0xfffbc000 0x100>;
108 interrupts = <25>; 179 interrupts = <25 4>;
109 status = "disabled"; 180 status = "disabled";
110 }; 181 };
111 }; 182 };
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index a387e7704ce..15e25f903ca 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -37,4 +37,76 @@
37 }; 37 };
38 }; 38 };
39 }; 39 };
40
41 leds {
42 compatible = "gpio-leds";
43
44 d8 {
45 label = "d8";
46 gpios = <&pioD 30 0>;
47 linux,default-trigger = "heartbeat";
48 };
49
50 d6 {
51 label = "d6";
52 gpios = <&pioD 0 1>;
53 linux,default-trigger = "nand-disk";
54 };
55
56 d7 {
57 label = "d7";
58 gpios = <&pioD 31 1>;
59 linux,default-trigger = "mmc0";
60 };
61 };
62
63 gpio_keys {
64 compatible = "gpio-keys";
65 #address-cells = <1>;
66 #size-cells = <0>;
67
68 left_click {
69 label = "left_click";
70 gpios = <&pioB 6 1>;
71 linux,code = <272>;
72 gpio-key,wakeup;
73 };
74
75 right_click {
76 label = "right_click";
77 gpios = <&pioB 7 1>;
78 linux,code = <273>;
79 gpio-key,wakeup;
80 };
81
82 left {
83 label = "Joystick Left";
84 gpios = <&pioB 14 1>;
85 linux,code = <105>;
86 };
87
88 right {
89 label = "Joystick Right";
90 gpios = <&pioB 15 1>;
91 linux,code = <106>;
92 };
93
94 up {
95 label = "Joystick Up";
96 gpios = <&pioB 16 1>;
97 linux,code = <103>;
98 };
99
100 down {
101 label = "Joystick Down";
102 gpios = <&pioB 17 1>;
103 linux,code = <108>;
104 };
105
106 enter {
107 label = "Joystick Press";
108 gpios = <&pioB 18 1>;
109 linux,code = <28>;
110 };
111 };
40}; 112};
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
new file mode 100644
index 00000000000..a02e636d8a5
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -0,0 +1,176 @@
1/*
2 * at91sam9x5.dtsi - Device Tree Include file for AT91SAM9x5 family SoC
3 * applies to AT91SAM9G15, AT91SAM9G25, AT91SAM9G35,
4 * AT91SAM9X25, AT91SAM9X35 SoC
5 *
6 * Copyright (C) 2012 Atmel,
7 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
8 *
9 * Licensed under GPLv2 or later.
10 */
11
12/include/ "skeleton.dtsi"
13
14/ {
15 model = "Atmel AT91SAM9x5 family SoC";
16 compatible = "atmel,at91sam9x5";
17 interrupt-parent = <&aic>;
18
19 aliases {
20 serial0 = &dbgu;
21 serial1 = &usart0;
22 serial2 = &usart1;
23 serial3 = &usart2;
24 gpio0 = &pioA;
25 gpio1 = &pioB;
26 gpio2 = &pioC;
27 gpio3 = &pioD;
28 tcb0 = &tcb0;
29 tcb1 = &tcb1;
30 };
31 cpus {
32 cpu@0 {
33 compatible = "arm,arm926ejs";
34 };
35 };
36
37 memory@20000000 {
38 reg = <0x20000000 0x10000000>;
39 };
40
41 ahb {
42 compatible = "simple-bus";
43 #address-cells = <1>;
44 #size-cells = <1>;
45 ranges;
46
47 apb {
48 compatible = "simple-bus";
49 #address-cells = <1>;
50 #size-cells = <1>;
51 ranges;
52
53 aic: interrupt-controller@fffff000 {
54 #interrupt-cells = <2>;
55 compatible = "atmel,at91rm9200-aic";
56 interrupt-controller;
57 interrupt-parent;
58 reg = <0xfffff000 0x200>;
59 };
60
61 pit: timer@fffffe30 {
62 compatible = "atmel,at91sam9260-pit";
63 reg = <0xfffffe30 0xf>;
64 interrupts = <1 4>;
65 };
66
67 tcb0: timer@f8008000 {
68 compatible = "atmel,at91sam9x5-tcb";
69 reg = <0xf8008000 0x100>;
70 interrupts = <17 4>;
71 };
72
73 tcb1: timer@f800c000 {
74 compatible = "atmel,at91sam9x5-tcb";
75 reg = <0xf800c000 0x100>;
76 interrupts = <17 4>;
77 };
78
79 dma0: dma-controller@ffffec00 {
80 compatible = "atmel,at91sam9g45-dma";
81 reg = <0xffffec00 0x200>;
82 interrupts = <20 4>;
83 };
84
85 dma1: dma-controller@ffffee00 {
86 compatible = "atmel,at91sam9g45-dma";
87 reg = <0xffffee00 0x200>;
88 interrupts = <21 4>;
89 };
90
91 pioA: gpio@fffff400 {
92 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
93 reg = <0xfffff400 0x100>;
94 interrupts = <2 4>;
95 #gpio-cells = <2>;
96 gpio-controller;
97 interrupt-controller;
98 };
99
100 pioB: gpio@fffff600 {
101 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
102 reg = <0xfffff600 0x100>;
103 interrupts = <2 4>;
104 #gpio-cells = <2>;
105 gpio-controller;
106 interrupt-controller;
107 };
108
109 pioC: gpio@fffff800 {
110 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
111 reg = <0xfffff800 0x100>;
112 interrupts = <3 4>;
113 #gpio-cells = <2>;
114 gpio-controller;
115 interrupt-controller;
116 };
117
118 pioD: gpio@fffffa00 {
119 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
120 reg = <0xfffffa00 0x100>;
121 interrupts = <3 4>;
122 #gpio-cells = <2>;
123 gpio-controller;
124 interrupt-controller;
125 };
126
127 dbgu: serial@fffff200 {
128 compatible = "atmel,at91sam9260-usart";
129 reg = <0xfffff200 0x200>;
130 interrupts = <1 4>;
131 status = "disabled";
132 };
133
134 usart0: serial@f801c000 {
135 compatible = "atmel,at91sam9260-usart";
136 reg = <0xf801c000 0x200>;
137 interrupts = <5 4>;
138 atmel,use-dma-rx;
139 atmel,use-dma-tx;
140 status = "disabled";
141 };
142
143 usart1: serial@f8020000 {
144 compatible = "atmel,at91sam9260-usart";
145 reg = <0xf8020000 0x200>;
146 interrupts = <6 4>;
147 atmel,use-dma-rx;
148 atmel,use-dma-tx;
149 status = "disabled";
150 };
151
152 usart2: serial@f8024000 {
153 compatible = "atmel,at91sam9260-usart";
154 reg = <0xf8024000 0x200>;
155 interrupts = <7 4>;
156 atmel,use-dma-rx;
157 atmel,use-dma-tx;
158 status = "disabled";
159 };
160
161 macb0: ethernet@f802c000 {
162 compatible = "cdns,at32ap7000-macb", "cdns,macb";
163 reg = <0xf802c000 0x100>;
164 interrupts = <24 4>;
165 status = "disabled";
166 };
167
168 macb1: ethernet@f8030000 {
169 compatible = "cdns,at32ap7000-macb", "cdns,macb";
170 reg = <0xf8030000 0x100>;
171 interrupts = <27 4>;
172 status = "disabled";
173 };
174 };
175 };
176};
diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi b/arch/arm/boot/dts/at91sam9x5cm.dtsi
new file mode 100644
index 00000000000..64ae3e89025
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi
@@ -0,0 +1,29 @@
1/*
2 * at91sam9x5cm.dtsi - Device Tree Include file for AT91SAM9x5 CPU Module
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9
10/ {
11 memory@20000000 {
12 reg = <0x20000000 0x8000000>;
13 };
14
15 leds {
16 compatible = "gpio-leds";
17
18 pb18 {
19 label = "pb18";
20 gpios = <&pioB 18 1>;
21 linux,default-trigger = "heartbeat";
22 };
23
24 pd21 {
25 label = "pd21";
26 gpios = <&pioD 21 0>;
27 };
28 };
29};
diff --git a/arch/arm/boot/dts/highbank.dts b/arch/arm/boot/dts/highbank.dts
index 305635bd45c..37c0ff9c8b9 100644
--- a/arch/arm/boot/dts/highbank.dts
+++ b/arch/arm/boot/dts/highbank.dts
@@ -72,15 +72,15 @@
72 ranges; 72 ranges;
73 73
74 timer@fff10600 { 74 timer@fff10600 {
75 compatible = "arm,smp-twd"; 75 compatible = "arm,cortex-a9-twd-timer";
76 reg = <0xfff10600 0x20>; 76 reg = <0xfff10600 0x20>;
77 interrupts = <1 13 0xf04>; 77 interrupts = <1 13 0xf01>;
78 }; 78 };
79 79
80 watchdog@fff10620 { 80 watchdog@fff10620 {
81 compatible = "arm,cortex-a9-wdt"; 81 compatible = "arm,cortex-a9-twd-wdt";
82 reg = <0xfff10620 0x20>; 82 reg = <0xfff10620 0x20>;
83 interrupts = <1 14 0xf04>; 83 interrupts = <1 14 0xf01>;
84 }; 84 };
85 85
86 intc: interrupt-controller@fff11000 { 86 intc: interrupt-controller@fff11000 {
diff --git a/arch/arm/boot/dts/imx27-phytec-phycore.dts b/arch/arm/boot/dts/imx27-phytec-phycore.dts
new file mode 100644
index 00000000000..a51a08fc2af
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-phytec-phycore.dts
@@ -0,0 +1,76 @@
1/*
2 * Copyright 2012 Sascha Hauer, Pengutronix
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "imx27.dtsi"
14
15/ {
16 model = "Phytec pcm038";
17 compatible = "phytec,imx27-pcm038", "fsl,imx27";
18
19 memory {
20 reg = <0x0 0x0>;
21 };
22
23 soc {
24 aipi@10000000 { /* aipi */
25
26 wdog@10002000 {
27 status = "okay";
28 };
29
30 uart@1000a000 {
31 fsl,uart-has-rtscts;
32 status = "okay";
33 };
34
35 uart@1000b000 {
36 fsl,uart-has-rtscts;
37 status = "okay";
38 };
39
40 uart@1000c000 {
41 fsl,uart-has-rtscts;
42 status = "okay";
43 };
44
45 fec@1002b000 {
46 status = "okay";
47 };
48
49 i2c@1001d000 {
50 clock-frequency = <400000>;
51 status = "okay";
52 at24@4c {
53 compatible = "at,24c32";
54 pagesize = <32>;
55 reg = <0x52>;
56 };
57 pcf8563@51 {
58 compatible = "nxp,pcf8563";
59 reg = <0x51>;
60 };
61 lm75@4a {
62 compatible = "national,lm75";
63 reg = <0x4a>;
64 };
65 };
66 };
67 };
68
69 nor_flash@c0000000 {
70 compatible = "cfi-flash";
71 bank-width = <2>;
72 reg = <0xc0000000 0x02000000>;
73 #address-cells = <1>;
74 #size-cells = <1>;
75 };
76};
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
new file mode 100644
index 00000000000..bc5e7d5ddd5
--- /dev/null
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -0,0 +1,217 @@
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/ "skeleton.dtsi"
13
14/ {
15 aliases {
16 serial0 = &uart1;
17 serial1 = &uart2;
18 serial2 = &uart3;
19 serial3 = &uart4;
20 serial4 = &uart5;
21 serial5 = &uart6;
22 };
23
24 avic: avic-interrupt-controller@e0000000 {
25 compatible = "fsl,imx27-avic", "fsl,avic";
26 interrupt-controller;
27 #interrupt-cells = <1>;
28 reg = <0x10040000 0x1000>;
29 };
30
31 clocks {
32 #address-cells = <1>;
33 #size-cells = <0>;
34
35 osc26m {
36 compatible = "fsl,imx-osc26m", "fixed-clock";
37 clock-frequency = <26000000>;
38 };
39 };
40
41 soc {
42 #address-cells = <1>;
43 #size-cells = <1>;
44 compatible = "simple-bus";
45 interrupt-parent = <&avic>;
46 ranges;
47
48 aipi@10000000 { /* AIPI1 */
49 compatible = "fsl,aipi-bus", "simple-bus";
50 #address-cells = <1>;
51 #size-cells = <1>;
52 reg = <0x10000000 0x10000000>;
53 ranges;
54
55 wdog@10002000 {
56 compatible = "fsl,imx27-wdt", "fsl,imx21-wdt";
57 reg = <0x10002000 0x4000>;
58 interrupts = <27>;
59 status = "disabled";
60 };
61
62 uart1: uart@1000a000 {
63 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
64 reg = <0x1000a000 0x1000>;
65 interrupts = <20>;
66 status = "disabled";
67 };
68
69 uart2: uart@1000b000 {
70 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
71 reg = <0x1000b000 0x1000>;
72 interrupts = <19>;
73 status = "disabled";
74 };
75
76 uart3: uart@1000c000 {
77 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
78 reg = <0x1000c000 0x1000>;
79 interrupts = <18>;
80 status = "disabled";
81 };
82
83 uart4: uart@1000d000 {
84 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
85 reg = <0x1000d000 0x1000>;
86 interrupts = <17>;
87 status = "disabled";
88 };
89
90 cspi1: cspi@1000e000 {
91 #address-cells = <1>;
92 #size-cells = <0>;
93 compatible = "fsl,imx27-cspi";
94 reg = <0x1000e000 0x1000>;
95 interrupts = <16>;
96 status = "disabled";
97 };
98
99 cspi2: cspi@1000f000 {
100 #address-cells = <1>;
101 #size-cells = <0>;
102 compatible = "fsl,imx27-cspi";
103 reg = <0x1000f000 0x1000>;
104 interrupts = <15>;
105 status = "disabled";
106 };
107
108 i2c1: i2c@10012000 {
109 #address-cells = <1>;
110 #size-cells = <0>;
111 compatible = "fsl,imx27-i2c", "fsl,imx1-i2c";
112 reg = <0x10012000 0x1000>;
113 interrupts = <12>;
114 status = "disabled";
115 };
116
117 gpio1: gpio@10015000 {
118 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
119 reg = <0x10015000 0x100>;
120 interrupts = <8>;
121 gpio-controller;
122 #gpio-cells = <2>;
123 interrupt-controller;
124 #interrupt-cells = <1>;
125 };
126
127 gpio2: gpio@10015100 {
128 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
129 reg = <0x10015100 0x100>;
130 interrupts = <8>;
131 gpio-controller;
132 #gpio-cells = <2>;
133 interrupt-controller;
134 #interrupt-cells = <1>;
135 };
136
137 gpio3: gpio@10015200 {
138 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
139 reg = <0x10015200 0x100>;
140 interrupts = <8>;
141 gpio-controller;
142 #gpio-cells = <2>;
143 interrupt-controller;
144 #interrupt-cells = <1>;
145 };
146
147 gpio4: gpio@10015300 {
148 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
149 reg = <0x10015300 0x100>;
150 interrupts = <8>;
151 gpio-controller;
152 #gpio-cells = <2>;
153 interrupt-controller;
154 #interrupt-cells = <1>;
155 };
156
157 gpio5: gpio@10015400 {
158 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
159 reg = <0x10015400 0x100>;
160 interrupts = <8>;
161 gpio-controller;
162 #gpio-cells = <2>;
163 interrupt-controller;
164 #interrupt-cells = <1>;
165 };
166
167 gpio6: gpio@10015500 {
168 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
169 reg = <0x10015500 0x100>;
170 interrupts = <8>;
171 gpio-controller;
172 #gpio-cells = <2>;
173 interrupt-controller;
174 #interrupt-cells = <1>;
175 };
176
177 cspi3: cspi@10017000 {
178 #address-cells = <1>;
179 #size-cells = <0>;
180 compatible = "fsl,imx27-cspi";
181 reg = <0x10017000 0x1000>;
182 interrupts = <6>;
183 status = "disabled";
184 };
185
186 uart5: uart@1001b000 {
187 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
188 reg = <0x1001b000 0x1000>;
189 interrupts = <49>;
190 status = "disabled";
191 };
192
193 uart6: uart@1001c000 {
194 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
195 reg = <0x1001c000 0x1000>;
196 interrupts = <48>;
197 status = "disabled";
198 };
199
200 i2c2: i2c@1001d000 {
201 #address-cells = <1>;
202 #size-cells = <0>;
203 compatible = "fsl,imx27-i2c", "fsl,imx1-i2c";
204 reg = <0x1001d000 0x1000>;
205 interrupts = <1>;
206 status = "disabled";
207 };
208
209 fec: fec@1002b000 {
210 compatible = "fsl,imx27-fec";
211 reg = <0x1002b000 0x4000>;
212 interrupts = <50>;
213 status = "disabled";
214 };
215 };
216 };
217};
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
index 564cb8c19f1..9949e6060de 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dts
@@ -56,8 +56,95 @@
56 compatible = "fsl,mc13892"; 56 compatible = "fsl,mc13892";
57 spi-max-frequency = <6000000>; 57 spi-max-frequency = <6000000>;
58 reg = <0>; 58 reg = <0>;
59 mc13xxx-irq-gpios = <&gpio1 8 0>; 59 interrupt-parent = <&gpio1>;
60 fsl,mc13xxx-uses-regulator; 60 interrupts = <8>;
61
62 regulators {
63 sw1_reg: sw1 {
64 regulator-min-microvolt = <600000>;
65 regulator-max-microvolt = <1375000>;
66 regulator-boot-on;
67 regulator-always-on;
68 };
69
70 sw2_reg: sw2 {
71 regulator-min-microvolt = <900000>;
72 regulator-max-microvolt = <1850000>;
73 regulator-boot-on;
74 regulator-always-on;
75 };
76
77 sw3_reg: sw3 {
78 regulator-min-microvolt = <1100000>;
79 regulator-max-microvolt = <1850000>;
80 regulator-boot-on;
81 regulator-always-on;
82 };
83
84 sw4_reg: sw4 {
85 regulator-min-microvolt = <1100000>;
86 regulator-max-microvolt = <1850000>;
87 regulator-boot-on;
88 regulator-always-on;
89 };
90
91 vpll_reg: vpll {
92 regulator-min-microvolt = <1050000>;
93 regulator-max-microvolt = <1800000>;
94 regulator-boot-on;
95 regulator-always-on;
96 };
97
98 vdig_reg: vdig {
99 regulator-min-microvolt = <1650000>;
100 regulator-max-microvolt = <1650000>;
101 regulator-boot-on;
102 };
103
104 vsd_reg: vsd {
105 regulator-min-microvolt = <1800000>;
106 regulator-max-microvolt = <3150000>;
107 };
108
109 vusb2_reg: vusb2 {
110 regulator-min-microvolt = <2400000>;
111 regulator-max-microvolt = <2775000>;
112 regulator-boot-on;
113 regulator-always-on;
114 };
115
116 vvideo_reg: vvideo {
117 regulator-min-microvolt = <2775000>;
118 regulator-max-microvolt = <2775000>;
119 };
120
121 vaudio_reg: vaudio {
122 regulator-min-microvolt = <2300000>;
123 regulator-max-microvolt = <3000000>;
124 };
125
126 vcam_reg: vcam {
127 regulator-min-microvolt = <2500000>;
128 regulator-max-microvolt = <3000000>;
129 };
130
131 vgen1_reg: vgen1 {
132 regulator-min-microvolt = <1200000>;
133 regulator-max-microvolt = <1200000>;
134 };
135
136 vgen2_reg: vgen2 {
137 regulator-min-microvolt = <1200000>;
138 regulator-max-microvolt = <3150000>;
139 regulator-always-on;
140 };
141
142 vgen3_reg: vgen3 {
143 regulator-min-microvolt = <1800000>;
144 regulator-max-microvolt = <2900000>;
145 regulator-always-on;
146 };
147 };
61 }; 148 };
62 149
63 flash: at45db321d@1 { 150 flash: at45db321d@1 {
diff --git a/arch/arm/boot/dts/imx6q-arm2.dts b/arch/arm/boot/dts/imx6q-arm2.dts
index c3977e0478b..ce1c8238c89 100644
--- a/arch/arm/boot/dts/imx6q-arm2.dts
+++ b/arch/arm/boot/dts/imx6q-arm2.dts
@@ -36,11 +36,13 @@
36 usdhc@02198000 { /* uSDHC3 */ 36 usdhc@02198000 { /* uSDHC3 */
37 cd-gpios = <&gpio6 11 0>; 37 cd-gpios = <&gpio6 11 0>;
38 wp-gpios = <&gpio6 14 0>; 38 wp-gpios = <&gpio6 14 0>;
39 vmmc-supply = <&reg_3p3v>;
39 status = "okay"; 40 status = "okay";
40 }; 41 };
41 42
42 usdhc@0219c000 { /* uSDHC4 */ 43 usdhc@0219c000 { /* uSDHC4 */
43 fsl,card-wired; 44 fsl,card-wired;
45 vmmc-supply = <&reg_3p3v>;
44 status = "okay"; 46 status = "okay";
45 }; 47 };
46 48
@@ -50,6 +52,18 @@
50 }; 52 };
51 }; 53 };
52 54
55 regulators {
56 compatible = "simple-bus";
57
58 reg_3p3v: 3p3v {
59 compatible = "regulator-fixed";
60 regulator-name = "3P3V";
61 regulator-min-microvolt = <3300000>;
62 regulator-max-microvolt = <3300000>;
63 regulator-always-on;
64 };
65 };
66
53 leds { 67 leds {
54 compatible = "gpio-leds"; 68 compatible = "gpio-leds";
55 69
diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts b/arch/arm/boot/dts/imx6q-sabrelite.dts
index 08d920de728..4663a4e5a28 100644
--- a/arch/arm/boot/dts/imx6q-sabrelite.dts
+++ b/arch/arm/boot/dts/imx6q-sabrelite.dts
@@ -32,18 +32,52 @@
32 usdhc@02198000 { /* uSDHC3 */ 32 usdhc@02198000 { /* uSDHC3 */
33 cd-gpios = <&gpio7 0 0>; 33 cd-gpios = <&gpio7 0 0>;
34 wp-gpios = <&gpio7 1 0>; 34 wp-gpios = <&gpio7 1 0>;
35 vmmc-supply = <&reg_3p3v>;
35 status = "okay"; 36 status = "okay";
36 }; 37 };
37 38
38 usdhc@0219c000 { /* uSDHC4 */ 39 usdhc@0219c000 { /* uSDHC4 */
39 cd-gpios = <&gpio2 6 0>; 40 cd-gpios = <&gpio2 6 0>;
40 wp-gpios = <&gpio2 7 0>; 41 wp-gpios = <&gpio2 7 0>;
42 vmmc-supply = <&reg_3p3v>;
41 status = "okay"; 43 status = "okay";
42 }; 44 };
43 45
44 uart2: uart@021e8000 { 46 uart2: uart@021e8000 {
45 status = "okay"; 47 status = "okay";
46 }; 48 };
49
50 i2c@021a0000 { /* I2C1 */
51 status = "okay";
52 clock-frequency = <100000>;
53
54 codec: sgtl5000@0a {
55 compatible = "fsl,sgtl5000";
56 reg = <0x0a>;
57 VDDA-supply = <&reg_2p5v>;
58 VDDIO-supply = <&reg_3p3v>;
59 };
60 };
61 };
62 };
63
64 regulators {
65 compatible = "simple-bus";
66
67 reg_2p5v: 2p5v {
68 compatible = "regulator-fixed";
69 regulator-name = "2P5V";
70 regulator-min-microvolt = <2500000>;
71 regulator-max-microvolt = <2500000>;
72 regulator-always-on;
73 };
74
75 reg_3p3v: 3p3v {
76 compatible = "regulator-fixed";
77 regulator-name = "3P3V";
78 regulator-min-microvolt = <3300000>;
79 regulator-max-microvolt = <3300000>;
80 regulator-always-on;
47 }; 81 };
48 }; 82 };
49}; 83};
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index 263e8f3664b..4905f51a106 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -88,9 +88,9 @@
88 ranges; 88 ranges;
89 89
90 timer@00a00600 { 90 timer@00a00600 {
91 compatible = "arm,smp-twd"; 91 compatible = "arm,cortex-a9-twd-timer";
92 reg = <0x00a00600 0x100>; 92 reg = <0x00a00600 0x20>;
93 interrupts = <1 13 0xf4>; 93 interrupts = <1 13 0xf01>;
94 }; 94 };
95 95
96 L2: l2-cache@00a02000 { 96 L2: l2-cache@00a02000 {
diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts
new file mode 100644
index 00000000000..8a5dff807b4
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts
@@ -0,0 +1,25 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "Globalscale Technologies Dreamplug";
7 compatible = "globalscale,dreamplug-003-ds2001", "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x20000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 };
17
18 serial@f1012000 {
19 compatible = "ns16550a";
20 reg = <0xf1012000 0xff>;
21 reg-shift = <2>;
22 interrupts = <33>;
23 clock-frequency = <200000000>;
24 };
25};
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
new file mode 100644
index 00000000000..771c6bbeb29
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -0,0 +1,6 @@
1/include/ "skeleton.dtsi"
2
3/ {
4 compatible = "marvell,kirkwood";
5};
6
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index 9486be62bcd..9f72cd4cf30 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -13,15 +13,6 @@
13 model = "TI OMAP3 BeagleBoard"; 13 model = "TI OMAP3 BeagleBoard";
14 compatible = "ti,omap3-beagle", "ti,omap3"; 14 compatible = "ti,omap3-beagle", "ti,omap3";
15 15
16 /*
17 * Since the initial device tree board file does not create any
18 * devices (MMC, network...), the only way to boot is to provide a
19 * ramdisk.
20 */
21 chosen {
22 bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug earlyprintk";
23 };
24
25 memory { 16 memory {
26 device_type = "memory"; 17 device_type = "memory";
27 reg = <0x80000000 0x20000000>; /* 512 MB */ 18 reg = <0x80000000 0x20000000>; /* 512 MB */
diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
new file mode 100644
index 00000000000..2eee16ec59b
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-evm.dts
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10/include/ "omap3.dtsi"
11
12/ {
13 model = "TI OMAP3 EVM (OMAP3530, AM/DM37x)";
14 compatible = "ti,omap3-evm", "ti,omap3";
15
16 memory {
17 device_type = "memory";
18 reg = <0x80000000 0x10000000>; /* 256 MB */
19 };
20};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 216c3317461..c6121357c1e 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -61,34 +61,57 @@
61 ranges; 61 ranges;
62 ti,hwmods = "l3_main"; 62 ti,hwmods = "l3_main";
63 63
64 intc: interrupt-controller@1 { 64 intc: interrupt-controller@48200000 {
65 compatible = "ti,omap3-intc"; 65 compatible = "ti,omap2-intc";
66 interrupt-controller; 66 interrupt-controller;
67 #interrupt-cells = <1>; 67 #interrupt-cells = <1>;
68 ti,intc-size = <96>;
69 reg = <0x48200000 0x1000>;
68 }; 70 };
69 71
70 uart1: serial@0x4806a000 { 72 uart1: serial@4806a000 {
71 compatible = "ti,omap3-uart"; 73 compatible = "ti,omap3-uart";
72 ti,hwmods = "uart1"; 74 ti,hwmods = "uart1";
73 clock-frequency = <48000000>; 75 clock-frequency = <48000000>;
74 }; 76 };
75 77
76 uart2: serial@0x4806c000 { 78 uart2: serial@4806c000 {
77 compatible = "ti,omap3-uart"; 79 compatible = "ti,omap3-uart";
78 ti,hwmods = "uart2"; 80 ti,hwmods = "uart2";
79 clock-frequency = <48000000>; 81 clock-frequency = <48000000>;
80 }; 82 };
81 83
82 uart3: serial@0x49020000 { 84 uart3: serial@49020000 {
83 compatible = "ti,omap3-uart"; 85 compatible = "ti,omap3-uart";
84 ti,hwmods = "uart3"; 86 ti,hwmods = "uart3";
85 clock-frequency = <48000000>; 87 clock-frequency = <48000000>;
86 }; 88 };
87 89
88 uart4: serial@0x49042000 { 90 uart4: serial@49042000 {
89 compatible = "ti,omap3-uart"; 91 compatible = "ti,omap3-uart";
90 ti,hwmods = "uart4"; 92 ti,hwmods = "uart4";
91 clock-frequency = <48000000>; 93 clock-frequency = <48000000>;
92 }; 94 };
95
96 i2c1: i2c@48070000 {
97 compatible = "ti,omap3-i2c";
98 #address-cells = <1>;
99 #size-cells = <0>;
100 ti,hwmods = "i2c1";
101 };
102
103 i2c2: i2c@48072000 {
104 compatible = "ti,omap3-i2c";
105 #address-cells = <1>;
106 #size-cells = <0>;
107 ti,hwmods = "i2c2";
108 };
109
110 i2c3: i2c@48060000 {
111 compatible = "ti,omap3-i2c";
112 #address-cells = <1>;
113 #size-cells = <0>;
114 ti,hwmods = "i2c3";
115 };
93 }; 116 };
94}; 117};
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index c7026578ce7..9755ad5917f 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -13,15 +13,6 @@
13 model = "TI OMAP4 PandaBoard"; 13 model = "TI OMAP4 PandaBoard";
14 compatible = "ti,omap4-panda", "ti,omap4430", "ti,omap4"; 14 compatible = "ti,omap4-panda", "ti,omap4430", "ti,omap4";
15 15
16 /*
17 * Since the initial device tree board file does not create any
18 * devices (MMC, network...), the only way to boot is to provide a
19 * ramdisk.
20 */
21 chosen {
22 bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug";
23 };
24
25 memory { 16 memory {
26 device_type = "memory"; 17 device_type = "memory";
27 reg = <0x80000000 0x40000000>; /* 1 GB */ 18 reg = <0x80000000 0x40000000>; /* 1 GB */
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 066e28c9032..63c6b2b2bf4 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -13,15 +13,6 @@
13 model = "TI OMAP4 SDP board"; 13 model = "TI OMAP4 SDP board";
14 compatible = "ti,omap4-sdp", "ti,omap4430", "ti,omap4"; 14 compatible = "ti,omap4-sdp", "ti,omap4430", "ti,omap4";
15 15
16 /*
17 * Since the initial device tree board file does not create any
18 * devices (MMC, network...), the only way to boot is to provide a
19 * ramdisk.
20 */
21 chosen {
22 bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug";
23 };
24
25 memory { 16 memory {
26 device_type = "memory"; 17 device_type = "memory";
27 reg = <0x80000000 0x40000000>; /* 1 GB */ 18 reg = <0x80000000 0x40000000>; /* 1 GB */
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index e8fe75fac7c..3d35559e77b 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -99,33 +99,61 @@
99 gic: interrupt-controller@48241000 { 99 gic: interrupt-controller@48241000 {
100 compatible = "arm,cortex-a9-gic"; 100 compatible = "arm,cortex-a9-gic";
101 interrupt-controller; 101 interrupt-controller;
102 #interrupt-cells = <1>; 102 #interrupt-cells = <3>;
103 reg = <0x48241000 0x1000>, 103 reg = <0x48241000 0x1000>,
104 <0x48240100 0x0100>; 104 <0x48240100 0x0100>;
105 }; 105 };
106 106
107 uart1: serial@0x4806a000 { 107 uart1: serial@4806a000 {
108 compatible = "ti,omap4-uart"; 108 compatible = "ti,omap4-uart";
109 ti,hwmods = "uart1"; 109 ti,hwmods = "uart1";
110 clock-frequency = <48000000>; 110 clock-frequency = <48000000>;
111 }; 111 };
112 112
113 uart2: serial@0x4806c000 { 113 uart2: serial@4806c000 {
114 compatible = "ti,omap4-uart"; 114 compatible = "ti,omap4-uart";
115 ti,hwmods = "uart2"; 115 ti,hwmods = "uart2";
116 clock-frequency = <48000000>; 116 clock-frequency = <48000000>;
117 }; 117 };
118 118
119 uart3: serial@0x48020000 { 119 uart3: serial@48020000 {
120 compatible = "ti,omap4-uart"; 120 compatible = "ti,omap4-uart";
121 ti,hwmods = "uart3"; 121 ti,hwmods = "uart3";
122 clock-frequency = <48000000>; 122 clock-frequency = <48000000>;
123 }; 123 };
124 124
125 uart4: serial@0x4806e000 { 125 uart4: serial@4806e000 {
126 compatible = "ti,omap4-uart"; 126 compatible = "ti,omap4-uart";
127 ti,hwmods = "uart4"; 127 ti,hwmods = "uart4";
128 clock-frequency = <48000000>; 128 clock-frequency = <48000000>;
129 }; 129 };
130
131 i2c1: i2c@48070000 {
132 compatible = "ti,omap4-i2c";
133 #address-cells = <1>;
134 #size-cells = <0>;
135 ti,hwmods = "i2c1";
136 };
137
138 i2c2: i2c@48072000 {
139 compatible = "ti,omap4-i2c";
140 #address-cells = <1>;
141 #size-cells = <0>;
142 ti,hwmods = "i2c2";
143 };
144
145 i2c3: i2c@48060000 {
146 compatible = "ti,omap4-i2c";
147 #address-cells = <1>;
148 #size-cells = <0>;
149 ti,hwmods = "i2c3";
150 };
151
152 i2c4: i2c@48350000 {
153 compatible = "ti,omap4-i2c";
154 #address-cells = <1>;
155 #size-cells = <0>;
156 ti,hwmods = "i2c4";
157 };
130 }; 158 };
131}; 159};
diff --git a/arch/arm/boot/dts/pxa168-aspenite.dts b/arch/arm/boot/dts/pxa168-aspenite.dts
new file mode 100644
index 00000000000..e762facb3fa
--- /dev/null
+++ b/arch/arm/boot/dts/pxa168-aspenite.dts
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2012 Marvell Technology Group Ltd.
3 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10/dts-v1/;
11/include/ "pxa168.dtsi"
12
13/ {
14 model = "Marvell PXA168 Aspenite Development Board";
15 compatible = "mrvl,pxa168-aspenite", "mrvl,pxa168";
16
17 chosen {
18 bootargs = "console=ttyS0,115200 root=/dev/nfs nfsroot=192.168.1.100:/nfsroot/ ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on";
19 };
20
21 memory {
22 reg = <0x00000000 0x04000000>;
23 };
24
25 soc {
26 apb@d4000000 {
27 uart1: uart@d4017000 {
28 status = "okay";
29 };
30 twsi1: i2c@d4011000 {
31 status = "okay";
32 };
33 rtc: rtc@d4010000 {
34 status = "okay";
35 };
36 };
37 };
38};
diff --git a/arch/arm/boot/dts/pxa168.dtsi b/arch/arm/boot/dts/pxa168.dtsi
new file mode 100644
index 00000000000..d32d5128f22
--- /dev/null
+++ b/arch/arm/boot/dts/pxa168.dtsi
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2012 Marvell Technology Group Ltd.
3 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10/include/ "skeleton.dtsi"
11
12/ {
13 aliases {
14 serial0 = &uart1;
15 serial1 = &uart2;
16 serial2 = &uart3;
17 i2c0 = &twsi1;
18 i2c1 = &twsi2;
19 };
20
21 intc: intc-interrupt-controller@d4282000 {
22 compatible = "mrvl,mmp-intc", "mrvl,intc";
23 interrupt-controller;
24 #interrupt-cells = <1>;
25 reg = <0xd4282000 0x1000>;
26 };
27
28 soc {
29 #address-cells = <1>;
30 #size-cells = <1>;
31 compatible = "simple-bus";
32 interrupt-parent = <&intc>;
33 ranges;
34
35 apb@d4000000 { /* APB */
36 compatible = "mrvl,apb-bus", "simple-bus";
37 #address-cells = <1>;
38 #size-cells = <1>;
39 reg = <0xd4000000 0x00200000>;
40 ranges;
41
42 uart1: uart@d4017000 {
43 compatible = "mrvl,mmp-uart", "mrvl,pxa-uart";
44 reg = <0xd4017000 0x1000>;
45 interrupts = <27>;
46 status = "disabled";
47 };
48
49 uart2: uart@d4018000 {
50 compatible = "mrvl,mmp-uart", "mrvl,pxa-uart";
51 reg = <0xd4018000 0x1000>;
52 interrupts = <28>;
53 status = "disabled";
54 };
55
56 uart3: uart@d4026000 {
57 compatible = "mrvl,mmp-uart", "mrvl,pxa-uart";
58 reg = <0xd4026000 0x1000>;
59 interrupts = <29>;
60 status = "disabled";
61 };
62
63 gpio: gpio@d4019000 {
64 compatible = "mrvl,mmp-gpio", "mrvl,pxa-gpio";
65 reg = <0xd4019000 0x1000>;
66 interrupts = <49>;
67 interrupt-names = "gpio_mux";
68 gpio-controller;
69 #gpio-cells = <1>;
70 interrupt-controller;
71 #interrupt-cells = <1>;
72 };
73
74 twsi1: i2c@d4011000 {
75 compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c";
76 reg = <0xd4011000 0x1000>;
77 interrupts = <7>;
78 mrvl,i2c-fast-mode;
79 status = "disabled";
80 };
81
82 twsi2: i2c@d4025000 {
83 compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c";
84 reg = <0xd4025000 0x1000>;
85 interrupts = <58>;
86 status = "disabled";
87 };
88
89 rtc: rtc@d4010000 {
90 compatible = "mrvl,mmp-rtc";
91 reg = <0xd4010000 0x1000>;
92 interrupts = <5 6>;
93 interrupt-names = "rtc 1Hz", "rtc alarm";
94 status = "disabled";
95 };
96 };
97 };
98};
diff --git a/arch/arm/boot/dts/tegra-cardhu.dts b/arch/arm/boot/dts/tegra-cardhu.dts
index 70c41fc897d..73263501f58 100644
--- a/arch/arm/boot/dts/tegra-cardhu.dts
+++ b/arch/arm/boot/dts/tegra-cardhu.dts
@@ -33,4 +33,22 @@
33 i2c@7000d000 { 33 i2c@7000d000 {
34 clock-frequency = <100000>; 34 clock-frequency = <100000>;
35 }; 35 };
36
37 sdhci@78000000 {
38 cd-gpios = <&gpio 69 0>; /* gpio PI5 */
39 wp-gpios = <&gpio 155 0>; /* gpio PT3 */
40 power-gpios = <&gpio 31 0>; /* gpio PD7 */
41 };
42
43 sdhci@78000200 {
44 status = "disable";
45 };
46
47 sdhci@78000400 {
48 status = "disable";
49 };
50
51 sdhci@78000400 {
52 support-8bit;
53 };
36}; 54};
diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts
index 80afa1b70b8..6e8447dc020 100644
--- a/arch/arm/boot/dts/tegra-harmony.dts
+++ b/arch/arm/boot/dts/tegra-harmony.dts
@@ -10,19 +10,25 @@
10 reg = < 0x00000000 0x40000000 >; 10 reg = < 0x00000000 0x40000000 >;
11 }; 11 };
12 12
13 pmc@7000f400 {
14 nvidia,invert-interrupt;
15 };
16
13 i2c@7000c000 { 17 i2c@7000c000 {
14 clock-frequency = <400000>; 18 clock-frequency = <400000>;
15 19
16 codec: wm8903@1a { 20 wm8903: wm8903@1a {
17 compatible = "wlf,wm8903"; 21 compatible = "wlf,wm8903";
18 reg = <0x1a>; 22 reg = <0x1a>;
19 interrupts = < 347 >; 23 interrupt-parent = <&gpio>;
24 interrupts = < 187 0x04 >;
20 25
21 gpio-controller; 26 gpio-controller;
22 #gpio-cells = <2>; 27 #gpio-cells = <2>;
23 28
24 /* 0x8000 = Not configured */ 29 micdet-cfg = <0>;
25 gpio-cfg = < 0x8000 0x8000 0 0x8000 0x8000 >; 30 micdet-delay = <100>;
31 gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >;
26 }; 32 };
27 }; 33 };
28 34
@@ -38,13 +44,32 @@
38 clock-frequency = <400000>; 44 clock-frequency = <400000>;
39 }; 45 };
40 46
41 sound { 47 i2s@70002a00 {
42 compatible = "nvidia,harmony-sound", "nvidia,tegra-wm8903"; 48 status = "disable";
49 };
43 50
44 spkr-en-gpios = <&codec 2 0>; 51 sound {
45 hp-det-gpios = <&gpio 178 0>; 52 compatible = "nvidia,tegra-audio-wm8903-harmony",
46 int-mic-en-gpios = <&gpio 184 0>; 53 "nvidia,tegra-audio-wm8903";
47 ext-mic-en-gpios = <&gpio 185 0>; 54 nvidia,model = "NVIDIA Tegra Harmony";
55
56 nvidia,audio-routing =
57 "Headphone Jack", "HPOUTR",
58 "Headphone Jack", "HPOUTL",
59 "Int Spk", "ROP",
60 "Int Spk", "RON",
61 "Int Spk", "LOP",
62 "Int Spk", "LON",
63 "Mic Jack", "MICBIAS",
64 "IN1L", "Mic Jack";
65
66 nvidia,i2s-controller = <&tegra_i2s1>;
67 nvidia,audio-codec = <&wm8903>;
68
69 nvidia,spkr-en-gpios = <&wm8903 2 0>;
70 nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */
71 nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */
72 nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */
48 }; 73 };
49 74
50 serial@70006000 { 75 serial@70006000 {
diff --git a/arch/arm/boot/dts/tegra-paz00.dts b/arch/arm/boot/dts/tegra-paz00.dts
index 825d2957da0..6c02abb469d 100644
--- a/arch/arm/boot/dts/tegra-paz00.dts
+++ b/arch/arm/boot/dts/tegra-paz00.dts
@@ -12,6 +12,13 @@
12 12
13 i2c@7000c000 { 13 i2c@7000c000 {
14 clock-frequency = <400000>; 14 clock-frequency = <400000>;
15
16 alc5632: alc5632@1e {
17 compatible = "realtek,alc5632";
18 reg = <0x1e>;
19 gpio-controller;
20 #gpio-cells = <2>;
21 };
15 }; 22 };
16 23
17 i2c@7000c400 { 24 i2c@7000c400 {
@@ -35,6 +42,35 @@
35 42
36 i2c@7000d000 { 43 i2c@7000d000 {
37 clock-frequency = <400000>; 44 clock-frequency = <400000>;
45
46 adt7461@4c {
47 compatible = "adi,adt7461";
48 reg = <0x4c>;
49 };
50 };
51
52 i2s@70002a00 {
53 status = "disable";
54 };
55
56 sound {
57 compatible = "nvidia,tegra-audio-alc5632-paz00",
58 "nvidia,tegra-audio-alc5632";
59
60 nvidia,model = "Compal PAZ00";
61
62 nvidia,audio-routing =
63 "Int Spk", "SPKOUT",
64 "Int Spk", "SPKOUTN",
65 "Headset Mic", "MICBIAS1",
66 "MIC1", "Headset Mic",
67 "Headset Stereophone", "HPR",
68 "Headset Stereophone", "HPL",
69 "DMICDAT", "Digital Mic";
70
71 nvidia,audio-codec = <&alc5632>;
72 nvidia,i2s-controller = <&tegra_i2s1>;
73 nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */
38 }; 74 };
39 75
40 serial@70006000 { 76 serial@70006000 {
@@ -74,4 +110,25 @@
74 sdhci@c8000600 { 110 sdhci@c8000600 {
75 support-8bit; 111 support-8bit;
76 }; 112 };
113
114 gpio-keys {
115 compatible = "gpio-keys";
116
117 power {
118 label = "Power";
119 gpios = <&gpio 79 1>; /* gpio PJ7, active low */
120 linux,code = <116>; /* KEY_POWER */
121 gpio-key,wakeup;
122 };
123 };
124
125 gpio-leds {
126 compatible = "gpio-leds";
127
128 wifi {
129 label = "wifi-led";
130 gpios = <&gpio 24 0>;
131 linux,default-trigger = "rfkill0";
132 };
133 };
77}; 134};
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts
index b55a02e34ba..876d5c92ce3 100644
--- a/arch/arm/boot/dts/tegra-seaboard.dts
+++ b/arch/arm/boot/dts/tegra-seaboard.dts
@@ -13,6 +13,20 @@
13 13
14 i2c@7000c000 { 14 i2c@7000c000 {
15 clock-frequency = <400000>; 15 clock-frequency = <400000>;
16
17 wm8903: wm8903@1a {
18 compatible = "wlf,wm8903";
19 reg = <0x1a>;
20 interrupt-parent = <&gpio>;
21 interrupts = < 187 0x04 >;
22
23 gpio-controller;
24 #gpio-cells = <2>;
25
26 micdet-cfg = <0>;
27 micdet-delay = <100>;
28 gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >;
29 };
16 }; 30 };
17 31
18 i2c@7000c400 { 32 i2c@7000c400 {
@@ -32,6 +46,32 @@
32 }; 46 };
33 }; 47 };
34 48
49 i2s@70002a00 {
50 status = "disable";
51 };
52
53 sound {
54 compatible = "nvidia,tegra-audio-wm8903-seaboard",
55 "nvidia,tegra-audio-wm8903";
56 nvidia,model = "NVIDIA Tegra Seaboard";
57
58 nvidia,audio-routing =
59 "Headphone Jack", "HPOUTR",
60 "Headphone Jack", "HPOUTL",
61 "Int Spk", "ROP",
62 "Int Spk", "RON",
63 "Int Spk", "LOP",
64 "Int Spk", "LON",
65 "Mic Jack", "MICBIAS",
66 "IN1R", "Mic Jack";
67
68 nvidia,i2s-controller = <&tegra_i2s1>;
69 nvidia,audio-codec = <&wm8903>;
70
71 nvidia,spkr-en-gpios = <&wm8903 2 0>;
72 nvidia,hp-det-gpios = <&gpio 185 0>; /* gpio PX1 */
73 };
74
35 serial@70006000 { 75 serial@70006000 {
36 status = "disable"; 76 status = "disable";
37 }; 77 };
@@ -93,4 +133,42 @@
93 gpio-key,wakeup; 133 gpio-key,wakeup;
94 }; 134 };
95 }; 135 };
136
137 emc@7000f400 {
138 emc-table@190000 {
139 reg = < 190000 >;
140 compatible = "nvidia,tegra20-emc-table";
141 clock-frequency = < 190000 >;
142 nvidia,emc-registers = < 0x0000000c 0x00000026
143 0x00000009 0x00000003 0x00000004 0x00000004
144 0x00000002 0x0000000c 0x00000003 0x00000003
145 0x00000002 0x00000001 0x00000004 0x00000005
146 0x00000004 0x00000009 0x0000000d 0x0000059f
147 0x00000000 0x00000003 0x00000003 0x00000003
148 0x00000003 0x00000001 0x0000000b 0x000000c8
149 0x00000003 0x00000007 0x00000004 0x0000000f
150 0x00000002 0x00000000 0x00000000 0x00000002
151 0x00000000 0x00000000 0x00000083 0xa06204ae
152 0x007dc010 0x00000000 0x00000000 0x00000000
153 0x00000000 0x00000000 0x00000000 0x00000000 >;
154 };
155
156 emc-table@380000 {
157 reg = < 380000 >;
158 compatible = "nvidia,tegra20-emc-table";
159 clock-frequency = < 380000 >;
160 nvidia,emc-registers = < 0x00000017 0x0000004b
161 0x00000012 0x00000006 0x00000004 0x00000005
162 0x00000003 0x0000000c 0x00000006 0x00000006
163 0x00000003 0x00000001 0x00000004 0x00000005
164 0x00000004 0x00000009 0x0000000d 0x00000b5f
165 0x00000000 0x00000003 0x00000003 0x00000006
166 0x00000006 0x00000001 0x00000011 0x000000c8
167 0x00000003 0x0000000e 0x00000007 0x0000000f
168 0x00000002 0x00000000 0x00000000 0x00000002
169 0x00000000 0x00000000 0x00000083 0xe044048b
170 0x007d8010 0x00000000 0x00000000 0x00000000
171 0x00000000 0x00000000 0x00000000 0x00000000 >;
172 };
173 };
96}; 174};
diff --git a/arch/arm/boot/dts/tegra-trimslice.dts b/arch/arm/boot/dts/tegra-trimslice.dts
index 3b3ee7db99f..252476867b5 100644
--- a/arch/arm/boot/dts/tegra-trimslice.dts
+++ b/arch/arm/boot/dts/tegra-trimslice.dts
@@ -26,6 +26,18 @@
26 status = "disable"; 26 status = "disable";
27 }; 27 };
28 28
29 i2s@70002800 {
30 status = "disable";
31 };
32
33 i2s@70002a00 {
34 status = "disable";
35 };
36
37 das@70000c00 {
38 status = "disable";
39 };
40
29 serial@70006000 { 41 serial@70006000 {
30 clock-frequency = < 216000000 >; 42 clock-frequency = < 216000000 >;
31 }; 43 };
diff --git a/arch/arm/boot/dts/tegra-ventana.dts b/arch/arm/boot/dts/tegra-ventana.dts
index c7d3b87f29d..2dcff8728e9 100644
--- a/arch/arm/boot/dts/tegra-ventana.dts
+++ b/arch/arm/boot/dts/tegra-ventana.dts
@@ -12,6 +12,20 @@
12 12
13 i2c@7000c000 { 13 i2c@7000c000 {
14 clock-frequency = <400000>; 14 clock-frequency = <400000>;
15
16 wm8903: wm8903@1a {
17 compatible = "wlf,wm8903";
18 reg = <0x1a>;
19 interrupt-parent = <&gpio>;
20 interrupts = < 187 0x04 >;
21
22 gpio-controller;
23 #gpio-cells = <2>;
24
25 micdet-cfg = <0>;
26 micdet-delay = <100>;
27 gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >;
28 };
15 }; 29 };
16 30
17 i2c@7000c400 { 31 i2c@7000c400 {
@@ -26,6 +40,34 @@
26 clock-frequency = <400000>; 40 clock-frequency = <400000>;
27 }; 41 };
28 42
43 i2s@70002a00 {
44 status = "disable";
45 };
46
47 sound {
48 compatible = "nvidia,tegra-audio-wm8903-ventana",
49 "nvidia,tegra-audio-wm8903";
50 nvidia,model = "NVIDIA Tegra Ventana";
51
52 nvidia,audio-routing =
53 "Headphone Jack", "HPOUTR",
54 "Headphone Jack", "HPOUTL",
55 "Int Spk", "ROP",
56 "Int Spk", "RON",
57 "Int Spk", "LOP",
58 "Int Spk", "LON",
59 "Mic Jack", "MICBIAS",
60 "IN1L", "Mic Jack";
61
62 nvidia,i2s-controller = <&tegra_i2s1>;
63 nvidia,audio-codec = <&wm8903>;
64
65 nvidia,spkr-en-gpios = <&wm8903 2 0>;
66 nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */
67 nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */
68 nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */
69 };
70
29 serial@70006000 { 71 serial@70006000 {
30 status = "disable"; 72 status = "disable";
31 }; 73 };
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 3da7afd4532..aff8a175aa4 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -4,6 +4,11 @@
4 compatible = "nvidia,tegra20"; 4 compatible = "nvidia,tegra20";
5 interrupt-parent = <&intc>; 5 interrupt-parent = <&intc>;
6 6
7 pmc@7000f400 {
8 compatible = "nvidia,tegra20-pmc";
9 reg = <0x7000e400 0x400>;
10 };
11
7 intc: interrupt-controller@50041000 { 12 intc: interrupt-controller@50041000 {
8 compatible = "arm,cortex-a9-gic"; 13 compatible = "arm,cortex-a9-gic";
9 interrupt-controller; 14 interrupt-controller;
@@ -12,6 +17,33 @@
12 < 0x50040100 0x0100 >; 17 < 0x50040100 0x0100 >;
13 }; 18 };
14 19
20 pmu {
21 compatible = "arm,cortex-a9-pmu";
22 interrupts = <0 56 0x04
23 0 57 0x04>;
24 };
25
26 apbdma: dma@6000a000 {
27 compatible = "nvidia,tegra20-apbdma";
28 reg = <0x6000a000 0x1200>;
29 interrupts = < 0 104 0x04
30 0 105 0x04
31 0 106 0x04
32 0 107 0x04
33 0 108 0x04
34 0 109 0x04
35 0 110 0x04
36 0 111 0x04
37 0 112 0x04
38 0 113 0x04
39 0 114 0x04
40 0 115 0x04
41 0 116 0x04
42 0 117 0x04
43 0 118 0x04
44 0 119 0x04 >;
45 };
46
15 i2c@7000c000 { 47 i2c@7000c000 {
16 #address-cells = <1>; 48 #address-cells = <1>;
17 #size-cells = <0>; 49 #size-cells = <0>;
@@ -44,18 +76,18 @@
44 interrupts = < 0 53 0x04 >; 76 interrupts = < 0 53 0x04 >;
45 }; 77 };
46 78
47 i2s@70002800 { 79 tegra_i2s1: i2s@70002800 {
48 compatible = "nvidia,tegra20-i2s"; 80 compatible = "nvidia,tegra20-i2s";
49 reg = <0x70002800 0x200>; 81 reg = <0x70002800 0x200>;
50 interrupts = < 0 13 0x04 >; 82 interrupts = < 0 13 0x04 >;
51 dma-channel = < 2 >; 83 nvidia,dma-request-selector = < &apbdma 2 >;
52 }; 84 };
53 85
54 i2s@70002a00 { 86 tegra_i2s2: i2s@70002a00 {
55 compatible = "nvidia,tegra20-i2s"; 87 compatible = "nvidia,tegra20-i2s";
56 reg = <0x70002a00 0x200>; 88 reg = <0x70002a00 0x200>;
57 interrupts = < 0 3 0x04 >; 89 interrupts = < 0 3 0x04 >;
58 dma-channel = < 1 >; 90 nvidia,dma-request-selector = < &apbdma 1 >;
59 }; 91 };
60 92
61 das@70000c00 { 93 das@70000c00 {
@@ -75,6 +107,8 @@
75 0 89 0x04 >; 107 0 89 0x04 >;
76 #gpio-cells = <2>; 108 #gpio-cells = <2>;
77 gpio-controller; 109 gpio-controller;
110 #interrupt-cells = <2>;
111 interrupt-controller;
78 }; 112 };
79 113
80 pinmux: pinmux@70000000 { 114 pinmux: pinmux@70000000 {
@@ -120,6 +154,13 @@
120 interrupts = < 0 91 0x04 >; 154 interrupts = < 0 91 0x04 >;
121 }; 155 };
122 156
157 emc@7000f400 {
158 #address-cells = <1>;
159 #size-cells = <0>;
160 compatible = "nvidia,tegra20-emc";
161 reg = <0x7000f400 0x200>;
162 };
163
123 sdhci@c8000000 { 164 sdhci@c8000000 {
124 compatible = "nvidia,tegra20-sdhci"; 165 compatible = "nvidia,tegra20-sdhci";
125 reg = <0xc8000000 0x200>; 166 reg = <0xc8000000 0x200>;
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index ee7db9892e0..62a7b39f1c9 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -4,6 +4,11 @@
4 compatible = "nvidia,tegra30"; 4 compatible = "nvidia,tegra30";
5 interrupt-parent = <&intc>; 5 interrupt-parent = <&intc>;
6 6
7 pmc@7000f400 {
8 compatible = "nvidia,tegra20-pmc", "nvidia,tegra30-pmc";
9 reg = <0x7000e400 0x400>;
10 };
11
7 intc: interrupt-controller@50041000 { 12 intc: interrupt-controller@50041000 {
8 compatible = "arm,cortex-a9-gic"; 13 compatible = "arm,cortex-a9-gic";
9 interrupt-controller; 14 interrupt-controller;
@@ -12,6 +17,51 @@
12 < 0x50040100 0x0100 >; 17 < 0x50040100 0x0100 >;
13 }; 18 };
14 19
20 pmu {
21 compatible = "arm,cortex-a9-pmu";
22 interrupts = <0 144 0x04
23 0 145 0x04
24 0 146 0x04
25 0 147 0x04>;
26 };
27
28 apbdma: dma@6000a000 {
29 compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma";
30 reg = <0x6000a000 0x1400>;
31 interrupts = < 0 104 0x04
32 0 105 0x04
33 0 106 0x04
34 0 107 0x04
35 0 108 0x04
36 0 109 0x04
37 0 110 0x04
38 0 111 0x04
39 0 112 0x04
40 0 113 0x04
41 0 114 0x04
42 0 115 0x04
43 0 116 0x04
44 0 117 0x04
45 0 118 0x04
46 0 119 0x04
47 0 128 0x04
48 0 129 0x04
49 0 130 0x04
50 0 131 0x04
51 0 132 0x04
52 0 133 0x04
53 0 134 0x04
54 0 135 0x04
55 0 136 0x04
56 0 137 0x04
57 0 138 0x04
58 0 139 0x04
59 0 140 0x04
60 0 141 0x04
61 0 142 0x04
62 0 143 0x04 >;
63 };
64
15 i2c@7000c000 { 65 i2c@7000c000 {
16 #address-cells = <1>; 66 #address-cells = <1>;
17 #size-cells = <0>; 67 #size-cells = <0>;
@@ -55,9 +105,18 @@
55 gpio: gpio@6000d000 { 105 gpio: gpio@6000d000 {
56 compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio"; 106 compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio";
57 reg = < 0x6000d000 0x1000 >; 107 reg = < 0x6000d000 0x1000 >;
58 interrupts = < 0 32 0x04 0 33 0x04 0 34 0x04 0 35 0x04 0 55 0x04 0 87 0x04 0 89 0x04 >; 108 interrupts = < 0 32 0x04
109 0 33 0x04
110 0 34 0x04
111 0 35 0x04
112 0 55 0x04
113 0 87 0x04
114 0 89 0x04
115 0 125 0x04 >;
59 #gpio-cells = <2>; 116 #gpio-cells = <2>;
60 gpio-controller; 117 gpio-controller;
118 #interrupt-cells = <2>;
119 interrupt-controller;
61 }; 120 };
62 121
63 serial@70006000 { 122 serial@70006000 {
diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts
index f04b535477f..d74545a2a77 100644
--- a/arch/arm/boot/dts/usb_a9g20.dts
+++ b/arch/arm/boot/dts/usb_a9g20.dts
@@ -32,4 +32,27 @@
32 }; 32 };
33 }; 33 };
34 }; 34 };
35
36 leds {
37 compatible = "gpio-leds";
38
39 user_led {
40 label = "user_led";
41 gpios = <&pioB 21 1>;
42 linux,default-trigger = "heartbeat";
43 };
44 };
45
46 gpio_keys {
47 compatible = "gpio-keys";
48 #address-cells = <1>;
49 #size-cells = <0>;
50
51 user_pb {
52 label = "user_pb";
53 gpios = <&pioB 10 1>;
54 linux,code = <28>;
55 gpio-key,wakeup;
56 };
57 };
35}; 58};
diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
new file mode 100644
index 00000000000..16076e2d093
--- /dev/null
+++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
@@ -0,0 +1,201 @@
1/*
2 * ARM Ltd. Versatile Express
3 *
4 * Motherboard Express uATX
5 * V2M-P1
6 *
7 * HBI-0190D
8 *
9 * RS1 memory map ("ARM Cortex-A Series memory map" in the board's
10 * Technical Reference Manual)
11 *
12 * WARNING! The hardware described in this file is independent from the
13 * original variant (vexpress-v2m.dtsi), but there is a strong
14 * correspondence between the two configurations.
15 *
16 * TAKE CARE WHEN MAINTAINING THIS FILE TO PROPAGATE ANY RELEVANT
17 * CHANGES TO vexpress-v2m.dtsi!
18 */
19
20/ {
21 aliases {
22 arm,v2m_timer = &v2m_timer01;
23 };
24
25 motherboard {
26 compatible = "simple-bus";
27 arm,v2m-memory-map = "rs1";
28 #address-cells = <2>; /* SMB chipselect number and offset */
29 #size-cells = <1>;
30 #interrupt-cells = <1>;
31
32 flash@0,00000000 {
33 compatible = "arm,vexpress-flash", "cfi-flash";
34 reg = <0 0x00000000 0x04000000>,
35 <4 0x00000000 0x04000000>;
36 bank-width = <4>;
37 };
38
39 psram@1,00000000 {
40 compatible = "arm,vexpress-psram", "mtd-ram";
41 reg = <1 0x00000000 0x02000000>;
42 bank-width = <4>;
43 };
44
45 vram@2,00000000 {
46 compatible = "arm,vexpress-vram";
47 reg = <2 0x00000000 0x00800000>;
48 };
49
50 ethernet@2,02000000 {
51 compatible = "smsc,lan9118", "smsc,lan9115";
52 reg = <2 0x02000000 0x10000>;
53 interrupts = <15>;
54 phy-mode = "mii";
55 reg-io-width = <4>;
56 smsc,irq-active-high;
57 smsc,irq-push-pull;
58 };
59
60 usb@2,03000000 {
61 compatible = "nxp,usb-isp1761";
62 reg = <2 0x03000000 0x20000>;
63 interrupts = <16>;
64 port1-otg;
65 };
66
67 iofpga@3,00000000 {
68 compatible = "arm,amba-bus", "simple-bus";
69 #address-cells = <1>;
70 #size-cells = <1>;
71 ranges = <0 3 0 0x200000>;
72
73 sysreg@010000 {
74 compatible = "arm,vexpress-sysreg";
75 reg = <0x010000 0x1000>;
76 };
77
78 sysctl@020000 {
79 compatible = "arm,sp810", "arm,primecell";
80 reg = <0x020000 0x1000>;
81 };
82
83 /* PCI-E I2C bus */
84 v2m_i2c_pcie: i2c@030000 {
85 compatible = "arm,versatile-i2c";
86 reg = <0x030000 0x1000>;
87
88 #address-cells = <1>;
89 #size-cells = <0>;
90
91 pcie-switch@60 {
92 compatible = "idt,89hpes32h8";
93 reg = <0x60>;
94 };
95 };
96
97 aaci@040000 {
98 compatible = "arm,pl041", "arm,primecell";
99 reg = <0x040000 0x1000>;
100 interrupts = <11>;
101 };
102
103 mmci@050000 {
104 compatible = "arm,pl180", "arm,primecell";
105 reg = <0x050000 0x1000>;
106 interrupts = <9 10>;
107 };
108
109 kmi@060000 {
110 compatible = "arm,pl050", "arm,primecell";
111 reg = <0x060000 0x1000>;
112 interrupts = <12>;
113 };
114
115 kmi@070000 {
116 compatible = "arm,pl050", "arm,primecell";
117 reg = <0x070000 0x1000>;
118 interrupts = <13>;
119 };
120
121 v2m_serial0: uart@090000 {
122 compatible = "arm,pl011", "arm,primecell";
123 reg = <0x090000 0x1000>;
124 interrupts = <5>;
125 };
126
127 v2m_serial1: uart@0a0000 {
128 compatible = "arm,pl011", "arm,primecell";
129 reg = <0x0a0000 0x1000>;
130 interrupts = <6>;
131 };
132
133 v2m_serial2: uart@0b0000 {
134 compatible = "arm,pl011", "arm,primecell";
135 reg = <0x0b0000 0x1000>;
136 interrupts = <7>;
137 };
138
139 v2m_serial3: uart@0c0000 {
140 compatible = "arm,pl011", "arm,primecell";
141 reg = <0x0c0000 0x1000>;
142 interrupts = <8>;
143 };
144
145 wdt@0f0000 {
146 compatible = "arm,sp805", "arm,primecell";
147 reg = <0x0f0000 0x1000>;
148 interrupts = <0>;
149 };
150
151 v2m_timer01: timer@110000 {
152 compatible = "arm,sp804", "arm,primecell";
153 reg = <0x110000 0x1000>;
154 interrupts = <2>;
155 };
156
157 v2m_timer23: timer@120000 {
158 compatible = "arm,sp804", "arm,primecell";
159 reg = <0x120000 0x1000>;
160 };
161
162 /* DVI I2C bus */
163 v2m_i2c_dvi: i2c@160000 {
164 compatible = "arm,versatile-i2c";
165 reg = <0x160000 0x1000>;
166
167 #address-cells = <1>;
168 #size-cells = <0>;
169
170 dvi-transmitter@39 {
171 compatible = "sil,sii9022-tpi", "sil,sii9022";
172 reg = <0x39>;
173 };
174
175 dvi-transmitter@60 {
176 compatible = "sil,sii9022-cpi", "sil,sii9022";
177 reg = <0x60>;
178 };
179 };
180
181 rtc@170000 {
182 compatible = "arm,pl031", "arm,primecell";
183 reg = <0x170000 0x1000>;
184 interrupts = <4>;
185 };
186
187 compact-flash@1a0000 {
188 compatible = "arm,vexpress-cf", "ata-generic";
189 reg = <0x1a0000 0x100
190 0x1a0100 0xf00>;
191 reg-shift = <2>;
192 };
193
194 clcd@1f0000 {
195 compatible = "arm,pl111", "arm,primecell";
196 reg = <0x1f0000 0x1000>;
197 interrupts = <14>;
198 };
199 };
200 };
201};
diff --git a/arch/arm/boot/dts/vexpress-v2m.dtsi b/arch/arm/boot/dts/vexpress-v2m.dtsi
new file mode 100644
index 00000000000..a6c9c7c82d5
--- /dev/null
+++ b/arch/arm/boot/dts/vexpress-v2m.dtsi
@@ -0,0 +1,200 @@
1/*
2 * ARM Ltd. Versatile Express
3 *
4 * Motherboard Express uATX
5 * V2M-P1
6 *
7 * HBI-0190D
8 *
9 * Original memory map ("Legacy memory map" in the board's
10 * Technical Reference Manual)
11 *
12 * WARNING! The hardware described in this file is independent from the
13 * RS1 variant (vexpress-v2m-rs1.dtsi), but there is a strong
14 * correspondence between the two configurations.
15 *
16 * TAKE CARE WHEN MAINTAINING THIS FILE TO PROPAGATE ANY RELEVANT
17 * CHANGES TO vexpress-v2m-rs1.dtsi!
18 */
19
20/ {
21 aliases {
22 arm,v2m_timer = &v2m_timer01;
23 };
24
25 motherboard {
26 compatible = "simple-bus";
27 #address-cells = <2>; /* SMB chipselect number and offset */
28 #size-cells = <1>;
29 #interrupt-cells = <1>;
30
31 flash@0,00000000 {
32 compatible = "arm,vexpress-flash", "cfi-flash";
33 reg = <0 0x00000000 0x04000000>,
34 <1 0x00000000 0x04000000>;
35 bank-width = <4>;
36 };
37
38 psram@2,00000000 {
39 compatible = "arm,vexpress-psram", "mtd-ram";
40 reg = <2 0x00000000 0x02000000>;
41 bank-width = <4>;
42 };
43
44 vram@3,00000000 {
45 compatible = "arm,vexpress-vram";
46 reg = <3 0x00000000 0x00800000>;
47 };
48
49 ethernet@3,02000000 {
50 compatible = "smsc,lan9118", "smsc,lan9115";
51 reg = <3 0x02000000 0x10000>;
52 interrupts = <15>;
53 phy-mode = "mii";
54 reg-io-width = <4>;
55 smsc,irq-active-high;
56 smsc,irq-push-pull;
57 };
58
59 usb@3,03000000 {
60 compatible = "nxp,usb-isp1761";
61 reg = <3 0x03000000 0x20000>;
62 interrupts = <16>;
63 port1-otg;
64 };
65
66 iofpga@7,00000000 {
67 compatible = "arm,amba-bus", "simple-bus";
68 #address-cells = <1>;
69 #size-cells = <1>;
70 ranges = <0 7 0 0x20000>;
71
72 sysreg@00000 {
73 compatible = "arm,vexpress-sysreg";
74 reg = <0x00000 0x1000>;
75 };
76
77 sysctl@01000 {
78 compatible = "arm,sp810", "arm,primecell";
79 reg = <0x01000 0x1000>;
80 };
81
82 /* PCI-E I2C bus */
83 v2m_i2c_pcie: i2c@02000 {
84 compatible = "arm,versatile-i2c";
85 reg = <0x02000 0x1000>;
86
87 #address-cells = <1>;
88 #size-cells = <0>;
89
90 pcie-switch@60 {
91 compatible = "idt,89hpes32h8";
92 reg = <0x60>;
93 };
94 };
95
96 aaci@04000 {
97 compatible = "arm,pl041", "arm,primecell";
98 reg = <0x04000 0x1000>;
99 interrupts = <11>;
100 };
101
102 mmci@05000 {
103 compatible = "arm,pl180", "arm,primecell";
104 reg = <0x05000 0x1000>;
105 interrupts = <9 10>;
106 };
107
108 kmi@06000 {
109 compatible = "arm,pl050", "arm,primecell";
110 reg = <0x06000 0x1000>;
111 interrupts = <12>;
112 };
113
114 kmi@07000 {
115 compatible = "arm,pl050", "arm,primecell";
116 reg = <0x07000 0x1000>;
117 interrupts = <13>;
118 };
119
120 v2m_serial0: uart@09000 {
121 compatible = "arm,pl011", "arm,primecell";
122 reg = <0x09000 0x1000>;
123 interrupts = <5>;
124 };
125
126 v2m_serial1: uart@0a000 {
127 compatible = "arm,pl011", "arm,primecell";
128 reg = <0x0a000 0x1000>;
129 interrupts = <6>;
130 };
131
132 v2m_serial2: uart@0b000 {
133 compatible = "arm,pl011", "arm,primecell";
134 reg = <0x0b000 0x1000>;
135 interrupts = <7>;
136 };
137
138 v2m_serial3: uart@0c000 {
139 compatible = "arm,pl011", "arm,primecell";
140 reg = <0x0c000 0x1000>;
141 interrupts = <8>;
142 };
143
144 wdt@0f000 {
145 compatible = "arm,sp805", "arm,primecell";
146 reg = <0x0f000 0x1000>;
147 interrupts = <0>;
148 };
149
150 v2m_timer01: timer@11000 {
151 compatible = "arm,sp804", "arm,primecell";
152 reg = <0x11000 0x1000>;
153 interrupts = <2>;
154 };
155
156 v2m_timer23: timer@12000 {
157 compatible = "arm,sp804", "arm,primecell";
158 reg = <0x12000 0x1000>;
159 };
160
161 /* DVI I2C bus */
162 v2m_i2c_dvi: i2c@16000 {
163 compatible = "arm,versatile-i2c";
164 reg = <0x16000 0x1000>;
165
166 #address-cells = <1>;
167 #size-cells = <0>;
168
169 dvi-transmitter@39 {
170 compatible = "sil,sii9022-tpi", "sil,sii9022";
171 reg = <0x39>;
172 };
173
174 dvi-transmitter@60 {
175 compatible = "sil,sii9022-cpi", "sil,sii9022";
176 reg = <0x60>;
177 };
178 };
179
180 rtc@17000 {
181 compatible = "arm,pl031", "arm,primecell";
182 reg = <0x17000 0x1000>;
183 interrupts = <4>;
184 };
185
186 compact-flash@1a000 {
187 compatible = "arm,vexpress-cf", "ata-generic";
188 reg = <0x1a000 0x100
189 0x1a100 0xf00>;
190 reg-shift = <2>;
191 };
192
193 clcd@1f000 {
194 compatible = "arm,pl111", "arm,primecell";
195 reg = <0x1f000 0x1000>;
196 interrupts = <14>;
197 };
198 };
199 };
200};
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
new file mode 100644
index 00000000000..941b161ab78
--- /dev/null
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
@@ -0,0 +1,157 @@
1/*
2 * ARM Ltd. Versatile Express
3 *
4 * CoreTile Express A15x2 (version with Test Chip 1)
5 * Cortex-A15 MPCore (V2P-CA15)
6 *
7 * HBI-0237A
8 */
9
10/dts-v1/;
11
12/ {
13 model = "V2P-CA15";
14 arm,hbi = <0x237>;
15 compatible = "arm,vexpress,v2p-ca15,tc1", "arm,vexpress,v2p-ca15", "arm,vexpress";
16 interrupt-parent = <&gic>;
17 #address-cells = <1>;
18 #size-cells = <1>;
19
20 chosen { };
21
22 aliases {
23 serial0 = &v2m_serial0;
24 serial1 = &v2m_serial1;
25 serial2 = &v2m_serial2;
26 serial3 = &v2m_serial3;
27 i2c0 = &v2m_i2c_dvi;
28 i2c1 = &v2m_i2c_pcie;
29 };
30
31 cpus {
32 #address-cells = <1>;
33 #size-cells = <0>;
34
35 cpu@0 {
36 device_type = "cpu";
37 compatible = "arm,cortex-a15";
38 reg = <0>;
39 };
40
41 cpu@1 {
42 device_type = "cpu";
43 compatible = "arm,cortex-a15";
44 reg = <1>;
45 };
46 };
47
48 memory@80000000 {
49 device_type = "memory";
50 reg = <0x80000000 0x40000000>;
51 };
52
53 hdlcd@2b000000 {
54 compatible = "arm,hdlcd";
55 reg = <0x2b000000 0x1000>;
56 interrupts = <0 85 4>;
57 };
58
59 memory-controller@2b0a0000 {
60 compatible = "arm,pl341", "arm,primecell";
61 reg = <0x2b0a0000 0x1000>;
62 };
63
64 wdt@2b060000 {
65 compatible = "arm,sp805", "arm,primecell";
66 reg = <0x2b060000 0x1000>;
67 interrupts = <98>;
68 };
69
70 gic: interrupt-controller@2c001000 {
71 compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
72 #interrupt-cells = <3>;
73 #address-cells = <0>;
74 interrupt-controller;
75 reg = <0x2c001000 0x1000>,
76 <0x2c002000 0x100>;
77 };
78
79 memory-controller@7ffd0000 {
80 compatible = "arm,pl354", "arm,primecell";
81 reg = <0x7ffd0000 0x1000>;
82 interrupts = <0 86 4>,
83 <0 87 4>;
84 };
85
86 dma@7ffb0000 {
87 compatible = "arm,pl330", "arm,primecell";
88 reg = <0x7ffb0000 0x1000>;
89 interrupts = <0 92 4>,
90 <0 88 4>,
91 <0 89 4>,
92 <0 90 4>,
93 <0 91 4>;
94 };
95
96 pmu {
97 compatible = "arm,cortex-a15-pmu", "arm,cortex-a9-pmu";
98 interrupts = <0 68 4>,
99 <0 69 4>;
100 };
101
102 motherboard {
103 ranges = <0 0 0x08000000 0x04000000>,
104 <1 0 0x14000000 0x04000000>,
105 <2 0 0x18000000 0x04000000>,
106 <3 0 0x1c000000 0x04000000>,
107 <4 0 0x0c000000 0x04000000>,
108 <5 0 0x10000000 0x04000000>;
109
110 interrupt-map-mask = <0 0 63>;
111 interrupt-map = <0 0 0 &gic 0 0 4>,
112 <0 0 1 &gic 0 1 4>,
113 <0 0 2 &gic 0 2 4>,
114 <0 0 3 &gic 0 3 4>,
115 <0 0 4 &gic 0 4 4>,
116 <0 0 5 &gic 0 5 4>,
117 <0 0 6 &gic 0 6 4>,
118 <0 0 7 &gic 0 7 4>,
119 <0 0 8 &gic 0 8 4>,
120 <0 0 9 &gic 0 9 4>,
121 <0 0 10 &gic 0 10 4>,
122 <0 0 11 &gic 0 11 4>,
123 <0 0 12 &gic 0 12 4>,
124 <0 0 13 &gic 0 13 4>,
125 <0 0 14 &gic 0 14 4>,
126 <0 0 15 &gic 0 15 4>,
127 <0 0 16 &gic 0 16 4>,
128 <0 0 17 &gic 0 17 4>,
129 <0 0 18 &gic 0 18 4>,
130 <0 0 19 &gic 0 19 4>,
131 <0 0 20 &gic 0 20 4>,
132 <0 0 21 &gic 0 21 4>,
133 <0 0 22 &gic 0 22 4>,
134 <0 0 23 &gic 0 23 4>,
135 <0 0 24 &gic 0 24 4>,
136 <0 0 25 &gic 0 25 4>,
137 <0 0 26 &gic 0 26 4>,
138 <0 0 27 &gic 0 27 4>,
139 <0 0 28 &gic 0 28 4>,
140 <0 0 29 &gic 0 29 4>,
141 <0 0 30 &gic 0 30 4>,
142 <0 0 31 &gic 0 31 4>,
143 <0 0 32 &gic 0 32 4>,
144 <0 0 33 &gic 0 33 4>,
145 <0 0 34 &gic 0 34 4>,
146 <0 0 35 &gic 0 35 4>,
147 <0 0 36 &gic 0 36 4>,
148 <0 0 37 &gic 0 37 4>,
149 <0 0 38 &gic 0 38 4>,
150 <0 0 39 &gic 0 39 4>,
151 <0 0 40 &gic 0 40 4>,
152 <0 0 41 &gic 0 41 4>,
153 <0 0 42 &gic 0 42 4>;
154 };
155};
156
157/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
new file mode 100644
index 00000000000..6905e66d474
--- /dev/null
+++ b/arch/arm/boot/dts/vexpress-v2p-ca5s.dts
@@ -0,0 +1,162 @@
1/*
2 * ARM Ltd. Versatile Express
3 *
4 * CoreTile Express A5x2
5 * Cortex-A5 MPCore (V2P-CA5s)
6 *
7 * HBI-0225B
8 */
9
10/dts-v1/;
11
12/ {
13 model = "V2P-CA5s";
14 arm,hbi = <0x225>;
15 compatible = "arm,vexpress,v2p-ca5s", "arm,vexpress";
16 interrupt-parent = <&gic>;
17 #address-cells = <1>;
18 #size-cells = <1>;
19
20 chosen { };
21
22 aliases {
23 serial0 = &v2m_serial0;
24 serial1 = &v2m_serial1;
25 serial2 = &v2m_serial2;
26 serial3 = &v2m_serial3;
27 i2c0 = &v2m_i2c_dvi;
28 i2c1 = &v2m_i2c_pcie;
29 };
30
31 cpus {
32 #address-cells = <1>;
33 #size-cells = <0>;
34
35 cpu@0 {
36 device_type = "cpu";
37 compatible = "arm,cortex-a5";
38 reg = <0>;
39 next-level-cache = <&L2>;
40 };
41
42 cpu@1 {
43 device_type = "cpu";
44 compatible = "arm,cortex-a5";
45 reg = <1>;
46 next-level-cache = <&L2>;
47 };
48 };
49
50 memory@80000000 {
51 device_type = "memory";
52 reg = <0x80000000 0x40000000>;
53 };
54
55 hdlcd@2a110000 {
56 compatible = "arm,hdlcd";
57 reg = <0x2a110000 0x1000>;
58 interrupts = <0 85 4>;
59 };
60
61 memory-controller@2a150000 {
62 compatible = "arm,pl341", "arm,primecell";
63 reg = <0x2a150000 0x1000>;
64 };
65
66 memory-controller@2a190000 {
67 compatible = "arm,pl354", "arm,primecell";
68 reg = <0x2a190000 0x1000>;
69 interrupts = <0 86 4>,
70 <0 87 4>;
71 };
72
73 scu@2c000000 {
74 compatible = "arm,cortex-a5-scu";
75 reg = <0x2c000000 0x58>;
76 };
77
78 timer@2c000600 {
79 compatible = "arm,cortex-a5-twd-timer";
80 reg = <0x2c000600 0x38>;
81 interrupts = <1 2 0x304>,
82 <1 3 0x304>;
83 };
84
85 gic: interrupt-controller@2c001000 {
86 compatible = "arm,corex-a5-gic", "arm,cortex-a9-gic";
87 #interrupt-cells = <3>;
88 #address-cells = <0>;
89 interrupt-controller;
90 reg = <0x2c001000 0x1000>,
91 <0x2c000100 0x100>;
92 };
93
94 L2: cache-controller@2c0f0000 {
95 compatible = "arm,pl310-cache";
96 reg = <0x2c0f0000 0x1000>;
97 interrupts = <0 84 4>;
98 cache-level = <2>;
99 };
100
101 pmu {
102 compatible = "arm,cortex-a5-pmu", "arm,cortex-a9-pmu";
103 interrupts = <0 68 4>,
104 <0 69 4>;
105 };
106
107 motherboard {
108 ranges = <0 0 0x08000000 0x04000000>,
109 <1 0 0x14000000 0x04000000>,
110 <2 0 0x18000000 0x04000000>,
111 <3 0 0x1c000000 0x04000000>,
112 <4 0 0x0c000000 0x04000000>,
113 <5 0 0x10000000 0x04000000>;
114
115 interrupt-map-mask = <0 0 63>;
116 interrupt-map = <0 0 0 &gic 0 0 4>,
117 <0 0 1 &gic 0 1 4>,
118 <0 0 2 &gic 0 2 4>,
119 <0 0 3 &gic 0 3 4>,
120 <0 0 4 &gic 0 4 4>,
121 <0 0 5 &gic 0 5 4>,
122 <0 0 6 &gic 0 6 4>,
123 <0 0 7 &gic 0 7 4>,
124 <0 0 8 &gic 0 8 4>,
125 <0 0 9 &gic 0 9 4>,
126 <0 0 10 &gic 0 10 4>,
127 <0 0 11 &gic 0 11 4>,
128 <0 0 12 &gic 0 12 4>,
129 <0 0 13 &gic 0 13 4>,
130 <0 0 14 &gic 0 14 4>,
131 <0 0 15 &gic 0 15 4>,
132 <0 0 16 &gic 0 16 4>,
133 <0 0 17 &gic 0 17 4>,
134 <0 0 18 &gic 0 18 4>,
135 <0 0 19 &gic 0 19 4>,
136 <0 0 20 &gic 0 20 4>,
137 <0 0 21 &gic 0 21 4>,
138 <0 0 22 &gic 0 22 4>,
139 <0 0 23 &gic 0 23 4>,
140 <0 0 24 &gic 0 24 4>,
141 <0 0 25 &gic 0 25 4>,
142 <0 0 26 &gic 0 26 4>,
143 <0 0 27 &gic 0 27 4>,
144 <0 0 28 &gic 0 28 4>,
145 <0 0 29 &gic 0 29 4>,
146 <0 0 30 &gic 0 30 4>,
147 <0 0 31 &gic 0 31 4>,
148 <0 0 32 &gic 0 32 4>,
149 <0 0 33 &gic 0 33 4>,
150 <0 0 34 &gic 0 34 4>,
151 <0 0 35 &gic 0 35 4>,
152 <0 0 36 &gic 0 36 4>,
153 <0 0 37 &gic 0 37 4>,
154 <0 0 38 &gic 0 38 4>,
155 <0 0 39 &gic 0 39 4>,
156 <0 0 40 &gic 0 40 4>,
157 <0 0 41 &gic 0 41 4>,
158 <0 0 42 &gic 0 42 4>;
159 };
160};
161
162/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
new file mode 100644
index 00000000000..da778693be5
--- /dev/null
+++ b/arch/arm/boot/dts/vexpress-v2p-ca9.dts
@@ -0,0 +1,192 @@
1/*
2 * ARM Ltd. Versatile Express
3 *
4 * CoreTile Express A9x4
5 * Cortex-A9 MPCore (V2P-CA9)
6 *
7 * HBI-0191B
8 */
9
10/dts-v1/;
11
12/ {
13 model = "V2P-CA9";
14 arm,hbi = <0x191>;
15 compatible = "arm,vexpress,v2p-ca9", "arm,vexpress";
16 interrupt-parent = <&gic>;
17 #address-cells = <1>;
18 #size-cells = <1>;
19
20 chosen { };
21
22 aliases {
23 serial0 = &v2m_serial0;
24 serial1 = &v2m_serial1;
25 serial2 = &v2m_serial2;
26 serial3 = &v2m_serial3;
27 i2c0 = &v2m_i2c_dvi;
28 i2c1 = &v2m_i2c_pcie;
29 };
30
31 cpus {
32 #address-cells = <1>;
33 #size-cells = <0>;
34
35 cpu@0 {
36 device_type = "cpu";
37 compatible = "arm,cortex-a9";
38 reg = <0>;
39 next-level-cache = <&L2>;
40 };
41
42 cpu@1 {
43 device_type = "cpu";
44 compatible = "arm,cortex-a9";
45 reg = <1>;
46 next-level-cache = <&L2>;
47 };
48
49 cpu@2 {
50 device_type = "cpu";
51 compatible = "arm,cortex-a9";
52 reg = <2>;
53 next-level-cache = <&L2>;
54 };
55
56 cpu@3 {
57 device_type = "cpu";
58 compatible = "arm,cortex-a9";
59 reg = <3>;
60 next-level-cache = <&L2>;
61 };
62 };
63
64 memory@60000000 {
65 device_type = "memory";
66 reg = <0x60000000 0x40000000>;
67 };
68
69 clcd@10020000 {
70 compatible = "arm,pl111", "arm,primecell";
71 reg = <0x10020000 0x1000>;
72 interrupts = <0 44 4>;
73 };
74
75 memory-controller@100e0000 {
76 compatible = "arm,pl341", "arm,primecell";
77 reg = <0x100e0000 0x1000>;
78 };
79
80 memory-controller@100e1000 {
81 compatible = "arm,pl354", "arm,primecell";
82 reg = <0x100e1000 0x1000>;
83 interrupts = <0 45 4>,
84 <0 46 4>;
85 };
86
87 timer@100e4000 {
88 compatible = "arm,sp804", "arm,primecell";
89 reg = <0x100e4000 0x1000>;
90 interrupts = <0 48 4>,
91 <0 49 4>;
92 };
93
94 watchdog@100e5000 {
95 compatible = "arm,sp805", "arm,primecell";
96 reg = <0x100e5000 0x1000>;
97 interrupts = <0 51 4>;
98 };
99
100 scu@1e000000 {
101 compatible = "arm,cortex-a9-scu";
102 reg = <0x1e000000 0x58>;
103 };
104
105 timer@1e000600 {
106 compatible = "arm,cortex-a9-twd-timer";
107 reg = <0x1e000600 0x20>;
108 interrupts = <1 2 0xf04>,
109 <1 3 0xf04>;
110 };
111
112 gic: interrupt-controller@1e001000 {
113 compatible = "arm,cortex-a9-gic";
114 #interrupt-cells = <3>;
115 #address-cells = <0>;
116 interrupt-controller;
117 reg = <0x1e001000 0x1000>,
118 <0x1e000100 0x100>;
119 };
120
121 L2: cache-controller@1e00a000 {
122 compatible = "arm,pl310-cache";
123 reg = <0x1e00a000 0x1000>;
124 interrupts = <0 43 4>;
125 cache-level = <2>;
126 arm,data-latency = <1 1 1>;
127 arm,tag-latency = <1 1 1>;
128 };
129
130 pmu {
131 compatible = "arm,cortex-a9-pmu";
132 interrupts = <0 60 4>,
133 <0 61 4>,
134 <0 62 4>,
135 <0 63 4>;
136 };
137
138 motherboard {
139 ranges = <0 0 0x40000000 0x04000000>,
140 <1 0 0x44000000 0x04000000>,
141 <2 0 0x48000000 0x04000000>,
142 <3 0 0x4c000000 0x04000000>,
143 <7 0 0x10000000 0x00020000>;
144
145 interrupt-map-mask = <0 0 63>;
146 interrupt-map = <0 0 0 &gic 0 0 4>,
147 <0 0 1 &gic 0 1 4>,
148 <0 0 2 &gic 0 2 4>,
149 <0 0 3 &gic 0 3 4>,
150 <0 0 4 &gic 0 4 4>,
151 <0 0 5 &gic 0 5 4>,
152 <0 0 6 &gic 0 6 4>,
153 <0 0 7 &gic 0 7 4>,
154 <0 0 8 &gic 0 8 4>,
155 <0 0 9 &gic 0 9 4>,
156 <0 0 10 &gic 0 10 4>,
157 <0 0 11 &gic 0 11 4>,
158 <0 0 12 &gic 0 12 4>,
159 <0 0 13 &gic 0 13 4>,
160 <0 0 14 &gic 0 14 4>,
161 <0 0 15 &gic 0 15 4>,
162 <0 0 16 &gic 0 16 4>,
163 <0 0 17 &gic 0 17 4>,
164 <0 0 18 &gic 0 18 4>,
165 <0 0 19 &gic 0 19 4>,
166 <0 0 20 &gic 0 20 4>,
167 <0 0 21 &gic 0 21 4>,
168 <0 0 22 &gic 0 22 4>,
169 <0 0 23 &gic 0 23 4>,
170 <0 0 24 &gic 0 24 4>,
171 <0 0 25 &gic 0 25 4>,
172 <0 0 26 &gic 0 26 4>,
173 <0 0 27 &gic 0 27 4>,
174 <0 0 28 &gic 0 28 4>,
175 <0 0 29 &gic 0 29 4>,
176 <0 0 30 &gic 0 30 4>,
177 <0 0 31 &gic 0 31 4>,
178 <0 0 32 &gic 0 32 4>,
179 <0 0 33 &gic 0 33 4>,
180 <0 0 34 &gic 0 34 4>,
181 <0 0 35 &gic 0 35 4>,
182 <0 0 36 &gic 0 36 4>,
183 <0 0 37 &gic 0 37 4>,
184 <0 0 38 &gic 0 38 4>,
185 <0 0 39 &gic 0 39 4>,
186 <0 0 40 &gic 0 40 4>,
187 <0 0 41 &gic 0 41 4>,
188 <0 0 42 &gic 0 42 4>;
189 };
190};
191
192/include/ "vexpress-v2m.dtsi"
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c
index fb1f1cfce60..dcb13494ca0 100644
--- a/arch/arm/common/it8152.c
+++ b/arch/arm/common/it8152.c
@@ -299,8 +299,8 @@ int __init it8152_pci_setup(int nr, struct pci_sys_data *sys)
299 goto err1; 299 goto err1;
300 } 300 }
301 301
302 pci_add_resource(&sys->resources, &it8152_io); 302 pci_add_resource_offset(&sys->resources, &it8152_io, sys->io_offset);
303 pci_add_resource(&sys->resources, &it8152_mem); 303 pci_add_resource_offset(&sys->resources, &it8152_mem, sys->mem_offset);
304 304
305 if (platform_notify || platform_notify_remove) { 305 if (platform_notify || platform_notify_remove) {
306 printk(KERN_ERR "PCI: Can't use platform_notify\n"); 306 printk(KERN_ERR "PCI: Can't use platform_notify\n");
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index 8794a34eae6..df13a3ffff3 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -26,6 +26,7 @@
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/io.h> 27#include <linux/io.h>
28 28
29#include <asm/sched_clock.h>
29#include <asm/hardware/arm_timer.h> 30#include <asm/hardware/arm_timer.h>
30 31
31static long __init sp804_get_clock_rate(const char *name) 32static long __init sp804_get_clock_rate(const char *name)
@@ -67,7 +68,16 @@ static long __init sp804_get_clock_rate(const char *name)
67 return rate; 68 return rate;
68} 69}
69 70
70void __init sp804_clocksource_init(void __iomem *base, const char *name) 71static void __iomem *sched_clock_base;
72
73static u32 sp804_read(void)
74{
75 return ~readl_relaxed(sched_clock_base + TIMER_VALUE);
76}
77
78void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base,
79 const char *name,
80 int use_sched_clock)
71{ 81{
72 long rate = sp804_get_clock_rate(name); 82 long rate = sp804_get_clock_rate(name);
73 83
@@ -83,6 +93,11 @@ void __init sp804_clocksource_init(void __iomem *base, const char *name)
83 93
84 clocksource_mmio_init(base + TIMER_VALUE, name, 94 clocksource_mmio_init(base + TIMER_VALUE, name,
85 rate, 200, 32, clocksource_mmio_readl_down); 95 rate, 200, 32, clocksource_mmio_readl_down);
96
97 if (use_sched_clock) {
98 sched_clock_base = base;
99 setup_sched_clock(sp804_read, 32, rate);
100 }
86} 101}
87 102
88 103
diff --git a/arch/arm/configs/at91cap9_defconfig b/arch/arm/configs/at91cap9_defconfig
deleted file mode 100644
index 8826eb218e7..00000000000
--- a/arch/arm/configs/at91cap9_defconfig
+++ /dev/null
@@ -1,108 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_SLAB=y
8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set
11# CONFIG_IOSCHED_DEADLINE is not set
12# CONFIG_IOSCHED_CFQ is not set
13CONFIG_ARCH_AT91=y
14CONFIG_ARCH_AT91CAP9=y
15CONFIG_MACH_AT91CAP9ADK=y
16CONFIG_MTD_AT91_DATAFLASH_CARD=y
17CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
18# CONFIG_ARM_THUMB is not set
19CONFIG_AEABI=y
20CONFIG_LEDS=y
21CONFIG_LEDS_CPU=y
22CONFIG_ZBOOT_ROM_TEXT=0x0
23CONFIG_ZBOOT_ROM_BSS=0x0
24CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/ram0 rw"
25CONFIG_FPE_NWFPE=y
26CONFIG_NET=y
27CONFIG_PACKET=y
28CONFIG_UNIX=y
29CONFIG_INET=y
30CONFIG_IP_PNP=y
31CONFIG_IP_PNP_BOOTP=y
32CONFIG_IP_PNP_RARP=y
33# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
34# CONFIG_INET_XFRM_MODE_TUNNEL is not set
35# CONFIG_INET_XFRM_MODE_BEET is not set
36# CONFIG_INET_LRO is not set
37# CONFIG_INET_DIAG is not set
38# CONFIG_IPV6 is not set
39CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
40CONFIG_MTD=y
41CONFIG_MTD_CMDLINE_PARTS=y
42CONFIG_MTD_CHAR=y
43CONFIG_MTD_BLOCK=y
44CONFIG_MTD_CFI=y
45CONFIG_MTD_JEDECPROBE=y
46CONFIG_MTD_CFI_AMDSTD=y
47CONFIG_MTD_PHYSMAP=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
54CONFIG_SCSI=y
55CONFIG_BLK_DEV_SD=y
56CONFIG_SCSI_MULTI_LUN=y
57CONFIG_NETDEVICES=y
58CONFIG_MII=y
59CONFIG_MACB=y
60# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
61CONFIG_INPUT_EVDEV=y
62# CONFIG_INPUT_KEYBOARD is not set
63# CONFIG_INPUT_MOUSE is not set
64CONFIG_INPUT_TOUCHSCREEN=y
65CONFIG_TOUCHSCREEN_ADS7846=y
66# CONFIG_SERIO is not set
67CONFIG_SERIAL_ATMEL=y
68CONFIG_SERIAL_ATMEL_CONSOLE=y
69CONFIG_HW_RANDOM=y
70CONFIG_I2C=y
71CONFIG_I2C_CHARDEV=y
72CONFIG_SPI=y
73CONFIG_SPI_ATMEL=y
74# CONFIG_HWMON is not set
75CONFIG_WATCHDOG=y
76CONFIG_WATCHDOG_NOWAYOUT=y
77CONFIG_FB=y
78CONFIG_FB_ATMEL=y
79CONFIG_LOGO=y
80# CONFIG_LOGO_LINUX_MONO is not set
81# CONFIG_LOGO_LINUX_CLUT224 is not set
82# CONFIG_USB_HID is not set
83CONFIG_USB=y
84CONFIG_USB_DEVICEFS=y
85CONFIG_USB_MON=y
86CONFIG_USB_OHCI_HCD=y
87CONFIG_USB_STORAGE=y
88CONFIG_USB_GADGET=y
89CONFIG_USB_ETH=m
90CONFIG_USB_FILE_STORAGE=m
91CONFIG_MMC=y
92CONFIG_MMC_AT91=m
93CONFIG_RTC_CLASS=y
94CONFIG_RTC_DRV_AT91SAM9=y
95CONFIG_EXT2_FS=y
96CONFIG_VFAT_FS=y
97CONFIG_TMPFS=y
98CONFIG_JFFS2_FS=y
99CONFIG_CRAMFS=y
100CONFIG_NFS_FS=y
101CONFIG_ROOT_NFS=y
102CONFIG_NLS_CODEPAGE_437=y
103CONFIG_NLS_CODEPAGE_850=y
104CONFIG_NLS_ISO8859_1=y
105CONFIG_DEBUG_FS=y
106CONFIG_DEBUG_KERNEL=y
107CONFIG_DEBUG_INFO=y
108CONFIG_DEBUG_USER=y
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index a22e9307906..b5ac644e12a 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -45,6 +45,7 @@ CONFIG_FPE_NWFPE=y
45CONFIG_FPE_NWFPE_XP=y 45CONFIG_FPE_NWFPE_XP=y
46CONFIG_PM_DEBUG=y 46CONFIG_PM_DEBUG=y
47CONFIG_NET=y 47CONFIG_NET=y
48CONFIG_SMSC911X=y
48CONFIG_PACKET=y 49CONFIG_PACKET=y
49CONFIG_UNIX=y 50CONFIG_UNIX=y
50CONFIG_INET=y 51CONFIG_INET=y
@@ -68,6 +69,7 @@ CONFIG_MTD_CFI=y
68CONFIG_MTD_CFI_ADV_OPTIONS=y 69CONFIG_MTD_CFI_ADV_OPTIONS=y
69CONFIG_MTD_CFI_GEOMETRY=y 70CONFIG_MTD_CFI_GEOMETRY=y
70# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set 71# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
72CONFIG_MTD_MAP_BANK_WIDTH_4=y
71# CONFIG_MTD_CFI_I2 is not set 73# CONFIG_MTD_CFI_I2 is not set
72CONFIG_MTD_CFI_INTELEXT=y 74CONFIG_MTD_CFI_INTELEXT=y
73CONFIG_MTD_PHYSMAP=y 75CONFIG_MTD_PHYSMAP=y
@@ -78,6 +80,8 @@ CONFIG_MISC_DEVICES=y
78CONFIG_EEPROM_AT24=y 80CONFIG_EEPROM_AT24=y
79CONFIG_EEPROM_AT25=y 81CONFIG_EEPROM_AT25=y
80CONFIG_NETDEVICES=y 82CONFIG_NETDEVICES=y
83CONFIG_CS89x0=y
84CONFIG_CS89x0_PLATFORM=y
81CONFIG_DM9000=y 85CONFIG_DM9000=y
82CONFIG_SMC91X=y 86CONFIG_SMC91X=y
83CONFIG_SMC911X=y 87CONFIG_SMC911X=y
@@ -115,6 +119,21 @@ CONFIG_FB_IMX=y
115CONFIG_BACKLIGHT_LCD_SUPPORT=y 119CONFIG_BACKLIGHT_LCD_SUPPORT=y
116CONFIG_LCD_CLASS_DEVICE=y 120CONFIG_LCD_CLASS_DEVICE=y
117CONFIG_BACKLIGHT_CLASS_DEVICE=y 121CONFIG_BACKLIGHT_CLASS_DEVICE=y
122CONFIG_LCD_L4F00242T03=y
123CONFIG_MEDIA_SUPPORT=y
124CONFIG_VIDEO_DEV=y
125CONFIG_VIDEO_V4L2_COMMON=y
126CONFIG_VIDEO_MEDIA=y
127CONFIG_VIDEO_V4L2=y
128CONFIG_VIDEOBUF_GEN=y
129CONFIG_VIDEOBUF_DMA_CONTIG=y
130CONFIG_VIDEOBUF2_CORE=y
131CONFIG_VIDEO_CAPTURE_DRIVERS=y
132CONFIG_V4L_PLATFORM_DRIVERS=y
133CONFIG_SOC_CAMERA=y
134CONFIG_SOC_CAMERA_OV2640=y
135CONFIG_VIDEO_MX2_HOSTSUPPORT=y
136CONFIG_VIDEO_MX2=y
118CONFIG_BACKLIGHT_PWM=y 137CONFIG_BACKLIGHT_PWM=y
119CONFIG_FRAMEBUFFER_CONSOLE=y 138CONFIG_FRAMEBUFFER_CONSOLE=y
120CONFIG_FONTS=y 139CONFIG_FONTS=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 3a4fb2e5fc6..dc6f6411bbf 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -5,6 +5,7 @@ CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=18 5CONFIG_LOG_BUF_SHIFT=18
6CONFIG_CGROUPS=y 6CONFIG_CGROUPS=y
7CONFIG_RELAY=y 7CONFIG_RELAY=y
8CONFIG_BLK_DEV_INITRD=y
8CONFIG_EXPERT=y 9CONFIG_EXPERT=y
9# CONFIG_SLUB_DEBUG is not set 10# CONFIG_SLUB_DEBUG is not set
10# CONFIG_COMPAT_BRK is not set 11# CONFIG_COMPAT_BRK is not set
@@ -12,7 +13,6 @@ CONFIG_MODULES=y
12CONFIG_MODULE_UNLOAD=y 13CONFIG_MODULE_UNLOAD=y
13CONFIG_MODVERSIONS=y 14CONFIG_MODVERSIONS=y
14CONFIG_MODULE_SRCVERSION_ALL=y 15CONFIG_MODULE_SRCVERSION_ALL=y
15# CONFIG_LBDAF is not set
16# CONFIG_BLK_DEV_BSG is not set 16# CONFIG_BLK_DEV_BSG is not set
17CONFIG_ARCH_MXC=y 17CONFIG_ARCH_MXC=y
18CONFIG_MACH_MX31LILLY=y 18CONFIG_MACH_MX31LILLY=y
@@ -26,7 +26,6 @@ CONFIG_MACH_ARMADILLO5X0=y
26CONFIG_MACH_KZM_ARM11_01=y 26CONFIG_MACH_KZM_ARM11_01=y
27CONFIG_MACH_PCM043=y 27CONFIG_MACH_PCM043=y
28CONFIG_MACH_MX35_3DS=y 28CONFIG_MACH_MX35_3DS=y
29CONFIG_MACH_EUKREA_CPUIMX35=y
30CONFIG_MACH_VPR200=y 29CONFIG_MACH_VPR200=y
31CONFIG_MACH_IMX51_DT=y 30CONFIG_MACH_IMX51_DT=y
32CONFIG_MACH_MX51_3DS=y 31CONFIG_MACH_MX51_3DS=y
@@ -82,8 +81,9 @@ CONFIG_PATA_IMX=y
82CONFIG_NETDEVICES=y 81CONFIG_NETDEVICES=y
83# CONFIG_NET_VENDOR_BROADCOM is not set 82# CONFIG_NET_VENDOR_BROADCOM is not set
84# CONFIG_NET_VENDOR_CHELSIO is not set 83# CONFIG_NET_VENDOR_CHELSIO is not set
84CONFIG_CS89x0=y
85CONFIG_CS89x0_PLATFORM=y
85# CONFIG_NET_VENDOR_FARADAY is not set 86# CONFIG_NET_VENDOR_FARADAY is not set
86CONFIG_FEC=y
87# CONFIG_NET_VENDOR_INTEL is not set 87# CONFIG_NET_VENDOR_INTEL is not set
88# CONFIG_NET_VENDOR_MARVELL is not set 88# CONFIG_NET_VENDOR_MARVELL is not set
89# CONFIG_NET_VENDOR_MICREL is not set 89# CONFIG_NET_VENDOR_MICREL is not set
@@ -126,7 +126,40 @@ CONFIG_WATCHDOG=y
126CONFIG_IMX2_WDT=y 126CONFIG_IMX2_WDT=y
127CONFIG_MFD_MC13XXX=y 127CONFIG_MFD_MC13XXX=y
128CONFIG_REGULATOR=y 128CONFIG_REGULATOR=y
129CONFIG_REGULATOR_FIXED_VOLTAGE=y
130CONFIG_REGULATOR_MC13783=y
129CONFIG_REGULATOR_MC13892=y 131CONFIG_REGULATOR_MC13892=y
132CONFIG_MEDIA_SUPPORT=y
133CONFIG_VIDEO_V4L2=y
134CONFIG_VIDEO_DEV=y
135CONFIG_VIDEO_V4L2_COMMON=y
136CONFIG_VIDEOBUF_GEN=y
137CONFIG_VIDEOBUF2_CORE=y
138CONFIG_VIDEOBUF2_MEMOPS=y
139CONFIG_VIDEOBUF2_DMA_CONTIG=y
140CONFIG_VIDEO_CAPTURE_DRIVERS=y
141CONFIG_V4L_PLATFORM_DRIVERS=y
142CONFIG_SOC_CAMERA=y
143CONFIG_SOC_CAMERA_OV2640=y
144CONFIG_MX3_VIDEO=y
145CONFIG_VIDEO_MX3=y
146CONFIG_FB=y
147CONFIG_FB_MX3=y
148CONFIG_BACKLIGHT_LCD_SUPPORT=y
149CONFIG_LCD_CLASS_DEVICE=y
150CONFIG_LCD_L4F00242T03=y
151CONFIG_BACKLIGHT_CLASS_DEVICE=y
152CONFIG_BACKLIGHT_GENERIC=y
153CONFIG_DUMMY_CONSOLE=y
154CONFIG_FRAMEBUFFER_CONSOLE=y
155CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
156CONFIG_FONTS=y
157CONFIG_FONT_8x8=y
158CONFIG_FONT_8x16=y
159CONFIG_LOGO=y
160CONFIG_LOGO_LINUX_MONO=y
161CONFIG_LOGO_LINUX_VGA16=y
162CONFIG_LOGO_LINUX_CLUT224=y
130CONFIG_USB=y 163CONFIG_USB=y
131CONFIG_USB_EHCI_HCD=y 164CONFIG_USB_EHCI_HCD=y
132CONFIG_USB_EHCI_MXC=y 165CONFIG_USB_EHCI_MXC=y
diff --git a/arch/arm/configs/lpc32xx_defconfig b/arch/arm/configs/lpc32xx_defconfig
new file mode 100644
index 00000000000..fb2088171ca
--- /dev/null
+++ b/arch/arm/configs/lpc32xx_defconfig
@@ -0,0 +1,145 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED=y
7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y
9CONFIG_CC_OPTIMIZE_FOR_SIZE=y
10CONFIG_SYSCTL_SYSCALL=y
11CONFIG_EMBEDDED=y
12CONFIG_SLAB=y
13CONFIG_MODULES=y
14CONFIG_MODULE_UNLOAD=y
15# CONFIG_BLK_DEV_BSG is not set
16CONFIG_PARTITION_ADVANCED=y
17CONFIG_ARCH_LPC32XX=y
18CONFIG_NO_HZ=y
19CONFIG_HIGH_RES_TIMERS=y
20CONFIG_PREEMPT=y
21CONFIG_AEABI=y
22CONFIG_ZBOOT_ROM_TEXT=0x0
23CONFIG_ZBOOT_ROM_BSS=0x0
24CONFIG_CMDLINE="console=ttyS0,115200n81 root=/dev/ram0"
25CONFIG_CPU_IDLE=y
26CONFIG_FPE_NWFPE=y
27CONFIG_VFP=y
28# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
29CONFIG_BINFMT_AOUT=y
30CONFIG_NET=y
31CONFIG_PACKET=y
32CONFIG_UNIX=y
33CONFIG_INET=y
34CONFIG_IP_MULTICAST=y
35CONFIG_IP_PNP=y
36CONFIG_IP_PNP_DHCP=y
37CONFIG_IP_PNP_BOOTP=y
38# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
39# CONFIG_INET_XFRM_MODE_TUNNEL is not set
40# CONFIG_INET_XFRM_MODE_BEET is not set
41# CONFIG_INET_LRO is not set
42# CONFIG_INET_DIAG is not set
43# CONFIG_IPV6 is not set
44# CONFIG_WIRELESS is not set
45CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
46# CONFIG_FW_LOADER is not set
47CONFIG_MTD=y
48CONFIG_MTD_CMDLINE_PARTS=y
49CONFIG_MTD_CHAR=y
50CONFIG_MTD_BLOCK=y
51CONFIG_MTD_NAND=y
52CONFIG_MTD_NAND_MUSEUM_IDS=y
53CONFIG_BLK_DEV_LOOP=y
54CONFIG_BLK_DEV_CRYPTOLOOP=y
55CONFIG_BLK_DEV_RAM=y
56CONFIG_BLK_DEV_RAM_COUNT=1
57CONFIG_BLK_DEV_RAM_SIZE=16384
58CONFIG_MISC_DEVICES=y
59CONFIG_EEPROM_AT25=y
60CONFIG_SCSI=y
61CONFIG_BLK_DEV_SD=y
62CONFIG_NETDEVICES=y
63CONFIG_MII=y
64CONFIG_PHYLIB=y
65CONFIG_SMSC_PHY=y
66# CONFIG_WLAN is not set
67# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
68CONFIG_INPUT_MOUSEDEV_SCREEN_X=240
69CONFIG_INPUT_MOUSEDEV_SCREEN_Y=320
70CONFIG_INPUT_EVDEV=y
71# CONFIG_INPUT_MOUSE is not set
72CONFIG_INPUT_TOUCHSCREEN=y
73CONFIG_TOUCHSCREEN_LPC32XX=y
74# CONFIG_LEGACY_PTYS is not set
75CONFIG_SERIAL_8250=y
76CONFIG_SERIAL_8250_CONSOLE=y
77# CONFIG_HW_RANDOM is not set
78CONFIG_I2C=y
79CONFIG_I2C_CHARDEV=y
80CONFIG_I2C_PNX=y
81CONFIG_SPI=y
82CONFIG_SPI_PL022=y
83CONFIG_GPIO_SYSFS=y
84# CONFIG_HWMON is not set
85CONFIG_WATCHDOG=y
86CONFIG_PNX4008_WATCHDOG=y
87CONFIG_FB=y
88CONFIG_FB_ARMCLCD=y
89CONFIG_FRAMEBUFFER_CONSOLE=y
90CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
91CONFIG_LOGO=y
92# CONFIG_LOGO_LINUX_MONO is not set
93# CONFIG_LOGO_LINUX_VGA16 is not set
94CONFIG_SOUND=y
95CONFIG_SND=y
96CONFIG_SND_SEQUENCER=y
97CONFIG_SND_MIXER_OSS=y
98CONFIG_SND_PCM_OSS=y
99CONFIG_SND_SEQUENCER_OSS=y
100CONFIG_SND_DYNAMIC_MINORS=y
101# CONFIG_SND_VERBOSE_PROCFS is not set
102# CONFIG_SND_DRIVERS is not set
103# CONFIG_SND_ARM is not set
104# CONFIG_SND_SPI is not set
105CONFIG_SND_SOC=y
106# CONFIG_HID_SUPPORT is not set
107CONFIG_USB=y
108CONFIG_USB_STORAGE=y
109CONFIG_USB_LIBUSUAL=y
110CONFIG_MMC=y
111# CONFIG_MMC_BLOCK_BOUNCE is not set
112CONFIG_MMC_ARMMMCI=y
113CONFIG_NEW_LEDS=y
114CONFIG_LEDS_CLASS=y
115CONFIG_LEDS_GPIO=y
116CONFIG_LEDS_TRIGGERS=y
117CONFIG_LEDS_TRIGGER_HEARTBEAT=y
118CONFIG_RTC_CLASS=y
119CONFIG_RTC_INTF_DEV_UIE_EMUL=y
120CONFIG_RTC_DRV_LPC32XX=y
121CONFIG_EXT2_FS=y
122CONFIG_AUTOFS4_FS=y
123CONFIG_MSDOS_FS=y
124CONFIG_VFAT_FS=y
125CONFIG_TMPFS=y
126CONFIG_JFFS2_FS=y
127CONFIG_JFFS2_FS_WBUF_VERIFY=y
128CONFIG_CRAMFS=y
129CONFIG_NFS_FS=y
130CONFIG_NFS_V3=y
131CONFIG_ROOT_NFS=y
132CONFIG_NLS_CODEPAGE_437=y
133CONFIG_NLS_ASCII=y
134CONFIG_NLS_ISO8859_1=y
135CONFIG_NLS_UTF8=y
136# CONFIG_SCHED_DEBUG is not set
137# CONFIG_DEBUG_PREEMPT is not set
138CONFIG_DEBUG_INFO=y
139# CONFIG_FTRACE is not set
140# CONFIG_ARM_UNWIND is not set
141CONFIG_DEBUG_LL=y
142CONFIG_EARLY_PRINTK=y
143CONFIG_CRYPTO_ANSI_CPRNG=y
144# CONFIG_CRYPTO_HW is not set
145CONFIG_CRC_CCITT=y
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig
index 443675d317e..a691ef4c600 100644
--- a/arch/arm/configs/magician_defconfig
+++ b/arch/arm/configs/magician_defconfig
@@ -101,7 +101,7 @@ CONFIG_MFD_ASIC3=y
101CONFIG_HTC_EGPIO=y 101CONFIG_HTC_EGPIO=y
102CONFIG_HTC_PASIC3=y 102CONFIG_HTC_PASIC3=y
103CONFIG_REGULATOR=y 103CONFIG_REGULATOR=y
104CONFIG_REGULATOR_BQ24022=y 104CONFIG_REGULATOR_GPIO=y
105CONFIG_FB=y 105CONFIG_FB=y
106CONFIG_FB_PXA=y 106CONFIG_FB_PXA=y
107CONFIG_FB_PXA_OVERLAY=y 107CONFIG_FB_PXA_OVERLAY=y
diff --git a/arch/arm/configs/mini2440_defconfig b/arch/arm/configs/mini2440_defconfig
index 2472a958583..42da9183acc 100644
--- a/arch/arm/configs/mini2440_defconfig
+++ b/arch/arm/configs/mini2440_defconfig
@@ -13,7 +13,7 @@ CONFIG_MODULE_UNLOAD=y
13CONFIG_MODULE_FORCE_UNLOAD=y 13CONFIG_MODULE_FORCE_UNLOAD=y
14# CONFIG_BLK_DEV_BSG is not set 14# CONFIG_BLK_DEV_BSG is not set
15CONFIG_BLK_DEV_INTEGRITY=y 15CONFIG_BLK_DEV_INTEGRITY=y
16CONFIG_ARCH_S3C2410=y 16CONFIG_ARCH_S3C24XX=y
17CONFIG_S3C_ADC=y 17CONFIG_S3C_ADC=y
18CONFIG_S3C24XX_PWM=y 18CONFIG_S3C24XX_PWM=y
19CONFIG_MACH_MINI2440=y 19CONFIG_MACH_MINI2440=y
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index 6ee781bf6bf..1ebbf451c48 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -77,10 +77,10 @@ CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
77CONFIG_SERIAL_AMBA_PL011=y 77CONFIG_SERIAL_AMBA_PL011=y
78CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 78CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
79# CONFIG_HW_RANDOM is not set 79# CONFIG_HW_RANDOM is not set
80CONFIG_I2C=m 80CONFIG_I2C=y
81# CONFIG_I2C_COMPAT is not set 81# CONFIG_I2C_COMPAT is not set
82CONFIG_I2C_CHARDEV=m 82CONFIG_I2C_CHARDEV=y
83CONFIG_I2C_MXS=m 83CONFIG_I2C_MXS=y
84CONFIG_SPI=y 84CONFIG_SPI=y
85CONFIG_SPI_GPIO=m 85CONFIG_SPI_GPIO=m
86CONFIG_DEBUG_GPIO=y 86CONFIG_DEBUG_GPIO=y
@@ -90,6 +90,20 @@ CONFIG_GPIO_SYSFS=y
90CONFIG_DISPLAY_SUPPORT=m 90CONFIG_DISPLAY_SUPPORT=m
91# CONFIG_HID_SUPPORT is not set 91# CONFIG_HID_SUPPORT is not set
92# CONFIG_USB_SUPPORT is not set 92# CONFIG_USB_SUPPORT is not set
93CONFIG_SOUND=y
94CONFIG_SND=y
95CONFIG_SND_TIMER=y
96CONFIG_SND_PCM=y
97CONFIG_SND_JACK=y
98CONFIG_SND_DRIVERS=y
99CONFIG_SND_ARM=y
100CONFIG_SND_SOC=y
101CONFIG_SND_MXS_SOC=y
102CONFIG_SND_SOC_MXS_SGTL5000=y
103CONFIG_SND_SOC_I2C_AND_SPI=y
104CONFIG_SND_SOC_SGTL5000=y
105CONFIG_REGULATOR=y
106CONFIG_REGULATOR_FIXED_VOLTAGE=y
93CONFIG_MMC=y 107CONFIG_MMC=y
94CONFIG_MMC_MXS=y 108CONFIG_MMC_MXS=y
95CONFIG_RTC_CLASS=y 109CONFIG_RTC_CLASS=y
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index f9096c1b0a6..193448f3128 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -3,40 +3,47 @@ CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=m 3CONFIG_IKCONFIG=m
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16 5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
8CONFIG_SLAB=y 7CONFIG_SLAB=y
9CONFIG_MODULES=y 8CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 10# CONFIG_BLK_DEV_BSG is not set
12CONFIG_ARCH_S3C2410=y 11CONFIG_PARTITION_ADVANCED=y
12CONFIG_BSD_DISKLABEL=y
13CONFIG_SOLARIS_X86_PARTITION=y
14CONFIG_ARCH_S3C24XX=y
13CONFIG_S3C_BOOT_ERROR_RESET=y 15CONFIG_S3C_BOOT_ERROR_RESET=y
14CONFIG_S3C_ADC=y 16CONFIG_S3C_ADC=y
15CONFIG_S3C24XX_PWM=y 17CONFIG_S3C24XX_PWM=y
16CONFIG_ARCH_SMDK2410=y 18CONFIG_CPU_S3C2412=y
19CONFIG_CPU_S3C2416=y
20CONFIG_CPU_S3C2440=y
21CONFIG_CPU_S3C2442=y
22CONFIG_CPU_S3C2443=y
23CONFIG_MACH_AML_M5900=y
24CONFIG_ARCH_BAST=y
17CONFIG_ARCH_H1940=y 25CONFIG_ARCH_H1940=y
18CONFIG_MACH_N30=y 26CONFIG_MACH_N30=y
19CONFIG_ARCH_BAST=y
20CONFIG_MACH_OTOM=y 27CONFIG_MACH_OTOM=y
21CONFIG_MACH_AML_M5900=y 28CONFIG_MACH_QT2410=y
29CONFIG_ARCH_SMDK2410=y
22CONFIG_MACH_TCT_HAMMER=y 30CONFIG_MACH_TCT_HAMMER=y
23CONFIG_MACH_VR1000=y 31CONFIG_MACH_VR1000=y
24CONFIG_MACH_QT2410=y
25CONFIG_MACH_JIVE=y 32CONFIG_MACH_JIVE=y
26CONFIG_MACH_SMDK2412=y 33CONFIG_MACH_SMDK2412=y
27CONFIG_MACH_VSTMS=y 34CONFIG_MACH_VSTMS=y
28CONFIG_MACH_SMDK2416=y 35CONFIG_MACH_SMDK2416=y
29CONFIG_MACH_ANUBIS=y 36CONFIG_MACH_ANUBIS=y
30CONFIG_MACH_NEO1973_GTA02=y 37CONFIG_MACH_AT2440EVB=y
38CONFIG_MACH_MINI2440=y
39CONFIG_MACH_NEXCODER_2440=y
31CONFIG_MACH_OSIRIS=y 40CONFIG_MACH_OSIRIS=y
32CONFIG_MACH_OSIRIS_DVS=m 41CONFIG_MACH_OSIRIS_DVS=m
33CONFIG_MACH_RX3715=y 42CONFIG_MACH_RX3715=y
34CONFIG_ARCH_S3C2440=y 43CONFIG_ARCH_S3C2440=y
35CONFIG_MACH_NEXCODER_2440=y 44CONFIG_MACH_NEO1973_GTA02=y
36CONFIG_SMDK2440_CPU2442=y
37CONFIG_MACH_AT2440EVB=y
38CONFIG_MACH_MINI2440=y
39CONFIG_MACH_RX1950=y 45CONFIG_MACH_RX1950=y
46CONFIG_SMDK2440_CPU2442=y
40CONFIG_MACH_SMDK2443=y 47CONFIG_MACH_SMDK2443=y
41# CONFIG_ARM_THUMB is not set 48# CONFIG_ARM_THUMB is not set
42CONFIG_ZBOOT_ROM_TEXT=0x0 49CONFIG_ZBOOT_ROM_TEXT=0x0
@@ -45,7 +52,6 @@ CONFIG_CMDLINE="root=/dev/hda1 ro init=/bin/bash console=ttySAC0"
45CONFIG_FPE_NWFPE=y 52CONFIG_FPE_NWFPE=y
46CONFIG_FPE_NWFPE_XP=y 53CONFIG_FPE_NWFPE_XP=y
47CONFIG_BINFMT_AOUT=y 54CONFIG_BINFMT_AOUT=y
48CONFIG_PM=y
49CONFIG_APM_EMULATION=m 55CONFIG_APM_EMULATION=m
50CONFIG_NET=y 56CONFIG_NET=y
51CONFIG_PACKET=y 57CONFIG_PACKET=y
@@ -58,7 +64,6 @@ CONFIG_IP_PNP=y
58CONFIG_IP_PNP_DHCP=y 64CONFIG_IP_PNP_DHCP=y
59CONFIG_IP_PNP_BOOTP=y 65CONFIG_IP_PNP_BOOTP=y
60CONFIG_NET_IPIP=m 66CONFIG_NET_IPIP=m
61CONFIG_NET_IPGRE=m
62CONFIG_INET_AH=m 67CONFIG_INET_AH=m
63CONFIG_INET_ESP=m 68CONFIG_INET_ESP=m
64CONFIG_INET_IPCOMP=m 69CONFIG_INET_IPCOMP=m
@@ -80,7 +85,6 @@ CONFIG_IPV6_MIP6=m
80CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 85CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
81CONFIG_IPV6_TUNNEL=m 86CONFIG_IPV6_TUNNEL=m
82CONFIG_NETFILTER=y 87CONFIG_NETFILTER=y
83CONFIG_NETFILTER_NETLINK_QUEUE=m
84CONFIG_NF_CONNTRACK=m 88CONFIG_NF_CONNTRACK=m
85CONFIG_NF_CONNTRACK_EVENTS=y 89CONFIG_NF_CONNTRACK_EVENTS=y
86CONFIG_NF_CT_PROTO_DCCP=m 90CONFIG_NF_CT_PROTO_DCCP=m
@@ -138,7 +142,6 @@ CONFIG_IP_VS=m
138CONFIG_NF_CONNTRACK_IPV4=m 142CONFIG_NF_CONNTRACK_IPV4=m
139CONFIG_IP_NF_QUEUE=m 143CONFIG_IP_NF_QUEUE=m
140CONFIG_IP_NF_IPTABLES=m 144CONFIG_IP_NF_IPTABLES=m
141CONFIG_IP_NF_MATCH_ADDRTYPE=m
142CONFIG_IP_NF_MATCH_AH=m 145CONFIG_IP_NF_MATCH_AH=m
143CONFIG_IP_NF_MATCH_ECN=m 146CONFIG_IP_NF_MATCH_ECN=m
144CONFIG_IP_NF_MATCH_TTL=m 147CONFIG_IP_NF_MATCH_TTL=m
@@ -150,7 +153,6 @@ CONFIG_NF_NAT=m
150CONFIG_IP_NF_TARGET_MASQUERADE=m 153CONFIG_IP_NF_TARGET_MASQUERADE=m
151CONFIG_IP_NF_TARGET_NETMAP=m 154CONFIG_IP_NF_TARGET_NETMAP=m
152CONFIG_IP_NF_TARGET_REDIRECT=m 155CONFIG_IP_NF_TARGET_REDIRECT=m
153CONFIG_NF_NAT_SNMP_BASIC=m
154CONFIG_IP_NF_MANGLE=m 156CONFIG_IP_NF_MANGLE=m
155CONFIG_IP_NF_TARGET_CLUSTERIP=m 157CONFIG_IP_NF_TARGET_CLUSTERIP=m
156CONFIG_IP_NF_TARGET_ECN=m 158CONFIG_IP_NF_TARGET_ECN=m
@@ -177,8 +179,6 @@ CONFIG_IP6_NF_TARGET_REJECT=m
177CONFIG_IP6_NF_MANGLE=m 179CONFIG_IP6_NF_MANGLE=m
178CONFIG_IP6_NF_RAW=m 180CONFIG_IP6_NF_RAW=m
179CONFIG_BT=m 181CONFIG_BT=m
180CONFIG_BT_L2CAP=m
181CONFIG_BT_SCO=m
182CONFIG_BT_RFCOMM=m 182CONFIG_BT_RFCOMM=m
183CONFIG_BT_RFCOMM_TTY=y 183CONFIG_BT_RFCOMM_TTY=y
184CONFIG_BT_BNEP=m 184CONFIG_BT_BNEP=m
@@ -199,7 +199,6 @@ CONFIG_MAC80211_MESH=y
199CONFIG_MAC80211_LEDS=y 199CONFIG_MAC80211_LEDS=y
200CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 200CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
201CONFIG_MTD=y 201CONFIG_MTD=y
202CONFIG_MTD_PARTITIONS=y
203CONFIG_MTD_REDBOOT_PARTS=y 202CONFIG_MTD_REDBOOT_PARTS=y
204CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y 203CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
205CONFIG_MTD_CMDLINE_PARTS=y 204CONFIG_MTD_CMDLINE_PARTS=y
@@ -221,9 +220,6 @@ CONFIG_BLK_DEV_NBD=m
221CONFIG_BLK_DEV_UB=m 220CONFIG_BLK_DEV_UB=m
222CONFIG_BLK_DEV_RAM=y 221CONFIG_BLK_DEV_RAM=y
223CONFIG_ATA_OVER_ETH=m 222CONFIG_ATA_OVER_ETH=m
224CONFIG_EEPROM_AT25=m
225CONFIG_EEPROM_LEGACY=m
226CONFIG_EEPROM_93CX6=m
227CONFIG_IDE=y 223CONFIG_IDE=y
228CONFIG_BLK_DEV_IDECD=y 224CONFIG_BLK_DEV_IDECD=y
229CONFIG_BLK_DEV_IDETAPE=m 225CONFIG_BLK_DEV_IDETAPE=m
@@ -240,7 +236,6 @@ CONFIG_SCSI_MULTI_LUN=y
240CONFIG_SCSI_CONSTANTS=y 236CONFIG_SCSI_CONSTANTS=y
241CONFIG_SCSI_SCAN_ASYNC=y 237CONFIG_SCSI_SCAN_ASYNC=y
242CONFIG_NETDEVICES=y 238CONFIG_NETDEVICES=y
243CONFIG_NET_ETHERNET=y
244CONFIG_DM9000=y 239CONFIG_DM9000=y
245CONFIG_INPUT_EVDEV=y 240CONFIG_INPUT_EVDEV=y
246CONFIG_MOUSE_APPLETOUCH=m 241CONFIG_MOUSE_APPLETOUCH=m
@@ -274,7 +269,6 @@ CONFIG_JOYSTICK_XPAD_LEDS=y
274CONFIG_INPUT_TOUCHSCREEN=y 269CONFIG_INPUT_TOUCHSCREEN=y
275CONFIG_TOUCHSCREEN_USB_COMPOSITE=m 270CONFIG_TOUCHSCREEN_USB_COMPOSITE=m
276CONFIG_INPUT_MISC=y 271CONFIG_INPUT_MISC=y
277CONFIG_INPUT_ATI_REMOTE=m
278CONFIG_INPUT_ATI_REMOTE2=m 272CONFIG_INPUT_ATI_REMOTE2=m
279CONFIG_INPUT_KEYSPAN_REMOTE=m 273CONFIG_INPUT_KEYSPAN_REMOTE=m
280CONFIG_INPUT_POWERMATE=m 274CONFIG_INPUT_POWERMATE=m
@@ -300,7 +294,6 @@ CONFIG_I2C_SIMTEC=y
300CONFIG_SPI=y 294CONFIG_SPI=y
301CONFIG_SPI_GPIO=m 295CONFIG_SPI_GPIO=m
302CONFIG_SPI_S3C24XX=m 296CONFIG_SPI_S3C24XX=m
303CONFIG_SPI_S3C24XX_GPIO=m
304CONFIG_SPI_SPIDEV=m 297CONFIG_SPI_SPIDEV=m
305CONFIG_SPI_TLE62X0=m 298CONFIG_SPI_TLE62X0=m
306CONFIG_SENSORS_LM75=m 299CONFIG_SENSORS_LM75=m
@@ -315,7 +308,6 @@ CONFIG_FB_MODE_HELPERS=y
315CONFIG_FB_S3C2410=y 308CONFIG_FB_S3C2410=y
316CONFIG_FB_SM501=y 309CONFIG_FB_SM501=y
317CONFIG_BACKLIGHT_PWM=m 310CONFIG_BACKLIGHT_PWM=m
318# CONFIG_VGA_CONSOLE is not set
319CONFIG_FRAMEBUFFER_CONSOLE=y 311CONFIG_FRAMEBUFFER_CONSOLE=y
320CONFIG_SOUND=y 312CONFIG_SOUND=y
321CONFIG_SND=y 313CONFIG_SND=y
@@ -330,10 +322,6 @@ CONFIG_SND_VERBOSE_PRINTK=y
330CONFIG_SND_USB_AUDIO=m 322CONFIG_SND_USB_AUDIO=m
331CONFIG_SND_USB_CAIAQ=m 323CONFIG_SND_USB_CAIAQ=m
332CONFIG_SND_SOC=y 324CONFIG_SND_SOC=y
333CONFIG_SND_S3C24XX_SOC=y
334CONFIG_SND_S3C24XX_SOC_JIVE_WM8750=m
335CONFIG_SND_S3C24XX_SOC_SMDK2443_WM9710=m
336CONFIG_SND_S3C24XX_SOC_LN2440SBC_ALC650=m
337# CONFIG_USB_HID is not set 325# CONFIG_USB_HID is not set
338CONFIG_USB=y 326CONFIG_USB=y
339CONFIG_USB_DEVICEFS=y 327CONFIG_USB_DEVICEFS=y
@@ -387,9 +375,7 @@ CONFIG_MMC_TEST=m
387CONFIG_MMC_SDHCI=m 375CONFIG_MMC_SDHCI=m
388CONFIG_MMC_SPI=m 376CONFIG_MMC_SPI=m
389CONFIG_MMC_S3C=y 377CONFIG_MMC_S3C=y
390CONFIG_LEDS_CLASS=m
391CONFIG_LEDS_S3C24XX=m 378CONFIG_LEDS_S3C24XX=m
392CONFIG_LEDS_H1940=m
393CONFIG_LEDS_PCA9532=m 379CONFIG_LEDS_PCA9532=m
394CONFIG_LEDS_GPIO=m 380CONFIG_LEDS_GPIO=m
395CONFIG_LEDS_PCA955X=m 381CONFIG_LEDS_PCA955X=m
@@ -410,8 +396,6 @@ CONFIG_EXT3_FS=y
410CONFIG_EXT3_FS_POSIX_ACL=y 396CONFIG_EXT3_FS_POSIX_ACL=y
411CONFIG_EXT4_FS=m 397CONFIG_EXT4_FS=m
412CONFIG_EXT4_FS_POSIX_ACL=y 398CONFIG_EXT4_FS_POSIX_ACL=y
413CONFIG_INOTIFY=y
414CONFIG_AUTOFS_FS=m
415CONFIG_AUTOFS4_FS=m 399CONFIG_AUTOFS4_FS=m
416CONFIG_FUSE_FS=m 400CONFIG_FUSE_FS=m
417CONFIG_ISO9660_FS=y 401CONFIG_ISO9660_FS=y
@@ -436,9 +420,6 @@ CONFIG_NFSD=m
436CONFIG_NFSD_V3_ACL=y 420CONFIG_NFSD_V3_ACL=y
437CONFIG_NFSD_V4=y 421CONFIG_NFSD_V4=y
438CONFIG_CIFS=m 422CONFIG_CIFS=m
439CONFIG_PARTITION_ADVANCED=y
440CONFIG_BSD_DISKLABEL=y
441CONFIG_SOLARIS_X86_PARTITION=y
442CONFIG_NLS_CODEPAGE_437=y 423CONFIG_NLS_CODEPAGE_437=y
443CONFIG_NLS_CODEPAGE_737=m 424CONFIG_NLS_CODEPAGE_737=m
444CONFIG_NLS_CODEPAGE_775=m 425CONFIG_NLS_CODEPAGE_775=m
@@ -481,9 +462,7 @@ CONFIG_MAGIC_SYSRQ=y
481CONFIG_DEBUG_KERNEL=y 462CONFIG_DEBUG_KERNEL=y
482CONFIG_DEBUG_MUTEXES=y 463CONFIG_DEBUG_MUTEXES=y
483CONFIG_DEBUG_INFO=y 464CONFIG_DEBUG_INFO=y
484# CONFIG_RCU_CPU_STALL_DETECTOR is not set
485CONFIG_SYSCTL_SYSCALL_CHECK=y 465CONFIG_SYSCTL_SYSCALL_CHECK=y
486CONFIG_DEBUG_USER=y 466CONFIG_DEBUG_USER=y
487CONFIG_DEBUG_ERRORS=y
488CONFIG_DEBUG_LL=y 467CONFIG_DEBUG_LL=y
489# CONFIG_CRYPTO_ANSI_CPRNG is not set 468# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/arm/configs/tct_hammer_defconfig b/arch/arm/configs/tct_hammer_defconfig
index 95c0f0d63db..1d24f8458be 100644
--- a/arch/arm/configs/tct_hammer_defconfig
+++ b/arch/arm/configs/tct_hammer_defconfig
@@ -14,7 +14,7 @@ CONFIG_SLOB=y
14CONFIG_MODULES=y 14CONFIG_MODULES=y
15CONFIG_MODULE_UNLOAD=y 15CONFIG_MODULE_UNLOAD=y
16# CONFIG_BLK_DEV_BSG is not set 16# CONFIG_BLK_DEV_BSG is not set
17CONFIG_ARCH_S3C2410=y 17CONFIG_ARCH_S3C24XX=y
18CONFIG_MACH_TCT_HAMMER=y 18CONFIG_MACH_TCT_HAMMER=y
19CONFIG_ZBOOT_ROM_TEXT=0x0 19CONFIG_ZBOOT_ROM_TEXT=0x0
20CONFIG_ZBOOT_ROM_BSS=0x0 20CONFIG_ZBOOT_ROM_BSS=0x0
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index fd5d3041d71..351d6708c3a 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -11,11 +11,14 @@ CONFIG_RT_GROUP_SCHED=y
11CONFIG_BLK_DEV_INITRD=y 11CONFIG_BLK_DEV_INITRD=y
12# CONFIG_ELF_CORE is not set 12# CONFIG_ELF_CORE is not set
13CONFIG_EMBEDDED=y 13CONFIG_EMBEDDED=y
14CONFIG_PERF_EVENTS=y
14CONFIG_SLAB=y 15CONFIG_SLAB=y
15CONFIG_MODULES=y 16CONFIG_MODULES=y
16CONFIG_MODULE_UNLOAD=y 17CONFIG_MODULE_UNLOAD=y
17CONFIG_MODULE_FORCE_UNLOAD=y 18CONFIG_MODULE_FORCE_UNLOAD=y
18# CONFIG_BLK_DEV_BSG is not set 19# CONFIG_BLK_DEV_BSG is not set
20CONFIG_PARTITION_ADVANCED=y
21CONFIG_EFI_PARTITION=y
19# CONFIG_IOSCHED_DEADLINE is not set 22# CONFIG_IOSCHED_DEADLINE is not set
20# CONFIG_IOSCHED_CFQ is not set 23# CONFIG_IOSCHED_CFQ is not set
21CONFIG_ARCH_TEGRA=y 24CONFIG_ARCH_TEGRA=y
@@ -27,18 +30,20 @@ CONFIG_MACH_PAZ00=y
27CONFIG_MACH_TRIMSLICE=y 30CONFIG_MACH_TRIMSLICE=y
28CONFIG_MACH_WARIO=y 31CONFIG_MACH_WARIO=y
29CONFIG_MACH_VENTANA=y 32CONFIG_MACH_VENTANA=y
30CONFIG_TEGRA_DEBUG_UARTD=y 33CONFIG_TEGRA_EMC_SCALING_ENABLE=y
31CONFIG_ARM_ERRATA_742230=y
32CONFIG_NO_HZ=y 34CONFIG_NO_HZ=y
33CONFIG_HIGH_RES_TIMERS=y 35CONFIG_HIGH_RES_TIMERS=y
34CONFIG_SMP=y 36CONFIG_SMP=y
35CONFIG_NR_CPUS=2
36CONFIG_PREEMPT=y 37CONFIG_PREEMPT=y
37CONFIG_AEABI=y 38CONFIG_AEABI=y
38# CONFIG_OABI_COMPAT is not set 39# CONFIG_OABI_COMPAT is not set
39CONFIG_HIGHMEM=y 40CONFIG_HIGHMEM=y
40CONFIG_ZBOOT_ROM_TEXT=0x0 41CONFIG_ZBOOT_ROM_TEXT=0x0
41CONFIG_ZBOOT_ROM_BSS=0x0 42CONFIG_ZBOOT_ROM_BSS=0x0
43CONFIG_AUTO_ZRELADDR=y
44CONFIG_CPU_FREQ=y
45CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
46CONFIG_CPU_IDLE=y
42CONFIG_VFP=y 47CONFIG_VFP=y
43CONFIG_NET=y 48CONFIG_NET=y
44CONFIG_PACKET=y 49CONFIG_PACKET=y
@@ -68,7 +73,6 @@ CONFIG_IPV6_MULTIPLE_TABLES=y
68# CONFIG_FIRMWARE_IN_KERNEL is not set 73# CONFIG_FIRMWARE_IN_KERNEL is not set
69CONFIG_PROC_DEVICETREE=y 74CONFIG_PROC_DEVICETREE=y
70CONFIG_BLK_DEV_LOOP=y 75CONFIG_BLK_DEV_LOOP=y
71CONFIG_MISC_DEVICES=y
72CONFIG_AD525X_DPOT=y 76CONFIG_AD525X_DPOT=y
73CONFIG_AD525X_DPOT_I2C=y 77CONFIG_AD525X_DPOT_I2C=y
74CONFIG_ICS932S401=y 78CONFIG_ICS932S401=y
@@ -76,6 +80,7 @@ CONFIG_APDS9802ALS=y
76CONFIG_ISL29003=y 80CONFIG_ISL29003=y
77CONFIG_SCSI=y 81CONFIG_SCSI=y
78CONFIG_BLK_DEV_SD=y 82CONFIG_BLK_DEV_SD=y
83CONFIG_BLK_DEV_SR=y
79# CONFIG_SCSI_LOWLEVEL is not set 84# CONFIG_SCSI_LOWLEVEL is not set
80CONFIG_NETDEVICES=y 85CONFIG_NETDEVICES=y
81CONFIG_DUMMY=y 86CONFIG_DUMMY=y
@@ -85,8 +90,7 @@ CONFIG_USB_USBNET=y
85CONFIG_USB_NET_SMSC75XX=y 90CONFIG_USB_NET_SMSC75XX=y
86CONFIG_USB_NET_SMSC95XX=y 91CONFIG_USB_NET_SMSC95XX=y
87# CONFIG_WLAN is not set 92# CONFIG_WLAN is not set
88# CONFIG_INPUT is not set 93CONFIG_INPUT_EVDEV=y
89# CONFIG_SERIO is not set
90# CONFIG_VT is not set 94# CONFIG_VT is not set
91# CONFIG_LEGACY_PTYS is not set 95# CONFIG_LEGACY_PTYS is not set
92# CONFIG_DEVKMEM is not set 96# CONFIG_DEVKMEM is not set
@@ -96,13 +100,15 @@ CONFIG_SERIAL_OF_PLATFORM=y
96# CONFIG_HW_RANDOM is not set 100# CONFIG_HW_RANDOM is not set
97CONFIG_I2C=y 101CONFIG_I2C=y
98# CONFIG_I2C_COMPAT is not set 102# CONFIG_I2C_COMPAT is not set
99# CONFIG_I2C_HELPER_AUTO is not set
100CONFIG_I2C_TEGRA=y 103CONFIG_I2C_TEGRA=y
101CONFIG_SPI=y 104CONFIG_SPI=y
102CONFIG_SPI_TEGRA=y 105CONFIG_SPI_TEGRA=y
103CONFIG_SENSORS_LM90=y 106CONFIG_SENSORS_LM90=y
104CONFIG_MFD_TPS6586X=y 107CONFIG_MFD_TPS6586X=y
105CONFIG_REGULATOR=y 108CONFIG_REGULATOR=y
109CONFIG_REGULATOR_FIXED_VOLTAGE=y
110CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
111CONFIG_REGULATOR_GPIO=y
106CONFIG_REGULATOR_TPS6586X=y 112CONFIG_REGULATOR_TPS6586X=y
107CONFIG_SOUND=y 113CONFIG_SOUND=y
108CONFIG_SND=y 114CONFIG_SND=y
@@ -116,11 +122,13 @@ CONFIG_SND_SOC=y
116CONFIG_SND_SOC_TEGRA=y 122CONFIG_SND_SOC_TEGRA=y
117CONFIG_SND_SOC_TEGRA_WM8903=y 123CONFIG_SND_SOC_TEGRA_WM8903=y
118CONFIG_SND_SOC_TEGRA_TRIMSLICE=y 124CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
125CONFIG_SND_SOC_TEGRA_ALC5632=y
119CONFIG_USB=y 126CONFIG_USB=y
120CONFIG_USB_EHCI_HCD=y 127CONFIG_USB_EHCI_HCD=y
121CONFIG_USB_EHCI_TEGRA=y 128CONFIG_USB_EHCI_TEGRA=y
122CONFIG_USB_STORAGE=y 129CONFIG_USB_STORAGE=y
123CONFIG_MMC=y 130CONFIG_MMC=y
131CONFIG_MMC_BLOCK_MINORS=16
124CONFIG_MMC_SDHCI=y 132CONFIG_MMC_SDHCI=y
125CONFIG_MMC_SDHCI_PLTFM=y 133CONFIG_MMC_SDHCI_PLTFM=y
126CONFIG_MMC_SDHCI_TEGRA=y 134CONFIG_MMC_SDHCI_TEGRA=y
@@ -130,6 +138,11 @@ CONFIG_STAGING=y
130CONFIG_IIO=y 138CONFIG_IIO=y
131CONFIG_SENSORS_ISL29018=y 139CONFIG_SENSORS_ISL29018=y
132CONFIG_SENSORS_AK8975=y 140CONFIG_SENSORS_AK8975=y
141CONFIG_MFD_NVEC=y
142CONFIG_KEYBOARD_NVEC=y
143CONFIG_SERIO_NVEC_PS2=y
144CONFIG_TEGRA_IOMMU_GART=y
145CONFIG_TEGRA_IOMMU_SMMU=y
133CONFIG_EXT2_FS=y 146CONFIG_EXT2_FS=y
134CONFIG_EXT2_FS_XATTR=y 147CONFIG_EXT2_FS_XATTR=y
135CONFIG_EXT2_FS_POSIX_ACL=y 148CONFIG_EXT2_FS_POSIX_ACL=y
@@ -138,13 +151,12 @@ CONFIG_EXT3_FS=y
138# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 151# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
139CONFIG_EXT3_FS_POSIX_ACL=y 152CONFIG_EXT3_FS_POSIX_ACL=y
140CONFIG_EXT3_FS_SECURITY=y 153CONFIG_EXT3_FS_SECURITY=y
154CONFIG_EXT4_FS=y
141# CONFIG_DNOTIFY is not set 155# CONFIG_DNOTIFY is not set
142CONFIG_VFAT_FS=y 156CONFIG_VFAT_FS=y
143CONFIG_TMPFS=y 157CONFIG_TMPFS=y
144CONFIG_NFS_FS=y 158CONFIG_NFS_FS=y
145CONFIG_ROOT_NFS=y 159CONFIG_ROOT_NFS=y
146CONFIG_PARTITION_ADVANCED=y
147CONFIG_EFI_PARTITION=y
148CONFIG_NLS_CODEPAGE_437=y 160CONFIG_NLS_CODEPAGE_437=y
149CONFIG_NLS_ISO8859_1=y 161CONFIG_NLS_ISO8859_1=y
150CONFIG_PRINTK_TIME=y 162CONFIG_PRINTK_TIME=y
@@ -162,9 +174,8 @@ CONFIG_DEBUG_SG=y
162CONFIG_DEBUG_LL=y 174CONFIG_DEBUG_LL=y
163CONFIG_EARLY_PRINTK=y 175CONFIG_EARLY_PRINTK=y
164CONFIG_CRYPTO_ECB=y 176CONFIG_CRYPTO_ECB=y
165CONFIG_CRYPTO_AES=y
166CONFIG_CRYPTO_ARC4=y 177CONFIG_CRYPTO_ARC4=y
167CONFIG_CRYPTO_TWOFISH=y 178CONFIG_CRYPTO_TWOFISH=y
168# CONFIG_CRYPTO_ANSI_CPRNG is not set 179# CONFIG_CRYPTO_ANSI_CPRNG is not set
180CONFIG_CRYPTO_DEV_TEGRA_AES=y
169CONFIG_CRC_CCITT=y 181CONFIG_CRC_CCITT=y
170CONFIG_CRC16=y
diff --git a/arch/arm/include/asm/hardware/arm_timer.h b/arch/arm/include/asm/hardware/arm_timer.h
index c0f4e7bf22d..d6030ff599d 100644
--- a/arch/arm/include/asm/hardware/arm_timer.h
+++ b/arch/arm/include/asm/hardware/arm_timer.h
@@ -9,7 +9,12 @@
9 * 9 *
10 * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview 10 * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview
11 * can have 16-bit or 32-bit selectable via a bit in the control register. 11 * can have 16-bit or 32-bit selectable via a bit in the control register.
12 *
13 * Every SP804 contains two identical timers.
12 */ 14 */
15#define TIMER_1_BASE 0x00
16#define TIMER_2_BASE 0x20
17
13#define TIMER_LOAD 0x00 /* ACVR rw */ 18#define TIMER_LOAD 0x00 /* ACVR rw */
14#define TIMER_VALUE 0x04 /* ACVR ro */ 19#define TIMER_VALUE 0x04 /* ACVR ro */
15#define TIMER_CTRL 0x08 /* ACVR rw */ 20#define TIMER_CTRL 0x08 /* ACVR rw */
diff --git a/arch/arm/include/asm/hardware/entry-macro-iomd.S b/arch/arm/include/asm/hardware/entry-macro-iomd.S
index e0af4983723..8c215acd9b5 100644
--- a/arch/arm/include/asm/hardware/entry-macro-iomd.S
+++ b/arch/arm/include/asm/hardware/entry-macro-iomd.S
@@ -11,14 +11,6 @@
11/* IOC / IOMD based hardware */ 11/* IOC / IOMD based hardware */
12#include <asm/hardware/iomd.h> 12#include <asm/hardware/iomd.h>
13 13
14 .macro disable_fiq
15 mov r12, #ioc_base_high
16 .if ioc_base_low
17 orr r12, r12, #ioc_base_low
18 .endif
19 strb r12, [r12, #0x38] @ Disable FIQ register
20 .endm
21
22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 14 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
23 ldrb \irqstat, [\base, #IOMD_IRQREQB] @ get high priority first 15 ldrb \irqstat, [\base, #IOMD_IRQREQB] @ get high priority first
24 ldr \tmp, =irq_prio_h 16 ldr \tmp, =irq_prio_h
diff --git a/arch/arm/include/asm/hardware/timer-sp.h b/arch/arm/include/asm/hardware/timer-sp.h
index 4384d81eee7..2dd9d3f83f2 100644
--- a/arch/arm/include/asm/hardware/timer-sp.h
+++ b/arch/arm/include/asm/hardware/timer-sp.h
@@ -1,2 +1,15 @@
1void sp804_clocksource_init(void __iomem *, const char *); 1void __sp804_clocksource_and_sched_clock_init(void __iomem *,
2 const char *, int);
3
4static inline void sp804_clocksource_init(void __iomem *base, const char *name)
5{
6 __sp804_clocksource_and_sched_clock_init(base, name, 0);
7}
8
9static inline void sp804_clocksource_and_sched_clock_init(void __iomem *base,
10 const char *name)
11{
12 __sp804_clocksource_and_sched_clock_init(base, name, 1);
13}
14
2void sp804_clockevents_init(void __iomem *, unsigned int, const char *); 15void sp804_clockevents_init(void __iomem *, unsigned int, const char *);
diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h
index c6a18424888..f77ffc1eb0c 100644
--- a/arch/arm/include/asm/localtimer.h
+++ b/arch/arm/include/asm/localtimer.h
@@ -11,47 +11,24 @@
11#define __ASM_ARM_LOCALTIMER_H 11#define __ASM_ARM_LOCALTIMER_H
12 12
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/interrupt.h>
15 14
16struct clock_event_device; 15struct clock_event_device;
17 16
18/* 17struct local_timer_ops {
19 * Setup a per-cpu timer, whether it be a local timer or dummy broadcast 18 int (*setup)(struct clock_event_device *);
20 */ 19 void (*stop)(struct clock_event_device *);
21void percpu_timer_setup(void); 20};
22 21
23#ifdef CONFIG_LOCAL_TIMERS 22#ifdef CONFIG_LOCAL_TIMERS
24
25#ifdef CONFIG_HAVE_ARM_TWD
26
27#include "smp_twd.h"
28
29#define local_timer_stop(c) twd_timer_stop((c))
30
31#else
32
33/*
34 * Stop the local timer
35 */
36void local_timer_stop(struct clock_event_device *);
37
38#endif
39
40/* 23/*
41 * Setup a local timer interrupt for a CPU. 24 * Register a local timer driver
42 */ 25 */
43int local_timer_setup(struct clock_event_device *); 26int local_timer_register(struct local_timer_ops *);
44
45#else 27#else
46 28static inline int local_timer_register(struct local_timer_ops *ops)
47static inline int local_timer_setup(struct clock_event_device *evt)
48{ 29{
49 return -ENXIO; 30 return -ENXIO;
50} 31}
51
52static inline void local_timer_stop(struct clock_event_device *evt)
53{
54}
55#endif 32#endif
56 33
57#endif 34#endif
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index da337ba57ff..a98a2e112fa 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -57,14 +57,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
57extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 57extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
58 enum pci_mmap_state mmap_state, int write_combine); 58 enum pci_mmap_state mmap_state, int write_combine);
59 59
60extern void
61pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
62 struct resource *res);
63
64extern void
65pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
66 struct pci_bus_region *region);
67
68/* 60/*
69 * Dummy implementation; always return 0. 61 * Dummy implementation; always return 0.
70 */ 62 */
diff --git a/arch/arm/include/asm/pgtable-nommu.h b/arch/arm/include/asm/pgtable-nommu.h
index ffc0e85775b..7ec60d6075b 100644
--- a/arch/arm/include/asm/pgtable-nommu.h
+++ b/arch/arm/include/asm/pgtable-nommu.h
@@ -79,7 +79,6 @@ extern unsigned int kobjsize(const void *objp);
79 * No page table caches to initialise. 79 * No page table caches to initialise.
80 */ 80 */
81#define pgtable_cache_init() do { } while (0) 81#define pgtable_cache_init() do { } while (0)
82#define io_remap_page_range remap_page_range
83#define io_remap_pfn_range remap_pfn_range 82#define io_remap_pfn_range remap_pfn_range
84 83
85 84
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
index ef9ffba97ad..0f01f4677bd 100644
--- a/arch/arm/include/asm/smp_twd.h
+++ b/arch/arm/include/asm/smp_twd.h
@@ -18,11 +18,28 @@
18#define TWD_TIMER_CONTROL_PERIODIC (1 << 1) 18#define TWD_TIMER_CONTROL_PERIODIC (1 << 1)
19#define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2) 19#define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2)
20 20
21struct clock_event_device; 21#include <linux/ioport.h>
22 22
23extern void __iomem *twd_base; 23struct twd_local_timer {
24 struct resource res[2];
25};
24 26
25void twd_timer_setup(struct clock_event_device *); 27#define DEFINE_TWD_LOCAL_TIMER(name,base,irq) \
26void twd_timer_stop(struct clock_event_device *); 28struct twd_local_timer name __initdata = { \
29 .res = { \
30 DEFINE_RES_MEM(base, 0x10), \
31 DEFINE_RES_IRQ(irq), \
32 }, \
33};
34
35int twd_local_timer_register(struct twd_local_timer *);
36
37#ifdef CONFIG_HAVE_ARM_TWD
38void twd_local_timer_of_register(void);
39#else
40static inline void twd_local_timer_of_register(void)
41{
42}
43#endif
27 44
28#endif 45#endif
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index e4c96cc6ec0..424aa458c48 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -110,6 +110,7 @@ extern void cpu_init(void);
110 110
111void soft_restart(unsigned long); 111void soft_restart(unsigned long);
112extern void (*arm_pm_restart)(char str, const char *cmd); 112extern void (*arm_pm_restart)(char str, const char *cmd);
113extern void (*arm_pm_idle)(void);
113 114
114#define UDBG_UNDEFINED (1 << 0) 115#define UDBG_UNDEFINED (1 << 0)
115#define UDBG_SYSCALL (1 << 1) 116#define UDBG_SYSCALL (1 << 1)
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 43b740d0e37..f16d7652f34 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -62,9 +62,6 @@ obj-$(CONFIG_SWP_EMULATE) += swp_emulate.o
62CFLAGS_swp_emulate.o := -Wa,-march=armv7-a 62CFLAGS_swp_emulate.o := -Wa,-march=armv7-a
63obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 63obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
64 64
65obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o
66AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312
67
68obj-$(CONFIG_CPU_XSCALE) += xscale-cp0.o 65obj-$(CONFIG_CPU_XSCALE) += xscale-cp0.o
69obj-$(CONFIG_CPU_XSC3) += xscale-cp0.o 66obj-$(CONFIG_CPU_XSC3) += xscale-cp0.o
70obj-$(CONFIG_CPU_MOHAWK) += xscale-cp0.o 67obj-$(CONFIG_CPU_MOHAWK) += xscale-cp0.o
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index f58ba358990..632df9a66f8 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -16,7 +16,6 @@
16#include <asm/mach/pci.h> 16#include <asm/mach/pci.h>
17 17
18static int debug_pci; 18static int debug_pci;
19static int use_firmware;
20 19
21/* 20/*
22 * We can't use pci_find_device() here since we are 21 * We can't use pci_find_device() here since we are
@@ -295,28 +294,6 @@ static inline int pdev_bad_for_parity(struct pci_dev *dev)
295} 294}
296 295
297/* 296/*
298 * Adjust the device resources from bus-centric to Linux-centric.
299 */
300static void __devinit
301pdev_fixup_device_resources(struct pci_sys_data *root, struct pci_dev *dev)
302{
303 resource_size_t offset;
304 int i;
305
306 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
307 if (dev->resource[i].start == 0)
308 continue;
309 if (dev->resource[i].flags & IORESOURCE_MEM)
310 offset = root->mem_offset;
311 else
312 offset = root->io_offset;
313
314 dev->resource[i].start += offset;
315 dev->resource[i].end += offset;
316 }
317}
318
319/*
320 * pcibios_fixup_bus - Called after each bus is probed, 297 * pcibios_fixup_bus - Called after each bus is probed,
321 * but before its children are examined. 298 * but before its children are examined.
322 */ 299 */
@@ -333,8 +310,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
333 list_for_each_entry(dev, &bus->devices, bus_list) { 310 list_for_each_entry(dev, &bus->devices, bus_list) {
334 u16 status; 311 u16 status;
335 312
336 pdev_fixup_device_resources(root, dev);
337
338 pci_read_config_word(dev, PCI_STATUS, &status); 313 pci_read_config_word(dev, PCI_STATUS, &status);
339 314
340 /* 315 /*
@@ -400,43 +375,6 @@ EXPORT_SYMBOL(pcibios_fixup_bus);
400#endif 375#endif
401 376
402/* 377/*
403 * Convert from Linux-centric to bus-centric addresses for bridge devices.
404 */
405void
406pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
407 struct resource *res)
408{
409 struct pci_sys_data *root = dev->sysdata;
410 unsigned long offset = 0;
411
412 if (res->flags & IORESOURCE_IO)
413 offset = root->io_offset;
414 if (res->flags & IORESOURCE_MEM)
415 offset = root->mem_offset;
416
417 region->start = res->start - offset;
418 region->end = res->end - offset;
419}
420EXPORT_SYMBOL(pcibios_resource_to_bus);
421
422void __devinit
423pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
424 struct pci_bus_region *region)
425{
426 struct pci_sys_data *root = dev->sysdata;
427 unsigned long offset = 0;
428
429 if (res->flags & IORESOURCE_IO)
430 offset = root->io_offset;
431 if (res->flags & IORESOURCE_MEM)
432 offset = root->mem_offset;
433
434 res->start = region->start + offset;
435 res->end = region->end + offset;
436}
437EXPORT_SYMBOL(pcibios_bus_to_resource);
438
439/*
440 * Swizzle the device pin each time we cross a bridge. 378 * Swizzle the device pin each time we cross a bridge.
441 * This might update pin and returns the slot number. 379 * This might update pin and returns the slot number.
442 */ 380 */
@@ -497,10 +435,10 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
497 435
498 if (ret > 0) { 436 if (ret > 0) {
499 if (list_empty(&sys->resources)) { 437 if (list_empty(&sys->resources)) {
500 pci_add_resource(&sys->resources, 438 pci_add_resource_offset(&sys->resources,
501 &ioport_resource); 439 &ioport_resource, sys->io_offset);
502 pci_add_resource(&sys->resources, 440 pci_add_resource_offset(&sys->resources,
503 &iomem_resource); 441 &iomem_resource, sys->mem_offset);
504 } 442 }
505 443
506 sys->bus = hw->scan(nr, sys); 444 sys->bus = hw->scan(nr, sys);
@@ -525,6 +463,7 @@ void __init pci_common_init(struct hw_pci *hw)
525 463
526 INIT_LIST_HEAD(&hw->buses); 464 INIT_LIST_HEAD(&hw->buses);
527 465
466 pci_add_flags(PCI_REASSIGN_ALL_RSRC);
528 if (hw->preinit) 467 if (hw->preinit)
529 hw->preinit(); 468 hw->preinit();
530 pcibios_init_hw(hw); 469 pcibios_init_hw(hw);
@@ -536,7 +475,7 @@ void __init pci_common_init(struct hw_pci *hw)
536 list_for_each_entry(sys, &hw->buses, node) { 475 list_for_each_entry(sys, &hw->buses, node) {
537 struct pci_bus *bus = sys->bus; 476 struct pci_bus *bus = sys->bus;
538 477
539 if (!use_firmware) { 478 if (!pci_has_flag(PCI_PROBE_ONLY)) {
540 /* 479 /*
541 * Size the bridge windows. 480 * Size the bridge windows.
542 */ 481 */
@@ -573,7 +512,7 @@ char * __init pcibios_setup(char *str)
573 debug_pci = 1; 512 debug_pci = 1;
574 return NULL; 513 return NULL;
575 } else if (!strcmp(str, "firmware")) { 514 } else if (!strcmp(str, "firmware")) {
576 use_firmware = 1; 515 pci_add_flags(PCI_PROBE_ONLY);
577 return NULL; 516 return NULL;
578 } 517 }
579 return str; 518 return str;
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index be16a48007b..22f0ed324f3 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -19,7 +19,9 @@
19#include <asm/glue-df.h> 19#include <asm/glue-df.h>
20#include <asm/glue-pf.h> 20#include <asm/glue-pf.h>
21#include <asm/vfpmacros.h> 21#include <asm/vfpmacros.h>
22#ifndef CONFIG_MULTI_IRQ_HANDLER
22#include <mach/entry-macro.S> 23#include <mach/entry-macro.S>
24#endif
23#include <asm/thread_notify.h> 25#include <asm/thread_notify.h>
24#include <asm/unwind.h> 26#include <asm/unwind.h>
25#include <asm/unistd.h> 27#include <asm/unistd.h>
@@ -1101,7 +1103,6 @@ __stubs_start:
1101 * get out of that mode without clobbering one register. 1103 * get out of that mode without clobbering one register.
1102 */ 1104 */
1103vector_fiq: 1105vector_fiq:
1104 disable_fiq
1105 subs pc, lr, #4 1106 subs pc, lr, #4
1106 1107
1107/*============================================================================= 1108/*=============================================================================
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 9fd0ba90c1d..54ee265dd81 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -10,9 +10,15 @@
10 10
11#include <asm/unistd.h> 11#include <asm/unistd.h>
12#include <asm/ftrace.h> 12#include <asm/ftrace.h>
13#include <mach/entry-macro.S>
14#include <asm/unwind.h> 13#include <asm/unwind.h>
15 14
15#ifdef CONFIG_NEED_RET_TO_USER
16#include <mach/entry-macro.S>
17#else
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20#endif
21
16#include "entry-header.S" 22#include "entry-header.S"
17 23
18 24
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index c2ae3cd331f..d3eca452453 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -61,8 +61,6 @@ extern void setup_mm_for_reboot(void);
61 61
62static volatile int hlt_counter; 62static volatile int hlt_counter;
63 63
64#include <mach/system.h>
65
66void disable_hlt(void) 64void disable_hlt(void)
67{ 65{
68 hlt_counter++; 66 hlt_counter++;
@@ -181,13 +179,17 @@ void cpu_idle_wait(void)
181EXPORT_SYMBOL_GPL(cpu_idle_wait); 179EXPORT_SYMBOL_GPL(cpu_idle_wait);
182 180
183/* 181/*
184 * This is our default idle handler. We need to disable 182 * This is our default idle handler.
185 * interrupts here to ensure we don't miss a wakeup call.
186 */ 183 */
184
185void (*arm_pm_idle)(void);
186
187static void default_idle(void) 187static void default_idle(void)
188{ 188{
189 if (!need_resched()) 189 if (arm_pm_idle)
190 arch_idle(); 190 arm_pm_idle();
191 else
192 cpu_do_idle();
191 local_irq_enable(); 193 local_irq_enable();
192} 194}
193 195
@@ -215,6 +217,10 @@ void cpu_idle(void)
215 cpu_die(); 217 cpu_die();
216#endif 218#endif
217 219
220 /*
221 * We need to disable interrupts here
222 * to ensure we don't miss a wakeup call.
223 */
218 local_irq_disable(); 224 local_irq_disable();
219#ifdef CONFIG_PL310_ERRATA_769419 225#ifdef CONFIG_PL310_ERRATA_769419
220 wmb(); 226 wmb();
@@ -222,19 +228,18 @@ void cpu_idle(void)
222 if (hlt_counter) { 228 if (hlt_counter) {
223 local_irq_enable(); 229 local_irq_enable();
224 cpu_relax(); 230 cpu_relax();
225 } else { 231 } else if (!need_resched()) {
226 stop_critical_timings(); 232 stop_critical_timings();
227 if (cpuidle_idle_call()) 233 if (cpuidle_idle_call())
228 pm_idle(); 234 pm_idle();
229 start_critical_timings(); 235 start_critical_timings();
230 /* 236 /*
231 * This will eventually be removed - pm_idle 237 * pm_idle functions must always
232 * functions should always return with IRQs 238 * return with IRQs enabled.
233 * enabled.
234 */ 239 */
235 WARN_ON(irqs_disabled()); 240 WARN_ON(irqs_disabled());
241 } else
236 local_irq_enable(); 242 local_irq_enable();
237 }
238 } 243 }
239 leds_event(led_idle_end); 244 leds_event(led_idle_end);
240 rcu_idle_exit(); 245 rcu_idle_exit();
@@ -533,8 +538,7 @@ int vectors_user_mapping(void)
533 struct mm_struct *mm = current->mm; 538 struct mm_struct *mm = current->mm;
534 return install_special_mapping(mm, 0xffff0000, PAGE_SIZE, 539 return install_special_mapping(mm, 0xffff0000, PAGE_SIZE,
535 VM_READ | VM_EXEC | 540 VM_READ | VM_EXEC |
536 VM_MAYREAD | VM_MAYEXEC | 541 VM_MAYREAD | VM_MAYEXEC | VM_RESERVED,
537 VM_ALWAYSDUMP | VM_RESERVED,
538 NULL); 542 NULL);
539} 543}
540 544
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index d616ed51e7a..8f8cce2c46c 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -246,6 +246,8 @@ static void __cpuinit smp_store_cpu_info(unsigned int cpuid)
246 store_cpu_topology(cpuid); 246 store_cpu_topology(cpuid);
247} 247}
248 248
249static void percpu_timer_setup(void);
250
249/* 251/*
250 * This is the secondary CPU boot entry. We're using this CPUs 252 * This is the secondary CPU boot entry. We're using this CPUs
251 * idle thread stack, but a set of temporary page tables. 253 * idle thread stack, but a set of temporary page tables.
@@ -452,7 +454,20 @@ static void __cpuinit broadcast_timer_setup(struct clock_event_device *evt)
452 clockevents_register_device(evt); 454 clockevents_register_device(evt);
453} 455}
454 456
455void __cpuinit percpu_timer_setup(void) 457static struct local_timer_ops *lt_ops;
458
459#ifdef CONFIG_LOCAL_TIMERS
460int local_timer_register(struct local_timer_ops *ops)
461{
462 if (lt_ops)
463 return -EBUSY;
464
465 lt_ops = ops;
466 return 0;
467}
468#endif
469
470static void __cpuinit percpu_timer_setup(void)
456{ 471{
457 unsigned int cpu = smp_processor_id(); 472 unsigned int cpu = smp_processor_id();
458 struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu); 473 struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu);
@@ -460,7 +475,7 @@ void __cpuinit percpu_timer_setup(void)
460 evt->cpumask = cpumask_of(cpu); 475 evt->cpumask = cpumask_of(cpu);
461 evt->broadcast = smp_timer_broadcast; 476 evt->broadcast = smp_timer_broadcast;
462 477
463 if (local_timer_setup(evt)) 478 if (!lt_ops || lt_ops->setup(evt))
464 broadcast_timer_setup(evt); 479 broadcast_timer_setup(evt);
465} 480}
466 481
@@ -475,7 +490,8 @@ static void percpu_timer_stop(void)
475 unsigned int cpu = smp_processor_id(); 490 unsigned int cpu = smp_processor_id();
476 struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu); 491 struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu);
477 492
478 local_timer_stop(evt); 493 if (lt_ops)
494 lt_ops->stop(evt);
479} 495}
480#endif 496#endif
481 497
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 7a79b24597b..fef42b21cec 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -18,20 +18,23 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/jiffies.h> 19#include <linux/jiffies.h>
20#include <linux/clockchips.h> 20#include <linux/clockchips.h>
21#include <linux/irq.h> 21#include <linux/interrupt.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/of_irq.h>
24#include <linux/of_address.h>
23 25
24#include <asm/smp_twd.h> 26#include <asm/smp_twd.h>
25#include <asm/localtimer.h> 27#include <asm/localtimer.h>
26#include <asm/hardware/gic.h> 28#include <asm/hardware/gic.h>
27 29
28/* set up by the platform code */ 30/* set up by the platform code */
29void __iomem *twd_base; 31static void __iomem *twd_base;
30 32
31static struct clk *twd_clk; 33static struct clk *twd_clk;
32static unsigned long twd_timer_rate; 34static unsigned long twd_timer_rate;
33 35
34static struct clock_event_device __percpu **twd_evt; 36static struct clock_event_device __percpu **twd_evt;
37static int twd_ppi;
35 38
36static void twd_set_mode(enum clock_event_mode mode, 39static void twd_set_mode(enum clock_event_mode mode,
37 struct clock_event_device *clk) 40 struct clock_event_device *clk)
@@ -77,7 +80,7 @@ static int twd_set_next_event(unsigned long evt,
77 * If a local timer interrupt has occurred, acknowledge and return 1. 80 * If a local timer interrupt has occurred, acknowledge and return 1.
78 * Otherwise, return 0. 81 * Otherwise, return 0.
79 */ 82 */
80int twd_timer_ack(void) 83static int twd_timer_ack(void)
81{ 84{
82 if (__raw_readl(twd_base + TWD_TIMER_INTSTAT)) { 85 if (__raw_readl(twd_base + TWD_TIMER_INTSTAT)) {
83 __raw_writel(1, twd_base + TWD_TIMER_INTSTAT); 86 __raw_writel(1, twd_base + TWD_TIMER_INTSTAT);
@@ -87,7 +90,7 @@ int twd_timer_ack(void)
87 return 0; 90 return 0;
88} 91}
89 92
90void twd_timer_stop(struct clock_event_device *clk) 93static void twd_timer_stop(struct clock_event_device *clk)
91{ 94{
92 twd_set_mode(CLOCK_EVT_MODE_UNUSED, clk); 95 twd_set_mode(CLOCK_EVT_MODE_UNUSED, clk);
93 disable_percpu_irq(clk->irq); 96 disable_percpu_irq(clk->irq);
@@ -222,28 +225,10 @@ static struct clk *twd_get_clock(void)
222/* 225/*
223 * Setup the local clock events for a CPU. 226 * Setup the local clock events for a CPU.
224 */ 227 */
225void __cpuinit twd_timer_setup(struct clock_event_device *clk) 228static int __cpuinit twd_timer_setup(struct clock_event_device *clk)
226{ 229{
227 struct clock_event_device **this_cpu_clk; 230 struct clock_event_device **this_cpu_clk;
228 231
229 if (!twd_evt) {
230 int err;
231
232 twd_evt = alloc_percpu(struct clock_event_device *);
233 if (!twd_evt) {
234 pr_err("twd: can't allocate memory\n");
235 return;
236 }
237
238 err = request_percpu_irq(clk->irq, twd_handler,
239 "twd", twd_evt);
240 if (err) {
241 pr_err("twd: can't register interrupt %d (%d)\n",
242 clk->irq, err);
243 return;
244 }
245 }
246
247 if (!twd_clk) 232 if (!twd_clk)
248 twd_clk = twd_get_clock(); 233 twd_clk = twd_get_clock();
249 234
@@ -260,6 +245,7 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
260 clk->rating = 350; 245 clk->rating = 350;
261 clk->set_mode = twd_set_mode; 246 clk->set_mode = twd_set_mode;
262 clk->set_next_event = twd_set_next_event; 247 clk->set_next_event = twd_set_next_event;
248 clk->irq = twd_ppi;
263 249
264 this_cpu_clk = __this_cpu_ptr(twd_evt); 250 this_cpu_clk = __this_cpu_ptr(twd_evt);
265 *this_cpu_clk = clk; 251 *this_cpu_clk = clk;
@@ -267,4 +253,95 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
267 clockevents_config_and_register(clk, twd_timer_rate, 253 clockevents_config_and_register(clk, twd_timer_rate,
268 0xf, 0xffffffff); 254 0xf, 0xffffffff);
269 enable_percpu_irq(clk->irq, 0); 255 enable_percpu_irq(clk->irq, 0);
256
257 return 0;
258}
259
260static struct local_timer_ops twd_lt_ops __cpuinitdata = {
261 .setup = twd_timer_setup,
262 .stop = twd_timer_stop,
263};
264
265static int __init twd_local_timer_common_register(void)
266{
267 int err;
268
269 twd_evt = alloc_percpu(struct clock_event_device *);
270 if (!twd_evt) {
271 err = -ENOMEM;
272 goto out_free;
273 }
274
275 err = request_percpu_irq(twd_ppi, twd_handler, "twd", twd_evt);
276 if (err) {
277 pr_err("twd: can't register interrupt %d (%d)\n", twd_ppi, err);
278 goto out_free;
279 }
280
281 err = local_timer_register(&twd_lt_ops);
282 if (err)
283 goto out_irq;
284
285 return 0;
286
287out_irq:
288 free_percpu_irq(twd_ppi, twd_evt);
289out_free:
290 iounmap(twd_base);
291 twd_base = NULL;
292 free_percpu(twd_evt);
293
294 return err;
270} 295}
296
297int __init twd_local_timer_register(struct twd_local_timer *tlt)
298{
299 if (twd_base || twd_evt)
300 return -EBUSY;
301
302 twd_ppi = tlt->res[1].start;
303
304 twd_base = ioremap(tlt->res[0].start, resource_size(&tlt->res[0]));
305 if (!twd_base)
306 return -ENOMEM;
307
308 return twd_local_timer_common_register();
309}
310
311#ifdef CONFIG_OF
312const static struct of_device_id twd_of_match[] __initconst = {
313 { .compatible = "arm,cortex-a9-twd-timer", },
314 { .compatible = "arm,cortex-a5-twd-timer", },
315 { .compatible = "arm,arm11mp-twd-timer", },
316 { },
317};
318
319void __init twd_local_timer_of_register(void)
320{
321 struct device_node *np;
322 int err;
323
324 np = of_find_matching_node(NULL, twd_of_match);
325 if (!np) {
326 err = -ENODEV;
327 goto out;
328 }
329
330 twd_ppi = irq_of_parse_and_map(np, 0);
331 if (!twd_ppi) {
332 err = -EINVAL;
333 goto out;
334 }
335
336 twd_base = of_iomap(np, 0);
337 if (!twd_base) {
338 err = -ENOMEM;
339 goto out;
340 }
341
342 err = twd_local_timer_common_register();
343
344out:
345 WARN(err, "twd_local_timer_of_register failed (%d)\n", err);
346}
347#endif
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 71feb00a1e9..e55cdcbd81f 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -102,13 +102,13 @@ config ARCH_AT91SAM9G45
102 select HAVE_AT91_DBGU1 102 select HAVE_AT91_DBGU1
103 select AT91_SAM9G45_RESET 103 select AT91_SAM9G45_RESET
104 104
105config ARCH_AT91CAP9 105config ARCH_AT91SAM9X5
106 bool "AT91CAP9" 106 bool "AT91SAM9x5 family"
107 select CPU_ARM926T 107 select CPU_ARM926T
108 select GENERIC_CLOCKEVENTS 108 select GENERIC_CLOCKEVENTS
109 select HAVE_FB_ATMEL 109 select HAVE_FB_ATMEL
110 select HAVE_NET_MACB 110 select HAVE_NET_MACB
111 select HAVE_AT91_DBGU1 111 select HAVE_AT91_DBGU0
112 select AT91_SAM9G45_RESET 112 select AT91_SAM9G45_RESET
113 113
114config ARCH_AT91X40 114config ARCH_AT91X40
@@ -447,21 +447,6 @@ endif
447 447
448# ---------------------------------------------------------- 448# ----------------------------------------------------------
449 449
450if ARCH_AT91CAP9
451
452comment "AT91CAP9 Board Type"
453
454config MACH_AT91CAP9ADK
455 bool "Atmel AT91CAP9A-DK Evaluation Kit"
456 select HAVE_AT91_DATAFLASH_CARD
457 help
458 Select this if you are using Atmel's AT91CAP9A-DK Evaluation Kit.
459 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4138>
460
461endif
462
463# ----------------------------------------------------------
464
465if ARCH_AT91X40 450if ARCH_AT91X40
466 451
467comment "AT91X40 Board Type" 452comment "AT91X40 Board Type"
@@ -544,7 +529,7 @@ config AT91_EARLY_DBGU0
544 depends on HAVE_AT91_DBGU0 529 depends on HAVE_AT91_DBGU0
545 530
546config AT91_EARLY_DBGU1 531config AT91_EARLY_DBGU1
547 bool "DBGU on 9263, 9g45 and cap9" 532 bool "DBGU on 9263 and 9g45"
548 depends on HAVE_AT91_DBGU1 533 depends on HAVE_AT91_DBGU1
549 534
550config AT91_EARLY_USART0 535config AT91_EARLY_USART0
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 705e1fbded3..8512e53bed9 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -20,7 +20,7 @@ obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_d
20obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o 20obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o
21obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o 21obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o
22obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam926x_time.o at91sam9g45_devices.o sam9_smc.o 22obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam926x_time.o at91sam9g45_devices.o sam9_smc.o
23obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o sam9_smc.o 23obj-$(CONFIG_ARCH_AT91SAM9X5) += at91sam9x5.o at91sam926x_time.o sam9_smc.o
24obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o 24obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
25 25
26# AT91RM9200 board-specific support 26# AT91RM9200 board-specific support
@@ -81,9 +81,6 @@ obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o
81# AT91SAM board with device-tree 81# AT91SAM board with device-tree
82obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o 82obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o
83 83
84# AT91CAP9 board-specific support
85obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o
86
87# AT91X40 board-specific support 84# AT91X40 board-specific support
88obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o 85obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o
89 86
diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot
index 8ddafadfdc7..0da66ca4a4f 100644
--- a/arch/arm/mach-at91/Makefile.boot
+++ b/arch/arm/mach-at91/Makefile.boot
@@ -3,11 +3,7 @@
3# PARAMS_PHYS must be within 4MB of ZRELADDR 3# PARAMS_PHYS must be within 4MB of ZRELADDR
4# INITRD_PHYS must be in RAM 4# INITRD_PHYS must be in RAM
5 5
6ifeq ($(CONFIG_ARCH_AT91CAP9),y) 6ifeq ($(CONFIG_ARCH_AT91SAM9G45),y)
7 zreladdr-y += 0x70008000
8params_phys-y := 0x70000100
9initrd_phys-y := 0x70410000
10else ifeq ($(CONFIG_ARCH_AT91SAM9G45),y)
11 zreladdr-y += 0x70008000 7 zreladdr-y += 0x70008000
12params_phys-y := 0x70000100 8params_phys-y := 0x70000100
13initrd_phys-y := 0x70410000 9initrd_phys-y := 0x70410000
@@ -17,4 +13,10 @@ params_phys-y := 0x20000100
17initrd_phys-y := 0x20410000 13initrd_phys-y := 0x20410000
18endif 14endif
19 15
20dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb usb_a9g20.dtb 16# Keep dtb files sorted alphabetically for each SoC
17# sam9g20
18dtb-$(CONFIG_MACH_AT91SAM_DT) += usb_a9g20.dtb
19# sam9g45
20dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb
21# sam9x5
22dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9g25ek.dtb
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
deleted file mode 100644
index a42edc25a87..00000000000
--- a/arch/arm/mach-at91/at91cap9.c
+++ /dev/null
@@ -1,396 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91cap9.c
3 *
4 * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com>
5 * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com>
6 * Copyright (C) 2007 Atmel Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 */
14
15#include <linux/module.h>
16
17#include <asm/irq.h>
18#include <asm/mach/arch.h>
19#include <asm/mach/map.h>
20
21#include <mach/cpu.h>
22#include <mach/at91cap9.h>
23#include <mach/at91_pmc.h>
24
25#include "soc.h"
26#include "generic.h"
27#include "clock.h"
28#include "sam9_smc.h"
29
30/* --------------------------------------------------------------------
31 * Clocks
32 * -------------------------------------------------------------------- */
33
34/*
35 * The peripheral clocks.
36 */
37static struct clk pioABCD_clk = {
38 .name = "pioABCD_clk",
39 .pmc_mask = 1 << AT91CAP9_ID_PIOABCD,
40 .type = CLK_TYPE_PERIPHERAL,
41};
42static struct clk mpb0_clk = {
43 .name = "mpb0_clk",
44 .pmc_mask = 1 << AT91CAP9_ID_MPB0,
45 .type = CLK_TYPE_PERIPHERAL,
46};
47static struct clk mpb1_clk = {
48 .name = "mpb1_clk",
49 .pmc_mask = 1 << AT91CAP9_ID_MPB1,
50 .type = CLK_TYPE_PERIPHERAL,
51};
52static struct clk mpb2_clk = {
53 .name = "mpb2_clk",
54 .pmc_mask = 1 << AT91CAP9_ID_MPB2,
55 .type = CLK_TYPE_PERIPHERAL,
56};
57static struct clk mpb3_clk = {
58 .name = "mpb3_clk",
59 .pmc_mask = 1 << AT91CAP9_ID_MPB3,
60 .type = CLK_TYPE_PERIPHERAL,
61};
62static struct clk mpb4_clk = {
63 .name = "mpb4_clk",
64 .pmc_mask = 1 << AT91CAP9_ID_MPB4,
65 .type = CLK_TYPE_PERIPHERAL,
66};
67static struct clk usart0_clk = {
68 .name = "usart0_clk",
69 .pmc_mask = 1 << AT91CAP9_ID_US0,
70 .type = CLK_TYPE_PERIPHERAL,
71};
72static struct clk usart1_clk = {
73 .name = "usart1_clk",
74 .pmc_mask = 1 << AT91CAP9_ID_US1,
75 .type = CLK_TYPE_PERIPHERAL,
76};
77static struct clk usart2_clk = {
78 .name = "usart2_clk",
79 .pmc_mask = 1 << AT91CAP9_ID_US2,
80 .type = CLK_TYPE_PERIPHERAL,
81};
82static struct clk mmc0_clk = {
83 .name = "mci0_clk",
84 .pmc_mask = 1 << AT91CAP9_ID_MCI0,
85 .type = CLK_TYPE_PERIPHERAL,
86};
87static struct clk mmc1_clk = {
88 .name = "mci1_clk",
89 .pmc_mask = 1 << AT91CAP9_ID_MCI1,
90 .type = CLK_TYPE_PERIPHERAL,
91};
92static struct clk can_clk = {
93 .name = "can_clk",
94 .pmc_mask = 1 << AT91CAP9_ID_CAN,
95 .type = CLK_TYPE_PERIPHERAL,
96};
97static struct clk twi_clk = {
98 .name = "twi_clk",
99 .pmc_mask = 1 << AT91CAP9_ID_TWI,
100 .type = CLK_TYPE_PERIPHERAL,
101};
102static struct clk spi0_clk = {
103 .name = "spi0_clk",
104 .pmc_mask = 1 << AT91CAP9_ID_SPI0,
105 .type = CLK_TYPE_PERIPHERAL,
106};
107static struct clk spi1_clk = {
108 .name = "spi1_clk",
109 .pmc_mask = 1 << AT91CAP9_ID_SPI1,
110 .type = CLK_TYPE_PERIPHERAL,
111};
112static struct clk ssc0_clk = {
113 .name = "ssc0_clk",
114 .pmc_mask = 1 << AT91CAP9_ID_SSC0,
115 .type = CLK_TYPE_PERIPHERAL,
116};
117static struct clk ssc1_clk = {
118 .name = "ssc1_clk",
119 .pmc_mask = 1 << AT91CAP9_ID_SSC1,
120 .type = CLK_TYPE_PERIPHERAL,
121};
122static struct clk ac97_clk = {
123 .name = "ac97_clk",
124 .pmc_mask = 1 << AT91CAP9_ID_AC97C,
125 .type = CLK_TYPE_PERIPHERAL,
126};
127static struct clk tcb_clk = {
128 .name = "tcb_clk",
129 .pmc_mask = 1 << AT91CAP9_ID_TCB,
130 .type = CLK_TYPE_PERIPHERAL,
131};
132static struct clk pwm_clk = {
133 .name = "pwm_clk",
134 .pmc_mask = 1 << AT91CAP9_ID_PWMC,
135 .type = CLK_TYPE_PERIPHERAL,
136};
137static struct clk macb_clk = {
138 .name = "pclk",
139 .pmc_mask = 1 << AT91CAP9_ID_EMAC,
140 .type = CLK_TYPE_PERIPHERAL,
141};
142static struct clk aestdes_clk = {
143 .name = "aestdes_clk",
144 .pmc_mask = 1 << AT91CAP9_ID_AESTDES,
145 .type = CLK_TYPE_PERIPHERAL,
146};
147static struct clk adc_clk = {
148 .name = "adc_clk",
149 .pmc_mask = 1 << AT91CAP9_ID_ADC,
150 .type = CLK_TYPE_PERIPHERAL,
151};
152static struct clk isi_clk = {
153 .name = "isi_clk",
154 .pmc_mask = 1 << AT91CAP9_ID_ISI,
155 .type = CLK_TYPE_PERIPHERAL,
156};
157static struct clk lcdc_clk = {
158 .name = "lcdc_clk",
159 .pmc_mask = 1 << AT91CAP9_ID_LCDC,
160 .type = CLK_TYPE_PERIPHERAL,
161};
162static struct clk dma_clk = {
163 .name = "dma_clk",
164 .pmc_mask = 1 << AT91CAP9_ID_DMA,
165 .type = CLK_TYPE_PERIPHERAL,
166};
167static struct clk udphs_clk = {
168 .name = "udphs_clk",
169 .pmc_mask = 1 << AT91CAP9_ID_UDPHS,
170 .type = CLK_TYPE_PERIPHERAL,
171};
172static struct clk ohci_clk = {
173 .name = "ohci_clk",
174 .pmc_mask = 1 << AT91CAP9_ID_UHP,
175 .type = CLK_TYPE_PERIPHERAL,
176};
177
178static struct clk *periph_clocks[] __initdata = {
179 &pioABCD_clk,
180 &mpb0_clk,
181 &mpb1_clk,
182 &mpb2_clk,
183 &mpb3_clk,
184 &mpb4_clk,
185 &usart0_clk,
186 &usart1_clk,
187 &usart2_clk,
188 &mmc0_clk,
189 &mmc1_clk,
190 &can_clk,
191 &twi_clk,
192 &spi0_clk,
193 &spi1_clk,
194 &ssc0_clk,
195 &ssc1_clk,
196 &ac97_clk,
197 &tcb_clk,
198 &pwm_clk,
199 &macb_clk,
200 &aestdes_clk,
201 &adc_clk,
202 &isi_clk,
203 &lcdc_clk,
204 &dma_clk,
205 &udphs_clk,
206 &ohci_clk,
207 // irq0 .. irq1
208};
209
210static struct clk_lookup periph_clocks_lookups[] = {
211 /* One additional fake clock for macb_hclk */
212 CLKDEV_CON_ID("hclk", &macb_clk),
213 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk),
214 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk),
215 CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk),
216 CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.1", &mmc1_clk),
217 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
218 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
219 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
220 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
221 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
222 /* fake hclk clock */
223 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
224 CLKDEV_CON_ID("pioA", &pioABCD_clk),
225 CLKDEV_CON_ID("pioB", &pioABCD_clk),
226 CLKDEV_CON_ID("pioC", &pioABCD_clk),
227 CLKDEV_CON_ID("pioD", &pioABCD_clk),
228};
229
230static struct clk_lookup usart_clocks_lookups[] = {
231 CLKDEV_CON_DEV_ID("usart", "atmel_usart.0", &mck),
232 CLKDEV_CON_DEV_ID("usart", "atmel_usart.1", &usart0_clk),
233 CLKDEV_CON_DEV_ID("usart", "atmel_usart.2", &usart1_clk),
234 CLKDEV_CON_DEV_ID("usart", "atmel_usart.3", &usart2_clk),
235};
236
237/*
238 * The four programmable clocks.
239 * You must configure pin multiplexing to bring these signals out.
240 */
241static struct clk pck0 = {
242 .name = "pck0",
243 .pmc_mask = AT91_PMC_PCK0,
244 .type = CLK_TYPE_PROGRAMMABLE,
245 .id = 0,
246};
247static struct clk pck1 = {
248 .name = "pck1",
249 .pmc_mask = AT91_PMC_PCK1,
250 .type = CLK_TYPE_PROGRAMMABLE,
251 .id = 1,
252};
253static struct clk pck2 = {
254 .name = "pck2",
255 .pmc_mask = AT91_PMC_PCK2,
256 .type = CLK_TYPE_PROGRAMMABLE,
257 .id = 2,
258};
259static struct clk pck3 = {
260 .name = "pck3",
261 .pmc_mask = AT91_PMC_PCK3,
262 .type = CLK_TYPE_PROGRAMMABLE,
263 .id = 3,
264};
265
266static void __init at91cap9_register_clocks(void)
267{
268 int i;
269
270 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
271 clk_register(periph_clocks[i]);
272
273 clkdev_add_table(periph_clocks_lookups,
274 ARRAY_SIZE(periph_clocks_lookups));
275 clkdev_add_table(usart_clocks_lookups,
276 ARRAY_SIZE(usart_clocks_lookups));
277
278 clk_register(&pck0);
279 clk_register(&pck1);
280 clk_register(&pck2);
281 clk_register(&pck3);
282}
283
284static struct clk_lookup console_clock_lookup;
285
286void __init at91cap9_set_console_clock(int id)
287{
288 if (id >= ARRAY_SIZE(usart_clocks_lookups))
289 return;
290
291 console_clock_lookup.con_id = "usart";
292 console_clock_lookup.clk = usart_clocks_lookups[id].clk;
293 clkdev_add(&console_clock_lookup);
294}
295
296/* --------------------------------------------------------------------
297 * GPIO
298 * -------------------------------------------------------------------- */
299
300static struct at91_gpio_bank at91cap9_gpio[] __initdata = {
301 {
302 .id = AT91CAP9_ID_PIOABCD,
303 .regbase = AT91CAP9_BASE_PIOA,
304 }, {
305 .id = AT91CAP9_ID_PIOABCD,
306 .regbase = AT91CAP9_BASE_PIOB,
307 }, {
308 .id = AT91CAP9_ID_PIOABCD,
309 .regbase = AT91CAP9_BASE_PIOC,
310 }, {
311 .id = AT91CAP9_ID_PIOABCD,
312 .regbase = AT91CAP9_BASE_PIOD,
313 }
314};
315
316/* --------------------------------------------------------------------
317 * AT91CAP9 processor initialization
318 * -------------------------------------------------------------------- */
319
320static void __init at91cap9_map_io(void)
321{
322 at91_init_sram(0, AT91CAP9_SRAM_BASE, AT91CAP9_SRAM_SIZE);
323}
324
325static void __init at91cap9_ioremap_registers(void)
326{
327 at91_ioremap_shdwc(AT91CAP9_BASE_SHDWC);
328 at91_ioremap_rstc(AT91CAP9_BASE_RSTC);
329 at91sam926x_ioremap_pit(AT91CAP9_BASE_PIT);
330 at91sam9_ioremap_smc(0, AT91CAP9_BASE_SMC);
331}
332
333static void __init at91cap9_initialize(void)
334{
335 arm_pm_restart = at91sam9g45_restart;
336 at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1);
337
338 /* Register GPIO subsystem */
339 at91_gpio_init(at91cap9_gpio, 4);
340
341 /* Remember the silicon revision */
342 if (cpu_is_at91cap9_revB())
343 system_rev = 0xB;
344 else if (cpu_is_at91cap9_revC())
345 system_rev = 0xC;
346}
347
348/* --------------------------------------------------------------------
349 * Interrupt initialization
350 * -------------------------------------------------------------------- */
351
352/*
353 * The default interrupt priority levels (0 = lowest, 7 = highest).
354 */
355static unsigned int at91cap9_default_irq_priority[NR_AIC_IRQS] __initdata = {
356 7, /* Advanced Interrupt Controller (FIQ) */
357 7, /* System Peripherals */
358 1, /* Parallel IO Controller A, B, C and D */
359 0, /* MP Block Peripheral 0 */
360 0, /* MP Block Peripheral 1 */
361 0, /* MP Block Peripheral 2 */
362 0, /* MP Block Peripheral 3 */
363 0, /* MP Block Peripheral 4 */
364 5, /* USART 0 */
365 5, /* USART 1 */
366 5, /* USART 2 */
367 0, /* Multimedia Card Interface 0 */
368 0, /* Multimedia Card Interface 1 */
369 3, /* CAN */
370 6, /* Two-Wire Interface */
371 5, /* Serial Peripheral Interface 0 */
372 5, /* Serial Peripheral Interface 1 */
373 4, /* Serial Synchronous Controller 0 */
374 4, /* Serial Synchronous Controller 1 */
375 5, /* AC97 Controller */
376 0, /* Timer Counter 0, 1 and 2 */
377 0, /* Pulse Width Modulation Controller */
378 3, /* Ethernet */
379 0, /* Advanced Encryption Standard, Triple DES*/
380 0, /* Analog-to-Digital Converter */
381 0, /* Image Sensor Interface */
382 3, /* LCD Controller */
383 0, /* DMA Controller */
384 2, /* USB Device Port */
385 2, /* USB Host port */
386 0, /* Advanced Interrupt Controller (IRQ0) */
387 0, /* Advanced Interrupt Controller (IRQ1) */
388};
389
390struct at91_init_soc __initdata at91cap9_soc = {
391 .map_io = at91cap9_map_io,
392 .default_irq_priority = at91cap9_default_irq_priority,
393 .ioremap_registers = at91cap9_ioremap_registers,
394 .register_clocks = at91cap9_register_clocks,
395 .init = at91cap9_initialize,
396};
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
deleted file mode 100644
index d298fb7cb21..00000000000
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ /dev/null
@@ -1,1273 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91cap9_devices.c
3 *
4 * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com>
5 * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com>
6 * Copyright (C) 2007 Atmel Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 */
14#include <asm/mach/arch.h>
15#include <asm/mach/map.h>
16#include <asm/mach/irq.h>
17
18#include <linux/dma-mapping.h>
19#include <linux/gpio.h>
20#include <linux/platform_device.h>
21#include <linux/i2c-gpio.h>
22
23#include <video/atmel_lcdc.h>
24
25#include <mach/board.h>
26#include <mach/cpu.h>
27#include <mach/at91cap9.h>
28#include <mach/at91cap9_matrix.h>
29#include <mach/at91sam9_smc.h>
30
31#include "generic.h"
32
33
34/* --------------------------------------------------------------------
35 * USB Host
36 * -------------------------------------------------------------------- */
37
38#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
39static u64 ohci_dmamask = DMA_BIT_MASK(32);
40static struct at91_usbh_data usbh_data;
41
42static struct resource usbh_resources[] = {
43 [0] = {
44 .start = AT91CAP9_UHP_BASE,
45 .end = AT91CAP9_UHP_BASE + SZ_1M - 1,
46 .flags = IORESOURCE_MEM,
47 },
48 [1] = {
49 .start = AT91CAP9_ID_UHP,
50 .end = AT91CAP9_ID_UHP,
51 .flags = IORESOURCE_IRQ,
52 },
53};
54
55static struct platform_device at91_usbh_device = {
56 .name = "at91_ohci",
57 .id = -1,
58 .dev = {
59 .dma_mask = &ohci_dmamask,
60 .coherent_dma_mask = DMA_BIT_MASK(32),
61 .platform_data = &usbh_data,
62 },
63 .resource = usbh_resources,
64 .num_resources = ARRAY_SIZE(usbh_resources),
65};
66
67void __init at91_add_device_usbh(struct at91_usbh_data *data)
68{
69 int i;
70
71 if (!data)
72 return;
73
74 if (cpu_is_at91cap9_revB())
75 irq_set_irq_type(AT91CAP9_ID_UHP, IRQ_TYPE_LEVEL_HIGH);
76
77 /* Enable VBus control for UHP ports */
78 for (i = 0; i < data->ports; i++) {
79 if (gpio_is_valid(data->vbus_pin[i]))
80 at91_set_gpio_output(data->vbus_pin[i], 0);
81 }
82
83 /* Enable overcurrent notification */
84 for (i = 0; i < data->ports; i++) {
85 if (data->overcurrent_pin[i])
86 at91_set_gpio_input(data->overcurrent_pin[i], 1);
87 }
88
89 usbh_data = *data;
90 platform_device_register(&at91_usbh_device);
91}
92#else
93void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
94#endif
95
96
97/* --------------------------------------------------------------------
98 * USB HS Device (Gadget)
99 * -------------------------------------------------------------------- */
100
101#if defined(CONFIG_USB_ATMEL_USBA) || defined(CONFIG_USB_ATMEL_USBA_MODULE)
102
103static struct resource usba_udc_resources[] = {
104 [0] = {
105 .start = AT91CAP9_UDPHS_FIFO,
106 .end = AT91CAP9_UDPHS_FIFO + SZ_512K - 1,
107 .flags = IORESOURCE_MEM,
108 },
109 [1] = {
110 .start = AT91CAP9_BASE_UDPHS,
111 .end = AT91CAP9_BASE_UDPHS + SZ_1K - 1,
112 .flags = IORESOURCE_MEM,
113 },
114 [2] = {
115 .start = AT91CAP9_ID_UDPHS,
116 .end = AT91CAP9_ID_UDPHS,
117 .flags = IORESOURCE_IRQ,
118 },
119};
120
121#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
122 [idx] = { \
123 .name = nam, \
124 .index = idx, \
125 .fifo_size = maxpkt, \
126 .nr_banks = maxbk, \
127 .can_dma = dma, \
128 .can_isoc = isoc, \
129 }
130
131static struct usba_ep_data usba_udc_ep[] = {
132 EP("ep0", 0, 64, 1, 0, 0),
133 EP("ep1", 1, 1024, 3, 1, 1),
134 EP("ep2", 2, 1024, 3, 1, 1),
135 EP("ep3", 3, 1024, 2, 1, 1),
136 EP("ep4", 4, 1024, 2, 1, 1),
137 EP("ep5", 5, 1024, 2, 1, 0),
138 EP("ep6", 6, 1024, 2, 1, 0),
139 EP("ep7", 7, 1024, 2, 0, 0),
140};
141
142#undef EP
143
144/*
145 * pdata doesn't have room for any endpoints, so we need to
146 * append room for the ones we need right after it.
147 */
148static struct {
149 struct usba_platform_data pdata;
150 struct usba_ep_data ep[8];
151} usba_udc_data;
152
153static struct platform_device at91_usba_udc_device = {
154 .name = "atmel_usba_udc",
155 .id = -1,
156 .dev = {
157 .platform_data = &usba_udc_data.pdata,
158 },
159 .resource = usba_udc_resources,
160 .num_resources = ARRAY_SIZE(usba_udc_resources),
161};
162
163void __init at91_add_device_usba(struct usba_platform_data *data)
164{
165 if (cpu_is_at91cap9_revB()) {
166 irq_set_irq_type(AT91CAP9_ID_UDPHS, IRQ_TYPE_LEVEL_HIGH);
167 at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS |
168 AT91_MATRIX_UDPHS_BYPASS_LOCK);
169 }
170 else
171 at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS);
172
173 /*
174 * Invalid pins are 0 on AT91, but the usba driver is shared
175 * with AVR32, which use negative values instead. Once/if
176 * gpio_is_valid() is ported to AT91, revisit this code.
177 */
178 usba_udc_data.pdata.vbus_pin = -EINVAL;
179 usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
180 memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));
181
182 if (data && gpio_is_valid(data->vbus_pin)) {
183 at91_set_gpio_input(data->vbus_pin, 0);
184 at91_set_deglitch(data->vbus_pin, 1);
185 usba_udc_data.pdata.vbus_pin = data->vbus_pin;
186 }
187
188 /* Pullup pin is handled internally by USB device peripheral */
189
190 platform_device_register(&at91_usba_udc_device);
191}
192#else
193void __init at91_add_device_usba(struct usba_platform_data *data) {}
194#endif
195
196
197/* --------------------------------------------------------------------
198 * Ethernet
199 * -------------------------------------------------------------------- */
200
201#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
202static u64 eth_dmamask = DMA_BIT_MASK(32);
203static struct macb_platform_data eth_data;
204
205static struct resource eth_resources[] = {
206 [0] = {
207 .start = AT91CAP9_BASE_EMAC,
208 .end = AT91CAP9_BASE_EMAC + SZ_16K - 1,
209 .flags = IORESOURCE_MEM,
210 },
211 [1] = {
212 .start = AT91CAP9_ID_EMAC,
213 .end = AT91CAP9_ID_EMAC,
214 .flags = IORESOURCE_IRQ,
215 },
216};
217
218static struct platform_device at91cap9_eth_device = {
219 .name = "macb",
220 .id = -1,
221 .dev = {
222 .dma_mask = &eth_dmamask,
223 .coherent_dma_mask = DMA_BIT_MASK(32),
224 .platform_data = &eth_data,
225 },
226 .resource = eth_resources,
227 .num_resources = ARRAY_SIZE(eth_resources),
228};
229
230void __init at91_add_device_eth(struct macb_platform_data *data)
231{
232 if (!data)
233 return;
234
235 if (gpio_is_valid(data->phy_irq_pin)) {
236 at91_set_gpio_input(data->phy_irq_pin, 0);
237 at91_set_deglitch(data->phy_irq_pin, 1);
238 }
239
240 /* Pins used for MII and RMII */
241 at91_set_A_periph(AT91_PIN_PB21, 0); /* ETXCK_EREFCK */
242 at91_set_A_periph(AT91_PIN_PB22, 0); /* ERXDV */
243 at91_set_A_periph(AT91_PIN_PB25, 0); /* ERX0 */
244 at91_set_A_periph(AT91_PIN_PB26, 0); /* ERX1 */
245 at91_set_A_periph(AT91_PIN_PB27, 0); /* ERXER */
246 at91_set_A_periph(AT91_PIN_PB28, 0); /* ETXEN */
247 at91_set_A_periph(AT91_PIN_PB23, 0); /* ETX0 */
248 at91_set_A_periph(AT91_PIN_PB24, 0); /* ETX1 */
249 at91_set_A_periph(AT91_PIN_PB30, 0); /* EMDIO */
250 at91_set_A_periph(AT91_PIN_PB29, 0); /* EMDC */
251
252 if (!data->is_rmii) {
253 at91_set_B_periph(AT91_PIN_PC25, 0); /* ECRS */
254 at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */
255 at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */
256 at91_set_B_periph(AT91_PIN_PC23, 0); /* ERX3 */
257 at91_set_B_periph(AT91_PIN_PC27, 0); /* ERXCK */
258 at91_set_B_periph(AT91_PIN_PC20, 0); /* ETX2 */
259 at91_set_B_periph(AT91_PIN_PC21, 0); /* ETX3 */
260 at91_set_B_periph(AT91_PIN_PC24, 0); /* ETXER */
261 }
262
263 eth_data = *data;
264 platform_device_register(&at91cap9_eth_device);
265}
266#else
267void __init at91_add_device_eth(struct macb_platform_data *data) {}
268#endif
269
270
271/* --------------------------------------------------------------------
272 * MMC / SD
273 * -------------------------------------------------------------------- */
274
275#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
276static u64 mmc_dmamask = DMA_BIT_MASK(32);
277static struct at91_mmc_data mmc0_data, mmc1_data;
278
279static struct resource mmc0_resources[] = {
280 [0] = {
281 .start = AT91CAP9_BASE_MCI0,
282 .end = AT91CAP9_BASE_MCI0 + SZ_16K - 1,
283 .flags = IORESOURCE_MEM,
284 },
285 [1] = {
286 .start = AT91CAP9_ID_MCI0,
287 .end = AT91CAP9_ID_MCI0,
288 .flags = IORESOURCE_IRQ,
289 },
290};
291
292static struct platform_device at91cap9_mmc0_device = {
293 .name = "at91_mci",
294 .id = 0,
295 .dev = {
296 .dma_mask = &mmc_dmamask,
297 .coherent_dma_mask = DMA_BIT_MASK(32),
298 .platform_data = &mmc0_data,
299 },
300 .resource = mmc0_resources,
301 .num_resources = ARRAY_SIZE(mmc0_resources),
302};
303
304static struct resource mmc1_resources[] = {
305 [0] = {
306 .start = AT91CAP9_BASE_MCI1,
307 .end = AT91CAP9_BASE_MCI1 + SZ_16K - 1,
308 .flags = IORESOURCE_MEM,
309 },
310 [1] = {
311 .start = AT91CAP9_ID_MCI1,
312 .end = AT91CAP9_ID_MCI1,
313 .flags = IORESOURCE_IRQ,
314 },
315};
316
317static struct platform_device at91cap9_mmc1_device = {
318 .name = "at91_mci",
319 .id = 1,
320 .dev = {
321 .dma_mask = &mmc_dmamask,
322 .coherent_dma_mask = DMA_BIT_MASK(32),
323 .platform_data = &mmc1_data,
324 },
325 .resource = mmc1_resources,
326 .num_resources = ARRAY_SIZE(mmc1_resources),
327};
328
329void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
330{
331 if (!data)
332 return;
333
334 /* input/irq */
335 if (gpio_is_valid(data->det_pin)) {
336 at91_set_gpio_input(data->det_pin, 1);
337 at91_set_deglitch(data->det_pin, 1);
338 }
339 if (gpio_is_valid(data->wp_pin))
340 at91_set_gpio_input(data->wp_pin, 1);
341 if (gpio_is_valid(data->vcc_pin))
342 at91_set_gpio_output(data->vcc_pin, 0);
343
344 if (mmc_id == 0) { /* MCI0 */
345 /* CLK */
346 at91_set_A_periph(AT91_PIN_PA2, 0);
347
348 /* CMD */
349 at91_set_A_periph(AT91_PIN_PA1, 1);
350
351 /* DAT0, maybe DAT1..DAT3 */
352 at91_set_A_periph(AT91_PIN_PA0, 1);
353 if (data->wire4) {
354 at91_set_A_periph(AT91_PIN_PA3, 1);
355 at91_set_A_periph(AT91_PIN_PA4, 1);
356 at91_set_A_periph(AT91_PIN_PA5, 1);
357 }
358
359 mmc0_data = *data;
360 platform_device_register(&at91cap9_mmc0_device);
361 } else { /* MCI1 */
362 /* CLK */
363 at91_set_A_periph(AT91_PIN_PA16, 0);
364
365 /* CMD */
366 at91_set_A_periph(AT91_PIN_PA17, 1);
367
368 /* DAT0, maybe DAT1..DAT3 */
369 at91_set_A_periph(AT91_PIN_PA18, 1);
370 if (data->wire4) {
371 at91_set_A_periph(AT91_PIN_PA19, 1);
372 at91_set_A_periph(AT91_PIN_PA20, 1);
373 at91_set_A_periph(AT91_PIN_PA21, 1);
374 }
375
376 mmc1_data = *data;
377 platform_device_register(&at91cap9_mmc1_device);
378 }
379}
380#else
381void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
382#endif
383
384
385/* --------------------------------------------------------------------
386 * NAND / SmartMedia
387 * -------------------------------------------------------------------- */
388
389#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
390static struct atmel_nand_data nand_data;
391
392#define NAND_BASE AT91_CHIPSELECT_3
393
394static struct resource nand_resources[] = {
395 [0] = {
396 .start = NAND_BASE,
397 .end = NAND_BASE + SZ_256M - 1,
398 .flags = IORESOURCE_MEM,
399 },
400 [1] = {
401 .start = AT91CAP9_BASE_ECC,
402 .end = AT91CAP9_BASE_ECC + SZ_512 - 1,
403 .flags = IORESOURCE_MEM,
404 }
405};
406
407static struct platform_device at91cap9_nand_device = {
408 .name = "atmel_nand",
409 .id = -1,
410 .dev = {
411 .platform_data = &nand_data,
412 },
413 .resource = nand_resources,
414 .num_resources = ARRAY_SIZE(nand_resources),
415};
416
417void __init at91_add_device_nand(struct atmel_nand_data *data)
418{
419 unsigned long csa;
420
421 if (!data)
422 return;
423
424 csa = at91_sys_read(AT91_MATRIX_EBICSA);
425 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA);
426
427 /* enable pin */
428 if (gpio_is_valid(data->enable_pin))
429 at91_set_gpio_output(data->enable_pin, 1);
430
431 /* ready/busy pin */
432 if (gpio_is_valid(data->rdy_pin))
433 at91_set_gpio_input(data->rdy_pin, 1);
434
435 /* card detect pin */
436 if (gpio_is_valid(data->det_pin))
437 at91_set_gpio_input(data->det_pin, 1);
438
439 nand_data = *data;
440 platform_device_register(&at91cap9_nand_device);
441}
442#else
443void __init at91_add_device_nand(struct atmel_nand_data *data) {}
444#endif
445
446
447/* --------------------------------------------------------------------
448 * TWI (i2c)
449 * -------------------------------------------------------------------- */
450
451/*
452 * Prefer the GPIO code since the TWI controller isn't robust
453 * (gets overruns and underruns under load) and can only issue
454 * repeated STARTs in one scenario (the driver doesn't yet handle them).
455 */
456#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
457
458static struct i2c_gpio_platform_data pdata = {
459 .sda_pin = AT91_PIN_PB4,
460 .sda_is_open_drain = 1,
461 .scl_pin = AT91_PIN_PB5,
462 .scl_is_open_drain = 1,
463 .udelay = 2, /* ~100 kHz */
464};
465
466static struct platform_device at91cap9_twi_device = {
467 .name = "i2c-gpio",
468 .id = -1,
469 .dev.platform_data = &pdata,
470};
471
472void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
473{
474 at91_set_GPIO_periph(AT91_PIN_PB4, 1); /* TWD (SDA) */
475 at91_set_multi_drive(AT91_PIN_PB4, 1);
476
477 at91_set_GPIO_periph(AT91_PIN_PB5, 1); /* TWCK (SCL) */
478 at91_set_multi_drive(AT91_PIN_PB5, 1);
479
480 i2c_register_board_info(0, devices, nr_devices);
481 platform_device_register(&at91cap9_twi_device);
482}
483
484#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
485
486static struct resource twi_resources[] = {
487 [0] = {
488 .start = AT91CAP9_BASE_TWI,
489 .end = AT91CAP9_BASE_TWI + SZ_16K - 1,
490 .flags = IORESOURCE_MEM,
491 },
492 [1] = {
493 .start = AT91CAP9_ID_TWI,
494 .end = AT91CAP9_ID_TWI,
495 .flags = IORESOURCE_IRQ,
496 },
497};
498
499static struct platform_device at91cap9_twi_device = {
500 .name = "at91_i2c",
501 .id = -1,
502 .resource = twi_resources,
503 .num_resources = ARRAY_SIZE(twi_resources),
504};
505
506void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
507{
508 /* pins used for TWI interface */
509 at91_set_B_periph(AT91_PIN_PB4, 0); /* TWD */
510 at91_set_multi_drive(AT91_PIN_PB4, 1);
511
512 at91_set_B_periph(AT91_PIN_PB5, 0); /* TWCK */
513 at91_set_multi_drive(AT91_PIN_PB5, 1);
514
515 i2c_register_board_info(0, devices, nr_devices);
516 platform_device_register(&at91cap9_twi_device);
517}
518#else
519void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
520#endif
521
522/* --------------------------------------------------------------------
523 * SPI
524 * -------------------------------------------------------------------- */
525
526#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
527static u64 spi_dmamask = DMA_BIT_MASK(32);
528
529static struct resource spi0_resources[] = {
530 [0] = {
531 .start = AT91CAP9_BASE_SPI0,
532 .end = AT91CAP9_BASE_SPI0 + SZ_16K - 1,
533 .flags = IORESOURCE_MEM,
534 },
535 [1] = {
536 .start = AT91CAP9_ID_SPI0,
537 .end = AT91CAP9_ID_SPI0,
538 .flags = IORESOURCE_IRQ,
539 },
540};
541
542static struct platform_device at91cap9_spi0_device = {
543 .name = "atmel_spi",
544 .id = 0,
545 .dev = {
546 .dma_mask = &spi_dmamask,
547 .coherent_dma_mask = DMA_BIT_MASK(32),
548 },
549 .resource = spi0_resources,
550 .num_resources = ARRAY_SIZE(spi0_resources),
551};
552
553static const unsigned spi0_standard_cs[4] = { AT91_PIN_PA5, AT91_PIN_PA3, AT91_PIN_PD0, AT91_PIN_PD1 };
554
555static struct resource spi1_resources[] = {
556 [0] = {
557 .start = AT91CAP9_BASE_SPI1,
558 .end = AT91CAP9_BASE_SPI1 + SZ_16K - 1,
559 .flags = IORESOURCE_MEM,
560 },
561 [1] = {
562 .start = AT91CAP9_ID_SPI1,
563 .end = AT91CAP9_ID_SPI1,
564 .flags = IORESOURCE_IRQ,
565 },
566};
567
568static struct platform_device at91cap9_spi1_device = {
569 .name = "atmel_spi",
570 .id = 1,
571 .dev = {
572 .dma_mask = &spi_dmamask,
573 .coherent_dma_mask = DMA_BIT_MASK(32),
574 },
575 .resource = spi1_resources,
576 .num_resources = ARRAY_SIZE(spi1_resources),
577};
578
579static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB15, AT91_PIN_PB16, AT91_PIN_PB17, AT91_PIN_PB18 };
580
581void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
582{
583 int i;
584 unsigned long cs_pin;
585 short enable_spi0 = 0;
586 short enable_spi1 = 0;
587
588 /* Choose SPI chip-selects */
589 for (i = 0; i < nr_devices; i++) {
590 if (devices[i].controller_data)
591 cs_pin = (unsigned long) devices[i].controller_data;
592 else if (devices[i].bus_num == 0)
593 cs_pin = spi0_standard_cs[devices[i].chip_select];
594 else
595 cs_pin = spi1_standard_cs[devices[i].chip_select];
596
597 if (devices[i].bus_num == 0)
598 enable_spi0 = 1;
599 else
600 enable_spi1 = 1;
601
602 /* enable chip-select pin */
603 at91_set_gpio_output(cs_pin, 1);
604
605 /* pass chip-select pin to driver */
606 devices[i].controller_data = (void *) cs_pin;
607 }
608
609 spi_register_board_info(devices, nr_devices);
610
611 /* Configure SPI bus(es) */
612 if (enable_spi0) {
613 at91_set_B_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
614 at91_set_B_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
615 at91_set_B_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */
616
617 platform_device_register(&at91cap9_spi0_device);
618 }
619 if (enable_spi1) {
620 at91_set_A_periph(AT91_PIN_PB12, 0); /* SPI1_MISO */
621 at91_set_A_periph(AT91_PIN_PB13, 0); /* SPI1_MOSI */
622 at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_SPCK */
623
624 platform_device_register(&at91cap9_spi1_device);
625 }
626}
627#else
628void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
629#endif
630
631
632/* --------------------------------------------------------------------
633 * Timer/Counter block
634 * -------------------------------------------------------------------- */
635
636#ifdef CONFIG_ATMEL_TCLIB
637
638static struct resource tcb_resources[] = {
639 [0] = {
640 .start = AT91CAP9_BASE_TCB0,
641 .end = AT91CAP9_BASE_TCB0 + SZ_16K - 1,
642 .flags = IORESOURCE_MEM,
643 },
644 [1] = {
645 .start = AT91CAP9_ID_TCB,
646 .end = AT91CAP9_ID_TCB,
647 .flags = IORESOURCE_IRQ,
648 },
649};
650
651static struct platform_device at91cap9_tcb_device = {
652 .name = "atmel_tcb",
653 .id = 0,
654 .resource = tcb_resources,
655 .num_resources = ARRAY_SIZE(tcb_resources),
656};
657
658static void __init at91_add_device_tc(void)
659{
660 platform_device_register(&at91cap9_tcb_device);
661}
662#else
663static void __init at91_add_device_tc(void) { }
664#endif
665
666
667/* --------------------------------------------------------------------
668 * RTT
669 * -------------------------------------------------------------------- */
670
671static struct resource rtt_resources[] = {
672 {
673 .start = AT91CAP9_BASE_RTT,
674 .end = AT91CAP9_BASE_RTT + SZ_16 - 1,
675 .flags = IORESOURCE_MEM,
676 }
677};
678
679static struct platform_device at91cap9_rtt_device = {
680 .name = "at91_rtt",
681 .id = 0,
682 .resource = rtt_resources,
683 .num_resources = ARRAY_SIZE(rtt_resources),
684};
685
686static void __init at91_add_device_rtt(void)
687{
688 platform_device_register(&at91cap9_rtt_device);
689}
690
691
692/* --------------------------------------------------------------------
693 * Watchdog
694 * -------------------------------------------------------------------- */
695
696#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
697static struct resource wdt_resources[] = {
698 {
699 .start = AT91CAP9_BASE_WDT,
700 .end = AT91CAP9_BASE_WDT + SZ_16 - 1,
701 .flags = IORESOURCE_MEM,
702 }
703};
704
705static struct platform_device at91cap9_wdt_device = {
706 .name = "at91_wdt",
707 .id = -1,
708 .resource = wdt_resources,
709 .num_resources = ARRAY_SIZE(wdt_resources),
710};
711
712static void __init at91_add_device_watchdog(void)
713{
714 platform_device_register(&at91cap9_wdt_device);
715}
716#else
717static void __init at91_add_device_watchdog(void) {}
718#endif
719
720
721/* --------------------------------------------------------------------
722 * PWM
723 * --------------------------------------------------------------------*/
724
725#if defined(CONFIG_ATMEL_PWM)
726static u32 pwm_mask;
727
728static struct resource pwm_resources[] = {
729 [0] = {
730 .start = AT91CAP9_BASE_PWMC,
731 .end = AT91CAP9_BASE_PWMC + SZ_16K - 1,
732 .flags = IORESOURCE_MEM,
733 },
734 [1] = {
735 .start = AT91CAP9_ID_PWMC,
736 .end = AT91CAP9_ID_PWMC,
737 .flags = IORESOURCE_IRQ,
738 },
739};
740
741static struct platform_device at91cap9_pwm0_device = {
742 .name = "atmel_pwm",
743 .id = -1,
744 .dev = {
745 .platform_data = &pwm_mask,
746 },
747 .resource = pwm_resources,
748 .num_resources = ARRAY_SIZE(pwm_resources),
749};
750
751void __init at91_add_device_pwm(u32 mask)
752{
753 if (mask & (1 << AT91_PWM0))
754 at91_set_A_periph(AT91_PIN_PB19, 1); /* enable PWM0 */
755
756 if (mask & (1 << AT91_PWM1))
757 at91_set_B_periph(AT91_PIN_PB8, 1); /* enable PWM1 */
758
759 if (mask & (1 << AT91_PWM2))
760 at91_set_B_periph(AT91_PIN_PC29, 1); /* enable PWM2 */
761
762 if (mask & (1 << AT91_PWM3))
763 at91_set_B_periph(AT91_PIN_PA11, 1); /* enable PWM3 */
764
765 pwm_mask = mask;
766
767 platform_device_register(&at91cap9_pwm0_device);
768}
769#else
770void __init at91_add_device_pwm(u32 mask) {}
771#endif
772
773
774
775/* --------------------------------------------------------------------
776 * AC97
777 * -------------------------------------------------------------------- */
778
779#if defined(CONFIG_SND_ATMEL_AC97C) || defined(CONFIG_SND_ATMEL_AC97C_MODULE)
780static u64 ac97_dmamask = DMA_BIT_MASK(32);
781static struct ac97c_platform_data ac97_data;
782
783static struct resource ac97_resources[] = {
784 [0] = {
785 .start = AT91CAP9_BASE_AC97C,
786 .end = AT91CAP9_BASE_AC97C + SZ_16K - 1,
787 .flags = IORESOURCE_MEM,
788 },
789 [1] = {
790 .start = AT91CAP9_ID_AC97C,
791 .end = AT91CAP9_ID_AC97C,
792 .flags = IORESOURCE_IRQ,
793 },
794};
795
796static struct platform_device at91cap9_ac97_device = {
797 .name = "atmel_ac97c",
798 .id = 1,
799 .dev = {
800 .dma_mask = &ac97_dmamask,
801 .coherent_dma_mask = DMA_BIT_MASK(32),
802 .platform_data = &ac97_data,
803 },
804 .resource = ac97_resources,
805 .num_resources = ARRAY_SIZE(ac97_resources),
806};
807
808void __init at91_add_device_ac97(struct ac97c_platform_data *data)
809{
810 if (!data)
811 return;
812
813 at91_set_A_periph(AT91_PIN_PA6, 0); /* AC97FS */
814 at91_set_A_periph(AT91_PIN_PA7, 0); /* AC97CK */
815 at91_set_A_periph(AT91_PIN_PA8, 0); /* AC97TX */
816 at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */
817
818 /* reset */
819 if (gpio_is_valid(data->reset_pin))
820 at91_set_gpio_output(data->reset_pin, 0);
821
822 ac97_data = *data;
823 platform_device_register(&at91cap9_ac97_device);
824}
825#else
826void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
827#endif
828
829
830/* --------------------------------------------------------------------
831 * LCD Controller
832 * -------------------------------------------------------------------- */
833
834#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
835static u64 lcdc_dmamask = DMA_BIT_MASK(32);
836static struct atmel_lcdfb_info lcdc_data;
837
838static struct resource lcdc_resources[] = {
839 [0] = {
840 .start = AT91CAP9_LCDC_BASE,
841 .end = AT91CAP9_LCDC_BASE + SZ_4K - 1,
842 .flags = IORESOURCE_MEM,
843 },
844 [1] = {
845 .start = AT91CAP9_ID_LCDC,
846 .end = AT91CAP9_ID_LCDC,
847 .flags = IORESOURCE_IRQ,
848 },
849};
850
851static struct platform_device at91_lcdc_device = {
852 .name = "atmel_lcdfb",
853 .id = 0,
854 .dev = {
855 .dma_mask = &lcdc_dmamask,
856 .coherent_dma_mask = DMA_BIT_MASK(32),
857 .platform_data = &lcdc_data,
858 },
859 .resource = lcdc_resources,
860 .num_resources = ARRAY_SIZE(lcdc_resources),
861};
862
863void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
864{
865 if (!data)
866 return;
867
868 if (cpu_is_at91cap9_revB())
869 irq_set_irq_type(AT91CAP9_ID_LCDC, IRQ_TYPE_LEVEL_HIGH);
870
871 at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */
872 at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */
873 at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */
874 at91_set_B_periph(AT91_PIN_PB9, 0); /* LCDCC */
875 at91_set_A_periph(AT91_PIN_PC6, 0); /* LCDD2 */
876 at91_set_A_periph(AT91_PIN_PC7, 0); /* LCDD3 */
877 at91_set_A_periph(AT91_PIN_PC8, 0); /* LCDD4 */
878 at91_set_A_periph(AT91_PIN_PC9, 0); /* LCDD5 */
879 at91_set_A_periph(AT91_PIN_PC10, 0); /* LCDD6 */
880 at91_set_A_periph(AT91_PIN_PC11, 0); /* LCDD7 */
881 at91_set_A_periph(AT91_PIN_PC14, 0); /* LCDD10 */
882 at91_set_A_periph(AT91_PIN_PC15, 0); /* LCDD11 */
883 at91_set_A_periph(AT91_PIN_PC16, 0); /* LCDD12 */
884 at91_set_A_periph(AT91_PIN_PC17, 0); /* LCDD13 */
885 at91_set_A_periph(AT91_PIN_PC18, 0); /* LCDD14 */
886 at91_set_A_periph(AT91_PIN_PC19, 0); /* LCDD15 */
887 at91_set_A_periph(AT91_PIN_PC22, 0); /* LCDD18 */
888 at91_set_A_periph(AT91_PIN_PC23, 0); /* LCDD19 */
889 at91_set_A_periph(AT91_PIN_PC24, 0); /* LCDD20 */
890 at91_set_A_periph(AT91_PIN_PC25, 0); /* LCDD21 */
891 at91_set_A_periph(AT91_PIN_PC26, 0); /* LCDD22 */
892 at91_set_A_periph(AT91_PIN_PC27, 0); /* LCDD23 */
893
894 lcdc_data = *data;
895 platform_device_register(&at91_lcdc_device);
896}
897#else
898void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
899#endif
900
901
902/* --------------------------------------------------------------------
903 * SSC -- Synchronous Serial Controller
904 * -------------------------------------------------------------------- */
905
906#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
907static u64 ssc0_dmamask = DMA_BIT_MASK(32);
908
909static struct resource ssc0_resources[] = {
910 [0] = {
911 .start = AT91CAP9_BASE_SSC0,
912 .end = AT91CAP9_BASE_SSC0 + SZ_16K - 1,
913 .flags = IORESOURCE_MEM,
914 },
915 [1] = {
916 .start = AT91CAP9_ID_SSC0,
917 .end = AT91CAP9_ID_SSC0,
918 .flags = IORESOURCE_IRQ,
919 },
920};
921
922static struct platform_device at91cap9_ssc0_device = {
923 .name = "ssc",
924 .id = 0,
925 .dev = {
926 .dma_mask = &ssc0_dmamask,
927 .coherent_dma_mask = DMA_BIT_MASK(32),
928 },
929 .resource = ssc0_resources,
930 .num_resources = ARRAY_SIZE(ssc0_resources),
931};
932
933static inline void configure_ssc0_pins(unsigned pins)
934{
935 if (pins & ATMEL_SSC_TF)
936 at91_set_A_periph(AT91_PIN_PB0, 1);
937 if (pins & ATMEL_SSC_TK)
938 at91_set_A_periph(AT91_PIN_PB1, 1);
939 if (pins & ATMEL_SSC_TD)
940 at91_set_A_periph(AT91_PIN_PB2, 1);
941 if (pins & ATMEL_SSC_RD)
942 at91_set_A_periph(AT91_PIN_PB3, 1);
943 if (pins & ATMEL_SSC_RK)
944 at91_set_A_periph(AT91_PIN_PB4, 1);
945 if (pins & ATMEL_SSC_RF)
946 at91_set_A_periph(AT91_PIN_PB5, 1);
947}
948
949static u64 ssc1_dmamask = DMA_BIT_MASK(32);
950
951static struct resource ssc1_resources[] = {
952 [0] = {
953 .start = AT91CAP9_BASE_SSC1,
954 .end = AT91CAP9_BASE_SSC1 + SZ_16K - 1,
955 .flags = IORESOURCE_MEM,
956 },
957 [1] = {
958 .start = AT91CAP9_ID_SSC1,
959 .end = AT91CAP9_ID_SSC1,
960 .flags = IORESOURCE_IRQ,
961 },
962};
963
964static struct platform_device at91cap9_ssc1_device = {
965 .name = "ssc",
966 .id = 1,
967 .dev = {
968 .dma_mask = &ssc1_dmamask,
969 .coherent_dma_mask = DMA_BIT_MASK(32),
970 },
971 .resource = ssc1_resources,
972 .num_resources = ARRAY_SIZE(ssc1_resources),
973};
974
975static inline void configure_ssc1_pins(unsigned pins)
976{
977 if (pins & ATMEL_SSC_TF)
978 at91_set_A_periph(AT91_PIN_PB6, 1);
979 if (pins & ATMEL_SSC_TK)
980 at91_set_A_periph(AT91_PIN_PB7, 1);
981 if (pins & ATMEL_SSC_TD)
982 at91_set_A_periph(AT91_PIN_PB8, 1);
983 if (pins & ATMEL_SSC_RD)
984 at91_set_A_periph(AT91_PIN_PB9, 1);
985 if (pins & ATMEL_SSC_RK)
986 at91_set_A_periph(AT91_PIN_PB10, 1);
987 if (pins & ATMEL_SSC_RF)
988 at91_set_A_periph(AT91_PIN_PB11, 1);
989}
990
991/*
992 * SSC controllers are accessed through library code, instead of any
993 * kind of all-singing/all-dancing driver. For example one could be
994 * used by a particular I2S audio codec's driver, while another one
995 * on the same system might be used by a custom data capture driver.
996 */
997void __init at91_add_device_ssc(unsigned id, unsigned pins)
998{
999 struct platform_device *pdev;
1000
1001 /*
1002 * NOTE: caller is responsible for passing information matching
1003 * "pins" to whatever will be using each particular controller.
1004 */
1005 switch (id) {
1006 case AT91CAP9_ID_SSC0:
1007 pdev = &at91cap9_ssc0_device;
1008 configure_ssc0_pins(pins);
1009 break;
1010 case AT91CAP9_ID_SSC1:
1011 pdev = &at91cap9_ssc1_device;
1012 configure_ssc1_pins(pins);
1013 break;
1014 default:
1015 return;
1016 }
1017
1018 platform_device_register(pdev);
1019}
1020
1021#else
1022void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
1023#endif
1024
1025
1026/* --------------------------------------------------------------------
1027 * UART
1028 * -------------------------------------------------------------------- */
1029
1030#if defined(CONFIG_SERIAL_ATMEL)
1031static struct resource dbgu_resources[] = {
1032 [0] = {
1033 .start = AT91CAP9_BASE_DBGU,
1034 .end = AT91CAP9_BASE_DBGU + SZ_512 - 1,
1035 .flags = IORESOURCE_MEM,
1036 },
1037 [1] = {
1038 .start = AT91_ID_SYS,
1039 .end = AT91_ID_SYS,
1040 .flags = IORESOURCE_IRQ,
1041 },
1042};
1043
1044static struct atmel_uart_data dbgu_data = {
1045 .use_dma_tx = 0,
1046 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
1047};
1048
1049static u64 dbgu_dmamask = DMA_BIT_MASK(32);
1050
1051static struct platform_device at91cap9_dbgu_device = {
1052 .name = "atmel_usart",
1053 .id = 0,
1054 .dev = {
1055 .dma_mask = &dbgu_dmamask,
1056 .coherent_dma_mask = DMA_BIT_MASK(32),
1057 .platform_data = &dbgu_data,
1058 },
1059 .resource = dbgu_resources,
1060 .num_resources = ARRAY_SIZE(dbgu_resources),
1061};
1062
1063static inline void configure_dbgu_pins(void)
1064{
1065 at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */
1066 at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */
1067}
1068
1069static struct resource uart0_resources[] = {
1070 [0] = {
1071 .start = AT91CAP9_BASE_US0,
1072 .end = AT91CAP9_BASE_US0 + SZ_16K - 1,
1073 .flags = IORESOURCE_MEM,
1074 },
1075 [1] = {
1076 .start = AT91CAP9_ID_US0,
1077 .end = AT91CAP9_ID_US0,
1078 .flags = IORESOURCE_IRQ,
1079 },
1080};
1081
1082static struct atmel_uart_data uart0_data = {
1083 .use_dma_tx = 1,
1084 .use_dma_rx = 1,
1085};
1086
1087static u64 uart0_dmamask = DMA_BIT_MASK(32);
1088
1089static struct platform_device at91cap9_uart0_device = {
1090 .name = "atmel_usart",
1091 .id = 1,
1092 .dev = {
1093 .dma_mask = &uart0_dmamask,
1094 .coherent_dma_mask = DMA_BIT_MASK(32),
1095 .platform_data = &uart0_data,
1096 },
1097 .resource = uart0_resources,
1098 .num_resources = ARRAY_SIZE(uart0_resources),
1099};
1100
1101static inline void configure_usart0_pins(unsigned pins)
1102{
1103 at91_set_A_periph(AT91_PIN_PA22, 1); /* TXD0 */
1104 at91_set_A_periph(AT91_PIN_PA23, 0); /* RXD0 */
1105
1106 if (pins & ATMEL_UART_RTS)
1107 at91_set_A_periph(AT91_PIN_PA24, 0); /* RTS0 */
1108 if (pins & ATMEL_UART_CTS)
1109 at91_set_A_periph(AT91_PIN_PA25, 0); /* CTS0 */
1110}
1111
1112static struct resource uart1_resources[] = {
1113 [0] = {
1114 .start = AT91CAP9_BASE_US1,
1115 .end = AT91CAP9_BASE_US1 + SZ_16K - 1,
1116 .flags = IORESOURCE_MEM,
1117 },
1118 [1] = {
1119 .start = AT91CAP9_ID_US1,
1120 .end = AT91CAP9_ID_US1,
1121 .flags = IORESOURCE_IRQ,
1122 },
1123};
1124
1125static struct atmel_uart_data uart1_data = {
1126 .use_dma_tx = 1,
1127 .use_dma_rx = 1,
1128};
1129
1130static u64 uart1_dmamask = DMA_BIT_MASK(32);
1131
1132static struct platform_device at91cap9_uart1_device = {
1133 .name = "atmel_usart",
1134 .id = 2,
1135 .dev = {
1136 .dma_mask = &uart1_dmamask,
1137 .coherent_dma_mask = DMA_BIT_MASK(32),
1138 .platform_data = &uart1_data,
1139 },
1140 .resource = uart1_resources,
1141 .num_resources = ARRAY_SIZE(uart1_resources),
1142};
1143
1144static inline void configure_usart1_pins(unsigned pins)
1145{
1146 at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */
1147 at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */
1148
1149 if (pins & ATMEL_UART_RTS)
1150 at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */
1151 if (pins & ATMEL_UART_CTS)
1152 at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */
1153}
1154
1155static struct resource uart2_resources[] = {
1156 [0] = {
1157 .start = AT91CAP9_BASE_US2,
1158 .end = AT91CAP9_BASE_US2 + SZ_16K - 1,
1159 .flags = IORESOURCE_MEM,
1160 },
1161 [1] = {
1162 .start = AT91CAP9_ID_US2,
1163 .end = AT91CAP9_ID_US2,
1164 .flags = IORESOURCE_IRQ,
1165 },
1166};
1167
1168static struct atmel_uart_data uart2_data = {
1169 .use_dma_tx = 1,
1170 .use_dma_rx = 1,
1171};
1172
1173static u64 uart2_dmamask = DMA_BIT_MASK(32);
1174
1175static struct platform_device at91cap9_uart2_device = {
1176 .name = "atmel_usart",
1177 .id = 3,
1178 .dev = {
1179 .dma_mask = &uart2_dmamask,
1180 .coherent_dma_mask = DMA_BIT_MASK(32),
1181 .platform_data = &uart2_data,
1182 },
1183 .resource = uart2_resources,
1184 .num_resources = ARRAY_SIZE(uart2_resources),
1185};
1186
1187static inline void configure_usart2_pins(unsigned pins)
1188{
1189 at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */
1190 at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */
1191
1192 if (pins & ATMEL_UART_RTS)
1193 at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */
1194 if (pins & ATMEL_UART_CTS)
1195 at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */
1196}
1197
1198static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1199struct platform_device *atmel_default_console_device; /* the serial console device */
1200
1201void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1202{
1203 struct platform_device *pdev;
1204 struct atmel_uart_data *pdata;
1205
1206 switch (id) {
1207 case 0: /* DBGU */
1208 pdev = &at91cap9_dbgu_device;
1209 configure_dbgu_pins();
1210 break;
1211 case AT91CAP9_ID_US0:
1212 pdev = &at91cap9_uart0_device;
1213 configure_usart0_pins(pins);
1214 break;
1215 case AT91CAP9_ID_US1:
1216 pdev = &at91cap9_uart1_device;
1217 configure_usart1_pins(pins);
1218 break;
1219 case AT91CAP9_ID_US2:
1220 pdev = &at91cap9_uart2_device;
1221 configure_usart2_pins(pins);
1222 break;
1223 default:
1224 return;
1225 }
1226 pdata = pdev->dev.platform_data;
1227 pdata->num = portnr; /* update to mapped ID */
1228
1229 if (portnr < ATMEL_MAX_UART)
1230 at91_uarts[portnr] = pdev;
1231}
1232
1233void __init at91_set_serial_console(unsigned portnr)
1234{
1235 if (portnr < ATMEL_MAX_UART) {
1236 atmel_default_console_device = at91_uarts[portnr];
1237 at91cap9_set_console_clock(at91_uarts[portnr]->id);
1238 }
1239}
1240
1241void __init at91_add_device_serial(void)
1242{
1243 int i;
1244
1245 for (i = 0; i < ATMEL_MAX_UART; i++) {
1246 if (at91_uarts[i])
1247 platform_device_register(at91_uarts[i]);
1248 }
1249
1250 if (!atmel_default_console_device)
1251 printk(KERN_INFO "AT91: No default serial console defined.\n");
1252}
1253#else
1254void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1255void __init at91_set_serial_console(unsigned portnr) {}
1256void __init at91_add_device_serial(void) {}
1257#endif
1258
1259
1260/* -------------------------------------------------------------------- */
1261/*
1262 * These devices are always present and don't need any board-specific
1263 * setup.
1264 */
1265static int __init at91_add_standard_devices(void)
1266{
1267 at91_add_device_rtt();
1268 at91_add_device_watchdog();
1269 at91_add_device_tc();
1270 return 0;
1271}
1272
1273arch_initcall(at91_add_standard_devices);
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 99c3174e24a..0df1045311e 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -289,13 +289,22 @@ static struct at91_gpio_bank at91rm9200_gpio[] __initdata = {
289 } 289 }
290}; 290};
291 291
292static void at91rm9200_idle(void)
293{
294 /*
295 * Disable the processor clock. The processor will be automatically
296 * re-enabled by an interrupt or by a reset.
297 */
298 at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK);
299}
300
292static void at91rm9200_restart(char mode, const char *cmd) 301static void at91rm9200_restart(char mode, const char *cmd)
293{ 302{
294 /* 303 /*
295 * Perform a hardware reset with the use of the Watchdog timer. 304 * Perform a hardware reset with the use of the Watchdog timer.
296 */ 305 */
297 at91_sys_write(AT91_ST_WDMR, AT91_ST_RSTEN | AT91_ST_EXTEN | 1); 306 at91_st_write(AT91_ST_WDMR, AT91_ST_RSTEN | AT91_ST_EXTEN | 1);
298 at91_sys_write(AT91_ST_CR, AT91_ST_WDRST); 307 at91_st_write(AT91_ST_CR, AT91_ST_WDRST);
299} 308}
300 309
301/* -------------------------------------------------------------------- 310/* --------------------------------------------------------------------
@@ -310,10 +319,13 @@ static void __init at91rm9200_map_io(void)
310 319
311static void __init at91rm9200_ioremap_registers(void) 320static void __init at91rm9200_ioremap_registers(void)
312{ 321{
322 at91rm9200_ioremap_st(AT91RM9200_BASE_ST);
323 at91_ioremap_ramc(0, AT91RM9200_BASE_MC, 256);
313} 324}
314 325
315static void __init at91rm9200_initialize(void) 326static void __init at91rm9200_initialize(void)
316{ 327{
328 arm_pm_idle = at91rm9200_idle;
317 arm_pm_restart = at91rm9200_restart; 329 arm_pm_restart = at91rm9200_restart;
318 at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1) 330 at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
319 | (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3) 331 | (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3)
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 97676bdae99..99ce5c955e3 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -21,6 +21,7 @@
21#include <mach/board.h> 21#include <mach/board.h>
22#include <mach/at91rm9200.h> 22#include <mach/at91rm9200.h>
23#include <mach/at91rm9200_mc.h> 23#include <mach/at91rm9200_mc.h>
24#include <mach/at91_ramc.h>
24 25
25#include "generic.h" 26#include "generic.h"
26 27
@@ -241,15 +242,15 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
241 data->chipselect = 4; /* can only use EBI ChipSelect 4 */ 242 data->chipselect = 4; /* can only use EBI ChipSelect 4 */
242 243
243 /* CF takes over CS4, CS5, CS6 */ 244 /* CF takes over CS4, CS5, CS6 */
244 csa = at91_sys_read(AT91_EBI_CSA); 245 csa = at91_ramc_read(0, AT91_EBI_CSA);
245 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH); 246 at91_ramc_write(0, AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH);
246 247
247 /* 248 /*
248 * Static memory controller timing adjustments. 249 * Static memory controller timing adjustments.
249 * REVISIT: these timings are in terms of MCK cycles, so 250 * REVISIT: these timings are in terms of MCK cycles, so
250 * when MCK changes (cpufreq etc) so must these values... 251 * when MCK changes (cpufreq etc) so must these values...
251 */ 252 */
252 at91_sys_write(AT91_SMC_CSR(4), 253 at91_ramc_write(0, AT91_SMC_CSR(4),
253 AT91_SMC_ACSS_STD 254 AT91_SMC_ACSS_STD
254 | AT91_SMC_DBW_16 255 | AT91_SMC_DBW_16
255 | AT91_SMC_BAT 256 | AT91_SMC_BAT
@@ -407,11 +408,11 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
407 return; 408 return;
408 409
409 /* enable the address range of CS3 */ 410 /* enable the address range of CS3 */
410 csa = at91_sys_read(AT91_EBI_CSA); 411 csa = at91_ramc_read(0, AT91_EBI_CSA);
411 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS3A_SMC_SMARTMEDIA); 412 at91_ramc_write(0, AT91_EBI_CSA, csa | AT91_EBI_CS3A_SMC_SMARTMEDIA);
412 413
413 /* set the bus interface characteristics */ 414 /* set the bus interface characteristics */
414 at91_sys_write(AT91_SMC_CSR(3), AT91_SMC_ACSS_STD | AT91_SMC_DBW_8 | AT91_SMC_WSEN 415 at91_ramc_write(0, AT91_SMC_CSR(3), AT91_SMC_ACSS_STD | AT91_SMC_DBW_8 | AT91_SMC_WSEN
415 | AT91_SMC_NWS_(5) 416 | AT91_SMC_NWS_(5)
416 | AT91_SMC_TDF_(1) 417 | AT91_SMC_TDF_(1)
417 | AT91_SMC_RWSETUP_(0) /* tDS Data Set up Time 30 - ns */ 418 | AT91_SMC_RWSETUP_(0) /* tDS Data Set up Time 30 - ns */
@@ -1114,7 +1115,6 @@ static inline void configure_usart3_pins(unsigned pins)
1114} 1115}
1115 1116
1116static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 1117static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1117struct platform_device *atmel_default_console_device; /* the serial console device */
1118 1118
1119void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) 1119void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1120{ 1120{
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index a028cdf8f97..dd7f782b0b9 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -43,9 +43,9 @@ static inline unsigned long read_CRTR(void)
43{ 43{
44 unsigned long x1, x2; 44 unsigned long x1, x2;
45 45
46 x1 = at91_sys_read(AT91_ST_CRTR); 46 x1 = at91_st_read(AT91_ST_CRTR);
47 do { 47 do {
48 x2 = at91_sys_read(AT91_ST_CRTR); 48 x2 = at91_st_read(AT91_ST_CRTR);
49 if (x1 == x2) 49 if (x1 == x2)
50 break; 50 break;
51 x1 = x2; 51 x1 = x2;
@@ -58,7 +58,7 @@ static inline unsigned long read_CRTR(void)
58 */ 58 */
59static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id) 59static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
60{ 60{
61 u32 sr = at91_sys_read(AT91_ST_SR) & irqmask; 61 u32 sr = at91_st_read(AT91_ST_SR) & irqmask;
62 62
63 /* 63 /*
64 * irqs should be disabled here, but as the irq is shared they are only 64 * irqs should be disabled here, but as the irq is shared they are only
@@ -110,22 +110,22 @@ static void
110clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev) 110clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev)
111{ 111{
112 /* Disable and flush pending timer interrupts */ 112 /* Disable and flush pending timer interrupts */
113 at91_sys_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_ALMS); 113 at91_st_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_ALMS);
114 (void) at91_sys_read(AT91_ST_SR); 114 at91_st_read(AT91_ST_SR);
115 115
116 last_crtr = read_CRTR(); 116 last_crtr = read_CRTR();
117 switch (mode) { 117 switch (mode) {
118 case CLOCK_EVT_MODE_PERIODIC: 118 case CLOCK_EVT_MODE_PERIODIC:
119 /* PIT for periodic irqs; fixed rate of 1/HZ */ 119 /* PIT for periodic irqs; fixed rate of 1/HZ */
120 irqmask = AT91_ST_PITS; 120 irqmask = AT91_ST_PITS;
121 at91_sys_write(AT91_ST_PIMR, RM9200_TIMER_LATCH); 121 at91_st_write(AT91_ST_PIMR, RM9200_TIMER_LATCH);
122 break; 122 break;
123 case CLOCK_EVT_MODE_ONESHOT: 123 case CLOCK_EVT_MODE_ONESHOT:
124 /* ALM for oneshot irqs, set by next_event() 124 /* ALM for oneshot irqs, set by next_event()
125 * before 32 seconds have passed 125 * before 32 seconds have passed
126 */ 126 */
127 irqmask = AT91_ST_ALMS; 127 irqmask = AT91_ST_ALMS;
128 at91_sys_write(AT91_ST_RTAR, last_crtr); 128 at91_st_write(AT91_ST_RTAR, last_crtr);
129 break; 129 break;
130 case CLOCK_EVT_MODE_SHUTDOWN: 130 case CLOCK_EVT_MODE_SHUTDOWN:
131 case CLOCK_EVT_MODE_UNUSED: 131 case CLOCK_EVT_MODE_UNUSED:
@@ -133,7 +133,7 @@ clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev)
133 irqmask = 0; 133 irqmask = 0;
134 break; 134 break;
135 } 135 }
136 at91_sys_write(AT91_ST_IER, irqmask); 136 at91_st_write(AT91_ST_IER, irqmask);
137} 137}
138 138
139static int 139static int
@@ -156,12 +156,12 @@ clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev)
156 alm = read_CRTR(); 156 alm = read_CRTR();
157 157
158 /* Cancel any pending alarm; flush any pending IRQ */ 158 /* Cancel any pending alarm; flush any pending IRQ */
159 at91_sys_write(AT91_ST_RTAR, alm); 159 at91_st_write(AT91_ST_RTAR, alm);
160 (void) at91_sys_read(AT91_ST_SR); 160 at91_st_read(AT91_ST_SR);
161 161
162 /* Schedule alarm by writing RTAR. */ 162 /* Schedule alarm by writing RTAR. */
163 alm += delta; 163 alm += delta;
164 at91_sys_write(AT91_ST_RTAR, alm); 164 at91_st_write(AT91_ST_RTAR, alm);
165 165
166 return status; 166 return status;
167} 167}
@@ -175,15 +175,24 @@ static struct clock_event_device clkevt = {
175 .set_mode = clkevt32k_mode, 175 .set_mode = clkevt32k_mode,
176}; 176};
177 177
178void __iomem *at91_st_base;
179
180void __init at91rm9200_ioremap_st(u32 addr)
181{
182 at91_st_base = ioremap(addr, 256);
183 if (!at91_st_base)
184 panic("Impossible to ioremap ST\n");
185}
186
178/* 187/*
179 * ST (system timer) module supports both clockevents and clocksource. 188 * ST (system timer) module supports both clockevents and clocksource.
180 */ 189 */
181void __init at91rm9200_timer_init(void) 190void __init at91rm9200_timer_init(void)
182{ 191{
183 /* Disable all timer interrupts, and clear any pending ones */ 192 /* Disable all timer interrupts, and clear any pending ones */
184 at91_sys_write(AT91_ST_IDR, 193 at91_st_write(AT91_ST_IDR,
185 AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS); 194 AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS);
186 (void) at91_sys_read(AT91_ST_SR); 195 at91_st_read(AT91_ST_SR);
187 196
188 /* Make IRQs happen for the system timer */ 197 /* Make IRQs happen for the system timer */
189 setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq); 198 setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq);
@@ -192,7 +201,7 @@ void __init at91rm9200_timer_init(void)
192 * directly for the clocksource and all clockevents, after adjusting 201 * directly for the clocksource and all clockevents, after adjusting
193 * its prescaler from the 1 Hz default. 202 * its prescaler from the 1 Hz default.
194 */ 203 */
195 at91_sys_write(AT91_ST_RTMR, 1); 204 at91_st_write(AT91_ST_RTMR, 1);
196 205
197 /* Setup timer clockevent, with minimum of two ticks (important!!) */ 206 /* Setup timer clockevent, with minimum of two ticks (important!!) */
198 clkevt.mult = div_sc(AT91_SLOW_CLOCK, NSEC_PER_SEC, clkevt.shift); 207 clkevt.mult = div_sc(AT91_SLOW_CLOCK, NSEC_PER_SEC, clkevt.shift);
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index d4036ba4361..14b5a9c9a51 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14 14
15#include <asm/proc-fns.h>
15#include <asm/irq.h> 16#include <asm/irq.h>
16#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
17#include <asm/mach/map.h> 18#include <asm/mach/map.h>
@@ -208,6 +209,13 @@ static struct clk_lookup periph_clocks_lookups[] = {
208 CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk), 209 CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk),
209 CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk), 210 CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk),
210 CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk), 211 CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk),
212 /* more tc lookup table for DT entries */
213 CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
214 CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
215 CLKDEV_CON_DEV_ID("t2_clk", "fffa0000.timer", &tc2_clk),
216 CLKDEV_CON_DEV_ID("t0_clk", "fffdc000.timer", &tc3_clk),
217 CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk),
218 CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk),
211 /* fake hclk clock */ 219 /* fake hclk clock */
212 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), 220 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
213 CLKDEV_CON_ID("pioA", &pioA_clk), 221 CLKDEV_CON_ID("pioA", &pioA_clk),
@@ -309,27 +317,27 @@ static void __init at91sam9xe_map_io(void)
309 317
310static void __init at91sam9260_map_io(void) 318static void __init at91sam9260_map_io(void)
311{ 319{
312 if (cpu_is_at91sam9xe()) { 320 if (cpu_is_at91sam9xe())
313 at91sam9xe_map_io(); 321 at91sam9xe_map_io();
314 } else if (cpu_is_at91sam9g20()) { 322 else if (cpu_is_at91sam9g20())
315 at91_init_sram(0, AT91SAM9G20_SRAM0_BASE, AT91SAM9G20_SRAM0_SIZE); 323 at91_init_sram(0, AT91SAM9G20_SRAM_BASE, AT91SAM9G20_SRAM_SIZE);
316 at91_init_sram(1, AT91SAM9G20_SRAM1_BASE, AT91SAM9G20_SRAM1_SIZE); 324 else
317 } else { 325 at91_init_sram(0, AT91SAM9260_SRAM_BASE, AT91SAM9260_SRAM_SIZE);
318 at91_init_sram(0, AT91SAM9260_SRAM0_BASE, AT91SAM9260_SRAM0_SIZE);
319 at91_init_sram(1, AT91SAM9260_SRAM1_BASE, AT91SAM9260_SRAM1_SIZE);
320 }
321} 326}
322 327
323static void __init at91sam9260_ioremap_registers(void) 328static void __init at91sam9260_ioremap_registers(void)
324{ 329{
325 at91_ioremap_shdwc(AT91SAM9260_BASE_SHDWC); 330 at91_ioremap_shdwc(AT91SAM9260_BASE_SHDWC);
326 at91_ioremap_rstc(AT91SAM9260_BASE_RSTC); 331 at91_ioremap_rstc(AT91SAM9260_BASE_RSTC);
332 at91_ioremap_ramc(0, AT91SAM9260_BASE_SDRAMC, 512);
327 at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT); 333 at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT);
328 at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC); 334 at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC);
335 at91_ioremap_matrix(AT91SAM9260_BASE_MATRIX);
329} 336}
330 337
331static void __init at91sam9260_initialize(void) 338static void __init at91sam9260_initialize(void)
332{ 339{
340 arm_pm_idle = at91sam9_idle;
333 arm_pm_restart = at91sam9_alt_restart; 341 arm_pm_restart = at91sam9_alt_restart;
334 at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1) 342 at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
335 | (1 << AT91SAM9260_ID_IRQ2); 343 | (1 << AT91SAM9260_ID_IRQ2);
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 5a24f0b4554..7e5651ee9f8 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -21,6 +21,7 @@
21#include <mach/cpu.h> 21#include <mach/cpu.h>
22#include <mach/at91sam9260.h> 22#include <mach/at91sam9260.h>
23#include <mach/at91sam9260_matrix.h> 23#include <mach/at91sam9260_matrix.h>
24#include <mach/at91_matrix.h>
24#include <mach/at91sam9_smc.h> 25#include <mach/at91sam9_smc.h>
25 26
26#include "generic.h" 27#include "generic.h"
@@ -422,8 +423,8 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
422 if (!data) 423 if (!data)
423 return; 424 return;
424 425
425 csa = at91_sys_read(AT91_MATRIX_EBICSA); 426 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
426 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); 427 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
427 428
428 /* enable pin */ 429 /* enable pin */
429 if (gpio_is_valid(data->enable_pin)) 430 if (gpio_is_valid(data->enable_pin))
@@ -641,7 +642,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
641static struct resource tcb0_resources[] = { 642static struct resource tcb0_resources[] = {
642 [0] = { 643 [0] = {
643 .start = AT91SAM9260_BASE_TCB0, 644 .start = AT91SAM9260_BASE_TCB0,
644 .end = AT91SAM9260_BASE_TCB0 + SZ_16K - 1, 645 .end = AT91SAM9260_BASE_TCB0 + SZ_256 - 1,
645 .flags = IORESOURCE_MEM, 646 .flags = IORESOURCE_MEM,
646 }, 647 },
647 [1] = { 648 [1] = {
@@ -671,7 +672,7 @@ static struct platform_device at91sam9260_tcb0_device = {
671static struct resource tcb1_resources[] = { 672static struct resource tcb1_resources[] = {
672 [0] = { 673 [0] = {
673 .start = AT91SAM9260_BASE_TCB1, 674 .start = AT91SAM9260_BASE_TCB1,
674 .end = AT91SAM9260_BASE_TCB1 + SZ_16K - 1, 675 .end = AT91SAM9260_BASE_TCB1 + SZ_256 - 1,
675 .flags = IORESOURCE_MEM, 676 .flags = IORESOURCE_MEM,
676 }, 677 },
677 [1] = { 678 [1] = {
@@ -698,8 +699,25 @@ static struct platform_device at91sam9260_tcb1_device = {
698 .num_resources = ARRAY_SIZE(tcb1_resources), 699 .num_resources = ARRAY_SIZE(tcb1_resources),
699}; 700};
700 701
702#if defined(CONFIG_OF)
703static struct of_device_id tcb_ids[] = {
704 { .compatible = "atmel,at91rm9200-tcb" },
705 { /*sentinel*/ }
706};
707#endif
708
701static void __init at91_add_device_tc(void) 709static void __init at91_add_device_tc(void)
702{ 710{
711#if defined(CONFIG_OF)
712 struct device_node *np;
713
714 np = of_find_matching_node(NULL, tcb_ids);
715 if (np) {
716 of_node_put(np);
717 return;
718 }
719#endif
720
703 platform_device_register(&at91sam9260_tcb0_device); 721 platform_device_register(&at91sam9260_tcb0_device);
704 platform_device_register(&at91sam9260_tcb1_device); 722 platform_device_register(&at91sam9260_tcb1_device);
705} 723}
@@ -717,18 +735,42 @@ static struct resource rtt_resources[] = {
717 .start = AT91SAM9260_BASE_RTT, 735 .start = AT91SAM9260_BASE_RTT,
718 .end = AT91SAM9260_BASE_RTT + SZ_16 - 1, 736 .end = AT91SAM9260_BASE_RTT + SZ_16 - 1,
719 .flags = IORESOURCE_MEM, 737 .flags = IORESOURCE_MEM,
720 } 738 }, {
739 .flags = IORESOURCE_MEM,
740 },
721}; 741};
722 742
723static struct platform_device at91sam9260_rtt_device = { 743static struct platform_device at91sam9260_rtt_device = {
724 .name = "at91_rtt", 744 .name = "at91_rtt",
725 .id = 0, 745 .id = 0,
726 .resource = rtt_resources, 746 .resource = rtt_resources,
727 .num_resources = ARRAY_SIZE(rtt_resources),
728}; 747};
729 748
749
750#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
751static void __init at91_add_device_rtt_rtc(void)
752{
753 at91sam9260_rtt_device.name = "rtc-at91sam9";
754 /*
755 * The second resource is needed:
756 * GPBR will serve as the storage for RTC time offset
757 */
758 at91sam9260_rtt_device.num_resources = 2;
759 rtt_resources[1].start = AT91SAM9260_BASE_GPBR +
760 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
761 rtt_resources[1].end = rtt_resources[1].start + 3;
762}
763#else
764static void __init at91_add_device_rtt_rtc(void)
765{
766 /* Only one resource is needed: RTT not used as RTC */
767 at91sam9260_rtt_device.num_resources = 1;
768}
769#endif
770
730static void __init at91_add_device_rtt(void) 771static void __init at91_add_device_rtt(void)
731{ 772{
773 at91_add_device_rtt_rtc();
732 platform_device_register(&at91sam9260_rtt_device); 774 platform_device_register(&at91sam9260_rtt_device);
733} 775}
734 776
@@ -1139,7 +1181,6 @@ static inline void configure_usart5_pins(void)
1139} 1181}
1140 1182
1141static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 1183static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1142struct platform_device *atmel_default_console_device; /* the serial console device */
1143 1184
1144void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) 1185void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1145{ 1186{
@@ -1264,7 +1305,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
1264 if (!data) 1305 if (!data)
1265 return; 1306 return;
1266 1307
1267 csa = at91_sys_read(AT91_MATRIX_EBICSA); 1308 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
1268 1309
1269 switch (data->chipselect) { 1310 switch (data->chipselect) {
1270 case 4: 1311 case 4:
@@ -1287,7 +1328,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
1287 return; 1328 return;
1288 } 1329 }
1289 1330
1290 at91_sys_write(AT91_MATRIX_EBICSA, csa); 1331 at91_matrix_write(AT91_MATRIX_EBICSA, csa);
1291 1332
1292 if (gpio_is_valid(data->rst_pin)) { 1333 if (gpio_is_valid(data->rst_pin)) {
1293 at91_set_multi_drive(data->rst_pin, 0); 1334 at91_set_multi_drive(data->rst_pin, 0);
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 023c2ff138d..684c5dfd92a 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14 14
15#include <asm/proc-fns.h>
15#include <asm/irq.h> 16#include <asm/irq.h>
16#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
17#include <asm/mach/map.h> 18#include <asm/mach/map.h>
@@ -282,12 +283,15 @@ static void __init at91sam9261_ioremap_registers(void)
282{ 283{
283 at91_ioremap_shdwc(AT91SAM9261_BASE_SHDWC); 284 at91_ioremap_shdwc(AT91SAM9261_BASE_SHDWC);
284 at91_ioremap_rstc(AT91SAM9261_BASE_RSTC); 285 at91_ioremap_rstc(AT91SAM9261_BASE_RSTC);
286 at91_ioremap_ramc(0, AT91SAM9261_BASE_SDRAMC, 512);
285 at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT); 287 at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT);
286 at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC); 288 at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC);
289 at91_ioremap_matrix(AT91SAM9261_BASE_MATRIX);
287} 290}
288 291
289static void __init at91sam9261_initialize(void) 292static void __init at91sam9261_initialize(void)
290{ 293{
294 arm_pm_idle = at91sam9_idle;
291 arm_pm_restart = at91sam9_alt_restart; 295 arm_pm_restart = at91sam9_alt_restart;
292 at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1) 296 at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
293 | (1 << AT91SAM9261_ID_IRQ2); 297 | (1 << AT91SAM9261_ID_IRQ2);
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 1e28bed8f42..096da87dc00 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -24,6 +24,7 @@
24#include <mach/board.h> 24#include <mach/board.h>
25#include <mach/at91sam9261.h> 25#include <mach/at91sam9261.h>
26#include <mach/at91sam9261_matrix.h> 26#include <mach/at91sam9261_matrix.h>
27#include <mach/at91_matrix.h>
27#include <mach/at91sam9_smc.h> 28#include <mach/at91sam9_smc.h>
28 29
29#include "generic.h" 30#include "generic.h"
@@ -236,8 +237,8 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
236 if (!data) 237 if (!data)
237 return; 238 return;
238 239
239 csa = at91_sys_read(AT91_MATRIX_EBICSA); 240 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
240 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); 241 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
241 242
242 /* enable pin */ 243 /* enable pin */
243 if (gpio_is_valid(data->enable_pin)) 244 if (gpio_is_valid(data->enable_pin))
@@ -603,6 +604,8 @@ static struct resource rtt_resources[] = {
603 .start = AT91SAM9261_BASE_RTT, 604 .start = AT91SAM9261_BASE_RTT,
604 .end = AT91SAM9261_BASE_RTT + SZ_16 - 1, 605 .end = AT91SAM9261_BASE_RTT + SZ_16 - 1,
605 .flags = IORESOURCE_MEM, 606 .flags = IORESOURCE_MEM,
607 }, {
608 .flags = IORESOURCE_MEM,
606 } 609 }
607}; 610};
608 611
@@ -610,11 +613,32 @@ static struct platform_device at91sam9261_rtt_device = {
610 .name = "at91_rtt", 613 .name = "at91_rtt",
611 .id = 0, 614 .id = 0,
612 .resource = rtt_resources, 615 .resource = rtt_resources,
613 .num_resources = ARRAY_SIZE(rtt_resources),
614}; 616};
615 617
618#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
619static void __init at91_add_device_rtt_rtc(void)
620{
621 at91sam9261_rtt_device.name = "rtc-at91sam9";
622 /*
623 * The second resource is needed:
624 * GPBR will serve as the storage for RTC time offset
625 */
626 at91sam9261_rtt_device.num_resources = 2;
627 rtt_resources[1].start = AT91SAM9261_BASE_GPBR +
628 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
629 rtt_resources[1].end = rtt_resources[1].start + 3;
630}
631#else
632static void __init at91_add_device_rtt_rtc(void)
633{
634 /* Only one resource is needed: RTT not used as RTC */
635 at91sam9261_rtt_device.num_resources = 1;
636}
637#endif
638
616static void __init at91_add_device_rtt(void) 639static void __init at91_add_device_rtt(void)
617{ 640{
641 at91_add_device_rtt_rtc();
618 platform_device_register(&at91sam9261_rtt_device); 642 platform_device_register(&at91sam9261_rtt_device);
619} 643}
620 644
@@ -991,7 +1015,6 @@ static inline void configure_usart2_pins(unsigned pins)
991} 1015}
992 1016
993static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 1017static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
994struct platform_device *atmel_default_console_device; /* the serial console device */
995 1018
996void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) 1019void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
997{ 1020{
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 75e876c258a..0b4fa5a7f68 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14 14
15#include <asm/proc-fns.h>
15#include <asm/irq.h> 16#include <asm/irq.h>
16#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
17#include <asm/mach/map.h> 18#include <asm/mach/map.h>
@@ -302,13 +303,17 @@ static void __init at91sam9263_ioremap_registers(void)
302{ 303{
303 at91_ioremap_shdwc(AT91SAM9263_BASE_SHDWC); 304 at91_ioremap_shdwc(AT91SAM9263_BASE_SHDWC);
304 at91_ioremap_rstc(AT91SAM9263_BASE_RSTC); 305 at91_ioremap_rstc(AT91SAM9263_BASE_RSTC);
306 at91_ioremap_ramc(0, AT91SAM9263_BASE_SDRAMC0, 512);
307 at91_ioremap_ramc(1, AT91SAM9263_BASE_SDRAMC1, 512);
305 at91sam926x_ioremap_pit(AT91SAM9263_BASE_PIT); 308 at91sam926x_ioremap_pit(AT91SAM9263_BASE_PIT);
306 at91sam9_ioremap_smc(0, AT91SAM9263_BASE_SMC0); 309 at91sam9_ioremap_smc(0, AT91SAM9263_BASE_SMC0);
307 at91sam9_ioremap_smc(1, AT91SAM9263_BASE_SMC1); 310 at91sam9_ioremap_smc(1, AT91SAM9263_BASE_SMC1);
311 at91_ioremap_matrix(AT91SAM9263_BASE_MATRIX);
308} 312}
309 313
310static void __init at91sam9263_initialize(void) 314static void __init at91sam9263_initialize(void)
311{ 315{
316 arm_pm_idle = at91sam9_idle;
312 arm_pm_restart = at91sam9_alt_restart; 317 arm_pm_restart = at91sam9_alt_restart;
313 at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1); 318 at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
314 319
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 366a7765635..53688c46f95 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -23,6 +23,7 @@
23#include <mach/board.h> 23#include <mach/board.h>
24#include <mach/at91sam9263.h> 24#include <mach/at91sam9263.h>
25#include <mach/at91sam9263_matrix.h> 25#include <mach/at91sam9263_matrix.h>
26#include <mach/at91_matrix.h>
26#include <mach/at91sam9_smc.h> 27#include <mach/at91sam9_smc.h>
27 28
28#include "generic.h" 29#include "generic.h"
@@ -409,7 +410,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
409 * we assume SMC timings are configured by board code, 410 * we assume SMC timings are configured by board code,
410 * except True IDE where timings are controlled by driver 411 * except True IDE where timings are controlled by driver
411 */ 412 */
412 ebi0_csa = at91_sys_read(AT91_MATRIX_EBI0CSA); 413 ebi0_csa = at91_matrix_read(AT91_MATRIX_EBI0CSA);
413 switch (data->chipselect) { 414 switch (data->chipselect) {
414 case 4: 415 case 4:
415 at91_set_A_periph(AT91_PIN_PD6, 0); /* EBI0_NCS4/CFCS0 */ 416 at91_set_A_periph(AT91_PIN_PD6, 0); /* EBI0_NCS4/CFCS0 */
@@ -428,7 +429,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
428 data->chipselect); 429 data->chipselect);
429 return; 430 return;
430 } 431 }
431 at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa); 432 at91_matrix_write(AT91_MATRIX_EBI0CSA, ebi0_csa);
432 433
433 if (gpio_is_valid(data->det_pin)) { 434 if (gpio_is_valid(data->det_pin)) {
434 at91_set_gpio_input(data->det_pin, 1); 435 at91_set_gpio_input(data->det_pin, 1);
@@ -496,8 +497,8 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
496 if (!data) 497 if (!data)
497 return; 498 return;
498 499
499 csa = at91_sys_read(AT91_MATRIX_EBI0CSA); 500 csa = at91_matrix_read(AT91_MATRIX_EBI0CSA);
500 at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); 501 at91_matrix_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA);
501 502
502 /* enable pin */ 503 /* enable pin */
503 if (gpio_is_valid(data->enable_pin)) 504 if (gpio_is_valid(data->enable_pin))
@@ -891,7 +892,8 @@ static struct platform_device at91sam9263_isi_device = {
891 .num_resources = ARRAY_SIZE(isi_resources), 892 .num_resources = ARRAY_SIZE(isi_resources),
892}; 893};
893 894
894void __init at91_add_device_isi(void) 895void __init at91_add_device_isi(struct isi_platform_data *data,
896 bool use_pck_as_mck)
895{ 897{
896 at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ 898 at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */
897 at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ 899 at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */
@@ -904,14 +906,20 @@ void __init at91_add_device_isi(void)
904 at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ 906 at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */
905 at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ 907 at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */
906 at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ 908 at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */
907 at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */
908 at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ 909 at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */
909 at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ 910 at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */
910 at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ 911 at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */
911 at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ 912 at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */
913
914 if (use_pck_as_mck) {
915 at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */
916
917 /* TODO: register the PCK for ISI_MCK and set its parent */
918 }
912} 919}
913#else 920#else
914void __init at91_add_device_isi(void) {} 921void __init at91_add_device_isi(struct isi_platform_data *data,
922 bool use_pck_as_mck) {}
915#endif 923#endif
916 924
917 925
@@ -959,6 +967,8 @@ static struct resource rtt0_resources[] = {
959 .start = AT91SAM9263_BASE_RTT0, 967 .start = AT91SAM9263_BASE_RTT0,
960 .end = AT91SAM9263_BASE_RTT0 + SZ_16 - 1, 968 .end = AT91SAM9263_BASE_RTT0 + SZ_16 - 1,
961 .flags = IORESOURCE_MEM, 969 .flags = IORESOURCE_MEM,
970 }, {
971 .flags = IORESOURCE_MEM,
962 } 972 }
963}; 973};
964 974
@@ -966,7 +976,6 @@ static struct platform_device at91sam9263_rtt0_device = {
966 .name = "at91_rtt", 976 .name = "at91_rtt",
967 .id = 0, 977 .id = 0,
968 .resource = rtt0_resources, 978 .resource = rtt0_resources,
969 .num_resources = ARRAY_SIZE(rtt0_resources),
970}; 979};
971 980
972static struct resource rtt1_resources[] = { 981static struct resource rtt1_resources[] = {
@@ -974,6 +983,8 @@ static struct resource rtt1_resources[] = {
974 .start = AT91SAM9263_BASE_RTT1, 983 .start = AT91SAM9263_BASE_RTT1,
975 .end = AT91SAM9263_BASE_RTT1 + SZ_16 - 1, 984 .end = AT91SAM9263_BASE_RTT1 + SZ_16 - 1,
976 .flags = IORESOURCE_MEM, 985 .flags = IORESOURCE_MEM,
986 }, {
987 .flags = IORESOURCE_MEM,
977 } 988 }
978}; 989};
979 990
@@ -981,11 +992,53 @@ static struct platform_device at91sam9263_rtt1_device = {
981 .name = "at91_rtt", 992 .name = "at91_rtt",
982 .id = 1, 993 .id = 1,
983 .resource = rtt1_resources, 994 .resource = rtt1_resources,
984 .num_resources = ARRAY_SIZE(rtt1_resources),
985}; 995};
986 996
997#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
998static void __init at91_add_device_rtt_rtc(void)
999{
1000 struct platform_device *pdev;
1001 struct resource *r;
1002
1003 switch (CONFIG_RTC_DRV_AT91SAM9_RTT) {
1004 case 0:
1005 /*
1006 * The second resource is needed only for the chosen RTT:
1007 * GPBR will serve as the storage for RTC time offset
1008 */
1009 at91sam9263_rtt0_device.num_resources = 2;
1010 at91sam9263_rtt1_device.num_resources = 1;
1011 pdev = &at91sam9263_rtt0_device;
1012 r = rtt0_resources;
1013 break;
1014 case 1:
1015 at91sam9263_rtt0_device.num_resources = 1;
1016 at91sam9263_rtt1_device.num_resources = 2;
1017 pdev = &at91sam9263_rtt1_device;
1018 r = rtt1_resources;
1019 break;
1020 default:
1021 pr_err("at91sam9263: only supports 2 RTT (%d)\n",
1022 CONFIG_RTC_DRV_AT91SAM9_RTT);
1023 return;
1024 }
1025
1026 pdev->name = "rtc-at91sam9";
1027 r[1].start = AT91SAM9263_BASE_GPBR + 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
1028 r[1].end = r[1].start + 3;
1029}
1030#else
1031static void __init at91_add_device_rtt_rtc(void)
1032{
1033 /* Only one resource is needed: RTT not used as RTC */
1034 at91sam9263_rtt0_device.num_resources = 1;
1035 at91sam9263_rtt1_device.num_resources = 1;
1036}
1037#endif
1038
987static void __init at91_add_device_rtt(void) 1039static void __init at91_add_device_rtt(void)
988{ 1040{
1041 at91_add_device_rtt_rtc();
989 platform_device_register(&at91sam9263_rtt0_device); 1042 platform_device_register(&at91sam9263_rtt0_device);
990 platform_device_register(&at91sam9263_rtt1_device); 1043 platform_device_register(&at91sam9263_rtt1_device);
991} 1044}
@@ -1371,7 +1424,6 @@ static inline void configure_usart2_pins(unsigned pins)
1371} 1424}
1372 1425
1373static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 1426static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1374struct platform_device *atmel_default_console_device; /* the serial console device */
1375 1427
1376void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) 1428void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1377{ 1429{
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index d89ead740a9..a94758b4273 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -14,6 +14,9 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17#include <linux/of.h>
18#include <linux/of_address.h>
19#include <linux/of_irq.h>
17 20
18#include <asm/mach/time.h> 21#include <asm/mach/time.h>
19 22
@@ -133,7 +136,8 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
133static struct irqaction at91sam926x_pit_irq = { 136static struct irqaction at91sam926x_pit_irq = {
134 .name = "at91_tick", 137 .name = "at91_tick",
135 .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 138 .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
136 .handler = at91sam926x_pit_interrupt 139 .handler = at91sam926x_pit_interrupt,
140 .irq = AT91_ID_SYS,
137}; 141};
138 142
139static void at91sam926x_pit_reset(void) 143static void at91sam926x_pit_reset(void)
@@ -149,6 +153,51 @@ static void at91sam926x_pit_reset(void)
149 pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); 153 pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
150} 154}
151 155
156#ifdef CONFIG_OF
157static struct of_device_id pit_timer_ids[] = {
158 { .compatible = "atmel,at91sam9260-pit" },
159 { /* sentinel */ }
160};
161
162static int __init of_at91sam926x_pit_init(void)
163{
164 struct device_node *np;
165 int ret;
166
167 np = of_find_matching_node(NULL, pit_timer_ids);
168 if (!np)
169 goto err;
170
171 pit_base_addr = of_iomap(np, 0);
172 if (!pit_base_addr)
173 goto node_err;
174
175 /* Get the interrupts property */
176 ret = irq_of_parse_and_map(np, 0);
177 if (!ret) {
178 pr_crit("AT91: PIT: Unable to get IRQ from DT\n");
179 goto ioremap_err;
180 }
181 at91sam926x_pit_irq.irq = ret;
182
183 of_node_put(np);
184
185 return 0;
186
187ioremap_err:
188 iounmap(pit_base_addr);
189node_err:
190 of_node_put(np);
191err:
192 return -EINVAL;
193}
194#else
195static int __init of_at91sam926x_pit_init(void)
196{
197 return -EINVAL;
198}
199#endif
200
152/* 201/*
153 * Set up both clocksource and clockevent support. 202 * Set up both clocksource and clockevent support.
154 */ 203 */
@@ -156,6 +205,10 @@ static void __init at91sam926x_pit_init(void)
156{ 205{
157 unsigned long pit_rate; 206 unsigned long pit_rate;
158 unsigned bits; 207 unsigned bits;
208 int ret;
209
210 /* For device tree enabled device: initialize here */
211 of_at91sam926x_pit_init();
159 212
160 /* 213 /*
161 * Use our actual MCK to figure out how many MCK/16 ticks per 214 * Use our actual MCK to figure out how many MCK/16 ticks per
@@ -177,7 +230,9 @@ static void __init at91sam926x_pit_init(void)
177 clocksource_register_hz(&pit_clk, pit_rate); 230 clocksource_register_hz(&pit_clk, pit_rate);
178 231
179 /* Set up irq handler */ 232 /* Set up irq handler */
180 setup_irq(AT91_ID_SYS, &at91sam926x_pit_irq); 233 ret = setup_irq(at91sam926x_pit_irq.irq, &at91sam926x_pit_irq);
234 if (ret)
235 pr_crit("AT91: PIT: Unable to setup IRQ\n");
181 236
182 /* Set up and register clockevents */ 237 /* Set up and register clockevents */
183 pit_clkevt.mult = div_sc(pit_rate, NSEC_PER_SEC, pit_clkevt.shift); 238 pit_clkevt.mult = div_sc(pit_rate, NSEC_PER_SEC, pit_clkevt.shift);
@@ -193,6 +248,15 @@ static void at91sam926x_pit_suspend(void)
193 248
194void __init at91sam926x_ioremap_pit(u32 addr) 249void __init at91sam926x_ioremap_pit(u32 addr)
195{ 250{
251#if defined(CONFIG_OF)
252 struct device_node *np =
253 of_find_matching_node(NULL, pit_timer_ids);
254
255 if (np) {
256 of_node_put(np);
257 return;
258 }
259#endif
196 pit_base_addr = ioremap(addr, 16); 260 pit_base_addr = ioremap(addr, 16);
197 261
198 if (!pit_base_addr) 262 if (!pit_base_addr)
diff --git a/arch/arm/mach-at91/at91sam9_alt_reset.S b/arch/arm/mach-at91/at91sam9_alt_reset.S
index 518e4237717..7af2e108b8a 100644
--- a/arch/arm/mach-at91/at91sam9_alt_reset.S
+++ b/arch/arm/mach-at91/at91sam9_alt_reset.S
@@ -15,16 +15,17 @@
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18#include <mach/at91sam9_sdramc.h> 18#include <mach/at91_ramc.h>
19#include <mach/at91_rstc.h> 19#include <mach/at91_rstc.h>
20 20
21 .arm 21 .arm
22 22
23 .globl at91sam9_alt_restart 23 .globl at91sam9_alt_restart
24 24
25at91sam9_alt_restart: ldr r0, .at91_va_base_sdramc @ preload constants 25at91sam9_alt_restart: ldr r0, =at91_ramc_base @ preload constants
26 ldr r1, =at91_rstc_base 26 ldr r0, [r0]
27 ldr r1, [r1] 27 ldr r4, =at91_rstc_base
28 ldr r1, [r4]
28 29
29 mov r2, #1 30 mov r2, #1
30 mov r3, #AT91_SDRAMC_LPCB_POWER_DOWN 31 mov r3, #AT91_SDRAMC_LPCB_POWER_DOWN
@@ -37,6 +38,3 @@ at91sam9_alt_restart: ldr r0, .at91_va_base_sdramc @ preload constants
37 str r4, [r1, #AT91_RSTC_CR] @ reset processor 38 str r4, [r1, #AT91_RSTC_CR] @ reset processor
38 39
39 b . 40 b .
40
41.at91_va_base_sdramc:
42 .word AT91_VA_BASE_SYS + AT91_SDRAMC0
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 1cb6a96b1c1..0014573dfe1 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -229,6 +229,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
229 CLKDEV_CON_DEV_ID("usart", "fff90000.serial", &usart1_clk), 229 CLKDEV_CON_DEV_ID("usart", "fff90000.serial", &usart1_clk),
230 CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk), 230 CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk),
231 CLKDEV_CON_DEV_ID("usart", "fff98000.serial", &usart3_clk), 231 CLKDEV_CON_DEV_ID("usart", "fff98000.serial", &usart3_clk),
232 /* more tc lookup table for DT entries */
233 CLKDEV_CON_DEV_ID("t0_clk", "fff7c000.timer", &tcb0_clk),
234 CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk),
232 /* fake hclk clock */ 235 /* fake hclk clock */
233 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk), 236 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
234 CLKDEV_CON_ID("pioA", &pioA_clk), 237 CLKDEV_CON_ID("pioA", &pioA_clk),
@@ -331,12 +334,16 @@ static void __init at91sam9g45_ioremap_registers(void)
331{ 334{
332 at91_ioremap_shdwc(AT91SAM9G45_BASE_SHDWC); 335 at91_ioremap_shdwc(AT91SAM9G45_BASE_SHDWC);
333 at91_ioremap_rstc(AT91SAM9G45_BASE_RSTC); 336 at91_ioremap_rstc(AT91SAM9G45_BASE_RSTC);
337 at91_ioremap_ramc(0, AT91SAM9G45_BASE_DDRSDRC1, 512);
338 at91_ioremap_ramc(1, AT91SAM9G45_BASE_DDRSDRC0, 512);
334 at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT); 339 at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT);
335 at91sam9_ioremap_smc(0, AT91SAM9G45_BASE_SMC); 340 at91sam9_ioremap_smc(0, AT91SAM9G45_BASE_SMC);
341 at91_ioremap_matrix(AT91SAM9G45_BASE_MATRIX);
336} 342}
337 343
338static void __init at91sam9g45_initialize(void) 344static void __init at91sam9g45_initialize(void)
339{ 345{
346 arm_pm_idle = at91sam9_idle;
340 arm_pm_restart = at91sam9g45_restart; 347 arm_pm_restart = at91sam9g45_restart;
341 at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0); 348 at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0);
342 349
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 96e2adcd5a8..4320b209678 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -14,6 +14,7 @@
14 14
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/clk.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h> 19#include <linux/i2c-gpio.h>
19#include <linux/atmel-mci.h> 20#include <linux/atmel-mci.h>
@@ -24,11 +25,15 @@
24#include <mach/board.h> 25#include <mach/board.h>
25#include <mach/at91sam9g45.h> 26#include <mach/at91sam9g45.h>
26#include <mach/at91sam9g45_matrix.h> 27#include <mach/at91sam9g45_matrix.h>
28#include <mach/at91_matrix.h>
27#include <mach/at91sam9_smc.h> 29#include <mach/at91sam9_smc.h>
28#include <mach/at_hdmac.h> 30#include <mach/at_hdmac.h>
29#include <mach/atmel-mci.h> 31#include <mach/atmel-mci.h>
30 32
33#include <media/atmel-isi.h>
34
31#include "generic.h" 35#include "generic.h"
36#include "clock.h"
32 37
33 38
34/* -------------------------------------------------------------------- 39/* --------------------------------------------------------------------
@@ -553,8 +558,8 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
553 if (!data) 558 if (!data)
554 return; 559 return;
555 560
556 csa = at91_sys_read(AT91_MATRIX_EBICSA); 561 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
557 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); 562 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA);
558 563
559 /* enable pin */ 564 /* enable pin */
560 if (gpio_is_valid(data->enable_pin)) 565 if (gpio_is_valid(data->enable_pin))
@@ -870,6 +875,96 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data)
870void __init at91_add_device_ac97(struct ac97c_platform_data *data) {} 875void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
871#endif 876#endif
872 877
878/* --------------------------------------------------------------------
879 * Image Sensor Interface
880 * -------------------------------------------------------------------- */
881#if defined(CONFIG_VIDEO_ATMEL_ISI) || defined(CONFIG_VIDEO_ATMEL_ISI_MODULE)
882static u64 isi_dmamask = DMA_BIT_MASK(32);
883static struct isi_platform_data isi_data;
884
885struct resource isi_resources[] = {
886 [0] = {
887 .start = AT91SAM9G45_BASE_ISI,
888 .end = AT91SAM9G45_BASE_ISI + SZ_16K - 1,
889 .flags = IORESOURCE_MEM,
890 },
891 [1] = {
892 .start = AT91SAM9G45_ID_ISI,
893 .end = AT91SAM9G45_ID_ISI,
894 .flags = IORESOURCE_IRQ,
895 },
896};
897
898static struct platform_device at91sam9g45_isi_device = {
899 .name = "atmel_isi",
900 .id = 0,
901 .dev = {
902 .dma_mask = &isi_dmamask,
903 .coherent_dma_mask = DMA_BIT_MASK(32),
904 .platform_data = &isi_data,
905 },
906 .resource = isi_resources,
907 .num_resources = ARRAY_SIZE(isi_resources),
908};
909
910static struct clk_lookup isi_mck_lookups[] = {
911 CLKDEV_CON_DEV_ID("isi_mck", "atmel_isi.0", NULL),
912};
913
914void __init at91_add_device_isi(struct isi_platform_data *data,
915 bool use_pck_as_mck)
916{
917 struct clk *pck;
918 struct clk *parent;
919
920 if (!data)
921 return;
922 isi_data = *data;
923
924 at91_set_A_periph(AT91_PIN_PB20, 0); /* ISI_D0 */
925 at91_set_A_periph(AT91_PIN_PB21, 0); /* ISI_D1 */
926 at91_set_A_periph(AT91_PIN_PB22, 0); /* ISI_D2 */
927 at91_set_A_periph(AT91_PIN_PB23, 0); /* ISI_D3 */
928 at91_set_A_periph(AT91_PIN_PB24, 0); /* ISI_D4 */
929 at91_set_A_periph(AT91_PIN_PB25, 0); /* ISI_D5 */
930 at91_set_A_periph(AT91_PIN_PB26, 0); /* ISI_D6 */
931 at91_set_A_periph(AT91_PIN_PB27, 0); /* ISI_D7 */
932 at91_set_A_periph(AT91_PIN_PB28, 0); /* ISI_PCK */
933 at91_set_A_periph(AT91_PIN_PB30, 0); /* ISI_HSYNC */
934 at91_set_A_periph(AT91_PIN_PB29, 0); /* ISI_VSYNC */
935 at91_set_B_periph(AT91_PIN_PB8, 0); /* ISI_PD8 */
936 at91_set_B_periph(AT91_PIN_PB9, 0); /* ISI_PD9 */
937 at91_set_B_periph(AT91_PIN_PB10, 0); /* ISI_PD10 */
938 at91_set_B_periph(AT91_PIN_PB11, 0); /* ISI_PD11 */
939
940 platform_device_register(&at91sam9g45_isi_device);
941
942 if (use_pck_as_mck) {
943 at91_set_B_periph(AT91_PIN_PB31, 0); /* ISI_MCK (PCK1) */
944
945 pck = clk_get(NULL, "pck1");
946 parent = clk_get(NULL, "plla");
947
948 BUG_ON(IS_ERR(pck) || IS_ERR(parent));
949
950 if (clk_set_parent(pck, parent)) {
951 pr_err("Failed to set PCK's parent\n");
952 } else {
953 /* Register PCK as ISI_MCK */
954 isi_mck_lookups[0].clk = pck;
955 clkdev_add_table(isi_mck_lookups,
956 ARRAY_SIZE(isi_mck_lookups));
957 }
958
959 clk_put(pck);
960 clk_put(parent);
961 }
962}
963#else
964void __init at91_add_device_isi(struct isi_platform_data *data,
965 bool use_pck_as_mck) {}
966#endif
967
873 968
874/* -------------------------------------------------------------------- 969/* --------------------------------------------------------------------
875 * LCD Controller 970 * LCD Controller
@@ -957,7 +1052,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
957static struct resource tcb0_resources[] = { 1052static struct resource tcb0_resources[] = {
958 [0] = { 1053 [0] = {
959 .start = AT91SAM9G45_BASE_TCB0, 1054 .start = AT91SAM9G45_BASE_TCB0,
960 .end = AT91SAM9G45_BASE_TCB0 + SZ_16K - 1, 1055 .end = AT91SAM9G45_BASE_TCB0 + SZ_256 - 1,
961 .flags = IORESOURCE_MEM, 1056 .flags = IORESOURCE_MEM,
962 }, 1057 },
963 [1] = { 1058 [1] = {
@@ -978,7 +1073,7 @@ static struct platform_device at91sam9g45_tcb0_device = {
978static struct resource tcb1_resources[] = { 1073static struct resource tcb1_resources[] = {
979 [0] = { 1074 [0] = {
980 .start = AT91SAM9G45_BASE_TCB1, 1075 .start = AT91SAM9G45_BASE_TCB1,
981 .end = AT91SAM9G45_BASE_TCB1 + SZ_16K - 1, 1076 .end = AT91SAM9G45_BASE_TCB1 + SZ_256 - 1,
982 .flags = IORESOURCE_MEM, 1077 .flags = IORESOURCE_MEM,
983 }, 1078 },
984 [1] = { 1079 [1] = {
@@ -995,8 +1090,25 @@ static struct platform_device at91sam9g45_tcb1_device = {
995 .num_resources = ARRAY_SIZE(tcb1_resources), 1090 .num_resources = ARRAY_SIZE(tcb1_resources),
996}; 1091};
997 1092
1093#if defined(CONFIG_OF)
1094static struct of_device_id tcb_ids[] = {
1095 { .compatible = "atmel,at91rm9200-tcb" },
1096 { /*sentinel*/ }
1097};
1098#endif
1099
998static void __init at91_add_device_tc(void) 1100static void __init at91_add_device_tc(void)
999{ 1101{
1102#if defined(CONFIG_OF)
1103 struct device_node *np;
1104
1105 np = of_find_matching_node(NULL, tcb_ids);
1106 if (np) {
1107 of_node_put(np);
1108 return;
1109 }
1110#endif
1111
1000 platform_device_register(&at91sam9g45_tcb0_device); 1112 platform_device_register(&at91sam9g45_tcb0_device);
1001 platform_device_register(&at91sam9g45_tcb1_device); 1113 platform_device_register(&at91sam9g45_tcb1_device);
1002} 1114}
@@ -1099,6 +1211,8 @@ static struct resource rtt_resources[] = {
1099 .start = AT91SAM9G45_BASE_RTT, 1211 .start = AT91SAM9G45_BASE_RTT,
1100 .end = AT91SAM9G45_BASE_RTT + SZ_16 - 1, 1212 .end = AT91SAM9G45_BASE_RTT + SZ_16 - 1,
1101 .flags = IORESOURCE_MEM, 1213 .flags = IORESOURCE_MEM,
1214 }, {
1215 .flags = IORESOURCE_MEM,
1102 } 1216 }
1103}; 1217};
1104 1218
@@ -1106,11 +1220,32 @@ static struct platform_device at91sam9g45_rtt_device = {
1106 .name = "at91_rtt", 1220 .name = "at91_rtt",
1107 .id = 0, 1221 .id = 0,
1108 .resource = rtt_resources, 1222 .resource = rtt_resources,
1109 .num_resources = ARRAY_SIZE(rtt_resources),
1110}; 1223};
1111 1224
1225#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
1226static void __init at91_add_device_rtt_rtc(void)
1227{
1228 at91sam9g45_rtt_device.name = "rtc-at91sam9";
1229 /*
1230 * The second resource is needed:
1231 * GPBR will serve as the storage for RTC time offset
1232 */
1233 at91sam9g45_rtt_device.num_resources = 2;
1234 rtt_resources[1].start = AT91SAM9G45_BASE_GPBR +
1235 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
1236 rtt_resources[1].end = rtt_resources[1].start + 3;
1237}
1238#else
1239static void __init at91_add_device_rtt_rtc(void)
1240{
1241 /* Only one resource is needed: RTT not used as RTC */
1242 at91sam9g45_rtt_device.num_resources = 1;
1243}
1244#endif
1245
1112static void __init at91_add_device_rtt(void) 1246static void __init at91_add_device_rtt(void)
1113{ 1247{
1248 at91_add_device_rtt_rtc();
1114 platform_device_register(&at91sam9g45_rtt_device); 1249 platform_device_register(&at91sam9g45_rtt_device);
1115} 1250}
1116 1251
@@ -1565,7 +1700,6 @@ static inline void configure_usart3_pins(unsigned pins)
1565} 1700}
1566 1701
1567static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 1702static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1568struct platform_device *atmel_default_console_device; /* the serial console device */
1569 1703
1570void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) 1704void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1571{ 1705{
diff --git a/arch/arm/mach-at91/at91sam9g45_reset.S b/arch/arm/mach-at91/at91sam9g45_reset.S
index 0468be10980..9d457182c86 100644
--- a/arch/arm/mach-at91/at91sam9g45_reset.S
+++ b/arch/arm/mach-at91/at91sam9g45_reset.S
@@ -12,7 +12,7 @@
12 12
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <mach/at91sam9_ddrsdr.h> 15#include <mach/at91_ramc.h>
16#include <mach/at91_rstc.h> 16#include <mach/at91_rstc.h>
17 17
18 .arm 18 .arm
@@ -20,9 +20,10 @@
20 .globl at91sam9g45_restart 20 .globl at91sam9g45_restart
21 21
22at91sam9g45_restart: 22at91sam9g45_restart:
23 ldr r0, .at91_va_base_sdramc0 @ preload constants 23 ldr r5, =at91_ramc_base @ preload constants
24 ldr r1, =at91_rstc_base 24 ldr r0, [r5]
25 ldr r1, [r1] 25 ldr r4, =at91_rstc_base
26 ldr r1, [r4]
26 27
27 mov r2, #1 28 mov r2, #1
28 mov r3, #AT91_DDRSDRC_LPCB_POWER_DOWN 29 mov r3, #AT91_DDRSDRC_LPCB_POWER_DOWN
@@ -35,6 +36,3 @@ at91sam9g45_restart:
35 str r4, [r1, #AT91_RSTC_CR] @ reset processor 36 str r4, [r1, #AT91_RSTC_CR] @ reset processor
36 37
37 b . 38 b .
38
39.at91_va_base_sdramc0:
40 .word AT91_VA_BASE_SYS + AT91_DDRSDRC0
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index d2c91a841cb..63d9372eb18 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13 13
14#include <asm/proc-fns.h>
14#include <asm/irq.h> 15#include <asm/irq.h>
15#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
16#include <asm/mach/map.h> 17#include <asm/mach/map.h>
@@ -287,12 +288,15 @@ static void __init at91sam9rl_ioremap_registers(void)
287{ 288{
288 at91_ioremap_shdwc(AT91SAM9RL_BASE_SHDWC); 289 at91_ioremap_shdwc(AT91SAM9RL_BASE_SHDWC);
289 at91_ioremap_rstc(AT91SAM9RL_BASE_RSTC); 290 at91_ioremap_rstc(AT91SAM9RL_BASE_RSTC);
291 at91_ioremap_ramc(0, AT91SAM9RL_BASE_SDRAMC, 512);
290 at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT); 292 at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT);
291 at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC); 293 at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC);
294 at91_ioremap_matrix(AT91SAM9RL_BASE_MATRIX);
292} 295}
293 296
294static void __init at91sam9rl_initialize(void) 297static void __init at91sam9rl_initialize(void)
295{ 298{
299 arm_pm_idle = at91sam9_idle;
296 arm_pm_restart = at91sam9_alt_restart; 300 arm_pm_restart = at91sam9_alt_restart;
297 at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0); 301 at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
298 302
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 9be71c11d0f..eda72e83037 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -20,6 +20,7 @@
20#include <mach/board.h> 20#include <mach/board.h>
21#include <mach/at91sam9rl.h> 21#include <mach/at91sam9rl.h>
22#include <mach/at91sam9rl_matrix.h> 22#include <mach/at91sam9rl_matrix.h>
23#include <mach/at91_matrix.h>
23#include <mach/at91sam9_smc.h> 24#include <mach/at91sam9_smc.h>
24#include <mach/at_hdmac.h> 25#include <mach/at_hdmac.h>
25 26
@@ -265,8 +266,8 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
265 if (!data) 266 if (!data)
266 return; 267 return;
267 268
268 csa = at91_sys_read(AT91_MATRIX_EBICSA); 269 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
269 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); 270 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
270 271
271 /* enable pin */ 272 /* enable pin */
272 if (gpio_is_valid(data->enable_pin)) 273 if (gpio_is_valid(data->enable_pin))
@@ -682,6 +683,8 @@ static struct resource rtt_resources[] = {
682 .start = AT91SAM9RL_BASE_RTT, 683 .start = AT91SAM9RL_BASE_RTT,
683 .end = AT91SAM9RL_BASE_RTT + SZ_16 - 1, 684 .end = AT91SAM9RL_BASE_RTT + SZ_16 - 1,
684 .flags = IORESOURCE_MEM, 685 .flags = IORESOURCE_MEM,
686 }, {
687 .flags = IORESOURCE_MEM,
685 } 688 }
686}; 689};
687 690
@@ -689,11 +692,32 @@ static struct platform_device at91sam9rl_rtt_device = {
689 .name = "at91_rtt", 692 .name = "at91_rtt",
690 .id = 0, 693 .id = 0,
691 .resource = rtt_resources, 694 .resource = rtt_resources,
692 .num_resources = ARRAY_SIZE(rtt_resources),
693}; 695};
694 696
697#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
698static void __init at91_add_device_rtt_rtc(void)
699{
700 at91sam9rl_rtt_device.name = "rtc-at91sam9";
701 /*
702 * The second resource is needed:
703 * GPBR will serve as the storage for RTC time offset
704 */
705 at91sam9rl_rtt_device.num_resources = 2;
706 rtt_resources[1].start = AT91SAM9RL_BASE_GPBR +
707 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
708 rtt_resources[1].end = rtt_resources[1].start + 3;
709}
710#else
711static void __init at91_add_device_rtt_rtc(void)
712{
713 /* Only one resource is needed: RTT not used as RTC */
714 at91sam9rl_rtt_device.num_resources = 1;
715}
716#endif
717
695static void __init at91_add_device_rtt(void) 718static void __init at91_add_device_rtt(void)
696{ 719{
720 at91_add_device_rtt_rtc();
697 platform_device_register(&at91sam9rl_rtt_device); 721 platform_device_register(&at91sam9rl_rtt_device);
698} 722}
699 723
@@ -1128,7 +1152,6 @@ static inline void configure_usart3_pins(unsigned pins)
1128} 1152}
1129 1153
1130static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 1154static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1131struct platform_device *atmel_default_console_device; /* the serial console device */
1132 1155
1133void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) 1156void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1134{ 1157{
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
new file mode 100644
index 00000000000..a34d96afa74
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -0,0 +1,368 @@
1/*
2 * Chip-specific setup code for the AT91SAM9x5 family
3 *
4 * Copyright (C) 2010-2012 Atmel Corporation.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/module.h>
10#include <linux/dma-mapping.h>
11
12#include <asm/irq.h>
13#include <asm/mach/arch.h>
14#include <asm/mach/map.h>
15#include <mach/at91sam9x5.h>
16#include <mach/at91_pmc.h>
17#include <mach/cpu.h>
18#include <mach/board.h>
19
20#include "soc.h"
21#include "generic.h"
22#include "clock.h"
23#include "sam9_smc.h"
24
25/* --------------------------------------------------------------------
26 * Clocks
27 * -------------------------------------------------------------------- */
28
29/*
30 * The peripheral clocks.
31 */
32static struct clk pioAB_clk = {
33 .name = "pioAB_clk",
34 .pmc_mask = 1 << AT91SAM9X5_ID_PIOAB,
35 .type = CLK_TYPE_PERIPHERAL,
36};
37static struct clk pioCD_clk = {
38 .name = "pioCD_clk",
39 .pmc_mask = 1 << AT91SAM9X5_ID_PIOCD,
40 .type = CLK_TYPE_PERIPHERAL,
41};
42static struct clk smd_clk = {
43 .name = "smd_clk",
44 .pmc_mask = 1 << AT91SAM9X5_ID_SMD,
45 .type = CLK_TYPE_PERIPHERAL,
46};
47static struct clk usart0_clk = {
48 .name = "usart0_clk",
49 .pmc_mask = 1 << AT91SAM9X5_ID_USART0,
50 .type = CLK_TYPE_PERIPHERAL,
51};
52static struct clk usart1_clk = {
53 .name = "usart1_clk",
54 .pmc_mask = 1 << AT91SAM9X5_ID_USART1,
55 .type = CLK_TYPE_PERIPHERAL,
56};
57static struct clk usart2_clk = {
58 .name = "usart2_clk",
59 .pmc_mask = 1 << AT91SAM9X5_ID_USART2,
60 .type = CLK_TYPE_PERIPHERAL,
61};
62/* USART3 clock - Only for sam9g25/sam9x25 */
63static struct clk usart3_clk = {
64 .name = "usart3_clk",
65 .pmc_mask = 1 << AT91SAM9X5_ID_USART3,
66 .type = CLK_TYPE_PERIPHERAL,
67};
68static struct clk twi0_clk = {
69 .name = "twi0_clk",
70 .pmc_mask = 1 << AT91SAM9X5_ID_TWI0,
71 .type = CLK_TYPE_PERIPHERAL,
72};
73static struct clk twi1_clk = {
74 .name = "twi1_clk",
75 .pmc_mask = 1 << AT91SAM9X5_ID_TWI1,
76 .type = CLK_TYPE_PERIPHERAL,
77};
78static struct clk twi2_clk = {
79 .name = "twi2_clk",
80 .pmc_mask = 1 << AT91SAM9X5_ID_TWI2,
81 .type = CLK_TYPE_PERIPHERAL,
82};
83static struct clk mmc0_clk = {
84 .name = "mci0_clk",
85 .pmc_mask = 1 << AT91SAM9X5_ID_MCI0,
86 .type = CLK_TYPE_PERIPHERAL,
87};
88static struct clk spi0_clk = {
89 .name = "spi0_clk",
90 .pmc_mask = 1 << AT91SAM9X5_ID_SPI0,
91 .type = CLK_TYPE_PERIPHERAL,
92};
93static struct clk spi1_clk = {
94 .name = "spi1_clk",
95 .pmc_mask = 1 << AT91SAM9X5_ID_SPI1,
96 .type = CLK_TYPE_PERIPHERAL,
97};
98static struct clk uart0_clk = {
99 .name = "uart0_clk",
100 .pmc_mask = 1 << AT91SAM9X5_ID_UART0,
101 .type = CLK_TYPE_PERIPHERAL,
102};
103static struct clk uart1_clk = {
104 .name = "uart1_clk",
105 .pmc_mask = 1 << AT91SAM9X5_ID_UART1,
106 .type = CLK_TYPE_PERIPHERAL,
107};
108static struct clk tcb0_clk = {
109 .name = "tcb0_clk",
110 .pmc_mask = 1 << AT91SAM9X5_ID_TCB,
111 .type = CLK_TYPE_PERIPHERAL,
112};
113static struct clk pwm_clk = {
114 .name = "pwm_clk",
115 .pmc_mask = 1 << AT91SAM9X5_ID_PWM,
116 .type = CLK_TYPE_PERIPHERAL,
117};
118static struct clk adc_clk = {
119 .name = "adc_clk",
120 .pmc_mask = 1 << AT91SAM9X5_ID_ADC,
121 .type = CLK_TYPE_PERIPHERAL,
122};
123static struct clk dma0_clk = {
124 .name = "dma0_clk",
125 .pmc_mask = 1 << AT91SAM9X5_ID_DMA0,
126 .type = CLK_TYPE_PERIPHERAL,
127};
128static struct clk dma1_clk = {
129 .name = "dma1_clk",
130 .pmc_mask = 1 << AT91SAM9X5_ID_DMA1,
131 .type = CLK_TYPE_PERIPHERAL,
132};
133static struct clk uhphs_clk = {
134 .name = "uhphs_clk",
135 .pmc_mask = 1 << AT91SAM9X5_ID_UHPHS,
136 .type = CLK_TYPE_PERIPHERAL,
137};
138static struct clk udphs_clk = {
139 .name = "udphs_clk",
140 .pmc_mask = 1 << AT91SAM9X5_ID_UDPHS,
141 .type = CLK_TYPE_PERIPHERAL,
142};
143/* emac0 clock - Only for sam9g25/sam9x25/sam9g35/sam9x35 */
144static struct clk macb0_clk = {
145 .name = "pclk",
146 .pmc_mask = 1 << AT91SAM9X5_ID_EMAC0,
147 .type = CLK_TYPE_PERIPHERAL,
148};
149/* lcd clock - Only for sam9g15/sam9g35/sam9x35 */
150static struct clk lcdc_clk = {
151 .name = "lcdc_clk",
152 .pmc_mask = 1 << AT91SAM9X5_ID_LCDC,
153 .type = CLK_TYPE_PERIPHERAL,
154};
155/* isi clock - Only for sam9g25 */
156static struct clk isi_clk = {
157 .name = "isi_clk",
158 .pmc_mask = 1 << AT91SAM9X5_ID_ISI,
159 .type = CLK_TYPE_PERIPHERAL,
160};
161static struct clk mmc1_clk = {
162 .name = "mci1_clk",
163 .pmc_mask = 1 << AT91SAM9X5_ID_MCI1,
164 .type = CLK_TYPE_PERIPHERAL,
165};
166/* emac1 clock - Only for sam9x25 */
167static struct clk macb1_clk = {
168 .name = "pclk",
169 .pmc_mask = 1 << AT91SAM9X5_ID_EMAC1,
170 .type = CLK_TYPE_PERIPHERAL,
171};
172static struct clk ssc_clk = {
173 .name = "ssc_clk",
174 .pmc_mask = 1 << AT91SAM9X5_ID_SSC,
175 .type = CLK_TYPE_PERIPHERAL,
176};
177/* can0 clock - Only for sam9x35 */
178static struct clk can0_clk = {
179 .name = "can0_clk",
180 .pmc_mask = 1 << AT91SAM9X5_ID_CAN0,
181 .type = CLK_TYPE_PERIPHERAL,
182};
183/* can1 clock - Only for sam9x35 */
184static struct clk can1_clk = {
185 .name = "can1_clk",
186 .pmc_mask = 1 << AT91SAM9X5_ID_CAN1,
187 .type = CLK_TYPE_PERIPHERAL,
188};
189
190static struct clk *periph_clocks[] __initdata = {
191 &pioAB_clk,
192 &pioCD_clk,
193 &smd_clk,
194 &usart0_clk,
195 &usart1_clk,
196 &usart2_clk,
197 &twi0_clk,
198 &twi1_clk,
199 &twi2_clk,
200 &mmc0_clk,
201 &spi0_clk,
202 &spi1_clk,
203 &uart0_clk,
204 &uart1_clk,
205 &tcb0_clk,
206 &pwm_clk,
207 &adc_clk,
208 &dma0_clk,
209 &dma1_clk,
210 &uhphs_clk,
211 &udphs_clk,
212 &mmc1_clk,
213 &ssc_clk,
214 // irq0
215};
216
217static struct clk_lookup periph_clocks_lookups[] = {
218 /* lookup table for DT entries */
219 CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
220 CLKDEV_CON_DEV_ID("usart", "f801c000.serial", &usart0_clk),
221 CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart1_clk),
222 CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart2_clk),
223 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
224 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk),
225 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
226 CLKDEV_CON_ID("pioA", &pioAB_clk),
227 CLKDEV_CON_ID("pioB", &pioAB_clk),
228 CLKDEV_CON_ID("pioC", &pioCD_clk),
229 CLKDEV_CON_ID("pioD", &pioCD_clk),
230 /* additional fake clock for macb_hclk */
231 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb0_clk),
232 CLKDEV_CON_DEV_ID("hclk", "f8030000.ethernet", &macb1_clk),
233};
234
235/*
236 * The two programmable clocks.
237 * You must configure pin multiplexing to bring these signals out.
238 */
239static struct clk pck0 = {
240 .name = "pck0",
241 .pmc_mask = AT91_PMC_PCK0,
242 .type = CLK_TYPE_PROGRAMMABLE,
243 .id = 0,
244};
245static struct clk pck1 = {
246 .name = "pck1",
247 .pmc_mask = AT91_PMC_PCK1,
248 .type = CLK_TYPE_PROGRAMMABLE,
249 .id = 1,
250};
251
252static void __init at91sam9x5_register_clocks(void)
253{
254 int i;
255
256 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
257 clk_register(periph_clocks[i]);
258
259 clkdev_add_table(periph_clocks_lookups,
260 ARRAY_SIZE(periph_clocks_lookups));
261
262 if (cpu_is_at91sam9g25()
263 || cpu_is_at91sam9x25())
264 clk_register(&usart3_clk);
265
266 if (cpu_is_at91sam9g25()
267 || cpu_is_at91sam9x25()
268 || cpu_is_at91sam9g35()
269 || cpu_is_at91sam9x35())
270 clk_register(&macb0_clk);
271
272 if (cpu_is_at91sam9g15()
273 || cpu_is_at91sam9g35()
274 || cpu_is_at91sam9x35())
275 clk_register(&lcdc_clk);
276
277 if (cpu_is_at91sam9g25())
278 clk_register(&isi_clk);
279
280 if (cpu_is_at91sam9x25())
281 clk_register(&macb1_clk);
282
283 if (cpu_is_at91sam9x25()
284 || cpu_is_at91sam9x35()) {
285 clk_register(&can0_clk);
286 clk_register(&can1_clk);
287 }
288
289 clk_register(&pck0);
290 clk_register(&pck1);
291}
292
293/* --------------------------------------------------------------------
294 * AT91SAM9x5 processor initialization
295 * -------------------------------------------------------------------- */
296
297static void __init at91sam9x5_map_io(void)
298{
299 at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE);
300}
301
302static void __init at91sam9x5_ioremap_registers(void)
303{
304 at91_ioremap_ramc(0, AT91SAM9X5_BASE_DDRSDRC0, 512);
305}
306
307void __init at91sam9x5_initialize(void)
308{
309 arm_pm_restart = at91sam9g45_restart;
310 at91_extern_irq = (1 << AT91SAM9X5_ID_IRQ0);
311
312 /* Register GPIO subsystem (using DT) */
313 at91_gpio_init(NULL, 0);
314}
315
316/* --------------------------------------------------------------------
317 * AT91SAM9x5 devices (temporary before modification of code)
318 * -------------------------------------------------------------------- */
319void __init at91_add_device_nand(struct atmel_nand_data *data) {}
320
321/* --------------------------------------------------------------------
322 * Interrupt initialization
323 * -------------------------------------------------------------------- */
324/*
325 * The default interrupt priority levels (0 = lowest, 7 = highest).
326 */
327static unsigned int at91sam9x5_default_irq_priority[NR_AIC_IRQS] __initdata = {
328 7, /* Advanced Interrupt Controller (FIQ) */
329 7, /* System Peripherals */
330 1, /* Parallel IO Controller A and B */
331 1, /* Parallel IO Controller C and D */
332 4, /* Soft Modem */
333 5, /* USART 0 */
334 5, /* USART 1 */
335 5, /* USART 2 */
336 5, /* USART 3 */
337 6, /* Two-Wire Interface 0 */
338 6, /* Two-Wire Interface 1 */
339 6, /* Two-Wire Interface 2 */
340 0, /* Multimedia Card Interface 0 */
341 5, /* Serial Peripheral Interface 0 */
342 5, /* Serial Peripheral Interface 1 */
343 5, /* UART 0 */
344 5, /* UART 1 */
345 0, /* Timer Counter 0, 1, 2, 3, 4 and 5 */
346 0, /* Pulse Width Modulation Controller */
347 0, /* ADC Controller */
348 0, /* DMA Controller 0 */
349 0, /* DMA Controller 1 */
350 2, /* USB Host High Speed port */
351 2, /* USB Device High speed port */
352 3, /* Ethernet MAC 0 */
353 3, /* LDC Controller or Image Sensor Interface */
354 0, /* Multimedia Card Interface 1 */
355 3, /* Ethernet MAC 1 */
356 4, /* Synchronous Serial Interface */
357 4, /* CAN Controller 0 */
358 4, /* CAN Controller 1 */
359 0, /* Advanced Interrupt Controller (IRQ0) */
360};
361
362struct at91_init_soc __initdata at91sam9x5_soc = {
363 .map_io = at91sam9x5_map_io,
364 .default_irq_priority = at91sam9x5_default_irq_priority,
365 .ioremap_registers = at91sam9x5_ioremap_registers,
366 .register_clocks = at91sam9x5_register_clocks,
367 .init = at91sam9x5_initialize,
368};
diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c
index 56ba3bd035a..5400a1d6503 100644
--- a/arch/arm/mach-at91/at91x40.c
+++ b/arch/arm/mach-at91/at91x40.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <asm/proc-fns.h>
16#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
17#include <mach/at91x40.h> 18#include <mach/at91x40.h>
18#include <mach/at91_st.h> 19#include <mach/at91_st.h>
@@ -37,8 +38,19 @@ unsigned long clk_get_rate(struct clk *clk)
37 return AT91X40_MASTER_CLOCK; 38 return AT91X40_MASTER_CLOCK;
38} 39}
39 40
41static void at91x40_idle(void)
42{
43 /*
44 * Disable the processor clock. The processor will be automatically
45 * re-enabled by an interrupt or by a reset.
46 */
47 __raw_writel(AT91_PS_CR_CPU, AT91_PS_CR);
48 cpu_do_idle();
49}
50
40void __init at91x40_initialize(unsigned long main_clock) 51void __init at91x40_initialize(unsigned long main_clock)
41{ 52{
53 arm_pm_idle = at91x40_idle;
42 at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1) 54 at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
43 | (1 << AT91X40_ID_IRQ2); 55 | (1 << AT91X40_ID_IRQ2);
44} 56}
diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c
index dfff2895f4b..6ca680a1d5d 100644
--- a/arch/arm/mach-at91/at91x40_time.c
+++ b/arch/arm/mach-at91/at91x40_time.c
@@ -28,6 +28,12 @@
28#include <asm/mach/time.h> 28#include <asm/mach/time.h>
29#include <mach/at91_tc.h> 29#include <mach/at91_tc.h>
30 30
31#define at91_tc_read(field) \
32 __raw_readl(AT91_TC + field)
33
34#define at91_tc_write(field, value) \
35 __raw_writel(value, AT91_TC + field);
36
31/* 37/*
32 * 3 counter/timer units present. 38 * 3 counter/timer units present.
33 */ 39 */
@@ -37,12 +43,12 @@
37 43
38static unsigned long at91x40_gettimeoffset(void) 44static unsigned long at91x40_gettimeoffset(void)
39{ 45{
40 return (at91_sys_read(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_CV) * 1000000 / (AT91X40_MASTER_CLOCK / 128)); 46 return (at91_tc_read(AT91_TC_CLK1BASE + AT91_TC_CV) * 1000000 / (AT91X40_MASTER_CLOCK / 128));
41} 47}
42 48
43static irqreturn_t at91x40_timer_interrupt(int irq, void *dev_id) 49static irqreturn_t at91x40_timer_interrupt(int irq, void *dev_id)
44{ 50{
45 at91_sys_read(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_SR); 51 at91_tc_read(AT91_TC_CLK1BASE + AT91_TC_SR);
46 timer_tick(); 52 timer_tick();
47 return IRQ_HANDLED; 53 return IRQ_HANDLED;
48} 54}
@@ -57,20 +63,20 @@ void __init at91x40_timer_init(void)
57{ 63{
58 unsigned int v; 64 unsigned int v;
59 65
60 at91_sys_write(AT91_TC + AT91_TC_BCR, 0); 66 at91_tc_write(AT91_TC_BCR, 0);
61 v = at91_sys_read(AT91_TC + AT91_TC_BMR); 67 v = at91_tc_read(AT91_TC_BMR);
62 v = (v & ~AT91_TC_TC1XC1S) | AT91_TC_TC1XC1S_NONE; 68 v = (v & ~AT91_TC_TC1XC1S) | AT91_TC_TC1XC1S_NONE;
63 at91_sys_write(AT91_TC + AT91_TC_BMR, v); 69 at91_tc_write(AT91_TC_BMR, v);
64 70
65 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_CCR, AT91_TC_CLKDIS); 71 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_CCR, AT91_TC_CLKDIS);
66 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_CMR, (AT91_TC_TIMER_CLOCK4 | AT91_TC_CPCTRG)); 72 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_CMR, (AT91_TC_TIMER_CLOCK4 | AT91_TC_CPCTRG));
67 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_IDR, 0xffffffff); 73 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_IDR, 0xffffffff);
68 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_RC, (AT91X40_MASTER_CLOCK / 128) / HZ - 1); 74 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_RC, (AT91X40_MASTER_CLOCK / 128) / HZ - 1);
69 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_IER, (1<<4)); 75 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_IER, (1<<4));
70 76
71 setup_irq(AT91X40_ID_TC1, &at91x40_timer_irq); 77 setup_irq(AT91X40_ID_TC1, &at91x40_timer_irq);
72 78
73 at91_sys_write(AT91_TC + AT91_TC_CLK1BASE + AT91_TC_CCR, (AT91_TC_SWTRG | AT91_TC_CLKEN)); 79 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_CCR, (AT91_TC_SWTRG | AT91_TC_CLKEN));
74} 80}
75 81
76struct sys_timer at91x40_timer = { 82struct sys_timer at91x40_timer = {
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
deleted file mode 100644
index ac3de4f7c31..00000000000
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ /dev/null
@@ -1,396 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-cap9adk.c
3 *
4 * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com>
5 * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com>
6 * Copyright (C) 2005 SAN People
7 * Copyright (C) 2007 Atmel Corporation.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/types.h>
25#include <linux/gpio.h>
26#include <linux/init.h>
27#include <linux/mm.h>
28#include <linux/module.h>
29#include <linux/platform_device.h>
30#include <linux/spi/spi.h>
31#include <linux/spi/ads7846.h>
32#include <linux/fb.h>
33#include <linux/mtd/physmap.h>
34
35#include <video/atmel_lcdc.h>
36
37#include <mach/hardware.h>
38#include <asm/setup.h>
39#include <asm/mach-types.h>
40
41#include <asm/mach/arch.h>
42#include <asm/mach/map.h>
43
44#include <mach/board.h>
45#include <mach/at91cap9_matrix.h>
46#include <mach/at91sam9_smc.h>
47#include <mach/system_rev.h>
48
49#include "sam9_smc.h"
50#include "generic.h"
51
52
53static void __init cap9adk_init_early(void)
54{
55 /* Initialize processor: 12 MHz crystal */
56 at91_initialize(12000000);
57
58 /* Setup the LEDs: USER1 and USER2 LED for cpu/timer... */
59 at91_init_leds(AT91_PIN_PA10, AT91_PIN_PA11);
60 /* ... POWER LED always on */
61 at91_set_gpio_output(AT91_PIN_PC29, 1);
62
63 /* Setup the serial ports and console */
64 at91_register_uart(0, 0, 0); /* DBGU = ttyS0 */
65 at91_set_serial_console(0);
66}
67
68/*
69 * USB Host port
70 */
71static struct at91_usbh_data __initdata cap9adk_usbh_data = {
72 .ports = 2,
73 .vbus_pin = {-EINVAL, -EINVAL},
74 .overcurrent_pin= {-EINVAL, -EINVAL},
75};
76
77/*
78 * USB HS Device port
79 */
80static struct usba_platform_data __initdata cap9adk_usba_udc_data = {
81 .vbus_pin = AT91_PIN_PB31,
82};
83
84/*
85 * ADS7846 Touchscreen
86 */
87#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
88static int ads7843_pendown_state(void)
89{
90 return !at91_get_gpio_value(AT91_PIN_PC4); /* Touchscreen PENIRQ */
91}
92
93static struct ads7846_platform_data ads_info = {
94 .model = 7843,
95 .x_min = 150,
96 .x_max = 3830,
97 .y_min = 190,
98 .y_max = 3830,
99 .vref_delay_usecs = 100,
100 .x_plate_ohms = 450,
101 .y_plate_ohms = 250,
102 .pressure_max = 15000,
103 .debounce_max = 1,
104 .debounce_rep = 0,
105 .debounce_tol = (~0),
106 .get_pendown_state = ads7843_pendown_state,
107};
108
109static void __init cap9adk_add_device_ts(void)
110{
111 at91_set_gpio_input(AT91_PIN_PC4, 1); /* Touchscreen PENIRQ */
112 at91_set_gpio_input(AT91_PIN_PC5, 1); /* Touchscreen BUSY */
113}
114#else
115static void __init cap9adk_add_device_ts(void) {}
116#endif
117
118
119/*
120 * SPI devices.
121 */
122static struct spi_board_info cap9adk_spi_devices[] = {
123#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
124 { /* DataFlash card */
125 .modalias = "mtd_dataflash",
126 .chip_select = 0,
127 .max_speed_hz = 15 * 1000 * 1000,
128 .bus_num = 0,
129 },
130#endif
131#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
132 {
133 .modalias = "ads7846",
134 .chip_select = 3, /* can be 2 or 3, depending on J2 jumper */
135 .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
136 .bus_num = 0,
137 .platform_data = &ads_info,
138 .irq = AT91_PIN_PC4,
139 },
140#endif
141};
142
143
144/*
145 * MCI (SD/MMC)
146 */
147static struct at91_mmc_data __initdata cap9adk_mmc_data = {
148 .wire4 = 1,
149 .det_pin = -EINVAL,
150 .wp_pin = -EINVAL,
151 .vcc_pin = -EINVAL,
152};
153
154
155/*
156 * MACB Ethernet device
157 */
158static struct macb_platform_data __initdata cap9adk_macb_data = {
159 .phy_irq_pin = -EINVAL,
160 .is_rmii = 1,
161};
162
163
164/*
165 * NAND flash
166 */
167static struct mtd_partition __initdata cap9adk_nand_partitions[] = {
168 {
169 .name = "NAND partition",
170 .offset = 0,
171 .size = MTDPART_SIZ_FULL,
172 },
173};
174
175static struct atmel_nand_data __initdata cap9adk_nand_data = {
176 .ale = 21,
177 .cle = 22,
178 .det_pin = -EINVAL,
179 .rdy_pin = -EINVAL,
180 .enable_pin = AT91_PIN_PD15,
181 .parts = cap9adk_nand_partitions,
182 .num_parts = ARRAY_SIZE(cap9adk_nand_partitions),
183};
184
185static struct sam9_smc_config __initdata cap9adk_nand_smc_config = {
186 .ncs_read_setup = 1,
187 .nrd_setup = 2,
188 .ncs_write_setup = 1,
189 .nwe_setup = 2,
190
191 .ncs_read_pulse = 6,
192 .nrd_pulse = 4,
193 .ncs_write_pulse = 6,
194 .nwe_pulse = 4,
195
196 .read_cycle = 8,
197 .write_cycle = 8,
198
199 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
200 .tdf_cycles = 1,
201};
202
203static void __init cap9adk_add_device_nand(void)
204{
205 unsigned long csa;
206
207 csa = at91_sys_read(AT91_MATRIX_EBICSA);
208 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
209
210 cap9adk_nand_data.bus_width_16 = board_have_nand_16bit();
211 /* setup bus-width (8 or 16) */
212 if (cap9adk_nand_data.bus_width_16)
213 cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_16;
214 else
215 cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_8;
216
217 /* configure chip-select 3 (NAND) */
218 sam9_smc_configure(0, 3, &cap9adk_nand_smc_config);
219
220 at91_add_device_nand(&cap9adk_nand_data);
221}
222
223
224/*
225 * NOR flash
226 */
227static struct mtd_partition cap9adk_nor_partitions[] = {
228 {
229 .name = "NOR partition",
230 .offset = 0,
231 .size = MTDPART_SIZ_FULL,
232 },
233};
234
235static struct physmap_flash_data cap9adk_nor_data = {
236 .width = 2,
237 .parts = cap9adk_nor_partitions,
238 .nr_parts = ARRAY_SIZE(cap9adk_nor_partitions),
239};
240
241#define NOR_BASE AT91_CHIPSELECT_0
242#define NOR_SIZE SZ_8M
243
244static struct resource nor_flash_resources[] = {
245 {
246 .start = NOR_BASE,
247 .end = NOR_BASE + NOR_SIZE - 1,
248 .flags = IORESOURCE_MEM,
249 }
250};
251
252static struct platform_device cap9adk_nor_flash = {
253 .name = "physmap-flash",
254 .id = 0,
255 .dev = {
256 .platform_data = &cap9adk_nor_data,
257 },
258 .resource = nor_flash_resources,
259 .num_resources = ARRAY_SIZE(nor_flash_resources),
260};
261
262static struct sam9_smc_config __initdata cap9adk_nor_smc_config = {
263 .ncs_read_setup = 2,
264 .nrd_setup = 4,
265 .ncs_write_setup = 2,
266 .nwe_setup = 4,
267
268 .ncs_read_pulse = 10,
269 .nrd_pulse = 8,
270 .ncs_write_pulse = 10,
271 .nwe_pulse = 8,
272
273 .read_cycle = 16,
274 .write_cycle = 16,
275
276 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16,
277 .tdf_cycles = 1,
278};
279
280static __init void cap9adk_add_device_nor(void)
281{
282 unsigned long csa;
283
284 csa = at91_sys_read(AT91_MATRIX_EBICSA);
285 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
286
287 /* configure chip-select 0 (NOR) */
288 sam9_smc_configure(0, 0, &cap9adk_nor_smc_config);
289
290 platform_device_register(&cap9adk_nor_flash);
291}
292
293
294/*
295 * LCD Controller
296 */
297#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
298static struct fb_videomode at91_tft_vga_modes[] = {
299 {
300 .name = "TX09D50VM1CCA @ 60",
301 .refresh = 60,
302 .xres = 240, .yres = 320,
303 .pixclock = KHZ2PICOS(4965),
304
305 .left_margin = 1, .right_margin = 33,
306 .upper_margin = 1, .lower_margin = 0,
307 .hsync_len = 5, .vsync_len = 1,
308
309 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
310 .vmode = FB_VMODE_NONINTERLACED,
311 },
312};
313
314static struct fb_monspecs at91fb_default_monspecs = {
315 .manufacturer = "HIT",
316 .monitor = "TX09D70VM1CCA",
317
318 .modedb = at91_tft_vga_modes,
319 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
320 .hfmin = 15000,
321 .hfmax = 64000,
322 .vfmin = 50,
323 .vfmax = 150,
324};
325
326#define AT91CAP9_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
327 | ATMEL_LCDC_DISTYPE_TFT \
328 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
329
330static void at91_lcdc_power_control(int on)
331{
332 if (on)
333 at91_set_gpio_value(AT91_PIN_PC0, 0); /* power up */
334 else
335 at91_set_gpio_value(AT91_PIN_PC0, 1); /* power down */
336}
337
338/* Driver datas */
339static struct atmel_lcdfb_info __initdata cap9adk_lcdc_data = {
340 .default_bpp = 16,
341 .default_dmacon = ATMEL_LCDC_DMAEN,
342 .default_lcdcon2 = AT91CAP9_DEFAULT_LCDCON2,
343 .default_monspecs = &at91fb_default_monspecs,
344 .atmel_lcdfb_power_control = at91_lcdc_power_control,
345 .guard_time = 1,
346};
347
348#else
349static struct atmel_lcdfb_info __initdata cap9adk_lcdc_data;
350#endif
351
352
353/*
354 * AC97
355 */
356static struct ac97c_platform_data cap9adk_ac97_data = {
357 .reset_pin = -EINVAL,
358};
359
360
361static void __init cap9adk_board_init(void)
362{
363 /* Serial */
364 at91_add_device_serial();
365 /* USB Host */
366 at91_add_device_usbh(&cap9adk_usbh_data);
367 /* USB HS */
368 at91_add_device_usba(&cap9adk_usba_udc_data);
369 /* SPI */
370 at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices));
371 /* Touchscreen */
372 cap9adk_add_device_ts();
373 /* MMC */
374 at91_add_device_mmc(1, &cap9adk_mmc_data);
375 /* Ethernet */
376 at91_add_device_eth(&cap9adk_macb_data);
377 /* NAND */
378 cap9adk_add_device_nand();
379 /* NOR Flash */
380 cap9adk_add_device_nor();
381 /* I2C */
382 at91_add_device_i2c(NULL, 0);
383 /* LCD Controller */
384 at91_add_device_lcdc(&cap9adk_lcdc_data);
385 /* AC97 */
386 at91_add_device_ac97(&cap9adk_ac97_data);
387}
388
389MACHINE_START(AT91CAP9ADK, "Atmel AT91CAP9A-DK")
390 /* Maintainer: Stelian Pop <stelian.pop@leadtechdesign.com> */
391 .timer = &at91sam926x_timer,
392 .map_io = at91_map_io,
393 .init_early = cap9adk_init_early,
394 .init_irq = at91_init_irq_default,
395 .init_machine = cap9adk_board_init,
396MACHINE_END
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index 9ab3d1ea326..989e1c5a9ca 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -43,6 +43,7 @@
43#include <mach/board.h> 43#include <mach/board.h>
44#include <mach/at91sam9_smc.h> 44#include <mach/at91sam9_smc.h>
45#include <mach/at91sam9260_matrix.h> 45#include <mach/at91sam9260_matrix.h>
46#include <mach/at91_matrix.h>
46 47
47#include "sam9_smc.h" 48#include "sam9_smc.h"
48#include "generic.h" 49#include "generic.h"
@@ -238,8 +239,8 @@ static __init void cpu9krea_add_device_nor(void)
238{ 239{
239 unsigned long csa; 240 unsigned long csa;
240 241
241 csa = at91_sys_read(AT91_MATRIX_EBICSA); 242 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
242 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_VDDIOMSEL_3_3V); 243 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_VDDIOMSEL_3_3V);
243 244
244 /* configure chip-select 0 (NOR) */ 245 /* configure chip-select 0 (NOR) */
245 sam9_smc_configure(0, 0, &cpu9krea_nor_smc_config); 246 sam9_smc_configure(0, 0, &cpu9krea_nor_smc_config);
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 368e1427ad9..e094cc81fe2 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -38,6 +38,7 @@
38 38
39#include <mach/board.h> 39#include <mach/board.h>
40#include <mach/at91rm9200_mc.h> 40#include <mach/at91rm9200_mc.h>
41#include <mach/at91_ramc.h>
41#include <mach/cpu.h> 42#include <mach/cpu.h>
42 43
43#include "generic.h" 44#include "generic.h"
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c
index bb6b434ec0c..583b72472ad 100644
--- a/arch/arm/mach-at91/board-dt.c
+++ b/arch/arm/mach-at91/board-dt.c
@@ -15,7 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/irqdomain.h> 18#include <linux/of.h>
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
@@ -38,12 +38,6 @@ static void __init ek_init_early(void)
38{ 38{
39 /* Initialize processor: 12.000 MHz crystal */ 39 /* Initialize processor: 12.000 MHz crystal */
40 at91_initialize(12000000); 40 at91_initialize(12000000);
41
42 /* DGBU on ttyS0. (Rx & Tx only) */
43 at91_register_uart(0, 0, 0);
44
45 /* set serial console to ttyS0 (ie, DBGU) */
46 at91_set_serial_console(0);
47} 41}
48 42
49/* det_pin is not connected */ 43/* det_pin is not connected */
@@ -88,15 +82,17 @@ static void __init ek_add_device_nand(void)
88 at91_add_device_nand(&ek_nand_data); 82 at91_add_device_nand(&ek_nand_data);
89} 83}
90 84
91static const struct of_device_id aic_of_match[] __initconst = { 85static const struct of_device_id irq_of_match[] __initconst = {
92 { .compatible = "atmel,at91rm9200-aic", }, 86
93 {}, 87 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init },
88 { .compatible = "atmel,at91rm9200-gpio", .data = at91_gpio_of_irq_setup },
89 { .compatible = "atmel,at91sam9x5-gpio", .data = at91_gpio_of_irq_setup },
90 { /*sentinel*/ }
94}; 91};
95 92
96static void __init at91_dt_init_irq(void) 93static void __init at91_dt_init_irq(void)
97{ 94{
98 irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); 95 of_irq_init(irq_of_match);
99 at91_init_irq_default();
100} 96}
101 97
102static void __init at91_dt_device_init(void) 98static void __init at91_dt_device_init(void)
@@ -109,6 +105,7 @@ static void __init at91_dt_device_init(void)
109 105
110static const char *at91_dt_board_compat[] __initdata = { 106static const char *at91_dt_board_compat[] __initdata = {
111 "atmel,at91sam9m10g45ek", 107 "atmel,at91sam9m10g45ek",
108 "atmel,at91sam9x5ek",
112 "calao,usb-a9g20", 109 "calao,usb-a9g20",
113 NULL 110 NULL
114}; 111};
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index 07ef35b0ec2..f23aabef855 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -26,6 +26,7 @@
26 26
27#include <mach/board.h> 27#include <mach/board.h>
28#include <mach/at91rm9200_mc.h> 28#include <mach/at91rm9200_mc.h>
29#include <mach/at91_ramc.h>
29#include <mach/cpu.h> 30#include <mach/cpu.h>
30 31
31#include "generic.h" 32#include "generic.h"
@@ -110,7 +111,7 @@ static void __init eco920_board_init(void)
110 at91_add_device_mmc(0, &eco920_mmc_data); 111 at91_add_device_mmc(0, &eco920_mmc_data);
111 platform_device_register(&eco920_flash); 112 platform_device_register(&eco920_flash);
112 113
113 at91_sys_write(AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1) 114 at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1)
114 | AT91_SMC_RWSETUP_(1) 115 | AT91_SMC_RWSETUP_(1)
115 | AT91_SMC_DBW_8 116 | AT91_SMC_DBW_8
116 | AT91_SMC_WSEN 117 | AT91_SMC_WSEN
@@ -122,7 +123,7 @@ static void __init eco920_board_init(void)
122 at91_set_deglitch(AT91_PIN_PA23, 1); 123 at91_set_deglitch(AT91_PIN_PA23, 1);
123 124
124/* Initialization of the Static Memory Controller for Chip Select 3 */ 125/* Initialization of the Static Memory Controller for Chip Select 3 */
125 at91_sys_write(AT91_SMC_CSR(3), 126 at91_ramc_write(0, AT91_SMC_CSR(3),
126 AT91_SMC_DBW_16 | /* 16 bit */ 127 AT91_SMC_DBW_16 | /* 16 bit */
127 AT91_SMC_WSEN | 128 AT91_SMC_WSEN |
128 AT91_SMC_NWS_(5) | /* wait states */ 129 AT91_SMC_NWS_(5) | /* wait states */
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c
index eec02cd57ce..1815152001f 100644
--- a/arch/arm/mach-at91/board-flexibity.c
+++ b/arch/arm/mach-at91/board-flexibity.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/mach-at91/board-flexibity.c 2 * linux/arch/arm/mach-at91/board-flexibity.c
3 * 3 *
4 * Copyright (C) 2010 Flexibity 4 * Copyright (C) 2010-2011 Flexibity
5 * Copyright (C) 2005 SAN People 5 * Copyright (C) 2005 SAN People
6 * Copyright (C) 2006 Atmel 6 * Copyright (C) 2006 Atmel
7 * 7 *
@@ -62,6 +62,13 @@ static struct at91_udc_data __initdata flexibity_udc_data = {
62 .pullup_pin = -EINVAL, /* pull-up driven by UDC */ 62 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
63}; 63};
64 64
65/* I2C devices */
66static struct i2c_board_info __initdata flexibity_i2c_devices[] = {
67 {
68 I2C_BOARD_INFO("ds1307", 0x68),
69 },
70};
71
65/* SPI devices */ 72/* SPI devices */
66static struct spi_board_info flexibity_spi_devices[] = { 73static struct spi_board_info flexibity_spi_devices[] = {
67 { /* DataFlash chip */ 74 { /* DataFlash chip */
@@ -141,6 +148,9 @@ static void __init flexibity_board_init(void)
141 at91_add_device_usbh(&flexibity_usbh_data); 148 at91_add_device_usbh(&flexibity_usbh_data);
142 /* USB Device */ 149 /* USB Device */
143 at91_add_device_udc(&flexibity_udc_data); 150 at91_add_device_udc(&flexibity_udc_data);
151 /* I2C */
152 at91_add_device_i2c(flexibity_i2c_devices,
153 ARRAY_SIZE(flexibity_i2c_devices));
144 /* SPI */ 154 /* SPI */
145 at91_add_device_spi(flexibity_spi_devices, 155 at91_add_device_spi(flexibity_spi_devices,
146 ARRAY_SIZE(flexibity_spi_devices)); 156 ARRAY_SIZE(flexibity_spi_devices));
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index d75a4a2ad9c..bb991458201 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -38,6 +38,7 @@
38#include <mach/board.h> 38#include <mach/board.h>
39#include <mach/cpu.h> 39#include <mach/cpu.h>
40#include <mach/at91rm9200_mc.h> 40#include <mach/at91rm9200_mc.h>
41#include <mach/at91_ramc.h>
41 42
42#include "generic.h" 43#include "generic.h"
43 44
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index ab024fa11d5..59e35dd1486 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -39,6 +39,7 @@
39 39
40#include <mach/board.h> 40#include <mach/board.h>
41#include <mach/at91rm9200_mc.h> 41#include <mach/at91rm9200_mc.h>
42#include <mach/at91_ramc.h>
42 43
43#include "generic.h" 44#include "generic.h"
44 45
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index 782f37946af..9083df04e7e 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -41,6 +41,7 @@
41#include <mach/hardware.h> 41#include <mach/hardware.h>
42#include <mach/board.h> 42#include <mach/board.h>
43#include <mach/at91rm9200_mc.h> 43#include <mach/at91rm9200_mc.h>
44#include <mach/at91_ramc.h>
44 45
45#include "generic.h" 46#include "generic.h"
46 47
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index ef7c12a9224..11cbaa8946f 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -41,6 +41,7 @@
41#include <mach/hardware.h> 41#include <mach/hardware.h>
42#include <mach/board.h> 42#include <mach/board.h>
43#include <mach/at91rm9200_mc.h> 43#include <mach/at91rm9200_mc.h>
44#include <mach/at91_ramc.h>
44 45
45#include "generic.h" 46#include "generic.h"
46 47
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index ea0d1b9c2b7..57497e2b887 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -24,11 +24,13 @@
24#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/leds.h> 26#include <linux/leds.h>
27#include <linux/clk.h>
28#include <linux/atmel-mci.h> 27#include <linux/atmel-mci.h>
28#include <linux/delay.h>
29 29
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <video/atmel_lcdc.h> 31#include <video/atmel_lcdc.h>
32#include <media/soc_camera.h>
33#include <media/atmel-isi.h>
32 34
33#include <asm/setup.h> 35#include <asm/setup.h>
34#include <asm/mach-types.h> 36#include <asm/mach-types.h>
@@ -185,6 +187,71 @@ static void __init ek_add_device_nand(void)
185 187
186 188
187/* 189/*
190 * ISI
191 */
192static struct isi_platform_data __initdata isi_data = {
193 .frate = ISI_CFG1_FRATE_CAPTURE_ALL,
194 /* to use codec and preview path simultaneously */
195 .full_mode = 1,
196 .data_width_flags = ISI_DATAWIDTH_8 | ISI_DATAWIDTH_10,
197 /* ISI_MCK is provided by programmable clock or external clock */
198 .mck_hz = 25000000,
199};
200
201
202/*
203 * soc-camera OV2640
204 */
205#if defined(CONFIG_SOC_CAMERA_OV2640) || \
206 defined(CONFIG_SOC_CAMERA_OV2640_MODULE)
207static unsigned long isi_camera_query_bus_param(struct soc_camera_link *link)
208{
209 /* ISI board for ek using default 8-bits connection */
210 return SOCAM_DATAWIDTH_8;
211}
212
213static int i2c_camera_power(struct device *dev, int on)
214{
215 /* enable or disable the camera */
216 pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE");
217 at91_set_gpio_output(AT91_PIN_PD13, !on);
218
219 if (!on)
220 goto out;
221
222 /* If enabled, give a reset impulse */
223 at91_set_gpio_output(AT91_PIN_PD12, 0);
224 msleep(20);
225 at91_set_gpio_output(AT91_PIN_PD12, 1);
226 msleep(100);
227
228out:
229 return 0;
230}
231
232static struct i2c_board_info i2c_camera = {
233 I2C_BOARD_INFO("ov2640", 0x30),
234};
235
236static struct soc_camera_link iclink_ov2640 = {
237 .bus_id = 0,
238 .board_info = &i2c_camera,
239 .i2c_adapter_id = 0,
240 .power = i2c_camera_power,
241 .query_bus_param = isi_camera_query_bus_param,
242};
243
244static struct platform_device isi_ov2640 = {
245 .name = "soc-camera-pdrv",
246 .id = 0,
247 .dev = {
248 .platform_data = &iclink_ov2640,
249 },
250};
251#endif
252
253
254/*
188 * LCD Controller 255 * LCD Controller
189 */ 256 */
190#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 257#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
@@ -377,7 +444,12 @@ static struct gpio_led ek_pwm_led[] = {
377#endif 444#endif
378}; 445};
379 446
380 447static struct platform_device *devices[] __initdata = {
448#if defined(CONFIG_SOC_CAMERA_OV2640) || \
449 defined(CONFIG_SOC_CAMERA_OV2640_MODULE)
450 &isi_ov2640,
451#endif
452};
381 453
382static void __init ek_board_init(void) 454static void __init ek_board_init(void)
383{ 455{
@@ -399,6 +471,8 @@ static void __init ek_board_init(void)
399 ek_add_device_nand(); 471 ek_add_device_nand();
400 /* I2C */ 472 /* I2C */
401 at91_add_device_i2c(0, NULL, 0); 473 at91_add_device_i2c(0, NULL, 0);
474 /* ISI, using programmable clock as ISI_MCK */
475 at91_add_device_isi(&isi_data, true);
402 /* LCD Controller */ 476 /* LCD Controller */
403 at91_add_device_lcdc(&ek_lcdc_data); 477 at91_add_device_lcdc(&ek_lcdc_data);
404 /* Touch Screen */ 478 /* Touch Screen */
@@ -410,6 +484,8 @@ static void __init ek_board_init(void)
410 /* LEDs */ 484 /* LEDs */
411 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 485 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
412 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); 486 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led));
487 /* Other platform devices */
488 platform_add_devices(devices, ARRAY_SIZE(devices));
413} 489}
414 490
415MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK") 491MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK")
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index 4770db08e5a..3c2e3fcc310 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -145,11 +145,11 @@ static struct i2c_board_info __initdata snapper9260_i2c_devices[] = {
145 /* Audio codec */ 145 /* Audio codec */
146 I2C_BOARD_INFO("tlv320aic23", 0x1a), 146 I2C_BOARD_INFO("tlv320aic23", 0x1a),
147 }, 147 },
148 { 148};
149
150static struct i2c_board_info __initdata snapper9260_i2c_isl1208 = {
149 /* RTC */ 151 /* RTC */
150 I2C_BOARD_INFO("isl1208", 0x6f), 152 I2C_BOARD_INFO("isl1208", 0x6f),
151 .irq = gpio_to_irq(AT91_PIN_PA31),
152 },
153}; 153};
154 154
155static void __init snapper9260_add_device_nand(void) 155static void __init snapper9260_add_device_nand(void)
@@ -163,6 +163,10 @@ static void __init snapper9260_board_init(void)
163{ 163{
164 at91_add_device_i2c(snapper9260_i2c_devices, 164 at91_add_device_i2c(snapper9260_i2c_devices,
165 ARRAY_SIZE(snapper9260_i2c_devices)); 165 ARRAY_SIZE(snapper9260_i2c_devices));
166
167 snapper9260_i2c_isl1208.irq = gpio_to_irq(AT91_PIN_PA31);
168 i2c_register_board_info(0, &snapper9260_i2c_isl1208, 1);
169
166 at91_add_device_serial(); 170 at91_add_device_serial();
167 at91_add_device_usbh(&snapper9260_usbh_data); 171 at91_add_device_usbh(&snapper9260_usbh_data);
168 at91_add_device_udc(&snapper9260_udc_data); 172 at91_add_device_udc(&snapper9260_udc_data);
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index bbd553e1cd9..52f460768f7 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -45,6 +45,7 @@
45#include <mach/hardware.h> 45#include <mach/hardware.h>
46#include <mach/board.h> 46#include <mach/board.h>
47#include <mach/at91rm9200_mc.h> 47#include <mach/at91rm9200_mc.h>
48#include <mach/at91_ramc.h>
48#include <mach/cpu.h> 49#include <mach/cpu.h>
49 50
50#include "generic.h" 51#include "generic.h"
@@ -393,7 +394,7 @@ static void yl9200_init_video(void)
393 at91_set_A_periph(AT91_PIN_PC6, 0); 394 at91_set_A_periph(AT91_PIN_PC6, 0);
394 395
395 /* Initialization of the Static Memory Controller for Chip Select 2 */ 396 /* Initialization of the Static Memory Controller for Chip Select 2 */
396 at91_sys_write(AT91_SMC_CSR(2), AT91_SMC_DBW_16 /* 16 bit */ 397 at91_ramc_write(0, AT91_SMC_CSR(2), AT91_SMC_DBW_16 /* 16 bit */
397 | AT91_SMC_WSEN | AT91_SMC_NWS_(0x4) /* wait states */ 398 | AT91_SMC_WSEN | AT91_SMC_NWS_(0x4) /* wait states */
398 | AT91_SMC_TDF_(0x100) /* float time */ 399 | AT91_SMC_TDF_(0x100) /* float time */
399 ); 400 );
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 61873f3aa92..be51ca7f694 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -28,9 +28,12 @@
28#include <mach/at91_pmc.h> 28#include <mach/at91_pmc.h>
29#include <mach/cpu.h> 29#include <mach/cpu.h>
30 30
31#include <asm/proc-fns.h>
32
31#include "clock.h" 33#include "clock.h"
32#include "generic.h" 34#include "generic.h"
33 35
36void __iomem *at91_pmc_base;
34 37
35/* 38/*
36 * There's a lot more which can be done with clocks, including cpufreq 39 * There's a lot more which can be done with clocks, including cpufreq
@@ -47,26 +50,38 @@
47/* 50/*
48 * Chips have some kind of clocks : group them by functionality 51 * Chips have some kind of clocks : group them by functionality
49 */ 52 */
50#define cpu_has_utmi() ( cpu_is_at91cap9() \ 53#define cpu_has_utmi() ( cpu_is_at91sam9rl() \
51 || cpu_is_at91sam9rl() \ 54 || cpu_is_at91sam9g45() \
52 || cpu_is_at91sam9g45()) 55 || cpu_is_at91sam9x5())
53 56
54#define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \ 57#define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \
55 || cpu_is_at91sam9g45()) 58 || cpu_is_at91sam9g45() \
59 || cpu_is_at91sam9x5())
56 60
57#define cpu_has_300M_plla() (cpu_is_at91sam9g10()) 61#define cpu_has_300M_plla() (cpu_is_at91sam9g10())
58 62
59#define cpu_has_pllb() (!(cpu_is_at91sam9rl() \ 63#define cpu_has_pllb() (!(cpu_is_at91sam9rl() \
60 || cpu_is_at91sam9g45())) 64 || cpu_is_at91sam9g45() \
65 || cpu_is_at91sam9x5()))
61 66
62#define cpu_has_upll() (cpu_is_at91sam9g45()) 67#define cpu_has_upll() (cpu_is_at91sam9g45() \
68 || cpu_is_at91sam9x5())
63 69
64/* USB host HS & FS */ 70/* USB host HS & FS */
65#define cpu_has_uhp() (!cpu_is_at91sam9rl()) 71#define cpu_has_uhp() (!cpu_is_at91sam9rl())
66 72
67/* USB device FS only */ 73/* USB device FS only */
68#define cpu_has_udpfs() (!(cpu_is_at91sam9rl() \ 74#define cpu_has_udpfs() (!(cpu_is_at91sam9rl() \
69 || cpu_is_at91sam9g45())) 75 || cpu_is_at91sam9g45() \
76 || cpu_is_at91sam9x5()))
77
78#define cpu_has_plladiv2() (cpu_is_at91sam9g45() \
79 || cpu_is_at91sam9x5())
80
81#define cpu_has_mdiv3() (cpu_is_at91sam9g45() \
82 || cpu_is_at91sam9x5())
83
84#define cpu_has_alt_prescaler() (cpu_is_at91sam9x5())
70 85
71static LIST_HEAD(clocks); 86static LIST_HEAD(clocks);
72static DEFINE_SPINLOCK(clk_lock); 87static DEFINE_SPINLOCK(clk_lock);
@@ -111,11 +126,11 @@ static void pllb_mode(struct clk *clk, int is_on)
111 value = 0; 126 value = 0;
112 127
113 // REVISIT: Add work-around for AT91RM9200 Errata #26 ? 128 // REVISIT: Add work-around for AT91RM9200 Errata #26 ?
114 at91_sys_write(AT91_CKGR_PLLBR, value); 129 at91_pmc_write(AT91_CKGR_PLLBR, value);
115 130
116 do { 131 do {
117 cpu_relax(); 132 cpu_relax();
118 } while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != is_on); 133 } while ((at91_pmc_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != is_on);
119} 134}
120 135
121static struct clk pllb = { 136static struct clk pllb = {
@@ -130,31 +145,24 @@ static struct clk pllb = {
130static void pmc_sys_mode(struct clk *clk, int is_on) 145static void pmc_sys_mode(struct clk *clk, int is_on)
131{ 146{
132 if (is_on) 147 if (is_on)
133 at91_sys_write(AT91_PMC_SCER, clk->pmc_mask); 148 at91_pmc_write(AT91_PMC_SCER, clk->pmc_mask);
134 else 149 else
135 at91_sys_write(AT91_PMC_SCDR, clk->pmc_mask); 150 at91_pmc_write(AT91_PMC_SCDR, clk->pmc_mask);
136} 151}
137 152
138static void pmc_uckr_mode(struct clk *clk, int is_on) 153static void pmc_uckr_mode(struct clk *clk, int is_on)
139{ 154{
140 unsigned int uckr = at91_sys_read(AT91_CKGR_UCKR); 155 unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR);
141
142 if (cpu_is_at91sam9g45()) {
143 if (is_on)
144 uckr |= AT91_PMC_BIASEN;
145 else
146 uckr &= ~AT91_PMC_BIASEN;
147 }
148 156
149 if (is_on) { 157 if (is_on) {
150 is_on = AT91_PMC_LOCKU; 158 is_on = AT91_PMC_LOCKU;
151 at91_sys_write(AT91_CKGR_UCKR, uckr | clk->pmc_mask); 159 at91_pmc_write(AT91_CKGR_UCKR, uckr | clk->pmc_mask);
152 } else 160 } else
153 at91_sys_write(AT91_CKGR_UCKR, uckr & ~(clk->pmc_mask)); 161 at91_pmc_write(AT91_CKGR_UCKR, uckr & ~(clk->pmc_mask));
154 162
155 do { 163 do {
156 cpu_relax(); 164 cpu_relax();
157 } while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKU) != is_on); 165 } while ((at91_pmc_read(AT91_PMC_SR) & AT91_PMC_LOCKU) != is_on);
158} 166}
159 167
160/* USB function clocks (PLLB must be 48 MHz) */ 168/* USB function clocks (PLLB must be 48 MHz) */
@@ -190,9 +198,9 @@ struct clk mck = {
190static void pmc_periph_mode(struct clk *clk, int is_on) 198static void pmc_periph_mode(struct clk *clk, int is_on)
191{ 199{
192 if (is_on) 200 if (is_on)
193 at91_sys_write(AT91_PMC_PCER, clk->pmc_mask); 201 at91_pmc_write(AT91_PMC_PCER, clk->pmc_mask);
194 else 202 else
195 at91_sys_write(AT91_PMC_PCDR, clk->pmc_mask); 203 at91_pmc_write(AT91_PMC_PCDR, clk->pmc_mask);
196} 204}
197 205
198static struct clk __init *at91_css_to_clk(unsigned long css) 206static struct clk __init *at91_css_to_clk(unsigned long css)
@@ -210,11 +218,24 @@ static struct clk __init *at91_css_to_clk(unsigned long css)
210 return &utmi_clk; 218 return &utmi_clk;
211 else if (cpu_has_pllb()) 219 else if (cpu_has_pllb())
212 return &pllb; 220 return &pllb;
221 break;
222 /* alternate PMC: can use master clock */
223 case AT91_PMC_CSS_MASTER:
224 return &mck;
213 } 225 }
214 226
215 return NULL; 227 return NULL;
216} 228}
217 229
230static int pmc_prescaler_divider(u32 reg)
231{
232 if (cpu_has_alt_prescaler()) {
233 return 1 << ((reg & AT91_PMC_ALT_PRES) >> PMC_ALT_PRES_OFFSET);
234 } else {
235 return 1 << ((reg & AT91_PMC_PRES) >> PMC_PRES_OFFSET);
236 }
237}
238
218static void __clk_enable(struct clk *clk) 239static void __clk_enable(struct clk *clk)
219{ 240{
220 if (clk->parent) 241 if (clk->parent)
@@ -316,12 +337,22 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
316{ 337{
317 unsigned long flags; 338 unsigned long flags;
318 unsigned prescale; 339 unsigned prescale;
340 unsigned long prescale_offset, css_mask;
319 unsigned long actual; 341 unsigned long actual;
320 342
321 if (!clk_is_programmable(clk)) 343 if (!clk_is_programmable(clk))
322 return -EINVAL; 344 return -EINVAL;
323 if (clk->users) 345 if (clk->users)
324 return -EBUSY; 346 return -EBUSY;
347
348 if (cpu_has_alt_prescaler()) {
349 prescale_offset = PMC_ALT_PRES_OFFSET;
350 css_mask = AT91_PMC_ALT_PCKR_CSS;
351 } else {
352 prescale_offset = PMC_PRES_OFFSET;
353 css_mask = AT91_PMC_CSS;
354 }
355
325 spin_lock_irqsave(&clk_lock, flags); 356 spin_lock_irqsave(&clk_lock, flags);
326 357
327 actual = clk->parent->rate_hz; 358 actual = clk->parent->rate_hz;
@@ -329,10 +360,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
329 if (actual && actual <= rate) { 360 if (actual && actual <= rate) {
330 u32 pckr; 361 u32 pckr;
331 362
332 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id)); 363 pckr = at91_pmc_read(AT91_PMC_PCKR(clk->id));
333 pckr &= AT91_PMC_CSS; /* clock selection */ 364 pckr &= css_mask; /* keep clock selection */
334 pckr |= prescale << 2; 365 pckr |= prescale << prescale_offset;
335 at91_sys_write(AT91_PMC_PCKR(clk->id), pckr); 366 at91_pmc_write(AT91_PMC_PCKR(clk->id), pckr);
336 clk->rate_hz = actual; 367 clk->rate_hz = actual;
337 break; 368 break;
338 } 369 }
@@ -366,7 +397,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
366 397
367 clk->rate_hz = parent->rate_hz; 398 clk->rate_hz = parent->rate_hz;
368 clk->parent = parent; 399 clk->parent = parent;
369 at91_sys_write(AT91_PMC_PCKR(clk->id), parent->id); 400 at91_pmc_write(AT91_PMC_PCKR(clk->id), parent->id);
370 401
371 spin_unlock_irqrestore(&clk_lock, flags); 402 spin_unlock_irqrestore(&clk_lock, flags);
372 return 0; 403 return 0;
@@ -378,11 +409,17 @@ static void __init init_programmable_clock(struct clk *clk)
378{ 409{
379 struct clk *parent; 410 struct clk *parent;
380 u32 pckr; 411 u32 pckr;
412 unsigned int css_mask;
413
414 if (cpu_has_alt_prescaler())
415 css_mask = AT91_PMC_ALT_PCKR_CSS;
416 else
417 css_mask = AT91_PMC_CSS;
381 418
382 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id)); 419 pckr = at91_pmc_read(AT91_PMC_PCKR(clk->id));
383 parent = at91_css_to_clk(pckr & AT91_PMC_CSS); 420 parent = at91_css_to_clk(pckr & css_mask);
384 clk->parent = parent; 421 clk->parent = parent;
385 clk->rate_hz = parent->rate_hz / (1 << ((pckr & AT91_PMC_PRES) >> 2)); 422 clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
386} 423}
387 424
388#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */ 425#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
@@ -396,19 +433,24 @@ static int at91_clk_show(struct seq_file *s, void *unused)
396 u32 scsr, pcsr, uckr = 0, sr; 433 u32 scsr, pcsr, uckr = 0, sr;
397 struct clk *clk; 434 struct clk *clk;
398 435
399 seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR)); 436 scsr = at91_pmc_read(AT91_PMC_SCSR);
400 seq_printf(s, "PCSR = %8x\n", pcsr = at91_sys_read(AT91_PMC_PCSR)); 437 pcsr = at91_pmc_read(AT91_PMC_PCSR);
401 seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR)); 438 sr = at91_pmc_read(AT91_PMC_SR);
402 seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR)); 439 seq_printf(s, "SCSR = %8x\n", scsr);
403 seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR)); 440 seq_printf(s, "PCSR = %8x\n", pcsr);
441 seq_printf(s, "MOR = %8x\n", at91_pmc_read(AT91_CKGR_MOR));
442 seq_printf(s, "MCFR = %8x\n", at91_pmc_read(AT91_CKGR_MCFR));
443 seq_printf(s, "PLLA = %8x\n", at91_pmc_read(AT91_CKGR_PLLAR));
404 if (cpu_has_pllb()) 444 if (cpu_has_pllb())
405 seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR)); 445 seq_printf(s, "PLLB = %8x\n", at91_pmc_read(AT91_CKGR_PLLBR));
406 if (cpu_has_utmi()) 446 if (cpu_has_utmi()) {
407 seq_printf(s, "UCKR = %8x\n", uckr = at91_sys_read(AT91_CKGR_UCKR)); 447 uckr = at91_pmc_read(AT91_CKGR_UCKR);
408 seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR)); 448 seq_printf(s, "UCKR = %8x\n", uckr);
449 }
450 seq_printf(s, "MCKR = %8x\n", at91_pmc_read(AT91_PMC_MCKR));
409 if (cpu_has_upll()) 451 if (cpu_has_upll())
410 seq_printf(s, "USB = %8x\n", at91_sys_read(AT91_PMC_USB)); 452 seq_printf(s, "USB = %8x\n", at91_pmc_read(AT91_PMC_USB));
411 seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR)); 453 seq_printf(s, "SR = %8x\n", sr);
412 454
413 seq_printf(s, "\n"); 455 seq_printf(s, "\n");
414 456
@@ -596,16 +638,14 @@ static void __init at91_pllb_usbfs_clock_init(unsigned long main_clock)
596 if (cpu_is_at91rm9200()) { 638 if (cpu_is_at91rm9200()) {
597 uhpck.pmc_mask = AT91RM9200_PMC_UHP; 639 uhpck.pmc_mask = AT91RM9200_PMC_UHP;
598 udpck.pmc_mask = AT91RM9200_PMC_UDP; 640 udpck.pmc_mask = AT91RM9200_PMC_UDP;
599 at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP); 641 at91_pmc_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP);
600 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || 642 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() ||
601 cpu_is_at91sam9263() || cpu_is_at91sam9g20() || 643 cpu_is_at91sam9263() || cpu_is_at91sam9g20() ||
602 cpu_is_at91sam9g10()) { 644 cpu_is_at91sam9g10()) {
603 uhpck.pmc_mask = AT91SAM926x_PMC_UHP; 645 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
604 udpck.pmc_mask = AT91SAM926x_PMC_UDP; 646 udpck.pmc_mask = AT91SAM926x_PMC_UDP;
605 } else if (cpu_is_at91cap9()) {
606 uhpck.pmc_mask = AT91CAP9_PMC_UHP;
607 } 647 }
608 at91_sys_write(AT91_CKGR_PLLBR, 0); 648 at91_pmc_write(AT91_CKGR_PLLBR, 0);
609 649
610 udpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); 650 udpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init);
611 uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); 651 uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init);
@@ -622,13 +662,13 @@ static void __init at91_upll_usbfs_clock_init(unsigned long main_clock)
622 /* Setup divider by 10 to reach 48 MHz */ 662 /* Setup divider by 10 to reach 48 MHz */
623 usbr |= ((10 - 1) << 8) & AT91_PMC_OHCIUSBDIV; 663 usbr |= ((10 - 1) << 8) & AT91_PMC_OHCIUSBDIV;
624 664
625 at91_sys_write(AT91_PMC_USB, usbr); 665 at91_pmc_write(AT91_PMC_USB, usbr);
626 666
627 /* Now set uhpck values */ 667 /* Now set uhpck values */
628 uhpck.parent = &utmi_clk; 668 uhpck.parent = &utmi_clk;
629 uhpck.pmc_mask = AT91SAM926x_PMC_UHP; 669 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
630 uhpck.rate_hz = utmi_clk.rate_hz; 670 uhpck.rate_hz = utmi_clk.rate_hz;
631 uhpck.rate_hz /= 1 + ((at91_sys_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8); 671 uhpck.rate_hz /= 1 + ((at91_pmc_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8);
632} 672}
633 673
634int __init at91_clock_init(unsigned long main_clock) 674int __init at91_clock_init(unsigned long main_clock)
@@ -637,6 +677,10 @@ int __init at91_clock_init(unsigned long main_clock)
637 int i; 677 int i;
638 int pll_overclock = false; 678 int pll_overclock = false;
639 679
680 at91_pmc_base = ioremap(AT91_PMC, 256);
681 if (!at91_pmc_base)
682 panic("Impossible to ioremap AT91_PMC 0x%x\n", AT91_PMC);
683
640 /* 684 /*
641 * When the bootloader initialized the main oscillator correctly, 685 * When the bootloader initialized the main oscillator correctly,
642 * there's no problem using the cycle counter. But if it didn't, 686 * there's no problem using the cycle counter. But if it didn't,
@@ -645,14 +689,14 @@ int __init at91_clock_init(unsigned long main_clock)
645 */ 689 */
646 if (!main_clock) { 690 if (!main_clock) {
647 do { 691 do {
648 tmp = at91_sys_read(AT91_CKGR_MCFR); 692 tmp = at91_pmc_read(AT91_CKGR_MCFR);
649 } while (!(tmp & AT91_PMC_MAINRDY)); 693 } while (!(tmp & AT91_PMC_MAINRDY));
650 main_clock = (tmp & AT91_PMC_MAINF) * (AT91_SLOW_CLOCK / 16); 694 main_clock = (tmp & AT91_PMC_MAINF) * (AT91_SLOW_CLOCK / 16);
651 } 695 }
652 main_clk.rate_hz = main_clock; 696 main_clk.rate_hz = main_clock;
653 697
654 /* report if PLLA is more than mildly overclocked */ 698 /* report if PLLA is more than mildly overclocked */
655 plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_sys_read(AT91_CKGR_PLLAR)); 699 plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_pmc_read(AT91_CKGR_PLLAR));
656 if (cpu_has_300M_plla()) { 700 if (cpu_has_300M_plla()) {
657 if (plla.rate_hz > 300000000) 701 if (plla.rate_hz > 300000000)
658 pll_overclock = true; 702 pll_overclock = true;
@@ -666,8 +710,8 @@ int __init at91_clock_init(unsigned long main_clock)
666 if (pll_overclock) 710 if (pll_overclock)
667 pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000); 711 pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000);
668 712
669 if (cpu_is_at91sam9g45()) { 713 if (cpu_has_plladiv2()) {
670 mckr = at91_sys_read(AT91_PMC_MCKR); 714 mckr = at91_pmc_read(AT91_PMC_MCKR);
671 plla.rate_hz /= (1 << ((mckr & AT91_PMC_PLLADIV2) >> 12)); /* plla divisor by 2 */ 715 plla.rate_hz /= (1 << ((mckr & AT91_PMC_PLLADIV2) >> 12)); /* plla divisor by 2 */
672 } 716 }
673 717
@@ -688,6 +732,10 @@ int __init at91_clock_init(unsigned long main_clock)
688 * (obtain the USB High Speed 480 MHz when input is 12 MHz) 732 * (obtain the USB High Speed 480 MHz when input is 12 MHz)
689 */ 733 */
690 utmi_clk.rate_hz = 40 * utmi_clk.parent->rate_hz; 734 utmi_clk.rate_hz = 40 * utmi_clk.parent->rate_hz;
735
736 /* UTMI bias and PLL are managed at the same time */
737 if (cpu_has_upll())
738 utmi_clk.pmc_mask |= AT91_PMC_BIASEN;
691 } 739 }
692 740
693 /* 741 /*
@@ -703,10 +751,10 @@ int __init at91_clock_init(unsigned long main_clock)
703 * MCK and CPU derive from one of those primary clocks. 751 * MCK and CPU derive from one of those primary clocks.
704 * For now, assume this parentage won't change. 752 * For now, assume this parentage won't change.
705 */ 753 */
706 mckr = at91_sys_read(AT91_PMC_MCKR); 754 mckr = at91_pmc_read(AT91_PMC_MCKR);
707 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS); 755 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS);
708 freq = mck.parent->rate_hz; 756 freq = mck.parent->rate_hz;
709 freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */ 757 freq /= pmc_prescaler_divider(mckr); /* prescale */
710 if (cpu_is_at91rm9200()) { 758 if (cpu_is_at91rm9200()) {
711 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ 759 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
712 } else if (cpu_is_at91sam9g20()) { 760 } else if (cpu_is_at91sam9g20()) {
@@ -714,13 +762,19 @@ int __init at91_clock_init(unsigned long main_clock)
714 freq / ((mckr & AT91_PMC_MDIV) >> 7) : freq; /* mdiv ; (x >> 7) = ((x >> 8) * 2) */ 762 freq / ((mckr & AT91_PMC_MDIV) >> 7) : freq; /* mdiv ; (x >> 7) = ((x >> 8) * 2) */
715 if (mckr & AT91_PMC_PDIV) 763 if (mckr & AT91_PMC_PDIV)
716 freq /= 2; /* processor clock division */ 764 freq /= 2; /* processor clock division */
717 } else if (cpu_is_at91sam9g45()) { 765 } else if (cpu_has_mdiv3()) {
718 mck.rate_hz = (mckr & AT91_PMC_MDIV) == AT91SAM9_PMC_MDIV_3 ? 766 mck.rate_hz = (mckr & AT91_PMC_MDIV) == AT91SAM9_PMC_MDIV_3 ?
719 freq / 3 : freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ 767 freq / 3 : freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
720 } else { 768 } else {
721 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ 769 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
722 } 770 }
723 771
772 if (cpu_has_alt_prescaler()) {
773 /* Programmable clocks can use MCK */
774 mck.type |= CLK_TYPE_PRIMARY;
775 mck.id = 4;
776 }
777
724 /* Register the PMC's standard clocks */ 778 /* Register the PMC's standard clocks */
725 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++) 779 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++)
726 at91_clk_add(standard_pmc_clocks[i]); 780 at91_clk_add(standard_pmc_clocks[i]);
@@ -770,9 +824,15 @@ static int __init at91_clock_reset(void)
770 pr_debug("Clocks: disable unused %s\n", clk->name); 824 pr_debug("Clocks: disable unused %s\n", clk->name);
771 } 825 }
772 826
773 at91_sys_write(AT91_PMC_PCDR, pcdr); 827 at91_pmc_write(AT91_PMC_PCDR, pcdr);
774 at91_sys_write(AT91_PMC_SCDR, scdr); 828 at91_pmc_write(AT91_PMC_SCDR, scdr);
775 829
776 return 0; 830 return 0;
777} 831}
778late_initcall(at91_clock_reset); 832late_initcall(at91_clock_reset);
833
834void at91sam9_idle(void)
835{
836 at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK);
837 cpu_do_idle();
838}
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
index a851e6c9842..555d956b3a5 100644
--- a/arch/arm/mach-at91/cpuidle.c
+++ b/arch/arm/mach-at91/cpuidle.c
@@ -39,20 +39,15 @@ static int at91_enter_idle(struct cpuidle_device *dev,
39{ 39{
40 struct timeval before, after; 40 struct timeval before, after;
41 int idle_time; 41 int idle_time;
42 u32 saved_lpr;
43 42
44 local_irq_disable(); 43 local_irq_disable();
45 do_gettimeofday(&before); 44 do_gettimeofday(&before);
46 if (index == 0) 45 if (index == 0)
47 /* Wait for interrupt state */ 46 /* Wait for interrupt state */
48 cpu_do_idle(); 47 cpu_do_idle();
49 else if (index == 1) { 48 else if (index == 1)
50 asm("b 1f; .align 5; 1:"); 49 at91_standby();
51 asm("mcr p15, 0, r0, c7, c10, 4"); /* drain write buffer */ 50
52 saved_lpr = sdram_selfrefresh_enable();
53 cpu_do_idle();
54 sdram_selfrefresh_disable(saved_lpr);
55 }
56 do_gettimeofday(&after); 51 do_gettimeofday(&after);
57 local_irq_enable(); 52 local_irq_enable();
58 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + 53 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 594133451c0..459f01a4a54 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include <linux/clkdev.h> 11#include <linux/clkdev.h>
12#include <linux/of.h>
12 13
13 /* Map io */ 14 /* Map io */
14extern void __init at91_map_io(void); 15extern void __init at91_map_io(void);
@@ -25,9 +26,13 @@ extern void __init at91_init_irq_default(void);
25extern void __init at91_init_interrupts(unsigned int priority[]); 26extern void __init at91_init_interrupts(unsigned int priority[]);
26extern void __init at91x40_init_interrupts(unsigned int priority[]); 27extern void __init at91x40_init_interrupts(unsigned int priority[]);
27extern void __init at91_aic_init(unsigned int priority[]); 28extern void __init at91_aic_init(unsigned int priority[]);
29extern int __init at91_aic_of_init(struct device_node *node,
30 struct device_node *parent);
31
28 32
29 /* Timer */ 33 /* Timer */
30struct sys_timer; 34struct sys_timer;
35extern void at91rm9200_ioremap_st(u32 addr);
31extern struct sys_timer at91rm9200_timer; 36extern struct sys_timer at91rm9200_timer;
32extern void at91sam926x_ioremap_pit(u32 addr); 37extern void at91sam926x_ioremap_pit(u32 addr);
33extern struct sys_timer at91sam926x_timer; 38extern struct sys_timer at91sam926x_timer;
@@ -45,7 +50,6 @@ extern void __init at91sam9261_set_console_clock(int id);
45extern void __init at91sam9263_set_console_clock(int id); 50extern void __init at91sam9263_set_console_clock(int id);
46extern void __init at91sam9rl_set_console_clock(int id); 51extern void __init at91sam9rl_set_console_clock(int id);
47extern void __init at91sam9g45_set_console_clock(int id); 52extern void __init at91sam9g45_set_console_clock(int id);
48extern void __init at91cap9_set_console_clock(int id);
49#ifdef CONFIG_AT91_PMC_UNIT 53#ifdef CONFIG_AT91_PMC_UNIT
50extern int __init at91_clock_init(unsigned long main_clock); 54extern int __init at91_clock_init(unsigned long main_clock);
51#else 55#else
@@ -57,6 +61,9 @@ struct device;
57extern void at91_irq_suspend(void); 61extern void at91_irq_suspend(void);
58extern void at91_irq_resume(void); 62extern void at91_irq_resume(void);
59 63
64/* idle */
65extern void at91sam9_idle(void);
66
60/* reset */ 67/* reset */
61extern void at91_ioremap_rstc(u32 base_addr); 68extern void at91_ioremap_rstc(u32 base_addr);
62extern void at91sam9_alt_restart(char, const char *); 69extern void at91sam9_alt_restart(char, const char *);
@@ -65,6 +72,12 @@ extern void at91sam9g45_restart(char, const char *);
65/* shutdown */ 72/* shutdown */
66extern void at91_ioremap_shdwc(u32 base_addr); 73extern void at91_ioremap_shdwc(u32 base_addr);
67 74
75/* Matrix */
76extern void at91_ioremap_matrix(u32 base_addr);
77
78/* Ram Controler */
79extern void at91_ioremap_ramc(int id, u32 addr, u32 size);
80
68 /* GPIO */ 81 /* GPIO */
69#define AT91RM9200_PQFP 3 /* AT91RM9200 PQFP package has 3 banks */ 82#define AT91RM9200_PQFP 3 /* AT91RM9200 PQFP package has 3 banks */
70#define AT91RM9200_BGA 4 /* AT91RM9200 BGA package has 4 banks */ 83#define AT91RM9200_BGA 4 /* AT91RM9200 BGA package has 4 banks */
@@ -75,5 +88,7 @@ struct at91_gpio_bank {
75}; 88};
76extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks); 89extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks);
77extern void __init at91_gpio_irq_setup(void); 90extern void __init at91_gpio_irq_setup(void);
91extern int __init at91_gpio_of_irq_setup(struct device_node *node,
92 struct device_node *parent);
78 93
79extern int at91_extern_irq; 94extern int at91_extern_irq;
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index 74d6783eeab..325837a264c 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/clk.h> 12#include <linux/clk.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/device.h>
14#include <linux/gpio.h> 15#include <linux/gpio.h>
15#include <linux/interrupt.h> 16#include <linux/interrupt.h>
16#include <linux/irq.h> 17#include <linux/irq.h>
@@ -20,6 +21,10 @@
20#include <linux/list.h> 21#include <linux/list.h>
21#include <linux/module.h> 22#include <linux/module.h>
22#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/irqdomain.h>
25#include <linux/of_address.h>
26#include <linux/of_irq.h>
27#include <linux/of_gpio.h>
23 28
24#include <mach/hardware.h> 29#include <mach/hardware.h>
25#include <mach/at91_pio.h> 30#include <mach/at91_pio.h>
@@ -29,9 +34,12 @@
29struct at91_gpio_chip { 34struct at91_gpio_chip {
30 struct gpio_chip chip; 35 struct gpio_chip chip;
31 struct at91_gpio_chip *next; /* Bank sharing same clock */ 36 struct at91_gpio_chip *next; /* Bank sharing same clock */
32 int id; /* ID of register bank */ 37 int pioc_hwirq; /* PIO bank interrupt identifier on AIC */
33 void __iomem *regbase; /* Base of register bank */ 38 int pioc_virq; /* PIO bank Linux virtual interrupt */
39 int pioc_idx; /* PIO bank index */
40 void __iomem *regbase; /* PIO bank virtual address */
34 struct clk *clock; /* associated clock */ 41 struct clk *clock; /* associated clock */
42 struct irq_domain *domain; /* associated irq domain */
35}; 43};
36 44
37#define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip) 45#define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip)
@@ -43,8 +51,9 @@ static int at91_gpiolib_direction_output(struct gpio_chip *chip,
43 unsigned offset, int val); 51 unsigned offset, int val);
44static int at91_gpiolib_direction_input(struct gpio_chip *chip, 52static int at91_gpiolib_direction_input(struct gpio_chip *chip,
45 unsigned offset); 53 unsigned offset);
54static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset);
46 55
47#define AT91_GPIO_CHIP(name, base_gpio, nr_gpio) \ 56#define AT91_GPIO_CHIP(name, nr_gpio) \
48 { \ 57 { \
49 .chip = { \ 58 .chip = { \
50 .label = name, \ 59 .label = name, \
@@ -53,20 +62,28 @@ static int at91_gpiolib_direction_input(struct gpio_chip *chip,
53 .get = at91_gpiolib_get, \ 62 .get = at91_gpiolib_get, \
54 .set = at91_gpiolib_set, \ 63 .set = at91_gpiolib_set, \
55 .dbg_show = at91_gpiolib_dbg_show, \ 64 .dbg_show = at91_gpiolib_dbg_show, \
56 .base = base_gpio, \ 65 .to_irq = at91_gpiolib_to_irq, \
57 .ngpio = nr_gpio, \ 66 .ngpio = nr_gpio, \
58 }, \ 67 }, \
59 } 68 }
60 69
61static struct at91_gpio_chip gpio_chip[] = { 70static struct at91_gpio_chip gpio_chip[] = {
62 AT91_GPIO_CHIP("pioA", 0x00, 32), 71 AT91_GPIO_CHIP("pioA", 32),
63 AT91_GPIO_CHIP("pioB", 0x20, 32), 72 AT91_GPIO_CHIP("pioB", 32),
64 AT91_GPIO_CHIP("pioC", 0x40, 32), 73 AT91_GPIO_CHIP("pioC", 32),
65 AT91_GPIO_CHIP("pioD", 0x60, 32), 74 AT91_GPIO_CHIP("pioD", 32),
66 AT91_GPIO_CHIP("pioE", 0x80, 32), 75 AT91_GPIO_CHIP("pioE", 32),
67}; 76};
68 77
69static int gpio_banks; 78static int gpio_banks;
79static unsigned long at91_gpio_caps;
80
81/* All PIO controllers support PIO3 features */
82#define AT91_GPIO_CAP_PIO3 (1 << 0)
83
84#define has_pio3() (at91_gpio_caps & AT91_GPIO_CAP_PIO3)
85
86/*--------------------------------------------------------------------------*/
70 87
71static inline void __iomem *pin_to_controller(unsigned pin) 88static inline void __iomem *pin_to_controller(unsigned pin)
72{ 89{
@@ -83,6 +100,25 @@ static inline unsigned pin_to_mask(unsigned pin)
83} 100}
84 101
85 102
103static char peripheral_function(void __iomem *pio, unsigned mask)
104{
105 char ret = 'X';
106 u8 select;
107
108 if (pio) {
109 if (has_pio3()) {
110 select = !!(__raw_readl(pio + PIO_ABCDSR1) & mask);
111 select |= (!!(__raw_readl(pio + PIO_ABCDSR2) & mask) << 1);
112 ret = 'A' + select;
113 } else {
114 ret = __raw_readl(pio + PIO_ABSR) & mask ?
115 'B' : 'A';
116 }
117 }
118
119 return ret;
120}
121
86/*--------------------------------------------------------------------------*/ 122/*--------------------------------------------------------------------------*/
87 123
88/* Not all hardware capabilities are exposed through these calls; they 124/* Not all hardware capabilities are exposed through these calls; they
@@ -130,7 +166,14 @@ int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup)
130 166
131 __raw_writel(mask, pio + PIO_IDR); 167 __raw_writel(mask, pio + PIO_IDR);
132 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR)); 168 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
133 __raw_writel(mask, pio + PIO_ASR); 169 if (has_pio3()) {
170 __raw_writel(__raw_readl(pio + PIO_ABCDSR1) & ~mask,
171 pio + PIO_ABCDSR1);
172 __raw_writel(__raw_readl(pio + PIO_ABCDSR2) & ~mask,
173 pio + PIO_ABCDSR2);
174 } else {
175 __raw_writel(mask, pio + PIO_ASR);
176 }
134 __raw_writel(mask, pio + PIO_PDR); 177 __raw_writel(mask, pio + PIO_PDR);
135 return 0; 178 return 0;
136} 179}
@@ -150,7 +193,14 @@ int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup)
150 193
151 __raw_writel(mask, pio + PIO_IDR); 194 __raw_writel(mask, pio + PIO_IDR);
152 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR)); 195 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
153 __raw_writel(mask, pio + PIO_BSR); 196 if (has_pio3()) {
197 __raw_writel(__raw_readl(pio + PIO_ABCDSR1) | mask,
198 pio + PIO_ABCDSR1);
199 __raw_writel(__raw_readl(pio + PIO_ABCDSR2) & ~mask,
200 pio + PIO_ABCDSR2);
201 } else {
202 __raw_writel(mask, pio + PIO_BSR);
203 }
154 __raw_writel(mask, pio + PIO_PDR); 204 __raw_writel(mask, pio + PIO_PDR);
155 return 0; 205 return 0;
156} 206}
@@ -158,8 +208,50 @@ EXPORT_SYMBOL(at91_set_B_periph);
158 208
159 209
160/* 210/*
161 * mux the pin to the gpio controller (instead of "A" or "B" peripheral), and 211 * mux the pin to the "C" internal peripheral role.
162 * configure it for an input. 212 */
213int __init_or_module at91_set_C_periph(unsigned pin, int use_pullup)
214{
215 void __iomem *pio = pin_to_controller(pin);
216 unsigned mask = pin_to_mask(pin);
217
218 if (!pio || !has_pio3())
219 return -EINVAL;
220
221 __raw_writel(mask, pio + PIO_IDR);
222 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
223 __raw_writel(__raw_readl(pio + PIO_ABCDSR1) & ~mask, pio + PIO_ABCDSR1);
224 __raw_writel(__raw_readl(pio + PIO_ABCDSR2) | mask, pio + PIO_ABCDSR2);
225 __raw_writel(mask, pio + PIO_PDR);
226 return 0;
227}
228EXPORT_SYMBOL(at91_set_C_periph);
229
230
231/*
232 * mux the pin to the "D" internal peripheral role.
233 */
234int __init_or_module at91_set_D_periph(unsigned pin, int use_pullup)
235{
236 void __iomem *pio = pin_to_controller(pin);
237 unsigned mask = pin_to_mask(pin);
238
239 if (!pio || !has_pio3())
240 return -EINVAL;
241
242 __raw_writel(mask, pio + PIO_IDR);
243 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
244 __raw_writel(__raw_readl(pio + PIO_ABCDSR1) | mask, pio + PIO_ABCDSR1);
245 __raw_writel(__raw_readl(pio + PIO_ABCDSR2) | mask, pio + PIO_ABCDSR2);
246 __raw_writel(mask, pio + PIO_PDR);
247 return 0;
248}
249EXPORT_SYMBOL(at91_set_D_periph);
250
251
252/*
253 * mux the pin to the gpio controller (instead of "A", "B", "C"
254 * or "D" peripheral), and configure it for an input.
163 */ 255 */
164int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup) 256int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup)
165{ 257{
@@ -179,8 +271,8 @@ EXPORT_SYMBOL(at91_set_gpio_input);
179 271
180 272
181/* 273/*
182 * mux the pin to the gpio controller (instead of "A" or "B" peripheral), 274 * mux the pin to the gpio controller (instead of "A", "B", "C"
183 * and configure it for an output. 275 * or "D" peripheral), and configure it for an output.
184 */ 276 */
185int __init_or_module at91_set_gpio_output(unsigned pin, int value) 277int __init_or_module at91_set_gpio_output(unsigned pin, int value)
186{ 278{
@@ -210,12 +302,37 @@ int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
210 302
211 if (!pio) 303 if (!pio)
212 return -EINVAL; 304 return -EINVAL;
305
306 if (has_pio3() && is_on)
307 __raw_writel(mask, pio + PIO_IFSCDR);
213 __raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR)); 308 __raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR));
214 return 0; 309 return 0;
215} 310}
216EXPORT_SYMBOL(at91_set_deglitch); 311EXPORT_SYMBOL(at91_set_deglitch);
217 312
218/* 313/*
314 * enable/disable the debounce filter;
315 */
316int __init_or_module at91_set_debounce(unsigned pin, int is_on, int div)
317{
318 void __iomem *pio = pin_to_controller(pin);
319 unsigned mask = pin_to_mask(pin);
320
321 if (!pio || !has_pio3())
322 return -EINVAL;
323
324 if (is_on) {
325 __raw_writel(mask, pio + PIO_IFSCER);
326 __raw_writel(div & PIO_SCDR_DIV, pio + PIO_SCDR);
327 __raw_writel(mask, pio + PIO_IFER);
328 } else {
329 __raw_writel(mask, pio + PIO_IFDR);
330 }
331 return 0;
332}
333EXPORT_SYMBOL(at91_set_debounce);
334
335/*
219 * enable/disable the multi-driver; This is only valid for output and 336 * enable/disable the multi-driver; This is only valid for output and
220 * allows the output pin to run as an open collector output. 337 * allows the output pin to run as an open collector output.
221 */ 338 */
@@ -233,6 +350,41 @@ int __init_or_module at91_set_multi_drive(unsigned pin, int is_on)
233EXPORT_SYMBOL(at91_set_multi_drive); 350EXPORT_SYMBOL(at91_set_multi_drive);
234 351
235/* 352/*
353 * enable/disable the pull-down.
354 * If pull-up already enabled while calling the function, we disable it.
355 */
356int __init_or_module at91_set_pulldown(unsigned pin, int is_on)
357{
358 void __iomem *pio = pin_to_controller(pin);
359 unsigned mask = pin_to_mask(pin);
360
361 if (!pio || !has_pio3())
362 return -EINVAL;
363
364 /* Disable pull-up anyway */
365 __raw_writel(mask, pio + PIO_PUDR);
366 __raw_writel(mask, pio + (is_on ? PIO_PPDER : PIO_PPDDR));
367 return 0;
368}
369EXPORT_SYMBOL(at91_set_pulldown);
370
371/*
372 * disable Schmitt trigger
373 */
374int __init_or_module at91_disable_schmitt_trig(unsigned pin)
375{
376 void __iomem *pio = pin_to_controller(pin);
377 unsigned mask = pin_to_mask(pin);
378
379 if (!pio || !has_pio3())
380 return -EINVAL;
381
382 __raw_writel(__raw_readl(pio + PIO_SCHMITT) | mask, pio + PIO_SCHMITT);
383 return 0;
384}
385EXPORT_SYMBOL(at91_disable_schmitt_trig);
386
387/*
236 * assuming the pin is muxed as a gpio output, set its value. 388 * assuming the pin is muxed as a gpio output, set its value.
237 */ 389 */
238int at91_set_gpio_value(unsigned pin, int value) 390int at91_set_gpio_value(unsigned pin, int value)
@@ -273,9 +425,9 @@ static u32 backups[MAX_GPIO_BANKS];
273 425
274static int gpio_irq_set_wake(struct irq_data *d, unsigned state) 426static int gpio_irq_set_wake(struct irq_data *d, unsigned state)
275{ 427{
276 unsigned pin = irq_to_gpio(d->irq); 428 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
277 unsigned mask = pin_to_mask(pin); 429 unsigned mask = 1 << d->hwirq;
278 unsigned bank = pin / 32; 430 unsigned bank = at91_gpio->pioc_idx;
279 431
280 if (unlikely(bank >= MAX_GPIO_BANKS)) 432 if (unlikely(bank >= MAX_GPIO_BANKS))
281 return -EINVAL; 433 return -EINVAL;
@@ -285,7 +437,7 @@ static int gpio_irq_set_wake(struct irq_data *d, unsigned state)
285 else 437 else
286 wakeups[bank] &= ~mask; 438 wakeups[bank] &= ~mask;
287 439
288 irq_set_irq_wake(gpio_chip[bank].id, state); 440 irq_set_irq_wake(at91_gpio->pioc_virq, state);
289 441
290 return 0; 442 return 0;
291} 443}
@@ -301,9 +453,10 @@ void at91_gpio_suspend(void)
301 __raw_writel(backups[i], pio + PIO_IDR); 453 __raw_writel(backups[i], pio + PIO_IDR);
302 __raw_writel(wakeups[i], pio + PIO_IER); 454 __raw_writel(wakeups[i], pio + PIO_IER);
303 455
304 if (!wakeups[i]) 456 if (!wakeups[i]) {
457 clk_unprepare(gpio_chip[i].clock);
305 clk_disable(gpio_chip[i].clock); 458 clk_disable(gpio_chip[i].clock);
306 else { 459 } else {
307#ifdef CONFIG_PM_DEBUG 460#ifdef CONFIG_PM_DEBUG
308 printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", 'A'+i, wakeups[i]); 461 printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", 'A'+i, wakeups[i]);
309#endif 462#endif
@@ -318,8 +471,10 @@ void at91_gpio_resume(void)
318 for (i = 0; i < gpio_banks; i++) { 471 for (i = 0; i < gpio_banks; i++) {
319 void __iomem *pio = gpio_chip[i].regbase; 472 void __iomem *pio = gpio_chip[i].regbase;
320 473
321 if (!wakeups[i]) 474 if (!wakeups[i]) {
322 clk_enable(gpio_chip[i].clock); 475 if (clk_prepare(gpio_chip[i].clock) == 0)
476 clk_enable(gpio_chip[i].clock);
477 }
323 478
324 __raw_writel(wakeups[i], pio + PIO_IDR); 479 __raw_writel(wakeups[i], pio + PIO_IDR);
325 __raw_writel(backups[i], pio + PIO_IER); 480 __raw_writel(backups[i], pio + PIO_IER);
@@ -335,7 +490,10 @@ void at91_gpio_resume(void)
335 * To use any AT91_PIN_* as an externally triggered IRQ, first call 490 * To use any AT91_PIN_* as an externally triggered IRQ, first call
336 * at91_set_gpio_input() then maybe enable its glitch filter. 491 * at91_set_gpio_input() then maybe enable its glitch filter.
337 * Then just request_irq() with the pin ID; it works like any ARM IRQ 492 * Then just request_irq() with the pin ID; it works like any ARM IRQ
338 * handler, though it always triggers on rising and falling edges. 493 * handler.
494 * First implementation always triggers on rising and falling edges
495 * whereas the newer PIO3 can be additionally configured to trigger on
496 * level, edge with any polarity.
339 * 497 *
340 * Alternatively, certain pins may be used directly as IRQ0..IRQ6 after 498 * Alternatively, certain pins may be used directly as IRQ0..IRQ6 after
341 * configuring them with at91_set_a_periph() or at91_set_b_periph(). 499 * configuring them with at91_set_a_periph() or at91_set_b_periph().
@@ -344,9 +502,9 @@ void at91_gpio_resume(void)
344 502
345static void gpio_irq_mask(struct irq_data *d) 503static void gpio_irq_mask(struct irq_data *d)
346{ 504{
347 unsigned pin = irq_to_gpio(d->irq); 505 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
348 void __iomem *pio = pin_to_controller(pin); 506 void __iomem *pio = at91_gpio->regbase;
349 unsigned mask = pin_to_mask(pin); 507 unsigned mask = 1 << d->hwirq;
350 508
351 if (pio) 509 if (pio)
352 __raw_writel(mask, pio + PIO_IDR); 510 __raw_writel(mask, pio + PIO_IDR);
@@ -354,9 +512,9 @@ static void gpio_irq_mask(struct irq_data *d)
354 512
355static void gpio_irq_unmask(struct irq_data *d) 513static void gpio_irq_unmask(struct irq_data *d)
356{ 514{
357 unsigned pin = irq_to_gpio(d->irq); 515 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
358 void __iomem *pio = pin_to_controller(pin); 516 void __iomem *pio = at91_gpio->regbase;
359 unsigned mask = pin_to_mask(pin); 517 unsigned mask = 1 << d->hwirq;
360 518
361 if (pio) 519 if (pio)
362 __raw_writel(mask, pio + PIO_IER); 520 __raw_writel(mask, pio + PIO_IER);
@@ -373,23 +531,66 @@ static int gpio_irq_type(struct irq_data *d, unsigned type)
373 } 531 }
374} 532}
375 533
534/* Alternate irq type for PIO3 support */
535static int alt_gpio_irq_type(struct irq_data *d, unsigned type)
536{
537 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
538 void __iomem *pio = at91_gpio->regbase;
539 unsigned mask = 1 << d->hwirq;
540
541 switch (type) {
542 case IRQ_TYPE_EDGE_RISING:
543 __raw_writel(mask, pio + PIO_ESR);
544 __raw_writel(mask, pio + PIO_REHLSR);
545 break;
546 case IRQ_TYPE_EDGE_FALLING:
547 __raw_writel(mask, pio + PIO_ESR);
548 __raw_writel(mask, pio + PIO_FELLSR);
549 break;
550 case IRQ_TYPE_LEVEL_LOW:
551 __raw_writel(mask, pio + PIO_LSR);
552 __raw_writel(mask, pio + PIO_FELLSR);
553 break;
554 case IRQ_TYPE_LEVEL_HIGH:
555 __raw_writel(mask, pio + PIO_LSR);
556 __raw_writel(mask, pio + PIO_REHLSR);
557 break;
558 case IRQ_TYPE_EDGE_BOTH:
559 /*
560 * disable additional interrupt modes:
561 * fall back to default behavior
562 */
563 __raw_writel(mask, pio + PIO_AIMDR);
564 return 0;
565 case IRQ_TYPE_NONE:
566 default:
567 pr_warn("AT91: No type for irq %d\n", gpio_to_irq(d->irq));
568 return -EINVAL;
569 }
570
571 /* enable additional interrupt modes */
572 __raw_writel(mask, pio + PIO_AIMER);
573
574 return 0;
575}
576
376static struct irq_chip gpio_irqchip = { 577static struct irq_chip gpio_irqchip = {
377 .name = "GPIO", 578 .name = "GPIO",
378 .irq_disable = gpio_irq_mask, 579 .irq_disable = gpio_irq_mask,
379 .irq_mask = gpio_irq_mask, 580 .irq_mask = gpio_irq_mask,
380 .irq_unmask = gpio_irq_unmask, 581 .irq_unmask = gpio_irq_unmask,
381 .irq_set_type = gpio_irq_type, 582 /* .irq_set_type is set dynamically */
382 .irq_set_wake = gpio_irq_set_wake, 583 .irq_set_wake = gpio_irq_set_wake,
383}; 584};
384 585
385static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) 586static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
386{ 587{
387 unsigned irq_pin;
388 struct irq_data *idata = irq_desc_get_irq_data(desc); 588 struct irq_data *idata = irq_desc_get_irq_data(desc);
389 struct irq_chip *chip = irq_data_get_irq_chip(idata); 589 struct irq_chip *chip = irq_data_get_irq_chip(idata);
390 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(idata); 590 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(idata);
391 void __iomem *pio = at91_gpio->regbase; 591 void __iomem *pio = at91_gpio->regbase;
392 u32 isr; 592 unsigned long isr;
593 int n;
393 594
394 /* temporarily mask (level sensitive) parent IRQ */ 595 /* temporarily mask (level sensitive) parent IRQ */
395 chip->irq_ack(idata); 596 chip->irq_ack(idata);
@@ -407,13 +608,10 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
407 continue; 608 continue;
408 } 609 }
409 610
410 irq_pin = gpio_to_irq(at91_gpio->chip.base); 611 n = find_first_bit(&isr, BITS_PER_LONG);
411 612 while (n < BITS_PER_LONG) {
412 while (isr) { 613 generic_handle_irq(irq_find_mapping(at91_gpio->domain, n));
413 if (isr & 1) 614 n = find_next_bit(&isr, BITS_PER_LONG, n + 1);
414 generic_handle_irq(irq_pin);
415 irq_pin++;
416 isr >>= 1;
417 } 615 }
418 } 616 }
419 chip->irq_unmask(idata); 617 chip->irq_unmask(idata);
@@ -424,6 +622,33 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
424 622
425#ifdef CONFIG_DEBUG_FS 623#ifdef CONFIG_DEBUG_FS
426 624
625static void gpio_printf(struct seq_file *s, void __iomem *pio, unsigned mask)
626{
627 char *trigger = NULL;
628 char *polarity = NULL;
629
630 if (__raw_readl(pio + PIO_IMR) & mask) {
631 if (!has_pio3() || !(__raw_readl(pio + PIO_AIMMR) & mask )) {
632 trigger = "edge";
633 polarity = "both";
634 } else {
635 if (__raw_readl(pio + PIO_ELSR) & mask) {
636 trigger = "level";
637 polarity = __raw_readl(pio + PIO_FRLHSR) & mask ?
638 "high" : "low";
639 } else {
640 trigger = "edge";
641 polarity = __raw_readl(pio + PIO_FRLHSR) & mask ?
642 "rising" : "falling";
643 }
644 }
645 seq_printf(s, "IRQ:%s-%s\t", trigger, polarity);
646 } else {
647 seq_printf(s, "GPIO:%s\t\t",
648 __raw_readl(pio + PIO_PDSR) & mask ? "1" : "0");
649 }
650}
651
427static int at91_gpio_show(struct seq_file *s, void *unused) 652static int at91_gpio_show(struct seq_file *s, void *unused)
428{ 653{
429 int bank, j; 654 int bank, j;
@@ -431,7 +656,7 @@ static int at91_gpio_show(struct seq_file *s, void *unused)
431 /* print heading */ 656 /* print heading */
432 seq_printf(s, "Pin\t"); 657 seq_printf(s, "Pin\t");
433 for (bank = 0; bank < gpio_banks; bank++) { 658 for (bank = 0; bank < gpio_banks; bank++) {
434 seq_printf(s, "PIO%c\t", 'A' + bank); 659 seq_printf(s, "PIO%c\t\t", 'A' + bank);
435 }; 660 };
436 seq_printf(s, "\n\n"); 661 seq_printf(s, "\n\n");
437 662
@@ -445,11 +670,10 @@ static int at91_gpio_show(struct seq_file *s, void *unused)
445 unsigned mask = pin_to_mask(pin); 670 unsigned mask = pin_to_mask(pin);
446 671
447 if (__raw_readl(pio + PIO_PSR) & mask) 672 if (__raw_readl(pio + PIO_PSR) & mask)
448 seq_printf(s, "GPIO:%s", __raw_readl(pio + PIO_PDSR) & mask ? "1" : "0"); 673 gpio_printf(s, pio, mask);
449 else 674 else
450 seq_printf(s, "%s", __raw_readl(pio + PIO_ABSR) & mask ? "B" : "A"); 675 seq_printf(s, "%c\t\t",
451 676 peripheral_function(pio, mask));
452 seq_printf(s, "\t");
453 } 677 }
454 678
455 seq_printf(s, "\n"); 679 seq_printf(s, "\n");
@@ -488,46 +712,152 @@ postcore_initcall(at91_gpio_debugfs_init);
488 */ 712 */
489static struct lock_class_key gpio_lock_class; 713static struct lock_class_key gpio_lock_class;
490 714
715#if defined(CONFIG_OF)
716static int at91_gpio_irq_map(struct irq_domain *h, unsigned int virq,
717 irq_hw_number_t hw)
718{
719 struct at91_gpio_chip *at91_gpio = h->host_data;
720
721 irq_set_lockdep_class(virq, &gpio_lock_class);
722
723 /*
724 * Can use the "simple" and not "edge" handler since it's
725 * shorter, and the AIC handles interrupts sanely.
726 */
727 irq_set_chip_and_handler(virq, &gpio_irqchip,
728 handle_simple_irq);
729 set_irq_flags(virq, IRQF_VALID);
730 irq_set_chip_data(virq, at91_gpio);
731
732 return 0;
733}
734
735static struct irq_domain_ops at91_gpio_ops = {
736 .map = at91_gpio_irq_map,
737 .xlate = irq_domain_xlate_twocell,
738};
739
740int __init at91_gpio_of_irq_setup(struct device_node *node,
741 struct device_node *parent)
742{
743 struct at91_gpio_chip *prev = NULL;
744 int alias_idx = of_alias_get_id(node, "gpio");
745 struct at91_gpio_chip *at91_gpio = &gpio_chip[alias_idx];
746
747 /* Setup proper .irq_set_type function */
748 if (has_pio3())
749 gpio_irqchip.irq_set_type = alt_gpio_irq_type;
750 else
751 gpio_irqchip.irq_set_type = gpio_irq_type;
752
753 /* Disable irqs of this PIO controller */
754 __raw_writel(~0, at91_gpio->regbase + PIO_IDR);
755
756 /* Setup irq domain */
757 at91_gpio->domain = irq_domain_add_linear(node, at91_gpio->chip.ngpio,
758 &at91_gpio_ops, at91_gpio);
759 if (!at91_gpio->domain)
760 panic("at91_gpio.%d: couldn't allocate irq domain (DT).\n",
761 at91_gpio->pioc_idx);
762
763 /* Setup chained handler */
764 if (at91_gpio->pioc_idx)
765 prev = &gpio_chip[at91_gpio->pioc_idx - 1];
766
767 /* The toplevel handler handles one bank of GPIOs, except
768 * on some SoC it can handles up to three...
769 * We only set up the handler for the first of the list.
770 */
771 if (prev && prev->next == at91_gpio)
772 return 0;
773
774 at91_gpio->pioc_virq = irq_create_mapping(irq_find_host(parent),
775 at91_gpio->pioc_hwirq);
776 irq_set_chip_data(at91_gpio->pioc_virq, at91_gpio);
777 irq_set_chained_handler(at91_gpio->pioc_virq, gpio_irq_handler);
778
779 return 0;
780}
781#else
782int __init at91_gpio_of_irq_setup(struct device_node *node,
783 struct device_node *parent)
784{
785 return -EINVAL;
786}
787#endif
788
789/*
790 * irqdomain initialization: pile up irqdomains on top of AIC range
791 */
792static void __init at91_gpio_irqdomain(struct at91_gpio_chip *at91_gpio)
793{
794 int irq_base;
795
796 irq_base = irq_alloc_descs(-1, 0, at91_gpio->chip.ngpio, 0);
797 if (irq_base < 0)
798 panic("at91_gpio.%d: error %d: couldn't allocate IRQ numbers.\n",
799 at91_gpio->pioc_idx, irq_base);
800 at91_gpio->domain = irq_domain_add_legacy(NULL, at91_gpio->chip.ngpio,
801 irq_base, 0,
802 &irq_domain_simple_ops, NULL);
803 if (!at91_gpio->domain)
804 panic("at91_gpio.%d: couldn't allocate irq domain.\n",
805 at91_gpio->pioc_idx);
806}
807
491/* 808/*
492 * Called from the processor-specific init to enable GPIO interrupt support. 809 * Called from the processor-specific init to enable GPIO interrupt support.
493 */ 810 */
494void __init at91_gpio_irq_setup(void) 811void __init at91_gpio_irq_setup(void)
495{ 812{
496 unsigned pioc, irq = gpio_to_irq(0); 813 unsigned pioc;
814 int gpio_irqnbr = 0;
497 struct at91_gpio_chip *this, *prev; 815 struct at91_gpio_chip *this, *prev;
498 816
817 /* Setup proper .irq_set_type function */
818 if (has_pio3())
819 gpio_irqchip.irq_set_type = alt_gpio_irq_type;
820 else
821 gpio_irqchip.irq_set_type = gpio_irq_type;
822
499 for (pioc = 0, this = gpio_chip, prev = NULL; 823 for (pioc = 0, this = gpio_chip, prev = NULL;
500 pioc++ < gpio_banks; 824 pioc++ < gpio_banks;
501 prev = this, this++) { 825 prev = this, this++) {
502 unsigned id = this->id; 826 int offset;
503 unsigned i;
504 827
505 __raw_writel(~0, this->regbase + PIO_IDR); 828 __raw_writel(~0, this->regbase + PIO_IDR);
506 829
507 for (i = 0, irq = gpio_to_irq(this->chip.base); i < 32; 830 /* setup irq domain for this GPIO controller */
508 i++, irq++) { 831 at91_gpio_irqdomain(this);
509 irq_set_lockdep_class(irq, &gpio_lock_class); 832
833 for (offset = 0; offset < this->chip.ngpio; offset++) {
834 unsigned int virq = irq_find_mapping(this->domain, offset);
835 irq_set_lockdep_class(virq, &gpio_lock_class);
510 836
511 /* 837 /*
512 * Can use the "simple" and not "edge" handler since it's 838 * Can use the "simple" and not "edge" handler since it's
513 * shorter, and the AIC handles interrupts sanely. 839 * shorter, and the AIC handles interrupts sanely.
514 */ 840 */
515 irq_set_chip_and_handler(irq, &gpio_irqchip, 841 irq_set_chip_and_handler(virq, &gpio_irqchip,
516 handle_simple_irq); 842 handle_simple_irq);
517 set_irq_flags(irq, IRQF_VALID); 843 set_irq_flags(virq, IRQF_VALID);
844 irq_set_chip_data(virq, this);
845
846 gpio_irqnbr++;
518 } 847 }
519 848
520 /* The toplevel handler handles one bank of GPIOs, except 849 /* The toplevel handler handles one bank of GPIOs, except
521 * AT91SAM9263_ID_PIOCDE handles three... PIOC is first in 850 * on some SoC it can handles up to three...
522 * the list, so we only set up that handler. 851 * We only set up the handler for the first of the list.
523 */ 852 */
524 if (prev && prev->next == this) 853 if (prev && prev->next == this)
525 continue; 854 continue;
526 855
527 irq_set_chip_data(id, this); 856 this->pioc_virq = irq_create_mapping(NULL, this->pioc_hwirq);
528 irq_set_chained_handler(id, gpio_irq_handler); 857 irq_set_chip_data(this->pioc_virq, this);
858 irq_set_chained_handler(this->pioc_virq, gpio_irq_handler);
529 } 859 }
530 pr_info("AT91: %d gpio irqs in %d banks\n", irq - gpio_to_irq(0), gpio_banks); 860 pr_info("AT91: %d gpio irqs in %d banks\n", gpio_irqnbr, gpio_banks);
531} 861}
532 862
533/* gpiolib support */ 863/* gpiolib support */
@@ -593,48 +923,175 @@ static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
593 at91_get_gpio_value(pin) ? 923 at91_get_gpio_value(pin) ?
594 "set" : "clear"); 924 "set" : "clear");
595 else 925 else
596 seq_printf(s, "[periph %s]\n", 926 seq_printf(s, "[periph %c]\n",
597 __raw_readl(pio + PIO_ABSR) & 927 peripheral_function(pio, mask));
598 mask ? "B" : "A");
599 } 928 }
600 } 929 }
601} 930}
602 931
932static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset)
933{
934 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
935 int virq;
936
937 if (offset < chip->ngpio)
938 virq = irq_create_mapping(at91_gpio->domain, offset);
939 else
940 virq = -ENXIO;
941
942 dev_dbg(chip->dev, "%s: request IRQ for GPIO %d, return %d\n",
943 chip->label, offset + chip->base, virq);
944 return virq;
945}
946
947static int __init at91_gpio_setup_clk(int idx)
948{
949 struct at91_gpio_chip *at91_gpio = &gpio_chip[idx];
950
951 /* retreive PIO controller's clock */
952 at91_gpio->clock = clk_get_sys(NULL, at91_gpio->chip.label);
953 if (IS_ERR(at91_gpio->clock)) {
954 pr_err("at91_gpio.%d, failed to get clock, ignoring.\n", idx);
955 goto err;
956 }
957
958 if (clk_prepare(at91_gpio->clock))
959 goto clk_prep_err;
960
961 /* enable PIO controller's clock */
962 if (clk_enable(at91_gpio->clock)) {
963 pr_err("at91_gpio.%d, failed to enable clock, ignoring.\n", idx);
964 goto clk_err;
965 }
966
967 return 0;
968
969clk_err:
970 clk_unprepare(at91_gpio->clock);
971clk_prep_err:
972 clk_put(at91_gpio->clock);
973err:
974 return -EINVAL;
975}
976
977#ifdef CONFIG_OF_GPIO
978static void __init of_at91_gpio_init_one(struct device_node *np)
979{
980 int alias_idx;
981 struct at91_gpio_chip *at91_gpio;
982
983 if (!np)
984 return;
985
986 alias_idx = of_alias_get_id(np, "gpio");
987 if (alias_idx >= MAX_GPIO_BANKS) {
988 pr_err("at91_gpio, failed alias idx(%d) > MAX_GPIO_BANKS(%d), ignoring.\n",
989 alias_idx, MAX_GPIO_BANKS);
990 return;
991 }
992
993 at91_gpio = &gpio_chip[alias_idx];
994 at91_gpio->chip.base = alias_idx * at91_gpio->chip.ngpio;
995
996 at91_gpio->regbase = of_iomap(np, 0);
997 if (!at91_gpio->regbase) {
998 pr_err("at91_gpio.%d, failed to map registers, ignoring.\n",
999 alias_idx);
1000 return;
1001 }
1002
1003 /* Get the interrupts property */
1004 if (of_property_read_u32(np, "interrupts", &at91_gpio->pioc_hwirq)) {
1005 pr_err("at91_gpio.%d, failed to get interrupts property, ignoring.\n",
1006 alias_idx);
1007 goto ioremap_err;
1008 }
1009
1010 /* Get capabilities from compatibility property */
1011 if (of_device_is_compatible(np, "atmel,at91sam9x5-gpio"))
1012 at91_gpio_caps |= AT91_GPIO_CAP_PIO3;
1013
1014 /* Setup clock */
1015 if (at91_gpio_setup_clk(alias_idx))
1016 goto ioremap_err;
1017
1018 at91_gpio->chip.of_node = np;
1019 gpio_banks = max(gpio_banks, alias_idx + 1);
1020 at91_gpio->pioc_idx = alias_idx;
1021 return;
1022
1023ioremap_err:
1024 iounmap(at91_gpio->regbase);
1025}
1026
1027static int __init of_at91_gpio_init(void)
1028{
1029 struct device_node *np = NULL;
1030
1031 /*
1032 * This isn't ideal, but it gets things hooked up until this
1033 * driver is converted into a platform_device
1034 */
1035 for_each_compatible_node(np, NULL, "atmel,at91rm9200-gpio")
1036 of_at91_gpio_init_one(np);
1037
1038 return gpio_banks > 0 ? 0 : -EINVAL;
1039}
1040#else
1041static int __init of_at91_gpio_init(void)
1042{
1043 return -EINVAL;
1044}
1045#endif
1046
1047static void __init at91_gpio_init_one(int idx, u32 regbase, int pioc_hwirq)
1048{
1049 struct at91_gpio_chip *at91_gpio = &gpio_chip[idx];
1050
1051 at91_gpio->chip.base = idx * at91_gpio->chip.ngpio;
1052 at91_gpio->pioc_hwirq = pioc_hwirq;
1053 at91_gpio->pioc_idx = idx;
1054
1055 at91_gpio->regbase = ioremap(regbase, 512);
1056 if (!at91_gpio->regbase) {
1057 pr_err("at91_gpio.%d, failed to map registers, ignoring.\n", idx);
1058 return;
1059 }
1060
1061 if (at91_gpio_setup_clk(idx))
1062 goto ioremap_err;
1063
1064 gpio_banks = max(gpio_banks, idx + 1);
1065 return;
1066
1067ioremap_err:
1068 iounmap(at91_gpio->regbase);
1069}
1070
603/* 1071/*
604 * Called from the processor-specific init to enable GPIO pin support. 1072 * Called from the processor-specific init to enable GPIO pin support.
605 */ 1073 */
606void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks) 1074void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks)
607{ 1075{
608 unsigned i; 1076 unsigned i;
609 struct at91_gpio_chip *at91_gpio, *last = NULL; 1077 struct at91_gpio_chip *at91_gpio, *last = NULL;
610 1078
611 BUG_ON(nr_banks > MAX_GPIO_BANKS); 1079 BUG_ON(nr_banks > MAX_GPIO_BANKS);
612 1080
613 gpio_banks = nr_banks; 1081 if (of_at91_gpio_init() < 0) {
1082 /* No GPIO controller found in device tree */
1083 for (i = 0; i < nr_banks; i++)
1084 at91_gpio_init_one(i, data[i].regbase, data[i].id);
1085 }
614 1086
615 for (i = 0; i < nr_banks; i++) { 1087 for (i = 0; i < gpio_banks; i++) {
616 at91_gpio = &gpio_chip[i]; 1088 at91_gpio = &gpio_chip[i];
617 1089
618 at91_gpio->id = data[i].id; 1090 /*
619 at91_gpio->chip.base = i * 32; 1091 * GPIO controller are grouped on some SoC:
620 1092 * PIOC, PIOD and PIOE can share the same IRQ line
621 at91_gpio->regbase = ioremap(data[i].regbase, 512); 1093 */
622 if (!at91_gpio->regbase) { 1094 if (last && last->pioc_hwirq == at91_gpio->pioc_hwirq)
623 pr_err("at91_gpio.%d, failed to map registers, ignoring.\n", i);
624 continue;
625 }
626
627 at91_gpio->clock = clk_get_sys(NULL, at91_gpio->chip.label);
628 if (!at91_gpio->clock) {
629 pr_err("at91_gpio.%d, failed to get clock, ignoring.\n", i);
630 continue;
631 }
632
633 /* enable PIO controller's clock */
634 clk_enable(at91_gpio->clock);
635
636 /* AT91SAM9263_ID_PIOCDE groups PIOC, PIOD, PIOE */
637 if (last && last->id == at91_gpio->id)
638 last->next = at91_gpio; 1095 last->next = at91_gpio;
639 last = at91_gpio; 1096 last = at91_gpio;
640 1097
diff --git a/arch/arm/mach-at91/include/mach/at91_matrix.h b/arch/arm/mach-at91/include/mach/at91_matrix.h
new file mode 100644
index 00000000000..02fae9de746
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_matrix.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
3 *
4 * Under GPLv2
5 */
6
7#ifndef __MACH_AT91_MATRIX_H__
8#define __MACH_AT91_MATRIX_H__
9
10#ifndef __ASSEMBLY__
11extern void __iomem *at91_matrix_base;
12
13#define at91_matrix_read(field) \
14 __raw_readl(at91_matrix_base + field)
15
16#define at91_matrix_write(field, value) \
17 __raw_writel(value, at91_matrix_base + field);
18
19#else
20.extern at91_matrix_base
21#endif
22
23#endif /* __MACH_AT91_MATRIX_H__ */
diff --git a/arch/arm/mach-at91/include/mach/at91_pio.h b/arch/arm/mach-at91/include/mach/at91_pio.h
index c6a31bf8a5c..732b11c37f1 100644
--- a/arch/arm/mach-at91/include/mach/at91_pio.h
+++ b/arch/arm/mach-at91/include/mach/at91_pio.h
@@ -40,10 +40,35 @@
40#define PIO_PUER 0x64 /* Pull-up Enable Register */ 40#define PIO_PUER 0x64 /* Pull-up Enable Register */
41#define PIO_PUSR 0x68 /* Pull-up Status Register */ 41#define PIO_PUSR 0x68 /* Pull-up Status Register */
42#define PIO_ASR 0x70 /* Peripheral A Select Register */ 42#define PIO_ASR 0x70 /* Peripheral A Select Register */
43#define PIO_ABCDSR1 0x70 /* Peripheral ABCD Select Register 1 [some sam9 only] */
43#define PIO_BSR 0x74 /* Peripheral B Select Register */ 44#define PIO_BSR 0x74 /* Peripheral B Select Register */
45#define PIO_ABCDSR2 0x74 /* Peripheral ABCD Select Register 2 [some sam9 only] */
44#define PIO_ABSR 0x78 /* AB Status Register */ 46#define PIO_ABSR 0x78 /* AB Status Register */
47#define PIO_IFSCDR 0x80 /* Input Filter Slow Clock Disable Register */
48#define PIO_IFSCER 0x84 /* Input Filter Slow Clock Enable Register */
49#define PIO_IFSCSR 0x88 /* Input Filter Slow Clock Status Register */
50#define PIO_SCDR 0x8c /* Slow Clock Divider Debouncing Register */
51#define PIO_SCDR_DIV (0x3fff << 0) /* Slow Clock Divider Mask */
52#define PIO_PPDDR 0x90 /* Pad Pull-down Disable Register */
53#define PIO_PPDER 0x94 /* Pad Pull-down Enable Register */
54#define PIO_PPDSR 0x98 /* Pad Pull-down Status Register */
45#define PIO_OWER 0xa0 /* Output Write Enable Register */ 55#define PIO_OWER 0xa0 /* Output Write Enable Register */
46#define PIO_OWDR 0xa4 /* Output Write Disable Register */ 56#define PIO_OWDR 0xa4 /* Output Write Disable Register */
47#define PIO_OWSR 0xa8 /* Output Write Status Register */ 57#define PIO_OWSR 0xa8 /* Output Write Status Register */
58#define PIO_AIMER 0xb0 /* Additional Interrupt Modes Enable Register */
59#define PIO_AIMDR 0xb4 /* Additional Interrupt Modes Disable Register */
60#define PIO_AIMMR 0xb8 /* Additional Interrupt Modes Mask Register */
61#define PIO_ESR 0xc0 /* Edge Select Register */
62#define PIO_LSR 0xc4 /* Level Select Register */
63#define PIO_ELSR 0xc8 /* Edge/Level Status Register */
64#define PIO_FELLSR 0xd0 /* Falling Edge/Low Level Select Register */
65#define PIO_REHLSR 0xd4 /* Rising Edge/ High Level Select Register */
66#define PIO_FRLHSR 0xd8 /* Fall/Rise - Low/High Status Register */
67#define PIO_SCHMITT 0x100 /* Schmitt Trigger Register */
68
69#define ABCDSR_PERIPH_A 0x0
70#define ABCDSR_PERIPH_B 0x1
71#define ABCDSR_PERIPH_C 0x2
72#define ABCDSR_PERIPH_D 0x3
48 73
49#endif 74#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
index e46f93e34aa..36604782a78 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -16,17 +16,27 @@
16#ifndef AT91_PMC_H 16#ifndef AT91_PMC_H
17#define AT91_PMC_H 17#define AT91_PMC_H
18 18
19#define AT91_PMC_SCER (AT91_PMC + 0x00) /* System Clock Enable Register */ 19#ifndef __ASSEMBLY__
20#define AT91_PMC_SCDR (AT91_PMC + 0x04) /* System Clock Disable Register */ 20extern void __iomem *at91_pmc_base;
21 21
22#define AT91_PMC_SCSR (AT91_PMC + 0x08) /* System Clock Status Register */ 22#define at91_pmc_read(field) \
23 __raw_readl(at91_pmc_base + field)
24
25#define at91_pmc_write(field, value) \
26 __raw_writel(value, at91_pmc_base + field)
27#else
28.extern at91_aic_base
29#endif
30
31#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */
32#define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */
33
34#define AT91_PMC_SCSR 0x08 /* System Clock Status Register */
23#define AT91_PMC_PCK (1 << 0) /* Processor Clock */ 35#define AT91_PMC_PCK (1 << 0) /* Processor Clock */
24#define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */ 36#define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */
25#define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */ 37#define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */
26#define AT91CAP9_PMC_DDR (1 << 2) /* DDR Clock [CAP9 revC & some SAM9 only] */
27#define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */ 38#define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */
28#define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */ 39#define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */
29#define AT91CAP9_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91CAP9 only] */
30#define AT91SAM926x_PMC_UDP (1 << 7) /* USB Devcice Port Clock [AT91SAM926x only] */ 40#define AT91SAM926x_PMC_UDP (1 << 7) /* USB Devcice Port Clock [AT91SAM926x only] */
31#define AT91_PMC_PCK0 (1 << 8) /* Programmable Clock 0 */ 41#define AT91_PMC_PCK0 (1 << 8) /* Programmable Clock 0 */
32#define AT91_PMC_PCK1 (1 << 9) /* Programmable Clock 1 */ 42#define AT91_PMC_PCK1 (1 << 9) /* Programmable Clock 1 */
@@ -36,27 +46,31 @@
36#define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */ 46#define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */
37#define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */ 47#define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */
38 48
39#define AT91_PMC_PCER (AT91_PMC + 0x10) /* Peripheral Clock Enable Register */ 49#define AT91_PMC_PCER 0x10 /* Peripheral Clock Enable Register */
40#define AT91_PMC_PCDR (AT91_PMC + 0x14) /* Peripheral Clock Disable Register */ 50#define AT91_PMC_PCDR 0x14 /* Peripheral Clock Disable Register */
41#define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */ 51#define AT91_PMC_PCSR 0x18 /* Peripheral Clock Status Register */
42 52
43#define AT91_CKGR_UCKR (AT91_PMC + 0x1C) /* UTMI Clock Register [some SAM9, CAP9] */ 53#define AT91_CKGR_UCKR 0x1C /* UTMI Clock Register [some SAM9] */
44#define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */ 54#define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */
45#define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */ 55#define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */
46#define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */ 56#define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */
47#define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */ 57#define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */
48 58
49#define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register [not on SAM9RL] */ 59#define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */
50#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ 60#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
51#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass [SAM9x, CAP9] */ 61#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */
52#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */ 62#define AT91_PMC_MOSCRCEN (1 << 3) /* Main On-Chip RC Oscillator Enable [some SAM9] */
63#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */
64#define AT91_PMC_KEY (0x37 << 16) /* MOR Writing Key */
65#define AT91_PMC_MOSCSEL (1 << 24) /* Main Oscillator Selection [some SAM9] */
66#define AT91_PMC_CFDEN (1 << 25) /* Clock Failure Detector Enable [some SAM9] */
53 67
54#define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */ 68#define AT91_CKGR_MCFR 0x24 /* Main Clock Frequency Register */
55#define AT91_PMC_MAINF (0xffff << 0) /* Main Clock Frequency */ 69#define AT91_PMC_MAINF (0xffff << 0) /* Main Clock Frequency */
56#define AT91_PMC_MAINRDY (1 << 16) /* Main Clock Ready */ 70#define AT91_PMC_MAINRDY (1 << 16) /* Main Clock Ready */
57 71
58#define AT91_CKGR_PLLAR (AT91_PMC + 0x28) /* PLL A Register */ 72#define AT91_CKGR_PLLAR 0x28 /* PLL A Register */
59#define AT91_CKGR_PLLBR (AT91_PMC + 0x2c) /* PLL B Register */ 73#define AT91_CKGR_PLLBR 0x2c /* PLL B Register */
60#define AT91_PMC_DIV (0xff << 0) /* Divider */ 74#define AT91_PMC_DIV (0xff << 0) /* Divider */
61#define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */ 75#define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */
62#define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */ 76#define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */
@@ -67,27 +81,37 @@
67#define AT91_PMC_USBDIV_4 (2 << 28) 81#define AT91_PMC_USBDIV_4 (2 << 28)
68#define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */ 82#define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */
69 83
70#define AT91_PMC_MCKR (AT91_PMC + 0x30) /* Master Clock Register */ 84#define AT91_PMC_MCKR 0x30 /* Master Clock Register */
71#define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */ 85#define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */
72#define AT91_PMC_CSS_SLOW (0 << 0) 86#define AT91_PMC_CSS_SLOW (0 << 0)
73#define AT91_PMC_CSS_MAIN (1 << 0) 87#define AT91_PMC_CSS_MAIN (1 << 0)
74#define AT91_PMC_CSS_PLLA (2 << 0) 88#define AT91_PMC_CSS_PLLA (2 << 0)
75#define AT91_PMC_CSS_PLLB (3 << 0) 89#define AT91_PMC_CSS_PLLB (3 << 0)
76#define AT91_PMC_CSS_UPLL (3 << 0) /* [some SAM9 only] */ 90#define AT91_PMC_CSS_UPLL (3 << 0) /* [some SAM9 only] */
77#define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */ 91#define PMC_PRES_OFFSET 2
78#define AT91_PMC_PRES_1 (0 << 2) 92#define AT91_PMC_PRES (7 << PMC_PRES_OFFSET) /* Master Clock Prescaler */
79#define AT91_PMC_PRES_2 (1 << 2) 93#define AT91_PMC_PRES_1 (0 << PMC_PRES_OFFSET)
80#define AT91_PMC_PRES_4 (2 << 2) 94#define AT91_PMC_PRES_2 (1 << PMC_PRES_OFFSET)
81#define AT91_PMC_PRES_8 (3 << 2) 95#define AT91_PMC_PRES_4 (2 << PMC_PRES_OFFSET)
82#define AT91_PMC_PRES_16 (4 << 2) 96#define AT91_PMC_PRES_8 (3 << PMC_PRES_OFFSET)
83#define AT91_PMC_PRES_32 (5 << 2) 97#define AT91_PMC_PRES_16 (4 << PMC_PRES_OFFSET)
84#define AT91_PMC_PRES_64 (6 << 2) 98#define AT91_PMC_PRES_32 (5 << PMC_PRES_OFFSET)
99#define AT91_PMC_PRES_64 (6 << PMC_PRES_OFFSET)
100#define PMC_ALT_PRES_OFFSET 4
101#define AT91_PMC_ALT_PRES (7 << PMC_ALT_PRES_OFFSET) /* Master Clock Prescaler [alternate location] */
102#define AT91_PMC_ALT_PRES_1 (0 << PMC_ALT_PRES_OFFSET)
103#define AT91_PMC_ALT_PRES_2 (1 << PMC_ALT_PRES_OFFSET)
104#define AT91_PMC_ALT_PRES_4 (2 << PMC_ALT_PRES_OFFSET)
105#define AT91_PMC_ALT_PRES_8 (3 << PMC_ALT_PRES_OFFSET)
106#define AT91_PMC_ALT_PRES_16 (4 << PMC_ALT_PRES_OFFSET)
107#define AT91_PMC_ALT_PRES_32 (5 << PMC_ALT_PRES_OFFSET)
108#define AT91_PMC_ALT_PRES_64 (6 << PMC_ALT_PRES_OFFSET)
85#define AT91_PMC_MDIV (3 << 8) /* Master Clock Division */ 109#define AT91_PMC_MDIV (3 << 8) /* Master Clock Division */
86#define AT91RM9200_PMC_MDIV_1 (0 << 8) /* [AT91RM9200 only] */ 110#define AT91RM9200_PMC_MDIV_1 (0 << 8) /* [AT91RM9200 only] */
87#define AT91RM9200_PMC_MDIV_2 (1 << 8) 111#define AT91RM9200_PMC_MDIV_2 (1 << 8)
88#define AT91RM9200_PMC_MDIV_3 (2 << 8) 112#define AT91RM9200_PMC_MDIV_3 (2 << 8)
89#define AT91RM9200_PMC_MDIV_4 (3 << 8) 113#define AT91RM9200_PMC_MDIV_4 (3 << 8)
90#define AT91SAM9_PMC_MDIV_1 (0 << 8) /* [SAM9,CAP9 only] */ 114#define AT91SAM9_PMC_MDIV_1 (0 << 8) /* [SAM9 only] */
91#define AT91SAM9_PMC_MDIV_2 (1 << 8) 115#define AT91SAM9_PMC_MDIV_2 (1 << 8)
92#define AT91SAM9_PMC_MDIV_4 (2 << 8) 116#define AT91SAM9_PMC_MDIV_4 (2 << 8)
93#define AT91SAM9_PMC_MDIV_6 (3 << 8) /* [some SAM9 only] */ 117#define AT91SAM9_PMC_MDIV_6 (3 << 8) /* [some SAM9 only] */
@@ -99,35 +123,55 @@
99#define AT91_PMC_PLLADIV2_OFF (0 << 12) 123#define AT91_PMC_PLLADIV2_OFF (0 << 12)
100#define AT91_PMC_PLLADIV2_ON (1 << 12) 124#define AT91_PMC_PLLADIV2_ON (1 << 12)
101 125
102#define AT91_PMC_USB (AT91_PMC + 0x38) /* USB Clock Register [some SAM9 only] */ 126#define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */
103#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */ 127#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */
104#define AT91_PMC_USBS_PLLA (0 << 0) 128#define AT91_PMC_USBS_PLLA (0 << 0)
105#define AT91_PMC_USBS_UPLL (1 << 0) 129#define AT91_PMC_USBS_UPLL (1 << 0)
106#define AT91_PMC_OHCIUSBDIV (0xF << 8) /* Divider for USB OHCI Clock */ 130#define AT91_PMC_OHCIUSBDIV (0xF << 8) /* Divider for USB OHCI Clock */
107 131
108#define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-N Registers */ 132#define AT91_PMC_SMD 0x3c /* Soft Modem Clock Register [some SAM9 only] */
133#define AT91_PMC_SMDS (0x1 << 0) /* SMD input clock selection */
134#define AT91_PMC_SMD_DIV (0x1f << 8) /* SMD input clock divider */
135#define AT91_PMC_SMDDIV(n) (((n) << 8) & AT91_PMC_SMD_DIV)
136
137#define AT91_PMC_PCKR(n) (0x40 + ((n) * 4)) /* Programmable Clock 0-N Registers */
138#define AT91_PMC_ALT_PCKR_CSS (0x7 << 0) /* Programmable Clock Source Selection [alternate length] */
139#define AT91_PMC_CSS_MASTER (4 << 0) /* [some SAM9 only] */
109#define AT91_PMC_CSSMCK (0x1 << 8) /* CSS or Master Clock Selection */ 140#define AT91_PMC_CSSMCK (0x1 << 8) /* CSS or Master Clock Selection */
110#define AT91_PMC_CSSMCK_CSS (0 << 8) 141#define AT91_PMC_CSSMCK_CSS (0 << 8)
111#define AT91_PMC_CSSMCK_MCK (1 << 8) 142#define AT91_PMC_CSSMCK_MCK (1 << 8)
112 143
113#define AT91_PMC_IER (AT91_PMC + 0x60) /* Interrupt Enable Register */ 144#define AT91_PMC_IER 0x60 /* Interrupt Enable Register */
114#define AT91_PMC_IDR (AT91_PMC + 0x64) /* Interrupt Disable Register */ 145#define AT91_PMC_IDR 0x64 /* Interrupt Disable Register */
115#define AT91_PMC_SR (AT91_PMC + 0x68) /* Status Register */ 146#define AT91_PMC_SR 0x68 /* Status Register */
116#define AT91_PMC_MOSCS (1 << 0) /* MOSCS Flag */ 147#define AT91_PMC_MOSCS (1 << 0) /* MOSCS Flag */
117#define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */ 148#define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */
118#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ 149#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
119#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */ 150#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
120#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9, AT91CAP9 only] */ 151#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9] */
121#define AT91_PMC_OSCSEL (1 << 7) /* Slow Clock Oscillator [AT91CAP9 revC only] */
122#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */ 152#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
123#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */ 153#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
124#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */ 154#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
125#define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */ 155#define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */
126#define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */ 156#define AT91_PMC_MOSCSELS (1 << 16) /* Main Oscillator Selection [some SAM9] */
157#define AT91_PMC_MOSCRCS (1 << 17) /* Main On-Chip RC [some SAM9] */
158#define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */
159#define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */
160
161#define AT91_PMC_PROT 0xe4 /* Write Protect Mode Register [some SAM9] */
162#define AT91_PMC_WPEN (0x1 << 0) /* Write Protect Enable */
163#define AT91_PMC_WPKEY (0xffffff << 8) /* Write Protect Key */
164#define AT91_PMC_PROTKEY (0x504d43 << 8) /* Activation Code */
127 165
128#define AT91_PMC_PROT (AT91_PMC + 0xe4) /* Protect Register [AT91CAP9 revC only] */ 166#define AT91_PMC_WPSR 0xe8 /* Write Protect Status Register [some SAM9] */
129#define AT91_PMC_PROTKEY 0x504d4301 /* Activation Code */ 167#define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */
168#define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */
130 169
131#define AT91_PMC_VER (AT91_PMC + 0xfc) /* PMC Module Version [AT91CAP9 only] */ 170#define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9] */
171#define AT91_PMC_PCR_PID (0x3f << 0) /* Peripheral ID */
172#define AT91_PMC_PCR_CMD (0x1 << 12) /* Command */
173#define AT91_PMC_PCR_DIV (0x3 << 16) /* Divisor Value */
174#define AT91_PMC_PCRDIV(n) (((n) << 16) & AT91_PMC_PCR_DIV)
175#define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */
132 176
133#endif 177#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_ramc.h b/arch/arm/mach-at91/include/mach/at91_ramc.h
new file mode 100644
index 00000000000..d8aeb278614
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_ramc.h
@@ -0,0 +1,32 @@
1/*
2 * Header file for the Atmel RAM Controller
3 *
4 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Under GPLv2 only
7 */
8
9#ifndef __AT91_RAMC_H__
10#define __AT91_RAMC_H__
11
12#ifndef __ASSEMBLY__
13extern void __iomem *at91_ramc_base[];
14
15#define at91_ramc_read(id, field) \
16 __raw_readl(at91_ramc_base[id] + field)
17
18#define at91_ramc_write(id, field, value) \
19 __raw_writel(value, at91_ramc_base[id] + field)
20#else
21.extern at91_ramc_base
22#endif
23
24#define AT91_MEMCTRL_MC 0
25#define AT91_MEMCTRL_SDRAMC 1
26#define AT91_MEMCTRL_DDRSDR 2
27
28#include <mach/at91rm9200_sdramc.h>
29#include <mach/at91sam9_ddrsdr.h>
30#include <mach/at91sam9_sdramc.h>
31
32#endif /* __AT91_RAMC_H__ */
diff --git a/arch/arm/mach-at91/include/mach/at91_st.h b/arch/arm/mach-at91/include/mach/at91_st.h
index 8847173e410..969aac27109 100644
--- a/arch/arm/mach-at91/include/mach/at91_st.h
+++ b/arch/arm/mach-at91/include/mach/at91_st.h
@@ -16,34 +16,46 @@
16#ifndef AT91_ST_H 16#ifndef AT91_ST_H
17#define AT91_ST_H 17#define AT91_ST_H
18 18
19#define AT91_ST_CR (AT91_ST + 0x00) /* Control Register */ 19#ifndef __ASSEMBLY__
20extern void __iomem *at91_st_base;
21
22#define at91_st_read(field) \
23 __raw_readl(at91_st_base + field)
24
25#define at91_st_write(field, value) \
26 __raw_writel(value, at91_st_base + field);
27#else
28.extern at91_st_base
29#endif
30
31#define AT91_ST_CR 0x00 /* Control Register */
20#define AT91_ST_WDRST (1 << 0) /* Watchdog Timer Restart */ 32#define AT91_ST_WDRST (1 << 0) /* Watchdog Timer Restart */
21 33
22#define AT91_ST_PIMR (AT91_ST + 0x04) /* Period Interval Mode Register */ 34#define AT91_ST_PIMR 0x04 /* Period Interval Mode Register */
23#define AT91_ST_PIV (0xffff << 0) /* Period Interval Value */ 35#define AT91_ST_PIV (0xffff << 0) /* Period Interval Value */
24 36
25#define AT91_ST_WDMR (AT91_ST + 0x08) /* Watchdog Mode Register */ 37#define AT91_ST_WDMR 0x08 /* Watchdog Mode Register */
26#define AT91_ST_WDV (0xffff << 0) /* Watchdog Counter Value */ 38#define AT91_ST_WDV (0xffff << 0) /* Watchdog Counter Value */
27#define AT91_ST_RSTEN (1 << 16) /* Reset Enable */ 39#define AT91_ST_RSTEN (1 << 16) /* Reset Enable */
28#define AT91_ST_EXTEN (1 << 17) /* External Signal Assertion Enable */ 40#define AT91_ST_EXTEN (1 << 17) /* External Signal Assertion Enable */
29 41
30#define AT91_ST_RTMR (AT91_ST + 0x0c) /* Real-time Mode Register */ 42#define AT91_ST_RTMR 0x0c /* Real-time Mode Register */
31#define AT91_ST_RTPRES (0xffff << 0) /* Real-time Prescalar Value */ 43#define AT91_ST_RTPRES (0xffff << 0) /* Real-time Prescalar Value */
32 44
33#define AT91_ST_SR (AT91_ST + 0x10) /* Status Register */ 45#define AT91_ST_SR 0x10 /* Status Register */
34#define AT91_ST_PITS (1 << 0) /* Period Interval Timer Status */ 46#define AT91_ST_PITS (1 << 0) /* Period Interval Timer Status */
35#define AT91_ST_WDOVF (1 << 1) /* Watchdog Overflow */ 47#define AT91_ST_WDOVF (1 << 1) /* Watchdog Overflow */
36#define AT91_ST_RTTINC (1 << 2) /* Real-time Timer Increment */ 48#define AT91_ST_RTTINC (1 << 2) /* Real-time Timer Increment */
37#define AT91_ST_ALMS (1 << 3) /* Alarm Status */ 49#define AT91_ST_ALMS (1 << 3) /* Alarm Status */
38 50
39#define AT91_ST_IER (AT91_ST + 0x14) /* Interrupt Enable Register */ 51#define AT91_ST_IER 0x14 /* Interrupt Enable Register */
40#define AT91_ST_IDR (AT91_ST + 0x18) /* Interrupt Disable Register */ 52#define AT91_ST_IDR 0x18 /* Interrupt Disable Register */
41#define AT91_ST_IMR (AT91_ST + 0x1c) /* Interrupt Mask Register */ 53#define AT91_ST_IMR 0x1c /* Interrupt Mask Register */
42 54
43#define AT91_ST_RTAR (AT91_ST + 0x20) /* Real-time Alarm Register */ 55#define AT91_ST_RTAR 0x20 /* Real-time Alarm Register */
44#define AT91_ST_ALMV (0xfffff << 0) /* Alarm Value */ 56#define AT91_ST_ALMV (0xfffff << 0) /* Alarm Value */
45 57
46#define AT91_ST_CRTR (AT91_ST + 0x24) /* Current Real-time Register */ 58#define AT91_ST_CRTR 0x24 /* Current Real-time Register */
47#define AT91_ST_CRTV (0xfffff << 0) /* Current Real-Time Value */ 59#define AT91_ST_CRTV (0xfffff << 0) /* Current Real-Time Value */
48 60
49#endif 61#endif
diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h
deleted file mode 100644
index 61d952902f2..00000000000
--- a/arch/arm/mach-at91/include/mach/at91cap9.h
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91cap9.h
3 *
4 * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com>
5 * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com>
6 * Copyright (C) 2007 Atmel Corporation.
7 *
8 * Common definitions.
9 * Based on AT91CAP9 datasheet revision B (Preliminary).
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 */
16
17#ifndef AT91CAP9_H
18#define AT91CAP9_H
19
20/*
21 * Peripheral identifiers/interrupts.
22 */
23#define AT91CAP9_ID_PIOABCD 2 /* Parallel IO Controller A, B, C and D */
24#define AT91CAP9_ID_MPB0 3 /* MP Block Peripheral 0 */
25#define AT91CAP9_ID_MPB1 4 /* MP Block Peripheral 1 */
26#define AT91CAP9_ID_MPB2 5 /* MP Block Peripheral 2 */
27#define AT91CAP9_ID_MPB3 6 /* MP Block Peripheral 3 */
28#define AT91CAP9_ID_MPB4 7 /* MP Block Peripheral 4 */
29#define AT91CAP9_ID_US0 8 /* USART 0 */
30#define AT91CAP9_ID_US1 9 /* USART 1 */
31#define AT91CAP9_ID_US2 10 /* USART 2 */
32#define AT91CAP9_ID_MCI0 11 /* Multimedia Card Interface 0 */
33#define AT91CAP9_ID_MCI1 12 /* Multimedia Card Interface 1 */
34#define AT91CAP9_ID_CAN 13 /* CAN */
35#define AT91CAP9_ID_TWI 14 /* Two-Wire Interface */
36#define AT91CAP9_ID_SPI0 15 /* Serial Peripheral Interface 0 */
37#define AT91CAP9_ID_SPI1 16 /* Serial Peripheral Interface 0 */
38#define AT91CAP9_ID_SSC0 17 /* Serial Synchronous Controller 0 */
39#define AT91CAP9_ID_SSC1 18 /* Serial Synchronous Controller 1 */
40#define AT91CAP9_ID_AC97C 19 /* AC97 Controller */
41#define AT91CAP9_ID_TCB 20 /* Timer Counter 0, 1 and 2 */
42#define AT91CAP9_ID_PWMC 21 /* Pulse Width Modulation Controller */
43#define AT91CAP9_ID_EMAC 22 /* Ethernet */
44#define AT91CAP9_ID_AESTDES 23 /* Advanced Encryption Standard, Triple DES */
45#define AT91CAP9_ID_ADC 24 /* Analog-to-Digital Converter */
46#define AT91CAP9_ID_ISI 25 /* Image Sensor Interface */
47#define AT91CAP9_ID_LCDC 26 /* LCD Controller */
48#define AT91CAP9_ID_DMA 27 /* DMA Controller */
49#define AT91CAP9_ID_UDPHS 28 /* USB High Speed Device Port */
50#define AT91CAP9_ID_UHP 29 /* USB Host Port */
51#define AT91CAP9_ID_IRQ0 30 /* Advanced Interrupt Controller (IRQ0) */
52#define AT91CAP9_ID_IRQ1 31 /* Advanced Interrupt Controller (IRQ1) */
53
54/*
55 * User Peripheral physical base addresses.
56 */
57#define AT91CAP9_BASE_UDPHS 0xfff78000
58#define AT91CAP9_BASE_TCB0 0xfff7c000
59#define AT91CAP9_BASE_TC0 0xfff7c000
60#define AT91CAP9_BASE_TC1 0xfff7c040
61#define AT91CAP9_BASE_TC2 0xfff7c080
62#define AT91CAP9_BASE_MCI0 0xfff80000
63#define AT91CAP9_BASE_MCI1 0xfff84000
64#define AT91CAP9_BASE_TWI 0xfff88000
65#define AT91CAP9_BASE_US0 0xfff8c000
66#define AT91CAP9_BASE_US1 0xfff90000
67#define AT91CAP9_BASE_US2 0xfff94000
68#define AT91CAP9_BASE_SSC0 0xfff98000
69#define AT91CAP9_BASE_SSC1 0xfff9c000
70#define AT91CAP9_BASE_AC97C 0xfffa0000
71#define AT91CAP9_BASE_SPI0 0xfffa4000
72#define AT91CAP9_BASE_SPI1 0xfffa8000
73#define AT91CAP9_BASE_CAN 0xfffac000
74#define AT91CAP9_BASE_PWMC 0xfffb8000
75#define AT91CAP9_BASE_EMAC 0xfffbc000
76#define AT91CAP9_BASE_ADC 0xfffc0000
77#define AT91CAP9_BASE_ISI 0xfffc4000
78
79/*
80 * System Peripherals (offset from AT91_BASE_SYS)
81 */
82#define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS)
83#define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS)
84#define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS)
85#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
86#define AT91_GPBR (cpu_is_at91cap9_revB() ? \
87 (0xfffffd50 - AT91_BASE_SYS) : \
88 (0xfffffd60 - AT91_BASE_SYS))
89
90#define AT91CAP9_BASE_ECC 0xffffe200
91#define AT91CAP9_BASE_DMA 0xffffec00
92#define AT91CAP9_BASE_SMC 0xffffe800
93#define AT91CAP9_BASE_DBGU AT91_BASE_DBGU1
94#define AT91CAP9_BASE_PIOA 0xfffff200
95#define AT91CAP9_BASE_PIOB 0xfffff400
96#define AT91CAP9_BASE_PIOC 0xfffff600
97#define AT91CAP9_BASE_PIOD 0xfffff800
98#define AT91CAP9_BASE_RSTC 0xfffffd00
99#define AT91CAP9_BASE_SHDWC 0xfffffd10
100#define AT91CAP9_BASE_RTT 0xfffffd20
101#define AT91CAP9_BASE_PIT 0xfffffd30
102#define AT91CAP9_BASE_WDT 0xfffffd40
103
104#define AT91_USART0 AT91CAP9_BASE_US0
105#define AT91_USART1 AT91CAP9_BASE_US1
106#define AT91_USART2 AT91CAP9_BASE_US2
107
108
109/*
110 * Internal Memory.
111 */
112#define AT91CAP9_SRAM_BASE 0x00100000 /* Internal SRAM base address */
113#define AT91CAP9_SRAM_SIZE (32 * SZ_1K) /* Internal SRAM size (32Kb) */
114
115#define AT91CAP9_ROM_BASE 0x00400000 /* Internal ROM base address */
116#define AT91CAP9_ROM_SIZE (32 * SZ_1K) /* Internal ROM size (32Kb) */
117
118#define AT91CAP9_LCDC_BASE 0x00500000 /* LCD Controller */
119#define AT91CAP9_UDPHS_FIFO 0x00600000 /* USB High Speed Device Port */
120#define AT91CAP9_UHP_BASE 0x00700000 /* USB Host controller */
121
122#endif
diff --git a/arch/arm/mach-at91/include/mach/at91cap9_matrix.h b/arch/arm/mach-at91/include/mach/at91cap9_matrix.h
deleted file mode 100644
index 4b9d4aff4b4..00000000000
--- a/arch/arm/mach-at91/include/mach/at91cap9_matrix.h
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91cap9_matrix.h
3 *
4 * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com>
5 * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com>
6 * Copyright (C) 2006 Atmel Corporation.
7 *
8 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
9 * Based on AT91CAP9 datasheet revision B (Preliminary).
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 */
16
17#ifndef AT91CAP9_MATRIX_H
18#define AT91CAP9_MATRIX_H
19
20#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */
21#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */
22#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */
23#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */
24#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */
25#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */
26#define AT91_MATRIX_MCFG6 (AT91_MATRIX + 0x18) /* Master Configuration Register 6 */
27#define AT91_MATRIX_MCFG7 (AT91_MATRIX + 0x1C) /* Master Configuration Register 7 */
28#define AT91_MATRIX_MCFG8 (AT91_MATRIX + 0x20) /* Master Configuration Register 8 */
29#define AT91_MATRIX_MCFG9 (AT91_MATRIX + 0x24) /* Master Configuration Register 9 */
30#define AT91_MATRIX_MCFG10 (AT91_MATRIX + 0x28) /* Master Configuration Register 10 */
31#define AT91_MATRIX_MCFG11 (AT91_MATRIX + 0x2C) /* Master Configuration Register 11 */
32#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
33#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
34#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
35#define AT91_MATRIX_ULBT_FOUR (2 << 0)
36#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
37#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
38
39#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */
40#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */
41#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */
42#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */
43#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */
44#define AT91_MATRIX_SCFG5 (AT91_MATRIX + 0x54) /* Slave Configuration Register 5 */
45#define AT91_MATRIX_SCFG6 (AT91_MATRIX + 0x58) /* Slave Configuration Register 6 */
46#define AT91_MATRIX_SCFG7 (AT91_MATRIX + 0x5C) /* Slave Configuration Register 7 */
47#define AT91_MATRIX_SCFG8 (AT91_MATRIX + 0x60) /* Slave Configuration Register 8 */
48#define AT91_MATRIX_SCFG9 (AT91_MATRIX + 0x64) /* Slave Configuration Register 9 */
49#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
50#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
51#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
52#define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16)
53#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
54#define AT91_MATRIX_FIXED_DEFMSTR (0xf << 18) /* Fixed Index of Default Master */
55#define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */
56#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
57#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
58
59#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */
60#define AT91_MATRIX_PRBS0 (AT91_MATRIX + 0x84) /* Priority Register B for Slave 0 */
61#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */
62#define AT91_MATRIX_PRBS1 (AT91_MATRIX + 0x8C) /* Priority Register B for Slave 1 */
63#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */
64#define AT91_MATRIX_PRBS2 (AT91_MATRIX + 0x94) /* Priority Register B for Slave 2 */
65#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */
66#define AT91_MATRIX_PRBS3 (AT91_MATRIX + 0x9C) /* Priority Register B for Slave 3 */
67#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */
68#define AT91_MATRIX_PRBS4 (AT91_MATRIX + 0xA4) /* Priority Register B for Slave 4 */
69#define AT91_MATRIX_PRAS5 (AT91_MATRIX + 0xA8) /* Priority Register A for Slave 5 */
70#define AT91_MATRIX_PRBS5 (AT91_MATRIX + 0xAC) /* Priority Register B for Slave 5 */
71#define AT91_MATRIX_PRAS6 (AT91_MATRIX + 0xB0) /* Priority Register A for Slave 6 */
72#define AT91_MATRIX_PRBS6 (AT91_MATRIX + 0xB4) /* Priority Register B for Slave 6 */
73#define AT91_MATRIX_PRAS7 (AT91_MATRIX + 0xB8) /* Priority Register A for Slave 7 */
74#define AT91_MATRIX_PRBS7 (AT91_MATRIX + 0xBC) /* Priority Register B for Slave 7 */
75#define AT91_MATRIX_PRAS8 (AT91_MATRIX + 0xC0) /* Priority Register A for Slave 8 */
76#define AT91_MATRIX_PRBS8 (AT91_MATRIX + 0xC4) /* Priority Register B for Slave 8 */
77#define AT91_MATRIX_PRAS9 (AT91_MATRIX + 0xC8) /* Priority Register A for Slave 9 */
78#define AT91_MATRIX_PRBS9 (AT91_MATRIX + 0xCC) /* Priority Register B for Slave 9 */
79#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
80#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
81#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
82#define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */
83#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */
84#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */
85#define AT91_MATRIX_M6PR (3 << 24) /* Master 6 Priority */
86#define AT91_MATRIX_M7PR (3 << 28) /* Master 7 Priority */
87#define AT91_MATRIX_M8PR (3 << 0) /* Master 8 Priority (in Register B) */
88#define AT91_MATRIX_M9PR (3 << 4) /* Master 9 Priority (in Register B) */
89#define AT91_MATRIX_M10PR (3 << 8) /* Master 10 Priority (in Register B) */
90#define AT91_MATRIX_M11PR (3 << 12) /* Master 11 Priority (in Register B) */
91
92#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */
93#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
94#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
95#define AT91_MATRIX_RCB2 (1 << 2)
96#define AT91_MATRIX_RCB3 (1 << 3)
97#define AT91_MATRIX_RCB4 (1 << 4)
98#define AT91_MATRIX_RCB5 (1 << 5)
99#define AT91_MATRIX_RCB6 (1 << 6)
100#define AT91_MATRIX_RCB7 (1 << 7)
101#define AT91_MATRIX_RCB8 (1 << 8)
102#define AT91_MATRIX_RCB9 (1 << 9)
103#define AT91_MATRIX_RCB10 (1 << 10)
104#define AT91_MATRIX_RCB11 (1 << 11)
105
106#define AT91_MPBS0_SFR (AT91_MATRIX + 0x114) /* MPBlock Slave 0 Special Function Register */
107#define AT91_MPBS1_SFR (AT91_MATRIX + 0x11C) /* MPBlock Slave 1 Special Function Register */
108
109#define AT91_MATRIX_UDPHS (AT91_MATRIX + 0x118) /* USBHS Special Function Register [AT91CAP9 only] */
110#define AT91_MATRIX_SELECT_UDPHS (0 << 31) /* select High Speed UDP */
111#define AT91_MATRIX_SELECT_UDP (1 << 31) /* select standard UDP */
112#define AT91_MATRIX_UDPHS_BYPASS_LOCK (1 << 30) /* bypass lock bit */
113
114#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x120) /* EBI Chip Select Assignment Register */
115#define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
116#define AT91_MATRIX_EBI_CS1A_SMC (0 << 1)
117#define AT91_MATRIX_EBI_CS1A_BCRAMC (1 << 1)
118#define AT91_MATRIX_EBI_CS3A (1 << 3) /* Chip Select 3 Assignment */
119#define AT91_MATRIX_EBI_CS3A_SMC (0 << 3)
120#define AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA (1 << 3)
121#define AT91_MATRIX_EBI_CS4A (1 << 4) /* Chip Select 4 Assignment */
122#define AT91_MATRIX_EBI_CS4A_SMC (0 << 4)
123#define AT91_MATRIX_EBI_CS4A_SMC_CF1 (1 << 4)
124#define AT91_MATRIX_EBI_CS5A (1 << 5) /* Chip Select 5 Assignment */
125#define AT91_MATRIX_EBI_CS5A_SMC (0 << 5)
126#define AT91_MATRIX_EBI_CS5A_SMC_CF2 (1 << 5)
127#define AT91_MATRIX_EBI_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
128#define AT91_MATRIX_EBI_DQSPDC (1 << 9) /* Data Qualifier Strobe Pull-Down Configuration */
129#define AT91_MATRIX_EBI_VDDIOMSEL (1 << 16) /* Memory voltage selection */
130#define AT91_MATRIX_EBI_VDDIOMSEL_1_8V (0 << 16)
131#define AT91_MATRIX_EBI_VDDIOMSEL_3_3V (1 << 16)
132
133#define AT91_MPBS2_SFR (AT91_MATRIX + 0x12C) /* MPBlock Slave 2 Special Function Register */
134#define AT91_MPBS3_SFR (AT91_MATRIX + 0x130) /* MPBlock Slave 3 Special Function Register */
135#define AT91_APB_SFR (AT91_MATRIX + 0x134) /* APB Bridge Special Function Register */
136
137#endif
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h b/arch/arm/mach-at91/include/mach/at91rm9200.h
index bacb5114181..603e6aac2a4 100644
--- a/arch/arm/mach-at91/include/mach/at91rm9200.h
+++ b/arch/arm/mach-at91/include/mach/at91rm9200.h
@@ -77,26 +77,22 @@
77 77
78 78
79/* 79/*
80 * System Peripherals (offset from AT91_BASE_SYS) 80 * System Peripherals
81 */ 81 */
82#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) /* Power Management Controller */
83#define AT91_ST (0xfffffd00 - AT91_BASE_SYS) /* System Timer */
84#define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */
85
86#define AT91RM9200_BASE_DBGU AT91_BASE_DBGU0 /* Debug Unit */ 82#define AT91RM9200_BASE_DBGU AT91_BASE_DBGU0 /* Debug Unit */
87#define AT91RM9200_BASE_PIOA 0xfffff400 /* PIO Controller A */ 83#define AT91RM9200_BASE_PIOA 0xfffff400 /* PIO Controller A */
88#define AT91RM9200_BASE_PIOB 0xfffff600 /* PIO Controller B */ 84#define AT91RM9200_BASE_PIOB 0xfffff600 /* PIO Controller B */
89#define AT91RM9200_BASE_PIOC 0xfffff800 /* PIO Controller C */ 85#define AT91RM9200_BASE_PIOC 0xfffff800 /* PIO Controller C */
90#define AT91RM9200_BASE_PIOD 0xfffffa00 /* PIO Controller D */ 86#define AT91RM9200_BASE_PIOD 0xfffffa00 /* PIO Controller D */
87#define AT91RM9200_BASE_ST 0xfffffd00 /* System Timer */
91#define AT91RM9200_BASE_RTC 0xfffffe00 /* Real-Time Clock */ 88#define AT91RM9200_BASE_RTC 0xfffffe00 /* Real-Time Clock */
89#define AT91RM9200_BASE_MC 0xffffff00 /* Memory Controllers */
92 90
93#define AT91_USART0 AT91RM9200_BASE_US0 91#define AT91_USART0 AT91RM9200_BASE_US0
94#define AT91_USART1 AT91RM9200_BASE_US1 92#define AT91_USART1 AT91RM9200_BASE_US1
95#define AT91_USART2 AT91RM9200_BASE_US2 93#define AT91_USART2 AT91RM9200_BASE_US2
96#define AT91_USART3 AT91RM9200_BASE_US3 94#define AT91_USART3 AT91RM9200_BASE_US3
97 95
98#define AT91_MATRIX 0 /* not supported */
99
100/* 96/*
101 * Internal Memory. 97 * Internal Memory.
102 */ 98 */
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200_mc.h b/arch/arm/mach-at91/include/mach/at91rm9200_mc.h
index d34e4ed8934..aeaadfb452a 100644
--- a/arch/arm/mach-at91/include/mach/at91rm9200_mc.h
+++ b/arch/arm/mach-at91/include/mach/at91rm9200_mc.h
@@ -17,10 +17,10 @@
17#define AT91RM9200_MC_H 17#define AT91RM9200_MC_H
18 18
19/* Memory Controller */ 19/* Memory Controller */
20#define AT91_MC_RCR (AT91_MC + 0x00) /* MC Remap Control Register */ 20#define AT91_MC_RCR 0x00 /* MC Remap Control Register */
21#define AT91_MC_RCB (1 << 0) /* Remap Command Bit */ 21#define AT91_MC_RCB (1 << 0) /* Remap Command Bit */
22 22
23#define AT91_MC_ASR (AT91_MC + 0x04) /* MC Abort Status Register */ 23#define AT91_MC_ASR 0x04 /* MC Abort Status Register */
24#define AT91_MC_UNADD (1 << 0) /* Undefined Address Abort Status */ 24#define AT91_MC_UNADD (1 << 0) /* Undefined Address Abort Status */
25#define AT91_MC_MISADD (1 << 1) /* Misaligned Address Abort Status */ 25#define AT91_MC_MISADD (1 << 1) /* Misaligned Address Abort Status */
26#define AT91_MC_ABTSZ (3 << 8) /* Abort Size Status */ 26#define AT91_MC_ABTSZ (3 << 8) /* Abort Size Status */
@@ -40,16 +40,16 @@
40#define AT91_MC_SVMST2 (1 << 26) /* Saved UHP Abort Source */ 40#define AT91_MC_SVMST2 (1 << 26) /* Saved UHP Abort Source */
41#define AT91_MC_SVMST3 (1 << 27) /* Saved EMAC Abort Source */ 41#define AT91_MC_SVMST3 (1 << 27) /* Saved EMAC Abort Source */
42 42
43#define AT91_MC_AASR (AT91_MC + 0x08) /* MC Abort Address Status Register */ 43#define AT91_MC_AASR 0x08 /* MC Abort Address Status Register */
44 44
45#define AT91_MC_MPR (AT91_MC + 0x0c) /* MC Master Priority Register */ 45#define AT91_MC_MPR 0x0c /* MC Master Priority Register */
46#define AT91_MPR_MSTP0 (7 << 0) /* ARM920T Priority */ 46#define AT91_MPR_MSTP0 (7 << 0) /* ARM920T Priority */
47#define AT91_MPR_MSTP1 (7 << 4) /* PDC Priority */ 47#define AT91_MPR_MSTP1 (7 << 4) /* PDC Priority */
48#define AT91_MPR_MSTP2 (7 << 8) /* UHP Priority */ 48#define AT91_MPR_MSTP2 (7 << 8) /* UHP Priority */
49#define AT91_MPR_MSTP3 (7 << 12) /* EMAC Priority */ 49#define AT91_MPR_MSTP3 (7 << 12) /* EMAC Priority */
50 50
51/* External Bus Interface (EBI) registers */ 51/* External Bus Interface (EBI) registers */
52#define AT91_EBI_CSA (AT91_MC + 0x60) /* Chip Select Assignment Register */ 52#define AT91_EBI_CSA 0x60 /* Chip Select Assignment Register */
53#define AT91_EBI_CS0A (1 << 0) /* Chip Select 0 Assignment */ 53#define AT91_EBI_CS0A (1 << 0) /* Chip Select 0 Assignment */
54#define AT91_EBI_CS0A_SMC (0 << 0) 54#define AT91_EBI_CS0A_SMC (0 << 0)
55#define AT91_EBI_CS0A_BFC (1 << 0) 55#define AT91_EBI_CS0A_BFC (1 << 0)
@@ -66,7 +66,7 @@
66#define AT91_EBI_DBPUC (1 << 0) /* Data Bus Pull-Up Configuration */ 66#define AT91_EBI_DBPUC (1 << 0) /* Data Bus Pull-Up Configuration */
67 67
68/* Static Memory Controller (SMC) registers */ 68/* Static Memory Controller (SMC) registers */
69#define AT91_SMC_CSR(n) (AT91_MC + 0x70 + ((n) * 4))/* SMC Chip Select Register */ 69#define AT91_SMC_CSR(n) (0x70 + ((n) * 4)) /* SMC Chip Select Register */
70#define AT91_SMC_NWS (0x7f << 0) /* Number of Wait States */ 70#define AT91_SMC_NWS (0x7f << 0) /* Number of Wait States */
71#define AT91_SMC_NWS_(x) ((x) << 0) 71#define AT91_SMC_NWS_(x) ((x) << 0)
72#define AT91_SMC_WSEN (1 << 7) /* Wait State Enable */ 72#define AT91_SMC_WSEN (1 << 7) /* Wait State Enable */
@@ -87,52 +87,8 @@
87#define AT91_SMC_RWHOLD (7 << 28) /* Read & Write Signal Hold Time */ 87#define AT91_SMC_RWHOLD (7 << 28) /* Read & Write Signal Hold Time */
88#define AT91_SMC_RWHOLD_(x) ((x) << 28) 88#define AT91_SMC_RWHOLD_(x) ((x) << 28)
89 89
90/* SDRAM Controller registers */
91#define AT91_SDRAMC_MR (AT91_MC + 0x90) /* Mode Register */
92#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
93#define AT91_SDRAMC_MODE_NORMAL (0 << 0)
94#define AT91_SDRAMC_MODE_NOP (1 << 0)
95#define AT91_SDRAMC_MODE_PRECHARGE (2 << 0)
96#define AT91_SDRAMC_MODE_LMR (3 << 0)
97#define AT91_SDRAMC_MODE_REFRESH (4 << 0)
98#define AT91_SDRAMC_DBW (1 << 4) /* Data Bus Width */
99#define AT91_SDRAMC_DBW_32 (0 << 4)
100#define AT91_SDRAMC_DBW_16 (1 << 4)
101
102#define AT91_SDRAMC_TR (AT91_MC + 0x94) /* Refresh Timer Register */
103#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Count */
104
105#define AT91_SDRAMC_CR (AT91_MC + 0x98) /* Configuration Register */
106#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
107#define AT91_SDRAMC_NC_8 (0 << 0)
108#define AT91_SDRAMC_NC_9 (1 << 0)
109#define AT91_SDRAMC_NC_10 (2 << 0)
110#define AT91_SDRAMC_NC_11 (3 << 0)
111#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
112#define AT91_SDRAMC_NR_11 (0 << 2)
113#define AT91_SDRAMC_NR_12 (1 << 2)
114#define AT91_SDRAMC_NR_13 (2 << 2)
115#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
116#define AT91_SDRAMC_NB_2 (0 << 4)
117#define AT91_SDRAMC_NB_4 (1 << 4)
118#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
119#define AT91_SDRAMC_CAS_2 (2 << 5)
120#define AT91_SDRAMC_TWR (0xf << 7) /* Write Recovery Delay */
121#define AT91_SDRAMC_TRC (0xf << 11) /* Row Cycle Delay */
122#define AT91_SDRAMC_TRP (0xf << 15) /* Row Precharge Delay */
123#define AT91_SDRAMC_TRCD (0xf << 19) /* Row to Column Delay */
124#define AT91_SDRAMC_TRAS (0xf << 23) /* Active to Precharge Delay */
125#define AT91_SDRAMC_TXSR (0xf << 27) /* Exit Self Refresh to Active Delay */
126
127#define AT91_SDRAMC_SRR (AT91_MC + 0x9c) /* Self Refresh Register */
128#define AT91_SDRAMC_LPR (AT91_MC + 0xa0) /* Low Power Register */
129#define AT91_SDRAMC_IER (AT91_MC + 0xa4) /* Interrupt Enable Register */
130#define AT91_SDRAMC_IDR (AT91_MC + 0xa8) /* Interrupt Disable Register */
131#define AT91_SDRAMC_IMR (AT91_MC + 0xac) /* Interrupt Mask Register */
132#define AT91_SDRAMC_ISR (AT91_MC + 0xb0) /* Interrupt Status Register */
133
134/* Burst Flash Controller register */ 90/* Burst Flash Controller register */
135#define AT91_BFC_MR (AT91_MC + 0xc0) /* Mode Register */ 91#define AT91_BFC_MR 0xc0 /* Mode Register */
136#define AT91_BFC_BFCOM (3 << 0) /* Burst Flash Controller Operating Mode */ 92#define AT91_BFC_BFCOM (3 << 0) /* Burst Flash Controller Operating Mode */
137#define AT91_BFC_BFCOM_DISABLED (0 << 0) 93#define AT91_BFC_BFCOM_DISABLED (0 << 0)
138#define AT91_BFC_BFCOM_ASYNC (1 << 0) 94#define AT91_BFC_BFCOM_ASYNC (1 << 0)
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h b/arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h
new file mode 100644
index 00000000000..aa047f458f1
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h
@@ -0,0 +1,63 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Memory Controllers (SDRAMC only) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_SDRAMC_H
17#define AT91RM9200_SDRAMC_H
18
19/* SDRAM Controller registers */
20#define AT91RM9200_SDRAMC_MR 0x90 /* Mode Register */
21#define AT91RM9200_SDRAMC_MODE (0xf << 0) /* Command Mode */
22#define AT91RM9200_SDRAMC_MODE_NORMAL (0 << 0)
23#define AT91RM9200_SDRAMC_MODE_NOP (1 << 0)
24#define AT91RM9200_SDRAMC_MODE_PRECHARGE (2 << 0)
25#define AT91RM9200_SDRAMC_MODE_LMR (3 << 0)
26#define AT91RM9200_SDRAMC_MODE_REFRESH (4 << 0)
27#define AT91RM9200_SDRAMC_DBW (1 << 4) /* Data Bus Width */
28#define AT91RM9200_SDRAMC_DBW_32 (0 << 4)
29#define AT91RM9200_SDRAMC_DBW_16 (1 << 4)
30
31#define AT91RM9200_SDRAMC_TR 0x94 /* Refresh Timer Register */
32#define AT91RM9200_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Count */
33
34#define AT91RM9200_SDRAMC_CR 0x98 /* Configuration Register */
35#define AT91RM9200_SDRAMC_NC (3 << 0) /* Number of Column Bits */
36#define AT91RM9200_SDRAMC_NC_8 (0 << 0)
37#define AT91RM9200_SDRAMC_NC_9 (1 << 0)
38#define AT91RM9200_SDRAMC_NC_10 (2 << 0)
39#define AT91RM9200_SDRAMC_NC_11 (3 << 0)
40#define AT91RM9200_SDRAMC_NR (3 << 2) /* Number of Row Bits */
41#define AT91RM9200_SDRAMC_NR_11 (0 << 2)
42#define AT91RM9200_SDRAMC_NR_12 (1 << 2)
43#define AT91RM9200_SDRAMC_NR_13 (2 << 2)
44#define AT91RM9200_SDRAMC_NB (1 << 4) /* Number of Banks */
45#define AT91RM9200_SDRAMC_NB_2 (0 << 4)
46#define AT91RM9200_SDRAMC_NB_4 (1 << 4)
47#define AT91RM9200_SDRAMC_CAS (3 << 5) /* CAS Latency */
48#define AT91RM9200_SDRAMC_CAS_2 (2 << 5)
49#define AT91RM9200_SDRAMC_TWR (0xf << 7) /* Write Recovery Delay */
50#define AT91RM9200_SDRAMC_TRC (0xf << 11) /* Row Cycle Delay */
51#define AT91RM9200_SDRAMC_TRP (0xf << 15) /* Row Precharge Delay */
52#define AT91RM9200_SDRAMC_TRCD (0xf << 19) /* Row to Column Delay */
53#define AT91RM9200_SDRAMC_TRAS (0xf << 23) /* Active to Precharge Delay */
54#define AT91RM9200_SDRAMC_TXSR (0xf << 27) /* Exit Self Refresh to Active Delay */
55
56#define AT91RM9200_SDRAMC_SRR 0x9c /* Self Refresh Register */
57#define AT91RM9200_SDRAMC_LPR 0xa0 /* Low Power Register */
58#define AT91RM9200_SDRAMC_IER 0xa4 /* Interrupt Enable Register */
59#define AT91RM9200_SDRAMC_IDR 0xa8 /* Interrupt Disable Register */
60#define AT91RM9200_SDRAMC_IMR 0xac /* Interrupt Mask Register */
61#define AT91RM9200_SDRAMC_ISR 0xb0 /* Interrupt Status Register */
62
63#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h
index fa5ca278ade..08ae9afd00f 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260.h
@@ -78,15 +78,12 @@
78#define AT91SAM9260_BASE_ADC 0xfffe0000 78#define AT91SAM9260_BASE_ADC 0xfffe0000
79 79
80/* 80/*
81 * System Peripherals (offset from AT91_BASE_SYS) 81 * System Peripherals
82 */ 82 */
83#define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS)
84#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
85#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
86#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS)
87
88#define AT91SAM9260_BASE_ECC 0xffffe800 83#define AT91SAM9260_BASE_ECC 0xffffe800
84#define AT91SAM9260_BASE_SDRAMC 0xffffea00
89#define AT91SAM9260_BASE_SMC 0xffffec00 85#define AT91SAM9260_BASE_SMC 0xffffec00
86#define AT91SAM9260_BASE_MATRIX 0xffffee00
90#define AT91SAM9260_BASE_DBGU AT91_BASE_DBGU0 87#define AT91SAM9260_BASE_DBGU AT91_BASE_DBGU0
91#define AT91SAM9260_BASE_PIOA 0xfffff400 88#define AT91SAM9260_BASE_PIOA 0xfffff400
92#define AT91SAM9260_BASE_PIOB 0xfffff600 89#define AT91SAM9260_BASE_PIOB 0xfffff600
@@ -96,6 +93,7 @@
96#define AT91SAM9260_BASE_RTT 0xfffffd20 93#define AT91SAM9260_BASE_RTT 0xfffffd20
97#define AT91SAM9260_BASE_PIT 0xfffffd30 94#define AT91SAM9260_BASE_PIT 0xfffffd30
98#define AT91SAM9260_BASE_WDT 0xfffffd40 95#define AT91SAM9260_BASE_WDT 0xfffffd40
96#define AT91SAM9260_BASE_GPBR 0xfffffd50
99 97
100#define AT91_USART0 AT91SAM9260_BASE_US0 98#define AT91_USART0 AT91SAM9260_BASE_US0
101#define AT91_USART1 AT91SAM9260_BASE_US1 99#define AT91_USART1 AT91SAM9260_BASE_US1
@@ -115,6 +113,8 @@
115#define AT91SAM9260_SRAM0_SIZE SZ_4K /* Internal SRAM 0 size (4Kb) */ 113#define AT91SAM9260_SRAM0_SIZE SZ_4K /* Internal SRAM 0 size (4Kb) */
116#define AT91SAM9260_SRAM1_BASE 0x00300000 /* Internal SRAM 1 base address */ 114#define AT91SAM9260_SRAM1_BASE 0x00300000 /* Internal SRAM 1 base address */
117#define AT91SAM9260_SRAM1_SIZE SZ_4K /* Internal SRAM 1 size (4Kb) */ 115#define AT91SAM9260_SRAM1_SIZE SZ_4K /* Internal SRAM 1 size (4Kb) */
116#define AT91SAM9260_SRAM_BASE 0x002FF000 /* Internal SRAM base address */
117#define AT91SAM9260_SRAM_SIZE SZ_8K /* Internal SRAM size (8Kb) */
118 118
119#define AT91SAM9260_UHP_BASE 0x00500000 /* USB Host controller */ 119#define AT91SAM9260_UHP_BASE 0x00500000 /* USB Host controller */
120 120
@@ -128,6 +128,8 @@
128#define AT91SAM9G20_SRAM0_SIZE SZ_16K /* Internal SRAM 0 size (16Kb) */ 128#define AT91SAM9G20_SRAM0_SIZE SZ_16K /* Internal SRAM 0 size (16Kb) */
129#define AT91SAM9G20_SRAM1_BASE 0x00300000 /* Internal SRAM 1 base address */ 129#define AT91SAM9G20_SRAM1_BASE 0x00300000 /* Internal SRAM 1 base address */
130#define AT91SAM9G20_SRAM1_SIZE SZ_16K /* Internal SRAM 1 size (16Kb) */ 130#define AT91SAM9G20_SRAM1_SIZE SZ_16K /* Internal SRAM 1 size (16Kb) */
131#define AT91SAM9G20_SRAM_BASE 0x002FC000 /* Internal SRAM base address */
132#define AT91SAM9G20_SRAM_SIZE SZ_32K /* Internal SRAM size (32Kb) */
131 133
132#define AT91SAM9G20_UHP_BASE 0x00500000 /* USB Host controller */ 134#define AT91SAM9G20_UHP_BASE 0x00500000 /* USB Host controller */
133 135
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
index 020f02ed921..f459df42062 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
@@ -15,12 +15,12 @@
15#ifndef AT91SAM9260_MATRIX_H 15#ifndef AT91SAM9260_MATRIX_H
16#define AT91SAM9260_MATRIX_H 16#define AT91SAM9260_MATRIX_H
17 17
18#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */ 18#define AT91_MATRIX_MCFG0 0x00 /* Master Configuration Register 0 */
19#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */ 19#define AT91_MATRIX_MCFG1 0x04 /* Master Configuration Register 1 */
20#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */ 20#define AT91_MATRIX_MCFG2 0x08 /* Master Configuration Register 2 */
21#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */ 21#define AT91_MATRIX_MCFG3 0x0C /* Master Configuration Register 3 */
22#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */ 22#define AT91_MATRIX_MCFG4 0x10 /* Master Configuration Register 4 */
23#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */ 23#define AT91_MATRIX_MCFG5 0x14 /* Master Configuration Register 5 */
24#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */ 24#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
25#define AT91_MATRIX_ULBT_INFINITE (0 << 0) 25#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
26#define AT91_MATRIX_ULBT_SINGLE (1 << 0) 26#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
@@ -28,11 +28,11 @@
28#define AT91_MATRIX_ULBT_EIGHT (3 << 0) 28#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
29#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0) 29#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
30 30
31#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */ 31#define AT91_MATRIX_SCFG0 0x40 /* Slave Configuration Register 0 */
32#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */ 32#define AT91_MATRIX_SCFG1 0x44 /* Slave Configuration Register 1 */
33#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */ 33#define AT91_MATRIX_SCFG2 0x48 /* Slave Configuration Register 2 */
34#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */ 34#define AT91_MATRIX_SCFG3 0x4C /* Slave Configuration Register 3 */
35#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */ 35#define AT91_MATRIX_SCFG4 0x50 /* Slave Configuration Register 4 */
36#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */ 36#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
37#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ 37#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
38#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) 38#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
@@ -43,11 +43,11 @@
43#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24) 43#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
44#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24) 44#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
45 45
46#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */ 46#define AT91_MATRIX_PRAS0 0x80 /* Priority Register A for Slave 0 */
47#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */ 47#define AT91_MATRIX_PRAS1 0x88 /* Priority Register A for Slave 1 */
48#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */ 48#define AT91_MATRIX_PRAS2 0x90 /* Priority Register A for Slave 2 */
49#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */ 49#define AT91_MATRIX_PRAS3 0x98 /* Priority Register A for Slave 3 */
50#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */ 50#define AT91_MATRIX_PRAS4 0xA0 /* Priority Register A for Slave 4 */
51#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */ 51#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
52#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */ 52#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
53#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */ 53#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
@@ -55,11 +55,11 @@
55#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */ 55#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */
56#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */ 56#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */
57 57
58#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */ 58#define AT91_MATRIX_MRCR 0x100 /* Master Remap Control Register */
59#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 59#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
60#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 60#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
61 61
62#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x11C) /* EBI Chip Select Assignment Register */ 62#define AT91_MATRIX_EBICSA 0x11C /* EBI Chip Select Assignment Register */
63#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */ 63#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
64#define AT91_MATRIX_CS1A_SMC (0 << 1) 64#define AT91_MATRIX_CS1A_SMC (0 << 1)
65#define AT91_MATRIX_CS1A_SDRAMC (1 << 1) 65#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h
index 7cde2d36570..44fbdc12ee6 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261.h
@@ -63,14 +63,11 @@
63 63
64 64
65/* 65/*
66 * System Peripherals (offset from AT91_BASE_SYS) 66 * System Peripherals
67 */ 67 */
68#define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS)
69#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
70#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
71#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS)
72
73#define AT91SAM9261_BASE_SMC 0xffffec00 68#define AT91SAM9261_BASE_SMC 0xffffec00
69#define AT91SAM9261_BASE_MATRIX 0xffffee00
70#define AT91SAM9261_BASE_SDRAMC 0xffffea00
74#define AT91SAM9261_BASE_DBGU AT91_BASE_DBGU0 71#define AT91SAM9261_BASE_DBGU AT91_BASE_DBGU0
75#define AT91SAM9261_BASE_PIOA 0xfffff400 72#define AT91SAM9261_BASE_PIOA 0xfffff400
76#define AT91SAM9261_BASE_PIOB 0xfffff600 73#define AT91SAM9261_BASE_PIOB 0xfffff600
@@ -80,6 +77,7 @@
80#define AT91SAM9261_BASE_RTT 0xfffffd20 77#define AT91SAM9261_BASE_RTT 0xfffffd20
81#define AT91SAM9261_BASE_PIT 0xfffffd30 78#define AT91SAM9261_BASE_PIT 0xfffffd30
82#define AT91SAM9261_BASE_WDT 0xfffffd40 79#define AT91SAM9261_BASE_WDT 0xfffffd40
80#define AT91SAM9261_BASE_GPBR 0xfffffd50
83 81
84#define AT91_USART0 AT91SAM9261_BASE_US0 82#define AT91_USART0 AT91SAM9261_BASE_US0
85#define AT91_USART1 AT91SAM9261_BASE_US1 83#define AT91_USART1 AT91SAM9261_BASE_US1
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
index 69c6501915d..a50cdf8b8ca 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
@@ -15,15 +15,15 @@
15#ifndef AT91SAM9261_MATRIX_H 15#ifndef AT91SAM9261_MATRIX_H
16#define AT91SAM9261_MATRIX_H 16#define AT91SAM9261_MATRIX_H
17 17
18#define AT91_MATRIX_MCFG (AT91_MATRIX + 0x00) /* Master Configuration Register */ 18#define AT91_MATRIX_MCFG 0x00 /* Master Configuration Register */
19#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 19#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
20#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 20#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
21 21
22#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x04) /* Slave Configuration Register 0 */ 22#define AT91_MATRIX_SCFG0 0x04 /* Slave Configuration Register 0 */
23#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x08) /* Slave Configuration Register 1 */ 23#define AT91_MATRIX_SCFG1 0x08 /* Slave Configuration Register 1 */
24#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x0C) /* Slave Configuration Register 2 */ 24#define AT91_MATRIX_SCFG2 0x0C /* Slave Configuration Register 2 */
25#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x10) /* Slave Configuration Register 3 */ 25#define AT91_MATRIX_SCFG3 0x10 /* Slave Configuration Register 3 */
26#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x14) /* Slave Configuration Register 4 */ 26#define AT91_MATRIX_SCFG4 0x14 /* Slave Configuration Register 4 */
27#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */ 27#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
28#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ 28#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
29#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) 29#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
@@ -31,7 +31,7 @@
31#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16) 31#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
32#define AT91_MATRIX_FIXED_DEFMSTR (7 << 18) /* Fixed Index of Default Master */ 32#define AT91_MATRIX_FIXED_DEFMSTR (7 << 18) /* Fixed Index of Default Master */
33 33
34#define AT91_MATRIX_TCR (AT91_MATRIX + 0x24) /* TCM Configuration Register */ 34#define AT91_MATRIX_TCR 0x24 /* TCM Configuration Register */
35#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */ 35#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */
36#define AT91_MATRIX_ITCM_0 (0 << 0) 36#define AT91_MATRIX_ITCM_0 (0 << 0)
37#define AT91_MATRIX_ITCM_16 (5 << 0) 37#define AT91_MATRIX_ITCM_16 (5 << 0)
@@ -43,7 +43,7 @@
43#define AT91_MATRIX_DTCM_32 (6 << 4) 43#define AT91_MATRIX_DTCM_32 (6 << 4)
44#define AT91_MATRIX_DTCM_64 (7 << 4) 44#define AT91_MATRIX_DTCM_64 (7 << 4)
45 45
46#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x30) /* EBI Chip Select Assignment Register */ 46#define AT91_MATRIX_EBICSA 0x30 /* EBI Chip Select Assignment Register */
47#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */ 47#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
48#define AT91_MATRIX_CS1A_SMC (0 << 1) 48#define AT91_MATRIX_CS1A_SMC (0 << 1)
49#define AT91_MATRIX_CS1A_SDRAMC (1 << 1) 49#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
@@ -58,7 +58,7 @@
58#define AT91_MATRIX_CS5A_SMC_CF2 (1 << 5) 58#define AT91_MATRIX_CS5A_SMC_CF2 (1 << 5)
59#define AT91_MATRIX_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */ 59#define AT91_MATRIX_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
60 60
61#define AT91_MATRIX_USBPUCR (AT91_MATRIX + 0x34) /* USB Pad Pull-Up Control Register */ 61#define AT91_MATRIX_USBPUCR 0x34 /* USB Pad Pull-Up Control Register */
62#define AT91_MATRIX_USBPUCR_PUON (1 << 30) /* USB Device PAD Pull-up Enable */ 62#define AT91_MATRIX_USBPUCR_PUON (1 << 30) /* USB Device PAD Pull-up Enable */
63 63
64#endif 64#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h
index 5949abda962..d96cbb2e03c 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9263.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9263.h
@@ -72,18 +72,15 @@
72#define AT91SAM9263_BASE_2DGE 0xfffc8000 72#define AT91SAM9263_BASE_2DGE 0xfffc8000
73 73
74/* 74/*
75 * System Peripherals (offset from AT91_BASE_SYS) 75 * System Peripherals
76 */ 76 */
77#define AT91_SDRAMC0 (0xffffe200 - AT91_BASE_SYS)
78#define AT91_SDRAMC1 (0xffffe800 - AT91_BASE_SYS)
79#define AT91_MATRIX (0xffffec00 - AT91_BASE_SYS)
80#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
81#define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS)
82
83#define AT91SAM9263_BASE_ECC0 0xffffe000 77#define AT91SAM9263_BASE_ECC0 0xffffe000
78#define AT91SAM9263_BASE_SDRAMC0 0xffffe200
84#define AT91SAM9263_BASE_SMC0 0xffffe400 79#define AT91SAM9263_BASE_SMC0 0xffffe400
85#define AT91SAM9263_BASE_ECC1 0xffffe600 80#define AT91SAM9263_BASE_ECC1 0xffffe600
81#define AT91SAM9263_BASE_SDRAMC1 0xffffe800
86#define AT91SAM9263_BASE_SMC1 0xffffea00 82#define AT91SAM9263_BASE_SMC1 0xffffea00
83#define AT91SAM9263_BASE_MATRIX 0xffffec00
87#define AT91SAM9263_BASE_DBGU AT91_BASE_DBGU1 84#define AT91SAM9263_BASE_DBGU AT91_BASE_DBGU1
88#define AT91SAM9263_BASE_PIOA 0xfffff200 85#define AT91SAM9263_BASE_PIOA 0xfffff200
89#define AT91SAM9263_BASE_PIOB 0xfffff400 86#define AT91SAM9263_BASE_PIOB 0xfffff400
@@ -96,6 +93,7 @@
96#define AT91SAM9263_BASE_PIT 0xfffffd30 93#define AT91SAM9263_BASE_PIT 0xfffffd30
97#define AT91SAM9263_BASE_WDT 0xfffffd40 94#define AT91SAM9263_BASE_WDT 0xfffffd40
98#define AT91SAM9263_BASE_RTT1 0xfffffd50 95#define AT91SAM9263_BASE_RTT1 0xfffffd50
96#define AT91SAM9263_BASE_GPBR 0xfffffd60
99 97
100#define AT91_USART0 AT91SAM9263_BASE_US0 98#define AT91_USART0 AT91SAM9263_BASE_US0
101#define AT91_USART1 AT91SAM9263_BASE_US1 99#define AT91_USART1 AT91SAM9263_BASE_US1
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9263_matrix.h
index 9b3efd3eb2f..ebb5fdb565e 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9263_matrix.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9263_matrix.h
@@ -15,15 +15,15 @@
15#ifndef AT91SAM9263_MATRIX_H 15#ifndef AT91SAM9263_MATRIX_H
16#define AT91SAM9263_MATRIX_H 16#define AT91SAM9263_MATRIX_H
17 17
18#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */ 18#define AT91_MATRIX_MCFG0 0x00 /* Master Configuration Register 0 */
19#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */ 19#define AT91_MATRIX_MCFG1 0x04 /* Master Configuration Register 1 */
20#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */ 20#define AT91_MATRIX_MCFG2 0x08 /* Master Configuration Register 2 */
21#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */ 21#define AT91_MATRIX_MCFG3 0x0C /* Master Configuration Register 3 */
22#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */ 22#define AT91_MATRIX_MCFG4 0x10 /* Master Configuration Register 4 */
23#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */ 23#define AT91_MATRIX_MCFG5 0x14 /* Master Configuration Register 5 */
24#define AT91_MATRIX_MCFG6 (AT91_MATRIX + 0x18) /* Master Configuration Register 6 */ 24#define AT91_MATRIX_MCFG6 0x18 /* Master Configuration Register 6 */
25#define AT91_MATRIX_MCFG7 (AT91_MATRIX + 0x1C) /* Master Configuration Register 7 */ 25#define AT91_MATRIX_MCFG7 0x1C /* Master Configuration Register 7 */
26#define AT91_MATRIX_MCFG8 (AT91_MATRIX + 0x20) /* Master Configuration Register 8 */ 26#define AT91_MATRIX_MCFG8 0x20 /* Master Configuration Register 8 */
27#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */ 27#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
28#define AT91_MATRIX_ULBT_INFINITE (0 << 0) 28#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
29#define AT91_MATRIX_ULBT_SINGLE (1 << 0) 29#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
@@ -31,14 +31,14 @@
31#define AT91_MATRIX_ULBT_EIGHT (3 << 0) 31#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
32#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0) 32#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
33 33
34#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */ 34#define AT91_MATRIX_SCFG0 0x40 /* Slave Configuration Register 0 */
35#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */ 35#define AT91_MATRIX_SCFG1 0x44 /* Slave Configuration Register 1 */
36#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */ 36#define AT91_MATRIX_SCFG2 0x48 /* Slave Configuration Register 2 */
37#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */ 37#define AT91_MATRIX_SCFG3 0x4C /* Slave Configuration Register 3 */
38#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */ 38#define AT91_MATRIX_SCFG4 0x50 /* Slave Configuration Register 4 */
39#define AT91_MATRIX_SCFG5 (AT91_MATRIX + 0x54) /* Slave Configuration Register 5 */ 39#define AT91_MATRIX_SCFG5 0x54 /* Slave Configuration Register 5 */
40#define AT91_MATRIX_SCFG6 (AT91_MATRIX + 0x58) /* Slave Configuration Register 6 */ 40#define AT91_MATRIX_SCFG6 0x58 /* Slave Configuration Register 6 */
41#define AT91_MATRIX_SCFG7 (AT91_MATRIX + 0x5C) /* Slave Configuration Register 7 */ 41#define AT91_MATRIX_SCFG7 0x5C /* Slave Configuration Register 7 */
42#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */ 42#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
43#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ 43#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
44#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) 44#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
@@ -49,22 +49,22 @@
49#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24) 49#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
50#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24) 50#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
51 51
52#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */ 52#define AT91_MATRIX_PRAS0 0x80 /* Priority Register A for Slave 0 */
53#define AT91_MATRIX_PRBS0 (AT91_MATRIX + 0x84) /* Priority Register B for Slave 0 */ 53#define AT91_MATRIX_PRBS0 0x84 /* Priority Register B for Slave 0 */
54#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */ 54#define AT91_MATRIX_PRAS1 0x88 /* Priority Register A for Slave 1 */
55#define AT91_MATRIX_PRBS1 (AT91_MATRIX + 0x8C) /* Priority Register B for Slave 1 */ 55#define AT91_MATRIX_PRBS1 0x8C /* Priority Register B for Slave 1 */
56#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */ 56#define AT91_MATRIX_PRAS2 0x90 /* Priority Register A for Slave 2 */
57#define AT91_MATRIX_PRBS2 (AT91_MATRIX + 0x94) /* Priority Register B for Slave 2 */ 57#define AT91_MATRIX_PRBS2 0x94 /* Priority Register B for Slave 2 */
58#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */ 58#define AT91_MATRIX_PRAS3 0x98 /* Priority Register A for Slave 3 */
59#define AT91_MATRIX_PRBS3 (AT91_MATRIX + 0x9C) /* Priority Register B for Slave 3 */ 59#define AT91_MATRIX_PRBS3 0x9C /* Priority Register B for Slave 3 */
60#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */ 60#define AT91_MATRIX_PRAS4 0xA0 /* Priority Register A for Slave 4 */
61#define AT91_MATRIX_PRBS4 (AT91_MATRIX + 0xA4) /* Priority Register B for Slave 4 */ 61#define AT91_MATRIX_PRBS4 0xA4 /* Priority Register B for Slave 4 */
62#define AT91_MATRIX_PRAS5 (AT91_MATRIX + 0xA8) /* Priority Register A for Slave 5 */ 62#define AT91_MATRIX_PRAS5 0xA8 /* Priority Register A for Slave 5 */
63#define AT91_MATRIX_PRBS5 (AT91_MATRIX + 0xAC) /* Priority Register B for Slave 5 */ 63#define AT91_MATRIX_PRBS5 0xAC /* Priority Register B for Slave 5 */
64#define AT91_MATRIX_PRAS6 (AT91_MATRIX + 0xB0) /* Priority Register A for Slave 6 */ 64#define AT91_MATRIX_PRAS6 0xB0 /* Priority Register A for Slave 6 */
65#define AT91_MATRIX_PRBS6 (AT91_MATRIX + 0xB4) /* Priority Register B for Slave 6 */ 65#define AT91_MATRIX_PRBS6 0xB4 /* Priority Register B for Slave 6 */
66#define AT91_MATRIX_PRAS7 (AT91_MATRIX + 0xB8) /* Priority Register A for Slave 7 */ 66#define AT91_MATRIX_PRAS7 0xB8 /* Priority Register A for Slave 7 */
67#define AT91_MATRIX_PRBS7 (AT91_MATRIX + 0xBC) /* Priority Register B for Slave 7 */ 67#define AT91_MATRIX_PRBS7 0xBC /* Priority Register B for Slave 7 */
68#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */ 68#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
69#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */ 69#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
70#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */ 70#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
@@ -75,7 +75,7 @@
75#define AT91_MATRIX_M7PR (3 << 28) /* Master 7 Priority */ 75#define AT91_MATRIX_M7PR (3 << 28) /* Master 7 Priority */
76#define AT91_MATRIX_M8PR (3 << 0) /* Master 8 Priority (in Register B) */ 76#define AT91_MATRIX_M8PR (3 << 0) /* Master 8 Priority (in Register B) */
77 77
78#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */ 78#define AT91_MATRIX_MRCR 0x100 /* Master Remap Control Register */
79#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 79#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
80#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 80#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
81#define AT91_MATRIX_RCB2 (1 << 2) 81#define AT91_MATRIX_RCB2 (1 << 2)
@@ -86,7 +86,7 @@
86#define AT91_MATRIX_RCB7 (1 << 7) 86#define AT91_MATRIX_RCB7 (1 << 7)
87#define AT91_MATRIX_RCB8 (1 << 8) 87#define AT91_MATRIX_RCB8 (1 << 8)
88 88
89#define AT91_MATRIX_TCMR (AT91_MATRIX + 0x114) /* TCM Configuration Register */ 89#define AT91_MATRIX_TCMR 0x114 /* TCM Configuration Register */
90#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */ 90#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */
91#define AT91_MATRIX_ITCM_0 (0 << 0) 91#define AT91_MATRIX_ITCM_0 (0 << 0)
92#define AT91_MATRIX_ITCM_16 (5 << 0) 92#define AT91_MATRIX_ITCM_16 (5 << 0)
@@ -96,7 +96,7 @@
96#define AT91_MATRIX_DTCM_16 (5 << 4) 96#define AT91_MATRIX_DTCM_16 (5 << 4)
97#define AT91_MATRIX_DTCM_32 (6 << 4) 97#define AT91_MATRIX_DTCM_32 (6 << 4)
98 98
99#define AT91_MATRIX_EBI0CSA (AT91_MATRIX + 0x120) /* EBI0 Chip Select Assignment Register */ 99#define AT91_MATRIX_EBI0CSA 0x120 /* EBI0 Chip Select Assignment Register */
100#define AT91_MATRIX_EBI0_CS1A (1 << 1) /* Chip Select 1 Assignment */ 100#define AT91_MATRIX_EBI0_CS1A (1 << 1) /* Chip Select 1 Assignment */
101#define AT91_MATRIX_EBI0_CS1A_SMC (0 << 1) 101#define AT91_MATRIX_EBI0_CS1A_SMC (0 << 1)
102#define AT91_MATRIX_EBI0_CS1A_SDRAMC (1 << 1) 102#define AT91_MATRIX_EBI0_CS1A_SDRAMC (1 << 1)
@@ -114,7 +114,7 @@
114#define AT91_MATRIX_EBI0_VDDIOMSEL_1_8V (0 << 16) 114#define AT91_MATRIX_EBI0_VDDIOMSEL_1_8V (0 << 16)
115#define AT91_MATRIX_EBI0_VDDIOMSEL_3_3V (1 << 16) 115#define AT91_MATRIX_EBI0_VDDIOMSEL_3_3V (1 << 16)
116 116
117#define AT91_MATRIX_EBI1CSA (AT91_MATRIX + 0x124) /* EBI1 Chip Select Assignment Register */ 117#define AT91_MATRIX_EBI1CSA 0x124 /* EBI1 Chip Select Assignment Register */
118#define AT91_MATRIX_EBI1_CS1A (1 << 1) /* Chip Select 1 Assignment */ 118#define AT91_MATRIX_EBI1_CS1A (1 << 1) /* Chip Select 1 Assignment */
119#define AT91_MATRIX_EBI1_CS1A_SMC (0 << 1) 119#define AT91_MATRIX_EBI1_CS1A_SMC (0 << 1)
120#define AT91_MATRIX_EBI1_CS1A_SDRAMC (1 << 1) 120#define AT91_MATRIX_EBI1_CS1A_SDRAMC (1 << 1)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
index e2f8da8ce5b..0210797abf2 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
@@ -59,7 +59,6 @@
59#define AT91_DDRSDRC_TRP (0xf << 16) /* Row precharge delay */ 59#define AT91_DDRSDRC_TRP (0xf << 16) /* Row precharge delay */
60#define AT91_DDRSDRC_TRRD (0xf << 20) /* Active BankA to BankB */ 60#define AT91_DDRSDRC_TRRD (0xf << 20) /* Active BankA to BankB */
61#define AT91_DDRSDRC_TWTR (0x7 << 24) /* Internal Write to Read delay */ 61#define AT91_DDRSDRC_TWTR (0x7 << 24) /* Internal Write to Read delay */
62#define AT91CAP9_DDRSDRC_TWTR (1 << 24) /* Internal Write to Read delay */
63#define AT91_DDRSDRC_RED_WRRD (0x1 << 27) /* Reduce Write to Read Delay [SAM9 Only] */ 62#define AT91_DDRSDRC_RED_WRRD (0x1 << 27) /* Reduce Write to Read Delay [SAM9 Only] */
64#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */ 63#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */
65 64
@@ -76,7 +75,6 @@
76#define AT91_DDRSDRC_TRTP (0x7 << 12) /* Read to Precharge delay */ 75#define AT91_DDRSDRC_TRTP (0x7 << 12) /* Read to Precharge delay */
77 76
78#define AT91_DDRSDRC_LPR 0x1C /* Low Power Register */ 77#define AT91_DDRSDRC_LPR 0x1C /* Low Power Register */
79#define AT91CAP9_DDRSDRC_LPR 0x18 /* Low Power Register */
80#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */ 78#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */
81#define AT91_DDRSDRC_LPCB_DISABLE 0 79#define AT91_DDRSDRC_LPCB_DISABLE 0
82#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1 80#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1
@@ -94,11 +92,9 @@
94#define AT91_DDRSDRC_UPD_MR (3 << 20) /* Update load mode register and extended mode register */ 92#define AT91_DDRSDRC_UPD_MR (3 << 20) /* Update load mode register and extended mode register */
95 93
96#define AT91_DDRSDRC_MDR 0x20 /* Memory Device Register */ 94#define AT91_DDRSDRC_MDR 0x20 /* Memory Device Register */
97#define AT91CAP9_DDRSDRC_MDR 0x1C /* Memory Device Register */
98#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */ 95#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */
99#define AT91_DDRSDRC_MD_SDR 0 96#define AT91_DDRSDRC_MD_SDR 0
100#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1 97#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1
101#define AT91CAP9_DDRSDRC_MD_DDR 2
102#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3 98#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3
103#define AT91_DDRSDRC_MD_DDR2 6 /* [SAM9 Only] */ 99#define AT91_DDRSDRC_MD_DDR2 6 /* [SAM9 Only] */
104#define AT91_DDRSDRC_DBW (1 << 4) /* Data Bus Width */ 100#define AT91_DDRSDRC_DBW (1 << 4) /* Data Bus Width */
@@ -106,16 +102,10 @@
106#define AT91_DDRSDRC_DBW_16BITS (1 << 4) 102#define AT91_DDRSDRC_DBW_16BITS (1 << 4)
107 103
108#define AT91_DDRSDRC_DLL 0x24 /* DLL Information Register */ 104#define AT91_DDRSDRC_DLL 0x24 /* DLL Information Register */
109#define AT91CAP9_DDRSDRC_DLL 0x20 /* DLL Information Register */
110#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */ 105#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */
111#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */ 106#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */
112#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */ 107#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */
113#define AT91CAP9_DDRSDRC_SDCOVF (1 << 3) /* Slave Delay Correction Overflow */
114#define AT91CAP9_DDRSDRC_SDCUDF (1 << 4) /* Slave Delay Correction Underflow */
115#define AT91CAP9_DDRSDRC_SDERF (1 << 5) /* Slave Delay Correction error */
116#define AT91_DDRSDRC_MDVAL (0xff << 8) /* Master Delay value */ 108#define AT91_DDRSDRC_MDVAL (0xff << 8) /* Master Delay value */
117#define AT91CAP9_DDRSDRC_SDVAL (0xff << 16) /* Slave Delay value */
118#define AT91CAP9_DDRSDRC_SDCVAL (0xff << 24) /* Slave Delay Correction value */
119 109
120#define AT91_DDRSDRC_HS 0x2C /* High Speed Register [SAM9 Only] */ 110#define AT91_DDRSDRC_HS 0x2C /* High Speed Register [SAM9 Only] */
121#define AT91_DDRSDRC_DIS_ATCP_RD (1 << 2) /* Anticip read access is disabled */ 111#define AT91_DDRSDRC_DIS_ATCP_RD (1 << 2) /* Anticip read access is disabled */
@@ -131,10 +121,4 @@
131#define AT91_DDRSDRC_WPVS (1 << 0) /* Write protect violation status */ 121#define AT91_DDRSDRC_WPVS (1 << 0) /* Write protect violation status */
132#define AT91_DDRSDRC_WPVSRC (0xffff << 8) /* Write protect violation source */ 122#define AT91_DDRSDRC_WPVSRC (0xffff << 8) /* Write protect violation source */
133 123
134/* Register access macros */
135#define at91_ramc_read(num, reg) \
136 at91_sys_read(AT91_DDRSDRC##num + reg)
137#define at91_ramc_write(num, reg, value) \
138 at91_sys_write(AT91_DDRSDRC##num + reg, value)
139
140#endif 124#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
index 100f5a59292..3d085a9a745 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
@@ -82,10 +82,4 @@
82#define AT91_SDRAMC_MD_SDRAM 0 82#define AT91_SDRAMC_MD_SDRAM 0
83#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1 83#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1
84 84
85/* Register access macros */
86#define at91_ramc_read(num, reg) \
87 at91_sys_read(AT91_SDRAMC##num + reg)
88#define at91_ramc_write(num, reg, value) \
89 at91_sys_write(AT91_SDRAMC##num + reg, value)
90
91#endif 85#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h
index dd9c95ea086..d052abcff85 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9g45.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h
@@ -84,17 +84,14 @@
84#define AT91SAM9G45_BASE_TC5 0xfffd4080 84#define AT91SAM9G45_BASE_TC5 0xfffd4080
85 85
86/* 86/*
87 * System Peripherals (offset from AT91_BASE_SYS) 87 * System Peripherals
88 */ 88 */
89#define AT91_DDRSDRC1 (0xffffe400 - AT91_BASE_SYS)
90#define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS)
91#define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS)
92#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
93#define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS)
94
95#define AT91SAM9G45_BASE_ECC 0xffffe200 89#define AT91SAM9G45_BASE_ECC 0xffffe200
90#define AT91SAM9G45_BASE_DDRSDRC1 0xffffe400
91#define AT91SAM9G45_BASE_DDRSDRC0 0xffffe600
96#define AT91SAM9G45_BASE_DMA 0xffffec00 92#define AT91SAM9G45_BASE_DMA 0xffffec00
97#define AT91SAM9G45_BASE_SMC 0xffffe800 93#define AT91SAM9G45_BASE_SMC 0xffffe800
94#define AT91SAM9G45_BASE_MATRIX 0xffffea00
98#define AT91SAM9G45_BASE_DBGU AT91_BASE_DBGU1 95#define AT91SAM9G45_BASE_DBGU AT91_BASE_DBGU1
99#define AT91SAM9G45_BASE_PIOA 0xfffff200 96#define AT91SAM9G45_BASE_PIOA 0xfffff200
100#define AT91SAM9G45_BASE_PIOB 0xfffff400 97#define AT91SAM9G45_BASE_PIOB 0xfffff400
@@ -107,6 +104,7 @@
107#define AT91SAM9G45_BASE_PIT 0xfffffd30 104#define AT91SAM9G45_BASE_PIT 0xfffffd30
108#define AT91SAM9G45_BASE_WDT 0xfffffd40 105#define AT91SAM9G45_BASE_WDT 0xfffffd40
109#define AT91SAM9G45_BASE_RTC 0xfffffdb0 106#define AT91SAM9G45_BASE_RTC 0xfffffdb0
107#define AT91SAM9G45_BASE_GPBR 0xfffffd60
110 108
111#define AT91_USART0 AT91SAM9G45_BASE_US0 109#define AT91_USART0 AT91SAM9G45_BASE_US0
112#define AT91_USART1 AT91SAM9G45_BASE_US1 110#define AT91_USART1 AT91SAM9G45_BASE_US1
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9g45_matrix.h
index c972d60e0ae..b76e2ed2fbc 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9g45_matrix.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9g45_matrix.h
@@ -15,18 +15,18 @@
15#ifndef AT91SAM9G45_MATRIX_H 15#ifndef AT91SAM9G45_MATRIX_H
16#define AT91SAM9G45_MATRIX_H 16#define AT91SAM9G45_MATRIX_H
17 17
18#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */ 18#define AT91_MATRIX_MCFG0 0x00 /* Master Configuration Register 0 */
19#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */ 19#define AT91_MATRIX_MCFG1 0x04 /* Master Configuration Register 1 */
20#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */ 20#define AT91_MATRIX_MCFG2 0x08 /* Master Configuration Register 2 */
21#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */ 21#define AT91_MATRIX_MCFG3 0x0C /* Master Configuration Register 3 */
22#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */ 22#define AT91_MATRIX_MCFG4 0x10 /* Master Configuration Register 4 */
23#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */ 23#define AT91_MATRIX_MCFG5 0x14 /* Master Configuration Register 5 */
24#define AT91_MATRIX_MCFG6 (AT91_MATRIX + 0x18) /* Master Configuration Register 6 */ 24#define AT91_MATRIX_MCFG6 0x18 /* Master Configuration Register 6 */
25#define AT91_MATRIX_MCFG7 (AT91_MATRIX + 0x1C) /* Master Configuration Register 7 */ 25#define AT91_MATRIX_MCFG7 0x1C /* Master Configuration Register 7 */
26#define AT91_MATRIX_MCFG8 (AT91_MATRIX + 0x20) /* Master Configuration Register 8 */ 26#define AT91_MATRIX_MCFG8 0x20 /* Master Configuration Register 8 */
27#define AT91_MATRIX_MCFG9 (AT91_MATRIX + 0x24) /* Master Configuration Register 9 */ 27#define AT91_MATRIX_MCFG9 0x24 /* Master Configuration Register 9 */
28#define AT91_MATRIX_MCFG10 (AT91_MATRIX + 0x28) /* Master Configuration Register 10 */ 28#define AT91_MATRIX_MCFG10 0x28 /* Master Configuration Register 10 */
29#define AT91_MATRIX_MCFG11 (AT91_MATRIX + 0x2C) /* Master Configuration Register 11 */ 29#define AT91_MATRIX_MCFG11 0x2C /* Master Configuration Register 11 */
30#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */ 30#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
31#define AT91_MATRIX_ULBT_INFINITE (0 << 0) 31#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
32#define AT91_MATRIX_ULBT_SINGLE (1 << 0) 32#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
@@ -37,14 +37,14 @@
37#define AT91_MATRIX_ULBT_SIXTYFOUR (6 << 0) 37#define AT91_MATRIX_ULBT_SIXTYFOUR (6 << 0)
38#define AT91_MATRIX_ULBT_128 (7 << 0) 38#define AT91_MATRIX_ULBT_128 (7 << 0)
39 39
40#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */ 40#define AT91_MATRIX_SCFG0 0x40 /* Slave Configuration Register 0 */
41#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */ 41#define AT91_MATRIX_SCFG1 0x44 /* Slave Configuration Register 1 */
42#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */ 42#define AT91_MATRIX_SCFG2 0x48 /* Slave Configuration Register 2 */
43#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */ 43#define AT91_MATRIX_SCFG3 0x4C /* Slave Configuration Register 3 */
44#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */ 44#define AT91_MATRIX_SCFG4 0x50 /* Slave Configuration Register 4 */
45#define AT91_MATRIX_SCFG5 (AT91_MATRIX + 0x54) /* Slave Configuration Register 5 */ 45#define AT91_MATRIX_SCFG5 0x54 /* Slave Configuration Register 5 */
46#define AT91_MATRIX_SCFG6 (AT91_MATRIX + 0x58) /* Slave Configuration Register 6 */ 46#define AT91_MATRIX_SCFG6 0x58 /* Slave Configuration Register 6 */
47#define AT91_MATRIX_SCFG7 (AT91_MATRIX + 0x5C) /* Slave Configuration Register 7 */ 47#define AT91_MATRIX_SCFG7 0x5C /* Slave Configuration Register 7 */
48#define AT91_MATRIX_SLOT_CYCLE (0x1ff << 0) /* Maximum Number of Allowed Cycles for a Burst */ 48#define AT91_MATRIX_SLOT_CYCLE (0x1ff << 0) /* Maximum Number of Allowed Cycles for a Burst */
49#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ 49#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
50#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) 50#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
@@ -52,22 +52,22 @@
52#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16) 52#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
53#define AT91_MATRIX_FIXED_DEFMSTR (0xf << 18) /* Fixed Index of Default Master */ 53#define AT91_MATRIX_FIXED_DEFMSTR (0xf << 18) /* Fixed Index of Default Master */
54 54
55#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */ 55#define AT91_MATRIX_PRAS0 0x80 /* Priority Register A for Slave 0 */
56#define AT91_MATRIX_PRBS0 (AT91_MATRIX + 0x84) /* Priority Register B for Slave 0 */ 56#define AT91_MATRIX_PRBS0 0x84 /* Priority Register B for Slave 0 */
57#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */ 57#define AT91_MATRIX_PRAS1 0x88 /* Priority Register A for Slave 1 */
58#define AT91_MATRIX_PRBS1 (AT91_MATRIX + 0x8C) /* Priority Register B for Slave 1 */ 58#define AT91_MATRIX_PRBS1 0x8C /* Priority Register B for Slave 1 */
59#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */ 59#define AT91_MATRIX_PRAS2 0x90 /* Priority Register A for Slave 2 */
60#define AT91_MATRIX_PRBS2 (AT91_MATRIX + 0x94) /* Priority Register B for Slave 2 */ 60#define AT91_MATRIX_PRBS2 0x94 /* Priority Register B for Slave 2 */
61#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */ 61#define AT91_MATRIX_PRAS3 0x98 /* Priority Register A for Slave 3 */
62#define AT91_MATRIX_PRBS3 (AT91_MATRIX + 0x9C) /* Priority Register B for Slave 3 */ 62#define AT91_MATRIX_PRBS3 0x9C /* Priority Register B for Slave 3 */
63#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */ 63#define AT91_MATRIX_PRAS4 0xA0 /* Priority Register A for Slave 4 */
64#define AT91_MATRIX_PRBS4 (AT91_MATRIX + 0xA4) /* Priority Register B for Slave 4 */ 64#define AT91_MATRIX_PRBS4 0xA4 /* Priority Register B for Slave 4 */
65#define AT91_MATRIX_PRAS5 (AT91_MATRIX + 0xA8) /* Priority Register A for Slave 5 */ 65#define AT91_MATRIX_PRAS5 0xA8 /* Priority Register A for Slave 5 */
66#define AT91_MATRIX_PRBS5 (AT91_MATRIX + 0xAC) /* Priority Register B for Slave 5 */ 66#define AT91_MATRIX_PRBS5 0xAC /* Priority Register B for Slave 5 */
67#define AT91_MATRIX_PRAS6 (AT91_MATRIX + 0xB0) /* Priority Register A for Slave 6 */ 67#define AT91_MATRIX_PRAS6 0xB0 /* Priority Register A for Slave 6 */
68#define AT91_MATRIX_PRBS6 (AT91_MATRIX + 0xB4) /* Priority Register B for Slave 6 */ 68#define AT91_MATRIX_PRBS6 0xB4 /* Priority Register B for Slave 6 */
69#define AT91_MATRIX_PRAS7 (AT91_MATRIX + 0xB8) /* Priority Register A for Slave 7 */ 69#define AT91_MATRIX_PRAS7 0xB8 /* Priority Register A for Slave 7 */
70#define AT91_MATRIX_PRBS7 (AT91_MATRIX + 0xBC) /* Priority Register B for Slave 7 */ 70#define AT91_MATRIX_PRBS7 0xBC /* Priority Register B for Slave 7 */
71#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */ 71#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
72#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */ 72#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
73#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */ 73#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
@@ -81,7 +81,7 @@
81#define AT91_MATRIX_M10PR (3 << 8) /* Master 10 Priority (in Register B) */ 81#define AT91_MATRIX_M10PR (3 << 8) /* Master 10 Priority (in Register B) */
82#define AT91_MATRIX_M11PR (3 << 12) /* Master 11 Priority (in Register B) */ 82#define AT91_MATRIX_M11PR (3 << 12) /* Master 11 Priority (in Register B) */
83 83
84#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */ 84#define AT91_MATRIX_MRCR 0x100 /* Master Remap Control Register */
85#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 85#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
86#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 86#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
87#define AT91_MATRIX_RCB2 (1 << 2) 87#define AT91_MATRIX_RCB2 (1 << 2)
@@ -95,7 +95,7 @@
95#define AT91_MATRIX_RCB10 (1 << 10) 95#define AT91_MATRIX_RCB10 (1 << 10)
96#define AT91_MATRIX_RCB11 (1 << 11) 96#define AT91_MATRIX_RCB11 (1 << 11)
97 97
98#define AT91_MATRIX_TCMR (AT91_MATRIX + 0x110) /* TCM Configuration Register */ 98#define AT91_MATRIX_TCMR 0x110 /* TCM Configuration Register */
99#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */ 99#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */
100#define AT91_MATRIX_ITCM_0 (0 << 0) 100#define AT91_MATRIX_ITCM_0 (0 << 0)
101#define AT91_MATRIX_ITCM_32 (6 << 0) 101#define AT91_MATRIX_ITCM_32 (6 << 0)
@@ -107,12 +107,12 @@
107#define AT91_MATRIX_TCM_NO_WS (0x0 << 11) 107#define AT91_MATRIX_TCM_NO_WS (0x0 << 11)
108#define AT91_MATRIX_TCM_ONE_WS (0x1 << 11) 108#define AT91_MATRIX_TCM_ONE_WS (0x1 << 11)
109 109
110#define AT91_MATRIX_VIDEO (AT91_MATRIX + 0x118) /* Video Mode Configuration Register */ 110#define AT91_MATRIX_VIDEO 0x118 /* Video Mode Configuration Register */
111#define AT91C_VDEC_SEL (0x1 << 0) /* Video Mode Selection */ 111#define AT91C_VDEC_SEL (0x1 << 0) /* Video Mode Selection */
112#define AT91C_VDEC_SEL_OFF (0 << 0) 112#define AT91C_VDEC_SEL_OFF (0 << 0)
113#define AT91C_VDEC_SEL_ON (1 << 0) 113#define AT91C_VDEC_SEL_ON (1 << 0)
114 114
115#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x128) /* EBI Chip Select Assignment Register */ 115#define AT91_MATRIX_EBICSA 0x128 /* EBI Chip Select Assignment Register */
116#define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */ 116#define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
117#define AT91_MATRIX_EBI_CS1A_SMC (0 << 1) 117#define AT91_MATRIX_EBI_CS1A_SMC (0 << 1)
118#define AT91_MATRIX_EBI_CS1A_SDRAMC (1 << 1) 118#define AT91_MATRIX_EBI_CS1A_SDRAMC (1 << 1)
@@ -138,13 +138,13 @@
138#define AT91_MATRIX_EBI_DDR_IOSR_REDUCED (0 << 18) 138#define AT91_MATRIX_EBI_DDR_IOSR_REDUCED (0 << 18)
139#define AT91_MATRIX_EBI_DDR_IOSR_NORMAL (1 << 18) 139#define AT91_MATRIX_EBI_DDR_IOSR_NORMAL (1 << 18)
140 140
141#define AT91_MATRIX_WPMR (AT91_MATRIX + 0x1E4) /* Write Protect Mode Register */ 141#define AT91_MATRIX_WPMR 0x1E4 /* Write Protect Mode Register */
142#define AT91_MATRIX_WPMR_WPEN (1 << 0) /* Write Protect ENable */ 142#define AT91_MATRIX_WPMR_WPEN (1 << 0) /* Write Protect ENable */
143#define AT91_MATRIX_WPMR_WP_WPDIS (0 << 0) 143#define AT91_MATRIX_WPMR_WP_WPDIS (0 << 0)
144#define AT91_MATRIX_WPMR_WP_WPEN (1 << 0) 144#define AT91_MATRIX_WPMR_WP_WPEN (1 << 0)
145#define AT91_MATRIX_WPMR_WPKEY (0xFFFFFF << 8) /* Write Protect KEY */ 145#define AT91_MATRIX_WPMR_WPKEY (0xFFFFFF << 8) /* Write Protect KEY */
146 146
147#define AT91_MATRIX_WPSR (AT91_MATRIX + 0x1E8) /* Write Protect Status Register */ 147#define AT91_MATRIX_WPSR 0x1E8 /* Write Protect Status Register */
148#define AT91_MATRIX_WPSR_WPVS (1 << 0) /* Write Protect Violation Status */ 148#define AT91_MATRIX_WPSR_WPVS (1 << 0) /* Write Protect Violation Status */
149#define AT91_MATRIX_WPSR_NO_WPV (0 << 0) 149#define AT91_MATRIX_WPSR_NO_WPV (0 << 0)
150#define AT91_MATRIX_WPSR_WPV (1 << 0) 150#define AT91_MATRIX_WPSR_WPV (1 << 0)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h
index d7bead7118d..e0073eb1014 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9rl.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h
@@ -69,15 +69,13 @@
69/* 69/*
70 * System Peripherals (offset from AT91_BASE_SYS) 70 * System Peripherals (offset from AT91_BASE_SYS)
71 */ 71 */
72#define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS)
73#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
74#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
75#define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) 72#define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS)
76#define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS)
77 73
78#define AT91SAM9RL_BASE_DMA 0xffffe600 74#define AT91SAM9RL_BASE_DMA 0xffffe600
79#define AT91SAM9RL_BASE_ECC 0xffffe800 75#define AT91SAM9RL_BASE_ECC 0xffffe800
76#define AT91SAM9RL_BASE_SDRAMC 0xffffea00
80#define AT91SAM9RL_BASE_SMC 0xffffec00 77#define AT91SAM9RL_BASE_SMC 0xffffec00
78#define AT91SAM9RL_BASE_MATRIX 0xffffee00
81#define AT91SAM9RL_BASE_DBGU AT91_BASE_DBGU0 79#define AT91SAM9RL_BASE_DBGU AT91_BASE_DBGU0
82#define AT91SAM9RL_BASE_PIOA 0xfffff400 80#define AT91SAM9RL_BASE_PIOA 0xfffff400
83#define AT91SAM9RL_BASE_PIOB 0xfffff600 81#define AT91SAM9RL_BASE_PIOB 0xfffff600
@@ -88,6 +86,7 @@
88#define AT91SAM9RL_BASE_RTT 0xfffffd20 86#define AT91SAM9RL_BASE_RTT 0xfffffd20
89#define AT91SAM9RL_BASE_PIT 0xfffffd30 87#define AT91SAM9RL_BASE_PIT 0xfffffd30
90#define AT91SAM9RL_BASE_WDT 0xfffffd40 88#define AT91SAM9RL_BASE_WDT 0xfffffd40
89#define AT91SAM9RL_BASE_GPBR 0xfffffd60
91#define AT91SAM9RL_BASE_RTC 0xfffffe00 90#define AT91SAM9RL_BASE_RTC 0xfffffe00
92 91
93#define AT91_USART0 AT91SAM9RL_BASE_US0 92#define AT91_USART0 AT91SAM9RL_BASE_US0
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h
index 5f9149071fe..6d160adadaf 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h
@@ -14,12 +14,12 @@
14#ifndef AT91SAM9RL_MATRIX_H 14#ifndef AT91SAM9RL_MATRIX_H
15#define AT91SAM9RL_MATRIX_H 15#define AT91SAM9RL_MATRIX_H
16 16
17#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */ 17#define AT91_MATRIX_MCFG0 0x00 /* Master Configuration Register 0 */
18#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */ 18#define AT91_MATRIX_MCFG1 0x04 /* Master Configuration Register 1 */
19#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */ 19#define AT91_MATRIX_MCFG2 0x08 /* Master Configuration Register 2 */
20#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */ 20#define AT91_MATRIX_MCFG3 0x0C /* Master Configuration Register 3 */
21#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */ 21#define AT91_MATRIX_MCFG4 0x10 /* Master Configuration Register 4 */
22#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */ 22#define AT91_MATRIX_MCFG5 0x14 /* Master Configuration Register 5 */
23#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */ 23#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
24#define AT91_MATRIX_ULBT_INFINITE (0 << 0) 24#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
25#define AT91_MATRIX_ULBT_SINGLE (1 << 0) 25#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
@@ -27,12 +27,12 @@
27#define AT91_MATRIX_ULBT_EIGHT (3 << 0) 27#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
28#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0) 28#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
29 29
30#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */ 30#define AT91_MATRIX_SCFG0 0x40 /* Slave Configuration Register 0 */
31#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */ 31#define AT91_MATRIX_SCFG1 0x44 /* Slave Configuration Register 1 */
32#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */ 32#define AT91_MATRIX_SCFG2 0x48 /* Slave Configuration Register 2 */
33#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */ 33#define AT91_MATRIX_SCFG3 0x4C /* Slave Configuration Register 3 */
34#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */ 34#define AT91_MATRIX_SCFG4 0x50 /* Slave Configuration Register 4 */
35#define AT91_MATRIX_SCFG5 (AT91_MATRIX + 0x54) /* Slave Configuration Register 5 */ 35#define AT91_MATRIX_SCFG5 0x54 /* Slave Configuration Register 5 */
36#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */ 36#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
37#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ 37#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
38#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) 38#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
@@ -43,12 +43,12 @@
43#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24) 43#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
44#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24) 44#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
45 45
46#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */ 46#define AT91_MATRIX_PRAS0 0x80 /* Priority Register A for Slave 0 */
47#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */ 47#define AT91_MATRIX_PRAS1 0x88 /* Priority Register A for Slave 1 */
48#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */ 48#define AT91_MATRIX_PRAS2 0x90 /* Priority Register A for Slave 2 */
49#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */ 49#define AT91_MATRIX_PRAS3 0x98 /* Priority Register A for Slave 3 */
50#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */ 50#define AT91_MATRIX_PRAS4 0xA0 /* Priority Register A for Slave 4 */
51#define AT91_MATRIX_PRAS5 (AT91_MATRIX + 0xA8) /* Priority Register A for Slave 5 */ 51#define AT91_MATRIX_PRAS5 0xA8 /* Priority Register A for Slave 5 */
52#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */ 52#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
53#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */ 53#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
54#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */ 54#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
@@ -56,7 +56,7 @@
56#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */ 56#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */
57#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */ 57#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */
58 58
59#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */ 59#define AT91_MATRIX_MRCR 0x100 /* Master Remap Control Register */
60#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 60#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
61#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 61#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
62#define AT91_MATRIX_RCB2 (1 << 2) 62#define AT91_MATRIX_RCB2 (1 << 2)
@@ -64,7 +64,7 @@
64#define AT91_MATRIX_RCB4 (1 << 4) 64#define AT91_MATRIX_RCB4 (1 << 4)
65#define AT91_MATRIX_RCB5 (1 << 5) 65#define AT91_MATRIX_RCB5 (1 << 5)
66 66
67#define AT91_MATRIX_TCMR (AT91_MATRIX + 0x114) /* TCM Configuration Register */ 67#define AT91_MATRIX_TCMR 0x114 /* TCM Configuration Register */
68#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */ 68#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */
69#define AT91_MATRIX_ITCM_0 (0 << 0) 69#define AT91_MATRIX_ITCM_0 (0 << 0)
70#define AT91_MATRIX_ITCM_16 (5 << 0) 70#define AT91_MATRIX_ITCM_16 (5 << 0)
@@ -74,7 +74,7 @@
74#define AT91_MATRIX_DTCM_16 (5 << 4) 74#define AT91_MATRIX_DTCM_16 (5 << 4)
75#define AT91_MATRIX_DTCM_32 (6 << 4) 75#define AT91_MATRIX_DTCM_32 (6 << 4)
76 76
77#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x120) /* EBI0 Chip Select Assignment Register */ 77#define AT91_MATRIX_EBICSA 0x120 /* EBI0 Chip Select Assignment Register */
78#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */ 78#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
79#define AT91_MATRIX_CS1A_SMC (0 << 1) 79#define AT91_MATRIX_CS1A_SMC (0 << 1)
80#define AT91_MATRIX_CS1A_SDRAMC (1 << 1) 80#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h b/arch/arm/mach-at91/include/mach/at91sam9x5.h
new file mode 100644
index 00000000000..a297a77d88e
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h
@@ -0,0 +1,79 @@
1/*
2 * Chip-specific header file for the AT91SAM9x5 family
3 *
4 * Copyright (C) 2009-2012 Atmel Corporation.
5 *
6 * Common definitions.
7 * Based on AT91SAM9x5 datasheet.
8 *
9 * Licensed under GPLv2 or later.
10 */
11
12#ifndef AT91SAM9X5_H
13#define AT91SAM9X5_H
14
15/*
16 * Peripheral identifiers/interrupts.
17 */
18#define AT91SAM9X5_ID_PIOAB 2 /* Parallel I/O Controller A and B */
19#define AT91SAM9X5_ID_PIOCD 3 /* Parallel I/O Controller C and D */
20#define AT91SAM9X5_ID_SMD 4 /* SMD Soft Modem (SMD) */
21#define AT91SAM9X5_ID_USART0 5 /* USART 0 */
22#define AT91SAM9X5_ID_USART1 6 /* USART 1 */
23#define AT91SAM9X5_ID_USART2 7 /* USART 2 */
24#define AT91SAM9X5_ID_USART3 8 /* USART 3 */
25#define AT91SAM9X5_ID_TWI0 9 /* Two-Wire Interface 0 */
26#define AT91SAM9X5_ID_TWI1 10 /* Two-Wire Interface 1 */
27#define AT91SAM9X5_ID_TWI2 11 /* Two-Wire Interface 2 */
28#define AT91SAM9X5_ID_MCI0 12 /* High Speed Multimedia Card Interface 0 */
29#define AT91SAM9X5_ID_SPI0 13 /* Serial Peripheral Interface 0 */
30#define AT91SAM9X5_ID_SPI1 14 /* Serial Peripheral Interface 1 */
31#define AT91SAM9X5_ID_UART0 15 /* UART 0 */
32#define AT91SAM9X5_ID_UART1 16 /* UART 1 */
33#define AT91SAM9X5_ID_TCB 17 /* Timer Counter 0, 1, 2, 3, 4 and 5 */
34#define AT91SAM9X5_ID_PWM 18 /* Pulse Width Modulation Controller */
35#define AT91SAM9X5_ID_ADC 19 /* ADC Controller */
36#define AT91SAM9X5_ID_DMA0 20 /* DMA Controller 0 */
37#define AT91SAM9X5_ID_DMA1 21 /* DMA Controller 1 */
38#define AT91SAM9X5_ID_UHPHS 22 /* USB Host High Speed */
39#define AT91SAM9X5_ID_UDPHS 23 /* USB Device High Speed */
40#define AT91SAM9X5_ID_EMAC0 24 /* Ethernet MAC0 */
41#define AT91SAM9X5_ID_LCDC 25 /* LCD Controller */
42#define AT91SAM9X5_ID_ISI 25 /* Image Sensor Interface */
43#define AT91SAM9X5_ID_MCI1 26 /* High Speed Multimedia Card Interface 1 */
44#define AT91SAM9X5_ID_EMAC1 27 /* Ethernet MAC1 */
45#define AT91SAM9X5_ID_SSC 28 /* Synchronous Serial Controller */
46#define AT91SAM9X5_ID_CAN0 29 /* CAN Controller 0 */
47#define AT91SAM9X5_ID_CAN1 30 /* CAN Controller 1 */
48#define AT91SAM9X5_ID_IRQ0 31 /* Advanced Interrupt Controller */
49
50/*
51 * User Peripheral physical base addresses.
52 */
53#define AT91SAM9X5_BASE_USART0 0xf801c000
54#define AT91SAM9X5_BASE_USART1 0xf8020000
55#define AT91SAM9X5_BASE_USART2 0xf8024000
56
57/*
58 * System Peripherals
59 */
60#define AT91SAM9X5_BASE_DDRSDRC0 0xffffe800
61
62/*
63 * Base addresses for early serial code (uncompress.h)
64 */
65#define AT91_DBGU AT91_BASE_DBGU0
66#define AT91_USART0 AT91SAM9X5_BASE_USART0
67#define AT91_USART1 AT91SAM9X5_BASE_USART1
68#define AT91_USART2 AT91SAM9X5_BASE_USART2
69
70/*
71 * Internal Memory.
72 */
73#define AT91SAM9X5_SRAM_BASE 0x00300000 /* Internal SRAM base address */
74#define AT91SAM9X5_SRAM_SIZE SZ_32K /* Internal SRAM size (32Kb) */
75
76#define AT91SAM9X5_ROM_BASE 0x00400000 /* Internal ROM base address */
77#define AT91SAM9X5_ROM_SIZE SZ_64K /* Internal ROM size (64Kb) */
78
79#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9x5_matrix.h
new file mode 100644
index 00000000000..a606d396647
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9x5_matrix.h
@@ -0,0 +1,53 @@
1/*
2 * Matrix-centric header file for the AT91SAM9x5 family
3 *
4 * Copyright (C) 2009-2012 Atmel Corporation.
5 *
6 * Only EBI related registers.
7 * Write Protect register definitions may be useful.
8 *
9 * Licensed under GPLv2 or later.
10 */
11
12#ifndef AT91SAM9X5_MATRIX_H
13#define AT91SAM9X5_MATRIX_H
14
15#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x120) /* EBI Chip Select Assignment Register */
16#define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
17#define AT91_MATRIX_EBI_CS1A_SMC (0 << 1)
18#define AT91_MATRIX_EBI_CS1A_SDRAMC (1 << 1)
19#define AT91_MATRIX_EBI_CS3A (1 << 3) /* Chip Select 3 Assignment */
20#define AT91_MATRIX_EBI_CS3A_SMC (0 << 3)
21#define AT91_MATRIX_EBI_CS3A_SMC_NANDFLASH (1 << 3)
22#define AT91_MATRIX_EBI_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
23#define AT91_MATRIX_EBI_DBPU_ON (0 << 8)
24#define AT91_MATRIX_EBI_DBPU_OFF (1 << 8)
25#define AT91_MATRIX_EBI_VDDIOMSEL (1 << 16) /* Memory voltage selection */
26#define AT91_MATRIX_EBI_VDDIOMSEL_1_8V (0 << 16)
27#define AT91_MATRIX_EBI_VDDIOMSEL_3_3V (1 << 16)
28#define AT91_MATRIX_EBI_EBI_IOSR (1 << 17) /* EBI I/O slew rate selection */
29#define AT91_MATRIX_EBI_EBI_IOSR_REDUCED (0 << 17)
30#define AT91_MATRIX_EBI_EBI_IOSR_NORMAL (1 << 17)
31#define AT91_MATRIX_EBI_DDR_IOSR (1 << 18) /* DDR2 dedicated port I/O slew rate selection */
32#define AT91_MATRIX_EBI_DDR_IOSR_REDUCED (0 << 18)
33#define AT91_MATRIX_EBI_DDR_IOSR_NORMAL (1 << 18)
34#define AT91_MATRIX_NFD0_SELECT (1 << 24) /* NAND Flash Data Bus Selection */
35#define AT91_MATRIX_NFD0_ON_D0 (0 << 24)
36#define AT91_MATRIX_NFD0_ON_D16 (1 << 24)
37#define AT91_MATRIX_DDR_MP_EN (1 << 25) /* DDR Multi-port Enable */
38#define AT91_MATRIX_MP_OFF (0 << 25)
39#define AT91_MATRIX_MP_ON (1 << 25)
40
41#define AT91_MATRIX_WPMR (AT91_MATRIX + 0x1E4) /* Write Protect Mode Register */
42#define AT91_MATRIX_WPMR_WPEN (1 << 0) /* Write Protect ENable */
43#define AT91_MATRIX_WPMR_WP_WPDIS (0 << 0)
44#define AT91_MATRIX_WPMR_WP_WPEN (1 << 0)
45#define AT91_MATRIX_WPMR_WPKEY (0xFFFFFF << 8) /* Write Protect KEY */
46
47#define AT91_MATRIX_WPSR (AT91_MATRIX + 0x1E8) /* Write Protect Status Register */
48#define AT91_MATRIX_WPSR_WPVS (1 << 0) /* Write Protect Violation Status */
49#define AT91_MATRIX_WPSR_NO_WPV (0 << 0)
50#define AT91_MATRIX_WPSR_WPV (1 << 0)
51#define AT91_MATRIX_WPSR_WPVSRC (0xFFFF << 8) /* Write Protect Violation Source */
52
53#endif
diff --git a/arch/arm/mach-at91/include/mach/at91x40.h b/arch/arm/mach-at91/include/mach/at91x40.h
index a57829f4fd1..90680217064 100644
--- a/arch/arm/mach-at91/include/mach/at91x40.h
+++ b/arch/arm/mach-at91/include/mach/at91x40.h
@@ -28,18 +28,18 @@
28#define AT91X40_ID_IRQ2 18 /* External IRQ 2 */ 28#define AT91X40_ID_IRQ2 18 /* External IRQ 2 */
29 29
30/* 30/*
31 * System Peripherals (offset from AT91_BASE_SYS) 31 * System Peripherals
32 */ 32 */
33#define AT91_BASE_SYS 0xffc00000 33#define AT91_BASE_SYS 0xffc00000
34 34
35#define AT91_EBI (0xffe00000 - AT91_BASE_SYS) /* External Bus Interface */ 35#define AT91_EBI 0xffe00000 /* External Bus Interface */
36#define AT91_SF (0xfff00000 - AT91_BASE_SYS) /* Special Function */ 36#define AT91_SF 0xfff00000 /* Special Function */
37#define AT91_USART1 (0xfffcc000 - AT91_BASE_SYS) /* USART 1 */ 37#define AT91_USART1 0xfffcc000 /* USART 1 */
38#define AT91_USART0 (0xfffd0000 - AT91_BASE_SYS) /* USART 0 */ 38#define AT91_USART0 0xfffd0000 /* USART 0 */
39#define AT91_TC (0xfffe0000 - AT91_BASE_SYS) /* Timer Counter */ 39#define AT91_TC 0xfffe0000 /* Timer Counter */
40#define AT91_PIOA (0xffff0000 - AT91_BASE_SYS) /* PIO Controller A */ 40#define AT91_PIOA 0xffff0000 /* PIO Controller A */
41#define AT91_PS (0xffff4000 - AT91_BASE_SYS) /* Power Save */ 41#define AT91_PS 0xffff4000 /* Power Save */
42#define AT91_WD (0xffff8000 - AT91_BASE_SYS) /* Watchdog Timer */ 42#define AT91_WD 0xffff8000 /* Watchdog Timer */
43 43
44/* 44/*
45 * The AT91x40 series doesn't have a debug unit like the other AT91 parts. 45 * The AT91x40 series doesn't have a debug unit like the other AT91 parts.
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 3b33f07b1e1..dc8d6d4f17c 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -107,6 +107,8 @@ struct atmel_nand_data {
107 u8 ale; /* address line number connected to ALE */ 107 u8 ale; /* address line number connected to ALE */
108 u8 cle; /* address line number connected to CLE */ 108 u8 cle; /* address line number connected to CLE */
109 u8 bus_width_16; /* buswidth is 16 bit */ 109 u8 bus_width_16; /* buswidth is 16 bit */
110 u8 correction_cap; /* PMECC correction capability */
111 u16 sector_size; /* Sector size for PMECC */
110 struct mtd_partition *parts; 112 struct mtd_partition *parts;
111 unsigned int num_parts; 113 unsigned int num_parts;
112}; 114};
@@ -179,7 +181,9 @@ extern void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data);
179extern void __init at91_add_device_ac97(struct ac97c_platform_data *data); 181extern void __init at91_add_device_ac97(struct ac97c_platform_data *data);
180 182
181 /* ISI */ 183 /* ISI */
182extern void __init at91_add_device_isi(void); 184struct isi_platform_data;
185extern void __init at91_add_device_isi(struct isi_platform_data *data,
186 bool use_pck_as_mck);
183 187
184 /* Touchscreen Controller */ 188 /* Touchscreen Controller */
185struct at91_tsadcc_data { 189struct at91_tsadcc_data {
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index f6ce936dba2..0118c333855 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -25,7 +25,6 @@
25#define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */ 25#define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */
26#define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */ 26#define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */
27#define ARCH_ID_AT91SAM9X5 0x819a05a0 27#define ARCH_ID_AT91SAM9X5 0x819a05a0
28#define ARCH_ID_AT91CAP9 0x039A03A0
29 28
30#define ARCH_ID_AT91SAM9XE128 0x329973a0 29#define ARCH_ID_AT91SAM9XE128 0x329973a0
31#define ARCH_ID_AT91SAM9XE256 0x329a93a0 30#define ARCH_ID_AT91SAM9XE256 0x329a93a0
@@ -51,10 +50,6 @@
51#define ARCH_FAMILY_AT91SAM9 0x01900000 50#define ARCH_FAMILY_AT91SAM9 0x01900000
52#define ARCH_FAMILY_AT91SAM9XE 0x02900000 51#define ARCH_FAMILY_AT91SAM9XE 0x02900000
53 52
54/* PMC revision */
55#define ARCH_REVISION_CAP9_B 0x399
56#define ARCH_REVISION_CAP9_C 0x601
57
58/* RM9200 type */ 53/* RM9200 type */
59#define ARCH_REVISON_9200_BGA (0 << 0) 54#define ARCH_REVISON_9200_BGA (0 << 0)
60#define ARCH_REVISON_9200_PQFP (1 << 0) 55#define ARCH_REVISON_9200_PQFP (1 << 0)
@@ -63,9 +58,6 @@ enum at91_soc_type {
63 /* 920T */ 58 /* 920T */
64 AT91_SOC_RM9200, 59 AT91_SOC_RM9200,
65 60
66 /* CAP */
67 AT91_SOC_CAP9,
68
69 /* SAM92xx */ 61 /* SAM92xx */
70 AT91_SOC_SAM9260, AT91_SOC_SAM9261, AT91_SOC_SAM9263, 62 AT91_SOC_SAM9260, AT91_SOC_SAM9261, AT91_SOC_SAM9263,
71 63
@@ -86,9 +78,6 @@ enum at91_soc_subtype {
86 /* RM9200 */ 78 /* RM9200 */
87 AT91_SOC_RM9200_BGA, AT91_SOC_RM9200_PQFP, 79 AT91_SOC_RM9200_BGA, AT91_SOC_RM9200_PQFP,
88 80
89 /* CAP9 */
90 AT91_SOC_CAP9_REV_B, AT91_SOC_CAP9_REV_C,
91
92 /* SAM9260 */ 81 /* SAM9260 */
93 AT91_SOC_SAM9XE, 82 AT91_SOC_SAM9XE,
94 83
@@ -195,16 +184,6 @@ static inline int at91_soc_is_detected(void)
195#define cpu_is_at91sam9x25() (0) 184#define cpu_is_at91sam9x25() (0)
196#endif 185#endif
197 186
198#ifdef CONFIG_ARCH_AT91CAP9
199#define cpu_is_at91cap9() (at91_soc_initdata.type == AT91_SOC_CAP9)
200#define cpu_is_at91cap9_revB() (at91_soc_initdata.subtype == AT91_SOC_CAP9_REV_B)
201#define cpu_is_at91cap9_revC() (at91_soc_initdata.subtype == AT91_SOC_CAP9_REV_C)
202#else
203#define cpu_is_at91cap9() (0)
204#define cpu_is_at91cap9_revB() (0)
205#define cpu_is_at91cap9_revC() (0)
206#endif
207
208/* 187/*
209 * Since this is ARM, we will never run on any AVR32 CPU. But these 188 * Since this is ARM, we will never run on any AVR32 CPU. But these
210 * definitions may reduce clutter in common drivers. 189 * definitions may reduce clutter in common drivers.
diff --git a/arch/arm/mach-at91/include/mach/entry-macro.S b/arch/arm/mach-at91/include/mach/entry-macro.S
index 423eea0ed74..903bf205a33 100644
--- a/arch/arm/mach-at91/include/mach/entry-macro.S
+++ b/arch/arm/mach-at91/include/mach/entry-macro.S
@@ -13,17 +13,11 @@
13#include <mach/hardware.h> 13#include <mach/hardware.h>
14#include <mach/at91_aic.h> 14#include <mach/at91_aic.h>
15 15
16 .macro disable_fiq
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp 16 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =at91_aic_base @ base virtual address of AIC peripheral 17 ldr \base, =at91_aic_base @ base virtual address of AIC peripheral
21 ldr \base, [\base] 18 ldr \base, [\base]
22 .endm 19 .endm
23 20
24 .macro arch_ret_to_user, tmp1, tmp2
25 .endm
26
27 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
28 ldr \irqnr, [\base, #AT91_AIC_IVR] @ read IRQ vector register: de-asserts nIRQ to processor (and clears interrupt) 22 ldr \irqnr, [\base, #AT91_AIC_IVR] @ read IRQ vector register: de-asserts nIRQ to processor (and clears interrupt)
29 ldr \irqstat, [\base, #AT91_AIC_ISR] @ read interrupt source number 23 ldr \irqstat, [\base, #AT91_AIC_ISR] @ read interrupt source number
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index e3fd225121c..eed465ab0dd 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -191,10 +191,15 @@
191extern int __init_or_module at91_set_GPIO_periph(unsigned pin, int use_pullup); 191extern int __init_or_module at91_set_GPIO_periph(unsigned pin, int use_pullup);
192extern int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup); 192extern int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup);
193extern int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup); 193extern int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup);
194extern int __init_or_module at91_set_C_periph(unsigned pin, int use_pullup);
195extern int __init_or_module at91_set_D_periph(unsigned pin, int use_pullup);
194extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup); 196extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup);
195extern int __init_or_module at91_set_gpio_output(unsigned pin, int value); 197extern int __init_or_module at91_set_gpio_output(unsigned pin, int value);
196extern int __init_or_module at91_set_deglitch(unsigned pin, int is_on); 198extern int __init_or_module at91_set_deglitch(unsigned pin, int is_on);
199extern int __init_or_module at91_set_debounce(unsigned pin, int is_on, int div);
197extern int __init_or_module at91_set_multi_drive(unsigned pin, int is_on); 200extern int __init_or_module at91_set_multi_drive(unsigned pin, int is_on);
201extern int __init_or_module at91_set_pulldown(unsigned pin, int is_on);
202extern int __init_or_module at91_disable_schmitt_trig(unsigned pin);
198 203
199/* callable at any time */ 204/* callable at any time */
200extern int at91_set_gpio_value(unsigned pin, int value); 205extern int at91_set_gpio_value(unsigned pin, int value);
@@ -204,18 +209,6 @@ extern int at91_get_gpio_value(unsigned pin);
204extern void at91_gpio_suspend(void); 209extern void at91_gpio_suspend(void);
205extern void at91_gpio_resume(void); 210extern void at91_gpio_resume(void);
206 211
207/*-------------------------------------------------------------------------*/
208
209/* wrappers for "new style" GPIO calls. the old AT91-specific ones should
210 * eventually be removed (along with this errno.h inclusion), and the
211 * gpio request/free calls should probably be implemented.
212 */
213
214#include <asm/errno.h>
215
216#define gpio_to_irq(gpio) (gpio + NR_AIC_IRQS)
217#define irq_to_gpio(irq) (irq - NR_AIC_IRQS)
218
219#endif /* __ASSEMBLY__ */ 212#endif /* __ASSEMBLY__ */
220 213
221#endif 214#endif
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
index 2d0e4e99856..e9e29a6c386 100644
--- a/arch/arm/mach-at91/include/mach/hardware.h
+++ b/arch/arm/mach-at91/include/mach/hardware.h
@@ -19,7 +19,7 @@
19/* DBGU base */ 19/* DBGU base */
20/* rm9200, 9260/9g20, 9261/9g10, 9rl */ 20/* rm9200, 9260/9g20, 9261/9g10, 9rl */
21#define AT91_BASE_DBGU0 0xfffff200 21#define AT91_BASE_DBGU0 0xfffff200
22/* 9263, 9g45, cap9 */ 22/* 9263, 9g45 */
23#define AT91_BASE_DBGU1 0xffffee00 23#define AT91_BASE_DBGU1 0xffffee00
24 24
25#if defined(CONFIG_ARCH_AT91RM9200) 25#if defined(CONFIG_ARCH_AT91RM9200)
@@ -34,8 +34,8 @@
34#include <mach/at91sam9rl.h> 34#include <mach/at91sam9rl.h>
35#elif defined(CONFIG_ARCH_AT91SAM9G45) 35#elif defined(CONFIG_ARCH_AT91SAM9G45)
36#include <mach/at91sam9g45.h> 36#include <mach/at91sam9g45.h>
37#elif defined(CONFIG_ARCH_AT91CAP9) 37#elif defined(CONFIG_ARCH_AT91SAM9X5)
38#include <mach/at91cap9.h> 38#include <mach/at91sam9x5.h>
39#elif defined(CONFIG_ARCH_AT91X40) 39#elif defined(CONFIG_ARCH_AT91X40)
40#include <mach/at91x40.h> 40#include <mach/at91x40.h>
41#else 41#else
@@ -59,9 +59,10 @@
59 59
60/* 60/*
61 * On all at91 have the Advanced Interrupt Controller starts at address 61 * On all at91 have the Advanced Interrupt Controller starts at address
62 * 0xfffff000 62 * 0xfffff000 and the Power Management Controller starts at 0xfffffc00
63 */ 63 */
64#define AT91_AIC 0xfffff000 64#define AT91_AIC 0xfffff000
65#define AT91_PMC 0xfffffc00
65 66
66/* 67/*
67 * Peripheral identifiers/interrupts. 68 * Peripheral identifiers/interrupts.
diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h
index 4ca09ef7ca2..4003001eca3 100644
--- a/arch/arm/mach-at91/include/mach/io.h
+++ b/arch/arm/mach-at91/include/mach/io.h
@@ -28,22 +28,4 @@
28#define __io(a) __typesafe_io(a) 28#define __io(a) __typesafe_io(a)
29#define __mem_pci(a) (a) 29#define __mem_pci(a) (a)
30 30
31#ifndef __ASSEMBLY__
32
33static inline unsigned int at91_sys_read(unsigned int reg_offset)
34{
35 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
36
37 return __raw_readl(addr + reg_offset);
38}
39
40static inline void at91_sys_write(unsigned int reg_offset, unsigned long value)
41{
42 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
43
44 __raw_writel(value, addr + reg_offset);
45}
46
47#endif
48
49#endif 31#endif
diff --git a/arch/arm/mach-at91/include/mach/system.h b/arch/arm/mach-at91/include/mach/system.h
deleted file mode 100644
index cbd64f3bcec..00000000000
--- a/arch/arm/mach-at91/include/mach/system.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/system.h
3 *
4 * Copyright (C) 2003 SAN People
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#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24#include <mach/hardware.h>
25#include <mach/at91_st.h>
26#include <mach/at91_dbgu.h>
27#include <mach/at91_pmc.h>
28
29static inline void arch_idle(void)
30{
31 /*
32 * Disable the processor clock. The processor will be automatically
33 * re-enabled by an interrupt or by a reset.
34 */
35#ifdef AT91_PS
36 at91_sys_write(AT91_PS_CR, AT91_PS_CR_CPU);
37#else
38 at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK);
39#endif
40#ifndef CONFIG_CPU_ARM920T
41 /*
42 * Set the processor (CP15) into 'Wait for Interrupt' mode.
43 * Post-RM9200 processors need this in conjunction with the above
44 * to save power when idle.
45 */
46 cpu_do_idle();
47#endif
48}
49
50#endif
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c
index be6b639ecd7..cfcfcbe3626 100644
--- a/arch/arm/mach-at91/irq.c
+++ b/arch/arm/mach-at91/irq.c
@@ -24,6 +24,12 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/irq.h>
28#include <linux/of.h>
29#include <linux/of_address.h>
30#include <linux/of_irq.h>
31#include <linux/irqdomain.h>
32#include <linux/err.h>
27 33
28#include <mach/hardware.h> 34#include <mach/hardware.h>
29#include <asm/irq.h> 35#include <asm/irq.h>
@@ -34,22 +40,24 @@
34#include <asm/mach/map.h> 40#include <asm/mach/map.h>
35 41
36void __iomem *at91_aic_base; 42void __iomem *at91_aic_base;
43static struct irq_domain *at91_aic_domain;
44static struct device_node *at91_aic_np;
37 45
38static void at91_aic_mask_irq(struct irq_data *d) 46static void at91_aic_mask_irq(struct irq_data *d)
39{ 47{
40 /* Disable interrupt on AIC */ 48 /* Disable interrupt on AIC */
41 at91_aic_write(AT91_AIC_IDCR, 1 << d->irq); 49 at91_aic_write(AT91_AIC_IDCR, 1 << d->hwirq);
42} 50}
43 51
44static void at91_aic_unmask_irq(struct irq_data *d) 52static void at91_aic_unmask_irq(struct irq_data *d)
45{ 53{
46 /* Enable interrupt on AIC */ 54 /* Enable interrupt on AIC */
47 at91_aic_write(AT91_AIC_IECR, 1 << d->irq); 55 at91_aic_write(AT91_AIC_IECR, 1 << d->hwirq);
48} 56}
49 57
50unsigned int at91_extern_irq; 58unsigned int at91_extern_irq;
51 59
52#define is_extern_irq(irq) ((1 << (irq)) & at91_extern_irq) 60#define is_extern_irq(hwirq) ((1 << (hwirq)) & at91_extern_irq)
53 61
54static int at91_aic_set_type(struct irq_data *d, unsigned type) 62static int at91_aic_set_type(struct irq_data *d, unsigned type)
55{ 63{
@@ -63,13 +71,13 @@ static int at91_aic_set_type(struct irq_data *d, unsigned type)
63 srctype = AT91_AIC_SRCTYPE_RISING; 71 srctype = AT91_AIC_SRCTYPE_RISING;
64 break; 72 break;
65 case IRQ_TYPE_LEVEL_LOW: 73 case IRQ_TYPE_LEVEL_LOW:
66 if ((d->irq == AT91_ID_FIQ) || is_extern_irq(d->irq)) /* only supported on external interrupts */ 74 if ((d->hwirq == AT91_ID_FIQ) || is_extern_irq(d->hwirq)) /* only supported on external interrupts */
67 srctype = AT91_AIC_SRCTYPE_LOW; 75 srctype = AT91_AIC_SRCTYPE_LOW;
68 else 76 else
69 return -EINVAL; 77 return -EINVAL;
70 break; 78 break;
71 case IRQ_TYPE_EDGE_FALLING: 79 case IRQ_TYPE_EDGE_FALLING:
72 if ((d->irq == AT91_ID_FIQ) || is_extern_irq(d->irq)) /* only supported on external interrupts */ 80 if ((d->hwirq == AT91_ID_FIQ) || is_extern_irq(d->hwirq)) /* only supported on external interrupts */
73 srctype = AT91_AIC_SRCTYPE_FALLING; 81 srctype = AT91_AIC_SRCTYPE_FALLING;
74 else 82 else
75 return -EINVAL; 83 return -EINVAL;
@@ -78,8 +86,8 @@ static int at91_aic_set_type(struct irq_data *d, unsigned type)
78 return -EINVAL; 86 return -EINVAL;
79 } 87 }
80 88
81 smr = at91_aic_read(AT91_AIC_SMR(d->irq)) & ~AT91_AIC_SRCTYPE; 89 smr = at91_aic_read(AT91_AIC_SMR(d->hwirq)) & ~AT91_AIC_SRCTYPE;
82 at91_aic_write(AT91_AIC_SMR(d->irq), smr | srctype); 90 at91_aic_write(AT91_AIC_SMR(d->hwirq), smr | srctype);
83 return 0; 91 return 0;
84} 92}
85 93
@@ -90,13 +98,13 @@ static u32 backups;
90 98
91static int at91_aic_set_wake(struct irq_data *d, unsigned value) 99static int at91_aic_set_wake(struct irq_data *d, unsigned value)
92{ 100{
93 if (unlikely(d->irq >= 32)) 101 if (unlikely(d->hwirq >= NR_AIC_IRQS))
94 return -EINVAL; 102 return -EINVAL;
95 103
96 if (value) 104 if (value)
97 wakeups |= (1 << d->irq); 105 wakeups |= (1 << d->hwirq);
98 else 106 else
99 wakeups &= ~(1 << d->irq); 107 wakeups &= ~(1 << d->hwirq);
100 108
101 return 0; 109 return 0;
102} 110}
@@ -127,46 +135,112 @@ static struct irq_chip at91_aic_chip = {
127 .irq_set_wake = at91_aic_set_wake, 135 .irq_set_wake = at91_aic_set_wake,
128}; 136};
129 137
138static void __init at91_aic_hw_init(unsigned int spu_vector)
139{
140 int i;
141
142 /*
143 * Perform 8 End Of Interrupt Command to make sure AIC
144 * will not Lock out nIRQ
145 */
146 for (i = 0; i < 8; i++)
147 at91_aic_write(AT91_AIC_EOICR, 0);
148
149 /*
150 * Spurious Interrupt ID in Spurious Vector Register.
151 * When there is no current interrupt, the IRQ Vector Register
152 * reads the value stored in AIC_SPU
153 */
154 at91_aic_write(AT91_AIC_SPU, spu_vector);
155
156 /* No debugging in AIC: Debug (Protect) Control Register */
157 at91_aic_write(AT91_AIC_DCR, 0);
158
159 /* Disable and clear all interrupts initially */
160 at91_aic_write(AT91_AIC_IDCR, 0xFFFFFFFF);
161 at91_aic_write(AT91_AIC_ICCR, 0xFFFFFFFF);
162}
163
164#if defined(CONFIG_OF)
165static int at91_aic_irq_map(struct irq_domain *h, unsigned int virq,
166 irq_hw_number_t hw)
167{
168 /* Put virq number in Source Vector Register */
169 at91_aic_write(AT91_AIC_SVR(hw), virq);
170
171 /* Active Low interrupt, without priority */
172 at91_aic_write(AT91_AIC_SMR(hw), AT91_AIC_SRCTYPE_LOW);
173
174 irq_set_chip_and_handler(virq, &at91_aic_chip, handle_level_irq);
175 set_irq_flags(virq, IRQF_VALID | IRQF_PROBE);
176
177 return 0;
178}
179
180static struct irq_domain_ops at91_aic_irq_ops = {
181 .map = at91_aic_irq_map,
182 .xlate = irq_domain_xlate_twocell,
183};
184
185int __init at91_aic_of_init(struct device_node *node,
186 struct device_node *parent)
187{
188 at91_aic_base = of_iomap(node, 0);
189 at91_aic_np = node;
190
191 at91_aic_domain = irq_domain_add_linear(at91_aic_np, NR_AIC_IRQS,
192 &at91_aic_irq_ops, NULL);
193 if (!at91_aic_domain)
194 panic("Unable to add AIC irq domain (DT)\n");
195
196 irq_set_default_host(at91_aic_domain);
197
198 at91_aic_hw_init(NR_AIC_IRQS);
199
200 return 0;
201}
202#endif
203
130/* 204/*
131 * Initialize the AIC interrupt controller. 205 * Initialize the AIC interrupt controller.
132 */ 206 */
133void __init at91_aic_init(unsigned int priority[NR_AIC_IRQS]) 207void __init at91_aic_init(unsigned int priority[NR_AIC_IRQS])
134{ 208{
135 unsigned int i; 209 unsigned int i;
210 int irq_base;
136 211
137 at91_aic_base = ioremap(AT91_AIC, 512); 212 at91_aic_base = ioremap(AT91_AIC, 512);
138
139 if (!at91_aic_base) 213 if (!at91_aic_base)
140 panic("Impossible to ioremap AT91_AIC\n"); 214 panic("Unable to ioremap AIC registers\n");
215
216 /* Add irq domain for AIC */
217 irq_base = irq_alloc_descs(-1, 0, NR_AIC_IRQS, 0);
218 if (irq_base < 0) {
219 WARN(1, "Cannot allocate irq_descs, assuming pre-allocated\n");
220 irq_base = 0;
221 }
222 at91_aic_domain = irq_domain_add_legacy(at91_aic_np, NR_AIC_IRQS,
223 irq_base, 0,
224 &irq_domain_simple_ops, NULL);
225
226 if (!at91_aic_domain)
227 panic("Unable to add AIC irq domain\n");
228
229 irq_set_default_host(at91_aic_domain);
141 230
142 /* 231 /*
143 * The IVR is used by macro get_irqnr_and_base to read and verify. 232 * The IVR is used by macro get_irqnr_and_base to read and verify.
144 * The irq number is NR_AIC_IRQS when a spurious interrupt has occurred. 233 * The irq number is NR_AIC_IRQS when a spurious interrupt has occurred.
145 */ 234 */
146 for (i = 0; i < NR_AIC_IRQS; i++) { 235 for (i = 0; i < NR_AIC_IRQS; i++) {
147 /* Put irq number in Source Vector Register: */ 236 /* Put hardware irq number in Source Vector Register: */
148 at91_aic_write(AT91_AIC_SVR(i), i); 237 at91_aic_write(AT91_AIC_SVR(i), i);
149 /* Active Low interrupt, with the specified priority */ 238 /* Active Low interrupt, with the specified priority */
150 at91_aic_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]); 239 at91_aic_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]);
151 240
152 irq_set_chip_and_handler(i, &at91_aic_chip, handle_level_irq); 241 irq_set_chip_and_handler(i, &at91_aic_chip, handle_level_irq);
153 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 242 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
154
155 /* Perform 8 End Of Interrupt Command to make sure AIC will not Lock out nIRQ */
156 if (i < 8)
157 at91_aic_write(AT91_AIC_EOICR, 0);
158 } 243 }
159 244
160 /* 245 at91_aic_hw_init(NR_AIC_IRQS);
161 * Spurious Interrupt ID in Spurious Vector Register is NR_AIC_IRQS
162 * When there is no current interrupt, the IRQ Vector Register reads the value stored in AIC_SPU
163 */
164 at91_aic_write(AT91_AIC_SPU, NR_AIC_IRQS);
165
166 /* No debugging in AIC: Debug (Protect) Control Register */
167 at91_aic_write(AT91_AIC_DCR, 0);
168
169 /* Disable and clear all interrupts initially */
170 at91_aic_write(AT91_AIC_IDCR, 0xFFFFFFFF);
171 at91_aic_write(AT91_AIC_ICCR, 0xFFFFFFFF);
172} 246}
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 1606379ac28..6c9d5e69ac2 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -136,7 +136,7 @@ static int at91_pm_verify_clocks(void)
136 unsigned long scsr; 136 unsigned long scsr;
137 int i; 137 int i;
138 138
139 scsr = at91_sys_read(AT91_PMC_SCSR); 139 scsr = at91_pmc_read(AT91_PMC_SCSR);
140 140
141 /* USB must not be using PLLB */ 141 /* USB must not be using PLLB */
142 if (cpu_is_at91rm9200()) { 142 if (cpu_is_at91rm9200()) {
@@ -150,11 +150,6 @@ static int at91_pm_verify_clocks(void)
150 pr_err("AT91: PM - Suspend-to-RAM with USB still active\n"); 150 pr_err("AT91: PM - Suspend-to-RAM with USB still active\n");
151 return 0; 151 return 0;
152 } 152 }
153 } else if (cpu_is_at91cap9()) {
154 if ((scsr & AT91CAP9_PMC_UHP) != 0) {
155 pr_err("AT91: PM - Suspend-to-RAM with USB still active\n");
156 return 0;
157 }
158 } 153 }
159 154
160#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS 155#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
@@ -165,7 +160,7 @@ static int at91_pm_verify_clocks(void)
165 if ((scsr & (AT91_PMC_PCK0 << i)) == 0) 160 if ((scsr & (AT91_PMC_PCK0 << i)) == 0)
166 continue; 161 continue;
167 162
168 css = at91_sys_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS; 163 css = at91_pmc_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS;
169 if (css != AT91_PMC_CSS_SLOW) { 164 if (css != AT91_PMC_CSS_SLOW) {
170 pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); 165 pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css);
171 return 0; 166 return 0;
@@ -193,23 +188,36 @@ int at91_suspend_entering_slow_clock(void)
193EXPORT_SYMBOL(at91_suspend_entering_slow_clock); 188EXPORT_SYMBOL(at91_suspend_entering_slow_clock);
194 189
195 190
196static void (*slow_clock)(void); 191static void (*slow_clock)(void __iomem *pmc, void __iomem *ramc0,
192 void __iomem *ramc1, int memctrl);
197 193
198#ifdef CONFIG_AT91_SLOW_CLOCK 194#ifdef CONFIG_AT91_SLOW_CLOCK
199extern void at91_slow_clock(void); 195extern void at91_slow_clock(void __iomem *pmc, void __iomem *ramc0,
196 void __iomem *ramc1, int memctrl);
200extern u32 at91_slow_clock_sz; 197extern u32 at91_slow_clock_sz;
201#endif 198#endif
202 199
200void __iomem *at91_ramc_base[2];
201
202void __init at91_ioremap_ramc(int id, u32 addr, u32 size)
203{
204 if (id < 0 || id > 1) {
205 pr_emerg("Wrong RAM controller id (%d), cannot continue\n", id);
206 BUG();
207 }
208 at91_ramc_base[id] = ioremap(addr, size);
209 if (!at91_ramc_base[id])
210 panic("Impossible to ioremap ramc.%d 0x%x\n", id, addr);
211}
203 212
204static int at91_pm_enter(suspend_state_t state) 213static int at91_pm_enter(suspend_state_t state)
205{ 214{
206 u32 saved_lpr;
207 at91_gpio_suspend(); 215 at91_gpio_suspend();
208 at91_irq_suspend(); 216 at91_irq_suspend();
209 217
210 pr_debug("AT91: PM - wake mask %08x, pm state %d\n", 218 pr_debug("AT91: PM - wake mask %08x, pm state %d\n",
211 /* remember all the always-wake irqs */ 219 /* remember all the always-wake irqs */
212 (at91_sys_read(AT91_PMC_PCSR) 220 (at91_pmc_read(AT91_PMC_PCSR)
213 | (1 << AT91_ID_FIQ) 221 | (1 << AT91_ID_FIQ)
214 | (1 << AT91_ID_SYS) 222 | (1 << AT91_ID_SYS)
215 | (at91_extern_irq)) 223 | (at91_extern_irq))
@@ -234,11 +242,18 @@ static int at91_pm_enter(suspend_state_t state)
234 * turning off the main oscillator; reverse on wakeup. 242 * turning off the main oscillator; reverse on wakeup.
235 */ 243 */
236 if (slow_clock) { 244 if (slow_clock) {
245 int memctrl = AT91_MEMCTRL_SDRAMC;
246
247 if (cpu_is_at91rm9200())
248 memctrl = AT91_MEMCTRL_MC;
249 else if (cpu_is_at91sam9g45())
250 memctrl = AT91_MEMCTRL_DDRSDR;
237#ifdef CONFIG_AT91_SLOW_CLOCK 251#ifdef CONFIG_AT91_SLOW_CLOCK
238 /* copy slow_clock handler to SRAM, and call it */ 252 /* copy slow_clock handler to SRAM, and call it */
239 memcpy(slow_clock, at91_slow_clock, at91_slow_clock_sz); 253 memcpy(slow_clock, at91_slow_clock, at91_slow_clock_sz);
240#endif 254#endif
241 slow_clock(); 255 slow_clock(at91_pmc_base, at91_ramc_base[0],
256 at91_ramc_base[1], memctrl);
242 break; 257 break;
243 } else { 258 } else {
244 pr_info("AT91: PM - no slow clock mode enabled ...\n"); 259 pr_info("AT91: PM - no slow clock mode enabled ...\n");
@@ -259,16 +274,7 @@ static int at91_pm_enter(suspend_state_t state)
259 * For ARM 926 based chips, this requirement is weaker 274 * For ARM 926 based chips, this requirement is weaker
260 * as at91sam9 can access a RAM in self-refresh mode. 275 * as at91sam9 can access a RAM in self-refresh mode.
261 */ 276 */
262 asm volatile ( "mov r0, #0\n\t" 277 at91_standby();
263 "b 1f\n\t"
264 ".align 5\n\t"
265 "1: mcr p15, 0, r0, c7, c10, 4\n\t"
266 : /* no output */
267 : /* no input */
268 : "r0");
269 saved_lpr = sdram_selfrefresh_enable();
270 wait_for_interrupt_enable();
271 sdram_selfrefresh_disable(saved_lpr);
272 break; 278 break;
273 279
274 case PM_SUSPEND_ON: 280 case PM_SUSPEND_ON:
@@ -316,7 +322,7 @@ static int __init at91_pm_init(void)
316 322
317#ifdef CONFIG_ARCH_AT91RM9200 323#ifdef CONFIG_ARCH_AT91RM9200
318 /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */ 324 /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */
319 at91_sys_write(AT91_SDRAMC_LPR, 0); 325 at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0);
320#endif 326#endif
321 327
322 suspend_set_ops(&at91_pm_ops); 328 suspend_set_ops(&at91_pm_ops);
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index 7eb40d24242..89f56f3a802 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -1,5 +1,19 @@
1/*
2 * AT91 Power Management
3 *
4 * Copyright (C) 2005 David Brownell
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#ifndef __ARCH_ARM_MACH_AT91_PM
12#define __ARCH_ARM_MACH_AT91_PM
13
14#include <mach/at91_ramc.h>
1#ifdef CONFIG_ARCH_AT91RM9200 15#ifdef CONFIG_ARCH_AT91RM9200
2#include <mach/at91rm9200_mc.h> 16#include <mach/at91rm9200_sdramc.h>
3 17
4/* 18/*
5 * The AT91RM9200 goes into self-refresh mode with this command, and will 19 * The AT91RM9200 goes into self-refresh mode with this command, and will
@@ -11,51 +25,37 @@
11 * still in self-refresh is "not recommended", but seems to work. 25 * still in self-refresh is "not recommended", but seems to work.
12 */ 26 */
13 27
14static inline u32 sdram_selfrefresh_enable(void) 28static inline void at91rm9200_standby(void)
15{ 29{
16 u32 saved_lpr = at91_sys_read(AT91_SDRAMC_LPR); 30 u32 lpr = at91_ramc_read(0, AT91RM9200_SDRAMC_LPR);
17 31
18 at91_sys_write(AT91_SDRAMC_LPR, 0); 32 asm volatile(
19 at91_sys_write(AT91_SDRAMC_SRR, 1); 33 "b 1f\n\t"
20 return saved_lpr; 34 ".align 5\n\t"
35 "1: mcr p15, 0, %0, c7, c10, 4\n\t"
36 " str %0, [%1, %2]\n\t"
37 " str %3, [%1, %4]\n\t"
38 " mcr p15, 0, %0, c7, c0, 4\n\t"
39 " str %5, [%1, %2]"
40 :
41 : "r" (0), "r" (AT91_BASE_SYS), "r" (AT91RM9200_SDRAMC_LPR),
42 "r" (1), "r" (AT91RM9200_SDRAMC_SRR),
43 "r" (lpr));
21} 44}
22 45
23#define sdram_selfrefresh_disable(saved_lpr) at91_sys_write(AT91_SDRAMC_LPR, saved_lpr) 46#define at91_standby at91rm9200_standby
24#define wait_for_interrupt_enable() asm volatile ("mcr p15, 0, %0, c7, c0, 4" \
25 : : "r" (0))
26
27#elif defined(CONFIG_ARCH_AT91CAP9)
28#include <mach/at91sam9_ddrsdr.h>
29
30
31static inline u32 sdram_selfrefresh_enable(void)
32{
33 u32 saved_lpr, lpr;
34
35 saved_lpr = at91_ramc_read(0, AT91CAP9_DDRSDRC_LPR);
36
37 lpr = saved_lpr & ~AT91_DDRSDRC_LPCB;
38 at91_ramc_write(0, AT91CAP9_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH);
39 return saved_lpr;
40}
41
42#define sdram_selfrefresh_disable(saved_lpr) at91_ramc_write(0, AT91CAP9_DDRSDRC_LPR, saved_lpr)
43#define wait_for_interrupt_enable() cpu_do_idle()
44 47
45#elif defined(CONFIG_ARCH_AT91SAM9G45) 48#elif defined(CONFIG_ARCH_AT91SAM9G45)
46#include <mach/at91sam9_ddrsdr.h>
47 49
48/* We manage both DDRAM/SDRAM controllers, we need more than one value to 50/* We manage both DDRAM/SDRAM controllers, we need more than one value to
49 * remember. 51 * remember.
50 */ 52 */
51static u32 saved_lpr1; 53static inline void at91sam9g45_standby(void)
52
53static inline u32 sdram_selfrefresh_enable(void)
54{ 54{
55 /* Those tow values allow us to delay self-refresh activation 55 /* Those two values allow us to delay self-refresh activation
56 * to the maximum. */ 56 * to the maximum. */
57 u32 lpr0, lpr1; 57 u32 lpr0, lpr1;
58 u32 saved_lpr0; 58 u32 saved_lpr0, saved_lpr1;
59 59
60 saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR); 60 saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR);
61 lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB; 61 lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB;
@@ -69,18 +69,15 @@ static inline u32 sdram_selfrefresh_enable(void)
69 at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0); 69 at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0);
70 at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1); 70 at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1);
71 71
72 return saved_lpr0; 72 cpu_do_idle();
73
74 at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0);
75 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
73} 76}
74 77
75#define sdram_selfrefresh_disable(saved_lpr0) \ 78#define at91_standby at91sam9g45_standby
76 do { \
77 at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0); \
78 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); \
79 } while (0)
80#define wait_for_interrupt_enable() cpu_do_idle()
81 79
82#else 80#else
83#include <mach/at91sam9_sdramc.h>
84 81
85#ifdef CONFIG_ARCH_AT91SAM9263 82#ifdef CONFIG_ARCH_AT91SAM9263
86/* 83/*
@@ -90,18 +87,23 @@ static inline u32 sdram_selfrefresh_enable(void)
90#warning Assuming EB1 SDRAM controller is *NOT* used 87#warning Assuming EB1 SDRAM controller is *NOT* used
91#endif 88#endif
92 89
93static inline u32 sdram_selfrefresh_enable(void) 90static inline void at91sam9_standby(void)
94{ 91{
95 u32 saved_lpr, lpr; 92 u32 saved_lpr, lpr;
96 93
97 saved_lpr = at91_ramc_read(0, AT91_SDRAMC_LPR); 94 saved_lpr = at91_ramc_read(0, AT91_SDRAMC_LPR);
98 95
99 lpr = saved_lpr & ~AT91_SDRAMC_LPCB; 96 lpr = saved_lpr & ~AT91_SDRAMC_LPCB;
100 at91_ramc_write(0, AT91_SDRAMC_LPR, lpr | AT91_SDRAMC_LPCB_SELF_REFRESH); 97 at91_ramc_write(0, AT91_SDRAMC_LPR, lpr |
101 return saved_lpr; 98 AT91_SDRAMC_LPCB_SELF_REFRESH);
99
100 cpu_do_idle();
101
102 at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr);
102} 103}
103 104
104#define sdram_selfrefresh_disable(saved_lpr) at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr) 105#define at91_standby at91sam9_standby
105#define wait_for_interrupt_enable() cpu_do_idle() 106
107#endif
106 108
107#endif 109#endif
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S
index 92dfb846139..db5452123f1 100644
--- a/arch/arm/mach-at91/pm_slowclock.S
+++ b/arch/arm/mach-at91/pm_slowclock.S
@@ -15,15 +15,7 @@
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <mach/at91_pmc.h> 17#include <mach/at91_pmc.h>
18 18#include <mach/at91_ramc.h>
19#if defined(CONFIG_ARCH_AT91RM9200)
20#include <mach/at91rm9200_mc.h>
21#elif defined(CONFIG_ARCH_AT91CAP9) \
22 || defined(CONFIG_ARCH_AT91SAM9G45)
23#include <mach/at91sam9_ddrsdr.h>
24#else
25#include <mach/at91sam9_sdramc.h>
26#endif
27 19
28 20
29#ifdef CONFIG_ARCH_AT91SAM9263 21#ifdef CONFIG_ARCH_AT91SAM9263
@@ -47,17 +39,23 @@
47#define PLLALOCK_TIMEOUT 1000 39#define PLLALOCK_TIMEOUT 1000
48#define PLLBLOCK_TIMEOUT 1000 40#define PLLBLOCK_TIMEOUT 1000
49 41
42pmc .req r0
43sdramc .req r1
44ramc1 .req r2
45memctrl .req r3
46tmp1 .req r4
47tmp2 .req r5
50 48
51/* 49/*
52 * Wait until master clock is ready (after switching master clock source) 50 * Wait until master clock is ready (after switching master clock source)
53 */ 51 */
54 .macro wait_mckrdy 52 .macro wait_mckrdy
55 mov r4, #MCKRDY_TIMEOUT 53 mov tmp2, #MCKRDY_TIMEOUT
561: sub r4, r4, #1 541: sub tmp2, tmp2, #1
57 cmp r4, #0 55 cmp tmp2, #0
58 beq 2f 56 beq 2f
59 ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)] 57 ldr tmp1, [pmc, #AT91_PMC_SR]
60 tst r3, #AT91_PMC_MCKRDY 58 tst tmp1, #AT91_PMC_MCKRDY
61 beq 1b 59 beq 1b
622: 602:
63 .endm 61 .endm
@@ -66,12 +64,12 @@
66 * Wait until master oscillator has stabilized. 64 * Wait until master oscillator has stabilized.
67 */ 65 */
68 .macro wait_moscrdy 66 .macro wait_moscrdy
69 mov r4, #MOSCRDY_TIMEOUT 67 mov tmp2, #MOSCRDY_TIMEOUT
701: sub r4, r4, #1 681: sub tmp2, tmp2, #1
71 cmp r4, #0 69 cmp tmp2, #0
72 beq 2f 70 beq 2f
73 ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)] 71 ldr tmp1, [pmc, #AT91_PMC_SR]
74 tst r3, #AT91_PMC_MOSCS 72 tst tmp1, #AT91_PMC_MOSCS
75 beq 1b 73 beq 1b
762: 742:
77 .endm 75 .endm
@@ -80,12 +78,12 @@
80 * Wait until PLLA has locked. 78 * Wait until PLLA has locked.
81 */ 79 */
82 .macro wait_pllalock 80 .macro wait_pllalock
83 mov r4, #PLLALOCK_TIMEOUT 81 mov tmp2, #PLLALOCK_TIMEOUT
841: sub r4, r4, #1 821: sub tmp2, tmp2, #1
85 cmp r4, #0 83 cmp tmp2, #0
86 beq 2f 84 beq 2f
87 ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)] 85 ldr tmp1, [pmc, #AT91_PMC_SR]
88 tst r3, #AT91_PMC_LOCKA 86 tst tmp1, #AT91_PMC_LOCKA
89 beq 1b 87 beq 1b
902: 882:
91 .endm 89 .endm
@@ -94,80 +92,98 @@
94 * Wait until PLLB has locked. 92 * Wait until PLLB has locked.
95 */ 93 */
96 .macro wait_pllblock 94 .macro wait_pllblock
97 mov r4, #PLLBLOCK_TIMEOUT 95 mov tmp2, #PLLBLOCK_TIMEOUT
981: sub r4, r4, #1 961: sub tmp2, tmp2, #1
99 cmp r4, #0 97 cmp tmp2, #0
100 beq 2f 98 beq 2f
101 ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)] 99 ldr tmp1, [pmc, #AT91_PMC_SR]
102 tst r3, #AT91_PMC_LOCKB 100 tst tmp1, #AT91_PMC_LOCKB
103 beq 1b 101 beq 1b
1042: 1022:
105 .endm 103 .endm
106 104
107 .text 105 .text
108 106
107/* void at91_slow_clock(void __iomem *pmc, void __iomem *sdramc,
108 * void __iomem *ramc1, int memctrl)
109 */
109ENTRY(at91_slow_clock) 110ENTRY(at91_slow_clock)
110 /* Save registers on stack */ 111 /* Save registers on stack */
111 stmfd sp!, {r0 - r12, lr} 112 stmfd sp!, {r4 - r12, lr}
112 113
113 /* 114 /*
114 * Register usage: 115 * Register usage:
115 * R1 = Base address of AT91_PMC 116 * R0 = Base address of AT91_PMC
116 * R2 = Base address of RAM Controller (SDRAM, DDRSDR, or AT91_SYS) 117 * R1 = Base address of RAM Controller (SDRAM, DDRSDR, or AT91_SYS)
117 * R3 = temporary register 118 * R2 = Base address of second RAM Controller or 0 if not present
119 * R3 = Memory controller
118 * R4 = temporary register 120 * R4 = temporary register
119 * R5 = Base address of second RAM Controller or 0 if not present 121 * R5 = temporary register
120 */ 122 */
121 ldr r1, .at91_va_base_pmc
122 ldr r2, .at91_va_base_sdramc
123 ldr r5, .at91_va_base_ramc1
124 123
125 /* Drain write buffer */ 124 /* Drain write buffer */
126 mov r0, #0 125 mov tmp1, #0
127 mcr p15, 0, r0, c7, c10, 4 126 mcr p15, 0, tmp1, c7, c10, 4
127
128 cmp memctrl, #AT91_MEMCTRL_MC
129 bne ddr_sr_enable
128 130
129#ifdef CONFIG_ARCH_AT91RM9200 131 /*
132 * at91rm9200 Memory controller
133 */
130 /* Put SDRAM in self-refresh mode */ 134 /* Put SDRAM in self-refresh mode */
131 mov r3, #1 135 mov tmp1, #1
132 str r3, [r2, #AT91_SDRAMC_SRR] 136 str tmp1, [sdramc, #AT91RM9200_SDRAMC_SRR]
133#elif defined(CONFIG_ARCH_AT91CAP9) \ 137 b sdr_sr_done
134 || defined(CONFIG_ARCH_AT91SAM9G45) 138
139 /*
140 * DDRSDR Memory controller
141 */
142ddr_sr_enable:
143 cmp memctrl, #AT91_MEMCTRL_DDRSDR
144 bne sdr_sr_enable
135 145
136 /* prepare for DDRAM self-refresh mode */ 146 /* prepare for DDRAM self-refresh mode */
137 ldr r3, [r2, #AT91_DDRSDRC_LPR] 147 ldr tmp1, [sdramc, #AT91_DDRSDRC_LPR]
138 str r3, .saved_sam9_lpr 148 str tmp1, .saved_sam9_lpr
139 bic r3, #AT91_DDRSDRC_LPCB 149 bic tmp1, #AT91_DDRSDRC_LPCB
140 orr r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH 150 orr tmp1, #AT91_DDRSDRC_LPCB_SELF_REFRESH
141 151
142 /* figure out if we use the second ram controller */ 152 /* figure out if we use the second ram controller */
143 cmp r5, #0 153 cmp ramc1, #0
144 ldrne r4, [r5, #AT91_DDRSDRC_LPR] 154 ldrne tmp2, [ramc1, #AT91_DDRSDRC_LPR]
145 strne r4, .saved_sam9_lpr1 155 strne tmp2, .saved_sam9_lpr1
146 bicne r4, #AT91_DDRSDRC_LPCB 156 bicne tmp2, #AT91_DDRSDRC_LPCB
147 orrne r4, #AT91_DDRSDRC_LPCB_SELF_REFRESH 157 orrne tmp2, #AT91_DDRSDRC_LPCB_SELF_REFRESH
148 158
149 /* Enable DDRAM self-refresh mode */ 159 /* Enable DDRAM self-refresh mode */
150 str r3, [r2, #AT91_DDRSDRC_LPR] 160 str tmp1, [sdramc, #AT91_DDRSDRC_LPR]
151 strne r4, [r5, #AT91_DDRSDRC_LPR] 161 strne tmp2, [ramc1, #AT91_DDRSDRC_LPR]
152#else 162
163 b sdr_sr_done
164
165 /*
166 * SDRAMC Memory controller
167 */
168sdr_sr_enable:
153 /* Enable SDRAM self-refresh mode */ 169 /* Enable SDRAM self-refresh mode */
154 ldr r3, [r2, #AT91_SDRAMC_LPR] 170 ldr tmp1, [sdramc, #AT91_SDRAMC_LPR]
155 str r3, .saved_sam9_lpr 171 str tmp1, .saved_sam9_lpr
156 172
157 bic r3, #AT91_SDRAMC_LPCB 173 bic tmp1, #AT91_SDRAMC_LPCB
158 orr r3, #AT91_SDRAMC_LPCB_SELF_REFRESH 174 orr tmp1, #AT91_SDRAMC_LPCB_SELF_REFRESH
159 str r3, [r2, #AT91_SDRAMC_LPR] 175 str tmp1, [sdramc, #AT91_SDRAMC_LPR]
160#endif
161 176
177sdr_sr_done:
162 /* Save Master clock setting */ 178 /* Save Master clock setting */
163 ldr r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)] 179 ldr tmp1, [pmc, #AT91_PMC_MCKR]
164 str r3, .saved_mckr 180 str tmp1, .saved_mckr
165 181
166 /* 182 /*
167 * Set the Master clock source to slow clock 183 * Set the Master clock source to slow clock
168 */ 184 */
169 bic r3, r3, #AT91_PMC_CSS 185 bic tmp1, tmp1, #AT91_PMC_CSS
170 str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)] 186 str tmp1, [pmc, #AT91_PMC_MCKR]
171 187
172 wait_mckrdy 188 wait_mckrdy
173 189
@@ -177,61 +193,61 @@ ENTRY(at91_slow_clock)
177 * 193 *
178 * See AT91RM9200 errata #27 and #28 for details. 194 * See AT91RM9200 errata #27 and #28 for details.
179 */ 195 */
180 mov r3, #0 196 mov tmp1, #0
181 str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)] 197 str tmp1, [pmc, #AT91_PMC_MCKR]
182 198
183 wait_mckrdy 199 wait_mckrdy
184#endif 200#endif
185 201
186 /* Save PLLA setting and disable it */ 202 /* Save PLLA setting and disable it */
187 ldr r3, [r1, #(AT91_CKGR_PLLAR - AT91_PMC)] 203 ldr tmp1, [pmc, #AT91_CKGR_PLLAR]
188 str r3, .saved_pllar 204 str tmp1, .saved_pllar
189 205
190 mov r3, #AT91_PMC_PLLCOUNT 206 mov tmp1, #AT91_PMC_PLLCOUNT
191 orr r3, r3, #(1 << 29) /* bit 29 always set */ 207 orr tmp1, tmp1, #(1 << 29) /* bit 29 always set */
192 str r3, [r1, #(AT91_CKGR_PLLAR - AT91_PMC)] 208 str tmp1, [pmc, #AT91_CKGR_PLLAR]
193 209
194 /* Save PLLB setting and disable it */ 210 /* Save PLLB setting and disable it */
195 ldr r3, [r1, #(AT91_CKGR_PLLBR - AT91_PMC)] 211 ldr tmp1, [pmc, #AT91_CKGR_PLLBR]
196 str r3, .saved_pllbr 212 str tmp1, .saved_pllbr
197 213
198 mov r3, #AT91_PMC_PLLCOUNT 214 mov tmp1, #AT91_PMC_PLLCOUNT
199 str r3, [r1, #(AT91_CKGR_PLLBR - AT91_PMC)] 215 str tmp1, [pmc, #AT91_CKGR_PLLBR]
200 216
201 /* Turn off the main oscillator */ 217 /* Turn off the main oscillator */
202 ldr r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)] 218 ldr tmp1, [pmc, #AT91_CKGR_MOR]
203 bic r3, r3, #AT91_PMC_MOSCEN 219 bic tmp1, tmp1, #AT91_PMC_MOSCEN
204 str r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)] 220 str tmp1, [pmc, #AT91_CKGR_MOR]
205 221
206 /* Wait for interrupt */ 222 /* Wait for interrupt */
207 mcr p15, 0, r0, c7, c0, 4 223 mcr p15, 0, tmp1, c7, c0, 4
208 224
209 /* Turn on the main oscillator */ 225 /* Turn on the main oscillator */
210 ldr r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)] 226 ldr tmp1, [pmc, #AT91_CKGR_MOR]
211 orr r3, r3, #AT91_PMC_MOSCEN 227 orr tmp1, tmp1, #AT91_PMC_MOSCEN
212 str r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)] 228 str tmp1, [pmc, #AT91_CKGR_MOR]
213 229
214 wait_moscrdy 230 wait_moscrdy
215 231
216 /* Restore PLLB setting */ 232 /* Restore PLLB setting */
217 ldr r3, .saved_pllbr 233 ldr tmp1, .saved_pllbr
218 str r3, [r1, #(AT91_CKGR_PLLBR - AT91_PMC)] 234 str tmp1, [pmc, #AT91_CKGR_PLLBR]
219 235
220 tst r3, #(AT91_PMC_MUL & 0xff0000) 236 tst tmp1, #(AT91_PMC_MUL & 0xff0000)
221 bne 1f 237 bne 1f
222 tst r3, #(AT91_PMC_MUL & ~0xff0000) 238 tst tmp1, #(AT91_PMC_MUL & ~0xff0000)
223 beq 2f 239 beq 2f
2241: 2401:
225 wait_pllblock 241 wait_pllblock
2262: 2422:
227 243
228 /* Restore PLLA setting */ 244 /* Restore PLLA setting */
229 ldr r3, .saved_pllar 245 ldr tmp1, .saved_pllar
230 str r3, [r1, #(AT91_CKGR_PLLAR - AT91_PMC)] 246 str tmp1, [pmc, #AT91_CKGR_PLLAR]
231 247
232 tst r3, #(AT91_PMC_MUL & 0xff0000) 248 tst tmp1, #(AT91_PMC_MUL & 0xff0000)
233 bne 3f 249 bne 3f
234 tst r3, #(AT91_PMC_MUL & ~0xff0000) 250 tst tmp1, #(AT91_PMC_MUL & ~0xff0000)
235 beq 4f 251 beq 4f
2363: 2523:
237 wait_pllalock 253 wait_pllalock
@@ -244,11 +260,11 @@ ENTRY(at91_slow_clock)
244 * 260 *
245 * See AT91RM9200 errata #27 and #28 for details. 261 * See AT91RM9200 errata #27 and #28 for details.
246 */ 262 */
247 ldr r3, .saved_mckr 263 ldr tmp1, .saved_mckr
248 tst r3, #AT91_PMC_PRES 264 tst tmp1, #AT91_PMC_PRES
249 beq 2f 265 beq 2f
250 and r3, r3, #AT91_PMC_PRES 266 and tmp1, tmp1, #AT91_PMC_PRES
251 str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)] 267 str tmp1, [pmc, #AT91_PMC_MCKR]
252 268
253 wait_mckrdy 269 wait_mckrdy
254#endif 270#endif
@@ -256,32 +272,45 @@ ENTRY(at91_slow_clock)
256 /* 272 /*
257 * Restore master clock setting 273 * Restore master clock setting
258 */ 274 */
2592: ldr r3, .saved_mckr 2752: ldr tmp1, .saved_mckr
260 str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)] 276 str tmp1, [pmc, #AT91_PMC_MCKR]
261 277
262 wait_mckrdy 278 wait_mckrdy
263 279
264#ifdef CONFIG_ARCH_AT91RM9200 280 /*
265 /* Do nothing - self-refresh is automatically disabled. */ 281 * at91rm9200 Memory controller
266#elif defined(CONFIG_ARCH_AT91CAP9) \ 282 * Do nothing - self-refresh is automatically disabled.
267 || defined(CONFIG_ARCH_AT91SAM9G45) 283 */
284 cmp memctrl, #AT91_MEMCTRL_MC
285 beq ram_restored
286
287 /*
288 * DDRSDR Memory controller
289 */
290 cmp memctrl, #AT91_MEMCTRL_DDRSDR
291 bne sdr_en_restore
268 /* Restore LPR on AT91 with DDRAM */ 292 /* Restore LPR on AT91 with DDRAM */
269 ldr r3, .saved_sam9_lpr 293 ldr tmp1, .saved_sam9_lpr
270 str r3, [r2, #AT91_DDRSDRC_LPR] 294 str tmp1, [sdramc, #AT91_DDRSDRC_LPR]
271 295
272 /* if we use the second ram controller */ 296 /* if we use the second ram controller */
273 cmp r5, #0 297 cmp ramc1, #0
274 ldrne r4, .saved_sam9_lpr1 298 ldrne tmp2, .saved_sam9_lpr1
275 strne r4, [r5, #AT91_DDRSDRC_LPR] 299 strne tmp2, [ramc1, #AT91_DDRSDRC_LPR]
300
301 b ram_restored
276 302
277#else 303 /*
304 * SDRAMC Memory controller
305 */
306sdr_en_restore:
278 /* Restore LPR on AT91 with SDRAM */ 307 /* Restore LPR on AT91 with SDRAM */
279 ldr r3, .saved_sam9_lpr 308 ldr tmp1, .saved_sam9_lpr
280 str r3, [r2, #AT91_SDRAMC_LPR] 309 str tmp1, [sdramc, #AT91_SDRAMC_LPR]
281#endif
282 310
311ram_restored:
283 /* Restore registers, and return */ 312 /* Restore registers, and return */
284 ldmfd sp!, {r0 - r12, pc} 313 ldmfd sp!, {r4 - r12, pc}
285 314
286 315
287.saved_mckr: 316.saved_mckr:
@@ -299,27 +328,5 @@ ENTRY(at91_slow_clock)
299.saved_sam9_lpr1: 328.saved_sam9_lpr1:
300 .word 0 329 .word 0
301 330
302.at91_va_base_pmc:
303 .word AT91_VA_BASE_SYS + AT91_PMC
304
305#ifdef CONFIG_ARCH_AT91RM9200
306.at91_va_base_sdramc:
307 .word AT91_VA_BASE_SYS
308#elif defined(CONFIG_ARCH_AT91CAP9) \
309 || defined(CONFIG_ARCH_AT91SAM9G45)
310.at91_va_base_sdramc:
311 .word AT91_VA_BASE_SYS + AT91_DDRSDRC0
312#else
313.at91_va_base_sdramc:
314 .word AT91_VA_BASE_SYS + AT91_SDRAMC0
315#endif
316
317.at91_va_base_ramc1:
318#if defined(CONFIG_ARCH_AT91SAM9G45)
319 .word AT91_VA_BASE_SYS + AT91_DDRSDRC1
320#else
321 .word 0
322#endif
323
324ENTRY(at91_slow_clock_sz) 331ENTRY(at91_slow_clock_sz)
325 .word .-at91_slow_clock 332 .word .-at91_slow_clock
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 69d3fc4c46f..372396c2ecb 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -86,20 +86,6 @@ static void __init soc_detect(u32 dbgu_base)
86 socid = cidr & ~AT91_CIDR_VERSION; 86 socid = cidr & ~AT91_CIDR_VERSION;
87 87
88 switch (socid) { 88 switch (socid) {
89 case ARCH_ID_AT91CAP9: {
90#ifdef CONFIG_AT91_PMC_UNIT
91 u32 pmc_ver = at91_sys_read(AT91_PMC_VER);
92
93 if (pmc_ver == ARCH_REVISION_CAP9_B)
94 at91_soc_initdata.subtype = AT91_SOC_CAP9_REV_B;
95 else if (pmc_ver == ARCH_REVISION_CAP9_C)
96 at91_soc_initdata.subtype = AT91_SOC_CAP9_REV_C;
97#endif
98 at91_soc_initdata.type = AT91_SOC_CAP9;
99 at91_boot_soc = at91cap9_soc;
100 break;
101 }
102
103 case ARCH_ID_AT91RM9200: 89 case ARCH_ID_AT91RM9200:
104 at91_soc_initdata.type = AT91_SOC_RM9200; 90 at91_soc_initdata.type = AT91_SOC_RM9200;
105 at91_boot_soc = at91rm9200_soc; 91 at91_boot_soc = at91rm9200_soc;
@@ -200,7 +186,6 @@ static void __init soc_detect(u32 dbgu_base)
200 186
201static const char *soc_name[] = { 187static const char *soc_name[] = {
202 [AT91_SOC_RM9200] = "at91rm9200", 188 [AT91_SOC_RM9200] = "at91rm9200",
203 [AT91_SOC_CAP9] = "at91cap9",
204 [AT91_SOC_SAM9260] = "at91sam9260", 189 [AT91_SOC_SAM9260] = "at91sam9260",
205 [AT91_SOC_SAM9261] = "at91sam9261", 190 [AT91_SOC_SAM9261] = "at91sam9261",
206 [AT91_SOC_SAM9263] = "at91sam9263", 191 [AT91_SOC_SAM9263] = "at91sam9263",
@@ -221,8 +206,6 @@ EXPORT_SYMBOL(at91_get_soc_type);
221static const char *soc_subtype_name[] = { 206static const char *soc_subtype_name[] = {
222 [AT91_SOC_RM9200_BGA] = "at91rm9200 BGA", 207 [AT91_SOC_RM9200_BGA] = "at91rm9200 BGA",
223 [AT91_SOC_RM9200_PQFP] = "at91rm9200 PQFP", 208 [AT91_SOC_RM9200_PQFP] = "at91rm9200 PQFP",
224 [AT91_SOC_CAP9_REV_B] = "at91cap9 revB",
225 [AT91_SOC_CAP9_REV_C] = "at91cap9 revC",
226 [AT91_SOC_SAM9XE] = "at91sam9xe", 209 [AT91_SOC_SAM9XE] = "at91sam9xe",
227 [AT91_SOC_SAM9G45ES] = "at91sam9g45es", 210 [AT91_SOC_SAM9G45ES] = "at91sam9g45es",
228 [AT91_SOC_SAM9M10] = "at91sam9m10", 211 [AT91_SOC_SAM9M10] = "at91sam9m10",
@@ -293,6 +276,15 @@ void __init at91_ioremap_rstc(u32 base_addr)
293 panic("Impossible to ioremap at91_rstc_base\n"); 276 panic("Impossible to ioremap at91_rstc_base\n");
294} 277}
295 278
279void __iomem *at91_matrix_base;
280
281void __init at91_ioremap_matrix(u32 base_addr)
282{
283 at91_matrix_base = ioremap(base_addr, 512);
284 if (!at91_matrix_base)
285 panic("Impossible to ioremap at91_matrix_base\n");
286}
287
296void __init at91_initialize(unsigned long main_clock) 288void __init at91_initialize(unsigned long main_clock)
297{ 289{
298 at91_boot_soc.ioremap_registers(); 290 at91_boot_soc.ioremap_registers();
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
index 4588ae6f7ac..5db4aa45404 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -13,7 +13,6 @@ struct at91_init_soc {
13}; 13};
14 14
15extern struct at91_init_soc at91_boot_soc; 15extern struct at91_init_soc at91_boot_soc;
16extern struct at91_init_soc at91cap9_soc;
17extern struct at91_init_soc at91rm9200_soc; 16extern struct at91_init_soc at91rm9200_soc;
18extern struct at91_init_soc at91sam9260_soc; 17extern struct at91_init_soc at91sam9260_soc;
19extern struct at91_init_soc at91sam9261_soc; 18extern struct at91_init_soc at91sam9261_soc;
@@ -27,10 +26,6 @@ static inline int at91_soc_is_enabled(void)
27 return at91_boot_soc.init != NULL; 26 return at91_boot_soc.init != NULL;
28} 27}
29 28
30#if !defined(CONFIG_ARCH_AT91CAP9)
31#define at91cap9_soc at91_boot_soc
32#endif
33
34#if !defined(CONFIG_ARCH_AT91RM9200) 29#if !defined(CONFIG_ARCH_AT91RM9200)
35#define at91rm9200_soc at91_boot_soc 30#define at91rm9200_soc at91_boot_soc
36#endif 31#endif
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 6b67b7e8426..22e4e0a28ad 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -52,27 +52,8 @@
52#include <mach/csp/chipcHw_inline.h> 52#include <mach/csp/chipcHw_inline.h>
53#include <mach/csp/tmrHw_reg.h> 53#include <mach/csp/tmrHw_reg.h>
54 54
55#define AMBA_DEVICE(name, initname, base, plat, size) \ 55static AMBA_APB_DEVICE(uartA, "uarta", MM_ADDR_IO_UARTA, { IRQ_UARTA }, NULL);
56static struct amba_device name##_device = { \ 56static AMBA_APB_DEVICE(uartB, "uartb", MM_ADDR_IO_UARTB, { IRQ_UARTB }, NULL);
57 .dev = { \
58 .coherent_dma_mask = ~0, \
59 .init_name = initname, \
60 .platform_data = plat \
61 }, \
62 .res = { \
63 .start = MM_ADDR_IO_##base, \
64 .end = MM_ADDR_IO_##base + (size) - 1, \
65 .flags = IORESOURCE_MEM \
66 }, \
67 .dma_mask = ~0, \
68 .irq = { \
69 IRQ_##base \
70 } \
71}
72
73
74AMBA_DEVICE(uartA, "uarta", UARTA, NULL, SZ_4K);
75AMBA_DEVICE(uartB, "uartb", UARTB, NULL, SZ_4K);
76 57
77static struct clk pll1_clk = { 58static struct clk pll1_clk = {
78 .name = "PLL1", 59 .name = "PLL1",
diff --git a/arch/arm/mach-bcmring/include/mach/entry-macro.S b/arch/arm/mach-bcmring/include/mach/entry-macro.S
index 94c950d783b..2f316f0e6e6 100644
--- a/arch/arm/mach-bcmring/include/mach/entry-macro.S
+++ b/arch/arm/mach-bcmring/include/mach/entry-macro.S
@@ -21,9 +21,6 @@
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <mach/csp/mm_io.h> 22#include <mach/csp/mm_io.h>
23 23
24 .macro disable_fiq
25 .endm
26
27 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
28 ldr \base, =(MM_IO_BASE_INTC0) 25 ldr \base, =(MM_IO_BASE_INTC0)
29 ldr \irqstat, [\base, #0] @ get status 26 ldr \irqstat, [\base, #0] @ get status
@@ -77,6 +74,3 @@
77 74
78 .macro get_irqnr_preamble, base, tmp 75 .macro get_irqnr_preamble, base, tmp
79 .endm 76 .endm
80
81 .macro arch_ret_to_user, tmp1, tmp2
82 .endm
diff --git a/arch/arm/mach-bcmring/include/mach/system.h b/arch/arm/mach-bcmring/include/mach/system.h
deleted file mode 100644
index cb78250db64..00000000000
--- a/arch/arm/mach-bcmring/include/mach/system.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 *
3 * Copyright (C) 1999 ARM Limited
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#ifndef __ASM_ARCH_SYSTEM_H
21#define __ASM_ARCH_SYSTEM_H
22
23static inline void arch_idle(void)
24{
25 cpu_do_idle();
26}
27
28#endif
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index ab1711b9b4d..8736c1acc16 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -225,3 +225,19 @@ void clps711x_restart(char mode, const char *cmd)
225{ 225{
226 soft_restart(0); 226 soft_restart(0);
227} 227}
228
229static void clps711x_idle(void)
230{
231 clps_writel(1, HALT);
232 __asm__ __volatile__(
233 "mov r0, r0\n\
234 mov r0, r0");
235}
236
237static int __init clps711x_idle_init(void)
238{
239 arm_pm_idle = clps711x_idle;
240 return 0;
241}
242
243arch_initcall(clps711x_idle_init);
diff --git a/arch/arm/mach-clps711x/include/mach/entry-macro.S b/arch/arm/mach-clps711x/include/mach/entry-macro.S
index 90fa2f70489..125af59d7a2 100644
--- a/arch/arm/mach-clps711x/include/mach/entry-macro.S
+++ b/arch/arm/mach-clps711x/include/mach/entry-macro.S
@@ -10,15 +10,9 @@
10#include <mach/hardware.h> 10#include <mach/hardware.h>
11#include <asm/hardware/clps7111.h> 11#include <asm/hardware/clps7111.h>
12 12
13 .macro disable_fiq
14 .endm
15
16 .macro get_irqnr_preamble, base, tmp 13 .macro get_irqnr_preamble, base, tmp
17 .endm 14 .endm
18 15
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
22#if (INTSR2 - INTSR1) != (INTMR2 - INTMR1) 16#if (INTSR2 - INTSR1) != (INTMR2 - INTMR1)
23#error INTSR stride != INTMR stride 17#error INTSR stride != INTMR stride
24#endif 18#endif
diff --git a/arch/arm/mach-clps711x/include/mach/system.h b/arch/arm/mach-clps711x/include/mach/system.h
deleted file mode 100644
index 23d6ef8c84d..00000000000
--- a/arch/arm/mach-clps711x/include/mach/system.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/system.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#ifndef __ASM_ARCH_SYSTEM_H
21#define __ASM_ARCH_SYSTEM_H
22
23#include <linux/io.h>
24#include <mach/hardware.h>
25#include <asm/hardware/clps7111.h>
26
27static inline void arch_idle(void)
28{
29 clps_writel(1, HALT);
30 __asm__ __volatile__(
31 "mov r0, r0\n\
32 mov r0, r0");
33}
34
35#endif
diff --git a/arch/arm/mach-cns3xxx/include/mach/entry-macro.S b/arch/arm/mach-cns3xxx/include/mach/entry-macro.S
deleted file mode 100644
index 01c57df5f71..00000000000
--- a/arch/arm/mach-cns3xxx/include/mach/entry-macro.S
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Low-level IRQ helper macros for Cavium Networks platforms
3 *
4 * Copyright 2008 Cavium Networks
5 *
6 * This file 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 .macro disable_fiq
12 .endm
13
14 .macro arch_ret_to_user, tmp1, tmp2
15 .endm
diff --git a/arch/arm/mach-cns3xxx/include/mach/system.h b/arch/arm/mach-cns3xxx/include/mach/system.h
deleted file mode 100644
index 9e56b7dc133..00000000000
--- a/arch/arm/mach-cns3xxx/include/mach/system.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright 2000 Deep Blue Solutions Ltd
3 * Copyright 2003 ARM Limited
4 * Copyright 2008 Cavium Networks
5 *
6 * This file 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 __MACH_SYSTEM_H
12#define __MACH_SYSTEM_H
13
14#include <asm/proc-fns.h>
15
16static inline void arch_idle(void)
17{
18 /*
19 * This should do all the clock switching
20 * and wait for interrupt tricks
21 */
22 cpu_do_idle();
23}
24
25#endif
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c
index e159d69967c..79d001f831e 100644
--- a/arch/arm/mach-cns3xxx/pcie.c
+++ b/arch/arm/mach-cns3xxx/pcie.c
@@ -155,8 +155,8 @@ static int cns3xxx_pci_setup(int nr, struct pci_sys_data *sys)
155 BUG_ON(request_resource(&iomem_resource, res_io) || 155 BUG_ON(request_resource(&iomem_resource, res_io) ||
156 request_resource(&iomem_resource, res_mem)); 156 request_resource(&iomem_resource, res_mem));
157 157
158 pci_add_resource(&sys->resources, res_io); 158 pci_add_resource_offset(&sys->resources, res_io, sys->io_offset);
159 pci_add_resource(&sys->resources, res_mem); 159 pci_add_resource_offset(&sys->resources, res_mem, sys->mem_offset);
160 160
161 return 1; 161 return 1;
162} 162}
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index 275341f159f..82ed753fb36 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -26,13 +26,14 @@
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28 28
29#include <mach/dm355.h>
30#include <mach/i2c.h> 29#include <mach/i2c.h>
31#include <mach/serial.h> 30#include <mach/serial.h>
32#include <mach/nand.h> 31#include <mach/nand.h>
33#include <mach/mmc.h> 32#include <mach/mmc.h>
34#include <mach/usb.h> 33#include <mach/usb.h>
35 34
35#include "davinci.h"
36
36/* NOTE: this is geared for the standard config, with a socketed 37/* NOTE: this is geared for the standard config, with a socketed
37 * 2 GByte Micron NAND (MT29F16G08FAA) using 128KB sectors. If you 38 * 2 GByte Micron NAND (MT29F16G08FAA) using 128KB sectors. If you
38 * swap chips, maybe with a different block size, partitioning may 39 * swap chips, maybe with a different block size, partitioning may
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index e99db28181a..d74a8b3445f 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -23,13 +23,14 @@
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25 25
26#include <mach/dm355.h>
27#include <mach/i2c.h> 26#include <mach/i2c.h>
28#include <mach/serial.h> 27#include <mach/serial.h>
29#include <mach/nand.h> 28#include <mach/nand.h>
30#include <mach/mmc.h> 29#include <mach/mmc.h>
31#include <mach/usb.h> 30#include <mach/usb.h>
32 31
32#include "davinci.h"
33
33/* NOTE: this is geared for the standard config, with a socketed 34/* NOTE: this is geared for the standard config, with a socketed
34 * 2 GByte Micron NAND (MT29F16G08FAA) using 128KB sectors. If you 35 * 2 GByte Micron NAND (MT29F16G08FAA) using 128KB sectors. If you
35 * swap chips, maybe with a different block size, partitioning may 36 * swap chips, maybe with a different block size, partitioning may
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 849311d3cb7..5bce2b83bb4 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -32,7 +32,6 @@
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33 33
34#include <mach/mux.h> 34#include <mach/mux.h>
35#include <mach/dm365.h>
36#include <mach/common.h> 35#include <mach/common.h>
37#include <mach/i2c.h> 36#include <mach/i2c.h>
38#include <mach/serial.h> 37#include <mach/serial.h>
@@ -42,6 +41,8 @@
42 41
43#include <media/tvp514x.h> 42#include <media/tvp514x.h>
44 43
44#include "davinci.h"
45
45static inline int have_imager(void) 46static inline int have_imager(void)
46{ 47{
47 /* REVISIT when it's supported, trigger via Kconfig */ 48 /* REVISIT when it's supported, trigger via Kconfig */
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 1247ecdcf75..864f676ecca 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -30,7 +30,6 @@
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/dm644x.h>
34#include <mach/common.h> 33#include <mach/common.h>
35#include <mach/i2c.h> 34#include <mach/i2c.h>
36#include <mach/serial.h> 35#include <mach/serial.h>
@@ -40,6 +39,8 @@
40#include <mach/usb.h> 39#include <mach/usb.h>
41#include <mach/aemif.h> 40#include <mach/aemif.h>
42 41
42#include "davinci.h"
43
43#define DM644X_EVM_PHY_ID "davinci_mdio-0:01" 44#define DM644X_EVM_PHY_ID "davinci_mdio-0:01"
44#define LXT971_PHY_ID (0x001378e2) 45#define LXT971_PHY_ID (0x001378e2)
45#define LXT971_PHY_MASK (0xfffffff0) 46#define LXT971_PHY_MASK (0xfffffff0)
@@ -189,7 +190,7 @@ static struct platform_device davinci_fb_device = {
189 .num_resources = 0, 190 .num_resources = 0,
190}; 191};
191 192
192static struct tvp514x_platform_data tvp5146_pdata = { 193static struct tvp514x_platform_data dm644xevm_tvp5146_pdata = {
193 .clk_polarity = 0, 194 .clk_polarity = 0,
194 .hs_polarity = 1, 195 .hs_polarity = 1,
195 .vs_polarity = 1 196 .vs_polarity = 1
@@ -197,7 +198,7 @@ static struct tvp514x_platform_data tvp5146_pdata = {
197 198
198#define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL) 199#define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
199/* Inputs available at the TVP5146 */ 200/* Inputs available at the TVP5146 */
200static struct v4l2_input tvp5146_inputs[] = { 201static struct v4l2_input dm644xevm_tvp5146_inputs[] = {
201 { 202 {
202 .index = 0, 203 .index = 0,
203 .name = "Composite", 204 .name = "Composite",
@@ -217,7 +218,7 @@ static struct v4l2_input tvp5146_inputs[] = {
217 * ouput that goes to vpfe. There is a one to one correspondence 218 * ouput that goes to vpfe. There is a one to one correspondence
218 * with tvp5146_inputs 219 * with tvp5146_inputs
219 */ 220 */
220static struct vpfe_route tvp5146_routes[] = { 221static struct vpfe_route dm644xevm_tvp5146_routes[] = {
221 { 222 {
222 .input = INPUT_CVBS_VI2B, 223 .input = INPUT_CVBS_VI2B,
223 .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, 224 .output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
@@ -228,13 +229,13 @@ static struct vpfe_route tvp5146_routes[] = {
228 }, 229 },
229}; 230};
230 231
231static struct vpfe_subdev_info vpfe_sub_devs[] = { 232static struct vpfe_subdev_info dm644xevm_vpfe_sub_devs[] = {
232 { 233 {
233 .name = "tvp5146", 234 .name = "tvp5146",
234 .grp_id = 0, 235 .grp_id = 0,
235 .num_inputs = ARRAY_SIZE(tvp5146_inputs), 236 .num_inputs = ARRAY_SIZE(dm644xevm_tvp5146_inputs),
236 .inputs = tvp5146_inputs, 237 .inputs = dm644xevm_tvp5146_inputs,
237 .routes = tvp5146_routes, 238 .routes = dm644xevm_tvp5146_routes,
238 .can_route = 1, 239 .can_route = 1,
239 .ccdc_if_params = { 240 .ccdc_if_params = {
240 .if_type = VPFE_BT656, 241 .if_type = VPFE_BT656,
@@ -243,15 +244,15 @@ static struct vpfe_subdev_info vpfe_sub_devs[] = {
243 }, 244 },
244 .board_info = { 245 .board_info = {
245 I2C_BOARD_INFO("tvp5146", 0x5d), 246 I2C_BOARD_INFO("tvp5146", 0x5d),
246 .platform_data = &tvp5146_pdata, 247 .platform_data = &dm644xevm_tvp5146_pdata,
247 }, 248 },
248 }, 249 },
249}; 250};
250 251
251static struct vpfe_config vpfe_cfg = { 252static struct vpfe_config dm644xevm_capture_cfg = {
252 .num_subdevs = ARRAY_SIZE(vpfe_sub_devs), 253 .num_subdevs = ARRAY_SIZE(dm644xevm_vpfe_sub_devs),
253 .i2c_adapter_id = 1, 254 .i2c_adapter_id = 1,
254 .sub_devs = vpfe_sub_devs, 255 .sub_devs = dm644xevm_vpfe_sub_devs,
255 .card_name = "DM6446 EVM", 256 .card_name = "DM6446 EVM",
256 .ccdc = "DM6446 CCDC", 257 .ccdc = "DM6446 CCDC",
257}; 258};
@@ -624,8 +625,6 @@ static struct davinci_uart_config uart_config __initdata = {
624static void __init 625static void __init
625davinci_evm_map_io(void) 626davinci_evm_map_io(void)
626{ 627{
627 /* setup input configuration for VPFE input devices */
628 dm644x_set_vpfe_config(&vpfe_cfg);
629 dm644x_init(); 628 dm644x_init();
630} 629}
631 630
@@ -697,6 +696,7 @@ static __init void davinci_evm_init(void)
697 evm_init_i2c(); 696 evm_init_i2c();
698 697
699 davinci_setup_mmc(0, &dm6446evm_mmc_config); 698 davinci_setup_mmc(0, &dm6446evm_mmc_config);
699 dm644x_init_video(&dm644xevm_capture_cfg);
700 700
701 davinci_serial_init(&uart_config); 701 davinci_serial_init(&uart_config);
702 dm644x_init_asp(&dm644x_evm_snd_data); 702 dm644x_init_asp(&dm644x_evm_snd_data);
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index 872ac69fa04..d72ab948d63 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -36,7 +36,6 @@
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 38
39#include <mach/dm646x.h>
40#include <mach/common.h> 39#include <mach/common.h>
41#include <mach/serial.h> 40#include <mach/serial.h>
42#include <mach/i2c.h> 41#include <mach/i2c.h>
@@ -45,6 +44,7 @@
45#include <mach/cdce949.h> 44#include <mach/cdce949.h>
46#include <mach/aemif.h> 45#include <mach/aemif.h>
47 46
47#include "davinci.h"
48#include "clock.h" 48#include "clock.h"
49 49
50#define NAND_BLOCK_SIZE SZ_128K 50#define NAND_BLOCK_SIZE SZ_128K
@@ -410,8 +410,6 @@ static struct davinci_i2c_platform_data i2c_pdata = {
410 .bus_delay = 0 /* usec */, 410 .bus_delay = 0 /* usec */,
411}; 411};
412 412
413#define VIDCLKCTL_OFFSET (DAVINCI_SYSTEM_MODULE_BASE + 0x38)
414#define VSCLKDIS_OFFSET (DAVINCI_SYSTEM_MODULE_BASE + 0x6c)
415#define VCH2CLK_MASK (BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8)) 413#define VCH2CLK_MASK (BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8))
416#define VCH2CLK_SYSCLK8 (BIT(9)) 414#define VCH2CLK_SYSCLK8 (BIT(9))
417#define VCH2CLK_AUXCLK (BIT(9) | BIT(8)) 415#define VCH2CLK_AUXCLK (BIT(9) | BIT(8))
@@ -429,8 +427,6 @@ static struct davinci_i2c_platform_data i2c_pdata = {
429#define TVP5147_CH0 "tvp514x-0" 427#define TVP5147_CH0 "tvp514x-0"
430#define TVP5147_CH1 "tvp514x-1" 428#define TVP5147_CH1 "tvp514x-1"
431 429
432static void __iomem *vpif_vidclkctl_reg;
433static void __iomem *vpif_vsclkdis_reg;
434/* spin lock for updating above registers */ 430/* spin lock for updating above registers */
435static spinlock_t vpif_reg_lock; 431static spinlock_t vpif_reg_lock;
436 432
@@ -441,14 +437,14 @@ static int set_vpif_clock(int mux_mode, int hd)
441 int val = 0; 437 int val = 0;
442 int err = 0; 438 int err = 0;
443 439
444 if (!vpif_vidclkctl_reg || !vpif_vsclkdis_reg || !cpld_client) 440 if (!cpld_client)
445 return -ENXIO; 441 return -ENXIO;
446 442
447 /* disable the clock */ 443 /* disable the clock */
448 spin_lock_irqsave(&vpif_reg_lock, flags); 444 spin_lock_irqsave(&vpif_reg_lock, flags);
449 value = __raw_readl(vpif_vsclkdis_reg); 445 value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
450 value |= (VIDCH3CLK | VIDCH2CLK); 446 value |= (VIDCH3CLK | VIDCH2CLK);
451 __raw_writel(value, vpif_vsclkdis_reg); 447 __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
452 spin_unlock_irqrestore(&vpif_reg_lock, flags); 448 spin_unlock_irqrestore(&vpif_reg_lock, flags);
453 449
454 val = i2c_smbus_read_byte(cpld_client); 450 val = i2c_smbus_read_byte(cpld_client);
@@ -464,7 +460,7 @@ static int set_vpif_clock(int mux_mode, int hd)
464 if (err) 460 if (err)
465 return err; 461 return err;
466 462
467 value = __raw_readl(vpif_vidclkctl_reg); 463 value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
468 value &= ~(VCH2CLK_MASK); 464 value &= ~(VCH2CLK_MASK);
469 value &= ~(VCH3CLK_MASK); 465 value &= ~(VCH3CLK_MASK);
470 466
@@ -473,13 +469,13 @@ static int set_vpif_clock(int mux_mode, int hd)
473 else 469 else
474 value |= (VCH2CLK_AUXCLK | VCH3CLK_AUXCLK); 470 value |= (VCH2CLK_AUXCLK | VCH3CLK_AUXCLK);
475 471
476 __raw_writel(value, vpif_vidclkctl_reg); 472 __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
477 473
478 spin_lock_irqsave(&vpif_reg_lock, flags); 474 spin_lock_irqsave(&vpif_reg_lock, flags);
479 value = __raw_readl(vpif_vsclkdis_reg); 475 value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
480 /* enable the clock */ 476 /* enable the clock */
481 value &= ~(VIDCH3CLK | VIDCH2CLK); 477 value &= ~(VIDCH3CLK | VIDCH2CLK);
482 __raw_writel(value, vpif_vsclkdis_reg); 478 __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
483 spin_unlock_irqrestore(&vpif_reg_lock, flags); 479 spin_unlock_irqrestore(&vpif_reg_lock, flags);
484 480
485 return 0; 481 return 0;
@@ -564,7 +560,7 @@ static int setup_vpif_input_channel_mode(int mux_mode)
564 int val; 560 int val;
565 u32 value; 561 u32 value;
566 562
567 if (!vpif_vidclkctl_reg || !cpld_client) 563 if (!cpld_client)
568 return -ENXIO; 564 return -ENXIO;
569 565
570 val = i2c_smbus_read_byte(cpld_client); 566 val = i2c_smbus_read_byte(cpld_client);
@@ -572,7 +568,7 @@ static int setup_vpif_input_channel_mode(int mux_mode)
572 return val; 568 return val;
573 569
574 spin_lock_irqsave(&vpif_reg_lock, flags); 570 spin_lock_irqsave(&vpif_reg_lock, flags);
575 value = __raw_readl(vpif_vidclkctl_reg); 571 value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
576 if (mux_mode) { 572 if (mux_mode) {
577 val &= VPIF_INPUT_TWO_CHANNEL; 573 val &= VPIF_INPUT_TWO_CHANNEL;
578 value |= VIDCH1CLK; 574 value |= VIDCH1CLK;
@@ -580,7 +576,7 @@ static int setup_vpif_input_channel_mode(int mux_mode)
580 val |= VPIF_INPUT_ONE_CHANNEL; 576 val |= VPIF_INPUT_ONE_CHANNEL;
581 value &= ~VIDCH1CLK; 577 value &= ~VIDCH1CLK;
582 } 578 }
583 __raw_writel(value, vpif_vidclkctl_reg); 579 __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
584 spin_unlock_irqrestore(&vpif_reg_lock, flags); 580 spin_unlock_irqrestore(&vpif_reg_lock, flags);
585 581
586 err = i2c_smbus_write_byte(cpld_client, val); 582 err = i2c_smbus_write_byte(cpld_client, val);
@@ -674,12 +670,6 @@ static struct vpif_capture_config dm646x_vpif_capture_cfg = {
674 670
675static void __init evm_init_video(void) 671static void __init evm_init_video(void)
676{ 672{
677 vpif_vidclkctl_reg = ioremap(VIDCLKCTL_OFFSET, 4);
678 vpif_vsclkdis_reg = ioremap(VSCLKDIS_OFFSET, 4);
679 if (!vpif_vidclkctl_reg || !vpif_vsclkdis_reg) {
680 pr_err("Can't map VPIF VIDCLKCTL or VSCLKDIS registers\n");
681 return;
682 }
683 spin_lock_init(&vpif_reg_lock); 673 spin_lock_init(&vpif_reg_lock);
684 674
685 dm646x_setup_vpif(&dm646x_vpif_display_config, 675 dm646x_setup_vpif(&dm646x_vpif_display_config,
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 8d34f513d41..a772bb45570 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -30,7 +30,6 @@
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/dm644x.h>
34#include <mach/common.h> 33#include <mach/common.h>
35#include <mach/i2c.h> 34#include <mach/i2c.h>
36#include <mach/serial.h> 35#include <mach/serial.h>
@@ -39,6 +38,8 @@
39#include <mach/mmc.h> 38#include <mach/mmc.h>
40#include <mach/usb.h> 39#include <mach/usb.h>
41 40
41#include "davinci.h"
42
42#define NEUROS_OSD2_PHY_ID "davinci_mdio-0:01" 43#define NEUROS_OSD2_PHY_ID "davinci_mdio-0:01"
43#define LXT971_PHY_ID 0x001378e2 44#define LXT971_PHY_ID 0x001378e2
44#define LXT971_PHY_MASK 0xfffffff0 45#define LXT971_PHY_MASK 0xfffffff0
diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
index 31da3c5b2ba..76e67509610 100644
--- a/arch/arm/mach-davinci/board-sffsdr.c
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -35,13 +35,14 @@
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
36#include <asm/mach/flash.h> 36#include <asm/mach/flash.h>
37 37
38#include <mach/dm644x.h>
39#include <mach/common.h> 38#include <mach/common.h>
40#include <mach/i2c.h> 39#include <mach/i2c.h>
41#include <mach/serial.h> 40#include <mach/serial.h>
42#include <mach/mux.h> 41#include <mach/mux.h>
43#include <mach/usb.h> 42#include <mach/usb.h>
44 43
44#include "davinci.h"
45
45#define SFFSDR_PHY_ID "davinci_mdio-0:01" 46#define SFFSDR_PHY_ID "davinci_mdio-0:01"
46static struct mtd_partition davinci_sffsdr_nandflash_partition[] = { 47static struct mtd_partition davinci_sffsdr_nandflash_partition[] = {
47 /* U-Boot Environment: Block 0 48 /* U-Boot Environment: Block 0
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c
index 5bba7070f27..031048fec9f 100644
--- a/arch/arm/mach-davinci/cpufreq.c
+++ b/arch/arm/mach-davinci/cpufreq.c
@@ -95,7 +95,7 @@ static int davinci_target(struct cpufreq_policy *policy,
95 if (freqs.old == freqs.new) 95 if (freqs.old == freqs.new)
96 return ret; 96 return ret;
97 97
98 dev_dbg(&cpufreq.dev, "transition: %u --> %u\n", freqs.old, freqs.new); 98 dev_dbg(cpufreq.dev, "transition: %u --> %u\n", freqs.old, freqs.new);
99 99
100 ret = cpufreq_frequency_table_target(policy, pdata->freq_table, 100 ret = cpufreq_frequency_table_target(policy, pdata->freq_table,
101 freqs.new, relation, &idx); 101 freqs.new, relation, &idx);
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 992c4c41018..b44dc844e15 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1026,7 +1026,7 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate)
1026} 1026}
1027#endif 1027#endif
1028 1028
1029int da850_register_pm(struct platform_device *pdev) 1029int __init da850_register_pm(struct platform_device *pdev)
1030{ 1030{
1031 int ret; 1031 int ret;
1032 struct davinci_pm_config *pdata = pdev->dev.platform_data; 1032 struct davinci_pm_config *pdata = pdev->dev.platform_data;
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
new file mode 100644
index 00000000000..9d708034b57
--- /dev/null
+++ b/arch/arm/mach-davinci/davinci.h
@@ -0,0 +1,96 @@
1/*
2 * This file contains the processor specific definitions
3 * of the TI DM644x, DM355, DM365, and DM646x.
4 *
5 * Copyright (C) 2011 Texas Instruments Incorporated
6 * Copyright (c) 2007 Deep Root Systems, LLC
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17#ifndef __DAVINCI_H
18#define __DAVINCI_H
19
20#include <linux/clk.h>
21#include <linux/videodev2.h>
22#include <linux/davinci_emac.h>
23#include <linux/platform_device.h>
24#include <linux/spi/spi.h>
25
26#include <mach/asp.h>
27#include <mach/keyscan.h>
28#include <mach/hardware.h>
29
30#include <media/davinci/vpfe_capture.h>
31#include <media/davinci/vpif_types.h>
32
33#define DAVINCI_SYSTEM_MODULE_BASE 0x01c40000
34#define SYSMOD_VIDCLKCTL 0x38
35#define SYSMOD_VDD3P3VPWDN 0x48
36#define SYSMOD_VSCLKDIS 0x6c
37#define SYSMOD_PUPDCTL1 0x7c
38
39extern void __iomem *davinci_sysmod_base;
40#define DAVINCI_SYSMOD_VIRT(x) (davinci_sysmod_base + (x))
41void davinci_map_sysmod(void);
42
43/* DM355 base addresses */
44#define DM355_ASYNC_EMIF_CONTROL_BASE 0x01e10000
45#define DM355_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
46
47#define ASP1_TX_EVT_EN 1
48#define ASP1_RX_EVT_EN 2
49
50/* DM365 base addresses */
51#define DM365_ASYNC_EMIF_CONTROL_BASE 0x01d10000
52#define DM365_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
53#define DM365_ASYNC_EMIF_DATA_CE1_BASE 0x04000000
54
55/* DM644x base addresses */
56#define DM644X_ASYNC_EMIF_CONTROL_BASE 0x01e00000
57#define DM644X_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
58#define DM644X_ASYNC_EMIF_DATA_CE1_BASE 0x04000000
59#define DM644X_ASYNC_EMIF_DATA_CE2_BASE 0x06000000
60#define DM644X_ASYNC_EMIF_DATA_CE3_BASE 0x08000000
61
62/* DM646x base addresses */
63#define DM646X_ASYNC_EMIF_CONTROL_BASE 0x20008000
64#define DM646X_ASYNC_EMIF_CS2_SPACE_BASE 0x42000000
65
66/* DM355 function declarations */
67void __init dm355_init(void);
68void dm355_init_spi0(unsigned chipselect_mask,
69 struct spi_board_info *info, unsigned len);
70void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata);
71void dm355_set_vpfe_config(struct vpfe_config *cfg);
72
73/* DM365 function declarations */
74void __init dm365_init(void);
75void __init dm365_init_asp(struct snd_platform_data *pdata);
76void __init dm365_init_vc(struct snd_platform_data *pdata);
77void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
78void __init dm365_init_rtc(void);
79void dm365_init_spi0(unsigned chipselect_mask,
80 struct spi_board_info *info, unsigned len);
81void dm365_set_vpfe_config(struct vpfe_config *cfg);
82
83/* DM644x function declarations */
84void __init dm644x_init(void);
85void __init dm644x_init_asp(struct snd_platform_data *pdata);
86int __init dm644x_init_video(struct vpfe_config *);
87
88/* DM646x function declarations */
89void __init dm646x_init(void);
90void __init dm646x_init_mcasp0(struct snd_platform_data *pdata);
91void __init dm646x_init_mcasp1(struct snd_platform_data *pdata);
92int __init dm646x_init_edma(struct edma_rsv_info *rsv);
93void dm646x_video_init(void);
94void dm646x_setup_vpif(struct vpif_display_config *,
95 struct vpif_capture_config *);
96#endif /*__DAVINCI_H */
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 50c0156b426..d2f9666284a 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -23,6 +23,7 @@
23#include <mach/mmc.h> 23#include <mach/mmc.h>
24#include <mach/time.h> 24#include <mach/time.h>
25 25
26#include "davinci.h"
26#include "clock.h" 27#include "clock.h"
27 28
28#define DAVINCI_I2C_BASE 0x01C21000 29#define DAVINCI_I2C_BASE 0x01C21000
@@ -33,8 +34,19 @@
33#define DM365_MMCSD0_BASE 0x01D11000 34#define DM365_MMCSD0_BASE 0x01D11000
34#define DM365_MMCSD1_BASE 0x01D00000 35#define DM365_MMCSD1_BASE 0x01D00000
35 36
36/* System control register offsets */ 37void __iomem *davinci_sysmod_base;
37#define DM64XX_VDD3P3V_PWDN 0x48 38
39void davinci_map_sysmod(void)
40{
41 davinci_sysmod_base = ioremap_nocache(DAVINCI_SYSTEM_MODULE_BASE,
42 0x800);
43 /*
44 * Throw a bug since a lot of board initialization code depends
45 * on system module availability. ioremap() failing this early
46 * need careful looking into anyway.
47 */
48 BUG_ON(!davinci_sysmod_base);
49}
38 50
39static struct resource i2c_resources[] = { 51static struct resource i2c_resources[] = {
40 { 52 {
@@ -212,12 +224,12 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
212 davinci_cfg_reg(DM355_SD1_DATA2); 224 davinci_cfg_reg(DM355_SD1_DATA2);
213 davinci_cfg_reg(DM355_SD1_DATA3); 225 davinci_cfg_reg(DM355_SD1_DATA3);
214 } else if (cpu_is_davinci_dm365()) { 226 } else if (cpu_is_davinci_dm365()) {
215 void __iomem *pupdctl1 =
216 IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE + 0x7c);
217
218 /* Configure pull down control */ 227 /* Configure pull down control */
219 __raw_writel((__raw_readl(pupdctl1) & ~0xfc0), 228 unsigned v;
220 pupdctl1); 229
230 v = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_PUPDCTL1));
231 __raw_writel(v & ~0xfc0,
232 DAVINCI_SYSMOD_VIRT(SYSMOD_PUPDCTL1));
221 233
222 mmcsd1_resources[0].start = DM365_MMCSD1_BASE; 234 mmcsd1_resources[0].start = DM365_MMCSD1_BASE;
223 mmcsd1_resources[0].end = DM365_MMCSD1_BASE + 235 mmcsd1_resources[0].end = DM365_MMCSD1_BASE +
@@ -246,11 +258,9 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
246 mmcsd0_resources[2].start = IRQ_DM365_SDIOINT0; 258 mmcsd0_resources[2].start = IRQ_DM365_SDIOINT0;
247 } else if (cpu_is_davinci_dm644x()) { 259 } else if (cpu_is_davinci_dm644x()) {
248 /* REVISIT: should this be in board-init code? */ 260 /* REVISIT: should this be in board-init code? */
249 void __iomem *base =
250 IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE);
251
252 /* Power-on 3.3V IO cells */ 261 /* Power-on 3.3V IO cells */
253 __raw_writel(0, base + DM64XX_VDD3P3V_PWDN); 262 __raw_writel(0,
263 DAVINCI_SYSMOD_VIRT(SYSMOD_VDD3P3VPWDN));
254 /*Set up the pull regiter for MMC */ 264 /*Set up the pull regiter for MMC */
255 davinci_cfg_reg(DM644X_MSTK); 265 davinci_cfg_reg(DM644X_MSTK);
256 } 266 }
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 19667cfc5de..fd3d09aa6cd 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -18,7 +18,6 @@
18 18
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20 20
21#include <mach/dm355.h>
22#include <mach/cputype.h> 21#include <mach/cputype.h>
23#include <mach/edma.h> 22#include <mach/edma.h>
24#include <mach/psc.h> 23#include <mach/psc.h>
@@ -31,6 +30,7 @@
31#include <mach/spi.h> 30#include <mach/spi.h>
32#include <mach/gpio-davinci.h> 31#include <mach/gpio-davinci.h>
33 32
33#include "davinci.h"
34#include "clock.h" 34#include "clock.h"
35#include "mux.h" 35#include "mux.h"
36 36
@@ -871,6 +871,7 @@ void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata)
871void __init dm355_init(void) 871void __init dm355_init(void)
872{ 872{
873 davinci_common_init(&davinci_soc_info_dm355); 873 davinci_common_init(&davinci_soc_info_dm355);
874 davinci_map_sysmod();
874} 875}
875 876
876static int __init dm355_init_devices(void) 877static int __init dm355_init_devices(void)
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index f15b435cc65..1a2e953082b 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -21,7 +21,6 @@
21 21
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23 23
24#include <mach/dm365.h>
25#include <mach/cputype.h> 24#include <mach/cputype.h>
26#include <mach/edma.h> 25#include <mach/edma.h>
27#include <mach/psc.h> 26#include <mach/psc.h>
@@ -35,11 +34,28 @@
35#include <mach/spi.h> 34#include <mach/spi.h>
36#include <mach/gpio-davinci.h> 35#include <mach/gpio-davinci.h>
37 36
37#include "davinci.h"
38#include "clock.h" 38#include "clock.h"
39#include "mux.h" 39#include "mux.h"
40 40
41#define DM365_REF_FREQ 24000000 /* 24 MHz on the DM365 EVM */ 41#define DM365_REF_FREQ 24000000 /* 24 MHz on the DM365 EVM */
42 42
43/* Base of key scan register bank */
44#define DM365_KEYSCAN_BASE 0x01c69400
45
46#define DM365_RTC_BASE 0x01c69000
47
48#define DAVINCI_DM365_VC_BASE 0x01d0c000
49#define DAVINCI_DMA_VC_TX 2
50#define DAVINCI_DMA_VC_RX 3
51
52#define DM365_EMAC_BASE 0x01d07000
53#define DM365_EMAC_MDIO_BASE (DM365_EMAC_BASE + 0x4000)
54#define DM365_EMAC_CNTRL_OFFSET 0x0000
55#define DM365_EMAC_CNTRL_MOD_OFFSET 0x3000
56#define DM365_EMAC_CNTRL_RAM_OFFSET 0x1000
57#define DM365_EMAC_CNTRL_RAM_SIZE 0x2000
58
43static struct pll_data pll1_data = { 59static struct pll_data pll1_data = {
44 .num = 1, 60 .num = 1,
45 .phys_base = DAVINCI_PLL1_BASE, 61 .phys_base = DAVINCI_PLL1_BASE,
@@ -1122,6 +1138,7 @@ void __init dm365_init_rtc(void)
1122void __init dm365_init(void) 1138void __init dm365_init(void)
1123{ 1139{
1124 davinci_common_init(&davinci_soc_info_dm365); 1140 davinci_common_init(&davinci_soc_info_dm365);
1141 davinci_map_sysmod();
1125} 1142}
1126 1143
1127static struct resource dm365_vpss_resources[] = { 1144static struct resource dm365_vpss_resources[] = {
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 43a48ee1917..23e81cafba8 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -15,7 +15,6 @@
15 15
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17 17
18#include <mach/dm644x.h>
19#include <mach/cputype.h> 18#include <mach/cputype.h>
20#include <mach/edma.h> 19#include <mach/edma.h>
21#include <mach/irqs.h> 20#include <mach/irqs.h>
@@ -27,6 +26,7 @@
27#include <mach/asp.h> 26#include <mach/asp.h>
28#include <mach/gpio-davinci.h> 27#include <mach/gpio-davinci.h>
29 28
29#include "davinci.h"
30#include "clock.h" 30#include "clock.h"
31#include "mux.h" 31#include "mux.h"
32 32
@@ -35,6 +35,13 @@
35 */ 35 */
36#define DM644X_REF_FREQ 27000000 36#define DM644X_REF_FREQ 27000000
37 37
38#define DM644X_EMAC_BASE 0x01c80000
39#define DM644X_EMAC_MDIO_BASE (DM644X_EMAC_BASE + 0x4000)
40#define DM644X_EMAC_CNTRL_OFFSET 0x0000
41#define DM644X_EMAC_CNTRL_MOD_OFFSET 0x1000
42#define DM644X_EMAC_CNTRL_RAM_OFFSET 0x2000
43#define DM644X_EMAC_CNTRL_RAM_SIZE 0x2000
44
38static struct pll_data pll1_data = { 45static struct pll_data pll1_data = {
39 .num = 1, 46 .num = 1,
40 .phys_base = DAVINCI_PLL1_BASE, 47 .phys_base = DAVINCI_PLL1_BASE,
@@ -587,13 +594,15 @@ static struct platform_device dm644x_asp_device = {
587 .resource = dm644x_asp_resources, 594 .resource = dm644x_asp_resources,
588}; 595};
589 596
597#define DM644X_VPSS_BASE 0x01c73400
598
590static struct resource dm644x_vpss_resources[] = { 599static struct resource dm644x_vpss_resources[] = {
591 { 600 {
592 /* VPSS Base address */ 601 /* VPSS Base address */
593 .name = "vpss", 602 .name = "vpss",
594 .start = 0x01c73400, 603 .start = DM644X_VPSS_BASE,
595 .end = 0x01c73400 + 0xff, 604 .end = DM644X_VPSS_BASE + 0xff,
596 .flags = IORESOURCE_MEM, 605 .flags = IORESOURCE_MEM,
597 }, 606 },
598}; 607};
599 608
@@ -605,7 +614,7 @@ static struct platform_device dm644x_vpss_device = {
605 .resource = dm644x_vpss_resources, 614 .resource = dm644x_vpss_resources,
606}; 615};
607 616
608static struct resource vpfe_resources[] = { 617static struct resource dm644x_vpfe_resources[] = {
609 { 618 {
610 .start = IRQ_VDINT0, 619 .start = IRQ_VDINT0,
611 .end = IRQ_VDINT0, 620 .end = IRQ_VDINT0,
@@ -639,22 +648,17 @@ static struct platform_device dm644x_ccdc_dev = {
639 }, 648 },
640}; 649};
641 650
642static struct platform_device vpfe_capture_dev = { 651static struct platform_device dm644x_vpfe_dev = {
643 .name = CAPTURE_DRV_NAME, 652 .name = CAPTURE_DRV_NAME,
644 .id = -1, 653 .id = -1,
645 .num_resources = ARRAY_SIZE(vpfe_resources), 654 .num_resources = ARRAY_SIZE(dm644x_vpfe_resources),
646 .resource = vpfe_resources, 655 .resource = dm644x_vpfe_resources,
647 .dev = { 656 .dev = {
648 .dma_mask = &vpfe_capture_dma_mask, 657 .dma_mask = &vpfe_capture_dma_mask,
649 .coherent_dma_mask = DMA_BIT_MASK(32), 658 .coherent_dma_mask = DMA_BIT_MASK(32),
650 }, 659 },
651}; 660};
652 661
653void dm644x_set_vpfe_config(struct vpfe_config *cfg)
654{
655 vpfe_capture_dev.dev.platform_data = cfg;
656}
657
658/*----------------------------------------------------------------------*/ 662/*----------------------------------------------------------------------*/
659 663
660static struct map_desc dm644x_io_desc[] = { 664static struct map_desc dm644x_io_desc[] = {
@@ -779,16 +783,29 @@ void __init dm644x_init_asp(struct snd_platform_data *pdata)
779void __init dm644x_init(void) 783void __init dm644x_init(void)
780{ 784{
781 davinci_common_init(&davinci_soc_info_dm644x); 785 davinci_common_init(&davinci_soc_info_dm644x);
786 davinci_map_sysmod();
782} 787}
783 788
784static int __init dm644x_init_devices(void) 789int __init dm644x_init_video(struct vpfe_config *vpfe_cfg)
785{ 790{
786 if (!cpu_is_davinci_dm644x()) 791 dm644x_vpfe_dev.dev.platform_data = vpfe_cfg;
787 return 0;
788 792
789 /* Add ccdc clock aliases */ 793 /* Add ccdc clock aliases */
790 clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL); 794 clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL);
791 clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL); 795 clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL);
796
797 platform_device_register(&dm644x_vpss_device);
798 platform_device_register(&dm644x_ccdc_dev);
799 platform_device_register(&dm644x_vpfe_dev);
800
801 return 0;
802}
803
804static int __init dm644x_init_devices(void)
805{
806 if (!cpu_is_davinci_dm644x())
807 return 0;
808
792 platform_device_register(&dm644x_edma_device); 809 platform_device_register(&dm644x_edma_device);
793 810
794 platform_device_register(&dm644x_mdio_device); 811 platform_device_register(&dm644x_mdio_device);
@@ -796,10 +813,6 @@ static int __init dm644x_init_devices(void)
796 clk_add_alias(NULL, dev_name(&dm644x_mdio_device.dev), 813 clk_add_alias(NULL, dev_name(&dm644x_mdio_device.dev),
797 NULL, &dm644x_emac_device.dev); 814 NULL, &dm644x_emac_device.dev);
798 815
799 platform_device_register(&dm644x_vpss_device);
800 platform_device_register(&dm644x_ccdc_dev);
801 platform_device_register(&vpfe_capture_dev);
802
803 return 0; 816 return 0;
804} 817}
805postcore_initcall(dm644x_init_devices); 818postcore_initcall(dm644x_init_devices);
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 00f774394b1..9eb87c1d1ed 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -16,7 +16,6 @@
16 16
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18 18
19#include <mach/dm646x.h>
20#include <mach/cputype.h> 19#include <mach/cputype.h>
21#include <mach/edma.h> 20#include <mach/edma.h>
22#include <mach/irqs.h> 21#include <mach/irqs.h>
@@ -28,12 +27,11 @@
28#include <mach/asp.h> 27#include <mach/asp.h>
29#include <mach/gpio-davinci.h> 28#include <mach/gpio-davinci.h>
30 29
30#include "davinci.h"
31#include "clock.h" 31#include "clock.h"
32#include "mux.h" 32#include "mux.h"
33 33
34#define DAVINCI_VPIF_BASE (0x01C12000) 34#define DAVINCI_VPIF_BASE (0x01C12000)
35#define VDD3P3V_PWDN_OFFSET (0x48)
36#define VSCLKDIS_OFFSET (0x6C)
37 35
38#define VDD3P3V_VID_MASK (BIT_MASK(3) | BIT_MASK(2) | BIT_MASK(1) |\ 36#define VDD3P3V_VID_MASK (BIT_MASK(3) | BIT_MASK(2) | BIT_MASK(1) |\
39 BIT_MASK(0)) 37 BIT_MASK(0))
@@ -46,6 +44,13 @@
46#define DM646X_REF_FREQ 27000000 44#define DM646X_REF_FREQ 27000000
47#define DM646X_AUX_FREQ 24000000 45#define DM646X_AUX_FREQ 24000000
48 46
47#define DM646X_EMAC_BASE 0x01c80000
48#define DM646X_EMAC_MDIO_BASE (DM646X_EMAC_BASE + 0x4000)
49#define DM646X_EMAC_CNTRL_OFFSET 0x0000
50#define DM646X_EMAC_CNTRL_MOD_OFFSET 0x1000
51#define DM646X_EMAC_CNTRL_RAM_OFFSET 0x2000
52#define DM646X_EMAC_CNTRL_RAM_SIZE 0x2000
53
49static struct pll_data pll1_data = { 54static struct pll_data pll1_data = {
50 .num = 1, 55 .num = 1,
51 .phys_base = DAVINCI_PLL1_BASE, 56 .phys_base = DAVINCI_PLL1_BASE,
@@ -873,15 +878,14 @@ void dm646x_setup_vpif(struct vpif_display_config *display_config,
873 struct vpif_capture_config *capture_config) 878 struct vpif_capture_config *capture_config)
874{ 879{
875 unsigned int value; 880 unsigned int value;
876 void __iomem *base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE);
877 881
878 value = __raw_readl(base + VSCLKDIS_OFFSET); 882 value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
879 value &= ~VSCLKDIS_MASK; 883 value &= ~VSCLKDIS_MASK;
880 __raw_writel(value, base + VSCLKDIS_OFFSET); 884 __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
881 885
882 value = __raw_readl(base + VDD3P3V_PWDN_OFFSET); 886 value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VDD3P3VPWDN));
883 value &= ~VDD3P3V_VID_MASK; 887 value &= ~VDD3P3V_VID_MASK;
884 __raw_writel(value, base + VDD3P3V_PWDN_OFFSET); 888 __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VDD3P3VPWDN));
885 889
886 davinci_cfg_reg(DM646X_STSOMUX_DISABLE); 890 davinci_cfg_reg(DM646X_STSOMUX_DISABLE);
887 davinci_cfg_reg(DM646X_STSIMUX_DISABLE); 891 davinci_cfg_reg(DM646X_STSIMUX_DISABLE);
@@ -905,6 +909,7 @@ int __init dm646x_init_edma(struct edma_rsv_info *rsv)
905void __init dm646x_init(void) 909void __init dm646x_init(void)
906{ 910{
907 davinci_common_init(&davinci_soc_info_dm646x); 911 davinci_common_init(&davinci_soc_info_dm646x);
912 davinci_map_sysmod();
908} 913}
909 914
910static int __init dm646x_init_devices(void) 915static int __init dm646x_init_devices(void)
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index da90103a313..fd33919c95d 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -1508,12 +1508,8 @@ static int __init edma_probe(struct platform_device *pdev)
1508 goto fail; 1508 goto fail;
1509 } 1509 }
1510 1510
1511 /* Everything lives on transfer controller 1 until otherwise
1512 * specified. This way, long transfers on the low priority queue
1513 * started by the codec engine will not cause audio defects.
1514 */
1515 for (i = 0; i < edma_cc[j]->num_channels; i++) 1511 for (i = 0; i < edma_cc[j]->num_channels; i++)
1516 map_dmach_queue(j, i, EVENTQ_1); 1512 map_dmach_queue(j, i, info[j]->default_queue);
1517 1513
1518 queue_tc_mapping = info[j]->queue_tc_mapping; 1514 queue_tc_mapping = info[j]->queue_tc_mapping;
1519 queue_priority_mapping = info[j]->queue_priority_mapping; 1515 queue_priority_mapping = info[j]->queue_priority_mapping;
diff --git a/arch/arm/mach-davinci/include/mach/dm355.h b/arch/arm/mach-davinci/include/mach/dm355.h
deleted file mode 100644
index 36dff4a0ce3..00000000000
--- a/arch/arm/mach-davinci/include/mach/dm355.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Chip specific defines for DM355 SoC
3 *
4 * Author: Kevin Hilman, Deep Root Systems, LLC
5 *
6 * 2007 (c) Deep Root Systems, LLC. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11#ifndef __ASM_ARCH_DM355_H
12#define __ASM_ARCH_DM355_H
13
14#include <mach/hardware.h>
15#include <mach/asp.h>
16#include <media/davinci/vpfe_capture.h>
17
18#define DM355_ASYNC_EMIF_CONTROL_BASE 0x01E10000
19#define DM355_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
20
21#define ASP1_TX_EVT_EN 1
22#define ASP1_RX_EVT_EN 2
23
24struct spi_board_info;
25
26void __init dm355_init(void);
27void dm355_init_spi0(unsigned chipselect_mask,
28 struct spi_board_info *info, unsigned len);
29void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata);
30void dm355_set_vpfe_config(struct vpfe_config *cfg);
31
32#endif /* __ASM_ARCH_DM355_H */
diff --git a/arch/arm/mach-davinci/include/mach/dm365.h b/arch/arm/mach-davinci/include/mach/dm365.h
index 2563bf4e93a..b9bf3d6a442 100644
--- a/arch/arm/mach-davinci/include/mach/dm365.h
+++ b/arch/arm/mach-davinci/include/mach/dm365.h
@@ -1,52 +1 @@
1/* /* empty, remove once unused */
2 * Copyright (C) 2009 Texas Instruments Incorporated
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#ifndef __ASM_ARCH_DM365_H
14#define __ASM_ARCH_DM665_H
15
16#include <linux/platform_device.h>
17#include <linux/davinci_emac.h>
18#include <mach/hardware.h>
19#include <mach/asp.h>
20#include <mach/keyscan.h>
21#include <media/davinci/vpfe_capture.h>
22
23#define DM365_EMAC_BASE (0x01D07000)
24#define DM365_EMAC_MDIO_BASE (DM365_EMAC_BASE + 0x4000)
25#define DM365_EMAC_CNTRL_OFFSET (0x0000)
26#define DM365_EMAC_CNTRL_MOD_OFFSET (0x3000)
27#define DM365_EMAC_CNTRL_RAM_OFFSET (0x1000)
28#define DM365_EMAC_CNTRL_RAM_SIZE (0x2000)
29
30/* Base of key scan register bank */
31#define DM365_KEYSCAN_BASE (0x01C69400)
32
33#define DM365_RTC_BASE (0x01C69000)
34
35#define DAVINCI_DM365_VC_BASE (0x01D0C000)
36#define DAVINCI_DMA_VC_TX 2
37#define DAVINCI_DMA_VC_RX 3
38
39#define DM365_ASYNC_EMIF_CONTROL_BASE 0x01D10000
40#define DM365_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
41#define DM365_ASYNC_EMIF_DATA_CE1_BASE 0x04000000
42
43void __init dm365_init(void);
44void __init dm365_init_asp(struct snd_platform_data *pdata);
45void __init dm365_init_vc(struct snd_platform_data *pdata);
46void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
47void __init dm365_init_rtc(void);
48void dm365_init_spi0(unsigned chipselect_mask,
49 struct spi_board_info *info, unsigned len);
50
51void dm365_set_vpfe_config(struct vpfe_config *cfg);
52#endif /* __ASM_ARCH_DM365_H */
diff --git a/arch/arm/mach-davinci/include/mach/dm644x.h b/arch/arm/mach-davinci/include/mach/dm644x.h
deleted file mode 100644
index 5a1b26d4e68..00000000000
--- a/arch/arm/mach-davinci/include/mach/dm644x.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * This file contains the processor specific definitions
3 * of the TI DM644x.
4 *
5 * Copyright (C) 2008 Texas Instruments.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22#ifndef __ASM_ARCH_DM644X_H
23#define __ASM_ARCH_DM644X_H
24
25#include <linux/davinci_emac.h>
26#include <mach/hardware.h>
27#include <mach/asp.h>
28#include <media/davinci/vpfe_capture.h>
29
30#define DM644X_EMAC_BASE (0x01C80000)
31#define DM644X_EMAC_MDIO_BASE (DM644X_EMAC_BASE + 0x4000)
32#define DM644X_EMAC_CNTRL_OFFSET (0x0000)
33#define DM644X_EMAC_CNTRL_MOD_OFFSET (0x1000)
34#define DM644X_EMAC_CNTRL_RAM_OFFSET (0x2000)
35#define DM644X_EMAC_CNTRL_RAM_SIZE (0x2000)
36
37#define DM644X_ASYNC_EMIF_CONTROL_BASE 0x01E00000
38#define DM644X_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
39#define DM644X_ASYNC_EMIF_DATA_CE1_BASE 0x04000000
40#define DM644X_ASYNC_EMIF_DATA_CE2_BASE 0x06000000
41#define DM644X_ASYNC_EMIF_DATA_CE3_BASE 0x08000000
42
43void __init dm644x_init(void);
44void __init dm644x_init_asp(struct snd_platform_data *pdata);
45void dm644x_set_vpfe_config(struct vpfe_config *cfg);
46
47#endif /* __ASM_ARCH_DM644X_H */
diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h
index a8ee6c9f0bb..b9bf3d6a442 100644
--- a/arch/arm/mach-davinci/include/mach/dm646x.h
+++ b/arch/arm/mach-davinci/include/mach/dm646x.h
@@ -1,41 +1 @@
1/* /* empty, remove once unused */
2 * Chip specific defines for DM646x SoC
3 *
4 * Author: Kevin Hilman, Deep Root Systems, LLC
5 *
6 * 2007 (c) Deep Root Systems, LLC. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11#ifndef __ASM_ARCH_DM646X_H
12#define __ASM_ARCH_DM646X_H
13
14#include <mach/hardware.h>
15#include <mach/asp.h>
16#include <linux/i2c.h>
17#include <linux/videodev2.h>
18#include <linux/davinci_emac.h>
19#include <media/davinci/vpif_types.h>
20
21#define DM646X_EMAC_BASE (0x01C80000)
22#define DM646X_EMAC_MDIO_BASE (DM646X_EMAC_BASE + 0x4000)
23#define DM646X_EMAC_CNTRL_OFFSET (0x0000)
24#define DM646X_EMAC_CNTRL_MOD_OFFSET (0x1000)
25#define DM646X_EMAC_CNTRL_RAM_OFFSET (0x2000)
26#define DM646X_EMAC_CNTRL_RAM_SIZE (0x2000)
27
28#define DM646X_ASYNC_EMIF_CONTROL_BASE 0x20008000
29#define DM646X_ASYNC_EMIF_CS2_SPACE_BASE 0x42000000
30
31void __init dm646x_init(void);
32void __init dm646x_init_mcasp0(struct snd_platform_data *pdata);
33void __init dm646x_init_mcasp1(struct snd_platform_data *pdata);
34int __init dm646x_init_edma(struct edma_rsv_info *rsv);
35
36void dm646x_video_init(void);
37
38void dm646x_setup_vpif(struct vpif_display_config *,
39 struct vpif_capture_config *);
40
41#endif /* __ASM_ARCH_DM646X_H */
diff --git a/arch/arm/mach-davinci/include/mach/edma.h b/arch/arm/mach-davinci/include/mach/edma.h
index 20c77f29bf0..7e84c906cef 100644
--- a/arch/arm/mach-davinci/include/mach/edma.h
+++ b/arch/arm/mach-davinci/include/mach/edma.h
@@ -250,6 +250,11 @@ struct edma_soc_info {
250 unsigned n_slot; 250 unsigned n_slot;
251 unsigned n_tc; 251 unsigned n_tc;
252 unsigned n_cc; 252 unsigned n_cc;
253 /*
254 * Default queue is expected to be a low-priority queue.
255 * This way, long transfers on the default queue started
256 * by the codec engine will not cause audio defects.
257 */
253 enum dma_event_q default_queue; 258 enum dma_event_q default_queue;
254 259
255 /* Resource reservation for other cores */ 260 /* Resource reservation for other cores */
diff --git a/arch/arm/mach-davinci/include/mach/entry-macro.S b/arch/arm/mach-davinci/include/mach/entry-macro.S
index e14c0dc0e12..c1661d2feca 100644
--- a/arch/arm/mach-davinci/include/mach/entry-macro.S
+++ b/arch/arm/mach-davinci/include/mach/entry-macro.S
@@ -11,17 +11,11 @@
11#include <mach/io.h> 11#include <mach/io.h>
12#include <mach/irqs.h> 12#include <mach/irqs.h>
13 13
14 .macro disable_fiq
15 .endm
16
17 .macro get_irqnr_preamble, base, tmp 14 .macro get_irqnr_preamble, base, tmp
18 ldr \base, =davinci_intc_base 15 ldr \base, =davinci_intc_base
19 ldr \base, [\base] 16 ldr \base, [\base]
20 .endm 17 .endm
21 18
22 .macro arch_ret_to_user, tmp1, tmp2
23 .endm
24
25 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 19 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
26#if defined(CONFIG_AINTC) && defined(CONFIG_CP_INTC) 20#if defined(CONFIG_AINTC) && defined(CONFIG_CP_INTC)
27 ldr \tmp, =davinci_intc_type 21 ldr \tmp, =davinci_intc_type
diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h
index 414e0b93e74..0209b1fc22a 100644
--- a/arch/arm/mach-davinci/include/mach/hardware.h
+++ b/arch/arm/mach-davinci/include/mach/hardware.h
@@ -19,8 +19,6 @@
19 * and the chip/board init code should then explicitly include 19 * and the chip/board init code should then explicitly include
20 * <chipname>.h 20 * <chipname>.h
21 */ 21 */
22#define DAVINCI_SYSTEM_MODULE_BASE 0x01C40000
23
24/* 22/*
25 * I/O mapping 23 * I/O mapping
26 */ 24 */
diff --git a/arch/arm/mach-davinci/include/mach/system.h b/arch/arm/mach-davinci/include/mach/system.h
deleted file mode 100644
index fcb7a015aba..00000000000
--- a/arch/arm/mach-davinci/include/mach/system.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * DaVinci system defines
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H
13
14#include <mach/common.h>
15
16static inline void arch_idle(void)
17{
18 cpu_do_idle();
19}
20
21#endif /* __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-dove/include/mach/entry-macro.S b/arch/arm/mach-dove/include/mach/entry-macro.S
index e84c78c2a8b..72d622baaad 100644
--- a/arch/arm/mach-dove/include/mach/entry-macro.S
+++ b/arch/arm/mach-dove/include/mach/entry-macro.S
@@ -10,12 +10,6 @@
10 10
11#include <mach/bridge-regs.h> 11#include <mach/bridge-regs.h>
12 12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp 13 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =IRQ_VIRT_BASE 14 ldr \base, =IRQ_VIRT_BASE
21 .endm 15 .endm
diff --git a/arch/arm/mach-dove/include/mach/system.h b/arch/arm/mach-dove/include/mach/system.h
deleted file mode 100644
index 3027954f616..00000000000
--- a/arch/arm/mach-dove/include/mach/system.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * arch/arm/mach-dove/include/mach/system.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_SYSTEM_H
10#define __ASM_ARCH_SYSTEM_H
11
12static inline void arch_idle(void)
13{
14 cpu_do_idle();
15}
16
17#endif
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index 52e96d397ba..48a032005ea 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -69,7 +69,7 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
69 pp->res[0].flags = IORESOURCE_IO; 69 pp->res[0].flags = IORESOURCE_IO;
70 if (request_resource(&ioport_resource, &pp->res[0])) 70 if (request_resource(&ioport_resource, &pp->res[0]))
71 panic("Request PCIe IO resource failed\n"); 71 panic("Request PCIe IO resource failed\n");
72 pci_add_resource(&sys->resources, &pp->res[0]); 72 pci_add_resource_offset(&sys->resources, &pp->res[0], sys->io_offset);
73 73
74 /* 74 /*
75 * IORESOURCE_MEM 75 * IORESOURCE_MEM
@@ -88,7 +88,7 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
88 pp->res[1].flags = IORESOURCE_MEM; 88 pp->res[1].flags = IORESOURCE_MEM;
89 if (request_resource(&iomem_resource, &pp->res[1])) 89 if (request_resource(&iomem_resource, &pp->res[1]))
90 panic("Request PCIe Memory resource failed\n"); 90 panic("Request PCIe Memory resource failed\n");
91 pci_add_resource(&sys->resources, &pp->res[1]); 91 pci_add_resource_offset(&sys->resources, &pp->res[1], sys->mem_offset);
92 92
93 return 1; 93 return 1;
94} 94}
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 294aad07f7a..804c9122b7b 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -271,8 +271,33 @@ static struct platform_device *ebsa110_devices[] = {
271 &am79c961_device, 271 &am79c961_device,
272}; 272};
273 273
274/*
275 * EBSA110 idling methodology:
276 *
277 * We can not execute the "wait for interrupt" instruction since that
278 * will stop our MCLK signal (which provides the clock for the glue
279 * logic, and therefore the timer interrupt).
280 *
281 * Instead, we spin, polling the IRQ_STAT register for the occurrence
282 * of any interrupt with core clock down to the memory clock.
283 */
284static void ebsa110_idle(void)
285{
286 const char *irq_stat = (char *)0xff000000;
287
288 /* disable clock switching */
289 asm volatile ("mcr p15, 0, ip, c15, c2, 2" : : : "cc");
290
291 /* wait for an interrupt to occur */
292 while (!*irq_stat);
293
294 /* enable clock switching */
295 asm volatile ("mcr p15, 0, ip, c15, c1, 2" : : : "cc");
296}
297
274static int __init ebsa110_init(void) 298static int __init ebsa110_init(void)
275{ 299{
300 arm_pm_idle = ebsa110_idle;
276 return platform_add_devices(ebsa110_devices, ARRAY_SIZE(ebsa110_devices)); 301 return platform_add_devices(ebsa110_devices, ARRAY_SIZE(ebsa110_devices));
277} 302}
278 303
diff --git a/arch/arm/mach-ebsa110/include/mach/entry-macro.S b/arch/arm/mach-ebsa110/include/mach/entry-macro.S
index cc3e5992f6b..14b110de78a 100644
--- a/arch/arm/mach-ebsa110/include/mach/entry-macro.S
+++ b/arch/arm/mach-ebsa110/include/mach/entry-macro.S
@@ -12,16 +12,10 @@
12 12
13#define IRQ_STAT 0xff000000 /* read */ 13#define IRQ_STAT 0xff000000 /* read */
14 14
15 .macro disable_fiq
16 .endm
17
18 .macro get_irqnr_preamble, base, tmp 15 .macro get_irqnr_preamble, base, tmp
19 mov \base, #IRQ_STAT 16 mov \base, #IRQ_STAT
20 .endm 17 .endm
21 18
22 .macro arch_ret_to_user, tmp1, tmp2
23 .endm
24
25 .macro get_irqnr_and_base, irqnr, stat, base, tmp 19 .macro get_irqnr_and_base, irqnr, stat, base, tmp
26 ldrb \stat, [\base] @ get interrupts 20 ldrb \stat, [\base] @ get interrupts
27 mov \irqnr, #0 21 mov \irqnr, #0
diff --git a/arch/arm/mach-ebsa110/include/mach/system.h b/arch/arm/mach-ebsa110/include/mach/system.h
deleted file mode 100644
index 2e4af65edb6..00000000000
--- a/arch/arm/mach-ebsa110/include/mach/system.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/system.h
3 *
4 * Copyright (C) 1996-2000 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARCH_SYSTEM_H
11#define __ASM_ARCH_SYSTEM_H
12
13/*
14 * EBSA110 idling methodology:
15 *
16 * We can not execute the "wait for interrupt" instruction since that
17 * will stop our MCLK signal (which provides the clock for the glue
18 * logic, and therefore the timer interrupt).
19 *
20 * Instead, we spin, polling the IRQ_STAT register for the occurrence
21 * of any interrupt with core clock down to the memory clock.
22 */
23static inline void arch_idle(void)
24{
25 const char *irq_stat = (char *)0xff000000;
26
27 /* disable clock switching */
28 asm volatile ("mcr p15, 0, ip, c15, c2, 2" : : : "cc");
29
30 /* wait for an interrupt to occur */
31 while (!*irq_stat);
32
33 /* enable clock switching */
34 asm volatile ("mcr p15, 0, ip, c15, c1, 2" : : : "cc");
35}
36
37#endif
diff --git a/arch/arm/mach-ep93xx/Makefile b/arch/arm/mach-ep93xx/Makefile
index 574209d9e24..0dc51f9462d 100644
--- a/arch/arm/mach-ep93xx/Makefile
+++ b/arch/arm/mach-ep93xx/Makefile
@@ -8,6 +8,9 @@ obj- :=
8 8
9obj-$(CONFIG_EP93XX_DMA) += dma.o 9obj-$(CONFIG_EP93XX_DMA) += dma.o
10 10
11obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o
12AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312
13
11obj-$(CONFIG_MACH_ADSSPHERE) += adssphere.o 14obj-$(CONFIG_MACH_ADSSPHERE) += adssphere.o
12obj-$(CONFIG_MACH_EDB93XX) += edb93xx.o 15obj-$(CONFIG_MACH_EDB93XX) += edb93xx.o
13obj-$(CONFIG_MACH_GESBC9312) += gesbc9312.o 16obj-$(CONFIG_MACH_GESBC9312) += gesbc9312.o
diff --git a/arch/arm/mach-ep93xx/adssphere.c b/arch/arm/mach-ep93xx/adssphere.c
index 681e939407d..2d45947a303 100644
--- a/arch/arm/mach-ep93xx/adssphere.c
+++ b/arch/arm/mach-ep93xx/adssphere.c
@@ -20,6 +20,7 @@
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
22 22
23#include "soc.h"
23 24
24static struct ep93xx_eth_data __initdata adssphere_eth_data = { 25static struct ep93xx_eth_data __initdata adssphere_eth_data = {
25 .phy_id = 1, 26 .phy_id = 1,
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index ca4de710509..c95dbce2468 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -25,6 +25,7 @@
25 25
26#include <asm/div64.h> 26#include <asm/div64.h>
27 27
28#include "soc.h"
28 29
29struct clk { 30struct clk {
30 struct clk *parent; 31 struct clk *parent;
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 24203f9a679..8d258958871 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -46,6 +46,7 @@
46 46
47#include <asm/hardware/vic.h> 47#include <asm/hardware/vic.h>
48 48
49#include "soc.h"
49 50
50/************************************************************************* 51/*************************************************************************
51 * Static I/O mappings that are needed for all EP93xx platforms 52 * Static I/O mappings that are needed for all EP93xx platforms
@@ -204,7 +205,6 @@ void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg)
204 205
205 spin_unlock_irqrestore(&syscon_swlock, flags); 206 spin_unlock_irqrestore(&syscon_swlock, flags);
206} 207}
207EXPORT_SYMBOL(ep93xx_syscon_swlocked_write);
208 208
209void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits) 209void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits)
210{ 210{
@@ -221,7 +221,6 @@ void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits)
221 221
222 spin_unlock_irqrestore(&syscon_swlock, flags); 222 spin_unlock_irqrestore(&syscon_swlock, flags);
223} 223}
224EXPORT_SYMBOL(ep93xx_devcfg_set_clear);
225 224
226/** 225/**
227 * ep93xx_chip_revision() - returns the EP93xx chip revision 226 * ep93xx_chip_revision() - returns the EP93xx chip revision
@@ -279,48 +278,14 @@ static struct amba_pl010_data ep93xx_uart_data = {
279 .set_mctrl = ep93xx_uart_set_mctrl, 278 .set_mctrl = ep93xx_uart_set_mctrl,
280}; 279};
281 280
282static struct amba_device uart1_device = { 281static AMBA_APB_DEVICE(uart1, "apb:uart1", 0x00041010, EP93XX_UART1_PHYS_BASE,
283 .dev = { 282 { IRQ_EP93XX_UART1 }, &ep93xx_uart_data);
284 .init_name = "apb:uart1",
285 .platform_data = &ep93xx_uart_data,
286 },
287 .res = {
288 .start = EP93XX_UART1_PHYS_BASE,
289 .end = EP93XX_UART1_PHYS_BASE + 0x0fff,
290 .flags = IORESOURCE_MEM,
291 },
292 .irq = { IRQ_EP93XX_UART1, NO_IRQ },
293 .periphid = 0x00041010,
294};
295
296static struct amba_device uart2_device = {
297 .dev = {
298 .init_name = "apb:uart2",
299 .platform_data = &ep93xx_uart_data,
300 },
301 .res = {
302 .start = EP93XX_UART2_PHYS_BASE,
303 .end = EP93XX_UART2_PHYS_BASE + 0x0fff,
304 .flags = IORESOURCE_MEM,
305 },
306 .irq = { IRQ_EP93XX_UART2, NO_IRQ },
307 .periphid = 0x00041010,
308};
309 283
310static struct amba_device uart3_device = { 284static AMBA_APB_DEVICE(uart2, "apb:uart2", 0x00041010, EP93XX_UART2_PHYS_BASE,
311 .dev = { 285 { IRQ_EP93XX_UART2 }, &ep93xx_uart_data);
312 .init_name = "apb:uart3",
313 .platform_data = &ep93xx_uart_data,
314 },
315 .res = {
316 .start = EP93XX_UART3_PHYS_BASE,
317 .end = EP93XX_UART3_PHYS_BASE + 0x0fff,
318 .flags = IORESOURCE_MEM,
319 },
320 .irq = { IRQ_EP93XX_UART3, NO_IRQ },
321 .periphid = 0x00041010,
322};
323 286
287static AMBA_APB_DEVICE(uart3, "apb:uart3", 0x00041010, EP93XX_UART3_PHYS_BASE,
288 { IRQ_EP93XX_UART3 }, &ep93xx_uart_data);
324 289
325static struct resource ep93xx_rtc_resource[] = { 290static struct resource ep93xx_rtc_resource[] = {
326 { 291 {
@@ -682,9 +647,19 @@ static struct platform_device ep93xx_fb_device = {
682 .resource = ep93xx_fb_resource, 647 .resource = ep93xx_fb_resource,
683}; 648};
684 649
650/* The backlight use a single register in the framebuffer's register space */
651#define EP93XX_RASTER_REG_BRIGHTNESS 0x20
652
653static struct resource ep93xx_bl_resources[] = {
654 DEFINE_RES_MEM(EP93XX_RASTER_PHYS_BASE +
655 EP93XX_RASTER_REG_BRIGHTNESS, 0x04),
656};
657
685static struct platform_device ep93xx_bl_device = { 658static struct platform_device ep93xx_bl_device = {
686 .name = "ep93xx-bl", 659 .name = "ep93xx-bl",
687 .id = -1, 660 .id = -1,
661 .num_resources = ARRAY_SIZE(ep93xx_bl_resources),
662 .resource = ep93xx_bl_resources,
688}; 663};
689 664
690/** 665/**
@@ -817,23 +792,12 @@ void __init ep93xx_register_i2s(void)
817#define EP93XX_I2SCLKDIV_MASK (EP93XX_SYSCON_I2SCLKDIV_ORIDE | \ 792#define EP93XX_I2SCLKDIV_MASK (EP93XX_SYSCON_I2SCLKDIV_ORIDE | \
818 EP93XX_SYSCON_I2SCLKDIV_SPOL) 793 EP93XX_SYSCON_I2SCLKDIV_SPOL)
819 794
820int ep93xx_i2s_acquire(unsigned i2s_pins, unsigned i2s_config) 795int ep93xx_i2s_acquire(void)
821{ 796{
822 unsigned val; 797 unsigned val;
823 798
824 /* Sanity check */ 799 ep93xx_devcfg_set_clear(EP93XX_SYSCON_DEVCFG_I2SONAC97,
825 if (i2s_pins & ~EP93XX_SYSCON_DEVCFG_I2S_MASK) 800 EP93XX_SYSCON_DEVCFG_I2S_MASK);
826 return -EINVAL;
827 if (i2s_config & ~EP93XX_I2SCLKDIV_MASK)
828 return -EINVAL;
829
830 /* Must have only one of I2SONSSP/I2SONAC97 set */
831 if ((i2s_pins & EP93XX_SYSCON_DEVCFG_I2SONSSP) ==
832 (i2s_pins & EP93XX_SYSCON_DEVCFG_I2SONAC97))
833 return -EINVAL;
834
835 ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2S_MASK);
836 ep93xx_devcfg_set_bits(i2s_pins);
837 801
838 /* 802 /*
839 * This is potentially racy with the clock api for i2s_mclk, sclk and 803 * This is potentially racy with the clock api for i2s_mclk, sclk and
@@ -843,7 +807,7 @@ int ep93xx_i2s_acquire(unsigned i2s_pins, unsigned i2s_config)
843 */ 807 */
844 val = __raw_readl(EP93XX_SYSCON_I2SCLKDIV); 808 val = __raw_readl(EP93XX_SYSCON_I2SCLKDIV);
845 val &= ~EP93XX_I2SCLKDIV_MASK; 809 val &= ~EP93XX_I2SCLKDIV_MASK;
846 val |= i2s_config; 810 val |= EP93XX_SYSCON_I2SCLKDIV_ORIDE | EP93XX_SYSCON_I2SCLKDIV_SPOL;
847 ep93xx_syscon_swlocked_write(val, EP93XX_SYSCON_I2SCLKDIV); 811 ep93xx_syscon_swlocked_write(val, EP93XX_SYSCON_I2SCLKDIV);
848 812
849 return 0; 813 return 0;
@@ -890,11 +854,32 @@ void __init ep93xx_register_ac97(void)
890 platform_device_register(&ep93xx_pcm_device); 854 platform_device_register(&ep93xx_pcm_device);
891} 855}
892 856
857/*************************************************************************
858 * EP93xx Watchdog
859 *************************************************************************/
860static struct resource ep93xx_wdt_resources[] = {
861 DEFINE_RES_MEM(EP93XX_WATCHDOG_PHYS_BASE, 0x08),
862};
863
864static struct platform_device ep93xx_wdt_device = {
865 .name = "ep93xx-wdt",
866 .id = -1,
867 .num_resources = ARRAY_SIZE(ep93xx_wdt_resources),
868 .resource = ep93xx_wdt_resources,
869};
870
893void __init ep93xx_init_devices(void) 871void __init ep93xx_init_devices(void)
894{ 872{
895 /* Disallow access to MaverickCrunch initially */ 873 /* Disallow access to MaverickCrunch initially */
896 ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_CPENA); 874 ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_CPENA);
897 875
876 /* Default all ports to GPIO */
877 ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_KEYS |
878 EP93XX_SYSCON_DEVCFG_GONK |
879 EP93XX_SYSCON_DEVCFG_EONIDE |
880 EP93XX_SYSCON_DEVCFG_GONIDE |
881 EP93XX_SYSCON_DEVCFG_HONIDE);
882
898 /* Get the GPIO working early, other devices need it */ 883 /* Get the GPIO working early, other devices need it */
899 platform_device_register(&ep93xx_gpio_device); 884 platform_device_register(&ep93xx_gpio_device);
900 885
@@ -905,6 +890,7 @@ void __init ep93xx_init_devices(void)
905 platform_device_register(&ep93xx_rtc_device); 890 platform_device_register(&ep93xx_rtc_device);
906 platform_device_register(&ep93xx_ohci_device); 891 platform_device_register(&ep93xx_ohci_device);
907 platform_device_register(&ep93xx_leds); 892 platform_device_register(&ep93xx_leds);
893 platform_device_register(&ep93xx_wdt_device);
908} 894}
909 895
910void ep93xx_restart(char mode, const char *cmd) 896void ep93xx_restart(char mode, const char *cmd)
diff --git a/arch/arm/kernel/crunch-bits.S b/arch/arm/mach-ep93xx/crunch-bits.S
index 0ec9bb48fab..0ec9bb48fab 100644
--- a/arch/arm/kernel/crunch-bits.S
+++ b/arch/arm/mach-ep93xx/crunch-bits.S
diff --git a/arch/arm/kernel/crunch.c b/arch/arm/mach-ep93xx/crunch.c
index 25ef223ba7f..74753e2df60 100644
--- a/arch/arm/kernel/crunch.c
+++ b/arch/arm/mach-ep93xx/crunch.c
@@ -16,9 +16,11 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <mach/ep93xx-regs.h> 19
20#include <asm/thread_notify.h> 20#include <asm/thread_notify.h>
21 21
22#include "soc.h"
23
22struct crunch_state *crunch_owner; 24struct crunch_state *crunch_owner;
23 25
24void crunch_task_release(struct thread_info *thread) 26void crunch_task_release(struct thread_info *thread)
diff --git a/arch/arm/mach-ep93xx/dma.c b/arch/arm/mach-ep93xx/dma.c
index 5a257088125..16976d7bdc8 100644
--- a/arch/arm/mach-ep93xx/dma.c
+++ b/arch/arm/mach-ep93xx/dma.c
@@ -28,6 +28,8 @@
28#include <mach/dma.h> 28#include <mach/dma.h>
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30 30
31#include "soc.h"
32
31#define DMA_CHANNEL(_name, _base, _irq) \ 33#define DMA_CHANNEL(_name, _base, _irq) \
32 { .name = (_name), .base = (_base), .irq = (_irq) } 34 { .name = (_name), .base = (_base), .irq = (_irq) }
33 35
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index d115653edca..da9047d726f 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -43,6 +43,7 @@
43#include <asm/mach-types.h> 43#include <asm/mach-types.h>
44#include <asm/mach/arch.h> 44#include <asm/mach/arch.h>
45 45
46#include "soc.h"
46 47
47static void __init edb93xx_register_flash(void) 48static void __init edb93xx_register_flash(void)
48{ 49{
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c
index af46970dc58..fcdffbe49dc 100644
--- a/arch/arm/mach-ep93xx/gesbc9312.c
+++ b/arch/arm/mach-ep93xx/gesbc9312.c
@@ -20,6 +20,7 @@
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
22 22
23#include "soc.h"
23 24
24static struct ep93xx_eth_data __initdata gesbc9312_eth_data = { 25static struct ep93xx_eth_data __initdata gesbc9312_eth_data = {
25 .phy_id = 1, 26 .phy_id = 1,
diff --git a/arch/arm/mach-ep93xx/include/mach/entry-macro.S b/arch/arm/mach-ep93xx/include/mach/entry-macro.S
deleted file mode 100644
index 9be6edcf904..00000000000
--- a/arch/arm/mach-ep93xx/include/mach/entry-macro.S
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/entry-macro.S
3 * IRQ demultiplexing for EP93xx
4 *
5 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 */
12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
index c4a7b84ef06..c64d7424660 100644
--- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
+++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
@@ -6,40 +6,6 @@
6#define __ASM_ARCH_EP93XX_REGS_H 6#define __ASM_ARCH_EP93XX_REGS_H
7 7
8/* 8/*
9 * EP93xx Physical Memory Map:
10 *
11 * The ASDO pin is sampled at system reset to select a synchronous or
12 * asynchronous boot configuration. When ASDO is "1" (i.e. pulled-up)
13 * the synchronous boot mode is selected. When ASDO is "0" (i.e
14 * pulled-down) the asynchronous boot mode is selected.
15 *
16 * In synchronous boot mode nSDCE3 is decoded starting at physical address
17 * 0x00000000 and nCS0 is decoded starting at 0xf0000000. For asynchronous
18 * boot mode they are swapped with nCS0 decoded at 0x00000000 ann nSDCE3
19 * decoded at 0xf0000000.
20 *
21 * There is known errata for the EP93xx dealing with External Memory
22 * Configurations. Please refer to "AN273: EP93xx Silicon Rev E Design
23 * Guidelines" for more information. This document can be found at:
24 *
25 * http://www.cirrus.com/en/pubs/appNote/AN273REV4.pdf
26 */
27
28#define EP93XX_CS0_PHYS_BASE_ASYNC 0x00000000 /* ASDO Pin = 0 */
29#define EP93XX_SDCE3_PHYS_BASE_SYNC 0x00000000 /* ASDO Pin = 1 */
30#define EP93XX_CS1_PHYS_BASE 0x10000000
31#define EP93XX_CS2_PHYS_BASE 0x20000000
32#define EP93XX_CS3_PHYS_BASE 0x30000000
33#define EP93XX_PCMCIA_PHYS_BASE 0x40000000
34#define EP93XX_CS6_PHYS_BASE 0x60000000
35#define EP93XX_CS7_PHYS_BASE 0x70000000
36#define EP93XX_SDCE0_PHYS_BASE 0xc0000000
37#define EP93XX_SDCE1_PHYS_BASE 0xd0000000
38#define EP93XX_SDCE2_PHYS_BASE 0xe0000000
39#define EP93XX_SDCE3_PHYS_BASE_ASYNC 0xf0000000 /* ASDO Pin = 0 */
40#define EP93XX_CS0_PHYS_BASE_SYNC 0xf0000000 /* ASDO Pin = 1 */
41
42/*
43 * EP93xx linux memory map: 9 * EP93xx linux memory map:
44 * 10 *
45 * virt phys size 11 * virt phys size
@@ -62,58 +28,7 @@
62#define EP93XX_APB_PHYS(x) (EP93XX_APB_PHYS_BASE + (x)) 28#define EP93XX_APB_PHYS(x) (EP93XX_APB_PHYS_BASE + (x))
63#define EP93XX_APB_IOMEM(x) IOMEM(EP93XX_APB_VIRT_BASE + (x)) 29#define EP93XX_APB_IOMEM(x) IOMEM(EP93XX_APB_VIRT_BASE + (x))
64 30
65 31/* APB UARTs */
66/* AHB peripherals */
67#define EP93XX_DMA_BASE EP93XX_AHB_IOMEM(0x00000000)
68
69#define EP93XX_ETHERNET_PHYS_BASE EP93XX_AHB_PHYS(0x00010000)
70#define EP93XX_ETHERNET_BASE EP93XX_AHB_IOMEM(0x00010000)
71
72#define EP93XX_USB_PHYS_BASE EP93XX_AHB_PHYS(0x00020000)
73#define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000)
74
75#define EP93XX_RASTER_PHYS_BASE EP93XX_AHB_PHYS(0x00030000)
76#define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000)
77
78#define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000)
79
80#define EP93XX_SDRAM_CONTROLLER_BASE EP93XX_AHB_IOMEM(0x00060000)
81
82#define EP93XX_PCMCIA_CONTROLLER_BASE EP93XX_AHB_IOMEM(0x00080000)
83
84#define EP93XX_BOOT_ROM_BASE EP93XX_AHB_IOMEM(0x00090000)
85
86#define EP93XX_IDE_BASE EP93XX_AHB_IOMEM(0x000a0000)
87
88#define EP93XX_VIC1_BASE EP93XX_AHB_IOMEM(0x000b0000)
89
90#define EP93XX_VIC2_BASE EP93XX_AHB_IOMEM(0x000c0000)
91
92
93/* APB peripherals */
94#define EP93XX_TIMER_BASE EP93XX_APB_IOMEM(0x00010000)
95
96#define EP93XX_I2S_PHYS_BASE EP93XX_APB_PHYS(0x00020000)
97#define EP93XX_I2S_BASE EP93XX_APB_IOMEM(0x00020000)
98
99#define EP93XX_SECURITY_BASE EP93XX_APB_IOMEM(0x00030000)
100
101#define EP93XX_GPIO_PHYS_BASE EP93XX_APB_PHYS(0x00040000)
102#define EP93XX_GPIO_BASE EP93XX_APB_IOMEM(0x00040000)
103#define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x))
104#define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c)
105#define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0)
106#define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc)
107#define EP93XX_GPIO_EEDRIVE EP93XX_GPIO_REG(0xc8)
108
109#define EP93XX_AAC_PHYS_BASE EP93XX_APB_PHYS(0x00080000)
110#define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000)
111
112#define EP93XX_SPI_PHYS_BASE EP93XX_APB_PHYS(0x000a0000)
113#define EP93XX_SPI_BASE EP93XX_APB_IOMEM(0x000a0000)
114
115#define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000)
116
117#define EP93XX_UART1_PHYS_BASE EP93XX_APB_PHYS(0x000c0000) 32#define EP93XX_UART1_PHYS_BASE EP93XX_APB_PHYS(0x000c0000)
118#define EP93XX_UART1_BASE EP93XX_APB_IOMEM(0x000c0000) 33#define EP93XX_UART1_BASE EP93XX_APB_IOMEM(0x000c0000)
119 34
@@ -123,108 +38,4 @@
123#define EP93XX_UART3_PHYS_BASE EP93XX_APB_PHYS(0x000e0000) 38#define EP93XX_UART3_PHYS_BASE EP93XX_APB_PHYS(0x000e0000)
124#define EP93XX_UART3_BASE EP93XX_APB_IOMEM(0x000e0000) 39#define EP93XX_UART3_BASE EP93XX_APB_IOMEM(0x000e0000)
125 40
126#define EP93XX_KEY_MATRIX_PHYS_BASE EP93XX_APB_PHYS(0x000f0000)
127#define EP93XX_KEY_MATRIX_BASE EP93XX_APB_IOMEM(0x000f0000)
128
129#define EP93XX_ADC_BASE EP93XX_APB_IOMEM(0x00100000)
130#define EP93XX_TOUCHSCREEN_BASE EP93XX_APB_IOMEM(0x00100000)
131
132#define EP93XX_PWM_PHYS_BASE EP93XX_APB_PHYS(0x00110000)
133#define EP93XX_PWM_BASE EP93XX_APB_IOMEM(0x00110000)
134
135#define EP93XX_RTC_PHYS_BASE EP93XX_APB_PHYS(0x00120000)
136#define EP93XX_RTC_BASE EP93XX_APB_IOMEM(0x00120000)
137
138#define EP93XX_SYSCON_BASE EP93XX_APB_IOMEM(0x00130000)
139#define EP93XX_SYSCON_REG(x) (EP93XX_SYSCON_BASE + (x))
140#define EP93XX_SYSCON_POWER_STATE EP93XX_SYSCON_REG(0x00)
141#define EP93XX_SYSCON_PWRCNT EP93XX_SYSCON_REG(0x04)
142#define EP93XX_SYSCON_PWRCNT_FIR_EN (1<<31)
143#define EP93XX_SYSCON_PWRCNT_UARTBAUD (1<<29)
144#define EP93XX_SYSCON_PWRCNT_USH_EN (1<<28)
145#define EP93XX_SYSCON_PWRCNT_DMA_M2M1 (1<<27)
146#define EP93XX_SYSCON_PWRCNT_DMA_M2M0 (1<<26)
147#define EP93XX_SYSCON_PWRCNT_DMA_M2P8 (1<<25)
148#define EP93XX_SYSCON_PWRCNT_DMA_M2P9 (1<<24)
149#define EP93XX_SYSCON_PWRCNT_DMA_M2P6 (1<<23)
150#define EP93XX_SYSCON_PWRCNT_DMA_M2P7 (1<<22)
151#define EP93XX_SYSCON_PWRCNT_DMA_M2P4 (1<<21)
152#define EP93XX_SYSCON_PWRCNT_DMA_M2P5 (1<<20)
153#define EP93XX_SYSCON_PWRCNT_DMA_M2P2 (1<<19)
154#define EP93XX_SYSCON_PWRCNT_DMA_M2P3 (1<<18)
155#define EP93XX_SYSCON_PWRCNT_DMA_M2P0 (1<<17)
156#define EP93XX_SYSCON_PWRCNT_DMA_M2P1 (1<<16)
157#define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08)
158#define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c)
159#define EP93XX_SYSCON_CLKSET1 EP93XX_SYSCON_REG(0x20)
160#define EP93XX_SYSCON_CLKSET1_NBYP1 (1<<23)
161#define EP93XX_SYSCON_CLKSET2 EP93XX_SYSCON_REG(0x24)
162#define EP93XX_SYSCON_CLKSET2_NBYP2 (1<<19)
163#define EP93XX_SYSCON_CLKSET2_PLL2_EN (1<<18)
164#define EP93XX_SYSCON_DEVCFG EP93XX_SYSCON_REG(0x80)
165#define EP93XX_SYSCON_DEVCFG_SWRST (1<<31)
166#define EP93XX_SYSCON_DEVCFG_D1ONG (1<<30)
167#define EP93XX_SYSCON_DEVCFG_D0ONG (1<<29)
168#define EP93XX_SYSCON_DEVCFG_IONU2 (1<<28)
169#define EP93XX_SYSCON_DEVCFG_GONK (1<<27)
170#define EP93XX_SYSCON_DEVCFG_TONG (1<<26)
171#define EP93XX_SYSCON_DEVCFG_MONG (1<<25)
172#define EP93XX_SYSCON_DEVCFG_U3EN (1<<24)
173#define EP93XX_SYSCON_DEVCFG_CPENA (1<<23)
174#define EP93XX_SYSCON_DEVCFG_A2ONG (1<<22)
175#define EP93XX_SYSCON_DEVCFG_A1ONG (1<<21)
176#define EP93XX_SYSCON_DEVCFG_U2EN (1<<20)
177#define EP93XX_SYSCON_DEVCFG_EXVC (1<<19)
178#define EP93XX_SYSCON_DEVCFG_U1EN (1<<18)
179#define EP93XX_SYSCON_DEVCFG_TIN (1<<17)
180#define EP93XX_SYSCON_DEVCFG_HC3IN (1<<15)
181#define EP93XX_SYSCON_DEVCFG_HC3EN (1<<14)
182#define EP93XX_SYSCON_DEVCFG_HC1IN (1<<13)
183#define EP93XX_SYSCON_DEVCFG_HC1EN (1<<12)
184#define EP93XX_SYSCON_DEVCFG_HONIDE (1<<11)
185#define EP93XX_SYSCON_DEVCFG_GONIDE (1<<10)
186#define EP93XX_SYSCON_DEVCFG_PONG (1<<9)
187#define EP93XX_SYSCON_DEVCFG_EONIDE (1<<8)
188#define EP93XX_SYSCON_DEVCFG_I2SONSSP (1<<7)
189#define EP93XX_SYSCON_DEVCFG_I2SONAC97 (1<<6)
190#define EP93XX_SYSCON_DEVCFG_RASONP3 (1<<4)
191#define EP93XX_SYSCON_DEVCFG_RAS (1<<3)
192#define EP93XX_SYSCON_DEVCFG_ADCPD (1<<2)
193#define EP93XX_SYSCON_DEVCFG_KEYS (1<<1)
194#define EP93XX_SYSCON_DEVCFG_SHENA (1<<0)
195#define EP93XX_SYSCON_VIDCLKDIV EP93XX_SYSCON_REG(0x84)
196#define EP93XX_SYSCON_CLKDIV_ENABLE (1<<15)
197#define EP93XX_SYSCON_CLKDIV_ESEL (1<<14)
198#define EP93XX_SYSCON_CLKDIV_PSEL (1<<13)
199#define EP93XX_SYSCON_CLKDIV_PDIV_SHIFT 8
200#define EP93XX_SYSCON_I2SCLKDIV EP93XX_SYSCON_REG(0x8c)
201#define EP93XX_SYSCON_I2SCLKDIV_SENA (1<<31)
202#define EP93XX_SYSCON_I2SCLKDIV_ORIDE (1<<29)
203#define EP93XX_SYSCON_I2SCLKDIV_SPOL (1<<19)
204#define EP93XX_I2SCLKDIV_SDIV (1 << 16)
205#define EP93XX_I2SCLKDIV_LRDIV32 (0 << 17)
206#define EP93XX_I2SCLKDIV_LRDIV64 (1 << 17)
207#define EP93XX_I2SCLKDIV_LRDIV128 (2 << 17)
208#define EP93XX_I2SCLKDIV_LRDIV_MASK (3 << 17)
209#define EP93XX_SYSCON_KEYTCHCLKDIV EP93XX_SYSCON_REG(0x90)
210#define EP93XX_SYSCON_KEYTCHCLKDIV_TSEN (1<<31)
211#define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16)
212#define EP93XX_SYSCON_KEYTCHCLKDIV_KEN (1<<15)
213#define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV (1<<0)
214#define EP93XX_SYSCON_SYSCFG EP93XX_SYSCON_REG(0x9c)
215#define EP93XX_SYSCON_SYSCFG_REV_MASK (0xf0000000)
216#define EP93XX_SYSCON_SYSCFG_REV_SHIFT (28)
217#define EP93XX_SYSCON_SYSCFG_SBOOT (1<<8)
218#define EP93XX_SYSCON_SYSCFG_LCSN7 (1<<7)
219#define EP93XX_SYSCON_SYSCFG_LCSN6 (1<<6)
220#define EP93XX_SYSCON_SYSCFG_LASDO (1<<5)
221#define EP93XX_SYSCON_SYSCFG_LEEDA (1<<4)
222#define EP93XX_SYSCON_SYSCFG_LEECLK (1<<3)
223#define EP93XX_SYSCON_SYSCFG_LCSN2 (1<<1)
224#define EP93XX_SYSCON_SYSCFG_LCSN1 (1<<0)
225#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0)
226
227#define EP93XX_WATCHDOG_BASE EP93XX_APB_IOMEM(0x00140000)
228
229
230#endif 41#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h b/arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
index 8aff2ea3587..6d7c571a519 100644
--- a/arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
+++ b/arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
@@ -3,6 +3,16 @@
3#ifndef __GPIO_EP93XX_H 3#ifndef __GPIO_EP93XX_H
4#define __GPIO_EP93XX_H 4#define __GPIO_EP93XX_H
5 5
6#include <mach/ep93xx-regs.h>
7
8#define EP93XX_GPIO_PHYS_BASE EP93XX_APB_PHYS(0x00040000)
9#define EP93XX_GPIO_BASE EP93XX_APB_IOMEM(0x00040000)
10#define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x))
11#define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c)
12#define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0)
13#define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc)
14#define EP93XX_GPIO_EEDRIVE EP93XX_GPIO_REG(0xc8)
15
6/* GPIO port A. */ 16/* GPIO port A. */
7#define EP93XX_GPIO_LINE_A(x) ((x) + 0) 17#define EP93XX_GPIO_LINE_A(x) ((x) + 0)
8#define EP93XX_GPIO_LINE_EGPIO0 EP93XX_GPIO_LINE_A(0) 18#define EP93XX_GPIO_LINE_EGPIO0 EP93XX_GPIO_LINE_A(0)
diff --git a/arch/arm/mach-ep93xx/include/mach/hardware.h b/arch/arm/mach-ep93xx/include/mach/hardware.h
index 4df842897ea..efcd47815a9 100644
--- a/arch/arm/mach-ep93xx/include/mach/hardware.h
+++ b/arch/arm/mach-ep93xx/include/mach/hardware.h
@@ -5,7 +5,6 @@
5#ifndef __ASM_ARCH_HARDWARE_H 5#ifndef __ASM_ARCH_HARDWARE_H
6#define __ASM_ARCH_HARDWARE_H 6#define __ASM_ARCH_HARDWARE_H
7 7
8#include <mach/ep93xx-regs.h>
9#include <mach/platform.h> 8#include <mach/platform.h>
10 9
11/* 10/*
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index d4c934931f9..602bd87fd0a 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -21,20 +21,6 @@ struct ep93xx_eth_data
21void ep93xx_map_io(void); 21void ep93xx_map_io(void);
22void ep93xx_init_irq(void); 22void ep93xx_init_irq(void);
23 23
24/* EP93xx System Controller software locked register write */
25void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg);
26void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits);
27
28static inline void ep93xx_devcfg_set_bits(unsigned int bits)
29{
30 ep93xx_devcfg_set_clear(bits, 0x00);
31}
32
33static inline void ep93xx_devcfg_clear_bits(unsigned int bits)
34{
35 ep93xx_devcfg_set_clear(0x00, bits);
36}
37
38#define EP93XX_CHIP_REV_D0 3 24#define EP93XX_CHIP_REV_D0 3
39#define EP93XX_CHIP_REV_D1 4 25#define EP93XX_CHIP_REV_D1 4
40#define EP93XX_CHIP_REV_E0 5 26#define EP93XX_CHIP_REV_E0 5
@@ -59,7 +45,7 @@ void ep93xx_register_keypad(struct ep93xx_keypad_platform_data *data);
59int ep93xx_keypad_acquire_gpio(struct platform_device *pdev); 45int ep93xx_keypad_acquire_gpio(struct platform_device *pdev);
60void ep93xx_keypad_release_gpio(struct platform_device *pdev); 46void ep93xx_keypad_release_gpio(struct platform_device *pdev);
61void ep93xx_register_i2s(void); 47void ep93xx_register_i2s(void);
62int ep93xx_i2s_acquire(unsigned i2s_pins, unsigned i2s_config); 48int ep93xx_i2s_acquire(void);
63void ep93xx_i2s_release(void); 49void ep93xx_i2s_release(void);
64void ep93xx_register_ac97(void); 50void ep93xx_register_ac97(void);
65 51
diff --git a/arch/arm/mach-ep93xx/include/mach/system.h b/arch/arm/mach-ep93xx/include/mach/system.h
deleted file mode 100644
index b5bec7cb9b5..00000000000
--- a/arch/arm/mach-ep93xx/include/mach/system.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/system.h
3 */
4static inline void arch_idle(void)
5{
6 cpu_do_idle();
7}
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c
index 7b98084f0c9..dc431c5f04c 100644
--- a/arch/arm/mach-ep93xx/micro9.c
+++ b/arch/arm/mach-ep93xx/micro9.c
@@ -22,6 +22,7 @@
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24 24
25#include "soc.h"
25 26
26/************************************************************************* 27/*************************************************************************
27 * Micro9 NOR Flash 28 * Micro9 NOR Flash
diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c
index f4e553eca21..f40c2987e54 100644
--- a/arch/arm/mach-ep93xx/simone.c
+++ b/arch/arm/mach-ep93xx/simone.c
@@ -29,6 +29,8 @@
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 "soc.h"
33
32static struct ep93xx_eth_data __initdata simone_eth_data = { 34static struct ep93xx_eth_data __initdata simone_eth_data = {
33 .phy_id = 1, 35 .phy_id = 1,
34}; 36};
diff --git a/arch/arm/mach-ep93xx/snappercl15.c b/arch/arm/mach-ep93xx/snappercl15.c
index fd846331ddf..0c00852ef16 100644
--- a/arch/arm/mach-ep93xx/snappercl15.c
+++ b/arch/arm/mach-ep93xx/snappercl15.c
@@ -35,6 +35,8 @@
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
37 37
38#include "soc.h"
39
38#define SNAPPERCL15_NAND_BASE (EP93XX_CS7_PHYS_BASE + SZ_16M) 40#define SNAPPERCL15_NAND_BASE (EP93XX_CS7_PHYS_BASE + SZ_16M)
39 41
40#define SNAPPERCL15_NAND_WPN (1 << 8) /* Write protect (active low) */ 42#define SNAPPERCL15_NAND_WPN (1 << 8) /* Write protect (active low) */
diff --git a/arch/arm/mach-ep93xx/soc.h b/arch/arm/mach-ep93xx/soc.h
new file mode 100644
index 00000000000..979fba72292
--- /dev/null
+++ b/arch/arm/mach-ep93xx/soc.h
@@ -0,0 +1,213 @@
1/*
2 * arch/arm/mach-ep93xx/soc.h
3 *
4 * Copyright (C) 2012 Open Kernel Labs <www.ok-labs.com>
5 * Copyright (C) 2012 Ryan Mallon <rmallon@gmail.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 (at
10 * your option) any later version.
11 */
12
13#ifndef _EP93XX_SOC_H
14#define _EP93XX_SOC_H
15
16#include <mach/ep93xx-regs.h>
17
18/*
19 * EP93xx Physical Memory Map:
20 *
21 * The ASDO pin is sampled at system reset to select a synchronous or
22 * asynchronous boot configuration. When ASDO is "1" (i.e. pulled-up)
23 * the synchronous boot mode is selected. When ASDO is "0" (i.e
24 * pulled-down) the asynchronous boot mode is selected.
25 *
26 * In synchronous boot mode nSDCE3 is decoded starting at physical address
27 * 0x00000000 and nCS0 is decoded starting at 0xf0000000. For asynchronous
28 * boot mode they are swapped with nCS0 decoded at 0x00000000 ann nSDCE3
29 * decoded at 0xf0000000.
30 *
31 * There is known errata for the EP93xx dealing with External Memory
32 * Configurations. Please refer to "AN273: EP93xx Silicon Rev E Design
33 * Guidelines" for more information. This document can be found at:
34 *
35 * http://www.cirrus.com/en/pubs/appNote/AN273REV4.pdf
36 */
37
38#define EP93XX_CS0_PHYS_BASE_ASYNC 0x00000000 /* ASDO Pin = 0 */
39#define EP93XX_SDCE3_PHYS_BASE_SYNC 0x00000000 /* ASDO Pin = 1 */
40#define EP93XX_CS1_PHYS_BASE 0x10000000
41#define EP93XX_CS2_PHYS_BASE 0x20000000
42#define EP93XX_CS3_PHYS_BASE 0x30000000
43#define EP93XX_PCMCIA_PHYS_BASE 0x40000000
44#define EP93XX_CS6_PHYS_BASE 0x60000000
45#define EP93XX_CS7_PHYS_BASE 0x70000000
46#define EP93XX_SDCE0_PHYS_BASE 0xc0000000
47#define EP93XX_SDCE1_PHYS_BASE 0xd0000000
48#define EP93XX_SDCE2_PHYS_BASE 0xe0000000
49#define EP93XX_SDCE3_PHYS_BASE_ASYNC 0xf0000000 /* ASDO Pin = 0 */
50#define EP93XX_CS0_PHYS_BASE_SYNC 0xf0000000 /* ASDO Pin = 1 */
51
52/* AHB peripherals */
53#define EP93XX_DMA_BASE EP93XX_AHB_IOMEM(0x00000000)
54
55#define EP93XX_ETHERNET_PHYS_BASE EP93XX_AHB_PHYS(0x00010000)
56#define EP93XX_ETHERNET_BASE EP93XX_AHB_IOMEM(0x00010000)
57
58#define EP93XX_USB_PHYS_BASE EP93XX_AHB_PHYS(0x00020000)
59#define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000)
60
61#define EP93XX_RASTER_PHYS_BASE EP93XX_AHB_PHYS(0x00030000)
62#define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000)
63
64#define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000)
65
66#define EP93XX_SDRAM_CONTROLLER_BASE EP93XX_AHB_IOMEM(0x00060000)
67
68#define EP93XX_PCMCIA_CONTROLLER_BASE EP93XX_AHB_IOMEM(0x00080000)
69
70#define EP93XX_BOOT_ROM_BASE EP93XX_AHB_IOMEM(0x00090000)
71
72#define EP93XX_IDE_BASE EP93XX_AHB_IOMEM(0x000a0000)
73
74#define EP93XX_VIC1_BASE EP93XX_AHB_IOMEM(0x000b0000)
75
76#define EP93XX_VIC2_BASE EP93XX_AHB_IOMEM(0x000c0000)
77
78/* APB peripherals */
79#define EP93XX_TIMER_BASE EP93XX_APB_IOMEM(0x00010000)
80
81#define EP93XX_I2S_PHYS_BASE EP93XX_APB_PHYS(0x00020000)
82#define EP93XX_I2S_BASE EP93XX_APB_IOMEM(0x00020000)
83
84#define EP93XX_SECURITY_BASE EP93XX_APB_IOMEM(0x00030000)
85
86#define EP93XX_AAC_PHYS_BASE EP93XX_APB_PHYS(0x00080000)
87#define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000)
88
89#define EP93XX_SPI_PHYS_BASE EP93XX_APB_PHYS(0x000a0000)
90#define EP93XX_SPI_BASE EP93XX_APB_IOMEM(0x000a0000)
91
92#define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000)
93
94#define EP93XX_KEY_MATRIX_PHYS_BASE EP93XX_APB_PHYS(0x000f0000)
95#define EP93XX_KEY_MATRIX_BASE EP93XX_APB_IOMEM(0x000f0000)
96
97#define EP93XX_ADC_BASE EP93XX_APB_IOMEM(0x00100000)
98#define EP93XX_TOUCHSCREEN_BASE EP93XX_APB_IOMEM(0x00100000)
99
100#define EP93XX_PWM_PHYS_BASE EP93XX_APB_PHYS(0x00110000)
101#define EP93XX_PWM_BASE EP93XX_APB_IOMEM(0x00110000)
102
103#define EP93XX_RTC_PHYS_BASE EP93XX_APB_PHYS(0x00120000)
104#define EP93XX_RTC_BASE EP93XX_APB_IOMEM(0x00120000)
105
106#define EP93XX_WATCHDOG_PHYS_BASE EP93XX_APB_PHYS(0x00140000)
107#define EP93XX_WATCHDOG_BASE EP93XX_APB_IOMEM(0x00140000)
108
109/* System controller */
110#define EP93XX_SYSCON_BASE EP93XX_APB_IOMEM(0x00130000)
111#define EP93XX_SYSCON_REG(x) (EP93XX_SYSCON_BASE + (x))
112#define EP93XX_SYSCON_POWER_STATE EP93XX_SYSCON_REG(0x00)
113#define EP93XX_SYSCON_PWRCNT EP93XX_SYSCON_REG(0x04)
114#define EP93XX_SYSCON_PWRCNT_FIR_EN (1<<31)
115#define EP93XX_SYSCON_PWRCNT_UARTBAUD (1<<29)
116#define EP93XX_SYSCON_PWRCNT_USH_EN (1<<28)
117#define EP93XX_SYSCON_PWRCNT_DMA_M2M1 (1<<27)
118#define EP93XX_SYSCON_PWRCNT_DMA_M2M0 (1<<26)
119#define EP93XX_SYSCON_PWRCNT_DMA_M2P8 (1<<25)
120#define EP93XX_SYSCON_PWRCNT_DMA_M2P9 (1<<24)
121#define EP93XX_SYSCON_PWRCNT_DMA_M2P6 (1<<23)
122#define EP93XX_SYSCON_PWRCNT_DMA_M2P7 (1<<22)
123#define EP93XX_SYSCON_PWRCNT_DMA_M2P4 (1<<21)
124#define EP93XX_SYSCON_PWRCNT_DMA_M2P5 (1<<20)
125#define EP93XX_SYSCON_PWRCNT_DMA_M2P2 (1<<19)
126#define EP93XX_SYSCON_PWRCNT_DMA_M2P3 (1<<18)
127#define EP93XX_SYSCON_PWRCNT_DMA_M2P0 (1<<17)
128#define EP93XX_SYSCON_PWRCNT_DMA_M2P1 (1<<16)
129#define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08)
130#define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c)
131#define EP93XX_SYSCON_CLKSET1 EP93XX_SYSCON_REG(0x20)
132#define EP93XX_SYSCON_CLKSET1_NBYP1 (1<<23)
133#define EP93XX_SYSCON_CLKSET2 EP93XX_SYSCON_REG(0x24)
134#define EP93XX_SYSCON_CLKSET2_NBYP2 (1<<19)
135#define EP93XX_SYSCON_CLKSET2_PLL2_EN (1<<18)
136#define EP93XX_SYSCON_DEVCFG EP93XX_SYSCON_REG(0x80)
137#define EP93XX_SYSCON_DEVCFG_SWRST (1<<31)
138#define EP93XX_SYSCON_DEVCFG_D1ONG (1<<30)
139#define EP93XX_SYSCON_DEVCFG_D0ONG (1<<29)
140#define EP93XX_SYSCON_DEVCFG_IONU2 (1<<28)
141#define EP93XX_SYSCON_DEVCFG_GONK (1<<27)
142#define EP93XX_SYSCON_DEVCFG_TONG (1<<26)
143#define EP93XX_SYSCON_DEVCFG_MONG (1<<25)
144#define EP93XX_SYSCON_DEVCFG_U3EN (1<<24)
145#define EP93XX_SYSCON_DEVCFG_CPENA (1<<23)
146#define EP93XX_SYSCON_DEVCFG_A2ONG (1<<22)
147#define EP93XX_SYSCON_DEVCFG_A1ONG (1<<21)
148#define EP93XX_SYSCON_DEVCFG_U2EN (1<<20)
149#define EP93XX_SYSCON_DEVCFG_EXVC (1<<19)
150#define EP93XX_SYSCON_DEVCFG_U1EN (1<<18)
151#define EP93XX_SYSCON_DEVCFG_TIN (1<<17)
152#define EP93XX_SYSCON_DEVCFG_HC3IN (1<<15)
153#define EP93XX_SYSCON_DEVCFG_HC3EN (1<<14)
154#define EP93XX_SYSCON_DEVCFG_HC1IN (1<<13)
155#define EP93XX_SYSCON_DEVCFG_HC1EN (1<<12)
156#define EP93XX_SYSCON_DEVCFG_HONIDE (1<<11)
157#define EP93XX_SYSCON_DEVCFG_GONIDE (1<<10)
158#define EP93XX_SYSCON_DEVCFG_PONG (1<<9)
159#define EP93XX_SYSCON_DEVCFG_EONIDE (1<<8)
160#define EP93XX_SYSCON_DEVCFG_I2SONSSP (1<<7)
161#define EP93XX_SYSCON_DEVCFG_I2SONAC97 (1<<6)
162#define EP93XX_SYSCON_DEVCFG_RASONP3 (1<<4)
163#define EP93XX_SYSCON_DEVCFG_RAS (1<<3)
164#define EP93XX_SYSCON_DEVCFG_ADCPD (1<<2)
165#define EP93XX_SYSCON_DEVCFG_KEYS (1<<1)
166#define EP93XX_SYSCON_DEVCFG_SHENA (1<<0)
167#define EP93XX_SYSCON_VIDCLKDIV EP93XX_SYSCON_REG(0x84)
168#define EP93XX_SYSCON_CLKDIV_ENABLE (1<<15)
169#define EP93XX_SYSCON_CLKDIV_ESEL (1<<14)
170#define EP93XX_SYSCON_CLKDIV_PSEL (1<<13)
171#define EP93XX_SYSCON_CLKDIV_PDIV_SHIFT 8
172#define EP93XX_SYSCON_I2SCLKDIV EP93XX_SYSCON_REG(0x8c)
173#define EP93XX_SYSCON_I2SCLKDIV_SENA (1<<31)
174#define EP93XX_SYSCON_I2SCLKDIV_ORIDE (1<<29)
175#define EP93XX_SYSCON_I2SCLKDIV_SPOL (1<<19)
176#define EP93XX_I2SCLKDIV_SDIV (1 << 16)
177#define EP93XX_I2SCLKDIV_LRDIV32 (0 << 17)
178#define EP93XX_I2SCLKDIV_LRDIV64 (1 << 17)
179#define EP93XX_I2SCLKDIV_LRDIV128 (2 << 17)
180#define EP93XX_I2SCLKDIV_LRDIV_MASK (3 << 17)
181#define EP93XX_SYSCON_KEYTCHCLKDIV EP93XX_SYSCON_REG(0x90)
182#define EP93XX_SYSCON_KEYTCHCLKDIV_TSEN (1<<31)
183#define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16)
184#define EP93XX_SYSCON_KEYTCHCLKDIV_KEN (1<<15)
185#define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV (1<<0)
186#define EP93XX_SYSCON_SYSCFG EP93XX_SYSCON_REG(0x9c)
187#define EP93XX_SYSCON_SYSCFG_REV_MASK (0xf0000000)
188#define EP93XX_SYSCON_SYSCFG_REV_SHIFT (28)
189#define EP93XX_SYSCON_SYSCFG_SBOOT (1<<8)
190#define EP93XX_SYSCON_SYSCFG_LCSN7 (1<<7)
191#define EP93XX_SYSCON_SYSCFG_LCSN6 (1<<6)
192#define EP93XX_SYSCON_SYSCFG_LASDO (1<<5)
193#define EP93XX_SYSCON_SYSCFG_LEEDA (1<<4)
194#define EP93XX_SYSCON_SYSCFG_LEECLK (1<<3)
195#define EP93XX_SYSCON_SYSCFG_LCSN2 (1<<1)
196#define EP93XX_SYSCON_SYSCFG_LCSN1 (1<<0)
197#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0)
198
199/* EP93xx System Controller software locked register write */
200void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg);
201void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits);
202
203static inline void ep93xx_devcfg_set_bits(unsigned int bits)
204{
205 ep93xx_devcfg_set_clear(bits, 0x00);
206}
207
208static inline void ep93xx_devcfg_clear_bits(unsigned int bits)
209{
210 ep93xx_devcfg_set_clear(0x00, bits);
211}
212
213#endif /* _EP93XX_SOC_H */
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 79f8ecf07a1..5ea790942e9 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -28,6 +28,7 @@
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30 30
31#include "soc.h"
31 32
32static struct map_desc ts72xx_io_desc[] __initdata = { 33static struct map_desc ts72xx_io_desc[] __initdata = {
33 { 34 {
diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c b/arch/arm/mach-ep93xx/vision_ep9307.c
index d67d0b4feb6..ba156eb225e 100644
--- a/arch/arm/mach-ep93xx/vision_ep9307.c
+++ b/arch/arm/mach-ep93xx/vision_ep9307.c
@@ -39,6 +39,8 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
41 41
42#include "soc.h"
43
42/************************************************************************* 44/*************************************************************************
43 * Static I/O mappings for the FPGA 45 * Static I/O mappings for the FPGA
44 *************************************************************************/ 46 *************************************************************************/
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index dfad6538b27..2bf7d6e2398 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -42,6 +42,7 @@ config SOC_EXYNOS4212
42 bool "SAMSUNG EXYNOS4212" 42 bool "SAMSUNG EXYNOS4212"
43 default y 43 default y
44 depends on ARCH_EXYNOS4 44 depends on ARCH_EXYNOS4
45 select SAMSUNG_DMADEV
45 select S5P_PM if PM 46 select S5P_PM if PM
46 select S5P_SLEEP if PM 47 select S5P_SLEEP if PM
47 help 48 help
@@ -51,6 +52,7 @@ config SOC_EXYNOS4412
51 bool "SAMSUNG EXYNOS4412" 52 bool "SAMSUNG EXYNOS4412"
52 default y 53 default y
53 depends on ARCH_EXYNOS4 54 depends on ARCH_EXYNOS4
55 select SAMSUNG_DMADEV
54 help 56 help
55 Enable EXYNOS4412 SoC support 57 Enable EXYNOS4412 SoC support
56 58
@@ -179,7 +181,9 @@ config MACH_SMDKV310
179 select S5P_DEV_FIMC1 181 select S5P_DEV_FIMC1
180 select S5P_DEV_FIMC2 182 select S5P_DEV_FIMC2
181 select S5P_DEV_FIMC3 183 select S5P_DEV_FIMC3
184 select S5P_DEV_G2D
182 select S5P_DEV_I2C_HDMIPHY 185 select S5P_DEV_I2C_HDMIPHY
186 select S5P_DEV_JPEG
183 select S5P_DEV_MFC 187 select S5P_DEV_MFC
184 select S5P_DEV_TV 188 select S5P_DEV_TV
185 select S5P_DEV_USB_EHCI 189 select S5P_DEV_USB_EHCI
@@ -225,7 +229,9 @@ config MACH_UNIVERSAL_C210
225 select S5P_DEV_FIMC1 229 select S5P_DEV_FIMC1
226 select S5P_DEV_FIMC2 230 select S5P_DEV_FIMC2
227 select S5P_DEV_FIMC3 231 select S5P_DEV_FIMC3
232 select S5P_DEV_G2D
228 select S5P_DEV_CSIS0 233 select S5P_DEV_CSIS0
234 select S5P_DEV_JPEG
229 select S5P_DEV_FIMD0 235 select S5P_DEV_FIMD0
230 select S3C_DEV_HSMMC 236 select S3C_DEV_HSMMC
231 select S3C_DEV_HSMMC2 237 select S3C_DEV_HSMMC2
@@ -262,11 +268,14 @@ config MACH_NURI
262 select S3C_DEV_I2C1 268 select S3C_DEV_I2C1
263 select S3C_DEV_I2C3 269 select S3C_DEV_I2C3
264 select S3C_DEV_I2C5 270 select S3C_DEV_I2C5
271 select S3C_DEV_I2C6
265 select S5P_DEV_CSIS0 272 select S5P_DEV_CSIS0
273 select S5P_DEV_JPEG
266 select S5P_DEV_FIMC0 274 select S5P_DEV_FIMC0
267 select S5P_DEV_FIMC1 275 select S5P_DEV_FIMC1
268 select S5P_DEV_FIMC2 276 select S5P_DEV_FIMC2
269 select S5P_DEV_FIMC3 277 select S5P_DEV_FIMC3
278 select S5P_DEV_G2D
270 select S5P_DEV_MFC 279 select S5P_DEV_MFC
271 select S5P_DEV_USB_EHCI 280 select S5P_DEV_USB_EHCI
272 select S5P_SETUP_MIPIPHY 281 select S5P_SETUP_MIPIPHY
@@ -276,6 +285,7 @@ config MACH_NURI
276 select EXYNOS4_SETUP_I2C1 285 select EXYNOS4_SETUP_I2C1
277 select EXYNOS4_SETUP_I2C3 286 select EXYNOS4_SETUP_I2C3
278 select EXYNOS4_SETUP_I2C5 287 select EXYNOS4_SETUP_I2C5
288 select EXYNOS4_SETUP_I2C6
279 select EXYNOS4_SETUP_SDHCI 289 select EXYNOS4_SETUP_SDHCI
280 select EXYNOS4_SETUP_USB_PHY 290 select EXYNOS4_SETUP_USB_PHY
281 select S5P_SETUP_MIPIPHY 291 select S5P_SETUP_MIPIPHY
@@ -296,7 +306,9 @@ config MACH_ORIGEN
296 select S5P_DEV_FIMC2 306 select S5P_DEV_FIMC2
297 select S5P_DEV_FIMC3 307 select S5P_DEV_FIMC3
298 select S5P_DEV_FIMD0 308 select S5P_DEV_FIMD0
309 select S5P_DEV_G2D
299 select S5P_DEV_I2C_HDMIPHY 310 select S5P_DEV_I2C_HDMIPHY
311 select S5P_DEV_JPEG
300 select S5P_DEV_MFC 312 select S5P_DEV_MFC
301 select S5P_DEV_TV 313 select S5P_DEV_TV
302 select S5P_DEV_USB_EHCI 314 select S5P_DEV_USB_EHCI
@@ -325,6 +337,7 @@ config MACH_SMDK4212
325 select SAMSUNG_DEV_BACKLIGHT 337 select SAMSUNG_DEV_BACKLIGHT
326 select SAMSUNG_DEV_KEYPAD 338 select SAMSUNG_DEV_KEYPAD
327 select SAMSUNG_DEV_PWM 339 select SAMSUNG_DEV_PWM
340 select EXYNOS4_DEV_DMA
328 select EXYNOS4_SETUP_I2C1 341 select EXYNOS4_SETUP_I2C1
329 select EXYNOS4_SETUP_I2C3 342 select EXYNOS4_SETUP_I2C3
330 select EXYNOS4_SETUP_I2C7 343 select EXYNOS4_SETUP_I2C7
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index d9191f9a7af..9a4c0989650 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -12,7 +12,8 @@ obj- :=
12 12
13# Core 13# Core
14 14
15obj-$(CONFIG_ARCH_EXYNOS4) += common.o clock.o 15obj-$(CONFIG_ARCH_EXYNOS) += common.o
16obj-$(CONFIG_ARCH_EXYNOS4) += clock-exynos4.o
16obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o 17obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o
17obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o 18obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o
18 19
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c
new file mode 100644
index 00000000000..200159dcb34
--- /dev/null
+++ b/arch/arm/mach-exynos/clock-exynos4.c
@@ -0,0 +1,1577 @@
1/*
2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS4 - Clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/io.h>
15#include <linux/syscore_ops.h>
16
17#include <plat/cpu-freq.h>
18#include <plat/clock.h>
19#include <plat/cpu.h>
20#include <plat/pll.h>
21#include <plat/s5p-clock.h>
22#include <plat/clock-clksrc.h>
23#include <plat/pm.h>
24
25#include <mach/map.h>
26#include <mach/regs-clock.h>
27#include <mach/sysmmu.h>
28
29#include "common.h"
30#include "clock-exynos4.h"
31
32#ifdef CONFIG_PM_SLEEP
33static struct sleep_save exynos4_clock_save[] = {
34 SAVE_ITEM(EXYNOS4_CLKDIV_LEFTBUS),
35 SAVE_ITEM(EXYNOS4_CLKGATE_IP_LEFTBUS),
36 SAVE_ITEM(EXYNOS4_CLKDIV_RIGHTBUS),
37 SAVE_ITEM(EXYNOS4_CLKGATE_IP_RIGHTBUS),
38 SAVE_ITEM(EXYNOS4_CLKSRC_TOP0),
39 SAVE_ITEM(EXYNOS4_CLKSRC_TOP1),
40 SAVE_ITEM(EXYNOS4_CLKSRC_CAM),
41 SAVE_ITEM(EXYNOS4_CLKSRC_TV),
42 SAVE_ITEM(EXYNOS4_CLKSRC_MFC),
43 SAVE_ITEM(EXYNOS4_CLKSRC_G3D),
44 SAVE_ITEM(EXYNOS4_CLKSRC_LCD0),
45 SAVE_ITEM(EXYNOS4_CLKSRC_MAUDIO),
46 SAVE_ITEM(EXYNOS4_CLKSRC_FSYS),
47 SAVE_ITEM(EXYNOS4_CLKSRC_PERIL0),
48 SAVE_ITEM(EXYNOS4_CLKSRC_PERIL1),
49 SAVE_ITEM(EXYNOS4_CLKDIV_CAM),
50 SAVE_ITEM(EXYNOS4_CLKDIV_TV),
51 SAVE_ITEM(EXYNOS4_CLKDIV_MFC),
52 SAVE_ITEM(EXYNOS4_CLKDIV_G3D),
53 SAVE_ITEM(EXYNOS4_CLKDIV_LCD0),
54 SAVE_ITEM(EXYNOS4_CLKDIV_MAUDIO),
55 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS0),
56 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS1),
57 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS2),
58 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS3),
59 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL0),
60 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL1),
61 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL2),
62 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL3),
63 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL4),
64 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL5),
65 SAVE_ITEM(EXYNOS4_CLKDIV_TOP),
66 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TOP),
67 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_CAM),
68 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TV),
69 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_LCD0),
70 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_MAUDIO),
71 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_FSYS),
72 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL0),
73 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL1),
74 SAVE_ITEM(EXYNOS4_CLKDIV2_RATIO),
75 SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCAM),
76 SAVE_ITEM(EXYNOS4_CLKGATE_IP_CAM),
77 SAVE_ITEM(EXYNOS4_CLKGATE_IP_TV),
78 SAVE_ITEM(EXYNOS4_CLKGATE_IP_MFC),
79 SAVE_ITEM(EXYNOS4_CLKGATE_IP_G3D),
80 SAVE_ITEM(EXYNOS4_CLKGATE_IP_LCD0),
81 SAVE_ITEM(EXYNOS4_CLKGATE_IP_FSYS),
82 SAVE_ITEM(EXYNOS4_CLKGATE_IP_GPS),
83 SAVE_ITEM(EXYNOS4_CLKGATE_IP_PERIL),
84 SAVE_ITEM(EXYNOS4_CLKGATE_BLOCK),
85 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_DMC),
86 SAVE_ITEM(EXYNOS4_CLKSRC_DMC),
87 SAVE_ITEM(EXYNOS4_CLKDIV_DMC0),
88 SAVE_ITEM(EXYNOS4_CLKDIV_DMC1),
89 SAVE_ITEM(EXYNOS4_CLKGATE_IP_DMC),
90 SAVE_ITEM(EXYNOS4_CLKSRC_CPU),
91 SAVE_ITEM(EXYNOS4_CLKDIV_CPU),
92 SAVE_ITEM(EXYNOS4_CLKDIV_CPU + 0x4),
93 SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCPU),
94 SAVE_ITEM(EXYNOS4_CLKGATE_IP_CPU),
95};
96#endif
97
98static struct clk exynos4_clk_sclk_hdmi27m = {
99 .name = "sclk_hdmi27m",
100 .rate = 27000000,
101};
102
103static struct clk exynos4_clk_sclk_hdmiphy = {
104 .name = "sclk_hdmiphy",
105};
106
107static struct clk exynos4_clk_sclk_usbphy0 = {
108 .name = "sclk_usbphy0",
109 .rate = 27000000,
110};
111
112static struct clk exynos4_clk_sclk_usbphy1 = {
113 .name = "sclk_usbphy1",
114};
115
116static struct clk dummy_apb_pclk = {
117 .name = "apb_pclk",
118 .id = -1,
119};
120
121static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
122{
123 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TOP, clk, enable);
124}
125
126static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
127{
128 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_CAM, clk, enable);
129}
130
131static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
132{
133 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_LCD0, clk, enable);
134}
135
136int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
137{
138 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_FSYS, clk, enable);
139}
140
141static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
142{
143 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL0, clk, enable);
144}
145
146static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
147{
148 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL1, clk, enable);
149}
150
151static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable)
152{
153 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_MFC, clk, enable);
154}
155
156static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
157{
158 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TV, clk, enable);
159}
160
161static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
162{
163 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_CAM, clk, enable);
164}
165
166static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable)
167{
168 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_TV, clk, enable);
169}
170
171static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
172{
173 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_IMAGE, clk, enable);
174}
175
176static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
177{
178 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_LCD0, clk, enable);
179}
180
181int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
182{
183 return s5p_gatectrl(EXYNOS4210_CLKGATE_IP_LCD1, clk, enable);
184}
185
186int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
187{
188 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_FSYS, clk, enable);
189}
190
191static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
192{
193 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIL, clk, enable);
194}
195
196static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
197{
198 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIR, clk, enable);
199}
200
201static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
202{
203 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
204}
205
206static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
207{
208 return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
209}
210
211/* Core list of CMU_CPU side */
212
213static struct clksrc_clk exynos4_clk_mout_apll = {
214 .clk = {
215 .name = "mout_apll",
216 },
217 .sources = &clk_src_apll,
218 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 0, .size = 1 },
219};
220
221static struct clksrc_clk exynos4_clk_sclk_apll = {
222 .clk = {
223 .name = "sclk_apll",
224 .parent = &exynos4_clk_mout_apll.clk,
225 },
226 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 24, .size = 3 },
227};
228
229static struct clksrc_clk exynos4_clk_mout_epll = {
230 .clk = {
231 .name = "mout_epll",
232 },
233 .sources = &clk_src_epll,
234 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 4, .size = 1 },
235};
236
237struct clksrc_clk exynos4_clk_mout_mpll = {
238 .clk = {
239 .name = "mout_mpll",
240 },
241 .sources = &clk_src_mpll,
242
243 /* reg_src will be added in each SoCs' clock */
244};
245
246static struct clk *exynos4_clkset_moutcore_list[] = {
247 [0] = &exynos4_clk_mout_apll.clk,
248 [1] = &exynos4_clk_mout_mpll.clk,
249};
250
251static struct clksrc_sources exynos4_clkset_moutcore = {
252 .sources = exynos4_clkset_moutcore_list,
253 .nr_sources = ARRAY_SIZE(exynos4_clkset_moutcore_list),
254};
255
256static struct clksrc_clk exynos4_clk_moutcore = {
257 .clk = {
258 .name = "moutcore",
259 },
260 .sources = &exynos4_clkset_moutcore,
261 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 16, .size = 1 },
262};
263
264static struct clksrc_clk exynos4_clk_coreclk = {
265 .clk = {
266 .name = "core_clk",
267 .parent = &exynos4_clk_moutcore.clk,
268 },
269 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 0, .size = 3 },
270};
271
272static struct clksrc_clk exynos4_clk_armclk = {
273 .clk = {
274 .name = "armclk",
275 .parent = &exynos4_clk_coreclk.clk,
276 },
277};
278
279static struct clksrc_clk exynos4_clk_aclk_corem0 = {
280 .clk = {
281 .name = "aclk_corem0",
282 .parent = &exynos4_clk_coreclk.clk,
283 },
284 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 },
285};
286
287static struct clksrc_clk exynos4_clk_aclk_cores = {
288 .clk = {
289 .name = "aclk_cores",
290 .parent = &exynos4_clk_coreclk.clk,
291 },
292 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 },
293};
294
295static struct clksrc_clk exynos4_clk_aclk_corem1 = {
296 .clk = {
297 .name = "aclk_corem1",
298 .parent = &exynos4_clk_coreclk.clk,
299 },
300 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 8, .size = 3 },
301};
302
303static struct clksrc_clk exynos4_clk_periphclk = {
304 .clk = {
305 .name = "periphclk",
306 .parent = &exynos4_clk_coreclk.clk,
307 },
308 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 12, .size = 3 },
309};
310
311/* Core list of CMU_CORE side */
312
313static struct clk *exynos4_clkset_corebus_list[] = {
314 [0] = &exynos4_clk_mout_mpll.clk,
315 [1] = &exynos4_clk_sclk_apll.clk,
316};
317
318struct clksrc_sources exynos4_clkset_mout_corebus = {
319 .sources = exynos4_clkset_corebus_list,
320 .nr_sources = ARRAY_SIZE(exynos4_clkset_corebus_list),
321};
322
323static struct clksrc_clk exynos4_clk_mout_corebus = {
324 .clk = {
325 .name = "mout_corebus",
326 },
327 .sources = &exynos4_clkset_mout_corebus,
328 .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 4, .size = 1 },
329};
330
331static struct clksrc_clk exynos4_clk_sclk_dmc = {
332 .clk = {
333 .name = "sclk_dmc",
334 .parent = &exynos4_clk_mout_corebus.clk,
335 },
336 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 12, .size = 3 },
337};
338
339static struct clksrc_clk exynos4_clk_aclk_cored = {
340 .clk = {
341 .name = "aclk_cored",
342 .parent = &exynos4_clk_sclk_dmc.clk,
343 },
344 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 16, .size = 3 },
345};
346
347static struct clksrc_clk exynos4_clk_aclk_corep = {
348 .clk = {
349 .name = "aclk_corep",
350 .parent = &exynos4_clk_aclk_cored.clk,
351 },
352 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 20, .size = 3 },
353};
354
355static struct clksrc_clk exynos4_clk_aclk_acp = {
356 .clk = {
357 .name = "aclk_acp",
358 .parent = &exynos4_clk_mout_corebus.clk,
359 },
360 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 0, .size = 3 },
361};
362
363static struct clksrc_clk exynos4_clk_pclk_acp = {
364 .clk = {
365 .name = "pclk_acp",
366 .parent = &exynos4_clk_aclk_acp.clk,
367 },
368 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 4, .size = 3 },
369};
370
371/* Core list of CMU_TOP side */
372
373struct clk *exynos4_clkset_aclk_top_list[] = {
374 [0] = &exynos4_clk_mout_mpll.clk,
375 [1] = &exynos4_clk_sclk_apll.clk,
376};
377
378static struct clksrc_sources exynos4_clkset_aclk = {
379 .sources = exynos4_clkset_aclk_top_list,
380 .nr_sources = ARRAY_SIZE(exynos4_clkset_aclk_top_list),
381};
382
383static struct clksrc_clk exynos4_clk_aclk_200 = {
384 .clk = {
385 .name = "aclk_200",
386 },
387 .sources = &exynos4_clkset_aclk,
388 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 12, .size = 1 },
389 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 0, .size = 3 },
390};
391
392static struct clksrc_clk exynos4_clk_aclk_100 = {
393 .clk = {
394 .name = "aclk_100",
395 },
396 .sources = &exynos4_clkset_aclk,
397 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 16, .size = 1 },
398 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 4, .size = 4 },
399};
400
401static struct clksrc_clk exynos4_clk_aclk_160 = {
402 .clk = {
403 .name = "aclk_160",
404 },
405 .sources = &exynos4_clkset_aclk,
406 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 20, .size = 1 },
407 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 8, .size = 3 },
408};
409
410struct clksrc_clk exynos4_clk_aclk_133 = {
411 .clk = {
412 .name = "aclk_133",
413 },
414 .sources = &exynos4_clkset_aclk,
415 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 24, .size = 1 },
416 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 12, .size = 3 },
417};
418
419static struct clk *exynos4_clkset_vpllsrc_list[] = {
420 [0] = &clk_fin_vpll,
421 [1] = &exynos4_clk_sclk_hdmi27m,
422};
423
424static struct clksrc_sources exynos4_clkset_vpllsrc = {
425 .sources = exynos4_clkset_vpllsrc_list,
426 .nr_sources = ARRAY_SIZE(exynos4_clkset_vpllsrc_list),
427};
428
429static struct clksrc_clk exynos4_clk_vpllsrc = {
430 .clk = {
431 .name = "vpll_src",
432 .enable = exynos4_clksrc_mask_top_ctrl,
433 .ctrlbit = (1 << 0),
434 },
435 .sources = &exynos4_clkset_vpllsrc,
436 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP1, .shift = 0, .size = 1 },
437};
438
439static struct clk *exynos4_clkset_sclk_vpll_list[] = {
440 [0] = &exynos4_clk_vpllsrc.clk,
441 [1] = &clk_fout_vpll,
442};
443
444static struct clksrc_sources exynos4_clkset_sclk_vpll = {
445 .sources = exynos4_clkset_sclk_vpll_list,
446 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_vpll_list),
447};
448
449static struct clksrc_clk exynos4_clk_sclk_vpll = {
450 .clk = {
451 .name = "sclk_vpll",
452 },
453 .sources = &exynos4_clkset_sclk_vpll,
454 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 8, .size = 1 },
455};
456
457static struct clk exynos4_init_clocks_off[] = {
458 {
459 .name = "timers",
460 .parent = &exynos4_clk_aclk_100.clk,
461 .enable = exynos4_clk_ip_peril_ctrl,
462 .ctrlbit = (1<<24),
463 }, {
464 .name = "csis",
465 .devname = "s5p-mipi-csis.0",
466 .enable = exynos4_clk_ip_cam_ctrl,
467 .ctrlbit = (1 << 4),
468 }, {
469 .name = "csis",
470 .devname = "s5p-mipi-csis.1",
471 .enable = exynos4_clk_ip_cam_ctrl,
472 .ctrlbit = (1 << 5),
473 }, {
474 .name = "jpeg",
475 .id = 0,
476 .enable = exynos4_clk_ip_cam_ctrl,
477 .ctrlbit = (1 << 6),
478 }, {
479 .name = "fimc",
480 .devname = "exynos4-fimc.0",
481 .enable = exynos4_clk_ip_cam_ctrl,
482 .ctrlbit = (1 << 0),
483 }, {
484 .name = "fimc",
485 .devname = "exynos4-fimc.1",
486 .enable = exynos4_clk_ip_cam_ctrl,
487 .ctrlbit = (1 << 1),
488 }, {
489 .name = "fimc",
490 .devname = "exynos4-fimc.2",
491 .enable = exynos4_clk_ip_cam_ctrl,
492 .ctrlbit = (1 << 2),
493 }, {
494 .name = "fimc",
495 .devname = "exynos4-fimc.3",
496 .enable = exynos4_clk_ip_cam_ctrl,
497 .ctrlbit = (1 << 3),
498 }, {
499 .name = "fimd",
500 .devname = "exynos4-fb.0",
501 .enable = exynos4_clk_ip_lcd0_ctrl,
502 .ctrlbit = (1 << 0),
503 }, {
504 .name = "hsmmc",
505 .devname = "s3c-sdhci.0",
506 .parent = &exynos4_clk_aclk_133.clk,
507 .enable = exynos4_clk_ip_fsys_ctrl,
508 .ctrlbit = (1 << 5),
509 }, {
510 .name = "hsmmc",
511 .devname = "s3c-sdhci.1",
512 .parent = &exynos4_clk_aclk_133.clk,
513 .enable = exynos4_clk_ip_fsys_ctrl,
514 .ctrlbit = (1 << 6),
515 }, {
516 .name = "hsmmc",
517 .devname = "s3c-sdhci.2",
518 .parent = &exynos4_clk_aclk_133.clk,
519 .enable = exynos4_clk_ip_fsys_ctrl,
520 .ctrlbit = (1 << 7),
521 }, {
522 .name = "hsmmc",
523 .devname = "s3c-sdhci.3",
524 .parent = &exynos4_clk_aclk_133.clk,
525 .enable = exynos4_clk_ip_fsys_ctrl,
526 .ctrlbit = (1 << 8),
527 }, {
528 .name = "dwmmc",
529 .parent = &exynos4_clk_aclk_133.clk,
530 .enable = exynos4_clk_ip_fsys_ctrl,
531 .ctrlbit = (1 << 9),
532 }, {
533 .name = "dac",
534 .devname = "s5p-sdo",
535 .enable = exynos4_clk_ip_tv_ctrl,
536 .ctrlbit = (1 << 2),
537 }, {
538 .name = "mixer",
539 .devname = "s5p-mixer",
540 .enable = exynos4_clk_ip_tv_ctrl,
541 .ctrlbit = (1 << 1),
542 }, {
543 .name = "vp",
544 .devname = "s5p-mixer",
545 .enable = exynos4_clk_ip_tv_ctrl,
546 .ctrlbit = (1 << 0),
547 }, {
548 .name = "hdmi",
549 .devname = "exynos4-hdmi",
550 .enable = exynos4_clk_ip_tv_ctrl,
551 .ctrlbit = (1 << 3),
552 }, {
553 .name = "hdmiphy",
554 .devname = "exynos4-hdmi",
555 .enable = exynos4_clk_hdmiphy_ctrl,
556 .ctrlbit = (1 << 0),
557 }, {
558 .name = "dacphy",
559 .devname = "s5p-sdo",
560 .enable = exynos4_clk_dac_ctrl,
561 .ctrlbit = (1 << 0),
562 }, {
563 .name = "adc",
564 .enable = exynos4_clk_ip_peril_ctrl,
565 .ctrlbit = (1 << 15),
566 }, {
567 .name = "keypad",
568 .enable = exynos4_clk_ip_perir_ctrl,
569 .ctrlbit = (1 << 16),
570 }, {
571 .name = "rtc",
572 .enable = exynos4_clk_ip_perir_ctrl,
573 .ctrlbit = (1 << 15),
574 }, {
575 .name = "watchdog",
576 .parent = &exynos4_clk_aclk_100.clk,
577 .enable = exynos4_clk_ip_perir_ctrl,
578 .ctrlbit = (1 << 14),
579 }, {
580 .name = "usbhost",
581 .enable = exynos4_clk_ip_fsys_ctrl ,
582 .ctrlbit = (1 << 12),
583 }, {
584 .name = "otg",
585 .enable = exynos4_clk_ip_fsys_ctrl,
586 .ctrlbit = (1 << 13),
587 }, {
588 .name = "spi",
589 .devname = "s3c64xx-spi.0",
590 .enable = exynos4_clk_ip_peril_ctrl,
591 .ctrlbit = (1 << 16),
592 }, {
593 .name = "spi",
594 .devname = "s3c64xx-spi.1",
595 .enable = exynos4_clk_ip_peril_ctrl,
596 .ctrlbit = (1 << 17),
597 }, {
598 .name = "spi",
599 .devname = "s3c64xx-spi.2",
600 .enable = exynos4_clk_ip_peril_ctrl,
601 .ctrlbit = (1 << 18),
602 }, {
603 .name = "iis",
604 .devname = "samsung-i2s.0",
605 .enable = exynos4_clk_ip_peril_ctrl,
606 .ctrlbit = (1 << 19),
607 }, {
608 .name = "iis",
609 .devname = "samsung-i2s.1",
610 .enable = exynos4_clk_ip_peril_ctrl,
611 .ctrlbit = (1 << 20),
612 }, {
613 .name = "iis",
614 .devname = "samsung-i2s.2",
615 .enable = exynos4_clk_ip_peril_ctrl,
616 .ctrlbit = (1 << 21),
617 }, {
618 .name = "ac97",
619 .devname = "samsung-ac97",
620 .enable = exynos4_clk_ip_peril_ctrl,
621 .ctrlbit = (1 << 27),
622 }, {
623 .name = "fimg2d",
624 .enable = exynos4_clk_ip_image_ctrl,
625 .ctrlbit = (1 << 0),
626 }, {
627 .name = "mfc",
628 .devname = "s5p-mfc",
629 .enable = exynos4_clk_ip_mfc_ctrl,
630 .ctrlbit = (1 << 0),
631 }, {
632 .name = "i2c",
633 .devname = "s3c2440-i2c.0",
634 .parent = &exynos4_clk_aclk_100.clk,
635 .enable = exynos4_clk_ip_peril_ctrl,
636 .ctrlbit = (1 << 6),
637 }, {
638 .name = "i2c",
639 .devname = "s3c2440-i2c.1",
640 .parent = &exynos4_clk_aclk_100.clk,
641 .enable = exynos4_clk_ip_peril_ctrl,
642 .ctrlbit = (1 << 7),
643 }, {
644 .name = "i2c",
645 .devname = "s3c2440-i2c.2",
646 .parent = &exynos4_clk_aclk_100.clk,
647 .enable = exynos4_clk_ip_peril_ctrl,
648 .ctrlbit = (1 << 8),
649 }, {
650 .name = "i2c",
651 .devname = "s3c2440-i2c.3",
652 .parent = &exynos4_clk_aclk_100.clk,
653 .enable = exynos4_clk_ip_peril_ctrl,
654 .ctrlbit = (1 << 9),
655 }, {
656 .name = "i2c",
657 .devname = "s3c2440-i2c.4",
658 .parent = &exynos4_clk_aclk_100.clk,
659 .enable = exynos4_clk_ip_peril_ctrl,
660 .ctrlbit = (1 << 10),
661 }, {
662 .name = "i2c",
663 .devname = "s3c2440-i2c.5",
664 .parent = &exynos4_clk_aclk_100.clk,
665 .enable = exynos4_clk_ip_peril_ctrl,
666 .ctrlbit = (1 << 11),
667 }, {
668 .name = "i2c",
669 .devname = "s3c2440-i2c.6",
670 .parent = &exynos4_clk_aclk_100.clk,
671 .enable = exynos4_clk_ip_peril_ctrl,
672 .ctrlbit = (1 << 12),
673 }, {
674 .name = "i2c",
675 .devname = "s3c2440-i2c.7",
676 .parent = &exynos4_clk_aclk_100.clk,
677 .enable = exynos4_clk_ip_peril_ctrl,
678 .ctrlbit = (1 << 13),
679 }, {
680 .name = "i2c",
681 .devname = "s3c2440-hdmiphy-i2c",
682 .parent = &exynos4_clk_aclk_100.clk,
683 .enable = exynos4_clk_ip_peril_ctrl,
684 .ctrlbit = (1 << 14),
685 }, {
686 .name = "SYSMMU_MDMA",
687 .enable = exynos4_clk_ip_image_ctrl,
688 .ctrlbit = (1 << 5),
689 }, {
690 .name = "SYSMMU_FIMC0",
691 .enable = exynos4_clk_ip_cam_ctrl,
692 .ctrlbit = (1 << 7),
693 }, {
694 .name = "SYSMMU_FIMC1",
695 .enable = exynos4_clk_ip_cam_ctrl,
696 .ctrlbit = (1 << 8),
697 }, {
698 .name = "SYSMMU_FIMC2",
699 .enable = exynos4_clk_ip_cam_ctrl,
700 .ctrlbit = (1 << 9),
701 }, {
702 .name = "SYSMMU_FIMC3",
703 .enable = exynos4_clk_ip_cam_ctrl,
704 .ctrlbit = (1 << 10),
705 }, {
706 .name = "SYSMMU_JPEG",
707 .enable = exynos4_clk_ip_cam_ctrl,
708 .ctrlbit = (1 << 11),
709 }, {
710 .name = "SYSMMU_FIMD0",
711 .enable = exynos4_clk_ip_lcd0_ctrl,
712 .ctrlbit = (1 << 4),
713 }, {
714 .name = "SYSMMU_FIMD1",
715 .enable = exynos4_clk_ip_lcd1_ctrl,
716 .ctrlbit = (1 << 4),
717 }, {
718 .name = "SYSMMU_PCIe",
719 .enable = exynos4_clk_ip_fsys_ctrl,
720 .ctrlbit = (1 << 18),
721 }, {
722 .name = "SYSMMU_G2D",
723 .enable = exynos4_clk_ip_image_ctrl,
724 .ctrlbit = (1 << 3),
725 }, {
726 .name = "SYSMMU_ROTATOR",
727 .enable = exynos4_clk_ip_image_ctrl,
728 .ctrlbit = (1 << 4),
729 }, {
730 .name = "SYSMMU_TV",
731 .enable = exynos4_clk_ip_tv_ctrl,
732 .ctrlbit = (1 << 4),
733 }, {
734 .name = "SYSMMU_MFC_L",
735 .enable = exynos4_clk_ip_mfc_ctrl,
736 .ctrlbit = (1 << 1),
737 }, {
738 .name = "SYSMMU_MFC_R",
739 .enable = exynos4_clk_ip_mfc_ctrl,
740 .ctrlbit = (1 << 2),
741 }
742};
743
744static struct clk exynos4_init_clocks_on[] = {
745 {
746 .name = "uart",
747 .devname = "s5pv210-uart.0",
748 .enable = exynos4_clk_ip_peril_ctrl,
749 .ctrlbit = (1 << 0),
750 }, {
751 .name = "uart",
752 .devname = "s5pv210-uart.1",
753 .enable = exynos4_clk_ip_peril_ctrl,
754 .ctrlbit = (1 << 1),
755 }, {
756 .name = "uart",
757 .devname = "s5pv210-uart.2",
758 .enable = exynos4_clk_ip_peril_ctrl,
759 .ctrlbit = (1 << 2),
760 }, {
761 .name = "uart",
762 .devname = "s5pv210-uart.3",
763 .enable = exynos4_clk_ip_peril_ctrl,
764 .ctrlbit = (1 << 3),
765 }, {
766 .name = "uart",
767 .devname = "s5pv210-uart.4",
768 .enable = exynos4_clk_ip_peril_ctrl,
769 .ctrlbit = (1 << 4),
770 }, {
771 .name = "uart",
772 .devname = "s5pv210-uart.5",
773 .enable = exynos4_clk_ip_peril_ctrl,
774 .ctrlbit = (1 << 5),
775 }
776};
777
778static struct clk exynos4_clk_pdma0 = {
779 .name = "dma",
780 .devname = "dma-pl330.0",
781 .enable = exynos4_clk_ip_fsys_ctrl,
782 .ctrlbit = (1 << 0),
783};
784
785static struct clk exynos4_clk_pdma1 = {
786 .name = "dma",
787 .devname = "dma-pl330.1",
788 .enable = exynos4_clk_ip_fsys_ctrl,
789 .ctrlbit = (1 << 1),
790};
791
792static struct clk exynos4_clk_mdma1 = {
793 .name = "dma",
794 .devname = "dma-pl330.2",
795 .enable = exynos4_clk_ip_image_ctrl,
796 .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)),
797};
798
799struct clk *exynos4_clkset_group_list[] = {
800 [0] = &clk_ext_xtal_mux,
801 [1] = &clk_xusbxti,
802 [2] = &exynos4_clk_sclk_hdmi27m,
803 [3] = &exynos4_clk_sclk_usbphy0,
804 [4] = &exynos4_clk_sclk_usbphy1,
805 [5] = &exynos4_clk_sclk_hdmiphy,
806 [6] = &exynos4_clk_mout_mpll.clk,
807 [7] = &exynos4_clk_mout_epll.clk,
808 [8] = &exynos4_clk_sclk_vpll.clk,
809};
810
811struct clksrc_sources exynos4_clkset_group = {
812 .sources = exynos4_clkset_group_list,
813 .nr_sources = ARRAY_SIZE(exynos4_clkset_group_list),
814};
815
816static struct clk *exynos4_clkset_mout_g2d0_list[] = {
817 [0] = &exynos4_clk_mout_mpll.clk,
818 [1] = &exynos4_clk_sclk_apll.clk,
819};
820
821static struct clksrc_sources exynos4_clkset_mout_g2d0 = {
822 .sources = exynos4_clkset_mout_g2d0_list,
823 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d0_list),
824};
825
826static struct clksrc_clk exynos4_clk_mout_g2d0 = {
827 .clk = {
828 .name = "mout_g2d0",
829 },
830 .sources = &exynos4_clkset_mout_g2d0,
831 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 0, .size = 1 },
832};
833
834static struct clk *exynos4_clkset_mout_g2d1_list[] = {
835 [0] = &exynos4_clk_mout_epll.clk,
836 [1] = &exynos4_clk_sclk_vpll.clk,
837};
838
839static struct clksrc_sources exynos4_clkset_mout_g2d1 = {
840 .sources = exynos4_clkset_mout_g2d1_list,
841 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d1_list),
842};
843
844static struct clksrc_clk exynos4_clk_mout_g2d1 = {
845 .clk = {
846 .name = "mout_g2d1",
847 },
848 .sources = &exynos4_clkset_mout_g2d1,
849 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 4, .size = 1 },
850};
851
852static struct clk *exynos4_clkset_mout_g2d_list[] = {
853 [0] = &exynos4_clk_mout_g2d0.clk,
854 [1] = &exynos4_clk_mout_g2d1.clk,
855};
856
857static struct clksrc_sources exynos4_clkset_mout_g2d = {
858 .sources = exynos4_clkset_mout_g2d_list,
859 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d_list),
860};
861
862static struct clk *exynos4_clkset_mout_mfc0_list[] = {
863 [0] = &exynos4_clk_mout_mpll.clk,
864 [1] = &exynos4_clk_sclk_apll.clk,
865};
866
867static struct clksrc_sources exynos4_clkset_mout_mfc0 = {
868 .sources = exynos4_clkset_mout_mfc0_list,
869 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc0_list),
870};
871
872static struct clksrc_clk exynos4_clk_mout_mfc0 = {
873 .clk = {
874 .name = "mout_mfc0",
875 },
876 .sources = &exynos4_clkset_mout_mfc0,
877 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 0, .size = 1 },
878};
879
880static struct clk *exynos4_clkset_mout_mfc1_list[] = {
881 [0] = &exynos4_clk_mout_epll.clk,
882 [1] = &exynos4_clk_sclk_vpll.clk,
883};
884
885static struct clksrc_sources exynos4_clkset_mout_mfc1 = {
886 .sources = exynos4_clkset_mout_mfc1_list,
887 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc1_list),
888};
889
890static struct clksrc_clk exynos4_clk_mout_mfc1 = {
891 .clk = {
892 .name = "mout_mfc1",
893 },
894 .sources = &exynos4_clkset_mout_mfc1,
895 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 4, .size = 1 },
896};
897
898static struct clk *exynos4_clkset_mout_mfc_list[] = {
899 [0] = &exynos4_clk_mout_mfc0.clk,
900 [1] = &exynos4_clk_mout_mfc1.clk,
901};
902
903static struct clksrc_sources exynos4_clkset_mout_mfc = {
904 .sources = exynos4_clkset_mout_mfc_list,
905 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc_list),
906};
907
908static struct clk *exynos4_clkset_sclk_dac_list[] = {
909 [0] = &exynos4_clk_sclk_vpll.clk,
910 [1] = &exynos4_clk_sclk_hdmiphy,
911};
912
913static struct clksrc_sources exynos4_clkset_sclk_dac = {
914 .sources = exynos4_clkset_sclk_dac_list,
915 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_dac_list),
916};
917
918static struct clksrc_clk exynos4_clk_sclk_dac = {
919 .clk = {
920 .name = "sclk_dac",
921 .enable = exynos4_clksrc_mask_tv_ctrl,
922 .ctrlbit = (1 << 8),
923 },
924 .sources = &exynos4_clkset_sclk_dac,
925 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 8, .size = 1 },
926};
927
928static struct clksrc_clk exynos4_clk_sclk_pixel = {
929 .clk = {
930 .name = "sclk_pixel",
931 .parent = &exynos4_clk_sclk_vpll.clk,
932 },
933 .reg_div = { .reg = EXYNOS4_CLKDIV_TV, .shift = 0, .size = 4 },
934};
935
936static struct clk *exynos4_clkset_sclk_hdmi_list[] = {
937 [0] = &exynos4_clk_sclk_pixel.clk,
938 [1] = &exynos4_clk_sclk_hdmiphy,
939};
940
941static struct clksrc_sources exynos4_clkset_sclk_hdmi = {
942 .sources = exynos4_clkset_sclk_hdmi_list,
943 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_hdmi_list),
944};
945
946static struct clksrc_clk exynos4_clk_sclk_hdmi = {
947 .clk = {
948 .name = "sclk_hdmi",
949 .enable = exynos4_clksrc_mask_tv_ctrl,
950 .ctrlbit = (1 << 0),
951 },
952 .sources = &exynos4_clkset_sclk_hdmi,
953 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 0, .size = 1 },
954};
955
956static struct clk *exynos4_clkset_sclk_mixer_list[] = {
957 [0] = &exynos4_clk_sclk_dac.clk,
958 [1] = &exynos4_clk_sclk_hdmi.clk,
959};
960
961static struct clksrc_sources exynos4_clkset_sclk_mixer = {
962 .sources = exynos4_clkset_sclk_mixer_list,
963 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_mixer_list),
964};
965
966static struct clksrc_clk exynos4_clk_sclk_mixer = {
967 .clk = {
968 .name = "sclk_mixer",
969 .enable = exynos4_clksrc_mask_tv_ctrl,
970 .ctrlbit = (1 << 4),
971 },
972 .sources = &exynos4_clkset_sclk_mixer,
973 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 4, .size = 1 },
974};
975
976static struct clksrc_clk *exynos4_sclk_tv[] = {
977 &exynos4_clk_sclk_dac,
978 &exynos4_clk_sclk_pixel,
979 &exynos4_clk_sclk_hdmi,
980 &exynos4_clk_sclk_mixer,
981};
982
983static struct clksrc_clk exynos4_clk_dout_mmc0 = {
984 .clk = {
985 .name = "dout_mmc0",
986 },
987 .sources = &exynos4_clkset_group,
988 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 0, .size = 4 },
989 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 0, .size = 4 },
990};
991
992static struct clksrc_clk exynos4_clk_dout_mmc1 = {
993 .clk = {
994 .name = "dout_mmc1",
995 },
996 .sources = &exynos4_clkset_group,
997 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 4, .size = 4 },
998 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 16, .size = 4 },
999};
1000
1001static struct clksrc_clk exynos4_clk_dout_mmc2 = {
1002 .clk = {
1003 .name = "dout_mmc2",
1004 },
1005 .sources = &exynos4_clkset_group,
1006 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 8, .size = 4 },
1007 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 0, .size = 4 },
1008};
1009
1010static struct clksrc_clk exynos4_clk_dout_mmc3 = {
1011 .clk = {
1012 .name = "dout_mmc3",
1013 },
1014 .sources = &exynos4_clkset_group,
1015 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 12, .size = 4 },
1016 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 16, .size = 4 },
1017};
1018
1019static struct clksrc_clk exynos4_clk_dout_mmc4 = {
1020 .clk = {
1021 .name = "dout_mmc4",
1022 },
1023 .sources = &exynos4_clkset_group,
1024 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 16, .size = 4 },
1025 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 0, .size = 4 },
1026};
1027
1028static struct clksrc_clk exynos4_clksrcs[] = {
1029 {
1030 .clk = {
1031 .name = "sclk_pwm",
1032 .enable = exynos4_clksrc_mask_peril0_ctrl,
1033 .ctrlbit = (1 << 24),
1034 },
1035 .sources = &exynos4_clkset_group,
1036 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 24, .size = 4 },
1037 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL3, .shift = 0, .size = 4 },
1038 }, {
1039 .clk = {
1040 .name = "sclk_csis",
1041 .devname = "s5p-mipi-csis.0",
1042 .enable = exynos4_clksrc_mask_cam_ctrl,
1043 .ctrlbit = (1 << 24),
1044 },
1045 .sources = &exynos4_clkset_group,
1046 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 24, .size = 4 },
1047 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 24, .size = 4 },
1048 }, {
1049 .clk = {
1050 .name = "sclk_csis",
1051 .devname = "s5p-mipi-csis.1",
1052 .enable = exynos4_clksrc_mask_cam_ctrl,
1053 .ctrlbit = (1 << 28),
1054 },
1055 .sources = &exynos4_clkset_group,
1056 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 28, .size = 4 },
1057 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 28, .size = 4 },
1058 }, {
1059 .clk = {
1060 .name = "sclk_cam0",
1061 .enable = exynos4_clksrc_mask_cam_ctrl,
1062 .ctrlbit = (1 << 16),
1063 },
1064 .sources = &exynos4_clkset_group,
1065 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 16, .size = 4 },
1066 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 16, .size = 4 },
1067 }, {
1068 .clk = {
1069 .name = "sclk_cam1",
1070 .enable = exynos4_clksrc_mask_cam_ctrl,
1071 .ctrlbit = (1 << 20),
1072 },
1073 .sources = &exynos4_clkset_group,
1074 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 20, .size = 4 },
1075 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 20, .size = 4 },
1076 }, {
1077 .clk = {
1078 .name = "sclk_fimc",
1079 .devname = "exynos4-fimc.0",
1080 .enable = exynos4_clksrc_mask_cam_ctrl,
1081 .ctrlbit = (1 << 0),
1082 },
1083 .sources = &exynos4_clkset_group,
1084 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 0, .size = 4 },
1085 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 0, .size = 4 },
1086 }, {
1087 .clk = {
1088 .name = "sclk_fimc",
1089 .devname = "exynos4-fimc.1",
1090 .enable = exynos4_clksrc_mask_cam_ctrl,
1091 .ctrlbit = (1 << 4),
1092 },
1093 .sources = &exynos4_clkset_group,
1094 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 4, .size = 4 },
1095 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 4, .size = 4 },
1096 }, {
1097 .clk = {
1098 .name = "sclk_fimc",
1099 .devname = "exynos4-fimc.2",
1100 .enable = exynos4_clksrc_mask_cam_ctrl,
1101 .ctrlbit = (1 << 8),
1102 },
1103 .sources = &exynos4_clkset_group,
1104 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 8, .size = 4 },
1105 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 8, .size = 4 },
1106 }, {
1107 .clk = {
1108 .name = "sclk_fimc",
1109 .devname = "exynos4-fimc.3",
1110 .enable = exynos4_clksrc_mask_cam_ctrl,
1111 .ctrlbit = (1 << 12),
1112 },
1113 .sources = &exynos4_clkset_group,
1114 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 12, .size = 4 },
1115 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 12, .size = 4 },
1116 }, {
1117 .clk = {
1118 .name = "sclk_fimd",
1119 .devname = "exynos4-fb.0",
1120 .enable = exynos4_clksrc_mask_lcd0_ctrl,
1121 .ctrlbit = (1 << 0),
1122 },
1123 .sources = &exynos4_clkset_group,
1124 .reg_src = { .reg = EXYNOS4_CLKSRC_LCD0, .shift = 0, .size = 4 },
1125 .reg_div = { .reg = EXYNOS4_CLKDIV_LCD0, .shift = 0, .size = 4 },
1126 }, {
1127 .clk = {
1128 .name = "sclk_fimg2d",
1129 },
1130 .sources = &exynos4_clkset_mout_g2d,
1131 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 8, .size = 1 },
1132 .reg_div = { .reg = EXYNOS4_CLKDIV_IMAGE, .shift = 0, .size = 4 },
1133 }, {
1134 .clk = {
1135 .name = "sclk_mfc",
1136 .devname = "s5p-mfc",
1137 },
1138 .sources = &exynos4_clkset_mout_mfc,
1139 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 8, .size = 1 },
1140 .reg_div = { .reg = EXYNOS4_CLKDIV_MFC, .shift = 0, .size = 4 },
1141 }, {
1142 .clk = {
1143 .name = "sclk_dwmmc",
1144 .parent = &exynos4_clk_dout_mmc4.clk,
1145 .enable = exynos4_clksrc_mask_fsys_ctrl,
1146 .ctrlbit = (1 << 16),
1147 },
1148 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 8, .size = 8 },
1149 }
1150};
1151
1152static struct clksrc_clk exynos4_clk_sclk_uart0 = {
1153 .clk = {
1154 .name = "uclk1",
1155 .devname = "exynos4210-uart.0",
1156 .enable = exynos4_clksrc_mask_peril0_ctrl,
1157 .ctrlbit = (1 << 0),
1158 },
1159 .sources = &exynos4_clkset_group,
1160 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 0, .size = 4 },
1161 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 0, .size = 4 },
1162};
1163
1164static struct clksrc_clk exynos4_clk_sclk_uart1 = {
1165 .clk = {
1166 .name = "uclk1",
1167 .devname = "exynos4210-uart.1",
1168 .enable = exynos4_clksrc_mask_peril0_ctrl,
1169 .ctrlbit = (1 << 4),
1170 },
1171 .sources = &exynos4_clkset_group,
1172 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 4, .size = 4 },
1173 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 4, .size = 4 },
1174};
1175
1176static struct clksrc_clk exynos4_clk_sclk_uart2 = {
1177 .clk = {
1178 .name = "uclk1",
1179 .devname = "exynos4210-uart.2",
1180 .enable = exynos4_clksrc_mask_peril0_ctrl,
1181 .ctrlbit = (1 << 8),
1182 },
1183 .sources = &exynos4_clkset_group,
1184 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 8, .size = 4 },
1185 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 8, .size = 4 },
1186};
1187
1188static struct clksrc_clk exynos4_clk_sclk_uart3 = {
1189 .clk = {
1190 .name = "uclk1",
1191 .devname = "exynos4210-uart.3",
1192 .enable = exynos4_clksrc_mask_peril0_ctrl,
1193 .ctrlbit = (1 << 12),
1194 },
1195 .sources = &exynos4_clkset_group,
1196 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 12, .size = 4 },
1197 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 12, .size = 4 },
1198};
1199
1200static struct clksrc_clk exynos4_clk_sclk_mmc0 = {
1201 .clk = {
1202 .name = "sclk_mmc",
1203 .devname = "s3c-sdhci.0",
1204 .parent = &exynos4_clk_dout_mmc0.clk,
1205 .enable = exynos4_clksrc_mask_fsys_ctrl,
1206 .ctrlbit = (1 << 0),
1207 },
1208 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 8, .size = 8 },
1209};
1210
1211static struct clksrc_clk exynos4_clk_sclk_mmc1 = {
1212 .clk = {
1213 .name = "sclk_mmc",
1214 .devname = "s3c-sdhci.1",
1215 .parent = &exynos4_clk_dout_mmc1.clk,
1216 .enable = exynos4_clksrc_mask_fsys_ctrl,
1217 .ctrlbit = (1 << 4),
1218 },
1219 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 24, .size = 8 },
1220};
1221
1222static struct clksrc_clk exynos4_clk_sclk_mmc2 = {
1223 .clk = {
1224 .name = "sclk_mmc",
1225 .devname = "s3c-sdhci.2",
1226 .parent = &exynos4_clk_dout_mmc2.clk,
1227 .enable = exynos4_clksrc_mask_fsys_ctrl,
1228 .ctrlbit = (1 << 8),
1229 },
1230 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 8, .size = 8 },
1231};
1232
1233static struct clksrc_clk exynos4_clk_sclk_mmc3 = {
1234 .clk = {
1235 .name = "sclk_mmc",
1236 .devname = "s3c-sdhci.3",
1237 .parent = &exynos4_clk_dout_mmc3.clk,
1238 .enable = exynos4_clksrc_mask_fsys_ctrl,
1239 .ctrlbit = (1 << 12),
1240 },
1241 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1242};
1243
1244static struct clksrc_clk exynos4_clk_sclk_spi0 = {
1245 .clk = {
1246 .name = "sclk_spi",
1247 .devname = "s3c64xx-spi.0",
1248 .enable = exynos4_clksrc_mask_peril1_ctrl,
1249 .ctrlbit = (1 << 16),
1250 },
1251 .sources = &exynos4_clkset_group,
1252 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 16, .size = 4 },
1253 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 0, .size = 4 },
1254};
1255
1256static struct clksrc_clk exynos4_clk_sclk_spi1 = {
1257 .clk = {
1258 .name = "sclk_spi",
1259 .devname = "s3c64xx-spi.1",
1260 .enable = exynos4_clksrc_mask_peril1_ctrl,
1261 .ctrlbit = (1 << 20),
1262 },
1263 .sources = &exynos4_clkset_group,
1264 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 20, .size = 4 },
1265 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 16, .size = 4 },
1266};
1267
1268static struct clksrc_clk exynos4_clk_sclk_spi2 = {
1269 .clk = {
1270 .name = "sclk_spi",
1271 .devname = "s3c64xx-spi.2",
1272 .enable = exynos4_clksrc_mask_peril1_ctrl,
1273 .ctrlbit = (1 << 24),
1274 },
1275 .sources = &exynos4_clkset_group,
1276 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 24, .size = 4 },
1277 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 0, .size = 4 },
1278};
1279
1280/* Clock initialization code */
1281static struct clksrc_clk *exynos4_sysclks[] = {
1282 &exynos4_clk_mout_apll,
1283 &exynos4_clk_sclk_apll,
1284 &exynos4_clk_mout_epll,
1285 &exynos4_clk_mout_mpll,
1286 &exynos4_clk_moutcore,
1287 &exynos4_clk_coreclk,
1288 &exynos4_clk_armclk,
1289 &exynos4_clk_aclk_corem0,
1290 &exynos4_clk_aclk_cores,
1291 &exynos4_clk_aclk_corem1,
1292 &exynos4_clk_periphclk,
1293 &exynos4_clk_mout_corebus,
1294 &exynos4_clk_sclk_dmc,
1295 &exynos4_clk_aclk_cored,
1296 &exynos4_clk_aclk_corep,
1297 &exynos4_clk_aclk_acp,
1298 &exynos4_clk_pclk_acp,
1299 &exynos4_clk_vpllsrc,
1300 &exynos4_clk_sclk_vpll,
1301 &exynos4_clk_aclk_200,
1302 &exynos4_clk_aclk_100,
1303 &exynos4_clk_aclk_160,
1304 &exynos4_clk_aclk_133,
1305 &exynos4_clk_dout_mmc0,
1306 &exynos4_clk_dout_mmc1,
1307 &exynos4_clk_dout_mmc2,
1308 &exynos4_clk_dout_mmc3,
1309 &exynos4_clk_dout_mmc4,
1310 &exynos4_clk_mout_mfc0,
1311 &exynos4_clk_mout_mfc1,
1312};
1313
1314static struct clk *exynos4_clk_cdev[] = {
1315 &exynos4_clk_pdma0,
1316 &exynos4_clk_pdma1,
1317 &exynos4_clk_mdma1,
1318};
1319
1320static struct clksrc_clk *exynos4_clksrc_cdev[] = {
1321 &exynos4_clk_sclk_uart0,
1322 &exynos4_clk_sclk_uart1,
1323 &exynos4_clk_sclk_uart2,
1324 &exynos4_clk_sclk_uart3,
1325 &exynos4_clk_sclk_mmc0,
1326 &exynos4_clk_sclk_mmc1,
1327 &exynos4_clk_sclk_mmc2,
1328 &exynos4_clk_sclk_mmc3,
1329 &exynos4_clk_sclk_spi0,
1330 &exynos4_clk_sclk_spi1,
1331 &exynos4_clk_sclk_spi2,
1332
1333};
1334
1335static struct clk_lookup exynos4_clk_lookup[] = {
1336 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos4_clk_sclk_uart0.clk),
1337 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk),
1338 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk),
1339 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk),
1340 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk),
1341 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk),
1342 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk),
1343 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk),
1344 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0),
1345 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1),
1346 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1),
1347 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk),
1348 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk),
1349 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk),
1350};
1351
1352static int xtal_rate;
1353
1354static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
1355{
1356 if (soc_is_exynos4210())
1357 return s5p_get_pll45xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0),
1358 pll_4508);
1359 else if (soc_is_exynos4212() || soc_is_exynos4412())
1360 return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0));
1361 else
1362 return 0;
1363}
1364
1365static struct clk_ops exynos4_fout_apll_ops = {
1366 .get_rate = exynos4_fout_apll_get_rate,
1367};
1368
1369static u32 exynos4_vpll_div[][8] = {
1370 { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
1371 { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
1372};
1373
1374static unsigned long exynos4_vpll_get_rate(struct clk *clk)
1375{
1376 return clk->rate;
1377}
1378
1379static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate)
1380{
1381 unsigned int vpll_con0, vpll_con1 = 0;
1382 unsigned int i;
1383
1384 /* Return if nothing changed */
1385 if (clk->rate == rate)
1386 return 0;
1387
1388 vpll_con0 = __raw_readl(EXYNOS4_VPLL_CON0);
1389 vpll_con0 &= ~(0x1 << 27 | \
1390 PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1391 PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1392 PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1393
1394 vpll_con1 = __raw_readl(EXYNOS4_VPLL_CON1);
1395 vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \
1396 PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \
1397 PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT);
1398
1399 for (i = 0; i < ARRAY_SIZE(exynos4_vpll_div); i++) {
1400 if (exynos4_vpll_div[i][0] == rate) {
1401 vpll_con0 |= exynos4_vpll_div[i][1] << PLL46XX_PDIV_SHIFT;
1402 vpll_con0 |= exynos4_vpll_div[i][2] << PLL46XX_MDIV_SHIFT;
1403 vpll_con0 |= exynos4_vpll_div[i][3] << PLL46XX_SDIV_SHIFT;
1404 vpll_con1 |= exynos4_vpll_div[i][4] << PLL46XX_KDIV_SHIFT;
1405 vpll_con1 |= exynos4_vpll_div[i][5] << PLL46XX_MFR_SHIFT;
1406 vpll_con1 |= exynos4_vpll_div[i][6] << PLL46XX_MRR_SHIFT;
1407 vpll_con0 |= exynos4_vpll_div[i][7] << 27;
1408 break;
1409 }
1410 }
1411
1412 if (i == ARRAY_SIZE(exynos4_vpll_div)) {
1413 printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n",
1414 __func__);
1415 return -EINVAL;
1416 }
1417
1418 __raw_writel(vpll_con0, EXYNOS4_VPLL_CON0);
1419 __raw_writel(vpll_con1, EXYNOS4_VPLL_CON1);
1420
1421 /* Wait for VPLL lock */
1422 while (!(__raw_readl(EXYNOS4_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT)))
1423 continue;
1424
1425 clk->rate = rate;
1426 return 0;
1427}
1428
1429static struct clk_ops exynos4_vpll_ops = {
1430 .get_rate = exynos4_vpll_get_rate,
1431 .set_rate = exynos4_vpll_set_rate,
1432};
1433
1434void __init_or_cpufreq exynos4_setup_clocks(void)
1435{
1436 struct clk *xtal_clk;
1437 unsigned long apll = 0;
1438 unsigned long mpll = 0;
1439 unsigned long epll = 0;
1440 unsigned long vpll = 0;
1441 unsigned long vpllsrc;
1442 unsigned long xtal;
1443 unsigned long armclk;
1444 unsigned long sclk_dmc;
1445 unsigned long aclk_200;
1446 unsigned long aclk_100;
1447 unsigned long aclk_160;
1448 unsigned long aclk_133;
1449 unsigned int ptr;
1450
1451 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1452
1453 xtal_clk = clk_get(NULL, "xtal");
1454 BUG_ON(IS_ERR(xtal_clk));
1455
1456 xtal = clk_get_rate(xtal_clk);
1457
1458 xtal_rate = xtal;
1459
1460 clk_put(xtal_clk);
1461
1462 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1463
1464 if (soc_is_exynos4210()) {
1465 apll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_APLL_CON0),
1466 pll_4508);
1467 mpll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0),
1468 pll_4508);
1469 epll = s5p_get_pll46xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0),
1470 __raw_readl(EXYNOS4_EPLL_CON1), pll_4600);
1471
1472 vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk);
1473 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0),
1474 __raw_readl(EXYNOS4_VPLL_CON1), pll_4650c);
1475 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
1476 apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_APLL_CON0));
1477 mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0));
1478 epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0),
1479 __raw_readl(EXYNOS4_EPLL_CON1));
1480
1481 vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk);
1482 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0),
1483 __raw_readl(EXYNOS4_VPLL_CON1));
1484 } else {
1485 /* nothing */
1486 }
1487
1488 clk_fout_apll.ops = &exynos4_fout_apll_ops;
1489 clk_fout_mpll.rate = mpll;
1490 clk_fout_epll.rate = epll;
1491 clk_fout_vpll.ops = &exynos4_vpll_ops;
1492 clk_fout_vpll.rate = vpll;
1493
1494 printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
1495 apll, mpll, epll, vpll);
1496
1497 armclk = clk_get_rate(&exynos4_clk_armclk.clk);
1498 sclk_dmc = clk_get_rate(&exynos4_clk_sclk_dmc.clk);
1499
1500 aclk_200 = clk_get_rate(&exynos4_clk_aclk_200.clk);
1501 aclk_100 = clk_get_rate(&exynos4_clk_aclk_100.clk);
1502 aclk_160 = clk_get_rate(&exynos4_clk_aclk_160.clk);
1503 aclk_133 = clk_get_rate(&exynos4_clk_aclk_133.clk);
1504
1505 printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
1506 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1507 armclk, sclk_dmc, aclk_200,
1508 aclk_100, aclk_160, aclk_133);
1509
1510 clk_f.rate = armclk;
1511 clk_h.rate = sclk_dmc;
1512 clk_p.rate = aclk_100;
1513
1514 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrcs); ptr++)
1515 s3c_set_clksrc(&exynos4_clksrcs[ptr], true);
1516}
1517
1518static struct clk *exynos4_clks[] __initdata = {
1519 &exynos4_clk_sclk_hdmi27m,
1520 &exynos4_clk_sclk_hdmiphy,
1521 &exynos4_clk_sclk_usbphy0,
1522 &exynos4_clk_sclk_usbphy1,
1523};
1524
1525#ifdef CONFIG_PM_SLEEP
1526static int exynos4_clock_suspend(void)
1527{
1528 s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1529 return 0;
1530}
1531
1532static void exynos4_clock_resume(void)
1533{
1534 s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1535}
1536
1537#else
1538#define exynos4_clock_suspend NULL
1539#define exynos4_clock_resume NULL
1540#endif
1541
1542static struct syscore_ops exynos4_clock_syscore_ops = {
1543 .suspend = exynos4_clock_suspend,
1544 .resume = exynos4_clock_resume,
1545};
1546
1547void __init exynos4_register_clocks(void)
1548{
1549 int ptr;
1550
1551 s3c24xx_register_clocks(exynos4_clks, ARRAY_SIZE(exynos4_clks));
1552
1553 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sysclks); ptr++)
1554 s3c_register_clksrc(exynos4_sysclks[ptr], 1);
1555
1556 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sclk_tv); ptr++)
1557 s3c_register_clksrc(exynos4_sclk_tv[ptr], 1);
1558
1559 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrc_cdev); ptr++)
1560 s3c_register_clksrc(exynos4_clksrc_cdev[ptr], 1);
1561
1562 s3c_register_clksrc(exynos4_clksrcs, ARRAY_SIZE(exynos4_clksrcs));
1563 s3c_register_clocks(exynos4_init_clocks_on, ARRAY_SIZE(exynos4_init_clocks_on));
1564
1565 s3c24xx_register_clocks(exynos4_clk_cdev, ARRAY_SIZE(exynos4_clk_cdev));
1566 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clk_cdev); ptr++)
1567 s3c_disable_clocks(exynos4_clk_cdev[ptr], 1);
1568
1569 s3c_register_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off));
1570 s3c_disable_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off));
1571 clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup));
1572
1573 register_syscore_ops(&exynos4_clock_syscore_ops);
1574 s3c24xx_register_clock(&dummy_apb_pclk);
1575
1576 s3c_pwmclk_init();
1577}
diff --git a/arch/arm/mach-exynos/clock-exynos4.h b/arch/arm/mach-exynos/clock-exynos4.h
new file mode 100644
index 00000000000..cb71c29c14d
--- /dev/null
+++ b/arch/arm/mach-exynos/clock-exynos4.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Header file for exynos4 clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __ASM_ARCH_CLOCK_H
13#define __ASM_ARCH_CLOCK_H __FILE__
14
15#include <linux/clk.h>
16
17extern struct clksrc_clk exynos4_clk_aclk_133;
18extern struct clksrc_clk exynos4_clk_mout_mpll;
19
20extern struct clksrc_sources exynos4_clkset_mout_corebus;
21extern struct clksrc_sources exynos4_clkset_group;
22
23extern struct clk *exynos4_clkset_aclk_top_list[];
24extern struct clk *exynos4_clkset_group_list[];
25
26extern int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable);
27extern int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable);
28extern int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable);
29
30#endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/mach-exynos/clock-exynos4210.c b/arch/arm/mach-exynos/clock-exynos4210.c
index 13312ccb2d9..3b131e4b6ef 100644
--- a/arch/arm/mach-exynos/clock-exynos4210.c
+++ b/arch/arm/mach-exynos/clock-exynos4210.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-exynos4/clock-exynos4210.c 2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com 3 * http://www.samsung.com
6 * 4 *
7 * EXYNOS4210 - Clock support 5 * EXYNOS4210 - Clock support
@@ -28,20 +26,20 @@
28#include <mach/hardware.h> 26#include <mach/hardware.h>
29#include <mach/map.h> 27#include <mach/map.h>
30#include <mach/regs-clock.h> 28#include <mach/regs-clock.h>
31#include <mach/exynos4-clock.h>
32 29
33#include "common.h" 30#include "common.h"
31#include "clock-exynos4.h"
34 32
35#ifdef CONFIG_PM_SLEEP 33#ifdef CONFIG_PM_SLEEP
36static struct sleep_save exynos4210_clock_save[] = { 34static struct sleep_save exynos4210_clock_save[] = {
37 SAVE_ITEM(S5P_CLKSRC_IMAGE), 35 SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE),
38 SAVE_ITEM(S5P_CLKSRC_LCD1), 36 SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE),
39 SAVE_ITEM(S5P_CLKDIV_IMAGE), 37 SAVE_ITEM(EXYNOS4210_CLKSRC_LCD1),
40 SAVE_ITEM(S5P_CLKDIV_LCD1), 38 SAVE_ITEM(EXYNOS4210_CLKDIV_LCD1),
41 SAVE_ITEM(S5P_CLKSRC_MASK_LCD1), 39 SAVE_ITEM(EXYNOS4210_CLKSRC_MASK_LCD1),
42 SAVE_ITEM(S5P_CLKGATE_IP_IMAGE_4210), 40 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_IMAGE),
43 SAVE_ITEM(S5P_CLKGATE_IP_LCD1), 41 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_LCD1),
44 SAVE_ITEM(S5P_CLKGATE_IP_PERIR_4210), 42 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_PERIR),
45}; 43};
46#endif 44#endif
47 45
@@ -51,7 +49,7 @@ static struct clksrc_clk *sysclks[] = {
51 49
52static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable) 50static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable)
53{ 51{
54 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable); 52 return s5p_gatectrl(EXYNOS4210_CLKSRC_MASK_LCD1, clk, enable);
55} 53}
56 54
57static struct clksrc_clk clksrcs[] = { 55static struct clksrc_clk clksrcs[] = {
@@ -62,9 +60,9 @@ static struct clksrc_clk clksrcs[] = {
62 .enable = exynos4_clksrc_mask_fsys_ctrl, 60 .enable = exynos4_clksrc_mask_fsys_ctrl,
63 .ctrlbit = (1 << 24), 61 .ctrlbit = (1 << 24),
64 }, 62 },
65 .sources = &clkset_mout_corebus, 63 .sources = &exynos4_clkset_mout_corebus,
66 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 }, 64 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 24, .size = 1 },
67 .reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 }, 65 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS0, .shift = 20, .size = 4 },
68 }, { 66 }, {
69 .clk = { 67 .clk = {
70 .name = "sclk_fimd", 68 .name = "sclk_fimd",
@@ -72,9 +70,9 @@ static struct clksrc_clk clksrcs[] = {
72 .enable = exynos4_clksrc_mask_lcd1_ctrl, 70 .enable = exynos4_clksrc_mask_lcd1_ctrl,
73 .ctrlbit = (1 << 0), 71 .ctrlbit = (1 << 0),
74 }, 72 },
75 .sources = &clkset_group, 73 .sources = &exynos4_clkset_group,
76 .reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 }, 74 .reg_src = { .reg = EXYNOS4210_CLKSRC_LCD1, .shift = 0, .size = 4 },
77 .reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 }, 75 .reg_div = { .reg = EXYNOS4210_CLKDIV_LCD1, .shift = 0, .size = 4 },
78 }, 76 },
79}; 77};
80 78
@@ -82,13 +80,13 @@ static struct clk init_clocks_off[] = {
82 { 80 {
83 .name = "sataphy", 81 .name = "sataphy",
84 .id = -1, 82 .id = -1,
85 .parent = &clk_aclk_133.clk, 83 .parent = &exynos4_clk_aclk_133.clk,
86 .enable = exynos4_clk_ip_fsys_ctrl, 84 .enable = exynos4_clk_ip_fsys_ctrl,
87 .ctrlbit = (1 << 3), 85 .ctrlbit = (1 << 3),
88 }, { 86 }, {
89 .name = "sata", 87 .name = "sata",
90 .id = -1, 88 .id = -1,
91 .parent = &clk_aclk_133.clk, 89 .parent = &exynos4_clk_aclk_133.clk,
92 .enable = exynos4_clk_ip_fsys_ctrl, 90 .enable = exynos4_clk_ip_fsys_ctrl,
93 .ctrlbit = (1 << 10), 91 .ctrlbit = (1 << 10),
94 }, { 92 }, {
@@ -117,7 +115,7 @@ static void exynos4210_clock_resume(void)
117#define exynos4210_clock_resume NULL 115#define exynos4210_clock_resume NULL
118#endif 116#endif
119 117
120struct syscore_ops exynos4210_clock_syscore_ops = { 118static struct syscore_ops exynos4210_clock_syscore_ops = {
121 .suspend = exynos4210_clock_suspend, 119 .suspend = exynos4210_clock_suspend,
122 .resume = exynos4210_clock_resume, 120 .resume = exynos4210_clock_resume,
123}; 121};
@@ -126,9 +124,9 @@ void __init exynos4210_register_clocks(void)
126{ 124{
127 int ptr; 125 int ptr;
128 126
129 clk_mout_mpll.reg_src.reg = S5P_CLKSRC_CPU; 127 exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_CPU;
130 clk_mout_mpll.reg_src.shift = 8; 128 exynos4_clk_mout_mpll.reg_src.shift = 8;
131 clk_mout_mpll.reg_src.size = 1; 129 exynos4_clk_mout_mpll.reg_src.size = 1;
132 130
133 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 131 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
134 s3c_register_clksrc(sysclks[ptr], 1); 132 s3c_register_clksrc(sysclks[ptr], 1);
diff --git a/arch/arm/mach-exynos/clock-exynos4212.c b/arch/arm/mach-exynos/clock-exynos4212.c
index 48af28566fa..3ecc01e06f7 100644
--- a/arch/arm/mach-exynos/clock-exynos4212.c
+++ b/arch/arm/mach-exynos/clock-exynos4212.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-exynos4/clock-exynos4212.c 2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com 3 * http://www.samsung.com
6 * 4 *
7 * EXYNOS4212 - Clock support 5 * EXYNOS4212 - Clock support
@@ -28,22 +26,22 @@
28#include <mach/hardware.h> 26#include <mach/hardware.h>
29#include <mach/map.h> 27#include <mach/map.h>
30#include <mach/regs-clock.h> 28#include <mach/regs-clock.h>
31#include <mach/exynos4-clock.h>
32 29
33#include "common.h" 30#include "common.h"
31#include "clock-exynos4.h"
34 32
35#ifdef CONFIG_PM_SLEEP 33#ifdef CONFIG_PM_SLEEP
36static struct sleep_save exynos4212_clock_save[] = { 34static struct sleep_save exynos4212_clock_save[] = {
37 SAVE_ITEM(S5P_CLKSRC_IMAGE), 35 SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE),
38 SAVE_ITEM(S5P_CLKDIV_IMAGE), 36 SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE),
39 SAVE_ITEM(S5P_CLKGATE_IP_IMAGE_4212), 37 SAVE_ITEM(EXYNOS4212_CLKGATE_IP_IMAGE),
40 SAVE_ITEM(S5P_CLKGATE_IP_PERIR_4212), 38 SAVE_ITEM(EXYNOS4212_CLKGATE_IP_PERIR),
41}; 39};
42#endif 40#endif
43 41
44static struct clk *clk_src_mpll_user_list[] = { 42static struct clk *clk_src_mpll_user_list[] = {
45 [0] = &clk_fin_mpll, 43 [0] = &clk_fin_mpll,
46 [1] = &clk_mout_mpll.clk, 44 [1] = &exynos4_clk_mout_mpll.clk,
47}; 45};
48 46
49static struct clksrc_sources clk_src_mpll_user = { 47static struct clksrc_sources clk_src_mpll_user = {
@@ -56,7 +54,7 @@ static struct clksrc_clk clk_mout_mpll_user = {
56 .name = "mout_mpll_user", 54 .name = "mout_mpll_user",
57 }, 55 },
58 .sources = &clk_src_mpll_user, 56 .sources = &clk_src_mpll_user,
59 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 24, .size = 1 }, 57 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 24, .size = 1 },
60}; 58};
61 59
62static struct clksrc_clk *sysclks[] = { 60static struct clksrc_clk *sysclks[] = {
@@ -89,7 +87,7 @@ static void exynos4212_clock_resume(void)
89#define exynos4212_clock_resume NULL 87#define exynos4212_clock_resume NULL
90#endif 88#endif
91 89
92struct syscore_ops exynos4212_clock_syscore_ops = { 90static struct syscore_ops exynos4212_clock_syscore_ops = {
93 .suspend = exynos4212_clock_suspend, 91 .suspend = exynos4212_clock_suspend,
94 .resume = exynos4212_clock_resume, 92 .resume = exynos4212_clock_resume,
95}; 93};
@@ -99,15 +97,15 @@ void __init exynos4212_register_clocks(void)
99 int ptr; 97 int ptr;
100 98
101 /* usbphy1 is removed */ 99 /* usbphy1 is removed */
102 clkset_group_list[4] = NULL; 100 exynos4_clkset_group_list[4] = NULL;
103 101
104 /* mout_mpll_user is used */ 102 /* mout_mpll_user is used */
105 clkset_group_list[6] = &clk_mout_mpll_user.clk; 103 exynos4_clkset_group_list[6] = &clk_mout_mpll_user.clk;
106 clkset_aclk_top_list[0] = &clk_mout_mpll_user.clk; 104 exynos4_clkset_aclk_top_list[0] = &clk_mout_mpll_user.clk;
107 105
108 clk_mout_mpll.reg_src.reg = S5P_CLKSRC_DMC; 106 exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_DMC;
109 clk_mout_mpll.reg_src.shift = 12; 107 exynos4_clk_mout_mpll.reg_src.shift = 12;
110 clk_mout_mpll.reg_src.size = 1; 108 exynos4_clk_mout_mpll.reg_src.size = 1;
111 109
112 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 110 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
113 s3c_register_clksrc(sysclks[ptr], 1); 111 s3c_register_clksrc(sysclks[ptr], 1);
diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c
deleted file mode 100644
index 187287aa57a..00000000000
--- a/arch/arm/mach-exynos/clock.c
+++ /dev/null
@@ -1,1564 +0,0 @@
1/* linux/arch/arm/mach-exynos4/clock.c
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/err.h>
15#include <linux/io.h>
16#include <linux/syscore_ops.h>
17
18#include <plat/cpu-freq.h>
19#include <plat/clock.h>
20#include <plat/cpu.h>
21#include <plat/pll.h>
22#include <plat/s5p-clock.h>
23#include <plat/clock-clksrc.h>
24#include <plat/pm.h>
25
26#include <mach/map.h>
27#include <mach/regs-clock.h>
28#include <mach/sysmmu.h>
29#include <mach/exynos4-clock.h>
30
31#include "common.h"
32
33#ifdef CONFIG_PM_SLEEP
34static struct sleep_save exynos4_clock_save[] = {
35 SAVE_ITEM(S5P_CLKDIV_LEFTBUS),
36 SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS),
37 SAVE_ITEM(S5P_CLKDIV_RIGHTBUS),
38 SAVE_ITEM(S5P_CLKGATE_IP_RIGHTBUS),
39 SAVE_ITEM(S5P_CLKSRC_TOP0),
40 SAVE_ITEM(S5P_CLKSRC_TOP1),
41 SAVE_ITEM(S5P_CLKSRC_CAM),
42 SAVE_ITEM(S5P_CLKSRC_TV),
43 SAVE_ITEM(S5P_CLKSRC_MFC),
44 SAVE_ITEM(S5P_CLKSRC_G3D),
45 SAVE_ITEM(S5P_CLKSRC_LCD0),
46 SAVE_ITEM(S5P_CLKSRC_MAUDIO),
47 SAVE_ITEM(S5P_CLKSRC_FSYS),
48 SAVE_ITEM(S5P_CLKSRC_PERIL0),
49 SAVE_ITEM(S5P_CLKSRC_PERIL1),
50 SAVE_ITEM(S5P_CLKDIV_CAM),
51 SAVE_ITEM(S5P_CLKDIV_TV),
52 SAVE_ITEM(S5P_CLKDIV_MFC),
53 SAVE_ITEM(S5P_CLKDIV_G3D),
54 SAVE_ITEM(S5P_CLKDIV_LCD0),
55 SAVE_ITEM(S5P_CLKDIV_MAUDIO),
56 SAVE_ITEM(S5P_CLKDIV_FSYS0),
57 SAVE_ITEM(S5P_CLKDIV_FSYS1),
58 SAVE_ITEM(S5P_CLKDIV_FSYS2),
59 SAVE_ITEM(S5P_CLKDIV_FSYS3),
60 SAVE_ITEM(S5P_CLKDIV_PERIL0),
61 SAVE_ITEM(S5P_CLKDIV_PERIL1),
62 SAVE_ITEM(S5P_CLKDIV_PERIL2),
63 SAVE_ITEM(S5P_CLKDIV_PERIL3),
64 SAVE_ITEM(S5P_CLKDIV_PERIL4),
65 SAVE_ITEM(S5P_CLKDIV_PERIL5),
66 SAVE_ITEM(S5P_CLKDIV_TOP),
67 SAVE_ITEM(S5P_CLKSRC_MASK_TOP),
68 SAVE_ITEM(S5P_CLKSRC_MASK_CAM),
69 SAVE_ITEM(S5P_CLKSRC_MASK_TV),
70 SAVE_ITEM(S5P_CLKSRC_MASK_LCD0),
71 SAVE_ITEM(S5P_CLKSRC_MASK_MAUDIO),
72 SAVE_ITEM(S5P_CLKSRC_MASK_FSYS),
73 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL0),
74 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL1),
75 SAVE_ITEM(S5P_CLKDIV2_RATIO),
76 SAVE_ITEM(S5P_CLKGATE_SCLKCAM),
77 SAVE_ITEM(S5P_CLKGATE_IP_CAM),
78 SAVE_ITEM(S5P_CLKGATE_IP_TV),
79 SAVE_ITEM(S5P_CLKGATE_IP_MFC),
80 SAVE_ITEM(S5P_CLKGATE_IP_G3D),
81 SAVE_ITEM(S5P_CLKGATE_IP_LCD0),
82 SAVE_ITEM(S5P_CLKGATE_IP_FSYS),
83 SAVE_ITEM(S5P_CLKGATE_IP_GPS),
84 SAVE_ITEM(S5P_CLKGATE_IP_PERIL),
85 SAVE_ITEM(S5P_CLKGATE_BLOCK),
86 SAVE_ITEM(S5P_CLKSRC_MASK_DMC),
87 SAVE_ITEM(S5P_CLKSRC_DMC),
88 SAVE_ITEM(S5P_CLKDIV_DMC0),
89 SAVE_ITEM(S5P_CLKDIV_DMC1),
90 SAVE_ITEM(S5P_CLKGATE_IP_DMC),
91 SAVE_ITEM(S5P_CLKSRC_CPU),
92 SAVE_ITEM(S5P_CLKDIV_CPU),
93 SAVE_ITEM(S5P_CLKDIV_CPU + 0x4),
94 SAVE_ITEM(S5P_CLKGATE_SCLKCPU),
95 SAVE_ITEM(S5P_CLKGATE_IP_CPU),
96};
97#endif
98
99struct clk clk_sclk_hdmi27m = {
100 .name = "sclk_hdmi27m",
101 .rate = 27000000,
102};
103
104struct clk clk_sclk_hdmiphy = {
105 .name = "sclk_hdmiphy",
106};
107
108struct clk clk_sclk_usbphy0 = {
109 .name = "sclk_usbphy0",
110 .rate = 27000000,
111};
112
113struct clk clk_sclk_usbphy1 = {
114 .name = "sclk_usbphy1",
115};
116
117static struct clk dummy_apb_pclk = {
118 .name = "apb_pclk",
119 .id = -1,
120};
121
122static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
123{
124 return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable);
125}
126
127static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
128{
129 return s5p_gatectrl(S5P_CLKSRC_MASK_CAM, clk, enable);
130}
131
132static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
133{
134 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable);
135}
136
137int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
138{
139 return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable);
140}
141
142static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
143{
144 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable);
145}
146
147static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
148{
149 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable);
150}
151
152static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable)
153{
154 return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable);
155}
156
157static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
158{
159 return s5p_gatectrl(S5P_CLKSRC_MASK_TV, clk, enable);
160}
161
162static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
163{
164 return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
165}
166
167static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable)
168{
169 return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable);
170}
171
172static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
173{
174 return s5p_gatectrl(S5P_CLKGATE_IP_IMAGE, clk, enable);
175}
176
177static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
178{
179 return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable);
180}
181
182int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
183{
184 return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable);
185}
186
187int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
188{
189 return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable);
190}
191
192static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
193{
194 return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable);
195}
196
197static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
198{
199 return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
200}
201
202static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
203{
204 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
205}
206
207static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
208{
209 return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
210}
211
212/* Core list of CMU_CPU side */
213
214static struct clksrc_clk clk_mout_apll = {
215 .clk = {
216 .name = "mout_apll",
217 },
218 .sources = &clk_src_apll,
219 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 },
220};
221
222struct clksrc_clk clk_sclk_apll = {
223 .clk = {
224 .name = "sclk_apll",
225 .parent = &clk_mout_apll.clk,
226 },
227 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 },
228};
229
230struct clksrc_clk clk_mout_epll = {
231 .clk = {
232 .name = "mout_epll",
233 },
234 .sources = &clk_src_epll,
235 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 },
236};
237
238struct clksrc_clk clk_mout_mpll = {
239 .clk = {
240 .name = "mout_mpll",
241 },
242 .sources = &clk_src_mpll,
243
244 /* reg_src will be added in each SoCs' clock */
245};
246
247static struct clk *clkset_moutcore_list[] = {
248 [0] = &clk_mout_apll.clk,
249 [1] = &clk_mout_mpll.clk,
250};
251
252static struct clksrc_sources clkset_moutcore = {
253 .sources = clkset_moutcore_list,
254 .nr_sources = ARRAY_SIZE(clkset_moutcore_list),
255};
256
257static struct clksrc_clk clk_moutcore = {
258 .clk = {
259 .name = "moutcore",
260 },
261 .sources = &clkset_moutcore,
262 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 },
263};
264
265static struct clksrc_clk clk_coreclk = {
266 .clk = {
267 .name = "core_clk",
268 .parent = &clk_moutcore.clk,
269 },
270 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 },
271};
272
273static struct clksrc_clk clk_armclk = {
274 .clk = {
275 .name = "armclk",
276 .parent = &clk_coreclk.clk,
277 },
278};
279
280static struct clksrc_clk clk_aclk_corem0 = {
281 .clk = {
282 .name = "aclk_corem0",
283 .parent = &clk_coreclk.clk,
284 },
285 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
286};
287
288static struct clksrc_clk clk_aclk_cores = {
289 .clk = {
290 .name = "aclk_cores",
291 .parent = &clk_coreclk.clk,
292 },
293 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
294};
295
296static struct clksrc_clk clk_aclk_corem1 = {
297 .clk = {
298 .name = "aclk_corem1",
299 .parent = &clk_coreclk.clk,
300 },
301 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 },
302};
303
304static struct clksrc_clk clk_periphclk = {
305 .clk = {
306 .name = "periphclk",
307 .parent = &clk_coreclk.clk,
308 },
309 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 },
310};
311
312/* Core list of CMU_CORE side */
313
314struct clk *clkset_corebus_list[] = {
315 [0] = &clk_mout_mpll.clk,
316 [1] = &clk_sclk_apll.clk,
317};
318
319struct clksrc_sources clkset_mout_corebus = {
320 .sources = clkset_corebus_list,
321 .nr_sources = ARRAY_SIZE(clkset_corebus_list),
322};
323
324static struct clksrc_clk clk_mout_corebus = {
325 .clk = {
326 .name = "mout_corebus",
327 },
328 .sources = &clkset_mout_corebus,
329 .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 },
330};
331
332static struct clksrc_clk clk_sclk_dmc = {
333 .clk = {
334 .name = "sclk_dmc",
335 .parent = &clk_mout_corebus.clk,
336 },
337 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 },
338};
339
340static struct clksrc_clk clk_aclk_cored = {
341 .clk = {
342 .name = "aclk_cored",
343 .parent = &clk_sclk_dmc.clk,
344 },
345 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 },
346};
347
348static struct clksrc_clk clk_aclk_corep = {
349 .clk = {
350 .name = "aclk_corep",
351 .parent = &clk_aclk_cored.clk,
352 },
353 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 },
354};
355
356static struct clksrc_clk clk_aclk_acp = {
357 .clk = {
358 .name = "aclk_acp",
359 .parent = &clk_mout_corebus.clk,
360 },
361 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 },
362};
363
364static struct clksrc_clk clk_pclk_acp = {
365 .clk = {
366 .name = "pclk_acp",
367 .parent = &clk_aclk_acp.clk,
368 },
369 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 },
370};
371
372/* Core list of CMU_TOP side */
373
374struct clk *clkset_aclk_top_list[] = {
375 [0] = &clk_mout_mpll.clk,
376 [1] = &clk_sclk_apll.clk,
377};
378
379struct clksrc_sources clkset_aclk = {
380 .sources = clkset_aclk_top_list,
381 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list),
382};
383
384static struct clksrc_clk clk_aclk_200 = {
385 .clk = {
386 .name = "aclk_200",
387 },
388 .sources = &clkset_aclk,
389 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 },
390 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 },
391};
392
393static struct clksrc_clk clk_aclk_100 = {
394 .clk = {
395 .name = "aclk_100",
396 },
397 .sources = &clkset_aclk,
398 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 },
399 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 },
400};
401
402static struct clksrc_clk clk_aclk_160 = {
403 .clk = {
404 .name = "aclk_160",
405 },
406 .sources = &clkset_aclk,
407 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 },
408 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 },
409};
410
411struct clksrc_clk clk_aclk_133 = {
412 .clk = {
413 .name = "aclk_133",
414 },
415 .sources = &clkset_aclk,
416 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 },
417 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 },
418};
419
420static struct clk *clkset_vpllsrc_list[] = {
421 [0] = &clk_fin_vpll,
422 [1] = &clk_sclk_hdmi27m,
423};
424
425static struct clksrc_sources clkset_vpllsrc = {
426 .sources = clkset_vpllsrc_list,
427 .nr_sources = ARRAY_SIZE(clkset_vpllsrc_list),
428};
429
430static struct clksrc_clk clk_vpllsrc = {
431 .clk = {
432 .name = "vpll_src",
433 .enable = exynos4_clksrc_mask_top_ctrl,
434 .ctrlbit = (1 << 0),
435 },
436 .sources = &clkset_vpllsrc,
437 .reg_src = { .reg = S5P_CLKSRC_TOP1, .shift = 0, .size = 1 },
438};
439
440static struct clk *clkset_sclk_vpll_list[] = {
441 [0] = &clk_vpllsrc.clk,
442 [1] = &clk_fout_vpll,
443};
444
445static struct clksrc_sources clkset_sclk_vpll = {
446 .sources = clkset_sclk_vpll_list,
447 .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list),
448};
449
450struct clksrc_clk clk_sclk_vpll = {
451 .clk = {
452 .name = "sclk_vpll",
453 },
454 .sources = &clkset_sclk_vpll,
455 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 },
456};
457
458static struct clk init_clocks_off[] = {
459 {
460 .name = "timers",
461 .parent = &clk_aclk_100.clk,
462 .enable = exynos4_clk_ip_peril_ctrl,
463 .ctrlbit = (1<<24),
464 }, {
465 .name = "csis",
466 .devname = "s5p-mipi-csis.0",
467 .enable = exynos4_clk_ip_cam_ctrl,
468 .ctrlbit = (1 << 4),
469 }, {
470 .name = "csis",
471 .devname = "s5p-mipi-csis.1",
472 .enable = exynos4_clk_ip_cam_ctrl,
473 .ctrlbit = (1 << 5),
474 }, {
475 .name = "fimc",
476 .devname = "exynos4-fimc.0",
477 .enable = exynos4_clk_ip_cam_ctrl,
478 .ctrlbit = (1 << 0),
479 }, {
480 .name = "fimc",
481 .devname = "exynos4-fimc.1",
482 .enable = exynos4_clk_ip_cam_ctrl,
483 .ctrlbit = (1 << 1),
484 }, {
485 .name = "fimc",
486 .devname = "exynos4-fimc.2",
487 .enable = exynos4_clk_ip_cam_ctrl,
488 .ctrlbit = (1 << 2),
489 }, {
490 .name = "fimc",
491 .devname = "exynos4-fimc.3",
492 .enable = exynos4_clk_ip_cam_ctrl,
493 .ctrlbit = (1 << 3),
494 }, {
495 .name = "fimd",
496 .devname = "exynos4-fb.0",
497 .enable = exynos4_clk_ip_lcd0_ctrl,
498 .ctrlbit = (1 << 0),
499 }, {
500 .name = "hsmmc",
501 .devname = "s3c-sdhci.0",
502 .parent = &clk_aclk_133.clk,
503 .enable = exynos4_clk_ip_fsys_ctrl,
504 .ctrlbit = (1 << 5),
505 }, {
506 .name = "hsmmc",
507 .devname = "s3c-sdhci.1",
508 .parent = &clk_aclk_133.clk,
509 .enable = exynos4_clk_ip_fsys_ctrl,
510 .ctrlbit = (1 << 6),
511 }, {
512 .name = "hsmmc",
513 .devname = "s3c-sdhci.2",
514 .parent = &clk_aclk_133.clk,
515 .enable = exynos4_clk_ip_fsys_ctrl,
516 .ctrlbit = (1 << 7),
517 }, {
518 .name = "hsmmc",
519 .devname = "s3c-sdhci.3",
520 .parent = &clk_aclk_133.clk,
521 .enable = exynos4_clk_ip_fsys_ctrl,
522 .ctrlbit = (1 << 8),
523 }, {
524 .name = "dwmmc",
525 .parent = &clk_aclk_133.clk,
526 .enable = exynos4_clk_ip_fsys_ctrl,
527 .ctrlbit = (1 << 9),
528 }, {
529 .name = "dac",
530 .devname = "s5p-sdo",
531 .enable = exynos4_clk_ip_tv_ctrl,
532 .ctrlbit = (1 << 2),
533 }, {
534 .name = "mixer",
535 .devname = "s5p-mixer",
536 .enable = exynos4_clk_ip_tv_ctrl,
537 .ctrlbit = (1 << 1),
538 }, {
539 .name = "vp",
540 .devname = "s5p-mixer",
541 .enable = exynos4_clk_ip_tv_ctrl,
542 .ctrlbit = (1 << 0),
543 }, {
544 .name = "hdmi",
545 .devname = "exynos4-hdmi",
546 .enable = exynos4_clk_ip_tv_ctrl,
547 .ctrlbit = (1 << 3),
548 }, {
549 .name = "hdmiphy",
550 .devname = "exynos4-hdmi",
551 .enable = exynos4_clk_hdmiphy_ctrl,
552 .ctrlbit = (1 << 0),
553 }, {
554 .name = "dacphy",
555 .devname = "s5p-sdo",
556 .enable = exynos4_clk_dac_ctrl,
557 .ctrlbit = (1 << 0),
558 }, {
559 .name = "adc",
560 .enable = exynos4_clk_ip_peril_ctrl,
561 .ctrlbit = (1 << 15),
562 }, {
563 .name = "keypad",
564 .enable = exynos4_clk_ip_perir_ctrl,
565 .ctrlbit = (1 << 16),
566 }, {
567 .name = "rtc",
568 .enable = exynos4_clk_ip_perir_ctrl,
569 .ctrlbit = (1 << 15),
570 }, {
571 .name = "watchdog",
572 .parent = &clk_aclk_100.clk,
573 .enable = exynos4_clk_ip_perir_ctrl,
574 .ctrlbit = (1 << 14),
575 }, {
576 .name = "usbhost",
577 .enable = exynos4_clk_ip_fsys_ctrl ,
578 .ctrlbit = (1 << 12),
579 }, {
580 .name = "otg",
581 .enable = exynos4_clk_ip_fsys_ctrl,
582 .ctrlbit = (1 << 13),
583 }, {
584 .name = "spi",
585 .devname = "s3c64xx-spi.0",
586 .enable = exynos4_clk_ip_peril_ctrl,
587 .ctrlbit = (1 << 16),
588 }, {
589 .name = "spi",
590 .devname = "s3c64xx-spi.1",
591 .enable = exynos4_clk_ip_peril_ctrl,
592 .ctrlbit = (1 << 17),
593 }, {
594 .name = "spi",
595 .devname = "s3c64xx-spi.2",
596 .enable = exynos4_clk_ip_peril_ctrl,
597 .ctrlbit = (1 << 18),
598 }, {
599 .name = "iis",
600 .devname = "samsung-i2s.0",
601 .enable = exynos4_clk_ip_peril_ctrl,
602 .ctrlbit = (1 << 19),
603 }, {
604 .name = "iis",
605 .devname = "samsung-i2s.1",
606 .enable = exynos4_clk_ip_peril_ctrl,
607 .ctrlbit = (1 << 20),
608 }, {
609 .name = "iis",
610 .devname = "samsung-i2s.2",
611 .enable = exynos4_clk_ip_peril_ctrl,
612 .ctrlbit = (1 << 21),
613 }, {
614 .name = "ac97",
615 .devname = "samsung-ac97",
616 .enable = exynos4_clk_ip_peril_ctrl,
617 .ctrlbit = (1 << 27),
618 }, {
619 .name = "fimg2d",
620 .enable = exynos4_clk_ip_image_ctrl,
621 .ctrlbit = (1 << 0),
622 }, {
623 .name = "mfc",
624 .devname = "s5p-mfc",
625 .enable = exynos4_clk_ip_mfc_ctrl,
626 .ctrlbit = (1 << 0),
627 }, {
628 .name = "i2c",
629 .devname = "s3c2440-i2c.0",
630 .parent = &clk_aclk_100.clk,
631 .enable = exynos4_clk_ip_peril_ctrl,
632 .ctrlbit = (1 << 6),
633 }, {
634 .name = "i2c",
635 .devname = "s3c2440-i2c.1",
636 .parent = &clk_aclk_100.clk,
637 .enable = exynos4_clk_ip_peril_ctrl,
638 .ctrlbit = (1 << 7),
639 }, {
640 .name = "i2c",
641 .devname = "s3c2440-i2c.2",
642 .parent = &clk_aclk_100.clk,
643 .enable = exynos4_clk_ip_peril_ctrl,
644 .ctrlbit = (1 << 8),
645 }, {
646 .name = "i2c",
647 .devname = "s3c2440-i2c.3",
648 .parent = &clk_aclk_100.clk,
649 .enable = exynos4_clk_ip_peril_ctrl,
650 .ctrlbit = (1 << 9),
651 }, {
652 .name = "i2c",
653 .devname = "s3c2440-i2c.4",
654 .parent = &clk_aclk_100.clk,
655 .enable = exynos4_clk_ip_peril_ctrl,
656 .ctrlbit = (1 << 10),
657 }, {
658 .name = "i2c",
659 .devname = "s3c2440-i2c.5",
660 .parent = &clk_aclk_100.clk,
661 .enable = exynos4_clk_ip_peril_ctrl,
662 .ctrlbit = (1 << 11),
663 }, {
664 .name = "i2c",
665 .devname = "s3c2440-i2c.6",
666 .parent = &clk_aclk_100.clk,
667 .enable = exynos4_clk_ip_peril_ctrl,
668 .ctrlbit = (1 << 12),
669 }, {
670 .name = "i2c",
671 .devname = "s3c2440-i2c.7",
672 .parent = &clk_aclk_100.clk,
673 .enable = exynos4_clk_ip_peril_ctrl,
674 .ctrlbit = (1 << 13),
675 }, {
676 .name = "i2c",
677 .devname = "s3c2440-hdmiphy-i2c",
678 .parent = &clk_aclk_100.clk,
679 .enable = exynos4_clk_ip_peril_ctrl,
680 .ctrlbit = (1 << 14),
681 }, {
682 .name = "SYSMMU_MDMA",
683 .enable = exynos4_clk_ip_image_ctrl,
684 .ctrlbit = (1 << 5),
685 }, {
686 .name = "SYSMMU_FIMC0",
687 .enable = exynos4_clk_ip_cam_ctrl,
688 .ctrlbit = (1 << 7),
689 }, {
690 .name = "SYSMMU_FIMC1",
691 .enable = exynos4_clk_ip_cam_ctrl,
692 .ctrlbit = (1 << 8),
693 }, {
694 .name = "SYSMMU_FIMC2",
695 .enable = exynos4_clk_ip_cam_ctrl,
696 .ctrlbit = (1 << 9),
697 }, {
698 .name = "SYSMMU_FIMC3",
699 .enable = exynos4_clk_ip_cam_ctrl,
700 .ctrlbit = (1 << 10),
701 }, {
702 .name = "SYSMMU_JPEG",
703 .enable = exynos4_clk_ip_cam_ctrl,
704 .ctrlbit = (1 << 11),
705 }, {
706 .name = "SYSMMU_FIMD0",
707 .enable = exynos4_clk_ip_lcd0_ctrl,
708 .ctrlbit = (1 << 4),
709 }, {
710 .name = "SYSMMU_FIMD1",
711 .enable = exynos4_clk_ip_lcd1_ctrl,
712 .ctrlbit = (1 << 4),
713 }, {
714 .name = "SYSMMU_PCIe",
715 .enable = exynos4_clk_ip_fsys_ctrl,
716 .ctrlbit = (1 << 18),
717 }, {
718 .name = "SYSMMU_G2D",
719 .enable = exynos4_clk_ip_image_ctrl,
720 .ctrlbit = (1 << 3),
721 }, {
722 .name = "SYSMMU_ROTATOR",
723 .enable = exynos4_clk_ip_image_ctrl,
724 .ctrlbit = (1 << 4),
725 }, {
726 .name = "SYSMMU_TV",
727 .enable = exynos4_clk_ip_tv_ctrl,
728 .ctrlbit = (1 << 4),
729 }, {
730 .name = "SYSMMU_MFC_L",
731 .enable = exynos4_clk_ip_mfc_ctrl,
732 .ctrlbit = (1 << 1),
733 }, {
734 .name = "SYSMMU_MFC_R",
735 .enable = exynos4_clk_ip_mfc_ctrl,
736 .ctrlbit = (1 << 2),
737 }
738};
739
740static struct clk init_clocks[] = {
741 {
742 .name = "uart",
743 .devname = "s5pv210-uart.0",
744 .enable = exynos4_clk_ip_peril_ctrl,
745 .ctrlbit = (1 << 0),
746 }, {
747 .name = "uart",
748 .devname = "s5pv210-uart.1",
749 .enable = exynos4_clk_ip_peril_ctrl,
750 .ctrlbit = (1 << 1),
751 }, {
752 .name = "uart",
753 .devname = "s5pv210-uart.2",
754 .enable = exynos4_clk_ip_peril_ctrl,
755 .ctrlbit = (1 << 2),
756 }, {
757 .name = "uart",
758 .devname = "s5pv210-uart.3",
759 .enable = exynos4_clk_ip_peril_ctrl,
760 .ctrlbit = (1 << 3),
761 }, {
762 .name = "uart",
763 .devname = "s5pv210-uart.4",
764 .enable = exynos4_clk_ip_peril_ctrl,
765 .ctrlbit = (1 << 4),
766 }, {
767 .name = "uart",
768 .devname = "s5pv210-uart.5",
769 .enable = exynos4_clk_ip_peril_ctrl,
770 .ctrlbit = (1 << 5),
771 }
772};
773
774static struct clk clk_pdma0 = {
775 .name = "dma",
776 .devname = "dma-pl330.0",
777 .enable = exynos4_clk_ip_fsys_ctrl,
778 .ctrlbit = (1 << 0),
779};
780
781static struct clk clk_pdma1 = {
782 .name = "dma",
783 .devname = "dma-pl330.1",
784 .enable = exynos4_clk_ip_fsys_ctrl,
785 .ctrlbit = (1 << 1),
786};
787
788struct clk *clkset_group_list[] = {
789 [0] = &clk_ext_xtal_mux,
790 [1] = &clk_xusbxti,
791 [2] = &clk_sclk_hdmi27m,
792 [3] = &clk_sclk_usbphy0,
793 [4] = &clk_sclk_usbphy1,
794 [5] = &clk_sclk_hdmiphy,
795 [6] = &clk_mout_mpll.clk,
796 [7] = &clk_mout_epll.clk,
797 [8] = &clk_sclk_vpll.clk,
798};
799
800struct clksrc_sources clkset_group = {
801 .sources = clkset_group_list,
802 .nr_sources = ARRAY_SIZE(clkset_group_list),
803};
804
805static struct clk *clkset_mout_g2d0_list[] = {
806 [0] = &clk_mout_mpll.clk,
807 [1] = &clk_sclk_apll.clk,
808};
809
810static struct clksrc_sources clkset_mout_g2d0 = {
811 .sources = clkset_mout_g2d0_list,
812 .nr_sources = ARRAY_SIZE(clkset_mout_g2d0_list),
813};
814
815static struct clksrc_clk clk_mout_g2d0 = {
816 .clk = {
817 .name = "mout_g2d0",
818 },
819 .sources = &clkset_mout_g2d0,
820 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 },
821};
822
823static struct clk *clkset_mout_g2d1_list[] = {
824 [0] = &clk_mout_epll.clk,
825 [1] = &clk_sclk_vpll.clk,
826};
827
828static struct clksrc_sources clkset_mout_g2d1 = {
829 .sources = clkset_mout_g2d1_list,
830 .nr_sources = ARRAY_SIZE(clkset_mout_g2d1_list),
831};
832
833static struct clksrc_clk clk_mout_g2d1 = {
834 .clk = {
835 .name = "mout_g2d1",
836 },
837 .sources = &clkset_mout_g2d1,
838 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 },
839};
840
841static struct clk *clkset_mout_g2d_list[] = {
842 [0] = &clk_mout_g2d0.clk,
843 [1] = &clk_mout_g2d1.clk,
844};
845
846static struct clksrc_sources clkset_mout_g2d = {
847 .sources = clkset_mout_g2d_list,
848 .nr_sources = ARRAY_SIZE(clkset_mout_g2d_list),
849};
850
851static struct clk *clkset_mout_mfc0_list[] = {
852 [0] = &clk_mout_mpll.clk,
853 [1] = &clk_sclk_apll.clk,
854};
855
856static struct clksrc_sources clkset_mout_mfc0 = {
857 .sources = clkset_mout_mfc0_list,
858 .nr_sources = ARRAY_SIZE(clkset_mout_mfc0_list),
859};
860
861static struct clksrc_clk clk_mout_mfc0 = {
862 .clk = {
863 .name = "mout_mfc0",
864 },
865 .sources = &clkset_mout_mfc0,
866 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 0, .size = 1 },
867};
868
869static struct clk *clkset_mout_mfc1_list[] = {
870 [0] = &clk_mout_epll.clk,
871 [1] = &clk_sclk_vpll.clk,
872};
873
874static struct clksrc_sources clkset_mout_mfc1 = {
875 .sources = clkset_mout_mfc1_list,
876 .nr_sources = ARRAY_SIZE(clkset_mout_mfc1_list),
877};
878
879static struct clksrc_clk clk_mout_mfc1 = {
880 .clk = {
881 .name = "mout_mfc1",
882 },
883 .sources = &clkset_mout_mfc1,
884 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 4, .size = 1 },
885};
886
887static struct clk *clkset_mout_mfc_list[] = {
888 [0] = &clk_mout_mfc0.clk,
889 [1] = &clk_mout_mfc1.clk,
890};
891
892static struct clksrc_sources clkset_mout_mfc = {
893 .sources = clkset_mout_mfc_list,
894 .nr_sources = ARRAY_SIZE(clkset_mout_mfc_list),
895};
896
897static struct clk *clkset_sclk_dac_list[] = {
898 [0] = &clk_sclk_vpll.clk,
899 [1] = &clk_sclk_hdmiphy,
900};
901
902static struct clksrc_sources clkset_sclk_dac = {
903 .sources = clkset_sclk_dac_list,
904 .nr_sources = ARRAY_SIZE(clkset_sclk_dac_list),
905};
906
907static struct clksrc_clk clk_sclk_dac = {
908 .clk = {
909 .name = "sclk_dac",
910 .enable = exynos4_clksrc_mask_tv_ctrl,
911 .ctrlbit = (1 << 8),
912 },
913 .sources = &clkset_sclk_dac,
914 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 8, .size = 1 },
915};
916
917static struct clksrc_clk clk_sclk_pixel = {
918 .clk = {
919 .name = "sclk_pixel",
920 .parent = &clk_sclk_vpll.clk,
921 },
922 .reg_div = { .reg = S5P_CLKDIV_TV, .shift = 0, .size = 4 },
923};
924
925static struct clk *clkset_sclk_hdmi_list[] = {
926 [0] = &clk_sclk_pixel.clk,
927 [1] = &clk_sclk_hdmiphy,
928};
929
930static struct clksrc_sources clkset_sclk_hdmi = {
931 .sources = clkset_sclk_hdmi_list,
932 .nr_sources = ARRAY_SIZE(clkset_sclk_hdmi_list),
933};
934
935static struct clksrc_clk clk_sclk_hdmi = {
936 .clk = {
937 .name = "sclk_hdmi",
938 .enable = exynos4_clksrc_mask_tv_ctrl,
939 .ctrlbit = (1 << 0),
940 },
941 .sources = &clkset_sclk_hdmi,
942 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 0, .size = 1 },
943};
944
945static struct clk *clkset_sclk_mixer_list[] = {
946 [0] = &clk_sclk_dac.clk,
947 [1] = &clk_sclk_hdmi.clk,
948};
949
950static struct clksrc_sources clkset_sclk_mixer = {
951 .sources = clkset_sclk_mixer_list,
952 .nr_sources = ARRAY_SIZE(clkset_sclk_mixer_list),
953};
954
955static struct clksrc_clk clk_sclk_mixer = {
956 .clk = {
957 .name = "sclk_mixer",
958 .enable = exynos4_clksrc_mask_tv_ctrl,
959 .ctrlbit = (1 << 4),
960 },
961 .sources = &clkset_sclk_mixer,
962 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 4, .size = 1 },
963};
964
965static struct clksrc_clk *sclk_tv[] = {
966 &clk_sclk_dac,
967 &clk_sclk_pixel,
968 &clk_sclk_hdmi,
969 &clk_sclk_mixer,
970};
971
972static struct clksrc_clk clk_dout_mmc0 = {
973 .clk = {
974 .name = "dout_mmc0",
975 },
976 .sources = &clkset_group,
977 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 },
978 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 0, .size = 4 },
979};
980
981static struct clksrc_clk clk_dout_mmc1 = {
982 .clk = {
983 .name = "dout_mmc1",
984 },
985 .sources = &clkset_group,
986 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 },
987 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 16, .size = 4 },
988};
989
990static struct clksrc_clk clk_dout_mmc2 = {
991 .clk = {
992 .name = "dout_mmc2",
993 },
994 .sources = &clkset_group,
995 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 },
996 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 0, .size = 4 },
997};
998
999static struct clksrc_clk clk_dout_mmc3 = {
1000 .clk = {
1001 .name = "dout_mmc3",
1002 },
1003 .sources = &clkset_group,
1004 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 },
1005 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 16, .size = 4 },
1006};
1007
1008static struct clksrc_clk clk_dout_mmc4 = {
1009 .clk = {
1010 .name = "dout_mmc4",
1011 },
1012 .sources = &clkset_group,
1013 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 },
1014 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 0, .size = 4 },
1015};
1016
1017static struct clksrc_clk clksrcs[] = {
1018 {
1019 .clk = {
1020 .name = "sclk_pwm",
1021 .enable = exynos4_clksrc_mask_peril0_ctrl,
1022 .ctrlbit = (1 << 24),
1023 },
1024 .sources = &clkset_group,
1025 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 },
1026 .reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 },
1027 }, {
1028 .clk = {
1029 .name = "sclk_csis",
1030 .devname = "s5p-mipi-csis.0",
1031 .enable = exynos4_clksrc_mask_cam_ctrl,
1032 .ctrlbit = (1 << 24),
1033 },
1034 .sources = &clkset_group,
1035 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 24, .size = 4 },
1036 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 24, .size = 4 },
1037 }, {
1038 .clk = {
1039 .name = "sclk_csis",
1040 .devname = "s5p-mipi-csis.1",
1041 .enable = exynos4_clksrc_mask_cam_ctrl,
1042 .ctrlbit = (1 << 28),
1043 },
1044 .sources = &clkset_group,
1045 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 28, .size = 4 },
1046 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 },
1047 }, {
1048 .clk = {
1049 .name = "sclk_cam0",
1050 .enable = exynos4_clksrc_mask_cam_ctrl,
1051 .ctrlbit = (1 << 16),
1052 },
1053 .sources = &clkset_group,
1054 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 16, .size = 4 },
1055 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 },
1056 }, {
1057 .clk = {
1058 .name = "sclk_cam1",
1059 .enable = exynos4_clksrc_mask_cam_ctrl,
1060 .ctrlbit = (1 << 20),
1061 },
1062 .sources = &clkset_group,
1063 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 20, .size = 4 },
1064 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 20, .size = 4 },
1065 }, {
1066 .clk = {
1067 .name = "sclk_fimc",
1068 .devname = "exynos4-fimc.0",
1069 .enable = exynos4_clksrc_mask_cam_ctrl,
1070 .ctrlbit = (1 << 0),
1071 },
1072 .sources = &clkset_group,
1073 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 0, .size = 4 },
1074 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 0, .size = 4 },
1075 }, {
1076 .clk = {
1077 .name = "sclk_fimc",
1078 .devname = "exynos4-fimc.1",
1079 .enable = exynos4_clksrc_mask_cam_ctrl,
1080 .ctrlbit = (1 << 4),
1081 },
1082 .sources = &clkset_group,
1083 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 4, .size = 4 },
1084 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 4, .size = 4 },
1085 }, {
1086 .clk = {
1087 .name = "sclk_fimc",
1088 .devname = "exynos4-fimc.2",
1089 .enable = exynos4_clksrc_mask_cam_ctrl,
1090 .ctrlbit = (1 << 8),
1091 },
1092 .sources = &clkset_group,
1093 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 8, .size = 4 },
1094 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 8, .size = 4 },
1095 }, {
1096 .clk = {
1097 .name = "sclk_fimc",
1098 .devname = "exynos4-fimc.3",
1099 .enable = exynos4_clksrc_mask_cam_ctrl,
1100 .ctrlbit = (1 << 12),
1101 },
1102 .sources = &clkset_group,
1103 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 12, .size = 4 },
1104 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 12, .size = 4 },
1105 }, {
1106 .clk = {
1107 .name = "sclk_fimd",
1108 .devname = "exynos4-fb.0",
1109 .enable = exynos4_clksrc_mask_lcd0_ctrl,
1110 .ctrlbit = (1 << 0),
1111 },
1112 .sources = &clkset_group,
1113 .reg_src = { .reg = S5P_CLKSRC_LCD0, .shift = 0, .size = 4 },
1114 .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 },
1115 }, {
1116 .clk = {
1117 .name = "sclk_fimg2d",
1118 },
1119 .sources = &clkset_mout_g2d,
1120 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 },
1121 .reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 },
1122 }, {
1123 .clk = {
1124 .name = "sclk_mfc",
1125 .devname = "s5p-mfc",
1126 },
1127 .sources = &clkset_mout_mfc,
1128 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 8, .size = 1 },
1129 .reg_div = { .reg = S5P_CLKDIV_MFC, .shift = 0, .size = 4 },
1130 }, {
1131 .clk = {
1132 .name = "sclk_dwmmc",
1133 .parent = &clk_dout_mmc4.clk,
1134 .enable = exynos4_clksrc_mask_fsys_ctrl,
1135 .ctrlbit = (1 << 16),
1136 },
1137 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 8, .size = 8 },
1138 }
1139};
1140
1141static struct clksrc_clk clk_sclk_uart0 = {
1142 .clk = {
1143 .name = "uclk1",
1144 .devname = "exynos4210-uart.0",
1145 .enable = exynos4_clksrc_mask_peril0_ctrl,
1146 .ctrlbit = (1 << 0),
1147 },
1148 .sources = &clkset_group,
1149 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 0, .size = 4 },
1150 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 0, .size = 4 },
1151};
1152
1153static struct clksrc_clk clk_sclk_uart1 = {
1154 .clk = {
1155 .name = "uclk1",
1156 .devname = "exynos4210-uart.1",
1157 .enable = exynos4_clksrc_mask_peril0_ctrl,
1158 .ctrlbit = (1 << 4),
1159 },
1160 .sources = &clkset_group,
1161 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 4, .size = 4 },
1162 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 4, .size = 4 },
1163};
1164
1165static struct clksrc_clk clk_sclk_uart2 = {
1166 .clk = {
1167 .name = "uclk1",
1168 .devname = "exynos4210-uart.2",
1169 .enable = exynos4_clksrc_mask_peril0_ctrl,
1170 .ctrlbit = (1 << 8),
1171 },
1172 .sources = &clkset_group,
1173 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 8, .size = 4 },
1174 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 8, .size = 4 },
1175};
1176
1177static struct clksrc_clk clk_sclk_uart3 = {
1178 .clk = {
1179 .name = "uclk1",
1180 .devname = "exynos4210-uart.3",
1181 .enable = exynos4_clksrc_mask_peril0_ctrl,
1182 .ctrlbit = (1 << 12),
1183 },
1184 .sources = &clkset_group,
1185 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 12, .size = 4 },
1186 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 12, .size = 4 },
1187};
1188
1189static struct clksrc_clk clk_sclk_mmc0 = {
1190 .clk = {
1191 .name = "sclk_mmc",
1192 .devname = "s3c-sdhci.0",
1193 .parent = &clk_dout_mmc0.clk,
1194 .enable = exynos4_clksrc_mask_fsys_ctrl,
1195 .ctrlbit = (1 << 0),
1196 },
1197 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 8, .size = 8 },
1198};
1199
1200static struct clksrc_clk clk_sclk_mmc1 = {
1201 .clk = {
1202 .name = "sclk_mmc",
1203 .devname = "s3c-sdhci.1",
1204 .parent = &clk_dout_mmc1.clk,
1205 .enable = exynos4_clksrc_mask_fsys_ctrl,
1206 .ctrlbit = (1 << 4),
1207 },
1208 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 24, .size = 8 },
1209};
1210
1211static struct clksrc_clk clk_sclk_mmc2 = {
1212 .clk = {
1213 .name = "sclk_mmc",
1214 .devname = "s3c-sdhci.2",
1215 .parent = &clk_dout_mmc2.clk,
1216 .enable = exynos4_clksrc_mask_fsys_ctrl,
1217 .ctrlbit = (1 << 8),
1218 },
1219 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 8, .size = 8 },
1220};
1221
1222static struct clksrc_clk clk_sclk_mmc3 = {
1223 .clk = {
1224 .name = "sclk_mmc",
1225 .devname = "s3c-sdhci.3",
1226 .parent = &clk_dout_mmc3.clk,
1227 .enable = exynos4_clksrc_mask_fsys_ctrl,
1228 .ctrlbit = (1 << 12),
1229 },
1230 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1231};
1232
1233static struct clksrc_clk clk_sclk_spi0 = {
1234 .clk = {
1235 .name = "sclk_spi",
1236 .devname = "s3c64xx-spi.0",
1237 .enable = exynos4_clksrc_mask_peril1_ctrl,
1238 .ctrlbit = (1 << 16),
1239 },
1240 .sources = &clkset_group,
1241 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 16, .size = 4 },
1242 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 0, .size = 4 },
1243};
1244
1245static struct clksrc_clk clk_sclk_spi1 = {
1246 .clk = {
1247 .name = "sclk_spi",
1248 .devname = "s3c64xx-spi.1",
1249 .enable = exynos4_clksrc_mask_peril1_ctrl,
1250 .ctrlbit = (1 << 20),
1251 },
1252 .sources = &clkset_group,
1253 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 20, .size = 4 },
1254 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 16, .size = 4 },
1255};
1256
1257static struct clksrc_clk clk_sclk_spi2 = {
1258 .clk = {
1259 .name = "sclk_spi",
1260 .devname = "s3c64xx-spi.2",
1261 .enable = exynos4_clksrc_mask_peril1_ctrl,
1262 .ctrlbit = (1 << 24),
1263 },
1264 .sources = &clkset_group,
1265 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 24, .size = 4 },
1266 .reg_div = { .reg = S5P_CLKDIV_PERIL2, .shift = 0, .size = 4 },
1267};
1268
1269/* Clock initialization code */
1270static struct clksrc_clk *sysclks[] = {
1271 &clk_mout_apll,
1272 &clk_sclk_apll,
1273 &clk_mout_epll,
1274 &clk_mout_mpll,
1275 &clk_moutcore,
1276 &clk_coreclk,
1277 &clk_armclk,
1278 &clk_aclk_corem0,
1279 &clk_aclk_cores,
1280 &clk_aclk_corem1,
1281 &clk_periphclk,
1282 &clk_mout_corebus,
1283 &clk_sclk_dmc,
1284 &clk_aclk_cored,
1285 &clk_aclk_corep,
1286 &clk_aclk_acp,
1287 &clk_pclk_acp,
1288 &clk_vpllsrc,
1289 &clk_sclk_vpll,
1290 &clk_aclk_200,
1291 &clk_aclk_100,
1292 &clk_aclk_160,
1293 &clk_aclk_133,
1294 &clk_dout_mmc0,
1295 &clk_dout_mmc1,
1296 &clk_dout_mmc2,
1297 &clk_dout_mmc3,
1298 &clk_dout_mmc4,
1299 &clk_mout_mfc0,
1300 &clk_mout_mfc1,
1301};
1302
1303static struct clk *clk_cdev[] = {
1304 &clk_pdma0,
1305 &clk_pdma1,
1306};
1307
1308static struct clksrc_clk *clksrc_cdev[] = {
1309 &clk_sclk_uart0,
1310 &clk_sclk_uart1,
1311 &clk_sclk_uart2,
1312 &clk_sclk_uart3,
1313 &clk_sclk_mmc0,
1314 &clk_sclk_mmc1,
1315 &clk_sclk_mmc2,
1316 &clk_sclk_mmc3,
1317 &clk_sclk_spi0,
1318 &clk_sclk_spi1,
1319 &clk_sclk_spi2,
1320
1321};
1322
1323static struct clk_lookup exynos4_clk_lookup[] = {
1324 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &clk_sclk_uart0.clk),
1325 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &clk_sclk_uart1.clk),
1326 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &clk_sclk_uart2.clk),
1327 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &clk_sclk_uart3.clk),
1328 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
1329 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
1330 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
1331 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk),
1332 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &clk_pdma0),
1333 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &clk_pdma1),
1334 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &clk_sclk_spi0.clk),
1335 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &clk_sclk_spi1.clk),
1336 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &clk_sclk_spi2.clk),
1337};
1338
1339static int xtal_rate;
1340
1341static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
1342{
1343 if (soc_is_exynos4210())
1344 return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0),
1345 pll_4508);
1346 else if (soc_is_exynos4212() || soc_is_exynos4412())
1347 return s5p_get_pll35xx(xtal_rate, __raw_readl(S5P_APLL_CON0));
1348 else
1349 return 0;
1350}
1351
1352static struct clk_ops exynos4_fout_apll_ops = {
1353 .get_rate = exynos4_fout_apll_get_rate,
1354};
1355
1356static u32 vpll_div[][8] = {
1357 { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
1358 { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
1359};
1360
1361static unsigned long exynos4_vpll_get_rate(struct clk *clk)
1362{
1363 return clk->rate;
1364}
1365
1366static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate)
1367{
1368 unsigned int vpll_con0, vpll_con1 = 0;
1369 unsigned int i;
1370
1371 /* Return if nothing changed */
1372 if (clk->rate == rate)
1373 return 0;
1374
1375 vpll_con0 = __raw_readl(S5P_VPLL_CON0);
1376 vpll_con0 &= ~(0x1 << 27 | \
1377 PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1378 PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1379 PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1380
1381 vpll_con1 = __raw_readl(S5P_VPLL_CON1);
1382 vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \
1383 PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \
1384 PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT);
1385
1386 for (i = 0; i < ARRAY_SIZE(vpll_div); i++) {
1387 if (vpll_div[i][0] == rate) {
1388 vpll_con0 |= vpll_div[i][1] << PLL46XX_PDIV_SHIFT;
1389 vpll_con0 |= vpll_div[i][2] << PLL46XX_MDIV_SHIFT;
1390 vpll_con0 |= vpll_div[i][3] << PLL46XX_SDIV_SHIFT;
1391 vpll_con1 |= vpll_div[i][4] << PLL46XX_KDIV_SHIFT;
1392 vpll_con1 |= vpll_div[i][5] << PLL46XX_MFR_SHIFT;
1393 vpll_con1 |= vpll_div[i][6] << PLL46XX_MRR_SHIFT;
1394 vpll_con0 |= vpll_div[i][7] << 27;
1395 break;
1396 }
1397 }
1398
1399 if (i == ARRAY_SIZE(vpll_div)) {
1400 printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n",
1401 __func__);
1402 return -EINVAL;
1403 }
1404
1405 __raw_writel(vpll_con0, S5P_VPLL_CON0);
1406 __raw_writel(vpll_con1, S5P_VPLL_CON1);
1407
1408 /* Wait for VPLL lock */
1409 while (!(__raw_readl(S5P_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT)))
1410 continue;
1411
1412 clk->rate = rate;
1413 return 0;
1414}
1415
1416static struct clk_ops exynos4_vpll_ops = {
1417 .get_rate = exynos4_vpll_get_rate,
1418 .set_rate = exynos4_vpll_set_rate,
1419};
1420
1421void __init_or_cpufreq exynos4_setup_clocks(void)
1422{
1423 struct clk *xtal_clk;
1424 unsigned long apll = 0;
1425 unsigned long mpll = 0;
1426 unsigned long epll = 0;
1427 unsigned long vpll = 0;
1428 unsigned long vpllsrc;
1429 unsigned long xtal;
1430 unsigned long armclk;
1431 unsigned long sclk_dmc;
1432 unsigned long aclk_200;
1433 unsigned long aclk_100;
1434 unsigned long aclk_160;
1435 unsigned long aclk_133;
1436 unsigned int ptr;
1437
1438 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1439
1440 xtal_clk = clk_get(NULL, "xtal");
1441 BUG_ON(IS_ERR(xtal_clk));
1442
1443 xtal = clk_get_rate(xtal_clk);
1444
1445 xtal_rate = xtal;
1446
1447 clk_put(xtal_clk);
1448
1449 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1450
1451 if (soc_is_exynos4210()) {
1452 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0),
1453 pll_4508);
1454 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0),
1455 pll_4508);
1456 epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0),
1457 __raw_readl(S5P_EPLL_CON1), pll_4600);
1458
1459 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1460 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1461 __raw_readl(S5P_VPLL_CON1), pll_4650c);
1462 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
1463 apll = s5p_get_pll35xx(xtal, __raw_readl(S5P_APLL_CON0));
1464 mpll = s5p_get_pll35xx(xtal, __raw_readl(S5P_MPLL_CON0));
1465 epll = s5p_get_pll36xx(xtal, __raw_readl(S5P_EPLL_CON0),
1466 __raw_readl(S5P_EPLL_CON1));
1467
1468 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1469 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1470 __raw_readl(S5P_VPLL_CON1));
1471 } else {
1472 /* nothing */
1473 }
1474
1475 clk_fout_apll.ops = &exynos4_fout_apll_ops;
1476 clk_fout_mpll.rate = mpll;
1477 clk_fout_epll.rate = epll;
1478 clk_fout_vpll.ops = &exynos4_vpll_ops;
1479 clk_fout_vpll.rate = vpll;
1480
1481 printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
1482 apll, mpll, epll, vpll);
1483
1484 armclk = clk_get_rate(&clk_armclk.clk);
1485 sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk);
1486
1487 aclk_200 = clk_get_rate(&clk_aclk_200.clk);
1488 aclk_100 = clk_get_rate(&clk_aclk_100.clk);
1489 aclk_160 = clk_get_rate(&clk_aclk_160.clk);
1490 aclk_133 = clk_get_rate(&clk_aclk_133.clk);
1491
1492 printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
1493 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1494 armclk, sclk_dmc, aclk_200,
1495 aclk_100, aclk_160, aclk_133);
1496
1497 clk_f.rate = armclk;
1498 clk_h.rate = sclk_dmc;
1499 clk_p.rate = aclk_100;
1500
1501 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
1502 s3c_set_clksrc(&clksrcs[ptr], true);
1503}
1504
1505static struct clk *clks[] __initdata = {
1506 &clk_sclk_hdmi27m,
1507 &clk_sclk_hdmiphy,
1508 &clk_sclk_usbphy0,
1509 &clk_sclk_usbphy1,
1510};
1511
1512#ifdef CONFIG_PM_SLEEP
1513static int exynos4_clock_suspend(void)
1514{
1515 s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1516 return 0;
1517}
1518
1519static void exynos4_clock_resume(void)
1520{
1521 s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1522}
1523
1524#else
1525#define exynos4_clock_suspend NULL
1526#define exynos4_clock_resume NULL
1527#endif
1528
1529struct syscore_ops exynos4_clock_syscore_ops = {
1530 .suspend = exynos4_clock_suspend,
1531 .resume = exynos4_clock_resume,
1532};
1533
1534void __init exynos4_register_clocks(void)
1535{
1536 int ptr;
1537
1538 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1539
1540 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1541 s3c_register_clksrc(sysclks[ptr], 1);
1542
1543 for (ptr = 0; ptr < ARRAY_SIZE(sclk_tv); ptr++)
1544 s3c_register_clksrc(sclk_tv[ptr], 1);
1545
1546 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
1547 s3c_register_clksrc(clksrc_cdev[ptr], 1);
1548
1549 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1550 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1551
1552 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
1553 for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++)
1554 s3c_disable_clocks(clk_cdev[ptr], 1);
1555
1556 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1557 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1558 clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup));
1559
1560 register_syscore_ops(&exynos4_clock_syscore_ops);
1561 s3c24xx_register_clock(&dummy_apb_pclk);
1562
1563 s3c_pwmclk_init();
1564}
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 6de298c5d2d..97ca2592ce8 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -26,10 +26,12 @@
26#include <asm/hardware/gic.h> 26#include <asm/hardware/gic.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29#include <asm/cacheflush.h>
29 30
30#include <mach/regs-irq.h> 31#include <mach/regs-irq.h>
31#include <mach/regs-pmu.h> 32#include <mach/regs-pmu.h>
32#include <mach/regs-gpio.h> 33#include <mach/regs-gpio.h>
34#include <mach/pmu.h>
33 35
34#include <plat/cpu.h> 36#include <plat/cpu.h>
35#include <plat/clock.h> 37#include <plat/clock.h>
@@ -45,6 +47,8 @@
45#include <plat/regs-serial.h> 47#include <plat/regs-serial.h>
46 48
47#include "common.h" 49#include "common.h"
50#define L2_AUX_VAL 0x7C470001
51#define L2_AUX_MASK 0xC200ffff
48 52
49static const char name_exynos4210[] = "EXYNOS4210"; 53static const char name_exynos4210[] = "EXYNOS4210";
50static const char name_exynos4212[] = "EXYNOS4212"; 54static const char name_exynos4212[] = "EXYNOS4212";
@@ -173,7 +177,12 @@ static struct map_desc exynos4_iodesc[] __initdata = {
173 }, { 177 }, {
174 .virtual = (unsigned long)S5P_VA_DMC0, 178 .virtual = (unsigned long)S5P_VA_DMC0,
175 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0), 179 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0),
176 .length = SZ_4K, 180 .length = SZ_64K,
181 .type = MT_DEVICE,
182 }, {
183 .virtual = (unsigned long)S5P_VA_DMC1,
184 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC1),
185 .length = SZ_64K,
177 .type = MT_DEVICE, 186 .type = MT_DEVICE,
178 }, { 187 }, {
179 .virtual = (unsigned long)S3C_VA_USB_HSPHY, 188 .virtual = (unsigned long)S3C_VA_USB_HSPHY,
@@ -201,14 +210,6 @@ static struct map_desc exynos4_iodesc1[] __initdata = {
201 }, 210 },
202}; 211};
203 212
204static void exynos_idle(void)
205{
206 if (!need_resched())
207 cpu_do_idle();
208
209 local_irq_enable();
210}
211
212void exynos4_restart(char mode, const char *cmd) 213void exynos4_restart(char mode, const char *cmd)
213{ 214{
214 __raw_writel(0x1, S5P_SWRESET); 215 __raw_writel(0x1, S5P_SWRESET);
@@ -441,23 +442,48 @@ core_initcall(exynos4_core_init);
441#ifdef CONFIG_CACHE_L2X0 442#ifdef CONFIG_CACHE_L2X0
442static int __init exynos4_l2x0_cache_init(void) 443static int __init exynos4_l2x0_cache_init(void)
443{ 444{
444 /* TAG, Data Latency Control: 2cycle */ 445 int ret;
445 __raw_writel(0x110, S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL); 446 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
447 if (!ret) {
448 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
449 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
450 return 0;
451 }
446 452
447 if (soc_is_exynos4210()) 453 if (!(__raw_readl(S5P_VA_L2CC + L2X0_CTRL) & 0x1)) {
448 __raw_writel(0x110, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL); 454 l2x0_saved_regs.phy_base = EXYNOS4_PA_L2CC;
449 else if (soc_is_exynos4212() || soc_is_exynos4412()) 455 /* TAG, Data Latency Control: 2 cycles */
450 __raw_writel(0x120, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL); 456 l2x0_saved_regs.tag_latency = 0x110;
457
458 if (soc_is_exynos4212() || soc_is_exynos4412())
459 l2x0_saved_regs.data_latency = 0x120;
460 else
461 l2x0_saved_regs.data_latency = 0x110;
462
463 l2x0_saved_regs.prefetch_ctrl = 0x30000007;
464 l2x0_saved_regs.pwr_ctrl =
465 (L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN);
466
467 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
451 468
452 /* L2X0 Prefetch Control */ 469 __raw_writel(l2x0_saved_regs.tag_latency,
453 __raw_writel(0x30000007, S5P_VA_L2CC + L2X0_PREFETCH_CTRL); 470 S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
471 __raw_writel(l2x0_saved_regs.data_latency,
472 S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
454 473
455 /* L2X0 Power Control */ 474 /* L2X0 Prefetch Control */
456 __raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN, 475 __raw_writel(l2x0_saved_regs.prefetch_ctrl,
457 S5P_VA_L2CC + L2X0_POWER_CTRL); 476 S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
458 477
459 l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200ffff); 478 /* L2X0 Power Control */
479 __raw_writel(l2x0_saved_regs.pwr_ctrl,
480 S5P_VA_L2CC + L2X0_POWER_CTRL);
460 481
482 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
483 clean_dcache_area(&l2x0_saved_regs, sizeof(struct l2x0_regs));
484 }
485
486 l2x0_init(S5P_VA_L2CC, L2_AUX_VAL, L2_AUX_MASK);
461 return 0; 487 return 0;
462} 488}
463 489
@@ -467,10 +493,6 @@ early_initcall(exynos4_l2x0_cache_init);
467int __init exynos_init(void) 493int __init exynos_init(void)
468{ 494{
469 printk(KERN_INFO "EXYNOS: Initializing architecture\n"); 495 printk(KERN_INFO "EXYNOS: Initializing architecture\n");
470
471 /* set idle function */
472 pm_idle = exynos_idle;
473
474 return device_register(&exynos4_dev); 496 return device_register(&exynos4_dev);
475} 497}
476 498
@@ -673,7 +695,7 @@ static void exynos4_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
673 chained_irq_exit(chip, desc); 695 chained_irq_exit(chip, desc);
674} 696}
675 697
676int __init exynos4_init_irq_eint(void) 698static int __init exynos4_init_irq_eint(void)
677{ 699{
678 int irq; 700 int irq;
679 701
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 1ac49de0f39..8c1efe692c2 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -15,12 +15,21 @@
15void exynos_init_io(struct map_desc *mach_desc, int size); 15void exynos_init_io(struct map_desc *mach_desc, int size);
16void exynos4_init_irq(void); 16void exynos4_init_irq(void);
17 17
18#ifdef CONFIG_ARCH_EXYNOS4
18void exynos4_register_clocks(void); 19void exynos4_register_clocks(void);
19void exynos4_setup_clocks(void); 20void exynos4_setup_clocks(void);
20 21
21void exynos4210_register_clocks(void); 22void exynos4210_register_clocks(void);
22void exynos4212_register_clocks(void); 23void exynos4212_register_clocks(void);
23 24
25#else
26#define exynos4_register_clocks()
27#define exynos4_setup_clocks()
28
29#define exynos4210_register_clocks()
30#define exynos4212_register_clocks()
31#endif
32
24void exynos4_restart(char mode, const char *cmd); 33void exynos4_restart(char mode, const char *cmd);
25 34
26extern struct sys_timer exynos4_timer; 35extern struct sys_timer exynos4_timer;
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index 4ebb382c597..33ab4e7558a 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -11,25 +11,53 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/cpuidle.h> 13#include <linux/cpuidle.h>
14#include <linux/cpu_pm.h>
14#include <linux/io.h> 15#include <linux/io.h>
15#include <linux/export.h> 16#include <linux/export.h>
16#include <linux/time.h> 17#include <linux/time.h>
17 18
18#include <asm/proc-fns.h> 19#include <asm/proc-fns.h>
20#include <asm/smp_scu.h>
21#include <asm/suspend.h>
22#include <asm/unified.h>
23#include <mach/regs-pmu.h>
24#include <mach/pmu.h>
25
26#include <plat/cpu.h>
27
28#define REG_DIRECTGO_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \
29 S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
30 (S5P_VA_SYSRAM + 0x24) : S5P_INFORM0))
31#define REG_DIRECTGO_FLAG (samsung_rev() == EXYNOS4210_REV_1_1 ? \
32 S5P_INFORM6 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
33 (S5P_VA_SYSRAM + 0x20) : S5P_INFORM1))
34
35#define S5P_CHECK_AFTR 0xFCBA0D10
19 36
20static int exynos4_enter_idle(struct cpuidle_device *dev, 37static int exynos4_enter_idle(struct cpuidle_device *dev,
21 struct cpuidle_driver *drv, 38 struct cpuidle_driver *drv,
22 int index); 39 int index);
40static int exynos4_enter_lowpower(struct cpuidle_device *dev,
41 struct cpuidle_driver *drv,
42 int index);
23 43
24static struct cpuidle_state exynos4_cpuidle_set[] = { 44static struct cpuidle_state exynos4_cpuidle_set[] __initdata = {
25 [0] = { 45 [0] = {
26 .enter = exynos4_enter_idle, 46 .enter = exynos4_enter_idle,
27 .exit_latency = 1, 47 .exit_latency = 1,
28 .target_residency = 100000, 48 .target_residency = 100000,
29 .flags = CPUIDLE_FLAG_TIME_VALID, 49 .flags = CPUIDLE_FLAG_TIME_VALID,
30 .name = "IDLE", 50 .name = "C0",
31 .desc = "ARM clock gating(WFI)", 51 .desc = "ARM clock gating(WFI)",
32 }, 52 },
53 [1] = {
54 .enter = exynos4_enter_lowpower,
55 .exit_latency = 300,
56 .target_residency = 100000,
57 .flags = CPUIDLE_FLAG_TIME_VALID,
58 .name = "C1",
59 .desc = "ARM power down",
60 },
33}; 61};
34 62
35static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); 63static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device);
@@ -39,9 +67,102 @@ static struct cpuidle_driver exynos4_idle_driver = {
39 .owner = THIS_MODULE, 67 .owner = THIS_MODULE,
40}; 68};
41 69
70/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
71static void exynos4_set_wakeupmask(void)
72{
73 __raw_writel(0x0000ff3e, S5P_WAKEUP_MASK);
74}
75
76static unsigned int g_pwr_ctrl, g_diag_reg;
77
78static void save_cpu_arch_register(void)
79{
80 /*read power control register*/
81 asm("mrc p15, 0, %0, c15, c0, 0" : "=r"(g_pwr_ctrl) : : "cc");
82 /*read diagnostic register*/
83 asm("mrc p15, 0, %0, c15, c0, 1" : "=r"(g_diag_reg) : : "cc");
84 return;
85}
86
87static void restore_cpu_arch_register(void)
88{
89 /*write power control register*/
90 asm("mcr p15, 0, %0, c15, c0, 0" : : "r"(g_pwr_ctrl) : "cc");
91 /*write diagnostic register*/
92 asm("mcr p15, 0, %0, c15, c0, 1" : : "r"(g_diag_reg) : "cc");
93 return;
94}
95
96static int idle_finisher(unsigned long flags)
97{
98 cpu_do_idle();
99 return 1;
100}
101
102static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
103 struct cpuidle_driver *drv,
104 int index)
105{
106 struct timeval before, after;
107 int idle_time;
108 unsigned long tmp;
109
110 local_irq_disable();
111 do_gettimeofday(&before);
112
113 exynos4_set_wakeupmask();
114
115 /* Set value of power down register for aftr mode */
116 exynos4_sys_powerdown_conf(SYS_AFTR);
117
118 __raw_writel(virt_to_phys(s3c_cpu_resume), REG_DIRECTGO_ADDR);
119 __raw_writel(S5P_CHECK_AFTR, REG_DIRECTGO_FLAG);
120
121 save_cpu_arch_register();
122
123 /* Setting Central Sequence Register for power down mode */
124 tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
125 tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
126 __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
127
128 cpu_pm_enter();
129 cpu_suspend(0, idle_finisher);
130
131#ifdef CONFIG_SMP
132 scu_enable(S5P_VA_SCU);
133#endif
134 cpu_pm_exit();
135
136 restore_cpu_arch_register();
137
138 /*
139 * If PMU failed while entering sleep mode, WFI will be
140 * ignored by PMU and then exiting cpu_do_idle().
141 * S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically
142 * in this situation.
143 */
144 tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
145 if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) {
146 tmp |= S5P_CENTRAL_LOWPWR_CFG;
147 __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
148 }
149
150 /* Clear wakeup state register */
151 __raw_writel(0x0, S5P_WAKEUP_STAT);
152
153 do_gettimeofday(&after);
154
155 local_irq_enable();
156 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
157 (after.tv_usec - before.tv_usec);
158
159 dev->last_residency = idle_time;
160 return index;
161}
162
42static int exynos4_enter_idle(struct cpuidle_device *dev, 163static int exynos4_enter_idle(struct cpuidle_device *dev,
43 struct cpuidle_driver *drv, 164 struct cpuidle_driver *drv,
44 int index) 165 int index)
45{ 166{
46 struct timeval before, after; 167 struct timeval before, after;
47 int idle_time; 168 int idle_time;
@@ -60,6 +181,22 @@ static int exynos4_enter_idle(struct cpuidle_device *dev,
60 return index; 181 return index;
61} 182}
62 183
184static int exynos4_enter_lowpower(struct cpuidle_device *dev,
185 struct cpuidle_driver *drv,
186 int index)
187{
188 int new_index = index;
189
190 /* This mode only can be entered when other core's are offline */
191 if (num_online_cpus() > 1)
192 new_index = drv->safe_state_index;
193
194 if (new_index == 0)
195 return exynos4_enter_idle(dev, drv, new_index);
196 else
197 return exynos4_enter_core0_aftr(dev, drv, new_index);
198}
199
63static int __init exynos4_init_cpuidle(void) 200static int __init exynos4_init_cpuidle(void)
64{ 201{
65 int i, max_cpuidle_state, cpu_id; 202 int i, max_cpuidle_state, cpu_id;
@@ -74,19 +211,25 @@ static int __init exynos4_init_cpuidle(void)
74 memcpy(&drv->states[i], &exynos4_cpuidle_set[i], 211 memcpy(&drv->states[i], &exynos4_cpuidle_set[i],
75 sizeof(struct cpuidle_state)); 212 sizeof(struct cpuidle_state));
76 } 213 }
214 drv->safe_state_index = 0;
77 cpuidle_register_driver(&exynos4_idle_driver); 215 cpuidle_register_driver(&exynos4_idle_driver);
78 216
79 for_each_cpu(cpu_id, cpu_online_mask) { 217 for_each_cpu(cpu_id, cpu_online_mask) {
80 device = &per_cpu(exynos4_cpuidle_device, cpu_id); 218 device = &per_cpu(exynos4_cpuidle_device, cpu_id);
81 device->cpu = cpu_id; 219 device->cpu = cpu_id;
82 220
83 device->state_count = drv->state_count; 221 if (cpu_id == 0)
222 device->state_count = (sizeof(exynos4_cpuidle_set) /
223 sizeof(struct cpuidle_state));
224 else
225 device->state_count = 1; /* Support IDLE only */
84 226
85 if (cpuidle_register_device(device)) { 227 if (cpuidle_register_device(device)) {
86 printk(KERN_ERR "CPUidle register device failed\n,"); 228 printk(KERN_ERR "CPUidle register device failed\n,");
87 return -EIO; 229 return -EIO;
88 } 230 }
89 } 231 }
232
90 return 0; 233 return 0;
91} 234}
92device_initcall(exynos4_init_cpuidle); 235device_initcall(exynos4_init_cpuidle);
diff --git a/arch/arm/mach-exynos/dma.c b/arch/arm/mach-exynos/dma.c
index b10fcd270f0..13607c4328b 100644
--- a/arch/arm/mach-exynos/dma.c
+++ b/arch/arm/mach-exynos/dma.c
@@ -29,6 +29,7 @@
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <plat/devs.h> 30#include <plat/devs.h>
31#include <plat/irqs.h> 31#include <plat/irqs.h>
32#include <plat/cpu.h>
32 33
33#include <mach/map.h> 34#include <mach/map.h>
34#include <mach/irqs.h> 35#include <mach/irqs.h>
@@ -36,7 +37,7 @@
36 37
37static u64 dma_dmamask = DMA_BIT_MASK(32); 38static u64 dma_dmamask = DMA_BIT_MASK(32);
38 39
39u8 pdma0_peri[] = { 40static u8 exynos4210_pdma0_peri[] = {
40 DMACH_PCM0_RX, 41 DMACH_PCM0_RX,
41 DMACH_PCM0_TX, 42 DMACH_PCM0_TX,
42 DMACH_PCM2_RX, 43 DMACH_PCM2_RX,
@@ -69,28 +70,47 @@ u8 pdma0_peri[] = {
69 DMACH_AC97_PCMOUT, 70 DMACH_AC97_PCMOUT,
70}; 71};
71 72
72struct dma_pl330_platdata exynos4_pdma0_pdata = { 73static u8 exynos4212_pdma0_peri[] = {
73 .nr_valid_peri = ARRAY_SIZE(pdma0_peri), 74 DMACH_PCM0_RX,
74 .peri_id = pdma0_peri, 75 DMACH_PCM0_TX,
76 DMACH_PCM2_RX,
77 DMACH_PCM2_TX,
78 DMACH_MIPI_HSI0,
79 DMACH_MIPI_HSI1,
80 DMACH_SPI0_RX,
81 DMACH_SPI0_TX,
82 DMACH_SPI2_RX,
83 DMACH_SPI2_TX,
84 DMACH_I2S0S_TX,
85 DMACH_I2S0_RX,
86 DMACH_I2S0_TX,
87 DMACH_I2S2_RX,
88 DMACH_I2S2_TX,
89 DMACH_UART0_RX,
90 DMACH_UART0_TX,
91 DMACH_UART2_RX,
92 DMACH_UART2_TX,
93 DMACH_UART4_RX,
94 DMACH_UART4_TX,
95 DMACH_SLIMBUS0_RX,
96 DMACH_SLIMBUS0_TX,
97 DMACH_SLIMBUS2_RX,
98 DMACH_SLIMBUS2_TX,
99 DMACH_SLIMBUS4_RX,
100 DMACH_SLIMBUS4_TX,
101 DMACH_AC97_MICIN,
102 DMACH_AC97_PCMIN,
103 DMACH_AC97_PCMOUT,
104 DMACH_MIPI_HSI4,
105 DMACH_MIPI_HSI5,
75}; 106};
76 107
77struct amba_device exynos4_device_pdma0 = { 108struct dma_pl330_platdata exynos4_pdma0_pdata;
78 .dev = { 109
79 .init_name = "dma-pl330.0", 110static AMBA_AHB_DEVICE(exynos4_pdma0, "dma-pl330.0", 0x00041330,
80 .dma_mask = &dma_dmamask, 111 EXYNOS4_PA_PDMA0, {IRQ_PDMA0}, &exynos4_pdma0_pdata);
81 .coherent_dma_mask = DMA_BIT_MASK(32),
82 .platform_data = &exynos4_pdma0_pdata,
83 },
84 .res = {
85 .start = EXYNOS4_PA_PDMA0,
86 .end = EXYNOS4_PA_PDMA0 + SZ_4K,
87 .flags = IORESOURCE_MEM,
88 },
89 .irq = {IRQ_PDMA0, NO_IRQ},
90 .periphid = 0x00041330,
91};
92 112
93u8 pdma1_peri[] = { 113static u8 exynos4210_pdma1_peri[] = {
94 DMACH_PCM0_RX, 114 DMACH_PCM0_RX,
95 DMACH_PCM0_TX, 115 DMACH_PCM0_TX,
96 DMACH_PCM1_RX, 116 DMACH_PCM1_RX,
@@ -118,39 +138,94 @@ u8 pdma1_peri[] = {
118 DMACH_SLIMBUS5_TX, 138 DMACH_SLIMBUS5_TX,
119}; 139};
120 140
121struct dma_pl330_platdata exynos4_pdma1_pdata = { 141static u8 exynos4212_pdma1_peri[] = {
122 .nr_valid_peri = ARRAY_SIZE(pdma1_peri), 142 DMACH_PCM0_RX,
123 .peri_id = pdma1_peri, 143 DMACH_PCM0_TX,
144 DMACH_PCM1_RX,
145 DMACH_PCM1_TX,
146 DMACH_MIPI_HSI2,
147 DMACH_MIPI_HSI3,
148 DMACH_SPI1_RX,
149 DMACH_SPI1_TX,
150 DMACH_I2S0S_TX,
151 DMACH_I2S0_RX,
152 DMACH_I2S0_TX,
153 DMACH_I2S1_RX,
154 DMACH_I2S1_TX,
155 DMACH_UART0_RX,
156 DMACH_UART0_TX,
157 DMACH_UART1_RX,
158 DMACH_UART1_TX,
159 DMACH_UART3_RX,
160 DMACH_UART3_TX,
161 DMACH_SLIMBUS1_RX,
162 DMACH_SLIMBUS1_TX,
163 DMACH_SLIMBUS3_RX,
164 DMACH_SLIMBUS3_TX,
165 DMACH_SLIMBUS5_RX,
166 DMACH_SLIMBUS5_TX,
167 DMACH_SLIMBUS0AUX_RX,
168 DMACH_SLIMBUS0AUX_TX,
169 DMACH_SPDIF,
170 DMACH_MIPI_HSI6,
171 DMACH_MIPI_HSI7,
124}; 172};
125 173
126struct amba_device exynos4_device_pdma1 = { 174static struct dma_pl330_platdata exynos4_pdma1_pdata;
127 .dev = { 175
128 .init_name = "dma-pl330.1", 176static AMBA_AHB_DEVICE(exynos4_pdma1, "dma-pl330.1", 0x00041330,
129 .dma_mask = &dma_dmamask, 177 EXYNOS4_PA_PDMA1, {IRQ_PDMA1}, &exynos4_pdma1_pdata);
130 .coherent_dma_mask = DMA_BIT_MASK(32), 178
131 .platform_data = &exynos4_pdma1_pdata, 179static u8 mdma_peri[] = {
132 }, 180 DMACH_MTOM_0,
133 .res = { 181 DMACH_MTOM_1,
134 .start = EXYNOS4_PA_PDMA1, 182 DMACH_MTOM_2,
135 .end = EXYNOS4_PA_PDMA1 + SZ_4K, 183 DMACH_MTOM_3,
136 .flags = IORESOURCE_MEM, 184 DMACH_MTOM_4,
137 }, 185 DMACH_MTOM_5,
138 .irq = {IRQ_PDMA1, NO_IRQ}, 186 DMACH_MTOM_6,
139 .periphid = 0x00041330, 187 DMACH_MTOM_7,
188};
189
190static struct dma_pl330_platdata exynos4_mdma1_pdata = {
191 .nr_valid_peri = ARRAY_SIZE(mdma_peri),
192 .peri_id = mdma_peri,
140}; 193};
141 194
195static AMBA_AHB_DEVICE(exynos4_mdma1, "dma-pl330.2", 0x00041330,
196 EXYNOS4_PA_MDMA1, {IRQ_MDMA1}, &exynos4_mdma1_pdata);
197
142static int __init exynos4_dma_init(void) 198static int __init exynos4_dma_init(void)
143{ 199{
144 if (of_have_populated_dt()) 200 if (of_have_populated_dt())
145 return 0; 201 return 0;
146 202
203 if (soc_is_exynos4210()) {
204 exynos4_pdma0_pdata.nr_valid_peri =
205 ARRAY_SIZE(exynos4210_pdma0_peri);
206 exynos4_pdma0_pdata.peri_id = exynos4210_pdma0_peri;
207 exynos4_pdma1_pdata.nr_valid_peri =
208 ARRAY_SIZE(exynos4210_pdma1_peri);
209 exynos4_pdma1_pdata.peri_id = exynos4210_pdma1_peri;
210 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
211 exynos4_pdma0_pdata.nr_valid_peri =
212 ARRAY_SIZE(exynos4212_pdma0_peri);
213 exynos4_pdma0_pdata.peri_id = exynos4212_pdma0_peri;
214 exynos4_pdma1_pdata.nr_valid_peri =
215 ARRAY_SIZE(exynos4212_pdma1_peri);
216 exynos4_pdma1_pdata.peri_id = exynos4212_pdma1_peri;
217 }
218
147 dma_cap_set(DMA_SLAVE, exynos4_pdma0_pdata.cap_mask); 219 dma_cap_set(DMA_SLAVE, exynos4_pdma0_pdata.cap_mask);
148 dma_cap_set(DMA_CYCLIC, exynos4_pdma0_pdata.cap_mask); 220 dma_cap_set(DMA_CYCLIC, exynos4_pdma0_pdata.cap_mask);
149 amba_device_register(&exynos4_device_pdma0, &iomem_resource); 221 amba_device_register(&exynos4_pdma0_device, &iomem_resource);
150 222
151 dma_cap_set(DMA_SLAVE, exynos4_pdma1_pdata.cap_mask); 223 dma_cap_set(DMA_SLAVE, exynos4_pdma1_pdata.cap_mask);
152 dma_cap_set(DMA_CYCLIC, exynos4_pdma1_pdata.cap_mask); 224 dma_cap_set(DMA_CYCLIC, exynos4_pdma1_pdata.cap_mask);
153 amba_device_register(&exynos4_device_pdma1, &iomem_resource); 225 amba_device_register(&exynos4_pdma1_device, &iomem_resource);
226
227 dma_cap_set(DMA_MEMCPY, exynos4_mdma1_pdata.cap_mask);
228 amba_device_register(&exynos4_mdma1_device, &iomem_resource);
154 229
155 return 0; 230 return 0;
156} 231}
diff --git a/arch/arm/mach-exynos/include/mach/cpufreq.h b/arch/arm/mach-exynos/include/mach/cpufreq.h
index 3df27f2d503..7517c3f417a 100644
--- a/arch/arm/mach-exynos/include/mach/cpufreq.h
+++ b/arch/arm/mach-exynos/include/mach/cpufreq.h
@@ -32,3 +32,5 @@ struct exynos_dvfs_info {
32}; 32};
33 33
34extern int exynos4210_cpufreq_init(struct exynos_dvfs_info *); 34extern int exynos4210_cpufreq_init(struct exynos_dvfs_info *);
35extern int exynos4x12_cpufreq_init(struct exynos_dvfs_info *);
36extern int exynos5250_cpufreq_init(struct exynos_dvfs_info *);
diff --git a/arch/arm/mach-exynos/include/mach/entry-macro.S b/arch/arm/mach-exynos/include/mach/entry-macro.S
deleted file mode 100644
index 3ba4f547534..00000000000
--- a/arch/arm/mach-exynos/include/mach/entry-macro.S
+++ /dev/null
@@ -1,16 +0,0 @@
1/* arch/arm/mach-exynos4/include/mach/entry-macro.S
2 *
3 * Cloned from arch/arm/mach-realview/include/mach/entry-macro.S
4 *
5 * Low-level IRQ helper macros for EXYNOS4 platforms
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 .macro disable_fiq
13 .endm
14
15 .macro arch_ret_to_user, tmp1, tmp2
16 .endm
diff --git a/arch/arm/mach-exynos/include/mach/exynos4-clock.h b/arch/arm/mach-exynos/include/mach/exynos4-clock.h
deleted file mode 100644
index a07fcbf5525..00000000000
--- a/arch/arm/mach-exynos/include/mach/exynos4-clock.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/include/mach/exynos4-clock.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Header file for exynos4 clock support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_CLOCK_H
15#define __ASM_ARCH_CLOCK_H __FILE__
16
17#include <linux/clk.h>
18
19extern struct clk clk_sclk_hdmi27m;
20extern struct clk clk_sclk_usbphy0;
21extern struct clk clk_sclk_usbphy1;
22extern struct clk clk_sclk_hdmiphy;
23
24extern struct clksrc_clk clk_sclk_apll;
25extern struct clksrc_clk clk_mout_mpll;
26extern struct clksrc_clk clk_aclk_133;
27extern struct clksrc_clk clk_mout_epll;
28extern struct clksrc_clk clk_sclk_vpll;
29
30extern struct clk *clkset_corebus_list[];
31extern struct clksrc_sources clkset_mout_corebus;
32
33extern struct clk *clkset_aclk_top_list[];
34extern struct clksrc_sources clkset_aclk;
35
36extern struct clk *clkset_group_list[];
37extern struct clksrc_sources clkset_group;
38
39extern int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable);
40extern int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable);
41extern int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable);
42
43#endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
index f77bce04789..1d401c95783 100644
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ b/arch/arm/mach-exynos/include/mach/irqs.h
@@ -43,6 +43,8 @@
43#define IRQ_EINT15 IRQ_SPI(31) 43#define IRQ_EINT15 IRQ_SPI(31)
44#define IRQ_EINT16_31 IRQ_SPI(32) 44#define IRQ_EINT16_31 IRQ_SPI(32)
45 45
46#define IRQ_MDMA0 IRQ_SPI(33)
47#define IRQ_MDMA1 IRQ_SPI(34)
46#define IRQ_PDMA0 IRQ_SPI(35) 48#define IRQ_PDMA0 IRQ_SPI(35)
47#define IRQ_PDMA1 IRQ_SPI(36) 49#define IRQ_PDMA1 IRQ_SPI(36)
48#define IRQ_TIMER0_VIC IRQ_SPI(37) 50#define IRQ_TIMER0_VIC IRQ_SPI(37)
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index c754a22a2bb..609127df9b0 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -31,6 +31,10 @@
31#define EXYNOS4_PA_FIMC2 0x11820000 31#define EXYNOS4_PA_FIMC2 0x11820000
32#define EXYNOS4_PA_FIMC3 0x11830000 32#define EXYNOS4_PA_FIMC3 0x11830000
33 33
34#define EXYNOS4_PA_JPEG 0x11840000
35
36#define EXYNOS4_PA_G2D 0x12800000
37
34#define EXYNOS4_PA_I2S0 0x03830000 38#define EXYNOS4_PA_I2S0 0x03830000
35#define EXYNOS4_PA_I2S1 0xE3100000 39#define EXYNOS4_PA_I2S1 0xE3100000
36#define EXYNOS4_PA_I2S2 0xE2A00000 40#define EXYNOS4_PA_I2S2 0xE2A00000
@@ -57,6 +61,7 @@
57#define EXYNOS4_PA_KEYPAD 0x100A0000 61#define EXYNOS4_PA_KEYPAD 0x100A0000
58 62
59#define EXYNOS4_PA_DMC0 0x10400000 63#define EXYNOS4_PA_DMC0 0x10400000
64#define EXYNOS4_PA_DMC1 0x10410000
60 65
61#define EXYNOS4_PA_COMBINER 0x10440000 66#define EXYNOS4_PA_COMBINER 0x10440000
62 67
@@ -67,7 +72,8 @@
67#define EXYNOS4_PA_TWD 0x10500600 72#define EXYNOS4_PA_TWD 0x10500600
68#define EXYNOS4_PA_L2CC 0x10502000 73#define EXYNOS4_PA_L2CC 0x10502000
69 74
70#define EXYNOS4_PA_MDMA 0x10810000 75#define EXYNOS4_PA_MDMA0 0x10810000
76#define EXYNOS4_PA_MDMA1 0x12840000
71#define EXYNOS4_PA_PDMA0 0x12680000 77#define EXYNOS4_PA_PDMA0 0x12680000
72#define EXYNOS4_PA_PDMA1 0x12690000 78#define EXYNOS4_PA_PDMA1 0x12690000
73 79
@@ -162,6 +168,8 @@
162#define S5P_PA_FIMC1 EXYNOS4_PA_FIMC1 168#define S5P_PA_FIMC1 EXYNOS4_PA_FIMC1
163#define S5P_PA_FIMC2 EXYNOS4_PA_FIMC2 169#define S5P_PA_FIMC2 EXYNOS4_PA_FIMC2
164#define S5P_PA_FIMC3 EXYNOS4_PA_FIMC3 170#define S5P_PA_FIMC3 EXYNOS4_PA_FIMC3
171#define S5P_PA_JPEG EXYNOS4_PA_JPEG
172#define S5P_PA_G2D EXYNOS4_PA_G2D
165#define S5P_PA_FIMD0 EXYNOS4_PA_FIMD0 173#define S5P_PA_FIMD0 EXYNOS4_PA_FIMD0
166#define S5P_PA_HDMI EXYNOS4_PA_HDMI 174#define S5P_PA_HDMI EXYNOS4_PA_HDMI
167#define S5P_PA_IIC_HDMIPHY EXYNOS4_PA_IIC_HDMIPHY 175#define S5P_PA_IIC_HDMIPHY EXYNOS4_PA_IIC_HDMIPHY
diff --git a/arch/arm/mach-exynos/include/mach/pmu.h b/arch/arm/mach-exynos/include/mach/pmu.h
index 632dd563013..e76b7faba66 100644
--- a/arch/arm/mach-exynos/include/mach/pmu.h
+++ b/arch/arm/mach-exynos/include/mach/pmu.h
@@ -22,11 +22,13 @@ enum sys_powerdown {
22 NUM_SYS_POWERDOWN, 22 NUM_SYS_POWERDOWN,
23}; 23};
24 24
25extern unsigned long l2x0_regs_phys;
25struct exynos4_pmu_conf { 26struct exynos4_pmu_conf {
26 void __iomem *reg; 27 void __iomem *reg;
27 unsigned int val[NUM_SYS_POWERDOWN]; 28 unsigned int val[NUM_SYS_POWERDOWN];
28}; 29};
29 30
30extern void exynos4_sys_powerdown_conf(enum sys_powerdown mode); 31extern void exynos4_sys_powerdown_conf(enum sys_powerdown mode);
32extern void s3c_cpu_resume(void);
31 33
32#endif /* __ASM_ARCH_PMU_H */ 34#endif /* __ASM_ARCH_PMU_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-clock.h b/arch/arm/mach-exynos/include/mach/regs-clock.h
index 6c37ebe9482..1e4abd64a54 100644
--- a/arch/arm/mach-exynos/include/mach/regs-clock.h
+++ b/arch/arm/mach-exynos/include/mach/regs-clock.h
@@ -16,195 +16,247 @@
16#include <plat/cpu.h> 16#include <plat/cpu.h>
17#include <mach/map.h> 17#include <mach/map.h>
18 18
19#define S5P_CLKREG(x) (S5P_VA_CMU + (x)) 19#define EXYNOS_CLKREG(x) (S5P_VA_CMU + (x))
20 20
21#define S5P_CLKDIV_LEFTBUS S5P_CLKREG(0x04500) 21#define EXYNOS4_CLKDIV_LEFTBUS EXYNOS_CLKREG(0x04500)
22#define S5P_CLKDIV_STAT_LEFTBUS S5P_CLKREG(0x04600) 22#define EXYNOS4_CLKDIV_STAT_LEFTBUS EXYNOS_CLKREG(0x04600)
23#define S5P_CLKGATE_IP_LEFTBUS S5P_CLKREG(0x04800) 23#define EXYNOS4_CLKGATE_IP_LEFTBUS EXYNOS_CLKREG(0x04800)
24 24
25#define S5P_CLKDIV_RIGHTBUS S5P_CLKREG(0x08500) 25#define EXYNOS4_CLKDIV_RIGHTBUS EXYNOS_CLKREG(0x08500)
26#define S5P_CLKDIV_STAT_RIGHTBUS S5P_CLKREG(0x08600) 26#define EXYNOS4_CLKDIV_STAT_RIGHTBUS EXYNOS_CLKREG(0x08600)
27#define S5P_CLKGATE_IP_RIGHTBUS S5P_CLKREG(0x08800) 27#define EXYNOS4_CLKGATE_IP_RIGHTBUS EXYNOS_CLKREG(0x08800)
28 28
29#define S5P_EPLL_LOCK S5P_CLKREG(0x0C010) 29#define EXYNOS4_EPLL_LOCK EXYNOS_CLKREG(0x0C010)
30#define S5P_VPLL_LOCK S5P_CLKREG(0x0C020) 30#define EXYNOS4_VPLL_LOCK EXYNOS_CLKREG(0x0C020)
31 31
32#define S5P_EPLL_CON0 S5P_CLKREG(0x0C110) 32#define EXYNOS4_EPLL_CON0 EXYNOS_CLKREG(0x0C110)
33#define S5P_EPLL_CON1 S5P_CLKREG(0x0C114) 33#define EXYNOS4_EPLL_CON1 EXYNOS_CLKREG(0x0C114)
34#define S5P_VPLL_CON0 S5P_CLKREG(0x0C120) 34#define EXYNOS4_VPLL_CON0 EXYNOS_CLKREG(0x0C120)
35#define S5P_VPLL_CON1 S5P_CLKREG(0x0C124) 35#define EXYNOS4_VPLL_CON1 EXYNOS_CLKREG(0x0C124)
36 36
37#define S5P_CLKSRC_TOP0 S5P_CLKREG(0x0C210) 37#define EXYNOS4_CLKSRC_TOP0 EXYNOS_CLKREG(0x0C210)
38#define S5P_CLKSRC_TOP1 S5P_CLKREG(0x0C214) 38#define EXYNOS4_CLKSRC_TOP1 EXYNOS_CLKREG(0x0C214)
39#define S5P_CLKSRC_CAM S5P_CLKREG(0x0C220) 39#define EXYNOS4_CLKSRC_CAM EXYNOS_CLKREG(0x0C220)
40#define S5P_CLKSRC_TV S5P_CLKREG(0x0C224) 40#define EXYNOS4_CLKSRC_TV EXYNOS_CLKREG(0x0C224)
41#define S5P_CLKSRC_MFC S5P_CLKREG(0x0C228) 41#define EXYNOS4_CLKSRC_MFC EXYNOS_CLKREG(0x0C228)
42#define S5P_CLKSRC_G3D S5P_CLKREG(0x0C22C) 42#define EXYNOS4_CLKSRC_G3D EXYNOS_CLKREG(0x0C22C)
43#define S5P_CLKSRC_IMAGE S5P_CLKREG(0x0C230) 43#define EXYNOS4_CLKSRC_IMAGE EXYNOS_CLKREG(0x0C230)
44#define S5P_CLKSRC_LCD0 S5P_CLKREG(0x0C234) 44#define EXYNOS4_CLKSRC_LCD0 EXYNOS_CLKREG(0x0C234)
45#define S5P_CLKSRC_MAUDIO S5P_CLKREG(0x0C23C) 45#define EXYNOS4_CLKSRC_MAUDIO EXYNOS_CLKREG(0x0C23C)
46#define S5P_CLKSRC_FSYS S5P_CLKREG(0x0C240) 46#define EXYNOS4_CLKSRC_FSYS EXYNOS_CLKREG(0x0C240)
47#define S5P_CLKSRC_PERIL0 S5P_CLKREG(0x0C250) 47#define EXYNOS4_CLKSRC_PERIL0 EXYNOS_CLKREG(0x0C250)
48#define S5P_CLKSRC_PERIL1 S5P_CLKREG(0x0C254) 48#define EXYNOS4_CLKSRC_PERIL1 EXYNOS_CLKREG(0x0C254)
49 49
50#define S5P_CLKSRC_MASK_TOP S5P_CLKREG(0x0C310) 50#define EXYNOS4_CLKSRC_MASK_TOP EXYNOS_CLKREG(0x0C310)
51#define S5P_CLKSRC_MASK_CAM S5P_CLKREG(0x0C320) 51#define EXYNOS4_CLKSRC_MASK_CAM EXYNOS_CLKREG(0x0C320)
52#define S5P_CLKSRC_MASK_TV S5P_CLKREG(0x0C324) 52#define EXYNOS4_CLKSRC_MASK_TV EXYNOS_CLKREG(0x0C324)
53#define S5P_CLKSRC_MASK_LCD0 S5P_CLKREG(0x0C334) 53#define EXYNOS4_CLKSRC_MASK_LCD0 EXYNOS_CLKREG(0x0C334)
54#define S5P_CLKSRC_MASK_MAUDIO S5P_CLKREG(0x0C33C) 54#define EXYNOS4_CLKSRC_MASK_MAUDIO EXYNOS_CLKREG(0x0C33C)
55#define S5P_CLKSRC_MASK_FSYS S5P_CLKREG(0x0C340) 55#define EXYNOS4_CLKSRC_MASK_FSYS EXYNOS_CLKREG(0x0C340)
56#define S5P_CLKSRC_MASK_PERIL0 S5P_CLKREG(0x0C350) 56#define EXYNOS4_CLKSRC_MASK_PERIL0 EXYNOS_CLKREG(0x0C350)
57#define S5P_CLKSRC_MASK_PERIL1 S5P_CLKREG(0x0C354) 57#define EXYNOS4_CLKSRC_MASK_PERIL1 EXYNOS_CLKREG(0x0C354)
58 58
59#define S5P_CLKDIV_TOP S5P_CLKREG(0x0C510) 59#define EXYNOS4_CLKDIV_TOP EXYNOS_CLKREG(0x0C510)
60#define S5P_CLKDIV_CAM S5P_CLKREG(0x0C520) 60#define EXYNOS4_CLKDIV_CAM EXYNOS_CLKREG(0x0C520)
61#define S5P_CLKDIV_TV S5P_CLKREG(0x0C524) 61#define EXYNOS4_CLKDIV_TV EXYNOS_CLKREG(0x0C524)
62#define S5P_CLKDIV_MFC S5P_CLKREG(0x0C528) 62#define EXYNOS4_CLKDIV_MFC EXYNOS_CLKREG(0x0C528)
63#define S5P_CLKDIV_G3D S5P_CLKREG(0x0C52C) 63#define EXYNOS4_CLKDIV_G3D EXYNOS_CLKREG(0x0C52C)
64#define S5P_CLKDIV_IMAGE S5P_CLKREG(0x0C530) 64#define EXYNOS4_CLKDIV_IMAGE EXYNOS_CLKREG(0x0C530)
65#define S5P_CLKDIV_LCD0 S5P_CLKREG(0x0C534) 65#define EXYNOS4_CLKDIV_LCD0 EXYNOS_CLKREG(0x0C534)
66#define S5P_CLKDIV_MAUDIO S5P_CLKREG(0x0C53C) 66#define EXYNOS4_CLKDIV_MAUDIO EXYNOS_CLKREG(0x0C53C)
67#define S5P_CLKDIV_FSYS0 S5P_CLKREG(0x0C540) 67#define EXYNOS4_CLKDIV_FSYS0 EXYNOS_CLKREG(0x0C540)
68#define S5P_CLKDIV_FSYS1 S5P_CLKREG(0x0C544) 68#define EXYNOS4_CLKDIV_FSYS1 EXYNOS_CLKREG(0x0C544)
69#define S5P_CLKDIV_FSYS2 S5P_CLKREG(0x0C548) 69#define EXYNOS4_CLKDIV_FSYS2 EXYNOS_CLKREG(0x0C548)
70#define S5P_CLKDIV_FSYS3 S5P_CLKREG(0x0C54C) 70#define EXYNOS4_CLKDIV_FSYS3 EXYNOS_CLKREG(0x0C54C)
71#define S5P_CLKDIV_PERIL0 S5P_CLKREG(0x0C550) 71#define EXYNOS4_CLKDIV_PERIL0 EXYNOS_CLKREG(0x0C550)
72#define S5P_CLKDIV_PERIL1 S5P_CLKREG(0x0C554) 72#define EXYNOS4_CLKDIV_PERIL1 EXYNOS_CLKREG(0x0C554)
73#define S5P_CLKDIV_PERIL2 S5P_CLKREG(0x0C558) 73#define EXYNOS4_CLKDIV_PERIL2 EXYNOS_CLKREG(0x0C558)
74#define S5P_CLKDIV_PERIL3 S5P_CLKREG(0x0C55C) 74#define EXYNOS4_CLKDIV_PERIL3 EXYNOS_CLKREG(0x0C55C)
75#define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x0C560) 75#define EXYNOS4_CLKDIV_PERIL4 EXYNOS_CLKREG(0x0C560)
76#define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x0C564) 76#define EXYNOS4_CLKDIV_PERIL5 EXYNOS_CLKREG(0x0C564)
77#define S5P_CLKDIV2_RATIO S5P_CLKREG(0x0C580) 77#define EXYNOS4_CLKDIV2_RATIO EXYNOS_CLKREG(0x0C580)
78 78
79#define S5P_CLKDIV_STAT_TOP S5P_CLKREG(0x0C610) 79#define EXYNOS4_CLKDIV_STAT_TOP EXYNOS_CLKREG(0x0C610)
80 80#define EXYNOS4_CLKDIV_STAT_MFC EXYNOS_CLKREG(0x0C628)
81#define S5P_CLKGATE_SCLKCAM S5P_CLKREG(0x0C820) 81
82#define S5P_CLKGATE_IP_CAM S5P_CLKREG(0x0C920) 82#define EXYNOS4_CLKGATE_SCLKCAM EXYNOS_CLKREG(0x0C820)
83#define S5P_CLKGATE_IP_TV S5P_CLKREG(0x0C924) 83#define EXYNOS4_CLKGATE_IP_CAM EXYNOS_CLKREG(0x0C920)
84#define S5P_CLKGATE_IP_MFC S5P_CLKREG(0x0C928) 84#define EXYNOS4_CLKGATE_IP_TV EXYNOS_CLKREG(0x0C924)
85#define S5P_CLKGATE_IP_G3D S5P_CLKREG(0x0C92C) 85#define EXYNOS4_CLKGATE_IP_MFC EXYNOS_CLKREG(0x0C928)
86#define S5P_CLKGATE_IP_IMAGE (soc_is_exynos4210() ? \ 86#define EXYNOS4_CLKGATE_IP_G3D EXYNOS_CLKREG(0x0C92C)
87 S5P_CLKREG(0x0C930) : \ 87#define EXYNOS4_CLKGATE_IP_IMAGE (soc_is_exynos4210() ? \
88 S5P_CLKREG(0x04930)) 88 EXYNOS_CLKREG(0x0C930) : \
89#define S5P_CLKGATE_IP_IMAGE_4210 S5P_CLKREG(0x0C930) 89 EXYNOS_CLKREG(0x04930))
90#define S5P_CLKGATE_IP_IMAGE_4212 S5P_CLKREG(0x04930) 90#define EXYNOS4210_CLKGATE_IP_IMAGE EXYNOS_CLKREG(0x0C930)
91#define S5P_CLKGATE_IP_LCD0 S5P_CLKREG(0x0C934) 91#define EXYNOS4212_CLKGATE_IP_IMAGE EXYNOS_CLKREG(0x04930)
92#define S5P_CLKGATE_IP_FSYS S5P_CLKREG(0x0C940) 92#define EXYNOS4_CLKGATE_IP_LCD0 EXYNOS_CLKREG(0x0C934)
93#define S5P_CLKGATE_IP_GPS S5P_CLKREG(0x0C94C) 93#define EXYNOS4_CLKGATE_IP_FSYS EXYNOS_CLKREG(0x0C940)
94#define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x0C950) 94#define EXYNOS4_CLKGATE_IP_GPS EXYNOS_CLKREG(0x0C94C)
95#define S5P_CLKGATE_IP_PERIR (soc_is_exynos4210() ? \ 95#define EXYNOS4_CLKGATE_IP_PERIL EXYNOS_CLKREG(0x0C950)
96 S5P_CLKREG(0x0C960) : \ 96#define EXYNOS4_CLKGATE_IP_PERIR (soc_is_exynos4210() ? \
97 S5P_CLKREG(0x08960)) 97 EXYNOS_CLKREG(0x0C960) : \
98#define S5P_CLKGATE_IP_PERIR_4210 S5P_CLKREG(0x0C960) 98 EXYNOS_CLKREG(0x08960))
99#define S5P_CLKGATE_IP_PERIR_4212 S5P_CLKREG(0x08960) 99#define EXYNOS4210_CLKGATE_IP_PERIR EXYNOS_CLKREG(0x0C960)
100#define S5P_CLKGATE_BLOCK S5P_CLKREG(0x0C970) 100#define EXYNOS4212_CLKGATE_IP_PERIR EXYNOS_CLKREG(0x08960)
101 101#define EXYNOS4_CLKGATE_BLOCK EXYNOS_CLKREG(0x0C970)
102#define S5P_CLKSRC_MASK_DMC S5P_CLKREG(0x10300) 102
103#define S5P_CLKSRC_DMC S5P_CLKREG(0x10200) 103#define EXYNOS4_CLKSRC_MASK_DMC EXYNOS_CLKREG(0x10300)
104#define S5P_CLKDIV_DMC0 S5P_CLKREG(0x10500) 104#define EXYNOS4_CLKSRC_DMC EXYNOS_CLKREG(0x10200)
105#define S5P_CLKDIV_DMC1 S5P_CLKREG(0x10504) 105#define EXYNOS4_CLKDIV_DMC0 EXYNOS_CLKREG(0x10500)
106#define S5P_CLKDIV_STAT_DMC0 S5P_CLKREG(0x10600) 106#define EXYNOS4_CLKDIV_DMC1 EXYNOS_CLKREG(0x10504)
107#define S5P_CLKGATE_IP_DMC S5P_CLKREG(0x10900) 107#define EXYNOS4_CLKDIV_STAT_DMC0 EXYNOS_CLKREG(0x10600)
108 108#define EXYNOS4_CLKDIV_STAT_DMC1 EXYNOS_CLKREG(0x10604)
109#define S5P_APLL_LOCK S5P_CLKREG(0x14000) 109#define EXYNOS4_CLKGATE_IP_DMC EXYNOS_CLKREG(0x10900)
110#define S5P_MPLL_LOCK (soc_is_exynos4210() ? \ 110
111 S5P_CLKREG(0x14004) : \ 111#define EXYNOS4_DMC_PAUSE_CTRL EXYNOS_CLKREG(0x11094)
112 S5P_CLKREG(0x10008)) 112#define EXYNOS4_DMC_PAUSE_ENABLE (1 << 0)
113#define S5P_APLL_CON0 S5P_CLKREG(0x14100) 113
114#define S5P_APLL_CON1 S5P_CLKREG(0x14104) 114#define EXYNOS4_APLL_LOCK EXYNOS_CLKREG(0x14000)
115#define S5P_MPLL_CON0 (soc_is_exynos4210() ? \ 115#define EXYNOS4_MPLL_LOCK (soc_is_exynos4210() ? \
116 S5P_CLKREG(0x14108) : \ 116 EXYNOS_CLKREG(0x14004) : \
117 S5P_CLKREG(0x10108)) 117 EXYNOS_CLKREG(0x10008))
118#define S5P_MPLL_CON1 (soc_is_exynos4210() ? \ 118#define EXYNOS4_APLL_CON0 EXYNOS_CLKREG(0x14100)
119 S5P_CLKREG(0x1410C) : \ 119#define EXYNOS4_APLL_CON1 EXYNOS_CLKREG(0x14104)
120 S5P_CLKREG(0x1010C)) 120#define EXYNOS4_MPLL_CON0 (soc_is_exynos4210() ? \
121 121 EXYNOS_CLKREG(0x14108) : \
122#define S5P_CLKSRC_CPU S5P_CLKREG(0x14200) 122 EXYNOS_CLKREG(0x10108))
123#define S5P_CLKMUX_STATCPU S5P_CLKREG(0x14400) 123#define EXYNOS4_MPLL_CON1 (soc_is_exynos4210() ? \
124 124 EXYNOS_CLKREG(0x1410C) : \
125#define S5P_CLKDIV_CPU S5P_CLKREG(0x14500) 125 EXYNOS_CLKREG(0x1010C))
126#define S5P_CLKDIV_CPU1 S5P_CLKREG(0x14504) 126
127#define S5P_CLKDIV_STATCPU S5P_CLKREG(0x14600) 127#define EXYNOS4_CLKSRC_CPU EXYNOS_CLKREG(0x14200)
128#define S5P_CLKDIV_STATCPU1 S5P_CLKREG(0x14604) 128#define EXYNOS4_CLKMUX_STATCPU EXYNOS_CLKREG(0x14400)
129 129
130#define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x14800) 130#define EXYNOS4_CLKDIV_CPU EXYNOS_CLKREG(0x14500)
131#define S5P_CLKGATE_IP_CPU S5P_CLKREG(0x14900) 131#define EXYNOS4_CLKDIV_CPU1 EXYNOS_CLKREG(0x14504)
132 132#define EXYNOS4_CLKDIV_STATCPU EXYNOS_CLKREG(0x14600)
133#define S5P_APLL_LOCKTIME (0x1C20) /* 300us */ 133#define EXYNOS4_CLKDIV_STATCPU1 EXYNOS_CLKREG(0x14604)
134 134
135#define S5P_APLLCON0_ENABLE_SHIFT (31) 135#define EXYNOS4_CLKGATE_SCLKCPU EXYNOS_CLKREG(0x14800)
136#define S5P_APLLCON0_LOCKED_SHIFT (29) 136#define EXYNOS4_CLKGATE_IP_CPU EXYNOS_CLKREG(0x14900)
137#define S5P_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1) 137
138#define S5P_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1) 138#define EXYNOS4_APLL_LOCKTIME (0x1C20) /* 300us */
139 139
140#define S5P_EPLLCON0_ENABLE_SHIFT (31) 140#define EXYNOS4_APLLCON0_ENABLE_SHIFT (31)
141#define S5P_EPLLCON0_LOCKED_SHIFT (29) 141#define EXYNOS4_APLLCON0_LOCKED_SHIFT (29)
142 142#define EXYNOS4_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1)
143#define S5P_VPLLCON0_ENABLE_SHIFT (31) 143#define EXYNOS4_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1)
144#define S5P_VPLLCON0_LOCKED_SHIFT (29) 144
145 145#define EXYNOS4_EPLLCON0_ENABLE_SHIFT (31)
146#define S5P_CLKSRC_CPU_MUXCORE_SHIFT (16) 146#define EXYNOS4_EPLLCON0_LOCKED_SHIFT (29)
147#define S5P_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << S5P_CLKSRC_CPU_MUXCORE_SHIFT) 147
148 148#define EXYNOS4_VPLLCON0_ENABLE_SHIFT (31)
149#define S5P_CLKDIV_CPU0_CORE_SHIFT (0) 149#define EXYNOS4_VPLLCON0_LOCKED_SHIFT (29)
150#define S5P_CLKDIV_CPU0_CORE_MASK (0x7 << S5P_CLKDIV_CPU0_CORE_SHIFT) 150
151#define S5P_CLKDIV_CPU0_COREM0_SHIFT (4) 151#define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16)
152#define S5P_CLKDIV_CPU0_COREM0_MASK (0x7 << S5P_CLKDIV_CPU0_COREM0_SHIFT) 152#define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)
153#define S5P_CLKDIV_CPU0_COREM1_SHIFT (8) 153
154#define S5P_CLKDIV_CPU0_COREM1_MASK (0x7 << S5P_CLKDIV_CPU0_COREM1_SHIFT) 154#define EXYNOS4_CLKDIV_CPU0_CORE_SHIFT (0)
155#define S5P_CLKDIV_CPU0_PERIPH_SHIFT (12) 155#define EXYNOS4_CLKDIV_CPU0_CORE_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_CORE_SHIFT)
156#define S5P_CLKDIV_CPU0_PERIPH_MASK (0x7 << S5P_CLKDIV_CPU0_PERIPH_SHIFT) 156#define EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT (4)
157#define S5P_CLKDIV_CPU0_ATB_SHIFT (16) 157#define EXYNOS4_CLKDIV_CPU0_COREM0_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT)
158#define S5P_CLKDIV_CPU0_ATB_MASK (0x7 << S5P_CLKDIV_CPU0_ATB_SHIFT) 158#define EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT (8)
159#define S5P_CLKDIV_CPU0_PCLKDBG_SHIFT (20) 159#define EXYNOS4_CLKDIV_CPU0_COREM1_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT)
160#define S5P_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << S5P_CLKDIV_CPU0_PCLKDBG_SHIFT) 160#define EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT (12)
161#define S5P_CLKDIV_CPU0_APLL_SHIFT (24) 161#define EXYNOS4_CLKDIV_CPU0_PERIPH_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT)
162#define S5P_CLKDIV_CPU0_APLL_MASK (0x7 << S5P_CLKDIV_CPU0_APLL_SHIFT) 162#define EXYNOS4_CLKDIV_CPU0_ATB_SHIFT (16)
163 163#define EXYNOS4_CLKDIV_CPU0_ATB_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_ATB_SHIFT)
164#define S5P_CLKDIV_DMC0_ACP_SHIFT (0) 164#define EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT (20)
165#define S5P_CLKDIV_DMC0_ACP_MASK (0x7 << S5P_CLKDIV_DMC0_ACP_SHIFT) 165#define EXYNOS4_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT)
166#define S5P_CLKDIV_DMC0_ACPPCLK_SHIFT (4) 166#define EXYNOS4_CLKDIV_CPU0_APLL_SHIFT (24)
167#define S5P_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << S5P_CLKDIV_DMC0_ACPPCLK_SHIFT) 167#define EXYNOS4_CLKDIV_CPU0_APLL_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_APLL_SHIFT)
168#define S5P_CLKDIV_DMC0_DPHY_SHIFT (8) 168#define EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT 28
169#define S5P_CLKDIV_DMC0_DPHY_MASK (0x7 << S5P_CLKDIV_DMC0_DPHY_SHIFT) 169#define EXYNOS4_CLKDIV_CPU0_CORE2_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT)
170#define S5P_CLKDIV_DMC0_DMC_SHIFT (12) 170
171#define S5P_CLKDIV_DMC0_DMC_MASK (0x7 << S5P_CLKDIV_DMC0_DMC_SHIFT) 171#define EXYNOS4_CLKDIV_CPU1_COPY_SHIFT 0
172#define S5P_CLKDIV_DMC0_DMCD_SHIFT (16) 172#define EXYNOS4_CLKDIV_CPU1_COPY_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_COPY_SHIFT)
173#define S5P_CLKDIV_DMC0_DMCD_MASK (0x7 << S5P_CLKDIV_DMC0_DMCD_SHIFT) 173#define EXYNOS4_CLKDIV_CPU1_HPM_SHIFT 4
174#define S5P_CLKDIV_DMC0_DMCP_SHIFT (20) 174#define EXYNOS4_CLKDIV_CPU1_HPM_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_HPM_SHIFT)
175#define S5P_CLKDIV_DMC0_DMCP_MASK (0x7 << S5P_CLKDIV_DMC0_DMCP_SHIFT) 175#define EXYNOS4_CLKDIV_CPU1_CORES_SHIFT 8
176#define S5P_CLKDIV_DMC0_COPY2_SHIFT (24) 176#define EXYNOS4_CLKDIV_CPU1_CORES_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_CORES_SHIFT)
177#define S5P_CLKDIV_DMC0_COPY2_MASK (0x7 << S5P_CLKDIV_DMC0_COPY2_SHIFT) 177
178#define S5P_CLKDIV_DMC0_CORETI_SHIFT (28) 178#define EXYNOS4_CLKDIV_DMC0_ACP_SHIFT (0)
179#define S5P_CLKDIV_DMC0_CORETI_MASK (0x7 << S5P_CLKDIV_DMC0_CORETI_SHIFT) 179#define EXYNOS4_CLKDIV_DMC0_ACP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACP_SHIFT)
180 180#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT (4)
181#define S5P_CLKDIV_TOP_ACLK200_SHIFT (0) 181#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT)
182#define S5P_CLKDIV_TOP_ACLK200_MASK (0x7 << S5P_CLKDIV_TOP_ACLK200_SHIFT) 182#define EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT (8)
183#define S5P_CLKDIV_TOP_ACLK100_SHIFT (4) 183#define EXYNOS4_CLKDIV_DMC0_DPHY_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT)
184#define S5P_CLKDIV_TOP_ACLK100_MASK (0xf << S5P_CLKDIV_TOP_ACLK100_SHIFT) 184#define EXYNOS4_CLKDIV_DMC0_DMC_SHIFT (12)
185#define S5P_CLKDIV_TOP_ACLK160_SHIFT (8) 185#define EXYNOS4_CLKDIV_DMC0_DMC_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMC_SHIFT)
186#define S5P_CLKDIV_TOP_ACLK160_MASK (0x7 << S5P_CLKDIV_TOP_ACLK160_SHIFT) 186#define EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT (16)
187#define S5P_CLKDIV_TOP_ACLK133_SHIFT (12) 187#define EXYNOS4_CLKDIV_DMC0_DMCD_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT)
188#define S5P_CLKDIV_TOP_ACLK133_MASK (0x7 << S5P_CLKDIV_TOP_ACLK133_SHIFT) 188#define EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT (20)
189#define S5P_CLKDIV_TOP_ONENAND_SHIFT (16) 189#define EXYNOS4_CLKDIV_DMC0_DMCP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT)
190#define S5P_CLKDIV_TOP_ONENAND_MASK (0x7 << S5P_CLKDIV_TOP_ONENAND_SHIFT) 190#define EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT (24)
191 191#define EXYNOS4_CLKDIV_DMC0_COPY2_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT)
192#define S5P_CLKDIV_BUS_GDLR_SHIFT (0) 192#define EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT (28)
193#define S5P_CLKDIV_BUS_GDLR_MASK (0x7 << S5P_CLKDIV_BUS_GDLR_SHIFT) 193#define EXYNOS4_CLKDIV_DMC0_CORETI_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT)
194#define S5P_CLKDIV_BUS_GPLR_SHIFT (4) 194
195#define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT) 195#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT (0)
196#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_MASK (0xf << EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT)
197#define EXYNOS4_CLKDIV_DMC1_C2C_SHIFT (4)
198#define EXYNOS4_CLKDIV_DMC1_C2C_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2C_SHIFT)
199#define EXYNOS4_CLKDIV_DMC1_PWI_SHIFT (8)
200#define EXYNOS4_CLKDIV_DMC1_PWI_MASK (0xf << EXYNOS4_CLKDIV_DMC1_PWI_SHIFT)
201#define EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT (12)
202#define EXYNOS4_CLKDIV_DMC1_C2CACLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT)
203#define EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT (16)
204#define EXYNOS4_CLKDIV_DMC1_DVSEM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT)
205#define EXYNOS4_CLKDIV_DMC1_DPM_SHIFT (24)
206#define EXYNOS4_CLKDIV_DMC1_DPM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DPM_SHIFT)
207
208#define EXYNOS4_CLKDIV_MFC_SHIFT (0)
209#define EXYNOS4_CLKDIV_MFC_MASK (0x7 << EXYNOS4_CLKDIV_MFC_SHIFT)
210
211#define EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT (0)
212#define EXYNOS4_CLKDIV_TOP_ACLK200_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT)
213#define EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT (4)
214#define EXYNOS4_CLKDIV_TOP_ACLK100_MASK (0xF << EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT)
215#define EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT (8)
216#define EXYNOS4_CLKDIV_TOP_ACLK160_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT)
217#define EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT (12)
218#define EXYNOS4_CLKDIV_TOP_ACLK133_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT)
219#define EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT (16)
220#define EXYNOS4_CLKDIV_TOP_ONENAND_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT)
221#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT (20)
222#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT)
223#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT (24)
224#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT)
225
226#define EXYNOS4_CLKDIV_BUS_GDLR_SHIFT (0)
227#define EXYNOS4_CLKDIV_BUS_GDLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GDLR_SHIFT)
228#define EXYNOS4_CLKDIV_BUS_GPLR_SHIFT (4)
229#define EXYNOS4_CLKDIV_BUS_GPLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GPLR_SHIFT)
230
231#define EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT (0)
232#define EXYNOS4_CLKDIV_CAM_FIMC0_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT)
233#define EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT (4)
234#define EXYNOS4_CLKDIV_CAM_FIMC1_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT)
235#define EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT (8)
236#define EXYNOS4_CLKDIV_CAM_FIMC2_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT)
237#define EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT (12)
238#define EXYNOS4_CLKDIV_CAM_FIMC3_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT)
196 239
197/* Only for EXYNOS4210 */ 240/* Only for EXYNOS4210 */
198 241
199#define S5P_CLKSRC_LCD1 S5P_CLKREG(0x0C238) 242#define EXYNOS4210_CLKSRC_LCD1 EXYNOS_CLKREG(0x0C238)
200#define S5P_CLKSRC_MASK_LCD1 S5P_CLKREG(0x0C338) 243#define EXYNOS4210_CLKSRC_MASK_LCD1 EXYNOS_CLKREG(0x0C338)
201#define S5P_CLKDIV_LCD1 S5P_CLKREG(0x0C538) 244#define EXYNOS4210_CLKDIV_LCD1 EXYNOS_CLKREG(0x0C538)
202#define S5P_CLKGATE_IP_LCD1 S5P_CLKREG(0x0C938) 245#define EXYNOS4210_CLKGATE_IP_LCD1 EXYNOS_CLKREG(0x0C938)
246
247/* Only for EXYNOS4212 */
248
249#define EXYNOS4_CLKDIV_CAM1 EXYNOS_CLKREG(0x0C568)
250
251#define EXYNOS4_CLKDIV_STAT_CAM1 EXYNOS_CLKREG(0x0C668)
252
253#define EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT (0)
254#define EXYNOS4_CLKDIV_CAM1_JPEG_MASK (0xf << EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT)
203 255
204/* Compatibility defines and inclusion */ 256/* Compatibility defines and inclusion */
205 257
206#include <mach/regs-pmu.h> 258#include <mach/regs-pmu.h>
207 259
208#define S5P_EPLL_CON S5P_EPLL_CON0 260#define S5P_EPLL_CON EXYNOS4_EPLL_CON0
209 261
210#endif /* __ASM_ARCH_REGS_CLOCK_H */ 262#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-exynos/include/mach/system.h b/arch/arm/mach-exynos/include/mach/system.h
deleted file mode 100644
index 0063a6de3dc..00000000000
--- a/arch/arm/mach-exynos/include/mach/system.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* linux/arch/arm/mach-exynos4/include/mach/system.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 - system support header
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_SYSTEM_H
14#define __ASM_ARCH_SYSTEM_H __FILE__
15
16static void arch_idle(void)
17{
18 /* nothing here yet */
19}
20#endif /* __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index aa37179d776..82ea6fccfb3 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -28,6 +28,7 @@
28 28
29#include <video/platform_lcd.h> 29#include <video/platform_lcd.h>
30#include <media/m5mols.h> 30#include <media/m5mols.h>
31#include <media/s5k6aa.h>
31#include <media/s5p_fimc.h> 32#include <media/s5p_fimc.h>
32#include <media/v4l2-mediabus.h> 33#include <media/v4l2-mediabus.h>
33 34
@@ -75,6 +76,7 @@ enum fixed_regulator_id {
75 FIXED_REG_ID_MAX8903, 76 FIXED_REG_ID_MAX8903,
76 FIXED_REG_ID_CAM_A28V, 77 FIXED_REG_ID_CAM_A28V,
77 FIXED_REG_ID_CAM_12V, 78 FIXED_REG_ID_CAM_12V,
79 FIXED_REG_ID_CAM_VT_15V,
78}; 80};
79 81
80static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = { 82static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
@@ -115,7 +117,7 @@ static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
115}; 117};
116 118
117static struct regulator_consumer_supply emmc_supplies[] = { 119static struct regulator_consumer_supply emmc_supplies[] = {
118 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), 120 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"),
119 REGULATOR_SUPPLY("vmmc", "dw_mmc"), 121 REGULATOR_SUPPLY("vmmc", "dw_mmc"),
120}; 122};
121 123
@@ -399,6 +401,9 @@ static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
399static struct regulator_consumer_supply __initdata max8997_ldo5_[] = { 401static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
400 REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */ 402 REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
401}; 403};
404static struct regulator_consumer_supply nuri_max8997_ldo6_consumer[] = {
405 REGULATOR_SUPPLY("vdd_reg", "6-003c"), /* S5K6AA camera */
406};
402static struct regulator_consumer_supply __initdata max8997_ldo7_[] = { 407static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
403 REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */ 408 REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
404}; 409};
@@ -413,7 +418,7 @@ static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
413 REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */ 418 REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
414}; 419};
415static struct regulator_consumer_supply __initdata max8997_ldo13_[] = { 420static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
416 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), /* TFLASH */ 421 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */
417}; 422};
418static struct regulator_consumer_supply __initdata max8997_ldo14_[] = { 423static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
419 REGULATOR_SUPPLY("inmotor", "max8997-haptic"), 424 REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
@@ -431,7 +436,7 @@ static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
431 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */ 436 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
432}; 437};
433static struct regulator_consumer_supply __initdata max8997_buck2_[] = { 438static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
434 REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */ 439 REGULATOR_SUPPLY("vdd_int", "exynos4210-busfreq.0"), /* CPUFREQ */
435}; 440};
436static struct regulator_consumer_supply __initdata max8997_buck3_[] = { 441static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
437 REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */ 442 REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
@@ -546,6 +551,8 @@ static struct regulator_init_data __initdata max8997_ldo6_data = {
546 .enabled = 1, 551 .enabled = 1,
547 }, 552 },
548 }, 553 },
554 .num_consumer_supplies = ARRAY_SIZE(nuri_max8997_ldo6_consumer),
555 .consumer_supplies = nuri_max8997_ldo6_consumer,
549}; 556};
550 557
551static struct regulator_init_data __initdata max8997_ldo7_data = { 558static struct regulator_init_data __initdata max8997_ldo7_data = {
@@ -742,7 +749,7 @@ static struct regulator_init_data __initdata max8997_buck2_data = {
742 .constraints = { 749 .constraints = {
743 .name = "VINT_1.1V_C210", 750 .name = "VINT_1.1V_C210",
744 .min_uV = 900000, 751 .min_uV = 900000,
745 .max_uV = 1100000, 752 .max_uV = 1200000,
746 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, 753 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
747 .always_on = 1, 754 .always_on = 1,
748 .state_mem = { 755 .state_mem = {
@@ -957,7 +964,6 @@ static struct max8997_platform_data __initdata nuri_max8997_pdata = {
957 .regulators = nuri_max8997_regulators, 964 .regulators = nuri_max8997_regulators,
958 965
959 .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) }, 966 .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
960 .buck2_gpiodvs = true,
961 967
962 .buck1_voltage[0] = 1350000, /* 1.35V */ 968 .buck1_voltage[0] = 1350000, /* 1.35V */
963 .buck1_voltage[1] = 1300000, /* 1.3V */ 969 .buck1_voltage[1] = 1300000, /* 1.3V */
@@ -1116,7 +1122,30 @@ static void __init nuri_ehci_init(void)
1116} 1122}
1117 1123
1118/* CAMERA */ 1124/* CAMERA */
1125static struct regulator_consumer_supply cam_vt_cam15_supply =
1126 REGULATOR_SUPPLY("vdd_core", "6-003c");
1127
1128static struct regulator_init_data cam_vt_cam15_reg_init_data = {
1129 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1130 .num_consumer_supplies = 1,
1131 .consumer_supplies = &cam_vt_cam15_supply,
1132};
1133
1134static struct fixed_voltage_config cam_vt_cam15_fixed_voltage_cfg = {
1135 .supply_name = "VT_CAM_1.5V",
1136 .microvolts = 1500000,
1137 .gpio = EXYNOS4_GPE2(2), /* VT_CAM_1.5V_EN */
1138 .enable_high = 1,
1139 .init_data = &cam_vt_cam15_reg_init_data,
1140};
1141
1142static struct platform_device cam_vt_cam15_fixed_rdev = {
1143 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_15V,
1144 .dev = { .platform_data = &cam_vt_cam15_fixed_voltage_cfg },
1145};
1146
1119static struct regulator_consumer_supply cam_vdda_supply[] = { 1147static struct regulator_consumer_supply cam_vdda_supply[] = {
1148 REGULATOR_SUPPLY("vdda", "6-003c"),
1120 REGULATOR_SUPPLY("a_sensor", "0-001f"), 1149 REGULATOR_SUPPLY("a_sensor", "0-001f"),
1121}; 1150};
1122 1151
@@ -1173,6 +1202,21 @@ static struct s5p_platform_mipi_csis mipi_csis_platdata = {
1173 1202
1174#define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */ 1203#define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */
1175#define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5) 1204#define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5)
1205#define GPIO_CAM_VT_NSTBY EXYNOS4_GPL2(0)
1206#define GPIO_CAM_VT_NRST EXYNOS4_GPL2(1)
1207
1208static struct s5k6aa_platform_data s5k6aa_pldata = {
1209 .mclk_frequency = 24000000UL,
1210 .gpio_reset = { GPIO_CAM_VT_NRST, 0 },
1211 .gpio_stby = { GPIO_CAM_VT_NSTBY, 0 },
1212 .bus_type = V4L2_MBUS_PARALLEL,
1213 .horiz_flip = 1,
1214};
1215
1216static struct i2c_board_info s5k6aa_board_info = {
1217 I2C_BOARD_INFO("S5K6AA", 0x3c),
1218 .platform_data = &s5k6aa_pldata,
1219};
1176 1220
1177static struct m5mols_platform_data m5mols_platdata = { 1221static struct m5mols_platform_data m5mols_platdata = {
1178 .gpio_reset = GPIO_CAM_MEGA_RST, 1222 .gpio_reset = GPIO_CAM_MEGA_RST,
@@ -1185,6 +1229,13 @@ static struct i2c_board_info m5mols_board_info = {
1185 1229
1186static struct s5p_fimc_isp_info nuri_camera_sensors[] = { 1230static struct s5p_fimc_isp_info nuri_camera_sensors[] = {
1187 { 1231 {
1232 .flags = V4L2_MBUS_PCLK_SAMPLE_RISING |
1233 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1234 .bus_type = FIMC_ITU_601,
1235 .board_info = &s5k6aa_board_info,
1236 .clk_frequency = 24000000UL,
1237 .i2c_bus_num = 6,
1238 }, {
1188 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | 1239 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
1189 V4L2_MBUS_VSYNC_ACTIVE_LOW, 1240 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1190 .bus_type = FIMC_MIPI_CSI2, 1241 .bus_type = FIMC_MIPI_CSI2,
@@ -1200,11 +1251,13 @@ static struct s5p_platform_fimc fimc_md_platdata = {
1200}; 1251};
1201 1252
1202static struct gpio nuri_camera_gpios[] = { 1253static struct gpio nuri_camera_gpios[] = {
1254 { GPIO_CAM_VT_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
1255 { GPIO_CAM_VT_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" },
1203 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" }, 1256 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
1204 { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" }, 1257 { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
1205}; 1258};
1206 1259
1207static void nuri_camera_init(void) 1260static void __init nuri_camera_init(void)
1208{ 1261{
1209 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata), 1262 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
1210 &s5p_device_mipi_csis0); 1263 &s5p_device_mipi_csis0);
@@ -1224,6 +1277,8 @@ static void nuri_camera_init(void)
1224 pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__); 1277 pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__);
1225 1278
1226 /* Free GPIOs controlled directly by the sensor drivers. */ 1279 /* Free GPIOs controlled directly by the sensor drivers. */
1280 gpio_free(GPIO_CAM_VT_NRST);
1281 gpio_free(GPIO_CAM_VT_NSTBY);
1227 gpio_free(GPIO_CAM_MEGA_RST); 1282 gpio_free(GPIO_CAM_MEGA_RST);
1228 1283
1229 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) { 1284 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) {
@@ -1234,15 +1289,27 @@ static void nuri_camera_init(void)
1234 s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4); 1289 s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4);
1235} 1290}
1236 1291
1292static struct s3c2410_platform_i2c nuri_i2c6_platdata __initdata = {
1293 .frequency = 400000U,
1294 .sda_delay = 200,
1295 .bus_num = 6,
1296};
1297
1237static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = { 1298static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = {
1238 .frequency = 400000U, 1299 .frequency = 400000U,
1239 .sda_delay = 200, 1300 .sda_delay = 200,
1240}; 1301};
1241 1302
1303/* DEVFREQ controlling memory/bus */
1304static struct platform_device exynos4_bus_devfreq = {
1305 .name = "exynos4210-busfreq",
1306};
1307
1242static struct platform_device *nuri_devices[] __initdata = { 1308static struct platform_device *nuri_devices[] __initdata = {
1243 /* Samsung Platform Devices */ 1309 /* Samsung Platform Devices */
1244 &s3c_device_i2c5, /* PMIC should initialize first */ 1310 &s3c_device_i2c5, /* PMIC should initialize first */
1245 &s3c_device_i2c0, 1311 &s3c_device_i2c0,
1312 &s3c_device_i2c6,
1246 &emmc_fixed_voltage, 1313 &emmc_fixed_voltage,
1247 &s5p_device_mipi_csis0, 1314 &s5p_device_mipi_csis0,
1248 &s5p_device_fimc0, 1315 &s5p_device_fimc0,
@@ -1259,6 +1326,8 @@ static struct platform_device *nuri_devices[] __initdata = {
1259 &s3c_device_i2c3, 1326 &s3c_device_i2c3,
1260 &i2c9_gpio, 1327 &i2c9_gpio,
1261 &s3c_device_adc, 1328 &s3c_device_adc,
1329 &s5p_device_g2d,
1330 &s5p_device_jpeg,
1262 &s3c_device_rtc, 1331 &s3c_device_rtc,
1263 &s5p_device_mfc, 1332 &s5p_device_mfc,
1264 &s5p_device_mfc_l, 1333 &s5p_device_mfc_l,
@@ -1271,8 +1340,10 @@ static struct platform_device *nuri_devices[] __initdata = {
1271 &nuri_backlight_device, 1340 &nuri_backlight_device,
1272 &max8903_fixed_reg_dev, 1341 &max8903_fixed_reg_dev,
1273 &nuri_max8903_device, 1342 &nuri_max8903_device,
1343 &cam_vt_cam15_fixed_rdev,
1274 &cam_vdda_fixed_rdev, 1344 &cam_vdda_fixed_rdev,
1275 &cam_8m_12v_fixed_rdev, 1345 &cam_8m_12v_fixed_rdev,
1346 &exynos4_bus_devfreq,
1276}; 1347};
1277 1348
1278static void __init nuri_map_io(void) 1349static void __init nuri_map_io(void)
@@ -1302,6 +1373,7 @@ static void __init nuri_machine_init(void)
1302 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs)); 1373 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
1303 i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3)); 1374 i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
1304 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs)); 1375 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
1376 s3c_i2c6_set_platdata(&nuri_i2c6_platdata);
1305 1377
1306 s5p_fimd0_set_platdata(&nuri_fb_pdata); 1378 s5p_fimd0_set_platdata(&nuri_fb_pdata);
1307 1379
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c
index fa5c4a59b0a..878d4c99142 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -20,6 +20,7 @@
20#include <linux/regulator/machine.h> 20#include <linux/regulator/machine.h>
21#include <linux/mfd/max8997.h> 21#include <linux/mfd/max8997.h>
22#include <linux/lcd.h> 22#include <linux/lcd.h>
23#include <linux/rfkill-gpio.h>
23 24
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
25#include <asm/hardware/gic.h> 26#include <asm/hardware/gic.h>
@@ -235,6 +236,7 @@ static struct regulator_init_data __initdata max8997_ldo9_data = {
235 .min_uV = 2800000, 236 .min_uV = 2800000,
236 .max_uV = 2800000, 237 .max_uV = 2800000,
237 .apply_uV = 1, 238 .apply_uV = 1,
239 .always_on = 1,
238 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 240 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
239 .state_mem = { 241 .state_mem = {
240 .disabled = 1, 242 .disabled = 1,
@@ -278,6 +280,7 @@ static struct regulator_init_data __initdata max8997_ldo14_data = {
278 .min_uV = 1800000, 280 .min_uV = 1800000,
279 .max_uV = 1800000, 281 .max_uV = 1800000,
280 .apply_uV = 1, 282 .apply_uV = 1,
283 .always_on = 1,
281 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 284 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
282 .state_mem = { 285 .state_mem = {
283 .disabled = 1, 286 .disabled = 1,
@@ -293,6 +296,7 @@ static struct regulator_init_data __initdata max8997_ldo17_data = {
293 .min_uV = 3300000, 296 .min_uV = 3300000,
294 .max_uV = 3300000, 297 .max_uV = 3300000,
295 .apply_uV = 1, 298 .apply_uV = 1,
299 .always_on = 1,
296 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 300 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
297 .state_mem = { 301 .state_mem = {
298 .disabled = 1, 302 .disabled = 1,
@@ -412,7 +416,7 @@ static struct max8997_regulator_data __initdata origen_max8997_regulators[] = {
412 { MAX8997_BUCK7, &max8997_buck7_data }, 416 { MAX8997_BUCK7, &max8997_buck7_data },
413}; 417};
414 418
415struct max8997_platform_data __initdata origen_max8997_pdata = { 419static struct max8997_platform_data __initdata origen_max8997_pdata = {
416 .num_regulators = ARRAY_SIZE(origen_max8997_regulators), 420 .num_regulators = ARRAY_SIZE(origen_max8997_regulators),
417 .regulators = origen_max8997_regulators, 421 .regulators = origen_max8997_regulators,
418 422
@@ -602,6 +606,23 @@ static struct s3c_fb_platdata origen_lcd_pdata __initdata = {
602 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, 606 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
603}; 607};
604 608
609/* Bluetooth rfkill gpio platform data */
610struct rfkill_gpio_platform_data origen_bt_pdata = {
611 .reset_gpio = EXYNOS4_GPX2(2),
612 .shutdown_gpio = -1,
613 .type = RFKILL_TYPE_BLUETOOTH,
614 .name = "origen-bt",
615};
616
617/* Bluetooth Platform device */
618static struct platform_device origen_device_bluetooth = {
619 .name = "rfkill_gpio",
620 .id = -1,
621 .dev = {
622 .platform_data = &origen_bt_pdata,
623 },
624};
625
605static struct platform_device *origen_devices[] __initdata = { 626static struct platform_device *origen_devices[] __initdata = {
606 &s3c_device_hsmmc2, 627 &s3c_device_hsmmc2,
607 &s3c_device_hsmmc0, 628 &s3c_device_hsmmc0,
@@ -613,9 +634,12 @@ static struct platform_device *origen_devices[] __initdata = {
613 &s5p_device_fimc1, 634 &s5p_device_fimc1,
614 &s5p_device_fimc2, 635 &s5p_device_fimc2,
615 &s5p_device_fimc3, 636 &s5p_device_fimc3,
637 &s5p_device_fimc_md,
616 &s5p_device_fimd0, 638 &s5p_device_fimd0,
639 &s5p_device_g2d,
617 &s5p_device_hdmi, 640 &s5p_device_hdmi,
618 &s5p_device_i2c_hdmiphy, 641 &s5p_device_i2c_hdmiphy,
642 &s5p_device_jpeg,
619 &s5p_device_mfc, 643 &s5p_device_mfc,
620 &s5p_device_mfc_l, 644 &s5p_device_mfc_l,
621 &s5p_device_mfc_r, 645 &s5p_device_mfc_r,
@@ -623,6 +647,7 @@ static struct platform_device *origen_devices[] __initdata = {
623 &exynos4_device_ohci, 647 &exynos4_device_ohci,
624 &origen_device_gpiokeys, 648 &origen_device_gpiokeys,
625 &origen_lcd_hv070wsa, 649 &origen_lcd_hv070wsa,
650 &origen_device_bluetooth,
626}; 651};
627 652
628/* LCD Backlight data */ 653/* LCD Backlight data */
@@ -636,6 +661,16 @@ static struct platform_pwm_backlight_data origen_bl_data = {
636 .pwm_period_ns = 1000, 661 .pwm_period_ns = 1000,
637}; 662};
638 663
664static void __init origen_bt_setup(void)
665{
666 gpio_request(EXYNOS4_GPA0(0), "GPIO BT_UART");
667 /* 4 UART Pins configuration */
668 s3c_gpio_cfgrange_nopull(EXYNOS4_GPA0(0), 4, S3C_GPIO_SFN(2));
669 /* Setup BT Reset, this gpio will be requesed by rfkill-gpio */
670 s3c_gpio_cfgpin(EXYNOS4_GPX2(2), S3C_GPIO_OUTPUT);
671 s3c_gpio_setpull(EXYNOS4_GPX2(2), S3C_GPIO_PULL_NONE);
672}
673
639static void s5p_tv_setup(void) 674static void s5p_tv_setup(void)
640{ 675{
641 /* Direct HPD to HDMI chip */ 676 /* Direct HPD to HDMI chip */
@@ -689,6 +724,8 @@ static void __init origen_machine_init(void)
689 platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices)); 724 platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices));
690 725
691 samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data); 726 samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data);
727
728 origen_bt_setup();
692} 729}
693 730
694MACHINE_START(ORIGEN, "ORIGEN") 731MACHINE_START(ORIGEN, "ORIGEN")
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c
index 5258b856367..83b91fa777c 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -270,6 +270,9 @@ static struct platform_device *smdkv310_devices[] __initdata = {
270 &s5p_device_fimc1, 270 &s5p_device_fimc1,
271 &s5p_device_fimc2, 271 &s5p_device_fimc2,
272 &s5p_device_fimc3, 272 &s5p_device_fimc3,
273 &s5p_device_fimc_md,
274 &s5p_device_g2d,
275 &s5p_device_jpeg,
273 &exynos4_device_ac97, 276 &exynos4_device_ac97,
274 &exynos4_device_i2s0, 277 &exynos4_device_i2s0,
275 &exynos4_device_ohci, 278 &exynos4_device_ohci,
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index b2d495b3109..28658da9f42 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -47,6 +47,7 @@
47#include <media/v4l2-mediabus.h> 47#include <media/v4l2-mediabus.h>
48#include <media/s5p_fimc.h> 48#include <media/s5p_fimc.h>
49#include <media/m5mols.h> 49#include <media/m5mols.h>
50#include <media/s5k6aa.h>
50 51
51#include "common.h" 52#include "common.h"
52 53
@@ -123,8 +124,10 @@ static struct regulator_consumer_supply lp3974_buck1_consumer =
123static struct regulator_consumer_supply lp3974_buck2_consumer = 124static struct regulator_consumer_supply lp3974_buck2_consumer =
124 REGULATOR_SUPPLY("vddg3d", NULL); 125 REGULATOR_SUPPLY("vddg3d", NULL);
125 126
126static struct regulator_consumer_supply lp3974_buck3_consumer = 127static struct regulator_consumer_supply lp3974_buck3_consumer[] = {
127 REGULATOR_SUPPLY("vdet", "s5p-sdo"); 128 REGULATOR_SUPPLY("vdet", "s5p-sdo"),
129 REGULATOR_SUPPLY("vdd_reg", "0-003c"),
130};
128 131
129static struct regulator_init_data lp3974_buck1_data = { 132static struct regulator_init_data lp3974_buck1_data = {
130 .constraints = { 133 .constraints = {
@@ -169,8 +172,8 @@ static struct regulator_init_data lp3974_buck3_data = {
169 .enabled = 1, 172 .enabled = 1,
170 }, 173 },
171 }, 174 },
172 .num_consumer_supplies = 1, 175 .num_consumer_supplies = ARRAY_SIZE(lp3974_buck3_consumer),
173 .consumer_supplies = &lp3974_buck3_consumer, 176 .consumer_supplies = lp3974_buck3_consumer,
174}; 177};
175 178
176static struct regulator_init_data lp3974_buck4_data = { 179static struct regulator_init_data lp3974_buck4_data = {
@@ -303,6 +306,9 @@ static struct regulator_init_data lp3974_ldo8_data = {
303 .consumer_supplies = lp3974_ldo8_consumer, 306 .consumer_supplies = lp3974_ldo8_consumer,
304}; 307};
305 308
309static struct regulator_consumer_supply lp3974_ldo9_consumer =
310 REGULATOR_SUPPLY("vddio", "0-003c");
311
306static struct regulator_init_data lp3974_ldo9_data = { 312static struct regulator_init_data lp3974_ldo9_data = {
307 .constraints = { 313 .constraints = {
308 .name = "VCC_2.8V", 314 .name = "VCC_2.8V",
@@ -314,6 +320,8 @@ static struct regulator_init_data lp3974_ldo9_data = {
314 .enabled = 1, 320 .enabled = 1,
315 }, 321 },
316 }, 322 },
323 .num_consumer_supplies = 1,
324 .consumer_supplies = &lp3974_ldo9_consumer,
317}; 325};
318 326
319static struct regulator_init_data lp3974_ldo10_data = { 327static struct regulator_init_data lp3974_ldo10_data = {
@@ -412,6 +420,7 @@ static struct regulator_init_data lp3974_ldo15_data = {
412}; 420};
413 421
414static struct regulator_consumer_supply lp3974_ldo16_consumer[] = { 422static struct regulator_consumer_supply lp3974_ldo16_consumer[] = {
423 REGULATOR_SUPPLY("vdda", "0-003c"),
415 REGULATOR_SUPPLY("a_sensor", "0-001f"), 424 REGULATOR_SUPPLY("a_sensor", "0-001f"),
416}; 425};
417 426
@@ -743,7 +752,7 @@ static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
743}; 752};
744 753
745static struct regulator_consumer_supply mmc0_supplies[] = { 754static struct regulator_consumer_supply mmc0_supplies[] = {
746 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), 755 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"),
747}; 756};
748 757
749static struct regulator_init_data mmc0_fixed_voltage_init_data = { 758static struct regulator_init_data mmc0_fixed_voltage_init_data = {
@@ -819,6 +828,8 @@ static struct s3c_fb_pd_win universal_fb_win0 = {
819 }, 828 },
820 .max_bpp = 32, 829 .max_bpp = 32,
821 .default_bpp = 16, 830 .default_bpp = 16,
831 .virtual_x = 480,
832 .virtual_y = 2 * 800,
822}; 833};
823 834
824static struct s3c_fb_platdata universal_lcd_pdata __initdata = { 835static struct s3c_fb_platdata universal_lcd_pdata __initdata = {
@@ -830,6 +841,28 @@ static struct s3c_fb_platdata universal_lcd_pdata __initdata = {
830 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, 841 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
831}; 842};
832 843
844static struct regulator_consumer_supply cam_vt_dio_supply =
845 REGULATOR_SUPPLY("vdd_core", "0-003c");
846
847static struct regulator_init_data cam_vt_dio_reg_init_data = {
848 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
849 .num_consumer_supplies = 1,
850 .consumer_supplies = &cam_vt_dio_supply,
851};
852
853static struct fixed_voltage_config cam_vt_dio_fixed_voltage_cfg = {
854 .supply_name = "CAM_VT_D_IO",
855 .microvolts = 2800000,
856 .gpio = EXYNOS4_GPE2(1), /* CAM_PWR_EN2 */
857 .enable_high = 1,
858 .init_data = &cam_vt_dio_reg_init_data,
859};
860
861static struct platform_device cam_vt_dio_fixed_reg_dev = {
862 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_DIO,
863 .dev = { .platform_data = &cam_vt_dio_fixed_voltage_cfg },
864};
865
833static struct regulator_consumer_supply cam_i_core_supply = 866static struct regulator_consumer_supply cam_i_core_supply =
834 REGULATOR_SUPPLY("core", "0-001f"); 867 REGULATOR_SUPPLY("core", "0-001f");
835 868
@@ -885,6 +918,28 @@ static struct s5p_platform_mipi_csis mipi_csis_platdata = {
885#define GPIO_CAM_LEVEL_EN(n) EXYNOS4_GPE4(n + 3) 918#define GPIO_CAM_LEVEL_EN(n) EXYNOS4_GPE4(n + 3)
886#define GPIO_CAM_8M_ISP_INT EXYNOS4_GPX1(5) /* XEINT_13 */ 919#define GPIO_CAM_8M_ISP_INT EXYNOS4_GPX1(5) /* XEINT_13 */
887#define GPIO_CAM_MEGA_nRST EXYNOS4_GPE2(5) 920#define GPIO_CAM_MEGA_nRST EXYNOS4_GPE2(5)
921#define GPIO_CAM_VGA_NRST EXYNOS4_GPE4(7)
922#define GPIO_CAM_VGA_NSTBY EXYNOS4_GPE4(6)
923
924static int s5k6aa_set_power(int on)
925{
926 gpio_set_value(GPIO_CAM_LEVEL_EN(2), !!on);
927 return 0;
928}
929
930static struct s5k6aa_platform_data s5k6aa_platdata = {
931 .mclk_frequency = 21600000UL,
932 .gpio_reset = { GPIO_CAM_VGA_NRST, 0 },
933 .gpio_stby = { GPIO_CAM_VGA_NSTBY, 0 },
934 .bus_type = V4L2_MBUS_PARALLEL,
935 .horiz_flip = 1,
936 .set_power = s5k6aa_set_power,
937};
938
939static struct i2c_board_info s5k6aa_board_info = {
940 I2C_BOARD_INFO("S5K6AA", 0x3C),
941 .platform_data = &s5k6aa_platdata,
942};
888 943
889static int m5mols_set_power(struct device *dev, int on) 944static int m5mols_set_power(struct device *dev, int on)
890{ 945{
@@ -909,6 +964,14 @@ static struct s5p_fimc_isp_info universal_camera_sensors[] = {
909 .mux_id = 0, 964 .mux_id = 0,
910 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | 965 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
911 V4L2_MBUS_VSYNC_ACTIVE_LOW, 966 V4L2_MBUS_VSYNC_ACTIVE_LOW,
967 .bus_type = FIMC_ITU_601,
968 .board_info = &s5k6aa_board_info,
969 .i2c_bus_num = 0,
970 .clk_frequency = 24000000UL,
971 }, {
972 .mux_id = 0,
973 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
974 V4L2_MBUS_VSYNC_ACTIVE_LOW,
912 .bus_type = FIMC_MIPI_CSI2, 975 .bus_type = FIMC_MIPI_CSI2,
913 .board_info = &m5mols_board_info, 976 .board_info = &m5mols_board_info,
914 .i2c_bus_num = 0, 977 .i2c_bus_num = 0,
@@ -927,9 +990,11 @@ static struct gpio universal_camera_gpios[] = {
927 { GPIO_CAM_LEVEL_EN(2), GPIOF_OUT_INIT_LOW, "CAM_LVL_EN2" }, 990 { GPIO_CAM_LEVEL_EN(2), GPIOF_OUT_INIT_LOW, "CAM_LVL_EN2" },
928 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" }, 991 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
929 { GPIO_CAM_MEGA_nRST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" }, 992 { GPIO_CAM_MEGA_nRST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
993 { GPIO_CAM_VGA_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" },
994 { GPIO_CAM_VGA_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
930}; 995};
931 996
932static void universal_camera_init(void) 997static void __init universal_camera_init(void)
933{ 998{
934 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata), 999 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
935 &s5p_device_mipi_csis0); 1000 &s5p_device_mipi_csis0);
@@ -950,6 +1015,8 @@ static void universal_camera_init(void)
950 /* Free GPIOs controlled directly by the sensor drivers. */ 1015 /* Free GPIOs controlled directly by the sensor drivers. */
951 gpio_free(GPIO_CAM_MEGA_nRST); 1016 gpio_free(GPIO_CAM_MEGA_nRST);
952 gpio_free(GPIO_CAM_8M_ISP_INT); 1017 gpio_free(GPIO_CAM_8M_ISP_INT);
1018 gpio_free(GPIO_CAM_VGA_NRST);
1019 gpio_free(GPIO_CAM_VGA_NSTBY);
953 1020
954 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) 1021 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A))
955 pr_err("Camera port A setup failed\n"); 1022 pr_err("Camera port A setup failed\n");
@@ -962,6 +1029,7 @@ static struct platform_device *universal_devices[] __initdata = {
962 &s5p_device_fimc1, 1029 &s5p_device_fimc1,
963 &s5p_device_fimc2, 1030 &s5p_device_fimc2,
964 &s5p_device_fimc3, 1031 &s5p_device_fimc3,
1032 &s5p_device_g2d,
965 &mmc0_fixed_voltage, 1033 &mmc0_fixed_voltage,
966 &s3c_device_hsmmc0, 1034 &s3c_device_hsmmc0,
967 &s3c_device_hsmmc2, 1035 &s3c_device_hsmmc2,
@@ -980,9 +1048,11 @@ static struct platform_device *universal_devices[] __initdata = {
980 &universal_gpio_keys, 1048 &universal_gpio_keys,
981 &s5p_device_onenand, 1049 &s5p_device_onenand,
982 &s5p_device_fimd0, 1050 &s5p_device_fimd0,
1051 &s5p_device_jpeg,
983 &s5p_device_mfc, 1052 &s5p_device_mfc,
984 &s5p_device_mfc_l, 1053 &s5p_device_mfc_l,
985 &s5p_device_mfc_r, 1054 &s5p_device_mfc_r,
1055 &cam_vt_dio_fixed_reg_dev,
986 &cam_i_core_fixed_reg_dev, 1056 &cam_i_core_fixed_reg_dev,
987 &cam_s_if_fixed_reg_dev, 1057 &cam_s_if_fixed_reg_dev,
988 &s5p_device_fimc_md, 1058 &s5p_device_fimc_md,
@@ -995,7 +1065,7 @@ static void __init universal_map_io(void)
995 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); 1065 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
996} 1066}
997 1067
998void s5p_tv_setup(void) 1068static void s5p_tv_setup(void)
999{ 1069{
1000 /* direct HPD to HDMI chip */ 1070 /* direct HPD to HDMI chip */
1001 gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug"); 1071 gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
index 85b5527d091..e8a1caaf190 100644
--- a/arch/arm/mach-exynos/mct.c
+++ b/arch/arm/mach-exynos/mct.c
@@ -21,6 +21,7 @@
21#include <linux/percpu.h> 21#include <linux/percpu.h>
22 22
23#include <asm/hardware/gic.h> 23#include <asm/hardware/gic.h>
24#include <asm/localtimer.h>
24 25
25#include <plat/cpu.h> 26#include <plat/cpu.h>
26 27
@@ -29,12 +30,13 @@
29#include <mach/regs-mct.h> 30#include <mach/regs-mct.h>
30#include <asm/mach/time.h> 31#include <asm/mach/time.h>
31 32
33#define TICK_BASE_CNT 1
34
32enum { 35enum {
33 MCT_INT_SPI, 36 MCT_INT_SPI,
34 MCT_INT_PPI 37 MCT_INT_PPI
35}; 38};
36 39
37static unsigned long clk_cnt_per_tick;
38static unsigned long clk_rate; 40static unsigned long clk_rate;
39static unsigned int mct_int_type; 41static unsigned int mct_int_type;
40 42
@@ -205,11 +207,14 @@ static int exynos4_comp_set_next_event(unsigned long cycles,
205static void exynos4_comp_set_mode(enum clock_event_mode mode, 207static void exynos4_comp_set_mode(enum clock_event_mode mode,
206 struct clock_event_device *evt) 208 struct clock_event_device *evt)
207{ 209{
210 unsigned long cycles_per_jiffy;
208 exynos4_mct_comp0_stop(); 211 exynos4_mct_comp0_stop();
209 212
210 switch (mode) { 213 switch (mode) {
211 case CLOCK_EVT_MODE_PERIODIC: 214 case CLOCK_EVT_MODE_PERIODIC:
212 exynos4_mct_comp0_start(mode, clk_cnt_per_tick); 215 cycles_per_jiffy =
216 (((unsigned long long) NSEC_PER_SEC / HZ * evt->mult) >> evt->shift);
217 exynos4_mct_comp0_start(mode, cycles_per_jiffy);
213 break; 218 break;
214 219
215 case CLOCK_EVT_MODE_ONESHOT: 220 case CLOCK_EVT_MODE_ONESHOT:
@@ -248,9 +253,7 @@ static struct irqaction mct_comp_event_irq = {
248 253
249static void exynos4_clockevent_init(void) 254static void exynos4_clockevent_init(void)
250{ 255{
251 clk_cnt_per_tick = clk_rate / 2 / HZ; 256 clockevents_calc_mult_shift(&mct_comp_device, clk_rate, 5);
252
253 clockevents_calc_mult_shift(&mct_comp_device, clk_rate / 2, 5);
254 mct_comp_device.max_delta_ns = 257 mct_comp_device.max_delta_ns =
255 clockevent_delta2ns(0xffffffff, &mct_comp_device); 258 clockevent_delta2ns(0xffffffff, &mct_comp_device);
256 mct_comp_device.min_delta_ns = 259 mct_comp_device.min_delta_ns =
@@ -314,12 +317,15 @@ static inline void exynos4_tick_set_mode(enum clock_event_mode mode,
314 struct clock_event_device *evt) 317 struct clock_event_device *evt)
315{ 318{
316 struct mct_clock_event_device *mevt = this_cpu_ptr(&percpu_mct_tick); 319 struct mct_clock_event_device *mevt = this_cpu_ptr(&percpu_mct_tick);
320 unsigned long cycles_per_jiffy;
317 321
318 exynos4_mct_tick_stop(mevt); 322 exynos4_mct_tick_stop(mevt);
319 323
320 switch (mode) { 324 switch (mode) {
321 case CLOCK_EVT_MODE_PERIODIC: 325 case CLOCK_EVT_MODE_PERIODIC:
322 exynos4_mct_tick_start(clk_cnt_per_tick, mevt); 326 cycles_per_jiffy =
327 (((unsigned long long) NSEC_PER_SEC / HZ * evt->mult) >> evt->shift);
328 exynos4_mct_tick_start(cycles_per_jiffy, mevt);
323 break; 329 break;
324 330
325 case CLOCK_EVT_MODE_ONESHOT: 331 case CLOCK_EVT_MODE_ONESHOT:
@@ -375,7 +381,7 @@ static struct irqaction mct_tick1_event_irq = {
375 .handler = exynos4_mct_tick_isr, 381 .handler = exynos4_mct_tick_isr,
376}; 382};
377 383
378static void exynos4_mct_tick_init(struct clock_event_device *evt) 384static int __cpuinit exynos4_local_timer_setup(struct clock_event_device *evt)
379{ 385{
380 struct mct_clock_event_device *mevt; 386 struct mct_clock_event_device *mevt;
381 unsigned int cpu = smp_processor_id(); 387 unsigned int cpu = smp_processor_id();
@@ -393,7 +399,7 @@ static void exynos4_mct_tick_init(struct clock_event_device *evt)
393 evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; 399 evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
394 evt->rating = 450; 400 evt->rating = 450;
395 401
396 clockevents_calc_mult_shift(evt, clk_rate / 2, 5); 402 clockevents_calc_mult_shift(evt, clk_rate / (TICK_BASE_CNT + 1), 5);
397 evt->max_delta_ns = 403 evt->max_delta_ns =
398 clockevent_delta2ns(0x7fffffff, evt); 404 clockevent_delta2ns(0x7fffffff, evt);
399 evt->min_delta_ns = 405 evt->min_delta_ns =
@@ -401,7 +407,7 @@ static void exynos4_mct_tick_init(struct clock_event_device *evt)
401 407
402 clockevents_register_device(evt); 408 clockevents_register_device(evt);
403 409
404 exynos4_mct_write(0x1, mevt->base + MCT_L_TCNTB_OFFSET); 410 exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET);
405 411
406 if (mct_int_type == MCT_INT_SPI) { 412 if (mct_int_type == MCT_INT_SPI) {
407 if (cpu == 0) { 413 if (cpu == 0) {
@@ -417,17 +423,11 @@ static void exynos4_mct_tick_init(struct clock_event_device *evt)
417 } else { 423 } else {
418 enable_percpu_irq(IRQ_MCT_LOCALTIMER, 0); 424 enable_percpu_irq(IRQ_MCT_LOCALTIMER, 0);
419 } 425 }
420}
421
422/* Setup the local clock events for a CPU */
423int __cpuinit local_timer_setup(struct clock_event_device *evt)
424{
425 exynos4_mct_tick_init(evt);
426 426
427 return 0; 427 return 0;
428} 428}
429 429
430void local_timer_stop(struct clock_event_device *evt) 430static void exynos4_local_timer_stop(struct clock_event_device *evt)
431{ 431{
432 unsigned int cpu = smp_processor_id(); 432 unsigned int cpu = smp_processor_id();
433 evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); 433 evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
@@ -439,6 +439,11 @@ void local_timer_stop(struct clock_event_device *evt)
439 else 439 else
440 disable_percpu_irq(IRQ_MCT_LOCALTIMER); 440 disable_percpu_irq(IRQ_MCT_LOCALTIMER);
441} 441}
442
443static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = {
444 .setup = exynos4_local_timer_setup,
445 .stop = exynos4_local_timer_stop,
446};
442#endif /* CONFIG_LOCAL_TIMERS */ 447#endif /* CONFIG_LOCAL_TIMERS */
443 448
444static void __init exynos4_timer_resources(void) 449static void __init exynos4_timer_resources(void)
@@ -458,6 +463,8 @@ static void __init exynos4_timer_resources(void)
458 WARN(err, "MCT: can't request IRQ %d (%d)\n", 463 WARN(err, "MCT: can't request IRQ %d (%d)\n",
459 IRQ_MCT_LOCALTIMER, err); 464 IRQ_MCT_LOCALTIMER, err);
460 } 465 }
466
467 local_timer_register(&exynos4_mct_tick_ops);
461#endif /* CONFIG_LOCAL_TIMERS */ 468#endif /* CONFIG_LOCAL_TIMERS */
462} 469}
463 470
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index e1901305177..428cfeb5772 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -38,29 +38,29 @@
38#include <mach/pmu.h> 38#include <mach/pmu.h>
39 39
40static struct sleep_save exynos4_set_clksrc[] = { 40static struct sleep_save exynos4_set_clksrc[] = {
41 { .reg = S5P_CLKSRC_MASK_TOP , .val = 0x00000001, }, 41 { .reg = EXYNOS4_CLKSRC_MASK_TOP , .val = 0x00000001, },
42 { .reg = S5P_CLKSRC_MASK_CAM , .val = 0x11111111, }, 42 { .reg = EXYNOS4_CLKSRC_MASK_CAM , .val = 0x11111111, },
43 { .reg = S5P_CLKSRC_MASK_TV , .val = 0x00000111, }, 43 { .reg = EXYNOS4_CLKSRC_MASK_TV , .val = 0x00000111, },
44 { .reg = S5P_CLKSRC_MASK_LCD0 , .val = 0x00001111, }, 44 { .reg = EXYNOS4_CLKSRC_MASK_LCD0 , .val = 0x00001111, },
45 { .reg = S5P_CLKSRC_MASK_MAUDIO , .val = 0x00000001, }, 45 { .reg = EXYNOS4_CLKSRC_MASK_MAUDIO , .val = 0x00000001, },
46 { .reg = S5P_CLKSRC_MASK_FSYS , .val = 0x01011111, }, 46 { .reg = EXYNOS4_CLKSRC_MASK_FSYS , .val = 0x01011111, },
47 { .reg = S5P_CLKSRC_MASK_PERIL0 , .val = 0x01111111, }, 47 { .reg = EXYNOS4_CLKSRC_MASK_PERIL0 , .val = 0x01111111, },
48 { .reg = S5P_CLKSRC_MASK_PERIL1 , .val = 0x01110111, }, 48 { .reg = EXYNOS4_CLKSRC_MASK_PERIL1 , .val = 0x01110111, },
49 { .reg = S5P_CLKSRC_MASK_DMC , .val = 0x00010000, }, 49 { .reg = EXYNOS4_CLKSRC_MASK_DMC , .val = 0x00010000, },
50}; 50};
51 51
52static struct sleep_save exynos4210_set_clksrc[] = { 52static struct sleep_save exynos4210_set_clksrc[] = {
53 { .reg = S5P_CLKSRC_MASK_LCD1 , .val = 0x00001111, }, 53 { .reg = EXYNOS4210_CLKSRC_MASK_LCD1 , .val = 0x00001111, },
54}; 54};
55 55
56static struct sleep_save exynos4_epll_save[] = { 56static struct sleep_save exynos4_epll_save[] = {
57 SAVE_ITEM(S5P_EPLL_CON0), 57 SAVE_ITEM(EXYNOS4_EPLL_CON0),
58 SAVE_ITEM(S5P_EPLL_CON1), 58 SAVE_ITEM(EXYNOS4_EPLL_CON1),
59}; 59};
60 60
61static struct sleep_save exynos4_vpll_save[] = { 61static struct sleep_save exynos4_vpll_save[] = {
62 SAVE_ITEM(S5P_VPLL_CON0), 62 SAVE_ITEM(EXYNOS4_VPLL_CON0),
63 SAVE_ITEM(S5P_VPLL_CON1), 63 SAVE_ITEM(EXYNOS4_VPLL_CON1),
64}; 64};
65 65
66static struct sleep_save exynos4_core_save[] = { 66static struct sleep_save exynos4_core_save[] = {
@@ -155,13 +155,6 @@ static struct sleep_save exynos4_core_save[] = {
155 SAVE_ITEM(S5P_SROM_BC3), 155 SAVE_ITEM(S5P_SROM_BC3),
156}; 156};
157 157
158static struct sleep_save exynos4_l2cc_save[] = {
159 SAVE_ITEM(S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL),
160 SAVE_ITEM(S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL),
161 SAVE_ITEM(S5P_VA_L2CC + L2X0_PREFETCH_CTRL),
162 SAVE_ITEM(S5P_VA_L2CC + L2X0_POWER_CTRL),
163 SAVE_ITEM(S5P_VA_L2CC + L2X0_AUX_CTRL),
164};
165 158
166/* For Cortex-A9 Diagnostic and Power control register */ 159/* For Cortex-A9 Diagnostic and Power control register */
167static unsigned int save_arm_register[2]; 160static unsigned int save_arm_register[2];
@@ -182,7 +175,6 @@ static void exynos4_pm_prepare(void)
182 u32 tmp; 175 u32 tmp;
183 176
184 s3c_pm_do_save(exynos4_core_save, ARRAY_SIZE(exynos4_core_save)); 177 s3c_pm_do_save(exynos4_core_save, ARRAY_SIZE(exynos4_core_save));
185 s3c_pm_do_save(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save));
186 s3c_pm_do_save(exynos4_epll_save, ARRAY_SIZE(exynos4_epll_save)); 178 s3c_pm_do_save(exynos4_epll_save, ARRAY_SIZE(exynos4_epll_save));
187 s3c_pm_do_save(exynos4_vpll_save, ARRAY_SIZE(exynos4_vpll_save)); 179 s3c_pm_do_save(exynos4_vpll_save, ARRAY_SIZE(exynos4_vpll_save));
188 180
@@ -239,7 +231,7 @@ static void exynos4_restore_pll(void)
239 locktime = (3000 / pll_in_rate) * p_div; 231 locktime = (3000 / pll_in_rate) * p_div;
240 lockcnt = locktime * 10000 / (10000 / pll_in_rate); 232 lockcnt = locktime * 10000 / (10000 / pll_in_rate);
241 233
242 __raw_writel(lockcnt, S5P_EPLL_LOCK); 234 __raw_writel(lockcnt, EXYNOS4_EPLL_LOCK);
243 235
244 s3c_pm_do_restore_core(exynos4_epll_save, 236 s3c_pm_do_restore_core(exynos4_epll_save,
245 ARRAY_SIZE(exynos4_epll_save)); 237 ARRAY_SIZE(exynos4_epll_save));
@@ -257,7 +249,7 @@ static void exynos4_restore_pll(void)
257 locktime = 750; 249 locktime = 750;
258 lockcnt = locktime * 10000 / (10000 / pll_in_rate); 250 lockcnt = locktime * 10000 / (10000 / pll_in_rate);
259 251
260 __raw_writel(lockcnt, S5P_VPLL_LOCK); 252 __raw_writel(lockcnt, EXYNOS4_VPLL_LOCK);
261 253
262 s3c_pm_do_restore_core(exynos4_vpll_save, 254 s3c_pm_do_restore_core(exynos4_vpll_save,
263 ARRAY_SIZE(exynos4_vpll_save)); 255 ARRAY_SIZE(exynos4_vpll_save));
@@ -268,14 +260,14 @@ static void exynos4_restore_pll(void)
268 260
269 do { 261 do {
270 if (epll_wait) { 262 if (epll_wait) {
271 pll_con = __raw_readl(S5P_EPLL_CON0); 263 pll_con = __raw_readl(EXYNOS4_EPLL_CON0);
272 if (pll_con & (1 << S5P_EPLLCON0_LOCKED_SHIFT)) 264 if (pll_con & (1 << EXYNOS4_EPLLCON0_LOCKED_SHIFT))
273 epll_wait = 0; 265 epll_wait = 0;
274 } 266 }
275 267
276 if (vpll_wait) { 268 if (vpll_wait) {
277 pll_con = __raw_readl(S5P_VPLL_CON0); 269 pll_con = __raw_readl(EXYNOS4_VPLL_CON0);
278 if (pll_con & (1 << S5P_VPLLCON0_LOCKED_SHIFT)) 270 if (pll_con & (1 << EXYNOS4_VPLLCON0_LOCKED_SHIFT))
279 vpll_wait = 0; 271 vpll_wait = 0;
280 } 272 }
281 } while (epll_wait || vpll_wait); 273 } while (epll_wait || vpll_wait);
@@ -388,13 +380,6 @@ static void exynos4_pm_resume(void)
388 scu_enable(S5P_VA_SCU); 380 scu_enable(S5P_VA_SCU);
389#endif 381#endif
390 382
391#ifdef CONFIG_CACHE_L2X0
392 s3c_pm_do_restore_core(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save));
393 outer_inv_all();
394 /* enable L2X0*/
395 writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL);
396#endif
397
398early_wakeup: 383early_wakeup:
399 return; 384 return;
400} 385}
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
index f685650c25d..3194d3f7350 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -275,11 +275,13 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys)
275 allocate_resource(&iomem_resource, &res[0], 0x40000000, 275 allocate_resource(&iomem_resource, &res[0], 0x40000000,
276 0x80000000, 0xffffffff, 0x40000000, NULL, NULL); 276 0x80000000, 0xffffffff, 0x40000000, NULL, NULL);
277 277
278 pci_add_resource(&sys->resources, &ioport_resource);
279 pci_add_resource(&sys->resources, &res[0]);
280 pci_add_resource(&sys->resources, &res[1]);
281 sys->mem_offset = DC21285_PCI_MEM; 278 sys->mem_offset = DC21285_PCI_MEM;
282 279
280 pci_add_resource_offset(&sys->resources,
281 &ioport_resource, sys->io_offset);
282 pci_add_resource_offset(&sys->resources, &res[0], sys->mem_offset);
283 pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset);
284
283 return 1; 285 return 1;
284} 286}
285 287
diff --git a/arch/arm/mach-footbridge/include/mach/entry-macro.S b/arch/arm/mach-footbridge/include/mach/entry-macro.S
index d3847be0c66..dabbd5c54a7 100644
--- a/arch/arm/mach-footbridge/include/mach/entry-macro.S
+++ b/arch/arm/mach-footbridge/include/mach/entry-macro.S
@@ -14,9 +14,6 @@
14 .equ dc21285_high, ARMCSR_BASE & 0xff000000 14 .equ dc21285_high, ARMCSR_BASE & 0xff000000
15 .equ dc21285_low, ARMCSR_BASE & 0x00ffffff 15 .equ dc21285_low, ARMCSR_BASE & 0x00ffffff
16 16
17 .macro disable_fiq
18 .endm
19
20 .macro get_irqnr_preamble, base, tmp 17 .macro get_irqnr_preamble, base, tmp
21 mov \base, #dc21285_high 18 mov \base, #dc21285_high
22 .if dc21285_low 19 .if dc21285_low
@@ -24,9 +21,6 @@
24 .endif 21 .endif
25 .endm 22 .endm
26 23
27 .macro arch_ret_to_user, tmp1, tmp2
28 .endm
29
30 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
31 ldr \irqstat, [\base, #0x180] @ get interrupts 25 ldr \irqstat, [\base, #0x180] @ get interrupts
32 26
diff --git a/arch/arm/mach-footbridge/include/mach/system.h b/arch/arm/mach-footbridge/include/mach/system.h
deleted file mode 100644
index a174a5841bc..00000000000
--- a/arch/arm/mach-footbridge/include/mach/system.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/system.h
3 *
4 * Copyright (C) 1996-1999 Russell King.
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 */
10static inline void arch_idle(void)
11{
12 cpu_do_idle();
13}
diff --git a/arch/arm/mach-gemini/Makefile b/arch/arm/mach-gemini/Makefile
index c5b24b95a76..7355c0bbcb5 100644
--- a/arch/arm/mach-gemini/Makefile
+++ b/arch/arm/mach-gemini/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := irq.o mm.o time.o devices.o gpio.o 7obj-y := irq.o mm.o time.o devices.o gpio.o idle.o
8 8
9# Board-specific support 9# Board-specific support
10obj-$(CONFIG_MACH_NAS4220B) += board-nas4220b.o 10obj-$(CONFIG_MACH_NAS4220B) += board-nas4220b.o
diff --git a/arch/arm/mach-gemini/idle.c b/arch/arm/mach-gemini/idle.c
new file mode 100644
index 00000000000..92bbd6bb600
--- /dev/null
+++ b/arch/arm/mach-gemini/idle.c
@@ -0,0 +1,29 @@
1/*
2 * arch/arm/mach-gemini/idle.c
3 */
4
5#include <linux/init.h>
6#include <asm/system.h>
7#include <asm/proc-fns.h>
8
9static void gemini_idle(void)
10{
11 /*
12 * Because of broken hardware we have to enable interrupts or the CPU
13 * will never wakeup... Acctualy it is not very good to enable
14 * interrupts first since scheduler can miss a tick, but there is
15 * no other way around this. Platforms that needs it for power saving
16 * should call enable_hlt() in init code, since by default it is
17 * disabled.
18 */
19 local_irq_enable();
20 cpu_do_idle();
21}
22
23static int __init gemini_idle_init(void)
24{
25 arm_pm_idle = gemini_idle;
26 return 0;
27}
28
29arch_initcall(gemini_idle_init);
diff --git a/arch/arm/mach-gemini/include/mach/entry-macro.S b/arch/arm/mach-gemini/include/mach/entry-macro.S
index 1624f91a2b8..f044e430bfa 100644
--- a/arch/arm/mach-gemini/include/mach/entry-macro.S
+++ b/arch/arm/mach-gemini/include/mach/entry-macro.S
@@ -12,15 +12,9 @@
12 12
13#define IRQ_STATUS 0x14 13#define IRQ_STATUS 0x14
14 14
15 .macro disable_fiq
16 .endm
17
18 .macro get_irqnr_preamble, base, tmp 15 .macro get_irqnr_preamble, base, tmp
19 .endm 16 .endm
20 17
21 .macro arch_ret_to_user, tmp1, tmp2
22 .endm
23
24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 18 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
25 ldr \irqstat, =IO_ADDRESS(GEMINI_INTERRUPT_BASE + IRQ_STATUS) 19 ldr \irqstat, =IO_ADDRESS(GEMINI_INTERRUPT_BASE + IRQ_STATUS)
26 ldr \irqnr, [\irqstat] 20 ldr \irqnr, [\irqstat]
diff --git a/arch/arm/mach-gemini/include/mach/system.h b/arch/arm/mach-gemini/include/mach/system.h
index 4d9c1f87247..a33b5a1f8ab 100644
--- a/arch/arm/mach-gemini/include/mach/system.h
+++ b/arch/arm/mach-gemini/include/mach/system.h
@@ -14,20 +14,6 @@
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <mach/global_reg.h> 15#include <mach/global_reg.h>
16 16
17static inline void arch_idle(void)
18{
19 /*
20 * Because of broken hardware we have to enable interrupts or the CPU
21 * will never wakeup... Acctualy it is not very good to enable
22 * interrupts here since scheduler can miss a tick, but there is
23 * no other way around this. Platforms that needs it for power saving
24 * should call enable_hlt() in init code, since by default it is
25 * disabled.
26 */
27 local_irq_enable();
28 cpu_do_idle();
29}
30
31static inline void arch_reset(char mode, const char *cmd) 17static inline void arch_reset(char mode, const char *cmd)
32{ 18{
33 __raw_writel(RESET_GLOBAL | RESET_CPU1, 19 __raw_writel(RESET_GLOBAL | RESET_CPU1,
diff --git a/arch/arm/mach-gemini/irq.c b/arch/arm/mach-gemini/irq.c
index 9485a8fdf85..ca70e5fcc7a 100644
--- a/arch/arm/mach-gemini/irq.c
+++ b/arch/arm/mach-gemini/irq.c
@@ -73,8 +73,8 @@ void __init gemini_init_irq(void)
73 unsigned int i, mode = 0, level = 0; 73 unsigned int i, mode = 0, level = 0;
74 74
75 /* 75 /*
76 * Disable arch_idle() by default since it is buggy 76 * Disable the idle handler by default since it is buggy
77 * For more info see arch/arm/mach-gemini/include/mach/system.h 77 * For more info see arch/arm/mach-gemini/idle.c
78 */ 78 */
79 disable_hlt(); 79 disable_hlt();
80 80
diff --git a/arch/arm/mach-h720x/common.c b/arch/arm/mach-h720x/common.c
index f8a2f6bb548..e756d1ac00c 100644
--- a/arch/arm/mach-h720x/common.c
+++ b/arch/arm/mach-h720x/common.c
@@ -247,3 +247,21 @@ void h720x_restart(char mode, const char *cmd)
247{ 247{
248 CPU_REG (PMU_BASE, PMU_STAT) |= PMU_WARMRESET; 248 CPU_REG (PMU_BASE, PMU_STAT) |= PMU_WARMRESET;
249} 249}
250
251static void h720x__idle(void)
252{
253 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_IDLE;
254 nop();
255 nop();
256 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_RUN;
257 nop();
258 nop();
259}
260
261static int __init h720x_idle_init(void)
262{
263 arm_pm_idle = h720x__idle;
264 return 0;
265}
266
267arch_initcall(h720x_idle_init);
diff --git a/arch/arm/mach-h720x/include/mach/entry-macro.S b/arch/arm/mach-h720x/include/mach/entry-macro.S
index c3948e5ba4a..75267fad701 100644
--- a/arch/arm/mach-h720x/include/mach/entry-macro.S
+++ b/arch/arm/mach-h720x/include/mach/entry-macro.S
@@ -8,15 +8,9 @@
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10
11 .macro disable_fiq
12 .endm
13
14 .macro get_irqnr_preamble, base, tmp 11 .macro get_irqnr_preamble, base, tmp
15 .endm 12 .endm
16 13
17 .macro arch_ret_to_user, tmp1, tmp2
18 .endm
19
20 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 14 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
21#if defined (CONFIG_CPU_H7201) || defined (CONFIG_CPU_H7202) 15#if defined (CONFIG_CPU_H7201) || defined (CONFIG_CPU_H7202)
22 @ we could use the id register on H7202, but this is not 16 @ we could use the id register on H7202, but this is not
diff --git a/arch/arm/mach-h720x/include/mach/system.h b/arch/arm/mach-h720x/include/mach/system.h
deleted file mode 100644
index 16ac46e239a..00000000000
--- a/arch/arm/mach-h720x/include/mach/system.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * arch/arm/mach-h720x/include/mach/system.h
3 *
4 * Copyright (C) 2001-2002 Jungjun Kim, Hynix Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 * arch/arm/mach-h720x/include/mach/system.h
10 *
11 */
12
13#ifndef __ASM_ARCH_SYSTEM_H
14#define __ASM_ARCH_SYSTEM_H
15#include <mach/hardware.h>
16
17static void arch_idle(void)
18{
19 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_IDLE;
20 nop();
21 nop();
22 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_RUN;
23 nop();
24 nop();
25}
26
27#endif
diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile
index 986958a5a72..f8437dd238c 100644
--- a/arch/arm/mach-highbank/Makefile
+++ b/arch/arm/mach-highbank/Makefile
@@ -1,6 +1,5 @@
1obj-y := clock.o highbank.o system.o 1obj-y := clock.o highbank.o system.o
2obj-$(CONFIG_DEBUG_HIGHBANK_UART) += lluart.o 2obj-$(CONFIG_DEBUG_HIGHBANK_UART) += lluart.o
3obj-$(CONFIG_SMP) += platsmp.o 3obj-$(CONFIG_SMP) += platsmp.o
4obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
5obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 4obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
6obj-$(CONFIG_PM_SLEEP) += pm.o 5obj-$(CONFIG_PM_SLEEP) += pm.o
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 8394d512a40..808b055289b 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -27,6 +27,7 @@
27#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
28#include <asm/smp_plat.h> 28#include <asm/smp_plat.h>
29#include <asm/smp_scu.h> 29#include <asm/smp_scu.h>
30#include <asm/smp_twd.h>
30#include <asm/hardware/arm_timer.h> 31#include <asm/hardware/arm_timer.h>
31#include <asm/hardware/timer-sp.h> 32#include <asm/hardware/timer-sp.h>
32#include <asm/hardware/gic.h> 33#include <asm/hardware/gic.h>
@@ -109,8 +110,10 @@ static void __init highbank_timer_init(void)
109 110
110 highbank_clocks_init(); 111 highbank_clocks_init();
111 112
112 sp804_clocksource_init(timer_base + 0x20, "timer1"); 113 sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1");
113 sp804_clockevents_init(timer_base, irq, "timer0"); 114 sp804_clockevents_init(timer_base, irq, "timer0");
115
116 twd_local_timer_of_register();
114} 117}
115 118
116static struct sys_timer highbank_timer = { 119static struct sys_timer highbank_timer = {
diff --git a/arch/arm/mach-highbank/include/mach/entry-macro.S b/arch/arm/mach-highbank/include/mach/entry-macro.S
deleted file mode 100644
index a14f9e62ca9..00000000000
--- a/arch/arm/mach-highbank/include/mach/entry-macro.S
+++ /dev/null
@@ -1,5 +0,0 @@
1 .macro disable_fiq
2 .endm
3
4 .macro arch_ret_to_user, tmp1, tmp2
5 .endm
diff --git a/arch/arm/mach-highbank/include/mach/memory.h b/arch/arm/mach-highbank/include/mach/memory.h
deleted file mode 100644
index 40a8c178f10..00000000000
--- a/arch/arm/mach-highbank/include/mach/memory.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-highbank/localtimer.c b/arch/arm/mach-highbank/localtimer.c
deleted file mode 100644
index 5a00e7945fd..00000000000
--- a/arch/arm/mach-highbank/localtimer.c
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright 2010-2011 Calxeda, Inc.
3 * Based on localtimer.c, Copyright (C) 2002 ARM Ltd.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17#include <linux/init.h>
18#include <linux/clockchips.h>
19#include <linux/of.h>
20#include <linux/of_address.h>
21#include <linux/of_irq.h>
22
23#include <asm/smp_twd.h>
24
25/*
26 * Setup the local clock events for a CPU.
27 */
28int __cpuinit local_timer_setup(struct clock_event_device *evt)
29{
30 struct device_node *np;
31
32 np = of_find_compatible_node(NULL, NULL, "arm,smp-twd");
33 if (!twd_base) {
34 twd_base = of_iomap(np, 0);
35 WARN_ON(!twd_base);
36 }
37 evt->irq = irq_of_parse_and_map(np, 0);
38 twd_timer_setup(evt);
39 return 0;
40}
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 4defb97bbfc..52359f80c42 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -46,7 +46,6 @@ config SOC_IMX21
46 bool 46 bool
47 select MACH_MX21 47 select MACH_MX21
48 select CPU_ARM926T 48 select CPU_ARM926T
49 select ARCH_MXC_AUDMUX_V1
50 select IMX_HAVE_DMA_V1 49 select IMX_HAVE_DMA_V1
51 select IMX_HAVE_IOMUX_V1 50 select IMX_HAVE_IOMUX_V1
52 select MXC_AVIC 51 select MXC_AVIC
@@ -55,7 +54,6 @@ config SOC_IMX25
55 bool 54 bool
56 select ARCH_MX25 55 select ARCH_MX25
57 select CPU_ARM926T 56 select CPU_ARM926T
58 select ARCH_MXC_AUDMUX_V2
59 select ARCH_MXC_IOMUX_V3 57 select ARCH_MXC_IOMUX_V3
60 select MXC_AVIC 58 select MXC_AVIC
61 59
@@ -63,7 +61,6 @@ config SOC_IMX27
63 bool 61 bool
64 select MACH_MX27 62 select MACH_MX27
65 select CPU_ARM926T 63 select CPU_ARM926T
66 select ARCH_MXC_AUDMUX_V1
67 select IMX_HAVE_DMA_V1 64 select IMX_HAVE_DMA_V1
68 select IMX_HAVE_IOMUX_V1 65 select IMX_HAVE_IOMUX_V1
69 select MXC_AVIC 66 select MXC_AVIC
@@ -72,7 +69,6 @@ config SOC_IMX31
72 bool 69 bool
73 select CPU_V6 70 select CPU_V6
74 select IMX_HAVE_PLATFORM_MXC_RNGA 71 select IMX_HAVE_PLATFORM_MXC_RNGA
75 select ARCH_MXC_AUDMUX_V2
76 select MXC_AVIC 72 select MXC_AVIC
77 select SMP_ON_UP if SMP 73 select SMP_ON_UP if SMP
78 74
@@ -80,7 +76,6 @@ config SOC_IMX35
80 bool 76 bool
81 select CPU_V6 77 select CPU_V6
82 select ARCH_MXC_IOMUX_V3 78 select ARCH_MXC_IOMUX_V3
83 select ARCH_MXC_AUDMUX_V2
84 select HAVE_EPIT 79 select HAVE_EPIT
85 select MXC_AVIC 80 select MXC_AVIC
86 select SMP_ON_UP if SMP 81 select SMP_ON_UP if SMP
@@ -89,7 +84,6 @@ config SOC_IMX5
89 select CPU_V7 84 select CPU_V7
90 select MXC_TZIC 85 select MXC_TZIC
91 select ARCH_MXC_IOMUX_V3 86 select ARCH_MXC_IOMUX_V3
92 select ARCH_MXC_AUDMUX_V2
93 select ARCH_HAS_CPUFREQ 87 select ARCH_HAS_CPUFREQ
94 select ARCH_MX5 88 select ARCH_MX5
95 bool 89 bool
@@ -304,6 +298,7 @@ config MACH_MX27_3DS
304 select IMX_HAVE_PLATFORM_IMX_I2C 298 select IMX_HAVE_PLATFORM_IMX_I2C
305 select IMX_HAVE_PLATFORM_IMX_KEYPAD 299 select IMX_HAVE_PLATFORM_IMX_KEYPAD
306 select IMX_HAVE_PLATFORM_IMX_UART 300 select IMX_HAVE_PLATFORM_IMX_UART
301 select IMX_HAVE_PLATFORM_MX2_CAMERA
307 select IMX_HAVE_PLATFORM_MXC_EHCI 302 select IMX_HAVE_PLATFORM_MXC_EHCI
308 select IMX_HAVE_PLATFORM_MXC_MMC 303 select IMX_HAVE_PLATFORM_MXC_MMC
309 select IMX_HAVE_PLATFORM_SPI_IMX 304 select IMX_HAVE_PLATFORM_SPI_IMX
@@ -320,8 +315,10 @@ config MACH_IMX27_VISSTRIM_M10
320 select IMX_HAVE_PLATFORM_IMX_I2C 315 select IMX_HAVE_PLATFORM_IMX_I2C
321 select IMX_HAVE_PLATFORM_IMX_SSI 316 select IMX_HAVE_PLATFORM_IMX_SSI
322 select IMX_HAVE_PLATFORM_IMX_UART 317 select IMX_HAVE_PLATFORM_IMX_UART
323 select IMX_HAVE_PLATFORM_MXC_MMC 318 select IMX_HAVE_PLATFORM_MX2_CAMERA
324 select IMX_HAVE_PLATFORM_MXC_EHCI 319 select IMX_HAVE_PLATFORM_MXC_EHCI
320 select IMX_HAVE_PLATFORM_MXC_MMC
321 select LEDS_GPIO_REGISTER
325 help 322 help
326 Include support for Visstrim_m10 platform and its different variants. 323 Include support for Visstrim_m10 platform and its different variants.
327 This includes specific configurations for the board and its 324 This includes specific configurations for the board and its
@@ -376,6 +373,14 @@ config MACH_IMX27IPCAM
376 Include support for IMX27 IPCAM platform. This includes specific 373 Include support for IMX27 IPCAM platform. This includes specific
377 configurations for the board and its peripherals. 374 configurations for the board and its peripherals.
378 375
376config MACH_IMX27_DT
377 bool "Support i.MX27 platforms from device tree"
378 select SOC_IMX27
379 select USE_OF
380 help
381 Include support for Freescale i.MX27 based platforms
382 using the device tree for discovery
383
379endif 384endif
380 385
381if ARCH_IMX_V6_V7 386if ARCH_IMX_V6_V7
@@ -492,6 +497,7 @@ config MACH_MX31MOBOARD
492 bool "Support mx31moboard platforms (EPFL Mobots group)" 497 bool "Support mx31moboard platforms (EPFL Mobots group)"
493 select SOC_IMX31 498 select SOC_IMX31
494 select IMX_HAVE_PLATFORM_FSL_USB2_UDC 499 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
500 select IMX_HAVE_PLATFORM_IMX2_WDT
495 select IMX_HAVE_PLATFORM_IMX_I2C 501 select IMX_HAVE_PLATFORM_IMX_I2C
496 select IMX_HAVE_PLATFORM_IMX_UART 502 select IMX_HAVE_PLATFORM_IMX_UART
497 select IMX_HAVE_PLATFORM_IPU_CORE 503 select IMX_HAVE_PLATFORM_IPU_CORE
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 55db9c488f2..35fc450fa26 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -8,8 +8,8 @@ obj-$(CONFIG_SOC_IMX25) += clock-imx25.o mm-imx25.o ehci-imx25.o cpu-imx25.o
8obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o 8obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o
9obj-$(CONFIG_SOC_IMX27) += clock-imx27.o mm-imx27.o ehci-imx27.o 9obj-$(CONFIG_SOC_IMX27) += clock-imx27.o mm-imx27.o ehci-imx27.o
10 10
11obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clock-imx31.o iomux-imx31.o ehci-imx31.o 11obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clock-imx31.o iomux-imx31.o ehci-imx31.o pm-imx3.o
12obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clock-imx35.o ehci-imx35.o 12obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clock-imx35.o ehci-imx35.o pm-imx3.o
13 13
14obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clock-mx51-mx53.o ehci-imx5.o pm-imx5.o cpu_op-mx51.o 14obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clock-mx51-mx53.o ehci-imx5.o pm-imx5.o cpu_op-mx51.o
15 15
@@ -41,6 +41,7 @@ obj-$(CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD) += eukrea_mbimx27-baseboard.o
41obj-$(CONFIG_MACH_PCA100) += mach-pca100.o 41obj-$(CONFIG_MACH_PCA100) += mach-pca100.o
42obj-$(CONFIG_MACH_MXT_TD60) += mach-mxt_td60.o 42obj-$(CONFIG_MACH_MXT_TD60) += mach-mxt_td60.o
43obj-$(CONFIG_MACH_IMX27IPCAM) += mach-imx27ipcam.o 43obj-$(CONFIG_MACH_IMX27IPCAM) += mach-imx27ipcam.o
44obj-$(CONFIG_MACH_IMX27_DT) += imx27-dt.o
44 45
45# i.MX31 based machines 46# i.MX31 based machines
46obj-$(CONFIG_MACH_MX31ADS) += mach-mx31ads.o 47obj-$(CONFIG_MACH_MX31ADS) += mach-mx31ads.o
@@ -71,7 +72,6 @@ obj-$(CONFIG_CPU_V7) += head-v7.o
71AFLAGS_head-v7.o :=-Wa,-march=armv7-a 72AFLAGS_head-v7.o :=-Wa,-march=armv7-a
72obj-$(CONFIG_SMP) += platsmp.o 73obj-$(CONFIG_SMP) += platsmp.o
73obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 74obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
74obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
75obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o mach-imx6q.o 75obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o mach-imx6q.o
76 76
77ifeq ($(CONFIG_PM),y) 77ifeq ($(CONFIG_PM),y)
diff --git a/arch/arm/mach-imx/Makefile.boot b/arch/arm/mach-imx/Makefile.boot
index 6dfdbcc83af..3851d8a2787 100644
--- a/arch/arm/mach-imx/Makefile.boot
+++ b/arch/arm/mach-imx/Makefile.boot
@@ -38,5 +38,8 @@ zreladdr-$(CONFIG_SOC_IMX6Q) += 0x10008000
38params_phys-$(CONFIG_SOC_IMX6Q) := 0x10000100 38params_phys-$(CONFIG_SOC_IMX6Q) := 0x10000100
39initrd_phys-$(CONFIG_SOC_IMX6Q) := 0x10800000 39initrd_phys-$(CONFIG_SOC_IMX6Q) := 0x10800000
40 40
41dtb-$(CONFIG_MACH_IMX51_DT) += imx51-babbage.dtb
42dtb-$(CONFIG_MACH_IMX53_DT) += imx53-ard.dtb imx53-evk.dtb \
43 imx53-qsb.dtb imx53-smd.dtb
41dtb-$(CONFIG_SOC_IMX6Q) += imx6q-arm2.dtb \ 44dtb-$(CONFIG_SOC_IMX6Q) += imx6q-arm2.dtb \
42 imx6q-sabrelite.dtb 45 imx6q-sabrelite.dtb
diff --git a/arch/arm/mach-imx/clock-imx27.c b/arch/arm/mach-imx/clock-imx27.c
index 88fe00a146e..b9a95ed7555 100644
--- a/arch/arm/mach-imx/clock-imx27.c
+++ b/arch/arm/mach-imx/clock-imx27.c
@@ -22,6 +22,7 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/clkdev.h> 24#include <linux/clkdev.h>
25#include <linux/of.h>
25 26
26#include <asm/div64.h> 27#include <asm/div64.h>
27 28
@@ -661,7 +662,7 @@ static struct clk_lookup lookups[] = {
661 _REGISTER_CLOCK(NULL, "dma", dma_clk) 662 _REGISTER_CLOCK(NULL, "dma", dma_clk)
662 _REGISTER_CLOCK(NULL, "rtic", rtic_clk) 663 _REGISTER_CLOCK(NULL, "rtic", rtic_clk)
663 _REGISTER_CLOCK(NULL, "brom", brom_clk) 664 _REGISTER_CLOCK(NULL, "brom", brom_clk)
664 _REGISTER_CLOCK(NULL, "emma", emma_clk) 665 _REGISTER_CLOCK("m2m-emmaprp.0", NULL, emma_clk)
665 _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk) 666 _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk)
666 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk) 667 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
667 _REGISTER_CLOCK(NULL, "emi", emi_clk) 668 _REGISTER_CLOCK(NULL, "emi", emi_clk)
@@ -764,3 +765,20 @@ int __init mx27_clocks_init(unsigned long fref)
764 return 0; 765 return 0;
765} 766}
766 767
768#ifdef CONFIG_OF
769int __init mx27_clocks_init_dt(void)
770{
771 struct device_node *np;
772 u32 fref = 26000000; /* default */
773
774 for_each_compatible_node(np, NULL, "fixed-clock") {
775 if (!of_device_is_compatible(np, "fsl,imx-osc26m"))
776 continue;
777
778 if (!of_property_read_u32(np, "clock-frequency", &fref))
779 break;
780 }
781
782 return mx27_clocks_init(fref);
783}
784#endif
diff --git a/arch/arm/mach-imx/clock-imx31.c b/arch/arm/mach-imx/clock-imx31.c
index 988a28178d4..3a943cd4159 100644
--- a/arch/arm/mach-imx/clock-imx31.c
+++ b/arch/arm/mach-imx/clock-imx31.c
@@ -32,7 +32,7 @@
32#include <mach/mx31.h> 32#include <mach/mx31.h>
33#include <mach/common.h> 33#include <mach/common.h>
34 34
35#include "crmregs-imx31.h" 35#include "crmregs-imx3.h"
36 36
37#define PRE_DIV_MIN_FREQ 10000000 /* Minimum Frequency after Predivider */ 37#define PRE_DIV_MIN_FREQ 10000000 /* Minimum Frequency after Predivider */
38 38
diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c
index ac8238caecb..1e279af656a 100644
--- a/arch/arm/mach-imx/clock-imx35.c
+++ b/arch/arm/mach-imx/clock-imx35.c
@@ -27,23 +27,7 @@
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <mach/common.h> 28#include <mach/common.h>
29 29
30#define CCM_BASE MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR) 30#include "crmregs-imx3.h"
31
32#define CCM_CCMR 0x00
33#define CCM_PDR0 0x04
34#define CCM_PDR1 0x08
35#define CCM_PDR2 0x0C
36#define CCM_PDR3 0x10
37#define CCM_PDR4 0x14
38#define CCM_RCSR 0x18
39#define CCM_MPCTL 0x1C
40#define CCM_PPCTL 0x20
41#define CCM_ACMR 0x24
42#define CCM_COSR 0x28
43#define CCM_CGR0 0x2C
44#define CCM_CGR1 0x30
45#define CCM_CGR2 0x34
46#define CCM_CGR3 0x38
47 31
48#ifdef HAVE_SET_RATE_SUPPORT 32#ifdef HAVE_SET_RATE_SUPPORT
49static void calc_dividers(u32 div, u32 *pre, u32 *post, u32 maxpost) 33static void calc_dividers(u32 div, u32 *pre, u32 *post, u32 maxpost)
@@ -111,14 +95,14 @@ static void calc_dividers_3_3(u32 div, u32 *pre, u32 *post)
111 95
112static unsigned long get_rate_mpll(void) 96static unsigned long get_rate_mpll(void)
113{ 97{
114 ulong mpctl = __raw_readl(CCM_BASE + CCM_MPCTL); 98 ulong mpctl = __raw_readl(MX35_CCM_MPCTL);
115 99
116 return mxc_decode_pll(mpctl, 24000000); 100 return mxc_decode_pll(mpctl, 24000000);
117} 101}
118 102
119static unsigned long get_rate_ppll(void) 103static unsigned long get_rate_ppll(void)
120{ 104{
121 ulong ppctl = __raw_readl(CCM_BASE + CCM_PPCTL); 105 ulong ppctl = __raw_readl(MX35_CCM_PPCTL);
122 106
123 return mxc_decode_pll(ppctl, 24000000); 107 return mxc_decode_pll(ppctl, 24000000);
124} 108}
@@ -148,7 +132,7 @@ static struct arm_ahb_div clk_consumer[] = {
148 132
149static unsigned long get_rate_arm(void) 133static unsigned long get_rate_arm(void)
150{ 134{
151 unsigned long pdr0 = __raw_readl(CCM_BASE + CCM_PDR0); 135 unsigned long pdr0 = __raw_readl(MXC_CCM_PDR0);
152 struct arm_ahb_div *aad; 136 struct arm_ahb_div *aad;
153 unsigned long fref = get_rate_mpll(); 137 unsigned long fref = get_rate_mpll();
154 138
@@ -161,7 +145,7 @@ static unsigned long get_rate_arm(void)
161 145
162static unsigned long get_rate_ahb(struct clk *clk) 146static unsigned long get_rate_ahb(struct clk *clk)
163{ 147{
164 unsigned long pdr0 = __raw_readl(CCM_BASE + CCM_PDR0); 148 unsigned long pdr0 = __raw_readl(MXC_CCM_PDR0);
165 struct arm_ahb_div *aad; 149 struct arm_ahb_div *aad;
166 unsigned long fref = get_rate_arm(); 150 unsigned long fref = get_rate_arm();
167 151
@@ -177,8 +161,8 @@ static unsigned long get_rate_ipg(struct clk *clk)
177 161
178static unsigned long get_rate_uart(struct clk *clk) 162static unsigned long get_rate_uart(struct clk *clk)
179{ 163{
180 unsigned long pdr3 = __raw_readl(CCM_BASE + CCM_PDR3); 164 unsigned long pdr3 = __raw_readl(MX35_CCM_PDR3);
181 unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4); 165 unsigned long pdr4 = __raw_readl(MX35_CCM_PDR4);
182 unsigned long div = ((pdr4 >> 10) & 0x3f) + 1; 166 unsigned long div = ((pdr4 >> 10) & 0x3f) + 1;
183 167
184 if (pdr3 & (1 << 14)) 168 if (pdr3 & (1 << 14))
@@ -189,7 +173,7 @@ static unsigned long get_rate_uart(struct clk *clk)
189 173
190static unsigned long get_rate_sdhc(struct clk *clk) 174static unsigned long get_rate_sdhc(struct clk *clk)
191{ 175{
192 unsigned long pdr3 = __raw_readl(CCM_BASE + CCM_PDR3); 176 unsigned long pdr3 = __raw_readl(MX35_CCM_PDR3);
193 unsigned long div, rate; 177 unsigned long div, rate;
194 178
195 if (pdr3 & (1 << 6)) 179 if (pdr3 & (1 << 6))
@@ -215,7 +199,7 @@ static unsigned long get_rate_sdhc(struct clk *clk)
215 199
216static unsigned long get_rate_mshc(struct clk *clk) 200static unsigned long get_rate_mshc(struct clk *clk)
217{ 201{
218 unsigned long pdr1 = __raw_readl(CCM_BASE + CCM_PDR1); 202 unsigned long pdr1 = __raw_readl(MXC_CCM_PDR1);
219 unsigned long div1, div2, rate; 203 unsigned long div1, div2, rate;
220 204
221 if (pdr1 & (1 << 7)) 205 if (pdr1 & (1 << 7))
@@ -231,7 +215,7 @@ static unsigned long get_rate_mshc(struct clk *clk)
231 215
232static unsigned long get_rate_ssi(struct clk *clk) 216static unsigned long get_rate_ssi(struct clk *clk)
233{ 217{
234 unsigned long pdr2 = __raw_readl(CCM_BASE + CCM_PDR2); 218 unsigned long pdr2 = __raw_readl(MX35_CCM_PDR2);
235 unsigned long div1, div2, rate; 219 unsigned long div1, div2, rate;
236 220
237 if (pdr2 & (1 << 6)) 221 if (pdr2 & (1 << 6))
@@ -256,7 +240,7 @@ static unsigned long get_rate_ssi(struct clk *clk)
256 240
257static unsigned long get_rate_csi(struct clk *clk) 241static unsigned long get_rate_csi(struct clk *clk)
258{ 242{
259 unsigned long pdr2 = __raw_readl(CCM_BASE + CCM_PDR2); 243 unsigned long pdr2 = __raw_readl(MX35_CCM_PDR2);
260 unsigned long rate; 244 unsigned long rate;
261 245
262 if (pdr2 & (1 << 7)) 246 if (pdr2 & (1 << 7))
@@ -269,7 +253,7 @@ static unsigned long get_rate_csi(struct clk *clk)
269 253
270static unsigned long get_rate_otg(struct clk *clk) 254static unsigned long get_rate_otg(struct clk *clk)
271{ 255{
272 unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4); 256 unsigned long pdr4 = __raw_readl(MX35_CCM_PDR4);
273 unsigned long rate; 257 unsigned long rate;
274 258
275 if (pdr4 & (1 << 9)) 259 if (pdr4 & (1 << 9))
@@ -282,8 +266,8 @@ static unsigned long get_rate_otg(struct clk *clk)
282 266
283static unsigned long get_rate_ipg_per(struct clk *clk) 267static unsigned long get_rate_ipg_per(struct clk *clk)
284{ 268{
285 unsigned long pdr0 = __raw_readl(CCM_BASE + CCM_PDR0); 269 unsigned long pdr0 = __raw_readl(MXC_CCM_PDR0);
286 unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4); 270 unsigned long pdr4 = __raw_readl(MX35_CCM_PDR4);
287 unsigned long div; 271 unsigned long div;
288 272
289 if (pdr0 & (1 << 26)) { 273 if (pdr0 & (1 << 26)) {
@@ -297,7 +281,7 @@ static unsigned long get_rate_ipg_per(struct clk *clk)
297 281
298static unsigned long get_rate_hsp(struct clk *clk) 282static unsigned long get_rate_hsp(struct clk *clk)
299{ 283{
300 unsigned long hsp_podf = (__raw_readl(CCM_BASE + CCM_PDR0) >> 20) & 0x03; 284 unsigned long hsp_podf = (__raw_readl(MXC_CCM_PDR0) >> 20) & 0x03;
301 unsigned long fref = get_rate_mpll(); 285 unsigned long fref = get_rate_mpll();
302 286
303 if (fref > 400 * 1000 * 1000) { 287 if (fref > 400 * 1000 * 1000) {
@@ -345,7 +329,7 @@ static void clk_cgr_disable(struct clk *clk)
345#define DEFINE_CLOCK(name, i, er, es, gr, sr) \ 329#define DEFINE_CLOCK(name, i, er, es, gr, sr) \
346 static struct clk name = { \ 330 static struct clk name = { \
347 .id = i, \ 331 .id = i, \
348 .enable_reg = CCM_BASE + er, \ 332 .enable_reg = er, \
349 .enable_shift = es, \ 333 .enable_shift = es, \
350 .get_rate = gr, \ 334 .get_rate = gr, \
351 .set_rate = sr, \ 335 .set_rate = sr, \
@@ -353,59 +337,59 @@ static void clk_cgr_disable(struct clk *clk)
353 .disable = clk_cgr_disable, \ 337 .disable = clk_cgr_disable, \
354 } 338 }
355 339
356DEFINE_CLOCK(asrc_clk, 0, CCM_CGR0, 0, NULL, NULL); 340DEFINE_CLOCK(asrc_clk, 0, MX35_CCM_CGR0, 0, NULL, NULL);
357DEFINE_CLOCK(pata_clk, 0, CCM_CGR0, 2, get_rate_ipg, NULL); 341DEFINE_CLOCK(pata_clk, 0, MX35_CCM_CGR0, 2, get_rate_ipg, NULL);
358/* DEFINE_CLOCK(audmux_clk, 0, CCM_CGR0, 4, NULL, NULL); */ 342/* DEFINE_CLOCK(audmux_clk, 0, MX35_CCM_CGR0, 4, NULL, NULL); */
359DEFINE_CLOCK(can1_clk, 0, CCM_CGR0, 6, get_rate_ipg, NULL); 343DEFINE_CLOCK(can1_clk, 0, MX35_CCM_CGR0, 6, get_rate_ipg, NULL);
360DEFINE_CLOCK(can2_clk, 1, CCM_CGR0, 8, get_rate_ipg, NULL); 344DEFINE_CLOCK(can2_clk, 1, MX35_CCM_CGR0, 8, get_rate_ipg, NULL);
361DEFINE_CLOCK(cspi1_clk, 0, CCM_CGR0, 10, get_rate_ipg, NULL); 345DEFINE_CLOCK(cspi1_clk, 0, MX35_CCM_CGR0, 10, get_rate_ipg, NULL);
362DEFINE_CLOCK(cspi2_clk, 1, CCM_CGR0, 12, get_rate_ipg, NULL); 346DEFINE_CLOCK(cspi2_clk, 1, MX35_CCM_CGR0, 12, get_rate_ipg, NULL);
363DEFINE_CLOCK(ect_clk, 0, CCM_CGR0, 14, get_rate_ipg, NULL); 347DEFINE_CLOCK(ect_clk, 0, MX35_CCM_CGR0, 14, get_rate_ipg, NULL);
364DEFINE_CLOCK(edio_clk, 0, CCM_CGR0, 16, NULL, NULL); 348DEFINE_CLOCK(edio_clk, 0, MX35_CCM_CGR0, 16, NULL, NULL);
365DEFINE_CLOCK(emi_clk, 0, CCM_CGR0, 18, get_rate_ipg, NULL); 349DEFINE_CLOCK(emi_clk, 0, MX35_CCM_CGR0, 18, get_rate_ipg, NULL);
366DEFINE_CLOCK(epit1_clk, 0, CCM_CGR0, 20, get_rate_ipg, NULL); 350DEFINE_CLOCK(epit1_clk, 0, MX35_CCM_CGR0, 20, get_rate_ipg, NULL);
367DEFINE_CLOCK(epit2_clk, 1, CCM_CGR0, 22, get_rate_ipg, NULL); 351DEFINE_CLOCK(epit2_clk, 1, MX35_CCM_CGR0, 22, get_rate_ipg, NULL);
368DEFINE_CLOCK(esai_clk, 0, CCM_CGR0, 24, NULL, NULL); 352DEFINE_CLOCK(esai_clk, 0, MX35_CCM_CGR0, 24, NULL, NULL);
369DEFINE_CLOCK(esdhc1_clk, 0, CCM_CGR0, 26, get_rate_sdhc, NULL); 353DEFINE_CLOCK(esdhc1_clk, 0, MX35_CCM_CGR0, 26, get_rate_sdhc, NULL);
370DEFINE_CLOCK(esdhc2_clk, 1, CCM_CGR0, 28, get_rate_sdhc, NULL); 354DEFINE_CLOCK(esdhc2_clk, 1, MX35_CCM_CGR0, 28, get_rate_sdhc, NULL);
371DEFINE_CLOCK(esdhc3_clk, 2, CCM_CGR0, 30, get_rate_sdhc, NULL); 355DEFINE_CLOCK(esdhc3_clk, 2, MX35_CCM_CGR0, 30, get_rate_sdhc, NULL);
372 356
373DEFINE_CLOCK(fec_clk, 0, CCM_CGR1, 0, get_rate_ipg, NULL); 357DEFINE_CLOCK(fec_clk, 0, MX35_CCM_CGR1, 0, get_rate_ipg, NULL);
374DEFINE_CLOCK(gpio1_clk, 0, CCM_CGR1, 2, NULL, NULL); 358DEFINE_CLOCK(gpio1_clk, 0, MX35_CCM_CGR1, 2, NULL, NULL);
375DEFINE_CLOCK(gpio2_clk, 1, CCM_CGR1, 4, NULL, NULL); 359DEFINE_CLOCK(gpio2_clk, 1, MX35_CCM_CGR1, 4, NULL, NULL);
376DEFINE_CLOCK(gpio3_clk, 2, CCM_CGR1, 6, NULL, NULL); 360DEFINE_CLOCK(gpio3_clk, 2, MX35_CCM_CGR1, 6, NULL, NULL);
377DEFINE_CLOCK(gpt_clk, 0, CCM_CGR1, 8, get_rate_ipg, NULL); 361DEFINE_CLOCK(gpt_clk, 0, MX35_CCM_CGR1, 8, get_rate_ipg, NULL);
378DEFINE_CLOCK(i2c1_clk, 0, CCM_CGR1, 10, get_rate_ipg_per, NULL); 362DEFINE_CLOCK(i2c1_clk, 0, MX35_CCM_CGR1, 10, get_rate_ipg_per, NULL);
379DEFINE_CLOCK(i2c2_clk, 1, CCM_CGR1, 12, get_rate_ipg_per, NULL); 363DEFINE_CLOCK(i2c2_clk, 1, MX35_CCM_CGR1, 12, get_rate_ipg_per, NULL);
380DEFINE_CLOCK(i2c3_clk, 2, CCM_CGR1, 14, get_rate_ipg_per, NULL); 364DEFINE_CLOCK(i2c3_clk, 2, MX35_CCM_CGR1, 14, get_rate_ipg_per, NULL);
381DEFINE_CLOCK(iomuxc_clk, 0, CCM_CGR1, 16, NULL, NULL); 365DEFINE_CLOCK(iomuxc_clk, 0, MX35_CCM_CGR1, 16, NULL, NULL);
382DEFINE_CLOCK(ipu_clk, 0, CCM_CGR1, 18, get_rate_hsp, NULL); 366DEFINE_CLOCK(ipu_clk, 0, MX35_CCM_CGR1, 18, get_rate_hsp, NULL);
383DEFINE_CLOCK(kpp_clk, 0, CCM_CGR1, 20, get_rate_ipg, NULL); 367DEFINE_CLOCK(kpp_clk, 0, MX35_CCM_CGR1, 20, get_rate_ipg, NULL);
384DEFINE_CLOCK(mlb_clk, 0, CCM_CGR1, 22, get_rate_ahb, NULL); 368DEFINE_CLOCK(mlb_clk, 0, MX35_CCM_CGR1, 22, get_rate_ahb, NULL);
385DEFINE_CLOCK(mshc_clk, 0, CCM_CGR1, 24, get_rate_mshc, NULL); 369DEFINE_CLOCK(mshc_clk, 0, MX35_CCM_CGR1, 24, get_rate_mshc, NULL);
386DEFINE_CLOCK(owire_clk, 0, CCM_CGR1, 26, get_rate_ipg_per, NULL); 370DEFINE_CLOCK(owire_clk, 0, MX35_CCM_CGR1, 26, get_rate_ipg_per, NULL);
387DEFINE_CLOCK(pwm_clk, 0, CCM_CGR1, 28, get_rate_ipg_per, NULL); 371DEFINE_CLOCK(pwm_clk, 0, MX35_CCM_CGR1, 28, get_rate_ipg_per, NULL);
388DEFINE_CLOCK(rngc_clk, 0, CCM_CGR1, 30, get_rate_ipg, NULL); 372DEFINE_CLOCK(rngc_clk, 0, MX35_CCM_CGR1, 30, get_rate_ipg, NULL);
389 373
390DEFINE_CLOCK(rtc_clk, 0, CCM_CGR2, 0, get_rate_ipg, NULL); 374DEFINE_CLOCK(rtc_clk, 0, MX35_CCM_CGR2, 0, get_rate_ipg, NULL);
391DEFINE_CLOCK(rtic_clk, 0, CCM_CGR2, 2, get_rate_ahb, NULL); 375DEFINE_CLOCK(rtic_clk, 0, MX35_CCM_CGR2, 2, get_rate_ahb, NULL);
392DEFINE_CLOCK(scc_clk, 0, CCM_CGR2, 4, get_rate_ipg, NULL); 376DEFINE_CLOCK(scc_clk, 0, MX35_CCM_CGR2, 4, get_rate_ipg, NULL);
393DEFINE_CLOCK(sdma_clk, 0, CCM_CGR2, 6, NULL, NULL); 377DEFINE_CLOCK(sdma_clk, 0, MX35_CCM_CGR2, 6, NULL, NULL);
394DEFINE_CLOCK(spba_clk, 0, CCM_CGR2, 8, get_rate_ipg, NULL); 378DEFINE_CLOCK(spba_clk, 0, MX35_CCM_CGR2, 8, get_rate_ipg, NULL);
395DEFINE_CLOCK(spdif_clk, 0, CCM_CGR2, 10, NULL, NULL); 379DEFINE_CLOCK(spdif_clk, 0, MX35_CCM_CGR2, 10, NULL, NULL);
396DEFINE_CLOCK(ssi1_clk, 0, CCM_CGR2, 12, get_rate_ssi, NULL); 380DEFINE_CLOCK(ssi1_clk, 0, MX35_CCM_CGR2, 12, get_rate_ssi, NULL);
397DEFINE_CLOCK(ssi2_clk, 1, CCM_CGR2, 14, get_rate_ssi, NULL); 381DEFINE_CLOCK(ssi2_clk, 1, MX35_CCM_CGR2, 14, get_rate_ssi, NULL);
398DEFINE_CLOCK(uart1_clk, 0, CCM_CGR2, 16, get_rate_uart, NULL); 382DEFINE_CLOCK(uart1_clk, 0, MX35_CCM_CGR2, 16, get_rate_uart, NULL);
399DEFINE_CLOCK(uart2_clk, 1, CCM_CGR2, 18, get_rate_uart, NULL); 383DEFINE_CLOCK(uart2_clk, 1, MX35_CCM_CGR2, 18, get_rate_uart, NULL);
400DEFINE_CLOCK(uart3_clk, 2, CCM_CGR2, 20, get_rate_uart, NULL); 384DEFINE_CLOCK(uart3_clk, 2, MX35_CCM_CGR2, 20, get_rate_uart, NULL);
401DEFINE_CLOCK(usbotg_clk, 0, CCM_CGR2, 22, get_rate_otg, NULL); 385DEFINE_CLOCK(usbotg_clk, 0, MX35_CCM_CGR2, 22, get_rate_otg, NULL);
402DEFINE_CLOCK(wdog_clk, 0, CCM_CGR2, 24, NULL, NULL); 386DEFINE_CLOCK(wdog_clk, 0, MX35_CCM_CGR2, 24, NULL, NULL);
403DEFINE_CLOCK(max_clk, 0, CCM_CGR2, 26, NULL, NULL); 387DEFINE_CLOCK(max_clk, 0, MX35_CCM_CGR2, 26, NULL, NULL);
404DEFINE_CLOCK(audmux_clk, 0, CCM_CGR2, 30, NULL, NULL); 388DEFINE_CLOCK(audmux_clk, 0, MX35_CCM_CGR2, 30, NULL, NULL);
405 389
406DEFINE_CLOCK(csi_clk, 0, CCM_CGR3, 0, get_rate_csi, NULL); 390DEFINE_CLOCK(csi_clk, 0, MX35_CCM_CGR3, 0, get_rate_csi, NULL);
407DEFINE_CLOCK(iim_clk, 0, CCM_CGR3, 2, NULL, NULL); 391DEFINE_CLOCK(iim_clk, 0, MX35_CCM_CGR3, 2, NULL, NULL);
408DEFINE_CLOCK(gpu2d_clk, 0, CCM_CGR3, 4, NULL, NULL); 392DEFINE_CLOCK(gpu2d_clk, 0, MX35_CCM_CGR3, 4, NULL, NULL);
409 393
410DEFINE_CLOCK(usbahb_clk, 0, 0, 0, get_rate_ahb, NULL); 394DEFINE_CLOCK(usbahb_clk, 0, 0, 0, get_rate_ahb, NULL);
411 395
@@ -422,7 +406,7 @@ static unsigned long get_rate_nfc(struct clk *clk)
422{ 406{
423 unsigned long div1; 407 unsigned long div1;
424 408
425 div1 = (__raw_readl(CCM_BASE + CCM_PDR4) >> 28) + 1; 409 div1 = (__raw_readl(MX35_CCM_PDR4) >> 28) + 1;
426 410
427 return get_rate_ahb(NULL) / div1; 411 return get_rate_ahb(NULL) / div1;
428} 412}
@@ -518,11 +502,11 @@ int __init mx35_clocks_init()
518 /* Turn off all clocks except the ones we need to survive, namely: 502 /* Turn off all clocks except the ones we need to survive, namely:
519 * EMI, GPIO1/2/3, GPT, IOMUX, MAX and eventually uart 503 * EMI, GPIO1/2/3, GPT, IOMUX, MAX and eventually uart
520 */ 504 */
521 __raw_writel((3 << 18), CCM_BASE + CCM_CGR0); 505 __raw_writel((3 << 18), MX35_CCM_CGR0);
522 __raw_writel((3 << 2) | (3 << 4) | (3 << 6) | (3 << 8) | (3 << 16), 506 __raw_writel((3 << 2) | (3 << 4) | (3 << 6) | (3 << 8) | (3 << 16),
523 CCM_BASE + CCM_CGR1); 507 MX35_CCM_CGR1);
524 __raw_writel(cgr2, CCM_BASE + CCM_CGR2); 508 __raw_writel(cgr2, MX35_CCM_CGR2);
525 __raw_writel(0, CCM_BASE + CCM_CGR3); 509 __raw_writel(0, MX35_CCM_CGR3);
526 510
527 clk_enable(&iim_clk); 511 clk_enable(&iim_clk);
528 imx_print_silicon_rev("i.MX35", mx35_revision()); 512 imx_print_silicon_rev("i.MX35", mx35_revision());
@@ -533,7 +517,7 @@ int __init mx35_clocks_init()
533 * extra clocks turned on, otherwise the MX35 boot ROM code will 517 * extra clocks turned on, otherwise the MX35 boot ROM code will
534 * hang after a watchdog reset. 518 * hang after a watchdog reset.
535 */ 519 */
536 if (!(__raw_readl(CCM_BASE + CCM_RCSR) & (3 << 10))) { 520 if (!(__raw_readl(MX35_CCM_RCSR) & (3 << 10))) {
537 /* Additionally turn on UART1, SCC, and IIM clocks */ 521 /* Additionally turn on UART1, SCC, and IIM clocks */
538 clk_enable(&iim_clk); 522 clk_enable(&iim_clk);
539 clk_enable(&uart1_clk); 523 clk_enable(&uart1_clk);
diff --git a/arch/arm/mach-imx/clock-imx6q.c b/arch/arm/mach-imx/clock-imx6q.c
index 2d88f8b9a45..111c328f542 100644
--- a/arch/arm/mach-imx/clock-imx6q.c
+++ b/arch/arm/mach-imx/clock-imx6q.c
@@ -329,6 +329,12 @@
329#define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26) 329#define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26)
330#define BM_CLPCR_MASK_L2CC_IDLE (0x1 << 27) 330#define BM_CLPCR_MASK_L2CC_IDLE (0x1 << 27)
331 331
332#define BP_CCOSR_CKO1_EN 7
333#define BP_CCOSR_CKO1_PODF 4
334#define BM_CCOSR_CKO1_PODF (0x7 << 4)
335#define BP_CCOSR_CKO1_SEL 0
336#define BM_CCOSR_CKO1_SEL (0xf << 0)
337
332#define FREQ_480M 480000000 338#define FREQ_480M 480000000
333#define FREQ_528M 528000000 339#define FREQ_528M 528000000
334#define FREQ_594M 594000000 340#define FREQ_594M 594000000
@@ -393,6 +399,7 @@ static struct clk ipu1_di1_clk;
393static struct clk ipu2_di0_clk; 399static struct clk ipu2_di0_clk;
394static struct clk ipu2_di1_clk; 400static struct clk ipu2_di1_clk;
395static struct clk enfc_clk; 401static struct clk enfc_clk;
402static struct clk cko1_clk;
396static struct clk dummy_clk = {}; 403static struct clk dummy_clk = {};
397 404
398static unsigned long external_high_reference; 405static unsigned long external_high_reference;
@@ -938,6 +945,24 @@ static void _clk_disable(struct clk *clk)
938 writel_relaxed(reg, clk->enable_reg); 945 writel_relaxed(reg, clk->enable_reg);
939} 946}
940 947
948static int _clk_enable_1b(struct clk *clk)
949{
950 u32 reg;
951 reg = readl_relaxed(clk->enable_reg);
952 reg |= 0x1 << clk->enable_shift;
953 writel_relaxed(reg, clk->enable_reg);
954
955 return 0;
956}
957
958static void _clk_disable_1b(struct clk *clk)
959{
960 u32 reg;
961 reg = readl_relaxed(clk->enable_reg);
962 reg &= ~(0x1 << clk->enable_shift);
963 writel_relaxed(reg, clk->enable_reg);
964}
965
941struct divider { 966struct divider {
942 struct clk *clk; 967 struct clk *clk;
943 void __iomem *reg; 968 void __iomem *reg;
@@ -983,6 +1008,7 @@ DEF_CLK_DIV1(ipu2_di0_pre_div, &ipu2_di0_pre_clk, CSCDR2, IPU2_DI0_PRE);
983DEF_CLK_DIV1(ipu2_di1_pre_div, &ipu2_di1_pre_clk, CSCDR2, IPU2_DI1_PRE); 1008DEF_CLK_DIV1(ipu2_di1_pre_div, &ipu2_di1_pre_clk, CSCDR2, IPU2_DI1_PRE);
984DEF_CLK_DIV1(ipu1_div, &ipu1_clk, CSCDR3, IPU1_HSP); 1009DEF_CLK_DIV1(ipu1_div, &ipu1_clk, CSCDR3, IPU1_HSP);
985DEF_CLK_DIV1(ipu2_div, &ipu2_clk, CSCDR3, IPU2_HSP); 1010DEF_CLK_DIV1(ipu2_div, &ipu2_clk, CSCDR3, IPU2_HSP);
1011DEF_CLK_DIV1(cko1_div, &cko1_clk, CCOSR, CKO1);
986 1012
987#define DEF_CLK_DIV2(d, c, r, b) \ 1013#define DEF_CLK_DIV2(d, c, r, b) \
988 static struct divider d = { \ 1014 static struct divider d = { \
@@ -1038,6 +1064,7 @@ static struct divider *dividers[] = {
1038 &enfc_div, 1064 &enfc_div,
1039 &spdif_div, 1065 &spdif_div,
1040 &asrc_serial_div, 1066 &asrc_serial_div,
1067 &cko1_div,
1041}; 1068};
1042 1069
1043static unsigned long ldb_di_clk_get_rate(struct clk *clk) 1070static unsigned long ldb_di_clk_get_rate(struct clk *clk)
@@ -1625,6 +1652,32 @@ DEF_IPU_DI_MUX(CSCDR2, 2, 1);
1625DEF_IPU_MUX(1); 1652DEF_IPU_MUX(1);
1626DEF_IPU_MUX(2); 1653DEF_IPU_MUX(2);
1627 1654
1655static struct multiplexer cko1_mux = {
1656 .clk = &cko1_clk,
1657 .reg = CCOSR,
1658 .bp = BP_CCOSR_CKO1_SEL,
1659 .bm = BM_CCOSR_CKO1_SEL,
1660 .parents = {
1661 &pll3_usb_otg,
1662 &pll2_bus,
1663 &pll1_sys,
1664 &pll5_video,
1665 &dummy_clk,
1666 &axi_clk,
1667 &enfc_clk,
1668 &ipu1_di0_clk,
1669 &ipu1_di1_clk,
1670 &ipu2_di0_clk,
1671 &ipu2_di1_clk,
1672 &ahb_clk,
1673 &ipg_clk,
1674 &ipg_perclk,
1675 &ckil_clk,
1676 &pll4_audio,
1677 NULL
1678 },
1679};
1680
1628static struct multiplexer *multiplexers[] = { 1681static struct multiplexer *multiplexers[] = {
1629 &axi_mux, 1682 &axi_mux,
1630 &periph_mux, 1683 &periph_mux,
@@ -1667,6 +1720,7 @@ static struct multiplexer *multiplexers[] = {
1667 &ipu2_di1_mux, 1720 &ipu2_di1_mux,
1668 &ipu1_mux, 1721 &ipu1_mux,
1669 &ipu2_mux, 1722 &ipu2_mux,
1723 &cko1_mux,
1670}; 1724};
1671 1725
1672static int _clk_set_parent(struct clk *clk, struct clk *parent) 1726static int _clk_set_parent(struct clk *clk, struct clk *parent)
@@ -1690,7 +1744,7 @@ static int _clk_set_parent(struct clk *clk, struct clk *parent)
1690 break; 1744 break;
1691 i++; 1745 i++;
1692 } 1746 }
1693 if (!m->parents[i]) 1747 if (!m->parents[i] || m->parents[i] == &dummy_clk)
1694 return -EINVAL; 1748 return -EINVAL;
1695 1749
1696 val = readl_relaxed(m->reg); 1750 val = readl_relaxed(m->reg);
@@ -1745,6 +1799,20 @@ DEF_NG_CLK(asrc_serial_clk, &pll3_usb_otg);
1745 .secondary = s, \ 1799 .secondary = s, \
1746 } 1800 }
1747 1801
1802#define DEF_CLK_1B(name, er, es, p, s) \
1803 static struct clk name = { \
1804 .enable_reg = er, \
1805 .enable_shift = es, \
1806 .enable = _clk_enable_1b, \
1807 .disable = _clk_disable_1b, \
1808 .get_rate = _clk_get_rate, \
1809 .set_rate = _clk_set_rate, \
1810 .round_rate = _clk_round_rate, \
1811 .set_parent = _clk_set_parent, \
1812 .parent = p, \
1813 .secondary = s, \
1814 }
1815
1748DEF_CLK(aips_tz1_clk, CCGR0, CG0, &ahb_clk, NULL); 1816DEF_CLK(aips_tz1_clk, CCGR0, CG0, &ahb_clk, NULL);
1749DEF_CLK(aips_tz2_clk, CCGR0, CG1, &ahb_clk, NULL); 1817DEF_CLK(aips_tz2_clk, CCGR0, CG1, &ahb_clk, NULL);
1750DEF_CLK(apbh_dma_clk, CCGR0, CG2, &ahb_clk, NULL); 1818DEF_CLK(apbh_dma_clk, CCGR0, CG2, &ahb_clk, NULL);
@@ -1811,6 +1879,7 @@ DEF_CLK(usdhc4_clk, CCGR6, CG4, &pll2_pfd_400m, NULL);
1811DEF_CLK(emi_slow_clk, CCGR6, CG5, &axi_clk, NULL); 1879DEF_CLK(emi_slow_clk, CCGR6, CG5, &axi_clk, NULL);
1812DEF_CLK(vdo_axi_clk, CCGR6, CG6, &axi_clk, NULL); 1880DEF_CLK(vdo_axi_clk, CCGR6, CG6, &axi_clk, NULL);
1813DEF_CLK(vpu_clk, CCGR6, CG7, &axi_clk, NULL); 1881DEF_CLK(vpu_clk, CCGR6, CG7, &axi_clk, NULL);
1882DEF_CLK_1B(cko1_clk, CCOSR, BP_CCOSR_CKO1_EN, &pll2_bus, NULL);
1814 1883
1815static int pcie_clk_enable(struct clk *clk) 1884static int pcie_clk_enable(struct clk *clk)
1816{ 1885{
@@ -1922,6 +1991,7 @@ static struct clk_lookup lookups[] = {
1922 _REGISTER_CLOCK(NULL, "gpmi_io_clk", gpmi_io_clk), 1991 _REGISTER_CLOCK(NULL, "gpmi_io_clk", gpmi_io_clk),
1923 _REGISTER_CLOCK(NULL, "usboh3_clk", usboh3_clk), 1992 _REGISTER_CLOCK(NULL, "usboh3_clk", usboh3_clk),
1924 _REGISTER_CLOCK(NULL, "sata_clk", sata_clk), 1993 _REGISTER_CLOCK(NULL, "sata_clk", sata_clk),
1994 _REGISTER_CLOCK(NULL, "cko1_clk", cko1_clk),
1925}; 1995};
1926 1996
1927int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode) 1997int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
@@ -2029,6 +2099,8 @@ int __init mx6q_clocks_init(void)
2029 clk_set_rate(&usdhc3_clk, 49500000); 2099 clk_set_rate(&usdhc3_clk, 49500000);
2030 clk_set_rate(&usdhc4_clk, 49500000); 2100 clk_set_rate(&usdhc4_clk, 49500000);
2031 2101
2102 clk_set_parent(&cko1_clk, &ahb_clk);
2103
2032 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); 2104 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt");
2033 base = of_iomap(np, 0); 2105 base = of_iomap(np, 0);
2034 WARN_ON(!base); 2106 WARN_ON(!base);
diff --git a/arch/arm/mach-imx/cpu-imx5.c b/arch/arm/mach-imx/cpu-imx5.c
index 5e2e7a84386..aa15c517d06 100644
--- a/arch/arm/mach-imx/cpu-imx5.c
+++ b/arch/arm/mach-imx/cpu-imx5.c
@@ -149,39 +149,3 @@ int mx50_revision(void)
149 return mx5_cpu_rev; 149 return mx5_cpu_rev;
150} 150}
151EXPORT_SYMBOL(mx50_revision); 151EXPORT_SYMBOL(mx50_revision);
152
153static int __init post_cpu_init(void)
154{
155 unsigned int reg;
156 void __iomem *base;
157
158 if (cpu_is_mx51() || cpu_is_mx53()) {
159 if (cpu_is_mx51())
160 base = MX51_IO_ADDRESS(MX51_AIPS1_BASE_ADDR);
161 else
162 base = MX53_IO_ADDRESS(MX53_AIPS1_BASE_ADDR);
163
164 __raw_writel(0x0, base + 0x40);
165 __raw_writel(0x0, base + 0x44);
166 __raw_writel(0x0, base + 0x48);
167 __raw_writel(0x0, base + 0x4C);
168 reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
169 __raw_writel(reg, base + 0x50);
170
171 if (cpu_is_mx51())
172 base = MX51_IO_ADDRESS(MX51_AIPS2_BASE_ADDR);
173 else
174 base = MX53_IO_ADDRESS(MX53_AIPS2_BASE_ADDR);
175
176 __raw_writel(0x0, base + 0x40);
177 __raw_writel(0x0, base + 0x44);
178 __raw_writel(0x0, base + 0x48);
179 __raw_writel(0x0, base + 0x4C);
180 reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
181 __raw_writel(reg, base + 0x50);
182 }
183
184 return 0;
185}
186
187postcore_initcall(post_cpu_init);
diff --git a/arch/arm/mach-imx/cpu_op-mx51.c b/arch/arm/mach-imx/cpu_op-mx51.c
index 9d34c3d4c02..7b92cd6da6d 100644
--- a/arch/arm/mach-imx/cpu_op-mx51.c
+++ b/arch/arm/mach-imx/cpu_op-mx51.c
@@ -11,6 +11,7 @@
11 * http://www.gnu.org/copyleft/gpl.html 11 * http://www.gnu.org/copyleft/gpl.html
12 */ 12 */
13 13
14#include <linux/bug.h>
14#include <linux/types.h> 15#include <linux/types.h>
15#include <mach/hardware.h> 16#include <mach/hardware.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
diff --git a/arch/arm/mach-imx/crmregs-imx31.h b/arch/arm/mach-imx/crmregs-imx3.h
index 37a8a07beda..53141273df4 100644
--- a/arch/arm/mach-imx/crmregs-imx31.h
+++ b/arch/arm/mach-imx/crmregs-imx3.h
@@ -24,23 +24,36 @@
24#define CKIH_CLK_FREQ_27MHZ 27000000 24#define CKIH_CLK_FREQ_27MHZ 27000000
25#define CKIL_CLK_FREQ 32768 25#define CKIL_CLK_FREQ 32768
26 26
27#define MXC_CCM_BASE MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR) 27#define MXC_CCM_BASE (cpu_is_mx31() ? \
28MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR) : MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR))
28 29
29/* Register addresses */ 30/* Register addresses */
30#define MXC_CCM_CCMR (MXC_CCM_BASE + 0x00) 31#define MXC_CCM_CCMR (MXC_CCM_BASE + 0x00)
31#define MXC_CCM_PDR0 (MXC_CCM_BASE + 0x04) 32#define MXC_CCM_PDR0 (MXC_CCM_BASE + 0x04)
32#define MXC_CCM_PDR1 (MXC_CCM_BASE + 0x08) 33#define MXC_CCM_PDR1 (MXC_CCM_BASE + 0x08)
34#define MX35_CCM_PDR2 (MXC_CCM_BASE + 0x0C)
33#define MXC_CCM_RCSR (MXC_CCM_BASE + 0x0C) 35#define MXC_CCM_RCSR (MXC_CCM_BASE + 0x0C)
36#define MX35_CCM_PDR3 (MXC_CCM_BASE + 0x10)
34#define MXC_CCM_MPCTL (MXC_CCM_BASE + 0x10) 37#define MXC_CCM_MPCTL (MXC_CCM_BASE + 0x10)
38#define MX35_CCM_PDR4 (MXC_CCM_BASE + 0x14)
35#define MXC_CCM_UPCTL (MXC_CCM_BASE + 0x14) 39#define MXC_CCM_UPCTL (MXC_CCM_BASE + 0x14)
40#define MX35_CCM_RCSR (MXC_CCM_BASE + 0x18)
36#define MXC_CCM_SRPCTL (MXC_CCM_BASE + 0x18) 41#define MXC_CCM_SRPCTL (MXC_CCM_BASE + 0x18)
42#define MX35_CCM_MPCTL (MXC_CCM_BASE + 0x1C)
37#define MXC_CCM_COSR (MXC_CCM_BASE + 0x1C) 43#define MXC_CCM_COSR (MXC_CCM_BASE + 0x1C)
44#define MX35_CCM_PPCTL (MXC_CCM_BASE + 0x20)
38#define MXC_CCM_CGR0 (MXC_CCM_BASE + 0x20) 45#define MXC_CCM_CGR0 (MXC_CCM_BASE + 0x20)
46#define MX35_CCM_ACMR (MXC_CCM_BASE + 0x24)
39#define MXC_CCM_CGR1 (MXC_CCM_BASE + 0x24) 47#define MXC_CCM_CGR1 (MXC_CCM_BASE + 0x24)
48#define MX35_CCM_COSR (MXC_CCM_BASE + 0x28)
40#define MXC_CCM_CGR2 (MXC_CCM_BASE + 0x28) 49#define MXC_CCM_CGR2 (MXC_CCM_BASE + 0x28)
50#define MX35_CCM_CGR0 (MXC_CCM_BASE + 0x2C)
41#define MXC_CCM_WIMR (MXC_CCM_BASE + 0x2C) 51#define MXC_CCM_WIMR (MXC_CCM_BASE + 0x2C)
52#define MX35_CCM_CGR1 (MXC_CCM_BASE + 0x30)
42#define MXC_CCM_LDC (MXC_CCM_BASE + 0x30) 53#define MXC_CCM_LDC (MXC_CCM_BASE + 0x30)
54#define MX35_CCM_CGR2 (MXC_CCM_BASE + 0x34)
43#define MXC_CCM_DCVR0 (MXC_CCM_BASE + 0x34) 55#define MXC_CCM_DCVR0 (MXC_CCM_BASE + 0x34)
56#define MX35_CCM_CGR3 (MXC_CCM_BASE + 0x38)
44#define MXC_CCM_DCVR1 (MXC_CCM_BASE + 0x38) 57#define MXC_CCM_DCVR1 (MXC_CCM_BASE + 0x38)
45#define MXC_CCM_DCVR2 (MXC_CCM_BASE + 0x3C) 58#define MXC_CCM_DCVR2 (MXC_CCM_BASE + 0x3C)
46#define MXC_CCM_DCVR3 (MXC_CCM_BASE + 0x40) 59#define MXC_CCM_DCVR3 (MXC_CCM_BASE + 0x40)
@@ -64,6 +77,7 @@
64#define MXC_CCM_CCMR_SSI2S_MASK (0x3 << 21) 77#define MXC_CCM_CCMR_SSI2S_MASK (0x3 << 21)
65#define MXC_CCM_CCMR_LPM_OFFSET 14 78#define MXC_CCM_CCMR_LPM_OFFSET 14
66#define MXC_CCM_CCMR_LPM_MASK (0x3 << 14) 79#define MXC_CCM_CCMR_LPM_MASK (0x3 << 14)
80#define MXC_CCM_CCMR_LPM_WAIT_MX35 (0x1 << 14)
67#define MXC_CCM_CCMR_FIRS_OFFSET 11 81#define MXC_CCM_CCMR_FIRS_OFFSET 11
68#define MXC_CCM_CCMR_FIRS_MASK (0x3 << 11) 82#define MXC_CCM_CCMR_FIRS_MASK (0x3 << 11)
69#define MXC_CCM_CCMR_UPE (1 << 9) 83#define MXC_CCM_CCMR_UPE (1 << 9)
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
index 2f727d7c380..28537a5d904 100644
--- a/arch/arm/mach-imx/devices-imx27.h
+++ b/arch/arm/mach-imx/devices-imx27.h
@@ -50,6 +50,8 @@ extern const struct imx_imx_uart_1irq_data imx27_imx_uart_data[];
50extern const struct imx_mx2_camera_data imx27_mx2_camera_data; 50extern const struct imx_mx2_camera_data imx27_mx2_camera_data;
51#define imx27_add_mx2_camera(pdata) \ 51#define imx27_add_mx2_camera(pdata) \
52 imx_add_mx2_camera(&imx27_mx2_camera_data, pdata) 52 imx_add_mx2_camera(&imx27_mx2_camera_data, pdata)
53#define imx27_add_mx2_emmaprp(pdata) \
54 imx_add_mx2_emmaprp(&imx27_mx2_camera_data)
53 55
54extern const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data; 56extern const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data;
55#define imx27_add_mxc_ehci_otg(pdata) \ 57#define imx27_add_mxc_ehci_otg(pdata) \
diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
index 5db3e1463af..5f2f91d1798 100644
--- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
@@ -32,7 +32,6 @@
32#include <mach/common.h> 32#include <mach/common.h>
33#include <mach/iomux-mx27.h> 33#include <mach/iomux-mx27.h>
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/audmux.h>
36 35
37#include "devices-imx27.h" 36#include "devices-imx27.h"
38 37
@@ -306,25 +305,6 @@ void __init eukrea_mbimx27_baseboard_init(void)
306 mxc_gpio_setup_multiple_pins(eukrea_mbimx27_pins, 305 mxc_gpio_setup_multiple_pins(eukrea_mbimx27_pins,
307 ARRAY_SIZE(eukrea_mbimx27_pins), "MBIMX27"); 306 ARRAY_SIZE(eukrea_mbimx27_pins), "MBIMX27");
308 307
309#if defined(CONFIG_SND_SOC_EUKREA_TLV320) \
310 || defined(CONFIG_SND_SOC_EUKREA_TLV320_MODULE)
311 /* SSI unit master I2S codec connected to SSI_PINS_4*/
312 mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
313 MXC_AUDMUX_V1_PCR_SYN |
314 MXC_AUDMUX_V1_PCR_TFSDIR |
315 MXC_AUDMUX_V1_PCR_TCLKDIR |
316 MXC_AUDMUX_V1_PCR_RFSDIR |
317 MXC_AUDMUX_V1_PCR_RCLKDIR |
318 MXC_AUDMUX_V1_PCR_TFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) |
319 MXC_AUDMUX_V1_PCR_RFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) |
320 MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4)
321 );
322 mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR3_SSI_PINS_4,
323 MXC_AUDMUX_V1_PCR_SYN |
324 MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0)
325 );
326#endif
327
328 imx27_add_imx_uart1(&uart_pdata); 308 imx27_add_imx_uart1(&uart_pdata);
329 imx27_add_imx_uart2(&uart_pdata); 309 imx27_add_imx_uart2(&uart_pdata);
330#if !defined(MACH_EUKREA_CPUIMX27_USEUART4) 310#if !defined(MACH_EUKREA_CPUIMX27_USEUART4)
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c
index d817fc80b98..aaa592fdb9c 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c
@@ -37,7 +37,6 @@
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/common.h> 38#include <mach/common.h>
39#include <mach/iomux-mx51.h> 39#include <mach/iomux-mx51.h>
40#include <mach/audmux.h>
41 40
42#include "devices-imx51.h" 41#include "devices-imx51.h"
43 42
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
index 66e8726253f..2cf603e11c4 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
@@ -31,7 +31,6 @@
31#include <asm/mach-types.h> 31#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33#include <mach/mx25.h> 33#include <mach/mx25.h>
34#include <mach/audmux.h>
35 34
36#include "devices-imx25.h" 35#include "devices-imx25.h"
37 36
@@ -241,22 +240,6 @@ void __init eukrea_mbimxsd25_baseboard_init(void)
241 ARRAY_SIZE(eukrea_mbimxsd_pads))) 240 ARRAY_SIZE(eukrea_mbimxsd_pads)))
242 printk(KERN_ERR "error setting mbimxsd pads !\n"); 241 printk(KERN_ERR "error setting mbimxsd pads !\n");
243 242
244#if defined(CONFIG_SND_SOC_EUKREA_TLV320)
245 /* SSI unit master I2S codec connected to SSI_AUD5*/
246 mxc_audmux_v2_configure_port(0,
247 MXC_AUDMUX_V2_PTCR_SYN |
248 MXC_AUDMUX_V2_PTCR_TFSDIR |
249 MXC_AUDMUX_V2_PTCR_TFSEL(4) |
250 MXC_AUDMUX_V2_PTCR_TCLKDIR |
251 MXC_AUDMUX_V2_PTCR_TCSEL(4),
252 MXC_AUDMUX_V2_PDCR_RXDSEL(4)
253 );
254 mxc_audmux_v2_configure_port(4,
255 MXC_AUDMUX_V2_PTCR_SYN,
256 MXC_AUDMUX_V2_PDCR_RXDSEL(0)
257 );
258#endif
259
260 imx25_add_imx_uart1(&uart_pdata); 243 imx25_add_imx_uart1(&uart_pdata);
261 imx25_add_imx_fb(&eukrea_mximxsd_fb_pdata); 244 imx25_add_imx_fb(&eukrea_mximxsd_fb_pdata);
262 imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); 245 imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
index 0f0af02b318..fd8bf8a425a 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
@@ -38,7 +38,6 @@
38#include <mach/hardware.h> 38#include <mach/hardware.h>
39#include <mach/common.h> 39#include <mach/common.h>
40#include <mach/iomux-mx35.h> 40#include <mach/iomux-mx35.h>
41#include <mach/audmux.h>
42 41
43#include "devices-imx35.h" 42#include "devices-imx35.h"
44 43
@@ -252,22 +251,6 @@ void __init eukrea_mbimxsd35_baseboard_init(void)
252 ARRAY_SIZE(eukrea_mbimxsd_pads))) 251 ARRAY_SIZE(eukrea_mbimxsd_pads)))
253 printk(KERN_ERR "error setting mbimxsd pads !\n"); 252 printk(KERN_ERR "error setting mbimxsd pads !\n");
254 253
255#if defined(CONFIG_SND_SOC_EUKREA_TLV320)
256 /* SSI unit master I2S codec connected to SSI_AUD4 */
257 mxc_audmux_v2_configure_port(0,
258 MXC_AUDMUX_V2_PTCR_SYN |
259 MXC_AUDMUX_V2_PTCR_TFSDIR |
260 MXC_AUDMUX_V2_PTCR_TFSEL(3) |
261 MXC_AUDMUX_V2_PTCR_TCLKDIR |
262 MXC_AUDMUX_V2_PTCR_TCSEL(3),
263 MXC_AUDMUX_V2_PDCR_RXDSEL(3)
264 );
265 mxc_audmux_v2_configure_port(3,
266 MXC_AUDMUX_V2_PTCR_SYN,
267 MXC_AUDMUX_V2_PDCR_RXDSEL(0)
268 );
269#endif
270
271 imx35_add_imx_uart1(&uart_pdata); 254 imx35_add_imx_uart1(&uart_pdata);
272 imx35_add_ipu_core(&mx3_ipu_data); 255 imx35_add_ipu_core(&mx3_ipu_data);
273 imx35_add_mx3_sdc_fb(&mx3fb_pdata); 256 imx35_add_mx3_sdc_fb(&mx3fb_pdata);
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
new file mode 100644
index 00000000000..861ceb8232d
--- /dev/null
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -0,0 +1,89 @@
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/irqdomain.h>
14#include <linux/of_irq.h>
15#include <linux/of_platform.h>
16#include <asm/mach/arch.h>
17#include <asm/mach/time.h>
18#include <mach/common.h>
19#include <mach/mx27.h>
20
21static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
22 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART1_BASE_ADDR, "imx21-uart.0", NULL),
23 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART2_BASE_ADDR, "imx21-uart.1", NULL),
24 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART3_BASE_ADDR, "imx21-uart.2", NULL),
25 OF_DEV_AUXDATA("fsl,imx27-fec", MX27_FEC_BASE_ADDR, "imx27-fec.0", NULL),
26 OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C1_BASE_ADDR, "imx-i2c.0", NULL),
27 OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C2_BASE_ADDR, "imx-i2c.1", NULL),
28 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI1_BASE_ADDR, "imx27-cspi.0", NULL),
29 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI2_BASE_ADDR, "imx27-cspi.1", NULL),
30 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI3_BASE_ADDR, "imx27-cspi.2", NULL),
31 OF_DEV_AUXDATA("fsl,imx27-wdt", MX27_WDOG_BASE_ADDR, "imx2-wdt.0", NULL),
32 { /* sentinel */ }
33};
34
35static int __init imx27_avic_add_irq_domain(struct device_node *np,
36 struct device_node *interrupt_parent)
37{
38 irq_domain_add_simple(np, 0);
39 return 0;
40}
41
42static int __init imx27_gpio_add_irq_domain(struct device_node *np,
43 struct device_node *interrupt_parent)
44{
45 static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
46
47 irq_domain_add_simple(np, gpio_irq_base);
48
49 return 0;
50}
51
52static const struct of_device_id imx27_irq_match[] __initconst = {
53 { .compatible = "fsl,imx27-avic", .data = imx27_avic_add_irq_domain, },
54 { .compatible = "fsl,imx27-gpio", .data = imx27_gpio_add_irq_domain, },
55 { /* sentinel */ }
56};
57
58static void __init imx27_dt_init(void)
59{
60 of_irq_init(imx27_irq_match);
61
62 of_platform_populate(NULL, of_default_bus_match_table,
63 imx27_auxdata_lookup, NULL);
64}
65
66static void __init imx27_timer_init(void)
67{
68 mx27_clocks_init_dt();
69}
70
71static struct sys_timer imx27_timer = {
72 .init = imx27_timer_init,
73};
74
75static const char *imx27_dt_board_compat[] __initdata = {
76 "fsl,imx27",
77 NULL
78};
79
80DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)")
81 .map_io = mx27_map_io,
82 .init_early = imx27_init_early,
83 .init_irq = mx27_init_irq,
84 .handle_irq = imx27_handle_irq,
85 .timer = &imx27_timer,
86 .init_machine = imx27_dt_init,
87 .dt_compat = imx27_dt_board_compat,
88 .restart = mxc_restart,
89MACHINE_END
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 1e03ef42faa..5cca573964f 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -104,6 +104,7 @@ static struct sys_timer imx51_timer = {
104 104
105static const char *imx51_dt_board_compat[] __initdata = { 105static const char *imx51_dt_board_compat[] __initdata = {
106 "fsl,imx51-babbage", 106 "fsl,imx51-babbage",
107 "fsl,imx51",
107 NULL 108 NULL
108}; 109};
109 110
diff --git a/arch/arm/mach-imx/imx53-dt.c b/arch/arm/mach-imx/imx53-dt.c
index fd5be0f20fb..4172279b390 100644
--- a/arch/arm/mach-imx/imx53-dt.c
+++ b/arch/arm/mach-imx/imx53-dt.c
@@ -114,6 +114,7 @@ static const char *imx53_dt_board_compat[] __initdata = {
114 "fsl,imx53-evk", 114 "fsl,imx53-evk",
115 "fsl,imx53-qsb", 115 "fsl,imx53-qsb",
116 "fsl,imx53-smd", 116 "fsl,imx53-smd",
117 "fsl,imx53",
117 NULL 118 NULL
118}; 119};
119 120
diff --git a/arch/arm/mach-imx/lluart.c b/arch/arm/mach-imx/lluart.c
index d4ab6f29a76..0213f8dcee8 100644
--- a/arch/arm/mach-imx/lluart.c
+++ b/arch/arm/mach-imx/lluart.c
@@ -17,7 +17,7 @@
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18 18
19static struct map_desc imx_lluart_desc = { 19static struct map_desc imx_lluart_desc = {
20#ifdef CONFIG_DEBUG_IMX6Q_UART 20#ifdef CONFIG_DEBUG_IMX6Q_UART4
21 .virtual = MX6Q_IO_P2V(MX6Q_UART4_BASE_ADDR), 21 .virtual = MX6Q_IO_P2V(MX6Q_UART4_BASE_ADDR),
22 .pfn = __phys_to_pfn(MX6Q_UART4_BASE_ADDR), 22 .pfn = __phys_to_pfn(MX6Q_UART4_BASE_ADDR),
23 .length = MX6Q_UART4_SIZE, 23 .length = MX6Q_UART4_SIZE,
diff --git a/arch/arm/mach-imx/localtimer.c b/arch/arm/mach-imx/localtimer.c
deleted file mode 100644
index 3a163515d41..00000000000
--- a/arch/arm/mach-imx/localtimer.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Copyright 2011 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#include <linux/init.h>
14#include <linux/clockchips.h>
15#include <linux/of_address.h>
16#include <linux/of_irq.h>
17#include <asm/smp_twd.h>
18
19/*
20 * Setup the local clock events for a CPU.
21 */
22int __cpuinit local_timer_setup(struct clock_event_device *evt)
23{
24 struct device_node *np;
25
26 np = of_find_compatible_node(NULL, NULL, "arm,smp-twd");
27 if (!twd_base) {
28 twd_base = of_iomap(np, 0);
29 WARN_ON(!twd_base);
30 }
31 evt->irq = irq_of_parse_and_map(np, 0);
32 twd_timer_setup(evt);
33
34 return 0;
35}
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c
index e4f426a0989..27bc27e6ea4 100644
--- a/arch/arm/mach-imx/mach-armadillo5x0.c
+++ b/arch/arm/mach-imx/mach-armadillo5x0.c
@@ -51,7 +51,7 @@
51#include <mach/ulpi.h> 51#include <mach/ulpi.h>
52 52
53#include "devices-imx31.h" 53#include "devices-imx31.h"
54#include "crmregs-imx31.h" 54#include "crmregs-imx3.h"
55 55
56static int armadillo5x0_pins[] = { 56static int armadillo5x0_pins[] = {
57 /* UART1 */ 57 /* UART1 */
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index c2766ae02b4..f7b074f496f 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -30,6 +30,10 @@
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/dma-mapping.h>
34#include <linux/leds.h>
35#include <linux/memblock.h>
36#include <media/soc_camera.h>
33#include <sound/tlv320aic32x4.h> 37#include <sound/tlv320aic32x4.h>
34#include <asm/mach-types.h> 38#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
@@ -39,6 +43,8 @@
39 43
40#include "devices-imx27.h" 44#include "devices-imx27.h"
41 45
46#define TVP5150_RSTN (GPIO_PORTC + 18)
47#define TVP5150_PWDN (GPIO_PORTC + 19)
42#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17) 48#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
43#define SDHC1_IRQ IRQ_GPIOB(25) 49#define SDHC1_IRQ IRQ_GPIOB(25)
44 50
@@ -100,8 +106,99 @@ static const int visstrim_m10_pins[] __initconst = {
100 PE1_PF_USBOTG_STP, 106 PE1_PF_USBOTG_STP,
101 PB23_PF_USB_PWR, 107 PB23_PF_USB_PWR,
102 PB24_PF_USB_OC, 108 PB24_PF_USB_OC,
109 /* CSI */
110 PB10_PF_CSI_D0,
111 PB11_PF_CSI_D1,
112 PB12_PF_CSI_D2,
113 PB13_PF_CSI_D3,
114 PB14_PF_CSI_D4,
115 PB15_PF_CSI_MCLK,
116 PB16_PF_CSI_PIXCLK,
117 PB17_PF_CSI_D5,
118 PB18_PF_CSI_D6,
119 PB19_PF_CSI_D7,
120 PB20_PF_CSI_VSYNC,
121 PB21_PF_CSI_HSYNC,
103}; 122};
104 123
124/* Camera */
125static int visstrim_camera_power(struct device *dev, int on)
126{
127 gpio_set_value(TVP5150_PWDN, on);
128
129 return 0;
130};
131
132static int visstrim_camera_reset(struct device *dev)
133{
134 gpio_set_value(TVP5150_RSTN, 0);
135 ndelay(500);
136 gpio_set_value(TVP5150_RSTN, 1);
137
138 return 0;
139};
140
141static struct i2c_board_info visstrim_i2c_camera = {
142 I2C_BOARD_INFO("tvp5150", 0x5d),
143};
144
145static struct soc_camera_link iclink_tvp5150 = {
146 .bus_id = 0,
147 .board_info = &visstrim_i2c_camera,
148 .i2c_adapter_id = 0,
149 .power = visstrim_camera_power,
150 .reset = visstrim_camera_reset,
151};
152
153static struct mx2_camera_platform_data visstrim_camera = {
154 .flags = MX2_CAMERA_CCIR | MX2_CAMERA_CCIR_INTERLACE |
155 MX2_CAMERA_SWAP16 | MX2_CAMERA_PCLK_SAMPLE_RISING,
156 .clk = 100000,
157};
158
159static phys_addr_t mx2_camera_base __initdata;
160#define MX2_CAMERA_BUF_SIZE SZ_8M
161
162static void __init visstrim_camera_init(void)
163{
164 struct platform_device *pdev;
165 int dma;
166
167 /* Initialize tvp5150 gpios */
168 mxc_gpio_mode(TVP5150_RSTN | GPIO_GPIO | GPIO_OUT);
169 mxc_gpio_mode(TVP5150_PWDN | GPIO_GPIO | GPIO_OUT);
170 gpio_set_value(TVP5150_RSTN, 1);
171 gpio_set_value(TVP5150_PWDN, 0);
172 ndelay(1);
173
174 gpio_set_value(TVP5150_PWDN, 1);
175 ndelay(1);
176 gpio_set_value(TVP5150_RSTN, 0);
177 ndelay(500);
178 gpio_set_value(TVP5150_RSTN, 1);
179 ndelay(200000);
180
181 pdev = imx27_add_mx2_camera(&visstrim_camera);
182 if (IS_ERR(pdev))
183 return;
184
185 dma = dma_declare_coherent_memory(&pdev->dev,
186 mx2_camera_base, mx2_camera_base,
187 MX2_CAMERA_BUF_SIZE,
188 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
189 if (!(dma & DMA_MEMORY_MAP))
190 return;
191}
192
193static void __init visstrim_reserve(void)
194{
195 /* reserve 4 MiB for mx2-camera */
196 mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE,
197 MX2_CAMERA_BUF_SIZE);
198 memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
199 memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
200}
201
105/* GPIOs used as events for applications */ 202/* GPIOs used as events for applications */
106static struct gpio_keys_button visstrim_gpio_keys[] = { 203static struct gpio_keys_button visstrim_gpio_keys[] = {
107 { 204 {
@@ -136,6 +233,35 @@ static const struct gpio_keys_platform_data
136 .nbuttons = ARRAY_SIZE(visstrim_gpio_keys), 233 .nbuttons = ARRAY_SIZE(visstrim_gpio_keys),
137}; 234};
138 235
236/* led */
237static const struct gpio_led visstrim_m10_leds[] __initconst = {
238 {
239 .name = "visstrim:ld0",
240 .default_trigger = "nand-disk",
241 .gpio = (GPIO_PORTC + 29),
242 },
243 {
244 .name = "visstrim:ld1",
245 .default_trigger = "nand-disk",
246 .gpio = (GPIO_PORTC + 24),
247 },
248 {
249 .name = "visstrim:ld2",
250 .default_trigger = "nand-disk",
251 .gpio = (GPIO_PORTC + 28),
252 },
253 {
254 .name = "visstrim:ld3",
255 .default_trigger = "nand-disk",
256 .gpio = (GPIO_PORTC + 25),
257 },
258};
259
260static const struct gpio_led_platform_data visstrim_m10_led_data __initconst = {
261 .leds = visstrim_m10_leds,
262 .num_leds = ARRAY_SIZE(visstrim_m10_leds),
263};
264
139/* Visstrim_SM10 has a microSD slot connected to sdhc1 */ 265/* Visstrim_SM10 has a microSD slot connected to sdhc1 */
140static int visstrim_m10_sdhc1_init(struct device *dev, 266static int visstrim_m10_sdhc1_init(struct device *dev,
141 irq_handler_t detect_irq, void *data) 267 irq_handler_t detect_irq, void *data)
@@ -216,6 +342,9 @@ static struct i2c_board_info visstrim_m10_i2c_devices[] = {
216 { 342 {
217 I2C_BOARD_INFO("tlv320aic32x4", 0x18), 343 I2C_BOARD_INFO("tlv320aic32x4", 0x18),
218 .platform_data = &visstrim_m10_aic32x4_pdata, 344 .platform_data = &visstrim_m10_aic32x4_pdata,
345 },
346 {
347 I2C_BOARD_INFO("m41t00", 0x68),
219 } 348 }
220}; 349};
221 350
@@ -254,15 +383,21 @@ static void __init visstrim_m10_board_init(void)
254 imx27_add_imx_ssi(0, &visstrim_m10_ssi_pdata); 383 imx27_add_imx_ssi(0, &visstrim_m10_ssi_pdata);
255 imx27_add_imx_uart0(&uart_pdata); 384 imx27_add_imx_uart0(&uart_pdata);
256 385
257 i2c_register_board_info(0, visstrim_m10_i2c_devices,
258 ARRAY_SIZE(visstrim_m10_i2c_devices));
259 imx27_add_imx_i2c(0, &visstrim_m10_i2c_data); 386 imx27_add_imx_i2c(0, &visstrim_m10_i2c_data);
260 imx27_add_imx_i2c(1, &visstrim_m10_i2c_data); 387 imx27_add_imx_i2c(1, &visstrim_m10_i2c_data);
388 i2c_register_board_info(0, visstrim_m10_i2c_devices,
389 ARRAY_SIZE(visstrim_m10_i2c_devices));
390
261 imx27_add_mxc_mmc(0, &visstrim_m10_sdhc_pdata); 391 imx27_add_mxc_mmc(0, &visstrim_m10_sdhc_pdata);
262 imx27_add_mxc_ehci_otg(&visstrim_m10_usbotg_pdata); 392 imx27_add_mxc_ehci_otg(&visstrim_m10_usbotg_pdata);
263 imx27_add_fec(NULL); 393 imx27_add_fec(NULL);
264 imx_add_gpio_keys(&visstrim_gpio_keys_platform_data); 394 imx_add_gpio_keys(&visstrim_gpio_keys_platform_data);
265 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 395 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
396 imx_add_platform_device("mx27vis", 0, NULL, 0, NULL, 0);
397 platform_device_register_resndata(NULL, "soc-camera-pdrv", 0, NULL, 0,
398 &iclink_tvp5150, sizeof(iclink_tvp5150));
399 gpio_led_register_device(0, &visstrim_m10_led_data);
400 visstrim_camera_init();
266} 401}
267 402
268static void __init visstrim_m10_timer_init(void) 403static void __init visstrim_m10_timer_init(void)
@@ -276,6 +411,7 @@ static struct sys_timer visstrim_m10_timer = {
276 411
277MACHINE_START(IMX27_VISSTRIM_M10, "Vista Silicon Visstrim_M10") 412MACHINE_START(IMX27_VISSTRIM_M10, "Vista Silicon Visstrim_M10")
278 .atag_offset = 0x100, 413 .atag_offset = 0x100,
414 .reserve = visstrim_reserve,
279 .map_io = mx27_map_io, 415 .map_io = mx27_map_io,
280 .init_early = imx27_init_early, 416 .init_early = imx27_init_early,
281 .init_irq = mx27_init_irq, 417 .init_irq = mx27_init_irq,
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 6075d4d62dd..7696dfa2bdb 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -21,6 +21,7 @@
21#include <linux/of_platform.h> 21#include <linux/of_platform.h>
22#include <linux/phy.h> 22#include <linux/phy.h>
23#include <linux/micrel_phy.h> 23#include <linux/micrel_phy.h>
24#include <asm/smp_twd.h>
24#include <asm/hardware/cache-l2x0.h> 25#include <asm/hardware/cache-l2x0.h>
25#include <asm/hardware/gic.h> 26#include <asm/hardware/gic.h>
26#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
@@ -120,6 +121,7 @@ static void __init imx6q_init_irq(void)
120static void __init imx6q_timer_init(void) 121static void __init imx6q_timer_init(void)
121{ 122{
122 mx6q_clocks_init(); 123 mx6q_clocks_init();
124 twd_local_timer_of_register();
123} 125}
124 126
125static struct sys_timer imx6q_timer = { 127static struct sys_timer imx6q_timer = {
@@ -129,6 +131,7 @@ static struct sys_timer imx6q_timer = {
129static const char *imx6q_dt_compat[] __initdata = { 131static const char *imx6q_dt_compat[] __initdata = {
130 "fsl,imx6q-arm2", 132 "fsl,imx6q-arm2",
131 "fsl,imx6q-sabrelite", 133 "fsl,imx6q-sabrelite",
134 "fsl,imx6q",
132 NULL, 135 NULL,
133}; 136};
134 137
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index 8d9f95514b1..e432d4acee1 100644
--- a/arch/arm/mach-imx/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -37,8 +37,8 @@
37#define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \ 37#define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \
38 (MX21ADS_MMIO_BASE_ADDR + (offset)) 38 (MX21ADS_MMIO_BASE_ADDR + (offset))
39 39
40#define MX21ADS_CS8900A_MMIO_SIZE 0x200000
40#define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11) 41#define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11)
41#define MX21ADS_CS8900A_IOBASE_REG MX21ADS_REG_ADDR(0x000000)
42#define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000) 42#define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000)
43#define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000) 43#define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000)
44#define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000) 44#define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000)
@@ -159,6 +159,18 @@ static struct platform_device mx21ads_nor_mtd_device = {
159 .resource = &mx21ads_flash_resource, 159 .resource = &mx21ads_flash_resource,
160}; 160};
161 161
162static const struct resource mx21ads_cs8900_resources[] __initconst = {
163 DEFINE_RES_MEM(MX21_CS1_BASE_ADDR, MX21ADS_CS8900A_MMIO_SIZE),
164 DEFINE_RES_IRQ(MX21ADS_CS8900A_IRQ),
165};
166
167static const struct platform_device_info mx21ads_cs8900_devinfo __initconst = {
168 .name = "cs89x0",
169 .id = 0,
170 .res = mx21ads_cs8900_resources,
171 .num_res = ARRAY_SIZE(mx21ads_cs8900_resources),
172};
173
162static const struct imxuart_platform_data uart_pdata_rts __initconst = { 174static const struct imxuart_platform_data uart_pdata_rts __initconst = {
163 .flags = IMXUART_HAVE_RTSCTS, 175 .flags = IMXUART_HAVE_RTSCTS,
164}; 176};
@@ -292,6 +304,8 @@ static void __init mx21ads_board_init(void)
292 imx21_add_mxc_nand(&mx21ads_nand_board_info); 304 imx21_add_mxc_nand(&mx21ads_nand_board_info);
293 305
294 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 306 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
307 platform_device_register_full(
308 (struct platform_device_info *)&mx21ads_cs8900_devinfo);
295} 309}
296 310
297static void __init mx21ads_timer_init(void) 311static void __init mx21ads_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 18f35816706..c6d385c5225 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -31,6 +31,8 @@
31#include <linux/regulator/machine.h> 31#include <linux/regulator/machine.h>
32#include <linux/spi/l4f00242t03.h> 32#include <linux/spi/l4f00242t03.h>
33 33
34#include <media/soc_camera.h>
35
34#include <asm/mach-types.h> 36#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
36#include <asm/mach/time.h> 38#include <asm/mach/time.h>
@@ -52,6 +54,8 @@
52#define SD1_CD IMX_GPIO_NR(2, 26) 54#define SD1_CD IMX_GPIO_NR(2, 26)
53#define LCD_RESET IMX_GPIO_NR(1, 3) 55#define LCD_RESET IMX_GPIO_NR(1, 3)
54#define LCD_ENABLE IMX_GPIO_NR(1, 31) 56#define LCD_ENABLE IMX_GPIO_NR(1, 31)
57#define CSI_PWRDWN IMX_GPIO_NR(4, 19)
58#define CSI_RESET IMX_GPIO_NR(3, 6)
55 59
56static const int mx27pdk_pins[] __initconst = { 60static const int mx27pdk_pins[] __initconst = {
57 /* UART1 */ 61 /* UART1 */
@@ -141,6 +145,26 @@ static const int mx27pdk_pins[] __initconst = {
141 PA30_PF_CONTRAST, 145 PA30_PF_CONTRAST,
142 LCD_ENABLE | GPIO_GPIO | GPIO_OUT, 146 LCD_ENABLE | GPIO_GPIO | GPIO_OUT,
143 LCD_RESET | GPIO_GPIO | GPIO_OUT, 147 LCD_RESET | GPIO_GPIO | GPIO_OUT,
148 /* CSI */
149 PB10_PF_CSI_D0,
150 PB11_PF_CSI_D1,
151 PB12_PF_CSI_D2,
152 PB13_PF_CSI_D3,
153 PB14_PF_CSI_D4,
154 PB15_PF_CSI_MCLK,
155 PB16_PF_CSI_PIXCLK,
156 PB17_PF_CSI_D5,
157 PB18_PF_CSI_D6,
158 PB19_PF_CSI_D7,
159 PB20_PF_CSI_VSYNC,
160 PB21_PF_CSI_HSYNC,
161 CSI_PWRDWN | GPIO_GPIO | GPIO_OUT,
162 CSI_RESET | GPIO_GPIO | GPIO_OUT,
163};
164
165static struct gpio mx27_3ds_camera_gpios[] = {
166 { CSI_PWRDWN, GPIOF_OUT_INIT_HIGH, "camera-power" },
167 { CSI_RESET, GPIOF_OUT_INIT_HIGH, "camera-reset" },
144}; 168};
145 169
146static const struct imxuart_platform_data uart_pdata __initconst = { 170static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -242,6 +266,7 @@ static struct regulator_init_data gpo_init = {
242 266
243static struct regulator_consumer_supply vmmc1_consumers[] = { 267static struct regulator_consumer_supply vmmc1_consumers[] = {
244 REGULATOR_SUPPLY("vcore", "spi0.0"), 268 REGULATOR_SUPPLY("vcore", "spi0.0"),
269 REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"),
245}; 270};
246 271
247static struct regulator_init_data vmmc1_init = { 272static struct regulator_init_data vmmc1_init = {
@@ -270,6 +295,22 @@ static struct regulator_init_data vgen_init = {
270 .consumer_supplies = vgen_consumers, 295 .consumer_supplies = vgen_consumers,
271}; 296};
272 297
298static struct regulator_consumer_supply vvib_consumers[] = {
299 REGULATOR_SUPPLY("cmos_vcore", "soc-camera-pdrv.0"),
300};
301
302static struct regulator_init_data vvib_init = {
303 .constraints = {
304 .min_uV = 1300000,
305 .max_uV = 1300000,
306 .apply_uV = 1,
307 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
308 REGULATOR_CHANGE_STATUS,
309 },
310 .num_consumer_supplies = ARRAY_SIZE(vvib_consumers),
311 .consumer_supplies = vvib_consumers,
312};
313
273static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { 314static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = {
274 { 315 {
275 .id = MC13783_REG_VMMC1, 316 .id = MC13783_REG_VMMC1,
@@ -283,6 +324,9 @@ static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = {
283 }, { 324 }, {
284 .id = MC13783_REG_GPO3, /* Turn on 3.3V */ 325 .id = MC13783_REG_GPO3, /* Turn on 3.3V */
285 .init_data = &gpo_init, 326 .init_data = &gpo_init,
327 }, {
328 .id = MC13783_REG_VVIB, /* Power OV2640 */
329 .init_data = &vvib_init,
286 }, 330 },
287}; 331};
288 332
@@ -311,6 +355,51 @@ static const struct spi_imx_master spi2_pdata __initconst = {
311 .num_chipselect = ARRAY_SIZE(spi2_chipselect), 355 .num_chipselect = ARRAY_SIZE(spi2_chipselect),
312}; 356};
313 357
358static int mx27_3ds_camera_power(struct device *dev, int on)
359{
360 /* enable or disable the camera */
361 pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE");
362 gpio_set_value(CSI_PWRDWN, on ? 0 : 1);
363
364 if (!on)
365 goto out;
366
367 /* If enabled, give a reset impulse */
368 gpio_set_value(CSI_RESET, 0);
369 msleep(20);
370 gpio_set_value(CSI_RESET, 1);
371 msleep(100);
372
373out:
374 return 0;
375}
376
377static struct i2c_board_info mx27_3ds_i2c_camera = {
378 I2C_BOARD_INFO("ov2640", 0x30),
379};
380
381static struct regulator_bulk_data mx27_3ds_camera_regs[] = {
382 { .supply = "cmos_vcore" },
383 { .supply = "cmos_2v8" },
384};
385
386static struct soc_camera_link iclink_ov2640 = {
387 .bus_id = 0,
388 .board_info = &mx27_3ds_i2c_camera,
389 .i2c_adapter_id = 0,
390 .power = mx27_3ds_camera_power,
391 .regulators = mx27_3ds_camera_regs,
392 .num_regulators = ARRAY_SIZE(mx27_3ds_camera_regs),
393};
394
395static struct platform_device mx27_3ds_ov2640 = {
396 .name = "soc-camera-pdrv",
397 .id = 0,
398 .dev = {
399 .platform_data = &iclink_ov2640,
400 },
401};
402
314static struct imx_fb_videomode mx27_3ds_modes[] = { 403static struct imx_fb_videomode mx27_3ds_modes[] = {
315 { /* 480x640 @ 60 Hz */ 404 { /* 480x640 @ 60 Hz */
316 .mode = { 405 .mode = {
@@ -367,12 +456,21 @@ static struct spi_board_info mx27_3ds_spi_devs[] __initdata = {
367 }, 456 },
368}; 457};
369 458
459static struct platform_device *devices[] __initdata = {
460 &mx27_3ds_ov2640,
461};
462
463static const struct mx2_camera_platform_data mx27_3ds_cam_pdata __initconst = {
464 .clk = 26000000,
465};
466
370static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = { 467static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = {
371 .bitrate = 100000, 468 .bitrate = 100000,
372}; 469};
373 470
374static void __init mx27pdk_init(void) 471static void __init mx27pdk_init(void)
375{ 472{
473 int ret;
376 imx27_soc_init(); 474 imx27_soc_init();
377 475
378 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), 476 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
@@ -404,7 +502,17 @@ static void __init mx27pdk_init(void)
404 if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT)) 502 if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT))
405 pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); 503 pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n");
406 imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); 504 imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data);
505 platform_add_devices(devices, ARRAY_SIZE(devices));
407 imx27_add_imx_fb(&mx27_3ds_fb_data); 506 imx27_add_imx_fb(&mx27_3ds_fb_data);
507
508 ret = gpio_request_array(mx27_3ds_camera_gpios,
509 ARRAY_SIZE(mx27_3ds_camera_gpios));
510 if (ret) {
511 pr_err("Failed to request camera gpios");
512 iclink_ov2640.power = NULL;
513 }
514
515 imx27_add_mx2_camera(&mx27_3ds_cam_pdata);
408} 516}
409 517
410static void __init mx27pdk_timer_init(void) 518static void __init mx27pdk_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c
index 4917aab0e25..4518e544822 100644
--- a/arch/arm/mach-imx/mach-mx31ads.c
+++ b/arch/arm/mach-imx/mach-mx31ads.c
@@ -28,7 +28,6 @@
28#include <asm/memory.h> 28#include <asm/memory.h>
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30#include <mach/common.h> 30#include <mach/common.h>
31#include <mach/board-mx31ads.h>
32#include <mach/iomux-mx3.h> 31#include <mach/iomux-mx3.h>
33 32
34#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 33#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
@@ -39,6 +38,9 @@
39 38
40#include "devices-imx31.h" 39#include "devices-imx31.h"
41 40
41/* Base address of PBC controller */
42#define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT
43
42/* PBC Board interrupt status register */ 44/* PBC Board interrupt status register */
43#define PBC_INTSTATUS 0x000016 45#define PBC_INTSTATUS 0x000016
44 46
@@ -62,6 +64,7 @@
62#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) 64#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS)
63#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) 65#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4)
64 66
67#define MXC_EXP_IO_BASE MXC_BOARD_IRQ_START
65#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) 68#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE)
66 69
67#define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10) 70#define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10)
@@ -69,6 +72,10 @@
69 72
70#define MXC_MAX_EXP_IO_LINES 16 73#define MXC_MAX_EXP_IO_LINES 16
71 74
75/* CS8900 */
76#define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8)
77#define CS4_CS8900_MMIO_START 0x20000
78
72/* 79/*
73 * The serial port definition structure. 80 * The serial port definition structure.
74 */ 81 */
@@ -101,11 +108,29 @@ static struct platform_device serial_device = {
101 }, 108 },
102}; 109};
103 110
111static const struct resource mx31ads_cs8900_resources[] __initconst = {
112 DEFINE_RES_MEM(MX31_CS4_BASE_ADDR + CS4_CS8900_MMIO_START, SZ_64K),
113 DEFINE_RES_IRQ(EXPIO_INT_ENET_INT),
114};
115
116static const struct platform_device_info mx31ads_cs8900_devinfo __initconst = {
117 .name = "cs89x0",
118 .id = 0,
119 .res = mx31ads_cs8900_resources,
120 .num_res = ARRAY_SIZE(mx31ads_cs8900_resources),
121};
122
104static int __init mxc_init_extuart(void) 123static int __init mxc_init_extuart(void)
105{ 124{
106 return platform_device_register(&serial_device); 125 return platform_device_register(&serial_device);
107} 126}
108 127
128static void __init mxc_init_ext_ethernet(void)
129{
130 platform_device_register_full(
131 (struct platform_device_info *)&mx31ads_cs8900_devinfo);
132}
133
109static const struct imxuart_platform_data uart_pdata __initconst = { 134static const struct imxuart_platform_data uart_pdata __initconst = {
110 .flags = IMXUART_HAVE_RTSCTS, 135 .flags = IMXUART_HAVE_RTSCTS,
111}; 136};
@@ -492,12 +517,15 @@ static void __init mxc_init_audio(void)
492 mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); 517 mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi");
493} 518}
494 519
495/* static mappings */ 520/*
521 * Static mappings, starting from the CS4 start address up to the start address
522 * of the CS8900.
523 */
496static struct map_desc mx31ads_io_desc[] __initdata = { 524static struct map_desc mx31ads_io_desc[] __initdata = {
497 { 525 {
498 .virtual = MX31_CS4_BASE_ADDR_VIRT, 526 .virtual = MX31_CS4_BASE_ADDR_VIRT,
499 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), 527 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR),
500 .length = MX31_CS4_SIZE / 2, 528 .length = CS4_CS8900_MMIO_START,
501 .type = MT_DEVICE 529 .type = MT_DEVICE
502 }, 530 },
503}; 531};
@@ -522,6 +550,7 @@ static void __init mx31ads_init(void)
522 mxc_init_imx_uart(); 550 mxc_init_imx_uart();
523 mxc_init_i2c(); 551 mxc_init_i2c();
524 mxc_init_audio(); 552 mxc_init_audio();
553 mxc_init_ext_ethernet();
525} 554}
526 555
527static void __init mx31ads_timer_init(void) 556static void __init mx31ads_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index f225262b5c3..f17a15f2831 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -507,7 +507,7 @@ static void mx31moboard_poweroff(void)
507 struct clk *clk = clk_get_sys("imx2-wdt.0", NULL); 507 struct clk *clk = clk_get_sys("imx2-wdt.0", NULL);
508 508
509 if (!IS_ERR(clk)) 509 if (!IS_ERR(clk))
510 clk_enable(clk); 510 clk_prepare_enable(clk);
511 511
512 mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST); 512 mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST);
513 513
@@ -530,6 +530,8 @@ static void __init mx31moboard_init(void)
530 platform_add_devices(devices, ARRAY_SIZE(devices)); 530 platform_add_devices(devices, ARRAY_SIZE(devices));
531 gpio_led_register_device(-1, &mx31moboard_led_pdata); 531 gpio_led_register_device(-1, &mx31moboard_led_pdata);
532 532
533 imx31_add_imx2_wdt(NULL);
534
533 imx31_add_imx_uart0(&uart0_pdata); 535 imx31_add_imx_uart0(&uart0_pdata);
534 imx31_add_imx_uart4(&uart4_pdata); 536 imx31_add_imx_uart4(&uart4_pdata);
535 537
@@ -590,7 +592,7 @@ static void __init mx31moboard_reserve(void)
590} 592}
591 593
592MACHINE_START(MX31MOBOARD, "EPFL Mobots mx31moboard") 594MACHINE_START(MX31MOBOARD, "EPFL Mobots mx31moboard")
593 /* Maintainer: Valentin Longchamp, EPFL Mobots group */ 595 /* Maintainer: Philippe Retornaz, EPFL Mobots group */
594 .atag_offset = 0x100, 596 .atag_offset = 0x100,
595 .reserve = mx31moboard_reserve, 597 .reserve = mx31moboard_reserve,
596 .map_io = mx31_map_io, 598 .map_io = mx31_map_io,
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index 0af6c9c5b3f..e14291d89e4 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -4,6 +4,11 @@
4 * 4 *
5 * Author: Fabio Estevam <fabio.estevam@freescale.com> 5 * Author: Fabio Estevam <fabio.estevam@freescale.com>
6 * 6 *
7 * Copyright (C) 2011 Meprolight, Ltd.
8 * Alex Gershgorin <alexg@meprolight.com>
9 *
10 * Modified from i.MX31 3-Stack Development System
11 *
7 * This program is free software; you can redistribute it and/or modify 12 * 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 13 * 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 14 * the Free Software Foundation; either version 2 of the License, or
@@ -34,15 +39,102 @@
34#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
35#include <asm/mach/time.h> 40#include <asm/mach/time.h>
36#include <asm/mach/map.h> 41#include <asm/mach/map.h>
42#include <asm/memblock.h>
37 43
38#include <mach/hardware.h> 44#include <mach/hardware.h>
39#include <mach/common.h> 45#include <mach/common.h>
40#include <mach/iomux-mx35.h> 46#include <mach/iomux-mx35.h>
41#include <mach/irqs.h> 47#include <mach/irqs.h>
42#include <mach/3ds_debugboard.h> 48#include <mach/3ds_debugboard.h>
49#include <video/platform_lcd.h>
50
51#include <media/soc_camera.h>
43 52
44#include "devices-imx35.h" 53#include "devices-imx35.h"
45 54
55#define GPIO_MC9S08DZ60_GPS_ENABLE 0
56#define GPIO_MC9S08DZ60_HDD_ENABLE 4
57#define GPIO_MC9S08DZ60_WIFI_ENABLE 5
58#define GPIO_MC9S08DZ60_LCD_ENABLE 6
59#define GPIO_MC9S08DZ60_SPEAKER_ENABLE 8
60
61static const struct fb_videomode fb_modedb[] = {
62 {
63 /* 800x480 @ 55 Hz */
64 .name = "Ceramate-CLAA070VC01",
65 .refresh = 55,
66 .xres = 800,
67 .yres = 480,
68 .pixclock = 40000,
69 .left_margin = 40,
70 .right_margin = 40,
71 .upper_margin = 5,
72 .lower_margin = 5,
73 .hsync_len = 20,
74 .vsync_len = 10,
75 .sync = FB_SYNC_OE_ACT_HIGH,
76 .vmode = FB_VMODE_NONINTERLACED,
77 .flag = 0,
78 },
79};
80
81static const struct ipu_platform_data mx3_ipu_data __initconst = {
82 .irq_base = MXC_IPU_IRQ_START,
83};
84
85static struct mx3fb_platform_data mx3fb_pdata __initdata = {
86 .name = "Ceramate-CLAA070VC01",
87 .mode = fb_modedb,
88 .num_modes = ARRAY_SIZE(fb_modedb),
89};
90
91static struct i2c_board_info __initdata i2c_devices_3ds[] = {
92 {
93 I2C_BOARD_INFO("mc9s08dz60", 0x69),
94 },
95};
96
97static int lcd_power_gpio = -ENXIO;
98
99static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip,
100 void *data)
101{
102 return !strcmp(chip->label, data);
103}
104
105static void mx35_3ds_lcd_set_power(
106 struct plat_lcd_data *pd, unsigned int power)
107{
108 struct gpio_chip *chip;
109
110 if (!gpio_is_valid(lcd_power_gpio)) {
111 chip = gpiochip_find(
112 "mc9s08dz60", mc9s08dz60_gpiochip_match);
113 if (chip) {
114 lcd_power_gpio =
115 chip->base + GPIO_MC9S08DZ60_LCD_ENABLE;
116 if (gpio_request(lcd_power_gpio, "lcd_power") < 0) {
117 pr_err("error: gpio already requested!\n");
118 lcd_power_gpio = -ENXIO;
119 }
120 } else {
121 pr_err("error: didn't find mc9s08dz60 gpio chip\n");
122 }
123 }
124
125 if (gpio_is_valid(lcd_power_gpio))
126 gpio_set_value_cansleep(lcd_power_gpio, power);
127}
128
129static struct plat_lcd_data mx35_3ds_lcd_data = {
130 .set_power = mx35_3ds_lcd_set_power,
131};
132
133static struct platform_device mx35_3ds_lcd = {
134 .name = "platform-lcd",
135 .dev.platform_data = &mx35_3ds_lcd_data,
136};
137
46#define EXPIO_PARENT_INT gpio_to_irq(IMX_GPIO_NR(1, 1)) 138#define EXPIO_PARENT_INT gpio_to_irq(IMX_GPIO_NR(1, 1))
47 139
48static const struct imxuart_platform_data uart_pdata __initconst = { 140static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -120,6 +212,109 @@ static iomux_v3_cfg_t mx35pdk_pads[] = {
120 /* I2C1 */ 212 /* I2C1 */
121 MX35_PAD_I2C1_CLK__I2C1_SCL, 213 MX35_PAD_I2C1_CLK__I2C1_SCL,
122 MX35_PAD_I2C1_DAT__I2C1_SDA, 214 MX35_PAD_I2C1_DAT__I2C1_SDA,
215 /* Display */
216 MX35_PAD_LD0__IPU_DISPB_DAT_0,
217 MX35_PAD_LD1__IPU_DISPB_DAT_1,
218 MX35_PAD_LD2__IPU_DISPB_DAT_2,
219 MX35_PAD_LD3__IPU_DISPB_DAT_3,
220 MX35_PAD_LD4__IPU_DISPB_DAT_4,
221 MX35_PAD_LD5__IPU_DISPB_DAT_5,
222 MX35_PAD_LD6__IPU_DISPB_DAT_6,
223 MX35_PAD_LD7__IPU_DISPB_DAT_7,
224 MX35_PAD_LD8__IPU_DISPB_DAT_8,
225 MX35_PAD_LD9__IPU_DISPB_DAT_9,
226 MX35_PAD_LD10__IPU_DISPB_DAT_10,
227 MX35_PAD_LD11__IPU_DISPB_DAT_11,
228 MX35_PAD_LD12__IPU_DISPB_DAT_12,
229 MX35_PAD_LD13__IPU_DISPB_DAT_13,
230 MX35_PAD_LD14__IPU_DISPB_DAT_14,
231 MX35_PAD_LD15__IPU_DISPB_DAT_15,
232 MX35_PAD_LD16__IPU_DISPB_DAT_16,
233 MX35_PAD_LD17__IPU_DISPB_DAT_17,
234 MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC,
235 MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK,
236 MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY,
237 MX35_PAD_CONTRAST__IPU_DISPB_CONTR,
238 MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC,
239 MX35_PAD_D3_REV__IPU_DISPB_D3_REV,
240 MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS,
241 /* CSI */
242 MX35_PAD_TX1__IPU_CSI_D_6,
243 MX35_PAD_TX0__IPU_CSI_D_7,
244 MX35_PAD_CSI_D8__IPU_CSI_D_8,
245 MX35_PAD_CSI_D9__IPU_CSI_D_9,
246 MX35_PAD_CSI_D10__IPU_CSI_D_10,
247 MX35_PAD_CSI_D11__IPU_CSI_D_11,
248 MX35_PAD_CSI_D12__IPU_CSI_D_12,
249 MX35_PAD_CSI_D13__IPU_CSI_D_13,
250 MX35_PAD_CSI_D14__IPU_CSI_D_14,
251 MX35_PAD_CSI_D15__IPU_CSI_D_15,
252 MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC,
253 MX35_PAD_CSI_MCLK__IPU_CSI_MCLK,
254 MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK,
255 MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC,
256};
257
258/*
259 * Camera support
260*/
261static phys_addr_t mx3_camera_base __initdata;
262#define MX35_3DS_CAMERA_BUF_SIZE SZ_8M
263
264static const struct mx3_camera_pdata mx35_3ds_camera_pdata __initconst = {
265 .flags = MX3_CAMERA_DATAWIDTH_8,
266 .mclk_10khz = 2000,
267};
268
269static int __init imx35_3ds_init_camera(void)
270{
271 int dma, ret = -ENOMEM;
272 struct platform_device *pdev =
273 imx35_alloc_mx3_camera(&mx35_3ds_camera_pdata);
274
275 if (IS_ERR(pdev))
276 return PTR_ERR(pdev);
277
278 if (!mx3_camera_base)
279 goto err;
280
281 dma = dma_declare_coherent_memory(&pdev->dev,
282 mx3_camera_base, mx3_camera_base,
283 MX35_3DS_CAMERA_BUF_SIZE,
284 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
285
286 if (!(dma & DMA_MEMORY_MAP))
287 goto err;
288
289 ret = platform_device_add(pdev);
290 if (ret)
291err:
292 platform_device_put(pdev);
293
294 return ret;
295}
296
297static const struct ipu_platform_data mx35_3ds_ipu_data __initconst = {
298 .irq_base = MXC_IPU_IRQ_START,
299};
300
301static struct i2c_board_info mx35_3ds_i2c_camera = {
302 I2C_BOARD_INFO("ov2640", 0x30),
303};
304
305static struct soc_camera_link iclink_ov2640 = {
306 .bus_id = 0,
307 .board_info = &mx35_3ds_i2c_camera,
308 .i2c_adapter_id = 0,
309 .power = NULL,
310};
311
312static struct platform_device mx35_3ds_ov2640 = {
313 .name = "soc-camera-pdrv",
314 .id = 0,
315 .dev = {
316 .platform_data = &iclink_ov2640,
317 },
123}; 318};
124 319
125static int mx35_3ds_otg_init(struct platform_device *pdev) 320static int mx35_3ds_otg_init(struct platform_device *pdev)
@@ -179,6 +374,8 @@ static const struct imxi2c_platform_data mx35_3ds_i2c0_data __initconst = {
179 */ 374 */
180static void __init mx35_3ds_init(void) 375static void __init mx35_3ds_init(void)
181{ 376{
377 struct platform_device *imx35_fb_pdev;
378
182 imx35_soc_init(); 379 imx35_soc_init();
183 380
184 mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads)); 381 mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads));
@@ -204,6 +401,17 @@ static void __init mx35_3ds_init(void)
204 pr_warn("Init of the debugboard failed, all " 401 pr_warn("Init of the debugboard failed, all "
205 "devices on the debugboard are unusable.\n"); 402 "devices on the debugboard are unusable.\n");
206 imx35_add_imx_i2c0(&mx35_3ds_i2c0_data); 403 imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
404
405 i2c_register_board_info(
406 0, i2c_devices_3ds, ARRAY_SIZE(i2c_devices_3ds));
407
408 imx35_add_ipu_core(&mx35_3ds_ipu_data);
409 platform_device_register(&mx35_3ds_ov2640);
410 imx35_3ds_init_camera();
411
412 imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata);
413 mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev;
414 platform_device_register(&mx35_3ds_lcd);
207} 415}
208 416
209static void __init mx35pdk_timer_init(void) 417static void __init mx35pdk_timer_init(void)
@@ -215,6 +423,13 @@ struct sys_timer mx35pdk_timer = {
215 .init = mx35pdk_timer_init, 423 .init = mx35pdk_timer_init,
216}; 424};
217 425
426static void __init mx35_3ds_reserve(void)
427{
428 /* reserve MX35_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */
429 mx3_camera_base = arm_memblock_steal(MX35_3DS_CAMERA_BUF_SIZE,
430 MX35_3DS_CAMERA_BUF_SIZE);
431}
432
218MACHINE_START(MX35_3DS, "Freescale MX35PDK") 433MACHINE_START(MX35_3DS, "Freescale MX35PDK")
219 /* Maintainer: Freescale Semiconductor, Inc */ 434 /* Maintainer: Freescale Semiconductor, Inc */
220 .atag_offset = 0x100, 435 .atag_offset = 0x100,
@@ -224,5 +439,6 @@ MACHINE_START(MX35_3DS, "Freescale MX35PDK")
224 .handle_irq = imx35_handle_irq, 439 .handle_irq = imx35_handle_irq,
225 .timer = &mx35pdk_timer, 440 .timer = &mx35pdk_timer,
226 .init_machine = mx35_3ds_init, 441 .init_machine = mx35_3ds_init,
442 .reserve = mx35_3ds_reserve,
227 .restart = mxc_restart, 443 .restart = mxc_restart,
228MACHINE_END 444MACHINE_END
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index d3b9c6b5edd..541152e450c 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -36,7 +36,6 @@
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <mach/iomux-mx27.h> 37#include <mach/iomux-mx27.h>
38#include <asm/mach/time.h> 38#include <asm/mach/time.h>
39#include <mach/audmux.h>
40#include <mach/irqs.h> 39#include <mach/irqs.h>
41#include <mach/ulpi.h> 40#include <mach/ulpi.h>
42 41
@@ -359,18 +358,6 @@ static void __init pca100_init(void)
359 358
360 imx27_soc_init(); 359 imx27_soc_init();
361 360
362 /* SSI unit */
363 mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
364 MXC_AUDMUX_V1_PCR_SYN | /* 4wire mode */
365 MXC_AUDMUX_V1_PCR_TFCSEL(3) |
366 MXC_AUDMUX_V1_PCR_TCLKDIR | /* clock is output */
367 MXC_AUDMUX_V1_PCR_RXDSEL(3));
368 mxc_audmux_v1_configure_port(3,
369 MXC_AUDMUX_V1_PCR_SYN | /* 4wire mode */
370 MXC_AUDMUX_V1_PCR_TFCSEL(0) |
371 MXC_AUDMUX_V1_PCR_TFSDIR |
372 MXC_AUDMUX_V1_PCR_RXDSEL(0));
373
374 ret = mxc_gpio_setup_multiple_pins(pca100_pins, 361 ret = mxc_gpio_setup_multiple_pins(pca100_pins,
375 ARRAY_SIZE(pca100_pins), "PCA100"); 362 ARRAY_SIZE(pca100_pins), "PCA100");
376 if (ret) 363 if (ret)
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index 16f126da9f8..2f3debe2a11 100644
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -233,7 +233,7 @@ static struct regulator_init_data sdhc1_data = {
233 233
234static struct regulator_consumer_supply cam_consumers[] = { 234static struct regulator_consumer_supply cam_consumers[] = {
235 { 235 {
236 .dev = NULL, 236 .dev_name = NULL,
237 .supply = "imx_cam_vcc", 237 .supply = "imx_cam_vcc",
238 }, 238 },
239}; 239};
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index 06dc106519a..237474fcca2 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -37,7 +37,6 @@
37#include <mach/common.h> 37#include <mach/common.h>
38#include <mach/iomux-mx35.h> 38#include <mach/iomux-mx35.h>
39#include <mach/ulpi.h> 39#include <mach/ulpi.h>
40#include <mach/audmux.h>
41 40
42#include "devices-imx35.h" 41#include "devices-imx35.h"
43 42
@@ -362,18 +361,6 @@ static void __init pcm043_init(void)
362 361
363 mxc_iomux_v3_setup_multiple_pads(pcm043_pads, ARRAY_SIZE(pcm043_pads)); 362 mxc_iomux_v3_setup_multiple_pads(pcm043_pads, ARRAY_SIZE(pcm043_pads));
364 363
365 mxc_audmux_v2_configure_port(3,
366 MXC_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
367 MXC_AUDMUX_V2_PTCR_TFSEL(0) |
368 MXC_AUDMUX_V2_PTCR_TFSDIR,
369 MXC_AUDMUX_V2_PDCR_RXDSEL(0));
370
371 mxc_audmux_v2_configure_port(0,
372 MXC_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
373 MXC_AUDMUX_V2_PTCR_TCSEL(3) |
374 MXC_AUDMUX_V2_PTCR_TCLKDIR, /* clock is output */
375 MXC_AUDMUX_V2_PDCR_RXDSEL(3));
376
377 imx35_add_fec(NULL); 364 imx35_add_fec(NULL);
378 platform_add_devices(devices, ARRAY_SIZE(devices)); 365 platform_add_devices(devices, ARRAY_SIZE(devices));
379 imx35_add_imx2_wdt(NULL); 366 imx35_add_imx2_wdt(NULL);
diff --git a/arch/arm/mach-imx/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c
index 3f05dfebacc..14d540edfd1 100644
--- a/arch/arm/mach-imx/mm-imx21.c
+++ b/arch/arm/mach-imx/mm-imx21.c
@@ -75,6 +75,10 @@ void __init mx21_init_irq(void)
75 mxc_init_irq(MX21_IO_ADDRESS(MX21_AVIC_BASE_ADDR)); 75 mxc_init_irq(MX21_IO_ADDRESS(MX21_AVIC_BASE_ADDR));
76} 76}
77 77
78static const struct resource imx21_audmux_res[] __initconst = {
79 DEFINE_RES_MEM(MX21_AUDMUX_BASE_ADDR, SZ_4K),
80};
81
78void __init imx21_soc_init(void) 82void __init imx21_soc_init(void)
79{ 83{
80 mxc_register_gpio("imx21-gpio", 0, MX21_GPIO1_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 84 mxc_register_gpio("imx21-gpio", 0, MX21_GPIO1_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
@@ -85,4 +89,6 @@ void __init imx21_soc_init(void)
85 mxc_register_gpio("imx21-gpio", 5, MX21_GPIO6_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 89 mxc_register_gpio("imx21-gpio", 5, MX21_GPIO6_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
86 90
87 imx_add_imx_dma(); 91 imx_add_imx_dma();
92 platform_device_register_simple("imx21-audmux", 0, imx21_audmux_res,
93 ARRAY_SIZE(imx21_audmux_res));
88} 94}
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
index cc4d152bd9b..153b457acdc 100644
--- a/arch/arm/mach-imx/mm-imx25.c
+++ b/arch/arm/mach-imx/mm-imx25.c
@@ -83,6 +83,10 @@ static struct sdma_platform_data imx25_sdma_pdata __initdata = {
83 .script_addrs = &imx25_sdma_script, 83 .script_addrs = &imx25_sdma_script,
84}; 84};
85 85
86static const struct resource imx25_audmux_res[] __initconst = {
87 DEFINE_RES_MEM(MX25_AUDMUX_BASE_ADDR, SZ_16K),
88};
89
86void __init imx25_soc_init(void) 90void __init imx25_soc_init(void)
87{ 91{
88 /* i.mx25 has the i.mx31 type gpio */ 92 /* i.mx25 has the i.mx31 type gpio */
@@ -93,4 +97,7 @@ void __init imx25_soc_init(void)
93 97
94 /* i.mx25 has the i.mx35 type sdma */ 98 /* i.mx25 has the i.mx35 type sdma */
95 imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata); 99 imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
100 /* i.mx25 has the i.mx31 type audmux */
101 platform_device_register_simple("imx31-audmux", 0, imx25_audmux_res,
102 ARRAY_SIZE(imx25_audmux_res));
96} 103}
diff --git a/arch/arm/mach-imx/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c
index 96dd1f5ea7b..8cb3f5e3e56 100644
--- a/arch/arm/mach-imx/mm-imx27.c
+++ b/arch/arm/mach-imx/mm-imx27.c
@@ -75,6 +75,10 @@ void __init mx27_init_irq(void)
75 mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR)); 75 mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR));
76} 76}
77 77
78static const struct resource imx27_audmux_res[] __initconst = {
79 DEFINE_RES_MEM(MX27_AUDMUX_BASE_ADDR, SZ_4K),
80};
81
78void __init imx27_soc_init(void) 82void __init imx27_soc_init(void)
79{ 83{
80 /* i.mx27 has the i.mx21 type gpio */ 84 /* i.mx27 has the i.mx21 type gpio */
@@ -86,4 +90,7 @@ void __init imx27_soc_init(void)
86 mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0); 90 mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
87 91
88 imx_add_imx_dma(); 92 imx_add_imx_dma();
93 /* imx27 has the imx21 type audmux */
94 platform_device_register_simple("imx21-audmux", 0, imx27_audmux_res,
95 ARRAY_SIZE(imx27_audmux_res));
89} 96}
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index 31807d2a8b7..f8ca96c354f 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -34,31 +34,31 @@ static void imx3_idle(void)
34{ 34{
35 unsigned long reg = 0; 35 unsigned long reg = 0;
36 36
37 if (!need_resched()) 37 mx3_cpu_lp_set(MX3_WAIT);
38 __asm__ __volatile__( 38
39 /* disable I and D cache */ 39 __asm__ __volatile__(
40 "mrc p15, 0, %0, c1, c0, 0\n" 40 /* disable I and D cache */
41 "bic %0, %0, #0x00001000\n" 41 "mrc p15, 0, %0, c1, c0, 0\n"
42 "bic %0, %0, #0x00000004\n" 42 "bic %0, %0, #0x00001000\n"
43 "mcr p15, 0, %0, c1, c0, 0\n" 43 "bic %0, %0, #0x00000004\n"
44 /* invalidate I cache */ 44 "mcr p15, 0, %0, c1, c0, 0\n"
45 "mov %0, #0\n" 45 /* invalidate I cache */
46 "mcr p15, 0, %0, c7, c5, 0\n" 46 "mov %0, #0\n"
47 /* clear and invalidate D cache */ 47 "mcr p15, 0, %0, c7, c5, 0\n"
48 "mov %0, #0\n" 48 /* clear and invalidate D cache */
49 "mcr p15, 0, %0, c7, c14, 0\n" 49 "mov %0, #0\n"
50 /* WFI */ 50 "mcr p15, 0, %0, c7, c14, 0\n"
51 "mov %0, #0\n" 51 /* WFI */
52 "mcr p15, 0, %0, c7, c0, 4\n" 52 "mov %0, #0\n"
53 "nop\n" "nop\n" "nop\n" "nop\n" 53 "mcr p15, 0, %0, c7, c0, 4\n"
54 "nop\n" "nop\n" "nop\n" 54 "nop\n" "nop\n" "nop\n" "nop\n"
55 /* enable I and D cache */ 55 "nop\n" "nop\n" "nop\n"
56 "mrc p15, 0, %0, c1, c0, 0\n" 56 /* enable I and D cache */
57 "orr %0, %0, #0x00001000\n" 57 "mrc p15, 0, %0, c1, c0, 0\n"
58 "orr %0, %0, #0x00000004\n" 58 "orr %0, %0, #0x00001000\n"
59 "mcr p15, 0, %0, c1, c0, 0\n" 59 "orr %0, %0, #0x00000004\n"
60 : "=r" (reg)); 60 "mcr p15, 0, %0, c1, c0, 0\n"
61 local_irq_enable(); 61 : "=r" (reg));
62} 62}
63 63
64static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size, 64static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size,
@@ -78,7 +78,7 @@ static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size,
78 return __arm_ioremap(phys_addr, size, mtype); 78 return __arm_ioremap(phys_addr, size, mtype);
79} 79}
80 80
81void imx3_init_l2x0(void) 81void __init imx3_init_l2x0(void)
82{ 82{
83 void __iomem *l2x0_base; 83 void __iomem *l2x0_base;
84 void __iomem *clkctl_base; 84 void __iomem *clkctl_base;
@@ -134,8 +134,8 @@ void __init imx31_init_early(void)
134{ 134{
135 mxc_set_cpu_type(MXC_CPU_MX31); 135 mxc_set_cpu_type(MXC_CPU_MX31);
136 mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); 136 mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
137 pm_idle = imx3_idle;
138 imx_ioremap = imx3_ioremap; 137 imx_ioremap = imx3_ioremap;
138 arm_pm_idle = imx3_idle;
139} 139}
140 140
141void __init mx31_init_irq(void) 141void __init mx31_init_irq(void)
@@ -158,6 +158,10 @@ static struct sdma_platform_data imx31_sdma_pdata __initdata = {
158 .script_addrs = &imx31_to2_sdma_script, 158 .script_addrs = &imx31_to2_sdma_script,
159}; 159};
160 160
161static const struct resource imx31_audmux_res[] __initconst = {
162 DEFINE_RES_MEM(MX31_AUDMUX_BASE_ADDR, SZ_16K),
163};
164
161void __init imx31_soc_init(void) 165void __init imx31_soc_init(void)
162{ 166{
163 int to_version = mx31_revision() >> 4; 167 int to_version = mx31_revision() >> 4;
@@ -175,6 +179,12 @@ void __init imx31_soc_init(void)
175 } 179 }
176 180
177 imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata); 181 imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
182
183 imx_set_aips(MX31_IO_ADDRESS(MX31_AIPS1_BASE_ADDR));
184 imx_set_aips(MX31_IO_ADDRESS(MX31_AIPS2_BASE_ADDR));
185
186 platform_device_register_simple("imx31-audmux", 0, imx31_audmux_res,
187 ARRAY_SIZE(imx31_audmux_res));
178} 188}
179#endif /* ifdef CONFIG_SOC_IMX31 */ 189#endif /* ifdef CONFIG_SOC_IMX31 */
180 190
@@ -197,7 +207,7 @@ void __init imx35_init_early(void)
197 mxc_set_cpu_type(MXC_CPU_MX35); 207 mxc_set_cpu_type(MXC_CPU_MX35);
198 mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR)); 208 mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR));
199 mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR)); 209 mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR));
200 pm_idle = imx3_idle; 210 arm_pm_idle = imx3_idle;
201 imx_ioremap = imx3_ioremap; 211 imx_ioremap = imx3_ioremap;
202} 212}
203 213
@@ -241,6 +251,10 @@ static struct sdma_platform_data imx35_sdma_pdata __initdata = {
241 .script_addrs = &imx35_to2_sdma_script, 251 .script_addrs = &imx35_to2_sdma_script,
242}; 252};
243 253
254static const struct resource imx35_audmux_res[] __initconst = {
255 DEFINE_RES_MEM(MX35_AUDMUX_BASE_ADDR, SZ_16K),
256};
257
244void __init imx35_soc_init(void) 258void __init imx35_soc_init(void)
245{ 259{
246 int to_version = mx35_revision() >> 4; 260 int to_version = mx35_revision() >> 4;
@@ -259,5 +273,13 @@ void __init imx35_soc_init(void)
259 } 273 }
260 274
261 imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata); 275 imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
276
277 /* Setup AIPS registers */
278 imx_set_aips(MX35_IO_ADDRESS(MX35_AIPS1_BASE_ADDR));
279 imx_set_aips(MX35_IO_ADDRESS(MX35_AIPS2_BASE_ADDR));
280
281 /* i.mx35 has the i.mx31 type audmux */
282 platform_device_register_simple("imx31-audmux", 0, imx35_audmux_res,
283 ARRAY_SIZE(imx35_audmux_res));
262} 284}
263#endif /* ifdef CONFIG_SOC_IMX35 */ 285#endif /* ifdef CONFIG_SOC_IMX35 */
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index bc17dfea381..51af9fa5694 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -26,23 +26,17 @@ static struct clk *gpc_dvfs_clk;
26 26
27static void imx5_idle(void) 27static void imx5_idle(void)
28{ 28{
29 if (!need_resched()) { 29 /* gpc clock is needed for SRPG */
30 /* gpc clock is needed for SRPG */ 30 if (gpc_dvfs_clk == NULL) {
31 if (gpc_dvfs_clk == NULL) { 31 gpc_dvfs_clk = clk_get(NULL, "gpc_dvfs");
32 gpc_dvfs_clk = clk_get(NULL, "gpc_dvfs"); 32 if (IS_ERR(gpc_dvfs_clk))
33 if (IS_ERR(gpc_dvfs_clk)) 33 return;
34 goto err0;
35 }
36 clk_enable(gpc_dvfs_clk);
37 mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF);
38 if (tzic_enable_wake())
39 goto err1;
40 cpu_do_idle();
41err1:
42 clk_disable(gpc_dvfs_clk);
43 } 34 }
44err0: 35 clk_enable(gpc_dvfs_clk);
45 local_irq_enable(); 36 mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF);
37 if (tzic_enable_wake() != 0)
38 cpu_do_idle();
39 clk_disable(gpc_dvfs_clk);
46} 40}
47 41
48/* 42/*
@@ -108,7 +102,7 @@ void __init imx51_init_early(void)
108 mxc_set_cpu_type(MXC_CPU_MX51); 102 mxc_set_cpu_type(MXC_CPU_MX51);
109 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR)); 103 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
110 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR)); 104 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR));
111 pm_idle = imx5_idle; 105 arm_pm_idle = imx5_idle;
112} 106}
113 107
114void __init imx53_init_early(void) 108void __init imx53_init_early(void)
@@ -170,6 +164,18 @@ static struct sdma_platform_data imx53_sdma_pdata __initdata = {
170 .script_addrs = &imx53_sdma_script, 164 .script_addrs = &imx53_sdma_script,
171}; 165};
172 166
167static const struct resource imx50_audmux_res[] __initconst = {
168 DEFINE_RES_MEM(MX50_AUDMUX_BASE_ADDR, SZ_16K),
169};
170
171static const struct resource imx51_audmux_res[] __initconst = {
172 DEFINE_RES_MEM(MX51_AUDMUX_BASE_ADDR, SZ_16K),
173};
174
175static const struct resource imx53_audmux_res[] __initconst = {
176 DEFINE_RES_MEM(MX53_AUDMUX_BASE_ADDR, SZ_16K),
177};
178
173void __init imx50_soc_init(void) 179void __init imx50_soc_init(void)
174{ 180{
175 /* i.mx50 has the i.mx31 type gpio */ 181 /* i.mx50 has the i.mx31 type gpio */
@@ -179,6 +185,10 @@ void __init imx50_soc_init(void)
179 mxc_register_gpio("imx31-gpio", 3, MX50_GPIO4_BASE_ADDR, SZ_16K, MX50_INT_GPIO4_LOW, MX50_INT_GPIO4_HIGH); 185 mxc_register_gpio("imx31-gpio", 3, MX50_GPIO4_BASE_ADDR, SZ_16K, MX50_INT_GPIO4_LOW, MX50_INT_GPIO4_HIGH);
180 mxc_register_gpio("imx31-gpio", 4, MX50_GPIO5_BASE_ADDR, SZ_16K, MX50_INT_GPIO5_LOW, MX50_INT_GPIO5_HIGH); 186 mxc_register_gpio("imx31-gpio", 4, MX50_GPIO5_BASE_ADDR, SZ_16K, MX50_INT_GPIO5_LOW, MX50_INT_GPIO5_HIGH);
181 mxc_register_gpio("imx31-gpio", 5, MX50_GPIO6_BASE_ADDR, SZ_16K, MX50_INT_GPIO6_LOW, MX50_INT_GPIO6_HIGH); 187 mxc_register_gpio("imx31-gpio", 5, MX50_GPIO6_BASE_ADDR, SZ_16K, MX50_INT_GPIO6_LOW, MX50_INT_GPIO6_HIGH);
188
189 /* i.mx50 has the i.mx31 type audmux */
190 platform_device_register_simple("imx31-audmux", 0, imx50_audmux_res,
191 ARRAY_SIZE(imx50_audmux_res));
182} 192}
183 193
184void __init imx51_soc_init(void) 194void __init imx51_soc_init(void)
@@ -191,6 +201,14 @@ void __init imx51_soc_init(void)
191 201
192 /* i.mx51 has the i.mx35 type sdma */ 202 /* i.mx51 has the i.mx35 type sdma */
193 imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata); 203 imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
204
205 /* Setup AIPS registers */
206 imx_set_aips(MX51_IO_ADDRESS(MX51_AIPS1_BASE_ADDR));
207 imx_set_aips(MX51_IO_ADDRESS(MX51_AIPS2_BASE_ADDR));
208
209 /* i.mx51 has the i.mx31 type audmux */
210 platform_device_register_simple("imx31-audmux", 0, imx51_audmux_res,
211 ARRAY_SIZE(imx51_audmux_res));
194} 212}
195 213
196void __init imx53_soc_init(void) 214void __init imx53_soc_init(void)
@@ -206,4 +224,12 @@ void __init imx53_soc_init(void)
206 224
207 /* i.mx53 has the i.mx35 type sdma */ 225 /* i.mx53 has the i.mx35 type sdma */
208 imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata); 226 imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
227
228 /* Setup AIPS registers */
229 imx_set_aips(MX53_IO_ADDRESS(MX53_AIPS1_BASE_ADDR));
230 imx_set_aips(MX53_IO_ADDRESS(MX53_AIPS2_BASE_ADDR));
231
232 /* i.mx53 has the i.mx31 type audmux */
233 platform_device_register_simple("imx31-audmux", 0, imx53_audmux_res,
234 ARRAY_SIZE(imx53_audmux_res));
209} 235}
diff --git a/arch/arm/mach-imx/pm-imx27.c b/arch/arm/mach-imx/pm-imx27.c
index e455d2f855b..6fcffa7db97 100644
--- a/arch/arm/mach-imx/pm-imx27.c
+++ b/arch/arm/mach-imx/pm-imx27.c
@@ -10,7 +10,6 @@
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/system.h>
14#include <mach/hardware.h> 13#include <mach/hardware.h>
15 14
16static int mx27_suspend_enter(suspend_state_t state) 15static int mx27_suspend_enter(suspend_state_t state)
@@ -23,7 +22,7 @@ static int mx27_suspend_enter(suspend_state_t state)
23 cscr &= 0xFFFFFFFC; 22 cscr &= 0xFFFFFFFC;
24 __raw_writel(cscr, MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR)); 23 __raw_writel(cscr, MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
25 /* Executes WFI */ 24 /* Executes WFI */
26 arch_idle(); 25 cpu_do_idle();
27 break; 26 break;
28 27
29 default: 28 default:
diff --git a/arch/arm/mach-imx/pm-imx3.c b/arch/arm/mach-imx/pm-imx3.c
new file mode 100644
index 00000000000..b3752439632
--- /dev/null
+++ b/arch/arm/mach-imx/pm-imx3.c
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11#include <linux/io.h>
12#include <mach/common.h>
13#include <mach/hardware.h>
14#include <mach/devices-common.h>
15#include "crmregs-imx3.h"
16
17/*
18 * Set cpu low power mode before WFI instruction. This function is called
19 * mx3 because it can be used for mx31 and mx35.
20 * Currently only WAIT_MODE is supported.
21 */
22void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode)
23{
24 int reg = __raw_readl(MXC_CCM_CCMR);
25 reg &= ~MXC_CCM_CCMR_LPM_MASK;
26
27 switch (mode) {
28 case MX3_WAIT:
29 if (cpu_is_mx35())
30 reg |= MXC_CCM_CCMR_LPM_WAIT_MX35;
31 __raw_writel(reg, MXC_CCM_CCMR);
32 break;
33 default:
34 pr_err("Unknown cpu power mode: %d\n", mode);
35 return;
36 }
37}
diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c
index 6dc09344805..e26a9cb05ed 100644
--- a/arch/arm/mach-imx/pm-imx5.c
+++ b/arch/arm/mach-imx/pm-imx5.c
@@ -89,7 +89,7 @@ void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode)
89 89
90static int mx5_suspend_prepare(void) 90static int mx5_suspend_prepare(void)
91{ 91{
92 return clk_enable(gpc_dvfs_clk); 92 return clk_prepare_enable(gpc_dvfs_clk);
93} 93}
94 94
95static int mx5_suspend_enter(suspend_state_t state) 95static int mx5_suspend_enter(suspend_state_t state)
@@ -119,7 +119,7 @@ static int mx5_suspend_enter(suspend_state_t state)
119 119
120static void mx5_suspend_finish(void) 120static void mx5_suspend_finish(void)
121{ 121{
122 clk_disable(gpc_dvfs_clk); 122 clk_disable_unprepare(gpc_dvfs_clk);
123} 123}
124 124
125static int mx5_pm_valid(suspend_state_t state) 125static int mx5_pm_valid(suspend_state_t state)
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 019f0ab08f6..15b87f26ac9 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -35,67 +35,23 @@
35 35
36static struct amba_pl010_data integrator_uart_data; 36static struct amba_pl010_data integrator_uart_data;
37 37
38static struct amba_device rtc_device = { 38#define INTEGRATOR_RTC_IRQ { IRQ_RTCINT }
39 .dev = { 39#define INTEGRATOR_UART0_IRQ { IRQ_UARTINT0 }
40 .init_name = "mb:15", 40#define INTEGRATOR_UART1_IRQ { IRQ_UARTINT1 }
41 }, 41#define KMI0_IRQ { IRQ_KMIINT0 }
42 .res = { 42#define KMI1_IRQ { IRQ_KMIINT1 }
43 .start = INTEGRATOR_RTC_BASE,
44 .end = INTEGRATOR_RTC_BASE + SZ_4K - 1,
45 .flags = IORESOURCE_MEM,
46 },
47 .irq = { IRQ_RTCINT, NO_IRQ },
48};
49 43
50static struct amba_device uart0_device = { 44static AMBA_APB_DEVICE(rtc, "mb:15", 0,
51 .dev = { 45 INTEGRATOR_RTC_BASE, INTEGRATOR_RTC_IRQ, NULL);
52 .init_name = "mb:16",
53 .platform_data = &integrator_uart_data,
54 },
55 .res = {
56 .start = INTEGRATOR_UART0_BASE,
57 .end = INTEGRATOR_UART0_BASE + SZ_4K - 1,
58 .flags = IORESOURCE_MEM,
59 },
60 .irq = { IRQ_UARTINT0, NO_IRQ },
61};
62 46
63static struct amba_device uart1_device = { 47static AMBA_APB_DEVICE(uart0, "mb:16", 0,
64 .dev = { 48 INTEGRATOR_UART0_BASE, INTEGRATOR_UART0_IRQ, &integrator_uart_data);
65 .init_name = "mb:17",
66 .platform_data = &integrator_uart_data,
67 },
68 .res = {
69 .start = INTEGRATOR_UART1_BASE,
70 .end = INTEGRATOR_UART1_BASE + SZ_4K - 1,
71 .flags = IORESOURCE_MEM,
72 },
73 .irq = { IRQ_UARTINT1, NO_IRQ },
74};
75 49
76static struct amba_device kmi0_device = { 50static AMBA_APB_DEVICE(uart1, "mb:17", 0,
77 .dev = { 51 INTEGRATOR_UART1_BASE, INTEGRATOR_UART1_IRQ, &integrator_uart_data);
78 .init_name = "mb:18",
79 },
80 .res = {
81 .start = KMI0_BASE,
82 .end = KMI0_BASE + SZ_4K - 1,
83 .flags = IORESOURCE_MEM,
84 },
85 .irq = { IRQ_KMIINT0, NO_IRQ },
86};
87 52
88static struct amba_device kmi1_device = { 53static AMBA_APB_DEVICE(kmi0, "mb:18", 0, KMI0_BASE, KMI0_IRQ, NULL);
89 .dev = { 54static AMBA_APB_DEVICE(kmi1, "mb:19", 0, KMI1_BASE, KMI1_IRQ, NULL);
90 .init_name = "mb:19",
91 },
92 .res = {
93 .start = KMI1_BASE,
94 .end = KMI1_BASE + SZ_4K - 1,
95 .flags = IORESOURCE_MEM,
96 },
97 .irq = { IRQ_KMIINT1, NO_IRQ },
98};
99 55
100static struct amba_device *amba_devs[] __initdata = { 56static struct amba_device *amba_devs[] __initdata = {
101 &rtc_device, 57 &rtc_device,
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 8cbb75a96bd..3e538da6cb1 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -401,24 +401,21 @@ static int impd1_probe(struct lm_device *dev)
401 401
402 pc_base = dev->resource.start + idev->offset; 402 pc_base = dev->resource.start + idev->offset;
403 403
404 d = kzalloc(sizeof(struct amba_device), GFP_KERNEL); 404 d = amba_device_alloc(NULL, pc_base, SZ_4K);
405 if (!d) 405 if (!d)
406 continue; 406 continue;
407 407
408 dev_set_name(&d->dev, "lm%x:%5.5lx", dev->id, idev->offset >> 12); 408 dev_set_name(&d->dev, "lm%x:%5.5lx", dev->id, idev->offset >> 12);
409 d->dev.parent = &dev->dev; 409 d->dev.parent = &dev->dev;
410 d->res.start = dev->resource.start + idev->offset;
411 d->res.end = d->res.start + SZ_4K - 1;
412 d->res.flags = IORESOURCE_MEM;
413 d->irq[0] = dev->irq; 410 d->irq[0] = dev->irq;
414 d->irq[1] = dev->irq; 411 d->irq[1] = dev->irq;
415 d->periphid = idev->id; 412 d->periphid = idev->id;
416 d->dev.platform_data = idev->platform_data; 413 d->dev.platform_data = idev->platform_data;
417 414
418 ret = amba_device_register(d, &dev->resource); 415 ret = amba_device_add(d, &dev->resource);
419 if (ret) { 416 if (ret) {
420 dev_err(&d->dev, "unable to register device: %d\n", ret); 417 dev_err(&d->dev, "unable to register device: %d\n", ret);
421 kfree(d); 418 amba_device_put(d);
422 } 419 }
423 } 420 }
424 421
diff --git a/arch/arm/mach-integrator/include/mach/entry-macro.S b/arch/arm/mach-integrator/include/mach/entry-macro.S
index 3d029c9f3ef..5cc7b85ad9d 100644
--- a/arch/arm/mach-integrator/include/mach/entry-macro.S
+++ b/arch/arm/mach-integrator/include/mach/entry-macro.S
@@ -11,15 +11,9 @@
11#include <mach/platform.h> 11#include <mach/platform.h>
12#include <mach/irqs.h> 12#include <mach/irqs.h>
13 13
14 .macro disable_fiq
15 .endm
16
17 .macro get_irqnr_preamble, base, tmp 14 .macro get_irqnr_preamble, base, tmp
18 .endm 15 .endm
19 16
20 .macro arch_ret_to_user, tmp1, tmp2
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24/* FIXME: should not be using soo many LDRs here */ 18/* FIXME: should not be using soo many LDRs here */
25 ldr \base, =IO_ADDRESS(INTEGRATOR_IC_BASE) 19 ldr \base, =IO_ADDRESS(INTEGRATOR_IC_BASE)
diff --git a/arch/arm/mach-integrator/include/mach/system.h b/arch/arm/mach-integrator/include/mach/system.h
deleted file mode 100644
index 901514eba4a..00000000000
--- a/arch/arm/mach-integrator/include/mach/system.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm/mach-integrator/include/mach/system.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24static inline void arch_idle(void)
25{
26 /*
27 * This should do all the clock switching
28 * and wait for interrupt tricks
29 */
30 cpu_do_idle();
31}
32
33#endif
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index a8b6aa6003f..be9ead4a3bc 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -347,32 +347,14 @@ static struct mmci_platform_data mmc_data = {
347 .gpio_cd = -1, 347 .gpio_cd = -1,
348}; 348};
349 349
350static struct amba_device mmc_device = { 350#define INTEGRATOR_CP_MMC_IRQS { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 }
351 .dev = { 351#define INTEGRATOR_CP_AACI_IRQS { IRQ_CP_AACIINT }
352 .init_name = "mb:1c",
353 .platform_data = &mmc_data,
354 },
355 .res = {
356 .start = INTEGRATOR_CP_MMC_BASE,
357 .end = INTEGRATOR_CP_MMC_BASE + SZ_4K - 1,
358 .flags = IORESOURCE_MEM,
359 },
360 .irq = { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 },
361 .periphid = 0,
362};
363 352
364static struct amba_device aaci_device = { 353static AMBA_APB_DEVICE(mmc, "mb:1c", 0, INTEGRATOR_CP_MMC_BASE,
365 .dev = { 354 INTEGRATOR_CP_MMC_IRQS, &mmc_data);
366 .init_name = "mb:1d", 355
367 }, 356static AMBA_APB_DEVICE(aaci, "mb:1d", 0, INTEGRATOR_CP_AACI_BASE,
368 .res = { 357 INTEGRATOR_CP_AACI_IRQS, NULL);
369 .start = INTEGRATOR_CP_AACI_BASE,
370 .end = INTEGRATOR_CP_AACI_BASE + SZ_4K - 1,
371 .flags = IORESOURCE_MEM,
372 },
373 .irq = { IRQ_CP_AACIINT, NO_IRQ },
374 .periphid = 0,
375};
376 358
377 359
378/* 360/*
@@ -425,21 +407,8 @@ static struct clcd_board clcd_data = {
425 .remove = versatile_clcd_remove_dma, 407 .remove = versatile_clcd_remove_dma,
426}; 408};
427 409
428static struct amba_device clcd_device = { 410static AMBA_AHB_DEVICE(clcd, "mb:c0", 0, INTCP_PA_CLCD_BASE,
429 .dev = { 411 { IRQ_CP_CLCDCINT }, &clcd_data);
430 .init_name = "mb:c0",
431 .coherent_dma_mask = ~0,
432 .platform_data = &clcd_data,
433 },
434 .res = {
435 .start = INTCP_PA_CLCD_BASE,
436 .end = INTCP_PA_CLCD_BASE + SZ_4K - 1,
437 .flags = IORESOURCE_MEM,
438 },
439 .dma_mask = ~0,
440 .irq = { IRQ_CP_CLCDCINT, NO_IRQ },
441 .periphid = 0,
442};
443 412
444static struct amba_device *amba_devs[] __initdata = { 413static struct amba_device *amba_devs[] __initdata = {
445 &mmc_device, 414 &mmc_device,
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index 3c82566acec..015be770c1d 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -378,9 +378,10 @@ static int __init pci_v3_setup_resources(struct pci_sys_data *sys)
378 * the mem resource for this bus 378 * the mem resource for this bus
379 * the prefetch mem resource for this bus 379 * the prefetch mem resource for this bus
380 */ 380 */
381 pci_add_resource(&sys->resources, &ioport_resource); 381 pci_add_resource_offset(&sys->resources,
382 pci_add_resource(&sys->resources, &non_mem); 382 &ioport_resource, sys->io_offset);
383 pci_add_resource(&sys->resources, &pre_mem); 383 pci_add_resource_offset(&sys->resources, &non_mem, sys->mem_offset);
384 pci_add_resource_offset(&sys->resources, &pre_mem, sys->mem_offset);
384 385
385 return 1; 386 return 1;
386} 387}
diff --git a/arch/arm/mach-iop13xx/include/mach/entry-macro.S b/arch/arm/mach-iop13xx/include/mach/entry-macro.S
index a624a7870c6..1a2d603488d 100644
--- a/arch/arm/mach-iop13xx/include/mach/entry-macro.S
+++ b/arch/arm/mach-iop13xx/include/mach/entry-macro.S
@@ -16,9 +16,6 @@
16 * Place - Suite 330, Boston, MA 02111-1307 USA. 16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 * 17 *
18 */ 18 */
19 .macro disable_fiq
20 .endm
21
22 .macro get_irqnr_preamble, base, tmp 19 .macro get_irqnr_preamble, base, tmp
23 mrc p15, 0, \tmp, c15, c1, 0 20 mrc p15, 0, \tmp, c15, c1, 0
24 orr \tmp, \tmp, #(1 << 6) 21 orr \tmp, \tmp, #(1 << 6)
diff --git a/arch/arm/mach-iop13xx/include/mach/system.h b/arch/arm/mach-iop13xx/include/mach/system.h
deleted file mode 100644
index 1f31ed3f8ae..00000000000
--- a/arch/arm/mach-iop13xx/include/mach/system.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-iop13xx/include/mach/system.h
3 *
4 * Copyright (C) 2004 Intel Corp.
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 */
10static inline void arch_idle(void)
11{
12 cpu_do_idle();
13}
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index b8f5a873651..861cb12ef43 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -1084,8 +1084,8 @@ int iop13xx_pci_setup(int nr, struct pci_sys_data *sys)
1084 request_resource(&ioport_resource, &res[0]); 1084 request_resource(&ioport_resource, &res[0]);
1085 request_resource(&iomem_resource, &res[1]); 1085 request_resource(&iomem_resource, &res[1]);
1086 1086
1087 pci_add_resource(&sys->resources, &res[0]); 1087 pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset);
1088 pci_add_resource(&sys->resources, &res[1]); 1088 pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset);
1089 1089
1090 return 1; 1090 return 1;
1091} 1091}
diff --git a/arch/arm/mach-iop32x/include/mach/entry-macro.S b/arch/arm/mach-iop32x/include/mach/entry-macro.S
index b02fb56bafc..ea13ae02d9b 100644
--- a/arch/arm/mach-iop32x/include/mach/entry-macro.S
+++ b/arch/arm/mach-iop32x/include/mach/entry-macro.S
@@ -9,9 +9,6 @@
9 */ 9 */
10#include <mach/iop32x.h> 10#include <mach/iop32x.h>
11 11
12 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_preamble, base, tmp 12 .macro get_irqnr_preamble, base, tmp
16 mrc p15, 0, \tmp, c15, c1, 0 13 mrc p15, 0, \tmp, c15, c1, 0
17 orr \tmp, \tmp, #(1 << 6) 14 orr \tmp, \tmp, #(1 << 6)
diff --git a/arch/arm/mach-iop32x/include/mach/system.h b/arch/arm/mach-iop32x/include/mach/system.h
deleted file mode 100644
index 4a88727bca9..00000000000
--- a/arch/arm/mach-iop32x/include/mach/system.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/system.h
3 *
4 * Copyright (C) 2001 MontaVista Software, 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 */
10static inline void arch_idle(void)
11{
12 cpu_do_idle();
13}
diff --git a/arch/arm/mach-iop33x/include/mach/entry-macro.S b/arch/arm/mach-iop33x/include/mach/entry-macro.S
index 4e1f7282b35..0a398fe1fba 100644
--- a/arch/arm/mach-iop33x/include/mach/entry-macro.S
+++ b/arch/arm/mach-iop33x/include/mach/entry-macro.S
@@ -9,9 +9,6 @@
9 */ 9 */
10#include <mach/iop33x.h> 10#include <mach/iop33x.h>
11 11
12 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_preamble, base, tmp 12 .macro get_irqnr_preamble, base, tmp
16 mrc p15, 0, \tmp, c15, c1, 0 13 mrc p15, 0, \tmp, c15, c1, 0
17 orr \tmp, \tmp, #(1 << 6) 14 orr \tmp, \tmp, #(1 << 6)
diff --git a/arch/arm/mach-iop33x/include/mach/system.h b/arch/arm/mach-iop33x/include/mach/system.h
deleted file mode 100644
index 4f98e765397..00000000000
--- a/arch/arm/mach-iop33x/include/mach/system.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/system.h
3 *
4 * Copyright (C) 2001 MontaVista Software, 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 */
10static inline void arch_idle(void)
11{
12 cpu_do_idle();
13}
diff --git a/arch/arm/mach-ixp2000/include/mach/entry-macro.S b/arch/arm/mach-ixp2000/include/mach/entry-macro.S
index 5850ffc8c75..c4444dff920 100644
--- a/arch/arm/mach-ixp2000/include/mach/entry-macro.S
+++ b/arch/arm/mach-ixp2000/include/mach/entry-macro.S
@@ -9,15 +9,9 @@
9 */ 9 */
10#include <mach/irqs.h> 10#include <mach/irqs.h>
11 11
12 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_preamble, base, tmp 12 .macro get_irqnr_preamble, base, tmp
16 .endm 13 .endm
17 14
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
22 16
23 mov \irqnr, #0x0 @clear out irqnr as default 17 mov \irqnr, #0x0 @clear out irqnr as default
diff --git a/arch/arm/mach-ixp2000/include/mach/system.h b/arch/arm/mach-ixp2000/include/mach/system.h
deleted file mode 100644
index a7fb08b2b8e..00000000000
--- a/arch/arm/mach-ixp2000/include/mach/system.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/system.h
3 *
4 * Copyright (C) 2002 Intel Corp.
5 * Copyricht (C) 2003-2005 MontaVista Software, 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 */
11static inline void arch_idle(void)
12{
13 cpu_do_idle();
14}
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
index f53e911ec94..d519944653a 100644
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ b/arch/arm/mach-ixp2000/ixdp2400.c
@@ -134,11 +134,11 @@ static void ixdp2400_pci_postinit(void)
134 134
135 if (ixdp2x00_master_npu()) { 135 if (ixdp2x00_master_npu()) {
136 dev = pci_get_bus_and_slot(1, IXDP2400_SLAVE_ENET_DEVFN); 136 dev = pci_get_bus_and_slot(1, IXDP2400_SLAVE_ENET_DEVFN);
137 pci_remove_bus_device(dev); 137 pci_stop_and_remove_bus_device(dev);
138 pci_dev_put(dev); 138 pci_dev_put(dev);
139 } else { 139 } else {
140 dev = pci_get_bus_and_slot(1, IXDP2400_MASTER_ENET_DEVFN); 140 dev = pci_get_bus_and_slot(1, IXDP2400_MASTER_ENET_DEVFN);
141 pci_remove_bus_device(dev); 141 pci_stop_and_remove_bus_device(dev);
142 pci_dev_put(dev); 142 pci_dev_put(dev);
143 143
144 ixdp2x00_slave_pci_postinit(); 144 ixdp2x00_slave_pci_postinit();
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c
index a2e7c393e74..b415febd202 100644
--- a/arch/arm/mach-ixp2000/ixdp2800.c
+++ b/arch/arm/mach-ixp2000/ixdp2800.c
@@ -262,14 +262,14 @@ int __init ixdp2800_pci_init(void)
262 pci_common_init(&ixdp2800_pci); 262 pci_common_init(&ixdp2800_pci);
263 if (ixdp2x00_master_npu()) { 263 if (ixdp2x00_master_npu()) {
264 dev = pci_get_bus_and_slot(1, IXDP2800_SLAVE_ENET_DEVFN); 264 dev = pci_get_bus_and_slot(1, IXDP2800_SLAVE_ENET_DEVFN);
265 pci_remove_bus_device(dev); 265 pci_stop_and_remove_bus_device(dev);
266 pci_dev_put(dev); 266 pci_dev_put(dev);
267 267
268 ixdp2800_master_enable_slave(); 268 ixdp2800_master_enable_slave();
269 ixdp2800_master_wait_for_slave_bus_scan(); 269 ixdp2800_master_wait_for_slave_bus_scan();
270 } else { 270 } else {
271 dev = pci_get_bus_and_slot(1, IXDP2800_MASTER_ENET_DEVFN); 271 dev = pci_get_bus_and_slot(1, IXDP2800_MASTER_ENET_DEVFN);
272 pci_remove_bus_device(dev); 272 pci_stop_and_remove_bus_device(dev);
273 pci_dev_put(dev); 273 pci_dev_put(dev);
274 } 274 }
275 } 275 }
diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c
index 634b6c852f6..dd983829906 100644
--- a/arch/arm/mach-ixp2000/ixdp2x00.c
+++ b/arch/arm/mach-ixp2000/ixdp2x00.c
@@ -239,12 +239,12 @@ void ixdp2x00_slave_pci_postinit(void)
239 * Remove PMC device is there is one 239 * Remove PMC device is there is one
240 */ 240 */
241 if((dev = pci_get_bus_and_slot(1, IXDP2X00_PMC_DEVFN))) { 241 if((dev = pci_get_bus_and_slot(1, IXDP2X00_PMC_DEVFN))) {
242 pci_remove_bus_device(dev); 242 pci_stop_and_remove_bus_device(dev);
243 pci_dev_put(dev); 243 pci_dev_put(dev);
244 } 244 }
245 245
246 dev = pci_get_bus_and_slot(0, IXDP2X00_21555_DEVFN); 246 dev = pci_get_bus_and_slot(0, IXDP2X00_21555_DEVFN);
247 pci_remove_bus_device(dev); 247 pci_stop_and_remove_bus_device(dev);
248 pci_dev_put(dev); 248 pci_dev_put(dev);
249} 249}
250 250
diff --git a/arch/arm/mach-ixp2000/pci.c b/arch/arm/mach-ixp2000/pci.c
index 626fda435aa..49c36f3cd60 100644
--- a/arch/arm/mach-ixp2000/pci.c
+++ b/arch/arm/mach-ixp2000/pci.c
@@ -243,8 +243,10 @@ int ixp2000_pci_setup(int nr, struct pci_sys_data *sys)
243 if (nr >= 1) 243 if (nr >= 1)
244 return 0; 244 return 0;
245 245
246 pci_add_resource(&sys->resources, &ixp2000_pci_io_space); 246 pci_add_resource_offset(&sys->resources,
247 pci_add_resource(&sys->resources, &ixp2000_pci_mem_space); 247 &ixp2000_pci_io_space, sys->io_offset);
248 pci_add_resource_offset(&sys->resources,
249 &ixp2000_pci_mem_space, sys->mem_offset);
248 250
249 return 1; 251 return 1;
250} 252}
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
index 0923bb905cc..7c1495e4fe7 100644
--- a/arch/arm/mach-ixp23xx/core.c
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -441,6 +441,9 @@ static struct platform_device *ixp23xx_devices[] __initdata = {
441 441
442void __init ixp23xx_sys_init(void) 442void __init ixp23xx_sys_init(void)
443{ 443{
444 /* by default, the idle code is disabled */
445 disable_hlt();
446
444 *IXP23XX_EXP_UNIT_FUSE |= 0xf; 447 *IXP23XX_EXP_UNIT_FUSE |= 0xf;
445 platform_add_devices(ixp23xx_devices, ARRAY_SIZE(ixp23xx_devices)); 448 platform_add_devices(ixp23xx_devices, ARRAY_SIZE(ixp23xx_devices));
446} 449}
diff --git a/arch/arm/mach-ixp23xx/include/mach/entry-macro.S b/arch/arm/mach-ixp23xx/include/mach/entry-macro.S
index 3f5338a7bbd..3fd2cb984e4 100644
--- a/arch/arm/mach-ixp23xx/include/mach/entry-macro.S
+++ b/arch/arm/mach-ixp23xx/include/mach/entry-macro.S
@@ -2,15 +2,9 @@
2 * arch/arm/mach-ixp23xx/include/mach/entry-macro.S 2 * arch/arm/mach-ixp23xx/include/mach/entry-macro.S
3 */ 3 */
4 4
5 .macro disable_fiq
6 .endm
7
8 .macro get_irqnr_preamble, base, tmp 5 .macro get_irqnr_preamble, base, tmp
9 .endm 6 .endm
10 7
11 .macro arch_ret_to_user, tmp1, tmp2
12 .endm
13
14 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 8 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
15 ldr \irqnr, =(IXP23XX_INTC_VIRT + IXP23XX_INTR_IRQ_ENC_ST_OFFSET) 9 ldr \irqnr, =(IXP23XX_INTC_VIRT + IXP23XX_INTR_IRQ_ENC_ST_OFFSET)
16 ldr \irqnr, [\irqnr] @ get interrupt number 10 ldr \irqnr, [\irqnr] @ get interrupt number
diff --git a/arch/arm/mach-ixp23xx/include/mach/system.h b/arch/arm/mach-ixp23xx/include/mach/system.h
deleted file mode 100644
index 277dda7334b..00000000000
--- a/arch/arm/mach-ixp23xx/include/mach/system.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/system.h
3 *
4 * Copyright (C) 2003 Intel 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 */
10static inline void arch_idle(void)
11{
12#if 0
13 if (!hlt_counter)
14 cpu_do_idle();
15#endif
16}
diff --git a/arch/arm/mach-ixp23xx/pci.c b/arch/arm/mach-ixp23xx/pci.c
index 25b5c462cea..3cbbd3208fa 100644
--- a/arch/arm/mach-ixp23xx/pci.c
+++ b/arch/arm/mach-ixp23xx/pci.c
@@ -281,8 +281,10 @@ int ixp23xx_pci_setup(int nr, struct pci_sys_data *sys)
281 if (nr >= 1) 281 if (nr >= 1)
282 return 0; 282 return 0;
283 283
284 pci_add_resource(&sys->resources, &ixp23xx_pci_io_space); 284 pci_add_resource_offset(&sys->resources,
285 pci_add_resource(&sys->resources, &ixp23xx_pci_mem_space); 285 &ixp23xx_pci_io_space, sys->io_offset);
286 pci_add_resource_offset(&sys->resources,
287 &ixp23xx_pci_mem_space, sys->mem_offset);
286 288
287 return 1; 289 return 1;
288} 290}
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 5eff15f24bc..8508882b13f 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -472,8 +472,8 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys)
472 request_resource(&ioport_resource, &res[0]); 472 request_resource(&ioport_resource, &res[0]);
473 request_resource(&iomem_resource, &res[1]); 473 request_resource(&iomem_resource, &res[1]);
474 474
475 pci_add_resource(&sys->resources, &res[0]); 475 pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset);
476 pci_add_resource(&sys->resources, &res[1]); 476 pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset);
477 477
478 platform_notify = ixp4xx_pci_platform_notify; 478 platform_notify = ixp4xx_pci_platform_notify;
479 platform_notify_remove = ixp4xx_pci_platform_notify_remove; 479 platform_notify_remove = ixp4xx_pci_platform_notify_remove;
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 3841ab4146b..a6329a0a8ec 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -236,6 +236,12 @@ void __init ixp4xx_init_irq(void)
236{ 236{
237 int i = 0; 237 int i = 0;
238 238
239 /*
240 * ixp4xx does not implement the XScale PWRMODE register
241 * so it must not call cpu_do_idle().
242 */
243 disable_hlt();
244
239 /* Route all sources to IRQ instead of FIQ */ 245 /* Route all sources to IRQ instead of FIQ */
240 *IXP4XX_ICLR = 0x0; 246 *IXP4XX_ICLR = 0x0;
241 247
diff --git a/arch/arm/mach-ixp4xx/include/mach/entry-macro.S b/arch/arm/mach-ixp4xx/include/mach/entry-macro.S
index f2e14e94ed1..79adf83e2c3 100644
--- a/arch/arm/mach-ixp4xx/include/mach/entry-macro.S
+++ b/arch/arm/mach-ixp4xx/include/mach/entry-macro.S
@@ -9,15 +9,9 @@
9 */ 9 */
10#include <mach/hardware.h> 10#include <mach/hardware.h>
11 11
12 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_preamble, base, tmp 12 .macro get_irqnr_preamble, base, tmp
16 .endm 13 .endm
17 14
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
22 ldr \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET) 16 ldr \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET)
23 ldr \irqstat, [\irqstat] @ get interrupts 17 ldr \irqstat, [\irqstat] @ get interrupts
diff --git a/arch/arm/mach-ixp4xx/include/mach/system.h b/arch/arm/mach-ixp4xx/include/mach/system.h
deleted file mode 100644
index 140a9bef446..00000000000
--- a/arch/arm/mach-ixp4xx/include/mach/system.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/system.h
3 *
4 * Copyright (C) 2002 Intel 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 */
11static inline void arch_idle(void)
12{
13 /* ixp4xx does not implement the XScale PWRMODE register,
14 * so it must not call cpu_do_idle() here.
15 */
16#if 0
17 cpu_do_idle();
18#endif
19}
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 7fc603b4689..90ceab76192 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -44,6 +44,20 @@ config MACH_GURUPLUG
44 Say 'Y' here if you want your kernel to support the 44 Say 'Y' here if you want your kernel to support the
45 Marvell GuruPlug Reference Board. 45 Marvell GuruPlug Reference Board.
46 46
47config ARCH_KIRKWOOD_DT
48 bool "Marvell Kirkwood Flattened Device Tree"
49 select USE_OF
50 help
51 Say 'Y' here if you want your kernel to support the
52 Marvell Kirkwood using flattened device tree.
53
54config MACH_DREAMPLUG_DT
55 bool "Marvell DreamPlug (Flattened Device Tree)"
56 select ARCH_KIRKWOOD_DT
57 help
58 Say 'Y' here if you want your kernel to support the
59 Marvell DreamPlug (Flattened Device Tree).
60
47config MACH_TS219 61config MACH_TS219
48 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" 62 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
49 help 63 help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 5dcaa81a2ec..acbc5e1db06 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -20,3 +20,4 @@ obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
20obj-$(CONFIG_MACH_T5325) += t5325-setup.o 20obj-$(CONFIG_MACH_T5325) += t5325-setup.o
21 21
22obj-$(CONFIG_CPU_IDLE) += cpuidle.o 22obj-$(CONFIG_CPU_IDLE) += cpuidle.o
23obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 760a0efe758..16f93852230 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -1,3 +1,5 @@
1 zreladdr-y += 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4
5dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
new file mode 100644
index 00000000000..fbe6405602e
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -0,0 +1,180 @@
1/*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3 *
4 * arch/arm/mach-kirkwood/board-dt.c
5 *
6 * Marvell DreamPlug Reference Board Setup
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/platform_device.h>
16#include <linux/mtd/partitions.h>
17#include <linux/ata_platform.h>
18#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>
25#include <linux/leds.h>
26#include <linux/mtd/physmap.h>
27#include <linux/spi/flash.h>
28#include <linux/spi/spi.h>
29#include <linux/spi/orion_spi.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <mach/kirkwood.h>
33#include <plat/mvsdio.h>
34#include "common.h"
35#include "mpp.h"
36
37static struct of_device_id kirkwood_dt_match_table[] __initdata = {
38 { .compatible = "simple-bus", },
39 { }
40};
41
42struct mtd_partition dreamplug_partitions[] = {
43 {
44 .name = "u-boot",
45 .size = SZ_512K,
46 .offset = 0,
47 },
48 {
49 .name = "u-boot env",
50 .size = SZ_64K,
51 .offset = SZ_512K + SZ_512K,
52 },
53 {
54 .name = "dtb",
55 .size = SZ_64K,
56 .offset = SZ_512K + SZ_512K + SZ_512K,
57 },
58};
59
60static const struct flash_platform_data dreamplug_spi_slave_data = {
61 .type = "mx25l1606e",
62 .name = "spi_flash",
63 .parts = dreamplug_partitions,
64 .nr_parts = ARRAY_SIZE(dreamplug_partitions),
65};
66
67static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
68 {
69 .modalias = "m25p80",
70 .platform_data = &dreamplug_spi_slave_data,
71 .irq = -1,
72 .max_speed_hz = 50000000,
73 .bus_num = 0,
74 .chip_select = 0,
75 },
76};
77
78static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
79 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
80};
81
82static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
83 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
84};
85
86static struct mv_sata_platform_data dreamplug_sata_data = {
87 .n_ports = 1,
88};
89
90static struct mvsdio_platform_data dreamplug_mvsdio_data = {
91 /* unfortunately the CD signal has not been connected */
92};
93
94static struct gpio_led dreamplug_led_pins[] = {
95 {
96 .name = "dreamplug:blue:bluetooth",
97 .gpio = 47,
98 .active_low = 1,
99 },
100 {
101 .name = "dreamplug:green:wifi",
102 .gpio = 48,
103 .active_low = 1,
104 },
105 {
106 .name = "dreamplug:green:wifi_ap",
107 .gpio = 49,
108 .active_low = 1,
109 },
110};
111
112static struct gpio_led_platform_data dreamplug_led_data = {
113 .leds = dreamplug_led_pins,
114 .num_leds = ARRAY_SIZE(dreamplug_led_pins),
115};
116
117static struct platform_device dreamplug_leds = {
118 .name = "leds-gpio",
119 .id = -1,
120 .dev = {
121 .platform_data = &dreamplug_led_data,
122 }
123};
124
125static unsigned int dreamplug_mpp_config[] __initdata = {
126 MPP0_SPI_SCn,
127 MPP1_SPI_MOSI,
128 MPP2_SPI_SCK,
129 MPP3_SPI_MISO,
130 MPP47_GPIO, /* Bluetooth LED */
131 MPP48_GPIO, /* Wifi LED */
132 MPP49_GPIO, /* Wifi AP LED */
133 0
134};
135
136static void __init dreamplug_init(void)
137{
138 /*
139 * Basic setup. Needs to be called early.
140 */
141 kirkwood_mpp_conf(dreamplug_mpp_config);
142
143 spi_register_board_info(dreamplug_spi_slave_info,
144 ARRAY_SIZE(dreamplug_spi_slave_info));
145 kirkwood_spi_init();
146
147 kirkwood_ehci_init();
148 kirkwood_ge00_init(&dreamplug_ge00_data);
149 kirkwood_ge01_init(&dreamplug_ge01_data);
150 kirkwood_sata_init(&dreamplug_sata_data);
151 kirkwood_sdio_init(&dreamplug_mvsdio_data);
152
153 platform_device_register(&dreamplug_leds);
154}
155
156static void __init kirkwood_dt_init(void)
157{
158 kirkwood_init();
159
160 if (of_machine_is_compatible("globalscale,dreamplug"))
161 dreamplug_init();
162
163 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
164}
165
166static const char *kirkwood_dt_board_compat[] = {
167 "globalscale,dreamplug",
168 NULL
169};
170
171DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
172 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
173 .map_io = kirkwood_map_io,
174 .init_early = kirkwood_init_early,
175 .init_irq = kirkwood_init_irq,
176 .timer = &kirkwood_timer,
177 .init_machine = kirkwood_dt_init,
178 .restart = kirkwood_restart,
179 .dt_compat = kirkwood_dt_board_compat,
180MACHINE_END
diff --git a/arch/arm/mach-kirkwood/include/mach/entry-macro.S b/arch/arm/mach-kirkwood/include/mach/entry-macro.S
index 8939d36f893..82db29f7af8 100644
--- a/arch/arm/mach-kirkwood/include/mach/entry-macro.S
+++ b/arch/arm/mach-kirkwood/include/mach/entry-macro.S
@@ -10,12 +10,6 @@
10 10
11#include <mach/bridge-regs.h> 11#include <mach/bridge-regs.h>
12 12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp 13 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =IRQ_VIRT_BASE 14 ldr \base, =IRQ_VIRT_BASE
21 .endm 15 .endm
diff --git a/arch/arm/mach-kirkwood/include/mach/system.h b/arch/arm/mach-kirkwood/include/mach/system.h
deleted file mode 100644
index 5fddde002b5..00000000000
--- a/arch/arm/mach-kirkwood/include/mach/system.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/system.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_SYSTEM_H
10#define __ASM_ARCH_SYSTEM_H
11
12static inline void arch_idle(void)
13{
14 cpu_do_idle();
15}
16
17#endif
diff --git a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c
index 01f8c899288..7e99c3f340f 100644
--- a/arch/arm/mach-kirkwood/openrd-setup.c
+++ b/arch/arm/mach-kirkwood/openrd-setup.c
@@ -83,6 +83,11 @@ static struct i2c_board_info i2c_board_info[] __initdata = {
83 }, 83 },
84}; 84};
85 85
86static struct platform_device openrd_client_audio_device = {
87 .name = "openrd-client-audio",
88 .id = -1,
89};
90
86static int __initdata uart1; 91static int __initdata uart1;
87 92
88static int __init sd_uart_selection(char *str) 93static int __init sd_uart_selection(char *str)
@@ -172,6 +177,7 @@ static void __init openrd_init(void)
172 kirkwood_i2c_init(); 177 kirkwood_i2c_init();
173 178
174 if (machine_is_openrd_client() || machine_is_openrd_ultimate()) { 179 if (machine_is_openrd_client() || machine_is_openrd_ultimate()) {
180 platform_device_register(&openrd_client_audio_device);
175 i2c_register_board_info(0, i2c_board_info, 181 i2c_register_board_info(0, i2c_board_info,
176 ARRAY_SIZE(i2c_board_info)); 182 ARRAY_SIZE(i2c_board_info));
177 kirkwood_audio_init(); 183 kirkwood_audio_init();
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index a066a6d8d9d..f56a0118c1b 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -198,9 +198,9 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
198 if (request_resource(&iomem_resource, &pp->res[1])) 198 if (request_resource(&iomem_resource, &pp->res[1]))
199 panic("Request PCIe%d Memory resource failed\n", index); 199 panic("Request PCIe%d Memory resource failed\n", index);
200 200
201 pci_add_resource(&sys->resources, &pp->res[0]);
202 pci_add_resource(&sys->resources, &pp->res[1]);
203 sys->io_offset = 0; 201 sys->io_offset = 0;
202 pci_add_resource_offset(&sys->resources, &pp->res[0], sys->io_offset);
203 pci_add_resource_offset(&sys->resources, &pp->res[1], sys->mem_offset);
204 204
205 /* 205 /*
206 * Generic PCIe unit setup. 206 * Generic PCIe unit setup.
diff --git a/arch/arm/mach-kirkwood/t5325-setup.c b/arch/arm/mach-kirkwood/t5325-setup.c
index 966b2b3bb81..f9d2a11b7f9 100644
--- a/arch/arm/mach-kirkwood/t5325-setup.c
+++ b/arch/arm/mach-kirkwood/t5325-setup.c
@@ -106,6 +106,11 @@ static struct platform_device hp_t5325_button_device = {
106 } 106 }
107}; 107};
108 108
109static struct platform_device hp_t5325_audio_device = {
110 .name = "t5325-audio",
111 .id = -1,
112};
113
109static unsigned int hp_t5325_mpp_config[] __initdata = { 114static unsigned int hp_t5325_mpp_config[] __initdata = {
110 MPP0_NF_IO2, 115 MPP0_NF_IO2,
111 MPP1_SPI_MOSI, 116 MPP1_SPI_MOSI,
@@ -179,6 +184,7 @@ static void __init hp_t5325_init(void)
179 kirkwood_sata_init(&hp_t5325_sata_data); 184 kirkwood_sata_init(&hp_t5325_sata_data);
180 kirkwood_ehci_init(); 185 kirkwood_ehci_init();
181 platform_device_register(&hp_t5325_button_device); 186 platform_device_register(&hp_t5325_button_device);
187 platform_device_register(&hp_t5325_audio_device);
182 188
183 i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info)); 189 i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info));
184 kirkwood_audio_init(); 190 kirkwood_audio_init();
diff --git a/arch/arm/mach-ks8695/include/mach/entry-macro.S b/arch/arm/mach-ks8695/include/mach/entry-macro.S
index b4fe0c11c6c..8315b34f32f 100644
--- a/arch/arm/mach-ks8695/include/mach/entry-macro.S
+++ b/arch/arm/mach-ks8695/include/mach/entry-macro.S
@@ -14,16 +14,10 @@
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <mach/regs-irq.h> 15#include <mach/regs-irq.h>
16 16
17 .macro disable_fiq
18 .endm
19
20 .macro get_irqnr_preamble, base, tmp 17 .macro get_irqnr_preamble, base, tmp
21 ldr \base, =KS8695_IRQ_VA @ Base address of interrupt controller 18 ldr \base, =KS8695_IRQ_VA @ Base address of interrupt controller
22 .endm 19 .endm
23 20
24 .macro arch_ret_to_user, tmp1, tmp2
25 .endm
26
27 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
28 ldr \irqstat, [\base, #KS8695_INTMS] @ Mask Status register 22 ldr \irqstat, [\base, #KS8695_INTMS] @ Mask Status register
29 23
diff --git a/arch/arm/mach-ks8695/include/mach/system.h b/arch/arm/mach-ks8695/include/mach/system.h
deleted file mode 100644
index 59fe992395b..00000000000
--- a/arch/arm/mach-ks8695/include/mach/system.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * arch/arm/mach-s3c2410/include/mach/system.h
3 *
4 * Copyright (C) 2006 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * KS8695 - System function defines and includes
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_SYSTEM_H
15#define __ASM_ARCH_SYSTEM_H
16
17static void arch_idle(void)
18{
19 /*
20 * This should do all the clock switching
21 * and wait for interrupt tricks,
22 */
23 cpu_do_idle();
24
25}
26
27#endif
diff --git a/arch/arm/mach-ks8695/pci.c b/arch/arm/mach-ks8695/pci.c
index b26f992071d..acc70143581 100644
--- a/arch/arm/mach-ks8695/pci.c
+++ b/arch/arm/mach-ks8695/pci.c
@@ -169,8 +169,8 @@ static int __init ks8695_pci_setup(int nr, struct pci_sys_data *sys)
169 request_resource(&iomem_resource, &pci_mem); 169 request_resource(&iomem_resource, &pci_mem);
170 request_resource(&ioport_resource, &pci_io); 170 request_resource(&ioport_resource, &pci_io);
171 171
172 pci_add_resource(&sys->resources, &pci_io); 172 pci_add_resource_offset(&sys->resources, &pci_io, sys->io_offset);
173 pci_add_resource(&sys->resources, &pci_mem); 173 pci_add_resource_offset(&sys->resources, &pci_mem, sys->mem_offset);
174 174
175 /* Assign and enable processor bridge */ 175 /* Assign and enable processor bridge */
176 ks8695_local_writeconfig(PCI_BASE_ADDRESS_0, KS8695_PCIMEM_PA); 176 ks8695_local_writeconfig(PCI_BASE_ADDRESS_0, KS8695_PCIMEM_PA);
diff --git a/arch/arm/mach-lpc32xx/clock.c b/arch/arm/mach-lpc32xx/clock.c
index 1e027514096..f55c772d181 100644
--- a/arch/arm/mach-lpc32xx/clock.c
+++ b/arch/arm/mach-lpc32xx/clock.c
@@ -82,6 +82,7 @@
82 * will also impact the individual peripheral rates. 82 * will also impact the individual peripheral rates.
83 */ 83 */
84 84
85#include <linux/export.h>
85#include <linux/kernel.h> 86#include <linux/kernel.h>
86#include <linux/list.h> 87#include <linux/list.h>
87#include <linux/errno.h> 88#include <linux/errno.h>
@@ -97,9 +98,10 @@
97#include "clock.h" 98#include "clock.h"
98#include "common.h" 99#include "common.h"
99 100
101static DEFINE_SPINLOCK(global_clkregs_lock);
102
100static struct clk clk_armpll; 103static struct clk clk_armpll;
101static struct clk clk_usbpll; 104static struct clk clk_usbpll;
102static DEFINE_MUTEX(clkm_lock);
103 105
104/* 106/*
105 * Post divider values for PLLs based on selected register value 107 * Post divider values for PLLs based on selected register value
@@ -127,7 +129,7 @@ static struct clk osc_32KHz = {
127static int local_pll397_enable(struct clk *clk, int enable) 129static int local_pll397_enable(struct clk *clk, int enable)
128{ 130{
129 u32 reg; 131 u32 reg;
130 unsigned long timeout = 1 + msecs_to_jiffies(10); 132 unsigned long timeout = jiffies + msecs_to_jiffies(10);
131 133
132 reg = __raw_readl(LPC32XX_CLKPWR_PLL397_CTRL); 134 reg = __raw_readl(LPC32XX_CLKPWR_PLL397_CTRL);
133 135
@@ -142,7 +144,7 @@ static int local_pll397_enable(struct clk *clk, int enable)
142 /* Wait for PLL397 lock */ 144 /* Wait for PLL397 lock */
143 while (((__raw_readl(LPC32XX_CLKPWR_PLL397_CTRL) & 145 while (((__raw_readl(LPC32XX_CLKPWR_PLL397_CTRL) &
144 LPC32XX_CLKPWR_SYSCTRL_PLL397_STS) == 0) && 146 LPC32XX_CLKPWR_SYSCTRL_PLL397_STS) == 0) &&
145 (timeout > jiffies)) 147 time_before(jiffies, timeout))
146 cpu_relax(); 148 cpu_relax();
147 149
148 if ((__raw_readl(LPC32XX_CLKPWR_PLL397_CTRL) & 150 if ((__raw_readl(LPC32XX_CLKPWR_PLL397_CTRL) &
@@ -156,7 +158,7 @@ static int local_pll397_enable(struct clk *clk, int enable)
156static int local_oscmain_enable(struct clk *clk, int enable) 158static int local_oscmain_enable(struct clk *clk, int enable)
157{ 159{
158 u32 reg; 160 u32 reg;
159 unsigned long timeout = 1 + msecs_to_jiffies(10); 161 unsigned long timeout = jiffies + msecs_to_jiffies(10);
160 162
161 reg = __raw_readl(LPC32XX_CLKPWR_MAIN_OSC_CTRL); 163 reg = __raw_readl(LPC32XX_CLKPWR_MAIN_OSC_CTRL);
162 164
@@ -171,7 +173,7 @@ static int local_oscmain_enable(struct clk *clk, int enable)
171 /* Wait for main oscillator to start */ 173 /* Wait for main oscillator to start */
172 while (((__raw_readl(LPC32XX_CLKPWR_MAIN_OSC_CTRL) & 174 while (((__raw_readl(LPC32XX_CLKPWR_MAIN_OSC_CTRL) &
173 LPC32XX_CLKPWR_MOSC_DISABLE) != 0) && 175 LPC32XX_CLKPWR_MOSC_DISABLE) != 0) &&
174 (timeout > jiffies)) 176 time_before(jiffies, timeout))
175 cpu_relax(); 177 cpu_relax();
176 178
177 if ((__raw_readl(LPC32XX_CLKPWR_MAIN_OSC_CTRL) & 179 if ((__raw_readl(LPC32XX_CLKPWR_MAIN_OSC_CTRL) &
@@ -383,7 +385,7 @@ static int local_usbpll_enable(struct clk *clk, int enable)
383{ 385{
384 u32 reg; 386 u32 reg;
385 int ret = -ENODEV; 387 int ret = -ENODEV;
386 unsigned long timeout = 1 + msecs_to_jiffies(10); 388 unsigned long timeout = jiffies + msecs_to_jiffies(10);
387 389
388 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL); 390 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
389 391
@@ -396,7 +398,7 @@ static int local_usbpll_enable(struct clk *clk, int enable)
396 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL); 398 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL);
397 399
398 /* Wait for PLL lock */ 400 /* Wait for PLL lock */
399 while ((timeout > jiffies) & (ret == -ENODEV)) { 401 while (time_before(jiffies, timeout) && (ret == -ENODEV)) {
400 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL); 402 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
401 if (reg & LPC32XX_CLKPWR_USBCTRL_PLL_STS) 403 if (reg & LPC32XX_CLKPWR_USBCTRL_PLL_STS)
402 ret = 0; 404 ret = 0;
@@ -719,6 +721,41 @@ static struct clk clk_tsc = {
719 .get_rate = local_return_parent_rate, 721 .get_rate = local_return_parent_rate,
720}; 722};
721 723
724static int adc_onoff_enable(struct clk *clk, int enable)
725{
726 u32 tmp;
727 u32 divider;
728
729 /* Use PERIPH_CLOCK */
730 tmp = __raw_readl(LPC32XX_CLKPWR_ADC_CLK_CTRL_1);
731 tmp |= LPC32XX_CLKPWR_ADCCTRL1_PCLK_SEL;
732 /*
733 * Set clock divider so that we have equal to or less than
734 * 4.5MHz clock at ADC
735 */
736 divider = clk->get_rate(clk) / 4500000 + 1;
737 tmp |= divider;
738 __raw_writel(tmp, LPC32XX_CLKPWR_ADC_CLK_CTRL_1);
739
740 /* synchronize rate of this clock w/ actual HW setting */
741 clk->rate = clk->get_rate(clk->parent) / divider;
742
743 if (enable == 0)
744 __raw_writel(0, clk->enable_reg);
745 else
746 __raw_writel(clk->enable_mask, clk->enable_reg);
747
748 return 0;
749}
750
751static struct clk clk_adc = {
752 .parent = &clk_pclk,
753 .enable = adc_onoff_enable,
754 .enable_reg = LPC32XX_CLKPWR_ADC_CLK_CTRL,
755 .enable_mask = LPC32XX_CLKPWR_ADC32CLKCTRL_CLK_EN,
756 .get_rate = local_return_parent_rate,
757};
758
722static int mmc_onoff_enable(struct clk *clk, int enable) 759static int mmc_onoff_enable(struct clk *clk, int enable)
723{ 760{
724 u32 tmp; 761 u32 tmp;
@@ -891,20 +928,8 @@ static struct clk clk_lcd = {
891 .enable_mask = LPC32XX_CLKPWR_LCDCTRL_CLK_EN, 928 .enable_mask = LPC32XX_CLKPWR_LCDCTRL_CLK_EN,
892}; 929};
893 930
894static inline void clk_lock(void)
895{
896 mutex_lock(&clkm_lock);
897}
898
899static inline void clk_unlock(void)
900{
901 mutex_unlock(&clkm_lock);
902}
903
904static void local_clk_disable(struct clk *clk) 931static void local_clk_disable(struct clk *clk)
905{ 932{
906 WARN_ON(clk->usecount == 0);
907
908 /* Don't attempt to disable clock if it has no users */ 933 /* Don't attempt to disable clock if it has no users */
909 if (clk->usecount > 0) { 934 if (clk->usecount > 0) {
910 clk->usecount--; 935 clk->usecount--;
@@ -947,10 +972,11 @@ static int local_clk_enable(struct clk *clk)
947int clk_enable(struct clk *clk) 972int clk_enable(struct clk *clk)
948{ 973{
949 int ret; 974 int ret;
975 unsigned long flags;
950 976
951 clk_lock(); 977 spin_lock_irqsave(&global_clkregs_lock, flags);
952 ret = local_clk_enable(clk); 978 ret = local_clk_enable(clk);
953 clk_unlock(); 979 spin_unlock_irqrestore(&global_clkregs_lock, flags);
954 980
955 return ret; 981 return ret;
956} 982}
@@ -961,9 +987,11 @@ EXPORT_SYMBOL(clk_enable);
961 */ 987 */
962void clk_disable(struct clk *clk) 988void clk_disable(struct clk *clk)
963{ 989{
964 clk_lock(); 990 unsigned long flags;
991
992 spin_lock_irqsave(&global_clkregs_lock, flags);
965 local_clk_disable(clk); 993 local_clk_disable(clk);
966 clk_unlock(); 994 spin_unlock_irqrestore(&global_clkregs_lock, flags);
967} 995}
968EXPORT_SYMBOL(clk_disable); 996EXPORT_SYMBOL(clk_disable);
969 997
@@ -972,13 +1000,7 @@ EXPORT_SYMBOL(clk_disable);
972 */ 1000 */
973unsigned long clk_get_rate(struct clk *clk) 1001unsigned long clk_get_rate(struct clk *clk)
974{ 1002{
975 unsigned long rate; 1003 return clk->get_rate(clk);
976
977 clk_lock();
978 rate = clk->get_rate(clk);
979 clk_unlock();
980
981 return rate;
982} 1004}
983EXPORT_SYMBOL(clk_get_rate); 1005EXPORT_SYMBOL(clk_get_rate);
984 1006
@@ -994,11 +1016,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
994 * the actual rate set as part of the peripheral dividers 1016 * the actual rate set as part of the peripheral dividers
995 * instead of high level clock control 1017 * instead of high level clock control
996 */ 1018 */
997 if (clk->set_rate) { 1019 if (clk->set_rate)
998 clk_lock();
999 ret = clk->set_rate(clk, rate); 1020 ret = clk->set_rate(clk, rate);
1000 clk_unlock();
1001 }
1002 1021
1003 return ret; 1022 return ret;
1004} 1023}
@@ -1009,15 +1028,11 @@ EXPORT_SYMBOL(clk_set_rate);
1009 */ 1028 */
1010long clk_round_rate(struct clk *clk, unsigned long rate) 1029long clk_round_rate(struct clk *clk, unsigned long rate)
1011{ 1030{
1012 clk_lock();
1013
1014 if (clk->round_rate) 1031 if (clk->round_rate)
1015 rate = clk->round_rate(clk, rate); 1032 rate = clk->round_rate(clk, rate);
1016 else 1033 else
1017 rate = clk->get_rate(clk); 1034 rate = clk->get_rate(clk);
1018 1035
1019 clk_unlock();
1020
1021 return rate; 1036 return rate;
1022} 1037}
1023EXPORT_SYMBOL(clk_round_rate); 1038EXPORT_SYMBOL(clk_round_rate);
@@ -1075,10 +1090,11 @@ static struct clk_lookup lookups[] = {
1075 _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1) 1090 _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1)
1076 _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan) 1091 _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan)
1077 _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand) 1092 _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand)
1078 _REGISTER_CLOCK("tbd", "i2s0_ck", clk_i2s0) 1093 _REGISTER_CLOCK("lpc32xx-adc", NULL, clk_adc)
1079 _REGISTER_CLOCK("tbd", "i2s1_ck", clk_i2s1) 1094 _REGISTER_CLOCK(NULL, "i2s0_ck", clk_i2s0)
1095 _REGISTER_CLOCK(NULL, "i2s1_ck", clk_i2s1)
1080 _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc) 1096 _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc)
1081 _REGISTER_CLOCK("dev:mmc0", "MCLK", clk_mmc) 1097 _REGISTER_CLOCK("dev:mmc0", NULL, clk_mmc)
1082 _REGISTER_CLOCK("lpc-net.0", NULL, clk_net) 1098 _REGISTER_CLOCK("lpc-net.0", NULL, clk_net)
1083 _REGISTER_CLOCK("dev:clcd", NULL, clk_lcd) 1099 _REGISTER_CLOCK("dev:clcd", NULL, clk_lcd)
1084 _REGISTER_CLOCK("lpc32xx_udc", "ck_usbd", clk_usbd) 1100 _REGISTER_CLOCK("lpc32xx_udc", "ck_usbd", clk_usbd)
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index 369b152896c..6c76bb36559 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -138,6 +138,28 @@ struct platform_device lpc32xx_rtc_device = {
138}; 138};
139 139
140/* 140/*
141 * ADC support
142 */
143static struct resource adc_resources[] = {
144 {
145 .start = LPC32XX_ADC_BASE,
146 .end = LPC32XX_ADC_BASE + SZ_4K - 1,
147 .flags = IORESOURCE_MEM,
148 }, {
149 .start = IRQ_LPC32XX_TS_IRQ,
150 .end = IRQ_LPC32XX_TS_IRQ,
151 .flags = IORESOURCE_IRQ,
152 },
153};
154
155struct platform_device lpc32xx_adc_device = {
156 .name = "lpc32xx-adc",
157 .id = -1,
158 .num_resources = ARRAY_SIZE(adc_resources),
159 .resource = adc_resources,
160};
161
162/*
141 * Returns the unique ID for the device 163 * Returns the unique ID for the device
142 */ 164 */
143void lpc32xx_get_uid(u32 devid[4]) 165void lpc32xx_get_uid(u32 devid[4])
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h
index 4b4e700343c..68f2e46d98a 100644
--- a/arch/arm/mach-lpc32xx/common.h
+++ b/arch/arm/mach-lpc32xx/common.h
@@ -29,6 +29,7 @@ extern struct platform_device lpc32xx_i2c0_device;
29extern struct platform_device lpc32xx_i2c1_device; 29extern struct platform_device lpc32xx_i2c1_device;
30extern struct platform_device lpc32xx_i2c2_device; 30extern struct platform_device lpc32xx_i2c2_device;
31extern struct platform_device lpc32xx_tsc_device; 31extern struct platform_device lpc32xx_tsc_device;
32extern struct platform_device lpc32xx_adc_device;
32extern struct platform_device lpc32xx_rtc_device; 33extern struct platform_device lpc32xx_rtc_device;
33 34
34/* 35/*
@@ -65,7 +66,6 @@ extern u32 clk_get_pclk_div(void);
65 */ 66 */
66extern void lpc32xx_get_uid(u32 devid[4]); 67extern void lpc32xx_get_uid(u32 devid[4]);
67 68
68extern void lpc32xx_watchdog_reset(void);
69extern u32 lpc32xx_return_iram_size(void); 69extern u32 lpc32xx_return_iram_size(void);
70 70
71/* 71/*
diff --git a/arch/arm/mach-lpc32xx/include/mach/entry-macro.S b/arch/arm/mach-lpc32xx/include/mach/entry-macro.S
index b725f6c9397..24ca11b377c 100644
--- a/arch/arm/mach-lpc32xx/include/mach/entry-macro.S
+++ b/arch/arm/mach-lpc32xx/include/mach/entry-macro.S
@@ -21,16 +21,10 @@
21 21
22#define LPC32XX_INTC_MASKED_STATUS_OFS 0x8 22#define LPC32XX_INTC_MASKED_STATUS_OFS 0x8
23 23
24 .macro disable_fiq
25 .endm
26
27 .macro get_irqnr_preamble, base, tmp 24 .macro get_irqnr_preamble, base, tmp
28 ldr \base, =IO_ADDRESS(LPC32XX_MIC_BASE) 25 ldr \base, =IO_ADDRESS(LPC32XX_MIC_BASE)
29 .endm 26 .endm
30 27
31 .macro arch_ret_to_user, tmp1, tmp2
32 .endm
33
34/* 28/*
35 * Return IRQ number in irqnr. Also return processor Z flag status in CPSR 29 * Return IRQ number in irqnr. Also return processor Z flag status in CPSR
36 * as set if an interrupt is pending. 30 * as set if an interrupt is pending.
diff --git a/arch/arm/mach-lpc32xx/include/mach/platform.h b/arch/arm/mach-lpc32xx/include/mach/platform.h
index 14ea8d1aadb..c584f5bb164 100644
--- a/arch/arm/mach-lpc32xx/include/mach/platform.h
+++ b/arch/arm/mach-lpc32xx/include/mach/platform.h
@@ -591,42 +591,42 @@
591/* 591/*
592 * Timer/counter register offsets 592 * Timer/counter register offsets
593 */ 593 */
594#define LCP32XX_TIMER_IR(x) io_p2v((x) + 0x00) 594#define LPC32XX_TIMER_IR(x) io_p2v((x) + 0x00)
595#define LCP32XX_TIMER_TCR(x) io_p2v((x) + 0x04) 595#define LPC32XX_TIMER_TCR(x) io_p2v((x) + 0x04)
596#define LCP32XX_TIMER_TC(x) io_p2v((x) + 0x08) 596#define LPC32XX_TIMER_TC(x) io_p2v((x) + 0x08)
597#define LCP32XX_TIMER_PR(x) io_p2v((x) + 0x0C) 597#define LPC32XX_TIMER_PR(x) io_p2v((x) + 0x0C)
598#define LCP32XX_TIMER_PC(x) io_p2v((x) + 0x10) 598#define LPC32XX_TIMER_PC(x) io_p2v((x) + 0x10)
599#define LCP32XX_TIMER_MCR(x) io_p2v((x) + 0x14) 599#define LPC32XX_TIMER_MCR(x) io_p2v((x) + 0x14)
600#define LCP32XX_TIMER_MR0(x) io_p2v((x) + 0x18) 600#define LPC32XX_TIMER_MR0(x) io_p2v((x) + 0x18)
601#define LCP32XX_TIMER_MR1(x) io_p2v((x) + 0x1C) 601#define LPC32XX_TIMER_MR1(x) io_p2v((x) + 0x1C)
602#define LCP32XX_TIMER_MR2(x) io_p2v((x) + 0x20) 602#define LPC32XX_TIMER_MR2(x) io_p2v((x) + 0x20)
603#define LCP32XX_TIMER_MR3(x) io_p2v((x) + 0x24) 603#define LPC32XX_TIMER_MR3(x) io_p2v((x) + 0x24)
604#define LCP32XX_TIMER_CCR(x) io_p2v((x) + 0x28) 604#define LPC32XX_TIMER_CCR(x) io_p2v((x) + 0x28)
605#define LCP32XX_TIMER_CR0(x) io_p2v((x) + 0x2C) 605#define LPC32XX_TIMER_CR0(x) io_p2v((x) + 0x2C)
606#define LCP32XX_TIMER_CR1(x) io_p2v((x) + 0x30) 606#define LPC32XX_TIMER_CR1(x) io_p2v((x) + 0x30)
607#define LCP32XX_TIMER_CR2(x) io_p2v((x) + 0x34) 607#define LPC32XX_TIMER_CR2(x) io_p2v((x) + 0x34)
608#define LCP32XX_TIMER_CR3(x) io_p2v((x) + 0x38) 608#define LPC32XX_TIMER_CR3(x) io_p2v((x) + 0x38)
609#define LCP32XX_TIMER_EMR(x) io_p2v((x) + 0x3C) 609#define LPC32XX_TIMER_EMR(x) io_p2v((x) + 0x3C)
610#define LCP32XX_TIMER_CTCR(x) io_p2v((x) + 0x70) 610#define LPC32XX_TIMER_CTCR(x) io_p2v((x) + 0x70)
611 611
612/* 612/*
613 * ir register definitions 613 * ir register definitions
614 */ 614 */
615#define LCP32XX_TIMER_CNTR_MTCH_BIT(n) (1 << ((n) & 0x3)) 615#define LPC32XX_TIMER_CNTR_MTCH_BIT(n) (1 << ((n) & 0x3))
616#define LCP32XX_TIMER_CNTR_CAPT_BIT(n) (1 << (4 + ((n) & 0x3))) 616#define LPC32XX_TIMER_CNTR_CAPT_BIT(n) (1 << (4 + ((n) & 0x3)))
617 617
618/* 618/*
619 * tcr register definitions 619 * tcr register definitions
620 */ 620 */
621#define LCP32XX_TIMER_CNTR_TCR_EN 0x1 621#define LPC32XX_TIMER_CNTR_TCR_EN 0x1
622#define LCP32XX_TIMER_CNTR_TCR_RESET 0x2 622#define LPC32XX_TIMER_CNTR_TCR_RESET 0x2
623 623
624/* 624/*
625 * mcr register definitions 625 * mcr register definitions
626 */ 626 */
627#define LCP32XX_TIMER_CNTR_MCR_MTCH(n) (0x1 << ((n) * 3)) 627#define LPC32XX_TIMER_CNTR_MCR_MTCH(n) (0x1 << ((n) * 3))
628#define LCP32XX_TIMER_CNTR_MCR_RESET(n) (0x1 << (((n) * 3) + 1)) 628#define LPC32XX_TIMER_CNTR_MCR_RESET(n) (0x1 << (((n) * 3) + 1))
629#define LCP32XX_TIMER_CNTR_MCR_STOP(n) (0x1 << (((n) * 3) + 2)) 629#define LPC32XX_TIMER_CNTR_MCR_STOP(n) (0x1 << (((n) * 3) + 2))
630 630
631/* 631/*
632 * Standard UART register offsets 632 * Standard UART register offsets
@@ -690,5 +690,8 @@
690#define LPC32XX_GPIO_P1_MUX_SET _GPREG(0x130) 690#define LPC32XX_GPIO_P1_MUX_SET _GPREG(0x130)
691#define LPC32XX_GPIO_P1_MUX_CLR _GPREG(0x134) 691#define LPC32XX_GPIO_P1_MUX_CLR _GPREG(0x134)
692#define LPC32XX_GPIO_P1_MUX_STATE _GPREG(0x138) 692#define LPC32XX_GPIO_P1_MUX_STATE _GPREG(0x138)
693#define LPC32XX_GPIO_P2_MUX_SET _GPREG(0x028)
694#define LPC32XX_GPIO_P2_MUX_CLR _GPREG(0x02C)
695#define LPC32XX_GPIO_P2_MUX_STATE _GPREG(0x030)
693 696
694#endif 697#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/system.h b/arch/arm/mach-lpc32xx/include/mach/system.h
deleted file mode 100644
index bf176c99152..00000000000
--- a/arch/arm/mach-lpc32xx/include/mach/system.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/system.h
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2010 NXP Semiconductors
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#ifndef __ASM_ARCH_SYSTEM_H
20#define __ASM_ARCH_SYSTEM_H
21
22static void arch_idle(void)
23{
24 cpu_do_idle();
25}
26
27#endif
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index bfee5b45510..0d79a3f8a5e 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -149,20 +149,8 @@ static struct clcd_board lpc32xx_clcd_data = {
149 .remove = lpc32xx_clcd_remove, 149 .remove = lpc32xx_clcd_remove,
150}; 150};
151 151
152static struct amba_device lpc32xx_clcd_device = { 152static AMBA_AHB_DEVICE(lpc32xx_clcd, "dev:clcd", 0,
153 .dev = { 153 LPC32XX_LCD_BASE, { IRQ_LPC32XX_LCD }, &lpc32xx_clcd_data);
154 .coherent_dma_mask = ~0,
155 .init_name = "dev:clcd",
156 .platform_data = &lpc32xx_clcd_data,
157 },
158 .res = {
159 .start = LPC32XX_LCD_BASE,
160 .end = (LPC32XX_LCD_BASE + SZ_4K - 1),
161 .flags = IORESOURCE_MEM,
162 },
163 .dma_mask = ~0,
164 .irq = {IRQ_LPC32XX_LCD, NO_IRQ},
165};
166 154
167/* 155/*
168 * AMBA SSP (SPI) 156 * AMBA SSP (SPI)
@@ -191,20 +179,8 @@ static struct pl022_ssp_controller lpc32xx_ssp0_data = {
191 .enable_dma = 0, 179 .enable_dma = 0,
192}; 180};
193 181
194static struct amba_device lpc32xx_ssp0_device = { 182static AMBA_APB_DEVICE(lpc32xx_ssp0, "dev:ssp0", 0,
195 .dev = { 183 LPC32XX_SSP0_BASE, { IRQ_LPC32XX_SSP0 }, &lpc32xx_ssp0_data);
196 .coherent_dma_mask = ~0,
197 .init_name = "dev:ssp0",
198 .platform_data = &lpc32xx_ssp0_data,
199 },
200 .res = {
201 .start = LPC32XX_SSP0_BASE,
202 .end = (LPC32XX_SSP0_BASE + SZ_4K - 1),
203 .flags = IORESOURCE_MEM,
204 },
205 .dma_mask = ~0,
206 .irq = {IRQ_LPC32XX_SSP0, NO_IRQ},
207};
208 184
209/* AT25 driver registration */ 185/* AT25 driver registration */
210static int __init phy3250_spi_board_register(void) 186static int __init phy3250_spi_board_register(void)
@@ -271,11 +247,14 @@ static struct platform_device lpc32xx_gpio_led_device = {
271}; 247};
272 248
273static struct platform_device *phy3250_devs[] __initdata = { 249static struct platform_device *phy3250_devs[] __initdata = {
250 &lpc32xx_rtc_device,
251 &lpc32xx_tsc_device,
274 &lpc32xx_i2c0_device, 252 &lpc32xx_i2c0_device,
275 &lpc32xx_i2c1_device, 253 &lpc32xx_i2c1_device,
276 &lpc32xx_i2c2_device, 254 &lpc32xx_i2c2_device,
277 &lpc32xx_watchdog_device, 255 &lpc32xx_watchdog_device,
278 &lpc32xx_gpio_led_device, 256 &lpc32xx_gpio_led_device,
257 &lpc32xx_adc_device,
279}; 258};
280 259
281static struct amba_device *amba_devs[] __initdata = { 260static struct amba_device *amba_devs[] __initdata = {
diff --git a/arch/arm/mach-lpc32xx/pm.c b/arch/arm/mach-lpc32xx/pm.c
index b9c80597b7b..207e81275ff 100644
--- a/arch/arm/mach-lpc32xx/pm.c
+++ b/arch/arm/mach-lpc32xx/pm.c
@@ -13,7 +13,7 @@
13/* 13/*
14 * LPC32XX CPU and system power management 14 * LPC32XX CPU and system power management
15 * 15 *
16 * The LCP32XX has three CPU modes for controlling system power: run, 16 * The LPC32XX has three CPU modes for controlling system power: run,
17 * direct-run, and halt modes. When switching between halt and run modes, 17 * direct-run, and halt modes. When switching between halt and run modes,
18 * the CPU transistions through direct-run mode. For Linux, direct-run 18 * the CPU transistions through direct-run mode. For Linux, direct-run
19 * mode is not used in normal operation. Halt mode is used when the 19 * mode is not used in normal operation. Halt mode is used when the
diff --git a/arch/arm/mach-lpc32xx/timer.c b/arch/arm/mach-lpc32xx/timer.c
index b42c909bbee..c40667c3316 100644
--- a/arch/arm/mach-lpc32xx/timer.c
+++ b/arch/arm/mach-lpc32xx/timer.c
@@ -34,11 +34,11 @@
34static int lpc32xx_clkevt_next_event(unsigned long delta, 34static int lpc32xx_clkevt_next_event(unsigned long delta,
35 struct clock_event_device *dev) 35 struct clock_event_device *dev)
36{ 36{
37 __raw_writel(LCP32XX_TIMER_CNTR_TCR_RESET, 37 __raw_writel(LPC32XX_TIMER_CNTR_TCR_RESET,
38 LCP32XX_TIMER_TCR(LPC32XX_TIMER0_BASE)); 38 LPC32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
39 __raw_writel(delta, LCP32XX_TIMER_PR(LPC32XX_TIMER0_BASE)); 39 __raw_writel(delta, LPC32XX_TIMER_PR(LPC32XX_TIMER0_BASE));
40 __raw_writel(LCP32XX_TIMER_CNTR_TCR_EN, 40 __raw_writel(LPC32XX_TIMER_CNTR_TCR_EN,
41 LCP32XX_TIMER_TCR(LPC32XX_TIMER0_BASE)); 41 LPC32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
42 42
43 return 0; 43 return 0;
44} 44}
@@ -58,7 +58,7 @@ static void lpc32xx_clkevt_mode(enum clock_event_mode mode,
58 * disable the timer to wait for the first call to 58 * disable the timer to wait for the first call to
59 * set_next_event(). 59 * set_next_event().
60 */ 60 */
61 __raw_writel(0, LCP32XX_TIMER_TCR(LPC32XX_TIMER0_BASE)); 61 __raw_writel(0, LPC32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
62 break; 62 break;
63 63
64 case CLOCK_EVT_MODE_UNUSED: 64 case CLOCK_EVT_MODE_UNUSED:
@@ -81,8 +81,8 @@ static irqreturn_t lpc32xx_timer_interrupt(int irq, void *dev_id)
81 struct clock_event_device *evt = &lpc32xx_clkevt; 81 struct clock_event_device *evt = &lpc32xx_clkevt;
82 82
83 /* Clear match */ 83 /* Clear match */
84 __raw_writel(LCP32XX_TIMER_CNTR_MTCH_BIT(0), 84 __raw_writel(LPC32XX_TIMER_CNTR_MTCH_BIT(0),
85 LCP32XX_TIMER_IR(LPC32XX_TIMER0_BASE)); 85 LPC32XX_TIMER_IR(LPC32XX_TIMER0_BASE));
86 86
87 evt->event_handler(evt); 87 evt->event_handler(evt);
88 88
@@ -128,14 +128,14 @@ static void __init lpc32xx_timer_init(void)
128 clkrate = clkrate / clk_get_pclk_div(); 128 clkrate = clkrate / clk_get_pclk_div();
129 129
130 /* Initial timer setup */ 130 /* Initial timer setup */
131 __raw_writel(0, LCP32XX_TIMER_TCR(LPC32XX_TIMER0_BASE)); 131 __raw_writel(0, LPC32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
132 __raw_writel(LCP32XX_TIMER_CNTR_MTCH_BIT(0), 132 __raw_writel(LPC32XX_TIMER_CNTR_MTCH_BIT(0),
133 LCP32XX_TIMER_IR(LPC32XX_TIMER0_BASE)); 133 LPC32XX_TIMER_IR(LPC32XX_TIMER0_BASE));
134 __raw_writel(1, LCP32XX_TIMER_MR0(LPC32XX_TIMER0_BASE)); 134 __raw_writel(1, LPC32XX_TIMER_MR0(LPC32XX_TIMER0_BASE));
135 __raw_writel(LCP32XX_TIMER_CNTR_MCR_MTCH(0) | 135 __raw_writel(LPC32XX_TIMER_CNTR_MCR_MTCH(0) |
136 LCP32XX_TIMER_CNTR_MCR_STOP(0) | 136 LPC32XX_TIMER_CNTR_MCR_STOP(0) |
137 LCP32XX_TIMER_CNTR_MCR_RESET(0), 137 LPC32XX_TIMER_CNTR_MCR_RESET(0),
138 LCP32XX_TIMER_MCR(LPC32XX_TIMER0_BASE)); 138 LPC32XX_TIMER_MCR(LPC32XX_TIMER0_BASE));
139 139
140 /* Setup tick interrupt */ 140 /* Setup tick interrupt */
141 setup_irq(IRQ_LPC32XX_TIMER0, &lpc32xx_timer_irq); 141 setup_irq(IRQ_LPC32XX_TIMER0, &lpc32xx_timer_irq);
@@ -151,14 +151,14 @@ static void __init lpc32xx_timer_init(void)
151 clockevents_register_device(&lpc32xx_clkevt); 151 clockevents_register_device(&lpc32xx_clkevt);
152 152
153 /* Use timer1 as clock source. */ 153 /* Use timer1 as clock source. */
154 __raw_writel(LCP32XX_TIMER_CNTR_TCR_RESET, 154 __raw_writel(LPC32XX_TIMER_CNTR_TCR_RESET,
155 LCP32XX_TIMER_TCR(LPC32XX_TIMER1_BASE)); 155 LPC32XX_TIMER_TCR(LPC32XX_TIMER1_BASE));
156 __raw_writel(0, LCP32XX_TIMER_PR(LPC32XX_TIMER1_BASE)); 156 __raw_writel(0, LPC32XX_TIMER_PR(LPC32XX_TIMER1_BASE));
157 __raw_writel(0, LCP32XX_TIMER_MCR(LPC32XX_TIMER1_BASE)); 157 __raw_writel(0, LPC32XX_TIMER_MCR(LPC32XX_TIMER1_BASE));
158 __raw_writel(LCP32XX_TIMER_CNTR_TCR_EN, 158 __raw_writel(LPC32XX_TIMER_CNTR_TCR_EN,
159 LCP32XX_TIMER_TCR(LPC32XX_TIMER1_BASE)); 159 LPC32XX_TIMER_TCR(LPC32XX_TIMER1_BASE));
160 160
161 clocksource_mmio_init(LCP32XX_TIMER_TC(LPC32XX_TIMER1_BASE), 161 clocksource_mmio_init(LPC32XX_TIMER_TC(LPC32XX_TIMER1_BASE),
162 "lpc32xx_clksrc", clkrate, 300, 32, clocksource_mmio_readl_up); 162 "lpc32xx_clksrc", clkrate, 300, 32, clocksource_mmio_readl_up);
163} 163}
164 164
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index 323d4c9e9f4..5a90b9a3ab6 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -2,6 +2,16 @@ if ARCH_MMP
2 2
3menu "Marvell PXA168/910/MMP2 Implmentations" 3menu "Marvell PXA168/910/MMP2 Implmentations"
4 4
5config MACH_MMP_DT
6 bool "Support MMP2 platforms from device tree"
7 select CPU_PXA168
8 select CPU_PXA910
9 select USE_OF
10 help
11 Include support for Marvell MMP2 based platforms using
12 the device tree. Needn't select any other machine while
13 MACH_MMP_DT is enabled.
14
5config MACH_ASPENITE 15config MACH_ASPENITE
6 bool "Marvell's PXA168 Aspenite Development Board" 16 bool "Marvell's PXA168 Aspenite Development Board"
7 select CPU_PXA168 17 select CPU_PXA168
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
index ba254a71691..4fc0ff5dc96 100644
--- a/arch/arm/mach-mmp/Makefile
+++ b/arch/arm/mach-mmp/Makefile
@@ -18,5 +18,6 @@ obj-$(CONFIG_MACH_TTC_DKB) += ttc_dkb.o
18obj-$(CONFIG_MACH_BROWNSTONE) += brownstone.o 18obj-$(CONFIG_MACH_BROWNSTONE) += brownstone.o
19obj-$(CONFIG_MACH_FLINT) += flint.o 19obj-$(CONFIG_MACH_FLINT) += flint.o
20obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o 20obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o
21obj-$(CONFIG_MACH_MMP_DT) += mmp-dt.o
21obj-$(CONFIG_MACH_TETON_BGA) += teton_bga.o 22obj-$(CONFIG_MACH_TETON_BGA) += teton_bga.o
22obj-$(CONFIG_MACH_GPLUGD) += gplugd.o 23obj-$(CONFIG_MACH_GPLUGD) += gplugd.o
diff --git a/arch/arm/mach-mmp/include/mach/entry-macro.S b/arch/arm/mach-mmp/include/mach/entry-macro.S
index c42d9d4e892..9cff9e7a2b2 100644
--- a/arch/arm/mach-mmp/include/mach/entry-macro.S
+++ b/arch/arm/mach-mmp/include/mach/entry-macro.S
@@ -8,12 +8,6 @@
8 8
9#include <mach/regs-icu.h> 9#include <mach/regs-icu.h>
10 10
11 .macro disable_fiq
12 .endm
13
14 .macro arch_ret_to_user, tmp1, tmp2
15 .endm
16
17 .macro get_irqnr_preamble, base, tmp 11 .macro get_irqnr_preamble, base, tmp
18 mrc p15, 0, \tmp, c0, c0, 0 @ CPUID 12 mrc p15, 0, \tmp, c0, c0, 0 @ CPUID
19 and \tmp, \tmp, #0xff00 13 and \tmp, \tmp, #0xff00
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h
index 4de13abef7b..e2e1f1e5e12 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -22,6 +22,7 @@ extern struct pxa_device_desc pxa910_device_pwm4;
22extern struct pxa_device_desc pxa910_device_nand; 22extern struct pxa_device_desc pxa910_device_nand;
23 23
24extern struct platform_device pxa910_device_gpio; 24extern struct platform_device pxa910_device_gpio;
25extern struct platform_device pxa910_device_rtc;
25 26
26static inline int pxa910_add_uart(int id) 27static inline int pxa910_add_uart(int id)
27{ 28{
diff --git a/arch/arm/mach-mmp/include/mach/regs-apbc.h b/arch/arm/mach-mmp/include/mach/regs-apbc.h
index 1a96585336b..8a37fb00365 100644
--- a/arch/arm/mach-mmp/include/mach/regs-apbc.h
+++ b/arch/arm/mach-mmp/include/mach/regs-apbc.h
@@ -57,6 +57,7 @@
57#define APBC_PXA910_SSP1 APBC_REG(0x01c) 57#define APBC_PXA910_SSP1 APBC_REG(0x01c)
58#define APBC_PXA910_SSP2 APBC_REG(0x020) 58#define APBC_PXA910_SSP2 APBC_REG(0x020)
59#define APBC_PXA910_IPC APBC_REG(0x024) 59#define APBC_PXA910_IPC APBC_REG(0x024)
60#define APBC_PXA910_RTC APBC_REG(0x028)
60#define APBC_PXA910_TWSI0 APBC_REG(0x02c) 61#define APBC_PXA910_TWSI0 APBC_REG(0x02c)
61#define APBC_PXA910_KPC APBC_REG(0x030) 62#define APBC_PXA910_KPC APBC_REG(0x030)
62#define APBC_PXA910_TIMERS APBC_REG(0x034) 63#define APBC_PXA910_TIMERS APBC_REG(0x034)
diff --git a/arch/arm/mach-mmp/include/mach/regs-rtc.h b/arch/arm/mach-mmp/include/mach/regs-rtc.h
new file mode 100644
index 00000000000..5bff886a394
--- /dev/null
+++ b/arch/arm/mach-mmp/include/mach/regs-rtc.h
@@ -0,0 +1,23 @@
1#ifndef __ASM_MACH_REGS_RTC_H
2#define __ASM_MACH_REGS_RTC_H
3
4#include <mach/addr-map.h>
5
6#define RTC_VIRT_BASE (APB_VIRT_BASE + 0x10000)
7#define RTC_REG(x) (*((volatile u32 __iomem *)(RTC_VIRT_BASE + (x))))
8
9/*
10 * Real Time Clock
11 */
12
13#define RCNR RTC_REG(0x00) /* RTC Count Register */
14#define RTAR RTC_REG(0x04) /* RTC Alarm Register */
15#define RTSR RTC_REG(0x08) /* RTC Status Register */
16#define RTTR RTC_REG(0x0C) /* RTC Timer Trim Register */
17
18#define RTSR_HZE (1 << 3) /* HZ interrupt enable */
19#define RTSR_ALE (1 << 2) /* RTC alarm interrupt enable */
20#define RTSR_HZ (1 << 1) /* HZ rising-edge detected */
21#define RTSR_AL (1 << 0) /* RTC alarm detected */
22
23#endif /* __ASM_MACH_REGS_RTC_H */
diff --git a/arch/arm/mach-mmp/include/mach/system.h b/arch/arm/mach-mmp/include/mach/system.h
deleted file mode 100644
index 1d001eab81e..00000000000
--- a/arch/arm/mach-mmp/include/mach/system.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * linux/arch/arm/mach-mmp/include/mach/system.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_MACH_SYSTEM_H
10#define __ASM_MACH_SYSTEM_H
11
12static inline void arch_idle(void)
13{
14 cpu_do_idle();
15}
16#endif /* __ASM_MACH_SYSTEM_H */
diff --git a/arch/arm/mach-mmp/mmp-dt.c b/arch/arm/mach-mmp/mmp-dt.c
new file mode 100644
index 00000000000..67075395e40
--- /dev/null
+++ b/arch/arm/mach-mmp/mmp-dt.c
@@ -0,0 +1,75 @@
1/*
2 * linux/arch/arm/mach-mmp/mmp-dt.c
3 *
4 * Copyright (C) 2012 Marvell Technology Group Ltd.
5 * Author: Haojian Zhuang <haojian.zhuang@marvell.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 * publishhed by the Free Software Foundation.
10 */
11
12#include <linux/irq.h>
13#include <linux/irqdomain.h>
14#include <linux/of_irq.h>
15#include <linux/of_platform.h>
16#include <asm/mach/arch.h>
17#include <mach/irqs.h>
18
19#include "common.h"
20
21extern struct sys_timer pxa168_timer;
22extern void __init icu_init_irq(void);
23
24static const struct of_dev_auxdata mmp_auxdata_lookup[] __initconst = {
25 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4017000, "pxa2xx-uart.0", NULL),
26 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4018000, "pxa2xx-uart.1", NULL),
27 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL),
28 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
29 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
30 OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL),
31 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
32 {}
33};
34
35static int __init mmp_intc_add_irq_domain(struct device_node *np,
36 struct device_node *parent)
37{
38 irq_domain_add_simple(np, 0);
39 return 0;
40}
41
42static int __init mmp_gpio_add_irq_domain(struct device_node *np,
43 struct device_node *parent)
44{
45 irq_domain_add_simple(np, IRQ_GPIO_START);
46 return 0;
47}
48
49static const struct of_device_id mmp_irq_match[] __initconst = {
50 { .compatible = "mrvl,mmp-intc", .data = mmp_intc_add_irq_domain, },
51 { .compatible = "mrvl,mmp-gpio", .data = mmp_gpio_add_irq_domain, },
52 {}
53};
54
55static void __init mmp_dt_init(void)
56{
57
58 of_irq_init(mmp_irq_match);
59
60 of_platform_populate(NULL, of_default_bus_match_table,
61 mmp_auxdata_lookup, NULL);
62}
63
64static const char *pxa168_dt_board_compat[] __initdata = {
65 "mrvl,pxa168-aspenite",
66 NULL,
67};
68
69DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)")
70 .map_io = mmp_map_io,
71 .init_irq = icu_init_irq,
72 .timer = &pxa168_timer,
73 .init_machine = mmp_dt_init,
74 .dt_compat = pxa168_dt_board_compat,
75MACHINE_END
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index 617c60a170a..c709a24a9d2 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -223,6 +223,7 @@ struct resource mmp2_resource_gpio[] = {
223 }, { 223 }, {
224 .start = IRQ_MMP2_GPIO, 224 .start = IRQ_MMP2_GPIO,
225 .end = IRQ_MMP2_GPIO, 225 .end = IRQ_MMP2_GPIO,
226 .name = "gpio_mux",
226 .flags = IORESOURCE_IRQ, 227 .flags = IORESOURCE_IRQ,
227 }, 228 },
228}; 229};
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index ada1213982b..f7d59c03fc6 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -64,6 +64,7 @@ static APBC_CLK(ssp4, PXA168_SSP4, 4, 0);
64static APBC_CLK(ssp5, PXA168_SSP5, 4, 0); 64static APBC_CLK(ssp5, PXA168_SSP5, 4, 0);
65static APBC_CLK(gpio, PXA168_GPIO, 0, 13000000); 65static APBC_CLK(gpio, PXA168_GPIO, 0, 13000000);
66static APBC_CLK(keypad, PXA168_KPC, 0, 32000); 66static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
67static APBC_CLK(rtc, PXA168_RTC, 8, 32768);
67 68
68static APMU_CLK(nand, NAND, 0x19b, 156000000); 69static APMU_CLK(nand, NAND, 0x19b, 156000000);
69static APMU_CLK(lcd, LCD, 0x7f, 312000000); 70static APMU_CLK(lcd, LCD, 0x7f, 312000000);
@@ -92,6 +93,7 @@ static struct clk_lookup pxa168_clkregs[] = {
92 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL), 93 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
93 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"), 94 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
94 INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"), 95 INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"),
96 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
95}; 97};
96 98
97static int __init pxa168_init(void) 99static int __init pxa168_init(void)
@@ -166,6 +168,7 @@ struct resource pxa168_resource_gpio[] = {
166 }, { 168 }, {
167 .start = IRQ_PXA168_GPIOX, 169 .start = IRQ_PXA168_GPIOX,
168 .end = IRQ_PXA168_GPIOX, 170 .end = IRQ_PXA168_GPIOX,
171 .name = "gpio_mux",
169 .flags = IORESOURCE_IRQ, 172 .flags = IORESOURCE_IRQ,
170 }, 173 },
171}; 174};
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 3241a25784d..43f8bcc29b6 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -92,6 +92,7 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
92static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000); 92static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
93static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000); 93static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
94static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000); 94static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000);
95static APBC_CLK(rtc, PXA910_RTC, 8, 32768);
95 96
96static APMU_CLK(nand, NAND, 0x19b, 156000000); 97static APMU_CLK(nand, NAND, 0x19b, 156000000);
97static APMU_CLK(u2o, USB, 0x1b, 480000000); 98static APMU_CLK(u2o, USB, 0x1b, 480000000);
@@ -109,6 +110,7 @@ static struct clk_lookup pxa910_clkregs[] = {
109 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 110 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
110 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), 111 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL),
111 INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"), 112 INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"),
113 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
112}; 114};
113 115
114static int __init pxa910_init(void) 116static int __init pxa910_init(void)
@@ -173,6 +175,7 @@ struct resource pxa910_resource_gpio[] = {
173 }, { 175 }, {
174 .start = IRQ_PXA910_AP_GPIO, 176 .start = IRQ_PXA910_AP_GPIO,
175 .end = IRQ_PXA910_AP_GPIO, 177 .end = IRQ_PXA910_AP_GPIO,
178 .name = "gpio_mux",
176 .flags = IORESOURCE_IRQ, 179 .flags = IORESOURCE_IRQ,
177 }, 180 },
178}; 181};
@@ -183,3 +186,28 @@ struct platform_device pxa910_device_gpio = {
183 .num_resources = ARRAY_SIZE(pxa910_resource_gpio), 186 .num_resources = ARRAY_SIZE(pxa910_resource_gpio),
184 .resource = pxa910_resource_gpio, 187 .resource = pxa910_resource_gpio,
185}; 188};
189
190static struct resource pxa910_resource_rtc[] = {
191 {
192 .start = 0xd4010000,
193 .end = 0xd401003f,
194 .flags = IORESOURCE_MEM,
195 }, {
196 .start = IRQ_PXA910_RTC_INT,
197 .end = IRQ_PXA910_RTC_INT,
198 .name = "rtc 1Hz",
199 .flags = IORESOURCE_IRQ,
200 }, {
201 .start = IRQ_PXA910_RTC_ALARM,
202 .end = IRQ_PXA910_RTC_ALARM,
203 .name = "rtc alarm",
204 .flags = IORESOURCE_IRQ,
205 },
206};
207
208struct platform_device pxa910_device_rtc = {
209 .name = "sa1100-rtc",
210 .id = -1,
211 .num_resources = ARRAY_SIZE(pxa910_resource_rtc),
212 .resource = pxa910_resource_rtc,
213};
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 5ac5d5832e4..e72c709da44 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -124,6 +124,7 @@ static struct platform_device ttc_dkb_device_onenand = {
124 124
125static struct platform_device *ttc_dkb_devices[] = { 125static struct platform_device *ttc_dkb_devices[] = {
126 &pxa910_device_gpio, 126 &pxa910_device_gpio,
127 &pxa910_device_rtc,
127 &ttc_dkb_device_onenand, 128 &ttc_dkb_device_onenand,
128}; 129};
129 130
diff --git a/arch/arm/mach-msm/idle.S b/arch/arm/mach-msm/idle.S
deleted file mode 100644
index 6a94f052713..00000000000
--- a/arch/arm/mach-msm/idle.S
+++ /dev/null
@@ -1,36 +0,0 @@
1/* arch/arm/mach-msm/include/mach/idle.S
2 *
3 * Idle processing for MSM7K - work around bugs with SWFI.
4 *
5 * Copyright (c) 2007 QUALCOMM Incorporated.
6 * Copyright (C) 2007 Google, Inc.
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#include <linux/linkage.h>
20#include <asm/assembler.h>
21
22ENTRY(arch_idle)
23#ifdef CONFIG_MSM7X00A_IDLE
24 mrc p15, 0, r1, c1, c0, 0 /* read current CR */
25 bic r0, r1, #(1 << 2) /* clear dcache bit */
26 bic r0, r0, #(1 << 12) /* clear icache bit */
27 mcr p15, 0, r0, c1, c0, 0 /* disable d/i cache */
28
29 mov r0, #0 /* prepare wfi value */
30 mcr p15, 0, r0, c7, c10, 0 /* flush the cache */
31 mcr p15, 0, r0, c7, c10, 4 /* memory barrier */
32 mcr p15, 0, r0, c7, c0, 4 /* wait for interrupt */
33
34 mcr p15, 0, r1, c1, c0, 0 /* restore d/i cache */
35#endif
36 mov pc, lr
diff --git a/arch/arm/mach-msm/idle.c b/arch/arm/mach-msm/idle.c
new file mode 100644
index 00000000000..0c9e13c6574
--- /dev/null
+++ b/arch/arm/mach-msm/idle.c
@@ -0,0 +1,49 @@
1/* arch/arm/mach-msm/idle.c
2 *
3 * Idle processing for MSM7K - work around bugs with SWFI.
4 *
5 * Copyright (c) 2007 QUALCOMM Incorporated.
6 * Copyright (C) 2007 Google, Inc.
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#include <linux/init.h>
20#include <asm/system.h>
21
22static void msm_idle(void)
23{
24#ifdef CONFIG_MSM7X00A_IDLE
25 asm volatile (
26
27 "mrc p15, 0, r1, c1, c0, 0 /* read current CR */ \n\t"
28 "bic r0, r1, #(1 << 2) /* clear dcache bit */ \n\t"
29 "bic r0, r0, #(1 << 12) /* clear icache bit */ \n\t"
30 "mcr p15, 0, r0, c1, c0, 0 /* disable d/i cache */ \n\t"
31
32 "mov r0, #0 /* prepare wfi value */ \n\t"
33 "mcr p15, 0, r0, c7, c10, 0 /* flush the cache */ \n\t"
34 "mcr p15, 0, r0, c7, c10, 4 /* memory barrier */ \n\t"
35 "mcr p15, 0, r0, c7, c0, 4 /* wait for interrupt */ \n\t"
36
37 "mcr p15, 0, r1, c1, c0, 0 /* restore d/i cache */ \n\t"
38
39 : : : "r0","r1" );
40#endif
41}
42
43static int __init msm_idle_init(void)
44{
45 arm_pm_idle = msm_idle;
46 return 0;
47}
48
49arch_initcall(msm_idle_init);
diff --git a/arch/arm/mach-msm/include/mach/entry-macro.S b/arch/arm/mach-msm/include/mach/entry-macro.S
index 41f7003ef34..f2ae9087f65 100644
--- a/arch/arm/mach-msm/include/mach/entry-macro.S
+++ b/arch/arm/mach-msm/include/mach/entry-macro.S
@@ -16,12 +16,6 @@
16 * 16 *
17 */ 17 */
18 18
19 .macro disable_fiq
20 .endm
21
22 .macro arch_ret_to_user, tmp1, tmp2
23 .endm
24
25#if !defined(CONFIG_ARM_GIC) 19#if !defined(CONFIG_ARM_GIC)
26#include <mach/msm_iomap.h> 20#include <mach/msm_iomap.h>
27 21
diff --git a/arch/arm/mach-msm/include/mach/system.h b/arch/arm/mach-msm/include/mach/system.h
index 311db2b35da..f5fb2ec87ff 100644
--- a/arch/arm/mach-msm/include/mach/system.h
+++ b/arch/arm/mach-msm/include/mach/system.h
@@ -12,7 +12,6 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 */ 14 */
15void arch_idle(void);
16 15
17/* low level hardware reset hook -- for example, hitting the 16/* low level hardware reset hook -- for example, hitting the
18 * PSHOLD line on the PMIC to hard reset the system 17 * PSHOLD line on the PMIC to hard reset the system
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 11d0d8f2656..75f4be40b3e 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -127,6 +127,45 @@ static struct clocksource msm_clocksource = {
127 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 127 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
128}; 128};
129 129
130#ifdef CONFIG_LOCAL_TIMERS
131static int __cpuinit msm_local_timer_setup(struct clock_event_device *evt)
132{
133 /* Use existing clock_event for cpu 0 */
134 if (!smp_processor_id())
135 return 0;
136
137 writel_relaxed(0, event_base + TIMER_ENABLE);
138 writel_relaxed(0, event_base + TIMER_CLEAR);
139 writel_relaxed(~0, event_base + TIMER_MATCH_VAL);
140 evt->irq = msm_clockevent.irq;
141 evt->name = "local_timer";
142 evt->features = msm_clockevent.features;
143 evt->rating = msm_clockevent.rating;
144 evt->set_mode = msm_timer_set_mode;
145 evt->set_next_event = msm_timer_set_next_event;
146 evt->shift = msm_clockevent.shift;
147 evt->mult = div_sc(GPT_HZ, NSEC_PER_SEC, evt->shift);
148 evt->max_delta_ns = clockevent_delta2ns(0xf0000000, evt);
149 evt->min_delta_ns = clockevent_delta2ns(4, evt);
150
151 *__this_cpu_ptr(msm_evt.percpu_evt) = evt;
152 clockevents_register_device(evt);
153 enable_percpu_irq(evt->irq, 0);
154 return 0;
155}
156
157static void msm_local_timer_stop(struct clock_event_device *evt)
158{
159 evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
160 disable_percpu_irq(evt->irq);
161}
162
163static struct local_timer_ops msm_local_timer_ops __cpuinitdata = {
164 .setup = msm_local_timer_setup,
165 .stop = msm_local_timer_stop,
166};
167#endif /* CONFIG_LOCAL_TIMERS */
168
130static void __init msm_timer_init(void) 169static void __init msm_timer_init(void)
131{ 170{
132 struct clock_event_device *ce = &msm_clockevent; 171 struct clock_event_device *ce = &msm_clockevent;
@@ -173,8 +212,12 @@ static void __init msm_timer_init(void)
173 *__this_cpu_ptr(msm_evt.percpu_evt) = ce; 212 *__this_cpu_ptr(msm_evt.percpu_evt) = ce;
174 res = request_percpu_irq(ce->irq, msm_timer_interrupt, 213 res = request_percpu_irq(ce->irq, msm_timer_interrupt,
175 ce->name, msm_evt.percpu_evt); 214 ce->name, msm_evt.percpu_evt);
176 if (!res) 215 if (!res) {
177 enable_percpu_irq(ce->irq, 0); 216 enable_percpu_irq(ce->irq, 0);
217#ifdef CONFIG_LOCAL_TIMERS
218 local_timer_register(&msm_local_timer_ops);
219#endif
220 }
178 } else { 221 } else {
179 msm_evt.evt = ce; 222 msm_evt.evt = ce;
180 res = request_irq(ce->irq, msm_timer_interrupt, 223 res = request_irq(ce->irq, msm_timer_interrupt,
@@ -191,40 +234,6 @@ err:
191 pr_err("clocksource_register failed\n"); 234 pr_err("clocksource_register failed\n");
192} 235}
193 236
194#ifdef CONFIG_LOCAL_TIMERS
195int __cpuinit local_timer_setup(struct clock_event_device *evt)
196{
197 /* Use existing clock_event for cpu 0 */
198 if (!smp_processor_id())
199 return 0;
200
201 writel_relaxed(0, event_base + TIMER_ENABLE);
202 writel_relaxed(0, event_base + TIMER_CLEAR);
203 writel_relaxed(~0, event_base + TIMER_MATCH_VAL);
204 evt->irq = msm_clockevent.irq;
205 evt->name = "local_timer";
206 evt->features = msm_clockevent.features;
207 evt->rating = msm_clockevent.rating;
208 evt->set_mode = msm_timer_set_mode;
209 evt->set_next_event = msm_timer_set_next_event;
210 evt->shift = msm_clockevent.shift;
211 evt->mult = div_sc(GPT_HZ, NSEC_PER_SEC, evt->shift);
212 evt->max_delta_ns = clockevent_delta2ns(0xf0000000, evt);
213 evt->min_delta_ns = clockevent_delta2ns(4, evt);
214
215 *__this_cpu_ptr(msm_evt.percpu_evt) = evt;
216 clockevents_register_device(evt);
217 enable_percpu_irq(evt->irq, 0);
218 return 0;
219}
220
221void local_timer_stop(struct clock_event_device *evt)
222{
223 evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
224 disable_percpu_irq(evt->irq);
225}
226#endif /* CONFIG_LOCAL_TIMERS */
227
228struct sys_timer msm_timer = { 237struct sys_timer msm_timer = {
229 .init = msm_timer_init 238 .init = msm_timer_init
230}; 239};
diff --git a/arch/arm/mach-mv78xx0/include/mach/entry-macro.S b/arch/arm/mach-mv78xx0/include/mach/entry-macro.S
index 66ae2d29e77..6b1f088e059 100644
--- a/arch/arm/mach-mv78xx0/include/mach/entry-macro.S
+++ b/arch/arm/mach-mv78xx0/include/mach/entry-macro.S
@@ -10,12 +10,6 @@
10 10
11#include <mach/bridge-regs.h> 11#include <mach/bridge-regs.h>
12 12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp 13 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =IRQ_VIRT_BASE 14 ldr \base, =IRQ_VIRT_BASE
21 .endm 15 .endm
diff --git a/arch/arm/mach-mv78xx0/include/mach/system.h b/arch/arm/mach-mv78xx0/include/mach/system.h
deleted file mode 100644
index 8c3a5387cec..00000000000
--- a/arch/arm/mach-mv78xx0/include/mach/system.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/system.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_SYSTEM_H
10#define __ASM_ARCH_SYSTEM_H
11
12static inline void arch_idle(void)
13{
14 cpu_do_idle();
15}
16
17#endif
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
index 8459f6d7d8c..df3e38055a2 100644
--- a/arch/arm/mach-mv78xx0/pcie.c
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -155,8 +155,8 @@ static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
155 orion_pcie_set_local_bus_nr(pp->base, sys->busnr); 155 orion_pcie_set_local_bus_nr(pp->base, sys->busnr);
156 orion_pcie_setup(pp->base); 156 orion_pcie_setup(pp->base);
157 157
158 pci_add_resource(&sys->resources, &pp->res[0]); 158 pci_add_resource_offset(&sys->resources, &pp->res[0], sys->io_offset);
159 pci_add_resource(&sys->resources, &pp->res[1]); 159 pci_add_resource_offset(&sys->resources, &pp->res[1], sys->mem_offset);
160 160
161 return 1; 161 return 1;
162} 162}
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index cf00b3e3be8..c57f9964a71 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -83,6 +83,18 @@ config MODULE_M28
83 select MXS_HAVE_PLATFORM_MXSFB 83 select MXS_HAVE_PLATFORM_MXSFB
84 select MXS_OCOTP 84 select MXS_OCOTP
85 85
86config MODULE_APX4
87 bool
88 select SOC_IMX28
89 select LEDS_GPIO_REGISTER
90 select MXS_HAVE_AMBA_DUART
91 select MXS_HAVE_PLATFORM_AUART
92 select MXS_HAVE_PLATFORM_FEC
93 select MXS_HAVE_PLATFORM_MXS_I2C
94 select MXS_HAVE_PLATFORM_MXS_MMC
95 select MXS_HAVE_PLATFORM_MXS_SAIF
96 select MXS_OCOTP
97
86config MACH_TX28 98config MACH_TX28
87 bool "Ka-Ro TX28 module" 99 bool "Ka-Ro TX28 module"
88 select MODULE_TX28 100 select MODULE_TX28
@@ -91,4 +103,8 @@ config MACH_M28EVK
91 bool "Support DENX M28EVK Platform" 103 bool "Support DENX M28EVK Platform"
92 select MODULE_M28 104 select MODULE_M28
93 105
106config MACH_APX4DEVKIT
107 bool "Support Bluegiga APX4 Development Kit"
108 select MODULE_APX4
109
94endif 110endif
diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile
index 8c93b24896b..908bf9a567f 100644
--- a/arch/arm/mach-mxs/Makefile
+++ b/arch/arm/mach-mxs/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_MACH_STMP378X_DEVB) += mach-stmp378x_devb.o
11obj-$(CONFIG_MACH_MX23EVK) += mach-mx23evk.o 11obj-$(CONFIG_MACH_MX23EVK) += mach-mx23evk.o
12obj-$(CONFIG_MACH_MX28EVK) += mach-mx28evk.o 12obj-$(CONFIG_MACH_MX28EVK) += mach-mx28evk.o
13obj-$(CONFIG_MACH_M28EVK) += mach-m28evk.o 13obj-$(CONFIG_MACH_M28EVK) += mach-m28evk.o
14obj-$(CONFIG_MACH_APX4DEVKIT) += mach-apx4devkit.o
14obj-$(CONFIG_MODULE_TX28) += module-tx28.o 15obj-$(CONFIG_MODULE_TX28) += module-tx28.o
15obj-$(CONFIG_MACH_TX28) += mach-tx28.o 16obj-$(CONFIG_MACH_TX28) += mach-tx28.o
16 17
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
index e12e11231dc..e3ac52c3401 100644
--- a/arch/arm/mach-mxs/clock-mx23.c
+++ b/arch/arm/mach-mxs/clock-mx23.c
@@ -223,7 +223,6 @@ static int cpu_clk_set_rate(struct clk *clk, unsigned long rate)
223{ 223{
224 u32 reg, bm_busy, div_max, d, f, div, frac; 224 u32 reg, bm_busy, div_max, d, f, div, frac;
225 unsigned long diff, parent_rate, calc_rate; 225 unsigned long diff, parent_rate, calc_rate;
226 int i;
227 226
228 parent_rate = clk_get_rate(clk->parent); 227 parent_rate = clk_get_rate(clk->parent);
229 228
@@ -275,14 +274,7 @@ static int cpu_clk_set_rate(struct clk *clk, unsigned long rate)
275 reg |= div << BP_CLKCTRL_CPU_DIV_CPU; 274 reg |= div << BP_CLKCTRL_CPU_DIV_CPU;
276 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_CPU); 275 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_CPU);
277 276
278 for (i = 10000; i; i--) 277 mxs_clkctrl_timeout(HW_CLKCTRL_CPU, bm_busy);
279 if (!(__raw_readl(CLKCTRL_BASE_ADDR +
280 HW_CLKCTRL_CPU) & bm_busy))
281 break;
282 if (!i) {
283 pr_err("%s: divider writing timeout\n", __func__);
284 return -ETIMEDOUT;
285 }
286 278
287 return 0; 279 return 0;
288} 280}
@@ -292,7 +284,6 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \
292{ \ 284{ \
293 u32 reg, div_max, div; \ 285 u32 reg, div_max, div; \
294 unsigned long parent_rate; \ 286 unsigned long parent_rate; \
295 int i; \
296 \ 287 \
297 parent_rate = clk_get_rate(clk->parent); \ 288 parent_rate = clk_get_rate(clk->parent); \
298 div_max = BM_CLKCTRL_##dr##_DIV >> BP_CLKCTRL_##dr##_DIV; \ 289 div_max = BM_CLKCTRL_##dr##_DIV >> BP_CLKCTRL_##dr##_DIV; \
@@ -310,15 +301,7 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \
310 } \ 301 } \
311 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ 302 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \
312 \ 303 \
313 for (i = 10000; i; i--) \ 304 mxs_clkctrl_timeout(HW_CLKCTRL_##dr, BM_CLKCTRL_##dr##_BUSY); \
314 if (!(__raw_readl(CLKCTRL_BASE_ADDR + \
315 HW_CLKCTRL_##dr) & BM_CLKCTRL_##dr##_BUSY)) \
316 break; \
317 if (!i) { \
318 pr_err("%s: divider writing timeout\n", __func__); \
319 return -ETIMEDOUT; \
320 } \
321 \
322 return 0; \ 305 return 0; \
323} 306}
324 307
@@ -456,12 +439,13 @@ static struct clk_lookup lookups[] = {
456 _REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk) 439 _REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk)
457 _REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk) 440 _REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk)
458 _REGISTER_CLOCK("imx23-fb", NULL, lcdif_clk) 441 _REGISTER_CLOCK("imx23-fb", NULL, lcdif_clk)
442 _REGISTER_CLOCK("imx23-gpmi-nand", NULL, gpmi_clk)
459}; 443};
460 444
461static int clk_misc_init(void) 445static int clk_misc_init(void)
462{ 446{
463 u32 reg; 447 u32 reg;
464 int i; 448 int ret;
465 449
466 /* Fix up parent per register setting */ 450 /* Fix up parent per register setting */
467 reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_CLKSEQ); 451 reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_CLKSEQ);
@@ -510,14 +494,7 @@ static int clk_misc_init(void)
510 reg |= 3 << BP_CLKCTRL_HBUS_DIV; 494 reg |= 3 << BP_CLKCTRL_HBUS_DIV;
511 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_HBUS); 495 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_HBUS);
512 496
513 for (i = 10000; i; i--) 497 ret = mxs_clkctrl_timeout(HW_CLKCTRL_HBUS, BM_CLKCTRL_HBUS_BUSY);
514 if (!(__raw_readl(CLKCTRL_BASE_ADDR +
515 HW_CLKCTRL_HBUS) & BM_CLKCTRL_HBUS_BUSY))
516 break;
517 if (!i) {
518 pr_err("%s: divider writing timeout\n", __func__);
519 return -ETIMEDOUT;
520 }
521 498
522 /* Gate off cpu clock in WFI for power saving */ 499 /* Gate off cpu clock in WFI for power saving */
523 __raw_writel(BM_CLKCTRL_CPU_INTERRUPT_WAIT, 500 __raw_writel(BM_CLKCTRL_CPU_INTERRUPT_WAIT,
@@ -532,7 +509,7 @@ static int clk_misc_init(void)
532 reg |= 30 << BP_CLKCTRL_FRAC_IOFRAC; 509 reg |= 30 << BP_CLKCTRL_FRAC_IOFRAC;
533 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_FRAC); 510 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_FRAC);
534 511
535 return 0; 512 return ret;
536} 513}
537 514
538int __init mx23_clocks_init(void) 515int __init mx23_clocks_init(void)
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 5d68e415222..cea29c99e21 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -322,7 +322,6 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \
322{ \ 322{ \
323 u32 reg, bm_busy, div_max, d, f, div, frac; \ 323 u32 reg, bm_busy, div_max, d, f, div, frac; \
324 unsigned long diff, parent_rate, calc_rate; \ 324 unsigned long diff, parent_rate, calc_rate; \
325 int i; \
326 \ 325 \
327 div_max = BM_CLKCTRL_##dr##_DIV >> BP_CLKCTRL_##dr##_DIV; \ 326 div_max = BM_CLKCTRL_##dr##_DIV >> BP_CLKCTRL_##dr##_DIV; \
328 bm_busy = BM_CLKCTRL_##dr##_BUSY; \ 327 bm_busy = BM_CLKCTRL_##dr##_BUSY; \
@@ -396,16 +395,7 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \
396 } \ 395 } \
397 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ 396 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \
398 \ 397 \
399 for (i = 10000; i; i--) \ 398 return mxs_clkctrl_timeout(HW_CLKCTRL_##dr, bm_busy); \
400 if (!(__raw_readl(CLKCTRL_BASE_ADDR + \
401 HW_CLKCTRL_##dr) & bm_busy)) \
402 break; \
403 if (!i) { \
404 pr_err("%s: divider writing timeout\n", __func__); \
405 return -ETIMEDOUT; \
406 } \
407 \
408 return 0; \
409} 399}
410 400
411_CLK_SET_RATE(cpu_clk, CPU, FRAC0, CPU) 401_CLK_SET_RATE(cpu_clk, CPU, FRAC0, CPU)
@@ -421,7 +411,6 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \
421{ \ 411{ \
422 u32 reg, div_max, div; \ 412 u32 reg, div_max, div; \
423 unsigned long parent_rate; \ 413 unsigned long parent_rate; \
424 int i; \
425 \ 414 \
426 parent_rate = clk_get_rate(clk->parent); \ 415 parent_rate = clk_get_rate(clk->parent); \
427 div_max = BM_CLKCTRL_##dr##_DIV >> BP_CLKCTRL_##dr##_DIV; \ 416 div_max = BM_CLKCTRL_##dr##_DIV >> BP_CLKCTRL_##dr##_DIV; \
@@ -439,16 +428,7 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \
439 } \ 428 } \
440 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ 429 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \
441 \ 430 \
442 for (i = 10000; i; i--) \ 431 return mxs_clkctrl_timeout(HW_CLKCTRL_##dr, BM_CLKCTRL_##dr##_BUSY);\
443 if (!(__raw_readl(CLKCTRL_BASE_ADDR + \
444 HW_CLKCTRL_##dr) & BM_CLKCTRL_##dr##_BUSY)) \
445 break; \
446 if (!i) { \
447 pr_err("%s: divider writing timeout\n", __func__); \
448 return -ETIMEDOUT; \
449 } \
450 \
451 return 0; \
452} 432}
453 433
454_CLK_SET_RATE1(xbus_clk, XBUS) 434_CLK_SET_RATE1(xbus_clk, XBUS)
@@ -461,7 +441,6 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \
461 u32 reg; \ 441 u32 reg; \
462 u64 lrate; \ 442 u64 lrate; \
463 unsigned long parent_rate; \ 443 unsigned long parent_rate; \
464 int i; \
465 \ 444 \
466 parent_rate = clk_get_rate(clk->parent); \ 445 parent_rate = clk_get_rate(clk->parent); \
467 if (rate > parent_rate) \ 446 if (rate > parent_rate) \
@@ -477,18 +456,13 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \
477 reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_##rs); \ 456 reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_##rs); \
478 reg &= ~BM_CLKCTRL_##rs##_DIV; \ 457 reg &= ~BM_CLKCTRL_##rs##_DIV; \
479 reg |= div << BP_CLKCTRL_##rs##_DIV; \ 458 reg |= div << BP_CLKCTRL_##rs##_DIV; \
480 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##rs); \ 459 if (reg & (1 << clk->enable_shift)) { \
481 \ 460 pr_err("%s: clock is gated\n", __func__); \
482 for (i = 10000; i; i--) \ 461 return -EINVAL; \
483 if (!(__raw_readl(CLKCTRL_BASE_ADDR + \
484 HW_CLKCTRL_##rs) & BM_CLKCTRL_##rs##_BUSY)) \
485 break; \
486 if (!i) { \
487 pr_err("%s: divider writing timeout\n", __func__); \
488 return -ETIMEDOUT; \
489 } \ 462 } \
463 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##rs); \
490 \ 464 \
491 return 0; \ 465 return mxs_clkctrl_timeout(HW_CLKCTRL_##rs, BM_CLKCTRL_##rs##_BUSY);\
492} 466}
493 467
494_CLK_SET_RATE_SAIF(saif0_clk, SAIF0) 468_CLK_SET_RATE_SAIF(saif0_clk, SAIF0)
@@ -643,6 +617,7 @@ static struct clk_lookup lookups[] = {
643 _REGISTER_CLOCK("duart", NULL, uart_clk) 617 _REGISTER_CLOCK("duart", NULL, uart_clk)
644 _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk) 618 _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
645 _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk) 619 _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
620 _REGISTER_CLOCK("imx28-gpmi-nand", NULL, gpmi_clk)
646 _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk) 621 _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
647 _REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk) 622 _REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk)
648 _REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk) 623 _REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk)
@@ -654,6 +629,8 @@ static struct clk_lookup lookups[] = {
654 _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk) 629 _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
655 _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk) 630 _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk)
656 _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk) 631 _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk)
632 _REGISTER_CLOCK("mxs-mmc.2", NULL, ssp2_clk)
633 _REGISTER_CLOCK("mxs-mmc.3", NULL, ssp3_clk)
657 _REGISTER_CLOCK("flexcan.0", NULL, can0_clk) 634 _REGISTER_CLOCK("flexcan.0", NULL, can0_clk)
658 _REGISTER_CLOCK("flexcan.1", NULL, can1_clk) 635 _REGISTER_CLOCK("flexcan.1", NULL, can1_clk)
659 _REGISTER_CLOCK(NULL, "usb0", usb0_clk) 636 _REGISTER_CLOCK(NULL, "usb0", usb0_clk)
@@ -676,7 +653,7 @@ static struct clk_lookup lookups[] = {
676static int clk_misc_init(void) 653static int clk_misc_init(void)
677{ 654{
678 u32 reg; 655 u32 reg;
679 int i; 656 int ret;
680 657
681 /* Fix up parent per register setting */ 658 /* Fix up parent per register setting */
682 reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_CLKSEQ); 659 reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_CLKSEQ);
@@ -756,14 +733,7 @@ static int clk_misc_init(void)
756 reg |= 3 << BP_CLKCTRL_HBUS_DIV; 733 reg |= 3 << BP_CLKCTRL_HBUS_DIV;
757 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_HBUS); 734 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_HBUS);
758 735
759 for (i = 10000; i; i--) 736 ret = mxs_clkctrl_timeout(HW_CLKCTRL_HBUS, BM_CLKCTRL_HBUS_ASM_BUSY);
760 if (!(__raw_readl(CLKCTRL_BASE_ADDR +
761 HW_CLKCTRL_HBUS) & BM_CLKCTRL_HBUS_ASM_BUSY))
762 break;
763 if (!i) {
764 pr_err("%s: divider writing timeout\n", __func__);
765 return -ETIMEDOUT;
766 }
767 737
768 /* Gate off cpu clock in WFI for power saving */ 738 /* Gate off cpu clock in WFI for power saving */
769 __raw_writel(BM_CLKCTRL_CPU_INTERRUPT_WAIT, 739 __raw_writel(BM_CLKCTRL_CPU_INTERRUPT_WAIT,
@@ -790,7 +760,7 @@ static int clk_misc_init(void)
790 reg |= 30 << BP_CLKCTRL_FRAC0_IO0FRAC; 760 reg |= 30 << BP_CLKCTRL_FRAC0_IO0FRAC;
791 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_FRAC0); 761 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_FRAC0);
792 762
793 return 0; 763 return ret;
794} 764}
795 765
796int __init mx28_clocks_init(void) 766int __init mx28_clocks_init(void)
@@ -803,6 +773,8 @@ int __init mx28_clocks_init(void)
803 */ 773 */
804 clk_set_parent(&ssp0_clk, &ref_io0_clk); 774 clk_set_parent(&ssp0_clk, &ref_io0_clk);
805 clk_set_parent(&ssp1_clk, &ref_io0_clk); 775 clk_set_parent(&ssp1_clk, &ref_io0_clk);
776 clk_set_parent(&ssp2_clk, &ref_io1_clk);
777 clk_set_parent(&ssp3_clk, &ref_io1_clk);
806 778
807 clk_prepare_enable(&cpu_clk); 779 clk_prepare_enable(&cpu_clk);
808 clk_prepare_enable(&hbus_clk); 780 clk_prepare_enable(&hbus_clk);
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index 3fa651d2c99..4d1329d5928 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -21,6 +21,10 @@ extern const struct mxs_auart_data mx23_auart_data[] __initconst;
21#define mx23_add_auart0() mx23_add_auart(0) 21#define mx23_add_auart0() mx23_add_auart(0)
22#define mx23_add_auart1() mx23_add_auart(1) 22#define mx23_add_auart1() mx23_add_auart(1)
23 23
24extern const struct mxs_gpmi_nand_data mx23_gpmi_nand_data __initconst;
25#define mx23_add_gpmi_nand(pdata) \
26 mxs_add_gpmi_nand(pdata, &mx23_gpmi_nand_data)
27
24extern const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst; 28extern const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst;
25#define mx23_add_mxs_mmc(id, pdata) \ 29#define mx23_add_mxs_mmc(id, pdata) \
26 mxs_add_mxs_mmc(&mx23_mxs_mmc_data[id], pdata) 30 mxs_add_mxs_mmc(&mx23_mxs_mmc_data[id], pdata)
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 4f50094e293..9dbeae13084 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -34,6 +34,10 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst;
34#define mx28_add_flexcan0(pdata) mx28_add_flexcan(0, pdata) 34#define mx28_add_flexcan0(pdata) mx28_add_flexcan(0, pdata)
35#define mx28_add_flexcan1(pdata) mx28_add_flexcan(1, pdata) 35#define mx28_add_flexcan1(pdata) mx28_add_flexcan(1, pdata)
36 36
37extern const struct mxs_gpmi_nand_data mx28_gpmi_nand_data __initconst;
38#define mx28_add_gpmi_nand(pdata) \
39 mxs_add_gpmi_nand(pdata, &mx28_gpmi_nand_data)
40
37extern const struct mxs_mxs_i2c_data mx28_mxs_i2c_data[] __initconst; 41extern const struct mxs_mxs_i2c_data mx28_mxs_i2c_data[] __initconst;
38#define mx28_add_mxs_i2c(id) mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id]) 42#define mx28_add_mxs_i2c(id) mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id])
39 43
diff --git a/arch/arm/mach-mxs/devices.c b/arch/arm/mach-mxs/devices.c
index fe3e847930c..01faffec306 100644
--- a/arch/arm/mach-mxs/devices.c
+++ b/arch/arm/mach-mxs/devices.c
@@ -77,16 +77,18 @@ err:
77 77
78int __init mxs_add_amba_device(const struct amba_device *dev) 78int __init mxs_add_amba_device(const struct amba_device *dev)
79{ 79{
80 struct amba_device *adev = kmalloc(sizeof(*adev), GFP_KERNEL); 80 struct amba_device *adev = amba_device_alloc(dev->dev.init_name,
81 dev->res.start, resource_size(&dev->res));
81 82
82 if (!adev) { 83 if (!adev) {
83 pr_err("%s: failed to allocate memory", __func__); 84 pr_err("%s: failed to allocate memory", __func__);
84 return -ENOMEM; 85 return -ENOMEM;
85 } 86 }
86 87
87 *adev = *dev; 88 adev->irq[0] = dev->irq[0];
89 adev->irq[1] = dev->irq[1];
88 90
89 return amba_device_register(adev, &iomem_resource); 91 return amba_device_add(adev, &iomem_resource);
90} 92}
91 93
92struct device mxs_apbh_bus = { 94struct device mxs_apbh_bus = {
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
index 18b6bf526a2..b8913df4cfa 100644
--- a/arch/arm/mach-mxs/devices/Kconfig
+++ b/arch/arm/mach-mxs/devices/Kconfig
@@ -12,6 +12,9 @@ config MXS_HAVE_PLATFORM_FLEXCAN
12 select HAVE_CAN_FLEXCAN if CAN 12 select HAVE_CAN_FLEXCAN if CAN
13 bool 13 bool
14 14
15config MXS_HAVE_PLATFORM_GPMI_NAND
16 bool
17
15config MXS_HAVE_PLATFORM_MXS_I2C 18config MXS_HAVE_PLATFORM_MXS_I2C
16 bool 19 bool
17 20
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile
index f52e3e53bae..c8f5c9541a3 100644
--- a/arch/arm/mach-mxs/devices/Makefile
+++ b/arch/arm/mach-mxs/devices/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o
3obj-y += platform-dma.o 3obj-y += platform-dma.o
4obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o 4obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o
5obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o 5obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
6obj-$(CONFIG_MXS_HAVE_PLATFORM_GPMI_NAND) += platform-gpmi-nand.o
6obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o 7obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o
7obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o 8obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o
8obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o 9obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o
diff --git a/arch/arm/mach-mxs/devices/amba-duart.c b/arch/arm/mach-mxs/devices/amba-duart.c
index a559db09b49..a5479f76604 100644
--- a/arch/arm/mach-mxs/devices/amba-duart.c
+++ b/arch/arm/mach-mxs/devices/amba-duart.c
@@ -23,7 +23,7 @@ const struct amba_device name##_device __initconst = { \
23 .end = (soc ## _DUART_BASE_ADDR) + SZ_8K - 1, \ 23 .end = (soc ## _DUART_BASE_ADDR) + SZ_8K - 1, \
24 .flags = IORESOURCE_MEM, \ 24 .flags = IORESOURCE_MEM, \
25 }, \ 25 }, \
26 .irq = {soc ## _INT_DUART, NO_IRQ}, \ 26 .irq = {soc ## _INT_DUART}, \
27} 27}
28 28
29#ifdef CONFIG_SOC_IMX23 29#ifdef CONFIG_SOC_IMX23
diff --git a/arch/arm/mach-mxs/devices/platform-gpmi-nand.c b/arch/arm/mach-mxs/devices/platform-gpmi-nand.c
new file mode 100644
index 00000000000..3e22df5944a
--- /dev/null
+++ b/arch/arm/mach-mxs/devices/platform-gpmi-nand.c
@@ -0,0 +1,81 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, 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 * 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 along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18#include <asm/sizes.h>
19#include <mach/mx23.h>
20#include <mach/mx28.h>
21#include <mach/devices-common.h>
22#include <linux/dma-mapping.h>
23
24#ifdef CONFIG_SOC_IMX23
25const struct mxs_gpmi_nand_data mx23_gpmi_nand_data __initconst = {
26 .devid = "imx23-gpmi-nand",
27 .res = {
28 /* GPMI */
29 DEFINE_RES_MEM_NAMED(MX23_GPMI_BASE_ADDR, SZ_8K,
30 GPMI_NAND_GPMI_REGS_ADDR_RES_NAME),
31 DEFINE_RES_IRQ_NAMED(MX23_INT_GPMI_ATTENTION,
32 GPMI_NAND_GPMI_INTERRUPT_RES_NAME),
33 /* BCH */
34 DEFINE_RES_MEM_NAMED(MX23_BCH_BASE_ADDR, SZ_8K,
35 GPMI_NAND_BCH_REGS_ADDR_RES_NAME),
36 DEFINE_RES_IRQ_NAMED(MX23_INT_BCH,
37 GPMI_NAND_BCH_INTERRUPT_RES_NAME),
38 /* DMA */
39 DEFINE_RES_NAMED(MX23_DMA_GPMI0,
40 MX23_DMA_GPMI3 - MX23_DMA_GPMI0 + 1,
41 GPMI_NAND_DMA_CHANNELS_RES_NAME,
42 IORESOURCE_DMA),
43 DEFINE_RES_IRQ_NAMED(MX23_INT_GPMI_DMA,
44 GPMI_NAND_DMA_INTERRUPT_RES_NAME),
45 },
46};
47#endif
48
49#ifdef CONFIG_SOC_IMX28
50const struct mxs_gpmi_nand_data mx28_gpmi_nand_data __initconst = {
51 .devid = "imx28-gpmi-nand",
52 .res = {
53 /* GPMI */
54 DEFINE_RES_MEM_NAMED(MX28_GPMI_BASE_ADDR, SZ_8K,
55 GPMI_NAND_GPMI_REGS_ADDR_RES_NAME),
56 DEFINE_RES_IRQ_NAMED(MX28_INT_GPMI,
57 GPMI_NAND_GPMI_INTERRUPT_RES_NAME),
58 /* BCH */
59 DEFINE_RES_MEM_NAMED(MX28_BCH_BASE_ADDR, SZ_8K,
60 GPMI_NAND_BCH_REGS_ADDR_RES_NAME),
61 DEFINE_RES_IRQ_NAMED(MX28_INT_BCH,
62 GPMI_NAND_BCH_INTERRUPT_RES_NAME),
63 /* DMA */
64 DEFINE_RES_NAMED(MX28_DMA_GPMI0,
65 MX28_DMA_GPMI7 - MX28_DMA_GPMI0 + 1,
66 GPMI_NAND_DMA_CHANNELS_RES_NAME,
67 IORESOURCE_DMA),
68 DEFINE_RES_IRQ_NAMED(MX28_INT_GPMI_DMA,
69 GPMI_NAND_DMA_INTERRUPT_RES_NAME),
70 },
71};
72#endif
73
74struct platform_device *__init
75mxs_add_gpmi_nand(const struct gpmi_nand_platform_data *pdata,
76 const struct mxs_gpmi_nand_data *data)
77{
78 return mxs_add_platform_device_dmamask(data->devid, -1,
79 data->res, GPMI_NAND_RES_SIZE,
80 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
81}
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-mmc.c b/arch/arm/mach-mxs/devices/platform-mxs-mmc.c
index 382dacbeca2..bef9d923f54 100644
--- a/arch/arm/mach-mxs/devices/platform-mxs-mmc.c
+++ b/arch/arm/mach-mxs/devices/platform-mxs-mmc.c
@@ -41,6 +41,8 @@ const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst = {
41const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst = { 41const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst = {
42 mxs_mxs_mmc_data_entry(MX28, 0, 0), 42 mxs_mxs_mmc_data_entry(MX28, 0, 0),
43 mxs_mxs_mmc_data_entry(MX28, 1, 1), 43 mxs_mxs_mmc_data_entry(MX28, 1, 1),
44 mxs_mxs_mmc_data_entry(MX28, 2, 2),
45 mxs_mxs_mmc_data_entry(MX28, 3, 3),
44}; 46};
45#endif 47#endif
46 48
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h
index e1237ab2586..c50c3ea28a9 100644
--- a/arch/arm/mach-mxs/include/mach/common.h
+++ b/arch/arm/mach-mxs/include/mach/common.h
@@ -31,4 +31,6 @@ extern void mx28_init_irq(void);
31 31
32extern void icoll_init_irq(void); 32extern void icoll_init_irq(void);
33 33
34extern int mxs_clkctrl_timeout(unsigned int reg_offset, unsigned int mask);
35
34#endif /* __MACH_MXS_COMMON_H__ */ 36#endif /* __MACH_MXS_COMMON_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index dc369c1239f..f2e383955d8 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -66,6 +66,16 @@ struct platform_device *__init mxs_add_flexcan(
66 const struct mxs_flexcan_data *data, 66 const struct mxs_flexcan_data *data,
67 const struct flexcan_platform_data *pdata); 67 const struct flexcan_platform_data *pdata);
68 68
69/* gpmi-nand */
70#include <linux/mtd/gpmi-nand.h>
71struct mxs_gpmi_nand_data {
72 const char *devid;
73 const struct resource res[GPMI_NAND_RES_SIZE];
74};
75struct platform_device *__init
76mxs_add_gpmi_nand(const struct gpmi_nand_platform_data *pdata,
77 const struct mxs_gpmi_nand_data *data);
78
69/* i2c */ 79/* i2c */
70struct mxs_mxs_i2c_data { 80struct mxs_mxs_i2c_data {
71 int id; 81 int id;
diff --git a/arch/arm/mach-mxs/include/mach/digctl.h b/arch/arm/mach-mxs/include/mach/digctl.h
index 49a888c65d6..17964066303 100644
--- a/arch/arm/mach-mxs/include/mach/digctl.h
+++ b/arch/arm/mach-mxs/include/mach/digctl.h
@@ -18,4 +18,5 @@
18#define HW_DIGCTL_CTRL 0x0 18#define HW_DIGCTL_CTRL 0x0
19#define BP_DIGCTL_CTRL_SAIF_CLKMUX 10 19#define BP_DIGCTL_CTRL_SAIF_CLKMUX 10
20#define BM_DIGCTL_CTRL_SAIF_CLKMUX (0x3 << 10) 20#define BM_DIGCTL_CTRL_SAIF_CLKMUX (0x3 << 10)
21#define HW_DIGCTL_CHIPID 0x310
21#endif 22#endif
diff --git a/arch/arm/mach-mxs/include/mach/entry-macro.S b/arch/arm/mach-mxs/include/mach/entry-macro.S
index 9f0da12e657..0c14259705b 100644
--- a/arch/arm/mach-mxs/include/mach/entry-macro.S
+++ b/arch/arm/mach-mxs/include/mach/entry-macro.S
@@ -23,9 +23,6 @@
23#define MXS_ICOLL_VBASE MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR) 23#define MXS_ICOLL_VBASE MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR)
24#define HW_ICOLL_STAT_OFFSET 0x70 24#define HW_ICOLL_STAT_OFFSET 0x70
25 25
26 .macro disable_fiq
27 .endm
28
29 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 26 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
30 ldr \irqnr, [\base, #HW_ICOLL_STAT_OFFSET] 27 ldr \irqnr, [\base, #HW_ICOLL_STAT_OFFSET]
31 cmp \irqnr, #0x7F 28 cmp \irqnr, #0x7F
@@ -36,6 +33,3 @@
36 .macro get_irqnr_preamble, base, tmp 33 .macro get_irqnr_preamble, base, tmp
37 ldr \base, =MXS_ICOLL_VBASE 34 ldr \base, =MXS_ICOLL_VBASE
38 .endm 35 .endm
39
40 .macro arch_ret_to_user, tmp1, tmp2
41 .endm
diff --git a/arch/arm/mach-mxs/include/mach/mxs.h b/arch/arm/mach-mxs/include/mach/mxs.h
index bde5f663474..7d4fb6d0afd 100644
--- a/arch/arm/mach-mxs/include/mach/mxs.h
+++ b/arch/arm/mach-mxs/include/mach/mxs.h
@@ -23,22 +23,10 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#endif 24#endif
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <mach/digctl.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27 28
28/* 29/*
29 * MXS CPU types
30 */
31#define cpu_is_mx23() ( \
32 machine_is_mx23evk() || \
33 machine_is_stmp378x() || \
34 0)
35#define cpu_is_mx28() ( \
36 machine_is_mx28evk() || \
37 machine_is_m28evk() || \
38 machine_is_tx28() || \
39 0)
40
41/*
42 * IO addresses common to MXS-based 30 * IO addresses common to MXS-based
43 */ 31 */
44#define MXS_IO_BASE_ADDR 0x80000000 32#define MXS_IO_BASE_ADDR 0x80000000
@@ -109,6 +97,21 @@ static inline void __mxs_togl(u32 mask, void __iomem *reg)
109{ 97{
110 __raw_writel(mask, reg + MXS_TOG_ADDR); 98 __raw_writel(mask, reg + MXS_TOG_ADDR);
111} 99}
100
101/*
102 * MXS CPU types
103 */
104#define MXS_CHIPID (MXS_IO_ADDRESS(MXS_DIGCTL_BASE_ADDR) + HW_DIGCTL_CHIPID)
105
106static inline int cpu_is_mx23(void)
107{
108 return ((__raw_readl(MXS_CHIPID) >> 16) == 0x3780);
109}
110
111static inline int cpu_is_mx28(void)
112{
113 return ((__raw_readl(MXS_CHIPID) >> 16) == 0x2800);
114}
112#endif 115#endif
113 116
114#endif /* __MACH_MXS_H__ */ 117#endif /* __MACH_MXS_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/system.h b/arch/arm/mach-mxs/include/mach/system.h
deleted file mode 100644
index e7ad1bb2942..00000000000
--- a/arch/arm/mach-mxs/include/mach/system.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 1999 ARM Limited
3 * Copyright (C) 2000 Deep Blue Solutions Ltd
4 * Copyright 2004-2008 Freescale Semiconductor, 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
17#ifndef __MACH_MXS_SYSTEM_H__
18#define __MACH_MXS_SYSTEM_H__
19
20static inline void arch_idle(void)
21{
22 cpu_do_idle();
23}
24
25#endif /* __MACH_MXS_SYSTEM_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/uncompress.h b/arch/arm/mach-mxs/include/mach/uncompress.h
index 67776746f14..ef281149544 100644
--- a/arch/arm/mach-mxs/include/mach/uncompress.h
+++ b/arch/arm/mach-mxs/include/mach/uncompress.h
@@ -18,8 +18,6 @@
18#ifndef __MACH_MXS_UNCOMPRESS_H__ 18#ifndef __MACH_MXS_UNCOMPRESS_H__
19#define __MACH_MXS_UNCOMPRESS_H__ 19#define __MACH_MXS_UNCOMPRESS_H__
20 20
21#include <asm/mach-types.h>
22
23unsigned long mxs_duart_base; 21unsigned long mxs_duart_base;
24 22
25#define MXS_DUART(x) (*(volatile unsigned long *)(mxs_duart_base + (x))) 23#define MXS_DUART(x) (*(volatile unsigned long *)(mxs_duart_base + (x)))
@@ -55,16 +53,17 @@ static inline void flush(void)
55 53
56#define MX23_DUART_BASE_ADDR 0x80070000 54#define MX23_DUART_BASE_ADDR 0x80070000
57#define MX28_DUART_BASE_ADDR 0x80074000 55#define MX28_DUART_BASE_ADDR 0x80074000
56#define MXS_DIGCTL_CHIPID 0x8001c310
58 57
59static inline void __arch_decomp_setup(unsigned long arch_id) 58static inline void __arch_decomp_setup(unsigned long arch_id)
60{ 59{
61 switch (arch_id) { 60 u16 chipid = (*(volatile unsigned long *) MXS_DIGCTL_CHIPID) >> 16;
62 case MACH_TYPE_MX23EVK: 61
62 switch (chipid) {
63 case 0x3780:
63 mxs_duart_base = MX23_DUART_BASE_ADDR; 64 mxs_duart_base = MX23_DUART_BASE_ADDR;
64 break; 65 break;
65 case MACH_TYPE_MX28EVK: 66 case 0x2800:
66 case MACH_TYPE_M28EVK:
67 case MACH_TYPE_TX28:
68 mxs_duart_base = MX28_DUART_BASE_ADDR; 67 mxs_duart_base = MX28_DUART_BASE_ADDR;
69 break; 68 break;
70 default: 69 default:
diff --git a/arch/arm/mach-mxs/mach-apx4devkit.c b/arch/arm/mach-mxs/mach-apx4devkit.c
new file mode 100644
index 00000000000..48a7fab571a
--- /dev/null
+++ b/arch/arm/mach-mxs/mach-apx4devkit.c
@@ -0,0 +1,260 @@
1/*
2 * Copyright (C) 2011-2012
3 * Lauri Hintsala, Bluegiga, <lauri.hintsala@bluegiga.com>
4 * Veli-Pekka Peltola, Bluegiga, <veli-pekka.peltola@bluegiga.com>
5 *
6 * based on: mach-mx28evk.c
7 * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */
19
20#include <linux/delay.h>
21#include <linux/platform_device.h>
22#include <linux/gpio.h>
23#include <linux/leds.h>
24#include <linux/clk.h>
25#include <linux/i2c.h>
26#include <linux/regulator/machine.h>
27#include <linux/regulator/fixed.h>
28#include <linux/micrel_phy.h>
29
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/time.h>
33
34#include <mach/common.h>
35#include <mach/digctl.h>
36#include <mach/iomux-mx28.h>
37
38#include "devices-mx28.h"
39
40#define APX4DEVKIT_GPIO_USERLED MXS_GPIO_NR(3, 28)
41
42static const iomux_cfg_t apx4devkit_pads[] __initconst = {
43 /* duart */
44 MX28_PAD_PWM0__DUART_RX | MXS_PAD_CTRL,
45 MX28_PAD_PWM1__DUART_TX | MXS_PAD_CTRL,
46
47 /* auart0 */
48 MX28_PAD_AUART0_RX__AUART0_RX | MXS_PAD_CTRL,
49 MX28_PAD_AUART0_TX__AUART0_TX | MXS_PAD_CTRL,
50 MX28_PAD_AUART0_CTS__AUART0_CTS | MXS_PAD_CTRL,
51 MX28_PAD_AUART0_RTS__AUART0_RTS | MXS_PAD_CTRL,
52
53 /* auart1 */
54 MX28_PAD_AUART1_RX__AUART1_RX | MXS_PAD_CTRL,
55 MX28_PAD_AUART1_TX__AUART1_TX | MXS_PAD_CTRL,
56
57 /* auart2 */
58 MX28_PAD_SSP2_SCK__AUART2_RX | MXS_PAD_CTRL,
59 MX28_PAD_SSP2_MOSI__AUART2_TX | MXS_PAD_CTRL,
60
61 /* auart3 */
62 MX28_PAD_SSP2_MISO__AUART3_RX | MXS_PAD_CTRL,
63 MX28_PAD_SSP2_SS0__AUART3_TX | MXS_PAD_CTRL,
64
65#define MXS_PAD_FEC (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP)
66 /* fec0 */
67 MX28_PAD_ENET0_MDC__ENET0_MDC | MXS_PAD_FEC,
68 MX28_PAD_ENET0_MDIO__ENET0_MDIO | MXS_PAD_FEC,
69 MX28_PAD_ENET0_RX_EN__ENET0_RX_EN | MXS_PAD_FEC,
70 MX28_PAD_ENET0_RXD0__ENET0_RXD0 | MXS_PAD_FEC,
71 MX28_PAD_ENET0_RXD1__ENET0_RXD1 | MXS_PAD_FEC,
72 MX28_PAD_ENET0_TX_EN__ENET0_TX_EN | MXS_PAD_FEC,
73 MX28_PAD_ENET0_TXD0__ENET0_TXD0 | MXS_PAD_FEC,
74 MX28_PAD_ENET0_TXD1__ENET0_TXD1 | MXS_PAD_FEC,
75 MX28_PAD_ENET_CLK__CLKCTRL_ENET | MXS_PAD_FEC,
76
77 /* i2c */
78 MX28_PAD_I2C0_SCL__I2C0_SCL,
79 MX28_PAD_I2C0_SDA__I2C0_SDA,
80
81 /* mmc0 */
82 MX28_PAD_SSP0_DATA0__SSP0_D0 |
83 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
84 MX28_PAD_SSP0_DATA1__SSP0_D1 |
85 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
86 MX28_PAD_SSP0_DATA2__SSP0_D2 |
87 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
88 MX28_PAD_SSP0_DATA3__SSP0_D3 |
89 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
90 MX28_PAD_SSP0_DATA4__SSP0_D4 |
91 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
92 MX28_PAD_SSP0_DATA5__SSP0_D5 |
93 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
94 MX28_PAD_SSP0_DATA6__SSP0_D6 |
95 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
96 MX28_PAD_SSP0_DATA7__SSP0_D7 |
97 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
98 MX28_PAD_SSP0_CMD__SSP0_CMD |
99 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
100 MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT |
101 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
102 MX28_PAD_SSP0_SCK__SSP0_SCK |
103 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
104
105 /* led */
106 MX28_PAD_PWM3__GPIO_3_28 | MXS_PAD_CTRL,
107
108 /* saif0 & saif1 */
109 MX28_PAD_SAIF0_MCLK__SAIF0_MCLK |
110 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
111 MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK |
112 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
113 MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK |
114 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
115 MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0 |
116 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
117 MX28_PAD_SAIF1_SDATA0__SAIF1_SDATA0 |
118 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
119};
120
121/* led */
122static const struct gpio_led apx4devkit_leds[] __initconst = {
123 {
124 .name = "user-led",
125 .default_trigger = "heartbeat",
126 .gpio = APX4DEVKIT_GPIO_USERLED,
127 },
128};
129
130static const struct gpio_led_platform_data apx4devkit_led_data __initconst = {
131 .leds = apx4devkit_leds,
132 .num_leds = ARRAY_SIZE(apx4devkit_leds),
133};
134
135static const struct fec_platform_data mx28_fec_pdata __initconst = {
136 .phy = PHY_INTERFACE_MODE_RMII,
137};
138
139static const struct mxs_mmc_platform_data apx4devkit_mmc_pdata __initconst = {
140 .wp_gpio = -EINVAL,
141 .flags = SLOTF_4_BIT_CAPABLE,
142};
143
144static const struct i2c_board_info apx4devkit_i2c_boardinfo[] __initconst = {
145 { I2C_BOARD_INFO("sgtl5000", 0x0a) }, /* ASoC */
146 { I2C_BOARD_INFO("pcf8563", 0x51) }, /* RTC */
147};
148
149#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || \
150 defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
151static struct regulator_consumer_supply apx4devkit_audio_consumer_supplies[] = {
152 REGULATOR_SUPPLY("VDDA", "0-000a"),
153 REGULATOR_SUPPLY("VDDIO", "0-000a"),
154};
155
156static struct regulator_init_data apx4devkit_vdd_reg_init_data = {
157 .constraints = {
158 .name = "3V3",
159 .always_on = 1,
160 },
161 .consumer_supplies = apx4devkit_audio_consumer_supplies,
162 .num_consumer_supplies = ARRAY_SIZE(apx4devkit_audio_consumer_supplies),
163};
164
165static struct fixed_voltage_config apx4devkit_vdd_pdata = {
166 .supply_name = "board-3V3",
167 .microvolts = 3300000,
168 .gpio = -EINVAL,
169 .enabled_at_boot = 1,
170 .init_data = &apx4devkit_vdd_reg_init_data,
171};
172
173static struct platform_device apx4devkit_voltage_regulator = {
174 .name = "reg-fixed-voltage",
175 .id = -1,
176 .num_resources = 0,
177 .dev = {
178 .platform_data = &apx4devkit_vdd_pdata,
179 },
180};
181
182static void __init apx4devkit_add_regulators(void)
183{
184 platform_device_register(&apx4devkit_voltage_regulator);
185}
186#else
187static void __init apx4devkit_add_regulators(void) {}
188#endif
189
190static const struct mxs_saif_platform_data
191 apx4devkit_mxs_saif_pdata[] __initconst = {
192 /* working on EXTMSTR0 mode (saif0 master, saif1 slave) */
193 {
194 .master_mode = 1,
195 .master_id = 0,
196 }, {
197 .master_mode = 0,
198 .master_id = 0,
199 },
200};
201
202static int apx4devkit_phy_fixup(struct phy_device *phy)
203{
204 phy->dev_flags |= MICREL_PHY_50MHZ_CLK;
205 return 0;
206}
207
208static void __init apx4devkit_init(void)
209{
210 mxs_iomux_setup_multiple_pads(apx4devkit_pads,
211 ARRAY_SIZE(apx4devkit_pads));
212
213 mx28_add_duart();
214 mx28_add_auart0();
215 mx28_add_auart1();
216 mx28_add_auart2();
217 mx28_add_auart3();
218
219 /*
220 * Register fixup for the Micrel KS8031 PHY clock
221 * (shares same ID with KS8051)
222 */
223 phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK,
224 apx4devkit_phy_fixup);
225
226 mx28_add_fec(0, &mx28_fec_pdata);
227
228 mx28_add_mxs_mmc(0, &apx4devkit_mmc_pdata);
229
230 gpio_led_register_device(0, &apx4devkit_led_data);
231
232 mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
233 mx28_add_saif(0, &apx4devkit_mxs_saif_pdata[0]);
234 mx28_add_saif(1, &apx4devkit_mxs_saif_pdata[1]);
235
236 apx4devkit_add_regulators();
237
238 mx28_add_mxs_i2c(0);
239 i2c_register_board_info(0, apx4devkit_i2c_boardinfo,
240 ARRAY_SIZE(apx4devkit_i2c_boardinfo));
241
242 mxs_add_platform_device("mxs-sgtl5000", 0, NULL, 0, NULL, 0);
243}
244
245static void __init apx4devkit_timer_init(void)
246{
247 mx28_clocks_init();
248}
249
250static struct sys_timer apx4devkit_timer = {
251 .init = apx4devkit_timer_init,
252};
253
254MACHINE_START(APX4DEVKIT, "Bluegiga APX4 Development Kit")
255 .map_io = mx28_map_io,
256 .init_irq = mx28_init_irq,
257 .timer = &apx4devkit_timer,
258 .init_machine = apx4devkit_init,
259 .restart = mxs_restart,
260MACHINE_END
diff --git a/arch/arm/mach-mxs/mach-m28evk.c b/arch/arm/mach-mxs/mach-m28evk.c
index 2f2758230ed..06d79963611 100644
--- a/arch/arm/mach-mxs/mach-m28evk.c
+++ b/arch/arm/mach-mxs/mach-m28evk.c
@@ -247,18 +247,15 @@ static int __init m28evk_fec_get_mac(void)
247 u32 val; 247 u32 val;
248 const u32 *ocotp = mxs_get_ocotp(); 248 const u32 *ocotp = mxs_get_ocotp();
249 249
250 if (!ocotp) { 250 if (!ocotp)
251 pr_err("%s: timeout when reading fec mac from OCOTP\n",
252 __func__);
253 return -ETIMEDOUT; 251 return -ETIMEDOUT;
254 }
255 252
256 /* 253 /*
257 * OCOTP only stores the last 4 octets for each mac address, 254 * OCOTP only stores the last 4 octets for each mac address,
258 * so hard-code DENX OUI (C0:E5:4E) here. 255 * so hard-code DENX OUI (C0:E5:4E) here.
259 */ 256 */
260 for (i = 0; i < 2; i++) { 257 for (i = 0; i < 2; i++) {
261 val = ocotp[i * 4]; 258 val = ocotp[i];
262 mx28_fec_pdata[i].mac[0] = 0xC0; 259 mx28_fec_pdata[i].mac[0] = 0xC0;
263 mx28_fec_pdata[i].mac[1] = 0xE5; 260 mx28_fec_pdata[i].mac[1] = 0xE5;
264 mx28_fec_pdata[i].mac[2] = 0x4E; 261 mx28_fec_pdata[i].mac[2] = 0x4E;
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index fdb0a5664dd..e386c142f93 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -223,7 +223,6 @@ static const struct gpio_led_platform_data mx28evk_led_data __initconst = {
223/* fec */ 223/* fec */
224static void __init mx28evk_fec_reset(void) 224static void __init mx28evk_fec_reset(void)
225{ 225{
226 int ret;
227 struct clk *clk; 226 struct clk *clk;
228 227
229 /* Enable fec phy clock */ 228 /* Enable fec phy clock */
@@ -231,32 +230,7 @@ static void __init mx28evk_fec_reset(void)
231 if (!IS_ERR(clk)) 230 if (!IS_ERR(clk))
232 clk_prepare_enable(clk); 231 clk_prepare_enable(clk);
233 232
234 /* Power up fec phy */ 233 gpio_set_value(MX28EVK_FEC_PHY_RESET, 0);
235 ret = gpio_request(MX28EVK_FEC_PHY_POWER, "fec-phy-power");
236 if (ret) {
237 pr_err("Failed to request gpio fec-phy-%s: %d\n", "power", ret);
238 return;
239 }
240
241 ret = gpio_direction_output(MX28EVK_FEC_PHY_POWER, 0);
242 if (ret) {
243 pr_err("Failed to drive gpio fec-phy-%s: %d\n", "power", ret);
244 return;
245 }
246
247 /* Reset fec phy */
248 ret = gpio_request(MX28EVK_FEC_PHY_RESET, "fec-phy-reset");
249 if (ret) {
250 pr_err("Failed to request gpio fec-phy-%s: %d\n", "reset", ret);
251 return;
252 }
253
254 gpio_direction_output(MX28EVK_FEC_PHY_RESET, 0);
255 if (ret) {
256 pr_err("Failed to drive gpio fec-phy-%s: %d\n", "reset", ret);
257 return;
258 }
259
260 mdelay(1); 234 mdelay(1);
261 gpio_set_value(MX28EVK_FEC_PHY_RESET, 1); 235 gpio_set_value(MX28EVK_FEC_PHY_RESET, 1);
262} 236}
@@ -278,14 +252,14 @@ static int __init mx28evk_fec_get_mac(void)
278 const u32 *ocotp = mxs_get_ocotp(); 252 const u32 *ocotp = mxs_get_ocotp();
279 253
280 if (!ocotp) 254 if (!ocotp)
281 goto error; 255 return -ETIMEDOUT;
282 256
283 /* 257 /*
284 * OCOTP only stores the last 4 octets for each mac address, 258 * OCOTP only stores the last 4 octets for each mac address,
285 * so hard-code Freescale OUI (00:04:9f) here. 259 * so hard-code Freescale OUI (00:04:9f) here.
286 */ 260 */
287 for (i = 0; i < 2; i++) { 261 for (i = 0; i < 2; i++) {
288 val = ocotp[i * 4]; 262 val = ocotp[i];
289 mx28_fec_pdata[i].mac[0] = 0x00; 263 mx28_fec_pdata[i].mac[0] = 0x00;
290 mx28_fec_pdata[i].mac[1] = 0x04; 264 mx28_fec_pdata[i].mac[1] = 0x04;
291 mx28_fec_pdata[i].mac[2] = 0x9f; 265 mx28_fec_pdata[i].mac[2] = 0x9f;
@@ -295,10 +269,6 @@ static int __init mx28evk_fec_get_mac(void)
295 } 269 }
296 270
297 return 0; 271 return 0;
298
299error:
300 pr_err("%s: timeout when reading fec mac from OCOTP\n", __func__);
301 return -ETIMEDOUT;
302} 272}
303 273
304/* 274/*
@@ -417,9 +387,14 @@ static void __init mx28evk_add_regulators(void)
417static void __init mx28evk_add_regulators(void) {} 387static void __init mx28evk_add_regulators(void) {}
418#endif 388#endif
419 389
420static struct gpio mx28evk_lcd_gpios[] = { 390static const struct gpio mx28evk_gpios[] __initconst = {
421 { MX28EVK_LCD_ENABLE, GPIOF_OUT_INIT_HIGH, "lcd-enable" }, 391 { MX28EVK_LCD_ENABLE, GPIOF_OUT_INIT_HIGH, "lcd-enable" },
422 { MX28EVK_BL_ENABLE, GPIOF_OUT_INIT_HIGH, "bl-enable" }, 392 { MX28EVK_BL_ENABLE, GPIOF_OUT_INIT_HIGH, "bl-enable" },
393 { MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT, "flexcan-switch" },
394 { MX28EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW, "mmc0-slot-power" },
395 { MX28EVK_MMC1_SLOT_POWER, GPIOF_OUT_INIT_LOW, "mmc1-slot-power" },
396 { MX28EVK_FEC_PHY_POWER, GPIOF_OUT_INIT_LOW, "fec-phy-power" },
397 { MX28EVK_FEC_PHY_RESET, GPIOF_DIR_OUT, "fec-phy-reset" },
423}; 398};
424 399
425static const struct mxs_saif_platform_data 400static const struct mxs_saif_platform_data
@@ -447,25 +422,18 @@ static void __init mx28evk_init(void)
447 if (mx28evk_fec_get_mac()) 422 if (mx28evk_fec_get_mac())
448 pr_warn("%s: failed on fec mac setup\n", __func__); 423 pr_warn("%s: failed on fec mac setup\n", __func__);
449 424
425 ret = gpio_request_array(mx28evk_gpios, ARRAY_SIZE(mx28evk_gpios));
426 if (ret)
427 pr_err("One or more GPIOs failed to be requested: %d\n", ret);
428
450 mx28evk_fec_reset(); 429 mx28evk_fec_reset();
451 mx28_add_fec(0, &mx28_fec_pdata[0]); 430 mx28_add_fec(0, &mx28_fec_pdata[0]);
452 mx28_add_fec(1, &mx28_fec_pdata[1]); 431 mx28_add_fec(1, &mx28_fec_pdata[1]);
453 432
454 ret = gpio_request_one(MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT, 433 mx28_add_flexcan(0, &mx28evk_flexcan_pdata[0]);
455 "flexcan-switch"); 434 mx28_add_flexcan(1, &mx28evk_flexcan_pdata[1]);
456 if (ret) {
457 pr_err("failed to request gpio flexcan-switch: %d\n", ret);
458 } else {
459 mx28_add_flexcan(0, &mx28evk_flexcan_pdata[0]);
460 mx28_add_flexcan(1, &mx28evk_flexcan_pdata[1]);
461 }
462 435
463 ret = gpio_request_array(mx28evk_lcd_gpios, 436 mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
464 ARRAY_SIZE(mx28evk_lcd_gpios));
465 if (ret)
466 pr_warn("failed to request gpio pins for lcd: %d\n", ret);
467 else
468 mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
469 437
470 mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); 438 mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
471 mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]); 439 mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]);
@@ -480,20 +448,8 @@ static void __init mx28evk_init(void)
480 mxs_add_platform_device("mxs-sgtl5000", 0, NULL, 0, 448 mxs_add_platform_device("mxs-sgtl5000", 0, NULL, 0,
481 NULL, 0); 449 NULL, 0);
482 450
483 /* power on mmc slot by writing 0 to the gpio */ 451 mx28_add_mxs_mmc(0, &mx28evk_mmc_pdata[0]);
484 ret = gpio_request_one(MX28EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW, 452 mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]);
485 "mmc0-slot-power");
486 if (ret)
487 pr_warn("failed to request gpio mmc0-slot-power: %d\n", ret);
488 else
489 mx28_add_mxs_mmc(0, &mx28evk_mmc_pdata[0]);
490
491 ret = gpio_request_one(MX28EVK_MMC1_SLOT_POWER, GPIOF_OUT_INIT_LOW,
492 "mmc1-slot-power");
493 if (ret)
494 pr_warn("failed to request gpio mmc1-slot-power: %d\n", ret);
495 else
496 mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]);
497 453
498 mx28_add_rtc_stmp3xxx(); 454 mx28_add_rtc_stmp3xxx();
499 455
diff --git a/arch/arm/mach-mxs/pm.c b/arch/arm/mach-mxs/pm.c
index fb042da29bd..a9b4bbcdafb 100644
--- a/arch/arm/mach-mxs/pm.c
+++ b/arch/arm/mach-mxs/pm.c
@@ -15,13 +15,12 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/suspend.h> 16#include <linux/suspend.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <mach/system.h>
19 18
20static int mxs_suspend_enter(suspend_state_t state) 19static int mxs_suspend_enter(suspend_state_t state)
21{ 20{
22 switch (state) { 21 switch (state) {
23 case PM_SUSPEND_MEM: 22 case PM_SUSPEND_MEM:
24 arch_idle(); 23 cpu_do_idle();
25 break; 24 break;
26 25
27 default: 26 default:
diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c
index 54f91ad1c96..7aa5ac5d78b 100644
--- a/arch/arm/mach-mxs/system.c
+++ b/arch/arm/mach-mxs/system.c
@@ -37,6 +37,8 @@
37#define MXS_MODULE_CLKGATE (1 << 30) 37#define MXS_MODULE_CLKGATE (1 << 30)
38#define MXS_MODULE_SFTRST (1 << 31) 38#define MXS_MODULE_SFTRST (1 << 31)
39 39
40#define CLKCTRL_TIMEOUT 10 /* 10 ms */
41
40static void __iomem *mxs_clkctrl_reset_addr; 42static void __iomem *mxs_clkctrl_reset_addr;
41 43
42/* 44/*
@@ -137,3 +139,17 @@ error:
137 return -ETIMEDOUT; 139 return -ETIMEDOUT;
138} 140}
139EXPORT_SYMBOL(mxs_reset_block); 141EXPORT_SYMBOL(mxs_reset_block);
142
143int mxs_clkctrl_timeout(unsigned int reg_offset, unsigned int mask)
144{
145 unsigned long timeout = jiffies + msecs_to_jiffies(CLKCTRL_TIMEOUT);
146 while (readl_relaxed(MXS_IO_ADDRESS(MXS_CLKCTRL_BASE_ADDR)
147 + reg_offset) & mask) {
148 if (time_after(jiffies, timeout)) {
149 pr_err("Timeout at CLKCTRL + 0x%x\n", reg_offset);
150 return -ETIMEDOUT;
151 }
152 }
153
154 return 0;
155}
diff --git a/arch/arm/mach-netx/fb.c b/arch/arm/mach-netx/fb.c
index b9913234bbf..2cdf6ef69be 100644
--- a/arch/arm/mach-netx/fb.c
+++ b/arch/arm/mach-netx/fb.c
@@ -92,18 +92,7 @@ void clk_put(struct clk *clk)
92{ 92{
93} 93}
94 94
95static struct amba_device fb_device = { 95static AMBA_AHB_DEVICE(fb, "fb", 0, 0x00104000, { NETX_IRQ_LCD }, NULL);
96 .dev = {
97 .init_name = "fb",
98 .coherent_dma_mask = ~0,
99 },
100 .res = {
101 .start = 0x00104000,
102 .end = 0x00104fff,
103 .flags = IORESOURCE_MEM,
104 },
105 .irq = { NETX_IRQ_LCD, NO_IRQ },
106};
107 96
108int netx_fb_init(struct clcd_board *board, struct clcd_panel *panel) 97int netx_fb_init(struct clcd_board *board, struct clcd_panel *panel)
109{ 98{
diff --git a/arch/arm/mach-netx/include/mach/entry-macro.S b/arch/arm/mach-netx/include/mach/entry-macro.S
deleted file mode 100644
index 6e9f1cbe163..00000000000
--- a/arch/arm/mach-netx/include/mach/entry-macro.S
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/mach-netx/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Hilscher netX based platforms
5 *
6 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
10 * as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 .macro disable_fiq
23 .endm
24
25 .macro arch_ret_to_user, tmp1, tmp2
26 .endm
diff --git a/arch/arm/mach-netx/include/mach/system.h b/arch/arm/mach-netx/include/mach/system.h
deleted file mode 100644
index b38fa36d58c..00000000000
--- a/arch/arm/mach-netx/include/mach/system.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * arch/arm/mach-netx/include/mach/system.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __ASM_ARCH_SYSTEM_H
20#define __ASM_ARCH_SYSTEM_H
21
22static inline void arch_idle(void)
23{
24 cpu_do_idle();
25}
26
27#endif
28
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
index 7c878bf0034..58cacafcf66 100644
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -27,11 +27,11 @@
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30#include <asm/mach/time.h>
30 31
31#include <plat/gpio-nomadik.h> 32#include <plat/gpio-nomadik.h>
32#include <plat/mtu.h> 33#include <plat/mtu.h>
33 34
34#include <mach/setup.h>
35#include <mach/nand.h> 35#include <mach/nand.h>
36#include <mach/fsmc.h> 36#include <mach/fsmc.h>
37 37
@@ -185,20 +185,11 @@ static void __init nhk8815_onenand_init(void)
185#endif 185#endif
186} 186}
187 187
188#define __MEM_4K_RESOURCE(x) \ 188static AMBA_APB_DEVICE(uart0, "uart0", 0, NOMADIK_UART0_BASE,
189 .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM} 189 { IRQ_UART0 }, NULL);
190 190
191static struct amba_device uart0_device = { 191static AMBA_APB_DEVICE(uart1, "uart1", 0, NOMADIK_UART1_BASE,
192 .dev = { .init_name = "uart0" }, 192 { IRQ_UART1 }, NULL);
193 __MEM_4K_RESOURCE(NOMADIK_UART0_BASE),
194 .irq = {IRQ_UART0, NO_IRQ},
195};
196
197static struct amba_device uart1_device = {
198 .dev = { .init_name = "uart1" },
199 __MEM_4K_RESOURCE(NOMADIK_UART1_BASE),
200 .irq = {IRQ_UART1, NO_IRQ},
201};
202 193
203static struct amba_device *amba_devs[] __initdata = { 194static struct amba_device *amba_devs[] __initdata = {
204 &uart0_device, 195 &uart0_device,
@@ -255,10 +246,7 @@ static void __init nomadik_timer_init(void)
255 src_cr |= SRC_CR_INIT_VAL; 246 src_cr |= SRC_CR_INIT_VAL;
256 writel(src_cr, io_p2v(NOMADIK_SRC_BASE)); 247 writel(src_cr, io_p2v(NOMADIK_SRC_BASE));
257 248
258 /* Save global pointer to mtu, used by platform timer code */ 249 nmdk_timer_init(io_p2v(NOMADIK_MTU0_BASE));
259 mtu_base = io_p2v(NOMADIK_MTU0_BASE);
260
261 nmdk_timer_init();
262} 250}
263 251
264static struct sys_timer nomadik_timer = { 252static struct sys_timer nomadik_timer = {
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 65df7b4fdd3..27f43a46985 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -97,12 +97,7 @@ static struct platform_device cpu8815_platform_gpio[] = {
97 GPIO_DEVICE(3), 97 GPIO_DEVICE(3),
98}; 98};
99 99
100static struct amba_device cpu8815_amba_rng = { 100static AMBA_APB_DEVICE(cpu8815_amba_rng, "rng", 0, NOMADIK_RNG_BASE, { }, NULL);
101 .dev = {
102 .init_name = "rng",
103 },
104 __MEM_4K_RESOURCE(NOMADIK_RNG_BASE),
105};
106 101
107static struct platform_device *platform_devs[] __initdata = { 102static struct platform_device *platform_devs[] __initdata = {
108 cpu8815_platform_gpio + 0, 103 cpu8815_platform_gpio + 0,
@@ -112,7 +107,7 @@ static struct platform_device *platform_devs[] __initdata = {
112}; 107};
113 108
114static struct amba_device *amba_devs[] __initdata = { 109static struct amba_device *amba_devs[] __initdata = {
115 &cpu8815_amba_rng 110 &cpu8815_amba_rng_device
116}; 111};
117 112
118static int __init cpu8815_init(void) 113static int __init cpu8815_init(void)
diff --git a/arch/arm/mach-nomadik/include/mach/entry-macro.S b/arch/arm/mach-nomadik/include/mach/entry-macro.S
deleted file mode 100644
index 98ea1c1fbba..00000000000
--- a/arch/arm/mach-nomadik/include/mach/entry-macro.S
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * Low-level IRQ helper macros for Nomadik platforms
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 .macro disable_fiq
10 .endm
11
12 .macro arch_ret_to_user, tmp1, tmp2
13 .endm
diff --git a/arch/arm/mach-nomadik/include/mach/setup.h b/arch/arm/mach-nomadik/include/mach/setup.h
deleted file mode 100644
index bcaeaf41c05..00000000000
--- a/arch/arm/mach-nomadik/include/mach/setup.h
+++ /dev/null
@@ -1,19 +0,0 @@
1
2/*
3 * These symbols are needed for board-specific files to call their
4 * own cpu-specific files
5 */
6
7#ifndef __ASM_ARCH_SETUP_H
8#define __ASM_ARCH_SETUP_H
9
10#include <asm/mach/time.h>
11#include <linux/init.h>
12
13#ifdef CONFIG_NOMADIK_8815
14
15extern void nmdk_timer_init(void);
16
17#endif /* NOMADIK_8815 */
18
19#endif /* __ASM_ARCH_SETUP_H */
diff --git a/arch/arm/mach-nomadik/include/mach/system.h b/arch/arm/mach-nomadik/include/mach/system.h
deleted file mode 100644
index 25e198b8976..00000000000
--- a/arch/arm/mach-nomadik/include/mach/system.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * mach-nomadik/include/mach/system.h
3 *
4 * Copyright (C) 2008 STMicroelectronics
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARCH_SYSTEM_H
21#define __ASM_ARCH_SYSTEM_H
22
23static inline void arch_idle(void)
24{
25 /*
26 * This should do all the clock switching
27 * and wait for interrupt tricks
28 */
29 cpu_do_idle();
30}
31
32#endif
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 4f8d66f044e..dfab466ebd1 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -37,7 +37,6 @@ comment "OMAP Board Type"
37config MACH_OMAP_INNOVATOR 37config MACH_OMAP_INNOVATOR
38 bool "TI Innovator" 38 bool "TI Innovator"
39 depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX) 39 depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX)
40 select OMAP_MCBSP
41 help 40 help
42 TI OMAP 1510 or 1610 Innovator board support. Say Y here if you 41 TI OMAP 1510 or 1610 Innovator board support. Say Y here if you
43 have such a board. 42 have such a board.
@@ -45,7 +44,6 @@ config MACH_OMAP_INNOVATOR
45config MACH_OMAP_H2 44config MACH_OMAP_H2
46 bool "TI H2 Support" 45 bool "TI H2 Support"
47 depends on ARCH_OMAP1 && ARCH_OMAP16XX 46 depends on ARCH_OMAP1 && ARCH_OMAP16XX
48 select OMAP_MCBSP
49 help 47 help
50 TI OMAP 1610/1611B H2 board support. Say Y here if you have such 48 TI OMAP 1610/1611B H2 board support. Say Y here if you have such
51 a board. 49 a board.
@@ -72,7 +70,6 @@ config MACH_HERALD
72config MACH_OMAP_OSK 70config MACH_OMAP_OSK
73 bool "TI OSK Support" 71 bool "TI OSK Support"
74 depends on ARCH_OMAP1 && ARCH_OMAP16XX 72 depends on ARCH_OMAP1 && ARCH_OMAP16XX
75 select OMAP_MCBSP
76 help 73 help
77 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here 74 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
78 if you have such a board. 75 if you have such a board.
@@ -155,6 +152,10 @@ config MACH_AMS_DELTA
155 bool "Amstrad E3 (Delta)" 152 bool "Amstrad E3 (Delta)"
156 depends on ARCH_OMAP1 && ARCH_OMAP15XX 153 depends on ARCH_OMAP1 && ARCH_OMAP15XX
157 select FIQ 154 select FIQ
155 select GPIO_GENERIC_PLATFORM
156 select LEDS_GPIO_REGISTER
157 select REGULATOR
158 select REGULATOR_FIXED_VOLTAGE
158 help 159 help
159 Support for the Amstrad E3 (codename Delta) videophone. Say Y here 160 Support for the Amstrad E3 (codename Delta) videophone. Say Y here
160 if you have such a device. 161 if you have such a device.
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 11c85cd2731..9923f92b545 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -6,7 +6,9 @@
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.o time.o irq.o mux.o flash.o serial.o devices.o dma.o
7obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o 7obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
8 8
9obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o 9ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
10obj-y += mcbsp.o
11endif
10 12
11obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o 13obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o
12 14
diff --git a/arch/arm/mach-omap1/ams-delta-fiq-handler.S b/arch/arm/mach-omap1/ams-delta-fiq-handler.S
index c1c5fb6a5b4..399c4c49722 100644
--- a/arch/arm/mach-omap1/ams-delta-fiq-handler.S
+++ b/arch/arm/mach-omap1/ams-delta-fiq-handler.S
@@ -15,11 +15,12 @@
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17 17
18#include <plat/io.h>
19#include <plat/board-ams-delta.h> 18#include <plat/board-ams-delta.h>
20 19
21#include <mach/ams-delta-fiq.h> 20#include <mach/ams-delta-fiq.h>
22 21
22#include "iomap.h"
23
23/* 24/*
24 * GPIO related definitions, copied from arch/arm/plat-omap/gpio.c. 25 * GPIO related definitions, copied from arch/arm/plat-omap/gpio.c.
25 * Unfortunately, those were not placed in a separate header file. 26 * Unfortunately, those were not placed in a separate header file.
diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c
index 152b32c15e2..fcce7ff3763 100644
--- a/arch/arm/mach-omap1/ams-delta-fiq.c
+++ b/arch/arm/mach-omap1/ams-delta-fiq.c
@@ -22,6 +22,7 @@
22#include <plat/board-ams-delta.h> 22#include <plat/board-ams-delta.h>
23 23
24#include <asm/fiq.h> 24#include <asm/fiq.h>
25
25#include <mach/ams-delta-fiq.h> 26#include <mach/ams-delta-fiq.h>
26 27
27static struct fiq_handler fh = { 28static struct fiq_handler fh = {
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 88909cc0b25..c1b681ef4cb 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -11,6 +11,7 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/basic_mmio_gpio.h>
14#include <linux/gpio.h> 15#include <linux/gpio.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
@@ -18,30 +19,33 @@
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <linux/leds.h> 20#include <linux/leds.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/regulator/consumer.h>
23#include <linux/regulator/fixed.h>
24#include <linux/regulator/machine.h>
21#include <linux/serial_8250.h> 25#include <linux/serial_8250.h>
22#include <linux/export.h> 26#include <linux/export.h>
27#include <linux/omapfb.h>
28#include <linux/io.h>
23 29
24#include <media/soc_camera.h> 30#include <media/soc_camera.h>
25 31
26#include <asm/serial.h> 32#include <asm/serial.h>
27#include <mach/hardware.h>
28#include <asm/mach-types.h> 33#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 35#include <asm/mach/map.h>
31 36
32#include <plat/io.h>
33#include <plat/board-ams-delta.h> 37#include <plat/board-ams-delta.h>
34#include <plat/keypad.h> 38#include <plat/keypad.h>
35#include <plat/mux.h> 39#include <plat/mux.h>
36#include <plat/usb.h> 40#include <plat/usb.h>
37#include <plat/board.h> 41#include <plat/board.h>
38#include "common.h"
39#include <mach/camera.h>
40 42
43#include <mach/hardware.h>
41#include <mach/ams-delta-fiq.h> 44#include <mach/ams-delta-fiq.h>
45#include <mach/camera.h>
42 46
43static u8 ams_delta_latch1_reg; 47#include "iomap.h"
44static u16 ams_delta_latch2_reg; 48#include "common.h"
45 49
46static const unsigned int ams_delta_keymap[] = { 50static const unsigned int ams_delta_keymap[] = {
47 KEY(0, 0, KEY_F1), /* Advert */ 51 KEY(0, 0, KEY_F1), /* Advert */
@@ -121,58 +125,188 @@ static const unsigned int ams_delta_keymap[] = {
121 KEY(7, 3, KEY_LEFTCTRL), /* Vol down */ 125 KEY(7, 3, KEY_LEFTCTRL), /* Vol down */
122}; 126};
123 127
124void ams_delta_latch1_write(u8 mask, u8 value) 128#define LATCH1_PHYS 0x01000000
125{ 129#define LATCH1_VIRT 0xEA000000
126 ams_delta_latch1_reg &= ~mask; 130#define MODEM_PHYS 0x04000000
127 ams_delta_latch1_reg |= value; 131#define MODEM_VIRT 0xEB000000
128 *(volatile __u8 *) AMS_DELTA_LATCH1_VIRT = ams_delta_latch1_reg; 132#define LATCH2_PHYS 0x08000000
129} 133#define LATCH2_VIRT 0xEC000000
130
131void ams_delta_latch2_write(u16 mask, u16 value)
132{
133 ams_delta_latch2_reg &= ~mask;
134 ams_delta_latch2_reg |= value;
135 *(volatile __u16 *) AMS_DELTA_LATCH2_VIRT = ams_delta_latch2_reg;
136}
137 134
138static struct map_desc ams_delta_io_desc[] __initdata = { 135static struct map_desc ams_delta_io_desc[] __initdata = {
139 /* AMS_DELTA_LATCH1 */ 136 /* AMS_DELTA_LATCH1 */
140 { 137 {
141 .virtual = AMS_DELTA_LATCH1_VIRT, 138 .virtual = LATCH1_VIRT,
142 .pfn = __phys_to_pfn(AMS_DELTA_LATCH1_PHYS), 139 .pfn = __phys_to_pfn(LATCH1_PHYS),
143 .length = 0x01000000, 140 .length = 0x01000000,
144 .type = MT_DEVICE 141 .type = MT_DEVICE
145 }, 142 },
146 /* AMS_DELTA_LATCH2 */ 143 /* AMS_DELTA_LATCH2 */
147 { 144 {
148 .virtual = AMS_DELTA_LATCH2_VIRT, 145 .virtual = LATCH2_VIRT,
149 .pfn = __phys_to_pfn(AMS_DELTA_LATCH2_PHYS), 146 .pfn = __phys_to_pfn(LATCH2_PHYS),
150 .length = 0x01000000, 147 .length = 0x01000000,
151 .type = MT_DEVICE 148 .type = MT_DEVICE
152 }, 149 },
153 /* AMS_DELTA_MODEM */ 150 /* AMS_DELTA_MODEM */
154 { 151 {
155 .virtual = AMS_DELTA_MODEM_VIRT, 152 .virtual = MODEM_VIRT,
156 .pfn = __phys_to_pfn(AMS_DELTA_MODEM_PHYS), 153 .pfn = __phys_to_pfn(MODEM_PHYS),
157 .length = 0x01000000, 154 .length = 0x01000000,
158 .type = MT_DEVICE 155 .type = MT_DEVICE
159 } 156 }
160}; 157};
161 158
162static struct omap_lcd_config ams_delta_lcd_config = { 159static struct omap_lcd_config ams_delta_lcd_config __initdata = {
163 .ctrl_name = "internal", 160 .ctrl_name = "internal",
164}; 161};
165 162
166static struct omap_usb_config ams_delta_usb_config __initdata = { 163static struct omap_usb_config ams_delta_usb_config = {
167 .register_host = 1, 164 .register_host = 1,
168 .hmc_mode = 16, 165 .hmc_mode = 16,
169 .pins[0] = 2, 166 .pins[0] = 2,
170}; 167};
171 168
172static struct omap_board_config_kernel ams_delta_config[] __initdata = { 169#define LATCH1_GPIO_BASE 232
173 { OMAP_TAG_LCD, &ams_delta_lcd_config }, 170#define LATCH1_NGPIO 8
171
172static struct resource latch1_resources[] = {
173 [0] = {
174 .name = "dat",
175 .start = LATCH1_PHYS,
176 .end = LATCH1_PHYS + (LATCH1_NGPIO - 1) / 8,
177 .flags = IORESOURCE_MEM,
178 },
174}; 179};
175 180
181static struct bgpio_pdata latch1_pdata = {
182 .base = LATCH1_GPIO_BASE,
183 .ngpio = LATCH1_NGPIO,
184};
185
186static struct platform_device latch1_gpio_device = {
187 .name = "basic-mmio-gpio",
188 .id = 0,
189 .resource = latch1_resources,
190 .num_resources = ARRAY_SIZE(latch1_resources),
191 .dev = {
192 .platform_data = &latch1_pdata,
193 },
194};
195
196static struct resource latch2_resources[] = {
197 [0] = {
198 .name = "dat",
199 .start = LATCH2_PHYS,
200 .end = LATCH2_PHYS + (AMS_DELTA_LATCH2_NGPIO - 1) / 8,
201 .flags = IORESOURCE_MEM,
202 },
203};
204
205static struct bgpio_pdata latch2_pdata = {
206 .base = AMS_DELTA_LATCH2_GPIO_BASE,
207 .ngpio = AMS_DELTA_LATCH2_NGPIO,
208};
209
210static struct platform_device latch2_gpio_device = {
211 .name = "basic-mmio-gpio",
212 .id = 1,
213 .resource = latch2_resources,
214 .num_resources = ARRAY_SIZE(latch2_resources),
215 .dev = {
216 .platform_data = &latch2_pdata,
217 },
218};
219
220static const struct gpio latch_gpios[] __initconst = {
221 {
222 .gpio = LATCH1_GPIO_BASE + 6,
223 .flags = GPIOF_OUT_INIT_LOW,
224 .label = "dockit1",
225 },
226 {
227 .gpio = LATCH1_GPIO_BASE + 7,
228 .flags = GPIOF_OUT_INIT_LOW,
229 .label = "dockit2",
230 },
231 {
232 .gpio = AMS_DELTA_GPIO_PIN_SCARD_RSTIN,
233 .flags = GPIOF_OUT_INIT_LOW,
234 .label = "scard_rstin",
235 },
236 {
237 .gpio = AMS_DELTA_GPIO_PIN_SCARD_CMDVCC,
238 .flags = GPIOF_OUT_INIT_LOW,
239 .label = "scard_cmdvcc",
240 },
241 {
242 .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC,
243 .flags = GPIOF_OUT_INIT_LOW,
244 .label = "modem_codec",
245 },
246 {
247 .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 14,
248 .flags = GPIOF_OUT_INIT_LOW,
249 .label = "hookflash1",
250 },
251 {
252 .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 15,
253 .flags = GPIOF_OUT_INIT_LOW,
254 .label = "hookflash2",
255 },
256};
257
258static struct regulator_consumer_supply modem_nreset_consumers[] = {
259 REGULATOR_SUPPLY("RESET#", "serial8250.1"),
260 REGULATOR_SUPPLY("POR", "cx20442-codec"),
261};
262
263static struct regulator_init_data modem_nreset_data = {
264 .constraints = {
265 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
266 .boot_on = 1,
267 },
268 .num_consumer_supplies = ARRAY_SIZE(modem_nreset_consumers),
269 .consumer_supplies = modem_nreset_consumers,
270};
271
272static struct fixed_voltage_config modem_nreset_config = {
273 .supply_name = "modem_nreset",
274 .microvolts = 3300000,
275 .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET,
276 .startup_delay = 25000,
277 .enable_high = 1,
278 .enabled_at_boot = 1,
279 .init_data = &modem_nreset_data,
280};
281
282static struct platform_device modem_nreset_device = {
283 .name = "reg-fixed-voltage",
284 .id = -1,
285 .dev = {
286 .platform_data = &modem_nreset_config,
287 },
288};
289
290struct modem_private_data {
291 struct regulator *regulator;
292};
293
294static struct modem_private_data modem_priv;
295
296void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value)
297{
298 int bit = 0;
299 u16 bitpos = 1 << bit;
300
301 for (; bit < ngpio; bit++, bitpos = bitpos << 1) {
302 if (!(mask & bitpos))
303 continue;
304 else
305 gpio_set_value(base + bit, (value & bitpos) != 0);
306 }
307}
308EXPORT_SYMBOL(ams_delta_latch_write);
309
176static struct resource ams_delta_nand_resources[] = { 310static struct resource ams_delta_nand_resources[] = {
177 [0] = { 311 [0] = {
178 .start = OMAP1_MPUIO_BASE, 312 .start = OMAP1_MPUIO_BASE,
@@ -202,7 +336,7 @@ static const struct matrix_keymap_data ams_delta_keymap_data = {
202 .keymap_size = ARRAY_SIZE(ams_delta_keymap), 336 .keymap_size = ARRAY_SIZE(ams_delta_keymap),
203}; 337};
204 338
205static struct omap_kp_platform_data ams_delta_kp_data __initdata = { 339static struct omap_kp_platform_data ams_delta_kp_data = {
206 .rows = 8, 340 .rows = 8,
207 .cols = 8, 341 .cols = 8,
208 .keymap_data = &ams_delta_keymap_data, 342 .keymap_data = &ams_delta_keymap_data,
@@ -224,9 +358,45 @@ static struct platform_device ams_delta_lcd_device = {
224 .id = -1, 358 .id = -1,
225}; 359};
226 360
227static struct platform_device ams_delta_led_device = { 361static const struct gpio_led gpio_leds[] __initconst = {
228 .name = "ams-delta-led", 362 {
229 .id = -1 363 .name = "camera",
364 .gpio = LATCH1_GPIO_BASE + 0,
365 .default_state = LEDS_GPIO_DEFSTATE_OFF,
366#ifdef CONFIG_LEDS_TRIGGERS
367 .default_trigger = "ams_delta_camera",
368#endif
369 },
370 {
371 .name = "advert",
372 .gpio = LATCH1_GPIO_BASE + 1,
373 .default_state = LEDS_GPIO_DEFSTATE_OFF,
374 },
375 {
376 .name = "email",
377 .gpio = LATCH1_GPIO_BASE + 2,
378 .default_state = LEDS_GPIO_DEFSTATE_OFF,
379 },
380 {
381 .name = "handsfree",
382 .gpio = LATCH1_GPIO_BASE + 3,
383 .default_state = LEDS_GPIO_DEFSTATE_OFF,
384 },
385 {
386 .name = "voicemail",
387 .gpio = LATCH1_GPIO_BASE + 4,
388 .default_state = LEDS_GPIO_DEFSTATE_OFF,
389 },
390 {
391 .name = "voice",
392 .gpio = LATCH1_GPIO_BASE + 5,
393 .default_state = LEDS_GPIO_DEFSTATE_OFF,
394 },
395};
396
397static const struct gpio_led_platform_data leds_pdata __initconst = {
398 .leds = gpio_leds,
399 .num_leds = ARRAY_SIZE(gpio_leds),
230}; 400};
231 401
232static struct i2c_board_info ams_delta_camera_board_info[] = { 402static struct i2c_board_info ams_delta_camera_board_info[] = {
@@ -275,13 +445,17 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
275}; 445};
276 446
277static struct platform_device *ams_delta_devices[] __initdata = { 447static struct platform_device *ams_delta_devices[] __initdata = {
278 &ams_delta_nand_device, 448 &latch1_gpio_device,
449 &latch2_gpio_device,
279 &ams_delta_kp_device, 450 &ams_delta_kp_device,
280 &ams_delta_lcd_device,
281 &ams_delta_led_device,
282 &ams_delta_camera_device, 451 &ams_delta_camera_device,
283}; 452};
284 453
454static struct platform_device *late_devices[] __initdata = {
455 &ams_delta_nand_device,
456 &ams_delta_lcd_device,
457};
458
285static void __init ams_delta_init(void) 459static void __init ams_delta_init(void)
286{ 460{
287 /* mux pins for uarts */ 461 /* mux pins for uarts */
@@ -302,37 +476,53 @@ static void __init ams_delta_init(void)
302 omap_cfg_reg(J19_1610_CAM_D6); 476 omap_cfg_reg(J19_1610_CAM_D6);
303 omap_cfg_reg(J18_1610_CAM_D7); 477 omap_cfg_reg(J18_1610_CAM_D7);
304 478
305 omap_board_config = ams_delta_config;
306 omap_board_config_size = ARRAY_SIZE(ams_delta_config);
307 omap_serial_init(); 479 omap_serial_init();
308 omap_register_i2c_bus(1, 100, NULL, 0); 480 omap_register_i2c_bus(1, 100, NULL, 0);
309 481
310 /* Clear latch2 (NAND, LCD, modem enable) */
311 ams_delta_latch2_write(~0, 0);
312
313 omap1_usb_init(&ams_delta_usb_config); 482 omap1_usb_init(&ams_delta_usb_config);
314 omap1_set_camera_info(&ams_delta_camera_platform_data); 483 omap1_set_camera_info(&ams_delta_camera_platform_data);
315#ifdef CONFIG_LEDS_TRIGGERS 484#ifdef CONFIG_LEDS_TRIGGERS
316 led_trigger_register_simple("ams_delta_camera", 485 led_trigger_register_simple("ams_delta_camera",
317 &ams_delta_camera_led_trigger); 486 &ams_delta_camera_led_trigger);
318#endif 487#endif
488 gpio_led_register_device(-1, &leds_pdata);
319 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); 489 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
320 490
321 ams_delta_init_fiq(); 491 ams_delta_init_fiq();
322 492
323 omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1); 493 omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
494
495 omapfb_set_lcd_config(&ams_delta_lcd_config);
496}
497
498static void modem_pm(struct uart_port *port, unsigned int state, unsigned old)
499{
500 struct modem_private_data *priv = port->private_data;
501
502 if (IS_ERR(priv->regulator))
503 return;
504
505 if (state == old)
506 return;
507
508 if (state == 0)
509 regulator_enable(priv->regulator);
510 else if (old == 0)
511 regulator_disable(priv->regulator);
324} 512}
325 513
326static struct plat_serial8250_port ams_delta_modem_ports[] = { 514static struct plat_serial8250_port ams_delta_modem_ports[] = {
327 { 515 {
328 .membase = IOMEM(AMS_DELTA_MODEM_VIRT), 516 .membase = IOMEM(MODEM_VIRT),
329 .mapbase = AMS_DELTA_MODEM_PHYS, 517 .mapbase = MODEM_PHYS,
330 .irq = -EINVAL, /* changed later */ 518 .irq = -EINVAL, /* changed later */
331 .flags = UPF_BOOT_AUTOCONF, 519 .flags = UPF_BOOT_AUTOCONF,
332 .irqflags = IRQF_TRIGGER_RISING, 520 .irqflags = IRQF_TRIGGER_RISING,
333 .iotype = UPIO_MEM, 521 .iotype = UPIO_MEM,
334 .regshift = 1, 522 .regshift = 1,
335 .uartclk = BASE_BAUD * 16, 523 .uartclk = BASE_BAUD * 16,
524 .pm = modem_pm,
525 .private_data = &modem_priv,
336 }, 526 },
337 { }, 527 { },
338}; 528};
@@ -345,13 +535,27 @@ static struct platform_device ams_delta_modem_device = {
345 }, 535 },
346}; 536};
347 537
348static int __init ams_delta_modem_init(void) 538static int __init late_init(void)
349{ 539{
350 int err; 540 int err;
351 541
352 if (!machine_is_ams_delta()) 542 if (!machine_is_ams_delta())
353 return -ENODEV; 543 return -ENODEV;
354 544
545 err = gpio_request_array(latch_gpios, ARRAY_SIZE(latch_gpios));
546 if (err) {
547 pr_err("Couldn't take over latch1/latch2 GPIO pins\n");
548 return err;
549 }
550
551 platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
552
553 err = platform_device_register(&modem_nreset_device);
554 if (err) {
555 pr_err("Couldn't register the modem regulator device\n");
556 return err;
557 }
558
355 omap_cfg_reg(M14_1510_GPIO2); 559 omap_cfg_reg(M14_1510_GPIO2);
356 ams_delta_modem_ports[0].irq = 560 ams_delta_modem_ports[0].irq =
357 gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); 561 gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
@@ -363,13 +567,35 @@ static int __init ams_delta_modem_init(void)
363 } 567 }
364 gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); 568 gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
365 569
366 ams_delta_latch2_write( 570 /* Initialize the modem_nreset regulator consumer before use */
367 AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC, 571 modem_priv.regulator = ERR_PTR(-ENODEV);
368 AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC); 572
573 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
574 AMS_DELTA_LATCH2_MODEM_CODEC);
369 575
370 return platform_device_register(&ams_delta_modem_device); 576 err = platform_device_register(&ams_delta_modem_device);
577 if (err)
578 goto gpio_free;
579
580 /*
581 * Once the modem device is registered, the modem_nreset
582 * regulator can be requested on behalf of that device.
583 */
584 modem_priv.regulator = regulator_get(&ams_delta_modem_device.dev,
585 "RESET#");
586 if (IS_ERR(modem_priv.regulator)) {
587 err = PTR_ERR(modem_priv.regulator);
588 goto unregister;
589 }
590 return 0;
591
592unregister:
593 platform_device_unregister(&ams_delta_modem_device);
594gpio_free:
595 gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
596 return err;
371} 597}
372arch_initcall(ams_delta_modem_init); 598late_initcall(late_init);
373 599
374static void __init ams_delta_map_io(void) 600static void __init ams_delta_map_io(void)
375{ 601{
@@ -388,6 +614,3 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
388 .timer = &omap1_timer, 614 .timer = &omap1_timer,
389 .restart = omap1_restart, 615 .restart = omap1_restart,
390MACHINE_END 616MACHINE_END
391
392EXPORT_SYMBOL(ams_delta_latch1_write);
393EXPORT_SYMBOL(ams_delta_latch2_write);
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 0b9464b4121..80bd43c7f4e 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -21,8 +21,8 @@
21#include <linux/mtd/physmap.h> 21#include <linux/mtd/physmap.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/smc91x.h> 23#include <linux/smc91x.h>
24#include <linux/omapfb.h>
24 25
25#include <mach/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
@@ -32,9 +32,13 @@
32#include <plat/flash.h> 32#include <plat/flash.h>
33#include <plat/fpga.h> 33#include <plat/fpga.h>
34#include <plat/keypad.h> 34#include <plat/keypad.h>
35#include "common.h"
36#include <plat/board.h> 35#include <plat/board.h>
37 36
37#include <mach/hardware.h>
38
39#include "iomap.h"
40#include "common.h"
41
38/* fsample is pretty close to p2-sample */ 42/* fsample is pretty close to p2-sample */
39 43
40#define fsample_cpld_read(reg) __raw_readb(reg) 44#define fsample_cpld_read(reg) __raw_readb(reg)
@@ -273,27 +277,17 @@ static struct platform_device kp_device = {
273 .resource = kp_resources, 277 .resource = kp_resources,
274}; 278};
275 279
276static struct platform_device lcd_device = {
277 .name = "lcd_p2",
278 .id = -1,
279};
280
281static struct platform_device *devices[] __initdata = { 280static struct platform_device *devices[] __initdata = {
282 &nor_device, 281 &nor_device,
283 &nand_device, 282 &nand_device,
284 &smc91x_device, 283 &smc91x_device,
285 &kp_device, 284 &kp_device,
286 &lcd_device,
287}; 285};
288 286
289static struct omap_lcd_config fsample_lcd_config = { 287static struct omap_lcd_config fsample_lcd_config = {
290 .ctrl_name = "internal", 288 .ctrl_name = "internal",
291}; 289};
292 290
293static struct omap_board_config_kernel fsample_config[] __initdata = {
294 { OMAP_TAG_LCD, &fsample_lcd_config },
295};
296
297static void __init omap_fsample_init(void) 291static void __init omap_fsample_init(void)
298{ 292{
299 /* Early, board-dependent init */ 293 /* Early, board-dependent init */
@@ -352,10 +346,10 @@ static void __init omap_fsample_init(void)
352 346
353 platform_add_devices(devices, ARRAY_SIZE(devices)); 347 platform_add_devices(devices, ARRAY_SIZE(devices));
354 348
355 omap_board_config = fsample_config;
356 omap_board_config_size = ARRAY_SIZE(fsample_config);
357 omap_serial_init(); 349 omap_serial_init();
358 omap_register_i2c_bus(1, 100, NULL, 0); 350 omap_register_i2c_bus(1, 100, NULL, 0);
351
352 omapfb_set_lcd_config(&fsample_lcd_config);
359} 353}
360 354
361/* Only FPGA needs to be mapped here. All others are done with ioremap */ 355/* Only FPGA needs to be mapped here. All others are done with ioremap */
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 00ad6b22d60..c3068622fdc 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -30,8 +30,7 @@
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/i2c/tps65010.h> 31#include <linux/i2c/tps65010.h>
32#include <linux/smc91x.h> 32#include <linux/smc91x.h>
33 33#include <linux/omapfb.h>
34#include <mach/hardware.h>
35 34
36#include <asm/mach-types.h> 35#include <asm/mach-types.h>
37#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
@@ -43,9 +42,11 @@
43#include <plat/irda.h> 42#include <plat/irda.h>
44#include <plat/usb.h> 43#include <plat/usb.h>
45#include <plat/keypad.h> 44#include <plat/keypad.h>
46#include "common.h"
47#include <plat/flash.h> 45#include <plat/flash.h>
48 46
47#include <mach/hardware.h>
48
49#include "common.h"
49#include "board-h2.h" 50#include "board-h2.h"
50 51
51/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 52/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
@@ -325,18 +326,12 @@ static struct platform_device h2_irda_device = {
325 .resource = h2_irda_resources, 326 .resource = h2_irda_resources,
326}; 327};
327 328
328static struct platform_device h2_lcd_device = {
329 .name = "lcd_h2",
330 .id = -1,
331};
332
333static struct platform_device *h2_devices[] __initdata = { 329static struct platform_device *h2_devices[] __initdata = {
334 &h2_nor_device, 330 &h2_nor_device,
335 &h2_nand_device, 331 &h2_nand_device,
336 &h2_smc91x_device, 332 &h2_smc91x_device,
337 &h2_irda_device, 333 &h2_irda_device,
338 &h2_kp_device, 334 &h2_kp_device,
339 &h2_lcd_device,
340}; 335};
341 336
342static void __init h2_init_smc91x(void) 337static void __init h2_init_smc91x(void)
@@ -391,10 +386,6 @@ static struct omap_lcd_config h2_lcd_config __initdata = {
391 .ctrl_name = "internal", 386 .ctrl_name = "internal",
392}; 387};
393 388
394static struct omap_board_config_kernel h2_config[] __initdata = {
395 { OMAP_TAG_LCD, &h2_lcd_config },
396};
397
398static void __init h2_init(void) 389static void __init h2_init(void)
399{ 390{
400 h2_init_smc91x(); 391 h2_init_smc91x();
@@ -438,13 +429,13 @@ static void __init h2_init(void)
438 omap_cfg_reg(N19_1610_KBR5); 429 omap_cfg_reg(N19_1610_KBR5);
439 430
440 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); 431 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
441 omap_board_config = h2_config;
442 omap_board_config_size = ARRAY_SIZE(h2_config);
443 omap_serial_init(); 432 omap_serial_init();
444 omap_register_i2c_bus(1, 100, h2_i2c_board_info, 433 omap_register_i2c_bus(1, 100, h2_i2c_board_info,
445 ARRAY_SIZE(h2_i2c_board_info)); 434 ARRAY_SIZE(h2_i2c_board_info));
446 omap1_usb_init(&h2_usb_config); 435 omap1_usb_init(&h2_usb_config);
447 h2_mmc_init(); 436 h2_mmc_init();
437
438 omapfb_set_lcd_config(&h2_lcd_config);
448} 439}
449 440
450MACHINE_START(OMAP_H2, "TI-H2") 441MACHINE_START(OMAP_H2, "TI-H2")
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 4a7f2514970..64b8584f64c 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -30,24 +30,25 @@
30#include <linux/spi/spi.h> 30#include <linux/spi/spi.h>
31#include <linux/i2c/tps65010.h> 31#include <linux/i2c/tps65010.h>
32#include <linux/smc91x.h> 32#include <linux/smc91x.h>
33#include <linux/omapfb.h>
33 34
34#include <asm/setup.h> 35#include <asm/setup.h>
35#include <asm/page.h> 36#include <asm/page.h>
36#include <mach/hardware.h>
37
38#include <asm/mach-types.h> 37#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
40#include <asm/mach/map.h> 39#include <asm/mach/map.h>
41 40
42#include <mach/irqs.h>
43#include <plat/mux.h> 41#include <plat/mux.h>
44#include <plat/tc.h> 42#include <plat/tc.h>
45#include <plat/usb.h> 43#include <plat/usb.h>
46#include <plat/keypad.h> 44#include <plat/keypad.h>
47#include <plat/dma.h> 45#include <plat/dma.h>
48#include "common.h"
49#include <plat/flash.h> 46#include <plat/flash.h>
50 47
48#include <mach/hardware.h>
49#include <mach/irqs.h>
50
51#include "common.h"
51#include "board-h3.h" 52#include "board-h3.h"
52 53
53/* In OMAP1710 H3 the Ethernet is directly connected to CS1 */ 54/* In OMAP1710 H3 the Ethernet is directly connected to CS1 */
@@ -370,10 +371,6 @@ static struct omap_lcd_config h3_lcd_config __initdata = {
370 .ctrl_name = "internal", 371 .ctrl_name = "internal",
371}; 372};
372 373
373static struct omap_board_config_kernel h3_config[] __initdata = {
374 { OMAP_TAG_LCD, &h3_lcd_config },
375};
376
377static struct i2c_board_info __initdata h3_i2c_board_info[] = { 374static struct i2c_board_info __initdata h3_i2c_board_info[] = {
378 { 375 {
379 I2C_BOARD_INFO("tps65013", 0x48), 376 I2C_BOARD_INFO("tps65013", 0x48),
@@ -426,13 +423,13 @@ static void __init h3_init(void)
426 platform_add_devices(devices, ARRAY_SIZE(devices)); 423 platform_add_devices(devices, ARRAY_SIZE(devices));
427 spi_register_board_info(h3_spi_board_info, 424 spi_register_board_info(h3_spi_board_info,
428 ARRAY_SIZE(h3_spi_board_info)); 425 ARRAY_SIZE(h3_spi_board_info));
429 omap_board_config = h3_config;
430 omap_board_config_size = ARRAY_SIZE(h3_config);
431 omap_serial_init(); 426 omap_serial_init();
432 omap_register_i2c_bus(1, 100, h3_i2c_board_info, 427 omap_register_i2c_bus(1, 100, h3_i2c_board_info,
433 ARRAY_SIZE(h3_i2c_board_info)); 428 ARRAY_SIZE(h3_i2c_board_info));
434 omap1_usb_init(&h3_usb_config); 429 omap1_usb_init(&h3_usb_config);
435 h3_mmc_init(); 430 h3_mmc_init();
431
432 omapfb_set_lcd_config(&h3_lcd_config);
436} 433}
437 434
438MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") 435MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 731cc3db7ab..827d83a96af 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -27,7 +27,7 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/io.h> 30#include <linux/delay.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/gpio_keys.h> 32#include <linux/gpio_keys.h>
33#include <linux/i2c.h> 33#include <linux/i2c.h>
@@ -36,12 +36,12 @@
36#include <linux/leds.h> 36#include <linux/leds.h>
37#include <linux/spi/spi.h> 37#include <linux/spi/spi.h>
38#include <linux/spi/ads7846.h> 38#include <linux/spi/ads7846.h>
39#include <linux/omapfb.h>
39 40
40#include <asm/mach-types.h> 41#include <asm/mach-types.h>
41#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
42 43
43#include <plat/omap7xx.h> 44#include <plat/omap7xx.h>
44#include "common.h"
45#include <plat/board.h> 45#include <plat/board.h>
46#include <plat/keypad.h> 46#include <plat/keypad.h>
47#include <plat/usb.h> 47#include <plat/usb.h>
@@ -49,7 +49,7 @@
49 49
50#include <mach/irqs.h> 50#include <mach/irqs.h>
51 51
52#include <linux/delay.h> 52#include "common.h"
53 53
54/* LCD register definition */ 54/* LCD register definition */
55#define OMAP_LCDC_CONTROL (0xfffec000 + 0x00) 55#define OMAP_LCDC_CONTROL (0xfffec000 + 0x00)
@@ -398,10 +398,6 @@ static struct omap_lcd_config htcherald_lcd_config __initdata = {
398 .ctrl_name = "internal", 398 .ctrl_name = "internal",
399}; 399};
400 400
401static struct omap_board_config_kernel htcherald_config[] __initdata = {
402 { OMAP_TAG_LCD, &htcherald_lcd_config },
403};
404
405static struct platform_device lcd_device = { 401static struct platform_device lcd_device = {
406 .name = "lcd_htcherald", 402 .name = "lcd_htcherald",
407 .id = -1, 403 .id = -1,
@@ -580,8 +576,6 @@ static void __init htcherald_init(void)
580 printk(KERN_INFO "HTC Herald init.\n"); 576 printk(KERN_INFO "HTC Herald init.\n");
581 577
582 /* Do board initialization before we register all the devices */ 578 /* Do board initialization before we register all the devices */
583 omap_board_config = htcherald_config;
584 omap_board_config_size = ARRAY_SIZE(htcherald_config);
585 platform_add_devices(devices, ARRAY_SIZE(devices)); 579 platform_add_devices(devices, ARRAY_SIZE(devices));
586 580
587 htcherald_disable_watchdog(); 581 htcherald_disable_watchdog();
@@ -598,6 +592,8 @@ static void __init htcherald_init(void)
598 htc_mmc_data[0] = &htc_mmc1_data; 592 htc_mmc_data[0] = &htc_mmc1_data;
599 omap1_init_mmc(htc_mmc_data, 1); 593 omap1_init_mmc(htc_mmc_data, 1);
600#endif 594#endif
595
596 omapfb_set_lcd_config(&htcherald_lcd_config);
601} 597}
602 598
603MACHINE_START(HERALD, "HTC Herald") 599MACHINE_START(HERALD, "HTC Herald")
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index be2002f42de..61219182d16 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -25,8 +25,8 @@
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/smc91x.h> 27#include <linux/smc91x.h>
28#include <linux/omapfb.h>
28 29
29#include <mach/hardware.h>
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#include <asm/mach/map.h> 32#include <asm/mach/map.h>
@@ -37,9 +37,13 @@
37#include <plat/tc.h> 37#include <plat/tc.h>
38#include <plat/usb.h> 38#include <plat/usb.h>
39#include <plat/keypad.h> 39#include <plat/keypad.h>
40#include "common.h"
41#include <plat/mmc.h> 40#include <plat/mmc.h>
42 41
42#include <mach/hardware.h>
43
44#include "iomap.h"
45#include "common.h"
46
43/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 47/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
44#define INNOVATOR1610_ETHR_START 0x04000300 48#define INNOVATOR1610_ETHR_START 0x04000300
45 49
@@ -370,10 +374,6 @@ static inline void innovator_mmc_init(void)
370} 374}
371#endif 375#endif
372 376
373static struct omap_board_config_kernel innovator_config[] = {
374 { OMAP_TAG_LCD, NULL },
375};
376
377static void __init innovator_init(void) 377static void __init innovator_init(void)
378{ 378{
379 if (cpu_is_omap1510()) 379 if (cpu_is_omap1510())
@@ -416,17 +416,15 @@ static void __init innovator_init(void)
416#ifdef CONFIG_ARCH_OMAP15XX 416#ifdef CONFIG_ARCH_OMAP15XX
417 if (cpu_is_omap1510()) { 417 if (cpu_is_omap1510()) {
418 omap1_usb_init(&innovator1510_usb_config); 418 omap1_usb_init(&innovator1510_usb_config);
419 innovator_config[0].data = &innovator1510_lcd_config; 419 omapfb_set_lcd_config(&innovator1510_lcd_config);
420 } 420 }
421#endif 421#endif
422#ifdef CONFIG_ARCH_OMAP16XX 422#ifdef CONFIG_ARCH_OMAP16XX
423 if (cpu_is_omap1610()) { 423 if (cpu_is_omap1610()) {
424 omap1_usb_init(&h2_usb_config); 424 omap1_usb_init(&h2_usb_config);
425 innovator_config[0].data = &innovator1610_lcd_config; 425 omapfb_set_lcd_config(&innovator1610_lcd_config);
426 } 426 }
427#endif 427#endif
428 omap_board_config = innovator_config;
429 omap_board_config_size = ARRAY_SIZE(innovator_config);
430 omap_serial_init(); 428 omap_serial_init();
431 omap_register_i2c_bus(1, 100, NULL, 0); 429 omap_register_i2c_bus(1, 100, NULL, 0);
432 innovator_mmc_init(); 430 innovator_mmc_init();
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index f9efc036ba9..fe95ec5f6f0 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -21,7 +21,6 @@
21#include <linux/workqueue.h> 21#include <linux/workqueue.h>
22#include <linux/delay.h> 22#include <linux/delay.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/map.h> 26#include <asm/mach/map.h>
@@ -30,12 +29,14 @@
30#include <plat/usb.h> 29#include <plat/usb.h>
31#include <plat/board.h> 30#include <plat/board.h>
32#include <plat/keypad.h> 31#include <plat/keypad.h>
33#include "common.h"
34#include <plat/hwa742.h>
35#include <plat/lcd_mipid.h> 32#include <plat/lcd_mipid.h>
36#include <plat/mmc.h> 33#include <plat/mmc.h>
37#include <plat/clock.h> 34#include <plat/clock.h>
38 35
36#include <mach/hardware.h>
37
38#include "common.h"
39
39#define ADS7846_PENDOWN_GPIO 15 40#define ADS7846_PENDOWN_GPIO 15
40 41
41static const unsigned int nokia770_keymap[] = { 42static const unsigned int nokia770_keymap[] = {
@@ -99,15 +100,16 @@ static struct mipid_platform_data nokia770_mipid_platform_data = {
99 .shutdown = mipid_shutdown, 100 .shutdown = mipid_shutdown,
100}; 101};
101 102
103static struct omap_lcd_config nokia770_lcd_config __initdata = {
104 .ctrl_name = "hwa742",
105};
106
102static void __init mipid_dev_init(void) 107static void __init mipid_dev_init(void)
103{ 108{
104 const struct omap_lcd_config *conf; 109 nokia770_mipid_platform_data.nreset_gpio = 13;
110 nokia770_mipid_platform_data.data_lines = 16;
105 111
106 conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config); 112 omapfb_set_lcd_config(&nokia770_lcd_config);
107 if (conf != NULL) {
108 nokia770_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
109 nokia770_mipid_platform_data.data_lines = conf->data_lines;
110 }
111} 113}
112 114
113static void __init ads7846_dev_init(void) 115static void __init ads7846_dev_init(void)
@@ -150,14 +152,9 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = {
150 }, 152 },
151}; 153};
152 154
153static struct hwa742_platform_data nokia770_hwa742_platform_data = {
154 .te_connected = 1,
155};
156
157static void __init hwa742_dev_init(void) 155static void __init hwa742_dev_init(void)
158{ 156{
159 clk_add_alias("hwa_sys_ck", NULL, "bclk", NULL); 157 clk_add_alias("hwa_sys_ck", NULL, "bclk", NULL);
160 omapfb_set_ctrl_platform_data(&nokia770_hwa742_platform_data);
161} 158}
162 159
163/* assume no Mini-AB port */ 160/* assume no Mini-AB port */
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 675de06557a..1fe347396f4 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -34,15 +34,12 @@
34#include <linux/i2c.h> 34#include <linux/i2c.h>
35#include <linux/leds.h> 35#include <linux/leds.h>
36#include <linux/smc91x.h> 36#include <linux/smc91x.h>
37 37#include <linux/omapfb.h>
38#include <linux/mtd/mtd.h> 38#include <linux/mtd/mtd.h>
39#include <linux/mtd/partitions.h> 39#include <linux/mtd/partitions.h>
40#include <linux/mtd/physmap.h> 40#include <linux/mtd/physmap.h>
41
42#include <linux/i2c/tps65010.h> 41#include <linux/i2c/tps65010.h>
43 42
44#include <mach/hardware.h>
45
46#include <asm/mach-types.h> 43#include <asm/mach-types.h>
47#include <asm/mach/arch.h> 44#include <asm/mach/arch.h>
48#include <asm/mach/map.h> 45#include <asm/mach/map.h>
@@ -51,6 +48,9 @@
51#include <plat/usb.h> 48#include <plat/usb.h>
52#include <plat/mux.h> 49#include <plat/mux.h>
53#include <plat/tc.h> 50#include <plat/tc.h>
51
52#include <mach/hardware.h>
53
54#include "common.h" 54#include "common.h"
55 55
56/* At OMAP5912 OSK the Ethernet is directly connected to CS1 */ 56/* At OMAP5912 OSK the Ethernet is directly connected to CS1 */
@@ -300,12 +300,6 @@ static struct omap_lcd_config osk_lcd_config __initdata = {
300}; 300};
301#endif 301#endif
302 302
303static struct omap_board_config_kernel osk_config[] __initdata = {
304#ifdef CONFIG_OMAP_OSK_MISTRAL
305 { OMAP_TAG_LCD, &osk_lcd_config },
306#endif
307};
308
309#ifdef CONFIG_OMAP_OSK_MISTRAL 303#ifdef CONFIG_OMAP_OSK_MISTRAL
310 304
311#include <linux/input.h> 305#include <linux/input.h>
@@ -549,8 +543,6 @@ static void __init osk_init(void)
549 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); 543 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
550 osk_flash_resource.end += SZ_32M - 1; 544 osk_flash_resource.end += SZ_32M - 1;
551 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); 545 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
552 omap_board_config = osk_config;
553 omap_board_config_size = ARRAY_SIZE(osk_config);
554 546
555 l = omap_readl(USB_TRANSCEIVER_CTRL); 547 l = omap_readl(USB_TRANSCEIVER_CTRL);
556 l |= (3 << 1); 548 l |= (3 << 1);
@@ -567,6 +559,11 @@ static void __init osk_init(void)
567 omap_register_i2c_bus(1, 400, osk_i2c_board_info, 559 omap_register_i2c_bus(1, 400, osk_i2c_board_info,
568 ARRAY_SIZE(osk_i2c_board_info)); 560 ARRAY_SIZE(osk_i2c_board_info));
569 osk_mistral_init(); 561 osk_mistral_init();
562
563#ifdef CONFIG_OMAP_OSK_MISTRAL
564 omapfb_set_lcd_config(&osk_lcd_config);
565#endif
566
570} 567}
571 568
572MACHINE_START(OMAP_OSK, "TI-OSK") 569MACHINE_START(OMAP_OSK, "TI-OSK")
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 81fa27f8836..0863d8e2bdf 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -27,8 +27,8 @@
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/apm-emulation.h> 29#include <linux/apm-emulation.h>
30#include <linux/omapfb.h>
30 31
31#include <mach/hardware.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
@@ -41,6 +41,9 @@
41#include <plat/board.h> 41#include <plat/board.h>
42#include <plat/irda.h> 42#include <plat/irda.h>
43#include <plat/keypad.h> 43#include <plat/keypad.h>
44
45#include <mach/hardware.h>
46
44#include "common.h" 47#include "common.h"
45 48
46#define PALMTE_USBDETECT_GPIO 0 49#define PALMTE_USBDETECT_GPIO 0
@@ -209,10 +212,6 @@ static struct omap_lcd_config palmte_lcd_config __initdata = {
209 .ctrl_name = "internal", 212 .ctrl_name = "internal",
210}; 213};
211 214
212static struct omap_board_config_kernel palmte_config[] __initdata = {
213 { OMAP_TAG_LCD, &palmte_lcd_config },
214};
215
216static struct spi_board_info palmte_spi_info[] __initdata = { 215static struct spi_board_info palmte_spi_info[] __initdata = {
217 { 216 {
218 .modalias = "tsc2102", 217 .modalias = "tsc2102",
@@ -250,9 +249,6 @@ static void __init omap_palmte_init(void)
250 omap_cfg_reg(UART3_TX); 249 omap_cfg_reg(UART3_TX);
251 omap_cfg_reg(UART3_RX); 250 omap_cfg_reg(UART3_RX);
252 251
253 omap_board_config = palmte_config;
254 omap_board_config_size = ARRAY_SIZE(palmte_config);
255
256 platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices)); 252 platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices));
257 253
258 spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info)); 254 spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
@@ -260,6 +256,8 @@ static void __init omap_palmte_init(void)
260 omap_serial_init(); 256 omap_serial_init();
261 omap1_usb_init(&palmte_usb_config); 257 omap1_usb_init(&palmte_usb_config);
262 omap_register_i2c_bus(1, 100, NULL, 0); 258 omap_register_i2c_bus(1, 100, NULL, 0);
259
260 omapfb_set_lcd_config(&palmte_lcd_config);
263} 261}
264 262
265MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E") 263MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 81cb8217838..4ff699c509c 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -24,8 +24,10 @@
24#include <linux/mtd/partitions.h> 24#include <linux/mtd/partitions.h>
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <linux/leds.h> 26#include <linux/leds.h>
27#include <linux/omapfb.h>
28#include <linux/spi/spi.h>
29#include <linux/spi/ads7846.h>
27 30
28#include <mach/hardware.h>
29#include <asm/mach-types.h> 31#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 33#include <asm/mach/map.h>
@@ -39,10 +41,10 @@
39#include <plat/board.h> 41#include <plat/board.h>
40#include <plat/irda.h> 42#include <plat/irda.h>
41#include <plat/keypad.h> 43#include <plat/keypad.h>
42#include "common.h"
43 44
44#include <linux/spi/spi.h> 45#include <mach/hardware.h>
45#include <linux/spi/ads7846.h> 46
47#include "common.h"
46 48
47#define PALMTT_USBDETECT_GPIO 0 49#define PALMTT_USBDETECT_GPIO 0
48#define PALMTT_CABLE_GPIO 1 50#define PALMTT_CABLE_GPIO 1
@@ -273,10 +275,6 @@ static struct omap_lcd_config palmtt_lcd_config __initdata = {
273 .ctrl_name = "internal", 275 .ctrl_name = "internal",
274}; 276};
275 277
276static struct omap_board_config_kernel palmtt_config[] __initdata = {
277 { OMAP_TAG_LCD, &palmtt_lcd_config },
278};
279
280static void __init omap_mpu_wdt_mode(int mode) { 278static void __init omap_mpu_wdt_mode(int mode) {
281 if (mode) 279 if (mode)
282 omap_writew(0x8000, OMAP_WDT_TIMER_MODE); 280 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
@@ -298,15 +296,14 @@ static void __init omap_palmtt_init(void)
298 296
299 omap_mpu_wdt_mode(0); 297 omap_mpu_wdt_mode(0);
300 298
301 omap_board_config = palmtt_config;
302 omap_board_config_size = ARRAY_SIZE(palmtt_config);
303
304 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices)); 299 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));
305 300
306 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo)); 301 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
307 omap_serial_init(); 302 omap_serial_init();
308 omap1_usb_init(&palmtt_usb_config); 303 omap1_usb_init(&palmtt_usb_config);
309 omap_register_i2c_bus(1, 100, NULL, 0); 304 omap_register_i2c_bus(1, 100, NULL, 0);
305
306 omapfb_set_lcd_config(&palmtt_lcd_config);
310} 307}
311 308
312MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T") 309MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index e881945ce8e..abcbbd339ae 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -27,8 +27,10 @@
27#include <linux/mtd/mtd.h> 27#include <linux/mtd/mtd.h>
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/mtd/physmap.h> 29#include <linux/mtd/physmap.h>
30#include <linux/omapfb.h>
31#include <linux/spi/spi.h>
32#include <linux/spi/ads7846.h>
30 33
31#include <mach/hardware.h>
32#include <asm/mach-types.h> 34#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 36#include <asm/mach/map.h>
@@ -41,10 +43,10 @@
41#include <plat/board.h> 43#include <plat/board.h>
42#include <plat/irda.h> 44#include <plat/irda.h>
43#include <plat/keypad.h> 45#include <plat/keypad.h>
44#include "common.h"
45 46
46#include <linux/spi/spi.h> 47#include <mach/hardware.h>
47#include <linux/spi/ads7846.h> 48
49#include "common.h"
48 50
49#define PALMZ71_USBDETECT_GPIO 0 51#define PALMZ71_USBDETECT_GPIO 0
50#define PALMZ71_PENIRQ_GPIO 6 52#define PALMZ71_PENIRQ_GPIO 6
@@ -239,10 +241,6 @@ static struct omap_lcd_config palmz71_lcd_config __initdata = {
239 .ctrl_name = "internal", 241 .ctrl_name = "internal",
240}; 242};
241 243
242static struct omap_board_config_kernel palmz71_config[] __initdata = {
243 {OMAP_TAG_LCD, &palmz71_lcd_config},
244};
245
246static irqreturn_t 244static irqreturn_t
247palmz71_powercable(int irq, void *dev_id) 245palmz71_powercable(int irq, void *dev_id)
248{ 246{
@@ -313,9 +311,6 @@ omap_palmz71_init(void)
313 palmz71_gpio_setup(1); 311 palmz71_gpio_setup(1);
314 omap_mpu_wdt_mode(0); 312 omap_mpu_wdt_mode(0);
315 313
316 omap_board_config = palmz71_config;
317 omap_board_config_size = ARRAY_SIZE(palmz71_config);
318
319 platform_add_devices(devices, ARRAY_SIZE(devices)); 314 platform_add_devices(devices, ARRAY_SIZE(devices));
320 315
321 spi_register_board_info(palmz71_boardinfo, 316 spi_register_board_info(palmz71_boardinfo,
@@ -324,6 +319,8 @@ omap_palmz71_init(void)
324 omap_serial_init(); 319 omap_serial_init();
325 omap_register_i2c_bus(1, 100, NULL, 0); 320 omap_register_i2c_bus(1, 100, NULL, 0);
326 palmz71_gpio_setup(0); 321 palmz71_gpio_setup(0);
322
323 omapfb_set_lcd_config(&palmz71_lcd_config);
327} 324}
328 325
329MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71") 326MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index c000bed7627..76d4ee05a81 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -21,8 +21,8 @@
21#include <linux/mtd/physmap.h> 21#include <linux/mtd/physmap.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/smc91x.h> 23#include <linux/smc91x.h>
24#include <linux/omapfb.h>
24 25
25#include <mach/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
@@ -32,9 +32,13 @@
32#include <plat/fpga.h> 32#include <plat/fpga.h>
33#include <plat/flash.h> 33#include <plat/flash.h>
34#include <plat/keypad.h> 34#include <plat/keypad.h>
35#include "common.h"
36#include <plat/board.h> 35#include <plat/board.h>
37 36
37#include <mach/hardware.h>
38
39#include "iomap.h"
40#include "common.h"
41
38static const unsigned int p2_keymap[] = { 42static const unsigned int p2_keymap[] = {
39 KEY(0, 0, KEY_UP), 43 KEY(0, 0, KEY_UP),
40 KEY(1, 0, KEY_RIGHT), 44 KEY(1, 0, KEY_RIGHT),
@@ -232,27 +236,17 @@ static struct platform_device kp_device = {
232 .resource = kp_resources, 236 .resource = kp_resources,
233}; 237};
234 238
235static struct platform_device lcd_device = {
236 .name = "lcd_p2",
237 .id = -1,
238};
239
240static struct platform_device *devices[] __initdata = { 239static struct platform_device *devices[] __initdata = {
241 &nor_device, 240 &nor_device,
242 &nand_device, 241 &nand_device,
243 &smc91x_device, 242 &smc91x_device,
244 &kp_device, 243 &kp_device,
245 &lcd_device,
246}; 244};
247 245
248static struct omap_lcd_config perseus2_lcd_config __initdata = { 246static struct omap_lcd_config perseus2_lcd_config __initdata = {
249 .ctrl_name = "internal", 247 .ctrl_name = "internal",
250}; 248};
251 249
252static struct omap_board_config_kernel perseus2_config[] __initdata = {
253 { OMAP_TAG_LCD, &perseus2_lcd_config },
254};
255
256static void __init perseus2_init_smc91x(void) 250static void __init perseus2_init_smc91x(void)
257{ 251{
258 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET); 252 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
@@ -320,10 +314,10 @@ static void __init omap_perseus2_init(void)
320 314
321 platform_add_devices(devices, ARRAY_SIZE(devices)); 315 platform_add_devices(devices, ARRAY_SIZE(devices));
322 316
323 omap_board_config = perseus2_config;
324 omap_board_config_size = ARRAY_SIZE(perseus2_config);
325 omap_serial_init(); 317 omap_serial_init();
326 omap_register_i2c_bus(1, 100, NULL, 0); 318 omap_register_i2c_bus(1, 100, NULL, 0);
319
320 omapfb_set_lcd_config(&perseus2_lcd_config);
327} 321}
328 322
329/* Only FPGA needs to be mapped here. All others are done with ioremap */ 323/* Only FPGA needs to be mapped here. All others are done with ioremap */
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 7bcd82ab0fd..f34cb74a9f4 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -27,8 +27,8 @@
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/export.h> 29#include <linux/export.h>
30#include <linux/omapfb.h>
30 31
31#include <mach/hardware.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
@@ -40,10 +40,13 @@
40#include <plat/usb.h> 40#include <plat/usb.h>
41#include <plat/tc.h> 41#include <plat/tc.h>
42#include <plat/board.h> 42#include <plat/board.h>
43#include "common.h"
44#include <plat/keypad.h> 43#include <plat/keypad.h>
45#include <plat/board-sx1.h> 44#include <plat/board-sx1.h>
46 45
46#include <mach/hardware.h>
47
48#include "common.h"
49
47/* Write to I2C device */ 50/* Write to I2C device */
48int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value) 51int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
49{ 52{
@@ -355,11 +358,6 @@ static struct omap_usb_config sx1_usb_config __initdata = {
355 358
356/*----------- LCD -------------------------*/ 359/*----------- LCD -------------------------*/
357 360
358static struct platform_device sx1_lcd_device = {
359 .name = "lcd_sx1",
360 .id = -1,
361};
362
363static struct omap_lcd_config sx1_lcd_config __initdata = { 361static struct omap_lcd_config sx1_lcd_config __initdata = {
364 .ctrl_name = "internal", 362 .ctrl_name = "internal",
365}; 363};
@@ -368,14 +366,8 @@ static struct omap_lcd_config sx1_lcd_config __initdata = {
368static struct platform_device *sx1_devices[] __initdata = { 366static struct platform_device *sx1_devices[] __initdata = {
369 &sx1_flash_device, 367 &sx1_flash_device,
370 &sx1_kp_device, 368 &sx1_kp_device,
371 &sx1_lcd_device,
372 &sx1_irda_device, 369 &sx1_irda_device,
373}; 370};
374/*-----------------------------------------*/
375
376static struct omap_board_config_kernel sx1_config[] __initdata = {
377 { OMAP_TAG_LCD, &sx1_lcd_config },
378};
379 371
380/*-----------------------------------------*/ 372/*-----------------------------------------*/
381 373
@@ -391,8 +383,6 @@ static void __init omap_sx1_init(void)
391 383
392 platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices)); 384 platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices));
393 385
394 omap_board_config = sx1_config;
395 omap_board_config_size = ARRAY_SIZE(sx1_config);
396 omap_serial_init(); 386 omap_serial_init();
397 omap_register_i2c_bus(1, 100, NULL, 0); 387 omap_register_i2c_bus(1, 100, NULL, 0);
398 omap1_usb_init(&sx1_usb_config); 388 omap1_usb_init(&sx1_usb_config);
@@ -406,6 +396,8 @@ static void __init omap_sx1_init(void)
406 gpio_direction_output(1, 1); /*A_IRDA_OFF = 1 */ 396 gpio_direction_output(1, 1); /*A_IRDA_OFF = 1 */
407 gpio_direction_output(11, 0); /*A_SWITCH = 0 */ 397 gpio_direction_output(11, 0); /*A_SWITCH = 0 */
408 gpio_direction_output(15, 0); /*A_USB_ON = 0 */ 398 gpio_direction_output(15, 0); /*A_USB_ON = 0 */
399
400 omapfb_set_lcd_config(&sx1_lcd_config);
409} 401}
410 402
411MACHINE_START(SX1, "OMAP310 based Siemens SX1") 403MACHINE_START(SX1, "OMAP310 based Siemens SX1")
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index f83a502dc93..659d0f75de2 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -27,18 +27,20 @@
27#include <linux/smc91x.h> 27#include <linux/smc91x.h>
28#include <linux/export.h> 28#include <linux/export.h>
29 29
30#include <mach/hardware.h>
31#include <asm/mach-types.h> 30#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 32#include <asm/mach/map.h>
34 33
35#include <plat/board-voiceblue.h> 34#include <plat/board-voiceblue.h>
36#include "common.h"
37#include <plat/flash.h> 35#include <plat/flash.h>
38#include <plat/mux.h> 36#include <plat/mux.h>
39#include <plat/tc.h> 37#include <plat/tc.h>
40#include <plat/usb.h> 38#include <plat/usb.h>
41 39
40#include <mach/hardware.h>
41
42#include "common.h"
43
42static struct plat_serial8250_port voiceblue_ports[] = { 44static struct plat_serial8250_port voiceblue_ports[] = {
43 { 45 {
44 .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x40000), 46 .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x40000),
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 0c50df05d13..67382ddd8c8 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -15,8 +15,8 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/clk.h>
19#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/clk.h>
20#include <linux/clkdev.h> 20#include <linux/clkdev.h>
21 21
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
@@ -27,6 +27,9 @@
27#include <plat/sram.h> 27#include <plat/sram.h>
28#include <plat/clkdev_omap.h> 28#include <plat/clkdev_omap.h>
29 29
30#include <mach/hardware.h>
31
32#include "iomap.h"
30#include "clock.h" 33#include "clock.h"
31#include "opp.h" 34#include "opp.h"
32 35
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index 94699a82a73..c6ce93f71d0 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -15,10 +15,10 @@
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/io.h>
18#include <linux/clk.h> 19#include <linux/clk.h>
19#include <linux/cpufreq.h> 20#include <linux/cpufreq.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
21#include <linux/io.h>
22 22
23#include <asm/mach-types.h> /* for machine_is_* */ 23#include <asm/mach-types.h> /* for machine_is_* */
24 24
@@ -28,6 +28,9 @@
28#include <plat/sram.h> /* for omap_sram_reprogram_clock() */ 28#include <plat/sram.h> /* for omap_sram_reprogram_clock() */
29#include <plat/usb.h> /* for OTG_BASE */ 29#include <plat/usb.h> /* for OTG_BASE */
30 30
31#include <mach/hardware.h>
32
33#include "iomap.h"
31#include "clock.h" 34#include "clock.h"
32 35
33/* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */ 36/* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index a9a5146dd2d..af658ad338e 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -58,5 +58,6 @@ void omap1_restart(char, const char *);
58 58
59extern struct sys_timer omap1_timer; 59extern struct sys_timer omap1_timer;
60extern bool omap_32k_timer_init(void); 60extern bool omap_32k_timer_init(void);
61extern void __init omap_init_consistent_dma_size(void);
61 62
62#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ 63#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 1d76a63c098..dcd8ddbec2b 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -15,21 +15,20 @@
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> 17#include <linux/platform_device.h>
18#include <linux/io.h>
19#include <linux/spi/spi.h> 18#include <linux/spi/spi.h>
20 19
21#include <mach/camera.h>
22#include <mach/hardware.h>
23#include <asm/mach/map.h> 20#include <asm/mach/map.h>
24 21
25#include "common.h"
26#include <plat/tc.h> 22#include <plat/tc.h>
27#include <plat/board.h> 23#include <plat/board.h>
28#include <plat/mux.h> 24#include <plat/mux.h>
29#include <plat/mmc.h> 25#include <plat/mmc.h>
30#include <plat/omap7xx.h> 26#include <plat/omap7xx.h>
31#include <plat/mcbsp.h>
32 27
28#include <mach/camera.h>
29#include <mach/hardware.h>
30
31#include "common.h"
33#include "clock.h" 32#include "clock.h"
34 33
35/*-------------------------------------------------------------------------*/ 34/*-------------------------------------------------------------------------*/
@@ -250,16 +249,8 @@ static struct platform_device omap_pcm = {
250 .id = -1, 249 .id = -1,
251}; 250};
252 251
253OMAP_MCBSP_PLATFORM_DEVICE(1);
254OMAP_MCBSP_PLATFORM_DEVICE(2);
255OMAP_MCBSP_PLATFORM_DEVICE(3);
256
257static void omap_init_audio(void) 252static void omap_init_audio(void)
258{ 253{
259 platform_device_register(&omap_mcbsp1);
260 platform_device_register(&omap_mcbsp2);
261 if (!cpu_is_omap7xx())
262 platform_device_register(&omap_mcbsp3);
263 platform_device_register(&omap_pcm); 254 platform_device_register(&omap_pcm);
264} 255}
265 256
diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c
index f5a52204b89..3ef7d52316b 100644
--- a/arch/arm/mach-omap1/dma.c
+++ b/arch/arm/mach-omap1/dma.c
@@ -19,11 +19,11 @@
19 */ 19 */
20 20
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/io.h>
23#include <linux/slab.h> 22#include <linux/slab.h>
24#include <linux/module.h> 23#include <linux/module.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/device.h> 25#include <linux/device.h>
26#include <linux/io.h>
27 27
28#include <plat/dma.h> 28#include <plat/dma.h>
29#include <plat/tc.h> 29#include <plat/tc.h>
diff --git a/arch/arm/mach-omap1/flash.c b/arch/arm/mach-omap1/flash.c
index 1749cb37dda..f9bf78d4fdf 100644
--- a/arch/arm/mach-omap1/flash.c
+++ b/arch/arm/mach-omap1/flash.c
@@ -6,13 +6,15 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9#include <linux/io.h>
9#include <linux/mtd/mtd.h> 10#include <linux/mtd/mtd.h>
10#include <linux/mtd/map.h> 11#include <linux/mtd/map.h>
11 12
12#include <plat/io.h>
13#include <plat/tc.h> 13#include <plat/tc.h>
14#include <plat/flash.h> 14#include <plat/flash.h>
15 15
16#include <mach/hardware.h>
17
16void omap1_set_vpp(struct platform_device *pdev, int enable) 18void omap1_set_vpp(struct platform_device *pdev, int enable)
17{ 19{
18 static int count; 20 static int count;
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 0a17a1a7e00..76c67b3f9f6 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -24,12 +24,15 @@
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <mach/hardware.h>
28#include <asm/irq.h> 27#include <asm/irq.h>
29#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
30 29
31#include <plat/fpga.h> 30#include <plat/fpga.h>
32 31
32#include <mach/hardware.h>
33
34#include "iomap.h"
35
33static void fpga_mask_irq(struct irq_data *d) 36static void fpga_mask_irq(struct irq_data *d)
34{ 37{
35 unsigned int irq = d->irq - OMAP_FPGA_IRQ_BASE; 38 unsigned int irq = d->irq - OMAP_FPGA_IRQ_BASE;
diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
index 399da4ce017..634903ef829 100644
--- a/arch/arm/mach-omap1/gpio15xx.c
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -42,11 +42,12 @@ static struct omap_gpio_reg_offs omap15xx_mpuio_regs = {
42 .irqstatus = OMAP_MPUIO_GPIO_INT, 42 .irqstatus = OMAP_MPUIO_GPIO_INT,
43 .irqenable = OMAP_MPUIO_GPIO_MASKIT, 43 .irqenable = OMAP_MPUIO_GPIO_MASKIT,
44 .irqenable_inv = true, 44 .irqenable_inv = true,
45 .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE,
45}; 46};
46 47
47static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { 48static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
48 .virtual_irq_start = IH_MPUIO_BASE, 49 .virtual_irq_start = IH_MPUIO_BASE,
49 .bank_type = METHOD_MPUIO, 50 .is_mpuio = true,
50 .bank_width = 16, 51 .bank_width = 16,
51 .bank_stride = 1, 52 .bank_stride = 1,
52 .regs = &omap15xx_mpuio_regs, 53 .regs = &omap15xx_mpuio_regs,
@@ -83,11 +84,12 @@ static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
83 .irqstatus = OMAP1510_GPIO_INT_STATUS, 84 .irqstatus = OMAP1510_GPIO_INT_STATUS,
84 .irqenable = OMAP1510_GPIO_INT_MASK, 85 .irqenable = OMAP1510_GPIO_INT_MASK,
85 .irqenable_inv = true, 86 .irqenable_inv = true,
87 .irqctrl = OMAP1510_GPIO_INT_CONTROL,
88 .pinctrl = OMAP1510_GPIO_PIN_CONTROL,
86}; 89};
87 90
88static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { 91static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
89 .virtual_irq_start = IH_GPIO_BASE, 92 .virtual_irq_start = IH_GPIO_BASE,
90 .bank_type = METHOD_GPIO_1510,
91 .bank_width = 16, 93 .bank_width = 16,
92 .regs = &omap15xx_gpio_regs, 94 .regs = &omap15xx_gpio_regs,
93}; 95};
@@ -115,7 +117,6 @@ static int __init omap15xx_gpio_init(void)
115 platform_device_register(&omap15xx_mpu_gpio); 117 platform_device_register(&omap15xx_mpu_gpio);
116 platform_device_register(&omap15xx_gpio); 118 platform_device_register(&omap15xx_gpio);
117 119
118 gpio_bank_count = 2;
119 return 0; 120 return 0;
120} 121}
121postcore_initcall(omap15xx_gpio_init); 122postcore_initcall(omap15xx_gpio_init);
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
index 0f399bd0e70..1fb3b9ad496 100644
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -24,6 +24,9 @@
24#define OMAP1610_GPIO4_BASE 0xfffbbc00 24#define OMAP1610_GPIO4_BASE 0xfffbbc00
25#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE 25#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
26 26
27/* smart idle, enable wakeup */
28#define SYSCONFIG_WORD 0x14
29
27/* mpu gpio */ 30/* mpu gpio */
28static struct __initdata resource omap16xx_mpu_gpio_resources[] = { 31static struct __initdata resource omap16xx_mpu_gpio_resources[] = {
29 { 32 {
@@ -45,11 +48,12 @@ static struct omap_gpio_reg_offs omap16xx_mpuio_regs = {
45 .irqstatus = OMAP_MPUIO_GPIO_INT, 48 .irqstatus = OMAP_MPUIO_GPIO_INT,
46 .irqenable = OMAP_MPUIO_GPIO_MASKIT, 49 .irqenable = OMAP_MPUIO_GPIO_MASKIT,
47 .irqenable_inv = true, 50 .irqenable_inv = true,
51 .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE,
48}; 52};
49 53
50static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { 54static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
51 .virtual_irq_start = IH_MPUIO_BASE, 55 .virtual_irq_start = IH_MPUIO_BASE,
52 .bank_type = METHOD_MPUIO, 56 .is_mpuio = true,
53 .bank_width = 16, 57 .bank_width = 16,
54 .bank_stride = 1, 58 .bank_stride = 1,
55 .regs = &omap16xx_mpuio_regs, 59 .regs = &omap16xx_mpuio_regs,
@@ -89,11 +93,13 @@ static struct omap_gpio_reg_offs omap16xx_gpio_regs = {
89 .irqenable = OMAP1610_GPIO_IRQENABLE1, 93 .irqenable = OMAP1610_GPIO_IRQENABLE1,
90 .set_irqenable = OMAP1610_GPIO_SET_IRQENABLE1, 94 .set_irqenable = OMAP1610_GPIO_SET_IRQENABLE1,
91 .clr_irqenable = OMAP1610_GPIO_CLEAR_IRQENABLE1, 95 .clr_irqenable = OMAP1610_GPIO_CLEAR_IRQENABLE1,
96 .wkup_en = OMAP1610_GPIO_WAKEUPENABLE,
97 .edgectrl1 = OMAP1610_GPIO_EDGE_CTRL1,
98 .edgectrl2 = OMAP1610_GPIO_EDGE_CTRL2,
92}; 99};
93 100
94static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { 101static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
95 .virtual_irq_start = IH_GPIO_BASE, 102 .virtual_irq_start = IH_GPIO_BASE,
96 .bank_type = METHOD_GPIO_1610,
97 .bank_width = 16, 103 .bank_width = 16,
98 .regs = &omap16xx_gpio_regs, 104 .regs = &omap16xx_gpio_regs,
99}; 105};
@@ -123,7 +129,6 @@ static struct __initdata resource omap16xx_gpio2_resources[] = {
123 129
124static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = { 130static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = {
125 .virtual_irq_start = IH_GPIO_BASE + 16, 131 .virtual_irq_start = IH_GPIO_BASE + 16,
126 .bank_type = METHOD_GPIO_1610,
127 .bank_width = 16, 132 .bank_width = 16,
128 .regs = &omap16xx_gpio_regs, 133 .regs = &omap16xx_gpio_regs,
129}; 134};
@@ -153,7 +158,6 @@ static struct __initdata resource omap16xx_gpio3_resources[] = {
153 158
154static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = { 159static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = {
155 .virtual_irq_start = IH_GPIO_BASE + 32, 160 .virtual_irq_start = IH_GPIO_BASE + 32,
156 .bank_type = METHOD_GPIO_1610,
157 .bank_width = 16, 161 .bank_width = 16,
158 .regs = &omap16xx_gpio_regs, 162 .regs = &omap16xx_gpio_regs,
159}; 163};
@@ -183,7 +187,6 @@ static struct __initdata resource omap16xx_gpio4_resources[] = {
183 187
184static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = { 188static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = {
185 .virtual_irq_start = IH_GPIO_BASE + 48, 189 .virtual_irq_start = IH_GPIO_BASE + 48,
186 .bank_type = METHOD_GPIO_1610,
187 .bank_width = 16, 190 .bank_width = 16,
188 .regs = &omap16xx_gpio_regs, 191 .regs = &omap16xx_gpio_regs,
189}; 192};
@@ -214,14 +217,42 @@ static struct __initdata platform_device * omap16xx_gpio_dev[] = {
214static int __init omap16xx_gpio_init(void) 217static int __init omap16xx_gpio_init(void)
215{ 218{
216 int i; 219 int i;
220 void __iomem *base;
221 struct resource *res;
222 struct platform_device *pdev;
223 struct omap_gpio_platform_data *pdata;
217 224
218 if (!cpu_is_omap16xx()) 225 if (!cpu_is_omap16xx())
219 return -EINVAL; 226 return -EINVAL;
220 227
221 for (i = 0; i < ARRAY_SIZE(omap16xx_gpio_dev); i++) 228 /*
222 platform_device_register(omap16xx_gpio_dev[i]); 229 * Enable system clock for GPIO module.
230 * The CAM_CLK_CTRL *is* really the right place.
231 */
232 omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04,
233 ULPD_CAM_CLK_CTRL);
234
235 for (i = 0; i < ARRAY_SIZE(omap16xx_gpio_dev); i++) {
236 pdev = omap16xx_gpio_dev[i];
237 pdata = pdev->dev.platform_data;
238
239 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
240 if (unlikely(!res)) {
241 dev_err(&pdev->dev, "Invalid mem resource.\n");
242 return -ENODEV;
243 }
223 244
224 gpio_bank_count = ARRAY_SIZE(omap16xx_gpio_dev); 245 base = ioremap(res->start, resource_size(res));
246 if (unlikely(!base)) {
247 dev_err(&pdev->dev, "ioremap failed.\n");
248 return -ENOMEM;
249 }
250
251 __raw_writel(SYSCONFIG_WORD, base + OMAP1610_GPIO_SYSCONFIG);
252 iounmap(base);
253
254 platform_device_register(omap16xx_gpio_dev[i]);
255 }
225 256
226 return 0; 257 return 0;
227} 258}
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
index 5ab63eab0ff..4771d6b68b9 100644
--- a/arch/arm/mach-omap1/gpio7xx.c
+++ b/arch/arm/mach-omap1/gpio7xx.c
@@ -47,12 +47,13 @@ static struct omap_gpio_reg_offs omap7xx_mpuio_regs = {
47 .irqstatus = OMAP_MPUIO_GPIO_INT / 2, 47 .irqstatus = OMAP_MPUIO_GPIO_INT / 2,
48 .irqenable = OMAP_MPUIO_GPIO_MASKIT / 2, 48 .irqenable = OMAP_MPUIO_GPIO_MASKIT / 2,
49 .irqenable_inv = true, 49 .irqenable_inv = true,
50 .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE >> 1,
50}; 51};
51 52
52static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { 53static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
53 .virtual_irq_start = IH_MPUIO_BASE, 54 .virtual_irq_start = IH_MPUIO_BASE,
54 .bank_type = METHOD_MPUIO, 55 .is_mpuio = true,
55 .bank_width = 32, 56 .bank_width = 16,
56 .bank_stride = 2, 57 .bank_stride = 2,
57 .regs = &omap7xx_mpuio_regs, 58 .regs = &omap7xx_mpuio_regs,
58}; 59};
@@ -88,11 +89,11 @@ static struct omap_gpio_reg_offs omap7xx_gpio_regs = {
88 .irqstatus = OMAP7XX_GPIO_INT_STATUS, 89 .irqstatus = OMAP7XX_GPIO_INT_STATUS,
89 .irqenable = OMAP7XX_GPIO_INT_MASK, 90 .irqenable = OMAP7XX_GPIO_INT_MASK,
90 .irqenable_inv = true, 91 .irqenable_inv = true,
92 .irqctrl = OMAP7XX_GPIO_INT_CONTROL,
91}; 93};
92 94
93static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { 95static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
94 .virtual_irq_start = IH_GPIO_BASE, 96 .virtual_irq_start = IH_GPIO_BASE,
95 .bank_type = METHOD_GPIO_7XX,
96 .bank_width = 32, 97 .bank_width = 32,
97 .regs = &omap7xx_gpio_regs, 98 .regs = &omap7xx_gpio_regs,
98}; 99};
@@ -122,7 +123,6 @@ static struct __initdata resource omap7xx_gpio2_resources[] = {
122 123
123static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = { 124static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = {
124 .virtual_irq_start = IH_GPIO_BASE + 32, 125 .virtual_irq_start = IH_GPIO_BASE + 32,
125 .bank_type = METHOD_GPIO_7XX,
126 .bank_width = 32, 126 .bank_width = 32,
127 .regs = &omap7xx_gpio_regs, 127 .regs = &omap7xx_gpio_regs,
128}; 128};
@@ -152,7 +152,6 @@ static struct __initdata resource omap7xx_gpio3_resources[] = {
152 152
153static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = { 153static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = {
154 .virtual_irq_start = IH_GPIO_BASE + 64, 154 .virtual_irq_start = IH_GPIO_BASE + 64,
155 .bank_type = METHOD_GPIO_7XX,
156 .bank_width = 32, 155 .bank_width = 32,
157 .regs = &omap7xx_gpio_regs, 156 .regs = &omap7xx_gpio_regs,
158}; 157};
@@ -182,7 +181,6 @@ static struct __initdata resource omap7xx_gpio4_resources[] = {
182 181
183static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = { 182static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = {
184 .virtual_irq_start = IH_GPIO_BASE + 96, 183 .virtual_irq_start = IH_GPIO_BASE + 96,
185 .bank_type = METHOD_GPIO_7XX,
186 .bank_width = 32, 184 .bank_width = 32,
187 .regs = &omap7xx_gpio_regs, 185 .regs = &omap7xx_gpio_regs,
188}; 186};
@@ -212,7 +210,6 @@ static struct __initdata resource omap7xx_gpio5_resources[] = {
212 210
213static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = { 211static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = {
214 .virtual_irq_start = IH_GPIO_BASE + 128, 212 .virtual_irq_start = IH_GPIO_BASE + 128,
215 .bank_type = METHOD_GPIO_7XX,
216 .bank_width = 32, 213 .bank_width = 32,
217 .regs = &omap7xx_gpio_regs, 214 .regs = &omap7xx_gpio_regs,
218}; 215};
@@ -242,7 +239,6 @@ static struct __initdata resource omap7xx_gpio6_resources[] = {
242 239
243static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = { 240static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = {
244 .virtual_irq_start = IH_GPIO_BASE + 160, 241 .virtual_irq_start = IH_GPIO_BASE + 160,
245 .bank_type = METHOD_GPIO_7XX,
246 .bank_width = 32, 242 .bank_width = 32,
247 .regs = &omap7xx_gpio_regs, 243 .regs = &omap7xx_gpio_regs,
248}; 244};
@@ -282,8 +278,6 @@ static int __init omap7xx_gpio_init(void)
282 for (i = 0; i < ARRAY_SIZE(omap7xx_gpio_dev); i++) 278 for (i = 0; i < ARRAY_SIZE(omap7xx_gpio_dev); i++)
283 platform_device_register(omap7xx_gpio_dev[i]); 279 platform_device_register(omap7xx_gpio_dev[i]);
284 280
285 gpio_bank_count = ARRAY_SIZE(omap7xx_gpio_dev);
286
287 return 0; 281 return 0;
288} 282}
289postcore_initcall(omap7xx_gpio_init); 283postcore_initcall(omap7xx_gpio_init);
diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c
index a0e3560b39d..f24c1e2c504 100644
--- a/arch/arm/mach-omap1/id.c
+++ b/arch/arm/mach-omap1/id.c
@@ -15,8 +15,11 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/io.h> 17#include <linux/io.h>
18
18#include <plat/cpu.h> 19#include <plat/cpu.h>
19 20
21#include <mach/hardware.h>
22
20#define OMAP_DIE_ID_0 0xfffe1800 23#define OMAP_DIE_ID_0 0xfffe1800
21#define OMAP_DIE_ID_1 0xfffe1804 24#define OMAP_DIE_ID_1 0xfffe1804
22#define OMAP_PRODUCTION_ID_0 0xfffe2000 25#define OMAP_PRODUCTION_ID_0 0xfffe2000
diff --git a/arch/arm/mach-omap1/include/mach/entry-macro.S b/arch/arm/mach-omap1/include/mach/entry-macro.S
index bfb4fb1d738..fa0f32a686a 100644
--- a/arch/arm/mach-omap1/include/mach/entry-macro.S
+++ b/arch/arm/mach-omap1/include/mach/entry-macro.S
@@ -9,20 +9,16 @@
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied. 10 * warranty of any kind, whether express or implied.
11 */ 11 */
12
12#include <mach/hardware.h> 13#include <mach/hardware.h>
13#include <mach/io.h> 14#include <mach/io.h>
14#include <mach/irqs.h> 15#include <mach/irqs.h>
15#include <asm/hardware/gic.h>
16 16
17 .macro disable_fiq 17#include "../../iomap.h"
18 .endm
19 18
20 .macro get_irqnr_preamble, base, tmp 19 .macro get_irqnr_preamble, base, tmp
21 .endm 20 .endm
22 21
23 .macro arch_ret_to_user, tmp1, tmp2
24 .endm
25
26 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
27 ldr \base, =OMAP1_IO_ADDRESS(OMAP_IH1_BASE) 23 ldr \base, =OMAP1_IO_ADDRESS(OMAP_IH1_BASE)
28 ldr \irqnr, [\base, #IRQ_ITR_REG_OFFSET] 24 ldr \irqnr, [\base, #IRQ_ITR_REG_OFFSET]
diff --git a/arch/arm/mach-omap1/include/mach/hardware.h b/arch/arm/mach-omap1/include/mach/hardware.h
index a3f6287b200..01e35fa106b 100644
--- a/arch/arm/mach-omap1/include/mach/hardware.h
+++ b/arch/arm/mach-omap1/include/mach/hardware.h
@@ -2,4 +2,40 @@
2 * arch/arm/mach-omap1/include/mach/hardware.h 2 * arch/arm/mach-omap1/include/mach/hardware.h
3 */ 3 */
4 4
5#ifndef __MACH_HARDWARE_H
6#define __MACH_HARDWARE_H
7
8#ifndef __ASSEMBLER__
9/*
10 * NOTE: Please use ioremap + __raw_read/write where possible instead of these
11 */
12extern u8 omap_readb(u32 pa);
13extern u16 omap_readw(u32 pa);
14extern u32 omap_readl(u32 pa);
15extern void omap_writeb(u8 v, u32 pa);
16extern void omap_writew(u16 v, u32 pa);
17extern void omap_writel(u32 v, u32 pa);
18
19#include <plat/tc.h>
20
21/* Almost all documentation for chip and board memory maps assumes
22 * BM is clear. Most devel boards have a switch to control booting
23 * from NOR flash (using external chipselect 3) rather than mask ROM,
24 * which uses BM to interchange the physical CS0 and CS3 addresses.
25 */
26static inline u32 omap_cs0m_phys(void)
27{
28 return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM)
29 ? OMAP_CS3_PHYS : 0;
30}
31
32static inline u32 omap_cs3_phys(void)
33{
34 return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM)
35 ? 0 : OMAP_CS3_PHYS;
36}
37
38#endif
39#endif
40
5#include <plat/hardware.h> 41#include <plat/hardware.h>
diff --git a/arch/arm/mach-omap1/include/mach/io.h b/arch/arm/mach-omap1/include/mach/io.h
index 57bdf74a3e6..37b12e1fd02 100644
--- a/arch/arm/mach-omap1/include/mach/io.h
+++ b/arch/arm/mach-omap1/include/mach/io.h
@@ -1,5 +1,46 @@
1/* 1/*
2 * arch/arm/mach-omap1/include/mach/io.h 2 * arch/arm/mach-omap1/include/mach/io.h
3 *
4 * IO definitions for TI OMAP processors and boards
5 *
6 * Copied from arch/arm/mach-sa1100/include/mach/io.h
7 * Copyright (C) 1997-1999 Russell King
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 *
29 * Modifications:
30 * 06-12-1997 RMK Created.
31 * 07-04-1999 RMK Major cleanup
3 */ 32 */
4 33
5#include <plat/io.h> 34#ifndef __ASM_ARM_ARCH_IO_H
35#define __ASM_ARM_ARCH_IO_H
36
37#define IO_SPACE_LIMIT 0xffffffff
38
39/*
40 * We don't actually have real ISA nor PCI buses, but there is so many
41 * drivers out there that might just work if we fake them...
42 */
43#define __io(a) __typesafe_io(a)
44#define __mem_pci(a) (a)
45
46#endif
diff --git a/arch/arm/mach-omap1/include/mach/memory.h b/arch/arm/mach-omap1/include/mach/memory.h
index c6337645ba8..901082def9b 100644
--- a/arch/arm/mach-omap1/include/mach/memory.h
+++ b/arch/arm/mach-omap1/include/mach/memory.h
@@ -18,7 +18,8 @@
18 * Note that the is_lbus_device() test is not very efficient on 1510 18 * Note that the is_lbus_device() test is not very efficient on 1510
19 * because of the strncmp(). 19 * because of the strncmp().
20 */ 20 */
21#ifdef CONFIG_ARCH_OMAP15XX 21#if defined(CONFIG_ARCH_OMAP15XX) && !defined(__ASSEMBLER__)
22#include <plat/cpu.h>
22 23
23/* 24/*
24 * OMAP-1510 Local Bus address offset 25 * OMAP-1510 Local Bus address offset
diff --git a/arch/arm/mach-omap1/include/mach/system.h b/arch/arm/mach-omap1/include/mach/system.h
deleted file mode 100644
index a6c1b3a16df..00000000000
--- a/arch/arm/mach-omap1/include/mach/system.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/*
2 * arch/arm/mach-omap1/include/mach/system.h
3 */
4
5#include <plat/system.h>
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 8e55b6fb347..d969a7203d1 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -15,9 +15,12 @@
15 15
16#include <asm/tlb.h> 16#include <asm/tlb.h>
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18
18#include <plat/mux.h> 19#include <plat/mux.h>
19#include <plat/tc.h> 20#include <plat/tc.h>
20 21
22#include "iomap.h"
23#include "common.h"
21#include "clock.h" 24#include "clock.h"
22 25
23extern void omap_check_revision(void); 26extern void omap_check_revision(void);
@@ -118,7 +121,7 @@ void __init omap16xx_map_io(void)
118/* 121/*
119 * Common low-level hardware init for omap1. 122 * Common low-level hardware init for omap1.
120 */ 123 */
121void omap1_init_early(void) 124void __init omap1_init_early(void)
122{ 125{
123 omap_check_revision(); 126 omap_check_revision();
124 127
diff --git a/arch/arm/mach-omap1/iomap.h b/arch/arm/mach-omap1/iomap.h
new file mode 100644
index 00000000000..d68175761c3
--- /dev/null
+++ b/arch/arm/mach-omap1/iomap.h
@@ -0,0 +1,42 @@
1/*
2 * IO mappings for OMAP1
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
10 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
12 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
13 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
15 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
16 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
18 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#ifdef __ASSEMBLER__
26#define IOMEM(x) (x)
27#else
28#define IOMEM(x) ((void __force __iomem *)(x))
29#endif
30
31#define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
32#define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET)
33
34/*
35 * ----------------------------------------------------------------------------
36 * Omap1 specific IO mapping
37 * ----------------------------------------------------------------------------
38 */
39
40#define OMAP1_IO_PHYS 0xFFFB0000
41#define OMAP1_IO_SIZE 0x40000
42#define OMAP1_IO_VIRT (OMAP1_IO_PHYS - OMAP1_IO_OFFSET)
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index e5b104b7fce..4448114fab7 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -42,11 +42,13 @@
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/io.h> 43#include <linux/io.h>
44 44
45#include <mach/hardware.h>
46#include <asm/irq.h> 45#include <asm/irq.h>
47#include <asm/mach/irq.h> 46#include <asm/mach/irq.h>
47
48#include <plat/cpu.h> 48#include <plat/cpu.h>
49 49
50#include <mach/hardware.h>
51
50#define IRQ_BANK(irq) ((irq) >> 5) 52#define IRQ_BANK(irq) ((irq) >> 5)
51#define IRQ_BIT(irq) ((irq) & 0x1f) 53#define IRQ_BIT(irq) ((irq) & 0x1f)
52 54
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
index 4c5ce7d829c..86ace9aaa66 100644
--- a/arch/arm/mach-omap1/lcd_dma.c
+++ b/arch/arm/mach-omap1/lcd_dma.c
@@ -27,9 +27,10 @@
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>
31
30#include <mach/hardware.h> 32#include <mach/hardware.h>
31#include <mach/lcdc.h> 33#include <mach/lcdc.h>
32#include <plat/dma.h>
33 34
34int omap_lcd_dma_running(void) 35int omap_lcd_dma_running(void)
35{ 36{
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index 91f9abbd325..adf00975b9b 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -19,12 +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 <mach/irqs.h>
23#include <plat/dma.h> 22#include <plat/dma.h>
24#include <plat/mux.h> 23#include <plat/mux.h>
25#include <plat/cpu.h> 24#include <plat/cpu.h>
26#include <plat/mcbsp.h> 25#include <plat/mcbsp.h>
27 26
27#include <mach/irqs.h>
28
29#include "iomap.h"
30
28#define DPS_RSTCT2_PER_EN (1 << 0) 31#define DPS_RSTCT2_PER_EN (1 << 0)
29#define DSP_RSTCT2_WD_PER_EN (1 << 1) 32#define DSP_RSTCT2_WD_PER_EN (1 << 1)
30 33
@@ -420,18 +423,6 @@ static int __init omap1_mcbsp_init(void)
420 return -ENODEV; 423 return -ENODEV;
421 424
422 if (cpu_is_omap7xx()) 425 if (cpu_is_omap7xx())
423 omap_mcbsp_count = OMAP7XX_MCBSP_COUNT;
424 else if (cpu_is_omap15xx())
425 omap_mcbsp_count = OMAP15XX_MCBSP_COUNT;
426 else if (cpu_is_omap16xx())
427 omap_mcbsp_count = OMAP16XX_MCBSP_COUNT;
428
429 mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *),
430 GFP_KERNEL);
431 if (!mcbsp_ptr)
432 return -ENOMEM;
433
434 if (cpu_is_omap7xx())
435 omap_mcbsp_register_board_cfg(omap7xx_mcbsp_res_0, 426 omap_mcbsp_register_board_cfg(omap7xx_mcbsp_res_0,
436 OMAP7XX_MCBSP_RES_SZ, 427 OMAP7XX_MCBSP_RES_SZ,
437 omap7xx_mcbsp_pdata, 428 omap7xx_mcbsp_pdata,
@@ -449,7 +440,7 @@ static int __init omap1_mcbsp_init(void)
449 omap16xx_mcbsp_pdata, 440 omap16xx_mcbsp_pdata,
450 OMAP16XX_MCBSP_COUNT); 441 OMAP16XX_MCBSP_COUNT);
451 442
452 return omap_mcbsp_init(); 443 return 0;
453} 444}
454 445
455arch_initcall(omap1_mcbsp_init); 446arch_initcall(omap1_mcbsp_init);
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 89ea20ca0cc..306beaca14c 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -42,14 +42,13 @@
42#include <linux/sysfs.h> 42#include <linux/sysfs.h>
43#include <linux/module.h> 43#include <linux/module.h>
44#include <linux/io.h> 44#include <linux/io.h>
45#include <linux/atomic.h>
45 46
46#include <asm/irq.h> 47#include <asm/irq.h>
47#include <linux/atomic.h>
48#include <asm/mach/time.h> 48#include <asm/mach/time.h>
49#include <asm/mach/irq.h> 49#include <asm/mach/irq.h>
50 50
51#include <plat/cpu.h> 51#include <plat/cpu.h>
52#include <mach/irqs.h>
53#include <plat/clock.h> 52#include <plat/clock.h>
54#include <plat/sram.h> 53#include <plat/sram.h>
55#include <plat/tc.h> 54#include <plat/tc.h>
@@ -57,6 +56,9 @@
57#include <plat/dma.h> 56#include <plat/dma.h>
58#include <plat/dmtimer.h> 57#include <plat/dmtimer.h>
59 58
59#include <mach/irqs.h>
60
61#include "iomap.h"
60#include "pm.h" 62#include "pm.h"
61 63
62static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE]; 64static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE];
@@ -108,13 +110,7 @@ void omap1_pm_idle(void)
108 __u32 use_idlect1 = arm_idlect1_mask; 110 __u32 use_idlect1 = arm_idlect1_mask;
109 int do_sleep = 0; 111 int do_sleep = 0;
110 112
111 local_irq_disable();
112 local_fiq_disable(); 113 local_fiq_disable();
113 if (need_resched()) {
114 local_fiq_enable();
115 local_irq_enable();
116 return;
117 }
118 114
119#if defined(CONFIG_OMAP_MPU_TIMER) && !defined(CONFIG_OMAP_DM_TIMER) 115#if defined(CONFIG_OMAP_MPU_TIMER) && !defined(CONFIG_OMAP_DM_TIMER)
120#warning Enable 32kHz OS timer in order to allow sleep states in idle 116#warning Enable 32kHz OS timer in order to allow sleep states in idle
@@ -157,14 +153,12 @@ void omap1_pm_idle(void)
157 omap_writel(saved_idlect1, ARM_IDLECT1); 153 omap_writel(saved_idlect1, ARM_IDLECT1);
158 154
159 local_fiq_enable(); 155 local_fiq_enable();
160 local_irq_enable();
161 return; 156 return;
162 } 157 }
163 omap_sram_suspend(omap_readl(ARM_IDLECT1), 158 omap_sram_suspend(omap_readl(ARM_IDLECT1),
164 omap_readl(ARM_IDLECT2)); 159 omap_readl(ARM_IDLECT2));
165 160
166 local_fiq_enable(); 161 local_fiq_enable();
167 local_irq_enable();
168} 162}
169 163
170/* 164/*
@@ -583,8 +577,6 @@ static void omap_pm_init_proc(void)
583 577
584#endif /* DEBUG && CONFIG_PROC_FS */ 578#endif /* DEBUG && CONFIG_PROC_FS */
585 579
586static void (*saved_idle)(void) = NULL;
587
588/* 580/*
589 * omap_pm_prepare - Do preliminary suspend work. 581 * omap_pm_prepare - Do preliminary suspend work.
590 * 582 *
@@ -592,8 +584,7 @@ static void (*saved_idle)(void) = NULL;
592static int omap_pm_prepare(void) 584static int omap_pm_prepare(void)
593{ 585{
594 /* We cannot sleep in idle until we have resumed */ 586 /* We cannot sleep in idle until we have resumed */
595 saved_idle = pm_idle; 587 disable_hlt();
596 pm_idle = NULL;
597 588
598 return 0; 589 return 0;
599} 590}
@@ -630,7 +621,7 @@ static int omap_pm_enter(suspend_state_t state)
630 621
631static void omap_pm_finish(void) 622static void omap_pm_finish(void)
632{ 623{
633 pm_idle = saved_idle; 624 enable_hlt();
634} 625}
635 626
636 627
@@ -687,7 +678,7 @@ static int __init omap_pm_init(void)
687 return -ENODEV; 678 return -ENODEV;
688 } 679 }
689 680
690 pm_idle = omap1_pm_idle; 681 arm_pm_idle = omap1_pm_idle;
691 682
692 if (cpu_is_omap7xx()) 683 if (cpu_is_omap7xx())
693 setup_irq(INT_7XX_WAKE_UP_REQ, &omap_wakeup_irq); 684 setup_irq(INT_7XX_WAKE_UP_REQ, &omap_wakeup_irq);
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c
index 91d199b6497..f255b153b86 100644
--- a/arch/arm/mach-omap1/reset.c
+++ b/arch/arm/mach-omap1/reset.c
@@ -4,9 +4,10 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/io.h> 5#include <linux/io.h>
6 6
7#include <mach/hardware.h>
8#include <plat/prcm.h> 7#include <plat/prcm.h>
9 8
9#include <mach/hardware.h>
10
10void omap1_restart(char mode, const char *cmd) 11void omap1_restart(char mode, const char *cmd)
11{ 12{
12 /* 13 /*
diff --git a/arch/arm/mach-omap1/sleep.S b/arch/arm/mach-omap1/sleep.S
index c875bdc902c..0779db150da 100644
--- a/arch/arm/mach-omap1/sleep.S
+++ b/arch/arm/mach-omap1/sleep.S
@@ -33,8 +33,12 @@
33 */ 33 */
34 34
35#include <linux/linkage.h> 35#include <linux/linkage.h>
36
36#include <asm/assembler.h> 37#include <asm/assembler.h>
38
37#include <mach/io.h> 39#include <mach/io.h>
40
41#include "iomap.h"
38#include "pm.h" 42#include "pm.h"
39 43
40 .text 44 .text
diff --git a/arch/arm/mach-omap1/sram.S b/arch/arm/mach-omap1/sram.S
index 692587d07ea..2ce0b9ab20e 100644
--- a/arch/arm/mach-omap1/sram.S
+++ b/arch/arm/mach-omap1/sram.S
@@ -9,10 +9,14 @@
9 */ 9 */
10 10
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12
12#include <asm/assembler.h> 13#include <asm/assembler.h>
14
13#include <mach/io.h> 15#include <mach/io.h>
14#include <mach/hardware.h> 16#include <mach/hardware.h>
15 17
18#include "iomap.h"
19
16 .text 20 .text
17 21
18/* 22/*
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index b8faffa44f9..2fae6a2740f 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -45,14 +45,15 @@
45#include <linux/io.h> 45#include <linux/io.h>
46 46
47#include <asm/system.h> 47#include <asm/system.h>
48#include <mach/hardware.h>
49#include <asm/leds.h> 48#include <asm/leds.h>
50#include <asm/irq.h> 49#include <asm/irq.h>
51#include <asm/sched_clock.h> 50#include <asm/sched_clock.h>
52 51
52#include <mach/hardware.h>
53#include <asm/mach/irq.h> 53#include <asm/mach/irq.h>
54#include <asm/mach/time.h> 54#include <asm/mach/time.h>
55 55
56#include "iomap.h"
56#include "common.h" 57#include "common.h"
57 58
58#ifdef CONFIG_OMAP_MPU_TIMER 59#ifdef CONFIG_OMAP_MPU_TIMER
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
index 9a54ef4dcf5..a2e6d0709df 100644
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -47,14 +47,17 @@
47#include <linux/io.h> 47#include <linux/io.h>
48 48
49#include <asm/system.h> 49#include <asm/system.h>
50#include <mach/hardware.h>
51#include <asm/leds.h> 50#include <asm/leds.h>
52#include <asm/irq.h> 51#include <asm/irq.h>
53#include <asm/mach/irq.h> 52#include <asm/mach/irq.h>
54#include <asm/mach/time.h> 53#include <asm/mach/time.h>
55#include "common.h" 54
56#include <plat/dmtimer.h> 55#include <plat/dmtimer.h>
57 56
57#include <mach/hardware.h>
58
59#include "common.h"
60
58/* 61/*
59 * --------------------------------------------------------------------------- 62 * ---------------------------------------------------------------------------
60 * 32KHz OS timer 63 * 32KHz OS timer
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index e20c8ab80b0..8141b76283a 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -32,7 +32,7 @@ config ARCH_OMAP3
32 depends on ARCH_OMAP2PLUS 32 depends on ARCH_OMAP2PLUS
33 default y 33 default y
34 select CPU_V7 34 select CPU_V7
35 select USB_ARCH_HAS_EHCI 35 select USB_ARCH_HAS_EHCI if USB_SUPPORT
36 select ARCH_HAS_OPP 36 select ARCH_HAS_OPP
37 select PM_OPP if PM 37 select PM_OPP if PM
38 select ARM_CPU_SUSPEND if PM 38 select ARM_CPU_SUSPEND if PM
@@ -52,7 +52,7 @@ config ARCH_OMAP4
52 select ARM_ERRATA_720789 52 select ARM_ERRATA_720789
53 select ARCH_HAS_OPP 53 select ARCH_HAS_OPP
54 select PM_OPP if PM 54 select PM_OPP if PM
55 select USB_ARCH_HAS_EHCI 55 select USB_ARCH_HAS_EHCI if USB_SUPPORT
56 select ARM_CPU_SUSPEND if PM 56 select ARM_CPU_SUSPEND if PM
57 57
58comment "OMAP Core Type" 58comment "OMAP Core Type"
@@ -117,7 +117,6 @@ comment "OMAP Board Type"
117config MACH_OMAP_GENERIC 117config MACH_OMAP_GENERIC
118 bool "Generic OMAP2+ board" 118 bool "Generic OMAP2+ board"
119 depends on ARCH_OMAP2PLUS 119 depends on ARCH_OMAP2PLUS
120 select USE_OF
121 default y 120 default y
122 help 121 help
123 Support for generic TI OMAP2+ boards using Flattened Device Tree. 122 Support for generic TI OMAP2+ boards using Flattened Device Tree.
@@ -245,10 +244,11 @@ config MACH_NOKIA_N8X0
245 select MACH_NOKIA_N810_WIMAX 244 select MACH_NOKIA_N810_WIMAX
246 245
247config MACH_NOKIA_RM680 246config MACH_NOKIA_RM680
248 bool "Nokia RM-680 board" 247 bool "Nokia RM-680/696 board"
249 depends on ARCH_OMAP3 248 depends on ARCH_OMAP3
250 default y 249 default y
251 select OMAP_PACKAGE_CBB 250 select OMAP_PACKAGE_CBB
251 select MACH_NOKIA_RM696
252 252
253config MACH_NOKIA_RX51 253config MACH_NOKIA_RX51
254 bool "Nokia RX-51 board" 254 bool "Nokia RX-51 board"
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index bd76394ccaf..49f92bc1c31 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -4,7 +4,7 @@
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 7 common.o gpio.o dma.o wd_timer.o display.o i2c.o
8 8
9omap-2-3-common = irq.o sdrc.o 9omap-2-3-common = irq.o sdrc.o
10hwmod-common = omap_hwmod.o \ 10hwmod-common = omap_hwmod.o \
@@ -17,13 +17,14 @@ obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
17obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common) 17obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
18obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common) 18obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common)
19 19
20obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o 20ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
21obj-y += mcbsp.o
22endif
21 23
22obj-$(CONFIG_TWL4030_CORE) += omap_twl.o 24obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
23 25
24# SMP support ONLY available for OMAP4 26# SMP support ONLY available for OMAP4
25obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o 27obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o
26obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o
27obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o 28obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o
28obj-$(CONFIG_ARCH_OMAP4) += omap4-common.o omap-wakeupgen.o \ 29obj-$(CONFIG_ARCH_OMAP4) += omap4-common.o omap-wakeupgen.o \
29 sleep44xx.o 30 sleep44xx.o
@@ -182,9 +183,6 @@ obj-$(CONFIG_OMAP_IOMMU) += iommu2.o
182iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o 183iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o
183obj-y += $(iommu-m) $(iommu-y) 184obj-y += $(iommu-m) $(iommu-y)
184 185
185i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
186obj-y += $(i2c-omap-m) $(i2c-omap-y)
187
188ifneq ($(CONFIG_TIDSPBRIDGE),) 186ifneq ($(CONFIG_TIDSPBRIDGE),)
189obj-y += dsp.o 187obj-y += dsp.o
190endif 188endif
@@ -268,6 +266,11 @@ obj-y += $(smc91x-m) $(smc91x-y)
268 266
269smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o 267smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o
270obj-y += $(smsc911x-m) $(smsc911x-y) 268obj-y += $(smsc911x-m) $(smsc911x-y)
271obj-$(CONFIG_ARCH_OMAP4) += hwspinlock.o 269ifneq ($(CONFIG_HWSPINLOCK_OMAP),)
270obj-y += hwspinlock.o
271endif
272
273emac-$(CONFIG_TI_DAVINCI_EMAC) := am35xx-emac.o
274obj-y += $(emac-m) $(emac-y)
272 275
273obj-y += common-board-devices.o twl-common.o 276obj-y += common-board-devices.o twl-common.o
diff --git a/arch/arm/mach-omap2/am35xx-emac.c b/arch/arm/mach-omap2/am35xx-emac.c
new file mode 100644
index 00000000000..1f97e747520
--- /dev/null
+++ b/arch/arm/mach-omap2/am35xx-emac.c
@@ -0,0 +1,117 @@
1/*
2 * Copyright (C) 2011 Ilya Yanok, Emcraft Systems
3 *
4 * Based on mach-omap2/board-am3517evm.c
5 * Copyright (C) 2009 Texas Instruments Incorporated
6 * Author: Ranjith Lohithakshan <ranjithl@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
13 * whether express or implied; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#include <linux/clk.h>
19#include <linux/davinci_emac.h>
20#include <linux/platform_device.h>
21#include <plat/irqs.h>
22#include <mach/am35xx.h>
23
24#include "control.h"
25
26static struct mdio_platform_data am35xx_emac_mdio_pdata;
27
28static struct resource am35xx_emac_mdio_resources[] = {
29 DEFINE_RES_MEM(AM35XX_IPSS_EMAC_BASE + AM35XX_EMAC_MDIO_OFFSET, SZ_4K),
30};
31
32static struct platform_device am35xx_emac_mdio_device = {
33 .name = "davinci_mdio",
34 .id = 0,
35 .num_resources = ARRAY_SIZE(am35xx_emac_mdio_resources),
36 .resource = am35xx_emac_mdio_resources,
37 .dev.platform_data = &am35xx_emac_mdio_pdata,
38};
39
40static void am35xx_enable_emac_int(void)
41{
42 u32 regval;
43
44 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
45 regval = (regval | AM35XX_CPGMAC_C0_RX_PULSE_CLR |
46 AM35XX_CPGMAC_C0_TX_PULSE_CLR |
47 AM35XX_CPGMAC_C0_MISC_PULSE_CLR |
48 AM35XX_CPGMAC_C0_RX_THRESH_CLR);
49 omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR);
50 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
51}
52
53static void am35xx_disable_emac_int(void)
54{
55 u32 regval;
56
57 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
58 regval = (regval | AM35XX_CPGMAC_C0_RX_PULSE_CLR |
59 AM35XX_CPGMAC_C0_TX_PULSE_CLR);
60 omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR);
61 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
62}
63
64static struct emac_platform_data am35xx_emac_pdata = {
65 .ctrl_reg_offset = AM35XX_EMAC_CNTRL_OFFSET,
66 .ctrl_mod_reg_offset = AM35XX_EMAC_CNTRL_MOD_OFFSET,
67 .ctrl_ram_offset = AM35XX_EMAC_CNTRL_RAM_OFFSET,
68 .ctrl_ram_size = AM35XX_EMAC_CNTRL_RAM_SIZE,
69 .hw_ram_addr = AM35XX_EMAC_HW_RAM_ADDR,
70 .version = EMAC_VERSION_2,
71 .interrupt_enable = am35xx_enable_emac_int,
72 .interrupt_disable = am35xx_disable_emac_int,
73};
74
75static struct resource am35xx_emac_resources[] = {
76 DEFINE_RES_MEM(AM35XX_IPSS_EMAC_BASE, 0x30000),
77 DEFINE_RES_IRQ(INT_35XX_EMAC_C0_RXTHRESH_IRQ),
78 DEFINE_RES_IRQ(INT_35XX_EMAC_C0_RX_PULSE_IRQ),
79 DEFINE_RES_IRQ(INT_35XX_EMAC_C0_TX_PULSE_IRQ),
80 DEFINE_RES_IRQ(INT_35XX_EMAC_C0_MISC_PULSE_IRQ),
81};
82
83static struct platform_device am35xx_emac_device = {
84 .name = "davinci_emac",
85 .id = -1,
86 .num_resources = ARRAY_SIZE(am35xx_emac_resources),
87 .resource = am35xx_emac_resources,
88 .dev = {
89 .platform_data = &am35xx_emac_pdata,
90 },
91};
92
93void __init am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en)
94{
95 unsigned int regval;
96 int err;
97
98 am35xx_emac_pdata.rmii_en = rmii_en;
99 am35xx_emac_mdio_pdata.bus_freq = mdio_bus_freq;
100 err = platform_device_register(&am35xx_emac_device);
101 if (err) {
102 pr_err("AM35x: failed registering EMAC device: %d\n", err);
103 return;
104 }
105
106 err = platform_device_register(&am35xx_emac_mdio_device);
107 if (err) {
108 pr_err("AM35x: failed registering EMAC MDIO device: %d\n", err);
109 platform_device_unregister(&am35xx_emac_device);
110 return;
111 }
112
113 regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
114 regval = regval & (~(AM35XX_CPGMACSS_SW_RST));
115 omap_ctrl_writel(regval, AM35XX_CONTROL_IP_SW_RESET);
116 regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
117}
diff --git a/arch/arm/mach-omap2/am35xx-emac.h b/arch/arm/mach-omap2/am35xx-emac.h
new file mode 100644
index 00000000000..15c6f9ce59a
--- /dev/null
+++ b/arch/arm/mach-omap2/am35xx-emac.h
@@ -0,0 +1,15 @@
1/*
2 * Copyright (C) 2011 Ilya Yanok, Emcraft Systems
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#define AM35XX_DEFAULT_MDIO_FREQUENCY 1000000
10
11#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE)
12void am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en);
13#else
14static inline void am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en) {}
15#endif
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 7370983f809..c8bda62900d 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -279,7 +279,7 @@ static void __init omap_2430sdp_init(void)
279 platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices)); 279 platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
280 omap_serial_init(); 280 omap_serial_init();
281 omap_sdrc_init(NULL, NULL); 281 omap_sdrc_init(NULL, NULL);
282 omap2_hsmmc_init(mmc); 282 omap_hsmmc_init(mmc);
283 omap2_usbfs_init(&sdp2430_usb_config); 283 omap2_usbfs_init(&sdp2430_usb_config);
284 284
285 omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP); 285 omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP);
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 383717ba63b..da75f239873 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -232,11 +232,13 @@ static struct omap2_hsmmc_info mmc[] = {
232 */ 232 */
233 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 233 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
234 .gpio_wp = 4, 234 .gpio_wp = 4,
235 .deferred = true,
235 }, 236 },
236 { 237 {
237 .mmc = 2, 238 .mmc = 2,
238 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 239 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
239 .gpio_wp = 7, 240 .gpio_wp = 7,
241 .deferred = true,
240 }, 242 },
241 {} /* Terminator */ 243 {} /* Terminator */
242}; 244};
@@ -249,7 +251,7 @@ static int sdp3430_twl_gpio_setup(struct device *dev,
249 */ 251 */
250 mmc[0].gpio_cd = gpio + 0; 252 mmc[0].gpio_cd = gpio + 0;
251 mmc[1].gpio_cd = gpio + 1; 253 mmc[1].gpio_cd = gpio + 1;
252 omap2_hsmmc_init(mmc); 254 omap_hsmmc_late_init(mmc);
253 255
254 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ 256 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
255 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl"); 257 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl");
@@ -606,6 +608,7 @@ static void __init omap_3430sdp_init(void)
606 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 608 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
607 omap_board_config = sdp3430_config; 609 omap_board_config = sdp3430_config;
608 omap_board_config_size = ARRAY_SIZE(sdp3430_config); 610 omap_board_config_size = ARRAY_SIZE(sdp3430_config);
611 omap_hsmmc_init(mmc);
609 omap3430_i2c_init(); 612 omap3430_i2c_init();
610 omap_display_init(&sdp3430_dss_data); 613 omap_display_init(&sdp3430_dss_data);
611 if (omap_rev() > OMAP3430_REV_ES1_0) 614 if (omap_rev() > OMAP3430_REV_ES1_0)
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 4e9071589bf..30768c2f53f 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -25,6 +25,7 @@
25#include <linux/regulator/fixed.h> 25#include <linux/regulator/fixed.h>
26#include <linux/leds.h> 26#include <linux/leds.h>
27#include <linux/leds_pwm.h> 27#include <linux/leds_pwm.h>
28#include <linux/platform_data/omap4-keypad.h>
28 29
29#include <mach/hardware.h> 30#include <mach/hardware.h>
30#include <asm/hardware/gic.h> 31#include <asm/hardware/gic.h>
@@ -41,6 +42,7 @@
41#include <video/omap-panel-nokia-dsi.h> 42#include <video/omap-panel-nokia-dsi.h>
42#include <video/omap-panel-picodlp.h> 43#include <video/omap-panel-picodlp.h>
43#include <linux/wl12xx.h> 44#include <linux/wl12xx.h>
45#include <linux/platform_data/omap-abe-twl6040.h>
44 46
45#include "mux.h" 47#include "mux.h"
46#include "hsmmc.h" 48#include "hsmmc.h"
@@ -322,7 +324,10 @@ static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
322 .bus_num = 1, 324 .bus_num = 1,
323 .chip_select = 0, 325 .chip_select = 0,
324 .max_speed_hz = 24000000, 326 .max_speed_hz = 24000000,
325 .irq = ETH_KS8851_IRQ, 327 /*
328 * .irq is set to gpio_to_irq(ETH_KS8851_IRQ)
329 * in omap_4430sdp_init
330 */
326 }, 331 },
327}; 332};
328 333
@@ -378,12 +383,40 @@ static struct platform_device sdp4430_dmic_codec = {
378 .id = -1, 383 .id = -1,
379}; 384};
380 385
386static struct omap_abe_twl6040_data sdp4430_abe_audio_data = {
387 .card_name = "SDP4430",
388 .has_hs = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
389 .has_hf = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
390 .has_ep = 1,
391 .has_aux = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
392 .has_vibra = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
393
394 .has_dmic = 1,
395 .has_hsmic = 1,
396 .has_mainmic = 1,
397 .has_submic = 1,
398 .has_afm = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
399
400 .jack_detection = 1,
401 /* MCLK input is 38.4MHz */
402 .mclk_freq = 38400000,
403};
404
405static struct platform_device sdp4430_abe_audio = {
406 .name = "omap-abe-twl6040",
407 .id = -1,
408 .dev = {
409 .platform_data = &sdp4430_abe_audio_data,
410 },
411};
412
381static struct platform_device *sdp4430_devices[] __initdata = { 413static struct platform_device *sdp4430_devices[] __initdata = {
382 &sdp4430_gpio_keys_device, 414 &sdp4430_gpio_keys_device,
383 &sdp4430_leds_gpio, 415 &sdp4430_leds_gpio,
384 &sdp4430_leds_pwm, 416 &sdp4430_leds_pwm,
385 &sdp4430_vbat, 417 &sdp4430_vbat,
386 &sdp4430_dmic_codec, 418 &sdp4430_dmic_codec,
419 &sdp4430_abe_audio,
387}; 420};
388 421
389static struct omap_musb_board_data musb_board_data = { 422static struct omap_musb_board_data musb_board_data = {
@@ -491,9 +524,9 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
491{ 524{
492 struct omap2_hsmmc_info *c; 525 struct omap2_hsmmc_info *c;
493 526
494 omap2_hsmmc_init(controllers); 527 omap_hsmmc_init(controllers);
495 for (c = controllers; c->mmc; c++) 528 for (c = controllers; c->mmc; c++)
496 omap4_twl6030_hsmmc_set_late_init(c->dev); 529 omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev);
497 530
498 return 0; 531 return 0;
499} 532}
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 4b1cfe32e6b..3645285a3e2 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -39,124 +39,11 @@
39#include <video/omap-panel-generic-dpi.h> 39#include <video/omap-panel-generic-dpi.h>
40#include <video/omap-panel-dvi.h> 40#include <video/omap-panel-dvi.h>
41 41
42#include "am35xx-emac.h"
42#include "mux.h" 43#include "mux.h"
43#include "control.h" 44#include "control.h"
44#include "hsmmc.h" 45#include "hsmmc.h"
45 46
46#define AM35XX_EVM_MDIO_FREQUENCY (1000000)
47
48static struct mdio_platform_data am3517_evm_mdio_pdata = {
49 .bus_freq = AM35XX_EVM_MDIO_FREQUENCY,
50};
51
52static struct resource am3517_mdio_resources[] = {
53 {
54 .start = AM35XX_IPSS_EMAC_BASE + AM35XX_EMAC_MDIO_OFFSET,
55 .end = AM35XX_IPSS_EMAC_BASE + AM35XX_EMAC_MDIO_OFFSET +
56 SZ_4K - 1,
57 .flags = IORESOURCE_MEM,
58 },
59};
60
61static struct platform_device am3517_mdio_device = {
62 .name = "davinci_mdio",
63 .id = 0,
64 .num_resources = ARRAY_SIZE(am3517_mdio_resources),
65 .resource = am3517_mdio_resources,
66 .dev.platform_data = &am3517_evm_mdio_pdata,
67};
68
69static struct emac_platform_data am3517_evm_emac_pdata = {
70 .rmii_en = 1,
71};
72
73static struct resource am3517_emac_resources[] = {
74 {
75 .start = AM35XX_IPSS_EMAC_BASE,
76 .end = AM35XX_IPSS_EMAC_BASE + 0x2FFFF,
77 .flags = IORESOURCE_MEM,
78 },
79 {
80 .start = INT_35XX_EMAC_C0_RXTHRESH_IRQ,
81 .end = INT_35XX_EMAC_C0_RXTHRESH_IRQ,
82 .flags = IORESOURCE_IRQ,
83 },
84 {
85 .start = INT_35XX_EMAC_C0_RX_PULSE_IRQ,
86 .end = INT_35XX_EMAC_C0_RX_PULSE_IRQ,
87 .flags = IORESOURCE_IRQ,
88 },
89 {
90 .start = INT_35XX_EMAC_C0_TX_PULSE_IRQ,
91 .end = INT_35XX_EMAC_C0_TX_PULSE_IRQ,
92 .flags = IORESOURCE_IRQ,
93 },
94 {
95 .start = INT_35XX_EMAC_C0_MISC_PULSE_IRQ,
96 .end = INT_35XX_EMAC_C0_MISC_PULSE_IRQ,
97 .flags = IORESOURCE_IRQ,
98 },
99};
100
101static struct platform_device am3517_emac_device = {
102 .name = "davinci_emac",
103 .id = -1,
104 .num_resources = ARRAY_SIZE(am3517_emac_resources),
105 .resource = am3517_emac_resources,
106};
107
108static void am3517_enable_ethernet_int(void)
109{
110 u32 regval;
111
112 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
113 regval = (regval | AM35XX_CPGMAC_C0_RX_PULSE_CLR |
114 AM35XX_CPGMAC_C0_TX_PULSE_CLR |
115 AM35XX_CPGMAC_C0_MISC_PULSE_CLR |
116 AM35XX_CPGMAC_C0_RX_THRESH_CLR);
117 omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR);
118 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
119}
120
121static void am3517_disable_ethernet_int(void)
122{
123 u32 regval;
124
125 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
126 regval = (regval | AM35XX_CPGMAC_C0_RX_PULSE_CLR |
127 AM35XX_CPGMAC_C0_TX_PULSE_CLR);
128 omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR);
129 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
130}
131
132static void am3517_evm_ethernet_init(struct emac_platform_data *pdata)
133{
134 unsigned int regval;
135
136 pdata->ctrl_reg_offset = AM35XX_EMAC_CNTRL_OFFSET;
137 pdata->ctrl_mod_reg_offset = AM35XX_EMAC_CNTRL_MOD_OFFSET;
138 pdata->ctrl_ram_offset = AM35XX_EMAC_CNTRL_RAM_OFFSET;
139 pdata->ctrl_ram_size = AM35XX_EMAC_CNTRL_RAM_SIZE;
140 pdata->version = EMAC_VERSION_2;
141 pdata->hw_ram_addr = AM35XX_EMAC_HW_RAM_ADDR;
142 pdata->interrupt_enable = am3517_enable_ethernet_int;
143 pdata->interrupt_disable = am3517_disable_ethernet_int;
144 am3517_emac_device.dev.platform_data = pdata;
145 platform_device_register(&am3517_emac_device);
146 platform_device_register(&am3517_mdio_device);
147 clk_add_alias(NULL, dev_name(&am3517_mdio_device.dev),
148 NULL, &am3517_emac_device.dev);
149
150 regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
151 regval = regval & (~(AM35XX_CPGMACSS_SW_RST));
152 omap_ctrl_writel(regval, AM35XX_CONTROL_IP_SW_RESET);
153 regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
154
155 return ;
156}
157
158
159
160#define LCD_PANEL_PWR 176 47#define LCD_PANEL_PWR 176
161#define LCD_PANEL_BKLIGHT_PWR 182 48#define LCD_PANEL_BKLIGHT_PWR 182
162#define LCD_PANEL_PWM 181 49#define LCD_PANEL_PWM 181
@@ -498,13 +385,13 @@ static void __init am3517_evm_init(void)
498 i2c_register_board_info(1, am3517evm_i2c1_boardinfo, 385 i2c_register_board_info(1, am3517evm_i2c1_boardinfo,
499 ARRAY_SIZE(am3517evm_i2c1_boardinfo)); 386 ARRAY_SIZE(am3517evm_i2c1_boardinfo));
500 /*Ethernet*/ 387 /*Ethernet*/
501 am3517_evm_ethernet_init(&am3517_evm_emac_pdata); 388 am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1);
502 389
503 /* MUSB */ 390 /* MUSB */
504 am3517_evm_musb_init(); 391 am3517_evm_musb_init();
505 392
506 /* MMC init function */ 393 /* MMC init function */
507 omap2_hsmmc_init(mmc); 394 omap_hsmmc_init(mmc);
508} 395}
509 396
510MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM") 397MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index d73316ed420..41b0a2fe0b0 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -280,7 +280,6 @@ static struct omap_dss_board_info cm_t35_dss_data = {
280 280
281static struct omap2_mcspi_device_config tdo24m_mcspi_config = { 281static struct omap2_mcspi_device_config tdo24m_mcspi_config = {
282 .turbo_mode = 0, 282 .turbo_mode = 0,
283 .single_channel = 1, /* 0: slave, 1: master */
284}; 283};
285 284
286static struct tdo24m_platform_data tdo24m_config = { 285static struct tdo24m_platform_data tdo24m_config = {
@@ -413,7 +412,7 @@ static struct omap2_hsmmc_info mmc[] = {
413 .caps = MMC_CAP_4_BIT_DATA, 412 .caps = MMC_CAP_4_BIT_DATA,
414 .gpio_cd = -EINVAL, 413 .gpio_cd = -EINVAL,
415 .gpio_wp = -EINVAL, 414 .gpio_wp = -EINVAL,
416 415 .deferred = true,
417 }, 416 },
418 { 417 {
419 .mmc = 2, 418 .mmc = 2,
@@ -471,7 +470,7 @@ static int cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio,
471 470
472 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 471 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
473 mmc[0].gpio_cd = gpio + 0; 472 mmc[0].gpio_cd = gpio + 0;
474 omap2_hsmmc_init(mmc); 473 omap_hsmmc_late_init(mmc);
475 474
476 return 0; 475 return 0;
477} 476}
@@ -639,6 +638,7 @@ static void __init cm_t3x_common_init(void)
639 omap_serial_init(); 638 omap_serial_init();
640 omap_sdrc_init(mt46h32m32lf6_sdrc_params, 639 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
641 mt46h32m32lf6_sdrc_params); 640 mt46h32m32lf6_sdrc_params);
641 omap_hsmmc_init(mmc);
642 cm_t35_init_i2c(); 642 cm_t35_init_i2c();
643 omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL); 643 omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL);
644 cm_t35_init_ethernet(); 644 cm_t35_init_ethernet();
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index f36d694d215..9e66e167e4f 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -49,6 +49,7 @@
49#include "mux.h" 49#include "mux.h"
50#include "control.h" 50#include "control.h"
51#include "common-board-devices.h" 51#include "common-board-devices.h"
52#include "am35xx-emac.h"
52 53
53#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 54#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
54static struct gpio_led cm_t3517_leds[] = { 55static struct gpio_led cm_t3517_leds[] = {
@@ -291,6 +292,7 @@ static void __init cm_t3517_init(void)
291 cm_t3517_init_rtc(); 292 cm_t3517_init_rtc();
292 cm_t3517_init_usbh(); 293 cm_t3517_init_usbh();
293 cm_t3517_init_hecc(); 294 cm_t3517_init_hecc();
295 am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1);
294} 296}
295 297
296MACHINE_START(CM_T3517, "Compulab CM-T3517") 298MACHINE_START(CM_T3517, "Compulab CM-T3517")
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index e873063f4fd..11cd2a80609 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -100,6 +100,7 @@ static struct omap2_hsmmc_info mmc[] = {
100 .mmc = 1, 100 .mmc = 1,
101 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 101 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
102 .gpio_wp = 29, 102 .gpio_wp = 29,
103 .deferred = true,
103 }, 104 },
104 {} /* Terminator */ 105 {} /* Terminator */
105}; 106};
@@ -228,7 +229,7 @@ static int devkit8000_twl_gpio_setup(struct device *dev,
228 229
229 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 230 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
230 mmc[0].gpio_cd = gpio + 0; 231 mmc[0].gpio_cd = gpio + 0;
231 omap2_hsmmc_init(mmc); 232 omap_hsmmc_late_init(mmc);
232 233
233 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 234 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
234 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 235 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -636,6 +637,7 @@ static void __init devkit8000_init(void)
636 637
637 omap_dm9000_init(); 638 omap_dm9000_init();
638 639
640 omap_hsmmc_init(mmc);
639 devkit8000_i2c_init(); 641 devkit8000_i2c_init();
640 platform_add_devices(devkit8000_devices, 642 platform_add_devices(devkit8000_devices,
641 ARRAY_SIZE(devkit8000_devices)); 643 ARRAY_SIZE(devkit8000_devices));
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index 30a6f527510..0349fd2b68d 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -189,7 +189,7 @@ unmap:
189 * 189 *
190 * @return - void. 190 * @return - void.
191 */ 191 */
192void board_flash_init(struct flash_partitions partition_info[], 192void __init board_flash_init(struct flash_partitions partition_info[],
193 char chip_sel_board[][GPMC_CS_NUM], int nand_type) 193 char chip_sel_board[][GPMC_CS_NUM], int nand_type)
194{ 194{
195 u8 cs = 0; 195 u8 cs = 0;
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 45fdfe2bd9d..74e1687b517 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -12,6 +12,7 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/of_irq.h>
15#include <linux/of_platform.h> 16#include <linux/of_platform.h>
16#include <linux/irqdomain.h> 17#include <linux/irqdomain.h>
17#include <linux/i2c/twl.h> 18#include <linux/i2c/twl.h>
@@ -24,33 +25,23 @@
24#include "common.h" 25#include "common.h"
25#include "common-board-devices.h" 26#include "common-board-devices.h"
26 27
27/* 28#if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3))
28 * XXX: Still needed to boot until the i2c & twl driver is adapted to 29#define omap_intc_of_init NULL
29 * device-tree 30#endif
30 */ 31#ifndef CONFIG_ARCH_OMAP4
31#ifdef CONFIG_ARCH_OMAP4 32#define gic_of_init NULL
32static struct twl4030_platform_data sdp4430_twldata = {
33 .irq_base = TWL6030_IRQ_BASE,
34 .irq_end = TWL6030_IRQ_END,
35};
36
37static void __init omap4_i2c_init(void)
38{
39 omap4_pmic_init("twl6030", &sdp4430_twldata);
40}
41#endif 33#endif
42 34
43#ifdef CONFIG_ARCH_OMAP3 35static struct of_device_id irq_match[] __initdata = {
44static struct twl4030_platform_data beagle_twldata = { 36 { .compatible = "ti,omap2-intc", .data = omap_intc_of_init, },
45 .irq_base = TWL4030_IRQ_BASE, 37 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
46 .irq_end = TWL4030_IRQ_END, 38 { }
47}; 39};
48 40
49static void __init omap3_i2c_init(void) 41static void __init omap_init_irq(void)
50{ 42{
51 omap3_pmic_init("twl4030", &beagle_twldata); 43 of_irq_init(irq_match);
52} 44}
53#endif
54 45
55static struct of_device_id omap_dt_match_table[] __initdata = { 46static struct of_device_id omap_dt_match_table[] __initdata = {
56 { .compatible = "simple-bus", }, 47 { .compatible = "simple-bus", },
@@ -58,51 +49,24 @@ static struct of_device_id omap_dt_match_table[] __initdata = {
58 { } 49 { }
59}; 50};
60 51
61static struct of_device_id intc_match[] __initdata = {
62 { .compatible = "ti,omap3-intc", },
63 { .compatible = "arm,cortex-a9-gic", },
64 { }
65};
66
67static void __init omap_generic_init(void) 52static void __init omap_generic_init(void)
68{ 53{
69 struct device_node *node = of_find_matching_node(NULL, intc_match);
70 if (node)
71 irq_domain_add_legacy(node, 32, 0, 0, &irq_domain_simple_ops, NULL);
72
73 omap_sdrc_init(NULL, NULL); 54 omap_sdrc_init(NULL, NULL);
74 55
75 of_platform_populate(NULL, omap_dt_match_table, NULL, NULL); 56 of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
76} 57}
77 58
78#ifdef CONFIG_ARCH_OMAP4 59#ifdef CONFIG_SOC_OMAP2420
79static void __init omap4_init(void)
80{
81 omap4_i2c_init();
82 omap_generic_init();
83}
84#endif
85
86#ifdef CONFIG_ARCH_OMAP3
87static void __init omap3_init(void)
88{
89 omap3_i2c_init();
90 omap_generic_init();
91}
92#endif
93
94#if defined(CONFIG_SOC_OMAP2420)
95static const char *omap242x_boards_compat[] __initdata = { 60static const char *omap242x_boards_compat[] __initdata = {
96 "ti,omap2420", 61 "ti,omap2420",
97 NULL, 62 NULL,
98}; 63};
99 64
100DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)") 65DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
101 .atag_offset = 0x100,
102 .reserve = omap_reserve, 66 .reserve = omap_reserve,
103 .map_io = omap242x_map_io, 67 .map_io = omap242x_map_io,
104 .init_early = omap2420_init_early, 68 .init_early = omap2420_init_early,
105 .init_irq = omap2_init_irq, 69 .init_irq = omap_init_irq,
106 .handle_irq = omap2_intc_handle_irq, 70 .handle_irq = omap2_intc_handle_irq,
107 .init_machine = omap_generic_init, 71 .init_machine = omap_generic_init,
108 .timer = &omap2_timer, 72 .timer = &omap2_timer,
@@ -111,18 +75,17 @@ DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
111MACHINE_END 75MACHINE_END
112#endif 76#endif
113 77
114#if defined(CONFIG_SOC_OMAP2430) 78#ifdef CONFIG_SOC_OMAP2430
115static const char *omap243x_boards_compat[] __initdata = { 79static const char *omap243x_boards_compat[] __initdata = {
116 "ti,omap2430", 80 "ti,omap2430",
117 NULL, 81 NULL,
118}; 82};
119 83
120DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)") 84DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
121 .atag_offset = 0x100,
122 .reserve = omap_reserve, 85 .reserve = omap_reserve,
123 .map_io = omap243x_map_io, 86 .map_io = omap243x_map_io,
124 .init_early = omap2430_init_early, 87 .init_early = omap2430_init_early,
125 .init_irq = omap2_init_irq, 88 .init_irq = omap_init_irq,
126 .handle_irq = omap2_intc_handle_irq, 89 .handle_irq = omap2_intc_handle_irq,
127 .init_machine = omap_generic_init, 90 .init_machine = omap_generic_init,
128 .timer = &omap2_timer, 91 .timer = &omap2_timer,
@@ -131,18 +94,33 @@ DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
131MACHINE_END 94MACHINE_END
132#endif 95#endif
133 96
134#if defined(CONFIG_ARCH_OMAP3) 97#ifdef CONFIG_ARCH_OMAP3
98static struct twl4030_platform_data beagle_twldata = {
99 .irq_base = TWL4030_IRQ_BASE,
100 .irq_end = TWL4030_IRQ_END,
101};
102
103static void __init omap3_i2c_init(void)
104{
105 omap3_pmic_init("twl4030", &beagle_twldata);
106}
107
108static void __init omap3_init(void)
109{
110 omap3_i2c_init();
111 omap_generic_init();
112}
113
135static const char *omap3_boards_compat[] __initdata = { 114static const char *omap3_boards_compat[] __initdata = {
136 "ti,omap3", 115 "ti,omap3",
137 NULL, 116 NULL,
138}; 117};
139 118
140DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)") 119DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
141 .atag_offset = 0x100,
142 .reserve = omap_reserve, 120 .reserve = omap_reserve,
143 .map_io = omap3_map_io, 121 .map_io = omap3_map_io,
144 .init_early = omap3430_init_early, 122 .init_early = omap3430_init_early,
145 .init_irq = omap3_init_irq, 123 .init_irq = omap_init_irq,
146 .handle_irq = omap3_intc_handle_irq, 124 .handle_irq = omap3_intc_handle_irq,
147 .init_machine = omap3_init, 125 .init_machine = omap3_init,
148 .timer = &omap3_timer, 126 .timer = &omap3_timer,
@@ -151,18 +129,33 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
151MACHINE_END 129MACHINE_END
152#endif 130#endif
153 131
154#if defined(CONFIG_ARCH_OMAP4) 132#ifdef CONFIG_ARCH_OMAP4
133static struct twl4030_platform_data sdp4430_twldata = {
134 .irq_base = TWL6030_IRQ_BASE,
135 .irq_end = TWL6030_IRQ_END,
136};
137
138static void __init omap4_i2c_init(void)
139{
140 omap4_pmic_init("twl6030", &sdp4430_twldata);
141}
142
143static void __init omap4_init(void)
144{
145 omap4_i2c_init();
146 omap_generic_init();
147}
148
155static const char *omap4_boards_compat[] __initdata = { 149static const char *omap4_boards_compat[] __initdata = {
156 "ti,omap4", 150 "ti,omap4",
157 NULL, 151 NULL,
158}; 152};
159 153
160DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)") 154DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
161 .atag_offset = 0x100,
162 .reserve = omap_reserve, 155 .reserve = omap_reserve,
163 .map_io = omap4_map_io, 156 .map_io = omap4_map_io,
164 .init_early = omap4430_init_early, 157 .init_early = omap4430_init_early,
165 .init_irq = gic_init_irq, 158 .init_irq = omap_init_irq,
166 .handle_irq = gic_handle_irq, 159 .handle_irq = gic_handle_irq,
167 .init_machine = omap4_init, 160 .init_machine = omap4_init,
168 .timer = &omap4_timer, 161 .timer = &omap4_timer,
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index a59ace0ed56..e558800adfd 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -295,6 +295,7 @@ static struct omap2_hsmmc_info mmc[] = {
295 .caps = MMC_CAP_4_BIT_DATA, 295 .caps = MMC_CAP_4_BIT_DATA,
296 .gpio_cd = -EINVAL, 296 .gpio_cd = -EINVAL,
297 .gpio_wp = -EINVAL, 297 .gpio_wp = -EINVAL,
298 .deferred = true,
298 }, 299 },
299#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) 300#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
300 { 301 {
@@ -402,7 +403,7 @@ static int igep_twl_gpio_setup(struct device *dev,
402 403
403 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 404 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
404 mmc[0].gpio_cd = gpio + 0; 405 mmc[0].gpio_cd = gpio + 0;
405 omap2_hsmmc_init(mmc); 406 omap_hsmmc_late_init(mmc);
406 407
407 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 408 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
408#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) 409#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
@@ -639,6 +640,9 @@ static void __init igep_init(void)
639 640
640 /* Get IGEP2 hardware revision */ 641 /* Get IGEP2 hardware revision */
641 igep2_get_revision(); 642 igep2_get_revision();
643
644 omap_hsmmc_init(mmc);
645
642 /* Register I2C busses and drivers */ 646 /* Register I2C busses and drivers */
643 igep_i2c_init(); 647 igep_i2c_init();
644 platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices)); 648 platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices));
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 2d2a61f7dcb..d50a562adfa 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -27,7 +27,6 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/smsc911x.h> 28#include <linux/smsc911x.h>
29#include <linux/mmc/host.h> 29#include <linux/mmc/host.h>
30#include <linux/gpio.h>
31 30
32#include <mach/hardware.h> 31#include <mach/hardware.h>
33#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -424,7 +423,7 @@ static void __init omap_ldp_init(void)
424 board_nand_init(ldp_nand_partitions, 423 board_nand_init(ldp_nand_partitions,
425 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); 424 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0);
426 425
427 omap2_hsmmc_init(mmc); 426 omap_hsmmc_init(mmc);
428 ldp_display_init(); 427 ldp_display_init();
429} 428}
430 429
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 67226271760..518091c5f77 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -36,10 +36,6 @@
36 36
37#include "mux.h" 37#include "mux.h"
38 38
39static int slot1_cover_open;
40static int slot2_cover_open;
41static struct device *mmc_device;
42
43#define TUSB6010_ASYNC_CS 1 39#define TUSB6010_ASYNC_CS 1
44#define TUSB6010_SYNC_CS 4 40#define TUSB6010_SYNC_CS 4
45#define TUSB6010_GPIO_INT 58 41#define TUSB6010_GPIO_INT 58
@@ -137,7 +133,6 @@ static void __init n8x0_usb_init(void) {}
137 133
138static struct omap2_mcspi_device_config p54spi_mcspi_config = { 134static struct omap2_mcspi_device_config p54spi_mcspi_config = {
139 .turbo_mode = 0, 135 .turbo_mode = 0,
140 .single_channel = 1,
141}; 136};
142 137
143static struct spi_board_info n800_spi_board_info[] __initdata = { 138static struct spi_board_info n800_spi_board_info[] __initdata = {
@@ -211,6 +206,10 @@ static struct omap_onenand_platform_data board_onenand_data[] = {
211#define N810_EMMC_VSD_GPIO 23 206#define N810_EMMC_VSD_GPIO 23
212#define N810_EMMC_VIO_GPIO 9 207#define N810_EMMC_VIO_GPIO 9
213 208
209static int slot1_cover_open;
210static int slot2_cover_open;
211static struct device *mmc_device;
212
214static int n8x0_mmc_switch_slot(struct device *dev, int slot) 213static int n8x0_mmc_switch_slot(struct device *dev, int slot)
215{ 214{
216#ifdef CONFIG_MMC_DEBUG 215#ifdef CONFIG_MMC_DEBUG
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 7ffcd2839e7..7be8d659d91 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -253,6 +253,7 @@ static struct omap2_hsmmc_info mmc[] = {
253 .mmc = 1, 253 .mmc = 1,
254 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 254 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
255 .gpio_wp = -EINVAL, 255 .gpio_wp = -EINVAL,
256 .deferred = true,
256 }, 257 },
257 {} /* Terminator */ 258 {} /* Terminator */
258}; 259};
@@ -272,12 +273,10 @@ static int beagle_twl_gpio_setup(struct device *dev,
272{ 273{
273 int r; 274 int r;
274 275
275 if (beagle_config.mmc1_gpio_wp != -EINVAL)
276 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
277 mmc[0].gpio_wp = beagle_config.mmc1_gpio_wp; 276 mmc[0].gpio_wp = beagle_config.mmc1_gpio_wp;
278 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 277 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
279 mmc[0].gpio_cd = gpio + 0; 278 mmc[0].gpio_cd = gpio + 0;
280 omap2_hsmmc_init(mmc); 279 omap_hsmmc_late_init(mmc);
281 280
282 /* 281 /*
283 * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active 282 * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active
@@ -521,6 +520,11 @@ static void __init omap3_beagle_init(void)
521{ 520{
522 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 521 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
523 omap3_beagle_init_rev(); 522 omap3_beagle_init_rev();
523
524 if (beagle_config.mmc1_gpio_wp != -EINVAL)
525 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
526 omap_hsmmc_init(mmc);
527
524 omap3_beagle_i2c_init(); 528 omap3_beagle_i2c_init();
525 529
526 gpio_buttons[0].gpio = beagle_config.usr_button_gpio; 530 gpio_buttons[0].gpio = beagle_config.usr_button_gpio;
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index c877236a844..a659e198892 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -317,6 +317,7 @@ static struct omap2_hsmmc_info mmc[] = {
317 .caps = MMC_CAP_4_BIT_DATA, 317 .caps = MMC_CAP_4_BIT_DATA,
318 .gpio_cd = -EINVAL, 318 .gpio_cd = -EINVAL,
319 .gpio_wp = 63, 319 .gpio_wp = 63,
320 .deferred = true,
320 }, 321 },
321#ifdef CONFIG_WL12XX_PLATFORM_DATA 322#ifdef CONFIG_WL12XX_PLATFORM_DATA
322 { 323 {
@@ -361,9 +362,8 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
361 int r, lcd_bl_en; 362 int r, lcd_bl_en;
362 363
363 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 364 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
364 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
365 mmc[0].gpio_cd = gpio + 0; 365 mmc[0].gpio_cd = gpio + 0;
366 omap2_hsmmc_init(mmc); 366 omap_hsmmc_late_init(mmc);
367 367
368 /* 368 /*
369 * Most GPIOs are for USB OTG. Some are mostly sent to 369 * Most GPIOs are for USB OTG. Some are mostly sent to
@@ -644,6 +644,9 @@ static void __init omap3_evm_init(void)
644 omap_board_config = omap3_evm_config; 644 omap_board_config = omap3_evm_config;
645 omap_board_config_size = ARRAY_SIZE(omap3_evm_config); 645 omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
646 646
647 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
648 omap_hsmmc_init(mmc);
649
647 omap3_evm_i2c_init(); 650 omap3_evm_i2c_init();
648 651
649 omap_display_init(&omap3_evm_dss_data); 652 omap_display_init(&omap3_evm_dss_data);
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 4198dd017d8..4a7d8c8a75d 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -128,7 +128,7 @@ static void __init board_mmc_init(void)
128 return; 128 return;
129 } 129 }
130 130
131 omap2_hsmmc_init(board_mmc_info); 131 omap_hsmmc_init(board_mmc_info);
132} 132}
133 133
134static struct omap_smsc911x_platform_data __initdata board_smsc911x_data = { 134static struct omap_smsc911x_platform_data __initdata board_smsc911x_data = {
@@ -205,6 +205,7 @@ static void __init omap3logic_init(void)
205 205
206MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board") 206MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
207 .atag_offset = 0x100, 207 .atag_offset = 0x100,
208 .reserve = omap_reserve,
208 .map_io = omap3_map_io, 209 .map_io = omap3_map_io,
209 .init_early = omap35xx_init_early, 210 .init_early = omap35xx_init_early,
210 .init_irq = omap3_init_irq, 211 .init_irq = omap3_init_irq,
@@ -216,6 +217,7 @@ MACHINE_END
216 217
217MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board") 218MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
218 .atag_offset = 0x100, 219 .atag_offset = 0x100,
220 .reserve = omap_reserve,
219 .map_io = omap3_map_io, 221 .map_io = omap3_map_io,
220 .init_early = omap35xx_init_early, 222 .init_early = omap35xx_init_early,
221 .init_irq = omap3_init_irq, 223 .init_irq = omap3_init_irq,
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 1644b73017f..33d995d0f07 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -121,6 +121,11 @@ static struct platform_device pandora_leds_gpio = {
121 }, 121 },
122}; 122};
123 123
124static struct platform_device pandora_backlight = {
125 .name = "pandora-backlight",
126 .id = -1,
127};
128
124#define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \ 129#define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \
125{ \ 130{ \
126 .gpio = gpio_num, \ 131 .gpio = gpio_num, \
@@ -273,6 +278,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = {
273 .gpio_cd = -EINVAL, 278 .gpio_cd = -EINVAL,
274 .gpio_wp = 126, 279 .gpio_wp = 126,
275 .ext_clock = 0, 280 .ext_clock = 0,
281 .deferred = true,
276 }, 282 },
277 { 283 {
278 .mmc = 2, 284 .mmc = 2,
@@ -281,6 +287,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = {
281 .gpio_wp = 127, 287 .gpio_wp = 127,
282 .ext_clock = 1, 288 .ext_clock = 1,
283 .transceiver = true, 289 .transceiver = true,
290 .deferred = true,
284 }, 291 },
285 { 292 {
286 .mmc = 3, 293 .mmc = 3,
@@ -300,7 +307,7 @@ static int omap3pandora_twl_gpio_setup(struct device *dev,
300 /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */ 307 /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */
301 omap3pandora_mmc[0].gpio_cd = gpio + 0; 308 omap3pandora_mmc[0].gpio_cd = gpio + 0;
302 omap3pandora_mmc[1].gpio_cd = gpio + 1; 309 omap3pandora_mmc[1].gpio_cd = gpio + 1;
303 omap2_hsmmc_init(omap3pandora_mmc); 310 omap_hsmmc_late_init(omap3pandora_mmc);
304 311
305 /* gpio + 13 drives 32kHz buffer for wifi module */ 312 /* gpio + 13 drives 32kHz buffer for wifi module */
306 gpio_32khz = gpio + 13; 313 gpio_32khz = gpio + 13;
@@ -343,7 +350,7 @@ static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = {
343}; 350};
344 351
345static struct regulator_consumer_supply pandora_usb_phy_supply[] = { 352static struct regulator_consumer_supply pandora_usb_phy_supply[] = {
346 REGULATOR_SUPPLY("hsusb0", "ehci-omap.0"), 353 REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"),
347}; 354};
348 355
349/* ads7846 on SPI and 2 nub controllers on I2C */ 356/* ads7846 on SPI and 2 nub controllers on I2C */
@@ -476,6 +483,10 @@ static struct platform_device pandora_vwlan_device = {
476 483
477static struct twl4030_bci_platform_data pandora_bci_data; 484static struct twl4030_bci_platform_data pandora_bci_data;
478 485
486static struct twl4030_power_data pandora_power_data = {
487 .use_poweroff = true,
488};
489
479static struct twl4030_platform_data omap3pandora_twldata = { 490static struct twl4030_platform_data omap3pandora_twldata = {
480 .gpio = &omap3pandora_gpio_data, 491 .gpio = &omap3pandora_gpio_data,
481 .vmmc1 = &pandora_vmmc1, 492 .vmmc1 = &pandora_vmmc1,
@@ -486,6 +497,7 @@ static struct twl4030_platform_data omap3pandora_twldata = {
486 .vsim = &pandora_vsim, 497 .vsim = &pandora_vsim,
487 .keypad = &pandora_kp_data, 498 .keypad = &pandora_kp_data,
488 .bci = &pandora_bci_data, 499 .bci = &pandora_bci_data,
500 .power = &pandora_power_data,
489}; 501};
490 502
491static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = { 503static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
@@ -557,17 +569,18 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
557 &pandora_leds_gpio, 569 &pandora_leds_gpio,
558 &pandora_keys_gpio, 570 &pandora_keys_gpio,
559 &pandora_vwlan_device, 571 &pandora_vwlan_device,
572 &pandora_backlight,
560}; 573};
561 574
562static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 575static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
563 576
564 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 577 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
565 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, 578 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
566 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 579 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
567 580
568 .phy_reset = true, 581 .phy_reset = true,
569 .reset_gpio_port[0] = 16, 582 .reset_gpio_port[0] = -EINVAL,
570 .reset_gpio_port[1] = -EINVAL, 583 .reset_gpio_port[1] = 16,
571 .reset_gpio_port[2] = -EINVAL 584 .reset_gpio_port[2] = -EINVAL
572}; 585};
573 586
@@ -580,6 +593,7 @@ static struct omap_board_mux board_mux[] __initdata = {
580static void __init omap3pandora_init(void) 593static void __init omap3pandora_init(void)
581{ 594{
582 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 595 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
596 omap_hsmmc_init(omap3pandora_mmc);
583 omap3pandora_i2c_init(); 597 omap3pandora_i2c_init();
584 pandora_wl1251_init(); 598 pandora_wl1251_init();
585 platform_add_devices(omap3pandora_devices, 599 platform_add_devices(omap3pandora_devices,
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index cb089a46f62..64100438079 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -209,10 +209,11 @@ static struct regulator_init_data omap3stalker_vsim = {
209 209
210static struct omap2_hsmmc_info mmc[] = { 210static struct omap2_hsmmc_info mmc[] = {
211 { 211 {
212 .mmc = 1, 212 .mmc = 1,
213 .caps = MMC_CAP_4_BIT_DATA, 213 .caps = MMC_CAP_4_BIT_DATA,
214 .gpio_cd = -EINVAL, 214 .gpio_cd = -EINVAL,
215 .gpio_wp = 23, 215 .gpio_wp = 23,
216 .deferred = true,
216 }, 217 },
217 {} /* Terminator */ 218 {} /* Terminator */
218}; 219};
@@ -282,9 +283,8 @@ omap3stalker_twl_gpio_setup(struct device *dev,
282 unsigned gpio, unsigned ngpio) 283 unsigned gpio, unsigned ngpio)
283{ 284{
284 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 285 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
285 omap_mux_init_gpio(23, OMAP_PIN_INPUT);
286 mmc[0].gpio_cd = gpio + 0; 286 mmc[0].gpio_cd = gpio + 0;
287 omap2_hsmmc_init(mmc); 287 omap_hsmmc_late_init(mmc);
288 288
289 /* 289 /*
290 * Most GPIOs are for USB OTG. Some are mostly sent to 290 * Most GPIOs are for USB OTG. Some are mostly sent to
@@ -425,6 +425,9 @@ static void __init omap3_stalker_init(void)
425 omap_board_config = omap3_stalker_config; 425 omap_board_config = omap3_stalker_config;
426 omap_board_config_size = ARRAY_SIZE(omap3_stalker_config); 426 omap_board_config_size = ARRAY_SIZE(omap3_stalker_config);
427 427
428 omap_mux_init_gpio(23, OMAP_PIN_INPUT);
429 omap_hsmmc_init(mmc);
430
428 omap3_stalker_i2c_init(); 431 omap3_stalker_i2c_init();
429 432
430 platform_add_devices(omap3_stalker_devices, 433 platform_add_devices(omap3_stalker_devices,
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index a0b851aafcc..8842e04aef0 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -100,6 +100,7 @@ static struct omap2_hsmmc_info mmc[] = {
100 .mmc = 1, 100 .mmc = 1,
101 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 101 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
102 .gpio_wp = 29, 102 .gpio_wp = 29,
103 .deferred = true,
103 }, 104 },
104 {} /* Terminator */ 105 {} /* Terminator */
105}; 106};
@@ -117,15 +118,9 @@ static struct gpio_led gpio_leds[];
117static int touchbook_twl_gpio_setup(struct device *dev, 118static int touchbook_twl_gpio_setup(struct device *dev,
118 unsigned gpio, unsigned ngpio) 119 unsigned gpio, unsigned ngpio)
119{ 120{
120 if (system_rev >= 0x20 && system_rev <= 0x34301000) {
121 omap_mux_init_gpio(23, OMAP_PIN_INPUT);
122 mmc[0].gpio_wp = 23;
123 } else {
124 omap_mux_init_gpio(29, OMAP_PIN_INPUT);
125 }
126 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 121 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
127 mmc[0].gpio_cd = gpio + 0; 122 mmc[0].gpio_cd = gpio + 0;
128 omap2_hsmmc_init(mmc); 123 omap_hsmmc_late_init(mmc);
129 124
130 /* REVISIT: need ehci-omap hooks for external VBUS 125 /* REVISIT: need ehci-omap hooks for external VBUS
131 * power switch and overcurrent detect 126 * power switch and overcurrent detect
@@ -351,6 +346,14 @@ static void __init omap3_touchbook_init(void)
351 346
352 pm_power_off = omap3_touchbook_poweroff; 347 pm_power_off = omap3_touchbook_poweroff;
353 348
349 if (system_rev >= 0x20 && system_rev <= 0x34301000) {
350 omap_mux_init_gpio(23, OMAP_PIN_INPUT);
351 mmc[0].gpio_wp = 23;
352 } else {
353 omap_mux_init_gpio(29, OMAP_PIN_INPUT);
354 }
355 omap_hsmmc_init(mmc);
356
354 omap3_touchbook_i2c_init(); 357 omap3_touchbook_i2c_init();
355 platform_add_devices(omap3_touchbook_devices, 358 platform_add_devices(omap3_touchbook_devices,
356 ARRAY_SIZE(omap3_touchbook_devices)); 359 ARRAY_SIZE(omap3_touchbook_devices));
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 28fc271f703..e9071a57c37 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -28,6 +28,7 @@
28#include <linux/regulator/machine.h> 28#include <linux/regulator/machine.h>
29#include <linux/regulator/fixed.h> 29#include <linux/regulator/fixed.h>
30#include <linux/wl12xx.h> 30#include <linux/wl12xx.h>
31#include <linux/platform_data/omap-abe-twl6040.h>
31 32
32#include <mach/hardware.h> 33#include <mach/hardware.h>
33#include <asm/hardware/gic.h> 34#include <asm/hardware/gic.h>
@@ -91,9 +92,40 @@ static struct platform_device leds_gpio = {
91 }, 92 },
92}; 93};
93 94
95static struct omap_abe_twl6040_data panda_abe_audio_data = {
96 /* Audio out */
97 .has_hs = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
98 /* HandsFree through expasion connector */
99 .has_hf = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
100 /* PandaBoard: FM TX, PandaBoardES: can be connected to audio out */
101 .has_aux = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
102 /* PandaBoard: FM RX, PandaBoardES: audio in */
103 .has_afm = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
104 /* No jack detection. */
105 .jack_detection = 0,
106 /* MCLK input is 38.4MHz */
107 .mclk_freq = 38400000,
108
109};
110
111static struct platform_device panda_abe_audio = {
112 .name = "omap-abe-twl6040",
113 .id = -1,
114 .dev = {
115 .platform_data = &panda_abe_audio_data,
116 },
117};
118
119static struct platform_device btwilink_device = {
120 .name = "btwilink",
121 .id = -1,
122};
123
94static struct platform_device *panda_devices[] __initdata = { 124static struct platform_device *panda_devices[] __initdata = {
95 &leds_gpio, 125 &leds_gpio,
96 &wl1271_device, 126 &wl1271_device,
127 &panda_abe_audio,
128 &btwilink_device,
97}; 129};
98 130
99static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 131static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
@@ -245,15 +277,32 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
245{ 277{
246 struct omap2_hsmmc_info *c; 278 struct omap2_hsmmc_info *c;
247 279
248 omap2_hsmmc_init(controllers); 280 omap_hsmmc_init(controllers);
249 for (c = controllers; c->mmc; c++) 281 for (c = controllers; c->mmc; c++)
250 omap4_twl6030_hsmmc_set_late_init(c->dev); 282 omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev);
251 283
252 return 0; 284 return 0;
253} 285}
254 286
287static struct twl4030_codec_data twl6040_codec = {
288 /* single-step ramp for headset and handsfree */
289 .hs_left_step = 0x0f,
290 .hs_right_step = 0x0f,
291 .hf_left_step = 0x1d,
292 .hf_right_step = 0x1d,
293};
294
295static struct twl4030_audio_data twl6040_audio = {
296 .codec = &twl6040_codec,
297 .audpwron_gpio = 127,
298 .naudint_irq = OMAP44XX_IRQ_SYS_2N,
299 .irq_base = TWL6040_CODEC_IRQ_BASE,
300};
301
255/* Panda board uses the common PMIC configuration */ 302/* Panda board uses the common PMIC configuration */
256static struct twl4030_platform_data omap4_panda_twldata; 303static struct twl4030_platform_data omap4_panda_twldata = {
304 .audio = &twl6040_audio,
305};
257 306
258/* 307/*
259 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM 308 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
@@ -461,7 +510,7 @@ static struct omap_dss_board_info omap4_panda_dss_data = {
461 .default_device = &omap4_panda_dvi_device, 510 .default_device = &omap4_panda_dvi_device,
462}; 511};
463 512
464void omap4_panda_display_init(void) 513void __init omap4_panda_display_init(void)
465{ 514{
466 int r; 515 int r;
467 516
@@ -485,6 +534,20 @@ void omap4_panda_display_init(void)
485 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN); 534 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
486} 535}
487 536
537static void omap4_panda_init_rev(void)
538{
539 if (cpu_is_omap443x()) {
540 /* PandaBoard 4430 */
541 /* ASoC audio configuration */
542 panda_abe_audio_data.card_name = "PandaBoard";
543 panda_abe_audio_data.has_hsmic = 1;
544 } else {
545 /* PandaBoard ES */
546 /* ASoC audio configuration */
547 panda_abe_audio_data.card_name = "PandaBoardES";
548 }
549}
550
488static void __init omap4_panda_init(void) 551static void __init omap4_panda_init(void)
489{ 552{
490 int package = OMAP_PACKAGE_CBS; 553 int package = OMAP_PACKAGE_CBS;
@@ -498,6 +561,7 @@ static void __init omap4_panda_init(void)
498 if (ret) 561 if (ret)
499 pr_err("error setting wl12xx data: %d\n", ret); 562 pr_err("error setting wl12xx data: %d\n", ret);
500 563
564 omap4_panda_init_rev();
501 omap4_panda_i2c_init(); 565 omap4_panda_i2c_init();
502 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); 566 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
503 platform_device_register(&omap_vwlan_device); 567 platform_device_register(&omap_vwlan_device);
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 52c0cef7716..668533e2a37 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -407,8 +407,6 @@ static inline void __init overo_init_keys(void) { return; }
407static int overo_twl_gpio_setup(struct device *dev, 407static int overo_twl_gpio_setup(struct device *dev,
408 unsigned gpio, unsigned ngpio) 408 unsigned gpio, unsigned ngpio)
409{ 409{
410 omap2_hsmmc_init(mmc);
411
412#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 410#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
413 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 411 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
414 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 412 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -505,6 +503,7 @@ static void __init overo_init(void)
505 int ret; 503 int ret;
506 504
507 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 505 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
506 omap_hsmmc_init(mmc);
508 overo_i2c_init(); 507 overo_i2c_init();
509 omap_display_init(&overo_dss_data); 508 omap_display_init(&overo_dss_data);
510 omap_serial_init(); 509 omap_serial_init();
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 8678b386c6a..ae53d71f0ce 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. 2 * Board support file for Nokia RM-680/696.
3 * 3 *
4 * Copyright (C) 2010 Nokia 4 * Copyright (C) 2010 Nokia
5 * 5 *
@@ -120,7 +120,7 @@ static void __init rm680_peripherals_init(void)
120 ARRAY_SIZE(rm680_peripherals_devices)); 120 ARRAY_SIZE(rm680_peripherals_devices));
121 rm680_i2c_init(); 121 rm680_i2c_init();
122 gpmc_onenand_init(board_onenand_data); 122 gpmc_onenand_init(board_onenand_data);
123 omap2_hsmmc_init(mmc); 123 omap_hsmmc_init(mmc);
124} 124}
125 125
126#ifdef CONFIG_OMAP_MUX 126#ifdef CONFIG_OMAP_MUX
@@ -154,3 +154,15 @@ MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
154 .timer = &omap3_timer, 154 .timer = &omap3_timer,
155 .restart = omap_prcm_restart, 155 .restart = omap_prcm_restart,
156MACHINE_END 156MACHINE_END
157
158MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
159 .atag_offset = 0x100,
160 .reserve = omap_reserve,
161 .map_io = omap3_map_io,
162 .init_early = omap3630_init_early,
163 .init_irq = omap3_init_irq,
164 .handle_irq = omap3_intc_handle_irq,
165 .init_machine = rm680_init,
166 .timer = &omap3_timer,
167 .restart = omap_prcm_restart,
168MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index acb4e77b39e..16aebfb8a7e 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -138,17 +138,14 @@ static struct lp5523_platform_data rx51_lp5523_platform_data = {
138 138
139static struct omap2_mcspi_device_config wl1251_mcspi_config = { 139static struct omap2_mcspi_device_config wl1251_mcspi_config = {
140 .turbo_mode = 0, 140 .turbo_mode = 0,
141 .single_channel = 1,
142}; 141};
143 142
144static struct omap2_mcspi_device_config mipid_mcspi_config = { 143static struct omap2_mcspi_device_config mipid_mcspi_config = {
145 .turbo_mode = 0, 144 .turbo_mode = 0,
146 .single_channel = 1,
147}; 145};
148 146
149static struct omap2_mcspi_device_config tsc2005_mcspi_config = { 147static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
150 .turbo_mode = 0, 148 .turbo_mode = 0,
151 .single_channel = 1,
152}; 149};
153 150
154static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = { 151static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
@@ -1105,6 +1102,11 @@ static struct tsc2005_platform_data tsc2005_pdata = {
1105 .esd_timeout_ms = 8000, 1102 .esd_timeout_ms = 8000,
1106}; 1103};
1107 1104
1105static struct gpio rx51_tsc2005_gpios[] __initdata = {
1106 { RX51_TSC2005_IRQ_GPIO, GPIOF_IN, "tsc2005 IRQ" },
1107 { RX51_TSC2005_RESET_GPIO, GPIOF_OUT_INIT_HIGH, "tsc2005 reset" },
1108};
1109
1108static void rx51_tsc2005_set_reset(bool enable) 1110static void rx51_tsc2005_set_reset(bool enable)
1109{ 1111{
1110 gpio_set_value(RX51_TSC2005_RESET_GPIO, enable); 1112 gpio_set_value(RX51_TSC2005_RESET_GPIO, enable);
@@ -1114,20 +1116,18 @@ static void __init rx51_init_tsc2005(void)
1114{ 1116{
1115 int r; 1117 int r;
1116 1118
1117 r = gpio_request_one(RX51_TSC2005_IRQ_GPIO, GPIOF_IN, "tsc2005 IRQ"); 1119 omap_mux_init_gpio(RX51_TSC2005_RESET_GPIO, OMAP_PIN_OUTPUT);
1118 if (r < 0) { 1120 omap_mux_init_gpio(RX51_TSC2005_IRQ_GPIO, OMAP_PIN_INPUT_PULLUP);
1119 printk(KERN_ERR "unable to get %s GPIO\n", "tsc2005 IRQ");
1120 rx51_peripherals_spi_board_info[RX51_SPI_TSC2005].irq = 0;
1121 }
1122 1121
1123 r = gpio_request_one(RX51_TSC2005_RESET_GPIO, GPIOF_OUT_INIT_HIGH, 1122 r = gpio_request_array(rx51_tsc2005_gpios,
1124 "tsc2005 reset"); 1123 ARRAY_SIZE(rx51_tsc2005_gpios));
1125 if (r >= 0) { 1124 if (r < 0) {
1126 tsc2005_pdata.set_reset = rx51_tsc2005_set_reset; 1125 printk(KERN_ERR "tsc2005 board initialization failed\n");
1127 } else {
1128 printk(KERN_ERR "unable to get %s GPIO\n", "tsc2005 reset");
1129 tsc2005_pdata.esd_timeout_ms = 0; 1126 tsc2005_pdata.esd_timeout_ms = 0;
1127 return;
1130 } 1128 }
1129
1130 tsc2005_pdata.set_reset = rx51_tsc2005_set_reset;
1131} 1131}
1132 1132
1133void __init rx51_peripherals_init(void) 1133void __init rx51_peripherals_init(void)
@@ -1145,7 +1145,7 @@ void __init rx51_peripherals_init(void)
1145 1145
1146 partition = omap_mux_get("core"); 1146 partition = omap_mux_get("core");
1147 if (partition) 1147 if (partition)
1148 omap2_hsmmc_init(mmc); 1148 omap_hsmmc_init(mmc);
1149 1149
1150 rx51_charger_init(); 1150 rx51_charger_init();
1151} 1151}
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
index d4683ba5f72..a43a765dd09 100644
--- a/arch/arm/mach-omap2/board-zoom-display.c
+++ b/arch/arm/mach-omap2/board-zoom-display.c
@@ -55,6 +55,7 @@ static void zoom_panel_disable_lcd(struct omap_dss_device *dssdev)
55 55
56static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level) 56static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level)
57{ 57{
58#ifdef CONFIG_TWL4030_CORE
58 unsigned char c; 59 unsigned char c;
59 u8 mux_pwm, enb_pwm; 60 u8 mux_pwm, enb_pwm;
60 61
@@ -90,6 +91,9 @@ static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level)
90 c = ((50 * (100 - level)) / 100) + 1; 91 c = ((50 * (100 - level)) / 100) + 1;
91 twl_i2c_write_u8(TWL4030_MODULE_PWM1, 0x7F, TWL_LED_PWMOFF); 92 twl_i2c_write_u8(TWL4030_MODULE_PWM1, 0x7F, TWL_LED_PWMOFF);
92 twl_i2c_write_u8(TWL4030_MODULE_PWM1, c, TWL_LED_PWMON); 93 twl_i2c_write_u8(TWL4030_MODULE_PWM1, c, TWL_LED_PWMON);
94#else
95 pr_warn("Backlight not enabled\n");
96#endif
93 97
94 return 0; 98 return 0;
95} 99}
@@ -117,7 +121,6 @@ static struct omap_dss_board_info zoom_dss_data = {
117 121
118static struct omap2_mcspi_device_config dss_lcd_mcspi_config = { 122static struct omap2_mcspi_device_config dss_lcd_mcspi_config = {
119 .turbo_mode = 1, 123 .turbo_mode = 1,
120 .single_channel = 1, /* 0: slave, 1: master */
121}; 124};
122 125
123static struct spi_board_info nec_8048_spi_board_info[] __initdata = { 126static struct spi_board_info nec_8048_spi_board_info[] __initdata = {
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index c126461836a..3d39cdb2e25 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -205,6 +205,7 @@ static struct omap2_hsmmc_info mmc[] = {
205 .caps = MMC_CAP_4_BIT_DATA, 205 .caps = MMC_CAP_4_BIT_DATA,
206 .gpio_wp = -EINVAL, 206 .gpio_wp = -EINVAL,
207 .power_saving = true, 207 .power_saving = true,
208 .deferred = true,
208 }, 209 },
209 { 210 {
210 .name = "internal", 211 .name = "internal",
@@ -233,7 +234,7 @@ static int zoom_twl_gpio_setup(struct device *dev,
233 234
234 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 235 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
235 mmc[0].gpio_cd = gpio + 0; 236 mmc[0].gpio_cd = gpio + 0;
236 omap2_hsmmc_init(mmc); 237 omap_hsmmc_late_init(mmc);
237 238
238 ret = gpio_request_one(LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, 239 ret = gpio_request_one(LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW,
239 "lcd enable"); 240 "lcd enable");
@@ -301,6 +302,7 @@ void __init zoom_peripherals_init(void)
301 if (ret) 302 if (ret)
302 pr_err("error setting wl12xx data: %d\n", ret); 303 pr_err("error setting wl12xx data: %d\n", ret);
303 304
305 omap_hsmmc_init(mmc);
304 omap_i2c_init(); 306 omap_i2c_init();
305 platform_device_register(&omap_vwlan_device); 307 platform_device_register(&omap_vwlan_device);
306 usb_musb_init(NULL); 308 usb_musb_init(NULL);
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index 39f9d5a58d0..7072e0d651b 100644
--- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
+++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
@@ -33,6 +33,7 @@
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/cpu.h>
36#include <plat/clock.h> 37#include <plat/clock.h>
37#include <plat/sram.h> 38#include <plat/sram.h>
38#include <plat/sdrc.h> 39#include <plat/sdrc.h>
diff --git a/arch/arm/mach-omap2/clkt_clksel.c b/arch/arm/mach-omap2/clkt_clksel.c
index e25364de028..04d551b1f7f 100644
--- a/arch/arm/mach-omap2/clkt_clksel.c
+++ b/arch/arm/mach-omap2/clkt_clksel.c
@@ -43,6 +43,7 @@
43#include <linux/errno.h> 43#include <linux/errno.h>
44#include <linux/clk.h> 44#include <linux/clk.h>
45#include <linux/io.h> 45#include <linux/io.h>
46#include <linux/bug.h>
46 47
47#include <plat/clock.h> 48#include <plat/clock.h>
48 49
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index e069a9be93d..cd7fd0f9114 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -22,6 +22,7 @@
22#include <asm/div64.h> 22#include <asm/div64.h>
23 23
24#include <plat/clock.h> 24#include <plat/clock.h>
25#include <plat/cpu.h>
25 26
26#include "clock.h" 27#include "clock.h"
27#include "cm-regbits-24xx.h" 28#include "cm-regbits-24xx.h"
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index 61ad3855f10..bace9308a4d 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -14,11 +14,14 @@
14 */ 14 */
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/io.h>
17#include <linux/clk.h> 18#include <linux/clk.h>
18#include <linux/list.h> 19#include <linux/list.h>
19 20
21#include <plat/hardware.h>
20#include <plat/clkdev_omap.h> 22#include <plat/clkdev_omap.h>
21 23
24#include "iomap.h"
22#include "clock.h" 25#include "clock.h"
23#include "clock2xxx.h" 26#include "clock2xxx.h"
24#include "opp2xxx.h" 27#include "opp2xxx.h"
diff --git a/arch/arm/mach-omap2/clock2430.c b/arch/arm/mach-omap2/clock2430.c
index d87bc9cb2a3..dfda9a3f2cb 100644
--- a/arch/arm/mach-omap2/clock2430.c
+++ b/arch/arm/mach-omap2/clock2430.c
@@ -21,8 +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/hardware.h>
24#include <plat/clock.h> 25#include <plat/clock.h>
25 26
27#include "iomap.h"
26#include "clock.h" 28#include "clock.h"
27#include "clock2xxx.h" 29#include "clock2xxx.h"
28#include "cm2xxx_3xxx.h" 30#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index 0cc12879e7b..3b4d09a5039 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -17,8 +17,10 @@
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/list.h> 18#include <linux/list.h>
19 19
20#include <plat/hardware.h>
20#include <plat/clkdev_omap.h> 21#include <plat/clkdev_omap.h>
21 22
23#include "iomap.h"
22#include "clock.h" 24#include "clock.h"
23#include "clock2xxx.h" 25#include "clock2xxx.h"
24#include "opp2xxx.h" 26#include "opp2xxx.h"
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
index 80bb0f0e92e..12500097378 100644
--- a/arch/arm/mach-omap2/clock2xxx.c
+++ b/arch/arm/mach-omap2/clock2xxx.c
@@ -22,6 +22,7 @@
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/cpu.h>
25#include <plat/clock.h> 26#include <plat/clock.h>
26 27
27#include "clock.h" 28#include "clock.h"
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c
index 952c3e01c9e..794d82702c8 100644
--- a/arch/arm/mach-omap2/clock3xxx.c
+++ b/arch/arm/mach-omap2/clock3xxx.c
@@ -21,6 +21,7 @@
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/hardware.h>
24#include <plat/clock.h> 25#include <plat/clock.h>
25 26
26#include "clock.h" 27#include "clock.h"
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index d75e5f6b8a0..981b9f9111a 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -20,14 +20,15 @@
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/list.h> 21#include <linux/list.h>
22 22
23#include <plat/hardware.h>
23#include <plat/clkdev_omap.h> 24#include <plat/clkdev_omap.h>
24 25
26#include "iomap.h"
25#include "clock.h" 27#include "clock.h"
26#include "clock3xxx.h" 28#include "clock3xxx.h"
27#include "clock34xx.h" 29#include "clock34xx.h"
28#include "clock36xx.h" 30#include "clock36xx.h"
29#include "clock3517.h" 31#include "clock3517.h"
30
31#include "cm2xxx_3xxx.h" 32#include "cm2xxx_3xxx.h"
32#include "cm-regbits-34xx.h" 33#include "cm-regbits-34xx.h"
33#include "prm2xxx_3xxx.h" 34#include "prm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 08e86d793a1..79b98f22f20 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -26,8 +26,11 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/clk.h> 28#include <linux/clk.h>
29
30#include <plat/hardware.h>
29#include <plat/clkdev_omap.h> 31#include <plat/clkdev_omap.h>
30 32
33#include "iomap.h"
31#include "clock.h" 34#include "clock.h"
32#include "clock44xx.h" 35#include "clock44xx.h"
33#include "cm1_44xx.h" 36#include "cm1_44xx.h"
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.c b/arch/arm/mach-omap2/cm2xxx_3xxx.c
index 04d39cdd211..389f9f8b570 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.c
@@ -18,8 +18,10 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "common.h" 21#include <plat/hardware.h>
22 22
23#include "iomap.h"
24#include "common.h"
23#include "cm.h" 25#include "cm.h"
24#include "cm2xxx_3xxx.h" 26#include "cm2xxx_3xxx.h"
25#include "cm-regbits-24xx.h" 27#include "cm-regbits-24xx.h"
diff --git a/arch/arm/mach-omap2/cm44xx.c b/arch/arm/mach-omap2/cm44xx.c
index 6a836303252..535d66e2822 100644
--- a/arch/arm/mach-omap2/cm44xx.c
+++ b/arch/arm/mach-omap2/cm44xx.c
@@ -18,8 +18,8 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "iomap.h"
21#include "common.h" 22#include "common.h"
22
23#include "cm.h" 23#include "cm.h"
24#include "cm1_44xx.h" 24#include "cm1_44xx.h"
25#include "cm2_44xx.h" 25#include "cm2_44xx.h"
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 6204deaf85b..bd8810c3753 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -20,8 +20,8 @@
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/io.h> 21#include <linux/io.h>
22 22
23#include "iomap.h"
23#include "common.h" 24#include "common.h"
24
25#include "cm.h" 25#include "cm.h"
26#include "cm1_44xx.h" 26#include "cm1_44xx.h"
27#include "cm2_44xx.h" 27#include "cm2_44xx.h"
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index bcb0c581716..9498b0f5fbd 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -33,7 +33,6 @@
33 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 33 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
34static struct omap2_mcspi_device_config ads7846_mcspi_config = { 34static struct omap2_mcspi_device_config ads7846_mcspi_config = {
35 .turbo_mode = 0, 35 .turbo_mode = 0,
36 .single_channel = 1, /* 0: slave, 1: master */
37}; 36};
38 37
39static struct ads7846_platform_data ads7846_config = { 38static struct ads7846_platform_data ads7846_config = {
@@ -76,13 +75,15 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
76 gpio_set_debounce(gpio_pendown, gpio_debounce); 75 gpio_set_debounce(gpio_pendown, gpio_debounce);
77 } 76 }
78 77
79 ads7846_config.gpio_pendown = gpio_pendown;
80
81 spi_bi->bus_num = bus_num; 78 spi_bi->bus_num = bus_num;
82 spi_bi->irq = OMAP_GPIO_IRQ(gpio_pendown); 79 spi_bi->irq = OMAP_GPIO_IRQ(gpio_pendown);
83 80
84 if (board_pdata) 81 if (board_pdata) {
82 board_pdata->gpio_pendown = gpio_pendown;
85 spi_bi->platform_data = board_pdata; 83 spi_bi->platform_data = board_pdata;
84 } else {
85 ads7846_config.gpio_pendown = gpio_pendown;
86 }
86 87
87 spi_register_board_info(&ads7846_spi_board_info, 1); 88 spi_register_board_info(&ads7846_spi_board_info, 1);
88} 89}
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index aaf421178c9..1549c11000d 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -17,12 +17,13 @@
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#include "common.h" 20#include <plat/hardware.h>
21#include <plat/board.h> 21#include <plat/board.h>
22#include <plat/mux.h> 22#include <plat/mux.h>
23
24#include <plat/clock.h> 23#include <plat/clock.h>
25 24
25#include "iomap.h"
26#include "common.h"
26#include "sdrc.h" 27#include "sdrc.h"
27#include "control.h" 28#include "control.h"
28 29
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 7e9338e8d68..57da7f406e2 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -134,6 +134,8 @@ void omap4_map_io(void);
134void ti81xx_map_io(void); 134void ti81xx_map_io(void);
135void omap_barriers_init(void); 135void omap_barriers_init(void);
136 136
137extern void __init omap_init_consistent_dma_size(void);
138
137/** 139/**
138 * omap_test_timeout - busy-loop, testing a condition 140 * omap_test_timeout - busy-loop, testing a condition
139 * @cond: condition to test until it evaluates to true 141 * @cond: condition to test until it evaluates to true
@@ -175,6 +177,18 @@ void omap3_intc_handle_irq(struct pt_regs *regs);
175extern void __iomem *omap4_get_l2cache_base(void); 177extern void __iomem *omap4_get_l2cache_base(void);
176#endif 178#endif
177 179
180struct device_node;
181#ifdef CONFIG_OF
182int __init omap_intc_of_init(struct device_node *node,
183 struct device_node *parent);
184#else
185int __init omap_intc_of_init(struct device_node *node,
186 struct device_node *parent)
187{
188 return 0;
189}
190#endif
191
178#ifdef CONFIG_SMP 192#ifdef CONFIG_SMP
179extern void __iomem *omap4_get_scu_base(void); 193extern void __iomem *omap4_get_scu_base(void);
180#else 194#else
@@ -236,5 +250,10 @@ static inline u32 omap4_mpuss_read_prev_context_state(void)
236 return 0; 250 return 0;
237} 251}
238#endif 252#endif
253
254struct omap_sdrc_params;
255extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
256 struct omap_sdrc_params *sdrc_cs1);
257
239#endif /* __ASSEMBLER__ */ 258#endif /* __ASSEMBLER__ */
240#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ 259#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 114c037e433..08e674bb041 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -15,9 +15,11 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include "common.h" 18#include <plat/hardware.h>
19#include <plat/sdrc.h> 19#include <plat/sdrc.h>
20 20
21#include "iomap.h"
22#include "common.h"
21#include "cm-regbits-34xx.h" 23#include "cm-regbits-34xx.h"
22#include "prm-regbits-34xx.h" 24#include "prm-regbits-34xx.h"
23#include "prm2xxx_3xxx.h" 25#include "prm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index 0ba68d3764b..a406fd045ce 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -16,7 +16,6 @@
16#ifndef __ARCH_ARM_MACH_OMAP2_CONTROL_H 16#ifndef __ARCH_ARM_MACH_OMAP2_CONTROL_H
17#define __ARCH_ARM_MACH_OMAP2_CONTROL_H 17#define __ARCH_ARM_MACH_OMAP2_CONTROL_H
18 18
19#include <mach/io.h>
20#include <mach/ctrl_module_core_44xx.h> 19#include <mach/ctrl_module_core_44xx.h>
21#include <mach/ctrl_module_wkup_44xx.h> 20#include <mach/ctrl_module_wkup_44xx.h>
22#include <mach/ctrl_module_pad_core_44xx.h> 21#include <mach/ctrl_module_pad_core_44xx.h>
@@ -339,6 +338,11 @@
339#define AM35XX_VPFE_PCLK_SW_RST BIT(4) 338#define AM35XX_VPFE_PCLK_SW_RST BIT(4)
340 339
341/* 340/*
341 * CONTROL AM33XX STATUS register
342 */
343#define AM33XX_CONTROL_STATUS 0x040
344
345/*
342 * CONTROL OMAP STATUS register to identify OMAP3 features 346 * CONTROL OMAP STATUS register to identify OMAP3 features
343 */ 347 */
344#define OMAP3_CONTROL_OMAP_STATUS 0x044c 348#define OMAP3_CONTROL_OMAP_STATUS 0x044c
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 283d11eae69..e4336035c0e 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -17,6 +17,7 @@
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/platform_data/omap4-keypad.h>
20 21
21#include <mach/hardware.h> 22#include <mach/hardware.h>
22#include <mach/irqs.h> 23#include <mach/irqs.h>
@@ -24,9 +25,8 @@
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
25#include <asm/pmu.h> 26#include <asm/pmu.h>
26 27
27#include <plat/tc.h> 28#include "iomap.h"
28#include <plat/board.h> 29#include <plat/board.h>
29#include <plat/mcbsp.h>
30#include <plat/mmc.h> 30#include <plat/mmc.h>
31#include <plat/dma.h> 31#include <plat/dma.h>
32#include <plat/omap_hwmod.h> 32#include <plat/omap_hwmod.h>
@@ -276,7 +276,7 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
276} 276}
277 277
278#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) 278#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
279static inline void omap_init_mbox(void) 279static inline void __init omap_init_mbox(void)
280{ 280{
281 struct omap_hwmod *oh; 281 struct omap_hwmod *oh;
282 struct platform_device *pdev; 282 struct platform_device *pdev;
@@ -304,29 +304,8 @@ static struct platform_device omap_pcm = {
304 .id = -1, 304 .id = -1,
305}; 305};
306 306
307/*
308 * OMAP2420 has 2 McBSP ports
309 * OMAP2430 has 5 McBSP ports
310 * OMAP3 has 5 McBSP ports
311 * OMAP4 has 4 McBSP ports
312 */
313OMAP_MCBSP_PLATFORM_DEVICE(1);
314OMAP_MCBSP_PLATFORM_DEVICE(2);
315OMAP_MCBSP_PLATFORM_DEVICE(3);
316OMAP_MCBSP_PLATFORM_DEVICE(4);
317OMAP_MCBSP_PLATFORM_DEVICE(5);
318
319static void omap_init_audio(void) 307static void omap_init_audio(void)
320{ 308{
321 platform_device_register(&omap_mcbsp1);
322 platform_device_register(&omap_mcbsp2);
323 if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
324 platform_device_register(&omap_mcbsp3);
325 platform_device_register(&omap_mcbsp4);
326 }
327 if (cpu_is_omap243x() || cpu_is_omap34xx())
328 platform_device_register(&omap_mcbsp5);
329
330 platform_device_register(&omap_pcm); 309 platform_device_register(&omap_pcm);
331} 310}
332 311
@@ -337,7 +316,7 @@ static inline void omap_init_audio(void) {}
337#if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \ 316#if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \
338 defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE) 317 defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE)
339 318
340static void omap_init_mcpdm(void) 319static void __init omap_init_mcpdm(void)
341{ 320{
342 struct omap_hwmod *oh; 321 struct omap_hwmod *oh;
343 struct platform_device *pdev; 322 struct platform_device *pdev;
@@ -358,7 +337,7 @@ static inline void omap_init_mcpdm(void) {}
358#if defined(CONFIG_SND_OMAP_SOC_DMIC) || \ 337#if defined(CONFIG_SND_OMAP_SOC_DMIC) || \
359 defined(CONFIG_SND_OMAP_SOC_DMIC_MODULE) 338 defined(CONFIG_SND_OMAP_SOC_DMIC_MODULE)
360 339
361static void omap_init_dmic(void) 340static void __init omap_init_dmic(void)
362{ 341{
363 struct omap_hwmod *oh; 342 struct omap_hwmod *oh;
364 struct platform_device *pdev; 343 struct platform_device *pdev;
@@ -380,7 +359,7 @@ static inline void omap_init_dmic(void) {}
380 359
381#include <plat/mcspi.h> 360#include <plat/mcspi.h>
382 361
383static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) 362static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
384{ 363{
385 struct platform_device *pdev; 364 struct platform_device *pdev;
386 char *name = "omap2_mcspi"; 365 char *name = "omap2_mcspi";
@@ -654,9 +633,7 @@ void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
654/*-------------------------------------------------------------------------*/ 633/*-------------------------------------------------------------------------*/
655 634
656#if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE) 635#if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
657#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430)
658#define OMAP_HDQ_BASE 0x480B2000 636#define OMAP_HDQ_BASE 0x480B2000
659#endif
660static struct resource omap_hdq_resources[] = { 637static struct resource omap_hdq_resources[] = {
661 { 638 {
662 .start = OMAP_HDQ_BASE, 639 .start = OMAP_HDQ_BASE,
@@ -679,7 +656,10 @@ static struct platform_device omap_hdq_dev = {
679}; 656};
680static inline void omap_hdq_init(void) 657static inline void omap_hdq_init(void)
681{ 658{
682 (void) platform_device_register(&omap_hdq_dev); 659 if (cpu_is_omap2420())
660 return;
661
662 platform_device_register(&omap_hdq_dev);
683} 663}
684#else 664#else
685static inline void omap_hdq_init(void) {} 665static inline void omap_hdq_init(void) {}
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 3677b1f58b8..9706c648bc1 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -30,6 +30,7 @@
30#include <plat/omap-pm.h> 30#include <plat/omap-pm.h>
31#include "common.h" 31#include "common.h"
32 32
33#include "iomap.h"
33#include "mux.h" 34#include "mux.h"
34#include "control.h" 35#include "control.h"
35#include "display.h" 36#include "display.h"
@@ -124,7 +125,7 @@ static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags)
124 } 125 }
125} 126}
126 127
127static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes) 128static int __init omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
128{ 129{
129 u32 enable_mask, enable_shift; 130 u32 enable_mask, enable_shift;
130 u32 pipd_mask, pipd_shift; 131 u32 pipd_mask, pipd_shift;
@@ -157,7 +158,7 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
157 return 0; 158 return 0;
158} 159}
159 160
160int omap_hdmi_init(enum omap_hdmi_flags flags) 161int __init omap_hdmi_init(enum omap_hdmi_flags flags)
161{ 162{
162 if (cpu_is_omap44xx()) 163 if (cpu_is_omap44xx())
163 omap4_hdmi_mux_pads(flags); 164 omap4_hdmi_mux_pads(flags);
@@ -165,7 +166,7 @@ int omap_hdmi_init(enum omap_hdmi_flags flags)
165 return 0; 166 return 0;
166} 167}
167 168
168static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask) 169static int __init omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
169{ 170{
170 if (cpu_is_omap44xx()) 171 if (cpu_is_omap44xx())
171 return omap4_dsi_mux_pads(dsi_id, lane_mask); 172 return omap4_dsi_mux_pads(dsi_id, lane_mask);
@@ -173,7 +174,7 @@ static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
173 return 0; 174 return 0;
174} 175}
175 176
176static void omap_dsi_disable_pads(int dsi_id, unsigned lane_mask) 177static void __init omap_dsi_disable_pads(int dsi_id, unsigned lane_mask)
177{ 178{
178 if (cpu_is_omap44xx()) 179 if (cpu_is_omap44xx())
179 omap4_dsi_mux_pads(dsi_id, 0); 180 omap4_dsi_mux_pads(dsi_id, 0);
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index a59a45a0096..b19d8496c16 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -227,7 +227,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
227 227
228 dma_stride = OMAP2_DMA_STRIDE; 228 dma_stride = OMAP2_DMA_STRIDE;
229 dma_common_ch_start = CSDP; 229 dma_common_ch_start = CSDP;
230 if (cpu_is_omap3630() || cpu_is_omap4430()) 230 if (cpu_is_omap3630() || cpu_is_omap44xx())
231 dma_common_ch_end = CCDN; 231 dma_common_ch_end = CCDN;
232 else 232 else
233 dma_common_ch_end = CCFN; 233 dma_common_ch_end = CCFN;
diff --git a/arch/arm/mach-omap2/emu.c b/arch/arm/mach-omap2/emu.c
index 9c442e290cc..e28e761b7ab 100644
--- a/arch/arm/mach-omap2/emu.c
+++ b/arch/arm/mach-omap2/emu.c
@@ -21,6 +21,10 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/err.h> 22#include <linux/err.h>
23 23
24#include <mach/hardware.h>
25
26#include "iomap.h"
27
24MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
25MODULE_AUTHOR("Alexander Shishkin"); 29MODULE_AUTHOR("Alexander Shishkin");
26 30
@@ -30,29 +34,8 @@ MODULE_AUTHOR("Alexander Shishkin");
30#define ETB_BASE (L4_EMU_34XX_PHYS + 0x1b000) 34#define ETB_BASE (L4_EMU_34XX_PHYS + 0x1b000)
31#define DAPCTL (L4_EMU_34XX_PHYS + 0x1d000) 35#define DAPCTL (L4_EMU_34XX_PHYS + 0x1d000)
32 36
33static struct amba_device omap3_etb_device = { 37static AMBA_APB_DEVICE(omap3_etb, "etb", 0x000bb907, ETB_BASE, { }, NULL);
34 .dev = { 38static AMBA_APB_DEVICE(omap3_etm, "etm", 0x102bb921, ETM_BASE, { }, NULL);
35 .init_name = "etb",
36 },
37 .res = {
38 .start = ETB_BASE,
39 .end = ETB_BASE + SZ_4K - 1,
40 .flags = IORESOURCE_MEM,
41 },
42 .periphid = 0x000bb907,
43};
44
45static struct amba_device omap3_etm_device = {
46 .dev = {
47 .init_name = "etm",
48 },
49 .res = {
50 .start = ETM_BASE,
51 .end = ETM_BASE + SZ_4K - 1,
52 .flags = IORESOURCE_MEM,
53 },
54 .periphid = 0x102bb921,
55};
56 39
57static int __init emu_init(void) 40static int __init emu_init(void)
58{ 41{
@@ -66,4 +49,3 @@ static int __init emu_init(void)
66} 49}
67 50
68subsys_initcall(emu_init); 51subsys_initcall(emu_init);
69
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 8cbfbc2918c..2f994e5194e 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -23,14 +23,18 @@
23 23
24#include <plat/omap_hwmod.h> 24#include <plat/omap_hwmod.h>
25#include <plat/omap_device.h> 25#include <plat/omap_device.h>
26#include <plat/omap-pm.h>
26 27
27static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) 28#include "powerdomain.h"
29
30static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
28{ 31{
29 struct platform_device *pdev; 32 struct platform_device *pdev;
30 struct omap_gpio_platform_data *pdata; 33 struct omap_gpio_platform_data *pdata;
31 struct omap_gpio_dev_attr *dev_attr; 34 struct omap_gpio_dev_attr *dev_attr;
32 char *name = "omap_gpio"; 35 char *name = "omap_gpio";
33 int id; 36 int id;
37 struct powerdomain *pwrdm;
34 38
35 /* 39 /*
36 * extract the device id from name field available in the 40 * extract the device id from name field available in the
@@ -52,7 +56,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
52 pdata->bank_width = dev_attr->bank_width; 56 pdata->bank_width = dev_attr->bank_width;
53 pdata->dbck_flag = dev_attr->dbck_flag; 57 pdata->dbck_flag = dev_attr->dbck_flag;
54 pdata->virtual_irq_start = IH_GPIO_BASE + 32 * (id - 1); 58 pdata->virtual_irq_start = IH_GPIO_BASE + 32 * (id - 1);
55 59 pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
56 pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL); 60 pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL);
57 if (!pdata) { 61 if (!pdata) {
58 pr_err("gpio%d: Memory allocation failed\n", id); 62 pr_err("gpio%d: Memory allocation failed\n", id);
@@ -61,8 +65,15 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
61 65
62 switch (oh->class->rev) { 66 switch (oh->class->rev) {
63 case 0: 67 case 0:
68 if (id == 1)
69 /* non-wakeup GPIO pins for OMAP2 Bank1 */
70 pdata->non_wakeup_gpios = 0xe203ffc0;
71 else if (id == 2)
72 /* non-wakeup GPIO pins for OMAP2 Bank2 */
73 pdata->non_wakeup_gpios = 0x08700040;
74 /* fall through */
75
64 case 1: 76 case 1:
65 pdata->bank_type = METHOD_GPIO_24XX;
66 pdata->regs->revision = OMAP24XX_GPIO_REVISION; 77 pdata->regs->revision = OMAP24XX_GPIO_REVISION;
67 pdata->regs->direction = OMAP24XX_GPIO_OE; 78 pdata->regs->direction = OMAP24XX_GPIO_OE;
68 pdata->regs->datain = OMAP24XX_GPIO_DATAIN; 79 pdata->regs->datain = OMAP24XX_GPIO_DATAIN;
@@ -72,13 +83,19 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
72 pdata->regs->irqstatus = OMAP24XX_GPIO_IRQSTATUS1; 83 pdata->regs->irqstatus = OMAP24XX_GPIO_IRQSTATUS1;
73 pdata->regs->irqstatus2 = OMAP24XX_GPIO_IRQSTATUS2; 84 pdata->regs->irqstatus2 = OMAP24XX_GPIO_IRQSTATUS2;
74 pdata->regs->irqenable = OMAP24XX_GPIO_IRQENABLE1; 85 pdata->regs->irqenable = OMAP24XX_GPIO_IRQENABLE1;
86 pdata->regs->irqenable2 = OMAP24XX_GPIO_IRQENABLE2;
75 pdata->regs->set_irqenable = OMAP24XX_GPIO_SETIRQENABLE1; 87 pdata->regs->set_irqenable = OMAP24XX_GPIO_SETIRQENABLE1;
76 pdata->regs->clr_irqenable = OMAP24XX_GPIO_CLEARIRQENABLE1; 88 pdata->regs->clr_irqenable = OMAP24XX_GPIO_CLEARIRQENABLE1;
77 pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL; 89 pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL;
78 pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN; 90 pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN;
91 pdata->regs->ctrl = OMAP24XX_GPIO_CTRL;
92 pdata->regs->wkup_en = OMAP24XX_GPIO_WAKE_EN;
93 pdata->regs->leveldetect0 = OMAP24XX_GPIO_LEVELDETECT0;
94 pdata->regs->leveldetect1 = OMAP24XX_GPIO_LEVELDETECT1;
95 pdata->regs->risingdetect = OMAP24XX_GPIO_RISINGDETECT;
96 pdata->regs->fallingdetect = OMAP24XX_GPIO_FALLINGDETECT;
79 break; 97 break;
80 case 2: 98 case 2:
81 pdata->bank_type = METHOD_GPIO_44XX;
82 pdata->regs->revision = OMAP4_GPIO_REVISION; 99 pdata->regs->revision = OMAP4_GPIO_REVISION;
83 pdata->regs->direction = OMAP4_GPIO_OE; 100 pdata->regs->direction = OMAP4_GPIO_OE;
84 pdata->regs->datain = OMAP4_GPIO_DATAIN; 101 pdata->regs->datain = OMAP4_GPIO_DATAIN;
@@ -88,10 +105,17 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
88 pdata->regs->irqstatus = OMAP4_GPIO_IRQSTATUS0; 105 pdata->regs->irqstatus = OMAP4_GPIO_IRQSTATUS0;
89 pdata->regs->irqstatus2 = OMAP4_GPIO_IRQSTATUS1; 106 pdata->regs->irqstatus2 = OMAP4_GPIO_IRQSTATUS1;
90 pdata->regs->irqenable = OMAP4_GPIO_IRQSTATUSSET0; 107 pdata->regs->irqenable = OMAP4_GPIO_IRQSTATUSSET0;
108 pdata->regs->irqenable2 = OMAP4_GPIO_IRQSTATUSSET1;
91 pdata->regs->set_irqenable = OMAP4_GPIO_IRQSTATUSSET0; 109 pdata->regs->set_irqenable = OMAP4_GPIO_IRQSTATUSSET0;
92 pdata->regs->clr_irqenable = OMAP4_GPIO_IRQSTATUSCLR0; 110 pdata->regs->clr_irqenable = OMAP4_GPIO_IRQSTATUSCLR0;
93 pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME; 111 pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME;
94 pdata->regs->debounce_en = OMAP4_GPIO_DEBOUNCENABLE; 112 pdata->regs->debounce_en = OMAP4_GPIO_DEBOUNCENABLE;
113 pdata->regs->ctrl = OMAP4_GPIO_CTRL;
114 pdata->regs->wkup_en = OMAP4_GPIO_IRQWAKEN0;
115 pdata->regs->leveldetect0 = OMAP4_GPIO_LEVELDETECT0;
116 pdata->regs->leveldetect1 = OMAP4_GPIO_LEVELDETECT1;
117 pdata->regs->risingdetect = OMAP4_GPIO_RISINGDETECT;
118 pdata->regs->fallingdetect = OMAP4_GPIO_FALLINGDETECT;
95 break; 119 break;
96 default: 120 default:
97 WARN(1, "Invalid gpio bank_type\n"); 121 WARN(1, "Invalid gpio bank_type\n");
@@ -99,6 +123,9 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
99 return -EINVAL; 123 return -EINVAL;
100 } 124 }
101 125
126 pwrdm = omap_hwmod_get_pwrdm(oh);
127 pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
128
102 pdev = omap_device_build(name, id - 1, oh, pdata, 129 pdev = omap_device_build(name, id - 1, oh, pdata,
103 sizeof(*pdata), NULL, 0, false); 130 sizeof(*pdata), NULL, 0, false);
104 kfree(pdata); 131 kfree(pdata);
@@ -109,9 +136,6 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
109 return PTR_ERR(pdev); 136 return PTR_ERR(pdev);
110 } 137 }
111 138
112 omap_device_disable_idle_on_suspend(pdev);
113
114 gpio_bank_count++;
115 return 0; 139 return 0;
116} 140}
117 141
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 8ad210bda9a..386dec8d235 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -16,6 +16,7 @@
16 16
17#include <asm/mach/flash.h> 17#include <asm/mach/flash.h>
18 18
19#include <plat/cpu.h>
19#include <plat/nand.h> 20#include <plat/nand.h>
20#include <plat/board.h> 21#include <plat/board.h>
21#include <plat/gpmc.h> 22#include <plat/gpmc.h>
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 5cdce10d618..385b3e02c4a 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -18,6 +18,7 @@
18 18
19#include <asm/mach/flash.h> 19#include <asm/mach/flash.h>
20 20
21#include <plat/cpu.h>
21#include <plat/onenand.h> 22#include <plat/onenand.h>
22#include <plat/board.h> 23#include <plat/board.h>
23#include <plat/gpmc.h> 24#include <plat/gpmc.h>
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
index bbb870c04a5..5e5880d6d09 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -101,10 +101,13 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
101 101
102 gpmc_cfg = board_data; 102 gpmc_cfg = board_data;
103 103
104 ret = platform_device_register(&gpmc_smsc911x_regulator); 104 if (!gpmc_cfg->id) {
105 if (ret < 0) { 105 ret = platform_device_register(&gpmc_smsc911x_regulator);
106 pr_err("Unable to register smsc911x regulators: %d\n", ret); 106 if (ret < 0) {
107 return; 107 pr_err("Unable to register smsc911x regulators: %d\n",
108 ret);
109 return;
110 }
108 } 111 }
109 112
110 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) { 113 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) {
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index dfffbbf4c00..00d510858e2 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -888,6 +888,7 @@ int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size)
888 gpmc_write_reg(GPMC_ECC_CONFIG, val); 888 gpmc_write_reg(GPMC_ECC_CONFIG, val);
889 return 0; 889 return 0;
890} 890}
891EXPORT_SYMBOL_GPL(gpmc_enable_hwecc);
891 892
892/** 893/**
893 * gpmc_calculate_ecc - generate non-inverted ecc bytes 894 * gpmc_calculate_ecc - generate non-inverted ecc bytes
@@ -918,3 +919,4 @@ int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code)
918 gpmc_ecc_used = -EINVAL; 919 gpmc_ecc_used = -EINVAL;
919 return 0; 920 return 0;
920} 921}
922EXPORT_SYMBOL_GPL(gpmc_calculate_ecc);
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 19dd1657245..8121720e942 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -293,8 +293,8 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
293 } 293 }
294} 294}
295 295
296static int omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, 296static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
297 struct omap_mmc_platform_data *mmc) 297 struct omap_mmc_platform_data *mmc)
298{ 298{
299 char *hc_name; 299 char *hc_name;
300 300
@@ -429,66 +429,131 @@ static int omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
429} 429}
430 430
431static int omap_hsmmc_done; 431static int omap_hsmmc_done;
432
433void omap_hsmmc_late_init(struct omap2_hsmmc_info *c)
434{
435 struct platform_device *pdev;
436 struct omap_mmc_platform_data *mmc_pdata;
437 int res;
438
439 if (omap_hsmmc_done != 1)
440 return;
441
442 omap_hsmmc_done++;
443
444 for (; c->mmc; c++) {
445 if (!c->deferred)
446 continue;
447
448 pdev = c->pdev;
449 if (!pdev)
450 continue;
451
452 mmc_pdata = pdev->dev.platform_data;
453 if (!mmc_pdata)
454 continue;
455
456 mmc_pdata->slots[0].switch_pin = c->gpio_cd;
457 mmc_pdata->slots[0].gpio_wp = c->gpio_wp;
458
459 res = omap_device_register(pdev);
460 if (res)
461 pr_err("Could not late init MMC %s\n",
462 c->name);
463 }
464}
465
432#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16 466#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16
433 467
434void omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) 468static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
469 int ctrl_nr)
435{ 470{
436 struct omap_hwmod *oh; 471 struct omap_hwmod *oh;
472 struct omap_hwmod *ohs[1];
473 struct omap_device *od;
437 struct platform_device *pdev; 474 struct platform_device *pdev;
438 char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN]; 475 char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
439 struct omap_mmc_platform_data *mmc_data; 476 struct omap_mmc_platform_data *mmc_data;
440 struct omap_mmc_dev_attr *mmc_dev_attr; 477 struct omap_mmc_dev_attr *mmc_dev_attr;
441 char *name; 478 char *name;
442 int l; 479 int res;
443 480
444 mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL); 481 mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
445 if (!mmc_data) { 482 if (!mmc_data) {
446 pr_err("Cannot allocate memory for mmc device!\n"); 483 pr_err("Cannot allocate memory for mmc device!\n");
447 goto done; 484 return;
448 } 485 }
449 486
450 if (omap_hsmmc_pdata_init(hsmmcinfo, mmc_data) < 0) { 487 res = omap_hsmmc_pdata_init(hsmmcinfo, mmc_data);
451 pr_err("%s fails!\n", __func__); 488 if (res < 0)
452 goto done; 489 goto free_mmc;
453 } 490
454 omap_hsmmc_mux(mmc_data, (ctrl_nr - 1)); 491 omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
455 492
456 name = "omap_hsmmc"; 493 name = "omap_hsmmc";
457 494 res = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
458 l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
459 "mmc%d", ctrl_nr); 495 "mmc%d", ctrl_nr);
460 WARN(l >= MAX_OMAP_MMC_HWMOD_NAME_LEN, 496 WARN(res >= MAX_OMAP_MMC_HWMOD_NAME_LEN,
461 "String buffer overflow in MMC%d device setup\n", ctrl_nr); 497 "String buffer overflow in MMC%d device setup\n", ctrl_nr);
498
462 oh = omap_hwmod_lookup(oh_name); 499 oh = omap_hwmod_lookup(oh_name);
463 if (!oh) { 500 if (!oh) {
464 pr_err("Could not look up %s\n", oh_name); 501 pr_err("Could not look up %s\n", oh_name);
465 kfree(mmc_data->slots[0].name); 502 goto free_name;
466 goto done;
467 } 503 }
468 504 ohs[0] = oh;
469 if (oh->dev_attr != NULL) { 505 if (oh->dev_attr != NULL) {
470 mmc_dev_attr = oh->dev_attr; 506 mmc_dev_attr = oh->dev_attr;
471 mmc_data->controller_flags = mmc_dev_attr->flags; 507 mmc_data->controller_flags = mmc_dev_attr->flags;
472 } 508 }
473 509
474 pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data, 510 pdev = platform_device_alloc(name, ctrl_nr - 1);
475 sizeof(struct omap_mmc_platform_data), NULL, 0, false); 511 if (!pdev) {
476 if (IS_ERR(pdev)) { 512 pr_err("Could not allocate pdev for %s\n", name);
477 WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name); 513 goto free_name;
478 kfree(mmc_data->slots[0].name);
479 goto done;
480 } 514 }
481 /* 515 dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
482 * return device handle to board setup code 516
483 * required to populate for regulator framework structure 517 od = omap_device_alloc(pdev, ohs, 1, NULL, 0);
484 */ 518 if (!od) {
485 hsmmcinfo->dev = &pdev->dev; 519 pr_err("Could not allocate od for %s\n", name);
520 goto put_pdev;
521 }
522
523 res = platform_device_add_data(pdev, mmc_data,
524 sizeof(struct omap_mmc_platform_data));
525 if (res) {
526 pr_err("Could not add pdata for %s\n", name);
527 goto put_pdev;
528 }
529
530 hsmmcinfo->pdev = pdev;
531
532 if (hsmmcinfo->deferred)
533 goto free_mmc;
534
535 res = omap_device_register(pdev);
536 if (res) {
537 pr_err("Could not register od for %s\n", name);
538 goto free_od;
539 }
540
541 goto free_mmc;
542
543free_od:
544 omap_device_delete(od);
545
546put_pdev:
547 platform_device_put(pdev);
548
549free_name:
550 kfree(mmc_data->slots[0].name);
486 551
487done: 552free_mmc:
488 kfree(mmc_data); 553 kfree(mmc_data);
489} 554}
490 555
491void omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) 556void __init omap_hsmmc_init(struct omap2_hsmmc_info *controllers)
492{ 557{
493 u32 reg; 558 u32 reg;
494 559
@@ -521,7 +586,7 @@ void omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
521 } 586 }
522 587
523 for (; controllers->mmc; controllers++) 588 for (; controllers->mmc; controllers++)
524 omap_init_hsmmc(controllers, controllers->mmc); 589 omap_hsmmc_init_one(controllers, controllers->mmc);
525 590
526} 591}
527 592
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index c4409730c4b..07831cc3c17 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -21,10 +21,11 @@ struct omap2_hsmmc_info {
21 bool no_off; /* power_saving and power is not to go off */ 21 bool no_off; /* power_saving and power is not to go off */
22 bool no_off_init; /* no power off when not in MMC sleep state */ 22 bool no_off_init; /* no power off when not in MMC sleep state */
23 bool vcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */ 23 bool vcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */
24 bool deferred; /* mmc needs a deferred probe */
24 int gpio_cd; /* or -EINVAL */ 25 int gpio_cd; /* or -EINVAL */
25 int gpio_wp; /* or -EINVAL */ 26 int gpio_wp; /* or -EINVAL */
26 char *name; /* or NULL for default */ 27 char *name; /* or NULL for default */
27 struct device *dev; /* returned: pointer to mmc adapter */ 28 struct platform_device *pdev; /* mmc controller instance */
28 int ocr_mask; /* temporary HACK */ 29 int ocr_mask; /* temporary HACK */
29 /* Remux (pad configuration) when powering on/off */ 30 /* Remux (pad configuration) when powering on/off */
30 void (*remux)(struct device *dev, int slot, int power_on); 31 void (*remux)(struct device *dev, int slot, int power_on);
@@ -34,11 +35,16 @@ struct omap2_hsmmc_info {
34 35
35#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) 36#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
36 37
37void omap2_hsmmc_init(struct omap2_hsmmc_info *); 38void omap_hsmmc_init(struct omap2_hsmmc_info *);
39void omap_hsmmc_late_init(struct omap2_hsmmc_info *);
38 40
39#else 41#else
40 42
41static inline void omap2_hsmmc_init(struct omap2_hsmmc_info *info) 43static inline void omap_hsmmc_init(struct omap2_hsmmc_info *info)
44{
45}
46
47static inline void omap_hsmmc_late_init(struct omap2_hsmmc_info *info)
42{ 48{
43} 49}
44 50
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 719ee423abe..0e79b7bc6aa 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -29,7 +29,7 @@
29#include "control.h" 29#include "control.h"
30 30
31static unsigned int omap_revision; 31static unsigned int omap_revision;
32 32static const char *cpu_rev;
33u32 omap_features; 33u32 omap_features;
34 34
35unsigned int omap_rev(void) 35unsigned int omap_rev(void)
@@ -44,6 +44,8 @@ int omap_type(void)
44 44
45 if (cpu_is_omap24xx()) { 45 if (cpu_is_omap24xx()) {
46 val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS); 46 val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
47 } else if (cpu_is_am33xx()) {
48 val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
47 } else if (cpu_is_omap34xx()) { 49 } else if (cpu_is_omap34xx()) {
48 val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS); 50 val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
49 } else if (cpu_is_omap44xx()) { 51 } else if (cpu_is_omap44xx()) {
@@ -112,7 +114,7 @@ void omap_get_die_id(struct omap_die_id *odi)
112 odi->id_3 = read_tap_reg(OMAP_TAP_DIE_ID_3); 114 odi->id_3 = read_tap_reg(OMAP_TAP_DIE_ID_3);
113} 115}
114 116
115static void __init omap24xx_check_revision(void) 117void __init omap2xxx_check_revision(void)
116{ 118{
117 int i, j; 119 int i, j;
118 u32 idcode, prod_id; 120 u32 idcode, prod_id;
@@ -166,13 +168,63 @@ static void __init omap24xx_check_revision(void)
166 pr_info("\n"); 168 pr_info("\n");
167} 169}
168 170
171#define OMAP3_SHOW_FEATURE(feat) \
172 if (omap3_has_ ##feat()) \
173 printk(#feat" ");
174
175static void __init omap3_cpuinfo(void)
176{
177 const char *cpu_name;
178
179 /*
180 * OMAP3430 and OMAP3530 are assumed to be same.
181 *
182 * OMAP3525, OMAP3515 and OMAP3503 can be detected only based
183 * on available features. Upon detection, update the CPU id
184 * and CPU class bits.
185 */
186 if (cpu_is_omap3630()) {
187 cpu_name = "OMAP3630";
188 } else if (cpu_is_omap3517()) {
189 /* AM35xx devices */
190 cpu_name = (omap3_has_sgx()) ? "AM3517" : "AM3505";
191 } else if (cpu_is_ti816x()) {
192 cpu_name = "TI816X";
193 } else if (cpu_is_am335x()) {
194 cpu_name = "AM335X";
195 } else if (cpu_is_ti814x()) {
196 cpu_name = "TI814X";
197 } else if (omap3_has_iva() && omap3_has_sgx()) {
198 /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
199 cpu_name = "OMAP3430/3530";
200 } else if (omap3_has_iva()) {
201 cpu_name = "OMAP3525";
202 } else if (omap3_has_sgx()) {
203 cpu_name = "OMAP3515";
204 } else {
205 cpu_name = "OMAP3503";
206 }
207
208 /* Print verbose information */
209 pr_info("%s ES%s (", cpu_name, cpu_rev);
210
211 OMAP3_SHOW_FEATURE(l2cache);
212 OMAP3_SHOW_FEATURE(iva);
213 OMAP3_SHOW_FEATURE(sgx);
214 OMAP3_SHOW_FEATURE(neon);
215 OMAP3_SHOW_FEATURE(isp);
216 OMAP3_SHOW_FEATURE(192mhz_clk);
217
218 printk(")\n");
219}
220
169#define OMAP3_CHECK_FEATURE(status,feat) \ 221#define OMAP3_CHECK_FEATURE(status,feat) \
170 if (((status & OMAP3_ ##feat## _MASK) \ 222 if (((status & OMAP3_ ##feat## _MASK) \
171 >> OMAP3_ ##feat## _SHIFT) != FEAT_ ##feat## _NONE) { \ 223 >> OMAP3_ ##feat## _SHIFT) != FEAT_ ##feat## _NONE) { \
172 omap_features |= OMAP3_HAS_ ##feat; \ 224 omap_features |= OMAP3_HAS_ ##feat; \
173 } 225 }
174 226
175static void __init omap3_check_features(void) 227void __init omap3xxx_check_features(void)
176{ 228{
177 u32 status; 229 u32 status;
178 230
@@ -199,9 +251,11 @@ static void __init omap3_check_features(void)
199 * TODO: Get additional info (where applicable) 251 * TODO: Get additional info (where applicable)
200 * e.g. Size of L2 cache. 252 * e.g. Size of L2 cache.
201 */ 253 */
254
255 omap3_cpuinfo();
202} 256}
203 257
204static void __init omap4_check_features(void) 258void __init omap4xxx_check_features(void)
205{ 259{
206 u32 si_type; 260 u32 si_type;
207 261
@@ -226,12 +280,13 @@ static void __init omap4_check_features(void)
226 } 280 }
227} 281}
228 282
229static void __init ti81xx_check_features(void) 283void __init ti81xx_check_features(void)
230{ 284{
231 omap_features = OMAP3_HAS_NEON; 285 omap_features = OMAP3_HAS_NEON;
286 omap3_cpuinfo();
232} 287}
233 288
234static void __init omap3_check_revision(const char **cpu_rev) 289void __init omap3xxx_check_revision(void)
235{ 290{
236 u32 cpuid, idcode; 291 u32 cpuid, idcode;
237 u16 hawkeye; 292 u16 hawkeye;
@@ -245,7 +300,7 @@ static void __init omap3_check_revision(const char **cpu_rev)
245 cpuid = read_cpuid(CPUID_ID); 300 cpuid = read_cpuid(CPUID_ID);
246 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) { 301 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
247 omap_revision = OMAP3430_REV_ES1_0; 302 omap_revision = OMAP3430_REV_ES1_0;
248 *cpu_rev = "1.0"; 303 cpu_rev = "1.0";
249 return; 304 return;
250 } 305 }
251 306
@@ -266,26 +321,26 @@ static void __init omap3_check_revision(const char **cpu_rev)
266 case 0: /* Take care of early samples */ 321 case 0: /* Take care of early samples */
267 case 1: 322 case 1:
268 omap_revision = OMAP3430_REV_ES2_0; 323 omap_revision = OMAP3430_REV_ES2_0;
269 *cpu_rev = "2.0"; 324 cpu_rev = "2.0";
270 break; 325 break;
271 case 2: 326 case 2:
272 omap_revision = OMAP3430_REV_ES2_1; 327 omap_revision = OMAP3430_REV_ES2_1;
273 *cpu_rev = "2.1"; 328 cpu_rev = "2.1";
274 break; 329 break;
275 case 3: 330 case 3:
276 omap_revision = OMAP3430_REV_ES3_0; 331 omap_revision = OMAP3430_REV_ES3_0;
277 *cpu_rev = "3.0"; 332 cpu_rev = "3.0";
278 break; 333 break;
279 case 4: 334 case 4:
280 omap_revision = OMAP3430_REV_ES3_1; 335 omap_revision = OMAP3430_REV_ES3_1;
281 *cpu_rev = "3.1"; 336 cpu_rev = "3.1";
282 break; 337 break;
283 case 7: 338 case 7:
284 /* FALLTHROUGH */ 339 /* FALLTHROUGH */
285 default: 340 default:
286 /* Use the latest known revision as default */ 341 /* Use the latest known revision as default */
287 omap_revision = OMAP3430_REV_ES3_1_2; 342 omap_revision = OMAP3430_REV_ES3_1_2;
288 *cpu_rev = "3.1.2"; 343 cpu_rev = "3.1.2";
289 } 344 }
290 break; 345 break;
291 case 0xb868: 346 case 0xb868:
@@ -298,13 +353,13 @@ static void __init omap3_check_revision(const char **cpu_rev)
298 switch (rev) { 353 switch (rev) {
299 case 0: 354 case 0:
300 omap_revision = OMAP3517_REV_ES1_0; 355 omap_revision = OMAP3517_REV_ES1_0;
301 *cpu_rev = "1.0"; 356 cpu_rev = "1.0";
302 break; 357 break;
303 case 1: 358 case 1:
304 /* FALLTHROUGH */ 359 /* FALLTHROUGH */
305 default: 360 default:
306 omap_revision = OMAP3517_REV_ES1_1; 361 omap_revision = OMAP3517_REV_ES1_1;
307 *cpu_rev = "1.1"; 362 cpu_rev = "1.1";
308 } 363 }
309 break; 364 break;
310 case 0xb891: 365 case 0xb891:
@@ -313,36 +368,36 @@ static void __init omap3_check_revision(const char **cpu_rev)
313 switch(rev) { 368 switch(rev) {
314 case 0: /* Take care of early samples */ 369 case 0: /* Take care of early samples */
315 omap_revision = OMAP3630_REV_ES1_0; 370 omap_revision = OMAP3630_REV_ES1_0;
316 *cpu_rev = "1.0"; 371 cpu_rev = "1.0";
317 break; 372 break;
318 case 1: 373 case 1:
319 omap_revision = OMAP3630_REV_ES1_1; 374 omap_revision = OMAP3630_REV_ES1_1;
320 *cpu_rev = "1.1"; 375 cpu_rev = "1.1";
321 break; 376 break;
322 case 2: 377 case 2:
323 /* FALLTHROUGH */ 378 /* FALLTHROUGH */
324 default: 379 default:
325 omap_revision = OMAP3630_REV_ES1_2; 380 omap_revision = OMAP3630_REV_ES1_2;
326 *cpu_rev = "1.2"; 381 cpu_rev = "1.2";
327 } 382 }
328 break; 383 break;
329 case 0xb81e: 384 case 0xb81e:
330 switch (rev) { 385 switch (rev) {
331 case 0: 386 case 0:
332 omap_revision = TI8168_REV_ES1_0; 387 omap_revision = TI8168_REV_ES1_0;
333 *cpu_rev = "1.0"; 388 cpu_rev = "1.0";
334 break; 389 break;
335 case 1: 390 case 1:
336 /* FALLTHROUGH */ 391 /* FALLTHROUGH */
337 default: 392 default:
338 omap_revision = TI8168_REV_ES1_1; 393 omap_revision = TI8168_REV_ES1_1;
339 *cpu_rev = "1.1"; 394 cpu_rev = "1.1";
340 break; 395 break;
341 } 396 }
342 break; 397 break;
343 case 0xb944: 398 case 0xb944:
344 omap_revision = AM335X_REV_ES1_0; 399 omap_revision = AM335X_REV_ES1_0;
345 *cpu_rev = "1.0"; 400 cpu_rev = "1.0";
346 break; 401 break;
347 case 0xb8f2: 402 case 0xb8f2:
348 switch (rev) { 403 switch (rev) {
@@ -350,29 +405,29 @@ static void __init omap3_check_revision(const char **cpu_rev)
350 /* FALLTHROUGH */ 405 /* FALLTHROUGH */
351 case 1: 406 case 1:
352 omap_revision = TI8148_REV_ES1_0; 407 omap_revision = TI8148_REV_ES1_0;
353 *cpu_rev = "1.0"; 408 cpu_rev = "1.0";
354 break; 409 break;
355 case 2: 410 case 2:
356 omap_revision = TI8148_REV_ES2_0; 411 omap_revision = TI8148_REV_ES2_0;
357 *cpu_rev = "2.0"; 412 cpu_rev = "2.0";
358 break; 413 break;
359 case 3: 414 case 3:
360 /* FALLTHROUGH */ 415 /* FALLTHROUGH */
361 default: 416 default:
362 omap_revision = TI8148_REV_ES2_1; 417 omap_revision = TI8148_REV_ES2_1;
363 *cpu_rev = "2.1"; 418 cpu_rev = "2.1";
364 break; 419 break;
365 } 420 }
366 break; 421 break;
367 default: 422 default:
368 /* Unknown default to latest silicon rev as default */ 423 /* Unknown default to latest silicon rev as default */
369 omap_revision = OMAP3630_REV_ES1_2; 424 omap_revision = OMAP3630_REV_ES1_2;
370 *cpu_rev = "1.2"; 425 cpu_rev = "1.2";
371 pr_warn("Warning: unknown chip type; assuming OMAP3630ES1.2\n"); 426 pr_warn("Warning: unknown chip type; assuming OMAP3630ES1.2\n");
372 } 427 }
373} 428}
374 429
375static void __init omap4_check_revision(void) 430void __init omap4xxx_check_revision(void)
376{ 431{
377 u32 idcode; 432 u32 idcode;
378 u16 hawkeye; 433 u16 hawkeye;
@@ -445,89 +500,6 @@ static void __init omap4_check_revision(void)
445 ((omap_rev() >> 12) & 0xf), ((omap_rev() >> 8) & 0xf)); 500 ((omap_rev() >> 12) & 0xf), ((omap_rev() >> 8) & 0xf));
446} 501}
447 502
448#define OMAP3_SHOW_FEATURE(feat) \
449 if (omap3_has_ ##feat()) \
450 printk(#feat" ");
451
452static void __init omap3_cpuinfo(const char *cpu_rev)
453{
454 const char *cpu_name;
455
456 /*
457 * OMAP3430 and OMAP3530 are assumed to be same.
458 *
459 * OMAP3525, OMAP3515 and OMAP3503 can be detected only based
460 * on available features. Upon detection, update the CPU id
461 * and CPU class bits.
462 */
463 if (cpu_is_omap3630()) {
464 cpu_name = "OMAP3630";
465 } else if (cpu_is_omap3517()) {
466 /* AM35xx devices */
467 cpu_name = (omap3_has_sgx()) ? "AM3517" : "AM3505";
468 } else if (cpu_is_ti816x()) {
469 cpu_name = "TI816X";
470 } else if (cpu_is_am335x()) {
471 cpu_name = "AM335X";
472 } else if (cpu_is_ti814x()) {
473 cpu_name = "TI814X";
474 } else if (omap3_has_iva() && omap3_has_sgx()) {
475 /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
476 cpu_name = "OMAP3430/3530";
477 } else if (omap3_has_iva()) {
478 cpu_name = "OMAP3525";
479 } else if (omap3_has_sgx()) {
480 cpu_name = "OMAP3515";
481 } else {
482 cpu_name = "OMAP3503";
483 }
484
485 /* Print verbose information */
486 pr_info("%s ES%s (", cpu_name, cpu_rev);
487
488 OMAP3_SHOW_FEATURE(l2cache);
489 OMAP3_SHOW_FEATURE(iva);
490 OMAP3_SHOW_FEATURE(sgx);
491 OMAP3_SHOW_FEATURE(neon);
492 OMAP3_SHOW_FEATURE(isp);
493 OMAP3_SHOW_FEATURE(192mhz_clk);
494
495 printk(")\n");
496}
497
498/*
499 * Try to detect the exact revision of the omap we're running on
500 */
501void __init omap2_check_revision(void)
502{
503 const char *cpu_rev;
504
505 /*
506 * At this point we have an idea about the processor revision set
507 * earlier with omap2_set_globals_tap().
508 */
509 if (cpu_is_omap24xx()) {
510 omap24xx_check_revision();
511 } else if (cpu_is_omap34xx()) {
512 omap3_check_revision(&cpu_rev);
513
514 /* TI81XX doesn't have feature register */
515 if (!cpu_is_ti81xx())
516 omap3_check_features();
517 else
518 ti81xx_check_features();
519
520 omap3_cpuinfo(cpu_rev);
521 return;
522 } else if (cpu_is_omap44xx()) {
523 omap4_check_revision();
524 omap4_check_features();
525 return;
526 } else {
527 pr_err("OMAP revision unknown, please fix!\n");
528 }
529}
530
531/* 503/*
532 * Set up things for map_io and processor detection later on. Gets called 504 * Set up things for map_io and processor detection later on. Gets called
533 * pretty much first thing from board init. For multi-omap, this gets 505 * pretty much first thing from board init. For multi-omap, this gets
diff --git a/arch/arm/mach-omap2/include/mach/entry-macro.S b/arch/arm/mach-omap2/include/mach/entry-macro.S
deleted file mode 100644
index 56964a0c4c7..00000000000
--- a/arch/arm/mach-omap2/include/mach/entry-macro.S
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for OMAP-based platforms
5 *
6 * Copyright (C) 2009 Texas Instruments
7 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.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 .macro disable_fiq
15 .endm
16
17 .macro arch_ret_to_user, tmp1, tmp2
18 .endm
diff --git a/arch/arm/mach-omap2/include/mach/io.h b/arch/arm/mach-omap2/include/mach/io.h
index fd78f31aa1a..b8758c8a939 100644
--- a/arch/arm/mach-omap2/include/mach/io.h
+++ b/arch/arm/mach-omap2/include/mach/io.h
@@ -1,5 +1,49 @@
1/* 1/*
2 * arch/arm/mach-omap2/include/mach/io.h 2 * arch/arm/mach-omap2/include/mach/io.h
3 *
4 * IO definitions for TI OMAP processors and boards
5 *
6 * Copied from arch/arm/mach-sa1100/include/mach/io.h
7 * Copyright (C) 1997-1999 Russell King
8 *
9 * Copyright (C) 2009 Texas Instruments
10 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 *
32 * Modifications:
33 * 06-12-1997 RMK Created.
34 * 07-04-1999 RMK Major cleanup
3 */ 35 */
4 36
5#include <plat/io.h> 37#ifndef __ASM_ARM_ARCH_IO_H
38#define __ASM_ARM_ARCH_IO_H
39
40#define IO_SPACE_LIMIT 0xffffffff
41
42/*
43 * We don't actually have real ISA nor PCI buses, but there is so many
44 * drivers out there that might just work if we fake them...
45 */
46#define __io(a) __typesafe_io(a)
47#define __mem_pci(a) (a)
48
49#endif
diff --git a/arch/arm/mach-omap2/include/mach/system.h b/arch/arm/mach-omap2/include/mach/system.h
deleted file mode 100644
index d488721ab90..00000000000
--- a/arch/arm/mach-omap2/include/mach/system.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/*
2 * arch/arm/mach-omap2/include/mach/system.h
3 */
4
5#include <plat/system.h>
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index fb11b44fbde..065bd768987 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -21,36 +21,32 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/omapfb.h>
25 24
26#include <asm/tlb.h> 25#include <asm/tlb.h>
27
28#include <asm/mach/map.h> 26#include <asm/mach/map.h>
29 27
30#include <plat/sram.h> 28#include <plat/sram.h>
31#include <plat/sdrc.h> 29#include <plat/sdrc.h>
32#include <plat/serial.h> 30#include <plat/serial.h>
33
34#include "clock2xxx.h"
35#include "clock3xxx.h"
36#include "clock44xx.h"
37
38#include "common.h"
39#include <plat/omap-pm.h> 31#include <plat/omap-pm.h>
32#include <plat/omap_hwmod.h>
33#include <plat/multi.h>
34
35#include "iomap.h"
40#include "voltage.h" 36#include "voltage.h"
41#include "powerdomain.h" 37#include "powerdomain.h"
42
43#include "clockdomain.h" 38#include "clockdomain.h"
44#include <plat/omap_hwmod.h>
45#include <plat/multi.h>
46#include "common.h" 39#include "common.h"
40#include "clock2xxx.h"
41#include "clock3xxx.h"
42#include "clock44xx.h"
47 43
48/* 44/*
49 * The machine specific code may provide the extra mapping besides the 45 * The machine specific code may provide the extra mapping besides the
50 * default mapping provided here. 46 * default mapping provided here.
51 */ 47 */
52 48
53#ifdef CONFIG_ARCH_OMAP2 49#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
54static struct map_desc omap24xx_io_desc[] __initdata = { 50static struct map_desc omap24xx_io_desc[] __initdata = {
55 { 51 {
56 .virtual = L3_24XX_VIRT, 52 .virtual = L3_24XX_VIRT,
@@ -352,7 +348,6 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
352 348
353static void __init omap_common_init_early(void) 349static void __init omap_common_init_early(void)
354{ 350{
355 omap2_check_revision();
356 omap_init_consistent_dma_size(); 351 omap_init_consistent_dma_size();
357} 352}
358 353
@@ -393,6 +388,7 @@ static void __init omap_hwmod_init_postsetup(void)
393void __init omap2420_init_early(void) 388void __init omap2420_init_early(void)
394{ 389{
395 omap2_set_globals_242x(); 390 omap2_set_globals_242x();
391 omap2xxx_check_revision();
396 omap_common_init_early(); 392 omap_common_init_early();
397 omap2xxx_voltagedomains_init(); 393 omap2xxx_voltagedomains_init();
398 omap242x_powerdomains_init(); 394 omap242x_powerdomains_init();
@@ -407,6 +403,7 @@ void __init omap2420_init_early(void)
407void __init omap2430_init_early(void) 403void __init omap2430_init_early(void)
408{ 404{
409 omap2_set_globals_243x(); 405 omap2_set_globals_243x();
406 omap2xxx_check_revision();
410 omap_common_init_early(); 407 omap_common_init_early();
411 omap2xxx_voltagedomains_init(); 408 omap2xxx_voltagedomains_init();
412 omap243x_powerdomains_init(); 409 omap243x_powerdomains_init();
@@ -425,6 +422,8 @@ void __init omap2430_init_early(void)
425void __init omap3_init_early(void) 422void __init omap3_init_early(void)
426{ 423{
427 omap2_set_globals_3xxx(); 424 omap2_set_globals_3xxx();
425 omap3xxx_check_revision();
426 omap3xxx_check_features();
428 omap_common_init_early(); 427 omap_common_init_early();
429 omap3xxx_voltagedomains_init(); 428 omap3xxx_voltagedomains_init();
430 omap3xxx_powerdomains_init(); 429 omap3xxx_powerdomains_init();
@@ -457,6 +456,8 @@ void __init am35xx_init_early(void)
457void __init ti81xx_init_early(void) 456void __init ti81xx_init_early(void)
458{ 457{
459 omap2_set_globals_ti81xx(); 458 omap2_set_globals_ti81xx();
459 omap3xxx_check_revision();
460 ti81xx_check_features();
460 omap_common_init_early(); 461 omap_common_init_early();
461 omap3xxx_voltagedomains_init(); 462 omap3xxx_voltagedomains_init();
462 omap3xxx_powerdomains_init(); 463 omap3xxx_powerdomains_init();
@@ -471,6 +472,8 @@ void __init ti81xx_init_early(void)
471void __init omap4430_init_early(void) 472void __init omap4430_init_early(void)
472{ 473{
473 omap2_set_globals_443x(); 474 omap2_set_globals_443x();
475 omap4xxx_check_revision();
476 omap4xxx_check_features();
474 omap_common_init_early(); 477 omap_common_init_early();
475 omap44xx_voltagedomains_init(); 478 omap44xx_voltagedomains_init();
476 omap44xx_powerdomains_init(); 479 omap44xx_powerdomains_init();
@@ -491,43 +494,3 @@ void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
491 _omap2_init_reprogram_sdrc(); 494 _omap2_init_reprogram_sdrc();
492 } 495 }
493} 496}
494
495/*
496 * NOTE: Please use ioremap + __raw_read/write where possible instead of these
497 */
498
499u8 omap_readb(u32 pa)
500{
501 return __raw_readb(OMAP2_L4_IO_ADDRESS(pa));
502}
503EXPORT_SYMBOL(omap_readb);
504
505u16 omap_readw(u32 pa)
506{
507 return __raw_readw(OMAP2_L4_IO_ADDRESS(pa));
508}
509EXPORT_SYMBOL(omap_readw);
510
511u32 omap_readl(u32 pa)
512{
513 return __raw_readl(OMAP2_L4_IO_ADDRESS(pa));
514}
515EXPORT_SYMBOL(omap_readl);
516
517void omap_writeb(u8 v, u32 pa)
518{
519 __raw_writeb(v, OMAP2_L4_IO_ADDRESS(pa));
520}
521EXPORT_SYMBOL(omap_writeb);
522
523void omap_writew(u16 v, u32 pa)
524{
525 __raw_writew(v, OMAP2_L4_IO_ADDRESS(pa));
526}
527EXPORT_SYMBOL(omap_writew);
528
529void omap_writel(u32 v, u32 pa)
530{
531 __raw_writel(v, OMAP2_L4_IO_ADDRESS(pa));
532}
533EXPORT_SYMBOL(omap_writel);
diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/mach-omap2/iomap.h
index 0696bae1818..e6f95816529 100644
--- a/arch/arm/plat-omap/include/plat/io.h
+++ b/arch/arm/mach-omap2/iomap.h
@@ -1,13 +1,5 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/io.h 2 * IO mappings for OMAP2+
3 *
4 * IO definitions for TI OMAP processors and boards
5 *
6 * Copied from arch/arm/mach-sa1100/include/mach/io.h
7 * Copyright (C) 1997-1999 Russell King
8 *
9 * Copyright (C) 2009 Texas Instruments
10 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
11 * 3 *
12 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 5 * under the terms of the GNU General Public License as published by the
@@ -25,33 +17,9 @@
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 17 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * 19 *
28 * You should have received a copy of the GNU General Public License along 20 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc., 21 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA. 22 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 *
32 * Modifications:
33 * 06-12-1997 RMK Created.
34 * 07-04-1999 RMK Major cleanup
35 */
36
37#ifndef __ASM_ARM_ARCH_IO_H
38#define __ASM_ARM_ARCH_IO_H
39
40#include <mach/hardware.h>
41
42#define IO_SPACE_LIMIT 0xffffffff
43
44/*
45 * We don't actually have real ISA nor PCI buses, but there is so many
46 * drivers out there that might just work if we fake them...
47 */
48#define __io(a) __typesafe_io(a)
49#define __mem_pci(a) (a)
50
51/*
52 * ----------------------------------------------------------------------------
53 * I/O mapping
54 * ----------------------------------------------------------------------------
55 */ 23 */
56 24
57#ifdef __ASSEMBLER__ 25#ifdef __ASSEMBLER__
@@ -60,13 +28,9 @@
60#define IOMEM(x) ((void __force __iomem *)(x)) 28#define IOMEM(x) ((void __force __iomem *)(x))
61#endif 29#endif
62 30
63#define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
64#define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET)
65
66#define OMAP2_L3_IO_OFFSET 0x90000000 31#define OMAP2_L3_IO_OFFSET 0x90000000
67#define OMAP2_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */ 32#define OMAP2_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */
68 33
69
70#define OMAP2_L4_IO_OFFSET 0xb2000000 34#define OMAP2_L4_IO_OFFSET 0xb2000000
71#define OMAP2_L4_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L4_IO_OFFSET) /* L4 */ 35#define OMAP2_L4_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L4_IO_OFFSET) /* L4 */
72 36
@@ -87,16 +51,6 @@
87 51
88/* 52/*
89 * ---------------------------------------------------------------------------- 53 * ----------------------------------------------------------------------------
90 * Omap1 specific IO mapping
91 * ----------------------------------------------------------------------------
92 */
93
94#define OMAP1_IO_PHYS 0xFFFB0000
95#define OMAP1_IO_SIZE 0x40000
96#define OMAP1_IO_VIRT (OMAP1_IO_PHYS - OMAP1_IO_OFFSET)
97
98/*
99 * ----------------------------------------------------------------------------
100 * Omap2 specific IO mapping 54 * Omap2 specific IO mapping
101 * ---------------------------------------------------------------------------- 55 * ----------------------------------------------------------------------------
102 */ 56 */
@@ -247,31 +201,3 @@
247 /* 0x4e000000 --> 0xfd300000 */ 201 /* 0x4e000000 --> 0xfd300000 */
248#define OMAP44XX_DMM_SIZE SZ_1M 202#define OMAP44XX_DMM_SIZE SZ_1M
249#define OMAP44XX_DMM_VIRT (OMAP44XX_EMIF2_VIRT + OMAP44XX_EMIF2_SIZE) 203#define OMAP44XX_DMM_VIRT (OMAP44XX_EMIF2_VIRT + OMAP44XX_EMIF2_SIZE)
250/*
251 * ----------------------------------------------------------------------------
252 * Omap specific register access
253 * ----------------------------------------------------------------------------
254 */
255
256#ifndef __ASSEMBLER__
257
258/*
259 * NOTE: Please use ioremap + __raw_read/write where possible instead of these
260 */
261
262extern u8 omap_readb(u32 pa);
263extern u16 omap_readw(u32 pa);
264extern u32 omap_readl(u32 pa);
265extern void omap_writeb(u8 v, u32 pa);
266extern void omap_writew(u16 v, u32 pa);
267extern void omap_writel(u32 v, u32 pa);
268
269struct omap_sdrc_params;
270extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
271 struct omap_sdrc_params *sdrc_cs1);
272
273extern void __init omap_init_consistent_dma_size(void);
274
275#endif
276
277#endif
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 1fef061f792..65f0d2571c9 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -11,13 +11,20 @@
11 * for more details. 11 * for more details.
12 */ 12 */
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h>
14#include <linux/init.h> 15#include <linux/init.h>
15#include <linux/interrupt.h> 16#include <linux/interrupt.h>
16#include <linux/io.h> 17#include <linux/io.h>
17#include <mach/hardware.h> 18
18#include <asm/exception.h> 19#include <asm/exception.h>
19#include <asm/mach/irq.h> 20#include <asm/mach/irq.h>
21#include <linux/irqdomain.h>
22#include <linux/of.h>
23#include <linux/of_address.h>
20 24
25#include <mach/hardware.h>
26
27#include "iomap.h"
21 28
22/* selected INTC register offsets */ 29/* selected INTC register offsets */
23 30
@@ -57,6 +64,8 @@ static struct omap_irq_bank {
57 }, 64 },
58}; 65};
59 66
67static struct irq_domain *domain;
68
60/* Structure to save interrupt controller context */ 69/* Structure to save interrupt controller context */
61struct omap3_intc_regs { 70struct omap3_intc_regs {
62 u32 sysconfig; 71 u32 sysconfig;
@@ -147,17 +156,27 @@ omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
147 IRQ_NOREQUEST | IRQ_NOPROBE, 0); 156 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
148} 157}
149 158
150static void __init omap_init_irq(u32 base, int nr_irqs) 159static void __init omap_init_irq(u32 base, int nr_irqs,
160 struct device_node *node)
151{ 161{
152 void __iomem *omap_irq_base; 162 void __iomem *omap_irq_base;
153 unsigned long nr_of_irqs = 0; 163 unsigned long nr_of_irqs = 0;
154 unsigned int nr_banks = 0; 164 unsigned int nr_banks = 0;
155 int i, j; 165 int i, j, irq_base;
156 166
157 omap_irq_base = ioremap(base, SZ_4K); 167 omap_irq_base = ioremap(base, SZ_4K);
158 if (WARN_ON(!omap_irq_base)) 168 if (WARN_ON(!omap_irq_base))
159 return; 169 return;
160 170
171 irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
172 if (irq_base < 0) {
173 pr_warn("Couldn't allocate IRQ numbers\n");
174 irq_base = 0;
175 }
176
177 domain = irq_domain_add_legacy(node, nr_irqs, irq_base, 0,
178 &irq_domain_simple_ops, NULL);
179
161 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) { 180 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
162 struct omap_irq_bank *bank = irq_banks + i; 181 struct omap_irq_bank *bank = irq_banks + i;
163 182
@@ -166,36 +185,36 @@ static void __init omap_init_irq(u32 base, int nr_irqs)
166 /* Static mapping, never released */ 185 /* Static mapping, never released */
167 bank->base_reg = ioremap(base, SZ_4K); 186 bank->base_reg = ioremap(base, SZ_4K);
168 if (!bank->base_reg) { 187 if (!bank->base_reg) {
169 printk(KERN_ERR "Could not ioremap irq bank%i\n", i); 188 pr_err("Could not ioremap irq bank%i\n", i);
170 continue; 189 continue;
171 } 190 }
172 191
173 omap_irq_bank_init_one(bank); 192 omap_irq_bank_init_one(bank);
174 193
175 for (j = 0; j < bank->nr_irqs; j += 32) 194 for (j = 0; j < bank->nr_irqs; j += 32)
176 omap_alloc_gc(bank->base_reg + j, j, 32); 195 omap_alloc_gc(bank->base_reg + j, j + irq_base, 32);
177 196
178 nr_of_irqs += bank->nr_irqs; 197 nr_of_irqs += bank->nr_irqs;
179 nr_banks++; 198 nr_banks++;
180 } 199 }
181 200
182 printk(KERN_INFO "Total of %ld interrupts on %d active controller%s\n", 201 pr_info("Total of %ld interrupts on %d active controller%s\n",
183 nr_of_irqs, nr_banks, nr_banks > 1 ? "s" : ""); 202 nr_of_irqs, nr_banks, nr_banks > 1 ? "s" : "");
184} 203}
185 204
186void __init omap2_init_irq(void) 205void __init omap2_init_irq(void)
187{ 206{
188 omap_init_irq(OMAP24XX_IC_BASE, 96); 207 omap_init_irq(OMAP24XX_IC_BASE, 96, NULL);
189} 208}
190 209
191void __init omap3_init_irq(void) 210void __init omap3_init_irq(void)
192{ 211{
193 omap_init_irq(OMAP34XX_IC_BASE, 96); 212 omap_init_irq(OMAP34XX_IC_BASE, 96, NULL);
194} 213}
195 214
196void __init ti81xx_init_irq(void) 215void __init ti81xx_init_irq(void)
197{ 216{
198 omap_init_irq(OMAP34XX_IC_BASE, 128); 217 omap_init_irq(OMAP34XX_IC_BASE, 128, NULL);
199} 218}
200 219
201static inline void omap_intc_handle_irq(void __iomem *base_addr, struct pt_regs *regs) 220static inline void omap_intc_handle_irq(void __iomem *base_addr, struct pt_regs *regs)
@@ -225,8 +244,10 @@ out:
225 irqnr = readl_relaxed(base_addr + INTCPS_SIR_IRQ_OFFSET); 244 irqnr = readl_relaxed(base_addr + INTCPS_SIR_IRQ_OFFSET);
226 irqnr &= ACTIVEIRQ_MASK; 245 irqnr &= ACTIVEIRQ_MASK;
227 246
228 if (irqnr) 247 if (irqnr) {
248 irqnr = irq_find_mapping(domain, irqnr);
229 handle_IRQ(irqnr, regs); 249 handle_IRQ(irqnr, regs);
250 }
230 } while (irqnr); 251 } while (irqnr);
231} 252}
232 253
@@ -236,6 +257,28 @@ asmlinkage void __exception_irq_entry omap2_intc_handle_irq(struct pt_regs *regs
236 omap_intc_handle_irq(base_addr, regs); 257 omap_intc_handle_irq(base_addr, regs);
237} 258}
238 259
260int __init omap_intc_of_init(struct device_node *node,
261 struct device_node *parent)
262{
263 struct resource res;
264 u32 nr_irqs = 96;
265
266 if (WARN_ON(!node))
267 return -ENODEV;
268
269 if (of_address_to_resource(node, 0, &res)) {
270 WARN(1, "unable to get intc registers\n");
271 return -EINVAL;
272 }
273
274 if (of_property_read_u32(node, "ti,intc-size", &nr_irqs))
275 pr_warn("unable to get intc-size, default to %d\n", nr_irqs);
276
277 omap_init_irq(res.start, nr_irqs, of_node_get(node));
278
279 return 0;
280}
281
239#ifdef CONFIG_ARCH_OMAP3 282#ifdef CONFIG_ARCH_OMAP3
240static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)]; 283static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
241 284
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index fb4bcf81a18..577cb77db26 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -34,7 +34,7 @@
34#include "cm2xxx_3xxx.h" 34#include "cm2xxx_3xxx.h"
35#include "cm-regbits-34xx.h" 35#include "cm-regbits-34xx.h"
36 36
37/* McBSP internal signal muxing function */ 37/* McBSP1 internal signal muxing function for OMAP2/3 */
38static int omap2_mcbsp1_mux_rx_clk(struct device *dev, const char *signal, 38static int omap2_mcbsp1_mux_rx_clk(struct device *dev, const char *signal,
39 const char *src) 39 const char *src)
40{ 40{
@@ -65,6 +65,42 @@ static int omap2_mcbsp1_mux_rx_clk(struct device *dev, const char *signal,
65 return 0; 65 return 0;
66} 66}
67 67
68/* McBSP4 internal signal muxing function for OMAP4 */
69#define OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_FSX (1 << 31)
70#define OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_CLKX (1 << 30)
71static int omap4_mcbsp4_mux_rx_clk(struct device *dev, const char *signal,
72 const char *src)
73{
74 u32 v;
75
76 /*
77 * In CONTROL_MCBSPLP register only bit 30 (CLKR mux), and bit 31 (FSR
78 * mux) is used */
79 v = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MCBSPLP);
80
81 if (!strcmp(signal, "clkr")) {
82 if (!strcmp(src, "clkr"))
83 v &= ~OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_CLKX;
84 else if (!strcmp(src, "clkx"))
85 v |= OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_CLKX;
86 else
87 return -EINVAL;
88 } else if (!strcmp(signal, "fsr")) {
89 if (!strcmp(src, "fsr"))
90 v &= ~OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_FSX;
91 else if (!strcmp(src, "fsx"))
92 v |= OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_FSX;
93 else
94 return -EINVAL;
95 } else {
96 return -EINVAL;
97 }
98
99 omap4_ctrl_pad_writel(v, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MCBSPLP);
100
101 return 0;
102}
103
68/* McBSP CLKS source switching function */ 104/* McBSP CLKS source switching function */
69static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk, 105static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
70 const char *src) 106 const char *src)
@@ -122,7 +158,7 @@ static int omap3_enable_st_clock(unsigned int id, bool enable)
122 return 0; 158 return 0;
123} 159}
124 160
125static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) 161static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
126{ 162{
127 int id, count = 1; 163 int id, count = 1;
128 char *name = "omap-mcbsp"; 164 char *name = "omap-mcbsp";
@@ -146,9 +182,15 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
146 pdata->has_ccr = true; 182 pdata->has_ccr = true;
147 } 183 }
148 pdata->set_clk_src = omap2_mcbsp_set_clk_src; 184 pdata->set_clk_src = omap2_mcbsp_set_clk_src;
149 if (id == 1) 185
186 /* On OMAP2/3 the McBSP1 port has 6 pin configuration */
187 if (id == 1 && oh->class->rev < MCBSP_CONFIG_TYPE4)
150 pdata->mux_signal = omap2_mcbsp1_mux_rx_clk; 188 pdata->mux_signal = omap2_mcbsp1_mux_rx_clk;
151 189
190 /* On OMAP4 the McBSP4 port has 6 pin configuration */
191 if (id == 4 && oh->class->rev == MCBSP_CONFIG_TYPE4)
192 pdata->mux_signal = omap4_mcbsp4_mux_rx_clk;
193
152 if (oh->class->rev == MCBSP_CONFIG_TYPE3) { 194 if (oh->class->rev == MCBSP_CONFIG_TYPE3) {
153 if (id == 2) 195 if (id == 2)
154 /* The FIFO has 1024 + 256 locations */ 196 /* The FIFO has 1024 + 256 locations */
@@ -180,7 +222,6 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
180 name, oh->name); 222 name, oh->name);
181 return PTR_ERR(pdev); 223 return PTR_ERR(pdev);
182 } 224 }
183 omap_mcbsp_count++;
184 return 0; 225 return 0;
185} 226}
186 227
@@ -188,11 +229,6 @@ static int __init omap2_mcbsp_init(void)
188{ 229{
189 omap_hwmod_for_each_by_class("mcbsp", omap_init_mcbsp, NULL); 230 omap_hwmod_for_each_by_class("mcbsp", omap_init_mcbsp, NULL);
190 231
191 mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *), 232 return 0;
192 GFP_KERNEL);
193 if (!mcbsp_ptr)
194 return -ENOMEM;
195
196 return omap_mcbsp_init();
197} 233}
198arch_initcall(omap2_mcbsp_init); 234arch_initcall(omap2_mcbsp_init);
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 611a0e3d54c..f26b2faa169 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -100,8 +100,8 @@ void omap_mux_write_array(struct omap_mux_partition *partition,
100 100
101static char *omap_mux_options; 101static char *omap_mux_options;
102 102
103static int _omap_mux_init_gpio(struct omap_mux_partition *partition, 103static int __init _omap_mux_init_gpio(struct omap_mux_partition *partition,
104 int gpio, int val) 104 int gpio, int val)
105{ 105{
106 struct omap_mux_entry *e; 106 struct omap_mux_entry *e;
107 struct omap_mux *gpio_mux = NULL; 107 struct omap_mux *gpio_mux = NULL;
@@ -145,7 +145,7 @@ static int _omap_mux_init_gpio(struct omap_mux_partition *partition,
145 return 0; 145 return 0;
146} 146}
147 147
148int omap_mux_init_gpio(int gpio, int val) 148int __init omap_mux_init_gpio(int gpio, int val)
149{ 149{
150 struct omap_mux_partition *partition; 150 struct omap_mux_partition *partition;
151 int ret; 151 int ret;
@@ -159,9 +159,9 @@ int omap_mux_init_gpio(int gpio, int val)
159 return -ENODEV; 159 return -ENODEV;
160} 160}
161 161
162static int _omap_mux_get_by_name(struct omap_mux_partition *partition, 162static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
163 const char *muxname, 163 const char *muxname,
164 struct omap_mux **found_mux) 164 struct omap_mux **found_mux)
165{ 165{
166 struct omap_mux *mux = NULL; 166 struct omap_mux *mux = NULL;
167 struct omap_mux_entry *e; 167 struct omap_mux_entry *e;
@@ -218,7 +218,7 @@ static int _omap_mux_get_by_name(struct omap_mux_partition *partition,
218 return -ENODEV; 218 return -ENODEV;
219} 219}
220 220
221static int 221static int __init
222omap_mux_get_by_name(const char *muxname, 222omap_mux_get_by_name(const char *muxname,
223 struct omap_mux_partition **found_partition, 223 struct omap_mux_partition **found_partition,
224 struct omap_mux **found_mux) 224 struct omap_mux **found_mux)
@@ -240,7 +240,7 @@ omap_mux_get_by_name(const char *muxname,
240 return -ENODEV; 240 return -ENODEV;
241} 241}
242 242
243int omap_mux_init_signal(const char *muxname, int val) 243int __init omap_mux_init_signal(const char *muxname, int val)
244{ 244{
245 struct omap_mux_partition *partition = NULL; 245 struct omap_mux_partition *partition = NULL;
246 struct omap_mux *mux = NULL; 246 struct omap_mux *mux = NULL;
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index 2132308ad1e..69fe060a0b7 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -246,7 +246,7 @@ static inline void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
246{ 246{
247} 247}
248 248
249static struct omap_board_mux *board_mux __initdata __maybe_unused; 249static struct omap_board_mux *board_mux __maybe_unused;
250 250
251#endif 251#endif
252 252
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
index adbe4d8c7ca..56c345b8b93 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -33,7 +33,7 @@ int platform_cpu_kill(unsigned int cpu)
33 * platform-specific code to shutdown a CPU 33 * platform-specific code to shutdown a CPU
34 * Called with IRQs disabled 34 * Called with IRQs disabled
35 */ 35 */
36void platform_cpu_die(unsigned int cpu) 36void __ref platform_cpu_die(unsigned int cpu)
37{ 37{
38 unsigned int this_cpu; 38 unsigned int this_cpu;
39 39
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index 1d5d0105655..63ab686834c 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -263,12 +263,10 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
263 * In MPUSS OSWR or device OFF, interrupt controller contest is lost. 263 * In MPUSS OSWR or device OFF, interrupt controller contest is lost.
264 */ 264 */
265 mpuss_clear_prev_logic_pwrst(); 265 mpuss_clear_prev_logic_pwrst();
266 pwrdm_clear_all_prev_pwrst(mpuss_pd);
267 if ((pwrdm_read_next_pwrst(mpuss_pd) == PWRDM_POWER_RET) && 266 if ((pwrdm_read_next_pwrst(mpuss_pd) == PWRDM_POWER_RET) &&
268 (pwrdm_read_logic_retst(mpuss_pd) == PWRDM_POWER_OFF)) 267 (pwrdm_read_logic_retst(mpuss_pd) == PWRDM_POWER_OFF))
269 save_state = 2; 268 save_state = 2;
270 269
271 clear_cpu_prev_pwrst(cpu);
272 cpu_clear_prev_logic_pwrst(cpu); 270 cpu_clear_prev_logic_pwrst(cpu);
273 set_cpu_next_pwrst(cpu, power_state); 271 set_cpu_next_pwrst(cpu, power_state);
274 set_cpu_wakeup_addr(cpu, virt_to_phys(omap4_cpu_resume)); 272 set_cpu_wakeup_addr(cpu, virt_to_phys(omap4_cpu_resume));
@@ -300,7 +298,7 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
300 * @cpu : CPU ID 298 * @cpu : CPU ID
301 * @power_state: CPU low power state. 299 * @power_state: CPU low power state.
302 */ 300 */
303int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state) 301int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
304{ 302{
305 unsigned int cpu_state = 0; 303 unsigned int cpu_state = 0;
306 304
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index c1bf3ef0ba0..deffbf1c962 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -23,11 +23,12 @@
23#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
24#include <asm/hardware/gic.h> 24#include <asm/hardware/gic.h>
25#include <asm/smp_scu.h> 25#include <asm/smp_scu.h>
26
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <mach/omap-secure.h> 28#include <mach/omap-secure.h>
28 29
30#include "iomap.h"
29#include "common.h" 31#include "common.h"
30
31#include "clockdomain.h" 32#include "clockdomain.h"
32 33
33/* SCU base address */ 34/* SCU base address */
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
index d3d8971d7f3..42cd7fb5241 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -43,7 +43,6 @@
43 43
44static void __iomem *wakeupgen_base; 44static void __iomem *wakeupgen_base;
45static void __iomem *sar_base; 45static void __iomem *sar_base;
46static DEFINE_PER_CPU(u32 [NR_REG_BANKS], irqmasks);
47static DEFINE_SPINLOCK(wakeupgen_lock); 46static DEFINE_SPINLOCK(wakeupgen_lock);
48static unsigned int irq_target_cpu[NR_IRQS]; 47static unsigned int irq_target_cpu[NR_IRQS];
49 48
@@ -67,14 +66,6 @@ static inline void sar_writel(u32 val, u32 offset, u8 idx)
67 __raw_writel(val, sar_base + offset + (idx * 4)); 66 __raw_writel(val, sar_base + offset + (idx * 4));
68} 67}
69 68
70static void _wakeupgen_set_all(unsigned int cpu, unsigned int reg)
71{
72 u8 i;
73
74 for (i = 0; i < NR_REG_BANKS; i++)
75 wakeupgen_writel(reg, i, cpu);
76}
77
78static inline int _wakeupgen_get_irq_info(u32 irq, u32 *bit_posn, u8 *reg_index) 69static inline int _wakeupgen_get_irq_info(u32 irq, u32 *bit_posn, u8 *reg_index)
79{ 70{
80 unsigned int spi_irq; 71 unsigned int spi_irq;
@@ -130,22 +121,6 @@ static void _wakeupgen_set(unsigned int irq, unsigned int cpu)
130 wakeupgen_writel(val, i, cpu); 121 wakeupgen_writel(val, i, cpu);
131} 122}
132 123
133static void _wakeupgen_save_masks(unsigned int cpu)
134{
135 u8 i;
136
137 for (i = 0; i < NR_REG_BANKS; i++)
138 per_cpu(irqmasks, cpu)[i] = wakeupgen_readl(i, cpu);
139}
140
141static void _wakeupgen_restore_masks(unsigned int cpu)
142{
143 u8 i;
144
145 for (i = 0; i < NR_REG_BANKS; i++)
146 wakeupgen_writel(per_cpu(irqmasks, cpu)[i], i, cpu);
147}
148
149/* 124/*
150 * Architecture specific Mask extension 125 * Architecture specific Mask extension
151 */ 126 */
@@ -170,6 +145,33 @@ static void wakeupgen_unmask(struct irq_data *d)
170 spin_unlock_irqrestore(&wakeupgen_lock, flags); 145 spin_unlock_irqrestore(&wakeupgen_lock, flags);
171} 146}
172 147
148#ifdef CONFIG_HOTPLUG_CPU
149static DEFINE_PER_CPU(u32 [NR_REG_BANKS], irqmasks);
150
151static void _wakeupgen_save_masks(unsigned int cpu)
152{
153 u8 i;
154
155 for (i = 0; i < NR_REG_BANKS; i++)
156 per_cpu(irqmasks, cpu)[i] = wakeupgen_readl(i, cpu);
157}
158
159static void _wakeupgen_restore_masks(unsigned int cpu)
160{
161 u8 i;
162
163 for (i = 0; i < NR_REG_BANKS; i++)
164 wakeupgen_writel(per_cpu(irqmasks, cpu)[i], i, cpu);
165}
166
167static void _wakeupgen_set_all(unsigned int cpu, unsigned int reg)
168{
169 u8 i;
170
171 for (i = 0; i < NR_REG_BANKS; i++)
172 wakeupgen_writel(reg, i, cpu);
173}
174
173/* 175/*
174 * Mask or unmask all interrupts on given CPU. 176 * Mask or unmask all interrupts on given CPU.
175 * 0 = Mask all interrupts on the 'cpu' 177 * 0 = Mask all interrupts on the 'cpu'
@@ -191,6 +193,7 @@ static void wakeupgen_irqmask_all(unsigned int cpu, unsigned int set)
191 } 193 }
192 spin_unlock_irqrestore(&wakeupgen_lock, flags); 194 spin_unlock_irqrestore(&wakeupgen_lock, flags);
193} 195}
196#endif
194 197
195#ifdef CONFIG_CPU_PM 198#ifdef CONFIG_CPU_PM
196/* 199/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 3c8dd928628..34b9766d1d2 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -29,6 +29,7 @@
29 29
30#include "omap_hwmod_common_data.h" 30#include "omap_hwmod_common_data.h"
31 31
32#include "smartreflex.h"
32#include "prm-regbits-34xx.h" 33#include "prm-regbits-34xx.h"
33#include "cm-regbits-34xx.h" 34#include "cm-regbits-34xx.h"
34#include "wd_timer.h" 35#include "wd_timer.h"
@@ -376,6 +377,16 @@ static struct omap_hwmod_ocp_if omap3_l4_core__i2c3 = {
376 .user = OCP_USER_MPU | OCP_USER_SDMA, 377 .user = OCP_USER_MPU | OCP_USER_SDMA,
377}; 378};
378 379
380static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = {
381 { .irq = 18},
382 { .irq = -1 }
383};
384
385static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = {
386 { .irq = 19},
387 { .irq = -1 }
388};
389
379/* L4 CORE -> SR1 interface */ 390/* L4 CORE -> SR1 interface */
380static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = { 391static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = {
381 { 392 {
@@ -2664,6 +2675,10 @@ static struct omap_hwmod_class omap36xx_smartreflex_hwmod_class = {
2664}; 2675};
2665 2676
2666/* SR1 */ 2677/* SR1 */
2678static struct omap_smartreflex_dev_attr sr1_dev_attr = {
2679 .sensor_voltdm_name = "mpu_iva",
2680};
2681
2667static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = { 2682static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = {
2668 &omap3_l4_core__sr1, 2683 &omap3_l4_core__sr1,
2669}; 2684};
@@ -2672,7 +2687,6 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
2672 .name = "sr1_hwmod", 2687 .name = "sr1_hwmod",
2673 .class = &omap34xx_smartreflex_hwmod_class, 2688 .class = &omap34xx_smartreflex_hwmod_class,
2674 .main_clk = "sr1_fck", 2689 .main_clk = "sr1_fck",
2675 .vdd_name = "mpu_iva",
2676 .prcm = { 2690 .prcm = {
2677 .omap2 = { 2691 .omap2 = {
2678 .prcm_reg_id = 1, 2692 .prcm_reg_id = 1,
@@ -2684,6 +2698,8 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
2684 }, 2698 },
2685 .slaves = omap3_sr1_slaves, 2699 .slaves = omap3_sr1_slaves,
2686 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), 2700 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves),
2701 .dev_attr = &sr1_dev_attr,
2702 .mpu_irqs = omap3_smartreflex_mpu_irqs,
2687 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2703 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
2688}; 2704};
2689 2705
@@ -2691,7 +2707,6 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
2691 .name = "sr1_hwmod", 2707 .name = "sr1_hwmod",
2692 .class = &omap36xx_smartreflex_hwmod_class, 2708 .class = &omap36xx_smartreflex_hwmod_class,
2693 .main_clk = "sr1_fck", 2709 .main_clk = "sr1_fck",
2694 .vdd_name = "mpu_iva",
2695 .prcm = { 2710 .prcm = {
2696 .omap2 = { 2711 .omap2 = {
2697 .prcm_reg_id = 1, 2712 .prcm_reg_id = 1,
@@ -2703,9 +2718,15 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
2703 }, 2718 },
2704 .slaves = omap3_sr1_slaves, 2719 .slaves = omap3_sr1_slaves,
2705 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), 2720 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves),
2721 .dev_attr = &sr1_dev_attr,
2722 .mpu_irqs = omap3_smartreflex_mpu_irqs,
2706}; 2723};
2707 2724
2708/* SR2 */ 2725/* SR2 */
2726static struct omap_smartreflex_dev_attr sr2_dev_attr = {
2727 .sensor_voltdm_name = "core",
2728};
2729
2709static struct omap_hwmod_ocp_if *omap3_sr2_slaves[] = { 2730static struct omap_hwmod_ocp_if *omap3_sr2_slaves[] = {
2710 &omap3_l4_core__sr2, 2731 &omap3_l4_core__sr2,
2711}; 2732};
@@ -2714,7 +2735,6 @@ static struct omap_hwmod omap34xx_sr2_hwmod = {
2714 .name = "sr2_hwmod", 2735 .name = "sr2_hwmod",
2715 .class = &omap34xx_smartreflex_hwmod_class, 2736 .class = &omap34xx_smartreflex_hwmod_class,
2716 .main_clk = "sr2_fck", 2737 .main_clk = "sr2_fck",
2717 .vdd_name = "core",
2718 .prcm = { 2738 .prcm = {
2719 .omap2 = { 2739 .omap2 = {
2720 .prcm_reg_id = 1, 2740 .prcm_reg_id = 1,
@@ -2726,6 +2746,8 @@ static struct omap_hwmod omap34xx_sr2_hwmod = {
2726 }, 2746 },
2727 .slaves = omap3_sr2_slaves, 2747 .slaves = omap3_sr2_slaves,
2728 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), 2748 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves),
2749 .dev_attr = &sr2_dev_attr,
2750 .mpu_irqs = omap3_smartreflex_core_irqs,
2729 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2751 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
2730}; 2752};
2731 2753
@@ -2733,7 +2755,6 @@ static struct omap_hwmod omap36xx_sr2_hwmod = {
2733 .name = "sr2_hwmod", 2755 .name = "sr2_hwmod",
2734 .class = &omap36xx_smartreflex_hwmod_class, 2756 .class = &omap36xx_smartreflex_hwmod_class,
2735 .main_clk = "sr2_fck", 2757 .main_clk = "sr2_fck",
2736 .vdd_name = "core",
2737 .prcm = { 2758 .prcm = {
2738 .omap2 = { 2759 .omap2 = {
2739 .prcm_reg_id = 1, 2760 .prcm_reg_id = 1,
@@ -2745,6 +2766,8 @@ static struct omap_hwmod omap36xx_sr2_hwmod = {
2745 }, 2766 },
2746 .slaves = omap3_sr2_slaves, 2767 .slaves = omap3_sr2_slaves,
2747 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), 2768 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves),
2769 .dev_attr = &sr2_dev_attr,
2770 .mpu_irqs = omap3_smartreflex_core_irqs,
2748}; 2771};
2749 2772
2750/* 2773/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index ef0524c10a8..08daa5e0eb5 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -28,12 +28,12 @@
28#include <plat/mcspi.h> 28#include <plat/mcspi.h>
29#include <plat/mcbsp.h> 29#include <plat/mcbsp.h>
30#include <plat/mmc.h> 30#include <plat/mmc.h>
31#include <plat/i2c.h>
32#include <plat/dmtimer.h> 31#include <plat/dmtimer.h>
33#include <plat/common.h> 32#include <plat/common.h>
34 33
35#include "omap_hwmod_common_data.h" 34#include "omap_hwmod_common_data.h"
36 35
36#include "smartreflex.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"
@@ -3963,6 +3963,10 @@ static struct omap_hwmod_class omap44xx_smartreflex_hwmod_class = {
3963}; 3963};
3964 3964
3965/* smartreflex_core */ 3965/* smartreflex_core */
3966static struct omap_smartreflex_dev_attr smartreflex_core_dev_attr = {
3967 .sensor_voltdm_name = "core",
3968};
3969
3966static struct omap_hwmod omap44xx_smartreflex_core_hwmod; 3970static struct omap_hwmod omap44xx_smartreflex_core_hwmod;
3967static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = { 3971static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = {
3968 { .irq = 19 + OMAP44XX_IRQ_GIC_START }, 3972 { .irq = 19 + OMAP44XX_IRQ_GIC_START },
@@ -3999,7 +4003,6 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
3999 .mpu_irqs = omap44xx_smartreflex_core_irqs, 4003 .mpu_irqs = omap44xx_smartreflex_core_irqs,
4000 4004
4001 .main_clk = "smartreflex_core_fck", 4005 .main_clk = "smartreflex_core_fck",
4002 .vdd_name = "core",
4003 .prcm = { 4006 .prcm = {
4004 .omap4 = { 4007 .omap4 = {
4005 .clkctrl_offs = OMAP4_CM_ALWON_SR_CORE_CLKCTRL_OFFSET, 4008 .clkctrl_offs = OMAP4_CM_ALWON_SR_CORE_CLKCTRL_OFFSET,
@@ -4009,9 +4012,14 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
4009 }, 4012 },
4010 .slaves = omap44xx_smartreflex_core_slaves, 4013 .slaves = omap44xx_smartreflex_core_slaves,
4011 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves), 4014 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves),
4015 .dev_attr = &smartreflex_core_dev_attr,
4012}; 4016};
4013 4017
4014/* smartreflex_iva */ 4018/* smartreflex_iva */
4019static struct omap_smartreflex_dev_attr smartreflex_iva_dev_attr = {
4020 .sensor_voltdm_name = "iva",
4021};
4022
4015static struct omap_hwmod omap44xx_smartreflex_iva_hwmod; 4023static struct omap_hwmod omap44xx_smartreflex_iva_hwmod;
4016static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = { 4024static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = {
4017 { .irq = 102 + OMAP44XX_IRQ_GIC_START }, 4025 { .irq = 102 + OMAP44XX_IRQ_GIC_START },
@@ -4047,7 +4055,6 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
4047 .clkdm_name = "l4_ao_clkdm", 4055 .clkdm_name = "l4_ao_clkdm",
4048 .mpu_irqs = omap44xx_smartreflex_iva_irqs, 4056 .mpu_irqs = omap44xx_smartreflex_iva_irqs,
4049 .main_clk = "smartreflex_iva_fck", 4057 .main_clk = "smartreflex_iva_fck",
4050 .vdd_name = "iva",
4051 .prcm = { 4058 .prcm = {
4052 .omap4 = { 4059 .omap4 = {
4053 .clkctrl_offs = OMAP4_CM_ALWON_SR_IVA_CLKCTRL_OFFSET, 4060 .clkctrl_offs = OMAP4_CM_ALWON_SR_IVA_CLKCTRL_OFFSET,
@@ -4057,9 +4064,14 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
4057 }, 4064 },
4058 .slaves = omap44xx_smartreflex_iva_slaves, 4065 .slaves = omap44xx_smartreflex_iva_slaves,
4059 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves), 4066 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves),
4067 .dev_attr = &smartreflex_iva_dev_attr,
4060}; 4068};
4061 4069
4062/* smartreflex_mpu */ 4070/* smartreflex_mpu */
4071static struct omap_smartreflex_dev_attr smartreflex_mpu_dev_attr = {
4072 .sensor_voltdm_name = "mpu",
4073};
4074
4063static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod; 4075static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod;
4064static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = { 4076static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = {
4065 { .irq = 18 + OMAP44XX_IRQ_GIC_START }, 4077 { .irq = 18 + OMAP44XX_IRQ_GIC_START },
@@ -4095,7 +4107,6 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = {
4095 .clkdm_name = "l4_ao_clkdm", 4107 .clkdm_name = "l4_ao_clkdm",
4096 .mpu_irqs = omap44xx_smartreflex_mpu_irqs, 4108 .mpu_irqs = omap44xx_smartreflex_mpu_irqs,
4097 .main_clk = "smartreflex_mpu_fck", 4109 .main_clk = "smartreflex_mpu_fck",
4098 .vdd_name = "mpu",
4099 .prcm = { 4110 .prcm = {
4100 .omap4 = { 4111 .omap4 = {
4101 .clkctrl_offs = OMAP4_CM_ALWON_SR_MPU_CLKCTRL_OFFSET, 4112 .clkctrl_offs = OMAP4_CM_ALWON_SR_MPU_CLKCTRL_OFFSET,
@@ -4105,6 +4116,7 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = {
4105 }, 4116 },
4106 .slaves = omap44xx_smartreflex_mpu_slaves, 4117 .slaves = omap44xx_smartreflex_mpu_slaves,
4107 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves), 4118 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves),
4119 .dev_attr = &smartreflex_mpu_dev_attr,
4108}; 4120};
4109 4121
4110/* 4122/*
diff --git a/arch/arm/mach-omap2/opp2420_data.c b/arch/arm/mach-omap2/opp2420_data.c
index e6dda694fd5..5037e76e4e2 100644
--- a/arch/arm/mach-omap2/opp2420_data.c
+++ b/arch/arm/mach-omap2/opp2420_data.c
@@ -28,6 +28,8 @@
28 * http://repository.maemo.org/pool/diablo/free/k/kernel-source-diablo/ 28 * http://repository.maemo.org/pool/diablo/free/k/kernel-source-diablo/
29 */ 29 */
30 30
31#include <plat/hardware.h>
32
31#include "opp2xxx.h" 33#include "opp2xxx.h"
32#include "sdrc.h" 34#include "sdrc.h"
33#include "clock.h" 35#include "clock.h"
diff --git a/arch/arm/mach-omap2/opp2430_data.c b/arch/arm/mach-omap2/opp2430_data.c
index 1b9596ae201..750805c528d 100644
--- a/arch/arm/mach-omap2/opp2430_data.c
+++ b/arch/arm/mach-omap2/opp2430_data.c
@@ -26,6 +26,8 @@
26 * This is technically part of the OMAP2xxx clock code. 26 * This is technically part of the OMAP2xxx clock code.
27 */ 27 */
28 28
29#include <plat/hardware.h>
30
29#include "opp2xxx.h" 31#include "opp2xxx.h"
30#include "sdrc.h" 32#include "sdrc.h"
31#include "clock.h" 33#include "clock.h"
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 4411163e012..814bcd90159 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -220,8 +220,8 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
220 return 0; 220 return 0;
221 221
222 d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir); 222 d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir);
223 223 if (!(IS_ERR_OR_NULL(d)))
224 (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, 224 (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d,
225 (void *)pwrdm, &pwrdm_suspend_fops); 225 (void *)pwrdm, &pwrdm_suspend_fops);
226 226
227 return 0; 227 return 0;
@@ -264,7 +264,7 @@ static int __init pm_dbg_init(void)
264 return 0; 264 return 0;
265 265
266 d = debugfs_create_dir("pm_debug", NULL); 266 d = debugfs_create_dir("pm_debug", NULL);
267 if (IS_ERR(d)) 267 if (IS_ERR_OR_NULL(d))
268 return PTR_ERR(d); 268 return PTR_ERR(d);
269 269
270 (void) debugfs_create_file("count", S_IRUGO, 270 (void) debugfs_create_file("count", S_IRUGO,
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 5a65dd04aa3..a7bdec69a2b 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -15,11 +15,13 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/opp.h> 16#include <linux/opp.h>
17#include <linux/export.h> 17#include <linux/export.h>
18#include <linux/suspend.h>
18 19
19#include <plat/omap-pm.h> 20#include <plat/omap-pm.h>
20#include <plat/omap_device.h> 21#include <plat/omap_device.h>
21#include "common.h" 22#include "common.h"
22 23
24#include "prcm-common.h"
23#include "voltage.h" 25#include "voltage.h"
24#include "powerdomain.h" 26#include "powerdomain.h"
25#include "clockdomain.h" 27#include "clockdomain.h"
@@ -28,7 +30,13 @@
28 30
29static struct omap_device_pm_latency *pm_lats; 31static struct omap_device_pm_latency *pm_lats;
30 32
31static int _init_omap_device(char *name) 33/*
34 * omap_pm_suspend: points to a function that does the SoC-specific
35 * suspend work
36 */
37int (*omap_pm_suspend)(void);
38
39static int __init _init_omap_device(char *name)
32{ 40{
33 struct omap_hwmod *oh; 41 struct omap_hwmod *oh;
34 struct platform_device *pdev; 42 struct platform_device *pdev;
@@ -49,7 +57,7 @@ static int _init_omap_device(char *name)
49/* 57/*
50 * Build omap_devices for processors and bus. 58 * Build omap_devices for processors and bus.
51 */ 59 */
52static void omap2_init_processor_devices(void) 60static void __init omap2_init_processor_devices(void)
53{ 61{
54 _init_omap_device("mpu"); 62 _init_omap_device("mpu");
55 if (omap3_has_iva()) 63 if (omap3_has_iva())
@@ -68,32 +76,41 @@ static void omap2_init_processor_devices(void)
68#define FORCEWAKEUP_SWITCH 0 76#define FORCEWAKEUP_SWITCH 0
69#define LOWPOWERSTATE_SWITCH 1 77#define LOWPOWERSTATE_SWITCH 1
70 78
79int __init omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused)
80{
81 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
82 clkdm_allow_idle(clkdm);
83 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
84 atomic_read(&clkdm->usecount) == 0)
85 clkdm_sleep(clkdm);
86 return 0;
87}
88
71/* 89/*
72 * This sets pwrdm state (other than mpu & core. Currently only ON & 90 * This sets pwrdm state (other than mpu & core. Currently only ON &
73 * RET are supported. 91 * RET are supported.
74 */ 92 */
75int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state) 93int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 pwrst)
76{ 94{
77 u32 cur_state; 95 u8 curr_pwrst, next_pwrst;
78 int sleep_switch = -1; 96 int sleep_switch = -1, ret = 0, hwsup = 0;
79 int ret = 0;
80 int hwsup = 0;
81 97
82 if (pwrdm == NULL || IS_ERR(pwrdm)) 98 if (!pwrdm || IS_ERR(pwrdm))
83 return -EINVAL; 99 return -EINVAL;
84 100
85 while (!(pwrdm->pwrsts & (1 << state))) { 101 while (!(pwrdm->pwrsts & (1 << pwrst))) {
86 if (state == PWRDM_POWER_OFF) 102 if (pwrst == PWRDM_POWER_OFF)
87 return ret; 103 return ret;
88 state--; 104 pwrst--;
89 } 105 }
90 106
91 cur_state = pwrdm_read_next_pwrst(pwrdm); 107 next_pwrst = pwrdm_read_next_pwrst(pwrdm);
92 if (cur_state == state) 108 if (next_pwrst == pwrst)
93 return ret; 109 return ret;
94 110
95 if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) { 111 curr_pwrst = pwrdm_read_pwrst(pwrdm);
96 if ((pwrdm_read_pwrst(pwrdm) > state) && 112 if (curr_pwrst < PWRDM_POWER_ON) {
113 if ((curr_pwrst > pwrst) &&
97 (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) { 114 (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
98 sleep_switch = LOWPOWERSTATE_SWITCH; 115 sleep_switch = LOWPOWERSTATE_SWITCH;
99 } else { 116 } else {
@@ -103,12 +120,10 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
103 } 120 }
104 } 121 }
105 122
106 ret = pwrdm_set_next_pwrst(pwrdm, state); 123 ret = pwrdm_set_next_pwrst(pwrdm, pwrst);
107 if (ret) { 124 if (ret)
108 pr_err("%s: unable to set state of powerdomain: %s\n", 125 pr_err("%s: unable to set power state of powerdomain: %s\n",
109 __func__, pwrdm->name); 126 __func__, pwrdm->name);
110 goto err;
111 }
112 127
113 switch (sleep_switch) { 128 switch (sleep_switch) {
114 case FORCEWAKEUP_SWITCH: 129 case FORCEWAKEUP_SWITCH:
@@ -119,16 +134,16 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
119 break; 134 break;
120 case LOWPOWERSTATE_SWITCH: 135 case LOWPOWERSTATE_SWITCH:
121 pwrdm_set_lowpwrstchange(pwrdm); 136 pwrdm_set_lowpwrstchange(pwrdm);
137 pwrdm_wait_transition(pwrdm);
138 pwrdm_state_switch(pwrdm);
122 break; 139 break;
123 default:
124 return ret;
125 } 140 }
126 141
127 pwrdm_state_switch(pwrdm);
128err:
129 return ret; 142 return ret;
130} 143}
131 144
145
146
132/* 147/*
133 * This API is to be called during init to set the various voltage 148 * This API is to be called during init to set the various voltage
134 * domains to the voltage as per the opp table. Typically we boot up 149 * domains to the voltage as per the opp table. Typically we boot up
@@ -199,6 +214,56 @@ exit:
199 return -EINVAL; 214 return -EINVAL;
200} 215}
201 216
217#ifdef CONFIG_SUSPEND
218static int omap_pm_enter(suspend_state_t suspend_state)
219{
220 int ret = 0;
221
222 if (!omap_pm_suspend)
223 return -ENOENT; /* XXX doublecheck */
224
225 switch (suspend_state) {
226 case PM_SUSPEND_STANDBY:
227 case PM_SUSPEND_MEM:
228 ret = omap_pm_suspend();
229 break;
230 default:
231 ret = -EINVAL;
232 }
233
234 return ret;
235}
236
237static int omap_pm_begin(suspend_state_t state)
238{
239 disable_hlt();
240 if (cpu_is_omap34xx())
241 omap_prcm_irq_prepare();
242 return 0;
243}
244
245static void omap_pm_end(void)
246{
247 enable_hlt();
248 return;
249}
250
251static void omap_pm_finish(void)
252{
253 if (cpu_is_omap34xx())
254 omap_prcm_irq_complete();
255}
256
257static const struct platform_suspend_ops omap_pm_ops = {
258 .begin = omap_pm_begin,
259 .end = omap_pm_end,
260 .enter = omap_pm_enter,
261 .finish = omap_pm_finish,
262 .valid = suspend_valid_only_mem,
263};
264
265#endif /* CONFIG_SUSPEND */
266
202static void __init omap3_init_voltages(void) 267static void __init omap3_init_voltages(void)
203{ 268{
204 if (!cpu_is_omap34xx()) 269 if (!cpu_is_omap34xx())
@@ -230,6 +295,14 @@ postcore_initcall(omap2_common_pm_init);
230 295
231static int __init omap2_common_pm_late_init(void) 296static int __init omap2_common_pm_late_init(void)
232{ 297{
298 /*
299 * In the case of DT, the PMIC and SR initialization will be done using
300 * a completely different mechanism.
301 * Disable this part if a DT blob is available.
302 */
303 if (of_have_populated_dt())
304 return 0;
305
233 /* Init the voltage layer */ 306 /* Init the voltage layer */
234 omap_pmic_late_init(); 307 omap_pmic_late_init();
235 omap_voltage_late_init(); 308 omap_voltage_late_init();
@@ -241,6 +314,10 @@ static int __init omap2_common_pm_late_init(void)
241 /* Smartreflex device init */ 314 /* Smartreflex device init */
242 omap_devinit_smartreflex(); 315 omap_devinit_smartreflex();
243 316
317#ifdef CONFIG_SUSPEND
318 suspend_set_ops(&omap_pm_ops);
319#endif
320
244 return 0; 321 return 0;
245} 322}
246late_initcall(omap2_common_pm_late_init); 323late_initcall(omap2_common_pm_late_init);
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index b737b11e449..36fa90b6ece 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -18,10 +18,11 @@
18extern void *omap3_secure_ram_storage; 18extern void *omap3_secure_ram_storage;
19extern void omap3_pm_off_mode_enable(int); 19extern void omap3_pm_off_mode_enable(int);
20extern void omap_sram_idle(void); 20extern void omap_sram_idle(void);
21extern int omap3_can_sleep(void);
22extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state); 21extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
23extern int omap3_idle_init(void); 22extern int omap3_idle_init(void);
24extern int omap4_idle_init(void); 23extern int omap4_idle_init(void);
24extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused);
25extern int (*omap_pm_suspend)(void);
25 26
26#if defined(CONFIG_PM_OPP) 27#if defined(CONFIG_PM_OPP)
27extern int omap3_opp_init(void); 28extern int omap3_opp_init(void);
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 23de98d0384..5ca45ca7694 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -26,7 +26,6 @@
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.h>
29#include <linux/io.h>
30#include <linux/irq.h> 29#include <linux/irq.h>
31#include <linux/time.h> 30#include <linux/time.h>
32#include <linux/gpio.h> 31#include <linux/gpio.h>
@@ -35,12 +34,13 @@
35#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
36#include <asm/mach-types.h> 35#include <asm/mach-types.h>
37 36
38#include <mach/irqs.h>
39#include <plat/clock.h> 37#include <plat/clock.h>
40#include <plat/sram.h> 38#include <plat/sram.h>
41#include <plat/dma.h> 39#include <plat/dma.h>
42#include <plat/board.h> 40#include <plat/board.h>
43 41
42#include <mach/irqs.h>
43
44#include "common.h" 44#include "common.h"
45#include "prm2xxx_3xxx.h" 45#include "prm2xxx_3xxx.h"
46#include "prm-regbits-24xx.h" 46#include "prm-regbits-24xx.h"
@@ -49,23 +49,9 @@
49#include "sdrc.h" 49#include "sdrc.h"
50#include "pm.h" 50#include "pm.h"
51#include "control.h" 51#include "control.h"
52
53#include "powerdomain.h" 52#include "powerdomain.h"
54#include "clockdomain.h" 53#include "clockdomain.h"
55 54
56#ifdef CONFIG_SUSPEND
57static suspend_state_t suspend_state = PM_SUSPEND_ON;
58static inline bool is_suspending(void)
59{
60 return (suspend_state != PM_SUSPEND_ON);
61}
62#else
63static inline bool is_suspending(void)
64{
65 return false;
66}
67#endif
68
69static void (*omap2_sram_idle)(void); 55static void (*omap2_sram_idle)(void);
70static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl, 56static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl,
71 void __iomem *sdrc_power); 57 void __iomem *sdrc_power);
@@ -85,7 +71,7 @@ static int omap2_fclks_active(void)
85 return (f1 | f2) ? 1 : 0; 71 return (f1 | f2) ? 1 : 0;
86} 72}
87 73
88static void omap2_enter_full_retention(void) 74static int omap2_enter_full_retention(void)
89{ 75{
90 u32 l; 76 u32 l;
91 77
@@ -148,6 +134,8 @@ no_sleep:
148 134
149 /* Mask future PRCM-to-MPU interrupts */ 135 /* Mask future PRCM-to-MPU interrupts */
150 omap2_prm_write_mod_reg(0x0, OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET); 136 omap2_prm_write_mod_reg(0x0, OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET);
137
138 return 0;
151} 139}
152 140
153static int omap2_i2c_active(void) 141static int omap2_i2c_active(void)
@@ -226,7 +214,6 @@ static int omap2_can_sleep(void)
226 214
227static void omap2_pm_idle(void) 215static void omap2_pm_idle(void)
228{ 216{
229 local_irq_disable();
230 local_fiq_disable(); 217 local_fiq_disable();
231 218
232 if (!omap2_can_sleep()) { 219 if (!omap2_can_sleep()) {
@@ -243,78 +230,6 @@ static void omap2_pm_idle(void)
243 230
244out: 231out:
245 local_fiq_enable(); 232 local_fiq_enable();
246 local_irq_enable();
247}
248
249#ifdef CONFIG_SUSPEND
250static int omap2_pm_begin(suspend_state_t state)
251{
252 disable_hlt();
253 suspend_state = state;
254 return 0;
255}
256
257static int omap2_pm_suspend(void)
258{
259 u32 wken_wkup, mir1;
260
261 wken_wkup = omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
262 wken_wkup &= ~OMAP24XX_EN_GPT1_MASK;
263 omap2_prm_write_mod_reg(wken_wkup, WKUP_MOD, PM_WKEN);
264
265 /* Mask GPT1 */
266 mir1 = omap_readl(0x480fe0a4);
267 omap_writel(1 << 5, 0x480fe0ac);
268
269 omap2_enter_full_retention();
270
271 omap_writel(mir1, 0x480fe0a4);
272 omap2_prm_write_mod_reg(wken_wkup, WKUP_MOD, PM_WKEN);
273
274 return 0;
275}
276
277static int omap2_pm_enter(suspend_state_t state)
278{
279 int ret = 0;
280
281 switch (state) {
282 case PM_SUSPEND_STANDBY:
283 case PM_SUSPEND_MEM:
284 ret = omap2_pm_suspend();
285 break;
286 default:
287 ret = -EINVAL;
288 }
289
290 return ret;
291}
292
293static void omap2_pm_end(void)
294{
295 suspend_state = PM_SUSPEND_ON;
296 enable_hlt();
297}
298
299static const struct platform_suspend_ops omap_pm_ops = {
300 .begin = omap2_pm_begin,
301 .enter = omap2_pm_enter,
302 .end = omap2_pm_end,
303 .valid = suspend_valid_only_mem,
304};
305#else
306static const struct platform_suspend_ops __initdata omap_pm_ops;
307#endif /* CONFIG_SUSPEND */
308
309/* XXX This function should be shareable between OMAP2xxx and OMAP3 */
310static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
311{
312 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
313 clkdm_allow_idle(clkdm);
314 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
315 atomic_read(&clkdm->usecount) == 0)
316 clkdm_sleep(clkdm);
317 return 0;
318} 233}
319 234
320static void __init prcm_setup_regs(void) 235static void __init prcm_setup_regs(void)
@@ -358,9 +273,13 @@ static void __init prcm_setup_regs(void)
358 clkdm_sleep(gfx_clkdm); 273 clkdm_sleep(gfx_clkdm);
359 274
360 /* Enable hardware-supervised idle for all clkdms */ 275 /* Enable hardware-supervised idle for all clkdms */
361 clkdm_for_each(clkdms_setup, NULL); 276 clkdm_for_each(omap_pm_clkdms_setup, NULL);
362 clkdm_add_wkdep(mpu_clkdm, wkup_clkdm); 277 clkdm_add_wkdep(mpu_clkdm, wkup_clkdm);
363 278
279#ifdef CONFIG_SUSPEND
280 omap_pm_suspend = omap2_enter_full_retention;
281#endif
282
364 /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk 283 /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk
365 * stabilisation */ 284 * stabilisation */
366 omap2_prm_write_mod_reg(15 << OMAP_SETUP_TIME_SHIFT, OMAP24XX_GR_MOD, 285 omap2_prm_write_mod_reg(15 << OMAP_SETUP_TIME_SHIFT, OMAP24XX_GR_MOD,
@@ -461,8 +380,7 @@ static int __init omap2_pm_init(void)
461 omap24xx_cpu_suspend_sz); 380 omap24xx_cpu_suspend_sz);
462 } 381 }
463 382
464 suspend_set_ops(&omap_pm_ops); 383 arm_pm_idle = omap2_pm_idle;
465 pm_idle = omap2_pm_idle;
466 384
467 return 0; 385 return 0;
468} 386}
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index fc698757892..027a537d72b 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -50,10 +50,6 @@
50#include "sdrc.h" 50#include "sdrc.h"
51#include "control.h" 51#include "control.h"
52 52
53#ifdef CONFIG_SUSPEND
54static suspend_state_t suspend_state = PM_SUSPEND_ON;
55#endif
56
57/* pm34xx errata defined in pm.h */ 53/* pm34xx errata defined in pm.h */
58u16 pm34xx_errata; 54u16 pm34xx_errata;
59 55
@@ -75,16 +71,6 @@ static struct powerdomain *mpu_pwrdm, *neon_pwrdm;
75static struct powerdomain *core_pwrdm, *per_pwrdm; 71static struct powerdomain *core_pwrdm, *per_pwrdm;
76static struct powerdomain *cam_pwrdm; 72static struct powerdomain *cam_pwrdm;
77 73
78static inline void omap3_per_save_context(void)
79{
80 omap_gpio_save_context();
81}
82
83static inline void omap3_per_restore_context(void)
84{
85 omap_gpio_restore_context();
86}
87
88static void omap3_enable_io_chain(void) 74static void omap3_enable_io_chain(void)
89{ 75{
90 int timeout = 0; 76 int timeout = 0;
@@ -290,11 +276,6 @@ void omap_sram_idle(void)
290 int core_prev_state, per_prev_state; 276 int core_prev_state, per_prev_state;
291 u32 sdrc_pwr = 0; 277 u32 sdrc_pwr = 0;
292 278
293 pwrdm_clear_all_prev_pwrst(mpu_pwrdm);
294 pwrdm_clear_all_prev_pwrst(neon_pwrdm);
295 pwrdm_clear_all_prev_pwrst(core_pwrdm);
296 pwrdm_clear_all_prev_pwrst(per_pwrdm);
297
298 mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm); 279 mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm);
299 switch (mpu_next_state) { 280 switch (mpu_next_state) {
300 case PWRDM_POWER_ON: 281 case PWRDM_POWER_ON:
@@ -332,8 +313,6 @@ void omap_sram_idle(void)
332 if (per_next_state < PWRDM_POWER_ON) { 313 if (per_next_state < PWRDM_POWER_ON) {
333 per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0; 314 per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0;
334 omap2_gpio_prepare_for_idle(per_going_off); 315 omap2_gpio_prepare_for_idle(per_going_off);
335 if (per_next_state == PWRDM_POWER_OFF)
336 omap3_per_save_context();
337 } 316 }
338 317
339 /* CORE */ 318 /* CORE */
@@ -399,8 +378,6 @@ void omap_sram_idle(void)
399 if (per_next_state < PWRDM_POWER_ON) { 378 if (per_next_state < PWRDM_POWER_ON) {
400 per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm); 379 per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm);
401 omap2_gpio_resume_after_idle(); 380 omap2_gpio_resume_after_idle();
402 if (per_prev_state == PWRDM_POWER_OFF)
403 omap3_per_restore_context();
404 } 381 }
405 382
406 /* Disable IO-PAD and IO-CHAIN wakeup */ 383 /* Disable IO-PAD and IO-CHAIN wakeup */
@@ -418,10 +395,9 @@ void omap_sram_idle(void)
418 395
419static void omap3_pm_idle(void) 396static void omap3_pm_idle(void)
420{ 397{
421 local_irq_disable();
422 local_fiq_disable(); 398 local_fiq_disable();
423 399
424 if (omap_irq_pending() || need_resched()) 400 if (omap_irq_pending())
425 goto out; 401 goto out;
426 402
427 trace_power_start(POWER_CSTATE, 1, smp_processor_id()); 403 trace_power_start(POWER_CSTATE, 1, smp_processor_id());
@@ -434,7 +410,6 @@ static void omap3_pm_idle(void)
434 410
435out: 411out:
436 local_fiq_enable(); 412 local_fiq_enable();
437 local_irq_enable();
438} 413}
439 414
440#ifdef CONFIG_SUSPEND 415#ifdef CONFIG_SUSPEND
@@ -479,50 +454,6 @@ restore:
479 return ret; 454 return ret;
480} 455}
481 456
482static int omap3_pm_enter(suspend_state_t unused)
483{
484 int ret = 0;
485
486 switch (suspend_state) {
487 case PM_SUSPEND_STANDBY:
488 case PM_SUSPEND_MEM:
489 ret = omap3_pm_suspend();
490 break;
491 default:
492 ret = -EINVAL;
493 }
494
495 return ret;
496}
497
498/* Hooks to enable / disable UART interrupts during suspend */
499static int omap3_pm_begin(suspend_state_t state)
500{
501 disable_hlt();
502 suspend_state = state;
503 omap_prcm_irq_prepare();
504 return 0;
505}
506
507static void omap3_pm_end(void)
508{
509 suspend_state = PM_SUSPEND_ON;
510 enable_hlt();
511 return;
512}
513
514static void omap3_pm_finish(void)
515{
516 omap_prcm_irq_complete();
517}
518
519static const struct platform_suspend_ops omap_pm_ops = {
520 .begin = omap3_pm_begin,
521 .end = omap3_pm_end,
522 .enter = omap3_pm_enter,
523 .finish = omap3_pm_finish,
524 .valid = suspend_valid_only_mem,
525};
526#endif /* CONFIG_SUSPEND */ 457#endif /* CONFIG_SUSPEND */
527 458
528 459
@@ -743,21 +674,6 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
743} 674}
744 675
745/* 676/*
746 * Enable hw supervised mode for all clockdomains if it's
747 * supported. Initiate sleep transition for other clockdomains, if
748 * they are not used
749 */
750static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
751{
752 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
753 clkdm_allow_idle(clkdm);
754 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
755 atomic_read(&clkdm->usecount) == 0)
756 clkdm_sleep(clkdm);
757 return 0;
758}
759
760/*
761 * Push functions to SRAM 677 * Push functions to SRAM
762 * 678 *
763 * The minimum set of functions is pushed to SRAM for execution: 679 * The minimum set of functions is pushed to SRAM for execution:
@@ -826,7 +742,7 @@ static int __init omap3_pm_init(void)
826 goto err2; 742 goto err2;
827 } 743 }
828 744
829 (void) clkdm_for_each(clkdms_setup, NULL); 745 (void) clkdm_for_each(omap_pm_clkdms_setup, NULL);
830 746
831 mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); 747 mpu_pwrdm = pwrdm_lookup("mpu_pwrdm");
832 if (mpu_pwrdm == NULL) { 748 if (mpu_pwrdm == NULL) {
@@ -845,10 +761,10 @@ static int __init omap3_pm_init(void)
845 core_clkdm = clkdm_lookup("core_clkdm"); 761 core_clkdm = clkdm_lookup("core_clkdm");
846 762
847#ifdef CONFIG_SUSPEND 763#ifdef CONFIG_SUSPEND
848 suspend_set_ops(&omap_pm_ops); 764 omap_pm_suspend = omap3_pm_suspend;
849#endif /* CONFIG_SUSPEND */ 765#endif
850 766
851 pm_idle = omap3_pm_idle; 767 arm_pm_idle = omap3_pm_idle;
852 omap3_idle_init(); 768 omap3_idle_init();
853 769
854 /* 770 /*
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index c264ef7219c..91e0b1c9b76 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -83,59 +83,8 @@ static int omap4_pm_suspend(void)
83 83
84 return 0; 84 return 0;
85} 85}
86
87static int omap4_pm_enter(suspend_state_t suspend_state)
88{
89 int ret = 0;
90
91 switch (suspend_state) {
92 case PM_SUSPEND_STANDBY:
93 case PM_SUSPEND_MEM:
94 ret = omap4_pm_suspend();
95 break;
96 default:
97 ret = -EINVAL;
98 }
99
100 return ret;
101}
102
103static int omap4_pm_begin(suspend_state_t state)
104{
105 disable_hlt();
106 return 0;
107}
108
109static void omap4_pm_end(void)
110{
111 enable_hlt();
112 return;
113}
114
115static const struct platform_suspend_ops omap_pm_ops = {
116 .begin = omap4_pm_begin,
117 .end = omap4_pm_end,
118 .enter = omap4_pm_enter,
119 .valid = suspend_valid_only_mem,
120};
121#endif /* CONFIG_SUSPEND */ 86#endif /* CONFIG_SUSPEND */
122 87
123/*
124 * Enable hardware supervised mode for all clockdomains if it's
125 * supported. Initiate sleep transition for other clockdomains, if
126 * they are not used
127 */
128static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
129{
130 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
131 clkdm_allow_idle(clkdm);
132 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
133 atomic_read(&clkdm->usecount) == 0)
134 clkdm_sleep(clkdm);
135 return 0;
136}
137
138
139static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) 88static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
140{ 89{
141 struct power_state *pwrst; 90 struct power_state *pwrst;
@@ -173,18 +122,16 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
173 * omap_default_idle - OMAP4 default ilde routine.' 122 * omap_default_idle - OMAP4 default ilde routine.'
174 * 123 *
175 * Implements OMAP4 memory, IO ordering requirements which can't be addressed 124 * Implements OMAP4 memory, IO ordering requirements which can't be addressed
176 * with default arch_idle() hook. Used by all CPUs with !CONFIG_CPUIDLE and 125 * with default cpu_do_idle() hook. Used by all CPUs with !CONFIG_CPUIDLE and
177 * by secondary CPU with CONFIG_CPUIDLE. 126 * by secondary CPU with CONFIG_CPUIDLE.
178 */ 127 */
179static void omap_default_idle(void) 128static void omap_default_idle(void)
180{ 129{
181 local_irq_disable();
182 local_fiq_disable(); 130 local_fiq_disable();
183 131
184 omap_do_wfi(); 132 omap_do_wfi();
185 133
186 local_fiq_enable(); 134 local_fiq_enable();
187 local_irq_enable();
188} 135}
189 136
190/** 137/**
@@ -249,14 +196,14 @@ static int __init omap4_pm_init(void)
249 goto err2; 196 goto err2;
250 } 197 }
251 198
252 (void) clkdm_for_each(clkdms_setup, NULL); 199 (void) clkdm_for_each(omap_pm_clkdms_setup, NULL);
253 200
254#ifdef CONFIG_SUSPEND 201#ifdef CONFIG_SUSPEND
255 suspend_set_ops(&omap_pm_ops); 202 omap_pm_suspend = omap4_pm_suspend;
256#endif /* CONFIG_SUSPEND */ 203#endif
257 204
258 /* Overwrite the default arch_idle() */ 205 /* Overwrite the default cpu_do_idle() */
259 pm_idle = omap_default_idle; 206 arm_pm_idle = omap_default_idle;
260 207
261 omap4_idle_init(); 208 omap4_idle_init();
262 209
diff --git a/arch/arm/mach-omap2/powerdomain-common.c b/arch/arm/mach-omap2/powerdomain-common.c
index f97afff68d6..c0aeabfcf00 100644
--- a/arch/arm/mach-omap2/powerdomain-common.c
+++ b/arch/arm/mach-omap2/powerdomain-common.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/bug.h>
16#include "pm.h" 17#include "pm.h"
17#include "cm.h" 18#include "cm.h"
18#include "cm-regbits-34xx.h" 19#include "cm-regbits-34xx.h"
diff --git a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
index 6a17e4ca1d7..0f0a9f1592f 100644
--- a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
@@ -15,6 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/bug.h>
18 19
19#include <plat/prcm.h> 20#include <plat/prcm.h>
20 21
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c
index a7880af4b3d..601325b852a 100644
--- a/arch/arm/mach-omap2/powerdomain44xx.c
+++ b/arch/arm/mach-omap2/powerdomain44xx.c
@@ -15,6 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/bug.h>
18 19
19#include "powerdomain.h" 20#include "powerdomain.h"
20#include <plat/prcm.h> 21#include <plat/prcm.h>
diff --git a/arch/arm/mach-omap2/powerdomains3xxx_data.c b/arch/arm/mach-omap2/powerdomains3xxx_data.c
index 8ef26daeed6..b7ea468eea3 100644
--- a/arch/arm/mach-omap2/powerdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains3xxx_data.c
@@ -13,6 +13,7 @@
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/bug.h>
16 17
17#include <plat/cpu.h> 18#include <plat/cpu.h>
18 19
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.c b/arch/arm/mach-omap2/prcm_mpu44xx.c
index ca669b50f39..928dbd4f20e 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.c
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.c
@@ -15,8 +15,8 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include "iomap.h"
18#include "common.h" 19#include "common.h"
19
20#include "prcm_mpu44xx.h" 20#include "prcm_mpu44xx.h"
21#include "cm-regbits-44xx.h" 21#include "cm-regbits-44xx.h"
22 22
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index a1d6154dc12..eac623c7c3d 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -17,11 +17,12 @@
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#include "common.h"
21#include <plat/cpu.h> 20#include <plat/cpu.h>
22#include <plat/irqs.h> 21#include <plat/irqs.h>
23#include <plat/prcm.h> 22#include <plat/prcm.h>
24 23
24#include "iomap.h"
25#include "common.h"
25#include "vp.h" 26#include "vp.h"
26#include "prm44xx.h" 27#include "prm44xx.h"
27#include "prm-regbits-44xx.h" 28#include "prm-regbits-44xx.h"
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 860118ab43e..873b51d494e 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -24,7 +24,6 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include <mach/system.h>
28#include <plat/common.h> 27#include <plat/common.h>
29#include <plat/prcm.h> 28#include <plat/prcm.h>
30#include <plat/irqs.h> 29#include <plat/irqs.h>
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index f6de5bc6b12..9b3898a3ac9 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -16,8 +16,8 @@
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/io.h> 17#include <linux/io.h>
18 18
19#include "iomap.h"
19#include "common.h" 20#include "common.h"
20
21#include "prm44xx.h" 21#include "prm44xx.h"
22#include "prminst44xx.h" 22#include "prminst44xx.h"
23#include "prm-regbits-44xx.h" 23#include "prm-regbits-44xx.h"
diff --git a/arch/arm/mach-omap2/sdram-nokia.c b/arch/arm/mach-omap2/sdram-nokia.c
index 7479d7ea137..845c4fd2b12 100644
--- a/arch/arm/mach-omap2/sdram-nokia.c
+++ b/arch/arm/mach-omap2/sdram-nokia.c
@@ -17,7 +17,6 @@
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#include <plat/io.h>
21#include "common.h" 20#include "common.h"
22#include <plat/clock.h> 21#include <plat/clock.h>
23#include <plat/sdrc.h> 22#include <plat/sdrc.h>
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c
index 791a63cdceb..1133bb2f632 100644
--- a/arch/arm/mach-omap2/sdrc2xxx.c
+++ b/arch/arm/mach-omap2/sdrc2xxx.c
@@ -24,13 +24,15 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include "common.h" 27#include <plat/hardware.h>
28#include <plat/clock.h> 28#include <plat/clock.h>
29#include <plat/sram.h> 29#include <plat/sram.h>
30#include <plat/sdrc.h>
30 31
32#include "iomap.h"
33#include "common.h"
31#include "prm2xxx_3xxx.h" 34#include "prm2xxx_3xxx.h"
32#include "clock.h" 35#include "clock.h"
33#include <plat/sdrc.h>
34#include "sdrc.h" 36#include "sdrc.h"
35 37
36/* Memory timing, DLL mode flags */ 38/* Memory timing, DLL mode flags */
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index f590afc1f67..0cdd359a128 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -54,11 +54,9 @@
54 54
55struct omap_uart_state { 55struct omap_uart_state {
56 int num; 56 int num;
57 int can_sleep;
58 57
59 struct list_head node; 58 struct list_head node;
60 struct omap_hwmod *oh; 59 struct omap_hwmod *oh;
61 struct platform_device *pdev;
62}; 60};
63 61
64static LIST_HEAD(uart_list); 62static LIST_HEAD(uart_list);
@@ -381,8 +379,6 @@ void __init omap_serial_init_port(struct omap_board_data *bdata,
381 379
382 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); 380 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
383 381
384 uart->pdev = pdev;
385
386 oh->dev_attr = uart; 382 oh->dev_attr = uart;
387 383
388 if (((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads) 384 if (((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads)
diff --git a/arch/arm/mach-omap2/sleep24xx.S b/arch/arm/mach-omap2/sleep24xx.S
index b5071a47ec3..d4bf904d84a 100644
--- a/arch/arm/mach-omap2/sleep24xx.S
+++ b/arch/arm/mach-omap2/sleep24xx.S
@@ -27,7 +27,6 @@
27 27
28#include <linux/linkage.h> 28#include <linux/linkage.h>
29#include <asm/assembler.h> 29#include <asm/assembler.h>
30#include <mach/io.h>
31 30
32#include <plat/omap24xx.h> 31#include <plat/omap24xx.h>
33 32
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index f2ea1bd1c69..1f62f23673f 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -23,10 +23,13 @@
23 * MA 02111-1307 USA 23 * MA 02111-1307 USA
24 */ 24 */
25#include <linux/linkage.h> 25#include <linux/linkage.h>
26
26#include <asm/assembler.h> 27#include <asm/assembler.h>
28
29#include <plat/hardware.h>
27#include <plat/sram.h> 30#include <plat/sram.h>
28#include <mach/io.h>
29 31
32#include "iomap.h"
30#include "cm2xxx_3xxx.h" 33#include "cm2xxx_3xxx.h"
31#include "prm2xxx_3xxx.h" 34#include "prm2xxx_3xxx.h"
32#include "sdrc.h" 35#include "sdrc.h"
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index 53d9d0a5b39..955566eefac 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -29,6 +29,7 @@ static int sr_class3_enable(struct voltagedomain *voltdm)
29 29
30static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset) 30static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
31{ 31{
32 sr_disable_errgen(voltdm);
32 omap_vp_disable(voltdm); 33 omap_vp_disable(voltdm);
33 sr_disable(voltdm); 34 sr_disable(voltdm);
34 if (is_volt_reset) 35 if (is_volt_reset)
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 7e755bb0ffc..008fbd7b935 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -36,6 +36,12 @@
36#define SR_DISABLE_TIMEOUT 200 36#define SR_DISABLE_TIMEOUT 200
37 37
38struct omap_sr { 38struct omap_sr {
39 struct list_head node;
40 struct platform_device *pdev;
41 struct omap_sr_nvalue_table *nvalue_table;
42 struct voltagedomain *voltdm;
43 struct dentry *dbg_dir;
44 unsigned int irq;
39 int srid; 45 int srid;
40 int ip_type; 46 int ip_type;
41 int nvalue_count; 47 int nvalue_count;
@@ -49,13 +55,7 @@ struct omap_sr {
49 u32 senp_avgweight; 55 u32 senp_avgweight;
50 u32 senp_mod; 56 u32 senp_mod;
51 u32 senn_mod; 57 u32 senn_mod;
52 unsigned int irq;
53 void __iomem *base; 58 void __iomem *base;
54 struct platform_device *pdev;
55 struct list_head node;
56 struct omap_sr_nvalue_table *nvalue_table;
57 struct voltagedomain *voltdm;
58 struct dentry *dbg_dir;
59}; 59};
60 60
61/* sr_list contains all the instances of smartreflex module */ 61/* sr_list contains all the instances of smartreflex module */
@@ -74,10 +74,6 @@ static inline void sr_modify_reg(struct omap_sr *sr, unsigned offset, u32 mask,
74 u32 value) 74 u32 value)
75{ 75{
76 u32 reg_val; 76 u32 reg_val;
77 u32 errconfig_offs = 0, errconfig_mask = 0;
78
79 reg_val = __raw_readl(sr->base + offset);
80 reg_val &= ~mask;
81 77
82 /* 78 /*
83 * Smartreflex error config register is special as it contains 79 * Smartreflex error config register is special as it contains
@@ -88,16 +84,15 @@ static inline void sr_modify_reg(struct omap_sr *sr, unsigned offset, u32 mask,
88 * if they are currently set, but does allow the caller to write 84 * if they are currently set, but does allow the caller to write
89 * those bits. 85 * those bits.
90 */ 86 */
91 if (sr->ip_type == SR_TYPE_V1) { 87 if (sr->ip_type == SR_TYPE_V1 && offset == ERRCONFIG_V1)
92 errconfig_offs = ERRCONFIG_V1; 88 mask |= ERRCONFIG_STATUS_V1_MASK;
93 errconfig_mask = ERRCONFIG_STATUS_V1_MASK; 89 else if (sr->ip_type == SR_TYPE_V2 && offset == ERRCONFIG_V2)
94 } else if (sr->ip_type == SR_TYPE_V2) { 90 mask |= ERRCONFIG_VPBOUNDINTST_V2;
95 errconfig_offs = ERRCONFIG_V2; 91
96 errconfig_mask = ERRCONFIG_VPBOUNDINTST_V2; 92 reg_val = __raw_readl(sr->base + offset);
97 } 93 reg_val &= ~mask;
98 94
99 if (offset == errconfig_offs) 95 value &= mask;
100 reg_val &= ~errconfig_mask;
101 96
102 reg_val |= value; 97 reg_val |= value;
103 98
@@ -128,21 +123,28 @@ static struct omap_sr *_sr_lookup(struct voltagedomain *voltdm)
128 123
129static irqreturn_t sr_interrupt(int irq, void *data) 124static irqreturn_t sr_interrupt(int irq, void *data)
130{ 125{
131 struct omap_sr *sr_info = (struct omap_sr *)data; 126 struct omap_sr *sr_info = data;
132 u32 status = 0; 127 u32 status = 0;
133 128
134 if (sr_info->ip_type == SR_TYPE_V1) { 129 switch (sr_info->ip_type) {
130 case SR_TYPE_V1:
135 /* Read the status bits */ 131 /* Read the status bits */
136 status = sr_read_reg(sr_info, ERRCONFIG_V1); 132 status = sr_read_reg(sr_info, ERRCONFIG_V1);
137 133
138 /* Clear them by writing back */ 134 /* Clear them by writing back */
139 sr_write_reg(sr_info, ERRCONFIG_V1, status); 135 sr_write_reg(sr_info, ERRCONFIG_V1, status);
140 } else if (sr_info->ip_type == SR_TYPE_V2) { 136 break;
137 case SR_TYPE_V2:
141 /* Read the status bits */ 138 /* Read the status bits */
142 status = sr_read_reg(sr_info, IRQSTATUS); 139 status = sr_read_reg(sr_info, IRQSTATUS);
143 140
144 /* Clear them by writing back */ 141 /* Clear them by writing back */
145 sr_write_reg(sr_info, IRQSTATUS, status); 142 sr_write_reg(sr_info, IRQSTATUS, status);
143 break;
144 default:
145 dev_err(&sr_info->pdev->dev, "UNKNOWN IP type %d\n",
146 sr_info->ip_type);
147 return IRQ_NONE;
146 } 148 }
147 149
148 if (sr_class->notify) 150 if (sr_class->notify)
@@ -166,6 +168,7 @@ static void sr_set_clk_length(struct omap_sr *sr)
166 __func__); 168 __func__);
167 return; 169 return;
168 } 170 }
171
169 sys_clk_speed = clk_get_rate(sys_ck); 172 sys_clk_speed = clk_get_rate(sys_ck);
170 clk_put(sys_ck); 173 clk_put(sys_ck);
171 174
@@ -267,7 +270,7 @@ static int sr_late_init(struct omap_sr *sr_info)
267 goto error; 270 goto error;
268 } 271 }
269 ret = request_irq(sr_info->irq, sr_interrupt, 272 ret = request_irq(sr_info->irq, sr_interrupt,
270 0, name, (void *)sr_info); 273 0, name, sr_info);
271 if (ret) 274 if (ret)
272 goto error; 275 goto error;
273 disable_irq(sr_info->irq); 276 disable_irq(sr_info->irq);
@@ -288,12 +291,15 @@ error:
288 "not function as desired\n", __func__); 291 "not function as desired\n", __func__);
289 kfree(name); 292 kfree(name);
290 kfree(sr_info); 293 kfree(sr_info);
294
291 return ret; 295 return ret;
292} 296}
293 297
294static void sr_v1_disable(struct omap_sr *sr) 298static void sr_v1_disable(struct omap_sr *sr)
295{ 299{
296 int timeout = 0; 300 int timeout = 0;
301 int errconf_val = ERRCONFIG_MCUACCUMINTST | ERRCONFIG_MCUVALIDINTST |
302 ERRCONFIG_MCUBOUNDINTST;
297 303
298 /* Enable MCUDisableAcknowledge interrupt */ 304 /* Enable MCUDisableAcknowledge interrupt */
299 sr_modify_reg(sr, ERRCONFIG_V1, 305 sr_modify_reg(sr, ERRCONFIG_V1,
@@ -302,13 +308,13 @@ static void sr_v1_disable(struct omap_sr *sr)
302 /* SRCONFIG - disable SR */ 308 /* SRCONFIG - disable SR */
303 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); 309 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0);
304 310
305 /* Disable all other SR interrupts and clear the status */ 311 /* Disable all other SR interrupts and clear the status as needed */
312 if (sr_read_reg(sr, ERRCONFIG_V1) & ERRCONFIG_VPBOUNDINTST_V1)
313 errconf_val |= ERRCONFIG_VPBOUNDINTST_V1;
306 sr_modify_reg(sr, ERRCONFIG_V1, 314 sr_modify_reg(sr, ERRCONFIG_V1,
307 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | 315 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN |
308 ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_VPBOUNDINTEN_V1), 316 ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_VPBOUNDINTEN_V1),
309 (ERRCONFIG_MCUACCUMINTST | ERRCONFIG_MCUVALIDINTST | 317 errconf_val);
310 ERRCONFIG_MCUBOUNDINTST |
311 ERRCONFIG_VPBOUNDINTST_V1));
312 318
313 /* 319 /*
314 * Wait for SR to be disabled. 320 * Wait for SR to be disabled.
@@ -337,9 +343,17 @@ static void sr_v2_disable(struct omap_sr *sr)
337 /* SRCONFIG - disable SR */ 343 /* SRCONFIG - disable SR */
338 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); 344 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0);
339 345
340 /* Disable all other SR interrupts and clear the status */ 346 /*
341 sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2, 347 * Disable all other SR interrupts and clear the status
348 * write to status register ONLY on need basis - only if status
349 * is set.
350 */
351 if (sr_read_reg(sr, ERRCONFIG_V2) & ERRCONFIG_VPBOUNDINTST_V2)
352 sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2,
342 ERRCONFIG_VPBOUNDINTST_V2); 353 ERRCONFIG_VPBOUNDINTST_V2);
354 else
355 sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2,
356 0x0);
343 sr_write_reg(sr, IRQENABLE_CLR, (IRQENABLE_MCUACCUMINT | 357 sr_write_reg(sr, IRQENABLE_CLR, (IRQENABLE_MCUACCUMINT |
344 IRQENABLE_MCUVALIDINT | 358 IRQENABLE_MCUVALIDINT |
345 IRQENABLE_MCUBOUNDSINT)); 359 IRQENABLE_MCUBOUNDSINT));
@@ -398,15 +412,16 @@ static u32 sr_retrieve_nvalue(struct omap_sr *sr, u32 efuse_offs)
398 */ 412 */
399int sr_configure_errgen(struct voltagedomain *voltdm) 413int sr_configure_errgen(struct voltagedomain *voltdm)
400{ 414{
401 u32 sr_config, sr_errconfig, errconfig_offs, vpboundint_en; 415 u32 sr_config, sr_errconfig, errconfig_offs;
402 u32 vpboundint_st, senp_en = 0, senn_en = 0; 416 u32 vpboundint_en, vpboundint_st;
417 u32 senp_en = 0, senn_en = 0;
403 u8 senp_shift, senn_shift; 418 u8 senp_shift, senn_shift;
404 struct omap_sr *sr = _sr_lookup(voltdm); 419 struct omap_sr *sr = _sr_lookup(voltdm);
405 420
406 if (IS_ERR(sr)) { 421 if (IS_ERR(sr)) {
407 pr_warning("%s: omap_sr struct for sr_%s not found\n", 422 pr_warning("%s: omap_sr struct for sr_%s not found\n",
408 __func__, voltdm->name); 423 __func__, voltdm->name);
409 return -EINVAL; 424 return PTR_ERR(sr);
410 } 425 }
411 426
412 if (!sr->clk_length) 427 if (!sr->clk_length)
@@ -418,20 +433,23 @@ int sr_configure_errgen(struct voltagedomain *voltdm)
418 sr_config = (sr->clk_length << SRCONFIG_SRCLKLENGTH_SHIFT) | 433 sr_config = (sr->clk_length << SRCONFIG_SRCLKLENGTH_SHIFT) |
419 SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN; 434 SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN;
420 435
421 if (sr->ip_type == SR_TYPE_V1) { 436 switch (sr->ip_type) {
437 case SR_TYPE_V1:
422 sr_config |= SRCONFIG_DELAYCTRL; 438 sr_config |= SRCONFIG_DELAYCTRL;
423 senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; 439 senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT;
424 senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; 440 senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT;
425 errconfig_offs = ERRCONFIG_V1; 441 errconfig_offs = ERRCONFIG_V1;
426 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1; 442 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1;
427 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1; 443 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1;
428 } else if (sr->ip_type == SR_TYPE_V2) { 444 break;
445 case SR_TYPE_V2:
429 senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; 446 senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT;
430 senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; 447 senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT;
431 errconfig_offs = ERRCONFIG_V2; 448 errconfig_offs = ERRCONFIG_V2;
432 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2; 449 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2;
433 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2; 450 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2;
434 } else { 451 break;
452 default:
435 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" 453 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex"
436 "module without specifying the ip\n", __func__); 454 "module without specifying the ip\n", __func__);
437 return -EINVAL; 455 return -EINVAL;
@@ -447,8 +465,55 @@ int sr_configure_errgen(struct voltagedomain *voltdm)
447 sr_errconfig); 465 sr_errconfig);
448 466
449 /* Enabling the interrupts if the ERROR module is used */ 467 /* Enabling the interrupts if the ERROR module is used */
450 sr_modify_reg(sr, errconfig_offs, 468 sr_modify_reg(sr, errconfig_offs, (vpboundint_en | vpboundint_st),
451 vpboundint_en, (vpboundint_en | vpboundint_st)); 469 vpboundint_en);
470
471 return 0;
472}
473
474/**
475 * sr_disable_errgen() - Disables SmartReflex AVS module's errgen component
476 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
477 *
478 * This API is to be called from the smartreflex class driver to
479 * disable the error generator module inside the smartreflex module.
480 *
481 * Returns 0 on success and error value in case of failure.
482 */
483int sr_disable_errgen(struct voltagedomain *voltdm)
484{
485 u32 errconfig_offs;
486 u32 vpboundint_en, vpboundint_st;
487 struct omap_sr *sr = _sr_lookup(voltdm);
488
489 if (IS_ERR(sr)) {
490 pr_warning("%s: omap_sr struct for sr_%s not found\n",
491 __func__, voltdm->name);
492 return PTR_ERR(sr);
493 }
494
495 switch (sr->ip_type) {
496 case SR_TYPE_V1:
497 errconfig_offs = ERRCONFIG_V1;
498 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1;
499 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1;
500 break;
501 case SR_TYPE_V2:
502 errconfig_offs = ERRCONFIG_V2;
503 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2;
504 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2;
505 break;
506 default:
507 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex"
508 "module without specifying the ip\n", __func__);
509 return -EINVAL;
510 }
511
512 /* Disable the interrupts of ERROR module */
513 sr_modify_reg(sr, errconfig_offs, vpboundint_en | vpboundint_st, 0);
514
515 /* Disable the Sensor and errorgen */
516 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN, 0);
452 517
453 return 0; 518 return 0;
454} 519}
@@ -475,7 +540,7 @@ int sr_configure_minmax(struct voltagedomain *voltdm)
475 if (IS_ERR(sr)) { 540 if (IS_ERR(sr)) {
476 pr_warning("%s: omap_sr struct for sr_%s not found\n", 541 pr_warning("%s: omap_sr struct for sr_%s not found\n",
477 __func__, voltdm->name); 542 __func__, voltdm->name);
478 return -EINVAL; 543 return PTR_ERR(sr);
479 } 544 }
480 545
481 if (!sr->clk_length) 546 if (!sr->clk_length)
@@ -488,14 +553,17 @@ int sr_configure_minmax(struct voltagedomain *voltdm)
488 SRCONFIG_SENENABLE | 553 SRCONFIG_SENENABLE |
489 (sr->accum_data << SRCONFIG_ACCUMDATA_SHIFT); 554 (sr->accum_data << SRCONFIG_ACCUMDATA_SHIFT);
490 555
491 if (sr->ip_type == SR_TYPE_V1) { 556 switch (sr->ip_type) {
557 case SR_TYPE_V1:
492 sr_config |= SRCONFIG_DELAYCTRL; 558 sr_config |= SRCONFIG_DELAYCTRL;
493 senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; 559 senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT;
494 senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; 560 senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT;
495 } else if (sr->ip_type == SR_TYPE_V2) { 561 break;
562 case SR_TYPE_V2:
496 senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; 563 senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT;
497 senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; 564 senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT;
498 } else { 565 break;
566 default:
499 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" 567 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex"
500 "module without specifying the ip\n", __func__); 568 "module without specifying the ip\n", __func__);
501 return -EINVAL; 569 return -EINVAL;
@@ -511,20 +579,27 @@ int sr_configure_minmax(struct voltagedomain *voltdm)
511 * Enabling the interrupts if MINMAXAVG module is used. 579 * Enabling the interrupts if MINMAXAVG module is used.
512 * TODO: check if all the interrupts are mandatory 580 * TODO: check if all the interrupts are mandatory
513 */ 581 */
514 if (sr->ip_type == SR_TYPE_V1) { 582 switch (sr->ip_type) {
583 case SR_TYPE_V1:
515 sr_modify_reg(sr, ERRCONFIG_V1, 584 sr_modify_reg(sr, ERRCONFIG_V1,
516 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | 585 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN |
517 ERRCONFIG_MCUBOUNDINTEN), 586 ERRCONFIG_MCUBOUNDINTEN),
518 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUACCUMINTST | 587 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUACCUMINTST |
519 ERRCONFIG_MCUVALIDINTEN | ERRCONFIG_MCUVALIDINTST | 588 ERRCONFIG_MCUVALIDINTEN | ERRCONFIG_MCUVALIDINTST |
520 ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_MCUBOUNDINTST)); 589 ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_MCUBOUNDINTST));
521 } else if (sr->ip_type == SR_TYPE_V2) { 590 break;
591 case SR_TYPE_V2:
522 sr_write_reg(sr, IRQSTATUS, 592 sr_write_reg(sr, IRQSTATUS,
523 IRQSTATUS_MCUACCUMINT | IRQSTATUS_MCVALIDINT | 593 IRQSTATUS_MCUACCUMINT | IRQSTATUS_MCVALIDINT |
524 IRQSTATUS_MCBOUNDSINT | IRQSTATUS_MCUDISABLEACKINT); 594 IRQSTATUS_MCBOUNDSINT | IRQSTATUS_MCUDISABLEACKINT);
525 sr_write_reg(sr, IRQENABLE_SET, 595 sr_write_reg(sr, IRQENABLE_SET,
526 IRQENABLE_MCUACCUMINT | IRQENABLE_MCUVALIDINT | 596 IRQENABLE_MCUACCUMINT | IRQENABLE_MCUVALIDINT |
527 IRQENABLE_MCUBOUNDSINT | IRQENABLE_MCUDISABLEACKINT); 597 IRQENABLE_MCUBOUNDSINT | IRQENABLE_MCUDISABLEACKINT);
598 break;
599 default:
600 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex"
601 "module without specifying the ip\n", __func__);
602 return -EINVAL;
528 } 603 }
529 604
530 return 0; 605 return 0;
@@ -543,15 +618,15 @@ int sr_configure_minmax(struct voltagedomain *voltdm)
543 */ 618 */
544int sr_enable(struct voltagedomain *voltdm, unsigned long volt) 619int sr_enable(struct voltagedomain *voltdm, unsigned long volt)
545{ 620{
546 u32 nvalue_reciprocal;
547 struct omap_volt_data *volt_data; 621 struct omap_volt_data *volt_data;
548 struct omap_sr *sr = _sr_lookup(voltdm); 622 struct omap_sr *sr = _sr_lookup(voltdm);
623 u32 nvalue_reciprocal;
549 int ret; 624 int ret;
550 625
551 if (IS_ERR(sr)) { 626 if (IS_ERR(sr)) {
552 pr_warning("%s: omap_sr struct for sr_%s not found\n", 627 pr_warning("%s: omap_sr struct for sr_%s not found\n",
553 __func__, voltdm->name); 628 __func__, voltdm->name);
554 return -EINVAL; 629 return PTR_ERR(sr);
555 } 630 }
556 631
557 volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); 632 volt_data = omap_voltage_get_voltdata(sr->voltdm, volt);
@@ -559,7 +634,7 @@ int sr_enable(struct voltagedomain *voltdm, unsigned long volt)
559 if (IS_ERR(volt_data)) { 634 if (IS_ERR(volt_data)) {
560 dev_warn(&sr->pdev->dev, "%s: Unable to get voltage table" 635 dev_warn(&sr->pdev->dev, "%s: Unable to get voltage table"
561 "for nominal voltage %ld\n", __func__, volt); 636 "for nominal voltage %ld\n", __func__, volt);
562 return -ENODATA; 637 return PTR_ERR(volt_data);
563 } 638 }
564 639
565 nvalue_reciprocal = sr_retrieve_nvalue(sr, volt_data->sr_efuse_offs); 640 nvalue_reciprocal = sr_retrieve_nvalue(sr, volt_data->sr_efuse_offs);
@@ -617,10 +692,17 @@ void sr_disable(struct voltagedomain *voltdm)
617 * disable the clocks. 692 * disable the clocks.
618 */ 693 */
619 if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE) { 694 if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE) {
620 if (sr->ip_type == SR_TYPE_V1) 695 switch (sr->ip_type) {
696 case SR_TYPE_V1:
621 sr_v1_disable(sr); 697 sr_v1_disable(sr);
622 else if (sr->ip_type == SR_TYPE_V2) 698 break;
699 case SR_TYPE_V2:
623 sr_v2_disable(sr); 700 sr_v2_disable(sr);
701 break;
702 default:
703 dev_err(&sr->pdev->dev, "UNKNOWN IP type %d\n",
704 sr->ip_type);
705 }
624 } 706 }
625 707
626 pm_runtime_put_sync_suspend(&sr->pdev->dev); 708 pm_runtime_put_sync_suspend(&sr->pdev->dev);
@@ -779,10 +861,10 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data)
779 sr_pmic_data = pmic_data; 861 sr_pmic_data = pmic_data;
780} 862}
781 863
782/* PM Debug Fs enteries to enable disable smartreflex. */ 864/* PM Debug FS entries to enable and disable smartreflex. */
783static int omap_sr_autocomp_show(void *data, u64 *val) 865static int omap_sr_autocomp_show(void *data, u64 *val)
784{ 866{
785 struct omap_sr *sr_info = (struct omap_sr *) data; 867 struct omap_sr *sr_info = data;
786 868
787 if (!sr_info) { 869 if (!sr_info) {
788 pr_warning("%s: omap_sr struct not found\n", __func__); 870 pr_warning("%s: omap_sr struct not found\n", __func__);
@@ -796,7 +878,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val)
796 878
797static int omap_sr_autocomp_store(void *data, u64 val) 879static int omap_sr_autocomp_store(void *data, u64 val)
798{ 880{
799 struct omap_sr *sr_info = (struct omap_sr *) data; 881 struct omap_sr *sr_info = data;
800 882
801 if (!sr_info) { 883 if (!sr_info) {
802 pr_warning("%s: omap_sr struct not found\n", __func__); 884 pr_warning("%s: omap_sr struct not found\n", __func__);
@@ -804,7 +886,7 @@ static int omap_sr_autocomp_store(void *data, u64 val)
804 } 886 }
805 887
806 /* Sanity check */ 888 /* Sanity check */
807 if (val && (val != 1)) { 889 if (val > 1) {
808 pr_warning("%s: Invalid argument %lld\n", __func__, val); 890 pr_warning("%s: Invalid argument %lld\n", __func__, val);
809 return -EINVAL; 891 return -EINVAL;
810 } 892 }
@@ -821,11 +903,11 @@ static int omap_sr_autocomp_store(void *data, u64 val)
821} 903}
822 904
823DEFINE_SIMPLE_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show, 905DEFINE_SIMPLE_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show,
824 omap_sr_autocomp_store, "%llu\n"); 906 omap_sr_autocomp_store, "%llu\n");
825 907
826static int __init omap_sr_probe(struct platform_device *pdev) 908static int __init omap_sr_probe(struct platform_device *pdev)
827{ 909{
828 struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); 910 struct omap_sr *sr_info;
829 struct omap_sr_data *pdata = pdev->dev.platform_data; 911 struct omap_sr_data *pdata = pdev->dev.platform_data;
830 struct resource *mem, *irq; 912 struct resource *mem, *irq;
831 struct dentry *nvalue_dir; 913 struct dentry *nvalue_dir;
@@ -833,12 +915,15 @@ static int __init omap_sr_probe(struct platform_device *pdev)
833 int i, ret = 0; 915 int i, ret = 0;
834 char *name; 916 char *name;
835 917
918 sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
836 if (!sr_info) { 919 if (!sr_info) {
837 dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", 920 dev_err(&pdev->dev, "%s: unable to allocate sr_info\n",
838 __func__); 921 __func__);
839 return -ENOMEM; 922 return -ENOMEM;
840 } 923 }
841 924
925 platform_set_drvdata(pdev, sr_info);
926
842 if (!pdata) { 927 if (!pdata) {
843 dev_err(&pdev->dev, "%s: platform data missing\n", __func__); 928 dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
844 ret = -EINVAL; 929 ret = -EINVAL;
@@ -904,7 +989,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
904 dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__); 989 dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__);
905 if (!sr_dbg_dir) { 990 if (!sr_dbg_dir) {
906 sr_dbg_dir = debugfs_create_dir("smartreflex", NULL); 991 sr_dbg_dir = debugfs_create_dir("smartreflex", NULL);
907 if (!sr_dbg_dir) { 992 if (IS_ERR_OR_NULL(sr_dbg_dir)) {
908 ret = PTR_ERR(sr_dbg_dir); 993 ret = PTR_ERR(sr_dbg_dir);
909 pr_err("%s:sr debugfs dir creation failed(%d)\n", 994 pr_err("%s:sr debugfs dir creation failed(%d)\n",
910 __func__, ret); 995 __func__, ret);
@@ -921,7 +1006,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
921 } 1006 }
922 sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir); 1007 sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir);
923 kfree(name); 1008 kfree(name);
924 if (IS_ERR(sr_info->dbg_dir)) { 1009 if (IS_ERR_OR_NULL(sr_info->dbg_dir)) {
925 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", 1010 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
926 __func__); 1011 __func__);
927 ret = PTR_ERR(sr_info->dbg_dir); 1012 ret = PTR_ERR(sr_info->dbg_dir);
@@ -938,7 +1023,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
938 &sr_info->err_minlimit); 1023 &sr_info->err_minlimit);
939 1024
940 nvalue_dir = debugfs_create_dir("nvalue", sr_info->dbg_dir); 1025 nvalue_dir = debugfs_create_dir("nvalue", sr_info->dbg_dir);
941 if (IS_ERR(nvalue_dir)) { 1026 if (IS_ERR_OR_NULL(nvalue_dir)) {
942 dev_err(&pdev->dev, "%s: Unable to create debugfs directory" 1027 dev_err(&pdev->dev, "%s: Unable to create debugfs directory"
943 "for n-values\n", __func__); 1028 "for n-values\n", __func__);
944 ret = PTR_ERR(nvalue_dir); 1029 ret = PTR_ERR(nvalue_dir);
@@ -994,7 +1079,7 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
994 if (IS_ERR(sr_info)) { 1079 if (IS_ERR(sr_info)) {
995 dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", 1080 dev_warn(&pdev->dev, "%s: omap_sr struct not found\n",
996 __func__); 1081 __func__);
997 return -EINVAL; 1082 return PTR_ERR(sr_info);
998 } 1083 }
999 1084
1000 if (sr_info->autocomp_active) 1085 if (sr_info->autocomp_active)
@@ -1011,8 +1096,32 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
1011 return 0; 1096 return 0;
1012} 1097}
1013 1098
1099static void __devexit omap_sr_shutdown(struct platform_device *pdev)
1100{
1101 struct omap_sr_data *pdata = pdev->dev.platform_data;
1102 struct omap_sr *sr_info;
1103
1104 if (!pdata) {
1105 dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
1106 return;
1107 }
1108
1109 sr_info = _sr_lookup(pdata->voltdm);
1110 if (IS_ERR(sr_info)) {
1111 dev_warn(&pdev->dev, "%s: omap_sr struct not found\n",
1112 __func__);
1113 return;
1114 }
1115
1116 if (sr_info->autocomp_active)
1117 sr_stop_vddautocomp(sr_info);
1118
1119 return;
1120}
1121
1014static struct platform_driver smartreflex_driver = { 1122static struct platform_driver smartreflex_driver = {
1015 .remove = omap_sr_remove, 1123 .remove = __devexit_p(omap_sr_remove),
1124 .shutdown = __devexit_p(omap_sr_shutdown),
1016 .driver = { 1125 .driver = {
1017 .name = "smartreflex", 1126 .name = "smartreflex",
1018 }, 1127 },
@@ -1042,12 +1151,12 @@ static int __init sr_init(void)
1042 1151
1043 return 0; 1152 return 0;
1044} 1153}
1154late_initcall(sr_init);
1045 1155
1046static void __exit sr_exit(void) 1156static void __exit sr_exit(void)
1047{ 1157{
1048 platform_driver_unregister(&smartreflex_driver); 1158 platform_driver_unregister(&smartreflex_driver);
1049} 1159}
1050late_initcall(sr_init);
1051module_exit(sr_exit); 1160module_exit(sr_exit);
1052 1161
1053MODULE_DESCRIPTION("OMAP Smartreflex Driver"); 1162MODULE_DESCRIPTION("OMAP Smartreflex Driver");
diff --git a/arch/arm/mach-omap2/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h
index 5f35b9e2555..5809141171f 100644
--- a/arch/arm/mach-omap2/smartreflex.h
+++ b/arch/arm/mach-omap2/smartreflex.h
@@ -152,6 +152,15 @@ struct omap_sr_pmic_data {
152 void (*sr_pmic_init) (void); 152 void (*sr_pmic_init) (void);
153}; 153};
154 154
155/**
156 * struct omap_smartreflex_dev_attr - Smartreflex Device attribute.
157 *
158 * @sensor_voltdm_name: Name of voltdomain of SR instance
159 */
160struct omap_smartreflex_dev_attr {
161 const char *sensor_voltdm_name;
162};
163
155#ifdef CONFIG_OMAP_SMARTREFLEX 164#ifdef CONFIG_OMAP_SMARTREFLEX
156/* 165/*
157 * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR. 166 * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR.
@@ -231,6 +240,7 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
231int sr_enable(struct voltagedomain *voltdm, unsigned long volt); 240int sr_enable(struct voltagedomain *voltdm, unsigned long volt);
232void sr_disable(struct voltagedomain *voltdm); 241void sr_disable(struct voltagedomain *voltdm);
233int sr_configure_errgen(struct voltagedomain *voltdm); 242int sr_configure_errgen(struct voltagedomain *voltdm);
243int sr_disable_errgen(struct voltagedomain *voltdm);
234int sr_configure_minmax(struct voltagedomain *voltdm); 244int sr_configure_minmax(struct voltagedomain *voltdm);
235 245
236/* API to register the smartreflex class driver with the smartreflex driver */ 246/* API to register the smartreflex class driver with the smartreflex driver */
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 9f43fcc05d3..a503e1e8358 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -69,11 +69,12 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
69 sr_data->nvalue_count = count; 69 sr_data->nvalue_count = count;
70} 70}
71 71
72static int sr_dev_init(struct omap_hwmod *oh, void *user) 72static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
73{ 73{
74 struct omap_sr_data *sr_data; 74 struct omap_sr_data *sr_data;
75 struct platform_device *pdev; 75 struct platform_device *pdev;
76 struct omap_volt_data *volt_data; 76 struct omap_volt_data *volt_data;
77 struct omap_smartreflex_dev_attr *sr_dev_attr;
77 char *name = "smartreflex"; 78 char *name = "smartreflex";
78 static int i; 79 static int i;
79 80
@@ -84,9 +85,11 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
84 return -ENOMEM; 85 return -ENOMEM;
85 } 86 }
86 87
87 if (!oh->vdd_name) { 88 sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr;
89 if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) {
88 pr_err("%s: No voltage domain specified for %s." 90 pr_err("%s: No voltage domain specified for %s."
89 "Cannot initialize\n", __func__, oh->name); 91 "Cannot initialize\n", __func__,
92 oh->name);
90 goto exit; 93 goto exit;
91 } 94 }
92 95
@@ -94,10 +97,10 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
94 sr_data->senn_mod = 0x1; 97 sr_data->senn_mod = 0x1;
95 sr_data->senp_mod = 0x1; 98 sr_data->senp_mod = 0x1;
96 99
97 sr_data->voltdm = voltdm_lookup(oh->vdd_name); 100 sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name);
98 if (IS_ERR(sr_data->voltdm)) { 101 if (IS_ERR(sr_data->voltdm)) {
99 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", 102 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
100 __func__, oh->vdd_name); 103 __func__, sr_dev_attr->sensor_voltdm_name);
101 goto exit; 104 goto exit;
102 } 105 }
103 106
diff --git a/arch/arm/mach-omap2/sram242x.S b/arch/arm/mach-omap2/sram242x.S
index ff9b9dbcb30..ee0bfcc1410 100644
--- a/arch/arm/mach-omap2/sram242x.S
+++ b/arch/arm/mach-omap2/sram242x.S
@@ -29,10 +29,12 @@
29 * These crashes may be intermittent. 29 * These crashes may be intermittent.
30 */ 30 */
31#include <linux/linkage.h> 31#include <linux/linkage.h>
32
32#include <asm/assembler.h> 33#include <asm/assembler.h>
33#include <mach/io.h> 34
34#include <mach/hardware.h> 35#include <mach/hardware.h>
35 36
37#include "iomap.h"
36#include "prm2xxx_3xxx.h" 38#include "prm2xxx_3xxx.h"
37#include "cm2xxx_3xxx.h" 39#include "cm2xxx_3xxx.h"
38#include "sdrc.h" 40#include "sdrc.h"
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S
index 76730209fa0..d4d39ef0476 100644
--- a/arch/arm/mach-omap2/sram243x.S
+++ b/arch/arm/mach-omap2/sram243x.S
@@ -29,10 +29,12 @@
29 * These crashes may be intermittent. 29 * These crashes may be intermittent.
30 */ 30 */
31#include <linux/linkage.h> 31#include <linux/linkage.h>
32
32#include <asm/assembler.h> 33#include <asm/assembler.h>
33#include <mach/io.h> 34
34#include <mach/hardware.h> 35#include <mach/hardware.h>
35 36
37#include "iomap.h"
36#include "prm2xxx_3xxx.h" 38#include "prm2xxx_3xxx.h"
37#include "cm2xxx_3xxx.h" 39#include "cm2xxx_3xxx.h"
38#include "sdrc.h" 40#include "sdrc.h"
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S
index 6f5849aaa7c..df5a21322b0 100644
--- a/arch/arm/mach-omap2/sram34xx.S
+++ b/arch/arm/mach-omap2/sram34xx.S
@@ -26,11 +26,12 @@
26 * MA 02111-1307 USA 26 * MA 02111-1307 USA
27 */ 27 */
28#include <linux/linkage.h> 28#include <linux/linkage.h>
29
29#include <asm/assembler.h> 30#include <asm/assembler.h>
30#include <mach/hardware.h>
31 31
32#include <mach/io.h> 32#include <mach/hardware.h>
33 33
34#include "iomap.h"
34#include "sdrc.h" 35#include "sdrc.h"
35#include "cm2xxx_3xxx.h" 36#include "cm2xxx_3xxx.h"
36 37
diff --git a/arch/arm/mach-omap2/timer-mpu.c b/arch/arm/mach-omap2/timer-mpu.c
deleted file mode 100644
index 31c0ac4cd66..00000000000
--- a/arch/arm/mach-omap2/timer-mpu.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * The MPU local timer source file. In OMAP4, both cortex-a9 cores have
3 * own timer in it's MPU domain. These timers will be driving the
4 * linux kernel SMP tick framework when active. These timers are not
5 * part of the wake up domain.
6 *
7 * Copyright (C) 2009 Texas Instruments, Inc.
8 *
9 * Author:
10 * Santosh Shilimkar <santosh.shilimkar@ti.com>
11 *
12 * This file is based on arm realview smp platform file.
13 * Copyright (C) 2002 ARM Ltd.
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#include <linux/init.h>
20#include <linux/smp.h>
21#include <linux/clockchips.h>
22#include <asm/irq.h>
23#include <asm/smp_twd.h>
24#include <asm/localtimer.h>
25
26/*
27 * Setup the local clock events for a CPU.
28 */
29int __cpuinit local_timer_setup(struct clock_event_device *evt)
30{
31 /* Local timers are not supprted on OMAP4430 ES1.0 */
32 if (omap_rev() == OMAP4430_REV_ES1_0)
33 return -ENXIO;
34
35 evt->irq = OMAP44XX_IRQ_LOCALTIMER;
36 twd_timer_setup(evt);
37 return 0;
38}
39
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 5c9acea9576..c512bac69ec 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -39,7 +39,7 @@
39 39
40#include <asm/mach/time.h> 40#include <asm/mach/time.h>
41#include <plat/dmtimer.h> 41#include <plat/dmtimer.h>
42#include <asm/localtimer.h> 42#include <asm/smp_twd.h>
43#include <asm/sched_clock.h> 43#include <asm/sched_clock.h>
44#include "common.h" 44#include "common.h"
45#include <plat/omap_hwmod.h> 45#include <plat/omap_hwmod.h>
@@ -324,14 +324,26 @@ OMAP_SYS_TIMER(3_secure)
324#endif 324#endif
325 325
326#ifdef CONFIG_ARCH_OMAP4 326#ifdef CONFIG_ARCH_OMAP4
327static void __init omap4_timer_init(void)
328{
329#ifdef CONFIG_LOCAL_TIMERS 327#ifdef CONFIG_LOCAL_TIMERS
330 twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256); 328static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
331 BUG_ON(!twd_base); 329 OMAP44XX_LOCAL_TWD_BASE,
330 OMAP44XX_IRQ_LOCALTIMER);
332#endif 331#endif
332
333static void __init omap4_timer_init(void)
334{
333 omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE); 335 omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
334 omap2_gp_clocksource_init(2, OMAP4_MPU_SOURCE); 336 omap2_gp_clocksource_init(2, OMAP4_MPU_SOURCE);
337#ifdef CONFIG_LOCAL_TIMERS
338 /* Local timers are not supprted on OMAP4430 ES1.0 */
339 if (omap_rev() != OMAP4430_REV_ES1_0) {
340 int err;
341
342 err = twd_local_timer_register(&twd_local_timer);
343 if (err)
344 pr_err("twd_local_timer_register failed %d\n", err);
345 }
346#endif
335} 347}
336OMAP_SYS_TIMER(4) 348OMAP_SYS_TIMER(4)
337#endif 349#endif
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 175b7d86d86..84da34f9a7c 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -10,6 +10,7 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
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 14
14#include <plat/cpu.h> 15#include <plat/cpu.h>
15 16
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
index 0df88820978..f95c1bad9dc 100644
--- a/arch/arm/mach-omap2/vp.c
+++ b/arch/arm/mach-omap2/vp.c
@@ -61,8 +61,8 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
61 vddmin = voltdm->pmic->vp_vddmin; 61 vddmin = voltdm->pmic->vp_vddmin;
62 vddmax = voltdm->pmic->vp_vddmax; 62 vddmax = voltdm->pmic->vp_vddmax;
63 63
64 waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) * 64 waittime = DIV_ROUND_UP(voltdm->pmic->step_size * sys_clk_rate,
65 sys_clk_rate) / 1000; 65 1000 * voltdm->pmic->slew_rate);
66 vstepmin = voltdm->pmic->vp_vstepmin; 66 vstepmin = voltdm->pmic->vp_vstepmin;
67 vstepmax = voltdm->pmic->vp_vstepmax; 67 vstepmax = voltdm->pmic->vp_vstepmax;
68 68
diff --git a/arch/arm/mach-orion5x/include/mach/entry-macro.S b/arch/arm/mach-orion5x/include/mach/entry-macro.S
index d658992e540..79eb502a1e6 100644
--- a/arch/arm/mach-orion5x/include/mach/entry-macro.S
+++ b/arch/arm/mach-orion5x/include/mach/entry-macro.S
@@ -10,12 +10,6 @@
10 10
11#include <mach/bridge-regs.h> 11#include <mach/bridge-regs.h>
12 12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp 13 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =MAIN_IRQ_CAUSE 14 ldr \base, =MAIN_IRQ_CAUSE
21 .endm 15 .endm
diff --git a/arch/arm/mach-orion5x/include/mach/system.h b/arch/arm/mach-orion5x/include/mach/system.h
deleted file mode 100644
index 825a2650cef..00000000000
--- a/arch/arm/mach-orion5x/include/mach/system.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/system.h
3 *
4 * Tzachi Perelstein <tzachi@marvell.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H
13
14static inline void arch_idle(void)
15{
16 cpu_do_idle();
17}
18
19#endif
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index 09a045f0c40..d6a91948e4d 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -171,13 +171,14 @@ static int __init pcie_setup(struct pci_sys_data *sys)
171 /* 171 /*
172 * IORESOURCE_IO 172 * IORESOURCE_IO
173 */ 173 */
174 sys->io_offset = 0;
174 res[0].name = "PCIe I/O Space"; 175 res[0].name = "PCIe I/O Space";
175 res[0].flags = IORESOURCE_IO; 176 res[0].flags = IORESOURCE_IO;
176 res[0].start = ORION5X_PCIE_IO_BUS_BASE; 177 res[0].start = ORION5X_PCIE_IO_BUS_BASE;
177 res[0].end = res[0].start + ORION5X_PCIE_IO_SIZE - 1; 178 res[0].end = res[0].start + ORION5X_PCIE_IO_SIZE - 1;
178 if (request_resource(&ioport_resource, &res[0])) 179 if (request_resource(&ioport_resource, &res[0]))
179 panic("Request PCIe IO resource failed\n"); 180 panic("Request PCIe IO resource failed\n");
180 pci_add_resource(&sys->resources, &res[0]); 181 pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset);
181 182
182 /* 183 /*
183 * IORESOURCE_MEM 184 * IORESOURCE_MEM
@@ -188,9 +189,7 @@ static int __init pcie_setup(struct pci_sys_data *sys)
188 res[1].end = res[1].start + ORION5X_PCIE_MEM_SIZE - 1; 189 res[1].end = res[1].start + ORION5X_PCIE_MEM_SIZE - 1;
189 if (request_resource(&iomem_resource, &res[1])) 190 if (request_resource(&iomem_resource, &res[1]))
190 panic("Request PCIe Memory resource failed\n"); 191 panic("Request PCIe Memory resource failed\n");
191 pci_add_resource(&sys->resources, &res[1]); 192 pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset);
192
193 sys->io_offset = 0;
194 193
195 return 1; 194 return 1;
196} 195}
@@ -499,13 +498,14 @@ static int __init pci_setup(struct pci_sys_data *sys)
499 /* 498 /*
500 * IORESOURCE_IO 499 * IORESOURCE_IO
501 */ 500 */
501 sys->io_offset = 0;
502 res[0].name = "PCI I/O Space"; 502 res[0].name = "PCI I/O Space";
503 res[0].flags = IORESOURCE_IO; 503 res[0].flags = IORESOURCE_IO;
504 res[0].start = ORION5X_PCI_IO_BUS_BASE; 504 res[0].start = ORION5X_PCI_IO_BUS_BASE;
505 res[0].end = res[0].start + ORION5X_PCI_IO_SIZE - 1; 505 res[0].end = res[0].start + ORION5X_PCI_IO_SIZE - 1;
506 if (request_resource(&ioport_resource, &res[0])) 506 if (request_resource(&ioport_resource, &res[0]))
507 panic("Request PCI IO resource failed\n"); 507 panic("Request PCI IO resource failed\n");
508 pci_add_resource(&sys->resources, &res[0]); 508 pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset);
509 509
510 /* 510 /*
511 * IORESOURCE_MEM 511 * IORESOURCE_MEM
@@ -516,9 +516,7 @@ static int __init pci_setup(struct pci_sys_data *sys)
516 res[1].end = res[1].start + ORION5X_PCI_MEM_SIZE - 1; 516 res[1].end = res[1].start + ORION5X_PCI_MEM_SIZE - 1;
517 if (request_resource(&iomem_resource, &res[1])) 517 if (request_resource(&iomem_resource, &res[1]))
518 panic("Request PCI Memory resource failed\n"); 518 panic("Request PCI Memory resource failed\n");
519 pci_add_resource(&sys->resources, &res[1]); 519 pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset);
520
521 sys->io_offset = 0;
522 520
523 return 1; 521 return 1;
524} 522}
diff --git a/arch/arm/mach-picoxcell/include/mach/entry-macro.S b/arch/arm/mach-picoxcell/include/mach/entry-macro.S
deleted file mode 100644
index 9b505ac00be..00000000000
--- a/arch/arm/mach-picoxcell/include/mach/entry-macro.S
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * entry-macro.S
3 *
4 * Copyright (c) 2011 Picochip Ltd., Jamie Iles
5 *
6 * Low-level IRQ helper macros for picoXcell platforms
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 .macro disable_fiq
13 .endm
14
15 .macro arch_ret_to_user, tmp1, tmp2
16 .endm
diff --git a/arch/arm/mach-picoxcell/include/mach/system.h b/arch/arm/mach-picoxcell/include/mach/system.h
deleted file mode 100644
index 1a5d8cb57df..00000000000
--- a/arch/arm/mach-picoxcell/include/mach/system.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (c) 2011 Picochip Ltd., Jamie Iles
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License 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#ifndef __ASM_ARCH_SYSTEM_H
15#define __ASM_ARCH_SYSTEM_H
16
17static inline void arch_idle(void)
18{
19 /*
20 * This should do all the clock switching and wait for interrupt
21 * tricks.
22 */
23 cpu_do_idle();
24}
25
26#endif /* __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-pnx4008/include/mach/entry-macro.S b/arch/arm/mach-pnx4008/include/mach/entry-macro.S
index db7eeebf30d..77a55584671 100644
--- a/arch/arm/mach-pnx4008/include/mach/entry-macro.S
+++ b/arch/arm/mach-pnx4008/include/mach/entry-macro.S
@@ -25,15 +25,9 @@
25#define SIC1_BASE_INT 32 25#define SIC1_BASE_INT 32
26#define SIC2_BASE_INT 64 26#define SIC2_BASE_INT 64
27 27
28 .macro disable_fiq
29 .endm
30
31 .macro get_irqnr_preamble, base, tmp 28 .macro get_irqnr_preamble, base, tmp
32 .endm 29 .endm
33 30
34 .macro arch_ret_to_user, tmp1, tmp2
35 .endm
36
37 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 31 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
38/* decode the MIC interrupt numbers */ 32/* decode the MIC interrupt numbers */
39 ldr \base, =IO_ADDRESS(PNX4008_INTCTRLMIC_BASE) 33 ldr \base, =IO_ADDRESS(PNX4008_INTCTRLMIC_BASE)
diff --git a/arch/arm/mach-pnx4008/include/mach/system.h b/arch/arm/mach-pnx4008/include/mach/system.h
deleted file mode 100644
index 60cfe718809..00000000000
--- a/arch/arm/mach-pnx4008/include/mach/system.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/system.h
3 *
4 * Copyright (C) 2003 Philips Semiconductors
5 * Copyright (C) 2005 MontaVista Software, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24static void arch_idle(void)
25{
26 cpu_do_idle();
27}
28
29#endif
diff --git a/arch/arm/mach-prima2/include/mach/entry-macro.S b/arch/arm/mach-prima2/include/mach/entry-macro.S
index 1c8a50f102a..86434e7a5be 100644
--- a/arch/arm/mach-prima2/include/mach/entry-macro.S
+++ b/arch/arm/mach-prima2/include/mach/entry-macro.S
@@ -20,10 +20,3 @@
20 cmp \irqnr, #0x40 @ the irq num can't be larger than 0x3f 20 cmp \irqnr, #0x40 @ the irq num can't be larger than 0x3f
21 movges \irqnr, #0 21 movges \irqnr, #0
22 .endm 22 .endm
23
24 .macro disable_fiq
25 .endm
26
27 .macro arch_ret_to_user, tmp1, tmp2
28 .endm
29
diff --git a/arch/arm/mach-prima2/include/mach/system.h b/arch/arm/mach-prima2/include/mach/system.h
deleted file mode 100644
index 2c7d2a9d0c9..00000000000
--- a/arch/arm/mach-prima2/include/mach/system.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * arch/arm/mach-prima2/include/mach/system.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_SYSTEM_H__
10#define __MACH_SYSTEM_H__
11
12static inline void arch_idle(void)
13{
14 cpu_do_idle();
15}
16
17#endif
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 5bc13121eac..84f2d7015cf 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -406,20 +406,17 @@ static struct resource pxa_rtc_resources[] = {
406 [1] = { 406 [1] = {
407 .start = IRQ_RTC1Hz, 407 .start = IRQ_RTC1Hz,
408 .end = IRQ_RTC1Hz, 408 .end = IRQ_RTC1Hz,
409 .name = "rtc 1Hz",
409 .flags = IORESOURCE_IRQ, 410 .flags = IORESOURCE_IRQ,
410 }, 411 },
411 [2] = { 412 [2] = {
412 .start = IRQ_RTCAlrm, 413 .start = IRQ_RTCAlrm,
413 .end = IRQ_RTCAlrm, 414 .end = IRQ_RTCAlrm,
415 .name = "rtc alarm",
414 .flags = IORESOURCE_IRQ, 416 .flags = IORESOURCE_IRQ,
415 }, 417 },
416}; 418};
417 419
418struct platform_device sa1100_device_rtc = {
419 .name = "sa1100-rtc",
420 .id = -1,
421};
422
423struct platform_device pxa_device_rtc = { 420struct platform_device pxa_device_rtc = {
424 .name = "pxa-rtc", 421 .name = "pxa-rtc",
425 .id = -1, 422 .id = -1,
@@ -427,6 +424,27 @@ struct platform_device pxa_device_rtc = {
427 .resource = pxa_rtc_resources, 424 .resource = pxa_rtc_resources,
428}; 425};
429 426
427static struct resource sa1100_rtc_resources[] = {
428 {
429 .start = IRQ_RTC1Hz,
430 .end = IRQ_RTC1Hz,
431 .name = "rtc 1Hz",
432 .flags = IORESOURCE_IRQ,
433 }, {
434 .start = IRQ_RTCAlrm,
435 .end = IRQ_RTCAlrm,
436 .name = "rtc alarm",
437 .flags = IORESOURCE_IRQ,
438 },
439};
440
441struct platform_device sa1100_device_rtc = {
442 .name = "sa1100-rtc",
443 .id = -1,
444 .num_resources = ARRAY_SIZE(sa1100_rtc_resources),
445 .resource = sa1100_rtc_resources,
446};
447
430static struct resource pxa_ac97_resources[] = { 448static struct resource pxa_ac97_resources[] = {
431 [0] = { 449 [0] = {
432 .start = 0x40500000, 450 .start = 0x40500000,
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 208eef1c048..3fa929d4a4f 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -28,7 +28,8 @@
28#include <linux/mtd/physmap.h> 28#include <linux/mtd/physmap.h>
29#include <linux/pda_power.h> 29#include <linux/pda_power.h>
30#include <linux/pwm_backlight.h> 30#include <linux/pwm_backlight.h>
31#include <linux/regulator/bq24022.h> 31#include <linux/regulator/driver.h>
32#include <linux/regulator/gpio-regulator.h>
32#include <linux/regulator/machine.h> 33#include <linux/regulator/machine.h>
33#include <linux/regulator/max1586.h> 34#include <linux/regulator/max1586.h>
34#include <linux/spi/ads7846.h> 35#include <linux/spi/ads7846.h>
@@ -97,9 +98,9 @@ static unsigned long hx4700_pin_config[] __initdata = {
97 98
98 /* BTUART */ 99 /* BTUART */
99 GPIO42_BTUART_RXD, 100 GPIO42_BTUART_RXD,
100 GPIO43_BTUART_TXD, 101 GPIO43_BTUART_TXD_LPM_LOW,
101 GPIO44_BTUART_CTS, 102 GPIO44_BTUART_CTS,
102 GPIO45_BTUART_RTS, 103 GPIO45_BTUART_RTS_LPM_LOW,
103 104
104 /* PWM 1 (Backlight) */ 105 /* PWM 1 (Backlight) */
105 GPIO17_PWM1_OUT, 106 GPIO17_PWM1_OUT,
@@ -245,6 +246,21 @@ static u16 asic3_gpio_config[] = {
245 ASIC3_GPIOD15_nPIOW, 246 ASIC3_GPIOD15_nPIOW,
246}; 247};
247 248
249static struct asic3_led asic3_leds[ASIC3_NUM_LEDS] = {
250 [0] = {
251 .name = "hx4700:amber",
252 .default_trigger = "ds2760-battery.0-charging-blink-full-solid",
253 },
254 [1] = {
255 .name = "hx4700:green",
256 .default_trigger = "unused",
257 },
258 [2] = {
259 .name = "hx4700:blue",
260 .default_trigger = "hx4700-radio",
261 },
262};
263
248static struct resource asic3_resources[] = { 264static struct resource asic3_resources[] = {
249 /* GPIO part */ 265 /* GPIO part */
250 [0] = { 266 [0] = {
@@ -275,6 +291,7 @@ static struct asic3_platform_data asic3_platform_data = {
275 .gpio_config_num = ARRAY_SIZE(asic3_gpio_config), 291 .gpio_config_num = ARRAY_SIZE(asic3_gpio_config),
276 .irq_base = IRQ_BOARD_START, 292 .irq_base = IRQ_BOARD_START,
277 .gpio_base = HX4700_ASIC3_GPIO_BASE, 293 .gpio_base = HX4700_ASIC3_GPIO_BASE,
294 .leds = asic3_leds,
278}; 295};
279 296
280static struct platform_device asic3 = { 297static struct platform_device asic3 = {
@@ -682,14 +699,34 @@ static struct regulator_init_data bq24022_init_data = {
682 .consumer_supplies = bq24022_consumers, 699 .consumer_supplies = bq24022_consumers,
683}; 700};
684 701
685static struct bq24022_mach_info bq24022_info = { 702static struct gpio bq24022_gpios[] = {
686 .gpio_nce = GPIO72_HX4700_BQ24022_nCHARGE_EN, 703 { GPIO96_HX4700_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" },
687 .gpio_iset2 = GPIO96_HX4700_BQ24022_ISET2, 704};
688 .init_data = &bq24022_init_data, 705
706static struct gpio_regulator_state bq24022_states[] = {
707 { .value = 100000, .gpios = (0 << 0) },
708 { .value = 500000, .gpios = (1 << 0) },
709};
710
711static struct gpio_regulator_config bq24022_info = {
712 .supply_name = "bq24022",
713
714 .enable_gpio = GPIO72_HX4700_BQ24022_nCHARGE_EN,
715 .enable_high = 0,
716 .enabled_at_boot = 0,
717
718 .gpios = bq24022_gpios,
719 .nr_gpios = ARRAY_SIZE(bq24022_gpios),
720
721 .states = bq24022_states,
722 .nr_states = ARRAY_SIZE(bq24022_states),
723
724 .type = REGULATOR_CURRENT,
725 .init_data = &bq24022_init_data,
689}; 726};
690 727
691static struct platform_device bq24022 = { 728static struct platform_device bq24022 = {
692 .name = "bq24022", 729 .name = "gpio-regulator",
693 .id = -1, 730 .id = -1,
694 .dev = { 731 .dev = {
695 .platform_data = &bq24022_info, 732 .platform_data = &bq24022_info,
@@ -705,10 +742,9 @@ static void hx4700_set_vpp(struct platform_device *pdev, int vpp)
705 gpio_set_value(GPIO91_HX4700_FLASH_VPEN, vpp); 742 gpio_set_value(GPIO91_HX4700_FLASH_VPEN, vpp);
706} 743}
707 744
708static struct resource strataflash_resource = { 745static struct resource strataflash_resource[] = {
709 .start = PXA_CS0_PHYS, 746 [0] = DEFINE_RES_MEM(PXA_CS0_PHYS, SZ_64M),
710 .end = PXA_CS0_PHYS + SZ_128M - 1, 747 [1] = DEFINE_RES_MEM(PXA_CS0_PHYS + SZ_64M, SZ_64M),
711 .flags = IORESOURCE_MEM,
712}; 748};
713 749
714static struct physmap_flash_data strataflash_data = { 750static struct physmap_flash_data strataflash_data = {
@@ -719,8 +755,8 @@ static struct physmap_flash_data strataflash_data = {
719static struct platform_device strataflash = { 755static struct platform_device strataflash = {
720 .name = "physmap-flash", 756 .name = "physmap-flash",
721 .id = -1, 757 .id = -1,
722 .resource = &strataflash_resource, 758 .resource = strataflash_resource,
723 .num_resources = 1, 759 .num_resources = ARRAY_SIZE(strataflash_resource),
724 .dev = { 760 .dev = {
725 .platform_data = &strataflash_data, 761 .platform_data = &strataflash_data,
726 }, 762 },
@@ -788,17 +824,6 @@ static struct platform_device audio = {
788 824
789 825
790/* 826/*
791 * PCMCIA
792 */
793
794static struct platform_device pcmcia = {
795 .name = "hx4700-pcmcia",
796 .dev = {
797 .parent = &asic3.dev,
798 },
799};
800
801/*
802 * Platform devices 827 * Platform devices
803 */ 828 */
804 829
@@ -814,7 +839,6 @@ static struct platform_device *devices[] __initdata = {
814 &power_supply, 839 &power_supply,
815 &strataflash, 840 &strataflash,
816 &audio, 841 &audio,
817 &pcmcia,
818}; 842};
819 843
820static struct gpio global_gpios[] = { 844static struct gpio global_gpios[] = {
@@ -830,7 +854,6 @@ static struct gpio global_gpios[] = {
830 { GPIO32_HX4700_RS232_ON, GPIOF_OUT_INIT_HIGH, "RS232_ON" }, 854 { GPIO32_HX4700_RS232_ON, GPIOF_OUT_INIT_HIGH, "RS232_ON" },
831 { GPIO71_HX4700_ASIC3_nRESET, GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" }, 855 { GPIO71_HX4700_ASIC3_nRESET, GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
832 { GPIO82_HX4700_EUART_RESET, GPIOF_OUT_INIT_HIGH, "EUART_RESET" }, 856 { GPIO82_HX4700_EUART_RESET, GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
833 { GPIO105_HX4700_nIR_ON, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
834}; 857};
835 858
836static void __init hx4700_init(void) 859static void __init hx4700_init(void)
diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h b/arch/arm/mach-pxa/include/mach/balloon3.h
index f02fa1e6ba8..954641e6c8b 100644
--- a/arch/arm/mach-pxa/include/mach/balloon3.h
+++ b/arch/arm/mach-pxa/include/mach/balloon3.h
@@ -174,7 +174,6 @@ enum balloon3_features {
174 174
175#define BALLOON3_AUX_NIRQ PXA_GPIO_TO_IRQ(BALLOON3_GPIO_AUX_NIRQ) 175#define BALLOON3_AUX_NIRQ PXA_GPIO_TO_IRQ(BALLOON3_GPIO_AUX_NIRQ)
176#define BALLOON3_CODEC_IRQ PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ) 176#define BALLOON3_CODEC_IRQ PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ)
177#define BALLOON3_S0_CD_IRQ PXA_GPIO_TO_IRQ(BALLOON3_GPIO_S0_CD)
178 177
179#define BALLOON3_NR_IRQS (IRQ_BOARD_START + 16) 178#define BALLOON3_NR_IRQS (IRQ_BOARD_START + 16)
180 179
diff --git a/arch/arm/mach-pxa/include/mach/entry-macro.S b/arch/arm/mach-pxa/include/mach/entry-macro.S
deleted file mode 100644
index 260c0c17692..00000000000
--- a/arch/arm/mach-pxa/include/mach/entry-macro.S
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * arch/arm/mach-pxa/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for PXA-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
11 .macro disable_fiq
12 .endm
13
14 .macro arch_ret_to_user, tmp1, tmp2
15 .endm
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
index ec0f0b0b674..a65867209aa 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
@@ -158,7 +158,9 @@
158#define GPIO44_BTUART_CTS MFP_CFG_IN(GPIO44, AF1) 158#define GPIO44_BTUART_CTS MFP_CFG_IN(GPIO44, AF1)
159#define GPIO42_BTUART_RXD MFP_CFG_IN(GPIO42, AF1) 159#define GPIO42_BTUART_RXD MFP_CFG_IN(GPIO42, AF1)
160#define GPIO45_BTUART_RTS MFP_CFG_OUT(GPIO45, AF2, DRIVE_HIGH) 160#define GPIO45_BTUART_RTS MFP_CFG_OUT(GPIO45, AF2, DRIVE_HIGH)
161#define GPIO45_BTUART_RTS_LPM_LOW MFP_CFG_OUT(GPIO45, AF2, DRIVE_LOW)
161#define GPIO43_BTUART_TXD MFP_CFG_OUT(GPIO43, AF2, DRIVE_HIGH) 162#define GPIO43_BTUART_TXD MFP_CFG_OUT(GPIO43, AF2, DRIVE_HIGH)
163#define GPIO43_BTUART_TXD_LPM_LOW MFP_CFG_OUT(GPIO43, AF2, DRIVE_LOW)
162 164
163/* STUART */ 165/* STUART */
164#define GPIO46_STUART_RXD MFP_CFG_IN(GPIO46, AF2) 166#define GPIO46_STUART_RXD MFP_CFG_IN(GPIO46, AF2)
diff --git a/arch/arm/mach-pxa/include/mach/system.h b/arch/arm/mach-pxa/include/mach/system.h
deleted file mode 100644
index c5afacd3cc0..00000000000
--- a/arch/arm/mach-pxa/include/mach/system.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * arch/arm/mach-pxa/include/mach/system.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software 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 */
12static inline void arch_idle(void)
13{
14 cpu_do_idle();
15}
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 3d6baf91396..5e26f3e93fd 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -25,7 +25,8 @@
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <linux/pda_power.h> 26#include <linux/pda_power.h>
27#include <linux/pwm_backlight.h> 27#include <linux/pwm_backlight.h>
28#include <linux/regulator/bq24022.h> 28#include <linux/regulator/driver.h>
29#include <linux/regulator/gpio-regulator.h>
29#include <linux/regulator/machine.h> 30#include <linux/regulator/machine.h>
30#include <linux/usb/gpio_vbus.h> 31#include <linux/usb/gpio_vbus.h>
31#include <linux/i2c/pxa-i2c.h> 32#include <linux/i2c/pxa-i2c.h>
@@ -596,14 +597,34 @@ static struct regulator_init_data bq24022_init_data = {
596 .consumer_supplies = bq24022_consumers, 597 .consumer_supplies = bq24022_consumers,
597}; 598};
598 599
599static struct bq24022_mach_info bq24022_info = { 600static struct gpio bq24022_gpios[] = {
600 .gpio_nce = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, 601 { EGPIO_MAGICIAN_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" },
601 .gpio_iset2 = EGPIO_MAGICIAN_BQ24022_ISET2, 602};
602 .init_data = &bq24022_init_data, 603
604static struct gpio_regulator_state bq24022_states[] = {
605 { .value = 100000, .gpios = (0 << 0) },
606 { .value = 500000, .gpios = (1 << 0) },
607};
608
609static struct gpio_regulator_config bq24022_info = {
610 .supply_name = "bq24022",
611
612 .enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
613 .enable_high = 0,
614 .enabled_at_boot = 0,
615
616 .gpios = bq24022_gpios,
617 .nr_gpios = ARRAY_SIZE(bq24022_gpios),
618
619 .states = bq24022_states,
620 .nr_states = ARRAY_SIZE(bq24022_states),
621
622 .type = REGULATOR_CURRENT,
623 .init_data = &bq24022_init_data,
603}; 624};
604 625
605static struct platform_device bq24022 = { 626static struct platform_device bq24022 = {
606 .name = "bq24022", 627 .name = "gpio-regulator",
607 .id = -1, 628 .id = -1,
608 .dev = { 629 .dev = {
609 .platform_data = &bq24022_info, 630 .platform_data = &bq24022_info,
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 3918a672238..1570d457fea 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -89,6 +89,7 @@ static struct clk_lookup pxa3xx_clkregs[] = {
89 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL), 89 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL),
90 INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL), 90 INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL),
91 INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL), 91 INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL),
92 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
92}; 93};
93 94
94#ifdef CONFIG_PM 95#ifdef CONFIG_PM
diff --git a/arch/arm/mach-pxa/pxa95x.c b/arch/arm/mach-pxa/pxa95x.c
index 5ce434b95e8..47601f80e6e 100644
--- a/arch/arm/mach-pxa/pxa95x.c
+++ b/arch/arm/mach-pxa/pxa95x.c
@@ -231,6 +231,7 @@ static struct clk_lookup pxa95x_clkregs[] = {
231 INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL), 231 INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL),
232 INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL), 232 INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL),
233 INIT_CLKREG(&clk_pxa95x_gpio, "pxa-gpio", NULL), 233 INIT_CLKREG(&clk_pxa95x_gpio, "pxa-gpio", NULL),
234 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
234}; 235};
235 236
236void __init pxa95x_init_irq(void) 237void __init pxa95x_init_irq(void)
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 735b57aaf2d..f8f2c0ac4c0 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -28,21 +28,11 @@
28#include <asm/setup.h> 28#include <asm/setup.h>
29#include <asm/leds.h> 29#include <asm/leds.h>
30 30
31#define AMBA_DEVICE(name,busid,base,plat) \ 31#define APB_DEVICE(name, busid, base, plat) \
32static struct amba_device name##_device = { \ 32static AMBA_APB_DEVICE(name, busid, 0, REALVIEW_##base##_BASE, base##_IRQ, plat)
33 .dev = { \ 33
34 .coherent_dma_mask = ~0, \ 34#define AHB_DEVICE(name, busid, base, plat) \
35 .init_name = busid, \ 35static AMBA_AHB_DEVICE(name, busid, 0, REALVIEW_##base##_BASE, base##_IRQ, plat)
36 .platform_data = plat, \
37 }, \
38 .res = { \
39 .start = REALVIEW_##base##_BASE, \
40 .end = (REALVIEW_##base##_BASE) + SZ_4K - 1, \
41 .flags = IORESOURCE_MEM, \
42 }, \
43 .dma_mask = ~0, \
44 .irq = base##_IRQ, \
45}
46 36
47struct machine_desc; 37struct machine_desc;
48 38
diff --git a/arch/arm/mach-realview/include/mach/entry-macro.S b/arch/arm/mach-realview/include/mach/entry-macro.S
deleted file mode 100644
index e8a5179c265..00000000000
--- a/arch/arm/mach-realview/include/mach/entry-macro.S
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * arch/arm/mach-realview/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for RealView platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11 .macro disable_fiq
12 .endm
13
14 .macro arch_ret_to_user, tmp1, tmp2
15 .endm
16
diff --git a/arch/arm/mach-realview/include/mach/irqs-eb.h b/arch/arm/mach-realview/include/mach/irqs-eb.h
index 204d5378f30..d6b5073692d 100644
--- a/arch/arm/mach-realview/include/mach/irqs-eb.h
+++ b/arch/arm/mach-realview/include/mach/irqs-eb.h
@@ -96,16 +96,19 @@
96#define IRQ_EB11MP_L220_SLAVE (IRQ_EB_GIC_START + 30) 96#define IRQ_EB11MP_L220_SLAVE (IRQ_EB_GIC_START + 30)
97#define IRQ_EB11MP_L220_DECODE (IRQ_EB_GIC_START + 31) 97#define IRQ_EB11MP_L220_DECODE (IRQ_EB_GIC_START + 31)
98 98
99#define IRQ_EB11MP_UART2 -1 99/*
100#define IRQ_EB11MP_UART3 -1 100 * The 11MPcore tile leaves the following unconnected.
101#define IRQ_EB11MP_CLCD -1 101 */
102#define IRQ_EB11MP_DMA -1 102#define IRQ_EB11MP_UART2 0
103#define IRQ_EB11MP_WDOG -1 103#define IRQ_EB11MP_UART3 0
104#define IRQ_EB11MP_GPIO0 -1 104#define IRQ_EB11MP_CLCD 0
105#define IRQ_EB11MP_GPIO1 -1 105#define IRQ_EB11MP_DMA 0
106#define IRQ_EB11MP_GPIO2 -1 106#define IRQ_EB11MP_WDOG 0
107#define IRQ_EB11MP_SCI -1 107#define IRQ_EB11MP_GPIO0 0
108#define IRQ_EB11MP_SSP -1 108#define IRQ_EB11MP_GPIO1 0
109#define IRQ_EB11MP_GPIO2 0
110#define IRQ_EB11MP_SCI 0
111#define IRQ_EB11MP_SSP 0
109 112
110#define NR_GIC_EB11MP 2 113#define NR_GIC_EB11MP 2
111 114
diff --git a/arch/arm/mach-realview/include/mach/irqs-pb1176.h b/arch/arm/mach-realview/include/mach/irqs-pb1176.h
index 5c3c625e3e0..708f84156f2 100644
--- a/arch/arm/mach-realview/include/mach/irqs-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/irqs-pb1176.h
@@ -40,6 +40,7 @@
40#define IRQ_DC1176_L2CC (IRQ_DC1176_GIC_START + 13) 40#define IRQ_DC1176_L2CC (IRQ_DC1176_GIC_START + 13)
41#define IRQ_DC1176_RTC (IRQ_DC1176_GIC_START + 14) 41#define IRQ_DC1176_RTC (IRQ_DC1176_GIC_START + 14)
42#define IRQ_DC1176_CLCD (IRQ_DC1176_GIC_START + 15) /* CLCD controller */ 42#define IRQ_DC1176_CLCD (IRQ_DC1176_GIC_START + 15) /* CLCD controller */
43#define IRQ_DC1176_GPIO0 (IRQ_DC1176_GIC_START + 16)
43#define IRQ_DC1176_SSP (IRQ_DC1176_GIC_START + 17) /* SSP port */ 44#define IRQ_DC1176_SSP (IRQ_DC1176_GIC_START + 17) /* SSP port */
44#define IRQ_DC1176_UART0 (IRQ_DC1176_GIC_START + 18) /* UART 0 on development chip */ 45#define IRQ_DC1176_UART0 (IRQ_DC1176_GIC_START + 18) /* UART 0 on development chip */
45#define IRQ_DC1176_UART1 (IRQ_DC1176_GIC_START + 19) /* UART 1 on development chip */ 46#define IRQ_DC1176_UART1 (IRQ_DC1176_GIC_START + 19) /* UART 1 on development chip */
@@ -73,7 +74,6 @@
73#define IRQ_PB1176_DMAC (IRQ_PB1176_GIC_START + 24) /* DMA controller */ 74#define IRQ_PB1176_DMAC (IRQ_PB1176_GIC_START + 24) /* DMA controller */
74#define IRQ_PB1176_RTC (IRQ_PB1176_GIC_START + 25) /* Real Time Clock */ 75#define IRQ_PB1176_RTC (IRQ_PB1176_GIC_START + 25) /* Real Time Clock */
75 76
76#define IRQ_PB1176_GPIO0 -1
77#define IRQ_PB1176_SCTL -1 77#define IRQ_PB1176_SCTL -1
78 78
79#define NR_GIC_PB1176 2 79#define NR_GIC_PB1176 2
diff --git a/arch/arm/mach-realview/include/mach/system.h b/arch/arm/mach-realview/include/mach/system.h
deleted file mode 100644
index 471b671159c..00000000000
--- a/arch/arm/mach-realview/include/mach/system.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm/mach-realview/include/mach/system.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24static inline void arch_idle(void)
25{
26 /*
27 * This should do all the clock switching
28 * and wait for interrupt tricks
29 */
30 cpu_do_idle();
31}
32
33#endif
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 9578145f2df..baf382c5e77 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -36,7 +36,7 @@
36#include <asm/pgtable.h> 36#include <asm/pgtable.h>
37#include <asm/hardware/gic.h> 37#include <asm/hardware/gic.h>
38#include <asm/hardware/cache-l2x0.h> 38#include <asm/hardware/cache-l2x0.h>
39#include <asm/localtimer.h> 39#include <asm/smp_twd.h>
40 40
41#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
42#include <asm/mach/map.h> 42#include <asm/mach/map.h>
@@ -135,63 +135,63 @@ static struct pl022_ssp_controller ssp0_plat_data = {
135/* 135/*
136 * These devices are connected via the core APB bridge 136 * These devices are connected via the core APB bridge
137 */ 137 */
138#define GPIO2_IRQ { IRQ_EB_GPIO2, NO_IRQ } 138#define GPIO2_IRQ { IRQ_EB_GPIO2 }
139#define GPIO3_IRQ { IRQ_EB_GPIO3, NO_IRQ } 139#define GPIO3_IRQ { IRQ_EB_GPIO3 }
140 140
141#define AACI_IRQ { IRQ_EB_AACI, NO_IRQ } 141#define AACI_IRQ { IRQ_EB_AACI }
142#define MMCI0_IRQ { IRQ_EB_MMCI0A, IRQ_EB_MMCI0B } 142#define MMCI0_IRQ { IRQ_EB_MMCI0A, IRQ_EB_MMCI0B }
143#define KMI0_IRQ { IRQ_EB_KMI0, NO_IRQ } 143#define KMI0_IRQ { IRQ_EB_KMI0 }
144#define KMI1_IRQ { IRQ_EB_KMI1, NO_IRQ } 144#define KMI1_IRQ { IRQ_EB_KMI1 }
145 145
146/* 146/*
147 * These devices are connected directly to the multi-layer AHB switch 147 * These devices are connected directly to the multi-layer AHB switch
148 */ 148 */
149#define EB_SMC_IRQ { NO_IRQ, NO_IRQ } 149#define EB_SMC_IRQ { }
150#define MPMC_IRQ { NO_IRQ, NO_IRQ } 150#define MPMC_IRQ { }
151#define EB_CLCD_IRQ { IRQ_EB_CLCD, NO_IRQ } 151#define EB_CLCD_IRQ { IRQ_EB_CLCD }
152#define DMAC_IRQ { IRQ_EB_DMA, NO_IRQ } 152#define DMAC_IRQ { IRQ_EB_DMA }
153 153
154/* 154/*
155 * These devices are connected via the core APB bridge 155 * These devices are connected via the core APB bridge
156 */ 156 */
157#define SCTL_IRQ { NO_IRQ, NO_IRQ } 157#define SCTL_IRQ { }
158#define EB_WATCHDOG_IRQ { IRQ_EB_WDOG, NO_IRQ } 158#define EB_WATCHDOG_IRQ { IRQ_EB_WDOG }
159#define EB_GPIO0_IRQ { IRQ_EB_GPIO0, NO_IRQ } 159#define EB_GPIO0_IRQ { IRQ_EB_GPIO0 }
160#define GPIO1_IRQ { IRQ_EB_GPIO1, NO_IRQ } 160#define GPIO1_IRQ { IRQ_EB_GPIO1 }
161#define EB_RTC_IRQ { IRQ_EB_RTC, NO_IRQ } 161#define EB_RTC_IRQ { IRQ_EB_RTC }
162 162
163/* 163/*
164 * These devices are connected via the DMA APB bridge 164 * These devices are connected via the DMA APB bridge
165 */ 165 */
166#define SCI_IRQ { IRQ_EB_SCI, NO_IRQ } 166#define SCI_IRQ { IRQ_EB_SCI }
167#define EB_UART0_IRQ { IRQ_EB_UART0, NO_IRQ } 167#define EB_UART0_IRQ { IRQ_EB_UART0 }
168#define EB_UART1_IRQ { IRQ_EB_UART1, NO_IRQ } 168#define EB_UART1_IRQ { IRQ_EB_UART1 }
169#define EB_UART2_IRQ { IRQ_EB_UART2, NO_IRQ } 169#define EB_UART2_IRQ { IRQ_EB_UART2 }
170#define EB_UART3_IRQ { IRQ_EB_UART3, NO_IRQ } 170#define EB_UART3_IRQ { IRQ_EB_UART3 }
171#define EB_SSP_IRQ { IRQ_EB_SSP, NO_IRQ } 171#define EB_SSP_IRQ { IRQ_EB_SSP }
172 172
173/* FPGA Primecells */ 173/* FPGA Primecells */
174AMBA_DEVICE(aaci, "fpga:aaci", AACI, NULL); 174APB_DEVICE(aaci, "fpga:aaci", AACI, NULL);
175AMBA_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data); 175APB_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data);
176AMBA_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL); 176APB_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL);
177AMBA_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL); 177APB_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL);
178AMBA_DEVICE(uart3, "fpga:uart3", EB_UART3, NULL); 178APB_DEVICE(uart3, "fpga:uart3", EB_UART3, NULL);
179 179
180/* DevChip Primecells */ 180/* DevChip Primecells */
181AMBA_DEVICE(smc, "dev:smc", EB_SMC, NULL); 181AHB_DEVICE(smc, "dev:smc", EB_SMC, NULL);
182AMBA_DEVICE(clcd, "dev:clcd", EB_CLCD, &clcd_plat_data); 182AHB_DEVICE(clcd, "dev:clcd", EB_CLCD, &clcd_plat_data);
183AMBA_DEVICE(dmac, "dev:dmac", DMAC, NULL); 183AHB_DEVICE(dmac, "dev:dmac", DMAC, NULL);
184AMBA_DEVICE(sctl, "dev:sctl", SCTL, NULL); 184AHB_DEVICE(sctl, "dev:sctl", SCTL, NULL);
185AMBA_DEVICE(wdog, "dev:wdog", EB_WATCHDOG, NULL); 185APB_DEVICE(wdog, "dev:wdog", EB_WATCHDOG, NULL);
186AMBA_DEVICE(gpio0, "dev:gpio0", EB_GPIO0, &gpio0_plat_data); 186APB_DEVICE(gpio0, "dev:gpio0", EB_GPIO0, &gpio0_plat_data);
187AMBA_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data); 187APB_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data);
188AMBA_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data); 188APB_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data);
189AMBA_DEVICE(rtc, "dev:rtc", EB_RTC, NULL); 189APB_DEVICE(rtc, "dev:rtc", EB_RTC, NULL);
190AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL); 190APB_DEVICE(sci0, "dev:sci0", SCI, NULL);
191AMBA_DEVICE(uart0, "dev:uart0", EB_UART0, NULL); 191APB_DEVICE(uart0, "dev:uart0", EB_UART0, NULL);
192AMBA_DEVICE(uart1, "dev:uart1", EB_UART1, NULL); 192APB_DEVICE(uart1, "dev:uart1", EB_UART1, NULL);
193AMBA_DEVICE(uart2, "dev:uart2", EB_UART2, NULL); 193APB_DEVICE(uart2, "dev:uart2", EB_UART2, NULL);
194AMBA_DEVICE(ssp0, "dev:ssp0", EB_SSP, &ssp0_plat_data); 194APB_DEVICE(ssp0, "dev:ssp0", EB_SSP, &ssp0_plat_data);
195 195
196static struct amba_device *amba_devs[] __initdata = { 196static struct amba_device *amba_devs[] __initdata = {
197 &dmac_device, 197 &dmac_device,
@@ -383,6 +383,23 @@ static void realview_eb11mp_fixup(void)
383 realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB; 383 realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB;
384} 384}
385 385
386#ifdef CONFIG_HAVE_ARM_TWD
387static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
388 REALVIEW_EB11MP_TWD_BASE,
389 IRQ_LOCALTIMER);
390
391static void __init realview_eb_twd_init(void)
392{
393 if (core_tile_eb11mp() || core_tile_a9mp()) {
394 int err = twd_local_timer_register(&twd_local_timer);
395 if (err)
396 pr_err("twd_local_timer_register failed %d\n", err);
397 }
398}
399#else
400#define realview_eb_twd_init() do { } while(0)
401#endif
402
386static void __init realview_eb_timer_init(void) 403static void __init realview_eb_timer_init(void)
387{ 404{
388 unsigned int timer_irq; 405 unsigned int timer_irq;
@@ -392,15 +409,13 @@ static void __init realview_eb_timer_init(void)
392 timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE); 409 timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE);
393 timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20; 410 timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20;
394 411
395 if (core_tile_eb11mp() || core_tile_a9mp()) { 412 if (core_tile_eb11mp() || core_tile_a9mp())
396#ifdef CONFIG_LOCAL_TIMERS
397 twd_base = __io_address(REALVIEW_EB11MP_TWD_BASE);
398#endif
399 timer_irq = IRQ_EB11MP_TIMER0_1; 413 timer_irq = IRQ_EB11MP_TIMER0_1;
400 } else 414 else
401 timer_irq = IRQ_EB_TIMER0_1; 415 timer_irq = IRQ_EB_TIMER0_1;
402 416
403 realview_timer_init(timer_irq); 417 realview_timer_init(timer_irq);
418 realview_eb_twd_init();
404} 419}
405 420
406static struct sys_timer realview_eb_timer = { 421static struct sys_timer realview_eb_timer = {
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index e4abe94fb11..b1d7cafa1a6 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -132,50 +132,50 @@ static struct pl022_ssp_controller ssp0_plat_data = {
132/* 132/*
133 * RealView PB1176 AMBA devices 133 * RealView PB1176 AMBA devices
134 */ 134 */
135#define GPIO2_IRQ { IRQ_PB1176_GPIO2, NO_IRQ } 135#define GPIO2_IRQ { IRQ_PB1176_GPIO2 }
136#define GPIO3_IRQ { IRQ_PB1176_GPIO3, NO_IRQ } 136#define GPIO3_IRQ { IRQ_PB1176_GPIO3 }
137#define AACI_IRQ { IRQ_PB1176_AACI, NO_IRQ } 137#define AACI_IRQ { IRQ_PB1176_AACI }
138#define MMCI0_IRQ { IRQ_PB1176_MMCI0A, IRQ_PB1176_MMCI0B } 138#define MMCI0_IRQ { IRQ_PB1176_MMCI0A, IRQ_PB1176_MMCI0B }
139#define KMI0_IRQ { IRQ_PB1176_KMI0, NO_IRQ } 139#define KMI0_IRQ { IRQ_PB1176_KMI0 }
140#define KMI1_IRQ { IRQ_PB1176_KMI1, NO_IRQ } 140#define KMI1_IRQ { IRQ_PB1176_KMI1 }
141#define PB1176_SMC_IRQ { NO_IRQ, NO_IRQ } 141#define PB1176_SMC_IRQ { }
142#define MPMC_IRQ { NO_IRQ, NO_IRQ } 142#define MPMC_IRQ { }
143#define PB1176_CLCD_IRQ { IRQ_DC1176_CLCD, NO_IRQ } 143#define PB1176_CLCD_IRQ { IRQ_DC1176_CLCD }
144#define SCTL_IRQ { NO_IRQ, NO_IRQ } 144#define SCTL_IRQ { }
145#define PB1176_WATCHDOG_IRQ { IRQ_DC1176_WATCHDOG, NO_IRQ } 145#define PB1176_WATCHDOG_IRQ { IRQ_DC1176_WATCHDOG }
146#define PB1176_GPIO0_IRQ { IRQ_PB1176_GPIO0, NO_IRQ } 146#define PB1176_GPIO0_IRQ { IRQ_DC1176_GPIO0 }
147#define GPIO1_IRQ { IRQ_PB1176_GPIO1, NO_IRQ } 147#define GPIO1_IRQ { IRQ_PB1176_GPIO1 }
148#define PB1176_RTC_IRQ { IRQ_DC1176_RTC, NO_IRQ } 148#define PB1176_RTC_IRQ { IRQ_DC1176_RTC }
149#define SCI_IRQ { IRQ_PB1176_SCI, NO_IRQ } 149#define SCI_IRQ { IRQ_PB1176_SCI }
150#define PB1176_UART0_IRQ { IRQ_DC1176_UART0, NO_IRQ } 150#define PB1176_UART0_IRQ { IRQ_DC1176_UART0 }
151#define PB1176_UART1_IRQ { IRQ_DC1176_UART1, NO_IRQ } 151#define PB1176_UART1_IRQ { IRQ_DC1176_UART1 }
152#define PB1176_UART2_IRQ { IRQ_DC1176_UART2, NO_IRQ } 152#define PB1176_UART2_IRQ { IRQ_DC1176_UART2 }
153#define PB1176_UART3_IRQ { IRQ_DC1176_UART3, NO_IRQ } 153#define PB1176_UART3_IRQ { IRQ_DC1176_UART3 }
154#define PB1176_UART4_IRQ { IRQ_PB1176_UART4, NO_IRQ } 154#define PB1176_UART4_IRQ { IRQ_PB1176_UART4 }
155#define PB1176_SSP_IRQ { IRQ_DC1176_SSP, NO_IRQ } 155#define PB1176_SSP_IRQ { IRQ_DC1176_SSP }
156 156
157/* FPGA Primecells */ 157/* FPGA Primecells */
158AMBA_DEVICE(aaci, "fpga:aaci", AACI, NULL); 158APB_DEVICE(aaci, "fpga:aaci", AACI, NULL);
159AMBA_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data); 159APB_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data);
160AMBA_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL); 160APB_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL);
161AMBA_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL); 161APB_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL);
162AMBA_DEVICE(uart4, "fpga:uart4", PB1176_UART4, NULL); 162APB_DEVICE(uart4, "fpga:uart4", PB1176_UART4, NULL);
163 163
164/* DevChip Primecells */ 164/* DevChip Primecells */
165AMBA_DEVICE(smc, "dev:smc", PB1176_SMC, NULL); 165AHB_DEVICE(smc, "dev:smc", PB1176_SMC, NULL);
166AMBA_DEVICE(sctl, "dev:sctl", SCTL, NULL); 166AHB_DEVICE(sctl, "dev:sctl", SCTL, NULL);
167AMBA_DEVICE(wdog, "dev:wdog", PB1176_WATCHDOG, NULL); 167APB_DEVICE(wdog, "dev:wdog", PB1176_WATCHDOG, NULL);
168AMBA_DEVICE(gpio0, "dev:gpio0", PB1176_GPIO0, &gpio0_plat_data); 168APB_DEVICE(gpio0, "dev:gpio0", PB1176_GPIO0, &gpio0_plat_data);
169AMBA_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data); 169APB_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data);
170AMBA_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data); 170APB_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data);
171AMBA_DEVICE(rtc, "dev:rtc", PB1176_RTC, NULL); 171APB_DEVICE(rtc, "dev:rtc", PB1176_RTC, NULL);
172AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL); 172APB_DEVICE(sci0, "dev:sci0", SCI, NULL);
173AMBA_DEVICE(uart0, "dev:uart0", PB1176_UART0, NULL); 173APB_DEVICE(uart0, "dev:uart0", PB1176_UART0, NULL);
174AMBA_DEVICE(uart1, "dev:uart1", PB1176_UART1, NULL); 174APB_DEVICE(uart1, "dev:uart1", PB1176_UART1, NULL);
175AMBA_DEVICE(uart2, "dev:uart2", PB1176_UART2, NULL); 175APB_DEVICE(uart2, "dev:uart2", PB1176_UART2, NULL);
176AMBA_DEVICE(uart3, "dev:uart3", PB1176_UART3, NULL); 176APB_DEVICE(uart3, "dev:uart3", PB1176_UART3, NULL);
177AMBA_DEVICE(ssp0, "dev:ssp0", PB1176_SSP, &ssp0_plat_data); 177APB_DEVICE(ssp0, "dev:ssp0", PB1176_SSP, &ssp0_plat_data);
178AMBA_DEVICE(clcd, "dev:clcd", PB1176_CLCD, &clcd_plat_data); 178AHB_DEVICE(clcd, "dev:clcd", PB1176_CLCD, &clcd_plat_data);
179 179
180static struct amba_device *amba_devs[] __initdata = { 180static struct amba_device *amba_devs[] __initdata = {
181 &uart0_device, 181 &uart0_device,
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 2147335f66f..a98c536e332 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -36,7 +36,7 @@
36#include <asm/pgtable.h> 36#include <asm/pgtable.h>
37#include <asm/hardware/gic.h> 37#include <asm/hardware/gic.h>
38#include <asm/hardware/cache-l2x0.h> 38#include <asm/hardware/cache-l2x0.h>
39#include <asm/localtimer.h> 39#include <asm/smp_twd.h>
40 40
41#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
42#include <asm/mach/flash.h> 42#include <asm/mach/flash.h>
@@ -127,52 +127,52 @@ static struct pl022_ssp_controller ssp0_plat_data = {
127 * RealView PB11MPCore AMBA devices 127 * RealView PB11MPCore AMBA devices
128 */ 128 */
129 129
130#define GPIO2_IRQ { IRQ_PB11MP_GPIO2, NO_IRQ } 130#define GPIO2_IRQ { IRQ_PB11MP_GPIO2 }
131#define GPIO3_IRQ { IRQ_PB11MP_GPIO3, NO_IRQ } 131#define GPIO3_IRQ { IRQ_PB11MP_GPIO3 }
132#define AACI_IRQ { IRQ_TC11MP_AACI, NO_IRQ } 132#define AACI_IRQ { IRQ_TC11MP_AACI }
133#define MMCI0_IRQ { IRQ_TC11MP_MMCI0A, IRQ_TC11MP_MMCI0B } 133#define MMCI0_IRQ { IRQ_TC11MP_MMCI0A, IRQ_TC11MP_MMCI0B }
134#define KMI0_IRQ { IRQ_TC11MP_KMI0, NO_IRQ } 134#define KMI0_IRQ { IRQ_TC11MP_KMI0 }
135#define KMI1_IRQ { IRQ_TC11MP_KMI1, NO_IRQ } 135#define KMI1_IRQ { IRQ_TC11MP_KMI1 }
136#define PB11MP_SMC_IRQ { NO_IRQ, NO_IRQ } 136#define PB11MP_SMC_IRQ { }
137#define MPMC_IRQ { NO_IRQ, NO_IRQ } 137#define MPMC_IRQ { }
138#define PB11MP_CLCD_IRQ { IRQ_PB11MP_CLCD, NO_IRQ } 138#define PB11MP_CLCD_IRQ { IRQ_PB11MP_CLCD }
139#define DMAC_IRQ { IRQ_PB11MP_DMAC, NO_IRQ } 139#define DMAC_IRQ { IRQ_PB11MP_DMAC }
140#define SCTL_IRQ { NO_IRQ, NO_IRQ } 140#define SCTL_IRQ { }
141#define PB11MP_WATCHDOG_IRQ { IRQ_PB11MP_WATCHDOG, NO_IRQ } 141#define PB11MP_WATCHDOG_IRQ { IRQ_PB11MP_WATCHDOG }
142#define PB11MP_GPIO0_IRQ { IRQ_PB11MP_GPIO0, NO_IRQ } 142#define PB11MP_GPIO0_IRQ { IRQ_PB11MP_GPIO0 }
143#define GPIO1_IRQ { IRQ_PB11MP_GPIO1, NO_IRQ } 143#define GPIO1_IRQ { IRQ_PB11MP_GPIO1 }
144#define PB11MP_RTC_IRQ { IRQ_TC11MP_RTC, NO_IRQ } 144#define PB11MP_RTC_IRQ { IRQ_TC11MP_RTC }
145#define SCI_IRQ { IRQ_PB11MP_SCI, NO_IRQ } 145#define SCI_IRQ { IRQ_PB11MP_SCI }
146#define PB11MP_UART0_IRQ { IRQ_TC11MP_UART0, NO_IRQ } 146#define PB11MP_UART0_IRQ { IRQ_TC11MP_UART0 }
147#define PB11MP_UART1_IRQ { IRQ_TC11MP_UART1, NO_IRQ } 147#define PB11MP_UART1_IRQ { IRQ_TC11MP_UART1 }
148#define PB11MP_UART2_IRQ { IRQ_PB11MP_UART2, NO_IRQ } 148#define PB11MP_UART2_IRQ { IRQ_PB11MP_UART2 }
149#define PB11MP_UART3_IRQ { IRQ_PB11MP_UART3, NO_IRQ } 149#define PB11MP_UART3_IRQ { IRQ_PB11MP_UART3 }
150#define PB11MP_SSP_IRQ { IRQ_PB11MP_SSP, NO_IRQ } 150#define PB11MP_SSP_IRQ { IRQ_PB11MP_SSP }
151 151
152/* FPGA Primecells */ 152/* FPGA Primecells */
153AMBA_DEVICE(aaci, "fpga:aaci", AACI, NULL); 153APB_DEVICE(aaci, "fpga:aaci", AACI, NULL);
154AMBA_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data); 154APB_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data);
155AMBA_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL); 155APB_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL);
156AMBA_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL); 156APB_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL);
157AMBA_DEVICE(uart3, "fpga:uart3", PB11MP_UART3, NULL); 157APB_DEVICE(uart3, "fpga:uart3", PB11MP_UART3, NULL);
158 158
159/* DevChip Primecells */ 159/* DevChip Primecells */
160AMBA_DEVICE(smc, "dev:smc", PB11MP_SMC, NULL); 160AHB_DEVICE(smc, "dev:smc", PB11MP_SMC, NULL);
161AMBA_DEVICE(sctl, "dev:sctl", SCTL, NULL); 161AHB_DEVICE(sctl, "dev:sctl", SCTL, NULL);
162AMBA_DEVICE(wdog, "dev:wdog", PB11MP_WATCHDOG, NULL); 162APB_DEVICE(wdog, "dev:wdog", PB11MP_WATCHDOG, NULL);
163AMBA_DEVICE(gpio0, "dev:gpio0", PB11MP_GPIO0, &gpio0_plat_data); 163APB_DEVICE(gpio0, "dev:gpio0", PB11MP_GPIO0, &gpio0_plat_data);
164AMBA_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data); 164APB_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data);
165AMBA_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data); 165APB_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data);
166AMBA_DEVICE(rtc, "dev:rtc", PB11MP_RTC, NULL); 166APB_DEVICE(rtc, "dev:rtc", PB11MP_RTC, NULL);
167AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL); 167APB_DEVICE(sci0, "dev:sci0", SCI, NULL);
168AMBA_DEVICE(uart0, "dev:uart0", PB11MP_UART0, NULL); 168APB_DEVICE(uart0, "dev:uart0", PB11MP_UART0, NULL);
169AMBA_DEVICE(uart1, "dev:uart1", PB11MP_UART1, NULL); 169APB_DEVICE(uart1, "dev:uart1", PB11MP_UART1, NULL);
170AMBA_DEVICE(uart2, "dev:uart2", PB11MP_UART2, NULL); 170APB_DEVICE(uart2, "dev:uart2", PB11MP_UART2, NULL);
171AMBA_DEVICE(ssp0, "dev:ssp0", PB11MP_SSP, &ssp0_plat_data); 171APB_DEVICE(ssp0, "dev:ssp0", PB11MP_SSP, &ssp0_plat_data);
172 172
173/* Primecells on the NEC ISSP chip */ 173/* Primecells on the NEC ISSP chip */
174AMBA_DEVICE(clcd, "issp:clcd", PB11MP_CLCD, &clcd_plat_data); 174AHB_DEVICE(clcd, "issp:clcd", PB11MP_CLCD, &clcd_plat_data);
175AMBA_DEVICE(dmac, "issp:dmac", DMAC, NULL); 175AHB_DEVICE(dmac, "issp:dmac", DMAC, NULL);
176 176
177static struct amba_device *amba_devs[] __initdata = { 177static struct amba_device *amba_devs[] __initdata = {
178 &dmac_device, 178 &dmac_device,
@@ -290,6 +290,21 @@ static void __init gic_init_irq(void)
290 gic_cascade_irq(1, IRQ_TC11MP_PB_IRQ1); 290 gic_cascade_irq(1, IRQ_TC11MP_PB_IRQ1);
291} 291}
292 292
293#ifdef CONFIG_HAVE_ARM_TWD
294static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
295 REALVIEW_TC11MP_TWD_BASE,
296 IRQ_LOCALTIMER);
297
298static void __init realview_pb11mp_twd_init(void)
299{
300 int err = twd_local_timer_register(&twd_local_timer);
301 if (err)
302 pr_err("twd_local_timer_register failed %d\n", err);
303}
304#else
305#define realview_pb11mp_twd_init() do {} while(0)
306#endif
307
293static void __init realview_pb11mp_timer_init(void) 308static void __init realview_pb11mp_timer_init(void)
294{ 309{
295 timer0_va_base = __io_address(REALVIEW_PB11MP_TIMER0_1_BASE); 310 timer0_va_base = __io_address(REALVIEW_PB11MP_TIMER0_1_BASE);
@@ -297,10 +312,8 @@ static void __init realview_pb11mp_timer_init(void)
297 timer2_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE); 312 timer2_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE);
298 timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20; 313 timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20;
299 314
300#ifdef CONFIG_LOCAL_TIMERS
301 twd_base = __io_address(REALVIEW_TC11MP_TWD_BASE);
302#endif
303 realview_timer_init(IRQ_TC11MP_TIMER0_1); 315 realview_timer_init(IRQ_TC11MP_TIMER0_1);
316 realview_pb11mp_twd_init();
304} 317}
305 318
306static struct sys_timer realview_pb11mp_timer = { 319static struct sys_timer realview_pb11mp_timer = {
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index 25b2e59296f..59650174e6e 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -122,52 +122,52 @@ static struct pl022_ssp_controller ssp0_plat_data = {
122 * RealView PBA8Core AMBA devices 122 * RealView PBA8Core AMBA devices
123 */ 123 */
124 124
125#define GPIO2_IRQ { IRQ_PBA8_GPIO2, NO_IRQ } 125#define GPIO2_IRQ { IRQ_PBA8_GPIO2 }
126#define GPIO3_IRQ { IRQ_PBA8_GPIO3, NO_IRQ } 126#define GPIO3_IRQ { IRQ_PBA8_GPIO3 }
127#define AACI_IRQ { IRQ_PBA8_AACI, NO_IRQ } 127#define AACI_IRQ { IRQ_PBA8_AACI }
128#define MMCI0_IRQ { IRQ_PBA8_MMCI0A, IRQ_PBA8_MMCI0B } 128#define MMCI0_IRQ { IRQ_PBA8_MMCI0A, IRQ_PBA8_MMCI0B }
129#define KMI0_IRQ { IRQ_PBA8_KMI0, NO_IRQ } 129#define KMI0_IRQ { IRQ_PBA8_KMI0 }
130#define KMI1_IRQ { IRQ_PBA8_KMI1, NO_IRQ } 130#define KMI1_IRQ { IRQ_PBA8_KMI1 }
131#define PBA8_SMC_IRQ { NO_IRQ, NO_IRQ } 131#define PBA8_SMC_IRQ { }
132#define MPMC_IRQ { NO_IRQ, NO_IRQ } 132#define MPMC_IRQ { }
133#define PBA8_CLCD_IRQ { IRQ_PBA8_CLCD, NO_IRQ } 133#define PBA8_CLCD_IRQ { IRQ_PBA8_CLCD }
134#define DMAC_IRQ { IRQ_PBA8_DMAC, NO_IRQ } 134#define DMAC_IRQ { IRQ_PBA8_DMAC }
135#define SCTL_IRQ { NO_IRQ, NO_IRQ } 135#define SCTL_IRQ { }
136#define PBA8_WATCHDOG_IRQ { IRQ_PBA8_WATCHDOG, NO_IRQ } 136#define PBA8_WATCHDOG_IRQ { IRQ_PBA8_WATCHDOG }
137#define PBA8_GPIO0_IRQ { IRQ_PBA8_GPIO0, NO_IRQ } 137#define PBA8_GPIO0_IRQ { IRQ_PBA8_GPIO0 }
138#define GPIO1_IRQ { IRQ_PBA8_GPIO1, NO_IRQ } 138#define GPIO1_IRQ { IRQ_PBA8_GPIO1 }
139#define PBA8_RTC_IRQ { IRQ_PBA8_RTC, NO_IRQ } 139#define PBA8_RTC_IRQ { IRQ_PBA8_RTC }
140#define SCI_IRQ { IRQ_PBA8_SCI, NO_IRQ } 140#define SCI_IRQ { IRQ_PBA8_SCI }
141#define PBA8_UART0_IRQ { IRQ_PBA8_UART0, NO_IRQ } 141#define PBA8_UART0_IRQ { IRQ_PBA8_UART0 }
142#define PBA8_UART1_IRQ { IRQ_PBA8_UART1, NO_IRQ } 142#define PBA8_UART1_IRQ { IRQ_PBA8_UART1 }
143#define PBA8_UART2_IRQ { IRQ_PBA8_UART2, NO_IRQ } 143#define PBA8_UART2_IRQ { IRQ_PBA8_UART2 }
144#define PBA8_UART3_IRQ { IRQ_PBA8_UART3, NO_IRQ } 144#define PBA8_UART3_IRQ { IRQ_PBA8_UART3 }
145#define PBA8_SSP_IRQ { IRQ_PBA8_SSP, NO_IRQ } 145#define PBA8_SSP_IRQ { IRQ_PBA8_SSP }
146 146
147/* FPGA Primecells */ 147/* FPGA Primecells */
148AMBA_DEVICE(aaci, "fpga:aaci", AACI, NULL); 148APB_DEVICE(aaci, "fpga:aaci", AACI, NULL);
149AMBA_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data); 149APB_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data);
150AMBA_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL); 150APB_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL);
151AMBA_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL); 151APB_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL);
152AMBA_DEVICE(uart3, "fpga:uart3", PBA8_UART3, NULL); 152APB_DEVICE(uart3, "fpga:uart3", PBA8_UART3, NULL);
153 153
154/* DevChip Primecells */ 154/* DevChip Primecells */
155AMBA_DEVICE(smc, "dev:smc", PBA8_SMC, NULL); 155AHB_DEVICE(smc, "dev:smc", PBA8_SMC, NULL);
156AMBA_DEVICE(sctl, "dev:sctl", SCTL, NULL); 156AHB_DEVICE(sctl, "dev:sctl", SCTL, NULL);
157AMBA_DEVICE(wdog, "dev:wdog", PBA8_WATCHDOG, NULL); 157APB_DEVICE(wdog, "dev:wdog", PBA8_WATCHDOG, NULL);
158AMBA_DEVICE(gpio0, "dev:gpio0", PBA8_GPIO0, &gpio0_plat_data); 158APB_DEVICE(gpio0, "dev:gpio0", PBA8_GPIO0, &gpio0_plat_data);
159AMBA_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data); 159APB_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data);
160AMBA_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data); 160APB_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data);
161AMBA_DEVICE(rtc, "dev:rtc", PBA8_RTC, NULL); 161APB_DEVICE(rtc, "dev:rtc", PBA8_RTC, NULL);
162AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL); 162APB_DEVICE(sci0, "dev:sci0", SCI, NULL);
163AMBA_DEVICE(uart0, "dev:uart0", PBA8_UART0, NULL); 163APB_DEVICE(uart0, "dev:uart0", PBA8_UART0, NULL);
164AMBA_DEVICE(uart1, "dev:uart1", PBA8_UART1, NULL); 164APB_DEVICE(uart1, "dev:uart1", PBA8_UART1, NULL);
165AMBA_DEVICE(uart2, "dev:uart2", PBA8_UART2, NULL); 165APB_DEVICE(uart2, "dev:uart2", PBA8_UART2, NULL);
166AMBA_DEVICE(ssp0, "dev:ssp0", PBA8_SSP, &ssp0_plat_data); 166APB_DEVICE(ssp0, "dev:ssp0", PBA8_SSP, &ssp0_plat_data);
167 167
168/* Primecells on the NEC ISSP chip */ 168/* Primecells on the NEC ISSP chip */
169AMBA_DEVICE(clcd, "issp:clcd", PBA8_CLCD, &clcd_plat_data); 169AHB_DEVICE(clcd, "issp:clcd", PBA8_CLCD, &clcd_plat_data);
170AMBA_DEVICE(dmac, "issp:dmac", DMAC, NULL); 170AHB_DEVICE(dmac, "issp:dmac", DMAC, NULL);
171 171
172static struct amba_device *amba_devs[] __initdata = { 172static struct amba_device *amba_devs[] __initdata = {
173 &dmac_device, 173 &dmac_device,
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index ac715645b86..3f2f605624e 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -144,52 +144,52 @@ static struct pl022_ssp_controller ssp0_plat_data = {
144 * RealView PBXCore AMBA devices 144 * RealView PBXCore AMBA devices
145 */ 145 */
146 146
147#define GPIO2_IRQ { IRQ_PBX_GPIO2, NO_IRQ } 147#define GPIO2_IRQ { IRQ_PBX_GPIO2 }
148#define GPIO3_IRQ { IRQ_PBX_GPIO3, NO_IRQ } 148#define GPIO3_IRQ { IRQ_PBX_GPIO3 }
149#define AACI_IRQ { IRQ_PBX_AACI, NO_IRQ } 149#define AACI_IRQ { IRQ_PBX_AACI }
150#define MMCI0_IRQ { IRQ_PBX_MMCI0A, IRQ_PBX_MMCI0B } 150#define MMCI0_IRQ { IRQ_PBX_MMCI0A, IRQ_PBX_MMCI0B }
151#define KMI0_IRQ { IRQ_PBX_KMI0, NO_IRQ } 151#define KMI0_IRQ { IRQ_PBX_KMI0 }
152#define KMI1_IRQ { IRQ_PBX_KMI1, NO_IRQ } 152#define KMI1_IRQ { IRQ_PBX_KMI1 }
153#define PBX_SMC_IRQ { NO_IRQ, NO_IRQ } 153#define PBX_SMC_IRQ { }
154#define MPMC_IRQ { NO_IRQ, NO_IRQ } 154#define MPMC_IRQ { }
155#define PBX_CLCD_IRQ { IRQ_PBX_CLCD, NO_IRQ } 155#define PBX_CLCD_IRQ { IRQ_PBX_CLCD }
156#define DMAC_IRQ { IRQ_PBX_DMAC, NO_IRQ } 156#define DMAC_IRQ { IRQ_PBX_DMAC }
157#define SCTL_IRQ { NO_IRQ, NO_IRQ } 157#define SCTL_IRQ { }
158#define PBX_WATCHDOG_IRQ { IRQ_PBX_WATCHDOG, NO_IRQ } 158#define PBX_WATCHDOG_IRQ { IRQ_PBX_WATCHDOG }
159#define PBX_GPIO0_IRQ { IRQ_PBX_GPIO0, NO_IRQ } 159#define PBX_GPIO0_IRQ { IRQ_PBX_GPIO0 }
160#define GPIO1_IRQ { IRQ_PBX_GPIO1, NO_IRQ } 160#define GPIO1_IRQ { IRQ_PBX_GPIO1 }
161#define PBX_RTC_IRQ { IRQ_PBX_RTC, NO_IRQ } 161#define PBX_RTC_IRQ { IRQ_PBX_RTC }
162#define SCI_IRQ { IRQ_PBX_SCI, NO_IRQ } 162#define SCI_IRQ { IRQ_PBX_SCI }
163#define PBX_UART0_IRQ { IRQ_PBX_UART0, NO_IRQ } 163#define PBX_UART0_IRQ { IRQ_PBX_UART0 }
164#define PBX_UART1_IRQ { IRQ_PBX_UART1, NO_IRQ } 164#define PBX_UART1_IRQ { IRQ_PBX_UART1 }
165#define PBX_UART2_IRQ { IRQ_PBX_UART2, NO_IRQ } 165#define PBX_UART2_IRQ { IRQ_PBX_UART2 }
166#define PBX_UART3_IRQ { IRQ_PBX_UART3, NO_IRQ } 166#define PBX_UART3_IRQ { IRQ_PBX_UART3 }
167#define PBX_SSP_IRQ { IRQ_PBX_SSP, NO_IRQ } 167#define PBX_SSP_IRQ { IRQ_PBX_SSP }
168 168
169/* FPGA Primecells */ 169/* FPGA Primecells */
170AMBA_DEVICE(aaci, "fpga:aaci", AACI, NULL); 170APB_DEVICE(aaci, "fpga:aaci", AACI, NULL);
171AMBA_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data); 171APB_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data);
172AMBA_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL); 172APB_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL);
173AMBA_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL); 173APB_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL);
174AMBA_DEVICE(uart3, "fpga:uart3", PBX_UART3, NULL); 174APB_DEVICE(uart3, "fpga:uart3", PBX_UART3, NULL);
175 175
176/* DevChip Primecells */ 176/* DevChip Primecells */
177AMBA_DEVICE(smc, "dev:smc", PBX_SMC, NULL); 177AHB_DEVICE(smc, "dev:smc", PBX_SMC, NULL);
178AMBA_DEVICE(sctl, "dev:sctl", SCTL, NULL); 178AHB_DEVICE(sctl, "dev:sctl", SCTL, NULL);
179AMBA_DEVICE(wdog, "dev:wdog", PBX_WATCHDOG, NULL); 179APB_DEVICE(wdog, "dev:wdog", PBX_WATCHDOG, NULL);
180AMBA_DEVICE(gpio0, "dev:gpio0", PBX_GPIO0, &gpio0_plat_data); 180APB_DEVICE(gpio0, "dev:gpio0", PBX_GPIO0, &gpio0_plat_data);
181AMBA_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data); 181APB_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data);
182AMBA_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data); 182APB_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data);
183AMBA_DEVICE(rtc, "dev:rtc", PBX_RTC, NULL); 183APB_DEVICE(rtc, "dev:rtc", PBX_RTC, NULL);
184AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL); 184APB_DEVICE(sci0, "dev:sci0", SCI, NULL);
185AMBA_DEVICE(uart0, "dev:uart0", PBX_UART0, NULL); 185APB_DEVICE(uart0, "dev:uart0", PBX_UART0, NULL);
186AMBA_DEVICE(uart1, "dev:uart1", PBX_UART1, NULL); 186APB_DEVICE(uart1, "dev:uart1", PBX_UART1, NULL);
187AMBA_DEVICE(uart2, "dev:uart2", PBX_UART2, NULL); 187APB_DEVICE(uart2, "dev:uart2", PBX_UART2, NULL);
188AMBA_DEVICE(ssp0, "dev:ssp0", PBX_SSP, &ssp0_plat_data); 188APB_DEVICE(ssp0, "dev:ssp0", PBX_SSP, &ssp0_plat_data);
189 189
190/* Primecells on the NEC ISSP chip */ 190/* Primecells on the NEC ISSP chip */
191AMBA_DEVICE(clcd, "issp:clcd", PBX_CLCD, &clcd_plat_data); 191AHB_DEVICE(clcd, "issp:clcd", PBX_CLCD, &clcd_plat_data);
192AMBA_DEVICE(dmac, "issp:dmac", DMAC, NULL); 192AHB_DEVICE(dmac, "issp:dmac", DMAC, NULL);
193 193
194static struct amba_device *amba_devs[] __initdata = { 194static struct amba_device *amba_devs[] __initdata = {
195 &dmac_device, 195 &dmac_device,
@@ -298,6 +298,21 @@ static void __init gic_init_irq(void)
298 } 298 }
299} 299}
300 300
301#ifdef CONFIG_HAVE_ARM_TWD
302static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
303 REALVIEW_PBX_TILE_TWD_BASE,
304 IRQ_LOCALTIMER);
305
306static void __init realview_pbx_twd_init(void)
307{
308 int err = twd_local_timer_register(&twd_local_timer);
309 if (err)
310 pr_err("twd_local_timer_register failed %d\n", err);
311}
312#else
313#define realview_pbx_twd_init() do { } while(0)
314#endif
315
301static void __init realview_pbx_timer_init(void) 316static void __init realview_pbx_timer_init(void)
302{ 317{
303 timer0_va_base = __io_address(REALVIEW_PBX_TIMER0_1_BASE); 318 timer0_va_base = __io_address(REALVIEW_PBX_TIMER0_1_BASE);
@@ -305,11 +320,8 @@ static void __init realview_pbx_timer_init(void)
305 timer2_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE); 320 timer2_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE);
306 timer3_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE) + 0x20; 321 timer3_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE) + 0x20;
307 322
308#ifdef CONFIG_LOCAL_TIMERS
309 if (core_tile_pbx11mp() || core_tile_pbxa9mp())
310 twd_base = __io_address(REALVIEW_PBX_TILE_TWD_BASE);
311#endif
312 realview_timer_init(IRQ_PBX_TIMER0_1); 323 realview_timer_init(IRQ_PBX_TIMER0_1);
324 realview_pbx_twd_init();
313} 325}
314 326
315static struct sys_timer realview_pbx_timer = { 327static struct sys_timer realview_pbx_timer = {
diff --git a/arch/arm/mach-rpc/Makefile b/arch/arm/mach-rpc/Makefile
index aa77bc9efbb..dfa405c0cfd 100644
--- a/arch/arm/mach-rpc/Makefile
+++ b/arch/arm/mach-rpc/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := dma.o irq.o riscpc.o 7obj-y := dma.o fiq.o irq.o riscpc.o
8obj-m := 8obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
diff --git a/arch/arm/mach-rpc/fiq.S b/arch/arm/mach-rpc/fiq.S
new file mode 100644
index 00000000000..48ddd57db16
--- /dev/null
+++ b/arch/arm/mach-rpc/fiq.S
@@ -0,0 +1,16 @@
1#include <linux/linkage.h>
2#include <asm/assembler.h>
3#include <mach/hardware.h>
4#include <mach/entry-macro.S>
5
6 .text
7
8 .global rpc_default_fiq_end
9ENTRY(rpc_default_fiq_start)
10 mov r12, #ioc_base_high
11 .if ioc_base_low
12 orr r12, r12, #ioc_base_low
13 .endif
14 strb r12, [r12, #0x38] @ Disable FIQ register
15 subs pc, lr, #4
16rpc_default_fiq_end:
diff --git a/arch/arm/mach-rpc/include/mach/entry-macro.S b/arch/arm/mach-rpc/include/mach/entry-macro.S
index 4e7e5414409..7178368d706 100644
--- a/arch/arm/mach-rpc/include/mach/entry-macro.S
+++ b/arch/arm/mach-rpc/include/mach/entry-macro.S
@@ -10,7 +10,3 @@
10 orr \base, \base, #ioc_base_low 10 orr \base, \base, #ioc_base_low
11 .endif 11 .endif
12 .endm 12 .endm
13
14 .macro arch_ret_to_user, tmp1, tmp2
15 .endm
16
diff --git a/arch/arm/mach-rpc/include/mach/system.h b/arch/arm/mach-rpc/include/mach/system.h
deleted file mode 100644
index 359bab94b6a..00000000000
--- a/arch/arm/mach-rpc/include/mach/system.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-rpc/include/mach/system.h
3 *
4 * Copyright (C) 1996-1999 Russell King.
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 */
10static inline void arch_idle(void)
11{
12 cpu_do_idle();
13}
diff --git a/arch/arm/mach-rpc/irq.c b/arch/arm/mach-rpc/irq.c
index 2e1b5309fba..cf0e669eaf1 100644
--- a/arch/arm/mach-rpc/irq.c
+++ b/arch/arm/mach-rpc/irq.c
@@ -5,6 +5,7 @@
5#include <asm/mach/irq.h> 5#include <asm/mach/irq.h>
6#include <asm/hardware/iomd.h> 6#include <asm/hardware/iomd.h>
7#include <asm/irq.h> 7#include <asm/irq.h>
8#include <asm/fiq.h>
8 9
9static void iomd_ack_irq_a(struct irq_data *d) 10static void iomd_ack_irq_a(struct irq_data *d)
10{ 11{
@@ -112,6 +113,8 @@ static struct irq_chip iomd_fiq_chip = {
112 .irq_unmask = iomd_unmask_irq_fiq, 113 .irq_unmask = iomd_unmask_irq_fiq,
113}; 114};
114 115
116extern unsigned char rpc_default_fiq_start, rpc_default_fiq_end;
117
115void __init rpc_init_irq(void) 118void __init rpc_init_irq(void)
116{ 119{
117 unsigned int irq, flags; 120 unsigned int irq, flags;
@@ -121,6 +124,9 @@ void __init rpc_init_irq(void)
121 iomd_writeb(0, IOMD_FIQMASK); 124 iomd_writeb(0, IOMD_FIQMASK);
122 iomd_writeb(0, IOMD_DMAMASK); 125 iomd_writeb(0, IOMD_DMAMASK);
123 126
127 set_fiq_handler(&rpc_default_fiq_start,
128 &rpc_default_fiq_end - &rpc_default_fiq_start);
129
124 for (irq = 0; irq < NR_IRQS; irq++) { 130 for (irq = 0; irq < NR_IRQS; irq++) {
125 flags = IRQF_VALID; 131 flags = IRQF_VALID;
126 132
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index 5261a7ed099..68d89cb96af 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -2,42 +2,6 @@
2# 2#
3# Licensed under GPLv2 3# Licensed under GPLv2
4 4
5config CPU_S3C2410
6 bool
7 depends on ARCH_S3C2410
8 select CPU_ARM920T
9 select S3C2410_CLOCK
10 select CPU_LLSERIAL_S3C2410
11 select S3C2410_PM if PM
12 select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
13 help
14 Support for S3C2410 and S3C2410A family from the S3C24XX line
15 of Samsung Mobile CPUs.
16
17config CPU_S3C2410_DMA
18 bool
19 depends on S3C2410_DMA && (CPU_S3C2410 || CPU_S3C2442)
20 default y if CPU_S3C2410 || CPU_S3C2442
21 help
22 DMA device selection for S3C2410 and compatible CPUs
23
24config S3C2410_PM
25 bool
26 help
27 Power Management code common to S3C2410 and better
28
29config SIMTEC_NOR
30 bool
31 help
32 Internal node to specify machine has simtec NOR mapping
33
34config MACH_BAST_IDE
35 bool
36 select HAVE_PATA_PLATFORM
37 help
38 Internal node for machines with an BAST style IDE
39 interface
40
41# cpu frequency scaling support 5# cpu frequency scaling support
42 6
43config S3C2410_CPUFREQ 7config S3C2410_CPUFREQ
@@ -54,121 +18,3 @@ config S3C2410_PLLTABLE
54 help 18 help
55 Select the PLL table for the S3C2410 19 Select the PLL table for the S3C2410
56 20
57menu "S3C2410 Machines"
58
59config ARCH_SMDK2410
60 bool "SMDK2410/A9M2410"
61 select CPU_S3C2410
62 select MACH_SMDK
63 help
64 Say Y here if you are using the SMDK2410 or the derived module A9M2410
65 <http://www.fsforth.de>
66
67config ARCH_H1940
68 bool "IPAQ H1940"
69 select CPU_S3C2410
70 select PM_H1940 if PM
71 select S3C_DEV_USB_HOST
72 select S3C_DEV_NAND
73 select S3C2410_SETUP_TS
74 help
75 Say Y here if you are using the HP IPAQ H1940
76
77config H1940BT
78 tristate "Control the state of H1940 bluetooth chip"
79 depends on ARCH_H1940
80 select RFKILL
81 help
82 This is a simple driver that is able to control
83 the state of built in bluetooth chip on h1940.
84
85config PM_H1940
86 bool
87 help
88 Internal node for H1940 and related PM
89
90config MACH_N30
91 bool "Acer N30 family"
92 select CPU_S3C2410
93 select MACH_N35
94 select S3C_DEV_USB_HOST
95 select S3C_DEV_NAND
96 help
97 Say Y here if you want suppt for the Acer N30, Acer N35,
98 Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs.
99
100config MACH_N35
101 bool
102 help
103 Internal node in order to enable support for Acer N35 if Acer N30 is
104 selected.
105
106config ARCH_BAST
107 bool "Simtec Electronics BAST (EB2410ITX)"
108 select CPU_S3C2410
109 select S3C2410_IOTIMING if S3C2410_CPUFREQ
110 select PM_SIMTEC if PM
111 select SIMTEC_NOR
112 select MACH_BAST_IDE
113 select S3C24XX_DCLK
114 select ISA
115 select S3C_DEV_HWMON
116 select S3C_DEV_USB_HOST
117 select S3C_DEV_NAND
118 help
119 Say Y here if you are using the Simtec Electronics EB2410ITX
120 development board (also known as BAST)
121
122config MACH_OTOM
123 bool "NexVision OTOM Board"
124 select CPU_S3C2410
125 select S3C_DEV_USB_HOST
126 select S3C_DEV_NAND
127 help
128 Say Y here if you are using the Nex Vision OTOM board
129
130config MACH_AML_M5900
131 bool "AML M5900 Series"
132 select CPU_S3C2410
133 select PM_SIMTEC if PM
134 select S3C_DEV_USB_HOST
135 help
136 Say Y here if you are using the American Microsystems M5900 Series
137 <http://www.amltd.com>
138
139config BAST_PC104_IRQ
140 bool "BAST PC104 IRQ support"
141 depends on ARCH_BAST
142 default y
143 help
144 Say Y here to enable the PC104 IRQ routing on the
145 Simtec BAST (EB2410ITX)
146
147config MACH_TCT_HAMMER
148 bool "TCT Hammer Board"
149 select CPU_S3C2410
150 select S3C_DEV_USB_HOST
151 help
152 Say Y here if you are using the TinCanTools Hammer Board
153 <http://www.tincantools.com>
154
155config MACH_VR1000
156 bool "Thorcom VR1000"
157 select PM_SIMTEC if PM
158 select S3C24XX_DCLK
159 select SIMTEC_NOR
160 select MACH_BAST_IDE
161 select CPU_S3C2410
162 select S3C_DEV_USB_HOST
163 help
164 Say Y here if you are using the Thorcom VR1000 board.
165
166config MACH_QT2410
167 bool "QT2410"
168 select CPU_S3C2410
169 select S3C_DEV_USB_HOST
170 select S3C_DEV_NAND
171 help
172 Say Y here if you are using the Armzone QT2410
173
174endmenu
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index 782fd81144e..6b9a316e004 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -9,32 +9,6 @@ obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
11 11
12obj-$(CONFIG_CPU_S3C2410) += s3c2410.o
13obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o
14obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o
15obj-$(CONFIG_S3C2410_PM) += pm.o sleep.o
16obj-$(CONFIG_S3C2410_CPUFREQ) += cpu-freq.o 12obj-$(CONFIG_S3C2410_CPUFREQ) += cpu-freq.o
17obj-$(CONFIG_S3C2410_PLLTABLE) += pll.o 13obj-$(CONFIG_S3C2410_PLLTABLE) += pll.o
18 14
19# Machine support
20
21obj-$(CONFIG_ARCH_SMDK2410) += mach-smdk2410.o
22obj-$(CONFIG_ARCH_H1940) += mach-h1940.o
23obj-$(CONFIG_H1940BT) += h1940-bluetooth.o
24obj-$(CONFIG_PM_H1940) += pm-h1940.o
25obj-$(CONFIG_MACH_N30) += mach-n30.o
26obj-$(CONFIG_ARCH_BAST) += mach-bast.o usb-simtec.o
27obj-$(CONFIG_MACH_OTOM) += mach-otom.o
28obj-$(CONFIG_MACH_AML_M5900) += mach-amlm5900.o
29obj-$(CONFIG_BAST_PC104_IRQ) += bast-irq.o
30obj-$(CONFIG_MACH_TCT_HAMMER) += mach-tct_hammer.o
31obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o usb-simtec.o
32obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o
33
34# Common bits of machine support
35
36obj-$(CONFIG_SIMTEC_NOR) += nor-simtec.o
37
38# machine additions
39
40obj-$(CONFIG_MACH_BAST_IDE) += bast-ide.o
diff --git a/arch/arm/mach-s3c2410/common.h b/arch/arm/mach-s3c2410/common.h
deleted file mode 100644
index f65dc806296..00000000000
--- a/arch/arm/mach-s3c2410/common.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Header for S3C2410 machines
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ARCH_ARM_MACH_S3C2410_COMMON_H
13#define __ARCH_ARM_MACH_S3C2410_COMMON_H
14
15void s3c2410_restart(char mode, const char *cmd);
16
17#endif /* __ARCH_ARM_MACH_S3C2410_COMMON_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/spi.h b/arch/arm/mach-s3c2410/include/mach/spi.h
deleted file mode 100644
index 4d9588373aa..00000000000
--- a/arch/arm/mach-s3c2410/include/mach/spi.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/spi.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - SPI Controller platform_device info
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_SPI_H
14#define __ASM_ARCH_SPI_H __FILE__
15
16struct s3c2410_spi_info {
17 int pin_cs; /* simple gpio cs */
18 unsigned int num_cs; /* total chipselects */
19 int bus_num; /* bus number to use. */
20
21 unsigned int use_fiq:1; /* use fiq */
22
23 void (*gpio_setup)(struct s3c2410_spi_info *spi, int enable);
24 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
25};
26
27/* Standard setup / suspend routines for SPI GPIO pins. */
28
29extern void s3c24xx_spi_gpiocfg_bus0_gpe11_12_13(struct s3c2410_spi_info *spi,
30 int enable);
31
32extern void s3c24xx_spi_gpiocfg_bus1_gpg5_6_7(struct s3c2410_spi_info *spi,
33 int enable);
34
35extern void s3c24xx_spi_gpiocfg_bus1_gpd8_9_10(struct s3c2410_spi_info *spi,
36 int enable);
37
38#endif /* __ASM_ARCH_SPI_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/system.h b/arch/arm/mach-s3c2410/include/mach/system.h
deleted file mode 100644
index 5e215c1a5c8..00000000000
--- a/arch/arm/mach-s3c2410/include/mach/system.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/system.h
2 *
3 * Copyright (c) 2003 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - System function defines and includes
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/io.h>
14#include <mach/hardware.h>
15
16#include <mach/map.h>
17#include <mach/idle.h>
18
19#include <mach/regs-clock.h>
20
21void (*s3c24xx_idle)(void);
22
23void s3c24xx_default_idle(void)
24{
25 unsigned long tmp;
26 int i;
27
28 /* idle the system by using the idle mode which will wait for an
29 * interrupt to happen before restarting the system.
30 */
31
32 /* Warning: going into idle state upsets jtag scanning */
33
34 __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
35 S3C2410_CLKCON);
36
37 /* the samsung port seems to do a loop and then unset idle.. */
38 for (i = 0; i < 50; i++) {
39 tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
40 }
41
42 /* this bit is not cleared on re-start... */
43
44 __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
45 S3C2410_CLKCON);
46}
47
48static void arch_idle(void)
49{
50 if (s3c24xx_idle != NULL)
51 (s3c24xx_idle)();
52 else
53 s3c24xx_default_idle();
54}
diff --git a/arch/arm/mach-s3c2410/usb-simtec.h b/arch/arm/mach-s3c2410/usb-simtec.h
deleted file mode 100644
index 03842ede9e7..00000000000
--- a/arch/arm/mach-s3c2410/usb-simtec.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/* linux/arch/arm/mach-s3c2410/usb-simtec.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * http://www.simtec.co.uk/products/EB2410ITX/
7 *
8 * Simtec BAST and Thorcom VR1000 USB port support functions
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
15extern int usb_simtec_init(void);
16
diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig
index b8b9029e9f2..c5256f4e90b 100644
--- a/arch/arm/mach-s3c2412/Kconfig
+++ b/arch/arm/mach-s3c2412/Kconfig
@@ -2,41 +2,6 @@
2# 2#
3# Licensed under GPLv2 3# Licensed under GPLv2
4 4
5config CPU_S3C2412
6 bool
7 depends on ARCH_S3C2410
8 select CPU_ARM926T
9 select CPU_LLSERIAL_S3C2440
10 select S3C2412_PM if PM
11 select S3C2412_DMA if S3C2410_DMA
12 help
13 Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
14
15config CPU_S3C2412_ONLY
16 bool
17 depends on ARCH_S3C2410 && !CPU_S3C2410 && \
18 !CPU_S3C2416 && !CPU_S3C2440 && !CPU_S3C2442 && \
19 !CPU_S3C2443 && CPU_S3C2412
20 default y if CPU_S3C2412
21
22config S3C2412_DMA
23 bool
24 depends on CPU_S3C2412
25 help
26 Internal config node for S3C2412 DMA support
27
28config S3C2412_PM
29 bool
30 select S3C2412_PM_SLEEP
31 help
32 Internal config node to apply S3C2412 power management
33
34config S3C2412_PM_SLEEP
35 bool
36 help
37 Internal config node to apply sleep for S3C2412 power management.
38 Can be selected by another SoCs with similar sleep procedure.
39
40# Note, the S3C2412 IOtiming support is in plat-s3c24xx 5# Note, the S3C2412 IOtiming support is in plat-s3c24xx
41 6
42config S3C2412_CPUFREQ 7config S3C2412_CPUFREQ
@@ -46,53 +11,3 @@ config S3C2412_CPUFREQ
46 default y 11 default y
47 help 12 help
48 CPU Frequency scaling support for S3C2412 and S3C2413 SoC CPUs. 13 CPU Frequency scaling support for S3C2412 and S3C2413 SoC CPUs.
49
50menu "S3C2412 Machines"
51
52config MACH_JIVE
53 bool "Logitech Jive"
54 select CPU_S3C2412
55 select S3C_DEV_USB_HOST
56 select S3C_DEV_NAND
57 help
58 Say Y here if you are using the Logitech Jive.
59
60config MACH_JIVE_SHOW_BOOTLOADER
61 bool "Allow access to bootloader partitions in MTD (EXPERIMENTAL)"
62 depends on MACH_JIVE && EXPERIMENTAL
63
64config MACH_SMDK2413
65 bool "SMDK2413"
66 select CPU_S3C2412
67 select MACH_S3C2413
68 select MACH_SMDK
69 select S3C_DEV_USB_HOST
70 select S3C_DEV_NAND
71 help
72 Say Y here if you are using an SMDK2413
73
74config MACH_S3C2413
75 bool
76 help
77 Internal node for S3C2413 version of SMDK2413, so that
78 machine_is_s3c2413() will work when MACH_SMDK2413 is
79 selected
80
81config MACH_SMDK2412
82 bool "SMDK2412"
83 select MACH_SMDK2413
84 help
85 Say Y here if you are using an SMDK2412
86
87 Note, this shares support with SMDK2413, so will automatically
88 select MACH_SMDK2413.
89
90config MACH_VSTMS
91 bool "VMSTMS"
92 select CPU_S3C2412
93 select S3C_DEV_USB_HOST
94 select S3C_DEV_NAND
95 help
96 Say Y here if you are using an VSTMS board
97
98endmenu
diff --git a/arch/arm/mach-s3c2412/Makefile b/arch/arm/mach-s3c2412/Makefile
index 7e4d95fa8a9..41a6c279fb2 100644
--- a/arch/arm/mach-s3c2412/Makefile
+++ b/arch/arm/mach-s3c2412/Makefile
@@ -9,16 +9,4 @@ obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
11 11
12obj-$(CONFIG_CPU_S3C2412) += s3c2412.o
13obj-$(CONFIG_CPU_S3C2412) += irq.o
14obj-$(CONFIG_CPU_S3C2412) += clock.o
15obj-$(CONFIG_S3C2412_DMA) += dma.o
16obj-$(CONFIG_S3C2412_PM) += pm.o
17obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep.o
18obj-$(CONFIG_S3C2412_CPUFREQ) += cpu-freq.o 12obj-$(CONFIG_S3C2412_CPUFREQ) += cpu-freq.o
19
20# Machine support
21
22obj-$(CONFIG_MACH_JIVE) += mach-jive.o
23obj-$(CONFIG_MACH_SMDK2413) += mach-smdk2413.o
24obj-$(CONFIG_MACH_VSTMS) += mach-vstms.o
diff --git a/arch/arm/mach-s3c2416/Kconfig b/arch/arm/mach-s3c2416/Kconfig
deleted file mode 100644
index 84c7b03e5a3..00000000000
--- a/arch/arm/mach-s3c2416/Kconfig
+++ /dev/null
@@ -1,60 +0,0 @@
1# arch/arm/mach-s3c2416/Kconfig
2#
3# Copyright 2009 Yauhen Kharuzhy <jekhor@gmail.com>
4#
5# Licensed under GPLv2
6
7# note, this also supports the S3C2450 which is so similar it has the same
8# ID code as the S3C2416.
9
10config CPU_S3C2416
11 bool
12 depends on ARCH_S3C2410
13 select CPU_ARM926T
14 select S3C2416_DMA if S3C2410_DMA
15 select CPU_LLSERIAL_S3C2440
16 select SAMSUNG_CLKSRC
17 select S3C2443_CLOCK
18 help
19 Support for the S3C2416 SoC from the S3C24XX line
20
21config S3C2416_DMA
22 bool
23 depends on CPU_S3C2416
24 help
25 Internal config node for S3C2416 DMA support
26
27config S3C2416_PM
28 bool
29 select S3C2412_PM_SLEEP
30 help
31 Internal config node to apply S3C2416 power management
32
33config S3C2416_SETUP_SDHCI
34 bool
35 select S3C2416_SETUP_SDHCI_GPIO
36 help
37 Internal helper functions for S3C2416 based SDHCI systems
38
39config S3C2416_SETUP_SDHCI_GPIO
40 bool
41 help
42 Common setup code for SDHCI gpio.
43
44menu "S3C2416 Machines"
45
46config MACH_SMDK2416
47 bool "SMDK2416"
48 select CPU_S3C2416
49 select MACH_SMDK
50 select S3C_DEV_FB
51 select S3C_DEV_HSMMC
52 select S3C_DEV_HSMMC1
53 select S3C_DEV_NAND
54 select S3C_DEV_USB_HOST
55 select S3C2416_SETUP_SDHCI
56 select S3C2416_PM if PM
57 help
58 Say Y here if you are using an SMDK2416
59
60endmenu
diff --git a/arch/arm/mach-s3c2416/Makefile b/arch/arm/mach-s3c2416/Makefile
deleted file mode 100644
index ca0cd227f87..00000000000
--- a/arch/arm/mach-s3c2416/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
1# arch/arm/mach-s3c2416/Makefile
2#
3# Copyright 2009 Yauhen Kharuzhy <jekhor@gmail.com>
4#
5# Licensed under GPLv2
6
7obj-y :=
8obj-m :=
9obj-n :=
10obj- :=
11
12obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock.o
13obj-$(CONFIG_CPU_S3C2416) += irq.o
14obj-$(CONFIG_S3C2416_PM) += pm.o
15#obj-$(CONFIG_S3C2416_DMA) += dma.o
16
17# Device setup
18obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
19
20# Machine support
21
22obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index 914e620f125..ece7a10fe3c 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -2,35 +2,6 @@
2# 2#
3# Licensed under GPLv2 3# Licensed under GPLv2
4 4
5config CPU_S3C2440
6 bool
7 select CPU_ARM920T
8 select S3C2410_CLOCK
9 select S3C2410_PM if PM
10 select S3C2440_DMA if S3C2410_DMA
11 select CPU_S3C244X
12 select CPU_LLSERIAL_S3C2440
13 help
14 Support for S3C2440 Samsung Mobile CPU based systems.
15
16config CPU_S3C2442
17 bool
18 select CPU_ARM920T
19 select S3C2410_CLOCK
20 select S3C2410_PM if PM
21 select CPU_S3C244X
22 select CPU_LLSERIAL_S3C2440
23 help
24 Support for S3C2442 Samsung Mobile CPU based systems.
25
26config CPU_S3C244X
27 bool
28 depends on CPU_S3C2440 || CPU_S3C2442
29 help
30 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems.
31
32
33
34config S3C2440_CPUFREQ 5config S3C2440_CPUFREQ
35 bool "S3C2440/S3C2442 CPU Frequency scaling support" 6 bool "S3C2440/S3C2442 CPU Frequency scaling support"
36 depends on CPU_FREQ_S3C24XX && (CPU_S3C2440 || CPU_S3C2442) 7 depends on CPU_FREQ_S3C24XX && (CPU_S3C2440 || CPU_S3C2442)
@@ -64,139 +35,3 @@ config S3C2440_PLL_16934400
64 default y if CPU_FREQ_S3C24XX_PLL 35 default y if CPU_FREQ_S3C24XX_PLL
65 help 36 help
66 PLL tables for S3C2440 or S3C2442 CPUs with 16.934MHz crystals. 37 PLL tables for S3C2440 or S3C2442 CPUs with 16.934MHz crystals.
67
68config S3C2440_DMA
69 bool
70 depends on CPU_S3C2440
71 help
72 Support for S3C2440 specific DMA code5A
73
74menu "S3C2440 and S3C2442 Machines"
75
76config MACH_ANUBIS
77 bool "Simtec Electronics ANUBIS"
78 select CPU_S3C2440
79 select S3C24XX_DCLK
80 select PM_SIMTEC if PM
81 select HAVE_PATA_PLATFORM
82 select S3C24XX_GPIO_EXTRA64
83 select S3C2440_XTAL_12000000
84 select S3C_DEV_USB_HOST
85 help
86 Say Y here if you are using the Simtec Electronics ANUBIS
87 development system
88
89config MACH_NEO1973_GTA02
90 bool "Openmoko GTA02 / Freerunner phone"
91 select CPU_S3C2442
92 select MFD_PCF50633
93 select PCF50633_GPIO
94 select I2C
95 select POWER_SUPPLY
96 select MACH_NEO1973
97 select S3C2410_PWM
98 select S3C_DEV_USB_HOST
99 help
100 Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone
101
102config MACH_OSIRIS
103 bool "Simtec IM2440D20 (OSIRIS) module"
104 select CPU_S3C2440
105 select S3C24XX_DCLK
106 select PM_SIMTEC if PM
107 select S3C24XX_GPIO_EXTRA128
108 select S3C2440_XTAL_12000000
109 select S3C2410_IOTIMING if S3C2440_CPUFREQ
110 select S3C_DEV_USB_HOST
111 select S3C_DEV_NAND
112 help
113 Say Y here if you are using the Simtec IM2440D20 module, also
114 known as the Osiris.
115
116config MACH_OSIRIS_DVS
117 tristate "Simtec IM2440D20 (OSIRIS) Dynamic Voltage Scaling driver"
118 depends on MACH_OSIRIS
119 select TPS65010
120 help
121 Say Y/M here if you want to have dynamic voltage scaling support
122 on the Simtec IM2440D20 (OSIRIS) module via the TPS65011.
123
124 The DVS driver alters the voltage supplied to the ARM core
125 depending on the frequency it is running at. The driver itself
126 does not do any of the frequency alteration, which is left up
127 to the cpufreq driver.
128
129config MACH_RX3715
130 bool "HP iPAQ rx3715"
131 select CPU_S3C2440
132 select S3C2440_XTAL_16934400
133 select PM_H1940 if PM
134 select S3C_DEV_NAND
135 help
136 Say Y here if you are using the HP iPAQ rx3715.
137
138config ARCH_S3C2440
139 bool "SMDK2440"
140 select CPU_S3C2440
141 select S3C2440_XTAL_16934400
142 select MACH_SMDK
143 select S3C_DEV_USB_HOST
144 select S3C_DEV_NAND
145 help
146 Say Y here if you are using the SMDK2440.
147
148config MACH_NEXCODER_2440
149 bool "NexVision NEXCODER 2440 Light Board"
150 select CPU_S3C2440
151 select S3C2440_XTAL_12000000
152 select S3C_DEV_USB_HOST
153 select S3C_DEV_NAND
154 help
155 Say Y here if you are using the Nex Vision NEXCODER 2440 Light Board
156
157config SMDK2440_CPU2440
158 bool "SMDK2440 with S3C2440 CPU module"
159 default y if ARCH_S3C2440
160 select S3C2440_XTAL_16934400
161 select CPU_S3C2440
162
163config SMDK2440_CPU2442
164 bool "SMDM2440 with S3C2442 CPU module"
165 select CPU_S3C2442
166
167config MACH_AT2440EVB
168 bool "Avantech AT2440EVB development board"
169 select CPU_S3C2440
170 select S3C_DEV_USB_HOST
171 select S3C_DEV_NAND
172 help
173 Say Y here if you are using the AT2440EVB development board
174
175config MACH_MINI2440
176 bool "MINI2440 development board"
177 select CPU_S3C2440
178 select EEPROM_AT24
179 select NEW_LEDS
180 select LEDS_CLASS
181 select LEDS_TRIGGER
182 select LEDS_TRIGGER_BACKLIGHT
183 select S3C_DEV_NAND
184 select S3C_DEV_USB_HOST
185 help
186 Say Y here to select support for the MINI2440. Is a 10cm x 10cm board
187 available via various sources. It can come with a 3.5" or 7" touch LCD.
188
189config MACH_RX1950
190 bool "HP iPAQ rx1950"
191 select CPU_S3C2442
192 select S3C24XX_DCLK
193 select PM_H1940 if PM
194 select I2C
195 select S3C2410_PWM
196 select S3C_DEV_NAND
197 select S3C2410_IOTIMING if S3C2440_CPUFREQ
198 select S3C2440_XTAL_16934400
199 help
200 Say Y here if you're using HP iPAQ rx1950
201
202endmenu
diff --git a/arch/arm/mach-s3c2440/Makefile b/arch/arm/mach-s3c2440/Makefile
index d5440fa34b0..c4609243981 100644
--- a/arch/arm/mach-s3c2440/Makefile
+++ b/arch/arm/mach-s3c2440/Makefile
@@ -9,33 +9,9 @@ obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
11 11
12obj-$(CONFIG_CPU_S3C2440) += s3c2440.o dsc.o 12obj-$(CONFIG_CPU_S3C2440) += dsc.o
13obj-$(CONFIG_CPU_S3C2442) += s3c2442.o
14 13
15obj-$(CONFIG_CPU_S3C2440) += irq.o
16obj-$(CONFIG_CPU_S3C2440) += clock.o
17obj-$(CONFIG_S3C2440_DMA) += dma.o
18
19obj-$(CONFIG_CPU_S3C244X) += s3c244x.o
20obj-$(CONFIG_CPU_S3C244X) += s3c244x-irq.o
21obj-$(CONFIG_CPU_S3C244X) += s3c244x-clock.o
22obj-$(CONFIG_S3C2440_CPUFREQ) += s3c2440-cpufreq.o 14obj-$(CONFIG_S3C2440_CPUFREQ) += s3c2440-cpufreq.o
23 15
24obj-$(CONFIG_S3C2440_PLL_12000000) += s3c2440-pll-12000000.o 16obj-$(CONFIG_S3C2440_PLL_12000000) += s3c2440-pll-12000000.o
25obj-$(CONFIG_S3C2440_PLL_16934400) += s3c2440-pll-16934400.o 17obj-$(CONFIG_S3C2440_PLL_16934400) += s3c2440-pll-16934400.o
26
27# Machine support
28
29obj-$(CONFIG_MACH_ANUBIS) += mach-anubis.o
30obj-$(CONFIG_MACH_OSIRIS) += mach-osiris.o
31obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o
32obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o
33obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o
34obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o
35obj-$(CONFIG_MACH_MINI2440) += mach-mini2440.o
36obj-$(CONFIG_MACH_NEO1973_GTA02) += mach-gta02.o
37obj-$(CONFIG_MACH_RX1950) += mach-rx1950.o
38
39# extra machine support
40
41obj-$(CONFIG_MACH_OSIRIS_DVS) += mach-osiris-dvs.o
diff --git a/arch/arm/mach-s3c2440/common.h b/arch/arm/mach-s3c2440/common.h
deleted file mode 100644
index 0c1eb1dfc53..00000000000
--- a/arch/arm/mach-s3c2440/common.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Header for S3C2440 machines
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ARCH_ARM_MACH_S3C2440_COMMON_H
13#define __ARCH_ARM_MACH_S3C2440_COMMON_H
14
15void s3c244x_restart(char mode, const char *cmd);
16
17#endif /* __ARCH_ARM_MACH_S3C2440_COMMON_H */
diff --git a/arch/arm/mach-s3c2443/Kconfig b/arch/arm/mach-s3c2443/Kconfig
deleted file mode 100644
index 8814031516c..00000000000
--- a/arch/arm/mach-s3c2443/Kconfig
+++ /dev/null
@@ -1,32 +0,0 @@
1# Copyright 2007 Simtec Electronics
2#
3# Licensed under GPLv2
4
5config CPU_S3C2443
6 bool
7 depends on ARCH_S3C2410
8 select CPU_ARM920T
9 select S3C2443_DMA if S3C2410_DMA
10 select CPU_LLSERIAL_S3C2440
11 select SAMSUNG_CLKSRC
12 select S3C2443_CLOCK
13 help
14 Support for the S3C2443 SoC from the S3C24XX line
15
16config S3C2443_DMA
17 bool
18 depends on CPU_S3C2443
19 help
20 Internal config node for S3C2443 DMA support
21
22menu "S3C2443 Machines"
23
24config MACH_SMDK2443
25 bool "SMDK2443"
26 select CPU_S3C2443
27 select MACH_SMDK
28 select S3C_DEV_HSMMC1
29 help
30 Say Y here if you are using an SMDK2443
31
32endmenu
diff --git a/arch/arm/mach-s3c2443/Makefile b/arch/arm/mach-s3c2443/Makefile
deleted file mode 100644
index d1843c9eb8b..00000000000
--- a/arch/arm/mach-s3c2443/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
1# arch/arm/mach-s3c2443/Makefile
2#
3# Copyright 2007 Simtec Electronics
4#
5# Licensed under GPLv2
6
7obj-y :=
8obj-m :=
9obj-n :=
10obj- :=
11
12obj-$(CONFIG_CPU_S3C2443) += s3c2443.o
13obj-$(CONFIG_CPU_S3C2443) += irq.o
14obj-$(CONFIG_CPU_S3C2443) += clock.o
15
16obj-$(CONFIG_S3C2443_DMA) += dma.o
17
18# Machine support
19
20obj-$(CONFIG_MACH_SMDK2443) += mach-smdk2443.o
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
new file mode 100644
index 00000000000..0f3a327ebca
--- /dev/null
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -0,0 +1,538 @@
1# arch/arm/mach-s3c24xx/Kconfig
2#
3# Copyright (c) 2012 Samsung Electronics Co., Ltd.
4# http://www.samsung.com/
5#
6# Copyright 2007 Simtec Electronics
7#
8# Licensed under GPLv2
9
10if ARCH_S3C24XX
11
12menu "SAMSUNG S3C24XX SoCs Support"
13
14comment "S3C24XX SoCs"
15
16config CPU_S3C2410
17 bool "SAMSUNG S3C2410"
18 default y
19 select CPU_ARM920T
20 select S3C2410_CLOCK
21 select CPU_LLSERIAL_S3C2410
22 select S3C2410_PM if PM
23 select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
24 help
25 Support for S3C2410 and S3C2410A family from the S3C24XX line
26 of Samsung Mobile CPUs.
27
28config CPU_S3C2412
29 bool "SAMSUNG S3C2412"
30 depends on ARCH_S3C24XX
31 select CPU_ARM926T
32 select CPU_LLSERIAL_S3C2440
33 select S3C2412_PM if PM
34 select S3C2412_DMA if S3C24XX_DMA
35 help
36 Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
37
38config CPU_S3C2416
39 bool "SAMSUNG S3C2416/S3C2450"
40 depends on ARCH_S3C24XX
41 select CPU_ARM926T
42 select CPU_LLSERIAL_S3C2440
43 select SAMSUNG_CLKSRC
44 select S3C2443_COMMON
45 select S3C2443_DMA if S3C24XX_DMA
46 select S3C2416_PM if PM
47 help
48 Support for the S3C2416 SoC from the S3C24XX line
49
50config CPU_S3C2440
51 bool "SAMSUNG S3C2440"
52 select CPU_ARM920T
53 select CPU_LLSERIAL_S3C2440
54 select S3C2410_CLOCK
55 select S3C2410_PM if PM
56 select S3C2440_DMA if S3C24XX_DMA
57 help
58 Support for S3C2440 Samsung Mobile CPU based systems.
59
60config CPU_S3C2442
61 bool "SAMSUNG S3C2442"
62 select CPU_ARM920T
63 select CPU_LLSERIAL_S3C2440
64 select S3C2410_CLOCK
65 select S3C2410_PM if PM
66 help
67 Support for S3C2442 Samsung Mobile CPU based systems.
68
69config CPU_S3C244X
70 def_bool y
71 depends on CPU_S3C2440 || CPU_S3C2442
72
73config CPU_S3C2443
74 bool "SAMSUNG S3C2443"
75 depends on ARCH_S3C24XX
76 select CPU_ARM920T
77 select CPU_LLSERIAL_S3C2440
78 select SAMSUNG_CLKSRC
79 select S3C2443_COMMON
80 select S3C2443_DMA if S3C24XX_DMA
81 help
82 Support for the S3C2443 SoC from the S3C24XX line
83
84# common code
85
86config S3C24XX_SMDK
87 bool
88 help
89 Common machine code for SMDK2410 and SMDK2440
90
91config S3C24XX_SIMTEC_AUDIO
92 bool
93 depends on (ARCH_BAST || MACH_VR1000 || MACH_OSIRIS || MACH_ANUBIS)
94 default y
95 help
96 Add audio devices for common Simtec S3C24XX boards
97
98config S3C24XX_SIMTEC_PM
99 bool
100 help
101 Common power management code for systems that are
102 compatible with the Simtec style of power management
103
104config S3C24XX_SIMTEC_USB
105 bool
106 help
107 USB management code for common Simtec S3C24XX boards
108
109config S3C24XX_SETUP_TS
110 bool
111 help
112 Compile in platform device definition for Samsung TouchScreen.
113
114# cpu-specific sections
115
116if CPU_S3C2410
117
118config S3C2410_DMA
119 bool
120 depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442)
121 default y if CPU_S3C2410 || CPU_S3C2442
122 help
123 DMA device selection for S3C2410 and compatible CPUs
124
125config S3C2410_PM
126 bool
127 help
128 Power Management code common to S3C2410 and better
129
130config S3C24XX_SIMTEC_NOR
131 bool
132 help
133 Internal node to specify machine has simtec NOR mapping
134
135config MACH_BAST_IDE
136 bool
137 select HAVE_PATA_PLATFORM
138 help
139 Internal node for machines with an BAST style IDE
140 interface
141
142comment "S3C2410 Boards"
143
144#
145# The "S3C2410 Boards" list is ordered alphabetically by option text.
146# (without ARCH_ or MACH_)
147#
148
149config MACH_AML_M5900
150 bool "AML M5900 Series"
151 select S3C24XX_SIMTEC_PM if PM
152 select S3C_DEV_USB_HOST
153 help
154 Say Y here if you are using the American Microsystems M5900 Series
155 <http://www.amltd.com>
156
157config ARCH_BAST
158 bool "Simtec Electronics BAST (EB2410ITX)"
159 select S3C2410_IOTIMING if S3C2410_CPUFREQ
160 select S3C24XX_SIMTEC_PM if PM
161 select S3C24XX_SIMTEC_NOR
162 select S3C24XX_SIMTEC_USB
163 select MACH_BAST_IDE
164 select S3C24XX_DCLK
165 select ISA
166 select S3C_DEV_HWMON
167 select S3C_DEV_USB_HOST
168 select S3C_DEV_NAND
169 help
170 Say Y here if you are using the Simtec Electronics EB2410ITX
171 development board (also known as BAST)
172
173config BAST_PC104_IRQ
174 bool "BAST PC104 IRQ support"
175 depends on ARCH_BAST
176 default y
177 help
178 Say Y here to enable the PC104 IRQ routing on the
179 Simtec BAST (EB2410ITX)
180
181config ARCH_H1940
182 bool "IPAQ H1940"
183 select PM_H1940 if PM
184 select S3C_DEV_USB_HOST
185 select S3C_DEV_NAND
186 select S3C24XX_SETUP_TS
187 help
188 Say Y here if you are using the HP IPAQ H1940
189
190config H1940BT
191 tristate "Control the state of H1940 bluetooth chip"
192 depends on ARCH_H1940
193 select RFKILL
194 help
195 This is a simple driver that is able to control
196 the state of built in bluetooth chip on h1940.
197
198config PM_H1940
199 bool
200 help
201 Internal node for H1940 and related PM
202
203config MACH_N30
204 bool "Acer N30 family"
205 select MACH_N35
206 select S3C_DEV_USB_HOST
207 select S3C_DEV_NAND
208 help
209 Say Y here if you want suppt for the Acer N30, Acer N35,
210 Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs.
211
212config MACH_OTOM
213 bool "NexVision OTOM Board"
214 select S3C_DEV_USB_HOST
215 select S3C_DEV_NAND
216 help
217 Say Y here if you are using the Nex Vision OTOM board
218
219config MACH_QT2410
220 bool "QT2410"
221 select S3C_DEV_USB_HOST
222 select S3C_DEV_NAND
223 help
224 Say Y here if you are using the Armzone QT2410
225
226config ARCH_SMDK2410
227 bool "SMDK2410/A9M2410"
228 select S3C24XX_SMDK
229 help
230 Say Y here if you are using the SMDK2410 or the derived module A9M2410
231 <http://www.fsforth.de>
232
233config MACH_TCT_HAMMER
234 bool "TCT Hammer Board"
235 select S3C_DEV_USB_HOST
236 help
237 Say Y here if you are using the TinCanTools Hammer Board
238 <http://www.tincantools.com>
239
240config MACH_VR1000
241 bool "Thorcom VR1000"
242 select S3C24XX_SIMTEC_PM if PM
243 select S3C24XX_DCLK
244 select S3C24XX_SIMTEC_NOR
245 select MACH_BAST_IDE
246 select S3C_DEV_USB_HOST
247 select S3C24XX_SIMTEC_USB
248 help
249 Say Y here if you are using the Thorcom VR1000 board.
250
251endif # CPU_S3C2410
252
253config S3C2412_PM_SLEEP
254 bool
255 help
256 Internal config node to apply sleep for S3C2412 power management.
257 Can be selected by another SoCs such as S3C2416 with similar
258 sleep procedure.
259
260if CPU_S3C2412
261
262config CPU_S3C2412_ONLY
263 bool
264 depends on ARCH_S3C24XX && !CPU_S3C2410 && \
265 !CPU_S3C2416 && !CPU_S3C2440 && !CPU_S3C2442 && \
266 !CPU_S3C2443 && CPU_S3C2412
267 default y
268
269config S3C2412_DMA
270 bool
271 help
272 Internal config node for S3C2412 DMA support
273
274config S3C2412_PM
275 bool
276 help
277 Internal config node to apply S3C2412 power management
278
279comment "S3C2412 Boards"
280
281#
282# The "S3C2412 Boards" list is ordered alphabetically by option text.
283# (without ARCH_ or MACH_)
284#
285
286config MACH_JIVE
287 bool "Logitech Jive"
288 select S3C_DEV_USB_HOST
289 select S3C_DEV_NAND
290 help
291 Say Y here if you are using the Logitech Jive.
292
293config MACH_JIVE_SHOW_BOOTLOADER
294 bool "Allow access to bootloader partitions in MTD (EXPERIMENTAL)"
295 depends on MACH_JIVE && EXPERIMENTAL
296
297config MACH_S3C2413
298 bool
299 help
300 Internal node for S3C2413 version of SMDK2413, so that
301 machine_is_s3c2413() will work when MACH_SMDK2413 is
302 selected
303
304config MACH_SMDK2412
305 bool "SMDK2412"
306 select MACH_SMDK2413
307 help
308 Say Y here if you are using an SMDK2412
309
310 Note, this shares support with SMDK2413, so will automatically
311 select MACH_SMDK2413.
312
313config MACH_SMDK2413
314 bool "SMDK2413"
315 select MACH_S3C2413
316 select S3C24XX_SMDK
317 select S3C_DEV_USB_HOST
318 select S3C_DEV_NAND
319 help
320 Say Y here if you are using an SMDK2413
321
322config MACH_VSTMS
323 bool "VMSTMS"
324 select S3C_DEV_USB_HOST
325 select S3C_DEV_NAND
326 help
327 Say Y here if you are using an VSTMS board
328
329endif # CPU_S3C2412
330
331if CPU_S3C2416
332
333config S3C2416_PM
334 bool
335 select S3C2412_PM_SLEEP
336 help
337 Internal config node to apply S3C2416 power management
338
339config S3C2416_SETUP_SDHCI
340 bool
341 select S3C2416_SETUP_SDHCI_GPIO
342 help
343 Internal helper functions for S3C2416 based SDHCI systems
344
345config S3C2416_SETUP_SDHCI_GPIO
346 bool
347 help
348 Common setup code for SDHCI gpio.
349
350comment "S3C2416 Boards"
351
352config MACH_SMDK2416
353 bool "SMDK2416"
354 select S3C24XX_SMDK
355 select S3C_DEV_FB
356 select S3C_DEV_HSMMC
357 select S3C_DEV_HSMMC1
358 select S3C_DEV_NAND
359 select S3C_DEV_USB_HOST
360 select S3C2416_SETUP_SDHCI
361 help
362 Say Y here if you are using an SMDK2416
363
364endif # CPU_S3C2416
365
366if CPU_S3C2440
367
368config S3C2440_DMA
369 bool
370 help
371 Support for S3C2440 specific DMA code5A
372
373comment "S3C2440 Boards"
374
375#
376# The "S3C2440 Boards" list is ordered alphabetically by option text.
377# (without ARCH_ or MACH_)
378#
379
380config MACH_ANUBIS
381 bool "Simtec Electronics ANUBIS"
382 select S3C24XX_DCLK
383 select S3C24XX_SIMTEC_PM if PM
384 select HAVE_PATA_PLATFORM
385 select S3C24XX_GPIO_EXTRA64
386 select S3C2440_XTAL_12000000
387 select S3C_DEV_USB_HOST
388 help
389 Say Y here if you are using the Simtec Electronics ANUBIS
390 development system
391
392config MACH_AT2440EVB
393 bool "Avantech AT2440EVB development board"
394 select S3C_DEV_USB_HOST
395 select S3C_DEV_NAND
396 help
397 Say Y here if you are using the AT2440EVB development board
398
399config MACH_MINI2440
400 bool "MINI2440 development board"
401 select EEPROM_AT24
402 select NEW_LEDS
403 select LEDS_CLASS
404 select LEDS_TRIGGER
405 select LEDS_TRIGGER_BACKLIGHT
406 select S3C_DEV_NAND
407 select S3C_DEV_USB_HOST
408 help
409 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
412config MACH_NEXCODER_2440
413 bool "NexVision NEXCODER 2440 Light Board"
414 select S3C2440_XTAL_12000000
415 select S3C_DEV_USB_HOST
416 select S3C_DEV_NAND
417 help
418 Say Y here if you are using the Nex Vision NEXCODER 2440 Light Board
419
420config MACH_OSIRIS
421 bool "Simtec IM2440D20 (OSIRIS) module"
422 select S3C24XX_DCLK
423 select S3C24XX_SIMTEC_PM if PM
424 select S3C24XX_GPIO_EXTRA128
425 select S3C2440_XTAL_12000000
426 select S3C2410_IOTIMING if S3C2440_CPUFREQ
427 select S3C_DEV_USB_HOST
428 select S3C_DEV_NAND
429 help
430 Say Y here if you are using the Simtec IM2440D20 module, also
431 known as the Osiris.
432
433config MACH_OSIRIS_DVS
434 tristate "Simtec IM2440D20 (OSIRIS) Dynamic Voltage Scaling driver"
435 depends on MACH_OSIRIS
436 select TPS65010
437 help
438 Say Y/M here if you want to have dynamic voltage scaling support
439 on the Simtec IM2440D20 (OSIRIS) module via the TPS65011.
440
441 The DVS driver alters the voltage supplied to the ARM core
442 depending on the frequency it is running at. The driver itself
443 does not do any of the frequency alteration, which is left up
444 to the cpufreq driver.
445
446config MACH_RX3715
447 bool "HP iPAQ rx3715"
448 select S3C2440_XTAL_16934400
449 select PM_H1940 if PM
450 select S3C_DEV_NAND
451 help
452 Say Y here if you are using the HP iPAQ rx3715.
453
454config ARCH_S3C2440
455 bool "SMDK2440"
456 select S3C2440_XTAL_16934400
457 select S3C24XX_SMDK
458 select S3C_DEV_USB_HOST
459 select S3C_DEV_NAND
460 help
461 Say Y here if you are using the SMDK2440.
462
463config SMDK2440_CPU2440
464 bool "SMDK2440 with S3C2440 CPU module"
465 default y if ARCH_S3C2440
466 select S3C2440_XTAL_16934400
467
468endif # CPU_S3C2440
469
470if CPU_S3C2442
471
472comment "S3C2442 Boards"
473
474#
475# The "S3C2442 Boards" list is ordered alphabetically by option text.
476# (without ARCH_ or MACH_)
477#
478
479config MACH_NEO1973_GTA02
480 bool "Openmoko GTA02 / Freerunner phone"
481 select MFD_PCF50633
482 select PCF50633_GPIO
483 select I2C
484 select POWER_SUPPLY
485 select MACH_NEO1973
486 select S3C2410_PWM
487 select S3C_DEV_USB_HOST
488 help
489 Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone
490
491config MACH_RX1950
492 bool "HP iPAQ rx1950"
493 select S3C24XX_DCLK
494 select PM_H1940 if PM
495 select I2C
496 select S3C2410_PWM
497 select S3C_DEV_NAND
498 select S3C2410_IOTIMING if S3C2440_CPUFREQ
499 select S3C2440_XTAL_16934400
500 help
501 Say Y here if you're using HP iPAQ rx1950
502
503config SMDK2440_CPU2442
504 bool "SMDM2440 with S3C2442 CPU module"
505
506endif # CPU_S3C2440
507
508if CPU_S3C2443 || CPU_S3C2416
509
510config S3C2443_COMMON
511 bool
512 help
513 Common code for the S3C2443 and similar processors, which includes
514 the S3C2416 and S3C2450.
515
516config S3C2443_DMA
517 bool
518 help
519 Internal config node for S3C2443 DMA support
520
521endif # CPU_S3C2443 || CPU_S3C2416
522
523if CPU_S3C2443
524
525comment "S3C2443 Boards"
526
527config MACH_SMDK2443
528 bool "SMDK2443"
529 select S3C24XX_SMDK
530 select S3C_DEV_HSMMC1
531 help
532 Say Y here if you are using an SMDK2443
533
534endif # CPU_S3C2443
535
536endmenu # SAMSUNG S3C24XX SoCs Support
537
538endif # ARCH_S3C24XX
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile
new file mode 100644
index 00000000000..3518fe812d5
--- /dev/null
+++ b/arch/arm/mach-s3c24xx/Makefile
@@ -0,0 +1,95 @@
1# arch/arm/mach-s3c24xx/Makefile
2#
3# Copyright (c) 2012 Samsung Electronics Co., Ltd.
4# http://www.samsung.com/
5#
6# Copyright 2007 Simtec Electronics
7#
8# Licensed under GPLv2
9
10obj-y :=
11obj-m :=
12obj-n :=
13obj- :=
14
15# core
16
17obj-$(CONFIG_CPU_S3C2410) += s3c2410.o
18obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o
19obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o
20
21obj-$(CONFIG_CPU_S3C2412) += s3c2412.o irq-s3c2412.o clock-s3c2412.o
22obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o
23obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o
24obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o
25
26obj-$(CONFIG_CPU_S3C2416) += s3c2416.o irq-s3c2416.o clock-s3c2416.o
27obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o
28
29obj-$(CONFIG_CPU_S3C2440) += s3c2440.o irq-s3c2440.o clock-s3c2440.o
30obj-$(CONFIG_CPU_S3C2442) += s3c2442.o
31obj-$(CONFIG_CPU_S3C244X) += s3c244x.o irq-s3c244x.o clock-s3c244x.o
32obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o
33
34obj-$(CONFIG_CPU_S3C2443) += s3c2443.o irq-s3c2443.o clock-s3c2443.o
35
36# common code
37
38obj-$(CONFIG_S3C2443_COMMON) += common-s3c2443.o
39obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o
40
41#
42# machine support
43# following is ordered alphabetically by option text.
44#
45
46obj-$(CONFIG_MACH_AML_M5900) += mach-amlm5900.o
47obj-$(CONFIG_ARCH_BAST) += mach-bast.o
48obj-$(CONFIG_BAST_PC104_IRQ) += bast-irq.o
49obj-$(CONFIG_ARCH_H1940) += mach-h1940.o
50obj-$(CONFIG_H1940BT) += h1940-bluetooth.o
51obj-$(CONFIG_PM_H1940) += pm-h1940.o
52obj-$(CONFIG_MACH_N30) += mach-n30.o
53obj-$(CONFIG_MACH_OTOM) += mach-otom.o
54obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o
55obj-$(CONFIG_ARCH_SMDK2410) += mach-smdk2410.o
56obj-$(CONFIG_MACH_TCT_HAMMER) += mach-tct_hammer.o
57obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o
58
59obj-$(CONFIG_MACH_JIVE) += mach-jive.o
60obj-$(CONFIG_MACH_SMDK2413) += mach-smdk2413.o
61obj-$(CONFIG_MACH_VSTMS) += mach-vstms.o
62
63obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o
64
65obj-$(CONFIG_MACH_ANUBIS) += mach-anubis.o
66obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o
67obj-$(CONFIG_MACH_MINI2440) += mach-mini2440.o
68obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o
69obj-$(CONFIG_MACH_OSIRIS) += mach-osiris.o
70obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o
71obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o
72
73obj-$(CONFIG_MACH_NEO1973_GTA02) += mach-gta02.o
74obj-$(CONFIG_MACH_RX1950) += mach-rx1950.o
75
76obj-$(CONFIG_MACH_SMDK2443) += mach-smdk2443.o
77
78# common bits of machine support
79
80obj-$(CONFIG_S3C24XX_SMDK) += common-smdk.o
81obj-$(CONFIG_S3C24XX_SIMTEC_AUDIO) += simtec-audio.o
82obj-$(CONFIG_S3C24XX_SIMTEC_NOR) += simtec-nor.o
83obj-$(CONFIG_S3C24XX_SIMTEC_PM) += simtec-pm.o
84obj-$(CONFIG_S3C24XX_SIMTEC_USB) += simtec-usb.o
85
86# machine additions
87
88obj-$(CONFIG_MACH_BAST_IDE) += bast-ide.o
89obj-$(CONFIG_MACH_OSIRIS_DVS) += mach-osiris-dvs.o
90
91# device setup
92
93obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
94obj-$(CONFIG_ARCH_S3C24XX) += setup-i2c.o
95obj-$(CONFIG_S3C24XX_SETUP_TS) += setup-ts.o
diff --git a/arch/arm/mach-s3c2410/Makefile.boot b/arch/arm/mach-s3c24xx/Makefile.boot
index 4457605ba04..4457605ba04 100644
--- a/arch/arm/mach-s3c2410/Makefile.boot
+++ b/arch/arm/mach-s3c24xx/Makefile.boot
diff --git a/arch/arm/mach-s3c2410/bast-ide.c b/arch/arm/mach-s3c24xx/bast-ide.c
index 298ececfa36..298ececfa36 100644
--- a/arch/arm/mach-s3c2410/bast-ide.c
+++ b/arch/arm/mach-s3c24xx/bast-ide.c
diff --git a/arch/arm/mach-s3c2410/bast-irq.c b/arch/arm/mach-s3c24xx/bast-irq.c
index ac7b2ad5c40..ac7b2ad5c40 100644
--- a/arch/arm/mach-s3c2410/bast-irq.c
+++ b/arch/arm/mach-s3c24xx/bast-irq.c
diff --git a/arch/arm/mach-s3c2412/clock.c b/arch/arm/mach-s3c24xx/clock-s3c2412.c
index d10b695a906..d10b695a906 100644
--- a/arch/arm/mach-s3c2412/clock.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2412.c
diff --git a/arch/arm/mach-s3c2416/clock.c b/arch/arm/mach-s3c24xx/clock-s3c2416.c
index 59f54d1d7f8..dbc9ab4aaca 100644
--- a/arch/arm/mach-s3c2416/clock.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2416.c
@@ -15,7 +15,6 @@
15#include <linux/clk.h> 15#include <linux/clk.h>
16 16
17#include <plat/s3c2416.h> 17#include <plat/s3c2416.h>
18#include <plat/s3c2443.h>
19#include <plat/clock.h> 18#include <plat/clock.h>
20#include <plat/clock-clksrc.h> 19#include <plat/clock-clksrc.h>
21#include <plat/cpu.h> 20#include <plat/cpu.h>
@@ -132,12 +131,6 @@ static struct clk hsmmc0_clk = {
132 .ctrlbit = S3C2416_HCLKCON_HSMMC0, 131 .ctrlbit = S3C2416_HCLKCON_HSMMC0,
133}; 132};
134 133
135void __init_or_cpufreq s3c2416_setup_clocks(void)
136{
137 s3c2443_common_setup_clocks(s3c2416_get_pll);
138}
139
140
141static struct clksrc_clk *clksrcs[] __initdata = { 134static struct clksrc_clk *clksrcs[] __initdata = {
142 &hsspi_eplldiv, 135 &hsspi_eplldiv,
143 &hsspi_mux, 136 &hsspi_mux,
diff --git a/arch/arm/mach-s3c2440/clock.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c
index 414364eb426..414364eb426 100644
--- a/arch/arm/mach-s3c2440/clock.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2440.c
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c24xx/clock-s3c2443.c
index 6dde2696f8f..efb3ac35956 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2443.c
@@ -179,11 +179,6 @@ static struct clk *clks[] __initdata = {
179 &clk_hsmmc, 179 &clk_hsmmc,
180}; 180};
181 181
182void __init_or_cpufreq s3c2443_setup_clocks(void)
183{
184 s3c2443_common_setup_clocks(s3c2443_get_mpll);
185}
186
187void __init s3c2443_init_clocks(int xtal) 182void __init s3c2443_init_clocks(int xtal)
188{ 183{
189 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON); 184 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
@@ -196,8 +191,6 @@ void __init s3c2443_init_clocks(int xtal)
196 armdiv, ARRAY_SIZE(armdiv), 191 armdiv, ARRAY_SIZE(armdiv),
197 S3C2443_CLKDIV0_ARMDIV_MASK); 192 S3C2443_CLKDIV0_ARMDIV_MASK);
198 193
199 s3c2443_setup_clocks();
200
201 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); 194 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
202 195
203 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) 196 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
diff --git a/arch/arm/mach-s3c2440/s3c244x-clock.c b/arch/arm/mach-s3c24xx/clock-s3c244x.c
index 6d9b688c442..6d9b688c442 100644
--- a/arch/arm/mach-s3c2440/s3c244x-clock.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c244x.c
diff --git a/arch/arm/plat-s3c24xx/s3c2443-clock.c b/arch/arm/mach-s3c24xx/common-s3c2443.c
index 95e68190d59..460431589f3 100644
--- a/arch/arm/plat-s3c24xx/s3c2443-clock.c
+++ b/arch/arm/mach-s3c24xx/common-s3c2443.c
@@ -1,9 +1,18 @@
1/* linux/arch/arm/plat-s3c24xx/s3c2443-clock.c 1/*
2 * Common code for SoCs starting with the S3C2443
2 * 3 *
3 * Copyright (c) 2007, 2010 Simtec Electronics 4 * Copyright (c) 2007, 2010 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
5 * 6 *
6 * S3C2443 Clock control suport - common code 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.
7 */ 16 */
8 17
9#include <linux/init.h> 18#include <linux/init.h>
@@ -12,7 +21,6 @@
12 21
13#include <mach/regs-s3c2443-clock.h> 22#include <mach/regs-s3c2443-clock.h>
14 23
15#include <plat/s3c2443.h>
16#include <plat/clock.h> 24#include <plat/clock.h>
17#include <plat/clock-clksrc.h> 25#include <plat/clock-clksrc.h>
18#include <plat/cpu.h> 26#include <plat/cpu.h>
@@ -53,7 +61,7 @@ int s3c2443_clkcon_enable_s(struct clk *clk, int enable)
53 * elided as the EPLL can be either sourced by the XTAL or EXTCLK and as 61 * elided as the EPLL can be either sourced by the XTAL or EXTCLK and as
54 * such directly equating the two source clocks is impossible. 62 * such directly equating the two source clocks is impossible.
55 */ 63 */
56struct clk clk_mpllref = { 64static struct clk clk_mpllref = {
57 .name = "mpllref", 65 .name = "mpllref",
58 .parent = &clk_xtal, 66 .parent = &clk_xtal,
59}; 67};
@@ -160,6 +168,44 @@ static struct clk clk_prediv = {
160 }, 168 },
161}; 169};
162 170
171/* hclk divider
172 *
173 * divides the prediv and provides the hclk.
174 */
175
176static unsigned long s3c2443_hclkdiv_getrate(struct clk *clk)
177{
178 unsigned long rate = clk_get_rate(clk->parent);
179 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
180
181 clkdiv0 &= S3C2443_CLKDIV0_HCLKDIV_MASK;
182
183 return rate / (clkdiv0 + 1);
184}
185
186static struct clk_ops clk_h_ops = {
187 .get_rate = s3c2443_hclkdiv_getrate,
188};
189
190/* pclk divider
191 *
192 * divides the hclk and provides the pclk.
193 */
194
195static unsigned long s3c2443_pclkdiv_getrate(struct clk *clk)
196{
197 unsigned long rate = clk_get_rate(clk->parent);
198 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
199
200 clkdiv0 = ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 1 : 0);
201
202 return rate / (clkdiv0 + 1);
203}
204
205static struct clk_ops clk_p_ops = {
206 .get_rate = s3c2443_pclkdiv_getrate,
207};
208
163/* armdiv 209/* armdiv
164 * 210 *
165 * this clock is sourced from msysclk and can have a number of 211 * this clock is sourced from msysclk and can have a number of
@@ -516,26 +562,15 @@ static struct clk hsmmc1_clk = {
516 .ctrlbit = S3C2443_HCLKCON_HSMMC, 562 .ctrlbit = S3C2443_HCLKCON_HSMMC,
517}; 563};
518 564
519static inline unsigned long s3c2443_get_hdiv(unsigned long clkcon0)
520{
521 clkcon0 &= S3C2443_CLKDIV0_HCLKDIV_MASK;
522
523 return clkcon0 + 1;
524}
525
526/* EPLLCON compatible enough to get on/off information */ 565/* EPLLCON compatible enough to get on/off information */
527 566
528void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll) 567void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
529{ 568{
530 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON); 569 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
531 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON); 570 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON);
532 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
533 struct clk *xtal_clk; 571 struct clk *xtal_clk;
534 unsigned long xtal; 572 unsigned long xtal;
535 unsigned long pll; 573 unsigned long pll;
536 unsigned long fclk;
537 unsigned long hclk;
538 unsigned long pclk;
539 int ptr; 574 int ptr;
540 575
541 xtal_clk = clk_get(NULL, "xtal"); 576 xtal_clk = clk_get(NULL, "xtal");
@@ -544,18 +579,13 @@ void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
544 579
545 pll = get_mpll(mpllcon, xtal); 580 pll = get_mpll(mpllcon, xtal);
546 clk_msysclk.clk.rate = pll; 581 clk_msysclk.clk.rate = pll;
547 582 clk_mpll.rate = pll;
548 fclk = clk_get_rate(&clk_armdiv);
549 hclk = s3c2443_prediv_getrate(&clk_prediv);
550 hclk /= s3c2443_get_hdiv(clkdiv0);
551 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1);
552
553 s3c24xx_setup_clocks(fclk, hclk, pclk);
554 583
555 printk("CPU: MPLL %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n", 584 printk("CPU: MPLL %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n",
556 (mpllcon & S3C2443_PLLCON_OFF) ? "off":"on", 585 (mpllcon & S3C2443_PLLCON_OFF) ? "off" : "on",
557 print_mhz(pll), print_mhz(fclk), 586 print_mhz(pll), print_mhz(clk_get_rate(&clk_armdiv)),
558 print_mhz(hclk), print_mhz(pclk)); 587 print_mhz(clk_get_rate(&clk_h)),
588 print_mhz(clk_get_rate(&clk_p)));
559 589
560 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_clks); ptr++) 590 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_clks); ptr++)
561 s3c_set_clksrc(&clksrc_clks[ptr], true); 591 s3c_set_clksrc(&clksrc_clks[ptr], true);
@@ -568,7 +598,7 @@ void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
568 } 598 }
569 599
570 printk("CPU: EPLL %s %ld.%03ld MHz, usb-bus %ld.%03ld MHz\n", 600 printk("CPU: EPLL %s %ld.%03ld MHz, usb-bus %ld.%03ld MHz\n",
571 (epllcon & S3C2443_PLLCON_OFF) ? "off":"on", 601 (epllcon & S3C2443_PLLCON_OFF) ? "off" : "on",
572 print_mhz(clk_get_rate(&clk_epll)), 602 print_mhz(clk_get_rate(&clk_epll)),
573 print_mhz(clk_get_rate(&clk_usb_bus))); 603 print_mhz(clk_get_rate(&clk_usb_bus)));
574} 604}
@@ -611,9 +641,13 @@ void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
611 nr_armdiv = nr_divs; 641 nr_armdiv = nr_divs;
612 armdivmask = divmask; 642 armdivmask = divmask;
613 643
614 /* s3c2443 parents h and p clocks from prediv */ 644 /* s3c2443 parents h clock from prediv */
615 clk_h.parent = &clk_prediv; 645 clk_h.parent = &clk_prediv;
616 clk_p.parent = &clk_prediv; 646 clk_h.ops = &clk_h_ops;
647
648 /* and p clock from h clock */
649 clk_p.parent = &clk_h;
650 clk_p.ops = &clk_p_ops;
617 651
618 clk_usb_bus.parent = &clk_usb_bus_host.clk; 652 clk_usb_bus.parent = &clk_usb_bus_host.clk;
619 clk_epll.parent = &clk_epllref.clk; 653 clk_epll.parent = &clk_epllref.clk;
diff --git a/arch/arm/plat-s3c24xx/common-smdk.c b/arch/arm/mach-s3c24xx/common-smdk.c
index 084604be6ad..084604be6ad 100644
--- a/arch/arm/plat-s3c24xx/common-smdk.c
+++ b/arch/arm/mach-s3c24xx/common-smdk.c
diff --git a/arch/arm/mach-s3c2410/dma.c b/arch/arm/mach-s3c24xx/dma-s3c2410.c
index 4803338cf56..4803338cf56 100644
--- a/arch/arm/mach-s3c2410/dma.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2410.c
diff --git a/arch/arm/mach-s3c2412/dma.c b/arch/arm/mach-s3c24xx/dma-s3c2412.c
index 38472ac920f..38472ac920f 100644
--- a/arch/arm/mach-s3c2412/dma.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2412.c
diff --git a/arch/arm/mach-s3c2440/dma.c b/arch/arm/mach-s3c24xx/dma-s3c2440.c
index 5f0a0c8ef84..5f0a0c8ef84 100644
--- a/arch/arm/mach-s3c2440/dma.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2440.c
diff --git a/arch/arm/mach-s3c2443/dma.c b/arch/arm/mach-s3c24xx/dma-s3c2443.c
index 14224517e62..e227c472a40 100644
--- a/arch/arm/mach-s3c2443/dma.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2443.c
@@ -51,7 +51,7 @@ static struct s3c24xx_dma_map __initdata s3c2443_dma_mappings[] = {
51 .name = "xdreq1", 51 .name = "xdreq1",
52 .channels = MAP(S3C2443_DMAREQSEL_XDREQ1), 52 .channels = MAP(S3C2443_DMAREQSEL_XDREQ1),
53 }, 53 },
54 [DMACH_SDI] = { 54 [DMACH_SDI] = { /* only on S3C2443 */
55 .name = "sdi", 55 .name = "sdi",
56 .channels = MAP(S3C2443_DMAREQSEL_SDI), 56 .channels = MAP(S3C2443_DMAREQSEL_SDI),
57 }, 57 },
@@ -59,7 +59,7 @@ static struct s3c24xx_dma_map __initdata s3c2443_dma_mappings[] = {
59 .name = "spi0", 59 .name = "spi0",
60 .channels = MAP(S3C2443_DMAREQSEL_SPI0TX), 60 .channels = MAP(S3C2443_DMAREQSEL_SPI0TX),
61 }, 61 },
62 [DMACH_SPI1] = { 62 [DMACH_SPI1] = { /* only on S3C2443/S3C2450 */
63 .name = "spi1", 63 .name = "spi1",
64 .channels = MAP(S3C2443_DMAREQSEL_SPI1TX), 64 .channels = MAP(S3C2443_DMAREQSEL_SPI1TX),
65 }, 65 },
@@ -71,11 +71,11 @@ static struct s3c24xx_dma_map __initdata s3c2443_dma_mappings[] = {
71 .name = "uart1", 71 .name = "uart1",
72 .channels = MAP(S3C2443_DMAREQSEL_UART1_0), 72 .channels = MAP(S3C2443_DMAREQSEL_UART1_0),
73 }, 73 },
74 [DMACH_UART2] = { 74 [DMACH_UART2] = {
75 .name = "uart2", 75 .name = "uart2",
76 .channels = MAP(S3C2443_DMAREQSEL_UART2_0), 76 .channels = MAP(S3C2443_DMAREQSEL_UART2_0),
77 }, 77 },
78 [DMACH_UART3] = { 78 [DMACH_UART3] = {
79 .name = "uart3", 79 .name = "uart3",
80 .channels = MAP(S3C2443_DMAREQSEL_UART3_0), 80 .channels = MAP(S3C2443_DMAREQSEL_UART3_0),
81 }, 81 },
@@ -87,11 +87,11 @@ static struct s3c24xx_dma_map __initdata s3c2443_dma_mappings[] = {
87 .name = "uart1", 87 .name = "uart1",
88 .channels = MAP(S3C2443_DMAREQSEL_UART1_1), 88 .channels = MAP(S3C2443_DMAREQSEL_UART1_1),
89 }, 89 },
90 [DMACH_UART2_SRC2] = { 90 [DMACH_UART2_SRC2] = {
91 .name = "uart2", 91 .name = "uart2",
92 .channels = MAP(S3C2443_DMAREQSEL_UART2_1), 92 .channels = MAP(S3C2443_DMAREQSEL_UART2_1),
93 }, 93 },
94 [DMACH_UART3_SRC2] = { 94 [DMACH_UART3_SRC2] = {
95 .name = "uart3", 95 .name = "uart3",
96 .channels = MAP(S3C2443_DMAREQSEL_UART3_1), 96 .channels = MAP(S3C2443_DMAREQSEL_UART3_1),
97 }, 97 },
@@ -142,6 +142,23 @@ static int __init s3c2443_dma_add(struct device *dev,
142 return s3c24xx_dma_init_map(&s3c2443_dma_sel); 142 return s3c24xx_dma_init_map(&s3c2443_dma_sel);
143} 143}
144 144
145#ifdef CONFIG_CPU_S3C2416
146/* S3C2416 DMA contains the same selection table as the S3C2443 */
147static struct subsys_interface s3c2416_dma_interface = {
148 .name = "s3c2416_dma",
149 .subsys = &s3c2416_subsys,
150 .add_dev = s3c2443_dma_add,
151};
152
153static int __init s3c2416_dma_init(void)
154{
155 return subsys_interface_register(&s3c2416_dma_interface);
156}
157
158arch_initcall(s3c2416_dma_init);
159#endif
160
161#ifdef CONFIG_CPU_S3C2443
145static struct subsys_interface s3c2443_dma_interface = { 162static struct subsys_interface s3c2443_dma_interface = {
146 .name = "s3c2443_dma", 163 .name = "s3c2443_dma",
147 .subsys = &s3c2443_subsys, 164 .subsys = &s3c2443_subsys,
@@ -154,3 +171,4 @@ static int __init s3c2443_dma_init(void)
154} 171}
155 172
156arch_initcall(s3c2443_dma_init); 173arch_initcall(s3c2443_dma_init);
174#endif
diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
index a5eeb62ce1c..a5eeb62ce1c 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
diff --git a/arch/arm/mach-s3c2410/include/mach/anubis-cpld.h b/arch/arm/mach-s3c24xx/include/mach/anubis-cpld.h
index 1b614d5a81f..1b614d5a81f 100644
--- a/arch/arm/mach-s3c2410/include/mach/anubis-cpld.h
+++ b/arch/arm/mach-s3c24xx/include/mach/anubis-cpld.h
diff --git a/arch/arm/mach-s3c2410/include/mach/anubis-irq.h b/arch/arm/mach-s3c24xx/include/mach/anubis-irq.h
index a2a328134e3..a2a328134e3 100644
--- a/arch/arm/mach-s3c2410/include/mach/anubis-irq.h
+++ b/arch/arm/mach-s3c24xx/include/mach/anubis-irq.h
diff --git a/arch/arm/mach-s3c2410/include/mach/anubis-map.h b/arch/arm/mach-s3c24xx/include/mach/anubis-map.h
index c9deb3a5b2c..c9deb3a5b2c 100644
--- a/arch/arm/mach-s3c2410/include/mach/anubis-map.h
+++ b/arch/arm/mach-s3c24xx/include/mach/anubis-map.h
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-cpld.h b/arch/arm/mach-s3c24xx/include/mach/bast-cpld.h
index bee2a7a932a..bee2a7a932a 100644
--- a/arch/arm/mach-s3c2410/include/mach/bast-cpld.h
+++ b/arch/arm/mach-s3c24xx/include/mach/bast-cpld.h
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-irq.h b/arch/arm/mach-s3c24xx/include/mach/bast-irq.h
index cac428c42e7..cac428c42e7 100644
--- a/arch/arm/mach-s3c2410/include/mach/bast-irq.h
+++ b/arch/arm/mach-s3c24xx/include/mach/bast-irq.h
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-map.h b/arch/arm/mach-s3c24xx/include/mach/bast-map.h
index 6e7dc9d0cf0..6e7dc9d0cf0 100644
--- a/arch/arm/mach-s3c2410/include/mach/bast-map.h
+++ b/arch/arm/mach-s3c24xx/include/mach/bast-map.h
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-pmu.h b/arch/arm/mach-s3c24xx/include/mach/bast-pmu.h
index 4c38b39b741..4c38b39b741 100644
--- a/arch/arm/mach-s3c2410/include/mach/bast-pmu.h
+++ b/arch/arm/mach-s3c24xx/include/mach/bast-pmu.h
diff --git a/arch/arm/mach-s3c2410/include/mach/debug-macro.S b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
index 4135de87d1f..4135de87d1f 100644
--- a/arch/arm/mach-s3c2410/include/mach/debug-macro.S
+++ b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
diff --git a/arch/arm/mach-s3c2410/include/mach/dma.h b/arch/arm/mach-s3c24xx/include/mach/dma.h
index acbdfecd418..acbdfecd418 100644
--- a/arch/arm/mach-s3c2410/include/mach/dma.h
+++ b/arch/arm/mach-s3c24xx/include/mach/dma.h
diff --git a/arch/arm/mach-s3c2410/include/mach/entry-macro.S b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
index 473b3cd37d9..7615a14773f 100644
--- a/arch/arm/mach-s3c2410/include/mach/entry-macro.S
+++ b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
@@ -25,9 +25,6 @@
25 .macro get_irqnr_preamble, base, tmp 25 .macro get_irqnr_preamble, base, tmp
26 .endm 26 .endm
27 27
28 .macro arch_ret_to_user, tmp1, tmp2
29 .endm
30
31 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 28 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
32 29
33 mov \base, #S3C24XX_VA_IRQ 30 mov \base, #S3C24XX_VA_IRQ
@@ -71,8 +68,3 @@
71 @@ exit here, Z flag unset if IRQ 68 @@ exit here, Z flag unset if IRQ
72 69
73 .endm 70 .endm
74
75 /* currently don't need an disable_fiq macro */
76
77 .macro disable_fiq
78 .endm
diff --git a/arch/arm/mach-s3c2410/include/mach/fb.h b/arch/arm/mach-s3c24xx/include/mach/fb.h
index a957bc8ed44..a957bc8ed44 100644
--- a/arch/arm/mach-s3c2410/include/mach/fb.h
+++ b/arch/arm/mach-s3c24xx/include/mach/fb.h
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-fns.h b/arch/arm/mach-s3c24xx/include/mach/gpio-fns.h
index c53ad34c657..c53ad34c657 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio-fns.h
+++ b/arch/arm/mach-s3c24xx/include/mach/gpio-fns.h
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h b/arch/arm/mach-s3c24xx/include/mach/gpio-nrs.h
index 019ea86057f..019ea86057f 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h
+++ b/arch/arm/mach-s3c24xx/include/mach/gpio-nrs.h
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-track.h b/arch/arm/mach-s3c24xx/include/mach/gpio-track.h
index c410a078622..c410a078622 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio-track.h
+++ b/arch/arm/mach-s3c24xx/include/mach/gpio-track.h
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h b/arch/arm/mach-s3c24xx/include/mach/gpio.h
index 6fac70f3484..6fac70f3484 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio.h
+++ b/arch/arm/mach-s3c24xx/include/mach/gpio.h
diff --git a/arch/arm/mach-s3c2440/include/mach/gta02.h b/arch/arm/mach-s3c24xx/include/mach/gta02.h
index 3a56a229cac..3a56a229cac 100644
--- a/arch/arm/mach-s3c2440/include/mach/gta02.h
+++ b/arch/arm/mach-s3c24xx/include/mach/gta02.h
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h b/arch/arm/mach-s3c24xx/include/mach/h1940-latch.h
index fc897d3a056..fc897d3a056 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c24xx/include/mach/h1940-latch.h
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940.h b/arch/arm/mach-s3c24xx/include/mach/h1940.h
index 2aa683c8d3d..2aa683c8d3d 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940.h
+++ b/arch/arm/mach-s3c24xx/include/mach/h1940.h
diff --git a/arch/arm/mach-s3c2410/include/mach/hardware.h b/arch/arm/mach-s3c24xx/include/mach/hardware.h
index aef5631eac5..aef5631eac5 100644
--- a/arch/arm/mach-s3c2410/include/mach/hardware.h
+++ b/arch/arm/mach-s3c24xx/include/mach/hardware.h
diff --git a/arch/arm/mach-s3c2410/include/mach/idle.h b/arch/arm/mach-s3c24xx/include/mach/idle.h
index e9ddd706b16..e9ddd706b16 100644
--- a/arch/arm/mach-s3c2410/include/mach/idle.h
+++ b/arch/arm/mach-s3c24xx/include/mach/idle.h
diff --git a/arch/arm/mach-s3c2410/include/mach/io.h b/arch/arm/mach-s3c24xx/include/mach/io.h
index 118749f37c4..118749f37c4 100644
--- a/arch/arm/mach-s3c2410/include/mach/io.h
+++ b/arch/arm/mach-s3c24xx/include/mach/io.h
diff --git a/arch/arm/mach-s3c2410/include/mach/irqs.h b/arch/arm/mach-s3c24xx/include/mach/irqs.h
index e53b2177319..e53b2177319 100644
--- a/arch/arm/mach-s3c2410/include/mach/irqs.h
+++ b/arch/arm/mach-s3c24xx/include/mach/irqs.h
diff --git a/arch/arm/mach-s3c2410/include/mach/leds-gpio.h b/arch/arm/mach-s3c24xx/include/mach/leds-gpio.h
index d8a7672519b..d8a7672519b 100644
--- a/arch/arm/mach-s3c2410/include/mach/leds-gpio.h
+++ b/arch/arm/mach-s3c24xx/include/mach/leds-gpio.h
diff --git a/arch/arm/mach-s3c2410/include/mach/map.h b/arch/arm/mach-s3c24xx/include/mach/map.h
index 78ae807f128..78ae807f128 100644
--- a/arch/arm/mach-s3c2410/include/mach/map.h
+++ b/arch/arm/mach-s3c24xx/include/mach/map.h
diff --git a/arch/arm/mach-s3c2410/include/mach/osiris-cpld.h b/arch/arm/mach-s3c24xx/include/mach/osiris-cpld.h
index e9e36b0abba..e9e36b0abba 100644
--- a/arch/arm/mach-s3c2410/include/mach/osiris-cpld.h
+++ b/arch/arm/mach-s3c24xx/include/mach/osiris-cpld.h
diff --git a/arch/arm/mach-s3c2410/include/mach/osiris-map.h b/arch/arm/mach-s3c24xx/include/mach/osiris-map.h
index 17380f84842..17380f84842 100644
--- a/arch/arm/mach-s3c2410/include/mach/osiris-map.h
+++ b/arch/arm/mach-s3c24xx/include/mach/osiris-map.h
diff --git a/arch/arm/mach-s3c2410/include/mach/otom-map.h b/arch/arm/mach-s3c24xx/include/mach/otom-map.h
index f9277a52c14..f9277a52c14 100644
--- a/arch/arm/mach-s3c2410/include/mach/otom-map.h
+++ b/arch/arm/mach-s3c24xx/include/mach/otom-map.h
diff --git a/arch/arm/mach-s3c2410/include/mach/pm-core.h b/arch/arm/mach-s3c24xx/include/mach/pm-core.h
index 2eef7e6f767..2eef7e6f767 100644
--- a/arch/arm/mach-s3c2410/include/mach/pm-core.h
+++ b/arch/arm/mach-s3c24xx/include/mach/pm-core.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-clock.h b/arch/arm/mach-s3c24xx/include/mach/regs-clock.h
index 3415b60082d..3415b60082d 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-clock.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-clock.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-dsc.h b/arch/arm/mach-s3c24xx/include/mach/regs-dsc.h
index 98fd4a05587..98fd4a05587 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-dsc.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-dsc.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h
index cac1ad6b582..cac1ad6b582 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpioj.h b/arch/arm/mach-s3c24xx/include/mach/regs-gpioj.h
index 19575e06111..19575e06111 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-gpioj.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-gpioj.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-irq.h b/arch/arm/mach-s3c24xx/include/mach/regs-irq.h
index 0f07ba30b1f..0f07ba30b1f 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-irq.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-irq.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-lcd.h b/arch/arm/mach-s3c24xx/include/mach/regs-lcd.h
index ee8f040aff5..ee8f040aff5 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-lcd.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-lcd.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-mem.h b/arch/arm/mach-s3c24xx/include/mach/regs-mem.h
index e0c67b0163d..e0c67b0163d 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-mem.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-mem.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-power.h b/arch/arm/mach-s3c24xx/include/mach/regs-power.h
index 4932b87bdf3..4932b87bdf3 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-power.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-power.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412-mem.h
index fb635251509..fb635251509 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412-mem.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2412.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412.h
index aa69dc79bc3..aa69dc79bc3 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-s3c2412.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2416-mem.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416-mem.h
index 2f31b74974a..2f31b74974a 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-s3c2416-mem.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416-mem.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2416.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416.h
index e443167efb8..e443167efb8 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-s3c2416.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h
index c3feff3c048..c3feff3c048 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-sdi.h b/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h
index cbf2d8884e3..cbf2d8884e3 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-sdi.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h
diff --git a/arch/arm/mach-s3c2410/include/mach/tick.h b/arch/arm/mach-s3c24xx/include/mach/tick.h
index 544da41979d..544da41979d 100644
--- a/arch/arm/mach-s3c2410/include/mach/tick.h
+++ b/arch/arm/mach-s3c24xx/include/mach/tick.h
diff --git a/arch/arm/mach-s3c2410/include/mach/timex.h b/arch/arm/mach-s3c24xx/include/mach/timex.h
index fe9ca1ffd51..fe9ca1ffd51 100644
--- a/arch/arm/mach-s3c2410/include/mach/timex.h
+++ b/arch/arm/mach-s3c24xx/include/mach/timex.h
diff --git a/arch/arm/mach-s3c2410/include/mach/uncompress.h b/arch/arm/mach-s3c24xx/include/mach/uncompress.h
index 8b283f847da..8b283f847da 100644
--- a/arch/arm/mach-s3c2410/include/mach/uncompress.h
+++ b/arch/arm/mach-s3c24xx/include/mach/uncompress.h
diff --git a/arch/arm/mach-s3c2410/include/mach/vr1000-cpld.h b/arch/arm/mach-s3c24xx/include/mach/vr1000-cpld.h
index e4119913d7c..e4119913d7c 100644
--- a/arch/arm/mach-s3c2410/include/mach/vr1000-cpld.h
+++ b/arch/arm/mach-s3c24xx/include/mach/vr1000-cpld.h
diff --git a/arch/arm/mach-s3c2410/include/mach/vr1000-irq.h b/arch/arm/mach-s3c24xx/include/mach/vr1000-irq.h
index 47add133b8e..47add133b8e 100644
--- a/arch/arm/mach-s3c2410/include/mach/vr1000-irq.h
+++ b/arch/arm/mach-s3c24xx/include/mach/vr1000-irq.h
diff --git a/arch/arm/mach-s3c2410/include/mach/vr1000-map.h b/arch/arm/mach-s3c24xx/include/mach/vr1000-map.h
index 99612fcc4eb..99612fcc4eb 100644
--- a/arch/arm/mach-s3c2410/include/mach/vr1000-map.h
+++ b/arch/arm/mach-s3c24xx/include/mach/vr1000-map.h
diff --git a/arch/arm/mach-s3c2412/irq.c b/arch/arm/mach-s3c24xx/irq-s3c2412.c
index e65619ddbcc..e65619ddbcc 100644
--- a/arch/arm/mach-s3c2412/irq.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c2412.c
diff --git a/arch/arm/mach-s3c2416/irq.c b/arch/arm/mach-s3c24xx/irq-s3c2416.c
index fd49f35e448..fd49f35e448 100644
--- a/arch/arm/mach-s3c2416/irq.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c2416.c
diff --git a/arch/arm/mach-s3c2440/irq.c b/arch/arm/mach-s3c24xx/irq-s3c2440.c
index 4a18cde439c..4a18cde439c 100644
--- a/arch/arm/mach-s3c2440/irq.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c2440.c
diff --git a/arch/arm/mach-s3c2443/irq.c b/arch/arm/mach-s3c24xx/irq-s3c2443.c
index ac2829f56d1..ac2829f56d1 100644
--- a/arch/arm/mach-s3c2443/irq.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c2443.c
diff --git a/arch/arm/mach-s3c2440/s3c244x-irq.c b/arch/arm/mach-s3c24xx/irq-s3c244x.c
index 5fe8e58d3af..5fe8e58d3af 100644
--- a/arch/arm/mach-s3c2440/s3c244x-irq.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c244x.c
diff --git a/arch/arm/mach-s3c2410/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index 4220cc60de3..4220cc60de3 100644
--- a/arch/arm/mach-s3c2410/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
diff --git a/arch/arm/mach-s3c2440/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index 19b577bc09b..60c72c54c21 100644
--- a/arch/arm/mach-s3c2440/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -55,6 +55,7 @@
55#include <plat/cpu.h> 55#include <plat/cpu.h>
56#include <plat/audio-simtec.h> 56#include <plat/audio-simtec.h>
57 57
58#include "simtec.h"
58#include "common.h" 59#include "common.h"
59 60
60#define COPYRIGHT ", Copyright 2005-2009 Simtec Electronics" 61#define COPYRIGHT ", Copyright 2005-2009 Simtec Electronics"
diff --git a/arch/arm/mach-s3c2440/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index d7ae49c9011..d7ae49c9011 100644
--- a/arch/arm/mach-s3c2440/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index feeaf73933d..53219c02eca 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -64,8 +64,7 @@
64#include <plat/gpio-cfg.h> 64#include <plat/gpio-cfg.h>
65#include <plat/audio-simtec.h> 65#include <plat/audio-simtec.h>
66 66
67#include "usb-simtec.h" 67#include "simtec.h"
68#include "nor-simtec.h"
69#include "common.h" 68#include "common.h"
70 69
71#define COPYRIGHT ", Copyright 2004-2008 Simtec Electronics" 70#define COPYRIGHT ", Copyright 2004-2008 Simtec Electronics"
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index 9a4a5bc008e..ba5d8539410 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -38,6 +38,7 @@
38#include <linux/platform_device.h> 38#include <linux/platform_device.h>
39#include <linux/serial_core.h> 39#include <linux/serial_core.h>
40#include <linux/spi/spi.h> 40#include <linux/spi/spi.h>
41#include <linux/spi/s3c24xx.h>
41 42
42#include <linux/mmc/host.h> 43#include <linux/mmc/host.h>
43 44
@@ -73,7 +74,6 @@
73#include <mach/regs-gpioj.h> 74#include <mach/regs-gpioj.h>
74#include <mach/fb.h> 75#include <mach/fb.h>
75 76
76#include <mach/spi.h>
77#include <plat/usb-control.h> 77#include <plat/usb-control.h>
78#include <mach/regs-mem.h> 78#include <mach/regs-mem.h>
79#include <mach/hardware.h> 79#include <mach/hardware.h>
@@ -258,7 +258,7 @@ static struct pcf50633_bl_platform_data gta02_backlight_data = {
258 .ramp_time = 5, 258 .ramp_time = 5,
259}; 259};
260 260
261struct pcf50633_platform_data gta02_pcf_pdata = { 261static struct pcf50633_platform_data gta02_pcf_pdata = {
262 .resumers = { 262 .resumers = {
263 [0] = PCF50633_INT1_USBINS | 263 [0] = PCF50633_INT1_USBINS |
264 PCF50633_INT1_USBREM | 264 PCF50633_INT1_USBREM |
@@ -404,7 +404,7 @@ static struct platform_device gta02_nor_flash = {
404}; 404};
405 405
406 406
407struct platform_device s3c24xx_pwm_device = { 407static struct platform_device s3c24xx_pwm_device = {
408 .name = "s3c24xx_pwm", 408 .name = "s3c24xx_pwm",
409 .num_resources = 0, 409 .num_resources = 0,
410}; 410};
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index 41245a60398..6b21ba107ea 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -162,7 +162,7 @@ static int h1940_gpiolib_latch_get(struct gpio_chip *chip,
162 return (latch_state >> (offset + 16)) & 1; 162 return (latch_state >> (offset + 16)) & 1;
163} 163}
164 164
165struct gpio_chip h1940_latch_gpiochip = { 165static struct gpio_chip h1940_latch_gpiochip = {
166 .base = H1940_LATCH_GPIO(0), 166 .base = H1940_LATCH_GPIO(0),
167 .owner = THIS_MODULE, 167 .owner = THIS_MODULE,
168 .label = "H1940_LATCH", 168 .label = "H1940_LATCH",
@@ -304,7 +304,7 @@ static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
304 { .volt = 3841, .cur = 0, .level = 0}, 304 { .volt = 3841, .cur = 0, .level = 0},
305}; 305};
306 306
307int h1940_bat_init(void) 307static int h1940_bat_init(void)
308{ 308{
309 int ret; 309 int ret;
310 310
@@ -317,17 +317,17 @@ int h1940_bat_init(void)
317 317
318} 318}
319 319
320void h1940_bat_exit(void) 320static void h1940_bat_exit(void)
321{ 321{
322 gpio_free(H1940_LATCH_SM803_ENABLE); 322 gpio_free(H1940_LATCH_SM803_ENABLE);
323} 323}
324 324
325void h1940_enable_charger(void) 325static void h1940_enable_charger(void)
326{ 326{
327 gpio_set_value(H1940_LATCH_SM803_ENABLE, 1); 327 gpio_set_value(H1940_LATCH_SM803_ENABLE, 1);
328} 328}
329 329
330void h1940_disable_charger(void) 330static void h1940_disable_charger(void)
331{ 331{
332 gpio_set_value(H1940_LATCH_SM803_ENABLE, 0); 332 gpio_set_value(H1940_LATCH_SM803_ENABLE, 0);
333} 333}
@@ -364,7 +364,7 @@ static struct platform_device h1940_battery = {
364 }, 364 },
365}; 365};
366 366
367DEFINE_SPINLOCK(h1940_blink_spin); 367static DEFINE_SPINLOCK(h1940_blink_spin);
368 368
369int h1940_led_blink_set(unsigned gpio, int state, 369int h1940_led_blink_set(unsigned gpio, int state,
370 unsigned long *delay_on, unsigned long *delay_off) 370 unsigned long *delay_on, unsigned long *delay_off)
diff --git a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index ae73ba34ecc..ae73ba34ecc 100644
--- a/arch/arm/mach-s3c2412/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 5d66fb218a4..5d66fb218a4 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index 383d00ca8f6..383d00ca8f6 100644
--- a/arch/arm/mach-s3c2410/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
diff --git a/arch/arm/mach-s3c2440/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index 5198e3e1c5b..5198e3e1c5b 100644
--- a/arch/arm/mach-s3c2440/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
diff --git a/arch/arm/mach-s3c2440/mach-osiris-dvs.c b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
index ad2792dfbee..ad2792dfbee 100644
--- a/arch/arm/mach-s3c2440/mach-osiris-dvs.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index c5daeb612a8..c5daeb612a8 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
diff --git a/arch/arm/mach-s3c2410/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index 5f1e0eeb38a..5f1e0eeb38a 100644
--- a/arch/arm/mach-s3c2410/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
diff --git a/arch/arm/mach-s3c2410/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index 91c16d9d245..91c16d9d245 100644
--- a/arch/arm/mach-s3c2410/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 6f68abf44fa..200debb4c72 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -217,7 +217,7 @@ static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
217 { .volt = 3820, .cur = 0, .level = 0}, 217 { .volt = 3820, .cur = 0, .level = 0},
218}; 218};
219 219
220int rx1950_bat_init(void) 220static int rx1950_bat_init(void)
221{ 221{
222 int ret; 222 int ret;
223 223
@@ -236,25 +236,25 @@ err_gpio1:
236 return ret; 236 return ret;
237} 237}
238 238
239void rx1950_bat_exit(void) 239static void rx1950_bat_exit(void)
240{ 240{
241 gpio_free(S3C2410_GPJ(2)); 241 gpio_free(S3C2410_GPJ(2));
242 gpio_free(S3C2410_GPJ(3)); 242 gpio_free(S3C2410_GPJ(3));
243} 243}
244 244
245void rx1950_enable_charger(void) 245static void rx1950_enable_charger(void)
246{ 246{
247 gpio_direction_output(S3C2410_GPJ(2), 1); 247 gpio_direction_output(S3C2410_GPJ(2), 1);
248 gpio_direction_output(S3C2410_GPJ(3), 1); 248 gpio_direction_output(S3C2410_GPJ(3), 1);
249} 249}
250 250
251void rx1950_disable_charger(void) 251static void rx1950_disable_charger(void)
252{ 252{
253 gpio_direction_output(S3C2410_GPJ(2), 0); 253 gpio_direction_output(S3C2410_GPJ(2), 0);
254 gpio_direction_output(S3C2410_GPJ(3), 0); 254 gpio_direction_output(S3C2410_GPJ(3), 0);
255} 255}
256 256
257DEFINE_SPINLOCK(rx1950_blink_spin); 257static DEFINE_SPINLOCK(rx1950_blink_spin);
258 258
259static int rx1950_led_blink_set(unsigned gpio, int state, 259static int rx1950_led_blink_set(unsigned gpio, int state,
260 unsigned long *delay_on, unsigned long *delay_off) 260 unsigned long *delay_on, unsigned long *delay_off)
@@ -382,7 +382,7 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
382 382
383static struct pwm_device *lcd_pwm; 383static struct pwm_device *lcd_pwm;
384 384
385void rx1950_lcd_power(int enable) 385static void rx1950_lcd_power(int enable)
386{ 386{
387 int i; 387 int i;
388 static int enabled; 388 static int enabled;
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index 56af3544759..56af3544759 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
diff --git a/arch/arm/mach-s3c2410/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index bdc27e77287..bdc27e77287 100644
--- a/arch/arm/mach-s3c2410/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
diff --git a/arch/arm/mach-s3c2412/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index b11451b853d..b11451b853d 100644
--- a/arch/arm/mach-s3c2412/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
diff --git a/arch/arm/mach-s3c2416/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index eebe1e72b93..30a44f806e0 100644
--- a/arch/arm/mach-s3c2416/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -125,7 +125,7 @@ static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
125 } 125 }
126}; 126};
127 127
128void smdk2416_hsudc_gpio_init(void) 128static void smdk2416_hsudc_gpio_init(void)
129{ 129{
130 s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP); 130 s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP);
131 s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE); 131 s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE);
@@ -133,20 +133,20 @@ void smdk2416_hsudc_gpio_init(void)
133 s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0); 133 s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0);
134} 134}
135 135
136void smdk2416_hsudc_gpio_uninit(void) 136static void smdk2416_hsudc_gpio_uninit(void)
137{ 137{
138 s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1); 138 s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1);
139 s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE); 139 s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE);
140 s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0)); 140 s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0));
141} 141}
142 142
143struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = { 143static struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = {
144 .epnum = 9, 144 .epnum = 9,
145 .gpio_init = smdk2416_hsudc_gpio_init, 145 .gpio_init = smdk2416_hsudc_gpio_init,
146 .gpio_uninit = smdk2416_hsudc_gpio_uninit, 146 .gpio_uninit = smdk2416_hsudc_gpio_uninit,
147}; 147};
148 148
149struct s3c_fb_pd_win smdk2416_fb_win[] = { 149static struct s3c_fb_pd_win smdk2416_fb_win[] = {
150 [0] = { 150 [0] = {
151 /* think this is the same as the smdk6410 */ 151 /* think this is the same as the smdk6410 */
152 .win_mode = { 152 .win_mode = {
diff --git a/arch/arm/mach-s3c2440/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index 83a1036d7dc..83a1036d7dc 100644
--- a/arch/arm/mach-s3c2440/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
diff --git a/arch/arm/mach-s3c2443/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index 20923695622..20923695622 100644
--- a/arch/arm/mach-s3c2443/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
diff --git a/arch/arm/mach-s3c2410/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 1114666f0ef..1114666f0ef 100644
--- a/arch/arm/mach-s3c2410/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index dbe668a803e..87608d45dac 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -51,8 +51,7 @@
51#include <plat/iic.h> 51#include <plat/iic.h>
52#include <plat/audio-simtec.h> 52#include <plat/audio-simtec.h>
53 53
54#include "usb-simtec.h" 54#include "simtec.h"
55#include "nor-simtec.h"
56#include "common.h" 55#include "common.h"
57 56
58/* macros for virtual address mods for the io space entries */ 57/* macros for virtual address mods for the io space entries */
diff --git a/arch/arm/mach-s3c2412/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index 94bfaa1fb14..94bfaa1fb14 100644
--- a/arch/arm/mach-s3c2412/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
diff --git a/arch/arm/mach-s3c2410/pm-h1940.S b/arch/arm/mach-s3c24xx/pm-h1940.S
index c93bf2db9f4..c93bf2db9f4 100644
--- a/arch/arm/mach-s3c2410/pm-h1940.S
+++ b/arch/arm/mach-s3c24xx/pm-h1940.S
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c24xx/pm-s3c2410.c
index 03f706dd600..03f706dd600 100644
--- a/arch/arm/mach-s3c2410/pm.c
+++ b/arch/arm/mach-s3c24xx/pm-s3c2410.c
diff --git a/arch/arm/mach-s3c2412/pm.c b/arch/arm/mach-s3c24xx/pm-s3c2412.c
index d04588506ec..d04588506ec 100644
--- a/arch/arm/mach-s3c2412/pm.c
+++ b/arch/arm/mach-s3c24xx/pm-s3c2412.c
diff --git a/arch/arm/mach-s3c2416/pm.c b/arch/arm/mach-s3c24xx/pm-s3c2416.c
index 1bd4817b8eb..1bd4817b8eb 100644
--- a/arch/arm/mach-s3c2416/pm.c
+++ b/arch/arm/mach-s3c24xx/pm-s3c2416.c
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
index 061b6bb1a55..061b6bb1a55 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c24xx/s3c2410.c
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c
index aff6e85a97c..c6eac987109 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c24xx/s3c2412.c
@@ -32,8 +32,6 @@
32#include <asm/proc-fns.h> 32#include <asm/proc-fns.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34 34
35#include <mach/idle.h>
36
37#include <plat/cpu-freq.h> 35#include <plat/cpu-freq.h>
38 36
39#include <mach/regs-clock.h> 37#include <mach/regs-clock.h>
@@ -164,7 +162,7 @@ void __init s3c2412_map_io(void)
164 162
165 /* set our idle function */ 163 /* set our idle function */
166 164
167 s3c24xx_idle = s3c2412_idle; 165 arm_pm_idle = s3c2412_idle;
168 166
169 /* register our io-tables */ 167 /* register our io-tables */
170 168
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c
index 5287d2808d3..0e9a71c90ed 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c24xx/s3c2416.c
@@ -44,7 +44,6 @@
44#include <asm/proc-fns.h> 44#include <asm/proc-fns.h>
45#include <asm/irq.h> 45#include <asm/irq.h>
46 46
47#include <mach/idle.h>
48#include <mach/regs-s3c2443-clock.h> 47#include <mach/regs-s3c2443-clock.h>
49 48
50#include <plat/gpio-core.h> 49#include <plat/gpio-core.h>
@@ -60,6 +59,7 @@
60#include <plat/fb-core.h> 59#include <plat/fb-core.h>
61#include <plat/nand-core.h> 60#include <plat/nand-core.h>
62#include <plat/adc-core.h> 61#include <plat/adc-core.h>
62#include <plat/rtc-core.h>
63 63
64static struct map_desc s3c2416_iodesc[] __initdata = { 64static struct map_desc s3c2416_iodesc[] __initdata = {
65 IODESC_ENT(WATCHDOG), 65 IODESC_ENT(WATCHDOG),
@@ -88,8 +88,6 @@ int __init s3c2416_init(void)
88{ 88{
89 printk(KERN_INFO "S3C2416: Initializing architecture\n"); 89 printk(KERN_INFO "S3C2416: Initializing architecture\n");
90 90
91 /* s3c24xx_idle = s3c2416_idle; */
92
93 /* change WDT IRQ number */ 91 /* change WDT IRQ number */
94 s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; 92 s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
95 s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT; 93 s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT;
@@ -101,6 +99,7 @@ int __init s3c2416_init(void)
101 s3c_fb_setname("s3c2443-fb"); 99 s3c_fb_setname("s3c2443-fb");
102 100
103 s3c_adc_setname("s3c2416-adc"); 101 s3c_adc_setname("s3c2416-adc");
102 s3c_rtc_setname("s3c2416-rtc");
104 103
105#ifdef CONFIG_PM 104#ifdef CONFIG_PM
106 register_syscore_ops(&s3c2416_pm_syscore_ops); 105 register_syscore_ops(&s3c2416_pm_syscore_ops);
diff --git a/arch/arm/mach-s3c2440/s3c2440.c b/arch/arm/mach-s3c24xx/s3c2440.c
index 2b3dddb49af..2b3dddb49af 100644
--- a/arch/arm/mach-s3c2440/s3c2440.c
+++ b/arch/arm/mach-s3c24xx/s3c2440.c
diff --git a/arch/arm/mach-s3c2440/s3c2442.c b/arch/arm/mach-s3c24xx/s3c2442.c
index 22cb7c94a8c..22cb7c94a8c 100644
--- a/arch/arm/mach-s3c2440/s3c2442.c
+++ b/arch/arm/mach-s3c24xx/s3c2442.c
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c
index b9deaeb0dff..b7778a9dafa 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c24xx/s3c2443.c
@@ -41,6 +41,7 @@
41#include <plat/fb-core.h> 41#include <plat/fb-core.h>
42#include <plat/nand-core.h> 42#include <plat/nand-core.h>
43#include <plat/adc-core.h> 43#include <plat/adc-core.h>
44#include <plat/rtc-core.h>
44 45
45static struct map_desc s3c2443_iodesc[] __initdata = { 46static struct map_desc s3c2443_iodesc[] __initdata = {
46 IODESC_ENT(WATCHDOG), 47 IODESC_ENT(WATCHDOG),
@@ -73,6 +74,7 @@ int __init s3c2443_init(void)
73 s3c_fb_setname("s3c2443-fb"); 74 s3c_fb_setname("s3c2443-fb");
74 75
75 s3c_adc_setname("s3c2443-adc"); 76 s3c_adc_setname("s3c2443-adc");
77 s3c_rtc_setname("s3c2443-rtc");
76 78
77 /* change WDT IRQ number */ 79 /* change WDT IRQ number */
78 s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; 80 s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
diff --git a/arch/arm/mach-s3c2440/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
index d15852f642b..d15852f642b 100644
--- a/arch/arm/mach-s3c2440/s3c244x.c
+++ b/arch/arm/mach-s3c24xx/s3c244x.c
diff --git a/arch/arm/plat-s3c24xx/setup-i2c.c b/arch/arm/mach-s3c24xx/setup-i2c.c
index 9e90a7cbd1d..9e90a7cbd1d 100644
--- a/arch/arm/plat-s3c24xx/setup-i2c.c
+++ b/arch/arm/mach-s3c24xx/setup-i2c.c
diff --git a/arch/arm/mach-s3c2416/setup-sdhci-gpio.c b/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c
index f65cb3ef16c..f65cb3ef16c 100644
--- a/arch/arm/mach-s3c2416/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c
diff --git a/arch/arm/plat-s3c24xx/setup-ts.c b/arch/arm/mach-s3c24xx/setup-ts.c
index ed263866367..ed263866367 100644
--- a/arch/arm/plat-s3c24xx/setup-ts.c
+++ b/arch/arm/mach-s3c24xx/setup-ts.c
diff --git a/arch/arm/plat-s3c24xx/simtec-audio.c b/arch/arm/mach-s3c24xx/simtec-audio.c
index 6bc832e0d8e..11881c9a38c 100644
--- a/arch/arm/plat-s3c24xx/simtec-audio.c
+++ b/arch/arm/mach-s3c24xx/simtec-audio.c
@@ -27,6 +27,8 @@
27#include <plat/audio-simtec.h> 27#include <plat/audio-simtec.h>
28#include <plat/devs.h> 28#include <plat/devs.h>
29 29
30#include "simtec.h"
31
30/* platform ops for audio */ 32/* platform ops for audio */
31 33
32static void simtec_audio_startup_lrroute(void) 34static void simtec_audio_startup_lrroute(void)
diff --git a/arch/arm/mach-s3c2410/nor-simtec.c b/arch/arm/mach-s3c24xx/simtec-nor.c
index ad9f750f1e5..2119ca6a73b 100644
--- a/arch/arm/mach-s3c2410/nor-simtec.c
+++ b/arch/arm/mach-s3c24xx/simtec-nor.c
@@ -30,7 +30,7 @@
30#include <mach/bast-map.h> 30#include <mach/bast-map.h>
31#include <mach/bast-cpld.h> 31#include <mach/bast-cpld.h>
32 32
33#include "nor-simtec.h" 33#include "simtec.h"
34 34
35static void simtec_nor_vpp(struct platform_device *pdev, int vpp) 35static void simtec_nor_vpp(struct platform_device *pdev, int vpp)
36{ 36{
diff --git a/arch/arm/plat-s3c24xx/pm-simtec.c b/arch/arm/mach-s3c24xx/simtec-pm.c
index 699f9317129..699f9317129 100644
--- a/arch/arm/plat-s3c24xx/pm-simtec.c
+++ b/arch/arm/mach-s3c24xx/simtec-pm.c
diff --git a/arch/arm/mach-s3c2410/usb-simtec.c b/arch/arm/mach-s3c24xx/simtec-usb.c
index 29bd3d987be..d91c1a72513 100644
--- a/arch/arm/mach-s3c2410/usb-simtec.c
+++ b/arch/arm/mach-s3c24xx/simtec-usb.c
@@ -37,7 +37,7 @@
37#include <plat/usb-control.h> 37#include <plat/usb-control.h>
38#include <plat/devs.h> 38#include <plat/devs.h>
39 39
40#include "usb-simtec.h" 40#include "simtec.h"
41 41
42/* control power and monitor over-current events on various Simtec 42/* control power and monitor over-current events on various Simtec
43 * designed boards. 43 * designed boards.
diff --git a/arch/arm/mach-s3c2410/nor-simtec.h b/arch/arm/mach-s3c24xx/simtec.h
index f619c1e0d0c..ae8f4f9ad2e 100644
--- a/arch/arm/mach-s3c2410/nor-simtec.h
+++ b/arch/arm/mach-s3c24xx/simtec.h
@@ -4,11 +4,18 @@
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
7 * Simtec NOR mapping 7 * Simtec common functions
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12*/ 12*/
13 13
14struct s3c24xx_audio_simtec_pdata;
15
14extern void nor_simtec_init(void); 16extern void nor_simtec_init(void);
17
18extern int usb_simtec_init(void);
19
20extern int simtec_audio_add(const char *codec_name, bool has_lr_routing,
21 struct s3c24xx_audio_simtec_pdata *pdata);
diff --git a/arch/arm/mach-s3c2410/sleep.S b/arch/arm/mach-s3c24xx/sleep-s3c2410.S
index dd5b6388a5a..dd5b6388a5a 100644
--- a/arch/arm/mach-s3c2410/sleep.S
+++ b/arch/arm/mach-s3c24xx/sleep-s3c2410.S
diff --git a/arch/arm/mach-s3c2412/sleep.S b/arch/arm/mach-s3c24xx/sleep-s3c2412.S
index c82418ed714..c82418ed714 100644
--- a/arch/arm/mach-s3c2412/sleep.S
+++ b/arch/arm/mach-s3c24xx/sleep-s3c2412.S
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index dd20c66cd70..82c0915729e 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -83,6 +83,11 @@ config S3C64XX_SETUP_SPI
83 help 83 help
84 Common setup code for SPI GPIO configurations 84 Common setup code for SPI GPIO configurations
85 85
86config S3C64XX_SETUP_USB_PHY
87 bool
88 help
89 Common setup code for USB PHY controller
90
86# S36400 Macchine support 91# S36400 Macchine support
87 92
88config MACH_SMDK6400 93config MACH_SMDK6400
@@ -157,6 +162,7 @@ config MACH_SMDK6410
157 select S3C64XX_SETUP_IDE 162 select S3C64XX_SETUP_IDE
158 select S3C64XX_SETUP_FB_24BPP 163 select S3C64XX_SETUP_FB_24BPP
159 select S3C64XX_SETUP_KEYPAD 164 select S3C64XX_SETUP_KEYPAD
165 select S3C64XX_SETUP_USB_PHY
160 help 166 help
161 Machine support for the Samsung SMDK6410 167 Machine support for the Samsung SMDK6410
162 168
@@ -256,6 +262,7 @@ config MACH_SMARTQ
256 select S3C_DEV_USB_HOST 262 select S3C_DEV_USB_HOST
257 select S3C64XX_SETUP_SDHCI 263 select S3C64XX_SETUP_SDHCI
258 select S3C64XX_SETUP_FB_24BPP 264 select S3C64XX_SETUP_FB_24BPP
265 select S3C64XX_SETUP_USB_PHY
259 select SAMSUNG_DEV_ADC 266 select SAMSUNG_DEV_ADC
260 select SAMSUNG_DEV_PWM 267 select SAMSUNG_DEV_PWM
261 select SAMSUNG_DEV_TS 268 select SAMSUNG_DEV_TS
@@ -283,6 +290,7 @@ config MACH_WLF_CRAGG_6410
283 select S3C64XX_SETUP_FB_24BPP 290 select S3C64XX_SETUP_FB_24BPP
284 select S3C64XX_SETUP_KEYPAD 291 select S3C64XX_SETUP_KEYPAD
285 select S3C64XX_SETUP_SPI 292 select S3C64XX_SETUP_SPI
293 select S3C64XX_SETUP_USB_PHY
286 select SAMSUNG_DEV_ADC 294 select SAMSUNG_DEV_ADC
287 select SAMSUNG_DEV_KEYPAD 295 select SAMSUNG_DEV_KEYPAD
288 select S3C_DEV_USB_HOST 296 select S3C_DEV_USB_HOST
@@ -296,5 +304,6 @@ config MACH_WLF_CRAGG_6410
296 select S3C64XX_DEV_SPI0 304 select S3C64XX_DEV_SPI0
297 select SAMSUNG_GPIO_EXTRA128 305 select SAMSUNG_GPIO_EXTRA128
298 select I2C 306 select I2C
307 select LEDS_GPIO_REGISTER
299 help 308 help
300 Machine support for the Wolfson Cragganmore S3C6410 variant. 309 Machine support for the Wolfson Cragganmore S3C6410 variant.
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 1822ac2eba3..f9ce1dc28ce 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_CPU_S3C6410) += s3c6410.o
22# PM 22# PM
23 23
24obj-$(CONFIG_PM) += pm.o irq-pm.o sleep.o 24obj-$(CONFIG_PM) += pm.o irq-pm.o sleep.o
25obj-$(CONFIG_CPU_IDLE) += cpuidle.o
25 26
26# DMA support 27# DMA support
27 28
@@ -42,6 +43,7 @@ obj-$(CONFIG_S3C64XX_SETUP_IDE) += setup-ide.o
42obj-$(CONFIG_S3C64XX_SETUP_KEYPAD) += setup-keypad.o 43obj-$(CONFIG_S3C64XX_SETUP_KEYPAD) += setup-keypad.o
43obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o 44obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
44obj-$(CONFIG_S3C64XX_SETUP_SPI) += setup-spi.o 45obj-$(CONFIG_S3C64XX_SETUP_SPI) += setup-spi.o
46obj-$(CONFIG_S3C64XX_SETUP_USB_PHY) += setup-usb-phy.o
45 47
46# Machine support 48# Machine support
47 49
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c
index aebbcc291b4..52f079a691c 100644
--- a/arch/arm/mach-s3c64xx/clock.c
+++ b/arch/arm/mach-s3c64xx/clock.c
@@ -207,6 +207,15 @@ static struct clk init_clocks_off[] = {
207 .enable = s3c64xx_sclk_ctrl, 207 .enable = s3c64xx_sclk_ctrl,
208 .ctrlbit = S3C_CLKCON_SCLK_MMC2_48, 208 .ctrlbit = S3C_CLKCON_SCLK_MMC2_48,
209 }, { 209 }, {
210 .name = "ac97",
211 .parent = &clk_p,
212 .ctrlbit = S3C_CLKCON_PCLK_AC97,
213 }, {
214 .name = "cfcon",
215 .parent = &clk_h,
216 .enable = s3c64xx_hclk_ctrl,
217 .ctrlbit = S3C_CLKCON_HCLK_IHOST,
218 }, {
210 .name = "dma0", 219 .name = "dma0",
211 .parent = &clk_h, 220 .parent = &clk_h,
212 .enable = s3c64xx_hclk_ctrl, 221 .enable = s3c64xx_hclk_ctrl,
@@ -216,6 +225,107 @@ static struct clk init_clocks_off[] = {
216 .parent = &clk_h, 225 .parent = &clk_h,
217 .enable = s3c64xx_hclk_ctrl, 226 .enable = s3c64xx_hclk_ctrl,
218 .ctrlbit = S3C_CLKCON_HCLK_DMA1, 227 .ctrlbit = S3C_CLKCON_HCLK_DMA1,
228 }, {
229 .name = "3dse",
230 .parent = &clk_h,
231 .enable = s3c64xx_hclk_ctrl,
232 .ctrlbit = S3C_CLKCON_HCLK_3DSE,
233 }, {
234 .name = "hclk_secur",
235 .parent = &clk_h,
236 .enable = s3c64xx_hclk_ctrl,
237 .ctrlbit = S3C_CLKCON_HCLK_SECUR,
238 }, {
239 .name = "sdma1",
240 .parent = &clk_h,
241 .enable = s3c64xx_hclk_ctrl,
242 .ctrlbit = S3C_CLKCON_HCLK_SDMA1,
243 }, {
244 .name = "sdma0",
245 .parent = &clk_h,
246 .enable = s3c64xx_hclk_ctrl,
247 .ctrlbit = S3C_CLKCON_HCLK_SDMA0,
248 }, {
249 .name = "hclk_jpeg",
250 .parent = &clk_h,
251 .enable = s3c64xx_hclk_ctrl,
252 .ctrlbit = S3C_CLKCON_HCLK_JPEG,
253 }, {
254 .name = "camif",
255 .parent = &clk_h,
256 .enable = s3c64xx_hclk_ctrl,
257 .ctrlbit = S3C_CLKCON_HCLK_CAMIF,
258 }, {
259 .name = "hclk_scaler",
260 .parent = &clk_h,
261 .enable = s3c64xx_hclk_ctrl,
262 .ctrlbit = S3C_CLKCON_HCLK_SCALER,
263 }, {
264 .name = "2d",
265 .parent = &clk_h,
266 .enable = s3c64xx_hclk_ctrl,
267 .ctrlbit = S3C_CLKCON_HCLK_2D,
268 }, {
269 .name = "tv",
270 .parent = &clk_h,
271 .enable = s3c64xx_hclk_ctrl,
272 .ctrlbit = S3C_CLKCON_HCLK_TV,
273 }, {
274 .name = "post0",
275 .parent = &clk_h,
276 .enable = s3c64xx_hclk_ctrl,
277 .ctrlbit = S3C_CLKCON_HCLK_POST0,
278 }, {
279 .name = "rot",
280 .parent = &clk_h,
281 .enable = s3c64xx_hclk_ctrl,
282 .ctrlbit = S3C_CLKCON_HCLK_ROT,
283 }, {
284 .name = "hclk_mfc",
285 .parent = &clk_h,
286 .enable = s3c64xx_hclk_ctrl,
287 .ctrlbit = S3C_CLKCON_HCLK_MFC,
288 }, {
289 .name = "pclk_mfc",
290 .parent = &clk_p,
291 .enable = s3c64xx_pclk_ctrl,
292 .ctrlbit = S3C_CLKCON_PCLK_MFC,
293 }, {
294 .name = "dac27",
295 .enable = s3c64xx_sclk_ctrl,
296 .ctrlbit = S3C_CLKCON_SCLK_DAC27,
297 }, {
298 .name = "tv27",
299 .enable = s3c64xx_sclk_ctrl,
300 .ctrlbit = S3C_CLKCON_SCLK_TV27,
301 }, {
302 .name = "scaler27",
303 .enable = s3c64xx_sclk_ctrl,
304 .ctrlbit = S3C_CLKCON_SCLK_SCALER27,
305 }, {
306 .name = "sclk_scaler",
307 .enable = s3c64xx_sclk_ctrl,
308 .ctrlbit = S3C_CLKCON_SCLK_SCALER,
309 }, {
310 .name = "post0_27",
311 .enable = s3c64xx_sclk_ctrl,
312 .ctrlbit = S3C_CLKCON_SCLK_POST0_27,
313 }, {
314 .name = "secur",
315 .enable = s3c64xx_sclk_ctrl,
316 .ctrlbit = S3C_CLKCON_SCLK_SECUR,
317 }, {
318 .name = "sclk_mfc",
319 .enable = s3c64xx_sclk_ctrl,
320 .ctrlbit = S3C_CLKCON_SCLK_MFC,
321 }, {
322 .name = "cam",
323 .enable = s3c64xx_sclk_ctrl,
324 .ctrlbit = S3C_CLKCON_SCLK_CAM,
325 }, {
326 .name = "sclk_jpeg",
327 .enable = s3c64xx_sclk_ctrl,
328 .ctrlbit = S3C_CLKCON_SCLK_JPEG,
219 }, 329 },
220}; 330};
221 331
@@ -289,16 +399,7 @@ static struct clk init_clocks[] = {
289 .name = "watchdog", 399 .name = "watchdog",
290 .parent = &clk_p, 400 .parent = &clk_p,
291 .ctrlbit = S3C_CLKCON_PCLK_WDT, 401 .ctrlbit = S3C_CLKCON_PCLK_WDT,
292 }, { 402 },
293 .name = "ac97",
294 .parent = &clk_p,
295 .ctrlbit = S3C_CLKCON_PCLK_AC97,
296 }, {
297 .name = "cfcon",
298 .parent = &clk_h,
299 .enable = s3c64xx_hclk_ctrl,
300 .ctrlbit = S3C_CLKCON_HCLK_IHOST,
301 }
302}; 403};
303 404
304static struct clk clk_hsmmc0 = { 405static struct clk clk_hsmmc0 = {
diff --git a/arch/arm/mach-s3c64xx/common.h b/arch/arm/mach-s3c64xx/common.h
index 5eb9c9a7d73..7a10be629ab 100644
--- a/arch/arm/mach-s3c64xx/common.h
+++ b/arch/arm/mach-s3c64xx/common.h
@@ -25,8 +25,6 @@ void s3c64xx_setup_clocks(void);
25 25
26void s3c64xx_restart(char mode, const char *cmd); 26void s3c64xx_restart(char mode, const char *cmd);
27 27
28extern struct syscore_ops s3c64xx_irq_syscore_ops;
29
30#ifdef CONFIG_CPU_S3C6400 28#ifdef CONFIG_CPU_S3C6400
31 29
32extern int s3c6400_init(void); 30extern int s3c6400_init(void);
diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-s3c64xx/cpuidle.c
new file mode 100644
index 00000000000..179460f38db
--- /dev/null
+++ b/arch/arm/mach-s3c64xx/cpuidle.c
@@ -0,0 +1,91 @@
1/* linux/arch/arm/mach-s3c64xx/cpuidle.c
2 *
3 * Copyright (c) 2011 Wolfson Microelectronics, plc
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/cpuidle.h>
15#include <linux/io.h>
16#include <linux/export.h>
17#include <linux/time.h>
18
19#include <asm/proc-fns.h>
20
21#include <mach/map.h>
22
23#include <mach/regs-sys.h>
24#include <mach/regs-syscon-power.h>
25
26static int s3c64xx_enter_idle(struct cpuidle_device *dev,
27 struct cpuidle_driver *drv,
28 int index)
29{
30 struct timeval before, after;
31 unsigned long tmp;
32 int idle_time;
33
34 local_irq_disable();
35 do_gettimeofday(&before);
36
37 /* Setup PWRCFG to enter idle mode */
38 tmp = __raw_readl(S3C64XX_PWR_CFG);
39 tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;
40 tmp |= S3C64XX_PWRCFG_CFG_WFI_IDLE;
41 __raw_writel(tmp, S3C64XX_PWR_CFG);
42
43 cpu_do_idle();
44
45 do_gettimeofday(&after);
46 local_irq_enable();
47 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
48 (after.tv_usec - before.tv_usec);
49
50 dev->last_residency = idle_time;
51 return index;
52}
53
54static struct cpuidle_state s3c64xx_cpuidle_set[] = {
55 [0] = {
56 .enter = s3c64xx_enter_idle,
57 .exit_latency = 1,
58 .target_residency = 1,
59 .flags = CPUIDLE_FLAG_TIME_VALID,
60 .name = "IDLE",
61 .desc = "System active, ARM gated",
62 },
63};
64
65static struct cpuidle_driver s3c64xx_cpuidle_driver = {
66 .name = "s3c64xx_cpuidle",
67 .owner = THIS_MODULE,
68 .state_count = ARRAY_SIZE(s3c64xx_cpuidle_set),
69};
70
71static struct cpuidle_device s3c64xx_cpuidle_device = {
72 .state_count = ARRAY_SIZE(s3c64xx_cpuidle_set),
73};
74
75static int __init s3c64xx_init_cpuidle(void)
76{
77 int ret;
78
79 memcpy(s3c64xx_cpuidle_driver.states, s3c64xx_cpuidle_set,
80 sizeof(s3c64xx_cpuidle_set));
81 cpuidle_register_driver(&s3c64xx_cpuidle_driver);
82
83 ret = cpuidle_register_device(&s3c64xx_cpuidle_device);
84 if (ret) {
85 pr_err("Failed to register cpuidle device: %d\n", ret);
86 return ret;
87 }
88
89 return 0;
90}
91device_initcall(s3c64xx_init_cpuidle);
diff --git a/arch/arm/mach-s3c64xx/include/mach/entry-macro.S b/arch/arm/mach-s3c64xx/include/mach/entry-macro.S
deleted file mode 100644
index dc2bc15142c..00000000000
--- a/arch/arm/mach-s3c64xx/include/mach/entry-macro.S
+++ /dev/null
@@ -1,19 +0,0 @@
1/* arch/arm/mach-s3c6400/include/mach/entry-macro.S
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * Low-level IRQ helper macros for the Samsung S3C64XX series
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13*/
14
15 .macro disable_fiq
16 .endm
17
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
diff --git a/arch/arm/mach-s3c64xx/include/mach/system.h b/arch/arm/mach-s3c64xx/include/mach/system.h
deleted file mode 100644
index 353ed4389ae..00000000000
--- a/arch/arm/mach-s3c64xx/include/mach/system.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/system.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - system implementation
9 */
10
11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H __FILE__
13
14static void arch_idle(void)
15{
16 /* nothing here yet */
17}
18
19#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c64xx/irq-pm.c b/arch/arm/mach-s3c64xx/irq-pm.c
index 8bec61e242c..0c7e1d960ca 100644
--- a/arch/arm/mach-s3c64xx/irq-pm.c
+++ b/arch/arm/mach-s3c64xx/irq-pm.c
@@ -96,7 +96,7 @@ static void s3c64xx_irq_pm_resume(void)
96 S3C_PMDBG("%s: IRQ configuration restored\n", __func__); 96 S3C_PMDBG("%s: IRQ configuration restored\n", __func__);
97} 97}
98 98
99struct syscore_ops s3c64xx_irq_syscore_ops = { 99static struct syscore_ops s3c64xx_irq_syscore_ops = {
100 .suspend = s3c64xx_irq_pm_suspend, 100 .suspend = s3c64xx_irq_pm_suspend,
101 .resume = s3c64xx_irq_pm_resume, 101 .resume = s3c64xx_irq_pm_resume,
102}; 102};
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index cd3c97e2ee7..b6a67728cc8 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -11,6 +11,7 @@
11#include <linux/export.h> 11#include <linux/export.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/i2c.h> 13#include <linux/i2c.h>
14#include <linux/spi/spi.h>
14 15
15#include <linux/mfd/wm831x/irq.h> 16#include <linux/mfd/wm831x/irq.h>
16#include <linux/mfd/wm831x/gpio.h> 17#include <linux/mfd/wm831x/gpio.h>
@@ -21,8 +22,25 @@
21#include <sound/wm8962.h> 22#include <sound/wm8962.h>
22#include <sound/wm9081.h> 23#include <sound/wm9081.h>
23 24
25#include <plat/s3c64xx-spi.h>
26
24#include <mach/crag6410.h> 27#include <mach/crag6410.h>
25 28
29static struct s3c64xx_spi_csinfo wm0010_spi_csinfo = {
30 .set_level = gpio_set_value,
31 .line = S3C64XX_GPC(3),
32};
33
34static struct spi_board_info wm1253_devs[] = {
35 [0] = {
36 .modalias = "wm0010",
37 .bus_num = 0,
38 .chip_select = 0,
39 .mode = SPI_MODE_0,
40 .controller_data = &wm0010_spi_csinfo,
41 },
42};
43
26static struct wm5100_pdata wm5100_pdata = { 44static struct wm5100_pdata wm5100_pdata = {
27 .ldo_ena = S3C64XX_GPN(7), 45 .ldo_ena = S3C64XX_GPN(7),
28 .irq_flags = IRQF_TRIGGER_HIGH, 46 .irq_flags = IRQF_TRIGGER_HIGH,
@@ -102,6 +120,7 @@ static struct wm8962_pdata wm8962_pdata __initdata = {
102 0x8000 | WM8962_GPIO_FN_DMICDAT, 120 0x8000 | WM8962_GPIO_FN_DMICDAT,
103 WM8962_GPIO_FN_IRQ, /* Open drain mode */ 121 WM8962_GPIO_FN_IRQ, /* Open drain mode */
104 }, 122 },
123 .in4_dc_measure = true,
105}; 124};
106 125
107static struct wm9081_pdata wm9081_pdata __initdata = { 126static struct wm9081_pdata wm9081_pdata __initdata = {
@@ -158,14 +177,21 @@ static __devinitdata const struct {
158 const char *name; 177 const char *name;
159 const struct i2c_board_info *i2c_devs; 178 const struct i2c_board_info *i2c_devs;
160 int num_i2c_devs; 179 int num_i2c_devs;
180 const struct spi_board_info *spi_devs;
181 int num_spi_devs;
161} gf_mods[] = { 182} gf_mods[] = {
162 { .id = 0x01, .name = "1250-EV1 Springbank" }, 183 { .id = 0x01, .name = "1250-EV1 Springbank" },
163 { .id = 0x02, .name = "1251-EV1 Jura" }, 184 { .id = 0x02, .name = "1251-EV1 Jura" },
164 { .id = 0x03, .name = "1252-EV1 Glenlivet" }, 185 { .id = 0x03, .name = "1252-EV1 Glenlivet" },
165 { .id = 0x11, .name = "6249-EV2 Glenfarclas", }, 186 { .id = 0x11, .name = "6249-EV2 Glenfarclas", },
187 { .id = 0x14, .name = "6271-EV1 Lochnagar" },
188 { .id = 0x15, .name = "XXXX-EV1 Bells" },
166 { .id = 0x21, .name = "1275-EV1 Mortlach" }, 189 { .id = 0x21, .name = "1275-EV1 Mortlach" },
167 { .id = 0x25, .name = "1274-EV1 Glencadam" }, 190 { .id = 0x25, .name = "1274-EV1 Glencadam" },
168 { .id = 0x31, .name = "1253-EV1 Tomatin", }, 191 { .id = 0x31, .name = "1253-EV1 Tomatin",
192 .spi_devs = wm1253_devs, .num_spi_devs = ARRAY_SIZE(wm1253_devs) },
193 { .id = 0x32, .name = "XXXX-EV1 Caol Illa" },
194 { .id = 0x33, .name = "XXXX-EV1 Oban" },
169 { .id = 0x39, .name = "1254-EV1 Dallas Dhu", 195 { .id = 0x39, .name = "1254-EV1 Dallas Dhu",
170 .i2c_devs = wm1254_devs, .num_i2c_devs = ARRAY_SIZE(wm1254_devs) }, 196 .i2c_devs = wm1254_devs, .num_i2c_devs = ARRAY_SIZE(wm1254_devs) },
171 { .id = 0x3a, .name = "1259-EV1 Tobermory", 197 { .id = 0x3a, .name = "1259-EV1 Tobermory",
@@ -197,12 +223,16 @@ static __devinit int wlf_gf_module_probe(struct i2c_client *i2c,
197 if (i < ARRAY_SIZE(gf_mods)) { 223 if (i < ARRAY_SIZE(gf_mods)) {
198 dev_info(&i2c->dev, "%s revision %d\n", 224 dev_info(&i2c->dev, "%s revision %d\n",
199 gf_mods[i].name, rev + 1); 225 gf_mods[i].name, rev + 1);
226
200 for (j = 0; j < gf_mods[i].num_i2c_devs; j++) { 227 for (j = 0; j < gf_mods[i].num_i2c_devs; j++) {
201 if (!i2c_new_device(i2c->adapter, 228 if (!i2c_new_device(i2c->adapter,
202 &(gf_mods[i].i2c_devs[j]))) 229 &(gf_mods[i].i2c_devs[j])))
203 dev_err(&i2c->dev, 230 dev_err(&i2c->dev,
204 "Failed to register dev: %d\n", ret); 231 "Failed to register dev: %d\n", ret);
205 } 232 }
233
234 spi_register_board_info(gf_mods[i].spi_devs,
235 gf_mods[i].num_spi_devs);
206 } else { 236 } else {
207 dev_warn(&i2c->dev, "Unknown module ID 0x%x revision %d\n", 237 dev_warn(&i2c->dev, "Unknown module ID 0x%x revision %d\n",
208 id, rev + 1); 238 id, rev + 1);
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 8077f650eb0..e20bf583536 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -19,7 +19,9 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/leds.h>
22#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/mmc/host.h>
23#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
24#include <linux/regulator/fixed.h> 26#include <linux/regulator/fixed.h>
25#include <linux/pwm_backlight.h> 27#include <linux/pwm_backlight.h>
@@ -59,6 +61,7 @@
59#include <plat/sdhci.h> 61#include <plat/sdhci.h>
60#include <plat/gpio-cfg.h> 62#include <plat/gpio-cfg.h>
61#include <plat/s3c64xx-spi.h> 63#include <plat/s3c64xx-spi.h>
64#include <plat/udc-hs.h>
62 65
63#include <plat/keypad.h> 66#include <plat/keypad.h>
64#include <plat/clock.h> 67#include <plat/clock.h>
@@ -298,6 +301,7 @@ static struct platform_device littlemill_device = {
298}; 301};
299 302
300static struct regulator_consumer_supply wallvdd_consumers[] = { 303static struct regulator_consumer_supply wallvdd_consumers[] = {
304 REGULATOR_SUPPLY("SPKVDD", "1-001a"),
301 REGULATOR_SUPPLY("SPKVDD1", "1-001a"), 305 REGULATOR_SUPPLY("SPKVDD1", "1-001a"),
302 REGULATOR_SUPPLY("SPKVDD2", "1-001a"), 306 REGULATOR_SUPPLY("SPKVDD2", "1-001a"),
303 REGULATOR_SUPPLY("SPKVDDL", "1-001a"), 307 REGULATOR_SUPPLY("SPKVDDL", "1-001a"),
@@ -574,11 +578,19 @@ static struct s3c2410_platform_i2c i2c0_pdata = {
574 .frequency = 400000, 578 .frequency = 400000,
575}; 579};
576 580
581static struct regulator_consumer_supply pvdd_1v2_consumers[] __initdata = {
582 REGULATOR_SUPPLY("DCVDD", "spi0.0"),
583 REGULATOR_SUPPLY("AVDD", "spi0.0"),
584};
585
577static struct regulator_init_data pvdd_1v2 __initdata = { 586static struct regulator_init_data pvdd_1v2 __initdata = {
578 .constraints = { 587 .constraints = {
579 .name = "PVDD_1V2", 588 .name = "PVDD_1V2",
580 .always_on = 1, 589 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
581 }, 590 },
591
592 .consumer_supplies = pvdd_1v2_consumers,
593 .num_consumer_supplies = ARRAY_SIZE(pvdd_1v2_consumers),
582}; 594};
583 595
584static struct regulator_consumer_supply pvdd_1v8_consumers[] __initdata = { 596static struct regulator_consumer_supply pvdd_1v8_consumers[] __initdata = {
@@ -592,6 +604,7 @@ static struct regulator_consumer_supply pvdd_1v8_consumers[] __initdata = {
592 REGULATOR_SUPPLY("AVDD2", "1-001a"), 604 REGULATOR_SUPPLY("AVDD2", "1-001a"),
593 REGULATOR_SUPPLY("DCVDD", "1-001a"), 605 REGULATOR_SUPPLY("DCVDD", "1-001a"),
594 REGULATOR_SUPPLY("AVDD", "1-001a"), 606 REGULATOR_SUPPLY("AVDD", "1-001a"),
607 REGULATOR_SUPPLY("DBVDD", "spi0.0"),
595}; 608};
596 609
597static struct regulator_init_data pvdd_1v8 __initdata = { 610static struct regulator_init_data pvdd_1v8 __initdata = {
@@ -681,6 +694,7 @@ static void __init crag6410_map_io(void)
681static struct s3c_sdhci_platdata crag6410_hsmmc2_pdata = { 694static struct s3c_sdhci_platdata crag6410_hsmmc2_pdata = {
682 .max_width = 4, 695 .max_width = 4,
683 .cd_type = S3C_SDHCI_CD_PERMANENT, 696 .cd_type = S3C_SDHCI_CD_PERMANENT,
697 .host_caps = MMC_CAP_POWER_OFF_CARD,
684}; 698};
685 699
686static void crag6410_cfg_sdhci0(struct platform_device *dev, int width) 700static void crag6410_cfg_sdhci0(struct platform_device *dev, int width)
@@ -696,8 +710,59 @@ static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
696 .max_width = 4, 710 .max_width = 4,
697 .cd_type = S3C_SDHCI_CD_INTERNAL, 711 .cd_type = S3C_SDHCI_CD_INTERNAL,
698 .cfg_gpio = crag6410_cfg_sdhci0, 712 .cfg_gpio = crag6410_cfg_sdhci0,
713 .host_caps = MMC_CAP_POWER_OFF_CARD,
714};
715
716static const struct gpio_led gpio_leds[] = {
717 {
718 .name = "d13:green:",
719 .gpio = MMGPIO_GPIO_BASE + 0,
720 .default_state = LEDS_GPIO_DEFSTATE_ON,
721 },
722 {
723 .name = "d14:green:",
724 .gpio = MMGPIO_GPIO_BASE + 1,
725 .default_state = LEDS_GPIO_DEFSTATE_ON,
726 },
727 {
728 .name = "d15:green:",
729 .gpio = MMGPIO_GPIO_BASE + 2,
730 .default_state = LEDS_GPIO_DEFSTATE_ON,
731 },
732 {
733 .name = "d16:green:",
734 .gpio = MMGPIO_GPIO_BASE + 3,
735 .default_state = LEDS_GPIO_DEFSTATE_ON,
736 },
737 {
738 .name = "d17:green:",
739 .gpio = MMGPIO_GPIO_BASE + 4,
740 .default_state = LEDS_GPIO_DEFSTATE_ON,
741 },
742 {
743 .name = "d18:green:",
744 .gpio = MMGPIO_GPIO_BASE + 5,
745 .default_state = LEDS_GPIO_DEFSTATE_ON,
746 },
747 {
748 .name = "d19:green:",
749 .gpio = MMGPIO_GPIO_BASE + 6,
750 .default_state = LEDS_GPIO_DEFSTATE_ON,
751 },
752 {
753 .name = "d20:green:",
754 .gpio = MMGPIO_GPIO_BASE + 7,
755 .default_state = LEDS_GPIO_DEFSTATE_ON,
756 },
699}; 757};
700 758
759static const struct gpio_led_platform_data gpio_leds_pdata = {
760 .leds = gpio_leds,
761 .num_leds = ARRAY_SIZE(gpio_leds),
762};
763
764static struct s3c_hsotg_plat crag6410_hsotg_pdata;
765
701static void __init crag6410_machine_init(void) 766static void __init crag6410_machine_init(void)
702{ 767{
703 /* Open drain IRQs need pullups */ 768 /* Open drain IRQs need pullups */
@@ -722,14 +787,18 @@ static void __init crag6410_machine_init(void)
722 s3c_i2c0_set_platdata(&i2c0_pdata); 787 s3c_i2c0_set_platdata(&i2c0_pdata);
723 s3c_i2c1_set_platdata(&i2c1_pdata); 788 s3c_i2c1_set_platdata(&i2c1_pdata);
724 s3c_fb_set_platdata(&crag6410_lcd_pdata); 789 s3c_fb_set_platdata(&crag6410_lcd_pdata);
790 s3c_hsotg_set_platdata(&crag6410_hsotg_pdata);
725 791
726 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0)); 792 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
727 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); 793 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
728 794
729 samsung_keypad_set_platdata(&crag6410_keypad_data); 795 samsung_keypad_set_platdata(&crag6410_keypad_data);
796 s3c64xx_spi0_set_platdata(&s3c64xx_spi0_pdata, 0, 1);
730 797
731 platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices)); 798 platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
732 799
800 gpio_led_register_device(-1, &gpio_leds_pdata);
801
733 regulator_has_full_constraints(); 802 regulator_has_full_constraints();
734 803
735 s3c64xx_pm_init(); 804 s3c64xx_pm_init();
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index ce31db13623..ce745e19aa2 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -187,6 +187,8 @@ static struct s3c_hwmon_pdata smartq_hwmon_pdata __initdata = {
187 }, 187 },
188}; 188};
189 189
190static struct s3c_hsotg_plat smartq_hsotg_pdata;
191
190static int __init smartq_lcd_setup_gpio(void) 192static int __init smartq_lcd_setup_gpio(void)
191{ 193{
192 int ret; 194 int ret;
@@ -383,6 +385,7 @@ void __init smartq_map_io(void)
383void __init smartq_machine_init(void) 385void __init smartq_machine_init(void)
384{ 386{
385 s3c_i2c0_set_platdata(NULL); 387 s3c_i2c0_set_platdata(NULL);
388 s3c_hsotg_set_platdata(&smartq_hsotg_pdata);
386 s3c_hwmon_set_platdata(&smartq_hwmon_pdata); 389 s3c_hwmon_set_platdata(&smartq_hwmon_pdata);
387 s3c_sdhci1_set_platdata(&smartq_internal_hsmmc_pdata); 390 s3c_sdhci1_set_platdata(&smartq_internal_hsmmc_pdata);
388 s3c_sdhci2_set_platdata(&smartq_internal_hsmmc_pdata); 391 s3c_sdhci2_set_platdata(&smartq_internal_hsmmc_pdata);
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index ca6fc204f0e..d55bc96d958 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -72,6 +72,7 @@
72#include <plat/keypad.h> 72#include <plat/keypad.h>
73#include <plat/backlight.h> 73#include <plat/backlight.h>
74#include <plat/regs-fb-v4.h> 74#include <plat/regs-fb-v4.h>
75#include <plat/udc-hs.h>
75 76
76#include "common.h" 77#include "common.h"
77 78
@@ -631,6 +632,8 @@ static struct platform_pwm_backlight_data smdk6410_bl_data = {
631 .pwm_id = 1, 632 .pwm_id = 1,
632}; 633};
633 634
635static struct s3c_hsotg_plat smdk6410_hsotg_pdata;
636
634static void __init smdk6410_map_io(void) 637static void __init smdk6410_map_io(void)
635{ 638{
636 u32 tmp; 639 u32 tmp;
@@ -659,6 +662,7 @@ static void __init smdk6410_machine_init(void)
659 s3c_i2c0_set_platdata(NULL); 662 s3c_i2c0_set_platdata(NULL);
660 s3c_i2c1_set_platdata(NULL); 663 s3c_i2c1_set_platdata(NULL);
661 s3c_fb_set_platdata(&smdk6410_lcd_pdata); 664 s3c_fb_set_platdata(&smdk6410_lcd_pdata);
665 s3c_hsotg_set_platdata(&smdk6410_hsotg_pdata);
662 666
663 samsung_keypad_set_platdata(&smdk6410_keypad_data); 667 samsung_keypad_set_platdata(&smdk6410_keypad_data);
664 668
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c b/arch/arm/mach-s3c64xx/setup-usb-phy.c
new file mode 100644
index 00000000000..f6757e02d7d
--- /dev/null
+++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
@@ -0,0 +1,90 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 */
11
12#include <linux/clk.h>
13#include <linux/delay.h>
14#include <linux/err.h>
15#include <linux/io.h>
16#include <linux/platform_device.h>
17#include <mach/map.h>
18#include <mach/regs-sys.h>
19#include <plat/cpu.h>
20#include <plat/regs-usb-hsotg-phy.h>
21#include <plat/usb-phy.h>
22
23static int s3c_usb_otgphy_init(struct platform_device *pdev)
24{
25 struct clk *xusbxti;
26 u32 phyclk;
27
28 writel(readl(S3C64XX_OTHERS) | S3C64XX_OTHERS_USBMASK, S3C64XX_OTHERS);
29
30 /* set clock frequency for PLL */
31 phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK;
32
33 xusbxti = clk_get(&pdev->dev, "xusbxti");
34 if (xusbxti && !IS_ERR(xusbxti)) {
35 switch (clk_get_rate(xusbxti)) {
36 case 12 * MHZ:
37 phyclk |= S3C_PHYCLK_CLKSEL_12M;
38 break;
39 case 24 * MHZ:
40 phyclk |= S3C_PHYCLK_CLKSEL_24M;
41 break;
42 default:
43 case 48 * MHZ:
44 /* default reference clock */
45 break;
46 }
47 clk_put(xusbxti);
48 }
49
50 /* TODO: select external clock/oscillator */
51 writel(phyclk | S3C_PHYCLK_CLK_FORCE, S3C_PHYCLK);
52
53 /* set to normal OTG PHY */
54 writel((readl(S3C_PHYPWR) & ~S3C_PHYPWR_NORMAL_MASK), S3C_PHYPWR);
55 mdelay(1);
56
57 /* reset OTG PHY and Link */
58 writel(S3C_RSTCON_PHY | S3C_RSTCON_HCLK | S3C_RSTCON_PHYCLK,
59 S3C_RSTCON);
60 udelay(20); /* at-least 10uS */
61 writel(0, S3C_RSTCON);
62
63 return 0;
64}
65
66static int s3c_usb_otgphy_exit(struct platform_device *pdev)
67{
68 writel((readl(S3C_PHYPWR) | S3C_PHYPWR_ANALOG_POWERDOWN |
69 S3C_PHYPWR_OTG_DISABLE), S3C_PHYPWR);
70
71 writel(readl(S3C64XX_OTHERS) & ~S3C64XX_OTHERS_USBMASK, S3C64XX_OTHERS);
72
73 return 0;
74}
75
76int s5p_usb_phy_init(struct platform_device *pdev, int type)
77{
78 if (type == S5P_USB_PHY_DEVICE)
79 return s3c_usb_otgphy_init(pdev);
80
81 return -EINVAL;
82}
83
84int s5p_usb_phy_exit(struct platform_device *pdev, int type)
85{
86 if (type == S5P_USB_PHY_DEVICE)
87 return s3c_usb_otgphy_exit(pdev);
88
89 return -EINVAL;
90}
diff --git a/arch/arm/mach-s5p64x0/clock.c b/arch/arm/mach-s5p64x0/clock.c
index 241d0e645c8..57e718957ef 100644
--- a/arch/arm/mach-s5p64x0/clock.c
+++ b/arch/arm/mach-s5p64x0/clock.c
@@ -73,7 +73,7 @@ static const u32 clock_table[][3] = {
73 {L2 * 1000, (3 << ARM_DIV_RATIO_SHIFT), (0 << S5P64X0_CLKDIV0_HCLK_SHIFT)}, 73 {L2 * 1000, (3 << ARM_DIV_RATIO_SHIFT), (0 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
74}; 74};
75 75
76unsigned long s5p64x0_armclk_get_rate(struct clk *clk) 76static unsigned long s5p64x0_armclk_get_rate(struct clk *clk)
77{ 77{
78 unsigned long rate = clk_get_rate(clk->parent); 78 unsigned long rate = clk_get_rate(clk->parent);
79 u32 clkdiv; 79 u32 clkdiv;
@@ -84,7 +84,8 @@ unsigned long s5p64x0_armclk_get_rate(struct clk *clk)
84 return rate / (clkdiv + 1); 84 return rate / (clkdiv + 1);
85} 85}
86 86
87unsigned long s5p64x0_armclk_round_rate(struct clk *clk, unsigned long rate) 87static unsigned long s5p64x0_armclk_round_rate(struct clk *clk,
88 unsigned long rate)
88{ 89{
89 u32 iter; 90 u32 iter;
90 91
@@ -96,7 +97,7 @@ unsigned long s5p64x0_armclk_round_rate(struct clk *clk, unsigned long rate)
96 return clock_table[ARRAY_SIZE(clock_table) - 1][0]; 97 return clock_table[ARRAY_SIZE(clock_table) - 1][0];
97} 98}
98 99
99int s5p64x0_armclk_set_rate(struct clk *clk, unsigned long rate) 100static int s5p64x0_armclk_set_rate(struct clk *clk, unsigned long rate)
100{ 101{
101 u32 round_tmp; 102 u32 round_tmp;
102 u32 iter; 103 u32 iter;
@@ -148,7 +149,7 @@ int s5p64x0_armclk_set_rate(struct clk *clk, unsigned long rate)
148 return 0; 149 return 0;
149} 150}
150 151
151struct clk_ops s5p64x0_clkarm_ops = { 152static struct clk_ops s5p64x0_clkarm_ops = {
152 .get_rate = s5p64x0_armclk_get_rate, 153 .get_rate = s5p64x0_armclk_get_rate,
153 .set_rate = s5p64x0_armclk_set_rate, 154 .set_rate = s5p64x0_armclk_set_rate,
154 .round_rate = s5p64x0_armclk_round_rate, 155 .round_rate = s5p64x0_armclk_round_rate,
@@ -173,7 +174,7 @@ struct clksrc_clk clk_dout_mpll = {
173 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 4, .size = 1 }, 174 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 4, .size = 1 },
174}; 175};
175 176
176struct clk *clkset_hclk_low_list[] = { 177static struct clk *clkset_hclk_low_list[] = {
177 &clk_mout_apll.clk, 178 &clk_mout_apll.clk,
178 &clk_mout_mpll.clk, 179 &clk_mout_mpll.clk,
179}; 180};
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 52b89a37644..9143f8b1996 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -146,15 +146,12 @@ static void s5p64x0_idle(void)
146{ 146{
147 unsigned long val; 147 unsigned long val;
148 148
149 if (!need_resched()) { 149 val = __raw_readl(S5P64X0_PWR_CFG);
150 val = __raw_readl(S5P64X0_PWR_CFG); 150 val &= ~(0x3 << 5);
151 val &= ~(0x3 << 5); 151 val |= (0x1 << 5);
152 val |= (0x1 << 5); 152 __raw_writel(val, S5P64X0_PWR_CFG);
153 __raw_writel(val, S5P64X0_PWR_CFG);
154 153
155 cpu_do_idle(); 154 cpu_do_idle();
156 }
157 local_irq_enable();
158} 155}
159 156
160/* 157/*
@@ -286,7 +283,7 @@ int __init s5p64x0_init(void)
286 printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n"); 283 printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n");
287 284
288 /* set idle function */ 285 /* set idle function */
289 pm_idle = s5p64x0_idle; 286 arm_pm_idle = s5p64x0_idle;
290 287
291 return device_register(&s5p64x0_dev); 288 return device_register(&s5p64x0_dev);
292} 289}
diff --git a/arch/arm/mach-s5p64x0/dma.c b/arch/arm/mach-s5p64x0/dma.c
index f820c074440..2ee5dc069b3 100644
--- a/arch/arm/mach-s5p64x0/dma.c
+++ b/arch/arm/mach-s5p64x0/dma.c
@@ -38,7 +38,7 @@
38 38
39static u64 dma_dmamask = DMA_BIT_MASK(32); 39static u64 dma_dmamask = DMA_BIT_MASK(32);
40 40
41u8 s5p6440_pdma_peri[] = { 41static u8 s5p6440_pdma_peri[] = {
42 DMACH_UART0_RX, 42 DMACH_UART0_RX,
43 DMACH_UART0_TX, 43 DMACH_UART0_TX,
44 DMACH_UART1_RX, 44 DMACH_UART1_RX,
@@ -63,12 +63,12 @@ u8 s5p6440_pdma_peri[] = {
63 DMACH_SPI1_RX, 63 DMACH_SPI1_RX,
64}; 64};
65 65
66struct dma_pl330_platdata s5p6440_pdma_pdata = { 66static struct dma_pl330_platdata s5p6440_pdma_pdata = {
67 .nr_valid_peri = ARRAY_SIZE(s5p6440_pdma_peri), 67 .nr_valid_peri = ARRAY_SIZE(s5p6440_pdma_peri),
68 .peri_id = s5p6440_pdma_peri, 68 .peri_id = s5p6440_pdma_peri,
69}; 69};
70 70
71u8 s5p6450_pdma_peri[] = { 71static u8 s5p6450_pdma_peri[] = {
72 DMACH_UART0_RX, 72 DMACH_UART0_RX,
73 DMACH_UART0_TX, 73 DMACH_UART0_TX,
74 DMACH_UART1_RX, 74 DMACH_UART1_RX,
@@ -103,39 +103,27 @@ u8 s5p6450_pdma_peri[] = {
103 DMACH_UART5_TX, 103 DMACH_UART5_TX,
104}; 104};
105 105
106struct dma_pl330_platdata s5p6450_pdma_pdata = { 106static struct dma_pl330_platdata s5p6450_pdma_pdata = {
107 .nr_valid_peri = ARRAY_SIZE(s5p6450_pdma_peri), 107 .nr_valid_peri = ARRAY_SIZE(s5p6450_pdma_peri),
108 .peri_id = s5p6450_pdma_peri, 108 .peri_id = s5p6450_pdma_peri,
109}; 109};
110 110
111struct amba_device s5p64x0_device_pdma = { 111static AMBA_AHB_DEVICE(s5p64x0_pdma, "dma-pl330", 0x00041330,
112 .dev = { 112 S5P64X0_PA_PDMA, {IRQ_DMA0}, NULL);
113 .init_name = "dma-pl330",
114 .dma_mask = &dma_dmamask,
115 .coherent_dma_mask = DMA_BIT_MASK(32),
116 },
117 .res = {
118 .start = S5P64X0_PA_PDMA,
119 .end = S5P64X0_PA_PDMA + SZ_4K,
120 .flags = IORESOURCE_MEM,
121 },
122 .irq = {IRQ_DMA0, NO_IRQ},
123 .periphid = 0x00041330,
124};
125 113
126static int __init s5p64x0_dma_init(void) 114static int __init s5p64x0_dma_init(void)
127{ 115{
128 if (soc_is_s5p6450()) { 116 if (soc_is_s5p6450()) {
129 dma_cap_set(DMA_SLAVE, s5p6450_pdma_pdata.cap_mask); 117 dma_cap_set(DMA_SLAVE, s5p6450_pdma_pdata.cap_mask);
130 dma_cap_set(DMA_CYCLIC, s5p6450_pdma_pdata.cap_mask); 118 dma_cap_set(DMA_CYCLIC, s5p6450_pdma_pdata.cap_mask);
131 s5p64x0_device_pdma.dev.platform_data = &s5p6450_pdma_pdata; 119 s5p64x0_pdma_device.dev.platform_data = &s5p6450_pdma_pdata;
132 } else { 120 } else {
133 dma_cap_set(DMA_SLAVE, s5p6440_pdma_pdata.cap_mask); 121 dma_cap_set(DMA_SLAVE, s5p6440_pdma_pdata.cap_mask);
134 dma_cap_set(DMA_CYCLIC, s5p6440_pdma_pdata.cap_mask); 122 dma_cap_set(DMA_CYCLIC, s5p6440_pdma_pdata.cap_mask);
135 s5p64x0_device_pdma.dev.platform_data = &s5p6440_pdma_pdata; 123 s5p64x0_pdma_device.dev.platform_data = &s5p6440_pdma_pdata;
136 } 124 }
137 125
138 amba_device_register(&s5p64x0_device_pdma, &iomem_resource); 126 amba_device_register(&s5p64x0_pdma_device, &iomem_resource);
139 127
140 return 0; 128 return 0;
141} 129}
diff --git a/arch/arm/mach-s5p64x0/include/mach/entry-macro.S b/arch/arm/mach-s5p64x0/include/mach/entry-macro.S
deleted file mode 100644
index fbb246d0a3d..00000000000
--- a/arch/arm/mach-s5p64x0/include/mach/entry-macro.S
+++ /dev/null
@@ -1,17 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/entry-macro.S
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Low-level IRQ helper macros for the Samsung S5P64X0
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 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
diff --git a/arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h b/arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h
index ff85b4b6e8d..0ef47d1b767 100644
--- a/arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h
+++ b/arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h
@@ -22,16 +22,9 @@ extern struct clksrc_clk clk_mout_epll;
22extern int s5p64x0_epll_enable(struct clk *clk, int enable); 22extern int s5p64x0_epll_enable(struct clk *clk, int enable);
23extern unsigned long s5p64x0_epll_get_rate(struct clk *clk); 23extern unsigned long s5p64x0_epll_get_rate(struct clk *clk);
24 24
25extern unsigned long s5p64x0_armclk_get_rate(struct clk *clk);
26extern unsigned long s5p64x0_armclk_round_rate(struct clk *clk, unsigned long rate);
27extern int s5p64x0_armclk_set_rate(struct clk *clk, unsigned long rate);
28
29extern struct clk_ops s5p64x0_clkarm_ops;
30
31extern struct clksrc_clk clk_armclk; 25extern struct clksrc_clk clk_armclk;
32extern struct clksrc_clk clk_dout_mpll; 26extern struct clksrc_clk clk_dout_mpll;
33 27
34extern struct clk *clkset_hclk_low_list[];
35extern struct clksrc_sources clkset_hclk_low; 28extern struct clksrc_sources clkset_hclk_low;
36 29
37extern int s5p64x0_pclk_ctrl(struct clk *clk, int enable); 30extern int s5p64x0_pclk_ctrl(struct clk *clk, int enable);
diff --git a/arch/arm/mach-s5p64x0/include/mach/system.h b/arch/arm/mach-s5p64x0/include/mach/system.h
deleted file mode 100644
index cf26e0954a2..00000000000
--- a/arch/arm/mach-s5p64x0/include/mach/system.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/system.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - system support header
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_SYSTEM_H
14#define __ASM_ARCH_SYSTEM_H __FILE__
15
16static void arch_idle(void)
17{
18 /* nothing here yet */
19}
20
21#endif /* __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-s5pc100/clock.c b/arch/arm/mach-s5pc100/clock.c
index 247194dd366..16eca4ea201 100644
--- a/arch/arm/mach-s5pc100/clock.c
+++ b/arch/arm/mach-s5pc100/clock.c
@@ -170,7 +170,7 @@ static struct clk *clk_src_mout_am_list[] = {
170 [1] = &clk_div_apll2.clk, 170 [1] = &clk_div_apll2.clk,
171}; 171};
172 172
173struct clksrc_sources clk_src_mout_am = { 173static struct clksrc_sources clk_src_mout_am = {
174 .sources = clk_src_mout_am_list, 174 .sources = clk_src_mout_am_list,
175 .nr_sources = ARRAY_SIZE(clk_src_mout_am_list), 175 .nr_sources = ARRAY_SIZE(clk_src_mout_am_list),
176}; 176};
@@ -212,7 +212,7 @@ static struct clk *clk_src_mout_onenand_list[] = {
212 [1] = &clk_div_d1_bus.clk, 212 [1] = &clk_div_d1_bus.clk,
213}; 213};
214 214
215struct clksrc_sources clk_src_mout_onenand = { 215static struct clksrc_sources clk_src_mout_onenand = {
216 .sources = clk_src_mout_onenand_list, 216 .sources = clk_src_mout_onenand_list,
217 .nr_sources = ARRAY_SIZE(clk_src_mout_onenand_list), 217 .nr_sources = ARRAY_SIZE(clk_src_mout_onenand_list),
218}; 218};
@@ -756,7 +756,7 @@ static struct clk *clk_src_group1_list[] = {
756 [3] = &clk_mout_hpll.clk, 756 [3] = &clk_mout_hpll.clk,
757}; 757};
758 758
759struct clksrc_sources clk_src_group1 = { 759static struct clksrc_sources clk_src_group1 = {
760 .sources = clk_src_group1_list, 760 .sources = clk_src_group1_list,
761 .nr_sources = ARRAY_SIZE(clk_src_group1_list), 761 .nr_sources = ARRAY_SIZE(clk_src_group1_list),
762}; 762};
@@ -766,7 +766,7 @@ static struct clk *clk_src_group2_list[] = {
766 [1] = &clk_div_mpll.clk, 766 [1] = &clk_div_mpll.clk,
767}; 767};
768 768
769struct clksrc_sources clk_src_group2 = { 769static struct clksrc_sources clk_src_group2 = {
770 .sources = clk_src_group2_list, 770 .sources = clk_src_group2_list,
771 .nr_sources = ARRAY_SIZE(clk_src_group2_list), 771 .nr_sources = ARRAY_SIZE(clk_src_group2_list),
772}; 772};
@@ -780,7 +780,7 @@ static struct clk *clk_src_group3_list[] = {
780 [5] = &clk_mout_hpll.clk, 780 [5] = &clk_mout_hpll.clk,
781}; 781};
782 782
783struct clksrc_sources clk_src_group3 = { 783static struct clksrc_sources clk_src_group3 = {
784 .sources = clk_src_group3_list, 784 .sources = clk_src_group3_list,
785 .nr_sources = ARRAY_SIZE(clk_src_group3_list), 785 .nr_sources = ARRAY_SIZE(clk_src_group3_list),
786}; 786};
@@ -806,7 +806,7 @@ static struct clk *clk_src_group4_list[] = {
806 [5] = &clk_mout_hpll.clk, 806 [5] = &clk_mout_hpll.clk,
807}; 807};
808 808
809struct clksrc_sources clk_src_group4 = { 809static struct clksrc_sources clk_src_group4 = {
810 .sources = clk_src_group4_list, 810 .sources = clk_src_group4_list,
811 .nr_sources = ARRAY_SIZE(clk_src_group4_list), 811 .nr_sources = ARRAY_SIZE(clk_src_group4_list),
812}; 812};
@@ -831,7 +831,7 @@ static struct clk *clk_src_group5_list[] = {
831 [4] = &clk_mout_hpll.clk, 831 [4] = &clk_mout_hpll.clk,
832}; 832};
833 833
834struct clksrc_sources clk_src_group5 = { 834static struct clksrc_sources clk_src_group5 = {
835 .sources = clk_src_group5_list, 835 .sources = clk_src_group5_list,
836 .nr_sources = ARRAY_SIZE(clk_src_group5_list), 836 .nr_sources = ARRAY_SIZE(clk_src_group5_list),
837}; 837};
@@ -854,7 +854,7 @@ static struct clk *clk_src_group6_list[] = {
854 [2] = &clk_div_hdmi.clk, 854 [2] = &clk_div_hdmi.clk,
855}; 855};
856 856
857struct clksrc_sources clk_src_group6 = { 857static struct clksrc_sources clk_src_group6 = {
858 .sources = clk_src_group6_list, 858 .sources = clk_src_group6_list,
859 .nr_sources = ARRAY_SIZE(clk_src_group6_list), 859 .nr_sources = ARRAY_SIZE(clk_src_group6_list),
860}; 860};
@@ -866,7 +866,7 @@ static struct clk *clk_src_group7_list[] = {
866 [3] = &clk_vclk54m, 866 [3] = &clk_vclk54m,
867}; 867};
868 868
869struct clksrc_sources clk_src_group7 = { 869static struct clksrc_sources clk_src_group7 = {
870 .sources = clk_src_group7_list, 870 .sources = clk_src_group7_list,
871 .nr_sources = ARRAY_SIZE(clk_src_group7_list), 871 .nr_sources = ARRAY_SIZE(clk_src_group7_list),
872}; 872};
@@ -877,7 +877,7 @@ static struct clk *clk_src_mmc0_list[] = {
877 [2] = &clk_fin_epll, 877 [2] = &clk_fin_epll,
878}; 878};
879 879
880struct clksrc_sources clk_src_mmc0 = { 880static struct clksrc_sources clk_src_mmc0 = {
881 .sources = clk_src_mmc0_list, 881 .sources = clk_src_mmc0_list,
882 .nr_sources = ARRAY_SIZE(clk_src_mmc0_list), 882 .nr_sources = ARRAY_SIZE(clk_src_mmc0_list),
883}; 883};
@@ -889,7 +889,7 @@ static struct clk *clk_src_mmc12_list[] = {
889 [3] = &clk_mout_hpll.clk, 889 [3] = &clk_mout_hpll.clk,
890}; 890};
891 891
892struct clksrc_sources clk_src_mmc12 = { 892static struct clksrc_sources clk_src_mmc12 = {
893 .sources = clk_src_mmc12_list, 893 .sources = clk_src_mmc12_list,
894 .nr_sources = ARRAY_SIZE(clk_src_mmc12_list), 894 .nr_sources = ARRAY_SIZE(clk_src_mmc12_list),
895}; 895};
@@ -901,7 +901,7 @@ static struct clk *clk_src_irda_usb_list[] = {
901 [3] = &clk_mout_hpll.clk, 901 [3] = &clk_mout_hpll.clk,
902}; 902};
903 903
904struct clksrc_sources clk_src_irda_usb = { 904static struct clksrc_sources clk_src_irda_usb = {
905 .sources = clk_src_irda_usb_list, 905 .sources = clk_src_irda_usb_list,
906 .nr_sources = ARRAY_SIZE(clk_src_irda_usb_list), 906 .nr_sources = ARRAY_SIZE(clk_src_irda_usb_list),
907}; 907};
@@ -912,7 +912,7 @@ static struct clk *clk_src_pwi_list[] = {
912 [2] = &clk_div_mpll.clk, 912 [2] = &clk_div_mpll.clk,
913}; 913};
914 914
915struct clksrc_sources clk_src_pwi = { 915static struct clksrc_sources clk_src_pwi = {
916 .sources = clk_src_pwi_list, 916 .sources = clk_src_pwi_list,
917 .nr_sources = ARRAY_SIZE(clk_src_pwi_list), 917 .nr_sources = ARRAY_SIZE(clk_src_pwi_list),
918}; 918};
@@ -923,7 +923,7 @@ static struct clk *clk_sclk_spdif_list[] = {
923 [2] = &clk_sclk_audio2.clk, 923 [2] = &clk_sclk_audio2.clk,
924}; 924};
925 925
926struct clksrc_sources clk_src_sclk_spdif = { 926static struct clksrc_sources clk_src_sclk_spdif = {
927 .sources = clk_sclk_spdif_list, 927 .sources = clk_sclk_spdif_list,
928 .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list), 928 .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list),
929}; 929};
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index c9095730a7f..ff71e2d467c 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -129,14 +129,6 @@ static struct map_desc s5pc100_iodesc[] __initdata = {
129 } 129 }
130}; 130};
131 131
132static void s5pc100_idle(void)
133{
134 if (!need_resched())
135 cpu_do_idle();
136
137 local_irq_enable();
138}
139
140/* 132/*
141 * s5pc100_map_io 133 * s5pc100_map_io
142 * 134 *
@@ -210,10 +202,6 @@ core_initcall(s5pc100_core_init);
210int __init s5pc100_init(void) 202int __init s5pc100_init(void)
211{ 203{
212 printk(KERN_INFO "S5PC100: Initializing architecture\n"); 204 printk(KERN_INFO "S5PC100: Initializing architecture\n");
213
214 /* set idle function */
215 pm_idle = s5pc100_idle;
216
217 return device_register(&s5pc100_dev); 205 return device_register(&s5pc100_dev);
218} 206}
219 207
diff --git a/arch/arm/mach-s5pc100/dma.c b/arch/arm/mach-s5pc100/dma.c
index c841f4d313f..afd8db2d599 100644
--- a/arch/arm/mach-s5pc100/dma.c
+++ b/arch/arm/mach-s5pc100/dma.c
@@ -35,7 +35,7 @@
35 35
36static u64 dma_dmamask = DMA_BIT_MASK(32); 36static u64 dma_dmamask = DMA_BIT_MASK(32);
37 37
38u8 pdma0_peri[] = { 38static u8 pdma0_peri[] = {
39 DMACH_UART0_RX, 39 DMACH_UART0_RX,
40 DMACH_UART0_TX, 40 DMACH_UART0_TX,
41 DMACH_UART1_RX, 41 DMACH_UART1_RX,
@@ -68,28 +68,15 @@ u8 pdma0_peri[] = {
68 DMACH_HSI_TX, 68 DMACH_HSI_TX,
69}; 69};
70 70
71struct dma_pl330_platdata s5pc100_pdma0_pdata = { 71static struct dma_pl330_platdata s5pc100_pdma0_pdata = {
72 .nr_valid_peri = ARRAY_SIZE(pdma0_peri), 72 .nr_valid_peri = ARRAY_SIZE(pdma0_peri),
73 .peri_id = pdma0_peri, 73 .peri_id = pdma0_peri,
74}; 74};
75 75
76struct amba_device s5pc100_device_pdma0 = { 76static AMBA_AHB_DEVICE(s5pc100_pdma0, "dma-pl330.0", 0x00041330,
77 .dev = { 77 S5PC100_PA_PDMA0, {IRQ_PDMA0}, &s5pc100_pdma0_pdata);
78 .init_name = "dma-pl330.0",
79 .dma_mask = &dma_dmamask,
80 .coherent_dma_mask = DMA_BIT_MASK(32),
81 .platform_data = &s5pc100_pdma0_pdata,
82 },
83 .res = {
84 .start = S5PC100_PA_PDMA0,
85 .end = S5PC100_PA_PDMA0 + SZ_4K,
86 .flags = IORESOURCE_MEM,
87 },
88 .irq = {IRQ_PDMA0, NO_IRQ},
89 .periphid = 0x00041330,
90};
91 78
92u8 pdma1_peri[] = { 79static u8 pdma1_peri[] = {
93 DMACH_UART0_RX, 80 DMACH_UART0_RX,
94 DMACH_UART0_TX, 81 DMACH_UART0_TX,
95 DMACH_UART1_RX, 82 DMACH_UART1_RX,
@@ -122,36 +109,23 @@ u8 pdma1_peri[] = {
122 DMACH_MSM_REQ3, 109 DMACH_MSM_REQ3,
123}; 110};
124 111
125struct dma_pl330_platdata s5pc100_pdma1_pdata = { 112static struct dma_pl330_platdata s5pc100_pdma1_pdata = {
126 .nr_valid_peri = ARRAY_SIZE(pdma1_peri), 113 .nr_valid_peri = ARRAY_SIZE(pdma1_peri),
127 .peri_id = pdma1_peri, 114 .peri_id = pdma1_peri,
128}; 115};
129 116
130struct amba_device s5pc100_device_pdma1 = { 117static AMBA_AHB_DEVICE(s5pc100_pdma1, "dma-pl330.1", 0x00041330,
131 .dev = { 118 S5PC100_PA_PDMA1, {IRQ_PDMA1}, &s5pc100_pdma1_pdata);
132 .init_name = "dma-pl330.1",
133 .dma_mask = &dma_dmamask,
134 .coherent_dma_mask = DMA_BIT_MASK(32),
135 .platform_data = &s5pc100_pdma1_pdata,
136 },
137 .res = {
138 .start = S5PC100_PA_PDMA1,
139 .end = S5PC100_PA_PDMA1 + SZ_4K,
140 .flags = IORESOURCE_MEM,
141 },
142 .irq = {IRQ_PDMA1, NO_IRQ},
143 .periphid = 0x00041330,
144};
145 119
146static int __init s5pc100_dma_init(void) 120static int __init s5pc100_dma_init(void)
147{ 121{
148 dma_cap_set(DMA_SLAVE, s5pc100_pdma0_pdata.cap_mask); 122 dma_cap_set(DMA_SLAVE, s5pc100_pdma0_pdata.cap_mask);
149 dma_cap_set(DMA_CYCLIC, s5pc100_pdma0_pdata.cap_mask); 123 dma_cap_set(DMA_CYCLIC, s5pc100_pdma0_pdata.cap_mask);
150 amba_device_register(&s5pc100_device_pdma0, &iomem_resource); 124 amba_device_register(&s5pc100_pdma0_device, &iomem_resource);
151 125
152 dma_cap_set(DMA_SLAVE, s5pc100_pdma1_pdata.cap_mask); 126 dma_cap_set(DMA_SLAVE, s5pc100_pdma1_pdata.cap_mask);
153 dma_cap_set(DMA_CYCLIC, s5pc100_pdma1_pdata.cap_mask); 127 dma_cap_set(DMA_CYCLIC, s5pc100_pdma1_pdata.cap_mask);
154 amba_device_register(&s5pc100_device_pdma1, &iomem_resource); 128 amba_device_register(&s5pc100_pdma1_device, &iomem_resource);
155 129
156 return 0; 130 return 0;
157} 131}
diff --git a/arch/arm/mach-s5pc100/include/mach/entry-macro.S b/arch/arm/mach-s5pc100/include/mach/entry-macro.S
index b8c242edfa2..bad0700457d 100644
--- a/arch/arm/mach-s5pc100/include/mach/entry-macro.S
+++ b/arch/arm/mach-s5pc100/include/mach/entry-macro.S
@@ -12,14 +12,8 @@
12 * warranty of any kind, whether express or implied. 12 * warranty of any kind, whether express or implied.
13*/ 13*/
14 14
15 .macro disable_fiq
16 .endm
17
18 .macro get_irqnr_preamble, base, tmp 15 .macro get_irqnr_preamble, base, tmp
19 .endm 16 .endm
20 17
21 .macro arch_ret_to_user, tmp1, tmp2
22 .endm
23
24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 18 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
25 .endm 19 .endm
diff --git a/arch/arm/mach-s5pc100/include/mach/system.h b/arch/arm/mach-s5pc100/include/mach/system.h
deleted file mode 100644
index afc96c29851..00000000000
--- a/arch/arm/mach-s5pc100/include/mach/system.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/system.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - system implementation
7 *
8 * Based on mach-s3c6400/include/mach/system.h
9 */
10
11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H __FILE__
13
14static void arch_idle(void)
15{
16 /* nothing here yet */
17}
18
19#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 2cdc42e838b..29594fc4fdf 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -65,6 +65,11 @@ config S5PV210_SETUP_SPI
65 help 65 help
66 Common setup code for SPI GPIO configurations. 66 Common setup code for SPI GPIO configurations.
67 67
68config S5PV210_SETUP_USB_PHY
69 bool
70 help
71 Common setup code for USB PHY controller
72
68menu "S5PC110 Machines" 73menu "S5PC110 Machines"
69 74
70config MACH_AQUILA 75config MACH_AQUILA
@@ -107,6 +112,7 @@ config MACH_GONI
107 select S5PV210_SETUP_KEYPAD 112 select S5PV210_SETUP_KEYPAD
108 select S5PV210_SETUP_SDHCI 113 select S5PV210_SETUP_SDHCI
109 select S5PV210_SETUP_FIMC 114 select S5PV210_SETUP_FIMC
115 select S5PV210_SETUP_USB_PHY
110 help 116 help
111 Machine support for Samsung GONI board 117 Machine support for Samsung GONI board
112 S5PC110(MCP) is one of package option of S5PV210 118 S5PC110(MCP) is one of package option of S5PV210
@@ -118,6 +124,10 @@ config MACH_SMDKC110
118 select S3C_DEV_I2C2 124 select S3C_DEV_I2C2
119 select S3C_DEV_RTC 125 select S3C_DEV_RTC
120 select S3C_DEV_WDT 126 select S3C_DEV_WDT
127 select S5P_DEV_FIMC0
128 select S5P_DEV_FIMC1
129 select S5P_DEV_FIMC2
130 select S5P_DEV_MFC
121 select SAMSUNG_DEV_IDE 131 select SAMSUNG_DEV_IDE
122 select S5PV210_SETUP_I2C1 132 select S5PV210_SETUP_I2C1
123 select S5PV210_SETUP_I2C2 133 select S5PV210_SETUP_I2C2
@@ -142,6 +152,11 @@ config MACH_SMDKV210
142 select S3C_DEV_I2C2 152 select S3C_DEV_I2C2
143 select S3C_DEV_RTC 153 select S3C_DEV_RTC
144 select S3C_DEV_WDT 154 select S3C_DEV_WDT
155 select S5P_DEV_FIMC0
156 select S5P_DEV_FIMC1
157 select S5P_DEV_FIMC2
158 select S5P_DEV_JPEG
159 select S5P_DEV_MFC
145 select SAMSUNG_DEV_ADC 160 select SAMSUNG_DEV_ADC
146 select SAMSUNG_DEV_BACKLIGHT 161 select SAMSUNG_DEV_BACKLIGHT
147 select SAMSUNG_DEV_IDE 162 select SAMSUNG_DEV_IDE
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 76a121dd52b..1c4e41998a1 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -39,3 +39,4 @@ obj-$(CONFIG_S5PV210_SETUP_IDE) += setup-ide.o
39obj-$(CONFIG_S5PV210_SETUP_KEYPAD) += setup-keypad.o 39obj-$(CONFIG_S5PV210_SETUP_KEYPAD) += setup-keypad.o
40obj-$(CONFIG_S5PV210_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o 40obj-$(CONFIG_S5PV210_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
41obj-$(CONFIG_S5PV210_SETUP_SPI) += setup-spi.o 41obj-$(CONFIG_S5PV210_SETUP_SPI) += setup-spi.o
42obj-$(CONFIG_S5PV210_SETUP_USB_PHY) += setup-usb-phy.o
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index b9ec0c35379..09609d50961 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -340,6 +340,11 @@ static struct clk init_clocks_off[] = {
340 .enable = s5pv210_clk_ip0_ctrl, 340 .enable = s5pv210_clk_ip0_ctrl,
341 .ctrlbit = (1 << 26), 341 .ctrlbit = (1 << 26),
342 }, { 342 }, {
343 .name = "jpeg",
344 .parent = &clk_hclk_dsys.clk,
345 .enable = s5pv210_clk_ip0_ctrl,
346 .ctrlbit = (1 << 28),
347 }, {
343 .name = "mfc", 348 .name = "mfc",
344 .devname = "s5p-mfc", 349 .devname = "s5p-mfc",
345 .parent = &clk_pclk_psys.clk, 350 .parent = &clk_pclk_psys.clk,
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 9c1bcdcc12c..4c9e9027df9 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -142,14 +142,6 @@ static struct map_desc s5pv210_iodesc[] __initdata = {
142 } 142 }
143}; 143};
144 144
145static void s5pv210_idle(void)
146{
147 if (!need_resched())
148 cpu_do_idle();
149
150 local_irq_enable();
151}
152
153void s5pv210_restart(char mode, const char *cmd) 145void s5pv210_restart(char mode, const char *cmd)
154{ 146{
155 __raw_writel(0x1, S5P_SWRESET); 147 __raw_writel(0x1, S5P_SWRESET);
@@ -247,10 +239,6 @@ core_initcall(s5pv210_core_init);
247int __init s5pv210_init(void) 239int __init s5pv210_init(void)
248{ 240{
249 printk(KERN_INFO "S5PV210: Initializing architecture\n"); 241 printk(KERN_INFO "S5PV210: Initializing architecture\n");
250
251 /* set idle function */
252 pm_idle = s5pv210_idle;
253
254 return device_register(&s5pv210_dev); 242 return device_register(&s5pv210_dev);
255} 243}
256 244
diff --git a/arch/arm/mach-s5pv210/dma.c b/arch/arm/mach-s5pv210/dma.c
index a6113e0267f..86ce62f6619 100644
--- a/arch/arm/mach-s5pv210/dma.c
+++ b/arch/arm/mach-s5pv210/dma.c
@@ -35,7 +35,7 @@
35 35
36static u64 dma_dmamask = DMA_BIT_MASK(32); 36static u64 dma_dmamask = DMA_BIT_MASK(32);
37 37
38u8 pdma0_peri[] = { 38static u8 pdma0_peri[] = {
39 DMACH_UART0_RX, 39 DMACH_UART0_RX,
40 DMACH_UART0_TX, 40 DMACH_UART0_TX,
41 DMACH_UART1_RX, 41 DMACH_UART1_RX,
@@ -66,28 +66,15 @@ u8 pdma0_peri[] = {
66 DMACH_SPDIF, 66 DMACH_SPDIF,
67}; 67};
68 68
69struct dma_pl330_platdata s5pv210_pdma0_pdata = { 69static struct dma_pl330_platdata s5pv210_pdma0_pdata = {
70 .nr_valid_peri = ARRAY_SIZE(pdma0_peri), 70 .nr_valid_peri = ARRAY_SIZE(pdma0_peri),
71 .peri_id = pdma0_peri, 71 .peri_id = pdma0_peri,
72}; 72};
73 73
74struct amba_device s5pv210_device_pdma0 = { 74static AMBA_AHB_DEVICE(s5pv210_pdma0, "dma-pl330.0", 0x00041330,
75 .dev = { 75 S5PV210_PA_PDMA0, {IRQ_PDMA0}, &s5pv210_pdma0_pdata);
76 .init_name = "dma-pl330.0",
77 .dma_mask = &dma_dmamask,
78 .coherent_dma_mask = DMA_BIT_MASK(32),
79 .platform_data = &s5pv210_pdma0_pdata,
80 },
81 .res = {
82 .start = S5PV210_PA_PDMA0,
83 .end = S5PV210_PA_PDMA0 + SZ_4K,
84 .flags = IORESOURCE_MEM,
85 },
86 .irq = {IRQ_PDMA0, NO_IRQ},
87 .periphid = 0x00041330,
88};
89 76
90u8 pdma1_peri[] = { 77static u8 pdma1_peri[] = {
91 DMACH_UART0_RX, 78 DMACH_UART0_RX,
92 DMACH_UART0_TX, 79 DMACH_UART0_TX,
93 DMACH_UART1_RX, 80 DMACH_UART1_RX,
@@ -122,36 +109,23 @@ u8 pdma1_peri[] = {
122 DMACH_PCM2_TX, 109 DMACH_PCM2_TX,
123}; 110};
124 111
125struct dma_pl330_platdata s5pv210_pdma1_pdata = { 112static struct dma_pl330_platdata s5pv210_pdma1_pdata = {
126 .nr_valid_peri = ARRAY_SIZE(pdma1_peri), 113 .nr_valid_peri = ARRAY_SIZE(pdma1_peri),
127 .peri_id = pdma1_peri, 114 .peri_id = pdma1_peri,
128}; 115};
129 116
130struct amba_device s5pv210_device_pdma1 = { 117static AMBA_AHB_DEVICE(s5pv210_pdma1, "dma-pl330.1", 0x00041330,
131 .dev = { 118 S5PV210_PA_PDMA1, {IRQ_PDMA1}, &s5pv210_pdma1_pdata);
132 .init_name = "dma-pl330.1",
133 .dma_mask = &dma_dmamask,
134 .coherent_dma_mask = DMA_BIT_MASK(32),
135 .platform_data = &s5pv210_pdma1_pdata,
136 },
137 .res = {
138 .start = S5PV210_PA_PDMA1,
139 .end = S5PV210_PA_PDMA1 + SZ_4K,
140 .flags = IORESOURCE_MEM,
141 },
142 .irq = {IRQ_PDMA1, NO_IRQ},
143 .periphid = 0x00041330,
144};
145 119
146static int __init s5pv210_dma_init(void) 120static int __init s5pv210_dma_init(void)
147{ 121{
148 dma_cap_set(DMA_SLAVE, s5pv210_pdma0_pdata.cap_mask); 122 dma_cap_set(DMA_SLAVE, s5pv210_pdma0_pdata.cap_mask);
149 dma_cap_set(DMA_CYCLIC, s5pv210_pdma0_pdata.cap_mask); 123 dma_cap_set(DMA_CYCLIC, s5pv210_pdma0_pdata.cap_mask);
150 amba_device_register(&s5pv210_device_pdma0, &iomem_resource); 124 amba_device_register(&s5pv210_pdma0_device, &iomem_resource);
151 125
152 dma_cap_set(DMA_SLAVE, s5pv210_pdma1_pdata.cap_mask); 126 dma_cap_set(DMA_SLAVE, s5pv210_pdma1_pdata.cap_mask);
153 dma_cap_set(DMA_CYCLIC, s5pv210_pdma1_pdata.cap_mask); 127 dma_cap_set(DMA_CYCLIC, s5pv210_pdma1_pdata.cap_mask);
154 amba_device_register(&s5pv210_device_pdma1, &iomem_resource); 128 amba_device_register(&s5pv210_pdma1_device, &iomem_resource);
155 129
156 return 0; 130 return 0;
157} 131}
diff --git a/arch/arm/mach-s5pv210/include/mach/entry-macro.S b/arch/arm/mach-s5pv210/include/mach/entry-macro.S
deleted file mode 100644
index bebca1b5d0b..00000000000
--- a/arch/arm/mach-s5pv210/include/mach/entry-macro.S
+++ /dev/null
@@ -1,17 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/entry-macro.S
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Low-level IRQ helper macros for the Samsung S5PV210
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 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h
index 89c34b8f73b..b7c8a1917ff 100644
--- a/arch/arm/mach-s5pv210/include/mach/map.h
+++ b/arch/arm/mach-s5pv210/include/mach/map.h
@@ -90,6 +90,8 @@
90#define S5PV210_PA_FIMC1 0xFB300000 90#define S5PV210_PA_FIMC1 0xFB300000
91#define S5PV210_PA_FIMC2 0xFB400000 91#define S5PV210_PA_FIMC2 0xFB400000
92 92
93#define S5PV210_PA_JPEG 0xFB600000
94
93#define S5PV210_PA_SDO 0xF9000000 95#define S5PV210_PA_SDO 0xF9000000
94#define S5PV210_PA_VP 0xF9100000 96#define S5PV210_PA_VP 0xF9100000
95#define S5PV210_PA_MIXER 0xF9200000 97#define S5PV210_PA_MIXER 0xF9200000
@@ -132,6 +134,8 @@
132#define S5P_PA_SYSCON S5PV210_PA_SYSCON 134#define S5P_PA_SYSCON S5PV210_PA_SYSCON
133#define S5P_PA_TIMER S5PV210_PA_TIMER 135#define S5P_PA_TIMER S5PV210_PA_TIMER
134 136
137#define S5P_PA_JPEG S5PV210_PA_JPEG
138
135#define SAMSUNG_PA_ADC S5PV210_PA_ADC 139#define SAMSUNG_PA_ADC S5PV210_PA_ADC
136#define SAMSUNG_PA_CFCON S5PV210_PA_CFCON 140#define SAMSUNG_PA_CFCON S5PV210_PA_CFCON
137#define SAMSUNG_PA_KEYPAD S5PV210_PA_KEYPAD 141#define SAMSUNG_PA_KEYPAD S5PV210_PA_KEYPAD
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-sys.h b/arch/arm/mach-s5pv210/include/mach/regs-sys.h
index 26691d39d0f..cccb1eddaa3 100644
--- a/arch/arm/mach-s5pv210/include/mach/regs-sys.h
+++ b/arch/arm/mach-s5pv210/include/mach/regs-sys.h
@@ -13,7 +13,3 @@
13#define S5PV210_USB_PHY_CON (S3C_VA_SYS + 0xE80C) 13#define S5PV210_USB_PHY_CON (S3C_VA_SYS + 0xE80C)
14#define S5PV210_USB_PHY0_EN (1 << 0) 14#define S5PV210_USB_PHY0_EN (1 << 0)
15#define S5PV210_USB_PHY1_EN (1 << 1) 15#define S5PV210_USB_PHY1_EN (1 << 1)
16
17/* compatibility defines for s3c-hsotg driver */
18#define S3C64XX_OTHERS S5PV210_USB_PHY_CON
19#define S3C64XX_OTHERS_USBMASK S5PV210_USB_PHY0_EN
diff --git a/arch/arm/mach-s5pv210/include/mach/system.h b/arch/arm/mach-s5pv210/include/mach/system.h
deleted file mode 100644
index bf288ced860..00000000000
--- a/arch/arm/mach-s5pv210/include/mach/system.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/system.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - system support header
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_SYSTEM_H
14#define __ASM_ARCH_SYSTEM_H __FILE__
15
16static void arch_idle(void)
17{
18 /* nothing here yet */
19}
20
21#endif /* __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index 5e734d025a6..a9ea64e0da0 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -616,6 +616,7 @@ static struct platform_device *aquila_devices[] __initdata = {
616 &s5p_device_fimc0, 616 &s5p_device_fimc0,
617 &s5p_device_fimc1, 617 &s5p_device_fimc1,
618 &s5p_device_fimc2, 618 &s5p_device_fimc2,
619 &s5p_device_fimc_md,
619 &s5pv210_device_iis0, 620 &s5pv210_device_iis0,
620 &wm8994_fixed_voltage0, 621 &wm8994_fixed_voltage0,
621 &wm8994_fixed_voltage1, 622 &wm8994_fixed_voltage1,
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index ff915261043..2cf5ed75f39 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -844,7 +844,7 @@ static struct s5p_fimc_isp_info goni_camera_sensors[] = {
844 }, 844 },
845}; 845};
846 846
847struct s5p_platform_fimc goni_fimc_md_platdata __initdata = { 847static struct s5p_platform_fimc goni_fimc_md_platdata __initdata = {
848 .isp_info = goni_camera_sensors, 848 .isp_info = goni_camera_sensors,
849 .num_clients = ARRAY_SIZE(goni_camera_sensors), 849 .num_clients = ARRAY_SIZE(goni_camera_sensors),
850}; 850};
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index b323983b2c5..dfc29236321 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -31,6 +31,7 @@
31#include <plat/iic.h> 31#include <plat/iic.h>
32#include <plat/pm.h> 32#include <plat/pm.h>
33#include <plat/s5p-time.h> 33#include <plat/s5p-time.h>
34#include <plat/mfc.h>
34 35
35#include "common.h" 36#include "common.h"
36 37
@@ -94,6 +95,13 @@ static struct platform_device *smdkc110_devices[] __initdata = {
94 &s3c_device_i2c2, 95 &s3c_device_i2c2,
95 &s3c_device_rtc, 96 &s3c_device_rtc,
96 &s3c_device_wdt, 97 &s3c_device_wdt,
98 &s5p_device_fimc0,
99 &s5p_device_fimc1,
100 &s5p_device_fimc2,
101 &s5p_device_fimc_md,
102 &s5p_device_mfc,
103 &s5p_device_mfc_l,
104 &s5p_device_mfc_r,
97}; 105};
98 106
99static struct i2c_board_info smdkc110_i2c_devs0[] __initdata = { 107static struct i2c_board_info smdkc110_i2c_devs0[] __initdata = {
@@ -117,6 +125,11 @@ static void __init smdkc110_map_io(void)
117 s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 125 s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
118} 126}
119 127
128static void __init smdkc110_reserve(void)
129{
130 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
131}
132
120static void __init smdkc110_machine_init(void) 133static void __init smdkc110_machine_init(void)
121{ 134{
122 s3c_pm_init(); 135 s3c_pm_init();
@@ -145,4 +158,5 @@ MACHINE_START(SMDKC110, "SMDKC110")
145 .init_machine = smdkc110_machine_init, 158 .init_machine = smdkc110_machine_init,
146 .timer = &s5p_timer, 159 .timer = &s5p_timer,
147 .restart = s5pv210_restart, 160 .restart = s5pv210_restart,
161 .reserve = &smdkc110_reserve,
148MACHINE_END 162MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index dff9ea7b5bb..91d4ad8bcc7 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -46,6 +46,7 @@
46#include <plat/s5p-time.h> 46#include <plat/s5p-time.h>
47#include <plat/backlight.h> 47#include <plat/backlight.h>
48#include <plat/regs-fb-v4.h> 48#include <plat/regs-fb-v4.h>
49#include <plat/mfc.h>
49 50
50#include "common.h" 51#include "common.h"
51 52
@@ -140,7 +141,7 @@ static struct dm9000_plat_data smdkv210_dm9000_platdata = {
140 .dev_addr = { 0x00, 0x09, 0xc0, 0xff, 0xec, 0x48 }, 141 .dev_addr = { 0x00, 0x09, 0xc0, 0xff, 0xec, 0x48 },
141}; 142};
142 143
143struct platform_device smdkv210_dm9000 = { 144static struct platform_device smdkv210_dm9000 = {
144 .name = "dm9000", 145 .name = "dm9000",
145 .id = -1, 146 .id = -1,
146 .num_resources = ARRAY_SIZE(smdkv210_dm9000_resources), 147 .num_resources = ARRAY_SIZE(smdkv210_dm9000_resources),
@@ -223,6 +224,14 @@ static struct platform_device *smdkv210_devices[] __initdata = {
223 &s3c_device_rtc, 224 &s3c_device_rtc,
224 &s3c_device_ts, 225 &s3c_device_ts,
225 &s3c_device_wdt, 226 &s3c_device_wdt,
227 &s5p_device_fimc0,
228 &s5p_device_fimc1,
229 &s5p_device_fimc2,
230 &s5p_device_fimc_md,
231 &s5p_device_jpeg,
232 &s5p_device_mfc,
233 &s5p_device_mfc_l,
234 &s5p_device_mfc_r,
226 &s5pv210_device_ac97, 235 &s5pv210_device_ac97,
227 &s5pv210_device_iis0, 236 &s5pv210_device_iis0,
228 &s5pv210_device_spdif, 237 &s5pv210_device_spdif,
@@ -282,6 +291,11 @@ static void __init smdkv210_map_io(void)
282 s5p_set_timer_source(S5P_PWM2, S5P_PWM4); 291 s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
283} 292}
284 293
294static void __init smdkv210_reserve(void)
295{
296 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
297}
298
285static void __init smdkv210_machine_init(void) 299static void __init smdkv210_machine_init(void)
286{ 300{
287 s3c_pm_init(); 301 s3c_pm_init();
@@ -319,4 +333,5 @@ MACHINE_START(SMDKV210, "SMDKV210")
319 .init_machine = smdkv210_machine_init, 333 .init_machine = smdkv210_machine_init,
320 .timer = &s5p_timer, 334 .timer = &s5p_timer,
321 .restart = s5pv210_restart, 335 .restart = s5pv210_restart,
336 .reserve = &smdkv210_reserve,
322MACHINE_END 337MACHINE_END
diff --git a/arch/arm/mach-s5pv210/setup-usb-phy.c b/arch/arm/mach-s5pv210/setup-usb-phy.c
new file mode 100644
index 00000000000..be39cf4aa91
--- /dev/null
+++ b/arch/arm/mach-s5pv210/setup-usb-phy.c
@@ -0,0 +1,90 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
3 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundationr
8 */
9
10#include <linux/clk.h>
11#include <linux/delay.h>
12#include <linux/err.h>
13#include <linux/io.h>
14#include <linux/platform_device.h>
15#include <mach/map.h>
16#include <mach/regs-sys.h>
17#include <plat/cpu.h>
18#include <plat/regs-usb-hsotg-phy.h>
19#include <plat/usb-phy.h>
20
21static int s5pv210_usb_otgphy_init(struct platform_device *pdev)
22{
23 struct clk *xusbxti;
24 u32 phyclk;
25
26 writel(readl(S5PV210_USB_PHY_CON) | S5PV210_USB_PHY0_EN,
27 S5PV210_USB_PHY_CON);
28
29 /* set clock frequency for PLL */
30 phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK;
31
32 xusbxti = clk_get(&pdev->dev, "xusbxti");
33 if (xusbxti && !IS_ERR(xusbxti)) {
34 switch (clk_get_rate(xusbxti)) {
35 case 12 * MHZ:
36 phyclk |= S3C_PHYCLK_CLKSEL_12M;
37 break;
38 case 24 * MHZ:
39 phyclk |= S3C_PHYCLK_CLKSEL_24M;
40 break;
41 default:
42 case 48 * MHZ:
43 /* default reference clock */
44 break;
45 }
46 clk_put(xusbxti);
47 }
48
49 /* TODO: select external clock/oscillator */
50 writel(phyclk | S3C_PHYCLK_CLK_FORCE, S3C_PHYCLK);
51
52 /* set to normal OTG PHY */
53 writel((readl(S3C_PHYPWR) & ~S3C_PHYPWR_NORMAL_MASK), S3C_PHYPWR);
54 mdelay(1);
55
56 /* reset OTG PHY and Link */
57 writel(S3C_RSTCON_PHY | S3C_RSTCON_HCLK | S3C_RSTCON_PHYCLK,
58 S3C_RSTCON);
59 udelay(20); /* at-least 10uS */
60 writel(0, S3C_RSTCON);
61
62 return 0;
63}
64
65static int s5pv210_usb_otgphy_exit(struct platform_device *pdev)
66{
67 writel((readl(S3C_PHYPWR) | S3C_PHYPWR_ANALOG_POWERDOWN |
68 S3C_PHYPWR_OTG_DISABLE), S3C_PHYPWR);
69
70 writel(readl(S5PV210_USB_PHY_CON) & ~S5PV210_USB_PHY0_EN,
71 S5PV210_USB_PHY_CON);
72
73 return 0;
74}
75
76int s5p_usb_phy_init(struct platform_device *pdev, int type)
77{
78 if (type == S5P_USB_PHY_DEVICE)
79 return s5pv210_usb_otgphy_init(pdev);
80
81 return -EINVAL;
82}
83
84int s5p_usb_phy_exit(struct platform_device *pdev, int type)
85{
86 if (type == S5P_USB_PHY_DEVICE)
87 return s5pv210_usb_otgphy_exit(pdev);
88
89 return -EINVAL;
90}
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index dab3c6347a8..172ebd0ee0a 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -11,17 +11,29 @@
11#include <linux/clk.h> 11#include <linux/clk.h>
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/mutex.h> 13#include <linux/mutex.h>
14#include <linux/io.h>
15#include <linux/clkdev.h>
14 16
15#include <mach/hardware.h> 17#include <mach/hardware.h>
16 18
17/* 19struct clkops {
18 * Very simple clock implementation - we only have one clock to deal with. 20 void (*enable)(struct clk *);
19 */ 21 void (*disable)(struct clk *);
22};
23
20struct clk { 24struct clk {
25 const struct clkops *ops;
21 unsigned int enabled; 26 unsigned int enabled;
22}; 27};
23 28
24static void clk_gpio27_enable(void) 29#define DEFINE_CLK(_name, _ops) \
30struct clk clk_##_name = { \
31 .ops = _ops, \
32 }
33
34static DEFINE_SPINLOCK(clocks_lock);
35
36static void clk_gpio27_enable(struct clk *clk)
25{ 37{
26 /* 38 /*
27 * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: 39 * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111:
@@ -32,38 +44,24 @@ static void clk_gpio27_enable(void)
32 TUCR = TUCR_3_6864MHz; 44 TUCR = TUCR_3_6864MHz;
33} 45}
34 46
35static void clk_gpio27_disable(void) 47static void clk_gpio27_disable(struct clk *clk)
36{ 48{
37 TUCR = 0; 49 TUCR = 0;
38 GPDR &= ~GPIO_32_768kHz; 50 GPDR &= ~GPIO_32_768kHz;
39 GAFR &= ~GPIO_32_768kHz; 51 GAFR &= ~GPIO_32_768kHz;
40} 52}
41 53
42static struct clk clk_gpio27;
43
44static DEFINE_SPINLOCK(clocks_lock);
45
46struct clk *clk_get(struct device *dev, const char *id)
47{
48 const char *devname = dev_name(dev);
49
50 return strcmp(devname, "sa1111.0") ? ERR_PTR(-ENOENT) : &clk_gpio27;
51}
52EXPORT_SYMBOL(clk_get);
53
54void clk_put(struct clk *clk)
55{
56}
57EXPORT_SYMBOL(clk_put);
58
59int clk_enable(struct clk *clk) 54int clk_enable(struct clk *clk)
60{ 55{
61 unsigned long flags; 56 unsigned long flags;
62 57
63 spin_lock_irqsave(&clocks_lock, flags); 58 if (clk) {
64 if (clk->enabled++ == 0) 59 spin_lock_irqsave(&clocks_lock, flags);
65 clk_gpio27_enable(); 60 if (clk->enabled++ == 0)
66 spin_unlock_irqrestore(&clocks_lock, flags); 61 clk->ops->enable(clk);
62 spin_unlock_irqrestore(&clocks_lock, flags);
63 }
64
67 return 0; 65 return 0;
68} 66}
69EXPORT_SYMBOL(clk_enable); 67EXPORT_SYMBOL(clk_enable);
@@ -72,17 +70,31 @@ void clk_disable(struct clk *clk)
72{ 70{
73 unsigned long flags; 71 unsigned long flags;
74 72
75 WARN_ON(clk->enabled == 0); 73 if (clk) {
76 74 WARN_ON(clk->enabled == 0);
77 spin_lock_irqsave(&clocks_lock, flags); 75 spin_lock_irqsave(&clocks_lock, flags);
78 if (--clk->enabled == 0) 76 if (--clk->enabled == 0)
79 clk_gpio27_disable(); 77 clk->ops->disable(clk);
80 spin_unlock_irqrestore(&clocks_lock, flags); 78 spin_unlock_irqrestore(&clocks_lock, flags);
79 }
81} 80}
82EXPORT_SYMBOL(clk_disable); 81EXPORT_SYMBOL(clk_disable);
83 82
84unsigned long clk_get_rate(struct clk *clk) 83const struct clkops clk_gpio27_ops = {
84 .enable = clk_gpio27_enable,
85 .disable = clk_gpio27_disable,
86};
87
88static DEFINE_CLK(gpio27, &clk_gpio27_ops);
89
90static struct clk_lookup sa11xx_clkregs[] = {
91 CLKDEV_INIT("sa1111.0", NULL, &clk_gpio27),
92 CLKDEV_INIT("sa1100-rtc", NULL, NULL),
93};
94
95static int __init sa11xx_clk_init(void)
85{ 96{
86 return 3686400; 97 clkdev_add_table(sa11xx_clkregs, ARRAY_SIZE(sa11xx_clkregs));
98 return 0;
87} 99}
88EXPORT_SYMBOL(clk_get_rate); 100core_initcall(sa11xx_clk_init);
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index bb10ee2cb89..7c1ebf4a792 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -345,9 +345,17 @@ void sa11x0_register_irda(struct irda_platform_data *irda)
345 sa11x0_register_device(&sa11x0ir_device, irda); 345 sa11x0_register_device(&sa11x0ir_device, irda);
346} 346}
347 347
348static struct resource sa1100_rtc_resources[] = {
349 DEFINE_RES_MEM(0x90010000, 0x9001003f),
350 DEFINE_RES_IRQ_NAMED(IRQ_RTC1Hz, "rtc 1Hz"),
351 DEFINE_RES_IRQ_NAMED(IRQ_RTCAlrm, "rtc alarm"),
352};
353
348static struct platform_device sa11x0rtc_device = { 354static struct platform_device sa11x0rtc_device = {
349 .name = "sa1100-rtc", 355 .name = "sa1100-rtc",
350 .id = -1, 356 .id = -1,
357 .num_resources = ARRAY_SIZE(sa1100_rtc_resources),
358 .resource = sa1100_rtc_resources,
351}; 359};
352 360
353static struct platform_device *sa11x0_devices[] __initdata = { 361static struct platform_device *sa11x0_devices[] __initdata = {
diff --git a/arch/arm/mach-sa1100/include/mach/assabet.h b/arch/arm/mach-sa1100/include/mach/assabet.h
index 28c2cf50c25..307391488c2 100644
--- a/arch/arm/mach-sa1100/include/mach/assabet.h
+++ b/arch/arm/mach-sa1100/include/mach/assabet.h
@@ -85,21 +85,18 @@ extern void ASSABET_BCR_frob(unsigned int mask, unsigned int set);
85#define ASSABET_BSR_RAD_RI (1 << 31) 85#define ASSABET_BSR_RAD_RI (1 << 31)
86 86
87 87
88/* GPIOs for which the generic definition doesn't say much */ 88/* GPIOs (bitmasks) for which the generic definition doesn't say much */
89#define ASSABET_GPIO_RADIO_IRQ GPIO_GPIO (14) /* Radio interrupt request */ 89#define ASSABET_GPIO_RADIO_IRQ GPIO_GPIO (14) /* Radio interrupt request */
90#define ASSABET_GPIO_PS_MODE_SYNC GPIO_GPIO (16) /* Power supply mode/sync */ 90#define ASSABET_GPIO_PS_MODE_SYNC GPIO_GPIO (16) /* Power supply mode/sync */
91#define ASSABET_GPIO_STEREO_64FS_CLK GPIO_GPIO (19) /* SSP UDA1341 clock input */ 91#define ASSABET_GPIO_STEREO_64FS_CLK GPIO_GPIO (19) /* SSP UDA1341 clock input */
92#define ASSABET_GPIO_CF_IRQ GPIO_GPIO (21) /* CF IRQ */
93#define ASSABET_GPIO_CF_CD GPIO_GPIO (22) /* CF CD */
94#define ASSABET_GPIO_CF_BVD2 GPIO_GPIO (24) /* CF BVD */
95#define ASSABET_GPIO_GFX_IRQ GPIO_GPIO (24) /* Graphics IRQ */ 92#define ASSABET_GPIO_GFX_IRQ GPIO_GPIO (24) /* Graphics IRQ */
96#define ASSABET_GPIO_CF_BVD1 GPIO_GPIO (25) /* CF BVD */
97#define ASSABET_GPIO_BATT_LOW GPIO_GPIO (26) /* Low battery */ 93#define ASSABET_GPIO_BATT_LOW GPIO_GPIO (26) /* Low battery */
98#define ASSABET_GPIO_RCLK GPIO_GPIO (26) /* CCLK/2 */ 94#define ASSABET_GPIO_RCLK GPIO_GPIO (26) /* CCLK/2 */
99 95
100#define ASSABET_IRQ_GPIO_CF_IRQ IRQ_GPIO21 96/* These are gpiolib GPIO numbers, not bitmasks */
101#define ASSABET_IRQ_GPIO_CF_CD IRQ_GPIO22 97#define ASSABET_GPIO_CF_IRQ 21 /* CF IRQ */
102#define ASSABET_IRQ_GPIO_CF_BVD2 IRQ_GPIO24 98#define ASSABET_GPIO_CF_CD 22 /* CF CD */
103#define ASSABET_IRQ_GPIO_CF_BVD1 IRQ_GPIO25 99#define ASSABET_GPIO_CF_BVD2 24 /* CF BVD / IOSPKR */
100#define ASSABET_GPIO_CF_BVD1 25 /* CF BVD / IOSTSCHG */
104 101
105#endif 102#endif
diff --git a/arch/arm/mach-sa1100/include/mach/cerf.h b/arch/arm/mach-sa1100/include/mach/cerf.h
index c3ac3d0f946..88fd9c006ce 100644
--- a/arch/arm/mach-sa1100/include/mach/cerf.h
+++ b/arch/arm/mach-sa1100/include/mach/cerf.h
@@ -14,15 +14,10 @@
14#define CERF_ETH_IO 0xf0000000 14#define CERF_ETH_IO 0xf0000000
15#define CERF_ETH_IRQ IRQ_GPIO26 15#define CERF_ETH_IRQ IRQ_GPIO26
16 16
17#define CERF_GPIO_CF_BVD2 GPIO_GPIO (19) 17#define CERF_GPIO_CF_BVD2 19
18#define CERF_GPIO_CF_BVD1 GPIO_GPIO (20) 18#define CERF_GPIO_CF_BVD1 20
19#define CERF_GPIO_CF_RESET GPIO_GPIO (21) 19#define CERF_GPIO_CF_RESET 21
20#define CERF_GPIO_CF_IRQ GPIO_GPIO (22) 20#define CERF_GPIO_CF_IRQ 22
21#define CERF_GPIO_CF_CD GPIO_GPIO (23) 21#define CERF_GPIO_CF_CD 23
22
23#define CERF_IRQ_GPIO_CF_BVD2 IRQ_GPIO19
24#define CERF_IRQ_GPIO_CF_BVD1 IRQ_GPIO20
25#define CERF_IRQ_GPIO_CF_IRQ IRQ_GPIO22
26#define CERF_IRQ_GPIO_CF_CD IRQ_GPIO23
27 22
28#endif // _INCLUDE_CERF_H_ 23#endif // _INCLUDE_CERF_H_
diff --git a/arch/arm/mach-sa1100/include/mach/entry-macro.S b/arch/arm/mach-sa1100/include/mach/entry-macro.S
index 6aa13c46c5d..8cf7630bf02 100644
--- a/arch/arm/mach-sa1100/include/mach/entry-macro.S
+++ b/arch/arm/mach-sa1100/include/mach/entry-macro.S
@@ -8,17 +8,11 @@
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10
11 .macro disable_fiq
12 .endm
13
14 .macro get_irqnr_preamble, base, tmp 11 .macro get_irqnr_preamble, base, tmp
15 mov \base, #0xfa000000 @ ICIP = 0xfa050000 12 mov \base, #0xfa000000 @ ICIP = 0xfa050000
16 add \base, \base, #0x00050000 13 add \base, \base, #0x00050000
17 .endm 14 .endm
18 15
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 16 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
23 ldr \irqstat, [\base] @ get irqs 17 ldr \irqstat, [\base] @ get irqs
24 ldr \irqnr, [\base, #4] @ ICMR = 0xfa050004 18 ldr \irqnr, [\base, #4] @ ICMR = 0xfa050004
diff --git a/arch/arm/mach-sa1100/include/mach/nanoengine.h b/arch/arm/mach-sa1100/include/mach/nanoengine.h
index 14f8382d066..5ebd469a31f 100644
--- a/arch/arm/mach-sa1100/include/mach/nanoengine.h
+++ b/arch/arm/mach-sa1100/include/mach/nanoengine.h
@@ -16,12 +16,12 @@
16 16
17#include <mach/irqs.h> 17#include <mach/irqs.h>
18 18
19#define GPIO_PC_READY0 GPIO_GPIO(11) /* ready for socket 0 (active high)*/ 19#define GPIO_PC_READY0 11 /* ready for socket 0 (active high)*/
20#define GPIO_PC_READY1 GPIO_GPIO(12) /* ready for socket 1 (active high) */ 20#define GPIO_PC_READY1 12 /* ready for socket 1 (active high) */
21#define GPIO_PC_CD0 GPIO_GPIO(13) /* detect for socket 0 (active low) */ 21#define GPIO_PC_CD0 13 /* detect for socket 0 (active low) */
22#define GPIO_PC_CD1 GPIO_GPIO(14) /* detect for socket 1 (active low) */ 22#define GPIO_PC_CD1 14 /* detect for socket 1 (active low) */
23#define GPIO_PC_RESET0 GPIO_GPIO(15) /* reset socket 0 */ 23#define GPIO_PC_RESET0 15 /* reset socket 0 */
24#define GPIO_PC_RESET1 GPIO_GPIO(16) /* reset socket 1 */ 24#define GPIO_PC_RESET1 16 /* reset socket 1 */
25 25
26#define NANOENGINE_IRQ_GPIO_PCI IRQ_GPIO0 26#define NANOENGINE_IRQ_GPIO_PCI IRQ_GPIO0
27#define NANOENGINE_IRQ_GPIO_PC_READY0 IRQ_GPIO11 27#define NANOENGINE_IRQ_GPIO_PC_READY0 IRQ_GPIO11
diff --git a/arch/arm/mach-sa1100/include/mach/shannon.h b/arch/arm/mach-sa1100/include/mach/shannon.h
index ec27d6e1214..019f857a793 100644
--- a/arch/arm/mach-sa1100/include/mach/shannon.h
+++ b/arch/arm/mach-sa1100/include/mach/shannon.h
@@ -23,14 +23,10 @@
23#define SHANNON_GPIO_SENSE_12V GPIO_GPIO (21) /* Input, 12v flash unprotect detected */ 23#define SHANNON_GPIO_SENSE_12V GPIO_GPIO (21) /* Input, 12v flash unprotect detected */
24#define SHANNON_GPIO_DISP_EN GPIO_GPIO (22) /* out */ 24#define SHANNON_GPIO_DISP_EN GPIO_GPIO (22) /* out */
25/* XXX GPIO 23 unaccounted for */ 25/* XXX GPIO 23 unaccounted for */
26#define SHANNON_GPIO_EJECT_0 GPIO_GPIO (24) /* in */ 26#define SHANNON_GPIO_EJECT_0 24 /* in */
27#define SHANNON_IRQ_GPIO_EJECT_0 IRQ_GPIO24 27#define SHANNON_GPIO_EJECT_1 25 /* in */
28#define SHANNON_GPIO_EJECT_1 GPIO_GPIO (25) /* in */ 28#define SHANNON_GPIO_RDY_0 26 /* in */
29#define SHANNON_IRQ_GPIO_EJECT_1 IRQ_GPIO25 29#define SHANNON_GPIO_RDY_1 27 /* in */
30#define SHANNON_GPIO_RDY_0 GPIO_GPIO (26) /* in */
31#define SHANNON_IRQ_GPIO_RDY_0 IRQ_GPIO26
32#define SHANNON_GPIO_RDY_1 GPIO_GPIO (27) /* in */
33#define SHANNON_IRQ_GPIO_RDY_1 IRQ_GPIO27
34 30
35/* MCP UCB codec GPIO pins... */ 31/* MCP UCB codec GPIO pins... */
36 32
diff --git a/arch/arm/mach-sa1100/include/mach/simpad.h b/arch/arm/mach-sa1100/include/mach/simpad.h
index db28118103e..cdea671e893 100644
--- a/arch/arm/mach-sa1100/include/mach/simpad.h
+++ b/arch/arm/mach-sa1100/include/mach/simpad.h
@@ -39,10 +39,8 @@
39 39
40 40
41/*--- PCMCIA ---*/ 41/*--- PCMCIA ---*/
42#define GPIO_CF_CD GPIO_GPIO24 42#define GPIO_CF_CD 24
43#define GPIO_CF_IRQ GPIO_GPIO1 43#define GPIO_CF_IRQ 1
44#define IRQ_GPIO_CF_IRQ IRQ_GPIO1
45#define IRQ_GPIO_CF_CD IRQ_GPIO24
46 44
47/*--- SmartCard ---*/ 45/*--- SmartCard ---*/
48#define GPIO_SMART_CARD GPIO_GPIO10 46#define GPIO_SMART_CARD GPIO_GPIO10
diff --git a/arch/arm/mach-sa1100/include/mach/system.h b/arch/arm/mach-sa1100/include/mach/system.h
deleted file mode 100644
index e17b208f76d..00000000000
--- a/arch/arm/mach-sa1100/include/mach/system.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/system.h
3 *
4 * Copyright (c) 1999 Nicolas Pitre <nico@fluxnic.net>
5 */
6static inline void arch_idle(void)
7{
8 cpu_do_idle();
9}
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c
index 0d01ca78892..b466bca9c65 100644
--- a/arch/arm/mach-sa1100/pci-nanoengine.c
+++ b/arch/arm/mach-sa1100/pci-nanoengine.c
@@ -244,9 +244,11 @@ static int __init pci_nanoengine_setup_resources(struct pci_sys_data *sys)
244 printk(KERN_ERR "PCI: unable to allocate prefetchable\n"); 244 printk(KERN_ERR "PCI: unable to allocate prefetchable\n");
245 return -EBUSY; 245 return -EBUSY;
246 } 246 }
247 pci_add_resource(&sys->resources, &pci_io_ports); 247 pci_add_resource_offset(&sys->resources, &pci_io_ports, sys->io_offset);
248 pci_add_resource(&sys->resources, &pci_non_prefetchable_memory); 248 pci_add_resource_offset(&sys->resources,
249 pci_add_resource(&sys->resources, &pci_prefetchable_memory); 249 &pci_non_prefetchable_memory, sys->mem_offset);
250 pci_add_resource_offset(&sys->resources,
251 &pci_prefetchable_memory, sys->mem_offset);
250 252
251 return 1; 253 return 1;
252} 254}
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index a851c254ad6..6a2a7f2c255 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -149,10 +149,16 @@ static struct sys_timer shark_timer = {
149 .init = shark_timer_init, 149 .init = shark_timer_init,
150}; 150};
151 151
152static void shark_init_early(void)
153{
154 disable_hlt();
155}
156
152MACHINE_START(SHARK, "Shark") 157MACHINE_START(SHARK, "Shark")
153 /* Maintainer: Alexander Schulz */ 158 /* Maintainer: Alexander Schulz */
154 .atag_offset = 0x3000, 159 .atag_offset = 0x3000,
155 .map_io = shark_map_io, 160 .map_io = shark_map_io,
161 .init_early = shark_init_early,
156 .init_irq = shark_init_irq, 162 .init_irq = shark_init_irq,
157 .timer = &shark_timer, 163 .timer = &shark_timer,
158 .dma_zone_size = SZ_4M, 164 .dma_zone_size = SZ_4M,
diff --git a/arch/arm/mach-shark/include/mach/entry-macro.S b/arch/arm/mach-shark/include/mach/entry-macro.S
index 0bb6cc626eb..5901b09fc96 100644
--- a/arch/arm/mach-shark/include/mach/entry-macro.S
+++ b/arch/arm/mach-shark/include/mach/entry-macro.S
@@ -7,16 +7,10 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 .macro disable_fiq
11 .endm
12
13 .macro get_irqnr_preamble, base, tmp 10 .macro get_irqnr_preamble, base, tmp
14 mov \base, #0xe0000000 11 mov \base, #0xe0000000
15 .endm 12 .endm
16 13
17 .macro arch_ret_to_user, tmp1, tmp2
18 .endm
19
20 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 14 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
21 15
22 mov \irqstat, #0x0C 16 mov \irqstat, #0x0C
diff --git a/arch/arm/mach-shark/include/mach/system.h b/arch/arm/mach-shark/include/mach/system.h
deleted file mode 100644
index 1b2f2c5050a..00000000000
--- a/arch/arm/mach-shark/include/mach/system.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-shark/include/mach/system.h
3 *
4 * by Alexander Schulz
5 */
6#ifndef __ASM_ARCH_SYSTEM_H
7#define __ASM_ARCH_SYSTEM_H
8
9static inline void arch_idle(void)
10{
11}
12
13#endif
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 7ad6954c46c..e7c2590b75d 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -16,7 +16,6 @@ obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o clock-r8a7779.o intc-r8a7779.o
16# SMP objects 16# SMP objects
17smp-y := platsmp.o headsmp.o 17smp-y := platsmp.o headsmp.o
18smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o 18smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o
19smp-$(CONFIG_LOCAL_TIMERS) += localtimer.o
20smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o 19smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o
21smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o 20smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o
22 21
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 8aea3a2dd88..f50d7c8b122 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -47,8 +47,6 @@
47#include <mach/common.h> 47#include <mach/common.h>
48#include <asm/mach-types.h> 48#include <asm/mach-types.h>
49#include <asm/mach/arch.h> 49#include <asm/mach/arch.h>
50#include <asm/mach/map.h>
51#include <asm/mach/time.h>
52#include <asm/hardware/gic.h> 50#include <asm/hardware/gic.h>
53#include <asm/hardware/cache-l2x0.h> 51#include <asm/hardware/cache-l2x0.h>
54#include <asm/traps.h> 52#include <asm/traps.h>
@@ -230,16 +228,6 @@ static void lcd_backlight_reset(void)
230 gpio_set_value(GPIO_PORT235, 1); 228 gpio_set_value(GPIO_PORT235, 1);
231} 229}
232 230
233static void lcd_on(void *board_data, struct fb_info *info)
234{
235 lcd_backlight_on();
236}
237
238static void lcd_off(void *board_data)
239{
240 lcd_backlight_reset();
241}
242
243/* LCDC0 */ 231/* LCDC0 */
244static const struct fb_videomode lcdc0_modes[] = { 232static const struct fb_videomode lcdc0_modes[] = {
245 { 233 {
@@ -263,14 +251,14 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
263 .interface_type = RGB24, 251 .interface_type = RGB24,
264 .clock_divider = 1, 252 .clock_divider = 1,
265 .flags = LCDC_FLAGS_DWPOL, 253 .flags = LCDC_FLAGS_DWPOL,
266 .lcd_size_cfg.width = 44,
267 .lcd_size_cfg.height = 79,
268 .fourcc = V4L2_PIX_FMT_RGB565, 254 .fourcc = V4L2_PIX_FMT_RGB565,
269 .lcd_cfg = lcdc0_modes, 255 .lcd_modes = lcdc0_modes,
270 .num_cfg = ARRAY_SIZE(lcdc0_modes), 256 .num_modes = ARRAY_SIZE(lcdc0_modes),
271 .board_cfg = { 257 .panel_cfg = {
272 .display_on = lcd_on, 258 .width = 44,
273 .display_off = lcd_off, 259 .height = 79,
260 .display_on = lcd_backlight_on,
261 .display_off = lcd_backlight_reset,
274 }, 262 },
275 } 263 }
276}; 264};
@@ -487,27 +475,6 @@ static struct platform_device *ag5evm_devices[] __initdata = {
487 &sdhi1_device, 475 &sdhi1_device,
488}; 476};
489 477
490static struct map_desc ag5evm_io_desc[] __initdata = {
491 /* create a 1:1 entity map for 0xe6xxxxxx
492 * used by CPGA, INTC and PFC.
493 */
494 {
495 .virtual = 0xe6000000,
496 .pfn = __phys_to_pfn(0xe6000000),
497 .length = 256 << 20,
498 .type = MT_DEVICE_NONSHARED
499 },
500};
501
502static void __init ag5evm_map_io(void)
503{
504 iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc));
505
506 /* setup early devices and console here as well */
507 sh73a0_add_early_devices();
508 shmobile_setup_console();
509}
510
511static void __init ag5evm_init(void) 478static void __init ag5evm_init(void)
512{ 479{
513 sh73a0_pinmux_init(); 480 sh73a0_pinmux_init();
@@ -623,22 +590,12 @@ static void __init ag5evm_init(void)
623 platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); 590 platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
624} 591}
625 592
626static void __init ag5evm_timer_init(void)
627{
628 sh73a0_clock_init();
629 shmobile_timer.init();
630 return;
631}
632
633struct sys_timer ag5evm_timer = {
634 .init = ag5evm_timer_init,
635};
636
637MACHINE_START(AG5EVM, "ag5evm") 593MACHINE_START(AG5EVM, "ag5evm")
638 .map_io = ag5evm_map_io, 594 .map_io = sh73a0_map_io,
595 .init_early = sh73a0_add_early_devices,
639 .nr_irqs = NR_IRQS_LEGACY, 596 .nr_irqs = NR_IRQS_LEGACY,
640 .init_irq = sh73a0_init_irq, 597 .init_irq = sh73a0_init_irq,
641 .handle_irq = gic_handle_irq, 598 .handle_irq = gic_handle_irq,
642 .init_machine = ag5evm_init, 599 .init_machine = ag5evm_init,
643 .timer = &ag5evm_timer, 600 .timer = &shmobile_timer,
644MACHINE_END 601MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index b4718b00e82..262f8def557 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -61,8 +61,6 @@
61 61
62#include <asm/mach-types.h> 62#include <asm/mach-types.h>
63#include <asm/mach/arch.h> 63#include <asm/mach/arch.h>
64#include <asm/mach/map.h>
65#include <asm/mach/time.h>
66#include <asm/setup.h> 64#include <asm/setup.h>
67 65
68/* 66/*
@@ -258,10 +256,16 @@ static struct sh_mobile_meram_info meram_info = {
258 256
259static struct resource meram_resources[] = { 257static struct resource meram_resources[] = {
260 [0] = { 258 [0] = {
261 .name = "MERAM", 259 .name = "regs",
262 .start = 0xe8000000, 260 .start = 0xe8000000,
263 .end = 0xe81fffff, 261 .end = 0xe807ffff,
264 .flags = IORESOURCE_MEM, 262 .flags = IORESOURCE_MEM,
263 },
264 [1] = {
265 .name = "meram",
266 .start = 0xe8080000,
267 .end = 0xe81fffff,
268 .flags = IORESOURCE_MEM,
265 }, 269 },
266}; 270};
267 271
@@ -437,82 +441,6 @@ static struct platform_device usb1_host_device = {
437 .resource = usb1_host_resources, 441 .resource = usb1_host_resources,
438}; 442};
439 443
440static const struct fb_videomode ap4evb_lcdc_modes[] = {
441 {
442#ifdef CONFIG_AP4EVB_QHD
443 .name = "R63302(QHD)",
444 .xres = 544,
445 .yres = 961,
446 .left_margin = 72,
447 .right_margin = 600,
448 .hsync_len = 16,
449 .upper_margin = 8,
450 .lower_margin = 8,
451 .vsync_len = 2,
452 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
453#else
454 .name = "WVGA Panel",
455 .xres = 800,
456 .yres = 480,
457 .left_margin = 220,
458 .right_margin = 110,
459 .hsync_len = 70,
460 .upper_margin = 20,
461 .lower_margin = 5,
462 .vsync_len = 5,
463 .sync = 0,
464#endif
465 },
466};
467static struct sh_mobile_meram_cfg lcd_meram_cfg = {
468 .icb[0] = {
469 .marker_icb = 28,
470 .cache_icb = 24,
471 .meram_offset = 0x0,
472 .meram_size = 0x40,
473 },
474 .icb[1] = {
475 .marker_icb = 29,
476 .cache_icb = 25,
477 .meram_offset = 0x40,
478 .meram_size = 0x40,
479 },
480};
481
482static struct sh_mobile_lcdc_info lcdc_info = {
483 .meram_dev = &meram_info,
484 .ch[0] = {
485 .chan = LCDC_CHAN_MAINLCD,
486 .fourcc = V4L2_PIX_FMT_RGB565,
487 .lcd_cfg = ap4evb_lcdc_modes,
488 .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
489 .meram_cfg = &lcd_meram_cfg,
490 }
491};
492
493static struct resource lcdc_resources[] = {
494 [0] = {
495 .name = "LCDC",
496 .start = 0xfe940000, /* P4-only space */
497 .end = 0xfe943fff,
498 .flags = IORESOURCE_MEM,
499 },
500 [1] = {
501 .start = intcs_evt2irq(0x580),
502 .flags = IORESOURCE_IRQ,
503 },
504};
505
506static struct platform_device lcdc_device = {
507 .name = "sh_mobile_lcdc_fb",
508 .num_resources = ARRAY_SIZE(lcdc_resources),
509 .resource = lcdc_resources,
510 .dev = {
511 .platform_data = &lcdc_info,
512 .coherent_dma_mask = ~0,
513 },
514};
515
516/* 444/*
517 * QHD display 445 * QHD display
518 */ 446 */
@@ -556,20 +484,25 @@ static struct platform_device keysc_device = {
556}; 484};
557 485
558/* MIPI-DSI */ 486/* MIPI-DSI */
559#define PHYCTRL 0x0070
560static int sh_mipi_set_dot_clock(struct platform_device *pdev, 487static int sh_mipi_set_dot_clock(struct platform_device *pdev,
561 void __iomem *base, 488 void __iomem *base,
562 int enable) 489 int enable)
563{ 490{
564 struct clk *pck = clk_get(&pdev->dev, "dsip_clk"); 491 struct clk *pck = clk_get(&pdev->dev, "dsip_clk");
565 void __iomem *phy = base + PHYCTRL;
566 492
567 if (IS_ERR(pck)) 493 if (IS_ERR(pck))
568 return PTR_ERR(pck); 494 return PTR_ERR(pck);
569 495
570 if (enable) { 496 if (enable) {
497 /*
498 * DSIPCLK = 24MHz
499 * D-PHY = DSIPCLK * ((0x6*2)+1) = 312MHz (see .phyctrl)
500 * HsByteCLK = D-PHY/8 = 39MHz
501 *
502 * X * Y * FPS =
503 * (544+72+600+16) * (961+8+8+2) * 30 = 36.1MHz
504 */
571 clk_set_rate(pck, clk_round_rate(pck, 24000000)); 505 clk_set_rate(pck, clk_round_rate(pck, 24000000));
572 iowrite32(ioread32(phy) | (0xb << 8), phy);
573 clk_enable(pck); 506 clk_enable(pck);
574 } else { 507 } else {
575 clk_disable(pck); 508 clk_disable(pck);
@@ -593,11 +526,14 @@ static struct resource mipidsi0_resources[] = {
593 }, 526 },
594}; 527};
595 528
529static struct sh_mobile_lcdc_info lcdc_info;
530
596static struct sh_mipi_dsi_info mipidsi0_info = { 531static struct sh_mipi_dsi_info mipidsi0_info = {
597 .data_format = MIPI_RGB888, 532 .data_format = MIPI_RGB888,
598 .lcd_chan = &lcdc_info.ch[0], 533 .lcd_chan = &lcdc_info.ch[0],
599 .lane = 2, 534 .lane = 2,
600 .vsynw_offset = 17, 535 .vsynw_offset = 17,
536 .phyctrl = 0x6 << 8,
601 .flags = SH_MIPI_DSI_SYNC_PULSES_MODE | 537 .flags = SH_MIPI_DSI_SYNC_PULSES_MODE |
602 SH_MIPI_DSI_HSbyteCLK, 538 SH_MIPI_DSI_HSbyteCLK,
603 .set_dot_clock = sh_mipi_set_dot_clock, 539 .set_dot_clock = sh_mipi_set_dot_clock,
@@ -619,6 +555,81 @@ static struct platform_device *qhd_devices[] __initdata = {
619}; 555};
620#endif /* CONFIG_AP4EVB_QHD */ 556#endif /* CONFIG_AP4EVB_QHD */
621 557
558/* LCDC0 */
559static const struct fb_videomode ap4evb_lcdc_modes[] = {
560 {
561#ifdef CONFIG_AP4EVB_QHD
562 .name = "R63302(QHD)",
563 .xres = 544,
564 .yres = 961,
565 .left_margin = 72,
566 .right_margin = 600,
567 .hsync_len = 16,
568 .upper_margin = 8,
569 .lower_margin = 8,
570 .vsync_len = 2,
571 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
572#else
573 .name = "WVGA Panel",
574 .xres = 800,
575 .yres = 480,
576 .left_margin = 220,
577 .right_margin = 110,
578 .hsync_len = 70,
579 .upper_margin = 20,
580 .lower_margin = 5,
581 .vsync_len = 5,
582 .sync = 0,
583#endif
584 },
585};
586
587static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
588 .icb[0] = {
589 .meram_size = 0x40,
590 },
591 .icb[1] = {
592 .meram_size = 0x40,
593 },
594};
595
596static struct sh_mobile_lcdc_info lcdc_info = {
597 .meram_dev = &meram_info,
598 .ch[0] = {
599 .chan = LCDC_CHAN_MAINLCD,
600 .fourcc = V4L2_PIX_FMT_RGB565,
601 .lcd_modes = ap4evb_lcdc_modes,
602 .num_modes = ARRAY_SIZE(ap4evb_lcdc_modes),
603 .meram_cfg = &lcd_meram_cfg,
604#ifdef CONFIG_AP4EVB_QHD
605 .tx_dev = &mipidsi0_device,
606#endif
607 }
608};
609
610static struct resource lcdc_resources[] = {
611 [0] = {
612 .name = "LCDC",
613 .start = 0xfe940000, /* P4-only space */
614 .end = 0xfe943fff,
615 .flags = IORESOURCE_MEM,
616 },
617 [1] = {
618 .start = intcs_evt2irq(0x580),
619 .flags = IORESOURCE_IRQ,
620 },
621};
622
623static struct platform_device lcdc_device = {
624 .name = "sh_mobile_lcdc_fb",
625 .num_resources = ARRAY_SIZE(lcdc_resources),
626 .resource = lcdc_resources,
627 .dev = {
628 .platform_data = &lcdc_info,
629 .coherent_dma_mask = ~0,
630 },
631};
632
622/* FSI */ 633/* FSI */
623#define IRQ_FSI evt2irq(0x1840) 634#define IRQ_FSI evt2irq(0x1840)
624static int __fsi_set_rate(struct clk *clk, long rate, int enable) 635static int __fsi_set_rate(struct clk *clk, long rate, int enable)
@@ -737,26 +748,18 @@ fsi_set_rate_end:
737 return ret; 748 return ret;
738} 749}
739 750
740static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable)
741{
742 int ret;
743
744 if (is_porta)
745 ret = fsi_ak4642_set_rate(dev, rate, enable);
746 else
747 ret = fsi_hdmi_set_rate(dev, rate, enable);
748
749 return ret;
750}
751
752static struct sh_fsi_platform_info fsi_info = { 751static struct sh_fsi_platform_info fsi_info = {
753 .porta_flags = SH_FSI_BRS_INV, 752 .port_a = {
754 753 .flags = SH_FSI_BRS_INV,
755 .portb_flags = SH_FSI_BRS_INV | 754 .set_rate = fsi_ak4642_set_rate,
756 SH_FSI_BRM_INV | 755 },
757 SH_FSI_LRS_INV | 756 .port_b = {
758 SH_FSI_FMT_SPDIF, 757 .flags = SH_FSI_BRS_INV |
759 .set_rate = fsi_set_rate, 758 SH_FSI_BRM_INV |
759 SH_FSI_LRS_INV |
760 SH_FSI_FMT_SPDIF,
761 .set_rate = fsi_hdmi_set_rate,
762 },
760}; 763};
761 764
762static struct resource fsi_resources[] = { 765static struct resource fsi_resources[] = {
@@ -798,65 +801,11 @@ static struct platform_device fsi_ak4643_device = {
798 }, 801 },
799}; 802};
800 803
801static struct sh_mobile_meram_cfg hdmi_meram_cfg = { 804/* LCDC1 */
802 .icb[0] = {
803 .marker_icb = 30,
804 .cache_icb = 26,
805 .meram_offset = 0x80,
806 .meram_size = 0x100,
807 },
808 .icb[1] = {
809 .marker_icb = 31,
810 .cache_icb = 27,
811 .meram_offset = 0x180,
812 .meram_size = 0x100,
813 },
814};
815
816static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
817 .clock_source = LCDC_CLK_EXTERNAL,
818 .meram_dev = &meram_info,
819 .ch[0] = {
820 .chan = LCDC_CHAN_MAINLCD,
821 .fourcc = V4L2_PIX_FMT_RGB565,
822 .interface_type = RGB24,
823 .clock_divider = 1,
824 .flags = LCDC_FLAGS_DWPOL,
825 .meram_cfg = &hdmi_meram_cfg,
826 }
827};
828
829static struct resource lcdc1_resources[] = {
830 [0] = {
831 .name = "LCDC1",
832 .start = 0xfe944000,
833 .end = 0xfe947fff,
834 .flags = IORESOURCE_MEM,
835 },
836 [1] = {
837 .start = intcs_evt2irq(0x1780),
838 .flags = IORESOURCE_IRQ,
839 },
840};
841
842static struct platform_device lcdc1_device = {
843 .name = "sh_mobile_lcdc_fb",
844 .num_resources = ARRAY_SIZE(lcdc1_resources),
845 .resource = lcdc1_resources,
846 .id = 1,
847 .dev = {
848 .platform_data = &sh_mobile_lcdc1_info,
849 .coherent_dma_mask = ~0,
850 },
851};
852
853static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, 805static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
854 unsigned long *parent_freq); 806 unsigned long *parent_freq);
855 807
856
857static struct sh_mobile_hdmi_info hdmi_info = { 808static struct sh_mobile_hdmi_info hdmi_info = {
858 .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
859 .lcd_dev = &lcdc1_device.dev,
860 .flags = HDMI_SND_SRC_SPDIF, 809 .flags = HDMI_SND_SRC_SPDIF,
861 .clk_optimize_parent = ap4evb_clk_optimize, 810 .clk_optimize_parent = ap4evb_clk_optimize,
862}; 811};
@@ -885,10 +834,6 @@ static struct platform_device hdmi_device = {
885 }, 834 },
886}; 835};
887 836
888static struct platform_device fsi_hdmi_device = {
889 .name = "sh_fsi2_b_hdmi",
890};
891
892static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, 837static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
893 unsigned long *parent_freq) 838 unsigned long *parent_freq)
894{ 839{
@@ -908,6 +853,57 @@ static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
908 return error; 853 return error;
909} 854}
910 855
856static const struct sh_mobile_meram_cfg hdmi_meram_cfg = {
857 .icb[0] = {
858 .meram_size = 0x100,
859 },
860 .icb[1] = {
861 .meram_size = 0x100,
862 },
863};
864
865static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
866 .clock_source = LCDC_CLK_EXTERNAL,
867 .meram_dev = &meram_info,
868 .ch[0] = {
869 .chan = LCDC_CHAN_MAINLCD,
870 .fourcc = V4L2_PIX_FMT_RGB565,
871 .interface_type = RGB24,
872 .clock_divider = 1,
873 .flags = LCDC_FLAGS_DWPOL,
874 .meram_cfg = &hdmi_meram_cfg,
875 .tx_dev = &hdmi_device,
876 }
877};
878
879static struct resource lcdc1_resources[] = {
880 [0] = {
881 .name = "LCDC1",
882 .start = 0xfe944000,
883 .end = 0xfe947fff,
884 .flags = IORESOURCE_MEM,
885 },
886 [1] = {
887 .start = intcs_evt2irq(0x1780),
888 .flags = IORESOURCE_IRQ,
889 },
890};
891
892static struct platform_device lcdc1_device = {
893 .name = "sh_mobile_lcdc_fb",
894 .num_resources = ARRAY_SIZE(lcdc1_resources),
895 .resource = lcdc1_resources,
896 .id = 1,
897 .dev = {
898 .platform_data = &sh_mobile_lcdc1_info,
899 .coherent_dma_mask = ~0,
900 },
901};
902
903static struct platform_device fsi_hdmi_device = {
904 .name = "sh_fsi2_b_hdmi",
905};
906
911static struct gpio_led ap4evb_leds[] = { 907static struct gpio_led ap4evb_leds[] = {
912 { 908 {
913 .name = "led4", 909 .name = "led4",
@@ -1042,9 +1038,9 @@ static struct platform_device *ap4evb_devices[] __initdata = {
1042 &fsi_ak4643_device, 1038 &fsi_ak4643_device,
1043 &fsi_hdmi_device, 1039 &fsi_hdmi_device,
1044 &sh_mmcif_device, 1040 &sh_mmcif_device,
1045 &lcdc1_device,
1046 &lcdc_device,
1047 &hdmi_device, 1041 &hdmi_device,
1042 &lcdc_device,
1043 &lcdc1_device,
1048 &ceu_device, 1044 &ceu_device,
1049 &ap4evb_camera, 1045 &ap4evb_camera,
1050 &meram_device, 1046 &meram_device,
@@ -1190,27 +1186,6 @@ static struct i2c_board_info i2c1_devices[] = {
1190 }, 1186 },
1191}; 1187};
1192 1188
1193static struct map_desc ap4evb_io_desc[] __initdata = {
1194 /* create a 1:1 entity map for 0xe6xxxxxx
1195 * used by CPGA, INTC and PFC.
1196 */
1197 {
1198 .virtual = 0xe6000000,
1199 .pfn = __phys_to_pfn(0xe6000000),
1200 .length = 256 << 20,
1201 .type = MT_DEVICE_NONSHARED
1202 },
1203};
1204
1205static void __init ap4evb_map_io(void)
1206{
1207 iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
1208
1209 /* setup early devices and console here as well */
1210 sh7372_add_early_devices();
1211 shmobile_setup_console();
1212}
1213
1214#define GPIO_PORT9CR 0xE6051009 1189#define GPIO_PORT9CR 0xE6051009
1215#define GPIO_PORT10CR 0xE605100A 1190#define GPIO_PORT10CR 0xE605100A
1216#define USCCR1 0xE6058144 1191#define USCCR1 0xE6058144
@@ -1219,6 +1194,9 @@ static void __init ap4evb_init(void)
1219 u32 srcr4; 1194 u32 srcr4;
1220 struct clk *clk; 1195 struct clk *clk;
1221 1196
1197 /* External clock source */
1198 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1199
1222 sh7372_pinmux_init(); 1200 sh7372_pinmux_init();
1223 1201
1224 /* enable SCIFA0 */ 1202 /* enable SCIFA0 */
@@ -1355,8 +1333,8 @@ static void __init ap4evb_init(void)
1355 lcdc_info.ch[0].interface_type = RGB24; 1333 lcdc_info.ch[0].interface_type = RGB24;
1356 lcdc_info.ch[0].clock_divider = 1; 1334 lcdc_info.ch[0].clock_divider = 1;
1357 lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL; 1335 lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
1358 lcdc_info.ch[0].lcd_size_cfg.width = 44; 1336 lcdc_info.ch[0].panel_cfg.width = 44;
1359 lcdc_info.ch[0].lcd_size_cfg.height = 79; 1337 lcdc_info.ch[0].panel_cfg.height = 79;
1360 1338
1361 platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices)); 1339 platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices));
1362 1340
@@ -1397,8 +1375,8 @@ static void __init ap4evb_init(void)
1397 lcdc_info.ch[0].interface_type = RGB18; 1375 lcdc_info.ch[0].interface_type = RGB18;
1398 lcdc_info.ch[0].clock_divider = 3; 1376 lcdc_info.ch[0].clock_divider = 3;
1399 lcdc_info.ch[0].flags = 0; 1377 lcdc_info.ch[0].flags = 0;
1400 lcdc_info.ch[0].lcd_size_cfg.width = 152; 1378 lcdc_info.ch[0].panel_cfg.width = 152;
1401 lcdc_info.ch[0].lcd_size_cfg.height = 91; 1379 lcdc_info.ch[0].panel_cfg.height = 91;
1402 1380
1403 /* enable TouchScreen */ 1381 /* enable TouchScreen */
1404 irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW); 1382 irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
@@ -1455,23 +1433,11 @@ static void __init ap4evb_init(void)
1455 pm_clk_add(&lcdc1_device.dev, "hdmi"); 1433 pm_clk_add(&lcdc1_device.dev, "hdmi");
1456} 1434}
1457 1435
1458static void __init ap4evb_timer_init(void)
1459{
1460 sh7372_clock_init();
1461 shmobile_timer.init();
1462
1463 /* External clock source */
1464 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1465}
1466
1467static struct sys_timer ap4evb_timer = {
1468 .init = ap4evb_timer_init,
1469};
1470
1471MACHINE_START(AP4EVB, "ap4evb") 1436MACHINE_START(AP4EVB, "ap4evb")
1472 .map_io = ap4evb_map_io, 1437 .map_io = sh7372_map_io,
1438 .init_early = sh7372_add_early_devices,
1473 .init_irq = sh7372_init_irq, 1439 .init_irq = sh7372_init_irq,
1474 .handle_irq = shmobile_handle_irq_intc, 1440 .handle_irq = shmobile_handle_irq_intc,
1475 .init_machine = ap4evb_init, 1441 .init_machine = ap4evb_init,
1476 .timer = &ap4evb_timer, 1442 .timer = &shmobile_timer,
1477MACHINE_END 1443MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index 4bd1162ce0d..8b2124da245 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -246,9 +246,9 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
246 .interface_type = RGB24, 246 .interface_type = RGB24,
247 .clock_divider = 5, 247 .clock_divider = 5,
248 .flags = 0, 248 .flags = 0,
249 .lcd_cfg = &lcdc0_mode, 249 .lcd_modes = &lcdc0_mode,
250 .num_cfg = 1, 250 .num_modes = 1,
251 .lcd_size_cfg = { 251 .panel_cfg = {
252 .width = 152, 252 .width = 152,
253 .height = 91, 253 .height = 91,
254 }, 254 },
@@ -328,28 +328,6 @@ static struct platform_device *bonito_base_devices[] __initdata = {
328 * map I/O 328 * map I/O
329 */ 329 */
330static struct map_desc bonito_io_desc[] __initdata = { 330static struct map_desc bonito_io_desc[] __initdata = {
331 /*
332 * for CPGA/INTC/PFC
333 * 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff
334 */
335 {
336 .virtual = 0xe6000000,
337 .pfn = __phys_to_pfn(0xe6000000),
338 .length = 160 << 20,
339 .type = MT_DEVICE_NONSHARED
340 },
341#ifdef CONFIG_CACHE_L2X0
342 /*
343 * for l2x0_init()
344 * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000
345 */
346 {
347 .virtual = 0xf0002000,
348 .pfn = __phys_to_pfn(0xf0100000),
349 .length = PAGE_SIZE,
350 .type = MT_DEVICE_NONSHARED
351 },
352#endif
353 /* 331 /*
354 * for FPGA (0x1800000-0x19ffffff) 332 * for FPGA (0x1800000-0x19ffffff)
355 * 0x18000000-0x18002000 -> 0xf0003000-0xf0005000 333 * 0x18000000-0x18002000 -> 0xf0003000-0xf0005000
@@ -364,11 +342,8 @@ static struct map_desc bonito_io_desc[] __initdata = {
364 342
365static void __init bonito_map_io(void) 343static void __init bonito_map_io(void)
366{ 344{
345 r8a7740_map_io();
367 iotable_init(bonito_io_desc, ARRAY_SIZE(bonito_io_desc)); 346 iotable_init(bonito_io_desc, ARRAY_SIZE(bonito_io_desc));
368
369 /* setup early devices and console here as well */
370 r8a7740_add_early_devices();
371 shmobile_setup_console();
372} 347}
373 348
374/* 349/*
@@ -492,7 +467,7 @@ static void __init bonito_init(void)
492 } 467 }
493} 468}
494 469
495static void __init bonito_timer_init(void) 470static void __init bonito_earlytimer_init(void)
496{ 471{
497 u16 val; 472 u16 val;
498 u8 md_ck = 0; 473 u8 md_ck = 0;
@@ -507,17 +482,22 @@ static void __init bonito_timer_init(void)
507 md_ck |= MD_CK0; 482 md_ck |= MD_CK0;
508 483
509 r8a7740_clock_init(md_ck); 484 r8a7740_clock_init(md_ck);
510 shmobile_timer.init(); 485 shmobile_earlytimer_init();
511} 486}
512 487
513struct sys_timer bonito_timer = { 488void __init bonito_add_early_devices(void)
514 .init = bonito_timer_init, 489{
515}; 490 r8a7740_add_early_devices();
491
492 /* override timer setup with board-specific code */
493 shmobile_timer.init = bonito_earlytimer_init;
494}
516 495
517MACHINE_START(BONITO, "bonito") 496MACHINE_START(BONITO, "bonito")
518 .map_io = bonito_map_io, 497 .map_io = bonito_map_io,
498 .init_early = bonito_add_early_devices,
519 .init_irq = r8a7740_init_irq, 499 .init_irq = r8a7740_init_irq,
520 .handle_irq = shmobile_handle_irq_intc, 500 .handle_irq = shmobile_handle_irq_intc,
521 .init_machine = bonito_init, 501 .init_machine = bonito_init,
522 .timer = &bonito_timer, 502 .timer = &shmobile_timer,
523MACHINE_END 503MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c
index 72d557281b1..b627e89037f 100644
--- a/arch/arm/mach-shmobile/board-g3evm.c
+++ b/arch/arm/mach-shmobile/board-g3evm.c
@@ -37,8 +37,6 @@
37#include <mach/common.h> 37#include <mach/common.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/map.h>
41#include <asm/mach/time.h>
42 40
43/* 41/*
44 * IrDA 42 * IrDA
@@ -246,27 +244,6 @@ static struct platform_device *g3evm_devices[] __initdata = {
246 &irda_device, 244 &irda_device,
247}; 245};
248 246
249static struct map_desc g3evm_io_desc[] __initdata = {
250 /* create a 1:1 entity map for 0xe6xxxxxx
251 * used by CPGA, INTC and PFC.
252 */
253 {
254 .virtual = 0xe6000000,
255 .pfn = __phys_to_pfn(0xe6000000),
256 .length = 256 << 20,
257 .type = MT_DEVICE_NONSHARED
258 },
259};
260
261static void __init g3evm_map_io(void)
262{
263 iotable_init(g3evm_io_desc, ARRAY_SIZE(g3evm_io_desc));
264
265 /* setup early devices and console here as well */
266 sh7367_add_early_devices();
267 shmobile_setup_console();
268}
269
270static void __init g3evm_init(void) 247static void __init g3evm_init(void)
271{ 248{
272 sh7367_pinmux_init(); 249 sh7367_pinmux_init();
@@ -354,20 +331,11 @@ static void __init g3evm_init(void)
354 platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices)); 331 platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices));
355} 332}
356 333
357static void __init g3evm_timer_init(void)
358{
359 sh7367_clock_init();
360 shmobile_timer.init();
361}
362
363static struct sys_timer g3evm_timer = {
364 .init = g3evm_timer_init,
365};
366
367MACHINE_START(G3EVM, "g3evm") 334MACHINE_START(G3EVM, "g3evm")
368 .map_io = g3evm_map_io, 335 .map_io = sh7367_map_io,
336 .init_early = sh7367_add_early_devices,
369 .init_irq = sh7367_init_irq, 337 .init_irq = sh7367_init_irq,
370 .handle_irq = shmobile_handle_irq_intc, 338 .handle_irq = shmobile_handle_irq_intc,
371 .init_machine = g3evm_init, 339 .init_machine = g3evm_init,
372 .timer = &g3evm_timer, 340 .timer = &shmobile_timer,
373MACHINE_END 341MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
index 2220b885cff..46d757d2759 100644
--- a/arch/arm/mach-shmobile/board-g4evm.c
+++ b/arch/arm/mach-shmobile/board-g4evm.c
@@ -38,8 +38,6 @@
38#include <mach/common.h> 38#include <mach/common.h>
39#include <asm/mach-types.h> 39#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
41#include <asm/mach/map.h>
42#include <asm/mach/time.h>
43 41
44/* 42/*
45 * SDHI 43 * SDHI
@@ -260,27 +258,6 @@ static struct platform_device *g4evm_devices[] __initdata = {
260 &sdhi1_device, 258 &sdhi1_device,
261}; 259};
262 260
263static struct map_desc g4evm_io_desc[] __initdata = {
264 /* create a 1:1 entity map for 0xe6xxxxxx
265 * used by CPGA, INTC and PFC.
266 */
267 {
268 .virtual = 0xe6000000,
269 .pfn = __phys_to_pfn(0xe6000000),
270 .length = 256 << 20,
271 .type = MT_DEVICE_NONSHARED
272 },
273};
274
275static void __init g4evm_map_io(void)
276{
277 iotable_init(g4evm_io_desc, ARRAY_SIZE(g4evm_io_desc));
278
279 /* setup early devices and console here as well */
280 sh7377_add_early_devices();
281 shmobile_setup_console();
282}
283
284#define GPIO_SDHID0_D0 0xe60520fc 261#define GPIO_SDHID0_D0 0xe60520fc
285#define GPIO_SDHID0_D1 0xe60520fd 262#define GPIO_SDHID0_D1 0xe60520fd
286#define GPIO_SDHID0_D2 0xe60520fe 263#define GPIO_SDHID0_D2 0xe60520fe
@@ -397,20 +374,11 @@ static void __init g4evm_init(void)
397 platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices)); 374 platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices));
398} 375}
399 376
400static void __init g4evm_timer_init(void)
401{
402 sh7377_clock_init();
403 shmobile_timer.init();
404}
405
406static struct sys_timer g4evm_timer = {
407 .init = g4evm_timer_init,
408};
409
410MACHINE_START(G4EVM, "g4evm") 377MACHINE_START(G4EVM, "g4evm")
411 .map_io = g4evm_map_io, 378 .map_io = sh7377_map_io,
379 .init_early = sh7377_add_early_devices,
412 .init_irq = sh7377_init_irq, 380 .init_irq = sh7377_init_irq,
413 .handle_irq = shmobile_handle_irq_intc, 381 .handle_irq = shmobile_handle_irq_intc,
414 .init_machine = g4evm_init, 382 .init_machine = g4evm_init,
415 .timer = &g4evm_timer, 383 .timer = &shmobile_timer,
416MACHINE_END 384MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index c8e7ca23fc0..61c06729466 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -43,7 +43,6 @@
43#include <mach/common.h> 43#include <mach/common.h>
44#include <asm/mach-types.h> 44#include <asm/mach-types.h>
45#include <asm/mach/arch.h> 45#include <asm/mach/arch.h>
46#include <asm/mach/map.h>
47#include <asm/mach/time.h> 46#include <asm/mach/time.h>
48#include <asm/hardware/gic.h> 47#include <asm/hardware/gic.h>
49#include <asm/hardware/cache-l2x0.h> 48#include <asm/hardware/cache-l2x0.h>
@@ -409,27 +408,6 @@ static struct platform_device *kota2_devices[] __initdata = {
409 &sdhi1_device, 408 &sdhi1_device,
410}; 409};
411 410
412static struct map_desc kota2_io_desc[] __initdata = {
413 /* create a 1:1 entity map for 0xe6xxxxxx
414 * used by CPGA, INTC and PFC.
415 */
416 {
417 .virtual = 0xe6000000,
418 .pfn = __phys_to_pfn(0xe6000000),
419 .length = 256 << 20,
420 .type = MT_DEVICE_NONSHARED
421 },
422};
423
424static void __init kota2_map_io(void)
425{
426 iotable_init(kota2_io_desc, ARRAY_SIZE(kota2_io_desc));
427
428 /* setup early devices and console here as well */
429 sh73a0_add_early_devices();
430 shmobile_setup_console();
431}
432
433static void __init kota2_init(void) 411static void __init kota2_init(void)
434{ 412{
435 sh73a0_pinmux_init(); 413 sh73a0_pinmux_init();
@@ -535,22 +513,12 @@ static void __init kota2_init(void)
535 platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices)); 513 platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices));
536} 514}
537 515
538static void __init kota2_timer_init(void)
539{
540 sh73a0_clock_init();
541 shmobile_timer.init();
542 return;
543}
544
545struct sys_timer kota2_timer = {
546 .init = kota2_timer_init,
547};
548
549MACHINE_START(KOTA2, "kota2") 516MACHINE_START(KOTA2, "kota2")
550 .map_io = kota2_map_io, 517 .map_io = sh73a0_map_io,
518 .init_early = sh73a0_add_early_devices,
551 .nr_irqs = NR_IRQS_LEGACY, 519 .nr_irqs = NR_IRQS_LEGACY,
552 .init_irq = sh73a0_init_irq, 520 .init_irq = sh73a0_init_irq,
553 .handle_irq = gic_handle_irq, 521 .handle_irq = gic_handle_irq,
554 .init_machine = kota2_init, 522 .init_machine = kota2_init,
555 .timer = &kota2_timer, 523 .timer = &shmobile_timer,
556MACHINE_END 524MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 7b53cda4185..bd4253ba05b 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -57,8 +57,6 @@
57#include <mach/sh7372.h> 57#include <mach/sh7372.h>
58 58
59#include <asm/mach/arch.h> 59#include <asm/mach/arch.h>
60#include <asm/mach/time.h>
61#include <asm/mach/map.h>
62#include <asm/mach-types.h> 60#include <asm/mach-types.h>
63 61
64/* 62/*
@@ -318,8 +316,14 @@ static struct sh_mobile_meram_info mackerel_meram_info = {
318 316
319static struct resource meram_resources[] = { 317static struct resource meram_resources[] = {
320 [0] = { 318 [0] = {
321 .name = "MERAM", 319 .name = "regs",
322 .start = 0xe8000000, 320 .start = 0xe8000000,
321 .end = 0xe807ffff,
322 .flags = IORESOURCE_MEM,
323 },
324 [1] = {
325 .name = "meram",
326 .start = 0xe8080000,
323 .end = 0xe81fffff, 327 .end = 0xe81fffff,
324 .flags = IORESOURCE_MEM, 328 .flags = IORESOURCE_MEM,
325 }, 329 },
@@ -351,29 +355,23 @@ static struct fb_videomode mackerel_lcdc_modes[] = {
351 }, 355 },
352}; 356};
353 357
354static int mackerel_set_brightness(void *board_data, int brightness) 358static int mackerel_set_brightness(int brightness)
355{ 359{
356 gpio_set_value(GPIO_PORT31, brightness); 360 gpio_set_value(GPIO_PORT31, brightness);
357 361
358 return 0; 362 return 0;
359} 363}
360 364
361static int mackerel_get_brightness(void *board_data) 365static int mackerel_get_brightness(void)
362{ 366{
363 return gpio_get_value(GPIO_PORT31); 367 return gpio_get_value(GPIO_PORT31);
364} 368}
365 369
366static struct sh_mobile_meram_cfg lcd_meram_cfg = { 370static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
367 .icb[0] = { 371 .icb[0] = {
368 .marker_icb = 28,
369 .cache_icb = 24,
370 .meram_offset = 0x0,
371 .meram_size = 0x40, 372 .meram_size = 0x40,
372 }, 373 },
373 .icb[1] = { 374 .icb[1] = {
374 .marker_icb = 29,
375 .cache_icb = 25,
376 .meram_offset = 0x40,
377 .meram_size = 0x40, 375 .meram_size = 0x40,
378 }, 376 },
379}; 377};
@@ -384,20 +382,20 @@ static struct sh_mobile_lcdc_info lcdc_info = {
384 .ch[0] = { 382 .ch[0] = {
385 .chan = LCDC_CHAN_MAINLCD, 383 .chan = LCDC_CHAN_MAINLCD,
386 .fourcc = V4L2_PIX_FMT_RGB565, 384 .fourcc = V4L2_PIX_FMT_RGB565,
387 .lcd_cfg = mackerel_lcdc_modes, 385 .lcd_modes = mackerel_lcdc_modes,
388 .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes), 386 .num_modes = ARRAY_SIZE(mackerel_lcdc_modes),
389 .interface_type = RGB24, 387 .interface_type = RGB24,
390 .clock_divider = 3, 388 .clock_divider = 3,
391 .flags = 0, 389 .flags = 0,
392 .lcd_size_cfg.width = 152, 390 .panel_cfg = {
393 .lcd_size_cfg.height = 91, 391 .width = 152,
394 .board_cfg = { 392 .height = 91,
395 .set_brightness = mackerel_set_brightness,
396 .get_brightness = mackerel_get_brightness,
397 }, 393 },
398 .bl_info = { 394 .bl_info = {
399 .name = "sh_mobile_lcdc_bl", 395 .name = "sh_mobile_lcdc_bl",
400 .max_brightness = 1, 396 .max_brightness = 1,
397 .set_brightness = mackerel_set_brightness,
398 .get_brightness = mackerel_get_brightness,
401 }, 399 },
402 .meram_cfg = &lcd_meram_cfg, 400 .meram_cfg = &lcd_meram_cfg,
403 } 401 }
@@ -426,21 +424,44 @@ static struct platform_device lcdc_device = {
426 }, 424 },
427}; 425};
428 426
429static struct sh_mobile_meram_cfg hdmi_meram_cfg = { 427/* HDMI */
428static struct sh_mobile_hdmi_info hdmi_info = {
429 .flags = HDMI_SND_SRC_SPDIF,
430};
431
432static struct resource hdmi_resources[] = {
433 [0] = {
434 .name = "HDMI",
435 .start = 0xe6be0000,
436 .end = 0xe6be00ff,
437 .flags = IORESOURCE_MEM,
438 },
439 [1] = {
440 /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
441 .start = evt2irq(0x17e0),
442 .flags = IORESOURCE_IRQ,
443 },
444};
445
446static struct platform_device hdmi_device = {
447 .name = "sh-mobile-hdmi",
448 .num_resources = ARRAY_SIZE(hdmi_resources),
449 .resource = hdmi_resources,
450 .id = -1,
451 .dev = {
452 .platform_data = &hdmi_info,
453 },
454};
455
456static const struct sh_mobile_meram_cfg hdmi_meram_cfg = {
430 .icb[0] = { 457 .icb[0] = {
431 .marker_icb = 30,
432 .cache_icb = 26,
433 .meram_offset = 0x80,
434 .meram_size = 0x100, 458 .meram_size = 0x100,
435 }, 459 },
436 .icb[1] = { 460 .icb[1] = {
437 .marker_icb = 31,
438 .cache_icb = 27,
439 .meram_offset = 0x180,
440 .meram_size = 0x100, 461 .meram_size = 0x100,
441 }, 462 },
442}; 463};
443/* HDMI */ 464
444static struct sh_mobile_lcdc_info hdmi_lcdc_info = { 465static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
445 .meram_dev = &mackerel_meram_info, 466 .meram_dev = &mackerel_meram_info,
446 .clock_source = LCDC_CLK_EXTERNAL, 467 .clock_source = LCDC_CLK_EXTERNAL,
@@ -451,6 +472,7 @@ static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
451 .clock_divider = 1, 472 .clock_divider = 1,
452 .flags = LCDC_FLAGS_DWPOL, 473 .flags = LCDC_FLAGS_DWPOL,
453 .meram_cfg = &hdmi_meram_cfg, 474 .meram_cfg = &hdmi_meram_cfg,
475 .tx_dev = &hdmi_device,
454 } 476 }
455}; 477};
456 478
@@ -478,36 +500,6 @@ static struct platform_device hdmi_lcdc_device = {
478 }, 500 },
479}; 501};
480 502
481static struct sh_mobile_hdmi_info hdmi_info = {
482 .lcd_chan = &hdmi_lcdc_info.ch[0],
483 .lcd_dev = &hdmi_lcdc_device.dev,
484 .flags = HDMI_SND_SRC_SPDIF,
485};
486
487static struct resource hdmi_resources[] = {
488 [0] = {
489 .name = "HDMI",
490 .start = 0xe6be0000,
491 .end = 0xe6be00ff,
492 .flags = IORESOURCE_MEM,
493 },
494 [1] = {
495 /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
496 .start = evt2irq(0x17e0),
497 .flags = IORESOURCE_IRQ,
498 },
499};
500
501static struct platform_device hdmi_device = {
502 .name = "sh-mobile-hdmi",
503 .num_resources = ARRAY_SIZE(hdmi_resources),
504 .resource = hdmi_resources,
505 .id = -1,
506 .dev = {
507 .platform_data = &hdmi_info,
508 },
509};
510
511static struct platform_device fsi_hdmi_device = { 503static struct platform_device fsi_hdmi_device = {
512 .name = "sh_fsi2_b_hdmi", 504 .name = "sh_fsi2_b_hdmi",
513}; 505};
@@ -860,7 +852,7 @@ static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
860 return clk_enable(clk); 852 return clk_enable(clk);
861} 853}
862 854
863static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable) 855static int fsi_b_set_rate(struct device *dev, int rate, int enable)
864{ 856{
865 struct clk *fsib_clk; 857 struct clk *fsib_clk;
866 struct clk *fdiv_clk = &sh7372_fsidivb_clk; 858 struct clk *fdiv_clk = &sh7372_fsidivb_clk;
@@ -869,10 +861,6 @@ static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable)
869 int ackmd_bpfmd; 861 int ackmd_bpfmd;
870 int ret; 862 int ret;
871 863
872 /* FSIA is slave mode. nothing to do here */
873 if (is_porta)
874 return 0;
875
876 /* clock start */ 864 /* clock start */
877 switch (rate) { 865 switch (rate) {
878 case 44100: 866 case 44100:
@@ -916,14 +904,16 @@ fsi_set_rate_end:
916} 904}
917 905
918static struct sh_fsi_platform_info fsi_info = { 906static struct sh_fsi_platform_info fsi_info = {
919 .porta_flags = SH_FSI_BRS_INV, 907 .port_a = {
920 908 .flags = SH_FSI_BRS_INV,
921 .portb_flags = SH_FSI_BRS_INV | 909 },
910 .port_b = {
911 .flags = SH_FSI_BRS_INV |
922 SH_FSI_BRM_INV | 912 SH_FSI_BRM_INV |
923 SH_FSI_LRS_INV | 913 SH_FSI_LRS_INV |
924 SH_FSI_FMT_SPDIF, 914 SH_FSI_FMT_SPDIF,
925 915 .set_rate = fsi_b_set_rate,
926 .set_rate = fsi_set_rate, 916 }
927}; 917};
928 918
929static struct resource fsi_resources[] = { 919static struct resource fsi_resources[] = {
@@ -1276,8 +1266,8 @@ static struct platform_device *mackerel_devices[] __initdata = {
1276 &sh_mmcif_device, 1266 &sh_mmcif_device,
1277 &ceu_device, 1267 &ceu_device,
1278 &mackerel_camera, 1268 &mackerel_camera,
1279 &hdmi_lcdc_device,
1280 &hdmi_device, 1269 &hdmi_device,
1270 &hdmi_lcdc_device,
1281 &meram_device, 1271 &meram_device,
1282}; 1272};
1283 1273
@@ -1337,29 +1327,13 @@ static struct i2c_board_info i2c1_devices[] = {
1337 }, 1327 },
1338}; 1328};
1339 1329
1340static struct map_desc mackerel_io_desc[] __initdata = {
1341 /* create a 1:1 entity map for 0xe6xxxxxx
1342 * used by CPGA, INTC and PFC.
1343 */
1344 {
1345 .virtual = 0xe6000000,
1346 .pfn = __phys_to_pfn(0xe6000000),
1347 .length = 256 << 20,
1348 .type = MT_DEVICE_NONSHARED
1349 },
1350};
1351
1352static void __init mackerel_map_io(void) 1330static void __init mackerel_map_io(void)
1353{ 1331{
1354 iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc)); 1332 sh7372_map_io();
1355 /* DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't 1333 /* DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't
1356 * enough to allocate the frame buffer memory. 1334 * enough to allocate the frame buffer memory.
1357 */ 1335 */
1358 init_consistent_dma_size(12 << 20); 1336 init_consistent_dma_size(12 << 20);
1359
1360 /* setup early devices and console here as well */
1361 sh7372_add_early_devices();
1362 shmobile_setup_console();
1363} 1337}
1364 1338
1365#define GPIO_PORT9CR 0xE6051009 1339#define GPIO_PORT9CR 0xE6051009
@@ -1374,6 +1348,9 @@ static void __init mackerel_init(void)
1374 struct clk *clk; 1348 struct clk *clk;
1375 int ret; 1349 int ret;
1376 1350
1351 /* External clock source */
1352 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1353
1377 sh7372_pinmux_init(); 1354 sh7372_pinmux_init();
1378 1355
1379 /* enable SCIFA0 */ 1356 /* enable SCIFA0 */
@@ -1577,23 +1554,11 @@ static void __init mackerel_init(void)
1577 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi"); 1554 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi");
1578} 1555}
1579 1556
1580static void __init mackerel_timer_init(void)
1581{
1582 sh7372_clock_init();
1583 shmobile_timer.init();
1584
1585 /* External clock source */
1586 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1587}
1588
1589static struct sys_timer mackerel_timer = {
1590 .init = mackerel_timer_init,
1591};
1592
1593MACHINE_START(MACKEREL, "mackerel") 1557MACHINE_START(MACKEREL, "mackerel")
1594 .map_io = mackerel_map_io, 1558 .map_io = mackerel_map_io,
1559 .init_early = sh7372_add_early_devices,
1595 .init_irq = sh7372_init_irq, 1560 .init_irq = sh7372_init_irq,
1596 .handle_irq = shmobile_handle_irq_intc, 1561 .handle_irq = shmobile_handle_irq_intc,
1597 .init_machine = mackerel_init, 1562 .init_machine = mackerel_init,
1598 .timer = &mackerel_timer, 1563 .timer = &shmobile_timer,
1599MACHINE_END 1564MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index f0e02c0ce99..cbd5e4cd06d 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -33,8 +33,6 @@
33#include <mach/common.h> 33#include <mach/common.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/time.h>
38#include <asm/hardware/gic.h> 36#include <asm/hardware/gic.h>
39#include <asm/traps.h> 37#include <asm/traps.h>
40 38
@@ -72,49 +70,6 @@ static struct platform_device *marzen_devices[] __initdata = {
72 &eth_device, 70 &eth_device,
73}; 71};
74 72
75static struct map_desc marzen_io_desc[] __initdata = {
76 /* 2M entity map for 0xf0000000 (MPCORE) */
77 {
78 .virtual = 0xf0000000,
79 .pfn = __phys_to_pfn(0xf0000000),
80 .length = SZ_2M,
81 .type = MT_DEVICE_NONSHARED
82 },
83 /* 16M entity map for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */
84 {
85 .virtual = 0xfe000000,
86 .pfn = __phys_to_pfn(0xfe000000),
87 .length = SZ_16M,
88 .type = MT_DEVICE_NONSHARED
89 },
90};
91
92static void __init marzen_map_io(void)
93{
94 iotable_init(marzen_io_desc, ARRAY_SIZE(marzen_io_desc));
95}
96
97static void __init marzen_init_early(void)
98{
99 r8a7779_add_early_devices();
100
101 /* Early serial console setup is not included here due to
102 * memory map collisions. The SCIF serial ports in r8a7779
103 * are difficult to entity map 1:1 due to collision with the
104 * virtual memory range used by the coherent DMA code on ARM.
105 *
106 * Anyone wanting to debug early can remove UPF_IOREMAP from
107 * the sh-sci serial console platform data, adjust mapbase
108 * to a static M:N virt:phys mapping that needs to be added to
109 * the mappings passed with iotable_init() above.
110 *
111 * Then add a call to shmobile_setup_console() from this function.
112 *
113 * As a final step pass earlyprint=sh-sci.2,115200 on the kernel
114 * command line.
115 */
116}
117
118static void __init marzen_init(void) 73static void __init marzen_init(void)
119{ 74{
120 r8a7779_pinmux_init(); 75 r8a7779_pinmux_init();
@@ -135,23 +90,12 @@ static void __init marzen_init(void)
135 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 90 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
136} 91}
137 92
138static void __init marzen_timer_init(void)
139{
140 r8a7779_clock_init();
141 shmobile_timer.init();
142 return;
143}
144
145struct sys_timer marzen_timer = {
146 .init = marzen_timer_init,
147};
148
149MACHINE_START(MARZEN, "marzen") 93MACHINE_START(MARZEN, "marzen")
150 .map_io = marzen_map_io, 94 .map_io = r8a7779_map_io,
151 .init_early = marzen_init_early, 95 .init_early = r8a7779_add_early_devices,
152 .nr_irqs = NR_IRQS_LEGACY, 96 .nr_irqs = NR_IRQS_LEGACY,
153 .init_irq = r8a7779_init_irq, 97 .init_irq = r8a7779_init_irq,
154 .handle_irq = gic_handle_irq, 98 .handle_irq = gic_handle_irq,
155 .init_machine = marzen_init, 99 .init_machine = marzen_init,
156 .timer = &marzen_timer, 100 .timer = &shmobile_timer,
157MACHINE_END 101MACHINE_END
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 3b35b9afc00..99c4d743a99 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -93,7 +93,7 @@ static unsigned long div_recalc(struct clk *clk)
93 return clk->parent->rate / (int)(clk->priv); 93 return clk->parent->rate / (int)(clk->priv);
94} 94}
95 95
96static struct clk_ops div_clk_ops = { 96static struct sh_clk_ops div_clk_ops = {
97 .recalc = div_recalc, 97 .recalc = div_recalc,
98}; 98};
99 99
@@ -125,7 +125,7 @@ static struct clk extal2_div2_clk = {
125 .parent = &extal2_clk, 125 .parent = &extal2_clk,
126}; 126};
127 127
128static struct clk_ops followparent_clk_ops = { 128static struct sh_clk_ops followparent_clk_ops = {
129 .recalc = followparent_recalc, 129 .recalc = followparent_recalc,
130}; 130};
131 131
@@ -156,7 +156,7 @@ static unsigned long pllc01_recalc(struct clk *clk)
156 return clk->parent->rate * mult; 156 return clk->parent->rate * mult;
157} 157}
158 158
159static struct clk_ops pllc01_clk_ops = { 159static struct sh_clk_ops pllc01_clk_ops = {
160 .recalc = pllc01_recalc, 160 .recalc = pllc01_recalc,
161}; 161};
162 162
@@ -376,7 +376,7 @@ void __init r8a7740_clock_init(u8 md_ck)
376 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 376 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
377 377
378 if (!ret) 378 if (!ret)
379 clk_init(); 379 shmobile_clk_init();
380 else 380 else
381 panic("failed to setup r8a7740 clocks\n"); 381 panic("failed to setup r8a7740 clocks\n");
382} 382}
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index b4b0e8cd096..7d6e9fe47b5 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -107,7 +107,7 @@ static unsigned long mul4_recalc(struct clk *clk)
107 return clk->parent->rate * 4; 107 return clk->parent->rate * 4;
108} 108}
109 109
110static struct clk_ops mul4_clk_ops = { 110static struct sh_clk_ops mul4_clk_ops = {
111 .recalc = mul4_recalc, 111 .recalc = mul4_recalc,
112}; 112};
113 113
@@ -170,7 +170,7 @@ void __init r8a7779_clock_init(void)
170 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 170 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
171 171
172 if (!ret) 172 if (!ret)
173 clk_init(); 173 shmobile_clk_init();
174 else 174 else
175 panic("failed to setup r8a7779 clocks\n"); 175 panic("failed to setup r8a7779 clocks\n");
176} 176}
diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c
index 5218c34a9cc..006e7b5d304 100644
--- a/arch/arm/mach-shmobile/clock-sh7367.c
+++ b/arch/arm/mach-shmobile/clock-sh7367.c
@@ -74,7 +74,7 @@ static unsigned long div2_recalc(struct clk *clk)
74 return clk->parent->rate / 2; 74 return clk->parent->rate / 2;
75} 75}
76 76
77static struct clk_ops div2_clk_ops = { 77static struct sh_clk_ops div2_clk_ops = {
78 .recalc = div2_recalc, 78 .recalc = div2_recalc,
79}; 79};
80 80
@@ -101,7 +101,7 @@ static unsigned long pllc1_recalc(struct clk *clk)
101 return clk->parent->rate * mult; 101 return clk->parent->rate * mult;
102} 102}
103 103
104static struct clk_ops pllc1_clk_ops = { 104static struct sh_clk_ops pllc1_clk_ops = {
105 .recalc = pllc1_recalc, 105 .recalc = pllc1_recalc,
106}; 106};
107 107
@@ -128,7 +128,7 @@ static unsigned long pllc2_recalc(struct clk *clk)
128 return clk->parent->rate * mult; 128 return clk->parent->rate * mult;
129} 129}
130 130
131static struct clk_ops pllc2_clk_ops = { 131static struct sh_clk_ops pllc2_clk_ops = {
132 .recalc = pllc2_recalc, 132 .recalc = pllc2_recalc,
133}; 133};
134 134
@@ -349,7 +349,7 @@ void __init sh7367_clock_init(void)
349 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 349 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
350 350
351 if (!ret) 351 if (!ret)
352 clk_init(); 352 shmobile_clk_init();
353 else 353 else
354 panic("failed to setup sh7367 clocks\n"); 354 panic("failed to setup sh7367 clocks\n");
355} 355}
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 293456d8dcf..de243e3c839 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -89,7 +89,7 @@ static unsigned long div2_recalc(struct clk *clk)
89 return clk->parent->rate / 2; 89 return clk->parent->rate / 2;
90} 90}
91 91
92static struct clk_ops div2_clk_ops = { 92static struct sh_clk_ops div2_clk_ops = {
93 .recalc = div2_recalc, 93 .recalc = div2_recalc,
94}; 94};
95 95
@@ -128,7 +128,7 @@ static unsigned long pllc01_recalc(struct clk *clk)
128 return clk->parent->rate * mult; 128 return clk->parent->rate * mult;
129} 129}
130 130
131static struct clk_ops pllc01_clk_ops = { 131static struct sh_clk_ops pllc01_clk_ops = {
132 .recalc = pllc01_recalc, 132 .recalc = pllc01_recalc,
133}; 133};
134 134
@@ -276,7 +276,7 @@ static int pllc2_set_parent(struct clk *clk, struct clk *parent)
276 return 0; 276 return 0;
277} 277}
278 278
279static struct clk_ops pllc2_clk_ops = { 279static struct sh_clk_ops pllc2_clk_ops = {
280 .recalc = pllc2_recalc, 280 .recalc = pllc2_recalc,
281 .round_rate = pllc2_round_rate, 281 .round_rate = pllc2_round_rate,
282 .set_rate = pllc2_set_rate, 282 .set_rate = pllc2_set_rate,
@@ -468,7 +468,7 @@ static int fsidiv_set_rate(struct clk *clk, unsigned long rate)
468 return 0; 468 return 0;
469} 469}
470 470
471static struct clk_ops fsidiv_clk_ops = { 471static struct sh_clk_ops fsidiv_clk_ops = {
472 .recalc = fsidiv_recalc, 472 .recalc = fsidiv_recalc,
473 .round_rate = fsidiv_round_rate, 473 .round_rate = fsidiv_round_rate,
474 .set_rate = fsidiv_set_rate, 474 .set_rate = fsidiv_set_rate,
@@ -710,7 +710,7 @@ void __init sh7372_clock_init(void)
710 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 710 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
711 711
712 if (!ret) 712 if (!ret)
713 clk_init(); 713 shmobile_clk_init();
714 else 714 else
715 panic("failed to setup sh7372 clocks\n"); 715 panic("failed to setup sh7372 clocks\n");
716 716
diff --git a/arch/arm/mach-shmobile/clock-sh7377.c b/arch/arm/mach-shmobile/clock-sh7377.c
index 8cee7b151ae..0798a15936c 100644
--- a/arch/arm/mach-shmobile/clock-sh7377.c
+++ b/arch/arm/mach-shmobile/clock-sh7377.c
@@ -77,7 +77,7 @@ static unsigned long div2_recalc(struct clk *clk)
77 return clk->parent->rate / 2; 77 return clk->parent->rate / 2;
78} 78}
79 79
80static struct clk_ops div2_clk_ops = { 80static struct sh_clk_ops div2_clk_ops = {
81 .recalc = div2_recalc, 81 .recalc = div2_recalc,
82}; 82};
83 83
@@ -110,7 +110,7 @@ static unsigned long pllc1_recalc(struct clk *clk)
110 return clk->parent->rate * mult; 110 return clk->parent->rate * mult;
111} 111}
112 112
113static struct clk_ops pllc1_clk_ops = { 113static struct sh_clk_ops pllc1_clk_ops = {
114 .recalc = pllc1_recalc, 114 .recalc = pllc1_recalc,
115}; 115};
116 116
@@ -137,7 +137,7 @@ static unsigned long pllc2_recalc(struct clk *clk)
137 return clk->parent->rate * mult; 137 return clk->parent->rate * mult;
138} 138}
139 139
140static struct clk_ops pllc2_clk_ops = { 140static struct sh_clk_ops pllc2_clk_ops = {
141 .recalc = pllc2_recalc, 141 .recalc = pllc2_recalc,
142}; 142};
143 143
@@ -360,7 +360,7 @@ void __init sh7377_clock_init(void)
360 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 360 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
361 361
362 if (!ret) 362 if (!ret)
363 clk_init(); 363 shmobile_clk_init();
364 else 364 else
365 panic("failed to setup sh7377 clocks\n"); 365 panic("failed to setup sh7377 clocks\n");
366} 366}
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 7727cca6136..472d1f5361e 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -88,7 +88,7 @@ static unsigned long div2_recalc(struct clk *clk)
88 return clk->parent->rate / 2; 88 return clk->parent->rate / 2;
89} 89}
90 90
91static struct clk_ops div2_clk_ops = { 91static struct sh_clk_ops div2_clk_ops = {
92 .recalc = div2_recalc, 92 .recalc = div2_recalc,
93}; 93};
94 94
@@ -97,7 +97,7 @@ static unsigned long div7_recalc(struct clk *clk)
97 return clk->parent->rate / 7; 97 return clk->parent->rate / 7;
98} 98}
99 99
100static struct clk_ops div7_clk_ops = { 100static struct sh_clk_ops div7_clk_ops = {
101 .recalc = div7_recalc, 101 .recalc = div7_recalc,
102}; 102};
103 103
@@ -106,7 +106,7 @@ static unsigned long div13_recalc(struct clk *clk)
106 return clk->parent->rate / 13; 106 return clk->parent->rate / 13;
107} 107}
108 108
109static struct clk_ops div13_clk_ops = { 109static struct sh_clk_ops div13_clk_ops = {
110 .recalc = div13_recalc, 110 .recalc = div13_recalc,
111}; 111};
112 112
@@ -122,7 +122,7 @@ static struct clk extal2_div2_clk = {
122 .parent = &sh73a0_extal2_clk, 122 .parent = &sh73a0_extal2_clk,
123}; 123};
124 124
125static struct clk_ops main_clk_ops = { 125static struct sh_clk_ops main_clk_ops = {
126 .recalc = followparent_recalc, 126 .recalc = followparent_recalc,
127}; 127};
128 128
@@ -156,7 +156,7 @@ static unsigned long pll_recalc(struct clk *clk)
156 return clk->parent->rate * mult; 156 return clk->parent->rate * mult;
157} 157}
158 158
159static struct clk_ops pll_clk_ops = { 159static struct sh_clk_ops pll_clk_ops = {
160 .recalc = pll_recalc, 160 .recalc = pll_recalc,
161}; 161};
162 162
@@ -438,7 +438,7 @@ static int dsiphy_set_rate(struct clk *clk, unsigned long rate)
438 return 0; 438 return 0;
439} 439}
440 440
441static struct clk_ops dsiphy_clk_ops = { 441static struct sh_clk_ops dsiphy_clk_ops = {
442 .recalc = dsiphy_recalc, 442 .recalc = dsiphy_recalc,
443 .round_rate = dsiphy_round_rate, 443 .round_rate = dsiphy_round_rate,
444 .set_rate = dsiphy_set_rate, 444 .set_rate = dsiphy_set_rate,
@@ -620,7 +620,7 @@ void __init sh73a0_clock_init(void)
620 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 620 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
621 621
622 if (!ret) 622 if (!ret)
623 clk_init(); 623 shmobile_clk_init();
624 else 624 else
625 panic("failed to setup sh73a0 clocks\n"); 625 panic("failed to setup sh73a0 clocks\n");
626} 626}
diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
index 31654d78b96..e816ca9bd21 100644
--- a/arch/arm/mach-shmobile/clock.c
+++ b/arch/arm/mach-shmobile/clock.c
@@ -24,7 +24,7 @@
24#include <linux/sh_clk.h> 24#include <linux/sh_clk.h>
25#include <linux/export.h> 25#include <linux/export.h>
26 26
27int __init clk_init(void) 27int __init shmobile_clk_init(void)
28{ 28{
29 /* Kick the child clocks.. */ 29 /* Kick the child clocks.. */
30 recalculate_root_clocks(); 30 recalculate_root_clocks();
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index e4b945e271e..83ad3fe0a75 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -1,12 +1,15 @@
1#ifndef __ARCH_MACH_COMMON_H 1#ifndef __ARCH_MACH_COMMON_H
2#define __ARCH_MACH_COMMON_H 2#define __ARCH_MACH_COMMON_H
3 3
4extern void shmobile_earlytimer_init(void);
4extern struct sys_timer shmobile_timer; 5extern struct sys_timer shmobile_timer;
6struct twd_local_timer;
7void shmobile_twd_init(struct twd_local_timer *twd_local_timer);
5extern void shmobile_setup_console(void); 8extern void shmobile_setup_console(void);
6extern void shmobile_secondary_vector(void); 9extern void shmobile_secondary_vector(void);
7extern int shmobile_platform_cpu_kill(unsigned int cpu); 10extern int shmobile_platform_cpu_kill(unsigned int cpu);
8struct clk; 11struct clk;
9extern int clk_init(void); 12extern int shmobile_clk_init(void);
10extern void shmobile_handle_irq_intc(struct pt_regs *); 13extern void shmobile_handle_irq_intc(struct pt_regs *);
11extern struct platform_suspend_ops shmobile_suspend_ops; 14extern struct platform_suspend_ops shmobile_suspend_ops;
12struct cpuidle_driver; 15struct cpuidle_driver;
@@ -14,6 +17,7 @@ extern void (*shmobile_cpuidle_modes[])(void);
14extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); 17extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);
15 18
16extern void sh7367_init_irq(void); 19extern void sh7367_init_irq(void);
20extern void sh7367_map_io(void);
17extern void sh7367_add_early_devices(void); 21extern void sh7367_add_early_devices(void);
18extern void sh7367_add_standard_devices(void); 22extern void sh7367_add_standard_devices(void);
19extern void sh7367_clock_init(void); 23extern void sh7367_clock_init(void);
@@ -22,6 +26,7 @@ extern struct clk sh7367_extalb1_clk;
22extern struct clk sh7367_extal2_clk; 26extern struct clk sh7367_extal2_clk;
23 27
24extern void sh7377_init_irq(void); 28extern void sh7377_init_irq(void);
29extern void sh7377_map_io(void);
25extern void sh7377_add_early_devices(void); 30extern void sh7377_add_early_devices(void);
26extern void sh7377_add_standard_devices(void); 31extern void sh7377_add_standard_devices(void);
27extern void sh7377_clock_init(void); 32extern void sh7377_clock_init(void);
@@ -30,6 +35,7 @@ extern struct clk sh7377_extalc1_clk;
30extern struct clk sh7377_extal2_clk; 35extern struct clk sh7377_extal2_clk;
31 36
32extern void sh7372_init_irq(void); 37extern void sh7372_init_irq(void);
38extern void sh7372_map_io(void);
33extern void sh7372_add_early_devices(void); 39extern void sh7372_add_early_devices(void);
34extern void sh7372_add_standard_devices(void); 40extern void sh7372_add_standard_devices(void);
35extern void sh7372_clock_init(void); 41extern void sh7372_clock_init(void);
@@ -41,6 +47,7 @@ extern struct clk sh7372_extal1_clk;
41extern struct clk sh7372_extal2_clk; 47extern struct clk sh7372_extal2_clk;
42 48
43extern void sh73a0_init_irq(void); 49extern void sh73a0_init_irq(void);
50extern void sh73a0_map_io(void);
44extern void sh73a0_add_early_devices(void); 51extern void sh73a0_add_early_devices(void);
45extern void sh73a0_add_standard_devices(void); 52extern void sh73a0_add_standard_devices(void);
46extern void sh73a0_clock_init(void); 53extern void sh73a0_clock_init(void);
@@ -56,12 +63,14 @@ extern int sh73a0_boot_secondary(unsigned int cpu);
56extern void sh73a0_smp_prepare_cpus(void); 63extern void sh73a0_smp_prepare_cpus(void);
57 64
58extern void r8a7740_init_irq(void); 65extern void r8a7740_init_irq(void);
66extern void r8a7740_map_io(void);
59extern void r8a7740_add_early_devices(void); 67extern void r8a7740_add_early_devices(void);
60extern void r8a7740_add_standard_devices(void); 68extern void r8a7740_add_standard_devices(void);
61extern void r8a7740_clock_init(u8 md_ck); 69extern void r8a7740_clock_init(u8 md_ck);
62extern void r8a7740_pinmux_init(void); 70extern void r8a7740_pinmux_init(void);
63 71
64extern void r8a7779_init_irq(void); 72extern void r8a7779_init_irq(void);
73extern void r8a7779_map_io(void);
65extern void r8a7779_add_early_devices(void); 74extern void r8a7779_add_early_devices(void);
66extern void r8a7779_add_standard_devices(void); 75extern void r8a7779_add_standard_devices(void);
67extern void r8a7779_clock_init(void); 76extern void r8a7779_clock_init(void);
diff --git a/arch/arm/mach-shmobile/include/mach/entry-macro.S b/arch/arm/mach-shmobile/include/mach/entry-macro.S
deleted file mode 100644
index 2a57b2964ee..00000000000
--- a/arch/arm/mach-shmobile/include/mach/entry-macro.S
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2010 Paul Mundt
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; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17
18 .macro disable_fiq
19 .endm
20
21 .macro arch_ret_to_user, tmp1, tmp2
22 .endm
diff --git a/arch/arm/mach-shmobile/include/mach/system.h b/arch/arm/mach-shmobile/include/mach/system.h
index 956ac18ddbf..3bbcb3fa077 100644
--- a/arch/arm/mach-shmobile/include/mach/system.h
+++ b/arch/arm/mach-shmobile/include/mach/system.h
@@ -1,11 +1,6 @@
1#ifndef __ASM_ARCH_SYSTEM_H 1#ifndef __ASM_ARCH_SYSTEM_H
2#define __ASM_ARCH_SYSTEM_H 2#define __ASM_ARCH_SYSTEM_H
3 3
4static inline void arch_idle(void)
5{
6 cpu_do_idle();
7}
8
9static inline void arch_reset(char mode, const char *cmd) 4static inline void arch_reset(char mode, const char *cmd)
10{ 5{
11 soft_restart(0); 6 soft_restart(0);
diff --git a/arch/arm/mach-shmobile/localtimer.c b/arch/arm/mach-shmobile/localtimer.c
deleted file mode 100644
index ad9ccc9900c..00000000000
--- a/arch/arm/mach-shmobile/localtimer.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * SMP support for R-Mobile / SH-Mobile - local timer portion
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * Based on vexpress, Copyright (C) 2002 ARM Ltd, 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 version 2 as
10 * published by the Free Software Foundation.
11 */
12#include <linux/init.h>
13#include <linux/smp.h>
14#include <linux/clockchips.h>
15#include <asm/smp_twd.h>
16#include <asm/localtimer.h>
17
18/*
19 * Setup the local clock events for a CPU.
20 */
21int __cpuinit local_timer_setup(struct clock_event_device *evt)
22{
23 evt->irq = 29;
24 twd_timer_setup(evt);
25 return 0;
26}
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index 993381257f6..45fa3924c6a 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -17,7 +17,6 @@
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <asm/hardware/gic.h> 19#include <asm/hardware/gic.h>
20#include <asm/localtimer.h>
21#include <asm/mach-types.h> 20#include <asm/mach-types.h>
22#include <mach/common.h> 21#include <mach/common.h>
23 22
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 986dca6b3fa..74e52341dd1 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -25,8 +25,41 @@
25#include <linux/serial_sci.h> 25#include <linux/serial_sci.h>
26#include <linux/sh_timer.h> 26#include <linux/sh_timer.h>
27#include <mach/r8a7740.h> 27#include <mach/r8a7740.h>
28#include <mach/common.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/mach/map.h>
29#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/time.h>
33
34static struct map_desc r8a7740_io_desc[] __initdata = {
35 /*
36 * for CPGA/INTC/PFC
37 * 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff
38 */
39 {
40 .virtual = 0xe6000000,
41 .pfn = __phys_to_pfn(0xe6000000),
42 .length = 160 << 20,
43 .type = MT_DEVICE_NONSHARED
44 },
45#ifdef CONFIG_CACHE_L2X0
46 /*
47 * for l2x0_init()
48 * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000
49 */
50 {
51 .virtual = 0xf0002000,
52 .pfn = __phys_to_pfn(0xf0100000),
53 .length = PAGE_SIZE,
54 .type = MT_DEVICE_NONSHARED
55 },
56#endif
57};
58
59void __init r8a7740_map_io(void)
60{
61 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
62}
30 63
31/* SCIFA0 */ 64/* SCIFA0 */
32static struct plat_sci_port scif0_platform_data = { 65static struct plat_sci_port scif0_platform_data = {
@@ -345,8 +378,20 @@ void __init r8a7740_add_standard_devices(void)
345 ARRAY_SIZE(r8a7740_late_devices)); 378 ARRAY_SIZE(r8a7740_late_devices));
346} 379}
347 380
381static void __init r8a7740_earlytimer_init(void)
382{
383 r8a7740_clock_init(0);
384 shmobile_earlytimer_init();
385}
386
348void __init r8a7740_add_early_devices(void) 387void __init r8a7740_add_early_devices(void)
349{ 388{
350 early_platform_add_devices(r8a7740_early_devices, 389 early_platform_add_devices(r8a7740_early_devices,
351 ARRAY_SIZE(r8a7740_early_devices)); 390 ARRAY_SIZE(r8a7740_early_devices));
391
392 /* setup early console here as well */
393 shmobile_setup_console();
394
395 /* override timer setup with soc-specific code */
396 shmobile_timer.init = r8a7740_earlytimer_init;
352} 397}
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 4725663bd03..6820d785493 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -33,6 +33,31 @@
33#include <mach/common.h> 33#include <mach/common.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
36#include <asm/mach/time.h>
37#include <asm/mach/map.h>
38#include <asm/hardware/cache-l2x0.h>
39
40static struct map_desc r8a7779_io_desc[] __initdata = {
41 /* 2M entity map for 0xf0000000 (MPCORE) */
42 {
43 .virtual = 0xf0000000,
44 .pfn = __phys_to_pfn(0xf0000000),
45 .length = SZ_2M,
46 .type = MT_DEVICE_NONSHARED
47 },
48 /* 16M entity map for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */
49 {
50 .virtual = 0xfe000000,
51 .pfn = __phys_to_pfn(0xfe000000),
52 .length = SZ_16M,
53 .type = MT_DEVICE_NONSHARED
54 },
55};
56
57void __init r8a7779_map_io(void)
58{
59 iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc));
60}
36 61
37static struct plat_sci_port scif0_platform_data = { 62static struct plat_sci_port scif0_platform_data = {
38 .mapbase = 0xffe40000, 63 .mapbase = 0xffe40000,
@@ -219,6 +244,10 @@ static struct platform_device *r8a7779_late_devices[] __initdata = {
219 244
220void __init r8a7779_add_standard_devices(void) 245void __init r8a7779_add_standard_devices(void)
221{ 246{
247#ifdef CONFIG_CACHE_L2X0
248 /* Early BRESP enable, Shared attribute override enable, 64K*16way */
249 l2x0_init((void __iomem __force *)(0xf0100000), 0x40470000, 0x82000fff);
250#endif
222 r8a7779_pm_init(); 251 r8a7779_pm_init();
223 252
224 r8a7779_init_pm_domain(&r8a7779_sh4a); 253 r8a7779_init_pm_domain(&r8a7779_sh4a);
@@ -232,8 +261,33 @@ void __init r8a7779_add_standard_devices(void)
232 ARRAY_SIZE(r8a7779_late_devices)); 261 ARRAY_SIZE(r8a7779_late_devices));
233} 262}
234 263
264static void __init r8a7779_earlytimer_init(void)
265{
266 r8a7779_clock_init();
267 shmobile_earlytimer_init();
268}
269
235void __init r8a7779_add_early_devices(void) 270void __init r8a7779_add_early_devices(void)
236{ 271{
237 early_platform_add_devices(r8a7779_early_devices, 272 early_platform_add_devices(r8a7779_early_devices,
238 ARRAY_SIZE(r8a7779_early_devices)); 273 ARRAY_SIZE(r8a7779_early_devices));
274
275 /* Early serial console setup is not included here due to
276 * memory map collisions. The SCIF serial ports in r8a7779
277 * are difficult to entity map 1:1 due to collision with the
278 * virtual memory range used by the coherent DMA code on ARM.
279 *
280 * Anyone wanting to debug early can remove UPF_IOREMAP from
281 * the sh-sci serial console platform data, adjust mapbase
282 * to a static M:N virt:phys mapping that needs to be added to
283 * the mappings passed with iotable_init() above.
284 *
285 * Then add a call to shmobile_setup_console() from this function.
286 *
287 * As a final step pass earlyprint=sh-sci.2,115200 on the kernel
288 * command line in case of the marzen board.
289 */
290
291 /* override timer setup with soc-specific code */
292 shmobile_timer.init = r8a7779_earlytimer_init;
239} 293}
diff --git a/arch/arm/mach-shmobile/setup-sh7367.c b/arch/arm/mach-shmobile/setup-sh7367.c
index e546017f15d..a51e1a1e699 100644
--- a/arch/arm/mach-shmobile/setup-sh7367.c
+++ b/arch/arm/mach-shmobile/setup-sh7367.c
@@ -29,8 +29,28 @@
29#include <linux/serial_sci.h> 29#include <linux/serial_sci.h>
30#include <linux/sh_timer.h> 30#include <linux/sh_timer.h>
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/common.h>
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/time.h>
37
38static struct map_desc sh7367_io_desc[] __initdata = {
39 /* create a 1:1 entity map for 0xe6xxxxxx
40 * used by CPGA, INTC and PFC.
41 */
42 {
43 .virtual = 0xe6000000,
44 .pfn = __phys_to_pfn(0xe6000000),
45 .length = 256 << 20,
46 .type = MT_DEVICE_NONSHARED
47 },
48};
49
50void __init sh7367_map_io(void)
51{
52 iotable_init(sh7367_io_desc, ARRAY_SIZE(sh7367_io_desc));
53}
34 54
35/* SCIFA0 */ 55/* SCIFA0 */
36static struct plat_sci_port scif0_platform_data = { 56static struct plat_sci_port scif0_platform_data = {
@@ -435,6 +455,12 @@ void __init sh7367_add_standard_devices(void)
435 ARRAY_SIZE(sh7367_devices)); 455 ARRAY_SIZE(sh7367_devices));
436} 456}
437 457
458static void __init sh7367_earlytimer_init(void)
459{
460 sh7367_clock_init();
461 shmobile_earlytimer_init();
462}
463
438#define SYMSTPCR2 0xe6158048 464#define SYMSTPCR2 0xe6158048
439#define SYMSTPCR2_CMT1 (1 << 29) 465#define SYMSTPCR2_CMT1 (1 << 29)
440 466
@@ -445,4 +471,10 @@ void __init sh7367_add_early_devices(void)
445 471
446 early_platform_add_devices(sh7367_early_devices, 472 early_platform_add_devices(sh7367_early_devices,
447 ARRAY_SIZE(sh7367_early_devices)); 473 ARRAY_SIZE(sh7367_early_devices));
474
475 /* setup early console here as well */
476 shmobile_setup_console();
477
478 /* override timer setup with soc-specific code */
479 shmobile_timer.init = sh7367_earlytimer_init;
448} 480}
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index cccf91b8fae..5375325d7ca 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -33,8 +33,28 @@
33#include <linux/pm_domain.h> 33#include <linux/pm_domain.h>
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/sh7372.h> 35#include <mach/sh7372.h>
36#include <mach/common.h>
37#include <asm/mach/map.h>
36#include <asm/mach-types.h> 38#include <asm/mach-types.h>
37#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/time.h>
41
42static struct map_desc sh7372_io_desc[] __initdata = {
43 /* create a 1:1 entity map for 0xe6xxxxxx
44 * used by CPGA, INTC and PFC.
45 */
46 {
47 .virtual = 0xe6000000,
48 .pfn = __phys_to_pfn(0xe6000000),
49 .length = 256 << 20,
50 .type = MT_DEVICE_NONSHARED
51 },
52};
53
54void __init sh7372_map_io(void)
55{
56 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
57}
38 58
39/* SCIFA0 */ 59/* SCIFA0 */
40static struct plat_sci_port scif0_platform_data = { 60static struct plat_sci_port scif0_platform_data = {
@@ -1047,8 +1067,20 @@ void __init sh7372_add_standard_devices(void)
1047 sh7372_add_device_to_domain(&sh7372_a4r, &tmu01_device); 1067 sh7372_add_device_to_domain(&sh7372_a4r, &tmu01_device);
1048} 1068}
1049 1069
1070static void __init sh7372_earlytimer_init(void)
1071{
1072 sh7372_clock_init();
1073 shmobile_earlytimer_init();
1074}
1075
1050void __init sh7372_add_early_devices(void) 1076void __init sh7372_add_early_devices(void)
1051{ 1077{
1052 early_platform_add_devices(sh7372_early_devices, 1078 early_platform_add_devices(sh7372_early_devices,
1053 ARRAY_SIZE(sh7372_early_devices)); 1079 ARRAY_SIZE(sh7372_early_devices));
1080
1081 /* setup early console here as well */
1082 shmobile_setup_console();
1083
1084 /* override timer setup with soc-specific code */
1085 shmobile_timer.init = sh7372_earlytimer_init;
1054} 1086}
diff --git a/arch/arm/mach-shmobile/setup-sh7377.c b/arch/arm/mach-shmobile/setup-sh7377.c
index bb405b8e459..9f146095098 100644
--- a/arch/arm/mach-shmobile/setup-sh7377.c
+++ b/arch/arm/mach-shmobile/setup-sh7377.c
@@ -30,8 +30,28 @@
30#include <linux/sh_intc.h> 30#include <linux/sh_intc.h>
31#include <linux/sh_timer.h> 31#include <linux/sh_timer.h>
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/common.h>
34#include <asm/mach/map.h>
33#include <asm/mach-types.h> 35#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
37#include <asm/mach/time.h>
38
39static struct map_desc sh7377_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 sh7377_map_io(void)
52{
53 iotable_init(sh7377_io_desc, ARRAY_SIZE(sh7377_io_desc));
54}
35 55
36/* SCIFA0 */ 56/* SCIFA0 */
37static struct plat_sci_port scif0_platform_data = { 57static struct plat_sci_port scif0_platform_data = {
@@ -456,6 +476,12 @@ void __init sh7377_add_standard_devices(void)
456 ARRAY_SIZE(sh7377_devices)); 476 ARRAY_SIZE(sh7377_devices));
457} 477}
458 478
479static void __init sh7377_earlytimer_init(void)
480{
481 sh7377_clock_init();
482 shmobile_earlytimer_init();
483}
484
459#define SMSTPCR3 0xe615013c 485#define SMSTPCR3 0xe615013c
460#define SMSTPCR3_CMT1 (1 << 29) 486#define SMSTPCR3_CMT1 (1 << 29)
461 487
@@ -466,4 +492,10 @@ void __init sh7377_add_early_devices(void)
466 492
467 early_platform_add_devices(sh7377_early_devices, 493 early_platform_add_devices(sh7377_early_devices,
468 ARRAY_SIZE(sh7377_early_devices)); 494 ARRAY_SIZE(sh7377_early_devices));
495
496 /* setup early console here as well */
497 shmobile_setup_console();
498
499 /* override timer setup with soc-specific code */
500 shmobile_timer.init = sh7377_earlytimer_init;
469} 501}
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 20e71e5cace..b6a0734a738 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -32,8 +32,28 @@
32#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
33#include <mach/hardware.h> 33#include <mach/hardware.h>
34#include <mach/sh73a0.h> 34#include <mach/sh73a0.h>
35#include <mach/common.h>
35#include <asm/mach-types.h> 36#include <asm/mach-types.h>
37#include <asm/mach/map.h>
36#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
39#include <asm/mach/time.h>
40
41static struct map_desc sh73a0_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 sh73a0_map_io(void)
54{
55 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
56}
37 57
38static struct plat_sci_port scif0_platform_data = { 58static struct plat_sci_port scif0_platform_data = {
39 .mapbase = 0xe6c40000, 59 .mapbase = 0xe6c40000,
@@ -667,8 +687,20 @@ void __init sh73a0_add_standard_devices(void)
667 ARRAY_SIZE(sh73a0_late_devices)); 687 ARRAY_SIZE(sh73a0_late_devices));
668} 688}
669 689
690static void __init sh73a0_earlytimer_init(void)
691{
692 sh73a0_clock_init();
693 shmobile_earlytimer_init();
694}
695
670void __init sh73a0_add_early_devices(void) 696void __init sh73a0_add_early_devices(void)
671{ 697{
672 early_platform_add_devices(sh73a0_early_devices, 698 early_platform_add_devices(sh73a0_early_devices,
673 ARRAY_SIZE(sh73a0_early_devices)); 699 ARRAY_SIZE(sh73a0_early_devices));
700
701 /* setup early console here as well */
702 shmobile_setup_console();
703
704 /* override timer setup with soc-specific code */
705 shmobile_timer.init = sh73a0_earlytimer_init;
674} 706}
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 4fe2e9eaf50..9bb7b8575a1 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -64,6 +64,8 @@ static void __iomem *scu_base_addr(void)
64static DEFINE_SPINLOCK(scu_lock); 64static DEFINE_SPINLOCK(scu_lock);
65static unsigned long tmp; 65static unsigned long tmp;
66 66
67static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
68
67static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) 69static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
68{ 70{
69 void __iomem *scu_base = scu_base_addr(); 71 void __iomem *scu_base = scu_base_addr();
@@ -82,11 +84,7 @@ unsigned int __init r8a7779_get_core_count(void)
82{ 84{
83 void __iomem *scu_base = scu_base_addr(); 85 void __iomem *scu_base = scu_base_addr();
84 86
85#ifdef CONFIG_HAVE_ARM_TWD 87 shmobile_twd_init(&twd_local_timer);
86 /* twd_base needs to be initialized before percpu_timer_setup() */
87 twd_base = (void __iomem *)0xf0000600;
88#endif
89
90 return scu_get_core_count(scu_base); 88 return scu_get_core_count(scu_base);
91} 89}
92 90
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 2d0d4212be4..c0a9093ba3a 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -42,6 +42,8 @@ static void __iomem *scu_base_addr(void)
42static DEFINE_SPINLOCK(scu_lock); 42static DEFINE_SPINLOCK(scu_lock);
43static unsigned long tmp; 43static unsigned long tmp;
44 44
45static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
46
45static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) 47static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
46{ 48{
47 void __iomem *scu_base = scu_base_addr(); 49 void __iomem *scu_base = scu_base_addr();
@@ -60,11 +62,7 @@ unsigned int __init sh73a0_get_core_count(void)
60{ 62{
61 void __iomem *scu_base = scu_base_addr(); 63 void __iomem *scu_base = scu_base_addr();
62 64
63#ifdef CONFIG_HAVE_ARM_TWD 65 shmobile_twd_init(&twd_local_timer);
64 /* twd_base needs to be initialized before percpu_timer_setup() */
65 twd_base = (void __iomem *)0xf0000600;
66#endif
67
68 return scu_get_core_count(scu_base); 66 return scu_get_core_count(scu_base);
69} 67}
70 68
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 895794b543c..2fba5f3d1c8 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -20,6 +20,7 @@
20 */ 20 */
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <asm/mach/time.h> 22#include <asm/mach/time.h>
23#include <asm/smp_twd.h>
23 24
24static void __init shmobile_late_time_init(void) 25static void __init shmobile_late_time_init(void)
25{ 26{
@@ -36,11 +37,24 @@ static void __init shmobile_late_time_init(void)
36 early_platform_driver_probe("earlytimer", 2, 0); 37 early_platform_driver_probe("earlytimer", 2, 0);
37} 38}
38 39
39static void __init shmobile_timer_init(void) 40void __init shmobile_earlytimer_init(void)
40{ 41{
41 late_time_init = shmobile_late_time_init; 42 late_time_init = shmobile_late_time_init;
42} 43}
43 44
45static void __init shmobile_timer_init(void)
46{
47}
48
49void __init shmobile_twd_init(struct twd_local_timer *twd_local_timer)
50{
51#ifdef CONFIG_HAVE_ARM_TWD
52 int err = twd_local_timer_register(twd_local_timer);
53 if (err)
54 pr_err("twd_local_timer_register failed %d\n", err);
55#endif
56}
57
44struct sys_timer shmobile_timer = { 58struct sys_timer shmobile_timer = {
45 .init = shmobile_timer_init, 59 .init = shmobile_timer_init,
46}; 60};
diff --git a/arch/arm/mach-spear3xx/include/mach/entry-macro.S b/arch/arm/mach-spear3xx/include/mach/entry-macro.S
deleted file mode 100644
index de3bb41c8e9..00000000000
--- a/arch/arm/mach-spear3xx/include/mach/entry-macro.S
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for SPEAr3xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.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 .macro disable_fiq
15 .endm
16
17 .macro arch_ret_to_user, tmp1, tmp2
18 .endm
diff --git a/arch/arm/mach-spear3xx/include/mach/system.h b/arch/arm/mach-spear3xx/include/mach/system.h
deleted file mode 100644
index 92cee6335c9..00000000000
--- a/arch/arm/mach-spear3xx/include/mach/system.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/system.h
3 *
4 * SPEAr3xx Machine family specific architecture functions
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.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 __MACH_SYSTEM_H
15#define __MACH_SYSTEM_H
16
17#include <plat/system.h>
18
19#endif /* __MACH_SYSTEM_H */
diff --git a/arch/arm/mach-spear3xx/spear300.c b/arch/arm/mach-spear3xx/spear300.c
index 4f7f5182dd4..f7db66812ab 100644
--- a/arch/arm/mach-spear3xx/spear300.c
+++ b/arch/arm/mach-spear3xx/spear300.c
@@ -430,18 +430,8 @@ static struct pl061_platform_data gpio1_plat_data = {
430 .irq_base = SPEAR300_GPIO1_INT_BASE, 430 .irq_base = SPEAR300_GPIO1_INT_BASE,
431}; 431};
432 432
433struct amba_device spear300_gpio1_device = { 433AMBA_APB_DEVICE(spear300_gpio1, "gpio1", 0, SPEAR300_GPIO_BASE,
434 .dev = { 434 {SPEAR300_VIRQ_GPIO1}, &gpio1_plat_data);
435 .init_name = "gpio1",
436 .platform_data = &gpio1_plat_data,
437 },
438 .res = {
439 .start = SPEAR300_GPIO_BASE,
440 .end = SPEAR300_GPIO_BASE + SZ_4K - 1,
441 .flags = IORESOURCE_MEM,
442 },
443 .irq = {SPEAR300_VIRQ_GPIO1, NO_IRQ},
444};
445 435
446/* spear300 routines */ 436/* spear300 routines */
447void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 437void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c
index 10af45da86a..b1733c37f20 100644
--- a/arch/arm/mach-spear3xx/spear3xx.c
+++ b/arch/arm/mach-spear3xx/spear3xx.c
@@ -28,31 +28,12 @@ static struct pl061_platform_data gpio_plat_data = {
28 .irq_base = SPEAR3XX_GPIO_INT_BASE, 28 .irq_base = SPEAR3XX_GPIO_INT_BASE,
29}; 29};
30 30
31struct amba_device spear3xx_gpio_device = { 31AMBA_APB_DEVICE(spear3xx_gpio, "gpio", 0, SPEAR3XX_ICM3_GPIO_BASE,
32 .dev = { 32 {SPEAR3XX_IRQ_BASIC_GPIO}, &gpio_plat_data);
33 .init_name = "gpio",
34 .platform_data = &gpio_plat_data,
35 },
36 .res = {
37 .start = SPEAR3XX_ICM3_GPIO_BASE,
38 .end = SPEAR3XX_ICM3_GPIO_BASE + SZ_4K - 1,
39 .flags = IORESOURCE_MEM,
40 },
41 .irq = {SPEAR3XX_IRQ_BASIC_GPIO, NO_IRQ},
42};
43 33
44/* uart device registration */ 34/* uart device registration */
45struct amba_device spear3xx_uart_device = { 35AMBA_APB_DEVICE(spear3xx_uart, "uart", 0, SPEAR3XX_ICM1_UART_BASE,
46 .dev = { 36 {SPEAR3XX_IRQ_UART}, NULL);
47 .init_name = "uart",
48 },
49 .res = {
50 .start = SPEAR3XX_ICM1_UART_BASE,
51 .end = SPEAR3XX_ICM1_UART_BASE + SZ_4K - 1,
52 .flags = IORESOURCE_MEM,
53 },
54 .irq = {SPEAR3XX_IRQ_UART, NO_IRQ},
55};
56 37
57/* Do spear3xx familiy common initialization part here */ 38/* Do spear3xx familiy common initialization part here */
58void __init spear3xx_init(void) 39void __init spear3xx_init(void)
diff --git a/arch/arm/mach-spear6xx/include/mach/entry-macro.S b/arch/arm/mach-spear6xx/include/mach/entry-macro.S
deleted file mode 100644
index d490a910d92..00000000000
--- a/arch/arm/mach-spear6xx/include/mach/entry-macro.S
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for SPEAr6xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.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 .macro disable_fiq
15 .endm
16
17 .macro arch_ret_to_user, tmp1, tmp2
18 .endm
diff --git a/arch/arm/mach-spear6xx/include/mach/system.h b/arch/arm/mach-spear6xx/include/mach/system.h
deleted file mode 100644
index 0b1d2be81cf..00000000000
--- a/arch/arm/mach-spear6xx/include/mach/system.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/include/mach/system.h
3 *
4 * SPEAr6xx Machine family specific architecture functions
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.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 __MACH_SYSTEM_H
15#define __MACH_SYSTEM_H
16
17#include <plat/system.h>
18
19#endif /* __MACH_SYSTEM_H */
diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear6xx/spear6xx.c
index e0f6628c8b2..b997b1b10ba 100644
--- a/arch/arm/mach-spear6xx/spear6xx.c
+++ b/arch/arm/mach-spear6xx/spear6xx.c
@@ -34,7 +34,7 @@ struct amba_device uart_device[] = {
34 .end = SPEAR6XX_ICM1_UART0_BASE + SZ_4K - 1, 34 .end = SPEAR6XX_ICM1_UART0_BASE + SZ_4K - 1,
35 .flags = IORESOURCE_MEM, 35 .flags = IORESOURCE_MEM,
36 }, 36 },
37 .irq = {IRQ_UART_0, NO_IRQ}, 37 .irq = {IRQ_UART_0},
38 }, { 38 }, {
39 .dev = { 39 .dev = {
40 .init_name = "uart1", 40 .init_name = "uart1",
@@ -44,7 +44,7 @@ struct amba_device uart_device[] = {
44 .end = SPEAR6XX_ICM1_UART1_BASE + SZ_4K - 1, 44 .end = SPEAR6XX_ICM1_UART1_BASE + SZ_4K - 1,
45 .flags = IORESOURCE_MEM, 45 .flags = IORESOURCE_MEM,
46 }, 46 },
47 .irq = {IRQ_UART_1, NO_IRQ}, 47 .irq = {IRQ_UART_1},
48 } 48 }
49}; 49};
50 50
@@ -73,7 +73,7 @@ struct amba_device gpio_device[] = {
73 .end = SPEAR6XX_CPU_GPIO_BASE + SZ_4K - 1, 73 .end = SPEAR6XX_CPU_GPIO_BASE + SZ_4K - 1,
74 .flags = IORESOURCE_MEM, 74 .flags = IORESOURCE_MEM,
75 }, 75 },
76 .irq = {IRQ_LOCAL_GPIO, NO_IRQ}, 76 .irq = {IRQ_LOCAL_GPIO},
77 }, { 77 }, {
78 .dev = { 78 .dev = {
79 .init_name = "gpio1", 79 .init_name = "gpio1",
@@ -84,7 +84,7 @@ struct amba_device gpio_device[] = {
84 .end = SPEAR6XX_ICM3_GPIO_BASE + SZ_4K - 1, 84 .end = SPEAR6XX_ICM3_GPIO_BASE + SZ_4K - 1,
85 .flags = IORESOURCE_MEM, 85 .flags = IORESOURCE_MEM,
86 }, 86 },
87 .irq = {IRQ_BASIC_GPIO, NO_IRQ}, 87 .irq = {IRQ_BASIC_GPIO},
88 }, { 88 }, {
89 .dev = { 89 .dev = {
90 .init_name = "gpio2", 90 .init_name = "gpio2",
@@ -95,7 +95,7 @@ struct amba_device gpio_device[] = {
95 .end = SPEAR6XX_ICM2_GPIO_BASE + SZ_4K - 1, 95 .end = SPEAR6XX_ICM2_GPIO_BASE + SZ_4K - 1,
96 .flags = IORESOURCE_MEM, 96 .flags = IORESOURCE_MEM,
97 }, 97 },
98 .irq = {IRQ_APPL_GPIO, NO_IRQ}, 98 .irq = {IRQ_APPL_GPIO},
99 } 99 }
100}; 100};
101 101
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 373652d76b9..d0f2546706c 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -7,9 +7,19 @@ config ARCH_TEGRA_2x_SOC
7 select CPU_V7 7 select CPU_V7
8 select ARM_GIC 8 select ARM_GIC
9 select ARCH_REQUIRE_GPIOLIB 9 select ARCH_REQUIRE_GPIOLIB
10 select PINCTRL
11 select PINCTRL_TEGRA20
10 select USB_ARCH_HAS_EHCI if USB_SUPPORT 12 select USB_ARCH_HAS_EHCI if USB_SUPPORT
11 select USB_ULPI if USB_SUPPORT 13 select USB_ULPI if USB
12 select USB_ULPI_VIEWPORT if USB_SUPPORT 14 select USB_ULPI_VIEWPORT if USB_SUPPORT
15 select ARM_ERRATA_720789
16 select ARM_ERRATA_742230
17 select ARM_ERRATA_751472
18 select ARM_ERRATA_754327
19 select ARM_ERRATA_764369
20 select PL310_ERRATA_727915 if CACHE_L2X0
21 select PL310_ERRATA_769419 if CACHE_L2X0
22 select CPU_FREQ_TABLE if CPU_FREQ
13 help 23 help
14 Support for NVIDIA Tegra AP20 and T20 processors, based on the 24 Support for NVIDIA Tegra AP20 and T20 processors, based on the
15 ARM CortexA9MP CPU and the ARM PL310 L2 cache controller 25 ARM CortexA9MP CPU and the ARM PL310 L2 cache controller
@@ -19,10 +29,18 @@ config ARCH_TEGRA_3x_SOC
19 select CPU_V7 29 select CPU_V7
20 select ARM_GIC 30 select ARM_GIC
21 select ARCH_REQUIRE_GPIOLIB 31 select ARCH_REQUIRE_GPIOLIB
32 select PINCTRL
33 select PINCTRL_TEGRA30
22 select USB_ARCH_HAS_EHCI if USB_SUPPORT 34 select USB_ARCH_HAS_EHCI if USB_SUPPORT
23 select USB_ULPI if USB_SUPPORT 35 select USB_ULPI if USB
24 select USB_ULPI_VIEWPORT if USB_SUPPORT 36 select USB_ULPI_VIEWPORT if USB_SUPPORT
25 select USE_OF 37 select USE_OF
38 select ARM_ERRATA_743622
39 select ARM_ERRATA_751472
40 select ARM_ERRATA_754322
41 select ARM_ERRATA_764369
42 select PL310_ERRATA_769419 if CACHE_L2X0
43 select CPU_FREQ_TABLE if CPU_FREQ
26 help 44 help
27 Support for NVIDIA Tegra T30 processor family, based on the 45 Support for NVIDIA Tegra T30 processor family, based on the
28 ARM CortexA9MP CPU and the ARM PL310 L2 cache controller 46 ARM CortexA9MP CPU and the ARM PL310 L2 cache controller
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index e120ff54f66..1dd2726986c 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -7,15 +7,19 @@ obj-y += clock.o
7obj-y += timer.o 7obj-y += timer.o
8obj-y += pinmux.o 8obj-y += pinmux.o
9obj-y += fuse.o 9obj-y += fuse.o
10obj-y += pmc.o
11obj-$(CONFIG_CPU_IDLE) += cpuidle.o
12obj-$(CONFIG_CPU_IDLE) += sleep.o
10obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o 13obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o
11obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o 14obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o
12obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o 15obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o
13obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pinmux-tegra20-tables.o 16obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pinmux-tegra20-tables.o
14obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += pinmux-tegra30-tables.o 17obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += pinmux-tegra30-tables.o
15obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o 18obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o
16obj-$(CONFIG_SMP) += platsmp.o localtimer.o headsmp.o 19obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o
20obj-$(CONFIG_SMP) += platsmp.o headsmp.o
17obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 21obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
18obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o 22obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o apbio.o
19obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o 23obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o
20obj-$(CONFIG_TEGRA_PCI) += pcie.o 24obj-$(CONFIG_TEGRA_PCI) += pcie.o
21obj-$(CONFIG_USB_SUPPORT) += usb_phy.o 25obj-$(CONFIG_USB_SUPPORT) += usb_phy.o
diff --git a/arch/arm/mach-tegra/apbio.c b/arch/arm/mach-tegra/apbio.c
new file mode 100644
index 00000000000..e75451e517b
--- /dev/null
+++ b/arch/arm/mach-tegra/apbio.c
@@ -0,0 +1,145 @@
1/*
2 * Copyright (C) 2010 NVIDIA Corporation.
3 * Copyright (C) 2010 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <linux/dma-mapping.h>
19#include <linux/spinlock.h>
20#include <linux/completion.h>
21#include <linux/sched.h>
22#include <linux/mutex.h>
23
24#include <mach/dma.h>
25#include <mach/iomap.h>
26
27#include "apbio.h"
28
29static DEFINE_MUTEX(tegra_apb_dma_lock);
30
31static struct tegra_dma_channel *tegra_apb_dma;
32static u32 *tegra_apb_bb;
33static dma_addr_t tegra_apb_bb_phys;
34static DECLARE_COMPLETION(tegra_apb_wait);
35
36bool tegra_apb_init(void)
37{
38 struct tegra_dma_channel *ch;
39
40 mutex_lock(&tegra_apb_dma_lock);
41
42 /* Check to see if we raced to setup */
43 if (tegra_apb_dma)
44 goto out;
45
46 ch = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT |
47 TEGRA_DMA_SHARED);
48
49 if (!ch)
50 goto out_fail;
51
52 tegra_apb_bb = dma_alloc_coherent(NULL, sizeof(u32),
53 &tegra_apb_bb_phys, GFP_KERNEL);
54 if (!tegra_apb_bb) {
55 pr_err("%s: can not allocate bounce buffer\n", __func__);
56 tegra_dma_free_channel(ch);
57 goto out_fail;
58 }
59
60 tegra_apb_dma = ch;
61out:
62 mutex_unlock(&tegra_apb_dma_lock);
63 return true;
64
65out_fail:
66 mutex_unlock(&tegra_apb_dma_lock);
67 return false;
68}
69
70static void apb_dma_complete(struct tegra_dma_req *req)
71{
72 complete(&tegra_apb_wait);
73}
74
75u32 tegra_apb_readl(unsigned long offset)
76{
77 struct tegra_dma_req req;
78 int ret;
79
80 if (!tegra_apb_dma && !tegra_apb_init())
81 return readl(IO_TO_VIRT(offset));
82
83 mutex_lock(&tegra_apb_dma_lock);
84 req.complete = apb_dma_complete;
85 req.to_memory = 1;
86 req.dest_addr = tegra_apb_bb_phys;
87 req.dest_bus_width = 32;
88 req.dest_wrap = 1;
89 req.source_addr = offset;
90 req.source_bus_width = 32;
91 req.source_wrap = 4;
92 req.req_sel = TEGRA_DMA_REQ_SEL_CNTR;
93 req.size = 4;
94
95 INIT_COMPLETION(tegra_apb_wait);
96
97 tegra_dma_enqueue_req(tegra_apb_dma, &req);
98
99 ret = wait_for_completion_timeout(&tegra_apb_wait,
100 msecs_to_jiffies(50));
101
102 if (WARN(ret == 0, "apb read dma timed out")) {
103 tegra_dma_dequeue_req(tegra_apb_dma, &req);
104 *(u32 *)tegra_apb_bb = 0;
105 }
106
107 mutex_unlock(&tegra_apb_dma_lock);
108 return *((u32 *)tegra_apb_bb);
109}
110
111void tegra_apb_writel(u32 value, unsigned long offset)
112{
113 struct tegra_dma_req req;
114 int ret;
115
116 if (!tegra_apb_dma && !tegra_apb_init()) {
117 writel(value, IO_TO_VIRT(offset));
118 return;
119 }
120
121 mutex_lock(&tegra_apb_dma_lock);
122 *((u32 *)tegra_apb_bb) = value;
123 req.complete = apb_dma_complete;
124 req.to_memory = 0;
125 req.dest_addr = offset;
126 req.dest_wrap = 4;
127 req.dest_bus_width = 32;
128 req.source_addr = tegra_apb_bb_phys;
129 req.source_bus_width = 32;
130 req.source_wrap = 1;
131 req.req_sel = TEGRA_DMA_REQ_SEL_CNTR;
132 req.size = 4;
133
134 INIT_COMPLETION(tegra_apb_wait);
135
136 tegra_dma_enqueue_req(tegra_apb_dma, &req);
137
138 ret = wait_for_completion_timeout(&tegra_apb_wait,
139 msecs_to_jiffies(50));
140
141 if (WARN(ret == 0, "apb write dma timed out"))
142 tegra_dma_dequeue_req(tegra_apb_dma, &req);
143
144 mutex_unlock(&tegra_apb_dma_lock);
145}
diff --git a/arch/arm/mach-tegra/include/mach/system.h b/arch/arm/mach-tegra/apbio.h
index a312988bf6f..8b49e8c89a6 100644
--- a/arch/arm/mach-tegra/include/mach/system.h
+++ b/arch/arm/mach-tegra/apbio.h
@@ -1,12 +1,7 @@
1/* 1/*
2 * arch/arm/mach-tegra/include/mach/system.h 2 * Copyright (C) 2010 NVIDIA Corporation.
3 *
4 * Copyright (C) 2010 Google, Inc. 3 * Copyright (C) 2010 Google, Inc.
5 * 4 *
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 5 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and 6 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms. 7 * may be copied, distributed, and modified under those terms.
@@ -18,11 +13,27 @@
18 * 13 *
19 */ 14 */
20 15
21#ifndef __MACH_TEGRA_SYSTEM_H 16#ifndef __MACH_TEGRA_APBIO_H
22#define __MACH_TEGRA_SYSTEM_H 17#define __MACH_TEGRA_APBIO_H
18
19#ifdef CONFIG_TEGRA_SYSTEM_DMA
20
21u32 tegra_apb_readl(unsigned long offset);
22void tegra_apb_writel(u32 value, unsigned long offset);
23
24#else
25#include <asm/io.h>
26#include <mach/io.h>
23 27
24static inline void arch_idle(void) 28static inline u32 tegra_apb_readl(unsigned long offset)
25{ 29{
30 return readl(IO_TO_VIRT(offset));
26} 31}
27 32
33static inline void tegra_apb_writel(u32 value, unsigned long offset)
34{
35 writel(value, IO_TO_VIRT(offset));
36}
37#endif
38
28#endif 39#endif
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index 7a95e0bc4ab..e20b419d598 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -131,11 +131,7 @@ static void __init tegra_dt_init(void)
131} 131}
132 132
133static const char *tegra20_dt_board_compat[] = { 133static const char *tegra20_dt_board_compat[] = {
134 "compulab,trimslice", 134 "nvidia,tegra20",
135 "nvidia,harmony",
136 "compal,paz00",
137 "nvidia,seaboard",
138 "nvidia,ventana",
139 NULL 135 NULL
140}; 136};
141 137
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
index 3c197e2440b..96f6c0d030b 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -34,20 +34,42 @@
34#include <asm/hardware/gic.h> 34#include <asm/hardware/gic.h>
35 35
36#include "board.h" 36#include "board.h"
37#include "clock.h"
37 38
38static struct of_device_id tegra_dt_match_table[] __initdata = { 39static struct of_device_id tegra_dt_match_table[] __initdata = {
39 { .compatible = "simple-bus", }, 40 { .compatible = "simple-bus", },
40 {} 41 {}
41}; 42};
42 43
44struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
45 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000000, "sdhci-tegra.0", NULL),
46 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000200, "sdhci-tegra.1", NULL),
47 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000400, "sdhci-tegra.2", NULL),
48 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000600, "sdhci-tegra.3", NULL),
49 OF_DEV_AUXDATA("nvidia,tegra20-i2c", 0x7000C000, "tegra-i2c.0", NULL),
50 OF_DEV_AUXDATA("nvidia,tegra20-i2c", 0x7000C400, "tegra-i2c.1", NULL),
51 OF_DEV_AUXDATA("nvidia,tegra20-i2c", 0x7000C500, "tegra-i2c.2", NULL),
52 OF_DEV_AUXDATA("nvidia,tegra20-i2c", 0x7000C700, "tegra-i2c.3", NULL),
53 OF_DEV_AUXDATA("nvidia,tegra20-i2c", 0x7000D000, "tegra-i2c.4", NULL),
54 {}
55};
56
57static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
58 /* name parent rate enabled */
59 { "uartd", "pll_p", 408000000, true },
60 { NULL, NULL, 0, 0},
61};
62
43static void __init tegra30_dt_init(void) 63static void __init tegra30_dt_init(void)
44{ 64{
65 tegra_clk_init_from_table(tegra_dt_clk_init_table);
66
45 of_platform_populate(NULL, tegra_dt_match_table, 67 of_platform_populate(NULL, tegra_dt_match_table,
46 NULL, NULL); 68 tegra30_auxdata_lookup, NULL);
47} 69}
48 70
49static const char *tegra30_dt_board_compat[] = { 71static const char *tegra30_dt_board_compat[] = {
50 "nvidia,cardhu", 72 "nvidia,tegra30",
51 NULL 73 NULL
52}; 74};
53 75
diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c
index 465808c8ac0..1af85bccc0f 100644
--- a/arch/arm/mach-tegra/board-harmony-pinmux.c
+++ b/arch/arm/mach-tegra/board-harmony-pinmux.c
@@ -53,7 +53,7 @@ static struct tegra_pingroup_config harmony_pinmux[] = {
53 {TEGRA_PINGROUP_GME, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 53 {TEGRA_PINGROUP_GME, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
54 {TEGRA_PINGROUP_GPU, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 54 {TEGRA_PINGROUP_GPU, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
55 {TEGRA_PINGROUP_GPU7, TEGRA_MUX_RTCK, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 55 {TEGRA_PINGROUP_GPU7, TEGRA_MUX_RTCK, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
56 {TEGRA_PINGROUP_GPV, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 56 {TEGRA_PINGROUP_GPV, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
57 {TEGRA_PINGROUP_HDINT, TEGRA_MUX_HDMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 57 {TEGRA_PINGROUP_HDINT, TEGRA_MUX_HDMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
58 {TEGRA_PINGROUP_I2CP, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 58 {TEGRA_PINGROUP_I2CP, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
59 {TEGRA_PINGROUP_IRRX, TEGRA_MUX_UARTA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 59 {TEGRA_PINGROUP_IRRX, TEGRA_MUX_UARTA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
@@ -112,10 +112,10 @@ static struct tegra_pingroup_config harmony_pinmux[] = {
112 {TEGRA_PINGROUP_SDC, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 112 {TEGRA_PINGROUP_SDC, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
113 {TEGRA_PINGROUP_SDD, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 113 {TEGRA_PINGROUP_SDD, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
114 {TEGRA_PINGROUP_SDIO1, TEGRA_MUX_SDIO1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 114 {TEGRA_PINGROUP_SDIO1, TEGRA_MUX_SDIO1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
115 {TEGRA_PINGROUP_SLXA, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 115 {TEGRA_PINGROUP_SLXA, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
116 {TEGRA_PINGROUP_SLXC, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 116 {TEGRA_PINGROUP_SLXC, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
117 {TEGRA_PINGROUP_SLXD, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 117 {TEGRA_PINGROUP_SLXD, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
118 {TEGRA_PINGROUP_SLXK, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 118 {TEGRA_PINGROUP_SLXK, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
119 {TEGRA_PINGROUP_SPDI, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 119 {TEGRA_PINGROUP_SPDI, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
120 {TEGRA_PINGROUP_SPDO, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 120 {TEGRA_PINGROUP_SPDO, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
121 {TEGRA_PINGROUP_SPIA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 121 {TEGRA_PINGROUP_SPIA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
diff --git a/arch/arm/mach-tegra/board-harmony-power.c b/arch/arm/mach-tegra/board-harmony-power.c
index 21d1285731b..82f32300796 100644
--- a/arch/arm/mach-tegra/board-harmony-power.c
+++ b/arch/arm/mach-tegra/board-harmony-power.c
@@ -18,31 +18,27 @@
18#include <linux/i2c.h> 18#include <linux/i2c.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/io.h>
22#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
23#include <linux/mfd/tps6586x.h> 22#include <linux/mfd/tps6586x.h>
24 23
25#include <mach/iomap.h>
26#include <mach/irqs.h> 24#include <mach/irqs.h>
27 25
28#include "board-harmony.h" 26#include "board-harmony.h"
29 27
30#define PMC_CTRL 0x0
31#define PMC_CTRL_INTR_LOW (1 << 17)
32
33static struct regulator_consumer_supply tps658621_ldo0_supply[] = { 28static struct regulator_consumer_supply tps658621_ldo0_supply[] = {
34 REGULATOR_SUPPLY("pex_clk", NULL), 29 REGULATOR_SUPPLY("pex_clk", NULL),
35}; 30};
36 31
37static struct regulator_init_data ldo0_data = { 32static struct regulator_init_data ldo0_data = {
38 .constraints = { 33 .constraints = {
39 .min_uV = 1250 * 1000, 34 .min_uV = 3300 * 1000,
40 .max_uV = 3300 * 1000, 35 .max_uV = 3300 * 1000,
41 .valid_modes_mask = (REGULATOR_MODE_NORMAL | 36 .valid_modes_mask = (REGULATOR_MODE_NORMAL |
42 REGULATOR_MODE_STANDBY), 37 REGULATOR_MODE_STANDBY),
43 .valid_ops_mask = (REGULATOR_CHANGE_MODE | 38 .valid_ops_mask = (REGULATOR_CHANGE_MODE |
44 REGULATOR_CHANGE_STATUS | 39 REGULATOR_CHANGE_STATUS |
45 REGULATOR_CHANGE_VOLTAGE), 40 REGULATOR_CHANGE_VOLTAGE),
41 .apply_uV = 1,
46 }, 42 },
47 .num_consumer_supplies = ARRAY_SIZE(tps658621_ldo0_supply), 43 .num_consumer_supplies = ARRAY_SIZE(tps658621_ldo0_supply),
48 .consumer_supplies = tps658621_ldo0_supply, 44 .consumer_supplies = tps658621_ldo0_supply,
@@ -114,16 +110,6 @@ static struct i2c_board_info __initdata harmony_regulators[] = {
114 110
115int __init harmony_regulator_init(void) 111int __init harmony_regulator_init(void)
116{ 112{
117 void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
118 u32 pmc_ctrl;
119
120 /*
121 * Configure the power management controller to trigger PMU
122 * interrupts when low
123 */
124 pmc_ctrl = readl(pmc + PMC_CTRL);
125 writel(pmc_ctrl | PMC_CTRL_INTR_LOW, pmc + PMC_CTRL);
126
127 i2c_register_board_info(3, harmony_regulators, 1); 113 i2c_register_board_info(3, harmony_regulators, 1);
128 114
129 return 0; 115 return 0;
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index 789bdc9e8f9..c00aadb01e0 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -101,7 +101,6 @@ static struct wm8903_platform_data harmony_wm8903_pdata = {
101static struct i2c_board_info __initdata wm8903_board_info = { 101static struct i2c_board_info __initdata wm8903_board_info = {
102 I2C_BOARD_INFO("wm8903", 0x1a), 102 I2C_BOARD_INFO("wm8903", 0x1a),
103 .platform_data = &harmony_wm8903_pdata, 103 .platform_data = &harmony_wm8903_pdata,
104 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
105}; 104};
106 105
107static void __init harmony_i2c_init(void) 106static void __init harmony_i2c_init(void)
@@ -111,6 +110,7 @@ static void __init harmony_i2c_init(void)
111 platform_device_register(&tegra_i2c_device3); 110 platform_device_register(&tegra_i2c_device3);
112 platform_device_register(&tegra_i2c_device4); 111 platform_device_register(&tegra_i2c_device4);
113 112
113 wm8903_board_info.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ);
114 i2c_register_board_info(0, &wm8903_board_info, 1); 114 i2c_register_board_info(0, &wm8903_board_info, 1);
115} 115}
116 116
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c
index ebac65f5251..d669847f048 100644
--- a/arch/arm/mach-tegra/board-seaboard.c
+++ b/arch/arm/mach-tegra/board-seaboard.c
@@ -159,7 +159,6 @@ static struct platform_device *seaboard_devices[] __initdata = {
159 159
160static struct i2c_board_info __initdata isl29018_device = { 160static struct i2c_board_info __initdata isl29018_device = {
161 I2C_BOARD_INFO("isl29018", 0x44), 161 I2C_BOARD_INFO("isl29018", 0x44),
162 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_ISL29018_IRQ),
163}; 162};
164 163
165static struct i2c_board_info __initdata adt7461_device = { 164static struct i2c_board_info __initdata adt7461_device = {
@@ -183,7 +182,6 @@ static struct wm8903_platform_data wm8903_pdata = {
183static struct i2c_board_info __initdata wm8903_device = { 182static struct i2c_board_info __initdata wm8903_device = {
184 I2C_BOARD_INFO("wm8903", 0x1a), 183 I2C_BOARD_INFO("wm8903", 0x1a),
185 .platform_data = &wm8903_pdata, 184 .platform_data = &wm8903_pdata,
186 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
187}; 185};
188 186
189static int seaboard_ehci_init(void) 187static int seaboard_ehci_init(void)
@@ -214,7 +212,10 @@ static void __init seaboard_i2c_init(void)
214 gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018"); 212 gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018");
215 gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ); 213 gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ);
216 214
215 isl29018_device.irq = gpio_to_irq(TEGRA_GPIO_ISL29018_IRQ);
217 i2c_register_board_info(0, &isl29018_device, 1); 216 i2c_register_board_info(0, &isl29018_device, 1);
217
218 wm8903_device.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ);
218 i2c_register_board_info(0, &wm8903_device, 1); 219 i2c_register_board_info(0, &wm8903_device, 1);
219 220
220 i2c_register_board_info(3, &adt7461_device, 1); 221 i2c_register_board_info(3, &adt7461_device, 1);
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index 8337068a4ab..8dad8d18cb4 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -399,6 +399,28 @@ void tegra_periph_reset_assert(struct clk *c)
399} 399}
400EXPORT_SYMBOL(tegra_periph_reset_assert); 400EXPORT_SYMBOL(tegra_periph_reset_assert);
401 401
402/* Several extended clock configuration bits (e.g., clock routing, clock
403 * phase control) are included in PLL and peripheral clock source
404 * registers. */
405int tegra_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting)
406{
407 int ret = 0;
408 unsigned long flags;
409
410 spin_lock_irqsave(&c->spinlock, flags);
411
412 if (!c->ops || !c->ops->clk_cfg_ex) {
413 ret = -ENOSYS;
414 goto out;
415 }
416 ret = c->ops->clk_cfg_ex(c, p, setting);
417
418out:
419 spin_unlock_irqrestore(&c->spinlock, flags);
420
421 return ret;
422}
423
402#ifdef CONFIG_DEBUG_FS 424#ifdef CONFIG_DEBUG_FS
403 425
404static int __clk_lock_all_spinlocks(void) 426static int __clk_lock_all_spinlocks(void)
diff --git a/arch/arm/mach-tegra/clock.h b/arch/arm/mach-tegra/clock.h
index 5c44106616c..bc300657deb 100644
--- a/arch/arm/mach-tegra/clock.h
+++ b/arch/arm/mach-tegra/clock.h
@@ -24,6 +24,8 @@
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26 26
27#include <mach/clk.h>
28
27#define DIV_BUS (1 << 0) 29#define DIV_BUS (1 << 0)
28#define DIV_U71 (1 << 1) 30#define DIV_U71 (1 << 1)
29#define DIV_U71_FIXED (1 << 2) 31#define DIV_U71_FIXED (1 << 2)
@@ -39,7 +41,16 @@
39#define PERIPH_MANUAL_RESET (1 << 12) 41#define PERIPH_MANUAL_RESET (1 << 12)
40#define PLL_ALT_MISC_REG (1 << 13) 42#define PLL_ALT_MISC_REG (1 << 13)
41#define PLLU (1 << 14) 43#define PLLU (1 << 14)
44#define PLLX (1 << 15)
45#define MUX_PWM (1 << 16)
46#define MUX8 (1 << 17)
47#define DIV_U71_UART (1 << 18)
48#define MUX_CLK_OUT (1 << 19)
49#define PLLM (1 << 20)
50#define DIV_U71_INT (1 << 21)
51#define DIV_U71_IDLE (1 << 22)
42#define ENABLE_ON_INIT (1 << 28) 52#define ENABLE_ON_INIT (1 << 28)
53#define PERIPH_ON_APB (1 << 29)
43 54
44struct clk; 55struct clk;
45 56
@@ -65,6 +76,8 @@ struct clk_ops {
65 int (*set_rate)(struct clk *, unsigned long); 76 int (*set_rate)(struct clk *, unsigned long);
66 long (*round_rate)(struct clk *, unsigned long); 77 long (*round_rate)(struct clk *, unsigned long);
67 void (*reset)(struct clk *, bool); 78 void (*reset)(struct clk *, bool);
79 int (*clk_cfg_ex)(struct clk *,
80 enum tegra_clk_ex_param, u32);
68}; 81};
69 82
70enum clk_state { 83enum clk_state {
@@ -114,6 +127,7 @@ struct clk {
114 unsigned long vco_max; 127 unsigned long vco_max;
115 const struct clk_pll_freq_table *freq_table; 128 const struct clk_pll_freq_table *freq_table;
116 int lock_delay; 129 int lock_delay;
130 unsigned long fixed_rate;
117 } pll; 131 } pll;
118 struct { 132 struct {
119 u32 sel; 133 u32 sel;
@@ -146,6 +160,7 @@ struct tegra_clk_init_table {
146}; 160};
147 161
148void tegra2_init_clocks(void); 162void tegra2_init_clocks(void);
163void tegra30_init_clocks(void);
149void clk_init(struct clk *clk); 164void clk_init(struct clk *clk);
150struct clk *tegra_get_clock_by_name(const char *name); 165struct clk *tegra_get_clock_by_name(const char *name);
151int clk_reparent(struct clk *c, struct clk *parent); 166int clk_reparent(struct clk *c, struct clk *parent);
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index a2eb90169ae..2f86fcca64a 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -27,11 +27,28 @@
27#include <asm/hardware/gic.h> 27#include <asm/hardware/gic.h>
28 28
29#include <mach/iomap.h> 29#include <mach/iomap.h>
30#include <mach/system.h>
31 30
32#include "board.h" 31#include "board.h"
33#include "clock.h" 32#include "clock.h"
34#include "fuse.h" 33#include "fuse.h"
34#include "pmc.h"
35
36/*
37 * Storage for debug-macro.S's state.
38 *
39 * This must be in .data not .bss so that it gets initialized each time the
40 * kernel is loaded. The data is declared here rather than debug-macro.S so
41 * that multiple inclusions of debug-macro.S point at the same data.
42 */
43#define TEGRA_DEBUG_UART_OFFSET (TEGRA_DEBUG_UART_BASE & 0xFFFF)
44u32 tegra_uart_config[3] = {
45 /* Debug UART initialization required */
46 1,
47 /* Debug UART physical address */
48 (u32)(IO_APB_PHYS + TEGRA_DEBUG_UART_OFFSET),
49 /* Debug UART virtual address */
50 (u32)(IO_APB_VIRT + TEGRA_DEBUG_UART_OFFSET),
51};
35 52
36#ifdef CONFIG_OF 53#ifdef CONFIG_OF
37static const struct of_device_id tegra_dt_irq_match[] __initconst = { 54static const struct of_device_id tegra_dt_irq_match[] __initconst = {
@@ -100,11 +117,14 @@ void __init tegra20_init_early(void)
100 tegra2_init_clocks(); 117 tegra2_init_clocks();
101 tegra_clk_init_from_table(tegra20_clk_init_table); 118 tegra_clk_init_from_table(tegra20_clk_init_table);
102 tegra_init_cache(0x331, 0x441); 119 tegra_init_cache(0x331, 0x441);
120 tegra_pmc_init();
103} 121}
104#endif 122#endif
105#ifdef CONFIG_ARCH_TEGRA_3x_SOC 123#ifdef CONFIG_ARCH_TEGRA_3x_SOC
106void __init tegra30_init_early(void) 124void __init tegra30_init_early(void)
107{ 125{
126 tegra30_init_clocks();
108 tegra_init_cache(0x441, 0x551); 127 tegra_init_cache(0x441, 0x551);
128 tegra_pmc_init();
109} 129}
110#endif 130#endif
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c
new file mode 100644
index 00000000000..d83a8c0296f
--- /dev/null
+++ b/arch/arm/mach-tegra/cpuidle.c
@@ -0,0 +1,107 @@
1/*
2 * arch/arm/mach-tegra/cpuidle.c
3 *
4 * CPU idle driver for Tegra CPUs
5 *
6 * Copyright (c) 2010-2012, NVIDIA Corporation.
7 * Copyright (c) 2011 Google, Inc.
8 * Author: Colin Cross <ccross@android.com>
9 * Gary King <gking@nvidia.com>
10 *
11 * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful, but WITHOUT
19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21 * more details.
22 */
23
24#include <linux/kernel.h>
25#include <linux/module.h>
26#include <linux/cpu.h>
27#include <linux/cpuidle.h>
28#include <linux/hrtimer.h>
29
30#include <mach/iomap.h>
31
32extern void tegra_cpu_wfi(void);
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 tegra_cpu_wfi();
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
80static int __init tegra_cpuidle_init(void)
81{
82 int ret;
83 unsigned int cpu;
84 struct cpuidle_device *dev;
85 struct cpuidle_driver *drv = &tegra_idle_driver;
86
87 ret = cpuidle_register_driver(&tegra_idle_driver);
88 if (ret) {
89 pr_err("CPUidle driver registration failed\n");
90 return ret;
91 }
92
93 for_each_possible_cpu(cpu) {
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}
107device_initcall(tegra_cpuidle_init);
diff --git a/arch/arm/mach-tegra/dma.c b/arch/arm/mach-tegra/dma.c
index c0cf967e47d..abea4f6e2dd 100644
--- a/arch/arm/mach-tegra/dma.c
+++ b/arch/arm/mach-tegra/dma.c
@@ -33,6 +33,8 @@
33#include <mach/iomap.h> 33#include <mach/iomap.h>
34#include <mach/suspend.h> 34#include <mach/suspend.h>
35 35
36#include "apbio.h"
37
36#define APB_DMA_GEN 0x000 38#define APB_DMA_GEN 0x000
37#define GEN_ENABLE (1<<31) 39#define GEN_ENABLE (1<<31)
38 40
@@ -50,8 +52,6 @@
50#define CSR_ONCE (1<<27) 52#define CSR_ONCE (1<<27)
51#define CSR_FLOW (1<<21) 53#define CSR_FLOW (1<<21)
52#define CSR_REQ_SEL_SHIFT 16 54#define CSR_REQ_SEL_SHIFT 16
53#define CSR_REQ_SEL_MASK (0x1F<<CSR_REQ_SEL_SHIFT)
54#define CSR_REQ_SEL_INVALID (31<<CSR_REQ_SEL_SHIFT)
55#define CSR_WCOUNT_SHIFT 2 55#define CSR_WCOUNT_SHIFT 2
56#define CSR_WCOUNT_MASK 0xFFFC 56#define CSR_WCOUNT_MASK 0xFFFC
57 57
@@ -133,6 +133,7 @@ struct tegra_dma_channel {
133 133
134static bool tegra_dma_initialized; 134static bool tegra_dma_initialized;
135static DEFINE_MUTEX(tegra_dma_lock); 135static DEFINE_MUTEX(tegra_dma_lock);
136static DEFINE_SPINLOCK(enable_lock);
136 137
137static DECLARE_BITMAP(channel_usage, NV_DMA_MAX_CHANNELS); 138static DECLARE_BITMAP(channel_usage, NV_DMA_MAX_CHANNELS);
138static struct tegra_dma_channel dma_channels[NV_DMA_MAX_CHANNELS]; 139static struct tegra_dma_channel dma_channels[NV_DMA_MAX_CHANNELS];
@@ -180,36 +181,94 @@ static void tegra_dma_stop(struct tegra_dma_channel *ch)
180 181
181static int tegra_dma_cancel(struct tegra_dma_channel *ch) 182static int tegra_dma_cancel(struct tegra_dma_channel *ch)
182{ 183{
183 u32 csr;
184 unsigned long irq_flags; 184 unsigned long irq_flags;
185 185
186 spin_lock_irqsave(&ch->lock, irq_flags); 186 spin_lock_irqsave(&ch->lock, irq_flags);
187 while (!list_empty(&ch->list)) 187 while (!list_empty(&ch->list))
188 list_del(ch->list.next); 188 list_del(ch->list.next);
189 189
190 csr = readl(ch->addr + APB_DMA_CHAN_CSR);
191 csr &= ~CSR_REQ_SEL_MASK;
192 csr |= CSR_REQ_SEL_INVALID;
193 writel(csr, ch->addr + APB_DMA_CHAN_CSR);
194
195 tegra_dma_stop(ch); 190 tegra_dma_stop(ch);
196 191
197 spin_unlock_irqrestore(&ch->lock, irq_flags); 192 spin_unlock_irqrestore(&ch->lock, irq_flags);
198 return 0; 193 return 0;
199} 194}
200 195
196static unsigned int get_channel_status(struct tegra_dma_channel *ch,
197 struct tegra_dma_req *req, bool is_stop_dma)
198{
199 void __iomem *addr = IO_ADDRESS(TEGRA_APB_DMA_BASE);
200 unsigned int status;
201
202 if (is_stop_dma) {
203 /*
204 * STOP the DMA and get the transfer count.
205 * Getting the transfer count is tricky.
206 * - Globally disable DMA on all channels
207 * - Read the channel's status register to know the number
208 * of pending bytes to be transfered.
209 * - Stop the dma channel
210 * - Globally re-enable DMA to resume other transfers
211 */
212 spin_lock(&enable_lock);
213 writel(0, addr + APB_DMA_GEN);
214 udelay(20);
215 status = readl(ch->addr + APB_DMA_CHAN_STA);
216 tegra_dma_stop(ch);
217 writel(GEN_ENABLE, addr + APB_DMA_GEN);
218 spin_unlock(&enable_lock);
219 if (status & STA_ISE_EOC) {
220 pr_err("Got Dma Int here clearing");
221 writel(status, ch->addr + APB_DMA_CHAN_STA);
222 }
223 req->status = TEGRA_DMA_REQ_ERROR_ABORTED;
224 } else {
225 status = readl(ch->addr + APB_DMA_CHAN_STA);
226 }
227 return status;
228}
229
230/* should be called with the channel lock held */
231static unsigned int dma_active_count(struct tegra_dma_channel *ch,
232 struct tegra_dma_req *req, unsigned int status)
233{
234 unsigned int to_transfer;
235 unsigned int req_transfer_count;
236 unsigned int bytes_transferred;
237
238 to_transfer = ((status & STA_COUNT_MASK) >> STA_COUNT_SHIFT) + 1;
239 req_transfer_count = ch->req_transfer_count + 1;
240 bytes_transferred = req_transfer_count;
241 if (status & STA_BUSY)
242 bytes_transferred -= to_transfer;
243 /*
244 * In continuous transfer mode, DMA only tracks the count of the
245 * half DMA buffer. So, if the DMA already finished half the DMA
246 * then add the half buffer to the completed count.
247 */
248 if (ch->mode & TEGRA_DMA_MODE_CONTINOUS) {
249 if (req->buffer_status == TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL)
250 bytes_transferred += req_transfer_count;
251 if (status & STA_ISE_EOC)
252 bytes_transferred += req_transfer_count;
253 }
254 bytes_transferred *= 4;
255 return bytes_transferred;
256}
257
201int tegra_dma_dequeue_req(struct tegra_dma_channel *ch, 258int tegra_dma_dequeue_req(struct tegra_dma_channel *ch,
202 struct tegra_dma_req *_req) 259 struct tegra_dma_req *_req)
203{ 260{
204 unsigned int csr;
205 unsigned int status; 261 unsigned int status;
206 struct tegra_dma_req *req = NULL; 262 struct tegra_dma_req *req = NULL;
207 int found = 0; 263 int found = 0;
208 unsigned long irq_flags; 264 unsigned long irq_flags;
209 int to_transfer; 265 int stop = 0;
210 int req_transfer_count;
211 266
212 spin_lock_irqsave(&ch->lock, irq_flags); 267 spin_lock_irqsave(&ch->lock, irq_flags);
268
269 if (list_entry(ch->list.next, struct tegra_dma_req, node) == _req)
270 stop = 1;
271
213 list_for_each_entry(req, &ch->list, node) { 272 list_for_each_entry(req, &ch->list, node) {
214 if (req == _req) { 273 if (req == _req) {
215 list_del(&req->node); 274 list_del(&req->node);
@@ -222,47 +281,12 @@ int tegra_dma_dequeue_req(struct tegra_dma_channel *ch,
222 return 0; 281 return 0;
223 } 282 }
224 283
225 /* STOP the DMA and get the transfer count. 284 if (!stop)
226 * Getting the transfer count is tricky. 285 goto skip_stop_dma;
227 * - Change the source selector to invalid to stop the DMA from
228 * FIFO to memory.
229 * - Read the status register to know the number of pending
230 * bytes to be transferred.
231 * - Finally stop or program the DMA to the next buffer in the
232 * list.
233 */
234 csr = readl(ch->addr + APB_DMA_CHAN_CSR);
235 csr &= ~CSR_REQ_SEL_MASK;
236 csr |= CSR_REQ_SEL_INVALID;
237 writel(csr, ch->addr + APB_DMA_CHAN_CSR);
238
239 /* Get the transfer count */
240 status = readl(ch->addr + APB_DMA_CHAN_STA);
241 to_transfer = (status & STA_COUNT_MASK) >> STA_COUNT_SHIFT;
242 req_transfer_count = ch->req_transfer_count;
243 req_transfer_count += 1;
244 to_transfer += 1;
245
246 req->bytes_transferred = req_transfer_count;
247
248 if (status & STA_BUSY)
249 req->bytes_transferred -= to_transfer;
250
251 /* In continuous transfer mode, DMA only tracks the count of the
252 * half DMA buffer. So, if the DMA already finished half the DMA
253 * then add the half buffer to the completed count.
254 *
255 * FIXME: There can be a race here. What if the req to
256 * dequue happens at the same time as the DMA just moved to
257 * the new buffer and SW didn't yet received the interrupt?
258 */
259 if (ch->mode & TEGRA_DMA_MODE_CONTINOUS)
260 if (req->buffer_status == TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL)
261 req->bytes_transferred += req_transfer_count;
262 286
263 req->bytes_transferred *= 4; 287 status = get_channel_status(ch, req, true);
288 req->bytes_transferred = dma_active_count(ch, req, status);
264 289
265 tegra_dma_stop(ch);
266 if (!list_empty(&ch->list)) { 290 if (!list_empty(&ch->list)) {
267 /* if the list is not empty, queue the next request */ 291 /* if the list is not empty, queue the next request */
268 struct tegra_dma_req *next_req; 292 struct tegra_dma_req *next_req;
@@ -270,6 +294,8 @@ int tegra_dma_dequeue_req(struct tegra_dma_channel *ch,
270 typeof(*next_req), node); 294 typeof(*next_req), node);
271 tegra_dma_update_hw(ch, next_req); 295 tegra_dma_update_hw(ch, next_req);
272 } 296 }
297
298skip_stop_dma:
273 req->status = -TEGRA_DMA_REQ_ERROR_ABORTED; 299 req->status = -TEGRA_DMA_REQ_ERROR_ABORTED;
274 300
275 spin_unlock_irqrestore(&ch->lock, irq_flags); 301 spin_unlock_irqrestore(&ch->lock, irq_flags);
@@ -357,7 +383,7 @@ struct tegra_dma_channel *tegra_dma_allocate_channel(int mode)
357 int channel; 383 int channel;
358 struct tegra_dma_channel *ch = NULL; 384 struct tegra_dma_channel *ch = NULL;
359 385
360 if (WARN_ON(!tegra_dma_initialized)) 386 if (!tegra_dma_initialized)
361 return NULL; 387 return NULL;
362 388
363 mutex_lock(&tegra_dma_lock); 389 mutex_lock(&tegra_dma_lock);
diff --git a/arch/arm/mach-tegra/flowctrl.h b/arch/arm/mach-tegra/flowctrl.h
new file mode 100644
index 00000000000..74c6efbe52f
--- /dev/null
+++ b/arch/arm/mach-tegra/flowctrl.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-tegra/flowctrl.h
3 *
4 * functions and macros to control the flowcontroller
5 *
6 * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
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 that 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_FLOWCTRL_H
22#define __MACH_TEGRA_FLOWCTRL_H
23
24#define FLOW_CTRL_HALT_CPU0_EVENTS 0x0
25#define FLOW_CTRL_WAITEVENT (2 << 29)
26#define FLOW_CTRL_WAIT_FOR_INTERRUPT (4 << 29)
27#define FLOW_CTRL_JTAG_RESUME (1 << 28)
28#define FLOW_CTRL_HALT_CPU_IRQ (1 << 10)
29#define FLOW_CTRL_HALT_CPU_FIQ (1 << 8)
30#define FLOW_CTRL_CPU0_CSR 0x8
31#define FLOW_CTRL_CSR_INTR_FLAG (1 << 15)
32#define FLOW_CTRL_CSR_EVENT_FLAG (1 << 14)
33#define FLOW_CTRL_CSR_ENABLE (1 << 0)
34#define FLOW_CTRL_HALT_CPU1_EVENTS 0x14
35#define FLOW_CTRL_CPU1_CSR 0x18
36
37#endif
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index ea49bd93c6b..c1afb273876 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -19,25 +19,75 @@
19 19
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/module.h> 22#include <linux/export.h>
23 23
24#include <mach/iomap.h> 24#include <mach/iomap.h>
25 25
26#include "fuse.h" 26#include "fuse.h"
27#include "apbio.h"
27 28
28#define FUSE_UID_LOW 0x108 29#define FUSE_UID_LOW 0x108
29#define FUSE_UID_HIGH 0x10c 30#define FUSE_UID_HIGH 0x10c
30#define FUSE_SKU_INFO 0x110 31#define FUSE_SKU_INFO 0x110
31#define FUSE_SPARE_BIT 0x200 32#define FUSE_SPARE_BIT 0x200
32 33
33static inline u32 fuse_readl(unsigned long offset) 34int tegra_sku_id;
35int tegra_cpu_process_id;
36int tegra_core_process_id;
37enum tegra_revision tegra_revision;
38
39/* The BCT to use at boot is specified by board straps that can be read
40 * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs.
41 */
42int tegra_bct_strapping;
43
44#define STRAP_OPT 0x008
45#define GMI_AD0 (1 << 4)
46#define GMI_AD1 (1 << 5)
47#define RAM_ID_MASK (GMI_AD0 | GMI_AD1)
48#define RAM_CODE_SHIFT 4
49
50static const char *tegra_revision_name[TEGRA_REVISION_MAX] = {
51 [TEGRA_REVISION_UNKNOWN] = "unknown",
52 [TEGRA_REVISION_A01] = "A01",
53 [TEGRA_REVISION_A02] = "A02",
54 [TEGRA_REVISION_A03] = "A03",
55 [TEGRA_REVISION_A03p] = "A03 prime",
56 [TEGRA_REVISION_A04] = "A04",
57};
58
59static inline u32 tegra_fuse_readl(unsigned long offset)
60{
61 return tegra_apb_readl(TEGRA_FUSE_BASE + offset);
62}
63
64static inline bool get_spare_fuse(int bit)
34{ 65{
35 return readl(IO_TO_VIRT(TEGRA_FUSE_BASE + offset)); 66 return tegra_fuse_readl(FUSE_SPARE_BIT + bit * 4);
36} 67}
37 68
38static inline void fuse_writel(u32 value, unsigned long offset) 69static enum tegra_revision tegra_get_revision(void)
39{ 70{
40 writel(value, IO_TO_VIRT(TEGRA_FUSE_BASE + offset)); 71 void __iomem *chip_id = IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804;
72 u32 id = readl(chip_id);
73 u32 minor_rev = (id >> 16) & 0xf;
74 u32 chipid = (id >> 8) & 0xff;
75
76 switch (minor_rev) {
77 case 1:
78 return TEGRA_REVISION_A01;
79 case 2:
80 return TEGRA_REVISION_A02;
81 case 3:
82 if (chipid == 0x20 && (get_spare_fuse(18) || get_spare_fuse(19)))
83 return TEGRA_REVISION_A03p;
84 else
85 return TEGRA_REVISION_A03;
86 case 4:
87 return TEGRA_REVISION_A04;
88 default:
89 return TEGRA_REVISION_UNKNOWN;
90 }
41} 91}
42 92
43void tegra_init_fuse(void) 93void tegra_init_fuse(void)
@@ -46,41 +96,32 @@ void tegra_init_fuse(void)
46 reg |= 1 << 28; 96 reg |= 1 << 28;
47 writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48)); 97 writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48));
48 98
49 pr_info("Tegra SKU: %d CPU Process: %d Core Process: %d\n", 99 reg = tegra_fuse_readl(FUSE_SKU_INFO);
50 tegra_sku_id(), tegra_cpu_process_id(), 100 tegra_sku_id = reg & 0xFF;
51 tegra_core_process_id()); 101
102 reg = tegra_fuse_readl(FUSE_SPARE_BIT);
103 tegra_cpu_process_id = (reg >> 6) & 3;
104
105 reg = tegra_fuse_readl(FUSE_SPARE_BIT);
106 tegra_core_process_id = (reg >> 12) & 3;
107
108 reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT);
109 tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT;
110
111 tegra_revision = tegra_get_revision();
112
113 pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n",
114 tegra_revision_name[tegra_get_revision()],
115 tegra_sku_id, tegra_cpu_process_id,
116 tegra_core_process_id);
52} 117}
53 118
54unsigned long long tegra_chip_uid(void) 119unsigned long long tegra_chip_uid(void)
55{ 120{
56 unsigned long long lo, hi; 121 unsigned long long lo, hi;
57 122
58 lo = fuse_readl(FUSE_UID_LOW); 123 lo = tegra_fuse_readl(FUSE_UID_LOW);
59 hi = fuse_readl(FUSE_UID_HIGH); 124 hi = tegra_fuse_readl(FUSE_UID_HIGH);
60 return (hi << 32ull) | lo; 125 return (hi << 32ull) | lo;
61} 126}
62EXPORT_SYMBOL(tegra_chip_uid); 127EXPORT_SYMBOL(tegra_chip_uid);
63
64int tegra_sku_id(void)
65{
66 int sku_id;
67 u32 reg = fuse_readl(FUSE_SKU_INFO);
68 sku_id = reg & 0xFF;
69 return sku_id;
70}
71
72int tegra_cpu_process_id(void)
73{
74 int cpu_process_id;
75 u32 reg = fuse_readl(FUSE_SPARE_BIT);
76 cpu_process_id = (reg >> 6) & 3;
77 return cpu_process_id;
78}
79
80int tegra_core_process_id(void)
81{
82 int core_process_id;
83 u32 reg = fuse_readl(FUSE_SPARE_BIT);
84 core_process_id = (reg >> 12) & 3;
85 return core_process_id;
86}
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h
index 584b2e27dbd..d65d2abf803 100644
--- a/arch/arm/mach-tegra/fuse.h
+++ b/arch/arm/mach-tegra/fuse.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/arm/mach-tegra/fuse.c
3 *
4 * Copyright (C) 2010 Google, Inc. 2 * Copyright (C) 2010 Google, Inc.
5 * 3 *
6 * Author: 4 * Author:
@@ -17,8 +15,34 @@
17 * 15 *
18 */ 16 */
19 17
18#ifndef __MACH_TEGRA_FUSE_H
19#define __MACH_TEGRA_FUSE_H
20
21enum tegra_revision {
22 TEGRA_REVISION_UNKNOWN = 0,
23 TEGRA_REVISION_A01,
24 TEGRA_REVISION_A02,
25 TEGRA_REVISION_A03,
26 TEGRA_REVISION_A03p,
27 TEGRA_REVISION_A04,
28 TEGRA_REVISION_MAX,
29};
30
31#define SKU_ID_T20 8
32#define SKU_ID_T25SE 20
33#define SKU_ID_AP25 23
34#define SKU_ID_T25 24
35#define SKU_ID_AP25E 27
36#define SKU_ID_T25E 28
37
38extern int tegra_sku_id;
39extern int tegra_cpu_process_id;
40extern int tegra_core_process_id;
41extern enum tegra_revision tegra_revision;
42
43extern int tegra_bct_strapping;
44
20unsigned long long tegra_chip_uid(void); 45unsigned long long tegra_chip_uid(void);
21int tegra_sku_id(void);
22int tegra_cpu_process_id(void);
23int tegra_core_process_id(void);
24void tegra_init_fuse(void); 46void tegra_init_fuse(void);
47
48#endif
diff --git a/arch/arm/mach-tegra/include/mach/clk.h b/arch/arm/mach-tegra/include/mach/clk.h
index fc3ecb66de0..d97e403303a 100644
--- a/arch/arm/mach-tegra/include/mach/clk.h
+++ b/arch/arm/mach-tegra/include/mach/clk.h
@@ -22,10 +22,20 @@
22 22
23struct clk; 23struct clk;
24 24
25enum tegra_clk_ex_param {
26 TEGRA_CLK_VI_INP_SEL,
27 TEGRA_CLK_DTV_INVERT,
28 TEGRA_CLK_NAND_PAD_DIV2_ENB,
29 TEGRA_CLK_PLLD_CSI_OUT_ENB,
30 TEGRA_CLK_PLLD_DSI_OUT_ENB,
31 TEGRA_CLK_PLLD_MIPI_MUX_SEL,
32};
33
25void tegra_periph_reset_deassert(struct clk *c); 34void tegra_periph_reset_deassert(struct clk *c);
26void tegra_periph_reset_assert(struct clk *c); 35void tegra_periph_reset_assert(struct clk *c);
27 36
28unsigned long clk_get_rate_all_locked(struct clk *c); 37unsigned long clk_get_rate_all_locked(struct clk *c);
29void tegra2_sdmmc_tap_delay(struct clk *c, int delay); 38void tegra2_sdmmc_tap_delay(struct clk *c, int delay);
39int tegra_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting);
30 40
31#endif 41#endif
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S
index 619abc63aee..90069abd37b 100644
--- a/arch/arm/mach-tegra/include/mach/debug-macro.S
+++ b/arch/arm/mach-tegra/include/mach/debug-macro.S
@@ -1,11 +1,17 @@
1/* 1/*
2 * arch/arm/mach-tegra/include/mach/debug-macro.S 2 * arch/arm/mach-tegra/include/mach/debug-macro.S
3 * 3 *
4 * Copyright (C) 2010 Google, Inc. 4 * Copyright (C) 2010,2011 Google, Inc.
5 * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved.
5 * 6 *
6 * Author: 7 * Author:
7 * Colin Cross <ccross@google.com> 8 * Colin Cross <ccross@google.com>
8 * Erik Gilling <konkers@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
9 * 15 *
10 * This software is licensed under the terms of the GNU General Public 16 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and 17 * License version 2, as published by the Free Software Foundation, and
@@ -18,18 +24,78 @@
18 * 24 *
19 */ 25 */
20 26
27#include <linux/serial_reg.h>
28
21#include <mach/io.h> 29#include <mach/io.h>
22#include <mach/iomap.h> 30#include <mach/iomap.h>
31#include <mach/irammap.h>
32
33 .macro addruart, rp, rv, tmp
34 adr \rp, 99f @ actual addr of 99f
35 ldr \rv, [\rp] @ linked addr is stored there
36 sub \rv, \rv, \rp @ offset between the two
37 ldr \rp, [\rp, #4] @ linked tegra_uart_config
38 sub \tmp, \rp, \rv @ actual tegra_uart_config
39 ldr \rp, [\tmp] @ Load tegra_uart_config
40 cmp \rp, #1 @ needs intitialization?
41 bne 100f @ no; go load the addresses
42 mov \rv, #0 @ yes; record init is done
43 str \rv, [\tmp]
44 mov \rp, #TEGRA_IRAM_BASE @ See if cookie is in IRAM
45 ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET]
46 movw \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE & 0xffff
47 movt \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE >> 16
48 cmp \rv, \rp @ Cookie present?
49 bne 100f @ No, use default UART
50 mov \rp, #TEGRA_IRAM_BASE @ Load UART address from IRAM
51 ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET + 4]
52 str \rv, [\tmp, #4] @ Store in tegra_uart_phys
53 sub \rv, \rv, #IO_APB_PHYS @ Calculate virt address
54 add \rv, \rv, #IO_APB_VIRT
55 str \rv, [\tmp, #8] @ Store in tegra_uart_virt
56 b 100f
57
58 .align
5999: .word .
60 .word tegra_uart_config
61 .ltorg
62
63100: ldr \rp, [\tmp, #4] @ Load tegra_uart_phys
64 ldr \rv, [\tmp, #8] @ Load tegra_uart_virt
65 .endm
66
67#define UART_SHIFT 2
68
69/*
70 * Code below is swiped from <asm/hardware/debug-8250.S>, but add an extra
71 * check to make sure that we aren't in the CONFIG_TEGRA_DEBUG_UART_NONE case.
72 * We use the fact that all 5 valid UART addresses all have something in the
73 * 2nd-to-lowest byte.
74 */
23 75
24 .macro addruart, rp, rv, tmp 76 .macro senduart, rd, rx
25 ldr \rp, =IO_APB_PHYS @ physical 77 tst \rx, #0x0000ff00
26 ldr \rv, =IO_APB_VIRT @ virtual 78 strneb \rd, [\rx, #UART_TX << UART_SHIFT]
27 orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF) 791001:
28 orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF00) 80 .endm
29 orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF)
30 orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF00)
31 .endm
32 81
33#define UART_SHIFT 2 82 .macro busyuart, rd, rx
34#include <asm/hardware/debug-8250.S> 83 tst \rx, #0x0000ff00
84 beq 1002f
851001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT]
86 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
87 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
88 bne 1001b
891002:
90 .endm
35 91
92 .macro waituart, rd, rx
93#ifdef FLOW_CONTROL
94 tst \rx, #0x0000ff00
95 beq 1002f
961001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT]
97 tst \rd, #UART_MSR_CTS
98 beq 1001b
991002:
100#endif
101 .endm
diff --git a/arch/arm/mach-tegra/include/mach/entry-macro.S b/arch/arm/mach-tegra/include/mach/entry-macro.S
deleted file mode 100644
index e577cfe27e7..00000000000
--- a/arch/arm/mach-tegra/include/mach/entry-macro.S
+++ /dev/null
@@ -1,20 +0,0 @@
1/* arch/arm/mach-tegra/include/mach/entry-macro.S
2 *
3 * Copyright (C) 2009 Palm, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16 .macro disable_fiq
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
diff --git a/arch/arm/mach-tegra/include/mach/gpio-tegra.h b/arch/arm/mach-tegra/include/mach/gpio-tegra.h
index 87d37fdf508..6140820555e 100644
--- a/arch/arm/mach-tegra/include/mach/gpio-tegra.h
+++ b/arch/arm/mach-tegra/include/mach/gpio-tegra.h
@@ -25,8 +25,6 @@
25 25
26#define TEGRA_NR_GPIOS INT_GPIO_NR 26#define TEGRA_NR_GPIOS INT_GPIO_NR
27 27
28#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
29
30struct tegra_gpio_table { 28struct tegra_gpio_table {
31 int gpio; /* GPIO number */ 29 int gpio; /* GPIO number */
32 bool enable; /* Enable for GPIO at init? */ 30 bool enable; /* Enable for GPIO at init? */
diff --git a/arch/arm/mach-tegra/include/mach/iomap.h b/arch/arm/mach-tegra/include/mach/iomap.h
index 19dec3ac085..67644c905d8 100644
--- a/arch/arm/mach-tegra/include/mach/iomap.h
+++ b/arch/arm/mach-tegra/include/mach/iomap.h
@@ -74,6 +74,9 @@
74#define TEGRA_QUATERNARY_ICTLR_BASE 0x60004300 74#define TEGRA_QUATERNARY_ICTLR_BASE 0x60004300
75#define TEGRA_QUATERNARY_ICTLR_SIZE SZ_64 75#define TEGRA_QUATERNARY_ICTLR_SIZE SZ_64
76 76
77#define TEGRA_QUINARY_ICTLR_BASE 0x60004400
78#define TEGRA_QUINARY_ICTLR_SIZE SZ_64
79
77#define TEGRA_TMR1_BASE 0x60005000 80#define TEGRA_TMR1_BASE 0x60005000
78#define TEGRA_TMR1_SIZE SZ_8 81#define TEGRA_TMR1_SIZE SZ_8
79 82
diff --git a/arch/arm/mach-tegra/include/mach/irammap.h b/arch/arm/mach-tegra/include/mach/irammap.h
new file mode 100644
index 00000000000..0cbe6326185
--- /dev/null
+++ b/arch/arm/mach-tegra/include/mach/irammap.h
@@ -0,0 +1,35 @@
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_IRAMMAP_H
18#define __MACH_TEGRA_IRAMMAP_H
19
20#include <asm/sizes.h>
21
22/* The first 1K of IRAM is permanently reserved for the CPU reset handler */
23#define TEGRA_IRAM_RESET_HANDLER_OFFSET 0
24#define TEGRA_IRAM_RESET_HANDLER_SIZE SZ_1K
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
diff --git a/arch/arm/mach-tegra/include/mach/irqs.h b/arch/arm/mach-tegra/include/mach/irqs.h
index a2146cd6867..aad1a2c1d71 100644
--- a/arch/arm/mach-tegra/include/mach/irqs.h
+++ b/arch/arm/mach-tegra/include/mach/irqs.h
@@ -165,11 +165,12 @@
165#define INT_QUAD_RES_30 (INT_QUAD_BASE + 30) 165#define INT_QUAD_RES_30 (INT_QUAD_BASE + 30)
166#define INT_QUAD_RES_31 (INT_QUAD_BASE + 31) 166#define INT_QUAD_RES_31 (INT_QUAD_BASE + 31)
167 167
168#define INT_MAIN_NR (INT_QUAD_BASE + 32 - INT_PRI_BASE) 168/* Tegra30 has 5 banks of 32 IRQs */
169 169#define INT_MAIN_NR (32 * 5)
170#define INT_GPIO_BASE (INT_PRI_BASE + INT_MAIN_NR) 170#define INT_GPIO_BASE (INT_PRI_BASE + INT_MAIN_NR)
171 171
172#define INT_GPIO_NR (28 * 8) 172/* Tegra30 has 8 banks of 32 GPIOs */
173#define INT_GPIO_NR (32 * 8)
173 174
174#define TEGRA_NR_IRQS (INT_GPIO_BASE + INT_GPIO_NR) 175#define TEGRA_NR_IRQS (INT_GPIO_BASE + INT_GPIO_NR)
175 176
diff --git a/arch/arm/mach-tegra/include/mach/kbc.h b/arch/arm/mach-tegra/include/mach/kbc.h
index 20bb0545f99..a1302561293 100644
--- a/arch/arm/mach-tegra/include/mach/kbc.h
+++ b/arch/arm/mach-tegra/include/mach/kbc.h
@@ -24,20 +24,21 @@
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/input/matrix_keypad.h> 25#include <linux/input/matrix_keypad.h>
26 26
27#ifdef CONFIG_ARCH_TEGRA_2x_SOC
28#define KBC_MAX_GPIO 24 27#define KBC_MAX_GPIO 24
29#define KBC_MAX_KPENT 8 28#define KBC_MAX_KPENT 8
30#else
31#define KBC_MAX_GPIO 20
32#define KBC_MAX_KPENT 7
33#endif
34 29
35#define KBC_MAX_ROW 16 30#define KBC_MAX_ROW 16
36#define KBC_MAX_COL 8 31#define KBC_MAX_COL 8
37#define KBC_MAX_KEY (KBC_MAX_ROW * KBC_MAX_COL) 32#define KBC_MAX_KEY (KBC_MAX_ROW * KBC_MAX_COL)
38 33
34enum tegra_pin_type {
35 PIN_CFG_IGNORE,
36 PIN_CFG_COL,
37 PIN_CFG_ROW,
38};
39
39struct tegra_kbc_pin_cfg { 40struct tegra_kbc_pin_cfg {
40 bool is_row; 41 enum tegra_pin_type type;
41 unsigned char num; 42 unsigned char num;
42}; 43};
43 44
diff --git a/arch/arm/mach-tegra/include/mach/pinconf-tegra.h b/arch/arm/mach-tegra/include/mach/pinconf-tegra.h
new file mode 100644
index 00000000000..1f24d304921
--- /dev/null
+++ b/arch/arm/mach-tegra/include/mach/pinconf-tegra.h
@@ -0,0 +1,63 @@
1/*
2 * pinctrl configuration definitions for the NVIDIA Tegra pinmux
3 *
4 * Copyright (c) 2011, 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
16#ifndef __PINCONF_TEGRA_H__
17#define __PINCONF_TEGRA_H__
18
19enum tegra_pinconf_param {
20 /* argument: tegra_pinconf_pull */
21 TEGRA_PINCONF_PARAM_PULL,
22 /* argument: tegra_pinconf_tristate */
23 TEGRA_PINCONF_PARAM_TRISTATE,
24 /* argument: Boolean */
25 TEGRA_PINCONF_PARAM_ENABLE_INPUT,
26 /* argument: Boolean */
27 TEGRA_PINCONF_PARAM_OPEN_DRAIN,
28 /* argument: Boolean */
29 TEGRA_PINCONF_PARAM_LOCK,
30 /* argument: Boolean */
31 TEGRA_PINCONF_PARAM_IORESET,
32 /* argument: Boolean */
33 TEGRA_PINCONF_PARAM_HIGH_SPEED_MODE,
34 /* argument: Boolean */
35 TEGRA_PINCONF_PARAM_SCHMITT,
36 /* argument: Boolean */
37 TEGRA_PINCONF_PARAM_LOW_POWER_MODE,
38 /* argument: Integer, range is HW-dependant */
39 TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH,
40 /* argument: Integer, range is HW-dependant */
41 TEGRA_PINCONF_PARAM_DRIVE_UP_STRENGTH,
42 /* argument: Integer, range is HW-dependant */
43 TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING,
44 /* argument: Integer, range is HW-dependant */
45 TEGRA_PINCONF_PARAM_SLEW_RATE_RISING,
46};
47
48enum tegra_pinconf_pull {
49 TEGRA_PINCONFIG_PULL_NONE,
50 TEGRA_PINCONFIG_PULL_DOWN,
51 TEGRA_PINCONFIG_PULL_UP,
52};
53
54enum tegra_pinconf_tristate {
55 TEGRA_PINCONFIG_DRIVEN,
56 TEGRA_PINCONFIG_TRISTATE,
57};
58
59#define TEGRA_PINCONF_PACK(_param_, _arg_) ((_param_) << 16 | (_arg_))
60#define TEGRA_PINCONF_UNPACK_PARAM(_conf_) ((_conf_) >> 16)
61#define TEGRA_PINCONF_UNPACK_ARG(_conf_) ((_conf_) & 0xffff)
62
63#endif
diff --git a/arch/arm/mach-tegra/include/mach/smmu.h b/arch/arm/mach-tegra/include/mach/smmu.h
new file mode 100644
index 00000000000..dad403a9cf0
--- /dev/null
+++ b/arch/arm/mach-tegra/include/mach/smmu.h
@@ -0,0 +1,63 @@
1/*
2 * IOMMU API for SMMU in Tegra30
3 *
4 * Copyright (c) 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 along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#ifndef MACH_SMMU_H
21#define MACH_SMMU_H
22
23enum smmu_hwgrp {
24 HWGRP_AFI,
25 HWGRP_AVPC,
26 HWGRP_DC,
27 HWGRP_DCB,
28 HWGRP_EPP,
29 HWGRP_G2,
30 HWGRP_HC,
31 HWGRP_HDA,
32 HWGRP_ISP,
33 HWGRP_MPE,
34 HWGRP_NV,
35 HWGRP_NV2,
36 HWGRP_PPCS,
37 HWGRP_SATA,
38 HWGRP_VDE,
39 HWGRP_VI,
40
41 HWGRP_COUNT,
42
43 HWGRP_END = ~0,
44};
45
46#define HWG_AFI (1 << HWGRP_AFI)
47#define HWG_AVPC (1 << HWGRP_AVPC)
48#define HWG_DC (1 << HWGRP_DC)
49#define HWG_DCB (1 << HWGRP_DCB)
50#define HWG_EPP (1 << HWGRP_EPP)
51#define HWG_G2 (1 << HWGRP_G2)
52#define HWG_HC (1 << HWGRP_HC)
53#define HWG_HDA (1 << HWGRP_HDA)
54#define HWG_ISP (1 << HWGRP_ISP)
55#define HWG_MPE (1 << HWGRP_MPE)
56#define HWG_NV (1 << HWGRP_NV)
57#define HWG_NV2 (1 << HWGRP_NV2)
58#define HWG_PPCS (1 << HWGRP_PPCS)
59#define HWG_SATA (1 << HWGRP_SATA)
60#define HWG_VDE (1 << HWGRP_VDE)
61#define HWG_VI (1 << HWGRP_VI)
62
63#endif /* MACH_SMMU_H */
diff --git a/arch/arm/mach-tegra/include/mach/uncompress.h b/arch/arm/mach-tegra/include/mach/uncompress.h
index 4e8323770c7..5a440f315e5 100644
--- a/arch/arm/mach-tegra/include/mach/uncompress.h
+++ b/arch/arm/mach-tegra/include/mach/uncompress.h
@@ -2,10 +2,14 @@
2 * arch/arm/mach-tegra/include/mach/uncompress.h 2 * arch/arm/mach-tegra/include/mach/uncompress.h
3 * 3 *
4 * Copyright (C) 2010 Google, Inc. 4 * Copyright (C) 2010 Google, Inc.
5 * Copyright (C) 2011 Google, Inc.
6 * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved.
5 * 7 *
6 * Author: 8 * Author:
7 * Colin Cross <ccross@google.com> 9 * Colin Cross <ccross@google.com>
8 * Erik Gilling <konkers@google.com> 10 * Erik Gilling <konkers@google.com>
11 * Doug Anderson <dianders@chromium.org>
12 * Stephen Warren <swarren@nvidia.com>
9 * 13 *
10 * This software is licensed under the terms of the GNU General Public 14 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and 15 * License version 2, as published by the Free Software Foundation, and
@@ -25,36 +29,130 @@
25#include <linux/serial_reg.h> 29#include <linux/serial_reg.h>
26 30
27#include <mach/iomap.h> 31#include <mach/iomap.h>
32#include <mach/irammap.h>
33
34#define BIT(x) (1 << (x))
35#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
36
37#define DEBUG_UART_SHIFT 2
38
39volatile u8 *uart;
28 40
29static void putc(int c) 41static void putc(int c)
30{ 42{
31 volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
32 int shift = 2;
33
34 if (uart == NULL) 43 if (uart == NULL)
35 return; 44 return;
36 45
37 while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) 46 while (!(uart[UART_LSR << DEBUG_UART_SHIFT] & UART_LSR_THRE))
38 barrier(); 47 barrier();
39 uart[UART_TX << shift] = c; 48 uart[UART_TX << DEBUG_UART_SHIFT] = c;
40} 49}
41 50
42static inline void flush(void) 51static inline void flush(void)
43{ 52{
44} 53}
45 54
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
66/*
67 * Setup before decompression. This is where we do UART selection for
68 * earlyprintk and init the uart_base register.
69 */
46static inline void arch_decomp_setup(void) 70static inline void arch_decomp_setup(void)
47{ 71{
48 volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE; 72 static const struct {
49 int shift = 2; 73 u32 base;
74 u32 reset_reg;
75 u32 clock_reg;
76 u32 bit;
77 } uarts[] = {
78 {
79 TEGRA_UARTA_BASE,
80 TEGRA_CLK_RESET_BASE + 0x04,
81 TEGRA_CLK_RESET_BASE + 0x10,
82 6,
83 },
84 {
85 TEGRA_UARTB_BASE,
86 TEGRA_CLK_RESET_BASE + 0x04,
87 TEGRA_CLK_RESET_BASE + 0x10,
88 7,
89 },
90 {
91 TEGRA_UARTC_BASE,
92 TEGRA_CLK_RESET_BASE + 0x08,
93 TEGRA_CLK_RESET_BASE + 0x14,
94 23,
95 },
96 {
97 TEGRA_UARTD_BASE,
98 TEGRA_CLK_RESET_BASE + 0x0c,
99 TEGRA_CLK_RESET_BASE + 0x18,
100 1,
101 },
102 {
103 TEGRA_UARTE_BASE,
104 TEGRA_CLK_RESET_BASE + 0x0c,
105 TEGRA_CLK_RESET_BASE + 0x18,
106 2,
107 },
108 };
109 int i;
110 volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE;
111 u32 chip, div;
112
113 /*
114 * Look for the first UART that:
115 * a) Is not in reset.
116 * b) Is clocked.
117 * c) Has a 'D' in the scratchpad register.
118 *
119 * Note that on Tegra30, the first two conditions are required, since
120 * if not true, accesses to the UART scratch register will hang.
121 * Tegra20 doesn't have this issue.
122 *
123 * The intent is that the bootloader will tell the kernel which UART
124 * to use by setting up those conditions. If nothing found, we'll fall
125 * back to what's specified in TEGRA_DEBUG_UART_BASE.
126 */
127 for (i = 0; i < ARRAY_SIZE(uarts); i++) {
128 if (*(u8 *)uarts[i].reset_reg & BIT(uarts[i].bit))
129 continue;
50 130
131 if (!(*(u8 *)uarts[i].clock_reg & BIT(uarts[i].bit)))
132 continue;
133
134 uart = (volatile u8 *)uarts[i].base;
135 if (uart[UART_SCR << DEBUG_UART_SHIFT] != 'D')
136 continue;
137
138 break;
139 }
140 if (i == ARRAY_SIZE(uarts))
141 uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
142 save_uart_address();
51 if (uart == NULL) 143 if (uart == NULL)
52 return; 144 return;
53 145
54 uart[UART_LCR << shift] |= UART_LCR_DLAB; 146 chip = (apb_misc[0x804 / 4] >> 8) & 0xff;
55 uart[UART_DLL << shift] = 0x75; 147 if (chip == 0x20)
56 uart[UART_DLM << shift] = 0x0; 148 div = 0x0075;
57 uart[UART_LCR << shift] = 3; 149 else
150 div = 0x00dd;
151
152 uart[UART_LCR << DEBUG_UART_SHIFT] |= UART_LCR_DLAB;
153 uart[UART_DLL << DEBUG_UART_SHIFT] = div & 0xff;
154 uart[UART_DLM << DEBUG_UART_SHIFT] = div >> 8;
155 uart[UART_LCR << DEBUG_UART_SHIFT] = 3;
58} 156}
59 157
60static inline void arch_decomp_wdog(void) 158static inline void arch_decomp_wdog(void)
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c
index 4e1afcd54fa..2f5bd2db8e1 100644
--- a/arch/arm/mach-tegra/irq.c
+++ b/arch/arm/mach-tegra/irq.c
@@ -44,14 +44,16 @@
44#define ICTLR_COP_IER_CLR 0x38 44#define ICTLR_COP_IER_CLR 0x38
45#define ICTLR_COP_IEP_CLASS 0x3c 45#define ICTLR_COP_IEP_CLASS 0x3c
46 46
47#define NUM_ICTLRS 4
48#define FIRST_LEGACY_IRQ 32 47#define FIRST_LEGACY_IRQ 32
49 48
49static int num_ictlrs;
50
50static void __iomem *ictlr_reg_base[] = { 51static void __iomem *ictlr_reg_base[] = {
51 IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE), 52 IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE),
52 IO_ADDRESS(TEGRA_SECONDARY_ICTLR_BASE), 53 IO_ADDRESS(TEGRA_SECONDARY_ICTLR_BASE),
53 IO_ADDRESS(TEGRA_TERTIARY_ICTLR_BASE), 54 IO_ADDRESS(TEGRA_TERTIARY_ICTLR_BASE),
54 IO_ADDRESS(TEGRA_QUATERNARY_ICTLR_BASE), 55 IO_ADDRESS(TEGRA_QUATERNARY_ICTLR_BASE),
56 IO_ADDRESS(TEGRA_QUINARY_ICTLR_BASE),
55}; 57};
56 58
57static inline void tegra_irq_write_mask(unsigned int irq, unsigned long reg) 59static inline void tegra_irq_write_mask(unsigned int irq, unsigned long reg)
@@ -60,7 +62,7 @@ static inline void tegra_irq_write_mask(unsigned int irq, unsigned long reg)
60 u32 mask; 62 u32 mask;
61 63
62 BUG_ON(irq < FIRST_LEGACY_IRQ || 64 BUG_ON(irq < FIRST_LEGACY_IRQ ||
63 irq >= FIRST_LEGACY_IRQ + NUM_ICTLRS * 32); 65 irq >= FIRST_LEGACY_IRQ + num_ictlrs * 32);
64 66
65 base = ictlr_reg_base[(irq - FIRST_LEGACY_IRQ) / 32]; 67 base = ictlr_reg_base[(irq - FIRST_LEGACY_IRQ) / 32];
66 mask = BIT((irq - FIRST_LEGACY_IRQ) % 32); 68 mask = BIT((irq - FIRST_LEGACY_IRQ) % 32);
@@ -113,8 +115,18 @@ static int tegra_retrigger(struct irq_data *d)
113void __init tegra_init_irq(void) 115void __init tegra_init_irq(void)
114{ 116{
115 int i; 117 int i;
118 void __iomem *distbase;
119
120 distbase = IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE);
121 num_ictlrs = readl_relaxed(distbase + GIC_DIST_CTR) & 0x1f;
122
123 if (num_ictlrs > ARRAY_SIZE(ictlr_reg_base)) {
124 WARN(1, "Too many (%d) interrupt controllers found. Maximum is %d.",
125 num_ictlrs, ARRAY_SIZE(ictlr_reg_base));
126 num_ictlrs = ARRAY_SIZE(ictlr_reg_base);
127 }
116 128
117 for (i = 0; i < NUM_ICTLRS; i++) { 129 for (i = 0; i < num_ictlrs; i++) {
118 void __iomem *ictlr = ictlr_reg_base[i]; 130 void __iomem *ictlr = ictlr_reg_base[i];
119 writel(~0, ictlr + ICTLR_CPU_IER_CLR); 131 writel(~0, ictlr + ICTLR_CPU_IER_CLR);
120 writel(0, ictlr + ICTLR_CPU_IEP_CLASS); 132 writel(0, ictlr + ICTLR_CPU_IEP_CLASS);
@@ -131,6 +143,6 @@ void __init tegra_init_irq(void)
131 * initialized elsewhere under DT. 143 * initialized elsewhere under DT.
132 */ 144 */
133 if (!of_have_populated_dt()) 145 if (!of_have_populated_dt())
134 gic_init(0, 29, IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE), 146 gic_init(0, 29, distbase,
135 IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100)); 147 IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100));
136} 148}
diff --git a/arch/arm/mach-tegra/localtimer.c b/arch/arm/mach-tegra/localtimer.c
deleted file mode 100644
index e91d681d45a..00000000000
--- a/arch/arm/mach-tegra/localtimer.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/mach-tegra/localtimer.c
3 *
4 * Copyright (C) 2002 ARM Ltd.
5 * All Rights Reserved
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/init.h>
12#include <linux/smp.h>
13#include <linux/clockchips.h>
14#include <asm/irq.h>
15#include <asm/smp_twd.h>
16#include <asm/localtimer.h>
17
18/*
19 * Setup the local clock events for a CPU.
20 */
21int __cpuinit local_timer_setup(struct clock_event_device *evt)
22{
23 evt->irq = IRQ_LOCALTIMER;
24 twd_timer_setup(evt);
25 return 0;
26}
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
index af8b6343572..54a816ff384 100644
--- a/arch/arm/mach-tegra/pcie.c
+++ b/arch/arm/mach-tegra/pcie.c
@@ -408,7 +408,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys)
408 pp->res[0].flags = IORESOURCE_IO; 408 pp->res[0].flags = IORESOURCE_IO;
409 if (request_resource(&ioport_resource, &pp->res[0])) 409 if (request_resource(&ioport_resource, &pp->res[0]))
410 panic("Request PCIe IO resource failed\n"); 410 panic("Request PCIe IO resource failed\n");
411 pci_add_resource(&sys->resources, &pp->res[0]); 411 pci_add_resource_offset(&sys->resources, &pp->res[0], sys->io_offset);
412 412
413 /* 413 /*
414 * IORESOURCE_MEM 414 * IORESOURCE_MEM
@@ -427,7 +427,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys)
427 pp->res[1].flags = IORESOURCE_MEM; 427 pp->res[1].flags = IORESOURCE_MEM;
428 if (request_resource(&iomem_resource, &pp->res[1])) 428 if (request_resource(&iomem_resource, &pp->res[1]))
429 panic("Request PCIe Memory resource failed\n"); 429 panic("Request PCIe Memory resource failed\n");
430 pci_add_resource(&sys->resources, &pp->res[1]); 430 pci_add_resource_offset(&sys->resources, &pp->res[1], sys->mem_offset);
431 431
432 /* 432 /*
433 * IORESOURCE_MEM | IORESOURCE_PREFETCH 433 * IORESOURCE_MEM | IORESOURCE_PREFETCH
@@ -446,7 +446,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys)
446 pp->res[2].flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; 446 pp->res[2].flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
447 if (request_resource(&iomem_resource, &pp->res[2])) 447 if (request_resource(&iomem_resource, &pp->res[2]))
448 panic("Request PCIe Prefetch Memory resource failed\n"); 448 panic("Request PCIe Prefetch Memory resource failed\n");
449 pci_add_resource(&sys->resources, &pp->res[2]); 449 pci_add_resource_offset(&sys->resources, &pp->res[2], sys->mem_offset);
450 450
451 return 1; 451 return 1;
452} 452}
@@ -585,10 +585,10 @@ static void tegra_pcie_setup_translations(void)
585 afi_writel(0, AFI_MSI_BAR_SZ); 585 afi_writel(0, AFI_MSI_BAR_SZ);
586} 586}
587 587
588static void tegra_pcie_enable_controller(void) 588static int tegra_pcie_enable_controller(void)
589{ 589{
590 u32 val, reg; 590 u32 val, reg;
591 int i; 591 int i, timeout;
592 592
593 /* Enable slot clock and pulse the reset signals */ 593 /* Enable slot clock and pulse the reset signals */
594 for (i = 0, reg = AFI_PEX0_CTRL; i < 2; i++, reg += 0x8) { 594 for (i = 0, reg = AFI_PEX0_CTRL; i < 2; i++, reg += 0x8) {
@@ -639,8 +639,14 @@ static void tegra_pcie_enable_controller(void)
639 pads_writel(0xfa5cfa5c, 0xc8); 639 pads_writel(0xfa5cfa5c, 0xc8);
640 640
641 /* Wait for the PLL to lock */ 641 /* Wait for the PLL to lock */
642 timeout = 300;
642 do { 643 do {
643 val = pads_readl(PADS_PLL_CTL); 644 val = pads_readl(PADS_PLL_CTL);
645 usleep_range(1000, 1000);
646 if (--timeout == 0) {
647 pr_err("Tegra PCIe error: timeout waiting for PLL\n");
648 return -EBUSY;
649 }
644 } while (!(val & PADS_PLL_CTL_LOCKDET)); 650 } while (!(val & PADS_PLL_CTL_LOCKDET));
645 651
646 /* turn off IDDQ override */ 652 /* turn off IDDQ override */
@@ -671,7 +677,7 @@ static void tegra_pcie_enable_controller(void)
671 /* Disable all execptions */ 677 /* Disable all execptions */
672 afi_writel(0, AFI_FPCI_ERROR_MASKS); 678 afi_writel(0, AFI_FPCI_ERROR_MASKS);
673 679
674 return; 680 return 0;
675} 681}
676 682
677static void tegra_pcie_xclk_clamp(bool clamp) 683static void tegra_pcie_xclk_clamp(bool clamp)
@@ -921,7 +927,9 @@ int __init tegra_pcie_init(bool init_port0, bool init_port1)
921 if (err) 927 if (err)
922 return err; 928 return err;
923 929
924 tegra_pcie_enable_controller(); 930 err = tegra_pcie_enable_controller();
931 if (err)
932 return err;
925 933
926 /* setup the AFI address translations */ 934 /* setup the AFI address translations */
927 tegra_pcie_setup_translations(); 935 tegra_pcie_setup_translations();
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
new file mode 100644
index 00000000000..7af6a54404b
--- /dev/null
+++ b/arch/arm/mach-tegra/pmc.c
@@ -0,0 +1,76 @@
1/*
2 * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#include <linux/kernel.h>
19#include <linux/io.h>
20#include <linux/of.h>
21
22#include <mach/iomap.h>
23
24#define PMC_CTRL 0x0
25#define PMC_CTRL_INTR_LOW (1 << 17)
26
27static inline u32 tegra_pmc_readl(u32 reg)
28{
29 return readl(IO_ADDRESS(TEGRA_PMC_BASE + reg));
30}
31
32static inline void tegra_pmc_writel(u32 val, u32 reg)
33{
34 writel(val, IO_ADDRESS(TEGRA_PMC_BASE + reg));
35}
36
37#ifdef CONFIG_OF
38static const struct of_device_id matches[] __initconst = {
39 { .compatible = "nvidia,tegra20-pmc" },
40 { }
41};
42#endif
43
44void __init tegra_pmc_init(void)
45{
46 /*
47 * For now, Harmony is the only board that uses the PMC, and it wants
48 * the signal inverted. Seaboard would too if it used the PMC.
49 * Hopefully by the time other boards want to use the PMC, everything
50 * will be device-tree, or they also want it inverted.
51 */
52 bool invert_interrupt = true;
53 u32 val;
54
55#ifdef CONFIG_OF
56 if (of_have_populated_dt()) {
57 struct device_node *np;
58
59 invert_interrupt = false;
60
61 np = of_find_matching_node(NULL, matches);
62 if (np) {
63 if (of_find_property(np, "nvidia,invert-interrupt",
64 NULL))
65 invert_interrupt = true;
66 }
67 }
68#endif
69
70 val = tegra_pmc_readl(PMC_CTRL);
71 if (invert_interrupt)
72 val |= PMC_CTRL_INTR_LOW;
73 else
74 val &= ~PMC_CTRL_INTR_LOW;
75 tegra_pmc_writel(val, PMC_CTRL);
76}
diff --git a/arch/arm/mach-highbank/include/mach/system.h b/arch/arm/mach-tegra/pmc.h
index b1d8b5fbe37..8995ee4a876 100644
--- a/arch/arm/mach-highbank/include/mach/system.h
+++ b/arch/arm/mach-tegra/pmc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2010-2011 Calxeda, Inc. 2 * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 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, 5 * under the terms and conditions of the GNU General Public License,
@@ -10,15 +10,14 @@
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details. 11 * more details.
12 * 12 *
13 * You should have received a copy of the GNU General Public License along with 13 * You should have received a copy of the GNU General Public License
14 * this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
15 */ 16 */
16#ifndef __MACH_SYSTEM_H
17#define __MACH_SYSTEM_H
18 17
19static inline void arch_idle(void) 18#ifndef __MACH_TEGRA_PMC_H
20{ 19#define __MACH_TEGRA_PMC_H
21 cpu_do_idle(); 20
22} 21void tegra_pmc_init(void);
23 22
24#endif 23#endif
diff --git a/arch/arm/mach-tegra/sleep.S b/arch/arm/mach-tegra/sleep.S
new file mode 100644
index 00000000000..8f9fde161c3
--- /dev/null
+++ b/arch/arm/mach-tegra/sleep.S
@@ -0,0 +1,91 @@
1/*
2 * arch/arm/mach-tegra/sleep.S
3 *
4 * Copyright (c) 2010-2011, NVIDIA Corporation.
5 * Copyright (c) 2011, Google, Inc.
6 *
7 * Author: Colin Cross <ccross@android.com>
8 * Gary King <gking@nvidia.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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 */
24
25#include <linux/linkage.h>
26#include <mach/io.h>
27#include <mach/iomap.h>
28
29#include "flowctrl.h"
30
31#define TEGRA_FLOW_CTRL_VIRT (TEGRA_FLOW_CTRL_BASE - IO_PPSB_PHYS \
32 + IO_PPSB_VIRT)
33
34/* returns the offset of the flow controller halt register for a cpu */
35.macro cpu_to_halt_reg rd, rcpu
36 cmp \rcpu, #0
37 subne \rd, \rcpu, #1
38 movne \rd, \rd, lsl #3
39 addne \rd, \rd, #0x14
40 moveq \rd, #0
41.endm
42
43/* returns the offset of the flow controller csr register for a cpu */
44.macro cpu_to_csr_reg rd, rcpu
45 cmp \rcpu, #0
46 subne \rd, \rcpu, #1
47 movne \rd, \rd, lsl #3
48 addne \rd, \rd, #0x18
49 moveq \rd, #8
50.endm
51
52/* returns the ID of the current processor */
53.macro cpu_id, rd
54 mrc p15, 0, \rd, c0, c0, 5
55 and \rd, \rd, #0xF
56.endm
57
58/* loads a 32-bit value into a register without a data access */
59.macro mov32, reg, val
60 movw \reg, #:lower16:\val
61 movt \reg, #:upper16:\val
62.endm
63
64/*
65 * tegra_cpu_wfi
66 *
67 * puts current CPU in clock-gated wfi using the flow controller
68 *
69 * corrupts r0-r3
70 * must be called with MMU on
71 */
72
73ENTRY(tegra_cpu_wfi)
74 cpu_id r0
75 cpu_to_halt_reg r1, r0
76 cpu_to_csr_reg r2, r0
77 mov32 r0, TEGRA_FLOW_CTRL_VIRT
78 mov r3, #FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG
79 str r3, [r0, r2] @ clear event & interrupt status
80 mov r3, #FLOW_CTRL_WAIT_FOR_INTERRUPT | FLOW_CTRL_JTAG_RESUME
81 str r3, [r0, r1] @ put flow controller in wait irq mode
82 dsb
83 wfi
84 mov r3, #0
85 str r3, [r0, r1] @ clear flow controller halt status
86 mov r3, #FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG
87 str r3, [r0, r2] @ clear event & interrupt status
88 dsb
89 mov pc, lr
90ENDPROC(tegra_cpu_wfi)
91
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index ff9e6b6c046..592a4eeb532 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -720,7 +720,7 @@ static void tegra2_pllx_clk_init(struct clk *c)
720{ 720{
721 tegra2_pll_clk_init(c); 721 tegra2_pll_clk_init(c);
722 722
723 if (tegra_sku_id() == 7) 723 if (tegra_sku_id == 7)
724 c->max_rate = 750000000; 724 c->max_rate = 750000000;
725} 725}
726 726
@@ -1143,15 +1143,35 @@ static void tegra2_emc_clk_init(struct clk *c)
1143 1143
1144static long tegra2_emc_clk_round_rate(struct clk *c, unsigned long rate) 1144static long tegra2_emc_clk_round_rate(struct clk *c, unsigned long rate)
1145{ 1145{
1146 long new_rate = rate; 1146 long emc_rate;
1147 long clk_rate;
1147 1148
1148 new_rate = tegra_emc_round_rate(new_rate); 1149 /*
1149 if (new_rate < 0) 1150 * The slowest entry in the EMC clock table that is at least as
1151 * fast as rate.
1152 */
1153 emc_rate = tegra_emc_round_rate(rate);
1154 if (emc_rate < 0)
1150 return c->max_rate; 1155 return c->max_rate;
1151 1156
1152 BUG_ON(new_rate != tegra2_periph_clk_round_rate(c, new_rate)); 1157 /*
1158 * The fastest rate the PLL will generate that is at most the
1159 * requested rate.
1160 */
1161 clk_rate = tegra2_periph_clk_round_rate(c, emc_rate);
1162
1163 /*
1164 * If this fails, and emc_rate > clk_rate, it's because the maximum
1165 * rate in the EMC tables is larger than the maximum rate of the EMC
1166 * clock. The EMC clock's max rate is the rate it was running when the
1167 * kernel booted. Such a mismatch is probably due to using the wrong
1168 * BCT, i.e. using a Tegra20 BCT with an EMC table written for Tegra25.
1169 */
1170 WARN_ONCE(emc_rate != clk_rate,
1171 "emc_rate %ld != clk_rate %ld",
1172 emc_rate, clk_rate);
1153 1173
1154 return new_rate; 1174 return emc_rate;
1155} 1175}
1156 1176
1157static int tegra2_emc_clk_set_rate(struct clk *c, unsigned long rate) 1177static int tegra2_emc_clk_set_rate(struct clk *c, unsigned long rate)
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c
index 0f7ae6e90b5..5070d833bdd 100644
--- a/arch/arm/mach-tegra/tegra2_emc.c
+++ b/arch/arm/mach-tegra/tegra2_emc.c
@@ -16,14 +16,19 @@
16 */ 16 */
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/device.h>
19#include <linux/clk.h> 20#include <linux/clk.h>
20#include <linux/err.h> 21#include <linux/err.h>
21#include <linux/io.h> 22#include <linux/io.h>
22#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/of.h>
25#include <linux/platform_device.h>
26#include <linux/platform_data/tegra_emc.h>
23 27
24#include <mach/iomap.h> 28#include <mach/iomap.h>
25 29
26#include "tegra2_emc.h" 30#include "tegra2_emc.h"
31#include "fuse.h"
27 32
28#ifdef CONFIG_TEGRA_EMC_SCALING_ENABLE 33#ifdef CONFIG_TEGRA_EMC_SCALING_ENABLE
29static bool emc_enable = true; 34static bool emc_enable = true;
@@ -32,18 +37,17 @@ static bool emc_enable;
32#endif 37#endif
33module_param(emc_enable, bool, 0644); 38module_param(emc_enable, bool, 0644);
34 39
35static void __iomem *emc = IO_ADDRESS(TEGRA_EMC_BASE); 40static struct platform_device *emc_pdev;
36static const struct tegra_emc_table *tegra_emc_table; 41static void __iomem *emc_regbase;
37static int tegra_emc_table_size;
38 42
39static inline void emc_writel(u32 val, unsigned long addr) 43static inline void emc_writel(u32 val, unsigned long addr)
40{ 44{
41 writel(val, emc + addr); 45 writel(val, emc_regbase + addr);
42} 46}
43 47
44static inline u32 emc_readl(unsigned long addr) 48static inline u32 emc_readl(unsigned long addr)
45{ 49{
46 return readl(emc + addr); 50 return readl(emc_regbase + addr);
47} 51}
48 52
49static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = { 53static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = {
@@ -98,15 +102,15 @@ static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = {
98/* Select the closest EMC rate that is higher than the requested rate */ 102/* Select the closest EMC rate that is higher than the requested rate */
99long tegra_emc_round_rate(unsigned long rate) 103long tegra_emc_round_rate(unsigned long rate)
100{ 104{
105 struct tegra_emc_pdata *pdata;
101 int i; 106 int i;
102 int best = -1; 107 int best = -1;
103 unsigned long distance = ULONG_MAX; 108 unsigned long distance = ULONG_MAX;
104 109
105 if (!tegra_emc_table) 110 if (!emc_pdev)
106 return -EINVAL; 111 return -EINVAL;
107 112
108 if (!emc_enable) 113 pdata = emc_pdev->dev.platform_data;
109 return -EINVAL;
110 114
111 pr_debug("%s: %lu\n", __func__, rate); 115 pr_debug("%s: %lu\n", __func__, rate);
112 116
@@ -116,10 +120,10 @@ long tegra_emc_round_rate(unsigned long rate)
116 */ 120 */
117 rate = rate / 2 / 1000; 121 rate = rate / 2 / 1000;
118 122
119 for (i = 0; i < tegra_emc_table_size; i++) { 123 for (i = 0; i < pdata->num_tables; i++) {
120 if (tegra_emc_table[i].rate >= rate && 124 if (pdata->tables[i].rate >= rate &&
121 (tegra_emc_table[i].rate - rate) < distance) { 125 (pdata->tables[i].rate - rate) < distance) {
122 distance = tegra_emc_table[i].rate - rate; 126 distance = pdata->tables[i].rate - rate;
123 best = i; 127 best = i;
124 } 128 }
125 } 129 }
@@ -127,9 +131,9 @@ long tegra_emc_round_rate(unsigned long rate)
127 if (best < 0) 131 if (best < 0)
128 return -EINVAL; 132 return -EINVAL;
129 133
130 pr_debug("%s: using %lu\n", __func__, tegra_emc_table[best].rate); 134 pr_debug("%s: using %lu\n", __func__, pdata->tables[best].rate);
131 135
132 return tegra_emc_table[best].rate * 2 * 1000; 136 return pdata->tables[best].rate * 2 * 1000;
133} 137}
134 138
135/* 139/*
@@ -142,37 +146,211 @@ long tegra_emc_round_rate(unsigned long rate)
142 */ 146 */
143int tegra_emc_set_rate(unsigned long rate) 147int tegra_emc_set_rate(unsigned long rate)
144{ 148{
149 struct tegra_emc_pdata *pdata;
145 int i; 150 int i;
146 int j; 151 int j;
147 152
148 if (!tegra_emc_table) 153 if (!emc_pdev)
149 return -EINVAL; 154 return -EINVAL;
150 155
156 pdata = emc_pdev->dev.platform_data;
157
151 /* 158 /*
152 * The EMC clock rate is twice the bus rate, and the bus rate is 159 * The EMC clock rate is twice the bus rate, and the bus rate is
153 * measured in kHz 160 * measured in kHz
154 */ 161 */
155 rate = rate / 2 / 1000; 162 rate = rate / 2 / 1000;
156 163
157 for (i = 0; i < tegra_emc_table_size; i++) 164 for (i = 0; i < pdata->num_tables; i++)
158 if (tegra_emc_table[i].rate == rate) 165 if (pdata->tables[i].rate == rate)
159 break; 166 break;
160 167
161 if (i >= tegra_emc_table_size) 168 if (i >= pdata->num_tables)
162 return -EINVAL; 169 return -EINVAL;
163 170
164 pr_debug("%s: setting to %lu\n", __func__, rate); 171 pr_debug("%s: setting to %lu\n", __func__, rate);
165 172
166 for (j = 0; j < TEGRA_EMC_NUM_REGS; j++) 173 for (j = 0; j < TEGRA_EMC_NUM_REGS; j++)
167 emc_writel(tegra_emc_table[i].regs[j], emc_reg_addr[j]); 174 emc_writel(pdata->tables[i].regs[j], emc_reg_addr[j]);
168 175
169 emc_readl(tegra_emc_table[i].regs[TEGRA_EMC_NUM_REGS - 1]); 176 emc_readl(pdata->tables[i].regs[TEGRA_EMC_NUM_REGS - 1]);
170 177
171 return 0; 178 return 0;
172} 179}
173 180
174void tegra_init_emc(const struct tegra_emc_table *table, int table_size) 181#ifdef CONFIG_OF
182static struct device_node *tegra_emc_ramcode_devnode(struct device_node *np)
183{
184 struct device_node *iter;
185 u32 reg;
186
187 for_each_child_of_node(np, iter) {
188 if (of_property_read_u32(np, "nvidia,ram-code", &reg))
189 continue;
190 if (reg == tegra_bct_strapping)
191 return of_node_get(iter);
192 }
193
194 return NULL;
195}
196
197static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata(
198 struct platform_device *pdev)
199{
200 struct device_node *np = pdev->dev.of_node;
201 struct device_node *tnp, *iter;
202 struct tegra_emc_pdata *pdata;
203 int ret, i, num_tables;
204
205 if (!np)
206 return NULL;
207
208 if (of_find_property(np, "nvidia,use-ram-code", NULL)) {
209 tnp = tegra_emc_ramcode_devnode(np);
210 if (!tnp)
211 dev_warn(&pdev->dev,
212 "can't find emc table for ram-code 0x%02x\n",
213 tegra_bct_strapping);
214 } else
215 tnp = of_node_get(np);
216
217 if (!tnp)
218 return NULL;
219
220 num_tables = 0;
221 for_each_child_of_node(tnp, iter)
222 if (of_device_is_compatible(iter, "nvidia,tegra20-emc-table"))
223 num_tables++;
224
225 if (!num_tables) {
226 pdata = NULL;
227 goto out;
228 }
229
230 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
231 pdata->tables = devm_kzalloc(&pdev->dev,
232 sizeof(*pdata->tables) * num_tables,
233 GFP_KERNEL);
234
235 i = 0;
236 for_each_child_of_node(tnp, iter) {
237 u32 prop;
238
239 ret = of_property_read_u32(iter, "clock-frequency", &prop);
240 if (ret) {
241 dev_err(&pdev->dev, "no clock-frequency in %s\n",
242 iter->full_name);
243 continue;
244 }
245 pdata->tables[i].rate = prop;
246
247 ret = of_property_read_u32_array(iter, "nvidia,emc-registers",
248 pdata->tables[i].regs,
249 TEGRA_EMC_NUM_REGS);
250 if (ret) {
251 dev_err(&pdev->dev,
252 "malformed emc-registers property in %s\n",
253 iter->full_name);
254 continue;
255 }
256
257 i++;
258 }
259 pdata->num_tables = i;
260
261out:
262 of_node_put(tnp);
263 return pdata;
264}
265#else
266static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata(
267 struct platform_device *pdev)
268{
269 return NULL;
270}
271#endif
272
273static struct tegra_emc_pdata __devinit *tegra_emc_fill_pdata(struct platform_device *pdev)
274{
275 struct clk *c = clk_get_sys(NULL, "emc");
276 struct tegra_emc_pdata *pdata;
277 unsigned long khz;
278 int i;
279
280 WARN_ON(pdev->dev.platform_data);
281 BUG_ON(IS_ERR_OR_NULL(c));
282
283 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
284 pdata->tables = devm_kzalloc(&pdev->dev, sizeof(*pdata->tables),
285 GFP_KERNEL);
286
287 pdata->tables[0].rate = clk_get_rate(c) / 2 / 1000;
288
289 for (i = 0; i < TEGRA_EMC_NUM_REGS; i++)
290 pdata->tables[0].regs[i] = emc_readl(emc_reg_addr[i]);
291
292 pdata->num_tables = 1;
293
294 khz = pdata->tables[0].rate;
295 dev_info(&pdev->dev, "no tables provided, using %ld kHz emc, "
296 "%ld kHz mem\n", khz * 2, khz);
297
298 return pdata;
299}
300
301static int __devinit tegra_emc_probe(struct platform_device *pdev)
302{
303 struct tegra_emc_pdata *pdata;
304 struct resource *res;
305
306 if (!emc_enable) {
307 dev_err(&pdev->dev, "disabled per module parameter\n");
308 return -ENODEV;
309 }
310
311 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
312 if (!res) {
313 dev_err(&pdev->dev, "missing register base\n");
314 return -ENOMEM;
315 }
316
317 emc_regbase = devm_request_and_ioremap(&pdev->dev, res);
318 if (!emc_regbase) {
319 dev_err(&pdev->dev, "failed to remap registers\n");
320 return -ENOMEM;
321 }
322
323 pdata = pdev->dev.platform_data;
324
325 if (!pdata)
326 pdata = tegra_emc_dt_parse_pdata(pdev);
327
328 if (!pdata)
329 pdata = tegra_emc_fill_pdata(pdev);
330
331 pdev->dev.platform_data = pdata;
332
333 emc_pdev = pdev;
334
335 return 0;
336}
337
338static struct of_device_id tegra_emc_of_match[] __devinitdata = {
339 { .compatible = "nvidia,tegra20-emc", },
340 { },
341};
342
343static struct platform_driver tegra_emc_driver = {
344 .driver = {
345 .name = "tegra-emc",
346 .owner = THIS_MODULE,
347 .of_match_table = tegra_emc_of_match,
348 },
349 .probe = tegra_emc_probe,
350};
351
352static int __init tegra_emc_init(void)
175{ 353{
176 tegra_emc_table = table; 354 return platform_driver_register(&tegra_emc_driver);
177 tegra_emc_table_size = table_size;
178} 355}
356device_initcall(tegra_emc_init);
diff --git a/arch/arm/mach-tegra/tegra2_emc.h b/arch/arm/mach-tegra/tegra2_emc.h
index 19f08cb3160..f61409b54cb 100644
--- a/arch/arm/mach-tegra/tegra2_emc.h
+++ b/arch/arm/mach-tegra/tegra2_emc.h
@@ -15,13 +15,10 @@
15 * 15 *
16 */ 16 */
17 17
18#define TEGRA_EMC_NUM_REGS 46 18#ifndef __MACH_TEGRA_TEGRA2_EMC_H_
19 19#define __MACH_TEGRA_TEGRA2_EMC_H
20struct tegra_emc_table {
21 unsigned long rate;
22 u32 regs[TEGRA_EMC_NUM_REGS];
23};
24 20
25int tegra_emc_set_rate(unsigned long rate); 21int tegra_emc_set_rate(unsigned long rate);
26long tegra_emc_round_rate(unsigned long rate); 22long tegra_emc_round_rate(unsigned long rate);
27void tegra_init_emc(const struct tegra_emc_table *table, int table_size); 23
24#endif
diff --git a/arch/arm/mach-tegra/tegra30_clocks.c b/arch/arm/mach-tegra/tegra30_clocks.c
new file mode 100644
index 00000000000..6d08b53f92d
--- /dev/null
+++ b/arch/arm/mach-tegra/tegra30_clocks.c
@@ -0,0 +1,3099 @@
1/*
2 * arch/arm/mach-tegra/tegra30_clocks.c
3 *
4 * Copyright (c) 2010-2011 NVIDIA CORPORATION. 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; version 2 of the License.
9 *
10 * This program is distributed in the hope that 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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/list.h>
24#include <linux/spinlock.h>
25#include <linux/delay.h>
26#include <linux/err.h>
27#include <linux/io.h>
28#include <linux/clk.h>
29#include <linux/cpufreq.h>
30#include <linux/syscore_ops.h>
31
32#include <asm/clkdev.h>
33
34#include <mach/iomap.h>
35
36#include "clock.h"
37#include "fuse.h"
38
39#define USE_PLL_LOCK_BITS 0
40
41#define RST_DEVICES_L 0x004
42#define RST_DEVICES_H 0x008
43#define RST_DEVICES_U 0x00C
44#define RST_DEVICES_V 0x358
45#define RST_DEVICES_W 0x35C
46#define RST_DEVICES_SET_L 0x300
47#define RST_DEVICES_CLR_L 0x304
48#define RST_DEVICES_SET_V 0x430
49#define RST_DEVICES_CLR_V 0x434
50#define RST_DEVICES_NUM 5
51
52#define CLK_OUT_ENB_L 0x010
53#define CLK_OUT_ENB_H 0x014
54#define CLK_OUT_ENB_U 0x018
55#define CLK_OUT_ENB_V 0x360
56#define CLK_OUT_ENB_W 0x364
57#define CLK_OUT_ENB_SET_L 0x320
58#define CLK_OUT_ENB_CLR_L 0x324
59#define CLK_OUT_ENB_SET_V 0x440
60#define CLK_OUT_ENB_CLR_V 0x444
61#define CLK_OUT_ENB_NUM 5
62
63#define RST_DEVICES_V_SWR_CPULP_RST_DIS (0x1 << 1)
64#define CLK_OUT_ENB_V_CLK_ENB_CPULP_EN (0x1 << 1)
65
66#define PERIPH_CLK_TO_BIT(c) (1 << (c->u.periph.clk_num % 32))
67#define PERIPH_CLK_TO_RST_REG(c) \
68 periph_clk_to_reg((c), RST_DEVICES_L, RST_DEVICES_V, 4)
69#define PERIPH_CLK_TO_RST_SET_REG(c) \
70 periph_clk_to_reg((c), RST_DEVICES_SET_L, RST_DEVICES_SET_V, 8)
71#define PERIPH_CLK_TO_RST_CLR_REG(c) \
72 periph_clk_to_reg((c), RST_DEVICES_CLR_L, RST_DEVICES_CLR_V, 8)
73
74#define PERIPH_CLK_TO_ENB_REG(c) \
75 periph_clk_to_reg((c), CLK_OUT_ENB_L, CLK_OUT_ENB_V, 4)
76#define PERIPH_CLK_TO_ENB_SET_REG(c) \
77 periph_clk_to_reg((c), CLK_OUT_ENB_SET_L, CLK_OUT_ENB_SET_V, 8)
78#define PERIPH_CLK_TO_ENB_CLR_REG(c) \
79 periph_clk_to_reg((c), CLK_OUT_ENB_CLR_L, CLK_OUT_ENB_CLR_V, 8)
80
81#define CLK_MASK_ARM 0x44
82#define MISC_CLK_ENB 0x48
83
84#define OSC_CTRL 0x50
85#define OSC_CTRL_OSC_FREQ_MASK (0xF<<28)
86#define OSC_CTRL_OSC_FREQ_13MHZ (0x0<<28)
87#define OSC_CTRL_OSC_FREQ_19_2MHZ (0x4<<28)
88#define OSC_CTRL_OSC_FREQ_12MHZ (0x8<<28)
89#define OSC_CTRL_OSC_FREQ_26MHZ (0xC<<28)
90#define OSC_CTRL_OSC_FREQ_16_8MHZ (0x1<<28)
91#define OSC_CTRL_OSC_FREQ_38_4MHZ (0x5<<28)
92#define OSC_CTRL_OSC_FREQ_48MHZ (0x9<<28)
93#define OSC_CTRL_MASK (0x3f2 | OSC_CTRL_OSC_FREQ_MASK)
94
95#define OSC_CTRL_PLL_REF_DIV_MASK (3<<26)
96#define OSC_CTRL_PLL_REF_DIV_1 (0<<26)
97#define OSC_CTRL_PLL_REF_DIV_2 (1<<26)
98#define OSC_CTRL_PLL_REF_DIV_4 (2<<26)
99
100#define OSC_FREQ_DET 0x58
101#define OSC_FREQ_DET_TRIG (1<<31)
102
103#define OSC_FREQ_DET_STATUS 0x5C
104#define OSC_FREQ_DET_BUSY (1<<31)
105#define OSC_FREQ_DET_CNT_MASK 0xFFFF
106
107#define PERIPH_CLK_SOURCE_I2S1 0x100
108#define PERIPH_CLK_SOURCE_EMC 0x19c
109#define PERIPH_CLK_SOURCE_OSC 0x1fc
110#define PERIPH_CLK_SOURCE_NUM1 \
111 ((PERIPH_CLK_SOURCE_OSC - PERIPH_CLK_SOURCE_I2S1) / 4)
112
113#define PERIPH_CLK_SOURCE_G3D2 0x3b0
114#define PERIPH_CLK_SOURCE_SE 0x42c
115#define PERIPH_CLK_SOURCE_NUM2 \
116 ((PERIPH_CLK_SOURCE_SE - PERIPH_CLK_SOURCE_G3D2) / 4 + 1)
117
118#define AUDIO_DLY_CLK 0x49c
119#define AUDIO_SYNC_CLK_SPDIF 0x4b4
120#define PERIPH_CLK_SOURCE_NUM3 \
121 ((AUDIO_SYNC_CLK_SPDIF - AUDIO_DLY_CLK) / 4 + 1)
122
123#define PERIPH_CLK_SOURCE_NUM (PERIPH_CLK_SOURCE_NUM1 + \
124 PERIPH_CLK_SOURCE_NUM2 + \
125 PERIPH_CLK_SOURCE_NUM3)
126
127#define CPU_SOFTRST_CTRL 0x380
128
129#define PERIPH_CLK_SOURCE_DIVU71_MASK 0xFF
130#define PERIPH_CLK_SOURCE_DIVU16_MASK 0xFFFF
131#define PERIPH_CLK_SOURCE_DIV_SHIFT 0
132#define PERIPH_CLK_SOURCE_DIVIDLE_SHIFT 8
133#define PERIPH_CLK_SOURCE_DIVIDLE_VAL 50
134#define PERIPH_CLK_UART_DIV_ENB (1<<24)
135#define PERIPH_CLK_VI_SEL_EX_SHIFT 24
136#define PERIPH_CLK_VI_SEL_EX_MASK (0x3<<PERIPH_CLK_VI_SEL_EX_SHIFT)
137#define PERIPH_CLK_NAND_DIV_EX_ENB (1<<8)
138#define PERIPH_CLK_DTV_POLARITY_INV (1<<25)
139
140#define AUDIO_SYNC_SOURCE_MASK 0x0F
141#define AUDIO_SYNC_DISABLE_BIT 0x10
142#define AUDIO_SYNC_TAP_NIBBLE_SHIFT(c) ((c->reg_shift - 24) * 4)
143
144#define PLL_BASE 0x0
145#define PLL_BASE_BYPASS (1<<31)
146#define PLL_BASE_ENABLE (1<<30)
147#define PLL_BASE_REF_ENABLE (1<<29)
148#define PLL_BASE_OVERRIDE (1<<28)
149#define PLL_BASE_LOCK (1<<27)
150#define PLL_BASE_DIVP_MASK (0x7<<20)
151#define PLL_BASE_DIVP_SHIFT 20
152#define PLL_BASE_DIVN_MASK (0x3FF<<8)
153#define PLL_BASE_DIVN_SHIFT 8
154#define PLL_BASE_DIVM_MASK (0x1F)
155#define PLL_BASE_DIVM_SHIFT 0
156
157#define PLL_OUT_RATIO_MASK (0xFF<<8)
158#define PLL_OUT_RATIO_SHIFT 8
159#define PLL_OUT_OVERRIDE (1<<2)
160#define PLL_OUT_CLKEN (1<<1)
161#define PLL_OUT_RESET_DISABLE (1<<0)
162
163#define PLL_MISC(c) \
164 (((c)->flags & PLL_ALT_MISC_REG) ? 0x4 : 0xc)
165#define PLL_MISC_LOCK_ENABLE(c) \
166 (((c)->flags & (PLLU | PLLD)) ? (1<<22) : (1<<18))
167
168#define PLL_MISC_DCCON_SHIFT 20
169#define PLL_MISC_CPCON_SHIFT 8
170#define PLL_MISC_CPCON_MASK (0xF<<PLL_MISC_CPCON_SHIFT)
171#define PLL_MISC_LFCON_SHIFT 4
172#define PLL_MISC_LFCON_MASK (0xF<<PLL_MISC_LFCON_SHIFT)
173#define PLL_MISC_VCOCON_SHIFT 0
174#define PLL_MISC_VCOCON_MASK (0xF<<PLL_MISC_VCOCON_SHIFT)
175#define PLLD_MISC_CLKENABLE (1<<30)
176
177#define PLLU_BASE_POST_DIV (1<<20)
178
179#define PLLD_BASE_DSIB_MUX_SHIFT 25
180#define PLLD_BASE_DSIB_MUX_MASK (1<<PLLD_BASE_DSIB_MUX_SHIFT)
181#define PLLD_BASE_CSI_CLKENABLE (1<<26)
182#define PLLD_MISC_DSI_CLKENABLE (1<<30)
183#define PLLD_MISC_DIV_RST (1<<23)
184#define PLLD_MISC_DCCON_SHIFT 12
185
186#define PLLDU_LFCON_SET_DIVN 600
187
188/* FIXME: OUT_OF_TABLE_CPCON per pll */
189#define OUT_OF_TABLE_CPCON 0x8
190
191#define SUPER_CLK_MUX 0x00
192#define SUPER_STATE_SHIFT 28
193#define SUPER_STATE_MASK (0xF << SUPER_STATE_SHIFT)
194#define SUPER_STATE_STANDBY (0x0 << SUPER_STATE_SHIFT)
195#define SUPER_STATE_IDLE (0x1 << SUPER_STATE_SHIFT)
196#define SUPER_STATE_RUN (0x2 << SUPER_STATE_SHIFT)
197#define SUPER_STATE_IRQ (0x3 << SUPER_STATE_SHIFT)
198#define SUPER_STATE_FIQ (0x4 << SUPER_STATE_SHIFT)
199#define SUPER_LP_DIV2_BYPASS (0x1 << 16)
200#define SUPER_SOURCE_MASK 0xF
201#define SUPER_FIQ_SOURCE_SHIFT 12
202#define SUPER_IRQ_SOURCE_SHIFT 8
203#define SUPER_RUN_SOURCE_SHIFT 4
204#define SUPER_IDLE_SOURCE_SHIFT 0
205
206#define SUPER_CLK_DIVIDER 0x04
207#define SUPER_CLOCK_DIV_U71_SHIFT 16
208#define SUPER_CLOCK_DIV_U71_MASK (0xff << SUPER_CLOCK_DIV_U71_SHIFT)
209/* guarantees safe cpu backup */
210#define SUPER_CLOCK_DIV_U71_MIN 0x2
211
212#define BUS_CLK_DISABLE (1<<3)
213#define BUS_CLK_DIV_MASK 0x3
214
215#define PMC_CTRL 0x0
216 #define PMC_CTRL_BLINK_ENB (1 << 7)
217
218#define PMC_DPD_PADS_ORIDE 0x1c
219 #define PMC_DPD_PADS_ORIDE_BLINK_ENB (1 << 20)
220
221#define PMC_BLINK_TIMER_DATA_ON_SHIFT 0
222#define PMC_BLINK_TIMER_DATA_ON_MASK 0x7fff
223#define PMC_BLINK_TIMER_ENB (1 << 15)
224#define PMC_BLINK_TIMER_DATA_OFF_SHIFT 16
225#define PMC_BLINK_TIMER_DATA_OFF_MASK 0xffff
226
227#define PMC_PLLP_WB0_OVERRIDE 0xf8
228#define PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE (1 << 12)
229
230#define UTMIP_PLL_CFG2 0x488
231#define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xfff) << 6)
232#define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18)
233#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN (1 << 0)
234#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN (1 << 2)
235#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN (1 << 4)
236
237#define UTMIP_PLL_CFG1 0x484
238#define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 27)
239#define UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(x) (((x) & 0xfff) << 0)
240#define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN (1 << 14)
241#define UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN (1 << 12)
242#define UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN (1 << 16)
243
244#define PLLE_BASE_CML_ENABLE (1<<31)
245#define PLLE_BASE_ENABLE (1<<30)
246#define PLLE_BASE_DIVCML_SHIFT 24
247#define PLLE_BASE_DIVCML_MASK (0xf<<PLLE_BASE_DIVCML_SHIFT)
248#define PLLE_BASE_DIVP_SHIFT 16
249#define PLLE_BASE_DIVP_MASK (0x3f<<PLLE_BASE_DIVP_SHIFT)
250#define PLLE_BASE_DIVN_SHIFT 8
251#define PLLE_BASE_DIVN_MASK (0xFF<<PLLE_BASE_DIVN_SHIFT)
252#define PLLE_BASE_DIVM_SHIFT 0
253#define PLLE_BASE_DIVM_MASK (0xFF<<PLLE_BASE_DIVM_SHIFT)
254#define PLLE_BASE_DIV_MASK \
255 (PLLE_BASE_DIVCML_MASK | PLLE_BASE_DIVP_MASK | \
256 PLLE_BASE_DIVN_MASK | PLLE_BASE_DIVM_MASK)
257#define PLLE_BASE_DIV(m, n, p, cml) \
258 (((cml)<<PLLE_BASE_DIVCML_SHIFT) | ((p)<<PLLE_BASE_DIVP_SHIFT) | \
259 ((n)<<PLLE_BASE_DIVN_SHIFT) | ((m)<<PLLE_BASE_DIVM_SHIFT))
260
261#define PLLE_MISC_SETUP_BASE_SHIFT 16
262#define PLLE_MISC_SETUP_BASE_MASK (0xFFFF<<PLLE_MISC_SETUP_BASE_SHIFT)
263#define PLLE_MISC_READY (1<<15)
264#define PLLE_MISC_LOCK (1<<11)
265#define PLLE_MISC_LOCK_ENABLE (1<<9)
266#define PLLE_MISC_SETUP_EX_SHIFT 2
267#define PLLE_MISC_SETUP_EX_MASK (0x3<<PLLE_MISC_SETUP_EX_SHIFT)
268#define PLLE_MISC_SETUP_MASK \
269 (PLLE_MISC_SETUP_BASE_MASK | PLLE_MISC_SETUP_EX_MASK)
270#define PLLE_MISC_SETUP_VALUE \
271 ((0x7<<PLLE_MISC_SETUP_BASE_SHIFT) | (0x0<<PLLE_MISC_SETUP_EX_SHIFT))
272
273#define PLLE_SS_CTRL 0x68
274#define PLLE_SS_INCINTRV_SHIFT 24
275#define PLLE_SS_INCINTRV_MASK (0x3f<<PLLE_SS_INCINTRV_SHIFT)
276#define PLLE_SS_INC_SHIFT 16
277#define PLLE_SS_INC_MASK (0xff<<PLLE_SS_INC_SHIFT)
278#define PLLE_SS_MAX_SHIFT 0
279#define PLLE_SS_MAX_MASK (0x1ff<<PLLE_SS_MAX_SHIFT)
280#define PLLE_SS_COEFFICIENTS_MASK \
281 (PLLE_SS_INCINTRV_MASK | PLLE_SS_INC_MASK | PLLE_SS_MAX_MASK)
282#define PLLE_SS_COEFFICIENTS_12MHZ \
283 ((0x18<<PLLE_SS_INCINTRV_SHIFT) | (0x1<<PLLE_SS_INC_SHIFT) | \
284 (0x24<<PLLE_SS_MAX_SHIFT))
285#define PLLE_SS_DISABLE ((1<<12) | (1<<11) | (1<<10))
286
287#define PLLE_AUX 0x48c
288#define PLLE_AUX_PLLP_SEL (1<<2)
289#define PLLE_AUX_CML_SATA_ENABLE (1<<1)
290#define PLLE_AUX_CML_PCIE_ENABLE (1<<0)
291
292#define PMC_SATA_PWRGT 0x1ac
293#define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE (1<<5)
294#define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL (1<<4)
295
296#define ROUND_DIVIDER_UP 0
297#define ROUND_DIVIDER_DOWN 1
298
299/* FIXME: recommended safety delay after lock is detected */
300#define PLL_POST_LOCK_DELAY 100
301
302/**
303* Structure defining the fields for USB UTMI clocks Parameters.
304*/
305struct utmi_clk_param {
306 /* Oscillator Frequency in KHz */
307 u32 osc_frequency;
308 /* UTMIP PLL Enable Delay Count */
309 u8 enable_delay_count;
310 /* UTMIP PLL Stable count */
311 u8 stable_count;
312 /* UTMIP PLL Active delay count */
313 u8 active_delay_count;
314 /* UTMIP PLL Xtal frequency count */
315 u8 xtal_freq_count;
316};
317
318static const struct utmi_clk_param utmi_parameters[] = {
319 {
320 .osc_frequency = 13000000,
321 .enable_delay_count = 0x02,
322 .stable_count = 0x33,
323 .active_delay_count = 0x05,
324 .xtal_freq_count = 0x7F
325 },
326 {
327 .osc_frequency = 19200000,
328 .enable_delay_count = 0x03,
329 .stable_count = 0x4B,
330 .active_delay_count = 0x06,
331 .xtal_freq_count = 0xBB},
332 {
333 .osc_frequency = 12000000,
334 .enable_delay_count = 0x02,
335 .stable_count = 0x2F,
336 .active_delay_count = 0x04,
337 .xtal_freq_count = 0x76
338 },
339 {
340 .osc_frequency = 26000000,
341 .enable_delay_count = 0x04,
342 .stable_count = 0x66,
343 .active_delay_count = 0x09,
344 .xtal_freq_count = 0xFE
345 },
346 {
347 .osc_frequency = 16800000,
348 .enable_delay_count = 0x03,
349 .stable_count = 0x41,
350 .active_delay_count = 0x0A,
351 .xtal_freq_count = 0xA4
352 },
353};
354
355static void __iomem *reg_clk_base = IO_ADDRESS(TEGRA_CLK_RESET_BASE);
356static void __iomem *reg_pmc_base = IO_ADDRESS(TEGRA_PMC_BASE);
357static void __iomem *misc_gp_hidrev_base = IO_ADDRESS(TEGRA_APB_MISC_BASE);
358
359#define MISC_GP_HIDREV 0x804
360
361/*
362 * Some peripheral clocks share an enable bit, so refcount the enable bits
363 * in registers CLK_ENABLE_L, ... CLK_ENABLE_W
364 */
365static int tegra_periph_clk_enable_refcount[CLK_OUT_ENB_NUM * 32];
366
367#define clk_writel(value, reg) \
368 __raw_writel(value, (u32)reg_clk_base + (reg))
369#define clk_readl(reg) \
370 __raw_readl((u32)reg_clk_base + (reg))
371#define pmc_writel(value, reg) \
372 __raw_writel(value, (u32)reg_pmc_base + (reg))
373#define pmc_readl(reg) \
374 __raw_readl((u32)reg_pmc_base + (reg))
375#define chipid_readl() \
376 __raw_readl((u32)misc_gp_hidrev_base + MISC_GP_HIDREV)
377
378#define clk_writel_delay(value, reg) \
379 do { \
380 __raw_writel((value), (u32)reg_clk_base + (reg)); \
381 udelay(2); \
382 } while (0)
383
384
385static inline int clk_set_div(struct clk *c, u32 n)
386{
387 return clk_set_rate(c, (clk_get_rate(c->parent) + n-1) / n);
388}
389
390static inline u32 periph_clk_to_reg(
391 struct clk *c, u32 reg_L, u32 reg_V, int offs)
392{
393 u32 reg = c->u.periph.clk_num / 32;
394 BUG_ON(reg >= RST_DEVICES_NUM);
395 if (reg < 3)
396 reg = reg_L + (reg * offs);
397 else
398 reg = reg_V + ((reg - 3) * offs);
399 return reg;
400}
401
402static unsigned long clk_measure_input_freq(void)
403{
404 u32 clock_autodetect;
405 clk_writel(OSC_FREQ_DET_TRIG | 1, OSC_FREQ_DET);
406 do {} while (clk_readl(OSC_FREQ_DET_STATUS) & OSC_FREQ_DET_BUSY);
407 clock_autodetect = clk_readl(OSC_FREQ_DET_STATUS);
408 if (clock_autodetect >= 732 - 3 && clock_autodetect <= 732 + 3) {
409 return 12000000;
410 } else if (clock_autodetect >= 794 - 3 && clock_autodetect <= 794 + 3) {
411 return 13000000;
412 } else if (clock_autodetect >= 1172 - 3 && clock_autodetect <= 1172 + 3) {
413 return 19200000;
414 } else if (clock_autodetect >= 1587 - 3 && clock_autodetect <= 1587 + 3) {
415 return 26000000;
416 } else if (clock_autodetect >= 1025 - 3 && clock_autodetect <= 1025 + 3) {
417 return 16800000;
418 } else if (clock_autodetect >= 2344 - 3 && clock_autodetect <= 2344 + 3) {
419 return 38400000;
420 } else if (clock_autodetect >= 2928 - 3 && clock_autodetect <= 2928 + 3) {
421 return 48000000;
422 } else {
423 pr_err("%s: Unexpected clock autodetect value %d", __func__,
424 clock_autodetect);
425 BUG();
426 return 0;
427 }
428}
429
430static int clk_div71_get_divider(unsigned long parent_rate, unsigned long rate,
431 u32 flags, u32 round_mode)
432{
433 s64 divider_u71 = parent_rate;
434 if (!rate)
435 return -EINVAL;
436
437 if (!(flags & DIV_U71_INT))
438 divider_u71 *= 2;
439 if (round_mode == ROUND_DIVIDER_UP)
440 divider_u71 += rate - 1;
441 do_div(divider_u71, rate);
442 if (flags & DIV_U71_INT)
443 divider_u71 *= 2;
444
445 if (divider_u71 - 2 < 0)
446 return 0;
447
448 if (divider_u71 - 2 > 255)
449 return -EINVAL;
450
451 return divider_u71 - 2;
452}
453
454static int clk_div16_get_divider(unsigned long parent_rate, unsigned long rate)
455{
456 s64 divider_u16;
457
458 divider_u16 = parent_rate;
459 if (!rate)
460 return -EINVAL;
461 divider_u16 += rate - 1;
462 do_div(divider_u16, rate);
463
464 if (divider_u16 - 1 < 0)
465 return 0;
466
467 if (divider_u16 - 1 > 0xFFFF)
468 return -EINVAL;
469
470 return divider_u16 - 1;
471}
472
473/* clk_m functions */
474static unsigned long tegra30_clk_m_autodetect_rate(struct clk *c)
475{
476 u32 osc_ctrl = clk_readl(OSC_CTRL);
477 u32 auto_clock_control = osc_ctrl & ~OSC_CTRL_OSC_FREQ_MASK;
478 u32 pll_ref_div = osc_ctrl & OSC_CTRL_PLL_REF_DIV_MASK;
479
480 c->rate = clk_measure_input_freq();
481 switch (c->rate) {
482 case 12000000:
483 auto_clock_control |= OSC_CTRL_OSC_FREQ_12MHZ;
484 BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1);
485 break;
486 case 13000000:
487 auto_clock_control |= OSC_CTRL_OSC_FREQ_13MHZ;
488 BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1);
489 break;
490 case 19200000:
491 auto_clock_control |= OSC_CTRL_OSC_FREQ_19_2MHZ;
492 BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1);
493 break;
494 case 26000000:
495 auto_clock_control |= OSC_CTRL_OSC_FREQ_26MHZ;
496 BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1);
497 break;
498 case 16800000:
499 auto_clock_control |= OSC_CTRL_OSC_FREQ_16_8MHZ;
500 BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1);
501 break;
502 case 38400000:
503 auto_clock_control |= OSC_CTRL_OSC_FREQ_38_4MHZ;
504 BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_2);
505 break;
506 case 48000000:
507 auto_clock_control |= OSC_CTRL_OSC_FREQ_48MHZ;
508 BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_4);
509 break;
510 default:
511 pr_err("%s: Unexpected clock rate %ld", __func__, c->rate);
512 BUG();
513 }
514 clk_writel(auto_clock_control, OSC_CTRL);
515 return c->rate;
516}
517
518static void tegra30_clk_m_init(struct clk *c)
519{
520 pr_debug("%s on clock %s\n", __func__, c->name);
521 tegra30_clk_m_autodetect_rate(c);
522}
523
524static int tegra30_clk_m_enable(struct clk *c)
525{
526 pr_debug("%s on clock %s\n", __func__, c->name);
527 return 0;
528}
529
530static void tegra30_clk_m_disable(struct clk *c)
531{
532 pr_debug("%s on clock %s\n", __func__, c->name);
533 WARN(1, "Attempting to disable main SoC clock\n");
534}
535
536static struct clk_ops tegra_clk_m_ops = {
537 .init = tegra30_clk_m_init,
538 .enable = tegra30_clk_m_enable,
539 .disable = tegra30_clk_m_disable,
540};
541
542static struct clk_ops tegra_clk_m_div_ops = {
543 .enable = tegra30_clk_m_enable,
544};
545
546/* PLL reference divider functions */
547static void tegra30_pll_ref_init(struct clk *c)
548{
549 u32 pll_ref_div = clk_readl(OSC_CTRL) & OSC_CTRL_PLL_REF_DIV_MASK;
550 pr_debug("%s on clock %s\n", __func__, c->name);
551
552 switch (pll_ref_div) {
553 case OSC_CTRL_PLL_REF_DIV_1:
554 c->div = 1;
555 break;
556 case OSC_CTRL_PLL_REF_DIV_2:
557 c->div = 2;
558 break;
559 case OSC_CTRL_PLL_REF_DIV_4:
560 c->div = 4;
561 break;
562 default:
563 pr_err("%s: Invalid pll ref divider %d", __func__, pll_ref_div);
564 BUG();
565 }
566 c->mul = 1;
567 c->state = ON;
568}
569
570static struct clk_ops tegra_pll_ref_ops = {
571 .init = tegra30_pll_ref_init,
572 .enable = tegra30_clk_m_enable,
573 .disable = tegra30_clk_m_disable,
574};
575
576/* super clock functions */
577/* "super clocks" on tegra30 have two-stage muxes, fractional 7.1 divider and
578 * clock skipping super divider. We will ignore the clock skipping divider,
579 * since we can't lower the voltage when using the clock skip, but we can if
580 * we lower the PLL frequency. We will use 7.1 divider for CPU super-clock
581 * only when its parent is a fixed rate PLL, since we can't change PLL rate
582 * in this case.
583 */
584static void tegra30_super_clk_init(struct clk *c)
585{
586 u32 val;
587 int source;
588 int shift;
589 const struct clk_mux_sel *sel;
590 val = clk_readl(c->reg + SUPER_CLK_MUX);
591 c->state = ON;
592 BUG_ON(((val & SUPER_STATE_MASK) != SUPER_STATE_RUN) &&
593 ((val & SUPER_STATE_MASK) != SUPER_STATE_IDLE));
594 shift = ((val & SUPER_STATE_MASK) == SUPER_STATE_IDLE) ?
595 SUPER_IDLE_SOURCE_SHIFT : SUPER_RUN_SOURCE_SHIFT;
596 source = (val >> shift) & SUPER_SOURCE_MASK;
597 if (c->flags & DIV_2)
598 source |= val & SUPER_LP_DIV2_BYPASS;
599 for (sel = c->inputs; sel->input != NULL; sel++) {
600 if (sel->value == source)
601 break;
602 }
603 BUG_ON(sel->input == NULL);
604 c->parent = sel->input;
605
606 if (c->flags & DIV_U71) {
607 /* Init safe 7.1 divider value (does not affect PLLX path) */
608 clk_writel(SUPER_CLOCK_DIV_U71_MIN << SUPER_CLOCK_DIV_U71_SHIFT,
609 c->reg + SUPER_CLK_DIVIDER);
610 c->mul = 2;
611 c->div = 2;
612 if (!(c->parent->flags & PLLX))
613 c->div += SUPER_CLOCK_DIV_U71_MIN;
614 } else
615 clk_writel(0, c->reg + SUPER_CLK_DIVIDER);
616}
617
618static int tegra30_super_clk_enable(struct clk *c)
619{
620 return 0;
621}
622
623static void tegra30_super_clk_disable(struct clk *c)
624{
625 /* since tegra 3 has 2 CPU super clocks - low power lp-mode clock and
626 geared up g-mode super clock - mode switch may request to disable
627 either of them; accept request with no affect on h/w */
628}
629
630static int tegra30_super_clk_set_parent(struct clk *c, struct clk *p)
631{
632 u32 val;
633 const struct clk_mux_sel *sel;
634 int shift;
635
636 val = clk_readl(c->reg + SUPER_CLK_MUX);
637 BUG_ON(((val & SUPER_STATE_MASK) != SUPER_STATE_RUN) &&
638 ((val & SUPER_STATE_MASK) != SUPER_STATE_IDLE));
639 shift = ((val & SUPER_STATE_MASK) == SUPER_STATE_IDLE) ?
640 SUPER_IDLE_SOURCE_SHIFT : SUPER_RUN_SOURCE_SHIFT;
641 for (sel = c->inputs; sel->input != NULL; sel++) {
642 if (sel->input == p) {
643 /* For LP mode super-clock switch between PLLX direct
644 and divided-by-2 outputs is allowed only when other
645 than PLLX clock source is current parent */
646 if ((c->flags & DIV_2) && (p->flags & PLLX) &&
647 ((sel->value ^ val) & SUPER_LP_DIV2_BYPASS)) {
648 if (c->parent->flags & PLLX)
649 return -EINVAL;
650 val ^= SUPER_LP_DIV2_BYPASS;
651 clk_writel_delay(val, c->reg);
652 }
653 val &= ~(SUPER_SOURCE_MASK << shift);
654 val |= (sel->value & SUPER_SOURCE_MASK) << shift;
655
656 /* 7.1 divider for CPU super-clock does not affect
657 PLLX path */
658 if (c->flags & DIV_U71) {
659 u32 div = 0;
660 if (!(p->flags & PLLX)) {
661 div = clk_readl(c->reg +
662 SUPER_CLK_DIVIDER);
663 div &= SUPER_CLOCK_DIV_U71_MASK;
664 div >>= SUPER_CLOCK_DIV_U71_SHIFT;
665 }
666 c->div = div + 2;
667 c->mul = 2;
668 }
669
670 if (c->refcnt)
671 clk_enable(p);
672
673 clk_writel_delay(val, c->reg);
674
675 if (c->refcnt && c->parent)
676 clk_disable(c->parent);
677
678 clk_reparent(c, p);
679 return 0;
680 }
681 }
682 return -EINVAL;
683}
684
685/*
686 * Do not use super clocks "skippers", since dividing using a clock skipper
687 * does not allow the voltage to be scaled down. Instead adjust the rate of
688 * the parent clock. This requires that the parent of a super clock have no
689 * other children, otherwise the rate will change underneath the other
690 * children. Special case: if fixed rate PLL is CPU super clock parent the
691 * rate of this PLL can't be changed, and it has many other children. In
692 * this case use 7.1 fractional divider to adjust the super clock rate.
693 */
694static int tegra30_super_clk_set_rate(struct clk *c, unsigned long rate)
695{
696 if ((c->flags & DIV_U71) && (c->parent->flags & PLL_FIXED)) {
697 int div = clk_div71_get_divider(c->parent->u.pll.fixed_rate,
698 rate, c->flags, ROUND_DIVIDER_DOWN);
699 div = max(div, SUPER_CLOCK_DIV_U71_MIN);
700
701 clk_writel(div << SUPER_CLOCK_DIV_U71_SHIFT,
702 c->reg + SUPER_CLK_DIVIDER);
703 c->div = div + 2;
704 c->mul = 2;
705 return 0;
706 }
707 return clk_set_rate(c->parent, rate);
708}
709
710static struct clk_ops tegra_super_ops = {
711 .init = tegra30_super_clk_init,
712 .enable = tegra30_super_clk_enable,
713 .disable = tegra30_super_clk_disable,
714 .set_parent = tegra30_super_clk_set_parent,
715 .set_rate = tegra30_super_clk_set_rate,
716};
717
718static int tegra30_twd_clk_set_rate(struct clk *c, unsigned long rate)
719{
720 /* The input value 'rate' is the clock rate of the CPU complex. */
721 c->rate = (rate * c->mul) / c->div;
722 return 0;
723}
724
725static struct clk_ops tegra30_twd_ops = {
726 .set_rate = tegra30_twd_clk_set_rate,
727};
728
729/* Blink output functions */
730
731static void tegra30_blink_clk_init(struct clk *c)
732{
733 u32 val;
734
735 val = pmc_readl(PMC_CTRL);
736 c->state = (val & PMC_CTRL_BLINK_ENB) ? ON : OFF;
737 c->mul = 1;
738 val = pmc_readl(c->reg);
739
740 if (val & PMC_BLINK_TIMER_ENB) {
741 unsigned int on_off;
742
743 on_off = (val >> PMC_BLINK_TIMER_DATA_ON_SHIFT) &
744 PMC_BLINK_TIMER_DATA_ON_MASK;
745 val >>= PMC_BLINK_TIMER_DATA_OFF_SHIFT;
746 val &= PMC_BLINK_TIMER_DATA_OFF_MASK;
747 on_off += val;
748 /* each tick in the blink timer is 4 32KHz clocks */
749 c->div = on_off * 4;
750 } else {
751 c->div = 1;
752 }
753}
754
755static int tegra30_blink_clk_enable(struct clk *c)
756{
757 u32 val;
758
759 val = pmc_readl(PMC_DPD_PADS_ORIDE);
760 pmc_writel(val | PMC_DPD_PADS_ORIDE_BLINK_ENB, PMC_DPD_PADS_ORIDE);
761
762 val = pmc_readl(PMC_CTRL);
763 pmc_writel(val | PMC_CTRL_BLINK_ENB, PMC_CTRL);
764
765 return 0;
766}
767
768static void tegra30_blink_clk_disable(struct clk *c)
769{
770 u32 val;
771
772 val = pmc_readl(PMC_CTRL);
773 pmc_writel(val & ~PMC_CTRL_BLINK_ENB, PMC_CTRL);
774
775 val = pmc_readl(PMC_DPD_PADS_ORIDE);
776 pmc_writel(val & ~PMC_DPD_PADS_ORIDE_BLINK_ENB, PMC_DPD_PADS_ORIDE);
777}
778
779static int tegra30_blink_clk_set_rate(struct clk *c, unsigned long rate)
780{
781 unsigned long parent_rate = clk_get_rate(c->parent);
782 if (rate >= parent_rate) {
783 c->div = 1;
784 pmc_writel(0, c->reg);
785 } else {
786 unsigned int on_off;
787 u32 val;
788
789 on_off = DIV_ROUND_UP(parent_rate / 8, rate);
790 c->div = on_off * 8;
791
792 val = (on_off & PMC_BLINK_TIMER_DATA_ON_MASK) <<
793 PMC_BLINK_TIMER_DATA_ON_SHIFT;
794 on_off &= PMC_BLINK_TIMER_DATA_OFF_MASK;
795 on_off <<= PMC_BLINK_TIMER_DATA_OFF_SHIFT;
796 val |= on_off;
797 val |= PMC_BLINK_TIMER_ENB;
798 pmc_writel(val, c->reg);
799 }
800
801 return 0;
802}
803
804static struct clk_ops tegra_blink_clk_ops = {
805 .init = &tegra30_blink_clk_init,
806 .enable = &tegra30_blink_clk_enable,
807 .disable = &tegra30_blink_clk_disable,
808 .set_rate = &tegra30_blink_clk_set_rate,
809};
810
811/* PLL Functions */
812static int tegra30_pll_clk_wait_for_lock(struct clk *c, u32 lock_reg,
813 u32 lock_bit)
814{
815#if USE_PLL_LOCK_BITS
816 int i;
817 for (i = 0; i < c->u.pll.lock_delay; i++) {
818 if (clk_readl(lock_reg) & lock_bit) {
819 udelay(PLL_POST_LOCK_DELAY);
820 return 0;
821 }
822 udelay(2); /* timeout = 2 * lock time */
823 }
824 pr_err("Timed out waiting for lock bit on pll %s", c->name);
825 return -1;
826#endif
827 udelay(c->u.pll.lock_delay);
828
829 return 0;
830}
831
832
833static void tegra30_utmi_param_configure(struct clk *c)
834{
835 u32 reg;
836 int i;
837 unsigned long main_rate =
838 clk_get_rate(c->parent->parent);
839
840 for (i = 0; i < ARRAY_SIZE(utmi_parameters); i++) {
841 if (main_rate == utmi_parameters[i].osc_frequency)
842 break;
843 }
844
845 if (i >= ARRAY_SIZE(utmi_parameters)) {
846 pr_err("%s: Unexpected main rate %lu\n", __func__, main_rate);
847 return;
848 }
849
850 reg = clk_readl(UTMIP_PLL_CFG2);
851
852 /* Program UTMIP PLL stable and active counts */
853 /* [FIXME] arclk_rst.h says WRONG! This should be 1ms -> 0x50 Check! */
854 reg &= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0);
855 reg |= UTMIP_PLL_CFG2_STABLE_COUNT(
856 utmi_parameters[i].stable_count);
857
858 reg &= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0);
859
860 reg |= UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(
861 utmi_parameters[i].active_delay_count);
862
863 /* Remove power downs from UTMIP PLL control bits */
864 reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN;
865 reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN;
866 reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN;
867
868 clk_writel(reg, UTMIP_PLL_CFG2);
869
870 /* Program UTMIP PLL delay and oscillator frequency counts */
871 reg = clk_readl(UTMIP_PLL_CFG1);
872 reg &= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0);
873
874 reg |= UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(
875 utmi_parameters[i].enable_delay_count);
876
877 reg &= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0);
878 reg |= UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(
879 utmi_parameters[i].xtal_freq_count);
880
881 /* Remove power downs from UTMIP PLL control bits */
882 reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN;
883 reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN;
884 reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN;
885
886 clk_writel(reg, UTMIP_PLL_CFG1);
887}
888
889static void tegra30_pll_clk_init(struct clk *c)
890{
891 u32 val = clk_readl(c->reg + PLL_BASE);
892
893 c->state = (val & PLL_BASE_ENABLE) ? ON : OFF;
894
895 if (c->flags & PLL_FIXED && !(val & PLL_BASE_OVERRIDE)) {
896 const struct clk_pll_freq_table *sel;
897 unsigned long input_rate = clk_get_rate(c->parent);
898 for (sel = c->u.pll.freq_table; sel->input_rate != 0; sel++) {
899 if (sel->input_rate == input_rate &&
900 sel->output_rate == c->u.pll.fixed_rate) {
901 c->mul = sel->n;
902 c->div = sel->m * sel->p;
903 return;
904 }
905 }
906 pr_err("Clock %s has unknown fixed frequency\n", c->name);
907 BUG();
908 } else if (val & PLL_BASE_BYPASS) {
909 c->mul = 1;
910 c->div = 1;
911 } else {
912 c->mul = (val & PLL_BASE_DIVN_MASK) >> PLL_BASE_DIVN_SHIFT;
913 c->div = (val & PLL_BASE_DIVM_MASK) >> PLL_BASE_DIVM_SHIFT;
914 if (c->flags & PLLU)
915 c->div *= (val & PLLU_BASE_POST_DIV) ? 1 : 2;
916 else
917 c->div *= (0x1 << ((val & PLL_BASE_DIVP_MASK) >>
918 PLL_BASE_DIVP_SHIFT));
919 if (c->flags & PLL_FIXED) {
920 unsigned long rate = clk_get_rate_locked(c);
921 BUG_ON(rate != c->u.pll.fixed_rate);
922 }
923 }
924
925 if (c->flags & PLLU)
926 tegra30_utmi_param_configure(c);
927}
928
929static int tegra30_pll_clk_enable(struct clk *c)
930{
931 u32 val;
932 pr_debug("%s on clock %s\n", __func__, c->name);
933
934#if USE_PLL_LOCK_BITS
935 val = clk_readl(c->reg + PLL_MISC(c));
936 val |= PLL_MISC_LOCK_ENABLE(c);
937 clk_writel(val, c->reg + PLL_MISC(c));
938#endif
939 val = clk_readl(c->reg + PLL_BASE);
940 val &= ~PLL_BASE_BYPASS;
941 val |= PLL_BASE_ENABLE;
942 clk_writel(val, c->reg + PLL_BASE);
943
944 if (c->flags & PLLM) {
945 val = pmc_readl(PMC_PLLP_WB0_OVERRIDE);
946 val |= PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE;
947 pmc_writel(val, PMC_PLLP_WB0_OVERRIDE);
948 }
949
950 tegra30_pll_clk_wait_for_lock(c, c->reg + PLL_BASE, PLL_BASE_LOCK);
951
952 return 0;
953}
954
955static void tegra30_pll_clk_disable(struct clk *c)
956{
957 u32 val;
958 pr_debug("%s on clock %s\n", __func__, c->name);
959
960 val = clk_readl(c->reg);
961 val &= ~(PLL_BASE_BYPASS | PLL_BASE_ENABLE);
962 clk_writel(val, c->reg);
963
964 if (c->flags & PLLM) {
965 val = pmc_readl(PMC_PLLP_WB0_OVERRIDE);
966 val &= ~PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE;
967 pmc_writel(val, PMC_PLLP_WB0_OVERRIDE);
968 }
969}
970
971static int tegra30_pll_clk_set_rate(struct clk *c, unsigned long rate)
972{
973 u32 val, p_div, old_base;
974 unsigned long input_rate;
975 const struct clk_pll_freq_table *sel;
976 struct clk_pll_freq_table cfg;
977
978 pr_debug("%s: %s %lu\n", __func__, c->name, rate);
979
980 if (c->flags & PLL_FIXED) {
981 int ret = 0;
982 if (rate != c->u.pll.fixed_rate) {
983 pr_err("%s: Can not change %s fixed rate %lu to %lu\n",
984 __func__, c->name, c->u.pll.fixed_rate, rate);
985 ret = -EINVAL;
986 }
987 return ret;
988 }
989
990 if (c->flags & PLLM) {
991 if (rate != clk_get_rate_locked(c)) {
992 pr_err("%s: Can not change memory %s rate in flight\n",
993 __func__, c->name);
994 return -EINVAL;
995 }
996 return 0;
997 }
998
999 p_div = 0;
1000 input_rate = clk_get_rate(c->parent);
1001
1002 /* Check if the target rate is tabulated */
1003 for (sel = c->u.pll.freq_table; sel->input_rate != 0; sel++) {
1004 if (sel->input_rate == input_rate && sel->output_rate == rate) {
1005 if (c->flags & PLLU) {
1006 BUG_ON(sel->p < 1 || sel->p > 2);
1007 if (sel->p == 1)
1008 p_div = PLLU_BASE_POST_DIV;
1009 } else {
1010 BUG_ON(sel->p < 1);
1011 for (val = sel->p; val > 1; val >>= 1)
1012 p_div++;
1013 p_div <<= PLL_BASE_DIVP_SHIFT;
1014 }
1015 break;
1016 }
1017 }
1018
1019 /* Configure out-of-table rate */
1020 if (sel->input_rate == 0) {
1021 unsigned long cfreq;
1022 BUG_ON(c->flags & PLLU);
1023 sel = &cfg;
1024
1025 switch (input_rate) {
1026 case 12000000:
1027 case 26000000:
1028 cfreq = (rate <= 1000000 * 1000) ? 1000000 : 2000000;
1029 break;
1030 case 13000000:
1031 cfreq = (rate <= 1000000 * 1000) ? 1000000 : 2600000;
1032 break;
1033 case 16800000:
1034 case 19200000:
1035 cfreq = (rate <= 1200000 * 1000) ? 1200000 : 2400000;
1036 break;
1037 default:
1038 pr_err("%s: Unexpected reference rate %lu\n",
1039 __func__, input_rate);
1040 BUG();
1041 }
1042
1043 /* Raise VCO to guarantee 0.5% accuracy */
1044 for (cfg.output_rate = rate; cfg.output_rate < 200 * cfreq;
1045 cfg.output_rate <<= 1)
1046 p_div++;
1047
1048 cfg.p = 0x1 << p_div;
1049 cfg.m = input_rate / cfreq;
1050 cfg.n = cfg.output_rate / cfreq;
1051 cfg.cpcon = OUT_OF_TABLE_CPCON;
1052
1053 if ((cfg.m > (PLL_BASE_DIVM_MASK >> PLL_BASE_DIVM_SHIFT)) ||
1054 (cfg.n > (PLL_BASE_DIVN_MASK >> PLL_BASE_DIVN_SHIFT)) ||
1055 (p_div > (PLL_BASE_DIVP_MASK >> PLL_BASE_DIVP_SHIFT)) ||
1056 (cfg.output_rate > c->u.pll.vco_max)) {
1057 pr_err("%s: Failed to set %s out-of-table rate %lu\n",
1058 __func__, c->name, rate);
1059 return -EINVAL;
1060 }
1061 p_div <<= PLL_BASE_DIVP_SHIFT;
1062 }
1063
1064 c->mul = sel->n;
1065 c->div = sel->m * sel->p;
1066
1067 old_base = val = clk_readl(c->reg + PLL_BASE);
1068 val &= ~(PLL_BASE_DIVM_MASK | PLL_BASE_DIVN_MASK |
1069 ((c->flags & PLLU) ? PLLU_BASE_POST_DIV : PLL_BASE_DIVP_MASK));
1070 val |= (sel->m << PLL_BASE_DIVM_SHIFT) |
1071 (sel->n << PLL_BASE_DIVN_SHIFT) | p_div;
1072 if (val == old_base)
1073 return 0;
1074
1075 if (c->state == ON) {
1076 tegra30_pll_clk_disable(c);
1077 val &= ~(PLL_BASE_BYPASS | PLL_BASE_ENABLE);
1078 }
1079 clk_writel(val, c->reg + PLL_BASE);
1080
1081 if (c->flags & PLL_HAS_CPCON) {
1082 val = clk_readl(c->reg + PLL_MISC(c));
1083 val &= ~PLL_MISC_CPCON_MASK;
1084 val |= sel->cpcon << PLL_MISC_CPCON_SHIFT;
1085 if (c->flags & (PLLU | PLLD)) {
1086 val &= ~PLL_MISC_LFCON_MASK;
1087 if (sel->n >= PLLDU_LFCON_SET_DIVN)
1088 val |= 0x1 << PLL_MISC_LFCON_SHIFT;
1089 } else if (c->flags & (PLLX | PLLM)) {
1090 val &= ~(0x1 << PLL_MISC_DCCON_SHIFT);
1091 if (rate >= (c->u.pll.vco_max >> 1))
1092 val |= 0x1 << PLL_MISC_DCCON_SHIFT;
1093 }
1094 clk_writel(val, c->reg + PLL_MISC(c));
1095 }
1096
1097 if (c->state == ON)
1098 tegra30_pll_clk_enable(c);
1099
1100 return 0;
1101}
1102
1103static struct clk_ops tegra_pll_ops = {
1104 .init = tegra30_pll_clk_init,
1105 .enable = tegra30_pll_clk_enable,
1106 .disable = tegra30_pll_clk_disable,
1107 .set_rate = tegra30_pll_clk_set_rate,
1108};
1109
1110static int
1111tegra30_plld_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting)
1112{
1113 u32 val, mask, reg;
1114
1115 switch (p) {
1116 case TEGRA_CLK_PLLD_CSI_OUT_ENB:
1117 mask = PLLD_BASE_CSI_CLKENABLE;
1118 reg = c->reg + PLL_BASE;
1119 break;
1120 case TEGRA_CLK_PLLD_DSI_OUT_ENB:
1121 mask = PLLD_MISC_DSI_CLKENABLE;
1122 reg = c->reg + PLL_MISC(c);
1123 break;
1124 case TEGRA_CLK_PLLD_MIPI_MUX_SEL:
1125 if (!(c->flags & PLL_ALT_MISC_REG)) {
1126 mask = PLLD_BASE_DSIB_MUX_MASK;
1127 reg = c->reg + PLL_BASE;
1128 break;
1129 }
1130 /* fall through - error since PLLD2 does not have MUX_SEL control */
1131 default:
1132 return -EINVAL;
1133 }
1134
1135 val = clk_readl(reg);
1136 if (setting)
1137 val |= mask;
1138 else
1139 val &= ~mask;
1140 clk_writel(val, reg);
1141 return 0;
1142}
1143
1144static struct clk_ops tegra_plld_ops = {
1145 .init = tegra30_pll_clk_init,
1146 .enable = tegra30_pll_clk_enable,
1147 .disable = tegra30_pll_clk_disable,
1148 .set_rate = tegra30_pll_clk_set_rate,
1149 .clk_cfg_ex = tegra30_plld_clk_cfg_ex,
1150};
1151
1152static void tegra30_plle_clk_init(struct clk *c)
1153{
1154 u32 val;
1155
1156 val = clk_readl(PLLE_AUX);
1157 c->parent = (val & PLLE_AUX_PLLP_SEL) ?
1158 tegra_get_clock_by_name("pll_p") :
1159 tegra_get_clock_by_name("pll_ref");
1160
1161 val = clk_readl(c->reg + PLL_BASE);
1162 c->state = (val & PLLE_BASE_ENABLE) ? ON : OFF;
1163 c->mul = (val & PLLE_BASE_DIVN_MASK) >> PLLE_BASE_DIVN_SHIFT;
1164 c->div = (val & PLLE_BASE_DIVM_MASK) >> PLLE_BASE_DIVM_SHIFT;
1165 c->div *= (val & PLLE_BASE_DIVP_MASK) >> PLLE_BASE_DIVP_SHIFT;
1166}
1167
1168static void tegra30_plle_clk_disable(struct clk *c)
1169{
1170 u32 val;
1171 pr_debug("%s on clock %s\n", __func__, c->name);
1172
1173 val = clk_readl(c->reg + PLL_BASE);
1174 val &= ~(PLLE_BASE_CML_ENABLE | PLLE_BASE_ENABLE);
1175 clk_writel(val, c->reg + PLL_BASE);
1176}
1177
1178static void tegra30_plle_training(struct clk *c)
1179{
1180 u32 val;
1181
1182 /* PLLE is already disabled, and setup cleared;
1183 * create falling edge on PLLE IDDQ input */
1184 val = pmc_readl(PMC_SATA_PWRGT);
1185 val |= PMC_SATA_PWRGT_PLLE_IDDQ_VALUE;
1186 pmc_writel(val, PMC_SATA_PWRGT);
1187
1188 val = pmc_readl(PMC_SATA_PWRGT);
1189 val |= PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL;
1190 pmc_writel(val, PMC_SATA_PWRGT);
1191
1192 val = pmc_readl(PMC_SATA_PWRGT);
1193 val &= ~PMC_SATA_PWRGT_PLLE_IDDQ_VALUE;
1194 pmc_writel(val, PMC_SATA_PWRGT);
1195
1196 do {
1197 val = clk_readl(c->reg + PLL_MISC(c));
1198 } while (!(val & PLLE_MISC_READY));
1199}
1200
1201static int tegra30_plle_configure(struct clk *c, bool force_training)
1202{
1203 u32 val;
1204 const struct clk_pll_freq_table *sel;
1205 unsigned long rate = c->u.pll.fixed_rate;
1206 unsigned long input_rate = clk_get_rate(c->parent);
1207
1208 for (sel = c->u.pll.freq_table; sel->input_rate != 0; sel++) {
1209 if (sel->input_rate == input_rate && sel->output_rate == rate)
1210 break;
1211 }
1212
1213 if (sel->input_rate == 0)
1214 return -ENOSYS;
1215
1216 /* disable PLLE, clear setup fiels */
1217 tegra30_plle_clk_disable(c);
1218
1219 val = clk_readl(c->reg + PLL_MISC(c));
1220 val &= ~(PLLE_MISC_LOCK_ENABLE | PLLE_MISC_SETUP_MASK);
1221 clk_writel(val, c->reg + PLL_MISC(c));
1222
1223 /* training */
1224 val = clk_readl(c->reg + PLL_MISC(c));
1225 if (force_training || (!(val & PLLE_MISC_READY)))
1226 tegra30_plle_training(c);
1227
1228 /* configure dividers, setup, disable SS */
1229 val = clk_readl(c->reg + PLL_BASE);
1230 val &= ~PLLE_BASE_DIV_MASK;
1231 val |= PLLE_BASE_DIV(sel->m, sel->n, sel->p, sel->cpcon);
1232 clk_writel(val, c->reg + PLL_BASE);
1233 c->mul = sel->n;
1234 c->div = sel->m * sel->p;
1235
1236 val = clk_readl(c->reg + PLL_MISC(c));
1237 val |= PLLE_MISC_SETUP_VALUE;
1238 val |= PLLE_MISC_LOCK_ENABLE;
1239 clk_writel(val, c->reg + PLL_MISC(c));
1240
1241 val = clk_readl(PLLE_SS_CTRL);
1242 val |= PLLE_SS_DISABLE;
1243 clk_writel(val, PLLE_SS_CTRL);
1244
1245 /* enable and lock PLLE*/
1246 val = clk_readl(c->reg + PLL_BASE);
1247 val |= (PLLE_BASE_CML_ENABLE | PLLE_BASE_ENABLE);
1248 clk_writel(val, c->reg + PLL_BASE);
1249
1250 tegra30_pll_clk_wait_for_lock(c, c->reg + PLL_MISC(c), PLLE_MISC_LOCK);
1251
1252 return 0;
1253}
1254
1255static int tegra30_plle_clk_enable(struct clk *c)
1256{
1257 pr_debug("%s on clock %s\n", __func__, c->name);
1258 return tegra30_plle_configure(c, !c->set);
1259}
1260
1261static struct clk_ops tegra_plle_ops = {
1262 .init = tegra30_plle_clk_init,
1263 .enable = tegra30_plle_clk_enable,
1264 .disable = tegra30_plle_clk_disable,
1265};
1266
1267/* Clock divider ops */
1268static void tegra30_pll_div_clk_init(struct clk *c)
1269{
1270 if (c->flags & DIV_U71) {
1271 u32 divu71;
1272 u32 val = clk_readl(c->reg);
1273 val >>= c->reg_shift;
1274 c->state = (val & PLL_OUT_CLKEN) ? ON : OFF;
1275 if (!(val & PLL_OUT_RESET_DISABLE))
1276 c->state = OFF;
1277
1278 divu71 = (val & PLL_OUT_RATIO_MASK) >> PLL_OUT_RATIO_SHIFT;
1279 c->div = (divu71 + 2);
1280 c->mul = 2;
1281 } else if (c->flags & DIV_2) {
1282 c->state = ON;
1283 if (c->flags & (PLLD | PLLX)) {
1284 c->div = 2;
1285 c->mul = 1;
1286 } else
1287 BUG();
1288 } else {
1289 c->state = ON;
1290 c->div = 1;
1291 c->mul = 1;
1292 }
1293}
1294
1295static int tegra30_pll_div_clk_enable(struct clk *c)
1296{
1297 u32 val;
1298 u32 new_val;
1299
1300 pr_debug("%s: %s\n", __func__, c->name);
1301 if (c->flags & DIV_U71) {
1302 val = clk_readl(c->reg);
1303 new_val = val >> c->reg_shift;
1304 new_val &= 0xFFFF;
1305
1306 new_val |= PLL_OUT_CLKEN | PLL_OUT_RESET_DISABLE;
1307
1308 val &= ~(0xFFFF << c->reg_shift);
1309 val |= new_val << c->reg_shift;
1310 clk_writel_delay(val, c->reg);
1311 return 0;
1312 } else if (c->flags & DIV_2) {
1313 return 0;
1314 }
1315 return -EINVAL;
1316}
1317
1318static void tegra30_pll_div_clk_disable(struct clk *c)
1319{
1320 u32 val;
1321 u32 new_val;
1322
1323 pr_debug("%s: %s\n", __func__, c->name);
1324 if (c->flags & DIV_U71) {
1325 val = clk_readl(c->reg);
1326 new_val = val >> c->reg_shift;
1327 new_val &= 0xFFFF;
1328
1329 new_val &= ~(PLL_OUT_CLKEN | PLL_OUT_RESET_DISABLE);
1330
1331 val &= ~(0xFFFF << c->reg_shift);
1332 val |= new_val << c->reg_shift;
1333 clk_writel_delay(val, c->reg);
1334 }
1335}
1336
1337static int tegra30_pll_div_clk_set_rate(struct clk *c, unsigned long rate)
1338{
1339 u32 val;
1340 u32 new_val;
1341 int divider_u71;
1342 unsigned long parent_rate = clk_get_rate(c->parent);
1343
1344 pr_debug("%s: %s %lu\n", __func__, c->name, rate);
1345 if (c->flags & DIV_U71) {
1346 divider_u71 = clk_div71_get_divider(
1347 parent_rate, rate, c->flags, ROUND_DIVIDER_UP);
1348 if (divider_u71 >= 0) {
1349 val = clk_readl(c->reg);
1350 new_val = val >> c->reg_shift;
1351 new_val &= 0xFFFF;
1352 if (c->flags & DIV_U71_FIXED)
1353 new_val |= PLL_OUT_OVERRIDE;
1354 new_val &= ~PLL_OUT_RATIO_MASK;
1355 new_val |= divider_u71 << PLL_OUT_RATIO_SHIFT;
1356
1357 val &= ~(0xFFFF << c->reg_shift);
1358 val |= new_val << c->reg_shift;
1359 clk_writel_delay(val, c->reg);
1360 c->div = divider_u71 + 2;
1361 c->mul = 2;
1362 return 0;
1363 }
1364 } else if (c->flags & DIV_2)
1365 return clk_set_rate(c->parent, rate * 2);
1366
1367 return -EINVAL;
1368}
1369
1370static long tegra30_pll_div_clk_round_rate(struct clk *c, unsigned long rate)
1371{
1372 int divider;
1373 unsigned long parent_rate = clk_get_rate(c->parent);
1374 pr_debug("%s: %s %lu\n", __func__, c->name, rate);
1375
1376 if (c->flags & DIV_U71) {
1377 divider = clk_div71_get_divider(
1378 parent_rate, rate, c->flags, ROUND_DIVIDER_UP);
1379 if (divider < 0)
1380 return divider;
1381 return DIV_ROUND_UP(parent_rate * 2, divider + 2);
1382 } else if (c->flags & DIV_2)
1383 /* no rounding - fixed DIV_2 dividers pass rate to parent PLL */
1384 return rate;
1385
1386 return -EINVAL;
1387}
1388
1389static struct clk_ops tegra_pll_div_ops = {
1390 .init = tegra30_pll_div_clk_init,
1391 .enable = tegra30_pll_div_clk_enable,
1392 .disable = tegra30_pll_div_clk_disable,
1393 .set_rate = tegra30_pll_div_clk_set_rate,
1394 .round_rate = tegra30_pll_div_clk_round_rate,
1395};
1396
1397/* Periph clk ops */
1398static inline u32 periph_clk_source_mask(struct clk *c)
1399{
1400 if (c->flags & MUX8)
1401 return 7 << 29;
1402 else if (c->flags & MUX_PWM)
1403 return 3 << 28;
1404 else if (c->flags & MUX_CLK_OUT)
1405 return 3 << (c->u.periph.clk_num + 4);
1406 else if (c->flags & PLLD)
1407 return PLLD_BASE_DSIB_MUX_MASK;
1408 else
1409 return 3 << 30;
1410}
1411
1412static inline u32 periph_clk_source_shift(struct clk *c)
1413{
1414 if (c->flags & MUX8)
1415 return 29;
1416 else if (c->flags & MUX_PWM)
1417 return 28;
1418 else if (c->flags & MUX_CLK_OUT)
1419 return c->u.periph.clk_num + 4;
1420 else if (c->flags & PLLD)
1421 return PLLD_BASE_DSIB_MUX_SHIFT;
1422 else
1423 return 30;
1424}
1425
1426static void tegra30_periph_clk_init(struct clk *c)
1427{
1428 u32 val = clk_readl(c->reg);
1429 const struct clk_mux_sel *mux = 0;
1430 const struct clk_mux_sel *sel;
1431 if (c->flags & MUX) {
1432 for (sel = c->inputs; sel->input != NULL; sel++) {
1433 if (((val & periph_clk_source_mask(c)) >>
1434 periph_clk_source_shift(c)) == sel->value)
1435 mux = sel;
1436 }
1437 BUG_ON(!mux);
1438
1439 c->parent = mux->input;
1440 } else {
1441 c->parent = c->inputs[0].input;
1442 }
1443
1444 if (c->flags & DIV_U71) {
1445 u32 divu71 = val & PERIPH_CLK_SOURCE_DIVU71_MASK;
1446 if ((c->flags & DIV_U71_UART) &&
1447 (!(val & PERIPH_CLK_UART_DIV_ENB))) {
1448 divu71 = 0;
1449 }
1450 if (c->flags & DIV_U71_IDLE) {
1451 val &= ~(PERIPH_CLK_SOURCE_DIVU71_MASK <<
1452 PERIPH_CLK_SOURCE_DIVIDLE_SHIFT);
1453 val |= (PERIPH_CLK_SOURCE_DIVIDLE_VAL <<
1454 PERIPH_CLK_SOURCE_DIVIDLE_SHIFT);
1455 clk_writel(val, c->reg);
1456 }
1457 c->div = divu71 + 2;
1458 c->mul = 2;
1459 } else if (c->flags & DIV_U16) {
1460 u32 divu16 = val & PERIPH_CLK_SOURCE_DIVU16_MASK;
1461 c->div = divu16 + 1;
1462 c->mul = 1;
1463 } else {
1464 c->div = 1;
1465 c->mul = 1;
1466 }
1467
1468 c->state = ON;
1469 if (!(clk_readl(PERIPH_CLK_TO_ENB_REG(c)) & PERIPH_CLK_TO_BIT(c)))
1470 c->state = OFF;
1471 if (!(c->flags & PERIPH_NO_RESET))
1472 if (clk_readl(PERIPH_CLK_TO_RST_REG(c)) & PERIPH_CLK_TO_BIT(c))
1473 c->state = OFF;
1474}
1475
1476static int tegra30_periph_clk_enable(struct clk *c)
1477{
1478 pr_debug("%s on clock %s\n", __func__, c->name);
1479
1480 tegra_periph_clk_enable_refcount[c->u.periph.clk_num]++;
1481 if (tegra_periph_clk_enable_refcount[c->u.periph.clk_num] > 1)
1482 return 0;
1483
1484 clk_writel_delay(PERIPH_CLK_TO_BIT(c), PERIPH_CLK_TO_ENB_SET_REG(c));
1485 if (!(c->flags & PERIPH_NO_RESET) &&
1486 !(c->flags & PERIPH_MANUAL_RESET)) {
1487 if (clk_readl(PERIPH_CLK_TO_RST_REG(c)) &
1488 PERIPH_CLK_TO_BIT(c)) {
1489 udelay(5); /* reset propagation delay */
1490 clk_writel(PERIPH_CLK_TO_BIT(c),
1491 PERIPH_CLK_TO_RST_CLR_REG(c));
1492 }
1493 }
1494 return 0;
1495}
1496
1497static void tegra30_periph_clk_disable(struct clk *c)
1498{
1499 unsigned long val;
1500 pr_debug("%s on clock %s\n", __func__, c->name);
1501
1502 if (c->refcnt)
1503 tegra_periph_clk_enable_refcount[c->u.periph.clk_num]--;
1504
1505 if (tegra_periph_clk_enable_refcount[c->u.periph.clk_num] == 0) {
1506 /* If peripheral is in the APB bus then read the APB bus to
1507 * flush the write operation in apb bus. This will avoid the
1508 * peripheral access after disabling clock*/
1509 if (c->flags & PERIPH_ON_APB)
1510 val = chipid_readl();
1511
1512 clk_writel_delay(
1513 PERIPH_CLK_TO_BIT(c), PERIPH_CLK_TO_ENB_CLR_REG(c));
1514 }
1515}
1516
1517static void tegra30_periph_clk_reset(struct clk *c, bool assert)
1518{
1519 unsigned long val;
1520 pr_debug("%s %s on clock %s\n", __func__,
1521 assert ? "assert" : "deassert", c->name);
1522
1523 if (!(c->flags & PERIPH_NO_RESET)) {
1524 if (assert) {
1525 /* If peripheral is in the APB bus then read the APB
1526 * bus to flush the write operation in apb bus. This
1527 * will avoid the peripheral access after disabling
1528 * clock */
1529 if (c->flags & PERIPH_ON_APB)
1530 val = chipid_readl();
1531
1532 clk_writel(PERIPH_CLK_TO_BIT(c),
1533 PERIPH_CLK_TO_RST_SET_REG(c));
1534 } else
1535 clk_writel(PERIPH_CLK_TO_BIT(c),
1536 PERIPH_CLK_TO_RST_CLR_REG(c));
1537 }
1538}
1539
1540static int tegra30_periph_clk_set_parent(struct clk *c, struct clk *p)
1541{
1542 u32 val;
1543 const struct clk_mux_sel *sel;
1544 pr_debug("%s: %s %s\n", __func__, c->name, p->name);
1545
1546 if (!(c->flags & MUX))
1547 return (p == c->parent) ? 0 : (-EINVAL);
1548
1549 for (sel = c->inputs; sel->input != NULL; sel++) {
1550 if (sel->input == p) {
1551 val = clk_readl(c->reg);
1552 val &= ~periph_clk_source_mask(c);
1553 val |= (sel->value << periph_clk_source_shift(c));
1554
1555 if (c->refcnt)
1556 clk_enable(p);
1557
1558 clk_writel_delay(val, c->reg);
1559
1560 if (c->refcnt && c->parent)
1561 clk_disable(c->parent);
1562
1563 clk_reparent(c, p);
1564 return 0;
1565 }
1566 }
1567
1568 return -EINVAL;
1569}
1570
1571static int tegra30_periph_clk_set_rate(struct clk *c, unsigned long rate)
1572{
1573 u32 val;
1574 int divider;
1575 unsigned long parent_rate = clk_get_rate(c->parent);
1576
1577 if (c->flags & DIV_U71) {
1578 divider = clk_div71_get_divider(
1579 parent_rate, rate, c->flags, ROUND_DIVIDER_UP);
1580 if (divider >= 0) {
1581 val = clk_readl(c->reg);
1582 val &= ~PERIPH_CLK_SOURCE_DIVU71_MASK;
1583 val |= divider;
1584 if (c->flags & DIV_U71_UART) {
1585 if (divider)
1586 val |= PERIPH_CLK_UART_DIV_ENB;
1587 else
1588 val &= ~PERIPH_CLK_UART_DIV_ENB;
1589 }
1590 clk_writel_delay(val, c->reg);
1591 c->div = divider + 2;
1592 c->mul = 2;
1593 return 0;
1594 }
1595 } else if (c->flags & DIV_U16) {
1596 divider = clk_div16_get_divider(parent_rate, rate);
1597 if (divider >= 0) {
1598 val = clk_readl(c->reg);
1599 val &= ~PERIPH_CLK_SOURCE_DIVU16_MASK;
1600 val |= divider;
1601 clk_writel_delay(val, c->reg);
1602 c->div = divider + 1;
1603 c->mul = 1;
1604 return 0;
1605 }
1606 } else if (parent_rate <= rate) {
1607 c->div = 1;
1608 c->mul = 1;
1609 return 0;
1610 }
1611 return -EINVAL;
1612}
1613
1614static long tegra30_periph_clk_round_rate(struct clk *c,
1615 unsigned long rate)
1616{
1617 int divider;
1618 unsigned long parent_rate = clk_get_rate(c->parent);
1619 pr_debug("%s: %s %lu\n", __func__, c->name, rate);
1620
1621 if (c->flags & DIV_U71) {
1622 divider = clk_div71_get_divider(
1623 parent_rate, rate, c->flags, ROUND_DIVIDER_UP);
1624 if (divider < 0)
1625 return divider;
1626
1627 return DIV_ROUND_UP(parent_rate * 2, divider + 2);
1628 } else if (c->flags & DIV_U16) {
1629 divider = clk_div16_get_divider(parent_rate, rate);
1630 if (divider < 0)
1631 return divider;
1632 return DIV_ROUND_UP(parent_rate, divider + 1);
1633 }
1634 return -EINVAL;
1635}
1636
1637static struct clk_ops tegra_periph_clk_ops = {
1638 .init = &tegra30_periph_clk_init,
1639 .enable = &tegra30_periph_clk_enable,
1640 .disable = &tegra30_periph_clk_disable,
1641 .set_parent = &tegra30_periph_clk_set_parent,
1642 .set_rate = &tegra30_periph_clk_set_rate,
1643 .round_rate = &tegra30_periph_clk_round_rate,
1644 .reset = &tegra30_periph_clk_reset,
1645};
1646
1647
1648/* Periph extended clock configuration ops */
1649static int
1650tegra30_vi_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting)
1651{
1652 if (p == TEGRA_CLK_VI_INP_SEL) {
1653 u32 val = clk_readl(c->reg);
1654 val &= ~PERIPH_CLK_VI_SEL_EX_MASK;
1655 val |= (setting << PERIPH_CLK_VI_SEL_EX_SHIFT) &
1656 PERIPH_CLK_VI_SEL_EX_MASK;
1657 clk_writel(val, c->reg);
1658 return 0;
1659 }
1660 return -EINVAL;
1661}
1662
1663static struct clk_ops tegra_vi_clk_ops = {
1664 .init = &tegra30_periph_clk_init,
1665 .enable = &tegra30_periph_clk_enable,
1666 .disable = &tegra30_periph_clk_disable,
1667 .set_parent = &tegra30_periph_clk_set_parent,
1668 .set_rate = &tegra30_periph_clk_set_rate,
1669 .round_rate = &tegra30_periph_clk_round_rate,
1670 .clk_cfg_ex = &tegra30_vi_clk_cfg_ex,
1671 .reset = &tegra30_periph_clk_reset,
1672};
1673
1674static int
1675tegra30_nand_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting)
1676{
1677 if (p == TEGRA_CLK_NAND_PAD_DIV2_ENB) {
1678 u32 val = clk_readl(c->reg);
1679 if (setting)
1680 val |= PERIPH_CLK_NAND_DIV_EX_ENB;
1681 else
1682 val &= ~PERIPH_CLK_NAND_DIV_EX_ENB;
1683 clk_writel(val, c->reg);
1684 return 0;
1685 }
1686 return -EINVAL;
1687}
1688
1689static struct clk_ops tegra_nand_clk_ops = {
1690 .init = &tegra30_periph_clk_init,
1691 .enable = &tegra30_periph_clk_enable,
1692 .disable = &tegra30_periph_clk_disable,
1693 .set_parent = &tegra30_periph_clk_set_parent,
1694 .set_rate = &tegra30_periph_clk_set_rate,
1695 .round_rate = &tegra30_periph_clk_round_rate,
1696 .clk_cfg_ex = &tegra30_nand_clk_cfg_ex,
1697 .reset = &tegra30_periph_clk_reset,
1698};
1699
1700
1701static int
1702tegra30_dtv_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting)
1703{
1704 if (p == TEGRA_CLK_DTV_INVERT) {
1705 u32 val = clk_readl(c->reg);
1706 if (setting)
1707 val |= PERIPH_CLK_DTV_POLARITY_INV;
1708 else
1709 val &= ~PERIPH_CLK_DTV_POLARITY_INV;
1710 clk_writel(val, c->reg);
1711 return 0;
1712 }
1713 return -EINVAL;
1714}
1715
1716static struct clk_ops tegra_dtv_clk_ops = {
1717 .init = &tegra30_periph_clk_init,
1718 .enable = &tegra30_periph_clk_enable,
1719 .disable = &tegra30_periph_clk_disable,
1720 .set_parent = &tegra30_periph_clk_set_parent,
1721 .set_rate = &tegra30_periph_clk_set_rate,
1722 .round_rate = &tegra30_periph_clk_round_rate,
1723 .clk_cfg_ex = &tegra30_dtv_clk_cfg_ex,
1724 .reset = &tegra30_periph_clk_reset,
1725};
1726
1727static int tegra30_dsib_clk_set_parent(struct clk *c, struct clk *p)
1728{
1729 const struct clk_mux_sel *sel;
1730 struct clk *d = tegra_get_clock_by_name("pll_d");
1731
1732 pr_debug("%s: %s %s\n", __func__, c->name, p->name);
1733
1734 for (sel = c->inputs; sel->input != NULL; sel++) {
1735 if (sel->input == p) {
1736 if (c->refcnt)
1737 clk_enable(p);
1738
1739 /* The DSIB parent selection bit is in PLLD base
1740 register - can not do direct r-m-w, must be
1741 protected by PLLD lock */
1742 tegra_clk_cfg_ex(
1743 d, TEGRA_CLK_PLLD_MIPI_MUX_SEL, sel->value);
1744
1745 if (c->refcnt && c->parent)
1746 clk_disable(c->parent);
1747
1748 clk_reparent(c, p);
1749 return 0;
1750 }
1751 }
1752
1753 return -EINVAL;
1754}
1755
1756static struct clk_ops tegra_dsib_clk_ops = {
1757 .init = &tegra30_periph_clk_init,
1758 .enable = &tegra30_periph_clk_enable,
1759 .disable = &tegra30_periph_clk_disable,
1760 .set_parent = &tegra30_dsib_clk_set_parent,
1761 .set_rate = &tegra30_periph_clk_set_rate,
1762 .round_rate = &tegra30_periph_clk_round_rate,
1763 .reset = &tegra30_periph_clk_reset,
1764};
1765
1766/* pciex clock support only reset function */
1767static struct clk_ops tegra_pciex_clk_ops = {
1768 .reset = tegra30_periph_clk_reset,
1769};
1770
1771/* Output clock ops */
1772
1773static DEFINE_SPINLOCK(clk_out_lock);
1774
1775static void tegra30_clk_out_init(struct clk *c)
1776{
1777 const struct clk_mux_sel *mux = 0;
1778 const struct clk_mux_sel *sel;
1779 u32 val = pmc_readl(c->reg);
1780
1781 c->state = (val & (0x1 << c->u.periph.clk_num)) ? ON : OFF;
1782 c->mul = 1;
1783 c->div = 1;
1784
1785 for (sel = c->inputs; sel->input != NULL; sel++) {
1786 if (((val & periph_clk_source_mask(c)) >>
1787 periph_clk_source_shift(c)) == sel->value)
1788 mux = sel;
1789 }
1790 BUG_ON(!mux);
1791 c->parent = mux->input;
1792}
1793
1794static int tegra30_clk_out_enable(struct clk *c)
1795{
1796 u32 val;
1797 unsigned long flags;
1798
1799 pr_debug("%s on clock %s\n", __func__, c->name);
1800
1801 spin_lock_irqsave(&clk_out_lock, flags);
1802 val = pmc_readl(c->reg);
1803 val |= (0x1 << c->u.periph.clk_num);
1804 pmc_writel(val, c->reg);
1805 spin_unlock_irqrestore(&clk_out_lock, flags);
1806
1807 return 0;
1808}
1809
1810static void tegra30_clk_out_disable(struct clk *c)
1811{
1812 u32 val;
1813 unsigned long flags;
1814
1815 pr_debug("%s on clock %s\n", __func__, c->name);
1816
1817 spin_lock_irqsave(&clk_out_lock, flags);
1818 val = pmc_readl(c->reg);
1819 val &= ~(0x1 << c->u.periph.clk_num);
1820 pmc_writel(val, c->reg);
1821 spin_unlock_irqrestore(&clk_out_lock, flags);
1822}
1823
1824static int tegra30_clk_out_set_parent(struct clk *c, struct clk *p)
1825{
1826 u32 val;
1827 unsigned long flags;
1828 const struct clk_mux_sel *sel;
1829
1830 pr_debug("%s: %s %s\n", __func__, c->name, p->name);
1831
1832 for (sel = c->inputs; sel->input != NULL; sel++) {
1833 if (sel->input == p) {
1834 if (c->refcnt)
1835 clk_enable(p);
1836
1837 spin_lock_irqsave(&clk_out_lock, flags);
1838 val = pmc_readl(c->reg);
1839 val &= ~periph_clk_source_mask(c);
1840 val |= (sel->value << periph_clk_source_shift(c));
1841 pmc_writel(val, c->reg);
1842 spin_unlock_irqrestore(&clk_out_lock, flags);
1843
1844 if (c->refcnt && c->parent)
1845 clk_disable(c->parent);
1846
1847 clk_reparent(c, p);
1848 return 0;
1849 }
1850 }
1851 return -EINVAL;
1852}
1853
1854static struct clk_ops tegra_clk_out_ops = {
1855 .init = &tegra30_clk_out_init,
1856 .enable = &tegra30_clk_out_enable,
1857 .disable = &tegra30_clk_out_disable,
1858 .set_parent = &tegra30_clk_out_set_parent,
1859};
1860
1861
1862/* Clock doubler ops */
1863static void tegra30_clk_double_init(struct clk *c)
1864{
1865 u32 val = clk_readl(c->reg);
1866 c->mul = val & (0x1 << c->reg_shift) ? 1 : 2;
1867 c->div = 1;
1868 c->state = ON;
1869 if (!(clk_readl(PERIPH_CLK_TO_ENB_REG(c)) & PERIPH_CLK_TO_BIT(c)))
1870 c->state = OFF;
1871};
1872
1873static int tegra30_clk_double_set_rate(struct clk *c, unsigned long rate)
1874{
1875 u32 val;
1876 unsigned long parent_rate = clk_get_rate(c->parent);
1877 if (rate == parent_rate) {
1878 val = clk_readl(c->reg) | (0x1 << c->reg_shift);
1879 clk_writel(val, c->reg);
1880 c->mul = 1;
1881 c->div = 1;
1882 return 0;
1883 } else if (rate == 2 * parent_rate) {
1884 val = clk_readl(c->reg) & (~(0x1 << c->reg_shift));
1885 clk_writel(val, c->reg);
1886 c->mul = 2;
1887 c->div = 1;
1888 return 0;
1889 }
1890 return -EINVAL;
1891}
1892
1893static struct clk_ops tegra_clk_double_ops = {
1894 .init = &tegra30_clk_double_init,
1895 .enable = &tegra30_periph_clk_enable,
1896 .disable = &tegra30_periph_clk_disable,
1897 .set_rate = &tegra30_clk_double_set_rate,
1898};
1899
1900/* Audio sync clock ops */
1901static int tegra30_sync_source_set_rate(struct clk *c, unsigned long rate)
1902{
1903 c->rate = rate;
1904 return 0;
1905}
1906
1907static struct clk_ops tegra_sync_source_ops = {
1908 .set_rate = &tegra30_sync_source_set_rate,
1909};
1910
1911static void tegra30_audio_sync_clk_init(struct clk *c)
1912{
1913 int source;
1914 const struct clk_mux_sel *sel;
1915 u32 val = clk_readl(c->reg);
1916 c->state = (val & AUDIO_SYNC_DISABLE_BIT) ? OFF : ON;
1917 source = val & AUDIO_SYNC_SOURCE_MASK;
1918 for (sel = c->inputs; sel->input != NULL; sel++)
1919 if (sel->value == source)
1920 break;
1921 BUG_ON(sel->input == NULL);
1922 c->parent = sel->input;
1923}
1924
1925static int tegra30_audio_sync_clk_enable(struct clk *c)
1926{
1927 u32 val = clk_readl(c->reg);
1928 clk_writel((val & (~AUDIO_SYNC_DISABLE_BIT)), c->reg);
1929 return 0;
1930}
1931
1932static void tegra30_audio_sync_clk_disable(struct clk *c)
1933{
1934 u32 val = clk_readl(c->reg);
1935 clk_writel((val | AUDIO_SYNC_DISABLE_BIT), c->reg);
1936}
1937
1938static int tegra30_audio_sync_clk_set_parent(struct clk *c, struct clk *p)
1939{
1940 u32 val;
1941 const struct clk_mux_sel *sel;
1942 for (sel = c->inputs; sel->input != NULL; sel++) {
1943 if (sel->input == p) {
1944 val = clk_readl(c->reg);
1945 val &= ~AUDIO_SYNC_SOURCE_MASK;
1946 val |= sel->value;
1947
1948 if (c->refcnt)
1949 clk_enable(p);
1950
1951 clk_writel(val, c->reg);
1952
1953 if (c->refcnt && c->parent)
1954 clk_disable(c->parent);
1955
1956 clk_reparent(c, p);
1957 return 0;
1958 }
1959 }
1960
1961 return -EINVAL;
1962}
1963
1964static struct clk_ops tegra_audio_sync_clk_ops = {
1965 .init = tegra30_audio_sync_clk_init,
1966 .enable = tegra30_audio_sync_clk_enable,
1967 .disable = tegra30_audio_sync_clk_disable,
1968 .set_parent = tegra30_audio_sync_clk_set_parent,
1969};
1970
1971/* cml0 (pcie), and cml1 (sata) clock ops */
1972static void tegra30_cml_clk_init(struct clk *c)
1973{
1974 u32 val = clk_readl(c->reg);
1975 c->state = val & (0x1 << c->u.periph.clk_num) ? ON : OFF;
1976}
1977
1978static int tegra30_cml_clk_enable(struct clk *c)
1979{
1980 u32 val = clk_readl(c->reg);
1981 val |= (0x1 << c->u.periph.clk_num);
1982 clk_writel(val, c->reg);
1983 return 0;
1984}
1985
1986static void tegra30_cml_clk_disable(struct clk *c)
1987{
1988 u32 val = clk_readl(c->reg);
1989 val &= ~(0x1 << c->u.periph.clk_num);
1990 clk_writel(val, c->reg);
1991}
1992
1993static struct clk_ops tegra_cml_clk_ops = {
1994 .init = &tegra30_cml_clk_init,
1995 .enable = &tegra30_cml_clk_enable,
1996 .disable = &tegra30_cml_clk_disable,
1997};
1998
1999/* Clock definitions */
2000static struct clk tegra_clk_32k = {
2001 .name = "clk_32k",
2002 .rate = 32768,
2003 .ops = NULL,
2004 .max_rate = 32768,
2005};
2006
2007static struct clk tegra_clk_m = {
2008 .name = "clk_m",
2009 .flags = ENABLE_ON_INIT,
2010 .ops = &tegra_clk_m_ops,
2011 .reg = 0x1fc,
2012 .reg_shift = 28,
2013 .max_rate = 48000000,
2014};
2015
2016static struct clk tegra_clk_m_div2 = {
2017 .name = "clk_m_div2",
2018 .ops = &tegra_clk_m_div_ops,
2019 .parent = &tegra_clk_m,
2020 .mul = 1,
2021 .div = 2,
2022 .state = ON,
2023 .max_rate = 24000000,
2024};
2025
2026static struct clk tegra_clk_m_div4 = {
2027 .name = "clk_m_div4",
2028 .ops = &tegra_clk_m_div_ops,
2029 .parent = &tegra_clk_m,
2030 .mul = 1,
2031 .div = 4,
2032 .state = ON,
2033 .max_rate = 12000000,
2034};
2035
2036static struct clk tegra_pll_ref = {
2037 .name = "pll_ref",
2038 .flags = ENABLE_ON_INIT,
2039 .ops = &tegra_pll_ref_ops,
2040 .parent = &tegra_clk_m,
2041 .max_rate = 26000000,
2042};
2043
2044static struct clk_pll_freq_table tegra_pll_c_freq_table[] = {
2045 { 12000000, 1040000000, 520, 6, 1, 8},
2046 { 13000000, 1040000000, 480, 6, 1, 8},
2047 { 16800000, 1040000000, 495, 8, 1, 8}, /* actual: 1039.5 MHz */
2048 { 19200000, 1040000000, 325, 6, 1, 6},
2049 { 26000000, 1040000000, 520, 13, 1, 8},
2050
2051 { 12000000, 832000000, 416, 6, 1, 8},
2052 { 13000000, 832000000, 832, 13, 1, 8},
2053 { 16800000, 832000000, 396, 8, 1, 8}, /* actual: 831.6 MHz */
2054 { 19200000, 832000000, 260, 6, 1, 8},
2055 { 26000000, 832000000, 416, 13, 1, 8},
2056
2057 { 12000000, 624000000, 624, 12, 1, 8},
2058 { 13000000, 624000000, 624, 13, 1, 8},
2059 { 16800000, 600000000, 520, 14, 1, 8},
2060 { 19200000, 624000000, 520, 16, 1, 8},
2061 { 26000000, 624000000, 624, 26, 1, 8},
2062
2063 { 12000000, 600000000, 600, 12, 1, 8},
2064 { 13000000, 600000000, 600, 13, 1, 8},
2065 { 16800000, 600000000, 500, 14, 1, 8},
2066 { 19200000, 600000000, 375, 12, 1, 6},
2067 { 26000000, 600000000, 600, 26, 1, 8},
2068
2069 { 12000000, 520000000, 520, 12, 1, 8},
2070 { 13000000, 520000000, 520, 13, 1, 8},
2071 { 16800000, 520000000, 495, 16, 1, 8}, /* actual: 519.75 MHz */
2072 { 19200000, 520000000, 325, 12, 1, 6},
2073 { 26000000, 520000000, 520, 26, 1, 8},
2074
2075 { 12000000, 416000000, 416, 12, 1, 8},
2076 { 13000000, 416000000, 416, 13, 1, 8},
2077 { 16800000, 416000000, 396, 16, 1, 8}, /* actual: 415.8 MHz */
2078 { 19200000, 416000000, 260, 12, 1, 6},
2079 { 26000000, 416000000, 416, 26, 1, 8},
2080 { 0, 0, 0, 0, 0, 0 },
2081};
2082
2083static struct clk tegra_pll_c = {
2084 .name = "pll_c",
2085 .flags = PLL_HAS_CPCON,
2086 .ops = &tegra_pll_ops,
2087 .reg = 0x80,
2088 .parent = &tegra_pll_ref,
2089 .max_rate = 1400000000,
2090 .u.pll = {
2091 .input_min = 2000000,
2092 .input_max = 31000000,
2093 .cf_min = 1000000,
2094 .cf_max = 6000000,
2095 .vco_min = 20000000,
2096 .vco_max = 1400000000,
2097 .freq_table = tegra_pll_c_freq_table,
2098 .lock_delay = 300,
2099 },
2100};
2101
2102static struct clk tegra_pll_c_out1 = {
2103 .name = "pll_c_out1",
2104 .ops = &tegra_pll_div_ops,
2105 .flags = DIV_U71,
2106 .parent = &tegra_pll_c,
2107 .reg = 0x84,
2108 .reg_shift = 0,
2109 .max_rate = 700000000,
2110};
2111
2112static struct clk_pll_freq_table tegra_pll_m_freq_table[] = {
2113 { 12000000, 666000000, 666, 12, 1, 8},
2114 { 13000000, 666000000, 666, 13, 1, 8},
2115 { 16800000, 666000000, 555, 14, 1, 8},
2116 { 19200000, 666000000, 555, 16, 1, 8},
2117 { 26000000, 666000000, 666, 26, 1, 8},
2118 { 12000000, 600000000, 600, 12, 1, 8},
2119 { 13000000, 600000000, 600, 13, 1, 8},
2120 { 16800000, 600000000, 500, 14, 1, 8},
2121 { 19200000, 600000000, 375, 12, 1, 6},
2122 { 26000000, 600000000, 600, 26, 1, 8},
2123 { 0, 0, 0, 0, 0, 0 },
2124};
2125
2126static struct clk tegra_pll_m = {
2127 .name = "pll_m",
2128 .flags = PLL_HAS_CPCON | PLLM,
2129 .ops = &tegra_pll_ops,
2130 .reg = 0x90,
2131 .parent = &tegra_pll_ref,
2132 .max_rate = 800000000,
2133 .u.pll = {
2134 .input_min = 2000000,
2135 .input_max = 31000000,
2136 .cf_min = 1000000,
2137 .cf_max = 6000000,
2138 .vco_min = 20000000,
2139 .vco_max = 1200000000,
2140 .freq_table = tegra_pll_m_freq_table,
2141 .lock_delay = 300,
2142 },
2143};
2144
2145static struct clk tegra_pll_m_out1 = {
2146 .name = "pll_m_out1",
2147 .ops = &tegra_pll_div_ops,
2148 .flags = DIV_U71,
2149 .parent = &tegra_pll_m,
2150 .reg = 0x94,
2151 .reg_shift = 0,
2152 .max_rate = 600000000,
2153};
2154
2155static struct clk_pll_freq_table tegra_pll_p_freq_table[] = {
2156 { 12000000, 216000000, 432, 12, 2, 8},
2157 { 13000000, 216000000, 432, 13, 2, 8},
2158 { 16800000, 216000000, 360, 14, 2, 8},
2159 { 19200000, 216000000, 360, 16, 2, 8},
2160 { 26000000, 216000000, 432, 26, 2, 8},
2161 { 0, 0, 0, 0, 0, 0 },
2162};
2163
2164static struct clk tegra_pll_p = {
2165 .name = "pll_p",
2166 .flags = ENABLE_ON_INIT | PLL_FIXED | PLL_HAS_CPCON,
2167 .ops = &tegra_pll_ops,
2168 .reg = 0xa0,
2169 .parent = &tegra_pll_ref,
2170 .max_rate = 432000000,
2171 .u.pll = {
2172 .input_min = 2000000,
2173 .input_max = 31000000,
2174 .cf_min = 1000000,
2175 .cf_max = 6000000,
2176 .vco_min = 20000000,
2177 .vco_max = 1400000000,
2178 .freq_table = tegra_pll_p_freq_table,
2179 .lock_delay = 300,
2180 .fixed_rate = 408000000,
2181 },
2182};
2183
2184static struct clk tegra_pll_p_out1 = {
2185 .name = "pll_p_out1",
2186 .ops = &tegra_pll_div_ops,
2187 .flags = ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED,
2188 .parent = &tegra_pll_p,
2189 .reg = 0xa4,
2190 .reg_shift = 0,
2191 .max_rate = 432000000,
2192};
2193
2194static struct clk tegra_pll_p_out2 = {
2195 .name = "pll_p_out2",
2196 .ops = &tegra_pll_div_ops,
2197 .flags = ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED,
2198 .parent = &tegra_pll_p,
2199 .reg = 0xa4,
2200 .reg_shift = 16,
2201 .max_rate = 432000000,
2202};
2203
2204static struct clk tegra_pll_p_out3 = {
2205 .name = "pll_p_out3",
2206 .ops = &tegra_pll_div_ops,
2207 .flags = ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED,
2208 .parent = &tegra_pll_p,
2209 .reg = 0xa8,
2210 .reg_shift = 0,
2211 .max_rate = 432000000,
2212};
2213
2214static struct clk tegra_pll_p_out4 = {
2215 .name = "pll_p_out4",
2216 .ops = &tegra_pll_div_ops,
2217 .flags = ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED,
2218 .parent = &tegra_pll_p,
2219 .reg = 0xa8,
2220 .reg_shift = 16,
2221 .max_rate = 432000000,
2222};
2223
2224static struct clk_pll_freq_table tegra_pll_a_freq_table[] = {
2225 { 9600000, 564480000, 294, 5, 1, 4},
2226 { 9600000, 552960000, 288, 5, 1, 4},
2227 { 9600000, 24000000, 5, 2, 1, 1},
2228
2229 { 28800000, 56448000, 49, 25, 1, 1},
2230 { 28800000, 73728000, 64, 25, 1, 1},
2231 { 28800000, 24000000, 5, 6, 1, 1},
2232 { 0, 0, 0, 0, 0, 0 },
2233};
2234
2235static struct clk tegra_pll_a = {
2236 .name = "pll_a",
2237 .flags = PLL_HAS_CPCON,
2238 .ops = &tegra_pll_ops,
2239 .reg = 0xb0,
2240 .parent = &tegra_pll_p_out1,
2241 .max_rate = 700000000,
2242 .u.pll = {
2243 .input_min = 2000000,
2244 .input_max = 31000000,
2245 .cf_min = 1000000,
2246 .cf_max = 6000000,
2247 .vco_min = 20000000,
2248 .vco_max = 1400000000,
2249 .freq_table = tegra_pll_a_freq_table,
2250 .lock_delay = 300,
2251 },
2252};
2253
2254static struct clk tegra_pll_a_out0 = {
2255 .name = "pll_a_out0",
2256 .ops = &tegra_pll_div_ops,
2257 .flags = DIV_U71,
2258 .parent = &tegra_pll_a,
2259 .reg = 0xb4,
2260 .reg_shift = 0,
2261 .max_rate = 100000000,
2262};
2263
2264static struct clk_pll_freq_table tegra_pll_d_freq_table[] = {
2265 { 12000000, 216000000, 216, 12, 1, 4},
2266 { 13000000, 216000000, 216, 13, 1, 4},
2267 { 16800000, 216000000, 180, 14, 1, 4},
2268 { 19200000, 216000000, 180, 16, 1, 4},
2269 { 26000000, 216000000, 216, 26, 1, 4},
2270
2271 { 12000000, 594000000, 594, 12, 1, 8},
2272 { 13000000, 594000000, 594, 13, 1, 8},
2273 { 16800000, 594000000, 495, 14, 1, 8},
2274 { 19200000, 594000000, 495, 16, 1, 8},
2275 { 26000000, 594000000, 594, 26, 1, 8},
2276
2277 { 12000000, 1000000000, 1000, 12, 1, 12},
2278 { 13000000, 1000000000, 1000, 13, 1, 12},
2279 { 19200000, 1000000000, 625, 12, 1, 8},
2280 { 26000000, 1000000000, 1000, 26, 1, 12},
2281
2282 { 0, 0, 0, 0, 0, 0 },
2283};
2284
2285static struct clk tegra_pll_d = {
2286 .name = "pll_d",
2287 .flags = PLL_HAS_CPCON | PLLD,
2288 .ops = &tegra_plld_ops,
2289 .reg = 0xd0,
2290 .parent = &tegra_pll_ref,
2291 .max_rate = 1000000000,
2292 .u.pll = {
2293 .input_min = 2000000,
2294 .input_max = 40000000,
2295 .cf_min = 1000000,
2296 .cf_max = 6000000,
2297 .vco_min = 40000000,
2298 .vco_max = 1000000000,
2299 .freq_table = tegra_pll_d_freq_table,
2300 .lock_delay = 1000,
2301 },
2302};
2303
2304static struct clk tegra_pll_d_out0 = {
2305 .name = "pll_d_out0",
2306 .ops = &tegra_pll_div_ops,
2307 .flags = DIV_2 | PLLD,
2308 .parent = &tegra_pll_d,
2309 .max_rate = 500000000,
2310};
2311
2312static struct clk tegra_pll_d2 = {
2313 .name = "pll_d2",
2314 .flags = PLL_HAS_CPCON | PLL_ALT_MISC_REG | PLLD,
2315 .ops = &tegra_plld_ops,
2316 .reg = 0x4b8,
2317 .parent = &tegra_pll_ref,
2318 .max_rate = 1000000000,
2319 .u.pll = {
2320 .input_min = 2000000,
2321 .input_max = 40000000,
2322 .cf_min = 1000000,
2323 .cf_max = 6000000,
2324 .vco_min = 40000000,
2325 .vco_max = 1000000000,
2326 .freq_table = tegra_pll_d_freq_table,
2327 .lock_delay = 1000,
2328 },
2329};
2330
2331static struct clk tegra_pll_d2_out0 = {
2332 .name = "pll_d2_out0",
2333 .ops = &tegra_pll_div_ops,
2334 .flags = DIV_2 | PLLD,
2335 .parent = &tegra_pll_d2,
2336 .max_rate = 500000000,
2337};
2338
2339static struct clk_pll_freq_table tegra_pll_u_freq_table[] = {
2340 { 12000000, 480000000, 960, 12, 2, 12},
2341 { 13000000, 480000000, 960, 13, 2, 12},
2342 { 16800000, 480000000, 400, 7, 2, 5},
2343 { 19200000, 480000000, 200, 4, 2, 3},
2344 { 26000000, 480000000, 960, 26, 2, 12},
2345 { 0, 0, 0, 0, 0, 0 },
2346};
2347
2348static struct clk tegra_pll_u = {
2349 .name = "pll_u",
2350 .flags = PLL_HAS_CPCON | PLLU,
2351 .ops = &tegra_pll_ops,
2352 .reg = 0xc0,
2353 .parent = &tegra_pll_ref,
2354 .max_rate = 480000000,
2355 .u.pll = {
2356 .input_min = 2000000,
2357 .input_max = 40000000,
2358 .cf_min = 1000000,
2359 .cf_max = 6000000,
2360 .vco_min = 480000000,
2361 .vco_max = 960000000,
2362 .freq_table = tegra_pll_u_freq_table,
2363 .lock_delay = 1000,
2364 },
2365};
2366
2367static struct clk_pll_freq_table tegra_pll_x_freq_table[] = {
2368 /* 1.7 GHz */
2369 { 12000000, 1700000000, 850, 6, 1, 8},
2370 { 13000000, 1700000000, 915, 7, 1, 8}, /* actual: 1699.2 MHz */
2371 { 16800000, 1700000000, 708, 7, 1, 8}, /* actual: 1699.2 MHz */
2372 { 19200000, 1700000000, 885, 10, 1, 8}, /* actual: 1699.2 MHz */
2373 { 26000000, 1700000000, 850, 13, 1, 8},
2374
2375 /* 1.6 GHz */
2376 { 12000000, 1600000000, 800, 6, 1, 8},
2377 { 13000000, 1600000000, 738, 6, 1, 8}, /* actual: 1599.0 MHz */
2378 { 16800000, 1600000000, 857, 9, 1, 8}, /* actual: 1599.7 MHz */
2379 { 19200000, 1600000000, 500, 6, 1, 8},
2380 { 26000000, 1600000000, 800, 13, 1, 8},
2381
2382 /* 1.5 GHz */
2383 { 12000000, 1500000000, 750, 6, 1, 8},
2384 { 13000000, 1500000000, 923, 8, 1, 8}, /* actual: 1499.8 MHz */
2385 { 16800000, 1500000000, 625, 7, 1, 8},
2386 { 19200000, 1500000000, 625, 8, 1, 8},
2387 { 26000000, 1500000000, 750, 13, 1, 8},
2388
2389 /* 1.4 GHz */
2390 { 12000000, 1400000000, 700, 6, 1, 8},
2391 { 13000000, 1400000000, 969, 9, 1, 8}, /* actual: 1399.7 MHz */
2392 { 16800000, 1400000000, 1000, 12, 1, 8},
2393 { 19200000, 1400000000, 875, 12, 1, 8},
2394 { 26000000, 1400000000, 700, 13, 1, 8},
2395
2396 /* 1.3 GHz */
2397 { 12000000, 1300000000, 975, 9, 1, 8},
2398 { 13000000, 1300000000, 1000, 10, 1, 8},
2399 { 16800000, 1300000000, 928, 12, 1, 8}, /* actual: 1299.2 MHz */
2400 { 19200000, 1300000000, 812, 12, 1, 8}, /* actual: 1299.2 MHz */
2401 { 26000000, 1300000000, 650, 13, 1, 8},
2402
2403 /* 1.2 GHz */
2404 { 12000000, 1200000000, 1000, 10, 1, 8},
2405 { 13000000, 1200000000, 923, 10, 1, 8}, /* actual: 1199.9 MHz */
2406 { 16800000, 1200000000, 1000, 14, 1, 8},
2407 { 19200000, 1200000000, 1000, 16, 1, 8},
2408 { 26000000, 1200000000, 600, 13, 1, 8},
2409
2410 /* 1.1 GHz */
2411 { 12000000, 1100000000, 825, 9, 1, 8},
2412 { 13000000, 1100000000, 846, 10, 1, 8}, /* actual: 1099.8 MHz */
2413 { 16800000, 1100000000, 982, 15, 1, 8}, /* actual: 1099.8 MHz */
2414 { 19200000, 1100000000, 859, 15, 1, 8}, /* actual: 1099.5 MHz */
2415 { 26000000, 1100000000, 550, 13, 1, 8},
2416
2417 /* 1 GHz */
2418 { 12000000, 1000000000, 1000, 12, 1, 8},
2419 { 13000000, 1000000000, 1000, 13, 1, 8},
2420 { 16800000, 1000000000, 833, 14, 1, 8}, /* actual: 999.6 MHz */
2421 { 19200000, 1000000000, 625, 12, 1, 8},
2422 { 26000000, 1000000000, 1000, 26, 1, 8},
2423
2424 { 0, 0, 0, 0, 0, 0 },
2425};
2426
2427static struct clk tegra_pll_x = {
2428 .name = "pll_x",
2429 .flags = PLL_HAS_CPCON | PLL_ALT_MISC_REG | PLLX,
2430 .ops = &tegra_pll_ops,
2431 .reg = 0xe0,
2432 .parent = &tegra_pll_ref,
2433 .max_rate = 1700000000,
2434 .u.pll = {
2435 .input_min = 2000000,
2436 .input_max = 31000000,
2437 .cf_min = 1000000,
2438 .cf_max = 6000000,
2439 .vco_min = 20000000,
2440 .vco_max = 1700000000,
2441 .freq_table = tegra_pll_x_freq_table,
2442 .lock_delay = 300,
2443 },
2444};
2445
2446static struct clk tegra_pll_x_out0 = {
2447 .name = "pll_x_out0",
2448 .ops = &tegra_pll_div_ops,
2449 .flags = DIV_2 | PLLX,
2450 .parent = &tegra_pll_x,
2451 .max_rate = 850000000,
2452};
2453
2454
2455static struct clk_pll_freq_table tegra_pll_e_freq_table[] = {
2456 /* PLLE special case: use cpcon field to store cml divider value */
2457 { 12000000, 100000000, 150, 1, 18, 11},
2458 { 216000000, 100000000, 200, 18, 24, 13},
2459 { 0, 0, 0, 0, 0, 0 },
2460};
2461
2462static struct clk tegra_pll_e = {
2463 .name = "pll_e",
2464 .flags = PLL_ALT_MISC_REG,
2465 .ops = &tegra_plle_ops,
2466 .reg = 0xe8,
2467 .max_rate = 100000000,
2468 .u.pll = {
2469 .input_min = 12000000,
2470 .input_max = 216000000,
2471 .cf_min = 12000000,
2472 .cf_max = 12000000,
2473 .vco_min = 1200000000,
2474 .vco_max = 2400000000U,
2475 .freq_table = tegra_pll_e_freq_table,
2476 .lock_delay = 300,
2477 .fixed_rate = 100000000,
2478 },
2479};
2480
2481static struct clk tegra_cml0_clk = {
2482 .name = "cml0",
2483 .parent = &tegra_pll_e,
2484 .ops = &tegra_cml_clk_ops,
2485 .reg = PLLE_AUX,
2486 .max_rate = 100000000,
2487 .u.periph = {
2488 .clk_num = 0,
2489 },
2490};
2491
2492static struct clk tegra_cml1_clk = {
2493 .name = "cml1",
2494 .parent = &tegra_pll_e,
2495 .ops = &tegra_cml_clk_ops,
2496 .reg = PLLE_AUX,
2497 .max_rate = 100000000,
2498 .u.periph = {
2499 .clk_num = 1,
2500 },
2501};
2502
2503static struct clk tegra_pciex_clk = {
2504 .name = "pciex",
2505 .parent = &tegra_pll_e,
2506 .ops = &tegra_pciex_clk_ops,
2507 .max_rate = 100000000,
2508 .u.periph = {
2509 .clk_num = 74,
2510 },
2511};
2512
2513/* Audio sync clocks */
2514#define SYNC_SOURCE(_id) \
2515 { \
2516 .name = #_id "_sync", \
2517 .rate = 24000000, \
2518 .max_rate = 24000000, \
2519 .ops = &tegra_sync_source_ops \
2520 }
2521static struct clk tegra_sync_source_list[] = {
2522 SYNC_SOURCE(spdif_in),
2523 SYNC_SOURCE(i2s0),
2524 SYNC_SOURCE(i2s1),
2525 SYNC_SOURCE(i2s2),
2526 SYNC_SOURCE(i2s3),
2527 SYNC_SOURCE(i2s4),
2528 SYNC_SOURCE(vimclk),
2529};
2530
2531static struct clk_mux_sel mux_audio_sync_clk[] = {
2532 { .input = &tegra_sync_source_list[0], .value = 0},
2533 { .input = &tegra_sync_source_list[1], .value = 1},
2534 { .input = &tegra_sync_source_list[2], .value = 2},
2535 { .input = &tegra_sync_source_list[3], .value = 3},
2536 { .input = &tegra_sync_source_list[4], .value = 4},
2537 { .input = &tegra_sync_source_list[5], .value = 5},
2538 { .input = &tegra_pll_a_out0, .value = 6},
2539 { .input = &tegra_sync_source_list[6], .value = 7},
2540 { 0, 0 }
2541};
2542
2543#define AUDIO_SYNC_CLK(_id, _index) \
2544 { \
2545 .name = #_id, \
2546 .inputs = mux_audio_sync_clk, \
2547 .reg = 0x4A0 + (_index) * 4, \
2548 .max_rate = 24000000, \
2549 .ops = &tegra_audio_sync_clk_ops \
2550 }
2551static struct clk tegra_clk_audio_list[] = {
2552 AUDIO_SYNC_CLK(audio0, 0),
2553 AUDIO_SYNC_CLK(audio1, 1),
2554 AUDIO_SYNC_CLK(audio2, 2),
2555 AUDIO_SYNC_CLK(audio3, 3),
2556 AUDIO_SYNC_CLK(audio4, 4),
2557 AUDIO_SYNC_CLK(audio, 5), /* SPDIF */
2558};
2559
2560#define AUDIO_SYNC_2X_CLK(_id, _index) \
2561 { \
2562 .name = #_id "_2x", \
2563 .flags = PERIPH_NO_RESET, \
2564 .max_rate = 48000000, \
2565 .ops = &tegra_clk_double_ops, \
2566 .reg = 0x49C, \
2567 .reg_shift = 24 + (_index), \
2568 .parent = &tegra_clk_audio_list[(_index)], \
2569 .u.periph = { \
2570 .clk_num = 113 + (_index), \
2571 }, \
2572 }
2573static struct clk tegra_clk_audio_2x_list[] = {
2574 AUDIO_SYNC_2X_CLK(audio0, 0),
2575 AUDIO_SYNC_2X_CLK(audio1, 1),
2576 AUDIO_SYNC_2X_CLK(audio2, 2),
2577 AUDIO_SYNC_2X_CLK(audio3, 3),
2578 AUDIO_SYNC_2X_CLK(audio4, 4),
2579 AUDIO_SYNC_2X_CLK(audio, 5), /* SPDIF */
2580};
2581
2582#define MUX_I2S_SPDIF(_id, _index) \
2583static struct clk_mux_sel mux_pllaout0_##_id##_2x_pllp_clkm[] = { \
2584 {.input = &tegra_pll_a_out0, .value = 0}, \
2585 {.input = &tegra_clk_audio_2x_list[(_index)], .value = 1}, \
2586 {.input = &tegra_pll_p, .value = 2}, \
2587 {.input = &tegra_clk_m, .value = 3}, \
2588 { 0, 0}, \
2589}
2590MUX_I2S_SPDIF(audio0, 0);
2591MUX_I2S_SPDIF(audio1, 1);
2592MUX_I2S_SPDIF(audio2, 2);
2593MUX_I2S_SPDIF(audio3, 3);
2594MUX_I2S_SPDIF(audio4, 4);
2595MUX_I2S_SPDIF(audio, 5); /* SPDIF */
2596
2597/* External clock outputs (through PMC) */
2598#define MUX_EXTERN_OUT(_id) \
2599static struct clk_mux_sel mux_clkm_clkm2_clkm4_extern##_id[] = { \
2600 {.input = &tegra_clk_m, .value = 0}, \
2601 {.input = &tegra_clk_m_div2, .value = 1}, \
2602 {.input = &tegra_clk_m_div4, .value = 2}, \
2603 {.input = NULL, .value = 3}, /* placeholder */ \
2604 { 0, 0}, \
2605}
2606MUX_EXTERN_OUT(1);
2607MUX_EXTERN_OUT(2);
2608MUX_EXTERN_OUT(3);
2609
2610static struct clk_mux_sel *mux_extern_out_list[] = {
2611 mux_clkm_clkm2_clkm4_extern1,
2612 mux_clkm_clkm2_clkm4_extern2,
2613 mux_clkm_clkm2_clkm4_extern3,
2614};
2615
2616#define CLK_OUT_CLK(_id) \
2617 { \
2618 .name = "clk_out_" #_id, \
2619 .lookup = { \
2620 .dev_id = "clk_out_" #_id, \
2621 .con_id = "extern" #_id, \
2622 }, \
2623 .ops = &tegra_clk_out_ops, \
2624 .reg = 0x1a8, \
2625 .inputs = mux_clkm_clkm2_clkm4_extern##_id, \
2626 .flags = MUX_CLK_OUT, \
2627 .max_rate = 216000000, \
2628 .u.periph = { \
2629 .clk_num = (_id - 1) * 8 + 2, \
2630 }, \
2631 }
2632static struct clk tegra_clk_out_list[] = {
2633 CLK_OUT_CLK(1),
2634 CLK_OUT_CLK(2),
2635 CLK_OUT_CLK(3),
2636};
2637
2638/* called after peripheral external clocks are initialized */
2639static void init_clk_out_mux(void)
2640{
2641 int i;
2642 struct clk *c;
2643
2644 /* output clock con_id is the name of peripheral
2645 external clock connected to input 3 of the output mux */
2646 for (i = 0; i < ARRAY_SIZE(tegra_clk_out_list); i++) {
2647 c = tegra_get_clock_by_name(
2648 tegra_clk_out_list[i].lookup.con_id);
2649 if (!c)
2650 pr_err("%s: could not find clk %s\n", __func__,
2651 tegra_clk_out_list[i].lookup.con_id);
2652 mux_extern_out_list[i][3].input = c;
2653 }
2654}
2655
2656/* Peripheral muxes */
2657static struct clk_mux_sel mux_sclk[] = {
2658 { .input = &tegra_clk_m, .value = 0},
2659 { .input = &tegra_pll_c_out1, .value = 1},
2660 { .input = &tegra_pll_p_out4, .value = 2},
2661 { .input = &tegra_pll_p_out3, .value = 3},
2662 { .input = &tegra_pll_p_out2, .value = 4},
2663 /* { .input = &tegra_clk_d, .value = 5}, - no use on tegra30 */
2664 { .input = &tegra_clk_32k, .value = 6},
2665 { .input = &tegra_pll_m_out1, .value = 7},
2666 { 0, 0},
2667};
2668
2669static struct clk tegra_clk_sclk = {
2670 .name = "sclk",
2671 .inputs = mux_sclk,
2672 .reg = 0x28,
2673 .ops = &tegra_super_ops,
2674 .max_rate = 334000000,
2675 .min_rate = 40000000,
2676};
2677
2678static struct clk tegra_clk_blink = {
2679 .name = "blink",
2680 .parent = &tegra_clk_32k,
2681 .reg = 0x40,
2682 .ops = &tegra_blink_clk_ops,
2683 .max_rate = 32768,
2684};
2685
2686static struct clk_mux_sel mux_pllm_pllc_pllp_plla[] = {
2687 { .input = &tegra_pll_m, .value = 0},
2688 { .input = &tegra_pll_c, .value = 1},
2689 { .input = &tegra_pll_p, .value = 2},
2690 { .input = &tegra_pll_a_out0, .value = 3},
2691 { 0, 0},
2692};
2693
2694static struct clk_mux_sel mux_pllp_pllc_pllm_clkm[] = {
2695 { .input = &tegra_pll_p, .value = 0},
2696 { .input = &tegra_pll_c, .value = 1},
2697 { .input = &tegra_pll_m, .value = 2},
2698 { .input = &tegra_clk_m, .value = 3},
2699 { 0, 0},
2700};
2701
2702static struct clk_mux_sel mux_pllp_clkm[] = {
2703 { .input = &tegra_pll_p, .value = 0},
2704 { .input = &tegra_clk_m, .value = 3},
2705 { 0, 0},
2706};
2707
2708static struct clk_mux_sel mux_pllp_plld_pllc_clkm[] = {
2709 {.input = &tegra_pll_p, .value = 0},
2710 {.input = &tegra_pll_d_out0, .value = 1},
2711 {.input = &tegra_pll_c, .value = 2},
2712 {.input = &tegra_clk_m, .value = 3},
2713 { 0, 0},
2714};
2715
2716static struct clk_mux_sel mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = {
2717 {.input = &tegra_pll_p, .value = 0},
2718 {.input = &tegra_pll_m, .value = 1},
2719 {.input = &tegra_pll_d_out0, .value = 2},
2720 {.input = &tegra_pll_a_out0, .value = 3},
2721 {.input = &tegra_pll_c, .value = 4},
2722 {.input = &tegra_pll_d2_out0, .value = 5},
2723 {.input = &tegra_clk_m, .value = 6},
2724 { 0, 0},
2725};
2726
2727static struct clk_mux_sel mux_plla_pllc_pllp_clkm[] = {
2728 { .input = &tegra_pll_a_out0, .value = 0},
2729 /* { .input = &tegra_pll_c, .value = 1}, no use on tegra30 */
2730 { .input = &tegra_pll_p, .value = 2},
2731 { .input = &tegra_clk_m, .value = 3},
2732 { 0, 0},
2733};
2734
2735static struct clk_mux_sel mux_pllp_pllc_clk32_clkm[] = {
2736 {.input = &tegra_pll_p, .value = 0},
2737 {.input = &tegra_pll_c, .value = 1},
2738 {.input = &tegra_clk_32k, .value = 2},
2739 {.input = &tegra_clk_m, .value = 3},
2740 { 0, 0},
2741};
2742
2743static struct clk_mux_sel mux_pllp_pllc_clkm_clk32[] = {
2744 {.input = &tegra_pll_p, .value = 0},
2745 {.input = &tegra_pll_c, .value = 1},
2746 {.input = &tegra_clk_m, .value = 2},
2747 {.input = &tegra_clk_32k, .value = 3},
2748 { 0, 0},
2749};
2750
2751static struct clk_mux_sel mux_pllp_pllc_pllm[] = {
2752 {.input = &tegra_pll_p, .value = 0},
2753 {.input = &tegra_pll_c, .value = 1},
2754 {.input = &tegra_pll_m, .value = 2},
2755 { 0, 0},
2756};
2757
2758static struct clk_mux_sel mux_clk_m[] = {
2759 { .input = &tegra_clk_m, .value = 0},
2760 { 0, 0},
2761};
2762
2763static struct clk_mux_sel mux_pllp_out3[] = {
2764 { .input = &tegra_pll_p_out3, .value = 0},
2765 { 0, 0},
2766};
2767
2768static struct clk_mux_sel mux_plld_out0[] = {
2769 { .input = &tegra_pll_d_out0, .value = 0},
2770 { 0, 0},
2771};
2772
2773static struct clk_mux_sel mux_plld_out0_plld2_out0[] = {
2774 { .input = &tegra_pll_d_out0, .value = 0},
2775 { .input = &tegra_pll_d2_out0, .value = 1},
2776 { 0, 0},
2777};
2778
2779static struct clk_mux_sel mux_clk_32k[] = {
2780 { .input = &tegra_clk_32k, .value = 0},
2781 { 0, 0},
2782};
2783
2784static struct clk_mux_sel mux_plla_clk32_pllp_clkm_plle[] = {
2785 { .input = &tegra_pll_a_out0, .value = 0},
2786 { .input = &tegra_clk_32k, .value = 1},
2787 { .input = &tegra_pll_p, .value = 2},
2788 { .input = &tegra_clk_m, .value = 3},
2789 { .input = &tegra_pll_e, .value = 4},
2790 { 0, 0},
2791};
2792
2793static struct clk_mux_sel mux_cclk_g[] = {
2794 { .input = &tegra_clk_m, .value = 0},
2795 { .input = &tegra_pll_c, .value = 1},
2796 { .input = &tegra_clk_32k, .value = 2},
2797 { .input = &tegra_pll_m, .value = 3},
2798 { .input = &tegra_pll_p, .value = 4},
2799 { .input = &tegra_pll_p_out4, .value = 5},
2800 { .input = &tegra_pll_p_out3, .value = 6},
2801 { .input = &tegra_pll_x, .value = 8},
2802 { 0, 0},
2803};
2804
2805static struct clk tegra_clk_cclk_g = {
2806 .name = "cclk_g",
2807 .flags = DIV_U71 | DIV_U71_INT,
2808 .inputs = mux_cclk_g,
2809 .reg = 0x368,
2810 .ops = &tegra_super_ops,
2811 .max_rate = 1700000000,
2812};
2813
2814static struct clk tegra30_clk_twd = {
2815 .parent = &tegra_clk_cclk_g,
2816 .name = "twd",
2817 .ops = &tegra30_twd_ops,
2818 .max_rate = 1400000000, /* Same as tegra_clk_cpu_cmplx.max_rate */
2819 .mul = 1,
2820 .div = 2,
2821};
2822
2823#define PERIPH_CLK(_name, _dev, _con, _clk_num, _reg, _max, _inputs, _flags) \
2824 { \
2825 .name = _name, \
2826 .lookup = { \
2827 .dev_id = _dev, \
2828 .con_id = _con, \
2829 }, \
2830 .ops = &tegra_periph_clk_ops, \
2831 .reg = _reg, \
2832 .inputs = _inputs, \
2833 .flags = _flags, \
2834 .max_rate = _max, \
2835 .u.periph = { \
2836 .clk_num = _clk_num, \
2837 }, \
2838 }
2839
2840#define PERIPH_CLK_EX(_name, _dev, _con, _clk_num, _reg, _max, _inputs, \
2841 _flags, _ops) \
2842 { \
2843 .name = _name, \
2844 .lookup = { \
2845 .dev_id = _dev, \
2846 .con_id = _con, \
2847 }, \
2848 .ops = _ops, \
2849 .reg = _reg, \
2850 .inputs = _inputs, \
2851 .flags = _flags, \
2852 .max_rate = _max, \
2853 .u.periph = { \
2854 .clk_num = _clk_num, \
2855 }, \
2856 }
2857
2858#define SHARED_CLK(_name, _dev, _con, _parent, _id, _div, _mode)\
2859 { \
2860 .name = _name, \
2861 .lookup = { \
2862 .dev_id = _dev, \
2863 .con_id = _con, \
2864 }, \
2865 .ops = &tegra_clk_shared_bus_ops, \
2866 .parent = _parent, \
2867 .u.shared_bus_user = { \
2868 .client_id = _id, \
2869 .client_div = _div, \
2870 .mode = _mode, \
2871 }, \
2872 }
2873struct clk tegra_list_clks[] = {
2874 PERIPH_CLK("apbdma", "tegra-dma", NULL, 34, 0, 26000000, mux_clk_m, 0),
2875 PERIPH_CLK("rtc", "rtc-tegra", NULL, 4, 0, 32768, mux_clk_32k, PERIPH_NO_RESET | PERIPH_ON_APB),
2876 PERIPH_CLK("kbc", "tegra-kbc", NULL, 36, 0, 32768, mux_clk_32k, PERIPH_NO_RESET | PERIPH_ON_APB),
2877 PERIPH_CLK("timer", "timer", NULL, 5, 0, 26000000, mux_clk_m, 0),
2878 PERIPH_CLK("kfuse", "kfuse-tegra", NULL, 40, 0, 26000000, mux_clk_m, 0),
2879 PERIPH_CLK("fuse", "fuse-tegra", "fuse", 39, 0, 26000000, mux_clk_m, PERIPH_ON_APB),
2880 PERIPH_CLK("fuse_burn", "fuse-tegra", "fuse_burn", 39, 0, 26000000, mux_clk_m, PERIPH_ON_APB),
2881 PERIPH_CLK("apbif", "tegra30-ahub", "apbif", 107, 0, 26000000, mux_clk_m, 0),
2882 PERIPH_CLK("i2s0", "tegra30-i2s.0", NULL, 30, 0x1d8, 26000000, mux_pllaout0_audio0_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2883 PERIPH_CLK("i2s1", "tegra30-i2s.1", NULL, 11, 0x100, 26000000, mux_pllaout0_audio1_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2884 PERIPH_CLK("i2s2", "tegra30-i2s.2", NULL, 18, 0x104, 26000000, mux_pllaout0_audio2_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2885 PERIPH_CLK("i2s3", "tegra30-i2s.3", NULL, 101, 0x3bc, 26000000, mux_pllaout0_audio3_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2886 PERIPH_CLK("i2s4", "tegra30-i2s.4", NULL, 102, 0x3c0, 26000000, mux_pllaout0_audio4_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2887 PERIPH_CLK("spdif_out", "tegra30-spdif", "spdif_out", 10, 0x108, 100000000, mux_pllaout0_audio_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2888 PERIPH_CLK("spdif_in", "tegra30-spdif", "spdif_in", 10, 0x10c, 100000000, mux_pllp_pllc_pllm, MUX | DIV_U71 | PERIPH_ON_APB),
2889 PERIPH_CLK("pwm", "pwm", NULL, 17, 0x110, 432000000, mux_pllp_pllc_clk32_clkm, MUX | MUX_PWM | DIV_U71 | PERIPH_ON_APB),
2890 PERIPH_CLK("d_audio", "tegra30-ahub", "d_audio", 106, 0x3d0, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71),
2891 PERIPH_CLK("dam0", "tegra30-dam.0", NULL, 108, 0x3d8, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71),
2892 PERIPH_CLK("dam1", "tegra30-dam.1", NULL, 109, 0x3dc, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71),
2893 PERIPH_CLK("dam2", "tegra30-dam.2", NULL, 110, 0x3e0, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71),
2894 PERIPH_CLK("hda", "tegra30-hda", "hda", 125, 0x428, 108000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71),
2895 PERIPH_CLK("hda2codec_2x", "tegra30-hda", "hda2codec", 111, 0x3e4, 48000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71),
2896 PERIPH_CLK("hda2hdmi", "tegra30-hda", "hda2hdmi", 128, 0, 48000000, mux_clk_m, 0),
2897 PERIPH_CLK("sbc1", "spi_tegra.0", NULL, 41, 0x134, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2898 PERIPH_CLK("sbc2", "spi_tegra.1", NULL, 44, 0x118, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2899 PERIPH_CLK("sbc3", "spi_tegra.2", NULL, 46, 0x11c, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2900 PERIPH_CLK("sbc4", "spi_tegra.3", NULL, 68, 0x1b4, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2901 PERIPH_CLK("sbc5", "spi_tegra.4", NULL, 104, 0x3c8, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2902 PERIPH_CLK("sbc6", "spi_tegra.5", NULL, 105, 0x3cc, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2903 PERIPH_CLK("sata_oob", "tegra_sata_oob", NULL, 123, 0x420, 216000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71),
2904 PERIPH_CLK("sata", "tegra_sata", NULL, 124, 0x424, 216000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71),
2905 PERIPH_CLK("sata_cold", "tegra_sata_cold", NULL, 129, 0, 48000000, mux_clk_m, 0),
2906 PERIPH_CLK_EX("ndflash", "tegra_nand", NULL, 13, 0x160, 240000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71, &tegra_nand_clk_ops),
2907 PERIPH_CLK("ndspeed", "tegra_nand_speed", NULL, 80, 0x3f8, 240000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71),
2908 PERIPH_CLK("vfir", "vfir", NULL, 7, 0x168, 72000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2909 PERIPH_CLK("sdmmc1", "sdhci-tegra.0", NULL, 14, 0x150, 208000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */
2910 PERIPH_CLK("sdmmc2", "sdhci-tegra.1", NULL, 9, 0x154, 104000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */
2911 PERIPH_CLK("sdmmc3", "sdhci-tegra.2", NULL, 69, 0x1bc, 208000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */
2912 PERIPH_CLK("sdmmc4", "sdhci-tegra.3", NULL, 15, 0x164, 104000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */
2913 PERIPH_CLK("vcp", "tegra-avp", "vcp", 29, 0, 250000000, mux_clk_m, 0),
2914 PERIPH_CLK("bsea", "tegra-avp", "bsea", 62, 0, 250000000, mux_clk_m, 0),
2915 PERIPH_CLK("bsev", "tegra-aes", "bsev", 63, 0, 250000000, mux_clk_m, 0),
2916 PERIPH_CLK("vde", "vde", NULL, 61, 0x1c8, 520000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_INT),
2917 PERIPH_CLK("csite", "csite", NULL, 73, 0x1d4, 144000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* max rate ??? */
2918 PERIPH_CLK("la", "la", NULL, 76, 0x1f8, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71),
2919 PERIPH_CLK("owr", "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2920 PERIPH_CLK("nor", "nor", NULL, 42, 0x1d0, 127000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* requires min voltage */
2921 PERIPH_CLK("mipi", "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB), /* scales with voltage */
2922 PERIPH_CLK("i2c1", "tegra-i2c.0", NULL, 12, 0x124, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB),
2923 PERIPH_CLK("i2c2", "tegra-i2c.1", NULL, 54, 0x198, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB),
2924 PERIPH_CLK("i2c3", "tegra-i2c.2", NULL, 67, 0x1b8, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB),
2925 PERIPH_CLK("i2c4", "tegra-i2c.3", NULL, 103, 0x3c4, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB),
2926 PERIPH_CLK("i2c5", "tegra-i2c.4", NULL, 47, 0x128, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB),
2927 PERIPH_CLK("uarta", "tegra_uart.0", NULL, 6, 0x178, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB),
2928 PERIPH_CLK("uartb", "tegra_uart.1", NULL, 7, 0x17c, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB),
2929 PERIPH_CLK("uartc", "tegra_uart.2", NULL, 55, 0x1a0, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB),
2930 PERIPH_CLK("uartd", "tegra_uart.3", NULL, 65, 0x1c0, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB),
2931 PERIPH_CLK("uarte", "tegra_uart.4", NULL, 66, 0x1c4, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB),
2932 PERIPH_CLK("uarta_dbg", "serial8250.0", "uarta", 6, 0x178, 800000000, mux_pllp_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB),
2933 PERIPH_CLK("uartb_dbg", "serial8250.0", "uartb", 7, 0x17c, 800000000, mux_pllp_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB),
2934 PERIPH_CLK("uartc_dbg", "serial8250.0", "uartc", 55, 0x1a0, 800000000, mux_pllp_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB),
2935 PERIPH_CLK("uartd_dbg", "serial8250.0", "uartd", 65, 0x1c0, 800000000, mux_pllp_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB),
2936 PERIPH_CLK("uarte_dbg", "serial8250.0", "uarte", 66, 0x1c4, 800000000, mux_pllp_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB),
2937 PERIPH_CLK_EX("vi", "tegra_camera", "vi", 20, 0x148, 425000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT, &tegra_vi_clk_ops),
2938 PERIPH_CLK("3d", "3d", NULL, 24, 0x158, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE | PERIPH_MANUAL_RESET),
2939 PERIPH_CLK("3d2", "3d2", NULL, 98, 0x3b0, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE | PERIPH_MANUAL_RESET),
2940 PERIPH_CLK("2d", "2d", NULL, 21, 0x15c, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE),
2941 PERIPH_CLK("vi_sensor", "tegra_camera", "vi_sensor", 20, 0x1a8, 150000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | PERIPH_NO_RESET),
2942 PERIPH_CLK("epp", "epp", NULL, 19, 0x16c, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT),
2943 PERIPH_CLK("mpe", "mpe", NULL, 60, 0x170, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT),
2944 PERIPH_CLK("host1x", "host1x", NULL, 28, 0x180, 260000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT),
2945 PERIPH_CLK("cve", "cve", NULL, 49, 0x140, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */
2946 PERIPH_CLK("tvo", "tvo", NULL, 49, 0x188, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */
2947 PERIPH_CLK_EX("dtv", "dtv", NULL, 79, 0x1dc, 250000000, mux_clk_m, 0, &tegra_dtv_clk_ops),
2948 PERIPH_CLK("hdmi", "hdmi", NULL, 51, 0x18c, 148500000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm, MUX | MUX8 | DIV_U71),
2949 PERIPH_CLK("tvdac", "tvdac", NULL, 53, 0x194, 220000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */
2950 PERIPH_CLK("disp1", "tegradc.0", NULL, 27, 0x138, 600000000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm, MUX | MUX8),
2951 PERIPH_CLK("disp2", "tegradc.1", NULL, 26, 0x13c, 600000000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm, MUX | MUX8),
2952 PERIPH_CLK("usbd", "fsl-tegra-udc", NULL, 22, 0, 480000000, mux_clk_m, 0), /* requires min voltage */
2953 PERIPH_CLK("usb2", "tegra-ehci.1", NULL, 58, 0, 480000000, mux_clk_m, 0), /* requires min voltage */
2954 PERIPH_CLK("usb3", "tegra-ehci.2", NULL, 59, 0, 480000000, mux_clk_m, 0), /* requires min voltage */
2955 PERIPH_CLK("dsia", "tegradc.0", "dsia", 48, 0, 500000000, mux_plld_out0, 0),
2956 PERIPH_CLK_EX("dsib", "tegradc.1", "dsib", 82, 0xd0, 500000000, mux_plld_out0_plld2_out0, MUX | PLLD, &tegra_dsib_clk_ops),
2957 PERIPH_CLK("csi", "tegra_camera", "csi", 52, 0, 102000000, mux_pllp_out3, 0),
2958 PERIPH_CLK("isp", "tegra_camera", "isp", 23, 0, 150000000, mux_clk_m, 0), /* same frequency as VI */
2959 PERIPH_CLK("csus", "tegra_camera", "csus", 92, 0, 150000000, mux_clk_m, PERIPH_NO_RESET),
2960
2961 PERIPH_CLK("tsensor", "tegra-tsensor", NULL, 100, 0x3b8, 216000000, mux_pllp_pllc_clkm_clk32, MUX | DIV_U71),
2962 PERIPH_CLK("actmon", "actmon", NULL, 119, 0x3e8, 216000000, mux_pllp_pllc_clk32_clkm, MUX | DIV_U71),
2963 PERIPH_CLK("extern1", "extern1", NULL, 120, 0x3ec, 216000000, mux_plla_clk32_pllp_clkm_plle, MUX | MUX8 | DIV_U71),
2964 PERIPH_CLK("extern2", "extern2", NULL, 121, 0x3f0, 216000000, mux_plla_clk32_pllp_clkm_plle, MUX | MUX8 | DIV_U71),
2965 PERIPH_CLK("extern3", "extern3", NULL, 122, 0x3f4, 216000000, mux_plla_clk32_pllp_clkm_plle, MUX | MUX8 | DIV_U71),
2966 PERIPH_CLK("i2cslow", "i2cslow", NULL, 81, 0x3fc, 26000000, mux_pllp_pllc_clk32_clkm, MUX | DIV_U71 | PERIPH_ON_APB),
2967 PERIPH_CLK("pcie", "tegra-pcie", "pcie", 70, 0, 250000000, mux_clk_m, 0),
2968 PERIPH_CLK("afi", "tegra-pcie", "afi", 72, 0, 250000000, mux_clk_m, 0),
2969 PERIPH_CLK("se", "se", NULL, 127, 0x42c, 520000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_INT),
2970};
2971
2972#define CLK_DUPLICATE(_name, _dev, _con) \
2973 { \
2974 .name = _name, \
2975 .lookup = { \
2976 .dev_id = _dev, \
2977 .con_id = _con, \
2978 }, \
2979 }
2980
2981/* Some clocks may be used by different drivers depending on the board
2982 * configuration. List those here to register them twice in the clock lookup
2983 * table under two names.
2984 */
2985struct clk_duplicate tegra_clk_duplicates[] = {
2986 CLK_DUPLICATE("usbd", "utmip-pad", NULL),
2987 CLK_DUPLICATE("usbd", "tegra-ehci.0", NULL),
2988 CLK_DUPLICATE("usbd", "tegra-otg", NULL),
2989 CLK_DUPLICATE("hdmi", "tegradc.0", "hdmi"),
2990 CLK_DUPLICATE("hdmi", "tegradc.1", "hdmi"),
2991 CLK_DUPLICATE("dsib", "tegradc.0", "dsib"),
2992 CLK_DUPLICATE("dsia", "tegradc.1", "dsia"),
2993 CLK_DUPLICATE("pwm", "tegra_pwm.0", NULL),
2994 CLK_DUPLICATE("pwm", "tegra_pwm.1", NULL),
2995 CLK_DUPLICATE("pwm", "tegra_pwm.2", NULL),
2996 CLK_DUPLICATE("pwm", "tegra_pwm.3", NULL),
2997 CLK_DUPLICATE("bsev", "tegra-avp", "bsev"),
2998 CLK_DUPLICATE("bsev", "nvavp", "bsev"),
2999 CLK_DUPLICATE("vde", "tegra-aes", "vde"),
3000 CLK_DUPLICATE("bsea", "tegra-aes", "bsea"),
3001 CLK_DUPLICATE("bsea", "nvavp", "bsea"),
3002 CLK_DUPLICATE("cml1", "tegra_sata_cml", NULL),
3003 CLK_DUPLICATE("cml0", "tegra_pcie", "cml"),
3004 CLK_DUPLICATE("pciex", "tegra_pcie", "pciex"),
3005 CLK_DUPLICATE("i2c1", "tegra-i2c-slave.0", NULL),
3006 CLK_DUPLICATE("i2c2", "tegra-i2c-slave.1", NULL),
3007 CLK_DUPLICATE("i2c3", "tegra-i2c-slave.2", NULL),
3008 CLK_DUPLICATE("i2c4", "tegra-i2c-slave.3", NULL),
3009 CLK_DUPLICATE("i2c5", "tegra-i2c-slave.4", NULL),
3010 CLK_DUPLICATE("sbc1", "spi_slave_tegra.0", NULL),
3011 CLK_DUPLICATE("sbc2", "spi_slave_tegra.1", NULL),
3012 CLK_DUPLICATE("sbc3", "spi_slave_tegra.2", NULL),
3013 CLK_DUPLICATE("sbc4", "spi_slave_tegra.3", NULL),
3014 CLK_DUPLICATE("sbc5", "spi_slave_tegra.4", NULL),
3015 CLK_DUPLICATE("sbc6", "spi_slave_tegra.5", NULL),
3016 CLK_DUPLICATE("twd", "smp_twd", NULL),
3017 CLK_DUPLICATE("vcp", "nvavp", "vcp"),
3018};
3019
3020struct clk *tegra_ptr_clks[] = {
3021 &tegra_clk_32k,
3022 &tegra_clk_m,
3023 &tegra_clk_m_div2,
3024 &tegra_clk_m_div4,
3025 &tegra_pll_ref,
3026 &tegra_pll_m,
3027 &tegra_pll_m_out1,
3028 &tegra_pll_c,
3029 &tegra_pll_c_out1,
3030 &tegra_pll_p,
3031 &tegra_pll_p_out1,
3032 &tegra_pll_p_out2,
3033 &tegra_pll_p_out3,
3034 &tegra_pll_p_out4,
3035 &tegra_pll_a,
3036 &tegra_pll_a_out0,
3037 &tegra_pll_d,
3038 &tegra_pll_d_out0,
3039 &tegra_pll_d2,
3040 &tegra_pll_d2_out0,
3041 &tegra_pll_u,
3042 &tegra_pll_x,
3043 &tegra_pll_x_out0,
3044 &tegra_pll_e,
3045 &tegra_clk_cclk_g,
3046 &tegra_cml0_clk,
3047 &tegra_cml1_clk,
3048 &tegra_pciex_clk,
3049 &tegra_clk_sclk,
3050 &tegra_clk_blink,
3051 &tegra30_clk_twd,
3052};
3053
3054
3055static void tegra30_init_one_clock(struct clk *c)
3056{
3057 clk_init(c);
3058 INIT_LIST_HEAD(&c->shared_bus_list);
3059 if (!c->lookup.dev_id && !c->lookup.con_id)
3060 c->lookup.con_id = c->name;
3061 c->lookup.clk = c;
3062 clkdev_add(&c->lookup);
3063}
3064
3065void __init tegra30_init_clocks(void)
3066{
3067 int i;
3068 struct clk *c;
3069
3070 for (i = 0; i < ARRAY_SIZE(tegra_ptr_clks); i++)
3071 tegra30_init_one_clock(tegra_ptr_clks[i]);
3072
3073 for (i = 0; i < ARRAY_SIZE(tegra_list_clks); i++)
3074 tegra30_init_one_clock(&tegra_list_clks[i]);
3075
3076 for (i = 0; i < ARRAY_SIZE(tegra_clk_duplicates); i++) {
3077 c = tegra_get_clock_by_name(tegra_clk_duplicates[i].name);
3078 if (!c) {
3079 pr_err("%s: Unknown duplicate clock %s\n", __func__,
3080 tegra_clk_duplicates[i].name);
3081 continue;
3082 }
3083
3084 tegra_clk_duplicates[i].lookup.clk = c;
3085 clkdev_add(&tegra_clk_duplicates[i].lookup);
3086 }
3087
3088 for (i = 0; i < ARRAY_SIZE(tegra_sync_source_list); i++)
3089 tegra30_init_one_clock(&tegra_sync_source_list[i]);
3090 for (i = 0; i < ARRAY_SIZE(tegra_clk_audio_list); i++)
3091 tegra30_init_one_clock(&tegra_clk_audio_list[i]);
3092 for (i = 0; i < ARRAY_SIZE(tegra_clk_audio_2x_list); i++)
3093 tegra30_init_one_clock(&tegra_clk_audio_2x_list[i]);
3094
3095 init_clk_out_mux();
3096 for (i = 0; i < ARRAY_SIZE(tegra_clk_out_list); i++)
3097 tegra30_init_one_clock(&tegra_clk_out_list[i]);
3098
3099}
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index 1d1acda4f3e..1eed8d4a80e 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -28,7 +28,7 @@
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <asm/mach/time.h> 30#include <asm/mach/time.h>
31#include <asm/localtimer.h> 31#include <asm/smp_twd.h>
32#include <asm/sched_clock.h> 32#include <asm/sched_clock.h>
33 33
34#include <mach/iomap.h> 34#include <mach/iomap.h>
@@ -162,6 +162,21 @@ static struct irqaction tegra_timer_irq = {
162 .irq = INT_TMR3, 162 .irq = INT_TMR3,
163}; 163};
164 164
165#ifdef CONFIG_HAVE_ARM_TWD
166static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
167 TEGRA_ARM_PERIF_BASE + 0x600,
168 IRQ_LOCALTIMER);
169
170static void __init tegra_twd_init(void)
171{
172 int err = twd_local_timer_register(&twd_local_timer);
173 if (err)
174 pr_err("twd_local_timer_register failed %d\n", err);
175}
176#else
177#define tegra_twd_init() do {} while(0)
178#endif
179
165static void __init tegra_init_timer(void) 180static void __init tegra_init_timer(void)
166{ 181{
167 struct clk *clk; 182 struct clk *clk;
@@ -188,10 +203,6 @@ static void __init tegra_init_timer(void)
188 else 203 else
189 clk_enable(clk); 204 clk_enable(clk);
190 205
191#ifdef CONFIG_HAVE_ARM_TWD
192 twd_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x600);
193#endif
194
195 switch (rate) { 206 switch (rate) {
196 case 12000000: 207 case 12000000:
197 timer_writel(0x000b, TIMERUS_USEC_CFG); 208 timer_writel(0x000b, TIMERUS_USEC_CFG);
@@ -231,6 +242,7 @@ static void __init tegra_init_timer(void)
231 tegra_clockevent.cpumask = cpu_all_mask; 242 tegra_clockevent.cpumask = cpu_all_mask;
232 tegra_clockevent.irq = tegra_timer_irq.irq; 243 tegra_clockevent.irq = tegra_timer_irq.irq;
233 clockevents_register_device(&tegra_clockevent); 244 clockevents_register_device(&tegra_clockevent);
245 tegra_twd_init();
234} 246}
235 247
236struct sys_timer tegra_timer = { 248struct sys_timer tegra_timer = {
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
index ad321f9e2bb..c5b2ac04e2a 100644
--- a/arch/arm/mach-tegra/usb_phy.c
+++ b/arch/arm/mach-tegra/usb_phy.c
@@ -22,6 +22,7 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/export.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/io.h> 27#include <linux/io.h>
27#include <linux/gpio.h> 28#include <linux/gpio.h>
@@ -730,6 +731,7 @@ err0:
730 kfree(phy); 731 kfree(phy);
731 return ERR_PTR(err); 732 return ERR_PTR(err);
732} 733}
734EXPORT_SYMBOL_GPL(tegra_usb_phy_open);
733 735
734int tegra_usb_phy_power_on(struct tegra_usb_phy *phy) 736int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
735{ 737{
@@ -738,6 +740,7 @@ int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
738 else 740 else
739 return utmi_phy_power_on(phy); 741 return utmi_phy_power_on(phy);
740} 742}
743EXPORT_SYMBOL_GPL(tegra_usb_phy_power_on);
741 744
742void tegra_usb_phy_power_off(struct tegra_usb_phy *phy) 745void tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
743{ 746{
@@ -746,18 +749,21 @@ void tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
746 else 749 else
747 utmi_phy_power_off(phy); 750 utmi_phy_power_off(phy);
748} 751}
752EXPORT_SYMBOL_GPL(tegra_usb_phy_power_off);
749 753
750void tegra_usb_phy_preresume(struct tegra_usb_phy *phy) 754void tegra_usb_phy_preresume(struct tegra_usb_phy *phy)
751{ 755{
752 if (!phy_is_ulpi(phy)) 756 if (!phy_is_ulpi(phy))
753 utmi_phy_preresume(phy); 757 utmi_phy_preresume(phy);
754} 758}
759EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume);
755 760
756void tegra_usb_phy_postresume(struct tegra_usb_phy *phy) 761void tegra_usb_phy_postresume(struct tegra_usb_phy *phy)
757{ 762{
758 if (!phy_is_ulpi(phy)) 763 if (!phy_is_ulpi(phy))
759 utmi_phy_postresume(phy); 764 utmi_phy_postresume(phy);
760} 765}
766EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume);
761 767
762void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, 768void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy,
763 enum tegra_usb_phy_port_speed port_speed) 769 enum tegra_usb_phy_port_speed port_speed)
@@ -765,24 +771,28 @@ void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy,
765 if (!phy_is_ulpi(phy)) 771 if (!phy_is_ulpi(phy))
766 utmi_phy_restore_start(phy, port_speed); 772 utmi_phy_restore_start(phy, port_speed);
767} 773}
774EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start);
768 775
769void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy) 776void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy)
770{ 777{
771 if (!phy_is_ulpi(phy)) 778 if (!phy_is_ulpi(phy))
772 utmi_phy_restore_end(phy); 779 utmi_phy_restore_end(phy);
773} 780}
781EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end);
774 782
775void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy) 783void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy)
776{ 784{
777 if (!phy_is_ulpi(phy)) 785 if (!phy_is_ulpi(phy))
778 utmi_phy_clk_disable(phy); 786 utmi_phy_clk_disable(phy);
779} 787}
788EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_disable);
780 789
781void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy) 790void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy)
782{ 791{
783 if (!phy_is_ulpi(phy)) 792 if (!phy_is_ulpi(phy))
784 utmi_phy_clk_enable(phy); 793 utmi_phy_clk_enable(phy);
785} 794}
795EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_enable);
786 796
787void tegra_usb_phy_close(struct tegra_usb_phy *phy) 797void tegra_usb_phy_close(struct tegra_usb_phy *phy)
788{ 798{
@@ -794,3 +804,4 @@ void tegra_usb_phy_close(struct tegra_usb_phy *phy)
794 clk_put(phy->pll_u); 804 clk_put(phy->pll_u);
795 kfree(phy); 805 kfree(phy);
796} 806}
807EXPORT_SYMBOL_GPL(tegra_usb_phy_close);
diff --git a/arch/arm/mach-u300/Makefile b/arch/arm/mach-u300/Makefile
index 285538124e5..fd3a5c382f4 100644
--- a/arch/arm/mach-u300/Makefile
+++ b/arch/arm/mach-u300/Makefile
@@ -8,7 +8,6 @@ obj-n :=
8obj- := 8obj- :=
9 9
10obj-$(CONFIG_ARCH_U300) += u300.o 10obj-$(CONFIG_ARCH_U300) += u300.o
11obj-$(CONFIG_MMC) += mmc.o
12obj-$(CONFIG_SPI_PL022) += spi.o 11obj-$(CONFIG_SPI_PL022) += spi.o
13obj-$(CONFIG_MACH_U300_SPIDUMMY) += dummyspichip.o 12obj-$(CONFIG_MACH_U300_SPIDUMMY) += dummyspichip.o
14obj-$(CONFIG_I2C_STU300) += i2c.o 13obj-$(CONFIG_I2C_STU300) += i2c.o
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index b4c6926a700..8b90c44d237 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -18,6 +18,7 @@
18#include <linux/termios.h> 18#include <linux/termios.h>
19#include <linux/dmaengine.h> 19#include <linux/dmaengine.h>
20#include <linux/amba/bus.h> 20#include <linux/amba/bus.h>
21#include <linux/amba/mmci.h>
21#include <linux/amba/serial.h> 22#include <linux/amba/serial.h>
22#include <linux/platform_device.h> 23#include <linux/platform_device.h>
23#include <linux/gpio.h> 24#include <linux/gpio.h>
@@ -26,7 +27,8 @@
26#include <linux/mtd/nand.h> 27#include <linux/mtd/nand.h>
27#include <linux/mtd/fsmc.h> 28#include <linux/mtd/fsmc.h>
28#include <linux/pinctrl/machine.h> 29#include <linux/pinctrl/machine.h>
29#include <linux/pinctrl/pinmux.h> 30#include <linux/pinctrl/consumer.h>
31#include <linux/pinctrl/pinconf-generic.h>
30#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
31 33
32#include <asm/types.h> 34#include <asm/types.h>
@@ -43,9 +45,9 @@
43#include <mach/gpio-u300.h> 45#include <mach/gpio-u300.h>
44 46
45#include "clock.h" 47#include "clock.h"
46#include "mmc.h"
47#include "spi.h" 48#include "spi.h"
48#include "i2c.h" 49#include "i2c.h"
50#include "u300-gpio.h"
49 51
50/* 52/*
51 * Static I/O mappings that are needed for booting the U300 platforms. The 53 * Static I/O mappings that are needed for booting the U300 platforms. The
@@ -94,19 +96,9 @@ static struct amba_pl011_data uart0_plat_data = {
94#endif 96#endif
95}; 97};
96 98
97static struct amba_device uart0_device = { 99/* Slow device at 0x3000 offset */
98 .dev = { 100static AMBA_APB_DEVICE(uart0, "uart0", 0, U300_UART0_BASE,
99 .coherent_dma_mask = ~0, 101 { IRQ_U300_UART0 }, &uart0_plat_data);
100 .init_name = "uart0", /* Slow device at 0x3000 offset */
101 .platform_data = &uart0_plat_data,
102 },
103 .res = {
104 .start = U300_UART0_BASE,
105 .end = U300_UART0_BASE + SZ_4K - 1,
106 .flags = IORESOURCE_MEM,
107 },
108 .irq = { IRQ_U300_UART0, NO_IRQ },
109};
110 102
111/* The U335 have an additional UART1 on the APP CPU */ 103/* The U335 have an additional UART1 on the APP CPU */
112#ifdef CONFIG_MACH_U300_BS335 104#ifdef CONFIG_MACH_U300_BS335
@@ -118,72 +110,42 @@ static struct amba_pl011_data uart1_plat_data = {
118#endif 110#endif
119}; 111};
120 112
121static struct amba_device uart1_device = { 113/* Fast device at 0x7000 offset */
122 .dev = { 114static AMBA_APB_DEVICE(uart1, "uart1", 0, U300_UART1_BASE,
123 .coherent_dma_mask = ~0, 115 { IRQ_U300_UART1 }, &uart1_plat_data);
124 .init_name = "uart1", /* Fast device at 0x7000 offset */
125 .platform_data = &uart1_plat_data,
126 },
127 .res = {
128 .start = U300_UART1_BASE,
129 .end = U300_UART1_BASE + SZ_4K - 1,
130 .flags = IORESOURCE_MEM,
131 },
132 .irq = { IRQ_U300_UART1, NO_IRQ },
133};
134#endif 116#endif
135 117
136static struct amba_device pl172_device = { 118/* AHB device at 0x4000 offset */
137 .dev = { 119static AMBA_APB_DEVICE(pl172, "pl172", 0, U300_EMIF_CFG_BASE, { }, NULL);
138 .init_name = "pl172", /* AHB device at 0x4000 offset */
139 .platform_data = NULL,
140 },
141 .res = {
142 .start = U300_EMIF_CFG_BASE,
143 .end = U300_EMIF_CFG_BASE + SZ_4K - 1,
144 .flags = IORESOURCE_MEM,
145 },
146};
147 120
121/* Fast device at 0x6000 offset */
122static AMBA_APB_DEVICE(pl022, "pl022", 0, U300_SPI_BASE,
123 { IRQ_U300_SPI }, NULL);
148 124
149/* 125/* Fast device at 0x1000 offset */
150 * Everything within this next ifdef deals with external devices connected to 126#define U300_MMCSD_IRQS { IRQ_U300_MMCSD_MCIINTR0, IRQ_U300_MMCSD_MCIINTR1 }
151 * the APP SPI bus.
152 */
153static struct amba_device pl022_device = {
154 .dev = {
155 .coherent_dma_mask = ~0,
156 .init_name = "pl022", /* Fast device at 0x6000 offset */
157 },
158 .res = {
159 .start = U300_SPI_BASE,
160 .end = U300_SPI_BASE + SZ_4K - 1,
161 .flags = IORESOURCE_MEM,
162 },
163 .irq = {IRQ_U300_SPI, NO_IRQ },
164 /*
165 * This device has a DMA channel but the Linux driver does not use
166 * it currently.
167 */
168};
169 127
170static struct amba_device mmcsd_device = { 128static struct mmci_platform_data mmcsd_platform_data = {
171 .dev = {
172 .init_name = "mmci", /* Fast device at 0x1000 offset */
173 .platform_data = NULL, /* Added later */
174 },
175 .res = {
176 .start = U300_MMCSD_BASE,
177 .end = U300_MMCSD_BASE + SZ_4K - 1,
178 .flags = IORESOURCE_MEM,
179 },
180 .irq = {IRQ_U300_MMCSD_MCIINTR0, IRQ_U300_MMCSD_MCIINTR1 },
181 /* 129 /*
182 * This device has a DMA channel but the Linux driver does not use 130 * Do not set ocr_mask or voltage translation function,
183 * it currently. 131 * we have a regulator we can control instead.
184 */ 132 */
133 .f_max = 24000000,
134 .gpio_wp = -1,
135 .gpio_cd = U300_GPIO_PIN_MMC_CD,
136 .cd_invert = true,
137 .capabilities = MMC_CAP_MMC_HIGHSPEED |
138 MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
139#ifdef CONFIG_COH901318
140 .dma_filter = coh901318_filter_id,
141 .dma_rx_param = (void *) U300_DMA_MMCSD_RX_TX,
142 /* Don't specify a TX channel, this RX channel is bidirectional */
143#endif
185}; 144};
186 145
146static AMBA_APB_DEVICE(mmcsd, "mmci", 0, U300_MMCSD_BASE,
147 U300_MMCSD_IRQS, &mmcsd_platform_data);
148
187/* 149/*
188 * The order of device declaration may be important, since some devices 150 * The order of device declaration may be important, since some devices
189 * have dependencies on other devices being initialized first. 151 * have dependencies on other devices being initialized first.
@@ -1477,7 +1439,7 @@ static struct coh901318_platform coh901318_platform = {
1477 .max_channels = U300_DMA_CHANNELS, 1439 .max_channels = U300_DMA_CHANNELS,
1478}; 1440};
1479 1441
1480static struct resource pinmux_resources[] = { 1442static struct resource pinctrl_resources[] = {
1481 { 1443 {
1482 .start = U300_SYSCON_BASE, 1444 .start = U300_SYSCON_BASE,
1483 .end = U300_SYSCON_BASE + SZ_4K - 1, 1445 .end = U300_SYSCON_BASE + SZ_4K - 1,
@@ -1506,6 +1468,13 @@ static struct platform_device i2c1_device = {
1506 .resource = i2c1_resources, 1468 .resource = i2c1_resources,
1507}; 1469};
1508 1470
1471static struct platform_device pinctrl_device = {
1472 .name = "pinctrl-u300",
1473 .id = -1,
1474 .num_resources = ARRAY_SIZE(pinctrl_resources),
1475 .resource = pinctrl_resources,
1476};
1477
1509/* 1478/*
1510 * The different variants have a few different versions of the 1479 * The different variants have a few different versions of the
1511 * GPIO block, with different number of ports. 1480 * GPIO block, with different number of ports.
@@ -1525,6 +1494,7 @@ static struct u300_gpio_platform u300_gpio_plat = {
1525#endif 1494#endif
1526 .gpio_base = 0, 1495 .gpio_base = 0,
1527 .gpio_irq_base = IRQ_U300_GPIO_BASE, 1496 .gpio_irq_base = IRQ_U300_GPIO_BASE,
1497 .pinctrl_device = &pinctrl_device,
1528}; 1498};
1529 1499
1530static struct platform_device gpio_device = { 1500static struct platform_device gpio_device = {
@@ -1597,71 +1567,67 @@ static struct platform_device dma_device = {
1597 }, 1567 },
1598}; 1568};
1599 1569
1600static struct platform_device pinmux_device = { 1570static unsigned long pin_pullup_conf[] = {
1601 .name = "pinmux-u300", 1571 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 1),
1602 .id = -1, 1572};
1603 .num_resources = ARRAY_SIZE(pinmux_resources), 1573
1604 .resource = pinmux_resources, 1574static unsigned long pin_highz_conf[] = {
1575 PIN_CONF_PACKED(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0),
1605}; 1576};
1606 1577
1607/* Pinmux settings */ 1578/* Pin control settings */
1608static struct pinmux_map __initdata u300_pinmux_map[] = { 1579static struct pinctrl_map __initdata u300_pinmux_map[] = {
1609 /* anonymous maps for chip power and EMIFs */ 1580 /* anonymous maps for chip power and EMIFs */
1610 PINMUX_MAP_SYS_HOG("POWER", "pinmux-u300", "power"), 1581 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "power"),
1611 PINMUX_MAP_SYS_HOG("EMIF0", "pinmux-u300", "emif0"), 1582 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif0"),
1612 PINMUX_MAP_SYS_HOG("EMIF1", "pinmux-u300", "emif1"), 1583 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif1"),
1613 /* per-device maps for MMC/SD, SPI and UART */ 1584 /* per-device maps for MMC/SD, SPI and UART */
1614 PINMUX_MAP("MMCSD", "pinmux-u300", "mmc0", "mmci"), 1585 PIN_MAP_MUX_GROUP_DEFAULT("mmci", "pinctrl-u300", NULL, "mmc0"),
1615 PINMUX_MAP("SPI", "pinmux-u300", "spi0", "pl022"), 1586 PIN_MAP_MUX_GROUP_DEFAULT("pl022", "pinctrl-u300", NULL, "spi0"),
1616 PINMUX_MAP("UART0", "pinmux-u300", "uart0", "uart0"), 1587 PIN_MAP_MUX_GROUP_DEFAULT("uart0", "pinctrl-u300", NULL, "uart0"),
1588 /* This pin is used for clock return rather than GPIO */
1589 PIN_MAP_CONFIGS_PIN_DEFAULT("mmci", "pinctrl-u300", "PIO APP GPIO 11",
1590 pin_pullup_conf),
1591 /* This pin is used for card detect */
1592 PIN_MAP_CONFIGS_PIN_DEFAULT("mmci", "pinctrl-u300", "PIO MS INS",
1593 pin_highz_conf),
1617}; 1594};
1618 1595
1619struct u300_mux_hog { 1596struct u300_mux_hog {
1620 const char *name;
1621 struct device *dev; 1597 struct device *dev;
1622 struct pinmux *pmx; 1598 struct pinctrl *p;
1623}; 1599};
1624 1600
1625static struct u300_mux_hog u300_mux_hogs[] = { 1601static struct u300_mux_hog u300_mux_hogs[] = {
1626 { 1602 {
1627 .name = "uart0",
1628 .dev = &uart0_device.dev, 1603 .dev = &uart0_device.dev,
1629 }, 1604 },
1630 { 1605 {
1631 .name = "spi0",
1632 .dev = &pl022_device.dev, 1606 .dev = &pl022_device.dev,
1633 }, 1607 },
1634 { 1608 {
1635 .name = "mmc0",
1636 .dev = &mmcsd_device.dev, 1609 .dev = &mmcsd_device.dev,
1637 }, 1610 },
1638}; 1611};
1639 1612
1640static int __init u300_pinmux_fetch(void) 1613static int __init u300_pinctrl_fetch(void)
1641{ 1614{
1642 int i; 1615 int i;
1643 1616
1644 for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) { 1617 for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) {
1645 struct pinmux *pmx; 1618 struct pinctrl *p;
1646 int ret;
1647 1619
1648 pmx = pinmux_get(u300_mux_hogs[i].dev, NULL); 1620 p = pinctrl_get_select_default(u300_mux_hogs[i].dev);
1649 if (IS_ERR(pmx)) { 1621 if (IS_ERR(p)) {
1650 pr_err("u300: could not get pinmux hog %s\n", 1622 pr_err("u300: could not get pinmux hog for dev %s\n",
1651 u300_mux_hogs[i].name); 1623 dev_name(u300_mux_hogs[i].dev));
1652 continue;
1653 }
1654 ret = pinmux_enable(pmx);
1655 if (ret) {
1656 pr_err("u300: could enable pinmux hog %s\n",
1657 u300_mux_hogs[i].name);
1658 continue; 1624 continue;
1659 } 1625 }
1660 u300_mux_hogs[i].pmx = pmx; 1626 u300_mux_hogs[i].p = p;
1661 } 1627 }
1662 return 0; 1628 return 0;
1663} 1629}
1664subsys_initcall(u300_pinmux_fetch); 1630subsys_initcall(u300_pinctrl_fetch);
1665 1631
1666/* 1632/*
1667 * Notice that AMBA devices are initialized before platform devices. 1633 * Notice that AMBA devices are initialized before platform devices.
@@ -1676,7 +1642,6 @@ static struct platform_device *platform_devs[] __initdata = {
1676 &gpio_device, 1642 &gpio_device,
1677 &nand_device, 1643 &nand_device,
1678 &wdog_device, 1644 &wdog_device,
1679 &pinmux_device,
1680}; 1645};
1681 1646
1682/* 1647/*
@@ -1861,8 +1826,8 @@ void __init u300_init_devices(void)
1861 u300_assign_physmem(); 1826 u300_assign_physmem();
1862 1827
1863 /* Initialize pinmuxing */ 1828 /* Initialize pinmuxing */
1864 pinmux_register_mappings(u300_pinmux_map, 1829 pinctrl_register_mappings(u300_pinmux_map,
1865 ARRAY_SIZE(u300_pinmux_map)); 1830 ARRAY_SIZE(u300_pinmux_map));
1866 1831
1867 /* Register subdevices on the I2C buses */ 1832 /* Register subdevices on the I2C buses */
1868 u300_i2c_register_board_devices(); 1833 u300_i2c_register_board_devices();
@@ -1879,16 +1844,6 @@ void __init u300_init_devices(void)
1879 writew(val, U300_SYSCON_VBASE + U300_SYSCON_SMCR); 1844 writew(val, U300_SYSCON_VBASE + U300_SYSCON_SMCR);
1880} 1845}
1881 1846
1882static int core_module_init(void)
1883{
1884 /*
1885 * This needs to be initialized later: it needs the input framework
1886 * to be initialized first.
1887 */
1888 return mmc_init(&mmcsd_device);
1889}
1890module_init(core_module_init);
1891
1892/* Forward declare this function from the watchdog */ 1847/* Forward declare this function from the watchdog */
1893void coh901327_watchdog_reset(void); 1848void coh901327_watchdog_reset(void);
1894 1849
diff --git a/arch/arm/mach-u300/include/mach/entry-macro.S b/arch/arm/mach-u300/include/mach/entry-macro.S
deleted file mode 100644
index 7181d6ac665..00000000000
--- a/arch/arm/mach-u300/include/mach/entry-macro.S
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 *
3 * arch-arm/mach-u300/include/mach/entry-macro.S
4 *
5 *
6 * Copyright (C) 2006-2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * Low-level IRQ helper macros for ST-Ericsson U300
9 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 */
11
12 .macro disable_fiq
13 .endm
14
15 .macro arch_ret_to_user, tmp1, tmp2
16 .endm
diff --git a/arch/arm/mach-u300/include/mach/gpio-u300.h b/arch/arm/mach-u300/include/mach/gpio-u300.h
index bf4c7935aec..e81400c1753 100644
--- a/arch/arm/mach-u300/include/mach/gpio-u300.h
+++ b/arch/arm/mach-u300/include/mach/gpio-u300.h
@@ -24,12 +24,14 @@ enum u300_gpio_variant {
24 * @ports: number of GPIO block ports 24 * @ports: number of GPIO block ports
25 * @gpio_base: first GPIO number for this block (use a free range) 25 * @gpio_base: first GPIO number for this block (use a free range)
26 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range) 26 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
27 * @pinctrl_device: pin control device to spawn as child
27 */ 28 */
28struct u300_gpio_platform { 29struct u300_gpio_platform {
29 enum u300_gpio_variant variant; 30 enum u300_gpio_variant variant;
30 u8 ports; 31 u8 ports;
31 int gpio_base; 32 int gpio_base;
32 int gpio_irq_base; 33 int gpio_irq_base;
34 struct platform_device *pinctrl_device;
33}; 35};
34 36
35#endif /* __MACH_U300_GPIO_U300_H */ 37#endif /* __MACH_U300_GPIO_U300_H */
diff --git a/arch/arm/mach-u300/include/mach/system.h b/arch/arm/mach-u300/include/mach/system.h
deleted file mode 100644
index 574d46e3829..00000000000
--- a/arch/arm/mach-u300/include/mach/system.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/include/mach/system.h
4 *
5 *
6 * Copyright (C) 2007-2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * System shutdown and reset functions.
9 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 */
11static inline void arch_idle(void)
12{
13 cpu_do_idle();
14}
diff --git a/arch/arm/mach-u300/mmc.c b/arch/arm/mach-u300/mmc.c
deleted file mode 100644
index 05abd6ad9fa..00000000000
--- a/arch/arm/mach-u300/mmc.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/mmc.c
4 *
5 *
6 * Copyright (C) 2009 ST-Ericsson SA
7 * License terms: GNU General Public License (GPL) version 2
8 *
9 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 * Author: Johan Lundin
11 * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
12 */
13#include <linux/device.h>
14#include <linux/amba/bus.h>
15#include <linux/mmc/host.h>
16#include <linux/dmaengine.h>
17#include <linux/amba/mmci.h>
18#include <linux/slab.h>
19#include <mach/coh901318.h>
20#include <mach/dma_channels.h>
21
22#include "u300-gpio.h"
23#include "mmc.h"
24
25static struct mmci_platform_data mmc0_plat_data = {
26 /*
27 * Do not set ocr_mask or voltage translation function,
28 * we have a regulator we can control instead.
29 */
30 /* Nominally 2.85V on our platform */
31 .f_max = 24000000,
32 .gpio_wp = -1,
33 .gpio_cd = U300_GPIO_PIN_MMC_CD,
34 .cd_invert = true,
35 .capabilities = MMC_CAP_MMC_HIGHSPEED |
36 MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
37#ifdef CONFIG_COH901318
38 .dma_filter = coh901318_filter_id,
39 .dma_rx_param = (void *) U300_DMA_MMCSD_RX_TX,
40 /* Don't specify a TX channel, this RX channel is bidirectional */
41#endif
42};
43
44int __devinit mmc_init(struct amba_device *adev)
45{
46 struct device *mmcsd_device = &adev->dev;
47 int ret = 0;
48
49 mmcsd_device->platform_data = &mmc0_plat_data;
50
51 return ret;
52}
diff --git a/arch/arm/mach-u300/mmc.h b/arch/arm/mach-u300/mmc.h
deleted file mode 100644
index 92b85125abb..00000000000
--- a/arch/arm/mach-u300/mmc.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/mmc.h
4 *
5 *
6 * Copyright (C) 2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 *
9 * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
10 */
11#ifndef MMC_H
12#define MMC_H
13
14#include <linux/amba/bus.h>
15
16int __devinit mmc_init(struct amba_device *adev);
17
18#endif
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index c59e8b892d6..9ec63581234 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -8,47 +8,55 @@ config UX500_SOC_COMMON
8 select PL310_ERRATA_753970 8 select PL310_ERRATA_753970
9 select ARM_ERRATA_754322 9 select ARM_ERRATA_754322
10 select ARM_ERRATA_764369 10 select ARM_ERRATA_764369
11 11 select CACHE_L2X0
12menu "Ux500 SoC"
13 12
14config UX500_SOC_DB5500 13config UX500_SOC_DB5500
15 bool "DB5500" 14 bool
16 select MFD_DB5500_PRCMU 15 select MFD_DB5500_PRCMU
17 16
18config UX500_SOC_DB8500 17config UX500_SOC_DB8500
19 bool "DB8500" 18 bool
20 select MFD_DB8500_PRCMU 19 select MFD_DB8500_PRCMU
21 select REGULATOR_DB8500_PRCMU 20 select REGULATOR_DB8500_PRCMU
22 21 select CPU_FREQ_TABLE if CPU_FREQ
23endmenu
24 22
25menu "Ux500 target platform (boards)" 23menu "Ux500 target platform (boards)"
26 24
27config MACH_U8500 25config MACH_MOP500
28 bool "U8500 Development platform" 26 bool "U8500 Development platform, MOP500 versions"
29 depends on UX500_SOC_DB8500 27 select UX500_SOC_DB8500
30 select TPS6105X 28 select I2C
29 select I2C_NOMADIK
31 help 30 help
32 Include support for the mop500 development platform. 31 Include support for the MOP500 development platform.
33 32
34config MACH_HREFV60 33config MACH_HREFV60
35 bool "U85000 Development platform, HREFv60 version" 34 bool "U8500 Development platform, HREFv60 version"
36 depends on UX500_SOC_DB8500 35 select MACH_MOP500
37 help 36 help
38 Include support for the HREFv60 new development platform. 37 Include support for the HREFv60 new development platform.
38 Includes HREFv70, v71 etc.
39 39
40config MACH_SNOWBALL 40config MACH_SNOWBALL
41 bool "U8500 Snowball platform" 41 bool "U8500 Snowball platform"
42 depends on UX500_SOC_DB8500 42 select MACH_MOP500
43 select MACH_U8500
44 help 43 help
45 Include support for the snowball development platform. 44 Include support for the snowball development platform.
46 45
47config MACH_U5500 46config MACH_U5500
48 bool "U5500 Development platform" 47 bool "U5500 Development platform"
49 depends on UX500_SOC_DB5500 48 select UX500_SOC_DB5500
50 help 49 help
51 Include support for the U5500 development platform. 50 Include support for the U5500 development platform.
51
52config UX500_AUTO_PLATFORM
53 def_bool y
54 depends on !MACH_U5500
55 select MACH_MOP500
56 help
57 At least one platform needs to be selected in order to build
58 a working kernel. If everything else is disabled, this
59 automatically enables MACH_MOP500.
52endmenu 60endmenu
53 61
54config UX500_DEBUG_UART 62config UX500_DEBUG_UART
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 6bd2f451c18..465b9ec9510 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -7,7 +7,7 @@ obj-y := clock.o cpu.o devices.o devices-common.o \
7obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 7obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
8obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o 8obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o
9obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o 9obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o
10obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \ 10obj-$(CONFIG_MACH_MOP500) += board-mop500.o board-mop500-sdi.o \
11 board-mop500-regulators.o \ 11 board-mop500-regulators.o \
12 board-mop500-uib.o board-mop500-stuib.o \ 12 board-mop500-uib.o board-mop500-stuib.o \
13 board-mop500-u8500uib.o \ 13 board-mop500-u8500uib.o \
@@ -15,7 +15,6 @@ obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \
15obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o 15obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o
16obj-$(CONFIG_SMP) += platsmp.o headsmp.o 16obj-$(CONFIG_SMP) += platsmp.o headsmp.o
17obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 17obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
18obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
19obj-$(CONFIG_U5500_MODEM_IRQ) += modem-irq-db5500.o 18obj-$(CONFIG_U5500_MODEM_IRQ) += modem-irq-db5500.o
20obj-$(CONFIG_U5500_MBOX) += mbox-db5500.o 19obj-$(CONFIG_U5500_MBOX) += mbox-db5500.o
21 20
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index 74bfcff2bdf..f5413dca532 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -6,6 +6,7 @@
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/bug.h>
9 10
10#include <asm/mach-types.h> 11#include <asm/mach-types.h>
11#include <plat/pincfg.h> 12#include <plat/pincfg.h>
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index 2735d03996c..52426a42578 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -74,6 +74,26 @@ static struct regulator_consumer_supply ab8500_vtvout_consumers[] = {
74 REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"), 74 REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
75}; 75};
76 76
77static struct regulator_consumer_supply ab8500_vaud_consumers[] = {
78 /* AB8500 audio-codec main supply */
79 REGULATOR_SUPPLY("vaud", "ab8500-codec.0"),
80};
81
82static struct regulator_consumer_supply ab8500_vamic1_consumers[] = {
83 /* AB8500 audio-codec Mic1 supply */
84 REGULATOR_SUPPLY("vamic1", "ab8500-codec.0"),
85};
86
87static struct regulator_consumer_supply ab8500_vamic2_consumers[] = {
88 /* AB8500 audio-codec Mic2 supply */
89 REGULATOR_SUPPLY("vamic2", "ab8500-codec.0"),
90};
91
92static struct regulator_consumer_supply ab8500_vdmic_consumers[] = {
93 /* AB8500 audio-codec DMic supply */
94 REGULATOR_SUPPLY("vdmic", "ab8500-codec.0"),
95};
96
77static struct regulator_consumer_supply ab8500_vintcore_consumers[] = { 97static struct regulator_consumer_supply ab8500_vintcore_consumers[] = {
78 /* SoC core supply, no device */ 98 /* SoC core supply, no device */
79 REGULATOR_SUPPLY("v-intcore", NULL), 99 REGULATOR_SUPPLY("v-intcore", NULL),
@@ -323,6 +343,8 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
323 .name = "V-AUD", 343 .name = "V-AUD",
324 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 344 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
325 }, 345 },
346 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers),
347 .consumer_supplies = ab8500_vaud_consumers,
326 }, 348 },
327 /* supply for v-anamic1 VAMic1-LDO */ 349 /* supply for v-anamic1 VAMic1-LDO */
328 [AB8500_LDO_ANAMIC1] = { 350 [AB8500_LDO_ANAMIC1] = {
@@ -330,6 +352,8 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
330 .name = "V-AMIC1", 352 .name = "V-AMIC1",
331 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 353 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
332 }, 354 },
355 .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers),
356 .consumer_supplies = ab8500_vamic1_consumers,
333 }, 357 },
334 /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */ 358 /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */
335 [AB8500_LDO_ANAMIC2] = { 359 [AB8500_LDO_ANAMIC2] = {
@@ -337,6 +361,8 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
337 .name = "V-AMIC2", 361 .name = "V-AMIC2",
338 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 362 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
339 }, 363 },
364 .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers),
365 .consumer_supplies = ab8500_vamic2_consumers,
340 }, 366 },
341 /* supply for v-dmic, VDMIC LDO */ 367 /* supply for v-dmic, VDMIC LDO */
342 [AB8500_LDO_DMIC] = { 368 [AB8500_LDO_DMIC] = {
@@ -344,6 +370,8 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
344 .name = "V-DMIC", 370 .name = "V-DMIC",
345 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 371 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
346 }, 372 },
373 .num_consumer_supplies = ARRAY_SIZE(ab8500_vdmic_consumers),
374 .consumer_supplies = ab8500_vdmic_consumers,
347 }, 375 },
348 /* supply for v-intcore12, VINTCORE12 LDO */ 376 /* supply for v-intcore12, VINTCORE12 LDO */
349 [AB8500_LDO_INTCORE] = { 377 [AB8500_LDO_INTCORE] = {
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index 5dde4d4ebe8..1daead3e583 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -31,21 +31,13 @@
31 * SDI 0 (MicroSD slot) 31 * SDI 0 (MicroSD slot)
32 */ 32 */
33 33
34/* MMCIPOWER bits */
35#define MCI_DATA2DIREN (1 << 2)
36#define MCI_CMDDIREN (1 << 3)
37#define MCI_DATA0DIREN (1 << 4)
38#define MCI_DATA31DIREN (1 << 5)
39#define MCI_FBCLKEN (1 << 7)
40
41/* GPIO pins used by the sdi0 level shifter */ 34/* GPIO pins used by the sdi0 level shifter */
42static int sdi0_en = -1; 35static int sdi0_en = -1;
43static int sdi0_vsel = -1; 36static int sdi0_vsel = -1;
44 37
45static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd, 38static int mop500_sdi0_ios_handler(struct device *dev, struct mmc_ios *ios)
46 unsigned char power_mode)
47{ 39{
48 switch (power_mode) { 40 switch (ios->power_mode) {
49 case MMC_POWER_UP: 41 case MMC_POWER_UP:
50 case MMC_POWER_ON: 42 case MMC_POWER_ON:
51 /* 43 /*
@@ -65,8 +57,7 @@ static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd,
65 break; 57 break;
66 } 58 }
67 59
68 return MCI_FBCLKEN | MCI_CMDDIREN | MCI_DATA0DIREN | 60 return 0;
69 MCI_DATA2DIREN | MCI_DATA31DIREN;
70} 61}
71 62
72#ifdef CONFIG_STE_DMA40 63#ifdef CONFIG_STE_DMA40
@@ -90,13 +81,17 @@ static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
90#endif 81#endif
91 82
92static struct mmci_platform_data mop500_sdi0_data = { 83static struct mmci_platform_data mop500_sdi0_data = {
93 .vdd_handler = mop500_sdi0_vdd_handler, 84 .ios_handler = mop500_sdi0_ios_handler,
94 .ocr_mask = MMC_VDD_29_30, 85 .ocr_mask = MMC_VDD_29_30,
95 .f_max = 50000000, 86 .f_max = 50000000,
96 .capabilities = MMC_CAP_4_BIT_DATA | 87 .capabilities = MMC_CAP_4_BIT_DATA |
97 MMC_CAP_SD_HIGHSPEED | 88 MMC_CAP_SD_HIGHSPEED |
98 MMC_CAP_MMC_HIGHSPEED, 89 MMC_CAP_MMC_HIGHSPEED,
99 .gpio_wp = -1, 90 .gpio_wp = -1,
91 .sigdir = MCI_ST_FBCLKEN |
92 MCI_ST_CMDDIREN |
93 MCI_ST_DATA0DIREN |
94 MCI_ST_DATA2DIREN,
100#ifdef CONFIG_STE_DMA40 95#ifdef CONFIG_STE_DMA40
101 .dma_filter = stedma40_filter, 96 .dma_filter = stedma40_filter,
102 .dma_rx_param = &mop500_sdi0_dma_cfg_rx, 97 .dma_rx_param = &mop500_sdi0_dma_cfg_rx,
diff --git a/arch/arm/mach-ux500/board-mop500-u8500uib.c b/arch/arm/mach-ux500/board-mop500-u8500uib.c
index feb5744d98b..ead91c968ff 100644
--- a/arch/arm/mach-ux500/board-mop500-u8500uib.c
+++ b/arch/arm/mach-ux500/board-mop500-u8500uib.c
@@ -8,7 +8,6 @@
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/i2c.h> 10#include <linux/i2c.h>
11#include <linux/gpio.h>
12#include <linux/interrupt.h> 11#include <linux/interrupt.h>
13#include <linux/mfd/tc3589x.h> 12#include <linux/mfd/tc3589x.h>
14#include <linux/input/matrix_keypad.h> 13#include <linux/input/matrix_keypad.h>
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 5c00712907d..6d672a556df 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -72,7 +72,7 @@ static struct platform_device snowball_led_dev = {
72}; 72};
73 73
74static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { 74static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
75 .gpio_base = MOP500_AB8500_GPIO(0), 75 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
76 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, 76 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
77 /* config_reg is the initial configuration of ab8500 pins. 77 /* config_reg is the initial configuration of ab8500 pins.
78 * The pins can be configured as GPIO or alt functions based 78 * The pins can be configured as GPIO or alt functions based
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index f926d3db620..7ff6cbffc10 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -63,7 +63,7 @@
63 * because the AB8500 GPIO pins are enumbered starting from 1, so the value in 63 * because the AB8500 GPIO pins are enumbered starting from 1, so the value in
64 * parens matches the GPIO pin number in the data sheet. 64 * parens matches the GPIO pin number in the data sheet.
65 */ 65 */
66#define MOP500_AB8500_GPIO(x) (MOP500_EGPIO_END + (x) - 1) 66#define MOP500_AB8500_PIN_GPIO(x) (MOP500_EGPIO_END + (x) - 1)
67/*Snowball AB8500 GPIO */ 67/*Snowball AB8500 GPIO */
68#define SNOWBALL_VSMPS2_1V8_GPIO MOP500_AB8500_PIN_GPIO(1) /* SYSCLKREQ2/GPIO1 */ 68#define SNOWBALL_VSMPS2_1V8_GPIO MOP500_AB8500_PIN_GPIO(1) /* SYSCLKREQ2/GPIO1 */
69#define SNOWBALL_PM_GPIO1_GPIO MOP500_AB8500_PIN_GPIO(2) /* SYSCLKREQ3/GPIO2 */ 69#define SNOWBALL_PM_GPIO1_GPIO MOP500_AB8500_PIN_GPIO(2) /* SYSCLKREQ3/GPIO2 */
diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c
index 73790753700..ec35f0aa566 100644
--- a/arch/arm/mach-ux500/clock.c
+++ b/arch/arm/mach-ux500/clock.c
@@ -223,6 +223,13 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
223} 223}
224EXPORT_SYMBOL(clk_set_rate); 224EXPORT_SYMBOL(clk_set_rate);
225 225
226int clk_set_parent(struct clk *clk, struct clk *parent)
227{
228 /*TODO*/
229 return -ENOSYS;
230}
231EXPORT_SYMBOL(clk_set_parent);
232
226static void clk_prcmu_enable(struct clk *clk) 233static void clk_prcmu_enable(struct clk *clk)
227{ 234{
228 void __iomem *cg_set_reg = __io_address(U8500_PRCMU_BASE) 235 void __iomem *cg_set_reg = __io_address(U8500_PRCMU_BASE)
diff --git a/arch/arm/mach-ux500/clock.h b/arch/arm/mach-ux500/clock.h
index 07449070522..d776ada08db 100644
--- a/arch/arm/mach-ux500/clock.h
+++ b/arch/arm/mach-ux500/clock.h
@@ -21,6 +21,7 @@ struct clkops {
21 void (*enable) (struct clk *); 21 void (*enable) (struct clk *);
22 void (*disable) (struct clk *); 22 void (*disable) (struct clk *);
23 unsigned long (*get_rate) (struct clk *); 23 unsigned long (*get_rate) (struct clk *);
24 int (*set_parent)(struct clk *, struct clk *);
24}; 25};
25 26
26/** 27/**
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index f4185749437..851308bf642 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -14,7 +14,6 @@
14 14
15#include <asm/hardware/gic.h> 15#include <asm/hardware/gic.h>
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17#include <asm/localtimer.h>
18 17
19#include <mach/hardware.h> 18#include <mach/hardware.h>
20#include <mach/setup.h> 19#include <mach/setup.h>
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index c563e5418d8..898a64517b0 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -26,29 +26,22 @@ dbx500_add_amba_device(const char *name, resource_size_t base,
26 struct amba_device *dev; 26 struct amba_device *dev;
27 int ret; 27 int ret;
28 28
29 dev = kzalloc(sizeof *dev, GFP_KERNEL); 29 dev = amba_device_alloc(name, base, SZ_4K);
30 if (!dev) 30 if (!dev)
31 return ERR_PTR(-ENOMEM); 31 return ERR_PTR(-ENOMEM);
32 32
33 dev->dev.init_name = name;
34
35 dev->res.start = base;
36 dev->res.end = base + SZ_4K - 1;
37 dev->res.flags = IORESOURCE_MEM;
38
39 dev->dma_mask = DMA_BIT_MASK(32); 33 dev->dma_mask = DMA_BIT_MASK(32);
40 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 34 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
41 35
42 dev->irq[0] = irq; 36 dev->irq[0] = irq;
43 dev->irq[1] = NO_IRQ;
44 37
45 dev->periphid = periphid; 38 dev->periphid = periphid;
46 39
47 dev->dev.platform_data = pdata; 40 dev->dev.platform_data = pdata;
48 41
49 ret = amba_device_register(dev, &iomem_resource); 42 ret = amba_device_add(dev, &iomem_resource);
50 if (ret) { 43 if (ret) {
51 kfree(dev); 44 amba_device_put(dev);
52 return ERR_PTR(ret); 45 return ERR_PTR(ret);
53 } 46 }
54 47
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index a7c6cdc9b11..6e66d3777ed 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -101,6 +101,9 @@ static const dma_addr_t dma40_tx_map[DB8500_DMA_NR_DEV] = {
101 [DB8500_DMA_DEV41_SD_MM3_TX] = -1, 101 [DB8500_DMA_DEV41_SD_MM3_TX] = -1,
102 [DB8500_DMA_DEV42_SD_MM4_TX] = -1, 102 [DB8500_DMA_DEV42_SD_MM4_TX] = -1,
103 [DB8500_DMA_DEV43_SD_MM5_TX] = -1, 103 [DB8500_DMA_DEV43_SD_MM5_TX] = -1,
104 [DB8500_DMA_DEV14_MSP2_TX] = U8500_MSP2_BASE + MSP_TX_RX_REG_OFFSET,
105 [DB8500_DMA_DEV30_MSP1_TX] = U8500_MSP1_BASE + MSP_TX_RX_REG_OFFSET,
106 [DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX] = U8500_MSP0_BASE + MSP_TX_RX_REG_OFFSET,
104}; 107};
105 108
106/* Mapping between source event lines and physical device address */ 109/* Mapping between source event lines and physical device address */
@@ -133,6 +136,9 @@ static const dma_addr_t dma40_rx_map[DB8500_DMA_NR_DEV] = {
133 [DB8500_DMA_DEV41_SD_MM3_RX] = -1, 136 [DB8500_DMA_DEV41_SD_MM3_RX] = -1,
134 [DB8500_DMA_DEV42_SD_MM4_RX] = -1, 137 [DB8500_DMA_DEV42_SD_MM4_RX] = -1,
135 [DB8500_DMA_DEV43_SD_MM5_RX] = -1, 138 [DB8500_DMA_DEV43_SD_MM5_RX] = -1,
139 [DB8500_DMA_DEV14_MSP2_RX] = U8500_MSP2_BASE + MSP_TX_RX_REG_OFFSET,
140 [DB8500_DMA_DEV30_MSP3_RX] = U8500_MSP3_BASE + MSP_TX_RX_REG_OFFSET,
141 [DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX] = U8500_MSP0_BASE + MSP_TX_RX_REG_OFFSET,
136}; 142};
137 143
138/* Reserved event lines for memcpy only */ 144/* Reserved event lines for memcpy only */
diff --git a/arch/arm/mach-ux500/include/mach/entry-macro.S b/arch/arm/mach-ux500/include/mach/entry-macro.S
deleted file mode 100644
index e16299e1020..00000000000
--- a/arch/arm/mach-ux500/include/mach/entry-macro.S
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * Low-level IRQ helper macros for U8500 platforms
3 *
4 * Copyright (C) 2009 ST-Ericsson.
5 *
6 * This file is a copy of ARM Realview platform.
7 * -just satisfied checkpatch script.
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 .macro disable_fiq
15 .endm
16
17 .macro arch_ret_to_user, tmp1, tmp2
18 .endm
diff --git a/arch/arm/mach-ux500/include/mach/hardware.h b/arch/arm/mach-ux500/include/mach/hardware.h
index b6ba26a1367..d93d6dbef25 100644
--- a/arch/arm/mach-ux500/include/mach/hardware.h
+++ b/arch/arm/mach-ux500/include/mach/hardware.h
@@ -30,6 +30,8 @@
30#include <mach/db8500-regs.h> 30#include <mach/db8500-regs.h>
31#include <mach/db5500-regs.h> 31#include <mach/db5500-regs.h>
32 32
33#define MSP_TX_RX_REG_OFFSET 0
34
33#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
34 36
35#include <mach/id.h> 37#include <mach/id.h>
diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/include/mach/irqs.h
index 9db68d264c5..c23a6b5f0c4 100644
--- a/arch/arm/mach-ux500/include/mach/irqs.h
+++ b/arch/arm/mach-ux500/include/mach/irqs.h
@@ -43,7 +43,7 @@
43/* This will be overridden by board-specific irq headers */ 43/* This will be overridden by board-specific irq headers */
44#define IRQ_BOARD_END IRQ_BOARD_START 44#define IRQ_BOARD_END IRQ_BOARD_START
45 45
46#ifdef CONFIG_MACH_U8500 46#ifdef CONFIG_MACH_MOP500
47#include <mach/irqs-board-mop500.h> 47#include <mach/irqs-board-mop500.h>
48#endif 48#endif
49 49
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index a7d363fdb4c..93d403955ea 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -27,9 +27,6 @@ extern void __init u5500_sdi_init(void);
27 27
28extern void __init db5500_dma_init(void); 28extern void __init db5500_dma_init(void);
29 29
30/* We re-use nomadik_timer for this platform */
31extern void nmdk_timer_init(void);
32
33struct amba_device; 30struct amba_device;
34extern void __init amba_add_devices(struct amba_device *devs[], int num); 31extern void __init amba_add_devices(struct amba_device *devs[], int num);
35 32
diff --git a/arch/arm/mach-ux500/include/mach/system.h b/arch/arm/mach-ux500/include/mach/system.h
deleted file mode 100644
index 258e5c919c2..00000000000
--- a/arch/arm/mach-ux500/include/mach/system.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright (C) 2009 ST-Ericsson.
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#ifndef __ASM_ARCH_SYSTEM_H
9#define __ASM_ARCH_SYSTEM_H
10
11static inline void arch_idle(void)
12{
13 /*
14 * This should do all the clock switching
15 * and wait for interrupt tricks
16 */
17 cpu_do_idle();
18}
19
20#endif
diff --git a/arch/arm/mach-ux500/localtimer.c b/arch/arm/mach-ux500/localtimer.c
deleted file mode 100644
index 5ba113309a0..00000000000
--- a/arch/arm/mach-ux500/localtimer.c
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2008-2009 ST-Ericsson
3 * Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
4 *
5 * This file is heavily based on relaview platform, almost a copy.
6 *
7 * Copyright (C) 2002 ARM Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/init.h>
14#include <linux/smp.h>
15#include <linux/clockchips.h>
16
17#include <asm/irq.h>
18#include <asm/smp_twd.h>
19#include <asm/localtimer.h>
20
21/*
22 * Setup the local clock events for a CPU.
23 */
24int __cpuinit local_timer_setup(struct clock_event_device *evt)
25{
26 evt->irq = IRQ_LOCALTIMER;
27 twd_timer_setup(evt);
28 return 0;
29}
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index aea467d04ff..e9d580702fb 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -8,28 +8,46 @@
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/clksrc-dbx500-prcmu.h> 9#include <linux/clksrc-dbx500-prcmu.h>
10 10
11#include <asm/localtimer.h> 11#include <asm/smp_twd.h>
12 12
13#include <plat/mtu.h> 13#include <plat/mtu.h>
14 14
15#include <mach/setup.h> 15#include <mach/setup.h>
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <mach/irqs.h>
18
19#ifdef CONFIG_HAVE_ARM_TWD
20static DEFINE_TWD_LOCAL_TIMER(u5500_twd_local_timer,
21 U5500_TWD_BASE, IRQ_LOCALTIMER);
22static DEFINE_TWD_LOCAL_TIMER(u8500_twd_local_timer,
23 U8500_TWD_BASE, IRQ_LOCALTIMER);
24
25static void __init ux500_twd_init(void)
26{
27 struct twd_local_timer *twd_local_timer;
28 int err;
29
30 twd_local_timer = cpu_is_u5500() ? &u5500_twd_local_timer :
31 &u8500_twd_local_timer;
32
33 err = twd_local_timer_register(twd_local_timer);
34 if (err)
35 pr_err("twd_local_timer_register failed %d\n", err);
36}
37#else
38#define ux500_twd_init() do { } while(0)
39#endif
17 40
18static void __init ux500_timer_init(void) 41static void __init ux500_timer_init(void)
19{ 42{
43 void __iomem *mtu_timer_base;
20 void __iomem *prcmu_timer_base; 44 void __iomem *prcmu_timer_base;
21 45
22 if (cpu_is_u5500()) { 46 if (cpu_is_u5500()) {
23#ifdef CONFIG_LOCAL_TIMERS 47 mtu_timer_base = __io_address(U5500_MTU0_BASE);
24 twd_base = __io_address(U5500_TWD_BASE);
25#endif
26 mtu_base = __io_address(U5500_MTU0_BASE);
27 prcmu_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE); 48 prcmu_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE);
28 } else if (cpu_is_u8500()) { 49 } else if (cpu_is_u8500()) {
29#ifdef CONFIG_LOCAL_TIMERS 50 mtu_timer_base = __io_address(U8500_MTU0_BASE);
30 twd_base = __io_address(U8500_TWD_BASE);
31#endif
32 mtu_base = __io_address(U8500_MTU0_BASE);
33 prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); 51 prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE);
34 } else { 52 } else {
35 ux500_unknown_soc(); 53 ux500_unknown_soc();
@@ -52,8 +70,9 @@ static void __init ux500_timer_init(void)
52 * 70 *
53 */ 71 */
54 72
55 nmdk_timer_init(); 73 nmdk_timer_init(mtu_timer_base);
56 clksrc_dbx500_prcmu_init(prcmu_timer_base); 74 clksrc_dbx500_prcmu_init(prcmu_timer_base);
75 ux500_twd_init();
57} 76}
58 77
59static void ux500_timer_reset(void) 78static void ux500_timer_reset(void)
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 008ce22b9a0..0968772aedb 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -585,58 +585,58 @@ static struct pl022_ssp_controller ssp0_plat_data = {
585 .num_chipselect = 1, 585 .num_chipselect = 1,
586}; 586};
587 587
588#define AACI_IRQ { IRQ_AACI, NO_IRQ } 588#define AACI_IRQ { IRQ_AACI }
589#define MMCI0_IRQ { IRQ_MMCI0A,IRQ_SIC_MMCI0B } 589#define MMCI0_IRQ { IRQ_MMCI0A,IRQ_SIC_MMCI0B }
590#define KMI0_IRQ { IRQ_SIC_KMI0, NO_IRQ } 590#define KMI0_IRQ { IRQ_SIC_KMI0 }
591#define KMI1_IRQ { IRQ_SIC_KMI1, NO_IRQ } 591#define KMI1_IRQ { IRQ_SIC_KMI1 }
592 592
593/* 593/*
594 * These devices are connected directly to the multi-layer AHB switch 594 * These devices are connected directly to the multi-layer AHB switch
595 */ 595 */
596#define SMC_IRQ { NO_IRQ, NO_IRQ } 596#define SMC_IRQ { }
597#define MPMC_IRQ { NO_IRQ, NO_IRQ } 597#define MPMC_IRQ { }
598#define CLCD_IRQ { IRQ_CLCDINT, NO_IRQ } 598#define CLCD_IRQ { IRQ_CLCDINT }
599#define DMAC_IRQ { IRQ_DMAINT, NO_IRQ } 599#define DMAC_IRQ { IRQ_DMAINT }
600 600
601/* 601/*
602 * These devices are connected via the core APB bridge 602 * These devices are connected via the core APB bridge
603 */ 603 */
604#define SCTL_IRQ { NO_IRQ, NO_IRQ } 604#define SCTL_IRQ { }
605#define WATCHDOG_IRQ { IRQ_WDOGINT, NO_IRQ } 605#define WATCHDOG_IRQ { IRQ_WDOGINT }
606#define GPIO0_IRQ { IRQ_GPIOINT0, NO_IRQ } 606#define GPIO0_IRQ { IRQ_GPIOINT0 }
607#define GPIO1_IRQ { IRQ_GPIOINT1, NO_IRQ } 607#define GPIO1_IRQ { IRQ_GPIOINT1 }
608#define RTC_IRQ { IRQ_RTCINT, NO_IRQ } 608#define RTC_IRQ { IRQ_RTCINT }
609 609
610/* 610/*
611 * These devices are connected via the DMA APB bridge 611 * These devices are connected via the DMA APB bridge
612 */ 612 */
613#define SCI_IRQ { IRQ_SCIINT, NO_IRQ } 613#define SCI_IRQ { IRQ_SCIINT }
614#define UART0_IRQ { IRQ_UARTINT0, NO_IRQ } 614#define UART0_IRQ { IRQ_UARTINT0 }
615#define UART1_IRQ { IRQ_UARTINT1, NO_IRQ } 615#define UART1_IRQ { IRQ_UARTINT1 }
616#define UART2_IRQ { IRQ_UARTINT2, NO_IRQ } 616#define UART2_IRQ { IRQ_UARTINT2 }
617#define SSP_IRQ { IRQ_SSPINT, NO_IRQ } 617#define SSP_IRQ { IRQ_SSPINT }
618 618
619/* FPGA Primecells */ 619/* FPGA Primecells */
620AMBA_DEVICE(aaci, "fpga:04", AACI, NULL); 620APB_DEVICE(aaci, "fpga:04", AACI, NULL);
621AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &mmc0_plat_data); 621APB_DEVICE(mmc0, "fpga:05", MMCI0, &mmc0_plat_data);
622AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL); 622APB_DEVICE(kmi0, "fpga:06", KMI0, NULL);
623AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL); 623APB_DEVICE(kmi1, "fpga:07", KMI1, NULL);
624 624
625/* DevChip Primecells */ 625/* DevChip Primecells */
626AMBA_DEVICE(smc, "dev:00", SMC, NULL); 626AHB_DEVICE(smc, "dev:00", SMC, NULL);
627AMBA_DEVICE(mpmc, "dev:10", MPMC, NULL); 627AHB_DEVICE(mpmc, "dev:10", MPMC, NULL);
628AMBA_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data); 628AHB_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data);
629AMBA_DEVICE(dmac, "dev:30", DMAC, NULL); 629AHB_DEVICE(dmac, "dev:30", DMAC, NULL);
630AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL); 630APB_DEVICE(sctl, "dev:e0", SCTL, NULL);
631AMBA_DEVICE(wdog, "dev:e1", WATCHDOG, NULL); 631APB_DEVICE(wdog, "dev:e1", WATCHDOG, NULL);
632AMBA_DEVICE(gpio0, "dev:e4", GPIO0, &gpio0_plat_data); 632APB_DEVICE(gpio0, "dev:e4", GPIO0, &gpio0_plat_data);
633AMBA_DEVICE(gpio1, "dev:e5", GPIO1, &gpio1_plat_data); 633APB_DEVICE(gpio1, "dev:e5", GPIO1, &gpio1_plat_data);
634AMBA_DEVICE(rtc, "dev:e8", RTC, NULL); 634APB_DEVICE(rtc, "dev:e8", RTC, NULL);
635AMBA_DEVICE(sci0, "dev:f0", SCI, NULL); 635APB_DEVICE(sci0, "dev:f0", SCI, NULL);
636AMBA_DEVICE(uart0, "dev:f1", UART0, NULL); 636APB_DEVICE(uart0, "dev:f1", UART0, NULL);
637AMBA_DEVICE(uart1, "dev:f2", UART1, NULL); 637APB_DEVICE(uart1, "dev:f2", UART1, NULL);
638AMBA_DEVICE(uart2, "dev:f3", UART2, NULL); 638APB_DEVICE(uart2, "dev:f3", UART2, NULL);
639AMBA_DEVICE(ssp0, "dev:f4", SSP, &ssp0_plat_data); 639APB_DEVICE(ssp0, "dev:f4", SSP, &ssp0_plat_data);
640 640
641static struct amba_device *amba_devs[] __initdata = { 641static struct amba_device *amba_devs[] __initdata = {
642 &dmac_device, 642 &dmac_device,
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h
index 2ef2f555f31..683e60776a8 100644
--- a/arch/arm/mach-versatile/core.h
+++ b/arch/arm/mach-versatile/core.h
@@ -36,20 +36,10 @@ extern unsigned int mmc_status(struct device *dev);
36extern struct of_dev_auxdata versatile_auxdata_lookup[]; 36extern struct of_dev_auxdata versatile_auxdata_lookup[];
37#endif 37#endif
38 38
39#define AMBA_DEVICE(name,busid,base,plat) \ 39#define APB_DEVICE(name, busid, base, plat) \
40static struct amba_device name##_device = { \ 40static AMBA_APB_DEVICE(name, busid, 0, VERSATILE_##base##_BASE, base##_IRQ, plat)
41 .dev = { \ 41
42 .coherent_dma_mask = ~0, \ 42#define AHB_DEVICE(name, busid, base, plat) \
43 .init_name = busid, \ 43static AMBA_AHB_DEVICE(name, busid, 0, VERSATILE_##base##_BASE, base##_IRQ, plat)
44 .platform_data = plat, \
45 }, \
46 .res = { \
47 .start = VERSATILE_##base##_BASE, \
48 .end = (VERSATILE_##base##_BASE) + SZ_4K - 1,\
49 .flags = IORESOURCE_MEM, \
50 }, \
51 .dma_mask = ~0, \
52 .irq = base##_IRQ, \
53}
54 44
55#endif 45#endif
diff --git a/arch/arm/mach-versatile/include/mach/entry-macro.S b/arch/arm/mach-versatile/include/mach/entry-macro.S
deleted file mode 100644
index b6f0dbf122e..00000000000
--- a/arch/arm/mach-versatile/include/mach/entry-macro.S
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * arch/arm/mach-versatile/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Versatile platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11 .macro disable_fiq
12 .endm
13
14 .macro arch_ret_to_user, tmp1, tmp2
15 .endm
diff --git a/arch/arm/mach-versatile/include/mach/system.h b/arch/arm/mach-versatile/include/mach/system.h
deleted file mode 100644
index f3fa347895f..00000000000
--- a/arch/arm/mach-versatile/include/mach/system.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm/mach-versatile/include/mach/system.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24static inline void arch_idle(void)
25{
26 /*
27 * This should do all the clock switching
28 * and wait for interrupt tricks
29 */
30 cpu_do_idle();
31}
32
33#endif
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index 90069bce23b..51733b022d0 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -219,9 +219,9 @@ static int __init pci_versatile_setup_resources(struct list_head *resources)
219 * the mem resource for this bus 219 * the mem resource for this bus
220 * the prefetch mem resource for this bus 220 * the prefetch mem resource for this bus
221 */ 221 */
222 pci_add_resource(resources, &io_mem); 222 pci_add_resource_offset(resources, &io_mem, sys->io_offset);
223 pci_add_resource(resources, &non_mem); 223 pci_add_resource_offset(resources, &non_mem, sys->mem_offset);
224 pci_add_resource(resources, &pre_mem); 224 pci_add_resource_offset(resources, &pre_mem, sys->mem_offset);
225 225
226 goto out; 226 goto out;
227 227
diff --git a/arch/arm/mach-versatile/versatile_pb.c b/arch/arm/mach-versatile/versatile_pb.c
index 9581c197500..19738331bd3 100644
--- a/arch/arm/mach-versatile/versatile_pb.c
+++ b/arch/arm/mach-versatile/versatile_pb.c
@@ -58,28 +58,28 @@ static struct pl061_platform_data gpio3_plat_data = {
58 .irq_base = IRQ_GPIO3_START, 58 .irq_base = IRQ_GPIO3_START,
59}; 59};
60 60
61#define UART3_IRQ { IRQ_SIC_UART3, NO_IRQ } 61#define UART3_IRQ { IRQ_SIC_UART3 }
62#define SCI1_IRQ { IRQ_SIC_SCI3, NO_IRQ } 62#define SCI1_IRQ { IRQ_SIC_SCI3 }
63#define MMCI1_IRQ { IRQ_MMCI1A, IRQ_SIC_MMCI1B } 63#define MMCI1_IRQ { IRQ_MMCI1A, IRQ_SIC_MMCI1B }
64 64
65/* 65/*
66 * These devices are connected via the core APB bridge 66 * These devices are connected via the core APB bridge
67 */ 67 */
68#define GPIO2_IRQ { IRQ_GPIOINT2, NO_IRQ } 68#define GPIO2_IRQ { IRQ_GPIOINT2 }
69#define GPIO3_IRQ { IRQ_GPIOINT3, NO_IRQ } 69#define GPIO3_IRQ { IRQ_GPIOINT3 }
70 70
71/* 71/*
72 * These devices are connected via the DMA APB bridge 72 * These devices are connected via the DMA APB bridge
73 */ 73 */
74 74
75/* FPGA Primecells */ 75/* FPGA Primecells */
76AMBA_DEVICE(uart3, "fpga:09", UART3, NULL); 76APB_DEVICE(uart3, "fpga:09", UART3, NULL);
77AMBA_DEVICE(sci1, "fpga:0a", SCI1, NULL); 77APB_DEVICE(sci1, "fpga:0a", SCI1, NULL);
78AMBA_DEVICE(mmc1, "fpga:0b", MMCI1, &mmc1_plat_data); 78APB_DEVICE(mmc1, "fpga:0b", MMCI1, &mmc1_plat_data);
79 79
80/* DevChip Primecells */ 80/* DevChip Primecells */
81AMBA_DEVICE(gpio2, "dev:e6", GPIO2, &gpio2_plat_data); 81APB_DEVICE(gpio2, "dev:e6", GPIO2, &gpio2_plat_data);
82AMBA_DEVICE(gpio3, "dev:e7", GPIO3, &gpio3_plat_data); 82APB_DEVICE(gpio3, "dev:e7", GPIO3, &gpio3_plat_data);
83 83
84static struct amba_device *amba_devs[] __initdata = { 84static struct amba_device *amba_devs[] __initdata = {
85 &uart3_device, 85 &uart3_device,
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index 88c3ba151e8..cf8730d35e7 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -1,14 +1,55 @@
1menu "Versatile Express platform type" 1menu "Versatile Express platform type"
2 depends on ARCH_VEXPRESS 2 depends on ARCH_VEXPRESS
3 3
4config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA
5 bool
6 select ARM_ERRATA_720789
7 select ARM_ERRATA_751472
8 select PL310_ERRATA_753970 if CACHE_PL310
9 help
10 Provides common dependencies for Versatile Express platforms
11 based on Cortex-A5 and Cortex-A9 processors. In order to
12 build a working kernel, you must also enable relevant core
13 tile support or Flattened Device Tree based support options.
14
4config ARCH_VEXPRESS_CA9X4 15config ARCH_VEXPRESS_CA9X4
5 bool "Versatile Express Cortex-A9x4 tile" 16 bool "Versatile Express Cortex-A9x4 tile"
17 select ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA
18 select ARM_GIC
6 select CPU_V7 19 select CPU_V7
20 select HAVE_SMP
21 select MIGHT_HAVE_CACHE_L2X0
22
23config ARCH_VEXPRESS_DT
24 bool "Device Tree support for Versatile Express platforms"
25 select ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA
7 select ARM_GIC 26 select ARM_GIC
8 select ARM_ERRATA_720789 27 select ARM_PATCH_PHYS_VIRT
9 select ARM_ERRATA_751472 28 select AUTO_ZRELADDR
10 select PL310_ERRATA_753970 29 select CPU_V7
11 select HAVE_SMP 30 select HAVE_SMP
12 select MIGHT_HAVE_CACHE_L2X0 31 select MIGHT_HAVE_CACHE_L2X0
32 select USE_OF
33 help
34 New Versatile Express platforms require Flattened Device Tree to
35 be passed to the kernel.
36
37 This option enables support for systems using Cortex processor based
38 ARM core and logic (FPGA) tiles on the Versatile Express motherboard,
39 for example:
40
41 - CoreTile Express A5x2 (V2P-CA5s)
42 - CoreTile Express A9x4 (V2P-CA9)
43 - CoreTile Express A15x2 (V2P-CA15)
44 - LogicTile Express 13MG (V2F-2XV6) with A5, A7, A9 or A15 SMMs
45 (Soft Macrocell Models)
46 - Versatile Express RTSMs (Models)
47
48 You must boot using a Flattened Device Tree in order to use these
49 platforms. The traditional (ATAGs) boot method is not usable on
50 these boards with this option.
51
52 If your bootloader supports Flattened Device Tree based booting,
53 say Y here.
13 54
14endmenu 55endmenu
diff --git a/arch/arm/mach-vexpress/Makefile.boot b/arch/arm/mach-vexpress/Makefile.boot
index 8630b3d10a4..909f85ebf5f 100644
--- a/arch/arm/mach-vexpress/Makefile.boot
+++ b/arch/arm/mach-vexpress/Makefile.boot
@@ -1,3 +1,9 @@
1# Those numbers are used only by the non-DT V2P-CA9 platform
2# The DT-enabled ones require CONFIG_AUTO_ZRELADDR=y
1 zreladdr-y += 0x60008000 3 zreladdr-y += 0x60008000
2params_phys-y := 0x60000100 4params_phys-y := 0x60000100
3initrd_phys-y := 0x60800000 5initrd_phys-y := 0x60800000
6
7dtb-$(CONFIG_ARCH_VEXPRESS_DT) += vexpress-v2p-ca5s.dtb \
8 vexpress-v2p-ca9.dtb \
9 vexpress-v2p-ca15-tc1.dtb
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
index f4397159c17..a3a4980770b 100644
--- a/arch/arm/mach-vexpress/core.h
+++ b/arch/arm/mach-vexpress/core.h
@@ -1,19 +1,7 @@
1#define __MMIO_P2V(x) (((x) & 0xfffff) | (((x) & 0x0f000000) >> 4) | 0xf8000000) 1/* 2MB large area for motherboard's peripherals static mapping */
2#define MMIO_P2V(x) ((void __iomem *)__MMIO_P2V(x)) 2#define V2M_PERIPH 0xf8000000
3 3
4#define AMBA_DEVICE(name,busid,base,plat) \ 4/* Tile's peripherals static mappings should start here */
5struct amba_device name##_device = { \ 5#define V2T_PERIPH 0xf8200000
6 .dev = { \ 6
7 .coherent_dma_mask = ~0UL, \ 7void vexpress_dt_smp_map_io(void);
8 .init_name = busid, \
9 .platform_data = plat, \
10 }, \
11 .res = { \
12 .start = base, \
13 .end = base + SZ_4K - 1, \
14 .flags = IORESOURCE_MEM, \
15 }, \
16 .dma_mask = ~0UL, \
17 .irq = IRQ_##base, \
18 /* .dma = DMA_##base,*/ \
19}
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index b1e87c184e5..c65cc3b462a 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -30,57 +30,40 @@
30 30
31#include <plat/clcd.h> 31#include <plat/clcd.h>
32 32
33#define V2M_PA_CS7 0x10000000
34
35static struct map_desc ct_ca9x4_io_desc[] __initdata = { 33static struct map_desc ct_ca9x4_io_desc[] __initdata = {
36 { 34 {
37 .virtual = __MMIO_P2V(CT_CA9X4_MPIC), 35 .virtual = V2T_PERIPH,
38 .pfn = __phys_to_pfn(CT_CA9X4_MPIC), 36 .pfn = __phys_to_pfn(CT_CA9X4_MPIC),
39 .length = SZ_16K, 37 .length = SZ_8K,
40 .type = MT_DEVICE, 38 .type = MT_DEVICE,
41 }, {
42 .virtual = __MMIO_P2V(CT_CA9X4_SP804_TIMER),
43 .pfn = __phys_to_pfn(CT_CA9X4_SP804_TIMER),
44 .length = SZ_4K,
45 .type = MT_DEVICE,
46 }, {
47 .virtual = __MMIO_P2V(CT_CA9X4_L2CC),
48 .pfn = __phys_to_pfn(CT_CA9X4_L2CC),
49 .length = SZ_4K,
50 .type = MT_DEVICE,
51 }, 39 },
52}; 40};
53 41
54static void __init ct_ca9x4_map_io(void) 42static void __init ct_ca9x4_map_io(void)
55{ 43{
56#ifdef CONFIG_LOCAL_TIMERS
57 twd_base = MMIO_P2V(A9_MPCORE_TWD);
58#endif
59 iotable_init(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc)); 44 iotable_init(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc));
60} 45}
61 46
62static void __init ct_ca9x4_init_irq(void) 47#ifdef CONFIG_HAVE_ARM_TWD
48static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, A9_MPCORE_TWD, IRQ_LOCALTIMER);
49
50static void __init ca9x4_twd_init(void)
63{ 51{
64 gic_init(0, 29, MMIO_P2V(A9_MPCORE_GIC_DIST), 52 int err = twd_local_timer_register(&twd_local_timer);
65 MMIO_P2V(A9_MPCORE_GIC_CPU)); 53 if (err)
54 pr_err("twd_local_timer_register failed %d\n", err);
66} 55}
56#else
57#define ca9x4_twd_init() do {} while(0)
58#endif
67 59
68#if 0 60static void __init ct_ca9x4_init_irq(void)
69static void __init ct_ca9x4_timer_init(void)
70{ 61{
71 writel(0, MMIO_P2V(CT_CA9X4_TIMER0) + TIMER_CTRL); 62 gic_init(0, 29, ioremap(A9_MPCORE_GIC_DIST, SZ_4K),
72 writel(0, MMIO_P2V(CT_CA9X4_TIMER1) + TIMER_CTRL); 63 ioremap(A9_MPCORE_GIC_CPU, SZ_256));
73 64 ca9x4_twd_init();
74 sp804_clocksource_init(MMIO_P2V(CT_CA9X4_TIMER1), "ct-timer1");
75 sp804_clockevents_init(MMIO_P2V(CT_CA9X4_TIMER0), IRQ_CT_CA9X4_TIMER0,
76 "ct-timer0");
77} 65}
78 66
79static struct sys_timer ct_ca9x4_timer = {
80 .init = ct_ca9x4_timer_init,
81};
82#endif
83
84static void ct_ca9x4_clcd_enable(struct clcd_fb *fb) 67static void ct_ca9x4_clcd_enable(struct clcd_fb *fb)
85{ 68{
86 v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE_DB1, 0); 69 v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE_DB1, 0);
@@ -109,10 +92,10 @@ static struct clcd_board ct_ca9x4_clcd_data = {
109 .remove = versatile_clcd_remove_dma, 92 .remove = versatile_clcd_remove_dma,
110}; 93};
111 94
112static AMBA_DEVICE(clcd, "ct:clcd", CT_CA9X4_CLCDC, &ct_ca9x4_clcd_data); 95static AMBA_AHB_DEVICE(clcd, "ct:clcd", 0, CT_CA9X4_CLCDC, IRQ_CT_CA9X4_CLCDC, &ct_ca9x4_clcd_data);
113static AMBA_DEVICE(dmc, "ct:dmc", CT_CA9X4_DMC, NULL); 96static AMBA_APB_DEVICE(dmc, "ct:dmc", 0, CT_CA9X4_DMC, IRQ_CT_CA9X4_DMC, NULL);
114static AMBA_DEVICE(smc, "ct:smc", CT_CA9X4_SMC, NULL); 97static AMBA_APB_DEVICE(smc, "ct:smc", 0, CT_CA9X4_SMC, IRQ_CT_CA9X4_SMC, NULL);
115static AMBA_DEVICE(gpio, "ct:gpio", CT_CA9X4_GPIO, NULL); 98static AMBA_APB_DEVICE(gpio, "ct:gpio", 0, CT_CA9X4_GPIO, IRQ_CT_CA9X4_GPIO, NULL);
116 99
117static struct amba_device *ct_ca9x4_amba_devs[] __initdata = { 100static struct amba_device *ct_ca9x4_amba_devs[] __initdata = {
118 &clcd_device, 101 &clcd_device,
@@ -201,7 +184,7 @@ static void __init ct_ca9x4_init(void)
201 int i; 184 int i;
202 185
203#ifdef CONFIG_CACHE_L2X0 186#ifdef CONFIG_CACHE_L2X0
204 void __iomem *l2x0_base = MMIO_P2V(CT_CA9X4_L2CC); 187 void __iomem *l2x0_base = ioremap(CT_CA9X4_L2CC, SZ_4K);
205 188
206 /* set RAM latencies to 1 cycle for this core tile. */ 189 /* set RAM latencies to 1 cycle for this core tile. */
207 writel(0, l2x0_base + L2X0_TAG_LATENCY_CTRL); 190 writel(0, l2x0_base + L2X0_TAG_LATENCY_CTRL);
@@ -217,9 +200,17 @@ static void __init ct_ca9x4_init(void)
217} 200}
218 201
219#ifdef CONFIG_SMP 202#ifdef CONFIG_SMP
203static void *ct_ca9x4_scu_base __initdata;
204
220static void __init ct_ca9x4_init_cpu_map(void) 205static void __init ct_ca9x4_init_cpu_map(void)
221{ 206{
222 int i, ncores = scu_get_core_count(MMIO_P2V(A9_MPCORE_SCU)); 207 int i, ncores;
208
209 ct_ca9x4_scu_base = ioremap(A9_MPCORE_SCU, SZ_128);
210 if (WARN_ON(!ct_ca9x4_scu_base))
211 return;
212
213 ncores = scu_get_core_count(ct_ca9x4_scu_base);
223 214
224 if (ncores > nr_cpu_ids) { 215 if (ncores > nr_cpu_ids) {
225 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", 216 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
@@ -235,7 +226,7 @@ static void __init ct_ca9x4_init_cpu_map(void)
235 226
236static void __init ct_ca9x4_smp_enable(unsigned int max_cpus) 227static void __init ct_ca9x4_smp_enable(unsigned int max_cpus)
237{ 228{
238 scu_enable(MMIO_P2V(A9_MPCORE_SCU)); 229 scu_enable(ct_ca9x4_scu_base);
239} 230}
240#endif 231#endif
241 232
diff --git a/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h b/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
index a34d3d4faae..84acf8439d4 100644
--- a/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
+++ b/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
@@ -22,9 +22,6 @@
22#define CT_CA9X4_SYSWDT (0x1e007000) 22#define CT_CA9X4_SYSWDT (0x1e007000)
23#define CT_CA9X4_L2CC (0x1e00a000) 23#define CT_CA9X4_L2CC (0x1e00a000)
24 24
25#define CT_CA9X4_TIMER0 (CT_CA9X4_SP804_TIMER + 0x000)
26#define CT_CA9X4_TIMER1 (CT_CA9X4_SP804_TIMER + 0x020)
27
28#define A9_MPCORE_SCU (CT_CA9X4_MPIC + 0x0000) 25#define A9_MPCORE_SCU (CT_CA9X4_MPIC + 0x0000)
29#define A9_MPCORE_GIC_CPU (CT_CA9X4_MPIC + 0x0100) 26#define A9_MPCORE_GIC_CPU (CT_CA9X4_MPIC + 0x0100)
30#define A9_MPCORE_GIT (CT_CA9X4_MPIC + 0x0200) 27#define A9_MPCORE_GIT (CT_CA9X4_MPIC + 0x0200)
@@ -35,7 +32,7 @@
35 * Interrupts. Those in {} are for AMBA devices 32 * Interrupts. Those in {} are for AMBA devices
36 */ 33 */
37#define IRQ_CT_CA9X4_CLCDC { 76 } 34#define IRQ_CT_CA9X4_CLCDC { 76 }
38#define IRQ_CT_CA9X4_DMC { -1 } 35#define IRQ_CT_CA9X4_DMC { 0 }
39#define IRQ_CT_CA9X4_SMC { 77, 78 } 36#define IRQ_CT_CA9X4_SMC { 77, 78 }
40#define IRQ_CT_CA9X4_TIMER0 80 37#define IRQ_CT_CA9X4_TIMER0 80
41#define IRQ_CT_CA9X4_TIMER1 81 38#define IRQ_CT_CA9X4_TIMER1 81
diff --git a/arch/arm/mach-vexpress/include/mach/debug-macro.S b/arch/arm/mach-vexpress/include/mach/debug-macro.S
index fd9e6c7ea49..fa8224794e0 100644
--- a/arch/arm/mach-vexpress/include/mach/debug-macro.S
+++ b/arch/arm/mach-vexpress/include/mach/debug-macro.S
@@ -10,12 +10,34 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13#define DEBUG_LL_UART_OFFSET 0x00009000 13#define DEBUG_LL_PHYS_BASE 0x10000000
14#define DEBUG_LL_UART_OFFSET 0x00009000
15
16#define DEBUG_LL_PHYS_BASE_RS1 0x1c000000
17#define DEBUG_LL_UART_OFFSET_RS1 0x00090000
18
19#define DEBUG_LL_VIRT_BASE 0xf8000000
14 20
15 .macro addruart,rp,rv,tmp 21 .macro addruart,rp,rv,tmp
16 mov \rp, #DEBUG_LL_UART_OFFSET 22
17 orr \rv, \rp, #0xf8000000 @ virtual base 23 @ Make an educated guess regarding the memory map:
18 orr \rp, \rp, #0x10000000 @ physical base 24 @ - the original A9 core tile, which has MPCore peripherals
25 @ located at 0x1e000000, should use UART at 0x10009000
26 @ - all other (RS1 complaint) tiles use UART mapped
27 @ at 0x1c090000
28 mrc p15, 4, \tmp, c15, c0, 0
29 cmp \tmp, #0x1e000000
30
31 @ Original memory map
32 moveq \rp, #DEBUG_LL_UART_OFFSET
33 orreq \rv, \rp, #DEBUG_LL_VIRT_BASE
34 orreq \rp, \rp, #DEBUG_LL_PHYS_BASE
35
36 @ RS1 memory map
37 movne \rp, #DEBUG_LL_UART_OFFSET_RS1
38 orrne \rv, \rp, #DEBUG_LL_VIRT_BASE
39 orrne \rp, \rp, #DEBUG_LL_PHYS_BASE_RS1
40
19 .endm 41 .endm
20 42
21#include <asm/hardware/debug-pl01x.S> 43#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-vexpress/include/mach/entry-macro.S b/arch/arm/mach-vexpress/include/mach/entry-macro.S
deleted file mode 100644
index a14f9e62ca9..00000000000
--- a/arch/arm/mach-vexpress/include/mach/entry-macro.S
+++ /dev/null
@@ -1,5 +0,0 @@
1 .macro disable_fiq
2 .endm
3
4 .macro arch_ret_to_user, tmp1, tmp2
5 .endm
diff --git a/arch/arm/mach-vexpress/include/mach/irqs.h b/arch/arm/mach-vexpress/include/mach/irqs.h
index 7054cbfc9de..4b10ee7657a 100644
--- a/arch/arm/mach-vexpress/include/mach/irqs.h
+++ b/arch/arm/mach-vexpress/include/mach/irqs.h
@@ -1,4 +1,4 @@
1#define IRQ_LOCALTIMER 29 1#define IRQ_LOCALTIMER 29
2#define IRQ_LOCALWDOG 30 2#define IRQ_LOCALWDOG 30
3 3
4#define NR_IRQS 128 4#define NR_IRQS 256
diff --git a/arch/arm/mach-vexpress/include/mach/motherboard.h b/arch/arm/mach-vexpress/include/mach/motherboard.h
index 0a3a3751840..31a92890893 100644
--- a/arch/arm/mach-vexpress/include/mach/motherboard.h
+++ b/arch/arm/mach-vexpress/include/mach/motherboard.h
@@ -39,33 +39,30 @@
39#define V2M_CF (V2M_PA_CS7 + 0x0001a000) 39#define V2M_CF (V2M_PA_CS7 + 0x0001a000)
40#define V2M_CLCD (V2M_PA_CS7 + 0x0001f000) 40#define V2M_CLCD (V2M_PA_CS7 + 0x0001f000)
41 41
42#define V2M_SYS_ID (V2M_SYSREGS + 0x000) 42/*
43#define V2M_SYS_SW (V2M_SYSREGS + 0x004) 43 * Offsets from SYSREGS base
44#define V2M_SYS_LED (V2M_SYSREGS + 0x008) 44 */
45#define V2M_SYS_100HZ (V2M_SYSREGS + 0x024) 45#define V2M_SYS_ID 0x000
46#define V2M_SYS_FLAGS (V2M_SYSREGS + 0x030) 46#define V2M_SYS_SW 0x004
47#define V2M_SYS_FLAGSSET (V2M_SYSREGS + 0x030) 47#define V2M_SYS_LED 0x008
48#define V2M_SYS_FLAGSCLR (V2M_SYSREGS + 0x034) 48#define V2M_SYS_100HZ 0x024
49#define V2M_SYS_NVFLAGS (V2M_SYSREGS + 0x038) 49#define V2M_SYS_FLAGS 0x030
50#define V2M_SYS_NVFLAGSSET (V2M_SYSREGS + 0x038) 50#define V2M_SYS_FLAGSSET 0x030
51#define V2M_SYS_NVFLAGSCLR (V2M_SYSREGS + 0x03c) 51#define V2M_SYS_FLAGSCLR 0x034
52#define V2M_SYS_MCI (V2M_SYSREGS + 0x048) 52#define V2M_SYS_NVFLAGS 0x038
53#define V2M_SYS_FLASH (V2M_SYSREGS + 0x03c) 53#define V2M_SYS_NVFLAGSSET 0x038
54#define V2M_SYS_CFGSW (V2M_SYSREGS + 0x058) 54#define V2M_SYS_NVFLAGSCLR 0x03c
55#define V2M_SYS_24MHZ (V2M_SYSREGS + 0x05c) 55#define V2M_SYS_MCI 0x048
56#define V2M_SYS_MISC (V2M_SYSREGS + 0x060) 56#define V2M_SYS_FLASH 0x03c
57#define V2M_SYS_DMA (V2M_SYSREGS + 0x064) 57#define V2M_SYS_CFGSW 0x058
58#define V2M_SYS_PROCID0 (V2M_SYSREGS + 0x084) 58#define V2M_SYS_24MHZ 0x05c
59#define V2M_SYS_PROCID1 (V2M_SYSREGS + 0x088) 59#define V2M_SYS_MISC 0x060
60#define V2M_SYS_CFGDATA (V2M_SYSREGS + 0x0a0) 60#define V2M_SYS_DMA 0x064
61#define V2M_SYS_CFGCTRL (V2M_SYSREGS + 0x0a4) 61#define V2M_SYS_PROCID0 0x084
62#define V2M_SYS_CFGSTAT (V2M_SYSREGS + 0x0a8) 62#define V2M_SYS_PROCID1 0x088
63 63#define V2M_SYS_CFGDATA 0x0a0
64#define V2M_TIMER0 (V2M_TIMER01 + 0x000) 64#define V2M_SYS_CFGCTRL 0x0a4
65#define V2M_TIMER1 (V2M_TIMER01 + 0x020) 65#define V2M_SYS_CFGSTAT 0x0a8
66
67#define V2M_TIMER2 (V2M_TIMER23 + 0x000)
68#define V2M_TIMER3 (V2M_TIMER23 + 0x020)
69 66
70 67
71/* 68/*
@@ -117,6 +114,13 @@
117 114
118int v2m_cfg_write(u32 devfn, u32 data); 115int v2m_cfg_write(u32 devfn, u32 data);
119int v2m_cfg_read(u32 devfn, u32 *data); 116int v2m_cfg_read(u32 devfn, u32 *data);
117void v2m_flags_set(u32 data);
118
119/*
120 * Miscellaneous
121 */
122#define SYS_MISC_MASTERSITE (1 << 14)
123#define SYS_PROCIDx_HBI_MASK 0xfff
120 124
121/* 125/*
122 * Core tile IDs 126 * Core tile IDs
diff --git a/arch/arm/mach-vexpress/include/mach/system.h b/arch/arm/mach-vexpress/include/mach/system.h
deleted file mode 100644
index f653a8e265b..00000000000
--- a/arch/arm/mach-vexpress/include/mach/system.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm/mach-vexpress/include/mach/system.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24static inline void arch_idle(void)
25{
26 /*
27 * This should do all the clock switching
28 * and wait for interrupt tricks
29 */
30 cpu_do_idle();
31}
32
33#endif
diff --git a/arch/arm/mach-vexpress/include/mach/uncompress.h b/arch/arm/mach-vexpress/include/mach/uncompress.h
index 7972c5748d0..7dab5596b86 100644
--- a/arch/arm/mach-vexpress/include/mach/uncompress.h
+++ b/arch/arm/mach-vexpress/include/mach/uncompress.h
@@ -22,7 +22,27 @@
22#define AMBA_UART_CR(base) (*(volatile unsigned char *)((base) + 0x30)) 22#define AMBA_UART_CR(base) (*(volatile unsigned char *)((base) + 0x30))
23#define AMBA_UART_FR(base) (*(volatile unsigned char *)((base) + 0x18)) 23#define AMBA_UART_FR(base) (*(volatile unsigned char *)((base) + 0x18))
24 24
25#define get_uart_base() (0x10000000 + 0x00009000) 25#define UART_BASE 0x10009000
26#define UART_BASE_RS1 0x1c090000
27
28static unsigned long get_uart_base(void)
29{
30 unsigned long mpcore_periph;
31
32 /*
33 * Make an educated guess regarding the memory map:
34 * - the original A9 core tile, which has MPCore peripherals
35 * located at 0x1e000000, should use UART at 0x10009000
36 * - all other (RS1 complaint) tiles use UART mapped
37 * at 0x1c090000
38 */
39 asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (mpcore_periph));
40
41 if (mpcore_periph == 0x1e000000)
42 return UART_BASE;
43 else
44 return UART_BASE_RS1;
45}
26 46
27/* 47/*
28 * This does not append a newline 48 * This does not append a newline
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 124ffb16909..14ba1128ae8 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -12,21 +12,168 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/of_fdt.h>
16
17#include <asm/smp_scu.h>
18#include <asm/hardware/gic.h>
19#include <asm/mach/map.h>
15 20
16#include <mach/motherboard.h> 21#include <mach/motherboard.h>
17#define V2M_PA_CS7 0x10000000
18 22
19#include "core.h" 23#include "core.h"
20 24
21extern void versatile_secondary_startup(void); 25extern void versatile_secondary_startup(void);
22 26
27#if defined(CONFIG_OF)
28
29static enum {
30 GENERIC_SCU,
31 CORTEX_A9_SCU,
32} vexpress_dt_scu __initdata = GENERIC_SCU;
33
34static struct map_desc vexpress_dt_cortex_a9_scu_map __initdata = {
35 .virtual = V2T_PERIPH,
36 /* .pfn set in vexpress_dt_init_cortex_a9_scu() */
37 .length = SZ_128,
38 .type = MT_DEVICE,
39};
40
41static void *vexpress_dt_cortex_a9_scu_base __initdata;
42
43const static char *vexpress_dt_cortex_a9_match[] __initconst = {
44 "arm,cortex-a5-scu",
45 "arm,cortex-a9-scu",
46 NULL
47};
48
49static int __init vexpress_dt_find_scu(unsigned long node,
50 const char *uname, int depth, void *data)
51{
52 if (of_flat_dt_match(node, vexpress_dt_cortex_a9_match)) {
53 phys_addr_t phys_addr;
54 __be32 *reg = of_get_flat_dt_prop(node, "reg", NULL);
55
56 if (WARN_ON(!reg))
57 return -EINVAL;
58
59 phys_addr = be32_to_cpup(reg);
60 vexpress_dt_scu = CORTEX_A9_SCU;
61
62 vexpress_dt_cortex_a9_scu_map.pfn = __phys_to_pfn(phys_addr);
63 iotable_init(&vexpress_dt_cortex_a9_scu_map, 1);
64 vexpress_dt_cortex_a9_scu_base = ioremap(phys_addr, SZ_256);
65 if (WARN_ON(!vexpress_dt_cortex_a9_scu_base))
66 return -EFAULT;
67 }
68
69 return 0;
70}
71
72void __init vexpress_dt_smp_map_io(void)
73{
74 if (initial_boot_params)
75 WARN_ON(of_scan_flat_dt(vexpress_dt_find_scu, NULL));
76}
77
78static int __init vexpress_dt_cpus_num(unsigned long node, const char *uname,
79 int depth, void *data)
80{
81 static int prev_depth = -1;
82 static int nr_cpus = -1;
83
84 if (prev_depth > depth && nr_cpus > 0)
85 return nr_cpus;
86
87 if (nr_cpus < 0 && strcmp(uname, "cpus") == 0)
88 nr_cpus = 0;
89
90 if (nr_cpus >= 0) {
91 const char *device_type = of_get_flat_dt_prop(node,
92 "device_type", NULL);
93
94 if (device_type && strcmp(device_type, "cpu") == 0)
95 nr_cpus++;
96 }
97
98 prev_depth = depth;
99
100 return 0;
101}
102
103static void __init vexpress_dt_smp_init_cpus(void)
104{
105 int ncores = 0, i;
106
107 switch (vexpress_dt_scu) {
108 case GENERIC_SCU:
109 ncores = of_scan_flat_dt(vexpress_dt_cpus_num, NULL);
110 break;
111 case CORTEX_A9_SCU:
112 ncores = scu_get_core_count(vexpress_dt_cortex_a9_scu_base);
113 break;
114 default:
115 WARN_ON(1);
116 break;
117 }
118
119 if (ncores < 2)
120 return;
121
122 if (ncores > nr_cpu_ids) {
123 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
124 ncores, nr_cpu_ids);
125 ncores = nr_cpu_ids;
126 }
127
128 for (i = 0; i < ncores; ++i)
129 set_cpu_possible(i, true);
130
131 set_smp_cross_call(gic_raise_softirq);
132}
133
134static void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus)
135{
136 int i;
137
138 switch (vexpress_dt_scu) {
139 case GENERIC_SCU:
140 for (i = 0; i < max_cpus; i++)
141 set_cpu_present(i, true);
142 break;
143 case CORTEX_A9_SCU:
144 scu_enable(vexpress_dt_cortex_a9_scu_base);
145 break;
146 default:
147 WARN_ON(1);
148 break;
149 }
150}
151
152#else
153
154static void __init vexpress_dt_smp_init_cpus(void)
155{
156 WARN_ON(1);
157}
158
159void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus)
160{
161 WARN_ON(1);
162}
163
164#endif
165
23/* 166/*
24 * Initialise the CPU possible map early - this describes the CPUs 167 * Initialise the CPU possible map early - this describes the CPUs
25 * which may be present or become present in the system. 168 * which may be present or become present in the system.
26 */ 169 */
27void __init smp_init_cpus(void) 170void __init smp_init_cpus(void)
28{ 171{
29 ct_desc->init_cpu_map(); 172 if (ct_desc)
173 ct_desc->init_cpu_map();
174 else
175 vexpress_dt_smp_init_cpus();
176
30} 177}
31 178
32void __init platform_smp_prepare_cpus(unsigned int max_cpus) 179void __init platform_smp_prepare_cpus(unsigned int max_cpus)
@@ -35,7 +182,10 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
35 * Initialise the present map, which describes the set of CPUs 182 * Initialise the present map, which describes the set of CPUs
36 * actually populated at the present time. 183 * actually populated at the present time.
37 */ 184 */
38 ct_desc->smp_enable(max_cpus); 185 if (ct_desc)
186 ct_desc->smp_enable(max_cpus);
187 else
188 vexpress_dt_smp_prepare_cpus(max_cpus);
39 189
40 /* 190 /*
41 * Write the address of secondary startup into the 191 * Write the address of secondary startup into the
@@ -43,7 +193,5 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
43 * until it receives a soft interrupt, and then the 193 * until it receives a soft interrupt, and then the
44 * secondary CPU branches to this address. 194 * secondary CPU branches to this address.
45 */ 195 */
46 writel(~0, MMIO_P2V(V2M_SYS_FLAGSCLR)); 196 v2m_flags_set(virt_to_phys(versatile_secondary_startup));
47 writel(virt_to_phys(versatile_secondary_startup),
48 MMIO_P2V(V2M_SYS_FLAGSSET));
49} 197}
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index b4a28ca0e50..47cdcca5a7e 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -6,6 +6,10 @@
6#include <linux/amba/mmci.h> 6#include <linux/amba/mmci.h>
7#include <linux/io.h> 7#include <linux/io.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/of_address.h>
10#include <linux/of_fdt.h>
11#include <linux/of_irq.h>
12#include <linux/of_platform.h>
9#include <linux/platform_device.h> 13#include <linux/platform_device.h>
10#include <linux/ata_platform.h> 14#include <linux/ata_platform.h>
11#include <linux/smsc911x.h> 15#include <linux/smsc911x.h>
@@ -21,6 +25,8 @@
21#include <asm/mach/map.h> 25#include <asm/mach/map.h>
22#include <asm/mach/time.h> 26#include <asm/mach/time.h>
23#include <asm/hardware/arm_timer.h> 27#include <asm/hardware/arm_timer.h>
28#include <asm/hardware/cache-l2x0.h>
29#include <asm/hardware/gic.h>
24#include <asm/hardware/timer-sp.h> 30#include <asm/hardware/timer-sp.h>
25#include <asm/hardware/sp810.h> 31#include <asm/hardware/sp810.h>
26#include <asm/hardware/gic.h> 32#include <asm/hardware/gic.h>
@@ -40,29 +46,45 @@
40 46
41static struct map_desc v2m_io_desc[] __initdata = { 47static struct map_desc v2m_io_desc[] __initdata = {
42 { 48 {
43 .virtual = __MMIO_P2V(V2M_PA_CS7), 49 .virtual = V2M_PERIPH,
44 .pfn = __phys_to_pfn(V2M_PA_CS7), 50 .pfn = __phys_to_pfn(V2M_PA_CS7),
45 .length = SZ_128K, 51 .length = SZ_128K,
46 .type = MT_DEVICE, 52 .type = MT_DEVICE,
47 }, 53 },
48}; 54};
49 55
50static void __init v2m_timer_init(void) 56static void __iomem *v2m_sysreg_base;
57
58static void __init v2m_sysctl_init(void __iomem *base)
51{ 59{
52 u32 scctrl; 60 u32 scctrl;
53 61
62 if (WARN_ON(!base))
63 return;
64
54 /* Select 1MHz TIMCLK as the reference clock for SP804 timers */ 65 /* Select 1MHz TIMCLK as the reference clock for SP804 timers */
55 scctrl = readl(MMIO_P2V(V2M_SYSCTL + SCCTRL)); 66 scctrl = readl(base + SCCTRL);
56 scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK; 67 scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK;
57 scctrl |= SCCTRL_TIMEREN1SEL_TIMCLK; 68 scctrl |= SCCTRL_TIMEREN1SEL_TIMCLK;
58 writel(scctrl, MMIO_P2V(V2M_SYSCTL + SCCTRL)); 69 writel(scctrl, base + SCCTRL);
70}
71
72static void __init v2m_sp804_init(void __iomem *base, unsigned int irq)
73{
74 if (WARN_ON(!base || irq == NO_IRQ))
75 return;
76
77 writel(0, base + TIMER_1_BASE + TIMER_CTRL);
78 writel(0, base + TIMER_2_BASE + TIMER_CTRL);
59 79
60 writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL); 80 sp804_clocksource_init(base + TIMER_2_BASE, "v2m-timer1");
61 writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL); 81 sp804_clockevents_init(base + TIMER_1_BASE, irq, "v2m-timer0");
82}
62 83
63 sp804_clocksource_init(MMIO_P2V(V2M_TIMER1), "v2m-timer1"); 84static void __init v2m_timer_init(void)
64 sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0, 85{
65 "v2m-timer0"); 86 v2m_sysctl_init(ioremap(V2M_SYSCTL, SZ_4K));
87 v2m_sp804_init(ioremap(V2M_TIMER01, SZ_4K), IRQ_V2M_TIMER0);
66} 88}
67 89
68static struct sys_timer v2m_timer = { 90static struct sys_timer v2m_timer = {
@@ -82,14 +104,14 @@ int v2m_cfg_write(u32 devfn, u32 data)
82 devfn |= SYS_CFG_START | SYS_CFG_WRITE; 104 devfn |= SYS_CFG_START | SYS_CFG_WRITE;
83 105
84 spin_lock(&v2m_cfg_lock); 106 spin_lock(&v2m_cfg_lock);
85 val = readl(MMIO_P2V(V2M_SYS_CFGSTAT)); 107 val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT);
86 writel(val & ~SYS_CFG_COMPLETE, MMIO_P2V(V2M_SYS_CFGSTAT)); 108 writel(val & ~SYS_CFG_COMPLETE, v2m_sysreg_base + V2M_SYS_CFGSTAT);
87 109
88 writel(data, MMIO_P2V(V2M_SYS_CFGDATA)); 110 writel(data, v2m_sysreg_base + V2M_SYS_CFGDATA);
89 writel(devfn, MMIO_P2V(V2M_SYS_CFGCTRL)); 111 writel(devfn, v2m_sysreg_base + V2M_SYS_CFGCTRL);
90 112
91 do { 113 do {
92 val = readl(MMIO_P2V(V2M_SYS_CFGSTAT)); 114 val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT);
93 } while (val == 0); 115 } while (val == 0);
94 spin_unlock(&v2m_cfg_lock); 116 spin_unlock(&v2m_cfg_lock);
95 117
@@ -103,22 +125,28 @@ int v2m_cfg_read(u32 devfn, u32 *data)
103 devfn |= SYS_CFG_START; 125 devfn |= SYS_CFG_START;
104 126
105 spin_lock(&v2m_cfg_lock); 127 spin_lock(&v2m_cfg_lock);
106 writel(0, MMIO_P2V(V2M_SYS_CFGSTAT)); 128 writel(0, v2m_sysreg_base + V2M_SYS_CFGSTAT);
107 writel(devfn, MMIO_P2V(V2M_SYS_CFGCTRL)); 129 writel(devfn, v2m_sysreg_base + V2M_SYS_CFGCTRL);
108 130
109 mb(); 131 mb();
110 132
111 do { 133 do {
112 cpu_relax(); 134 cpu_relax();
113 val = readl(MMIO_P2V(V2M_SYS_CFGSTAT)); 135 val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT);
114 } while (val == 0); 136 } while (val == 0);
115 137
116 *data = readl(MMIO_P2V(V2M_SYS_CFGDATA)); 138 *data = readl(v2m_sysreg_base + V2M_SYS_CFGDATA);
117 spin_unlock(&v2m_cfg_lock); 139 spin_unlock(&v2m_cfg_lock);
118 140
119 return !!(val & SYS_CFG_ERR); 141 return !!(val & SYS_CFG_ERR);
120} 142}
121 143
144void __init v2m_flags_set(u32 data)
145{
146 writel(~0, v2m_sysreg_base + V2M_SYS_FLAGSCLR);
147 writel(data, v2m_sysreg_base + V2M_SYS_FLAGSSET);
148}
149
122 150
123static struct resource v2m_pcie_i2c_resource = { 151static struct resource v2m_pcie_i2c_resource = {
124 .start = V2M_SERIAL_BUS_PCI, 152 .start = V2M_SERIAL_BUS_PCI,
@@ -204,7 +232,7 @@ static struct platform_device v2m_usb_device = {
204 232
205static void v2m_flash_set_vpp(struct platform_device *pdev, int on) 233static void v2m_flash_set_vpp(struct platform_device *pdev, int on)
206{ 234{
207 writel(on != 0, MMIO_P2V(V2M_SYS_FLASH)); 235 writel(on != 0, v2m_sysreg_base + V2M_SYS_FLASH);
208} 236}
209 237
210static struct physmap_flash_data v2m_flash_data = { 238static struct physmap_flash_data v2m_flash_data = {
@@ -258,7 +286,7 @@ static struct platform_device v2m_cf_device = {
258 286
259static unsigned int v2m_mmci_status(struct device *dev) 287static unsigned int v2m_mmci_status(struct device *dev)
260{ 288{
261 return readl(MMIO_P2V(V2M_SYS_MCI)) & (1 << 0); 289 return readl(v2m_sysreg_base + V2M_SYS_MCI) & (1 << 0);
262} 290}
263 291
264static struct mmci_platform_data v2m_mmci_data = { 292static struct mmci_platform_data v2m_mmci_data = {
@@ -266,16 +294,16 @@ static struct mmci_platform_data v2m_mmci_data = {
266 .status = v2m_mmci_status, 294 .status = v2m_mmci_status,
267}; 295};
268 296
269static AMBA_DEVICE(aaci, "mb:aaci", V2M_AACI, NULL); 297static AMBA_APB_DEVICE(aaci, "mb:aaci", 0, V2M_AACI, IRQ_V2M_AACI, NULL);
270static AMBA_DEVICE(mmci, "mb:mmci", V2M_MMCI, &v2m_mmci_data); 298static AMBA_APB_DEVICE(mmci, "mb:mmci", 0, V2M_MMCI, IRQ_V2M_MMCI, &v2m_mmci_data);
271static AMBA_DEVICE(kmi0, "mb:kmi0", V2M_KMI0, NULL); 299static AMBA_APB_DEVICE(kmi0, "mb:kmi0", 0, V2M_KMI0, IRQ_V2M_KMI0, NULL);
272static AMBA_DEVICE(kmi1, "mb:kmi1", V2M_KMI1, NULL); 300static AMBA_APB_DEVICE(kmi1, "mb:kmi1", 0, V2M_KMI1, IRQ_V2M_KMI1, NULL);
273static AMBA_DEVICE(uart0, "mb:uart0", V2M_UART0, NULL); 301static AMBA_APB_DEVICE(uart0, "mb:uart0", 0, V2M_UART0, IRQ_V2M_UART0, NULL);
274static AMBA_DEVICE(uart1, "mb:uart1", V2M_UART1, NULL); 302static AMBA_APB_DEVICE(uart1, "mb:uart1", 0, V2M_UART1, IRQ_V2M_UART1, NULL);
275static AMBA_DEVICE(uart2, "mb:uart2", V2M_UART2, NULL); 303static AMBA_APB_DEVICE(uart2, "mb:uart2", 0, V2M_UART2, IRQ_V2M_UART2, NULL);
276static AMBA_DEVICE(uart3, "mb:uart3", V2M_UART3, NULL); 304static AMBA_APB_DEVICE(uart3, "mb:uart3", 0, V2M_UART3, IRQ_V2M_UART3, NULL);
277static AMBA_DEVICE(wdt, "mb:wdt", V2M_WDT, NULL); 305static AMBA_APB_DEVICE(wdt, "mb:wdt", 0, V2M_WDT, IRQ_V2M_WDT, NULL);
278static AMBA_DEVICE(rtc, "mb:rtc", V2M_RTC, NULL); 306static AMBA_APB_DEVICE(rtc, "mb:rtc", 0, V2M_RTC, IRQ_V2M_RTC, NULL);
279 307
280static struct amba_device *v2m_amba_devs[] __initdata = { 308static struct amba_device *v2m_amba_devs[] __initdata = {
281 &aaci_device, 309 &aaci_device,
@@ -371,7 +399,7 @@ static void __init v2m_init_early(void)
371{ 399{
372 ct_desc->init_early(); 400 ct_desc->init_early();
373 clkdev_add_table(v2m_lookups, ARRAY_SIZE(v2m_lookups)); 401 clkdev_add_table(v2m_lookups, ARRAY_SIZE(v2m_lookups));
374 versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000); 402 versatile_sched_clock_init(v2m_sysreg_base + V2M_SYS_24MHZ, 24000000);
375} 403}
376 404
377static void v2m_power_off(void) 405static void v2m_power_off(void)
@@ -400,20 +428,23 @@ static void __init v2m_populate_ct_desc(void)
400 u32 current_tile_id; 428 u32 current_tile_id;
401 429
402 ct_desc = NULL; 430 ct_desc = NULL;
403 current_tile_id = readl(MMIO_P2V(V2M_SYS_PROCID0)) & V2M_CT_ID_MASK; 431 current_tile_id = readl(v2m_sysreg_base + V2M_SYS_PROCID0)
432 & V2M_CT_ID_MASK;
404 433
405 for (i = 0; i < ARRAY_SIZE(ct_descs) && !ct_desc; ++i) 434 for (i = 0; i < ARRAY_SIZE(ct_descs) && !ct_desc; ++i)
406 if (ct_descs[i]->id == current_tile_id) 435 if (ct_descs[i]->id == current_tile_id)
407 ct_desc = ct_descs[i]; 436 ct_desc = ct_descs[i];
408 437
409 if (!ct_desc) 438 if (!ct_desc)
410 panic("vexpress: failed to populate core tile description " 439 panic("vexpress: this kernel does not support core tile ID 0x%08x when booting via ATAGs.\n"
411 "for tile ID 0x%8x\n", current_tile_id); 440 "You may need a device tree blob or a different kernel to boot on this board.\n",
441 current_tile_id);
412} 442}
413 443
414static void __init v2m_map_io(void) 444static void __init v2m_map_io(void)
415{ 445{
416 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc)); 446 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc));
447 v2m_sysreg_base = ioremap(V2M_SYSREGS, SZ_4K);
417 v2m_populate_ct_desc(); 448 v2m_populate_ct_desc();
418 ct_desc->map_io(); 449 ct_desc->map_io();
419} 450}
@@ -452,3 +483,205 @@ MACHINE_START(VEXPRESS, "ARM-Versatile Express")
452 .init_machine = v2m_init, 483 .init_machine = v2m_init,
453 .restart = v2m_restart, 484 .restart = v2m_restart,
454MACHINE_END 485MACHINE_END
486
487#if defined(CONFIG_ARCH_VEXPRESS_DT)
488
489static struct map_desc v2m_rs1_io_desc __initdata = {
490 .virtual = V2M_PERIPH,
491 .pfn = __phys_to_pfn(0x1c000000),
492 .length = SZ_2M,
493 .type = MT_DEVICE,
494};
495
496static int __init v2m_dt_scan_memory_map(unsigned long node, const char *uname,
497 int depth, void *data)
498{
499 const char **map = data;
500
501 if (strcmp(uname, "motherboard") != 0)
502 return 0;
503
504 *map = of_get_flat_dt_prop(node, "arm,v2m-memory-map", NULL);
505
506 return 1;
507}
508
509void __init v2m_dt_map_io(void)
510{
511 const char *map = NULL;
512
513 of_scan_flat_dt(v2m_dt_scan_memory_map, &map);
514
515 if (map && strcmp(map, "rs1") == 0)
516 iotable_init(&v2m_rs1_io_desc, 1);
517 else
518 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc));
519
520#if defined(CONFIG_SMP)
521 vexpress_dt_smp_map_io();
522#endif
523}
524
525static struct clk_lookup v2m_dt_lookups[] = {
526 { /* AMBA bus clock */
527 .con_id = "apb_pclk",
528 .clk = &dummy_apb_pclk,
529 }, { /* SP804 timers */
530 .dev_id = "sp804",
531 .con_id = "v2m-timer0",
532 .clk = &v2m_sp804_clk,
533 }, { /* SP804 timers */
534 .dev_id = "sp804",
535 .con_id = "v2m-timer1",
536 .clk = &v2m_sp804_clk,
537 }, { /* PL180 MMCI */
538 .dev_id = "mb:mmci", /* 10005000.mmci */
539 .clk = &osc2_clk,
540 }, { /* PL050 KMI0 */
541 .dev_id = "10006000.kmi",
542 .clk = &osc2_clk,
543 }, { /* PL050 KMI1 */
544 .dev_id = "10007000.kmi",
545 .clk = &osc2_clk,
546 }, { /* PL011 UART0 */
547 .dev_id = "10009000.uart",
548 .clk = &osc2_clk,
549 }, { /* PL011 UART1 */
550 .dev_id = "1000a000.uart",
551 .clk = &osc2_clk,
552 }, { /* PL011 UART2 */
553 .dev_id = "1000b000.uart",
554 .clk = &osc2_clk,
555 }, { /* PL011 UART3 */
556 .dev_id = "1000c000.uart",
557 .clk = &osc2_clk,
558 }, { /* SP805 WDT */
559 .dev_id = "1000f000.wdt",
560 .clk = &v2m_ref_clk,
561 }, { /* PL111 CLCD */
562 .dev_id = "1001f000.clcd",
563 .clk = &osc1_clk,
564 },
565 /* RS1 memory map */
566 { /* PL180 MMCI */
567 .dev_id = "mb:mmci", /* 1c050000.mmci */
568 .clk = &osc2_clk,
569 }, { /* PL050 KMI0 */
570 .dev_id = "1c060000.kmi",
571 .clk = &osc2_clk,
572 }, { /* PL050 KMI1 */
573 .dev_id = "1c070000.kmi",
574 .clk = &osc2_clk,
575 }, { /* PL011 UART0 */
576 .dev_id = "1c090000.uart",
577 .clk = &osc2_clk,
578 }, { /* PL011 UART1 */
579 .dev_id = "1c0a0000.uart",
580 .clk = &osc2_clk,
581 }, { /* PL011 UART2 */
582 .dev_id = "1c0b0000.uart",
583 .clk = &osc2_clk,
584 }, { /* PL011 UART3 */
585 .dev_id = "1c0c0000.uart",
586 .clk = &osc2_clk,
587 }, { /* SP805 WDT */
588 .dev_id = "1c0f0000.wdt",
589 .clk = &v2m_ref_clk,
590 }, { /* PL111 CLCD */
591 .dev_id = "1c1f0000.clcd",
592 .clk = &osc1_clk,
593 },
594};
595
596void __init v2m_dt_init_early(void)
597{
598 struct device_node *node;
599 u32 dt_hbi;
600
601 node = of_find_compatible_node(NULL, NULL, "arm,vexpress-sysreg");
602 v2m_sysreg_base = of_iomap(node, 0);
603 if (WARN_ON(!v2m_sysreg_base))
604 return;
605
606 /* Confirm board type against DT property, if available */
607 if (of_property_read_u32(allnodes, "arm,hbi", &dt_hbi) == 0) {
608 u32 misc = readl(v2m_sysreg_base + V2M_SYS_MISC);
609 u32 id = readl(v2m_sysreg_base + (misc & SYS_MISC_MASTERSITE ?
610 V2M_SYS_PROCID1 : V2M_SYS_PROCID0));
611 u32 hbi = id & SYS_PROCIDx_HBI_MASK;
612
613 if (WARN_ON(dt_hbi != hbi))
614 pr_warning("vexpress: DT HBI (%x) is not matching "
615 "hardware (%x)!\n", dt_hbi, hbi);
616 }
617
618 clkdev_add_table(v2m_dt_lookups, ARRAY_SIZE(v2m_dt_lookups));
619 versatile_sched_clock_init(v2m_sysreg_base + V2M_SYS_24MHZ, 24000000);
620}
621
622static struct of_device_id vexpress_irq_match[] __initdata = {
623 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
624 {}
625};
626
627static void __init v2m_dt_init_irq(void)
628{
629 of_irq_init(vexpress_irq_match);
630}
631
632static void __init v2m_dt_timer_init(void)
633{
634 struct device_node *node;
635 const char *path;
636 int err;
637
638 node = of_find_compatible_node(NULL, NULL, "arm,sp810");
639 v2m_sysctl_init(of_iomap(node, 0));
640
641 err = of_property_read_string(of_aliases, "arm,v2m_timer", &path);
642 if (WARN_ON(err))
643 return;
644 node = of_find_node_by_path(path);
645 v2m_sp804_init(of_iomap(node, 0), irq_of_parse_and_map(node, 0));
646}
647
648static struct sys_timer v2m_dt_timer = {
649 .init = v2m_dt_timer_init,
650};
651
652static struct of_dev_auxdata v2m_dt_auxdata_lookup[] __initdata = {
653 OF_DEV_AUXDATA("arm,vexpress-flash", V2M_NOR0, "physmap-flash",
654 &v2m_flash_data),
655 OF_DEV_AUXDATA("arm,primecell", V2M_MMCI, "mb:mmci", &v2m_mmci_data),
656 /* RS1 memory map */
657 OF_DEV_AUXDATA("arm,vexpress-flash", 0x08000000, "physmap-flash",
658 &v2m_flash_data),
659 OF_DEV_AUXDATA("arm,primecell", 0x1c050000, "mb:mmci", &v2m_mmci_data),
660 {}
661};
662
663static void __init v2m_dt_init(void)
664{
665 l2x0_of_init(0x00400000, 0xfe0fffff);
666 of_platform_populate(NULL, of_default_bus_match_table,
667 v2m_dt_auxdata_lookup, NULL);
668 pm_power_off = v2m_power_off;
669}
670
671const static char *v2m_dt_match[] __initconst = {
672 "arm,vexpress",
673 NULL,
674};
675
676DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
677 .dt_compat = v2m_dt_match,
678 .map_io = v2m_dt_map_io,
679 .init_early = v2m_dt_init_early,
680 .init_irq = v2m_dt_init_irq,
681 .timer = &v2m_dt_timer,
682 .init_machine = v2m_dt_init,
683 .handle_irq = gic_handle_irq,
684 .restart = v2m_restart,
685MACHINE_END
686
687#endif
diff --git a/arch/arm/mach-vt8500/include/mach/entry-macro.S b/arch/arm/mach-vt8500/include/mach/entry-macro.S
index 92684c7eaed..367d1b55fb9 100644
--- a/arch/arm/mach-vt8500/include/mach/entry-macro.S
+++ b/arch/arm/mach-vt8500/include/mach/entry-macro.S
@@ -8,18 +8,12 @@
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10
11 .macro disable_fiq
12 .endm
13
14 .macro get_irqnr_preamble, base, tmp 11 .macro get_irqnr_preamble, base, tmp
15 @ physical 0xd8140000 is virtual 0xf8140000 12 @ physical 0xd8140000 is virtual 0xf8140000
16 mov \base, #0xf8000000 13 mov \base, #0xf8000000
17 orr \base, \base, #0x00140000 14 orr \base, \base, #0x00140000
18 .endm 15 .endm
19 16
20 .macro arch_ret_to_user, tmp1, tmp2
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24 ldr \irqnr, [\base] 18 ldr \irqnr, [\base]
25 cmp \irqnr, #63 @ may be false positive, check interrupt status 19 cmp \irqnr, #63 @ may be false positive, check interrupt status
diff --git a/arch/arm/mach-vt8500/include/mach/system.h b/arch/arm/mach-vt8500/include/mach/system.h
index d6c757eaf26..58fa8010ee6 100644
--- a/arch/arm/mach-vt8500/include/mach/system.h
+++ b/arch/arm/mach-vt8500/include/mach/system.h
@@ -7,11 +7,6 @@
7/* PM Software Reset request register */ 7/* PM Software Reset request register */
8#define VT8500_PMSR_VIRT 0xf8130060 8#define VT8500_PMSR_VIRT 0xf8130060
9 9
10static inline void arch_idle(void)
11{
12 cpu_do_idle();
13}
14
15static inline void arch_reset(char mode, const char *cmd) 10static inline void arch_reset(char mode, const char *cmd)
16{ 11{
17 writel(1, VT8500_PMSR_VIRT); 12 writel(1, VT8500_PMSR_VIRT);
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index 78110befb7a..db82568a998 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -530,6 +530,7 @@ static struct platform_device *nuc900_public_dev[] __initdata = {
530 530
531void __init nuc900_board_init(struct platform_device **device, int size) 531void __init nuc900_board_init(struct platform_device **device, int size)
532{ 532{
533 disable_hlt();
533 platform_add_devices(device, size); 534 platform_add_devices(device, size);
534 platform_add_devices(nuc900_public_dev, ARRAY_SIZE(nuc900_public_dev)); 535 platform_add_devices(nuc900_public_dev, ARRAY_SIZE(nuc900_public_dev));
535 spi_register_board_info(nuc900_spi_board_info, 536 spi_register_board_info(nuc900_spi_board_info,
diff --git a/arch/arm/mach-w90x900/include/mach/entry-macro.S b/arch/arm/mach-w90x900/include/mach/entry-macro.S
index d39aca5be9e..e286daca682 100644
--- a/arch/arm/mach-w90x900/include/mach/entry-macro.S
+++ b/arch/arm/mach-w90x900/include/mach/entry-macro.S
@@ -15,9 +15,6 @@
15 .macro get_irqnr_preamble, base, tmp 15 .macro get_irqnr_preamble, base, tmp
16 .endm 16 .endm
17 17
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 18 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
22 19
23 mov \base, #AIC_BA 20 mov \base, #AIC_BA
@@ -27,8 +24,3 @@
27 cmp \irqnr, #0 24 cmp \irqnr, #0
28 25
29 .endm 26 .endm
30
31 /* currently don't need an disable_fiq macro */
32
33 .macro disable_fiq
34 .endm
diff --git a/arch/arm/mach-w90x900/include/mach/system.h b/arch/arm/mach-w90x900/include/mach/system.h
deleted file mode 100644
index 2aaeb931161..00000000000
--- a/arch/arm/mach-w90x900/include/mach/system.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/system.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/system.h
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 */
17static void arch_idle(void)
18{
19}
diff --git a/arch/arm/mach-zynq/include/mach/entry-macro.S b/arch/arm/mach-zynq/include/mach/entry-macro.S
deleted file mode 100644
index d621fb73256..00000000000
--- a/arch/arm/mach-zynq/include/mach/entry-macro.S
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * arch/arm/mach-zynq/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros
5 *
6 * Copyright (C) 2011 Xilinx
7 *
8 * based on arch/plat-mxc/include/mach/entry-macro.S
9 *
10 * Copyright (C) 2007 Lennert Buytenhek <buytenh@wantstofly.org>
11 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
12 *
13 * This software is licensed under the terms of the GNU General Public
14 * License version 2, as published by the Free Software Foundation, and
15 * may be copied, distributed, and modified under those terms.
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
23 .macro disable_fiq
24 .endm
25
26 .macro arch_ret_to_user, tmp1, tmp2
27 .endm
diff --git a/arch/arm/mach-zynq/include/mach/system.h b/arch/arm/mach-zynq/include/mach/system.h
deleted file mode 100644
index 8e88e0b8d2b..00000000000
--- a/arch/arm/mach-zynq/include/mach/system.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/* arch/arm/mach-zynq/include/mach/system.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_SYSTEM_H__
16#define __MACH_SYSTEM_H__
17
18static inline void arch_idle(void)
19{
20 cpu_do_idle();
21}
22
23#endif
diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c
index e62956e1203..4614208369f 100644
--- a/arch/arm/mm/iomap.c
+++ b/arch/arm/mm/iomap.c
@@ -32,9 +32,6 @@ EXPORT_SYMBOL(pcibios_min_io);
32unsigned long pcibios_min_mem = 0x01000000; 32unsigned long pcibios_min_mem = 0x01000000;
33EXPORT_SYMBOL(pcibios_min_mem); 33EXPORT_SYMBOL(pcibios_min_mem);
34 34
35unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
36EXPORT_SYMBOL(pci_flags);
37
38void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 35void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
39{ 36{
40 if ((unsigned long)addr >= VMALLOC_START && 37 if ((unsigned long)addr >= VMALLOC_START &&
diff --git a/arch/arm/plat-iop/pci.c b/arch/arm/plat-iop/pci.c
index f4d40a27111..72768356447 100644
--- a/arch/arm/plat-iop/pci.c
+++ b/arch/arm/plat-iop/pci.c
@@ -215,8 +215,8 @@ int iop3xx_pci_setup(int nr, struct pci_sys_data *sys)
215 sys->mem_offset = IOP3XX_PCI_LOWER_MEM_PA - *IOP3XX_OMWTVR0; 215 sys->mem_offset = IOP3XX_PCI_LOWER_MEM_PA - *IOP3XX_OMWTVR0;
216 sys->io_offset = IOP3XX_PCI_LOWER_IO_PA - *IOP3XX_OIOWTVR; 216 sys->io_offset = IOP3XX_PCI_LOWER_IO_PA - *IOP3XX_OIOWTVR;
217 217
218 pci_add_resource(&sys->resources, &res[0]); 218 pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset);
219 pci_add_resource(&sys->resources, &res[1]); 219 pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset);
220 220
221 return 1; 221 return 1;
222} 222}
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index dcebb1230f7..c722f9ce691 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -88,12 +88,6 @@ config IMX_HAVE_IOMUX_V1
88config ARCH_MXC_IOMUX_V3 88config ARCH_MXC_IOMUX_V3
89 bool 89 bool
90 90
91config ARCH_MXC_AUDMUX_V1
92 bool
93
94config ARCH_MXC_AUDMUX_V2
95 bool
96
97config IRAM_ALLOC 91config IRAM_ALLOC
98 bool 92 bool
99 select GENERIC_ALLOCATOR 93 select GENERIC_ALLOCATOR
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index 076db84f3e3..e81290c27c6 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -14,8 +14,6 @@ obj-$(CONFIG_IRAM_ALLOC) += iram_alloc.o
14obj-$(CONFIG_MXC_PWM) += pwm.o 14obj-$(CONFIG_MXC_PWM) += pwm.o
15obj-$(CONFIG_MXC_ULPI) += ulpi.o 15obj-$(CONFIG_MXC_ULPI) += ulpi.o
16obj-$(CONFIG_MXC_USE_EPIT) += epit.o 16obj-$(CONFIG_MXC_USE_EPIT) += epit.o
17obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o
18obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o
19obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o 17obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
20obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o 18obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o
21ifdef CONFIG_SND_IMX_SOC 19ifdef CONFIG_SND_IMX_SOC
diff --git a/arch/arm/plat-mxc/audmux-v1.c b/arch/arm/plat-mxc/audmux-v1.c
deleted file mode 100644
index 1180bef7664..00000000000
--- a/arch/arm/plat-mxc/audmux-v1.c
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/module.h>
19#include <linux/err.h>
20#include <linux/io.h>
21#include <linux/clk.h>
22#include <mach/audmux.h>
23#include <mach/hardware.h>
24
25static void __iomem *audmux_base;
26
27static unsigned char port_mapping[] = {
28 0x0, 0x4, 0x8, 0x10, 0x14, 0x1c,
29};
30
31int mxc_audmux_v1_configure_port(unsigned int port, unsigned int pcr)
32{
33 if (!audmux_base) {
34 printk("%s: not configured\n", __func__);
35 return -ENOSYS;
36 }
37
38 if (port >= ARRAY_SIZE(port_mapping))
39 return -EINVAL;
40
41 writel(pcr, audmux_base + port_mapping[port]);
42
43 return 0;
44}
45EXPORT_SYMBOL_GPL(mxc_audmux_v1_configure_port);
46
47static int mxc_audmux_v1_init(void)
48{
49#ifdef CONFIG_MACH_MX21
50 if (cpu_is_mx21())
51 audmux_base = MX21_IO_ADDRESS(MX21_AUDMUX_BASE_ADDR);
52 else
53#endif
54#ifdef CONFIG_MACH_MX27
55 if (cpu_is_mx27())
56 audmux_base = MX27_IO_ADDRESS(MX27_AUDMUX_BASE_ADDR);
57 else
58#endif
59 (void)0;
60
61 return 0;
62}
63
64postcore_initcall(mxc_audmux_v1_init);
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
deleted file mode 100644
index 8cced35009b..00000000000
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ /dev/null
@@ -1,219 +0,0 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/module.h>
19#include <linux/err.h>
20#include <linux/io.h>
21#include <linux/clk.h>
22#include <linux/debugfs.h>
23#include <linux/slab.h>
24#include <mach/audmux.h>
25#include <mach/hardware.h>
26
27static struct clk *audmux_clk;
28static void __iomem *audmux_base;
29
30#define MXC_AUDMUX_V2_PTCR(x) ((x) * 8)
31#define MXC_AUDMUX_V2_PDCR(x) ((x) * 8 + 4)
32
33#ifdef CONFIG_DEBUG_FS
34static struct dentry *audmux_debugfs_root;
35
36static int audmux_open_file(struct inode *inode, struct file *file)
37{
38 file->private_data = inode->i_private;
39 return 0;
40}
41
42/* There is an annoying discontinuity in the SSI numbering with regard
43 * to the Linux number of the devices */
44static const char *audmux_port_string(int port)
45{
46 switch (port) {
47 case MX31_AUDMUX_PORT1_SSI0:
48 return "imx-ssi.0";
49 case MX31_AUDMUX_PORT2_SSI1:
50 return "imx-ssi.1";
51 case MX31_AUDMUX_PORT3_SSI_PINS_3:
52 return "SSI3";
53 case MX31_AUDMUX_PORT4_SSI_PINS_4:
54 return "SSI4";
55 case MX31_AUDMUX_PORT5_SSI_PINS_5:
56 return "SSI5";
57 case MX31_AUDMUX_PORT6_SSI_PINS_6:
58 return "SSI6";
59 default:
60 return "UNKNOWN";
61 }
62}
63
64static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
65 size_t count, loff_t *ppos)
66{
67 ssize_t ret;
68 char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
69 int port = (int)file->private_data;
70 u32 pdcr, ptcr;
71
72 if (!buf)
73 return -ENOMEM;
74
75 if (audmux_clk)
76 clk_enable(audmux_clk);
77
78 ptcr = readl(audmux_base + MXC_AUDMUX_V2_PTCR(port));
79 pdcr = readl(audmux_base + MXC_AUDMUX_V2_PDCR(port));
80
81 if (audmux_clk)
82 clk_disable(audmux_clk);
83
84 ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
85 pdcr, ptcr);
86
87 if (ptcr & MXC_AUDMUX_V2_PTCR_TFSDIR)
88 ret += snprintf(buf + ret, PAGE_SIZE - ret,
89 "TxFS output from %s, ",
90 audmux_port_string((ptcr >> 27) & 0x7));
91 else
92 ret += snprintf(buf + ret, PAGE_SIZE - ret,
93 "TxFS input, ");
94
95 if (ptcr & MXC_AUDMUX_V2_PTCR_TCLKDIR)
96 ret += snprintf(buf + ret, PAGE_SIZE - ret,
97 "TxClk output from %s",
98 audmux_port_string((ptcr >> 22) & 0x7));
99 else
100 ret += snprintf(buf + ret, PAGE_SIZE - ret,
101 "TxClk input");
102
103 ret += snprintf(buf + ret, PAGE_SIZE - ret, "\n");
104
105 if (ptcr & MXC_AUDMUX_V2_PTCR_SYN) {
106 ret += snprintf(buf + ret, PAGE_SIZE - ret,
107 "Port is symmetric");
108 } else {
109 if (ptcr & MXC_AUDMUX_V2_PTCR_RFSDIR)
110 ret += snprintf(buf + ret, PAGE_SIZE - ret,
111 "RxFS output from %s, ",
112 audmux_port_string((ptcr >> 17) & 0x7));
113 else
114 ret += snprintf(buf + ret, PAGE_SIZE - ret,
115 "RxFS input, ");
116
117 if (ptcr & MXC_AUDMUX_V2_PTCR_RCLKDIR)
118 ret += snprintf(buf + ret, PAGE_SIZE - ret,
119 "RxClk output from %s",
120 audmux_port_string((ptcr >> 12) & 0x7));
121 else
122 ret += snprintf(buf + ret, PAGE_SIZE - ret,
123 "RxClk input");
124 }
125
126 ret += snprintf(buf + ret, PAGE_SIZE - ret,
127 "\nData received from %s\n",
128 audmux_port_string((pdcr >> 13) & 0x7));
129
130 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
131
132 kfree(buf);
133
134 return ret;
135}
136
137static const struct file_operations audmux_debugfs_fops = {
138 .open = audmux_open_file,
139 .read = audmux_read_file,
140 .llseek = default_llseek,
141};
142
143static void audmux_debugfs_init(void)
144{
145 int i;
146 char buf[20];
147
148 audmux_debugfs_root = debugfs_create_dir("audmux", NULL);
149 if (!audmux_debugfs_root) {
150 pr_warning("Failed to create AUDMUX debugfs root\n");
151 return;
152 }
153
154 for (i = 1; i < 8; i++) {
155 snprintf(buf, sizeof(buf), "ssi%d", i);
156 if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
157 (void *)i, &audmux_debugfs_fops))
158 pr_warning("Failed to create AUDMUX port %d debugfs file\n",
159 i);
160 }
161}
162#else
163static inline void audmux_debugfs_init(void)
164{
165}
166#endif
167
168int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
169 unsigned int pdcr)
170{
171 if (!audmux_base)
172 return -ENOSYS;
173
174 if (audmux_clk)
175 clk_enable(audmux_clk);
176
177 writel(ptcr, audmux_base + MXC_AUDMUX_V2_PTCR(port));
178 writel(pdcr, audmux_base + MXC_AUDMUX_V2_PDCR(port));
179
180 if (audmux_clk)
181 clk_disable(audmux_clk);
182
183 return 0;
184}
185EXPORT_SYMBOL_GPL(mxc_audmux_v2_configure_port);
186
187static int mxc_audmux_v2_init(void)
188{
189 int ret;
190 if (cpu_is_mx51()) {
191 audmux_base = MX51_IO_ADDRESS(MX51_AUDMUX_BASE_ADDR);
192 } else if (cpu_is_mx31()) {
193 audmux_base = MX31_IO_ADDRESS(MX31_AUDMUX_BASE_ADDR);
194 } else if (cpu_is_mx35()) {
195 audmux_clk = clk_get(NULL, "audmux");
196 if (IS_ERR(audmux_clk)) {
197 ret = PTR_ERR(audmux_clk);
198 printk(KERN_ERR "%s: cannot get clock: %d\n", __func__,
199 ret);
200 return ret;
201 }
202 audmux_base = MX35_IO_ADDRESS(MX35_AUDMUX_BASE_ADDR);
203 } else if (cpu_is_mx25()) {
204 audmux_clk = clk_get(NULL, "audmux");
205 if (IS_ERR(audmux_clk)) {
206 ret = PTR_ERR(audmux_clk);
207 printk(KERN_ERR "%s: cannot get clock: %d\n", __func__,
208 ret);
209 return ret;
210 }
211 audmux_base = MX25_IO_ADDRESS(MX25_AUDMUX_BASE_ADDR);
212 }
213
214 audmux_debugfs_init();
215
216 return 0;
217}
218
219postcore_initcall(mxc_audmux_v2_init);
diff --git a/arch/arm/plat-mxc/avic.c b/arch/arm/plat-mxc/avic.c
index 55f15699a38..689f81f9593 100644
--- a/arch/arm/plat-mxc/avic.c
+++ b/arch/arm/plat-mxc/avic.c
@@ -60,7 +60,7 @@ static int avic_irq_set_priority(unsigned char irq, unsigned char prio)
60 unsigned int mask = 0x0F << irq % 8 * 4; 60 unsigned int mask = 0x0F << irq % 8 * 4;
61 61
62 if (irq >= AVIC_NUM_IRQS) 62 if (irq >= AVIC_NUM_IRQS)
63 return -EINVAL;; 63 return -EINVAL;
64 64
65 temp = __raw_readl(avic_base + AVIC_NIPRIORITY(irq / 8)); 65 temp = __raw_readl(avic_base + AVIC_NIPRIORITY(irq / 8));
66 temp &= ~mask; 66 temp &= ~mask;
diff --git a/arch/arm/plat-mxc/cpu.c b/arch/arm/plat-mxc/cpu.c
index f5b7e0fa237..220dd6f9312 100644
--- a/arch/arm/plat-mxc/cpu.c
+++ b/arch/arm/plat-mxc/cpu.c
@@ -1,5 +1,6 @@
1 1
2#include <linux/module.h> 2#include <linux/module.h>
3#include <linux/io.h>
3#include <mach/hardware.h> 4#include <mach/hardware.h>
4 5
5unsigned int __mxc_cpu_type; 6unsigned int __mxc_cpu_type;
@@ -18,3 +19,26 @@ void imx_print_silicon_rev(const char *cpu, int srev)
18 pr_info("CPU identified as %s, silicon rev %d.%d\n", 19 pr_info("CPU identified as %s, silicon rev %d.%d\n",
19 cpu, (srev >> 4) & 0xf, srev & 0xf); 20 cpu, (srev >> 4) & 0xf, srev & 0xf);
20} 21}
22
23void __init imx_set_aips(void __iomem *base)
24{
25 unsigned int reg;
26/*
27 * Set all MPROTx to be non-bufferable, trusted for R/W,
28 * not forced to user-mode.
29 */
30 __raw_writel(0x77777777, base + 0x0);
31 __raw_writel(0x77777777, base + 0x4);
32
33/*
34 * Set all OPACRx to be non-bufferable, to not require
35 * supervisor privilege level for access, allow for
36 * write access and untrusted master access.
37 */
38 __raw_writel(0x0, base + 0x40);
39 __raw_writel(0x0, base + 0x44);
40 __raw_writel(0x0, base + 0x48);
41 __raw_writel(0x0, base + 0x4C);
42 reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
43 __raw_writel(reg, base + 0x50);
44}
diff --git a/arch/arm/plat-mxc/devices/platform-ahci-imx.c b/arch/arm/plat-mxc/devices/platform-ahci-imx.c
index d8a56aee521..ade4a1c4e2a 100644
--- a/arch/arm/plat-mxc/devices/platform-ahci-imx.c
+++ b/arch/arm/plat-mxc/devices/platform-ahci-imx.c
@@ -60,9 +60,9 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
60 dev_err(dev, "no sata clock.\n"); 60 dev_err(dev, "no sata clock.\n");
61 return PTR_ERR(sata_clk); 61 return PTR_ERR(sata_clk);
62 } 62 }
63 ret = clk_enable(sata_clk); 63 ret = clk_prepare_enable(sata_clk);
64 if (ret) { 64 if (ret) {
65 dev_err(dev, "can't enable sata clock.\n"); 65 dev_err(dev, "can't prepare/enable sata clock.\n");
66 goto put_sata_clk; 66 goto put_sata_clk;
67 } 67 }
68 68
@@ -73,9 +73,9 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
73 ret = PTR_ERR(sata_ref_clk); 73 ret = PTR_ERR(sata_ref_clk);
74 goto release_sata_clk; 74 goto release_sata_clk;
75 } 75 }
76 ret = clk_enable(sata_ref_clk); 76 ret = clk_prepare_enable(sata_ref_clk);
77 if (ret) { 77 if (ret) {
78 dev_err(dev, "can't enable sata ref clock.\n"); 78 dev_err(dev, "can't prepare/enable sata ref clock.\n");
79 goto put_sata_ref_clk; 79 goto put_sata_ref_clk;
80 } 80 }
81 81
@@ -104,11 +104,11 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
104 return 0; 104 return 0;
105 105
106release_sata_ref_clk: 106release_sata_ref_clk:
107 clk_disable(sata_ref_clk); 107 clk_disable_unprepare(sata_ref_clk);
108put_sata_ref_clk: 108put_sata_ref_clk:
109 clk_put(sata_ref_clk); 109 clk_put(sata_ref_clk);
110release_sata_clk: 110release_sata_clk:
111 clk_disable(sata_clk); 111 clk_disable_unprepare(sata_clk);
112put_sata_clk: 112put_sata_clk:
113 clk_put(sata_clk); 113 clk_put(sata_clk);
114 114
@@ -117,10 +117,10 @@ put_sata_clk:
117 117
118static void imx_sata_exit(struct device *dev) 118static void imx_sata_exit(struct device *dev)
119{ 119{
120 clk_disable(sata_ref_clk); 120 clk_disable_unprepare(sata_ref_clk);
121 clk_put(sata_ref_clk); 121 clk_put(sata_ref_clk);
122 122
123 clk_disable(sata_clk); 123 clk_disable_unprepare(sata_clk);
124 clk_put(sata_clk); 124 clk_put(sata_clk);
125 125
126} 126}
diff --git a/arch/arm/plat-mxc/devices/platform-mx2-camera.c b/arch/arm/plat-mxc/devices/platform-mx2-camera.c
index b3f4828dc44..11eace953a0 100644
--- a/arch/arm/plat-mxc/devices/platform-mx2-camera.c
+++ b/arch/arm/plat-mxc/devices/platform-mx2-camera.c
@@ -62,3 +62,21 @@ struct platform_device *__init imx_add_mx2_camera(
62 res, data->iobaseemmaprp ? 4 : 2, 62 res, data->iobaseemmaprp ? 4 : 2,
63 pdata, sizeof(*pdata), DMA_BIT_MASK(32)); 63 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
64} 64}
65
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/epit.c b/arch/arm/plat-mxc/epit.c
index d3467f818c3..9129c9e7d53 100644
--- a/arch/arm/plat-mxc/epit.c
+++ b/arch/arm/plat-mxc/epit.c
@@ -203,7 +203,7 @@ static int __init epit_clockevent_init(struct clk *timer_clk)
203 203
204void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq) 204void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
205{ 205{
206 clk_enable(timer_clk); 206 clk_prepare_enable(timer_clk);
207 207
208 timer_base = base; 208 timer_base = base;
209 209
diff --git a/arch/arm/plat-mxc/include/mach/audmux.h b/arch/arm/plat-mxc/include/mach/audmux.h
deleted file mode 100644
index 6fda788ed0e..00000000000
--- a/arch/arm/plat-mxc/include/mach/audmux.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#ifndef __MACH_AUDMUX_H
2#define __MACH_AUDMUX_H
3
4#define MX27_AUDMUX_HPCR1_SSI0 0
5#define MX27_AUDMUX_HPCR2_SSI1 1
6#define MX27_AUDMUX_HPCR3_SSI_PINS_4 2
7#define MX27_AUDMUX_PPCR1_SSI_PINS_1 3
8#define MX27_AUDMUX_PPCR2_SSI_PINS_2 4
9#define MX27_AUDMUX_PPCR3_SSI_PINS_3 5
10
11#define MX31_AUDMUX_PORT1_SSI0 0
12#define MX31_AUDMUX_PORT2_SSI1 1
13#define MX31_AUDMUX_PORT3_SSI_PINS_3 2
14#define MX31_AUDMUX_PORT4_SSI_PINS_4 3
15#define MX31_AUDMUX_PORT5_SSI_PINS_5 4
16#define MX31_AUDMUX_PORT6_SSI_PINS_6 5
17
18#define MX51_AUDMUX_PORT1_SSI0 0
19#define MX51_AUDMUX_PORT2_SSI1 1
20#define MX51_AUDMUX_PORT3 2
21#define MX51_AUDMUX_PORT4 3
22#define MX51_AUDMUX_PORT5 4
23#define MX51_AUDMUX_PORT6 5
24#define MX51_AUDMUX_PORT7 6
25
26/* Register definitions for the i.MX21/27 Digital Audio Multiplexer */
27#define MXC_AUDMUX_V1_PCR_INMMASK(x) ((x) & 0xff)
28#define MXC_AUDMUX_V1_PCR_INMEN (1 << 8)
29#define MXC_AUDMUX_V1_PCR_TXRXEN (1 << 10)
30#define MXC_AUDMUX_V1_PCR_SYN (1 << 12)
31#define MXC_AUDMUX_V1_PCR_RXDSEL(x) (((x) & 0x7) << 13)
32#define MXC_AUDMUX_V1_PCR_RFCSEL(x) (((x) & 0xf) << 20)
33#define MXC_AUDMUX_V1_PCR_RCLKDIR (1 << 24)
34#define MXC_AUDMUX_V1_PCR_RFSDIR (1 << 25)
35#define MXC_AUDMUX_V1_PCR_TFCSEL(x) (((x) & 0xf) << 26)
36#define MXC_AUDMUX_V1_PCR_TCLKDIR (1 << 30)
37#define MXC_AUDMUX_V1_PCR_TFSDIR (1 << 31)
38
39/* Register definitions for the i.MX25/31/35/51 Digital Audio Multiplexer */
40#define MXC_AUDMUX_V2_PTCR_TFSDIR (1 << 31)
41#define MXC_AUDMUX_V2_PTCR_TFSEL(x) (((x) & 0xf) << 27)
42#define MXC_AUDMUX_V2_PTCR_TCLKDIR (1 << 26)
43#define MXC_AUDMUX_V2_PTCR_TCSEL(x) (((x) & 0xf) << 22)
44#define MXC_AUDMUX_V2_PTCR_RFSDIR (1 << 21)
45#define MXC_AUDMUX_V2_PTCR_RFSEL(x) (((x) & 0xf) << 17)
46#define MXC_AUDMUX_V2_PTCR_RCLKDIR (1 << 16)
47#define MXC_AUDMUX_V2_PTCR_RCSEL(x) (((x) & 0xf) << 12)
48#define MXC_AUDMUX_V2_PTCR_SYN (1 << 11)
49
50#define MXC_AUDMUX_V2_PDCR_RXDSEL(x) (((x) & 0x7) << 13)
51#define MXC_AUDMUX_V2_PDCR_TXRXEN (1 << 12)
52#define MXC_AUDMUX_V2_PDCR_MODE(x) (((x) & 0x3) << 8)
53#define MXC_AUDMUX_V2_PDCR_INMMASK(x) ((x) & 0xff)
54
55int mxc_audmux_v1_configure_port(unsigned int port, unsigned int pcr);
56
57int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
58 unsigned int pdcr);
59
60#endif /* __MACH_AUDMUX_H */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
deleted file mode 100644
index 94b60dd4713..00000000000
--- a/arch/arm/plat-mxc/include/mach/board-mx31ads.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * Copyright 2005-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_BOARD_MX31ADS_H__
12#define __ASM_ARCH_MXC_BOARD_MX31ADS_H__
13
14#include <mach/hardware.h>
15
16/*
17 * These symbols are used by drivers/net/cs89x0.c.
18 * This is ugly as hell, but we have to provide them until
19 * someone fixed the driver.
20 */
21
22/* Base address of PBC controller */
23#define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT
24/* Offsets for the PBC Controller register */
25
26/* Ethernet Controller IO base address */
27#define PBC_CS8900A_IOBASE 0x020000
28
29#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
30
31#define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8)
32
33#endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 1bf0df81bdc..0319c4a0caf 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -65,6 +65,7 @@ extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
65 unsigned long ckih1, unsigned long ckih2); 65 unsigned long ckih1, unsigned long ckih2);
66extern int mx53_clocks_init(unsigned long ckil, unsigned long osc, 66extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
67 unsigned long ckih1, unsigned long ckih2); 67 unsigned long ckih1, unsigned long ckih2);
68extern int mx27_clocks_init_dt(void);
68extern int mx51_clocks_init_dt(void); 69extern int mx51_clocks_init_dt(void);
69extern int mx53_clocks_init_dt(void); 70extern int mx53_clocks_init_dt(void);
70extern int mx6q_clocks_init(void); 71extern int mx6q_clocks_init(void);
@@ -75,6 +76,7 @@ extern void mxc_restart(char, const char *);
75extern void mxc_arch_reset_init(void __iomem *); 76extern void mxc_arch_reset_init(void __iomem *);
76extern int mx53_revision(void); 77extern int mx53_revision(void);
77extern int mx53_display_revision(void); 78extern int mx53_display_revision(void);
79extern void imx_set_aips(void __iomem *);
78 80
79enum mxc_cpu_pwr_mode { 81enum mxc_cpu_pwr_mode {
80 WAIT_CLOCKED, /* wfi only */ 82 WAIT_CLOCKED, /* wfi only */
@@ -84,6 +86,14 @@ enum mxc_cpu_pwr_mode {
84 STOP_POWER_OFF, /* STOP + SRPG */ 86 STOP_POWER_OFF, /* STOP + SRPG */
85}; 87};
86 88
89enum mx3_cpu_pwr_mode {
90 MX3_RUN,
91 MX3_WAIT,
92 MX3_DOZE,
93 MX3_SLEEP,
94};
95
96extern void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode);
87extern void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode); 97extern void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode);
88extern void imx_print_silicon_rev(const char *cpu, int srev); 98extern void imx_print_silicon_rev(const char *cpu, int srev);
89 99
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
index 6e192c4a391..8ddda365f1a 100644
--- a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -24,7 +24,7 @@
24#define UART_PADDR MX51_UART1_BASE_ADDR 24#define UART_PADDR MX51_UART1_BASE_ADDR
25#elif defined (CONFIG_DEBUG_IMX50_IMX53_UART) 25#elif defined (CONFIG_DEBUG_IMX50_IMX53_UART)
26#define UART_PADDR MX53_UART1_BASE_ADDR 26#define UART_PADDR MX53_UART1_BASE_ADDR
27#elif defined (CONFIG_DEBUG_IMX6Q_UART) 27#elif defined (CONFIG_DEBUG_IMX6Q_UART4)
28#define UART_PADDR MX6Q_UART4_BASE_ADDR 28#define UART_PADDR MX6Q_UART4_BASE_ADDR
29#endif 29#endif
30 30
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index def9ba53e23..1b2258daa05 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -223,6 +223,8 @@ struct imx_mx2_camera_data {
223struct platform_device *__init imx_add_mx2_camera( 223struct platform_device *__init imx_add_mx2_camera(
224 const struct imx_mx2_camera_data *data, 224 const struct imx_mx2_camera_data *data,
225 const struct mx2_camera_platform_data *pdata); 225 const struct mx2_camera_platform_data *pdata);
226struct platform_device *__init imx_add_mx2_emmaprp(
227 const struct imx_mx2_camera_data *data);
226 228
227#include <mach/mxc_ehci.h> 229#include <mach/mxc_ehci.h>
228struct imx_mxc_ehci_data { 230struct imx_mxc_ehci_data {
diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h
index 233d0a5e2d6..1b9080385b4 100644
--- a/arch/arm/plat-mxc/include/mach/dma.h
+++ b/arch/arm/plat-mxc/include/mach/dma.h
@@ -60,8 +60,7 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
60 60
61static inline int imx_dma_is_general_purpose(struct dma_chan *chan) 61static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
62{ 62{
63 return !strcmp(dev_name(chan->device->dev), "imx31-sdma") || 63 return strstr(dev_name(chan->device->dev), "sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx35-sdma") ||
65 !strcmp(dev_name(chan->device->dev), "imx-dma"); 64 !strcmp(dev_name(chan->device->dev), "imx-dma");
66} 65}
67 66
diff --git a/arch/arm/plat-mxc/include/mach/entry-macro.S b/arch/arm/plat-mxc/include/mach/entry-macro.S
deleted file mode 100644
index def5d30cb67..00000000000
--- a/arch/arm/plat-mxc/include/mach/entry-macro.S
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * Copyright (C) 2007 Lennert Buytenhek <buytenh@wantstofly.org>
3 * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
4 */
5
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 .macro disable_fiq
13 .endm
14
15 .macro arch_ret_to_user, tmp1, tmp2
16 .endm
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx25.h b/arch/arm/plat-mxc/include/mach/iomux-mx25.h
index f0726d48df2..c61ec0fc10d 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx25.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx25.h
@@ -139,15 +139,15 @@
139#define MX25_PAD_NFRB__GPIO_3_31 IOMUX_PAD(0x27c, 0x084, 0x15, 0, 0, NO_PAD_CTRL) 139#define MX25_PAD_NFRB__GPIO_3_31 IOMUX_PAD(0x27c, 0x084, 0x15, 0, 0, NO_PAD_CTRL)
140 140
141#define MX25_PAD_D15__D15 IOMUX_PAD(0x280, 0x088, 0x00, 0, 0, NO_PAD_CTRL) 141#define MX25_PAD_D15__D15 IOMUX_PAD(0x280, 0x088, 0x00, 0, 0, NO_PAD_CTRL)
142#define MX25_PAD_D15__LD16 IOMUX_PAD(0x280, 0x088, 0x01, 0, 0, NO_PAD_CTRL) 142#define MX25_PAD_D15__LD16 IOMUX_PAD(0x280, 0x088, 0x01, 0, 0, PAD_CTL_SRE_FAST)
143#define MX25_PAD_D15__GPIO_4_5 IOMUX_PAD(0x280, 0x088, 0x05, 0, 0, NO_PAD_CTRL) 143#define MX25_PAD_D15__GPIO_4_5 IOMUX_PAD(0x280, 0x088, 0x05, 0, 0, NO_PAD_CTRL)
144 144
145#define MX25_PAD_D14__D14 IOMUX_PAD(0x284, 0x08c, 0x00, 0, 0, NO_PAD_CTRL) 145#define MX25_PAD_D14__D14 IOMUX_PAD(0x284, 0x08c, 0x00, 0, 0, NO_PAD_CTRL)
146#define MX25_PAD_D14__LD17 IOMUX_PAD(0x284, 0x08c, 0x01, 0, 0, NO_PAD_CTRL) 146#define MX25_PAD_D14__LD17 IOMUX_PAD(0x284, 0x08c, 0x01, 0, 0, PAD_CTL_SRE_FAST)
147#define MX25_PAD_D14__GPIO_4_6 IOMUX_PAD(0x284, 0x08c, 0x05, 0, 0, NO_PAD_CTRL) 147#define MX25_PAD_D14__GPIO_4_6 IOMUX_PAD(0x284, 0x08c, 0x05, 0, 0, NO_PAD_CTRL)
148 148
149#define MX25_PAD_D13__D13 IOMUX_PAD(0x288, 0x090, 0x00, 0, 0, NO_PAD_CTRL) 149#define MX25_PAD_D13__D13 IOMUX_PAD(0x288, 0x090, 0x00, 0, 0, NO_PAD_CTRL)
150#define MX25_PAD_D13__LD18 IOMUX_PAD(0x288, 0x090, 0x01, 0, 0, NO_PAD_CTRL) 150#define MX25_PAD_D13__LD18 IOMUX_PAD(0x288, 0x090, 0x01, 0, 0, PAD_CTL_SRE_FAST)
151#define MX25_PAD_D13__GPIO_4_7 IOMUX_PAD(0x288, 0x090, 0x05, 0, 0, NO_PAD_CTRL) 151#define MX25_PAD_D13__GPIO_4_7 IOMUX_PAD(0x288, 0x090, 0x05, 0, 0, NO_PAD_CTRL)
152 152
153#define MX25_PAD_D12__D12 IOMUX_PAD(0x28c, 0x094, 0x00, 0, 0, NO_PAD_CTRL) 153#define MX25_PAD_D12__D12 IOMUX_PAD(0x28c, 0x094, 0x00, 0, 0, NO_PAD_CTRL)
@@ -192,54 +192,54 @@
192#define MX25_PAD_D0__D0 IOMUX_PAD(0x2bc, 0x0c4, 0x00, 0, 0, NO_PAD_CTRL) 192#define MX25_PAD_D0__D0 IOMUX_PAD(0x2bc, 0x0c4, 0x00, 0, 0, NO_PAD_CTRL)
193#define MX25_PAD_D0__GPIO_4_20 IOMUX_PAD(0x2bc, 0x0c4, 0x05, 0, 0, NO_PAD_CTRL) 193#define MX25_PAD_D0__GPIO_4_20 IOMUX_PAD(0x2bc, 0x0c4, 0x05, 0, 0, NO_PAD_CTRL)
194 194
195#define MX25_PAD_LD0__LD0 IOMUX_PAD(0x2c0, 0x0c8, 0x10, 0, 0, NO_PAD_CTRL) 195#define MX25_PAD_LD0__LD0 IOMUX_PAD(0x2c0, 0x0c8, 0x10, 0, 0, PAD_CTL_SRE_FAST)
196#define MX25_PAD_LD0__CSI_D0 IOMUX_PAD(0x2c0, 0x0c8, 0x12, 0x488, 0, NO_PAD_CTRL) 196#define MX25_PAD_LD0__CSI_D0 IOMUX_PAD(0x2c0, 0x0c8, 0x12, 0x488, 0, NO_PAD_CTRL)
197#define MX25_PAD_LD0__GPIO_2_15 IOMUX_PAD(0x2c0, 0x0c8, 0x15, 0, 0, NO_PAD_CTRL) 197#define MX25_PAD_LD0__GPIO_2_15 IOMUX_PAD(0x2c0, 0x0c8, 0x15, 0, 0, NO_PAD_CTRL)
198 198
199#define MX25_PAD_LD1__LD1 IOMUX_PAD(0x2c4, 0x0cc, 0x10, 0, 0, NO_PAD_CTRL) 199#define MX25_PAD_LD1__LD1 IOMUX_PAD(0x2c4, 0x0cc, 0x10, 0, 0, PAD_CTL_SRE_FAST)
200#define MX25_PAD_LD1__CSI_D1 IOMUX_PAD(0x2c4, 0x0cc, 0x12, 0x48c, 0, NO_PAD_CTRL) 200#define MX25_PAD_LD1__CSI_D1 IOMUX_PAD(0x2c4, 0x0cc, 0x12, 0x48c, 0, NO_PAD_CTRL)
201#define MX25_PAD_LD1__GPIO_2_16 IOMUX_PAD(0x2c4, 0x0cc, 0x15, 0, 0, NO_PAD_CTRL) 201#define MX25_PAD_LD1__GPIO_2_16 IOMUX_PAD(0x2c4, 0x0cc, 0x15, 0, 0, NO_PAD_CTRL)
202 202
203#define MX25_PAD_LD2__LD2 IOMUX_PAD(0x2c8, 0x0d0, 0x10, 0, 0, NO_PAD_CTRL) 203#define MX25_PAD_LD2__LD2 IOMUX_PAD(0x2c8, 0x0d0, 0x10, 0, 0, PAD_CTL_SRE_FAST)
204#define MX25_PAD_LD2__GPIO_2_17 IOMUX_PAD(0x2c8, 0x0d0, 0x15, 0, 0, NO_PAD_CTRL) 204#define MX25_PAD_LD2__GPIO_2_17 IOMUX_PAD(0x2c8, 0x0d0, 0x15, 0, 0, NO_PAD_CTRL)
205 205
206#define MX25_PAD_LD3__LD3 IOMUX_PAD(0x2cc, 0x0d4, 0x10, 0, 0, NO_PAD_CTRL) 206#define MX25_PAD_LD3__LD3 IOMUX_PAD(0x2cc, 0x0d4, 0x10, 0, 0, PAD_CTL_SRE_FAST)
207#define MX25_PAD_LD3__GPIO_2_18 IOMUX_PAD(0x2cc, 0x0d4, 0x15, 0, 0, NO_PAD_CTRL) 207#define MX25_PAD_LD3__GPIO_2_18 IOMUX_PAD(0x2cc, 0x0d4, 0x15, 0, 0, NO_PAD_CTRL)
208 208
209#define MX25_PAD_LD4__LD4 IOMUX_PAD(0x2d0, 0x0d8, 0x10, 0, 0, NO_PAD_CTRL) 209#define MX25_PAD_LD4__LD4 IOMUX_PAD(0x2d0, 0x0d8, 0x10, 0, 0, PAD_CTL_SRE_FAST)
210#define MX25_PAD_LD4__GPIO_2_19 IOMUX_PAD(0x2d0, 0x0d8, 0x15, 0, 0, NO_PAD_CTRL) 210#define MX25_PAD_LD4__GPIO_2_19 IOMUX_PAD(0x2d0, 0x0d8, 0x15, 0, 0, NO_PAD_CTRL)
211 211
212#define MX25_PAD_LD5__LD5 IOMUX_PAD(0x2d4, 0x0dc, 0x10, 0, 0, NO_PAD_CTRL) 212#define MX25_PAD_LD5__LD5 IOMUX_PAD(0x2d4, 0x0dc, 0x10, 0, 0, PAD_CTL_SRE_FAST)
213#define MX25_PAD_LD5__GPIO_1_19 IOMUX_PAD(0x2d4, 0x0dc, 0x15, 0, 0, NO_PAD_CTRL) 213#define MX25_PAD_LD5__GPIO_1_19 IOMUX_PAD(0x2d4, 0x0dc, 0x15, 0, 0, NO_PAD_CTRL)
214 214
215#define MX25_PAD_LD6__LD6 IOMUX_PAD(0x2d8, 0x0e0, 0x10, 0, 0, NO_PAD_CTRL) 215#define MX25_PAD_LD6__LD6 IOMUX_PAD(0x2d8, 0x0e0, 0x10, 0, 0, PAD_CTL_SRE_FAST)
216#define MX25_PAD_LD6__GPIO_1_20 IOMUX_PAD(0x2d8, 0x0e0, 0x15, 0, 0, NO_PAD_CTRL) 216#define MX25_PAD_LD6__GPIO_1_20 IOMUX_PAD(0x2d8, 0x0e0, 0x15, 0, 0, NO_PAD_CTRL)
217 217
218#define MX25_PAD_LD7__LD7 IOMUX_PAD(0x2dc, 0x0e4, 0x10, 0, 0, NO_PAD_CTRL) 218#define MX25_PAD_LD7__LD7 IOMUX_PAD(0x2dc, 0x0e4, 0x10, 0, 0, PAD_CTL_SRE_FAST)
219#define MX25_PAD_LD7__GPIO_1_21 IOMUX_PAD(0x2dc, 0x0e4, 0x15, 0, 0, NO_PAD_CTRL) 219#define MX25_PAD_LD7__GPIO_1_21 IOMUX_PAD(0x2dc, 0x0e4, 0x15, 0, 0, NO_PAD_CTRL)
220 220
221#define MX25_PAD_LD8__LD8 IOMUX_PAD(0x2e0, 0x0e8, 0x10, 0, 0, NO_PAD_CTRL) 221#define MX25_PAD_LD8__LD8 IOMUX_PAD(0x2e0, 0x0e8, 0x10, 0, 0, PAD_CTL_SRE_FAST)
222#define MX25_PAD_LD8__FEC_TX_ERR IOMUX_PAD(0x2e0, 0x0e8, 0x15, 0, 0, NO_PAD_CTRL) 222#define MX25_PAD_LD8__FEC_TX_ERR IOMUX_PAD(0x2e0, 0x0e8, 0x15, 0, 0, NO_PAD_CTRL)
223 223
224#define MX25_PAD_LD9__LD9 IOMUX_PAD(0x2e4, 0x0ec, 0x10, 0, 0, NO_PAD_CTRL) 224#define MX25_PAD_LD9__LD9 IOMUX_PAD(0x2e4, 0x0ec, 0x10, 0, 0, PAD_CTL_SRE_FAST)
225#define MX25_PAD_LD9__FEC_COL IOMUX_PAD(0x2e4, 0x0ec, 0x15, 0x504, 1, NO_PAD_CTRL) 225#define MX25_PAD_LD9__FEC_COL IOMUX_PAD(0x2e4, 0x0ec, 0x15, 0x504, 1, NO_PAD_CTRL)
226 226
227#define MX25_PAD_LD10__LD10 IOMUX_PAD(0x2e8, 0x0f0, 0x10, 0, 0, NO_PAD_CTRL) 227#define MX25_PAD_LD10__LD10 IOMUX_PAD(0x2e8, 0x0f0, 0x10, 0, 0, PAD_CTL_SRE_FAST)
228#define MX25_PAD_LD10__FEC_RX_ER IOMUX_PAD(0x2e8, 0x0f0, 0x15, 0x518, 1, NO_PAD_CTRL) 228#define MX25_PAD_LD10__FEC_RX_ER IOMUX_PAD(0x2e8, 0x0f0, 0x15, 0x518, 1, NO_PAD_CTRL)
229 229
230#define MX25_PAD_LD11__LD11 IOMUX_PAD(0x2ec, 0x0f4, 0x10, 0, 0, NO_PAD_CTRL) 230#define MX25_PAD_LD11__LD11 IOMUX_PAD(0x2ec, 0x0f4, 0x10, 0, 0, PAD_CTL_SRE_FAST)
231#define MX25_PAD_LD11__FEC_RDATA2 IOMUX_PAD(0x2ec, 0x0f4, 0x15, 0x50c, 1, NO_PAD_CTRL) 231#define MX25_PAD_LD11__FEC_RDATA2 IOMUX_PAD(0x2ec, 0x0f4, 0x15, 0x50c, 1, NO_PAD_CTRL)
232 232
233#define MX25_PAD_LD12__LD12 IOMUX_PAD(0x2f0, 0x0f8, 0x10, 0, 0, NO_PAD_CTRL) 233#define MX25_PAD_LD12__LD12 IOMUX_PAD(0x2f0, 0x0f8, 0x10, 0, 0, PAD_CTL_SRE_FAST)
234#define MX25_PAD_LD12__FEC_RDATA3 IOMUX_PAD(0x2f0, 0x0f8, 0x15, 0x510, 1, NO_PAD_CTRL) 234#define MX25_PAD_LD12__FEC_RDATA3 IOMUX_PAD(0x2f0, 0x0f8, 0x15, 0x510, 1, NO_PAD_CTRL)
235 235
236#define MX25_PAD_LD13__LD13 IOMUX_PAD(0x2f4, 0x0fc, 0x10, 0, 0, NO_PAD_CTRL) 236#define MX25_PAD_LD13__LD13 IOMUX_PAD(0x2f4, 0x0fc, 0x10, 0, 0, PAD_CTL_SRE_FAST)
237#define MX25_PAD_LD13__FEC_TDATA2 IOMUX_PAD(0x2f4, 0x0fc, 0x15, 0, 0, NO_PAD_CTRL) 237#define MX25_PAD_LD13__FEC_TDATA2 IOMUX_PAD(0x2f4, 0x0fc, 0x15, 0, 0, NO_PAD_CTRL)
238 238
239#define MX25_PAD_LD14__LD14 IOMUX_PAD(0x2f8, 0x100, 0x10, 0, 0, NO_PAD_CTRL) 239#define MX25_PAD_LD14__LD14 IOMUX_PAD(0x2f8, 0x100, 0x10, 0, 0, PAD_CTL_SRE_FAST)
240#define MX25_PAD_LD14__FEC_TDATA3 IOMUX_PAD(0x2f8, 0x100, 0x15, 0, 0, NO_PAD_CTRL) 240#define MX25_PAD_LD14__FEC_TDATA3 IOMUX_PAD(0x2f8, 0x100, 0x15, 0, 0, NO_PAD_CTRL)
241 241
242#define MX25_PAD_LD15__LD15 IOMUX_PAD(0x2fc, 0x104, 0x10, 0, 0, NO_PAD_CTRL) 242#define MX25_PAD_LD15__LD15 IOMUX_PAD(0x2fc, 0x104, 0x10, 0, 0, PAD_CTL_SRE_FAST)
243#define MX25_PAD_LD15__FEC_RX_CLK IOMUX_PAD(0x2fc, 0x104, 0x15, 0x514, 1, NO_PAD_CTRL) 243#define MX25_PAD_LD15__FEC_RX_CLK IOMUX_PAD(0x2fc, 0x104, 0x15, 0x514, 1, NO_PAD_CTRL)
244 244
245#define MX25_PAD_HSYNC__HSYNC IOMUX_PAD(0x300, 0x108, 0x10, 0, 0, NO_PAD_CTRL) 245#define MX25_PAD_HSYNC__HSYNC IOMUX_PAD(0x300, 0x108, 0x10, 0, 0, NO_PAD_CTRL)
@@ -468,11 +468,11 @@
468#define MX25_PAD_GPIO_C__CAN2_TX IOMUX_PAD(0x3f8, 0x1fc, 0x16, 0, 0, PAD_CTL_PUS_22K_UP) 468#define MX25_PAD_GPIO_C__CAN2_TX IOMUX_PAD(0x3f8, 0x1fc, 0x16, 0, 0, PAD_CTL_PUS_22K_UP)
469 469
470#define MX25_PAD_GPIO_D__GPIO_D IOMUX_PAD(0x3fc, 0x200, 0x10, 0, 0, NO_PAD_CTRL) 470#define MX25_PAD_GPIO_D__GPIO_D IOMUX_PAD(0x3fc, 0x200, 0x10, 0, 0, NO_PAD_CTRL)
471#define MX25_PAD_GPIO_E__LD16 IOMUX_PAD(0x400, 0x204, 0x02, 0, 0, NO_PAD_CTRL) 471#define MX25_PAD_GPIO_E__LD16 IOMUX_PAD(0x400, 0x204, 0x02, 0, 0, PAD_CTL_SRE_FAST)
472#define MX25_PAD_GPIO_D__CAN2_RX IOMUX_PAD(0x3fc, 0x200, 0x16, 0x484, 1, PAD_CTL_PUS_22K_UP) 472#define MX25_PAD_GPIO_D__CAN2_RX IOMUX_PAD(0x3fc, 0x200, 0x16, 0x484, 1, PAD_CTL_PUS_22K_UP)
473 473
474#define MX25_PAD_GPIO_E__GPIO_E IOMUX_PAD(0x400, 0x204, 0x10, 0, 0, NO_PAD_CTRL) 474#define MX25_PAD_GPIO_E__GPIO_E IOMUX_PAD(0x400, 0x204, 0x10, 0, 0, NO_PAD_CTRL)
475#define MX25_PAD_GPIO_F__LD17 IOMUX_PAD(0x404, 0x208, 0x02, 0, 0, NO_PAD_CTRL) 475#define MX25_PAD_GPIO_F__LD17 IOMUX_PAD(0x404, 0x208, 0x02, 0, 0, PAD_CTL_SRE_FAST)
476#define MX25_PAD_GPIO_E__AUD7_TXD IOMUX_PAD(0x400, 0x204, 0x14, 0, 0, NO_PAD_CTRL) 476#define MX25_PAD_GPIO_E__AUD7_TXD IOMUX_PAD(0x400, 0x204, 0x14, 0, 0, NO_PAD_CTRL)
477 477
478#define MX25_PAD_GPIO_F__GPIO_F IOMUX_PAD(0x404, 0x208, 0x10, 0, 0, NO_PAD_CTRL) 478#define MX25_PAD_GPIO_F__GPIO_F IOMUX_PAD(0x404, 0x208, 0x10, 0, 0, NO_PAD_CTRL)
diff --git a/arch/arm/plat-mxc/include/mach/system.h b/arch/arm/plat-mxc/include/mach/system.h
deleted file mode 100644
index 13ad0df2e86..00000000000
--- a/arch/arm/plat-mxc/include/mach/system.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 1999 ARM Limited
3 * Copyright (C) 2000 Deep Blue Solutions Ltd
4 * Copyright 2004-2008 Freescale Semiconductor, 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
17#ifndef __ASM_ARCH_MXC_SYSTEM_H__
18#define __ASM_ARCH_MXC_SYSTEM_H__
19
20static inline void arch_idle(void)
21{
22 cpu_do_idle();
23}
24
25#endif /* __ASM_ARCH_MXC_SYSTEM_H__ */
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index e032717f7d0..c0cab2270dd 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -132,7 +132,7 @@ int pwm_enable(struct pwm_device *pwm)
132 int rc = 0; 132 int rc = 0;
133 133
134 if (!pwm->clk_enabled) { 134 if (!pwm->clk_enabled) {
135 rc = clk_enable(pwm->clk); 135 rc = clk_prepare_enable(pwm->clk);
136 if (!rc) 136 if (!rc)
137 pwm->clk_enabled = 1; 137 pwm->clk_enabled = 1;
138 } 138 }
@@ -145,7 +145,7 @@ void pwm_disable(struct pwm_device *pwm)
145 writel(0, pwm->mmio_base + MX3_PWMCR); 145 writel(0, pwm->mmio_base + MX3_PWMCR);
146 146
147 if (pwm->clk_enabled) { 147 if (pwm->clk_enabled) {
148 clk_disable(pwm->clk); 148 clk_disable_unprepare(pwm->clk);
149 pwm->clk_enabled = 0; 149 pwm->clk_enabled = 0;
150 } 150 }
151} 151}
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index 3599bf2cfd4..f30dcacbbd0 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -48,7 +48,7 @@ void mxc_restart(char mode, const char *cmd)
48 48
49 clk = clk_get_sys("imx2-wdt.0", NULL); 49 clk = clk_get_sys("imx2-wdt.0", NULL);
50 if (!IS_ERR(clk)) 50 if (!IS_ERR(clk))
51 clk_enable(clk); 51 clk_prepare_enable(clk);
52 wcr_enable = (1 << 2); 52 wcr_enable = (1 << 2);
53 } 53 }
54 54
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index 1c96cdb4c35..7daf7c9a413 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -283,7 +283,7 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
283{ 283{
284 uint32_t tctl_val; 284 uint32_t tctl_val;
285 285
286 clk_enable(timer_clk); 286 clk_prepare_enable(timer_clk);
287 287
288 timer_base = base; 288 timer_base = base;
289 289
diff --git a/arch/arm/plat-nomadik/include/plat/mtu.h b/arch/arm/plat-nomadik/include/plat/mtu.h
index 6508e7694a4..582641f3dc0 100644
--- a/arch/arm/plat-nomadik/include/plat/mtu.h
+++ b/arch/arm/plat-nomadik/include/plat/mtu.h
@@ -1,9 +1,7 @@
1#ifndef __PLAT_MTU_H 1#ifndef __PLAT_MTU_H
2#define __PLAT_MTU_H 2#define __PLAT_MTU_H
3 3
4/* should be set by the platform code */ 4void nmdk_timer_init(void __iomem *base);
5extern void __iomem *mtu_base;
6
7void nmdk_clkevt_reset(void); 5void nmdk_clkevt_reset(void);
8void nmdk_clksrc_reset(void); 6void nmdk_clksrc_reset(void);
9 7
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c
index ad1b45b605a..9222e5522a4 100644
--- a/arch/arm/plat-nomadik/timer.c
+++ b/arch/arm/plat-nomadik/timer.c
@@ -21,12 +21,6 @@
21#include <asm/sched_clock.h> 21#include <asm/sched_clock.h>
22 22
23/* 23/*
24 * Guaranteed runtime conversion range in seconds for
25 * the clocksource and clockevent.
26 */
27#define MTU_MIN_RANGE 4
28
29/*
30 * The MTU device hosts four different counters, with 4 set of 24 * The MTU device hosts four different counters, with 4 set of
31 * registers. These are register names. 25 * registers. These are register names.
32 */ 26 */
@@ -66,12 +60,11 @@
66#define MTU_PCELL2 0xff8 60#define MTU_PCELL2 0xff8
67#define MTU_PCELL3 0xffC 61#define MTU_PCELL3 0xffC
68 62
63static void __iomem *mtu_base;
69static bool clkevt_periodic; 64static bool clkevt_periodic;
70static u32 clk_prescale; 65static u32 clk_prescale;
71static u32 nmdk_cycle; /* write-once */ 66static u32 nmdk_cycle; /* write-once */
72 67
73void __iomem *mtu_base; /* Assigned by machine code */
74
75#ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK 68#ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK
76/* 69/*
77 * Override the global weak sched_clock symbol with this 70 * Override the global weak sched_clock symbol with this
@@ -103,7 +96,6 @@ static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev)
103void nmdk_clkevt_reset(void) 96void nmdk_clkevt_reset(void)
104{ 97{
105 if (clkevt_periodic) { 98 if (clkevt_periodic) {
106
107 /* Timer: configure load and background-load, and fire it up */ 99 /* Timer: configure load and background-load, and fire it up */
108 writel(nmdk_cycle, mtu_base + MTU_LR(1)); 100 writel(nmdk_cycle, mtu_base + MTU_LR(1));
109 writel(nmdk_cycle, mtu_base + MTU_BGLR(1)); 101 writel(nmdk_cycle, mtu_base + MTU_BGLR(1));
@@ -121,7 +113,6 @@ void nmdk_clkevt_reset(void)
121static void nmdk_clkevt_mode(enum clock_event_mode mode, 113static void nmdk_clkevt_mode(enum clock_event_mode mode,
122 struct clock_event_device *dev) 114 struct clock_event_device *dev)
123{ 115{
124
125 switch (mode) { 116 switch (mode) {
126 case CLOCK_EVT_MODE_PERIODIC: 117 case CLOCK_EVT_MODE_PERIODIC:
127 clkevt_periodic = true; 118 clkevt_periodic = true;
@@ -183,15 +174,16 @@ void nmdk_clksrc_reset(void)
183 mtu_base + MTU_CR(0)); 174 mtu_base + MTU_CR(0));
184} 175}
185 176
186void __init nmdk_timer_init(void) 177void __init nmdk_timer_init(void __iomem *base)
187{ 178{
188 unsigned long rate; 179 unsigned long rate;
189 struct clk *clk0; 180 struct clk *clk0;
190 181
182 mtu_base = base;
191 clk0 = clk_get_sys("mtu0", NULL); 183 clk0 = clk_get_sys("mtu0", NULL);
192 BUG_ON(IS_ERR(clk0)); 184 BUG_ON(IS_ERR(clk0));
193 185 BUG_ON(clk_prepare(clk0) < 0);
194 clk_enable(clk0); 186 BUG_ON(clk_enable(clk0) < 0);
195 187
196 /* 188 /*
197 * Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz 189 * Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz
@@ -224,17 +216,8 @@ void __init nmdk_timer_init(void)
224 setup_sched_clock(nomadik_read_sched_clock, 32, rate); 216 setup_sched_clock(nomadik_read_sched_clock, 32, rate);
225#endif 217#endif
226 218
227 /* Timer 1 is used for events */ 219 /* Timer 1 is used for events, register irq and clockevents */
228
229 clockevents_calc_mult_shift(&nmdk_clkevt, rate, MTU_MIN_RANGE);
230
231 nmdk_clkevt.max_delta_ns =
232 clockevent_delta2ns(0xffffffff, &nmdk_clkevt);
233 nmdk_clkevt.min_delta_ns =
234 clockevent_delta2ns(0x00000002, &nmdk_clkevt);
235 nmdk_clkevt.cpumask = cpumask_of(0);
236
237 /* Register irq and clockevents */
238 setup_irq(IRQ_MTU0, &nmdk_timer_irq); 220 setup_irq(IRQ_MTU0, &nmdk_timer_irq);
239 clockevents_register_device(&nmdk_clkevt); 221 nmdk_clkevt.cpumask = cpumask_of(0);
222 clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU);
240} 223}
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index aa59f4247dc..ce1e9b96ba1 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -14,6 +14,7 @@ config ARCH_OMAP1
14 select CLKDEV_LOOKUP 14 select CLKDEV_LOOKUP
15 select CLKSRC_MMIO 15 select CLKSRC_MMIO
16 select GENERIC_IRQ_CHIP 16 select GENERIC_IRQ_CHIP
17 select IRQ_DOMAIN
17 select HAVE_IDE 18 select HAVE_IDE
18 select NEED_MACH_MEMORY_H 19 select NEED_MACH_MEMORY_H
19 help 20 help
@@ -24,6 +25,8 @@ config ARCH_OMAP2PLUS
24 select CLKDEV_LOOKUP 25 select CLKDEV_LOOKUP
25 select GENERIC_IRQ_CHIP 26 select GENERIC_IRQ_CHIP
26 select OMAP_DM_TIMER 27 select OMAP_DM_TIMER
28 select USE_OF
29 select PROC_DEVICETREE if PROC_FS
27 help 30 help
28 "Systems based on OMAP2, OMAP3 or OMAP4" 31 "Systems based on OMAP2, OMAP3 or OMAP4"
29 32
@@ -110,14 +113,6 @@ config OMAP_MUX_WARNINGS
110 to change the pin multiplexing setup. When there are no warnings 113 to change the pin multiplexing setup. When there are no warnings
111 printed, it's safe to deselect OMAP_MUX for your product. 114 printed, it's safe to deselect OMAP_MUX for your product.
112 115
113config OMAP_MCBSP
114 bool "McBSP support"
115 depends on ARCH_OMAP
116 default y
117 help
118 Say Y here if you want support for the OMAP Multichannel
119 Buffered Serial Port.
120
121config OMAP_MBOX_FWK 116config OMAP_MBOX_FWK
122 tristate "Mailbox framework support" 117 tristate "Mailbox framework support"
123 depends on ARCH_OMAP 118 depends on ARCH_OMAP
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 9a584614e7e..c0fe2757b69 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -17,8 +17,6 @@ obj-$(CONFIG_ARCH_OMAP2) += omap_device.o
17obj-$(CONFIG_ARCH_OMAP3) += omap_device.o 17obj-$(CONFIG_ARCH_OMAP3) += omap_device.o
18obj-$(CONFIG_ARCH_OMAP4) += omap_device.o 18obj-$(CONFIG_ARCH_OMAP4) += omap_device.o
19 19
20obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
21
22obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o 20obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
23obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o 21obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
24obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o 22obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 567e4b54f24..56b6f8b7053 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -20,7 +20,6 @@
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/mutex.h> 21#include <linux/mutex.h>
22#include <linux/cpufreq.h> 22#include <linux/cpufreq.h>
23#include <linux/debugfs.h>
24#include <linux/io.h> 23#include <linux/io.h>
25 24
26#include <plat/clock.h> 25#include <plat/clock.h>
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 4de7d1e79e7..f1e46ea6b81 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -15,7 +15,6 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18#include <linux/omapfb.h>
19 18
20#include <plat/common.h> 19#include <plat/common.h>
21#include <plat/board.h> 20#include <plat/board.h>
@@ -65,7 +64,6 @@ const void *__init omap_get_var_config(u16 tag, size_t *len)
65 64
66void __init omap_reserve(void) 65void __init omap_reserve(void)
67{ 66{
68 omapfb_reserve_sdram_memblock();
69 omap_vram_reserve_sdram_memblock(); 67 omap_vram_reserve_sdram_memblock();
70 omap_dsp_reserve_sdram_memblock(); 68 omap_dsp_reserve_sdram_memblock();
71 omap_secure_ram_reserve_memblock(); 69 omap_secure_ram_reserve_memblock();
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 5f0f2292b7f..5068fe5a691 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -21,6 +21,7 @@
21 21
22#include <asm/sched_clock.h> 22#include <asm/sched_clock.h>
23 23
24#include <plat/hardware.h>
24#include <plat/common.h> 25#include <plat/common.h>
25#include <plat/board.h> 26#include <plat/board.h>
26 27
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 002fb4d96bb..74300ae29b7 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -164,6 +164,8 @@ static inline void set_gdma_dev(int req, int dev)
164} 164}
165#else 165#else
166#define set_gdma_dev(req, dev) do {} while (0) 166#define set_gdma_dev(req, dev) do {} while (0)
167#define omap_readl(reg) 0
168#define omap_writel(val, reg) do {} while (0)
167#endif 169#endif
168 170
169void omap_set_dma_priority(int lch, int dst_port, int priority) 171void omap_set_dma_priority(int lch, int dst_port, int priority)
@@ -2125,7 +2127,7 @@ static int __devexit omap_system_dma_remove(struct platform_device *pdev)
2125 2127
2126static struct platform_driver omap_system_dma_driver = { 2128static struct platform_driver omap_system_dma_driver = {
2127 .probe = omap_system_dma_probe, 2129 .probe = omap_system_dma_probe,
2128 .remove = omap_system_dma_remove, 2130 .remove = __devexit_p(omap_system_dma_remove),
2129 .driver = { 2131 .driver = {
2130 .name = "omap_dma_system" 2132 .name = "omap_dma_system"
2131 }, 2133 },
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index af3b92be845..652139c0339 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -43,6 +43,8 @@
43 43
44#include <plat/dmtimer.h> 44#include <plat/dmtimer.h>
45 45
46#include <mach/hardware.h>
47
46static LIST_HEAD(omap_timer_list); 48static LIST_HEAD(omap_timer_list);
47static DEFINE_SPINLOCK(dm_timer_lock); 49static DEFINE_SPINLOCK(dm_timer_lock);
48 50
@@ -80,9 +82,9 @@ static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, u32 reg,
80 82
81static void omap_timer_restore_context(struct omap_dm_timer *timer) 83static void omap_timer_restore_context(struct omap_dm_timer *timer)
82{ 84{
83 omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_OFFSET, 85 __raw_writel(timer->context.tiocp_cfg,
84 timer->context.tiocp_cfg); 86 timer->io_base + OMAP_TIMER_OCP_CFG_OFFSET);
85 if (timer->revision > 1) 87 if (timer->revision == 1)
86 __raw_writel(timer->context.tistat, timer->sys_stat); 88 __raw_writel(timer->context.tistat, timer->sys_stat);
87 89
88 __raw_writel(timer->context.tisr, timer->irq_stat); 90 __raw_writel(timer->context.tisr, timer->irq_stat);
@@ -357,6 +359,19 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
357 359
358 __omap_dm_timer_stop(timer, timer->posted, rate); 360 __omap_dm_timer_stop(timer, timer->posted, rate);
359 361
362 if (timer->loses_context && timer->get_context_loss_count)
363 timer->ctx_loss_count =
364 timer->get_context_loss_count(&timer->pdev->dev);
365
366 /*
367 * Since the register values are computed and written within
368 * __omap_dm_timer_stop, we need to use read to retrieve the
369 * context.
370 */
371 timer->context.tclr =
372 omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
373 timer->context.tisr = __raw_readl(timer->irq_stat);
374 omap_dm_timer_disable(timer);
360 return 0; 375 return 0;
361} 376}
362EXPORT_SYMBOL_GPL(omap_dm_timer_stop); 377EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index c9e5d7298c4..dd6f92c99e5 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -34,15 +34,11 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include <plat/board.h> 36#include <plat/board.h>
37#include <plat/sram.h>
38
39#include "fb.h"
40 37
41#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) 38#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
42 39
40static bool omapfb_lcd_configured;
43static struct omapfb_platform_data omapfb_config; 41static struct omapfb_platform_data omapfb_config;
44static int config_invalid;
45static int configured_regions;
46 42
47static u64 omap_fb_dma_mask = ~(u32)0; 43static u64 omap_fb_dma_mask = ~(u32)0;
48 44
@@ -57,302 +53,21 @@ static struct platform_device omap_fb_device = {
57 .num_resources = 0, 53 .num_resources = 0,
58}; 54};
59 55
60void omapfb_set_platform_data(struct omapfb_platform_data *data) 56void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
61{
62}
63
64static inline int ranges_overlap(unsigned long start1, unsigned long size1,
65 unsigned long start2, unsigned long size2)
66{
67 return (start1 >= start2 && start1 < start2 + size2) ||
68 (start2 >= start1 && start2 < start1 + size1);
69}
70
71static inline int range_included(unsigned long start1, unsigned long size1,
72 unsigned long start2, unsigned long size2)
73{
74 return start1 >= start2 && start1 + size1 <= start2 + size2;
75}
76
77
78/* Check if there is an overlapping region. */
79static int fbmem_region_reserved(unsigned long start, size_t size)
80{
81 struct omapfb_mem_region *rg;
82 int i;
83
84 rg = &omapfb_config.mem_desc.region[0];
85 for (i = 0; i < OMAPFB_PLANE_NUM; i++, rg++) {
86 if (!rg->paddr)
87 /* Empty slot. */
88 continue;
89 if (ranges_overlap(start, size, rg->paddr, rg->size))
90 return 1;
91 }
92 return 0;
93}
94
95/*
96 * Get the region_idx`th region from board config/ATAG and convert it to
97 * our internal format.
98 */
99static int __init get_fbmem_region(int region_idx, struct omapfb_mem_region *rg)
100{ 57{
101 const struct omap_fbmem_config *conf; 58 omapfb_config.lcd = *config;
102 u32 paddr; 59 omapfb_lcd_configured = true;
103
104 conf = omap_get_nr_config(OMAP_TAG_FBMEM,
105 struct omap_fbmem_config, region_idx);
106 if (conf == NULL)
107 return -ENOENT;
108
109 paddr = conf->start;
110 /*
111 * Low bits encode the page allocation mode, if high bits
112 * are zero. Otherwise we need a page aligned fixed
113 * address.
114 */
115 memset(rg, 0, sizeof(*rg));
116 rg->type = paddr & ~PAGE_MASK;
117 rg->paddr = paddr & PAGE_MASK;
118 rg->size = PAGE_ALIGN(conf->size);
119 return 0;
120} 60}
121 61
122static int set_fbmem_region_type(struct omapfb_mem_region *rg, int mem_type, 62static int __init omap_init_fb(void)
123 unsigned long mem_start,
124 unsigned long mem_size)
125{
126 /*
127 * Check if the configuration specifies the type explicitly.
128 * type = 0 && paddr = 0, a default don't care case maps to
129 * the SDRAM type.
130 */
131 if (rg->type || !rg->paddr)
132 return 0;
133 if (ranges_overlap(rg->paddr, rg->size, mem_start, mem_size)) {
134 rg->type = mem_type;
135 return 0;
136 }
137 /* Can't determine it. */
138 return -1;
139}
140
141static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg,
142 unsigned long start_avail, unsigned size_avail)
143{ 63{
144 unsigned long paddr = rg->paddr;
145 size_t size = rg->size;
146
147 if (rg->type > OMAPFB_MEMTYPE_MAX) {
148 printk(KERN_ERR
149 "Invalid start address for FB region %d\n", region_idx);
150 return -EINVAL;
151 }
152
153 if (!rg->size) {
154 printk(KERN_ERR "Zero size for FB region %d\n", region_idx);
155 return -EINVAL;
156 }
157
158 if (!paddr)
159 /* Allocate this dynamically, leave paddr 0 for now. */
160 return 0;
161
162 /* 64 /*
163 * Fixed region for the given RAM range. Check if it's already 65 * If the board file has not set the lcd config with
164 * reserved by the FB code or someone else. 66 * omapfb_set_lcd_config(), don't bother registering the omapfb device
165 */ 67 */
166 if (fbmem_region_reserved(paddr, size) || 68 if (!omapfb_lcd_configured)
167 !range_included(paddr, size, start_avail, size_avail)) {
168 printk(KERN_ERR "Trying to use reserved memory "
169 "for FB region %d\n", region_idx);
170 return -EINVAL;
171 }
172
173 return 0;
174}
175
176static int valid_sdram(unsigned long addr, unsigned long size)
177{
178 return memblock_is_region_memory(addr, size);
179}
180
181static int reserve_sdram(unsigned long addr, unsigned long size)
182{
183 if (memblock_is_region_reserved(addr, size))
184 return -EBUSY;
185 if (memblock_reserve(addr, size))
186 return -ENOMEM;
187 return 0;
188}
189
190/*
191 * Called from map_io. We need to call to this early enough so that we
192 * can reserve the fixed SDRAM regions before VM could get hold of them.
193 */
194void __init omapfb_reserve_sdram_memblock(void)
195{
196 unsigned long reserved = 0;
197 int i;
198
199 if (config_invalid)
200 return;
201
202 for (i = 0; ; i++) {
203 struct omapfb_mem_region rg;
204
205 if (get_fbmem_region(i, &rg) < 0)
206 break;
207
208 if (i == OMAPFB_PLANE_NUM) {
209 pr_err("Extraneous FB mem configuration entries\n");
210 config_invalid = 1;
211 return;
212 }
213
214 /* Check if it's our memory type. */
215 if (rg.type != OMAPFB_MEMTYPE_SDRAM)
216 continue;
217
218 /* Check if the region falls within SDRAM */
219 if (rg.paddr && !valid_sdram(rg.paddr, rg.size))
220 continue;
221
222 if (rg.size == 0) {
223 pr_err("Zero size for FB region %d\n", i);
224 config_invalid = 1;
225 return;
226 }
227
228 if (rg.paddr) {
229 if (reserve_sdram(rg.paddr, rg.size)) {
230 pr_err("Trying to use reserved memory for FB region %d\n",
231 i);
232 config_invalid = 1;
233 return;
234 }
235 reserved += rg.size;
236 }
237
238 if (omapfb_config.mem_desc.region[i].size) {
239 pr_err("FB region %d already set\n", i);
240 config_invalid = 1;
241 return;
242 }
243
244 omapfb_config.mem_desc.region[i] = rg;
245 configured_regions++;
246 }
247 omapfb_config.mem_desc.region_cnt = i;
248 if (reserved)
249 pr_info("Reserving %lu bytes SDRAM for frame buffer\n",
250 reserved);
251}
252
253/*
254 * Called at sram init time, before anything is pushed to the SRAM stack.
255 * Because of the stack scheme, we will allocate everything from the
256 * start of the lowest address region to the end of SRAM. This will also
257 * include padding for page alignment and possible holes between regions.
258 *
259 * As opposed to the SDRAM case, we'll also do any dynamic allocations at
260 * this point, since the driver built as a module would have problem with
261 * freeing / reallocating the regions.
262 */
263unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
264 unsigned long sram_vstart,
265 unsigned long sram_size,
266 unsigned long pstart_avail,
267 unsigned long size_avail)
268{
269 struct omapfb_mem_region rg;
270 unsigned long pend_avail;
271 unsigned long reserved;
272 int i;
273
274 if (config_invalid)
275 return 0; 69 return 0;
276 70
277 reserved = 0;
278 pend_avail = pstart_avail + size_avail;
279 for (i = 0; ; i++) {
280 if (get_fbmem_region(i, &rg) < 0)
281 break;
282 if (i == OMAPFB_PLANE_NUM) {
283 printk(KERN_ERR
284 "Extraneous FB mem configuration entries\n");
285 config_invalid = 1;
286 return 0;
287 }
288
289 /* Check if it's our memory type. */
290 if (set_fbmem_region_type(&rg, OMAPFB_MEMTYPE_SRAM,
291 sram_pstart, sram_size) < 0 ||
292 (rg.type != OMAPFB_MEMTYPE_SRAM))
293 continue;
294 BUG_ON(omapfb_config.mem_desc.region[i].size);
295
296 if (check_fbmem_region(i, &rg, pstart_avail, size_avail) < 0) {
297 config_invalid = 1;
298 return 0;
299 }
300
301 if (!rg.paddr) {
302 /* Dynamic allocation */
303 if ((size_avail & PAGE_MASK) < rg.size) {
304 printk("Not enough SRAM for FB region %d\n",
305 i);
306 config_invalid = 1;
307 return 0;
308 }
309 size_avail = (size_avail - rg.size) & PAGE_MASK;
310 rg.paddr = pstart_avail + size_avail;
311 }
312 /* Reserve everything above the start of the region. */
313 if (pend_avail - rg.paddr > reserved)
314 reserved = pend_avail - rg.paddr;
315 size_avail = pend_avail - reserved - pstart_avail;
316
317 /*
318 * We have a kernel mapping for this already, so the
319 * driver won't have to make one.
320 */
321 rg.vaddr = (void *)(sram_vstart + rg.paddr - sram_pstart);
322 omapfb_config.mem_desc.region[i] = rg;
323 configured_regions++;
324 }
325 omapfb_config.mem_desc.region_cnt = i;
326 if (reserved)
327 pr_info("Reserving %lu bytes SRAM for frame buffer\n",
328 reserved);
329 return reserved;
330}
331
332void omapfb_set_ctrl_platform_data(void *data)
333{
334 omapfb_config.ctrl_platform_data = data;
335}
336
337static int __init omap_init_fb(void)
338{
339 const struct omap_lcd_config *conf;
340
341 if (config_invalid)
342 return 0;
343 if (configured_regions != omapfb_config.mem_desc.region_cnt) {
344 printk(KERN_ERR "Invalid FB mem configuration entries\n");
345 return 0;
346 }
347 conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
348 if (conf == NULL) {
349 if (configured_regions)
350 /* FB mem config, but no LCD config? */
351 printk(KERN_ERR "Missing LCD configuration\n");
352 return 0;
353 }
354 omapfb_config.lcd = *conf;
355
356 return platform_device_register(&omap_fb_device); 71 return platform_device_register(&omap_fb_device);
357} 72}
358 73
@@ -374,11 +89,6 @@ static struct platform_device omap_fb_device = {
374 .num_resources = 0, 89 .num_resources = 0,
375}; 90};
376 91
377void omapfb_set_platform_data(struct omapfb_platform_data *data)
378{
379 omapfb_config = *data;
380}
381
382static int __init omap_init_fb(void) 92static int __init omap_init_fb(void)
383{ 93{
384 return platform_device_register(&omap_fb_device); 94 return platform_device_register(&omap_fb_device);
@@ -386,36 +96,10 @@ static int __init omap_init_fb(void)
386 96
387arch_initcall(omap_init_fb); 97arch_initcall(omap_init_fb);
388 98
389void omapfb_reserve_sdram_memblock(void)
390{
391}
392
393unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
394 unsigned long sram_vstart,
395 unsigned long sram_size,
396 unsigned long start_avail,
397 unsigned long size_avail)
398{
399 return 0;
400}
401
402#else 99#else
403 100
404void omapfb_set_platform_data(struct omapfb_platform_data *data) 101void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
405{
406}
407
408void omapfb_reserve_sdram_memblock(void)
409{
410}
411
412unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
413 unsigned long sram_vstart,
414 unsigned long sram_size,
415 unsigned long start_avail,
416 unsigned long size_avail)
417{ 102{
418 return 0;
419} 103}
420 104
421#endif 105#endif
diff --git a/arch/arm/plat-omap/fb.h b/arch/arm/plat-omap/fb.h
deleted file mode 100644
index d765d0bd852..00000000000
--- a/arch/arm/plat-omap/fb.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __PLAT_OMAP_FB_H__
2#define __PLAT_OMAP_FB_H__
3
4extern unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
5 unsigned long sram_vstart,
6 unsigned long sram_size,
7 unsigned long pstart_avail,
8 unsigned long size_avail);
9
10#endif /* __PLAT_OMAP_FB_H__ */
diff --git a/arch/arm/plat-omap/include/plat/blizzard.h b/arch/arm/plat-omap/include/plat/blizzard.h
deleted file mode 100644
index 56e7f2e7d12..00000000000
--- a/arch/arm/plat-omap/include/plat/blizzard.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _BLIZZARD_H
2#define _BLIZZARD_H
3
4struct blizzard_platform_data {
5 void (*power_up)(struct device *dev);
6 void (*power_down)(struct device *dev);
7 unsigned long (*get_clock_rate)(struct device *dev);
8
9 unsigned te_connected:1;
10};
11
12#endif
diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h b/arch/arm/plat-omap/include/plat/board-ams-delta.h
index 51b102dc906..ad6f865d1f1 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -28,33 +28,8 @@
28 28
29#if defined (CONFIG_MACH_AMS_DELTA) 29#if defined (CONFIG_MACH_AMS_DELTA)
30 30
31#define AMS_DELTA_LATCH1_PHYS 0x01000000
32#define AMS_DELTA_LATCH1_VIRT 0xEA000000
33#define AMS_DELTA_MODEM_PHYS 0x04000000
34#define AMS_DELTA_MODEM_VIRT 0xEB000000
35#define AMS_DELTA_LATCH2_PHYS 0x08000000
36#define AMS_DELTA_LATCH2_VIRT 0xEC000000
37
38#define AMS_DELTA_LATCH1_LED_CAMERA 0x01
39#define AMS_DELTA_LATCH1_LED_ADVERT 0x02
40#define AMS_DELTA_LATCH1_LED_EMAIL 0x04
41#define AMS_DELTA_LATCH1_LED_HANDSFREE 0x08
42#define AMS_DELTA_LATCH1_LED_VOICEMAIL 0x10
43#define AMS_DELTA_LATCH1_LED_VOICE 0x20
44
45#define AMS_DELTA_LATCH2_LCD_VBLEN 0x0001
46#define AMS_DELTA_LATCH2_LCD_NDISP 0x0002
47#define AMS_DELTA_LATCH2_NAND_NCE 0x0004
48#define AMS_DELTA_LATCH2_NAND_NRE 0x0008
49#define AMS_DELTA_LATCH2_NAND_NWP 0x0010
50#define AMS_DELTA_LATCH2_NAND_NWE 0x0020
51#define AMS_DELTA_LATCH2_NAND_ALE 0x0040
52#define AMS_DELTA_LATCH2_NAND_CLE 0x0080
53#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
54#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
55#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400 31#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
56#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800 32#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
57#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000
58#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000 33#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000
59 34
60#define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0 35#define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0
@@ -66,9 +41,29 @@
66#define AMS_DELTA_GPIO_PIN_CONFIG 11 41#define AMS_DELTA_GPIO_PIN_CONFIG 11
67#define AMS_DELTA_GPIO_PIN_NAND_RB 12 42#define AMS_DELTA_GPIO_PIN_NAND_RB 12
68 43
44#define AMS_DELTA_GPIO_PIN_LCD_VBLEN 240
45#define AMS_DELTA_GPIO_PIN_LCD_NDISP 241
46#define AMS_DELTA_GPIO_PIN_NAND_NCE 242
47#define AMS_DELTA_GPIO_PIN_NAND_NRE 243
48#define AMS_DELTA_GPIO_PIN_NAND_NWP 244
49#define AMS_DELTA_GPIO_PIN_NAND_NWE 245
50#define AMS_DELTA_GPIO_PIN_NAND_ALE 246
51#define AMS_DELTA_GPIO_PIN_NAND_CLE 247
52#define AMS_DELTA_GPIO_PIN_KEYBRD_PWR 248
53#define AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT 249
54#define AMS_DELTA_GPIO_PIN_SCARD_RSTIN 250
55#define AMS_DELTA_GPIO_PIN_SCARD_CMDVCC 251
56#define AMS_DELTA_GPIO_PIN_MODEM_NRESET 252
57#define AMS_DELTA_GPIO_PIN_MODEM_CODEC 253
58
59#define AMS_DELTA_LATCH2_GPIO_BASE AMS_DELTA_GPIO_PIN_LCD_VBLEN
60#define AMS_DELTA_LATCH2_NGPIO 16
61
69#ifndef __ASSEMBLY__ 62#ifndef __ASSEMBLY__
70void ams_delta_latch1_write(u8 mask, u8 value); 63void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value);
71void ams_delta_latch2_write(u16 mask, u16 value); 64#define ams_delta_latch2_write(mask, value) \
65 ams_delta_latch_write(AMS_DELTA_LATCH2_GPIO_BASE, \
66 AMS_DELTA_LATCH2_NGPIO, (mask), (value))
72#endif 67#endif
73 68
74#endif /* CONFIG_MACH_AMS_DELTA */ 69#endif /* CONFIG_MACH_AMS_DELTA */
diff --git a/arch/arm/plat-omap/include/plat/board.h b/arch/arm/plat-omap/include/plat/board.h
index 97126dfd288..d5eb4c87db9 100644
--- a/arch/arm/plat-omap/include/plat/board.h
+++ b/arch/arm/plat-omap/include/plat/board.h
@@ -28,9 +28,7 @@ enum {
28 28
29/* Different peripheral ids */ 29/* Different peripheral ids */
30#define OMAP_TAG_CLOCK 0x4f01 30#define OMAP_TAG_CLOCK 0x4f01
31#define OMAP_TAG_LCD 0x4f05
32#define OMAP_TAG_GPIO_SWITCH 0x4f06 31#define OMAP_TAG_GPIO_SWITCH 0x4f06
33#define OMAP_TAG_FBMEM 0x4f08
34#define OMAP_TAG_STI_CONSOLE 0x4f09 32#define OMAP_TAG_STI_CONSOLE 0x4f09
35#define OMAP_TAG_CAMERA_SENSOR 0x4f0a 33#define OMAP_TAG_CAMERA_SENSOR 0x4f0a
36 34
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index 6b51086fce1..dc6a86bf217 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -250,7 +250,6 @@ IS_AM_SUBCLASS(335x, 0x335)
250 * cpu_is_omap2423(): True for OMAP2423 250 * cpu_is_omap2423(): True for OMAP2423
251 * cpu_is_omap2430(): True for OMAP2430 251 * cpu_is_omap2430(): True for OMAP2430
252 * cpu_is_omap3430(): True for OMAP3430 252 * cpu_is_omap3430(): True for OMAP3430
253 * cpu_is_omap4430(): True for OMAP4430
254 * cpu_is_omap3505(): True for OMAP3505 253 * cpu_is_omap3505(): True for OMAP3505
255 * cpu_is_omap3517(): True for OMAP3517 254 * cpu_is_omap3517(): True for OMAP3517
256 */ 255 */
@@ -299,7 +298,6 @@ IS_OMAP_TYPE(3517, 0x3517)
299#define cpu_is_omap3505() 0 298#define cpu_is_omap3505() 0
300#define cpu_is_omap3517() 0 299#define cpu_is_omap3517() 0
301#define cpu_is_omap3430() 0 300#define cpu_is_omap3430() 0
302#define cpu_is_omap4430() 0
303#define cpu_is_omap3630() 0 301#define cpu_is_omap3630() 0
304 302
305/* 303/*
@@ -451,7 +449,12 @@ IS_OMAP_TYPE(3517, 0x3517)
451#define OMAP447X_CLASS 0x44700044 449#define OMAP447X_CLASS 0x44700044
452#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8)) 450#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
453 451
454void omap2_check_revision(void); 452void omap2xxx_check_revision(void);
453void omap3xxx_check_revision(void);
454void omap4xxx_check_revision(void);
455void omap3xxx_check_features(void);
456void ti81xx_check_features(void);
457void omap4xxx_check_features(void);
455 458
456/* 459/*
457 * Runtime detection of OMAP3 features 460 * Runtime detection of OMAP3 features
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 9e86ee0aed0..cb75b657b04 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -162,13 +162,6 @@
162 IH_MPUIO_BASE + ((nr) & 0x0f) : \ 162 IH_MPUIO_BASE + ((nr) & 0x0f) : \
163 IH_GPIO_BASE + (nr)) 163 IH_GPIO_BASE + (nr))
164 164
165#define METHOD_MPUIO 0
166#define METHOD_GPIO_1510 1
167#define METHOD_GPIO_1610 2
168#define METHOD_GPIO_7XX 3
169#define METHOD_GPIO_24XX 5
170#define METHOD_GPIO_44XX 6
171
172struct omap_gpio_dev_attr { 165struct omap_gpio_dev_attr {
173 int bank_width; /* GPIO bank width */ 166 int bank_width; /* GPIO bank width */
174 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */ 167 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */
@@ -184,10 +177,21 @@ struct omap_gpio_reg_offs {
184 u16 irqstatus; 177 u16 irqstatus;
185 u16 irqstatus2; 178 u16 irqstatus2;
186 u16 irqenable; 179 u16 irqenable;
180 u16 irqenable2;
187 u16 set_irqenable; 181 u16 set_irqenable;
188 u16 clr_irqenable; 182 u16 clr_irqenable;
189 u16 debounce; 183 u16 debounce;
190 u16 debounce_en; 184 u16 debounce_en;
185 u16 ctrl;
186 u16 wkup_en;
187 u16 leveldetect0;
188 u16 leveldetect1;
189 u16 risingdetect;
190 u16 fallingdetect;
191 u16 irqctrl;
192 u16 edgectrl1;
193 u16 edgectrl2;
194 u16 pinctrl;
191 195
192 bool irqenable_inv; 196 bool irqenable_inv;
193}; 197};
@@ -198,19 +202,20 @@ struct omap_gpio_platform_data {
198 int bank_width; /* GPIO bank width */ 202 int bank_width; /* GPIO bank width */
199 int bank_stride; /* Only needed for omap1 MPUIO */ 203 int bank_stride; /* Only needed for omap1 MPUIO */
200 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */ 204 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */
205 bool loses_context; /* whether the bank would ever lose context */
206 bool is_mpuio; /* whether the bank is of type MPUIO */
207 u32 non_wakeup_gpios;
201 208
202 struct omap_gpio_reg_offs *regs; 209 struct omap_gpio_reg_offs *regs;
203};
204 210
205/* TODO: Analyze removing gpio_bank_count usage from driver code */ 211 /* Return context loss count due to PM states changing */
206extern int gpio_bank_count; 212 int (*get_context_loss_count)(struct device *dev);
213};
207 214
208extern void omap2_gpio_prepare_for_idle(int off_mode); 215extern void omap2_gpio_prepare_for_idle(int off_mode);
209extern void omap2_gpio_resume_after_idle(void); 216extern void omap2_gpio_resume_after_idle(void);
210extern void omap_set_gpio_debounce(int gpio, int enable); 217extern void omap_set_gpio_debounce(int gpio, int enable);
211extern void omap_set_gpio_debounce_time(int gpio, int enable); 218extern void omap_set_gpio_debounce_time(int gpio, int enable);
212extern void omap_gpio_save_context(void);
213extern void omap_gpio_restore_context(void);
214/*-------------------------------------------------------------------------*/ 219/*-------------------------------------------------------------------------*/
215 220
216/* Wrappers for "new style" GPIO calls, using the new infrastructure 221/* Wrappers for "new style" GPIO calls, using the new infrastructure
diff --git a/arch/arm/plat-omap/include/plat/hardware.h b/arch/arm/plat-omap/include/plat/hardware.h
index e897978371c..537b05ae1f5 100644
--- a/arch/arm/plat-omap/include/plat/hardware.h
+++ b/arch/arm/plat-omap/include/plat/hardware.h
@@ -43,6 +43,12 @@
43#endif 43#endif
44#include <plat/serial.h> 44#include <plat/serial.h>
45 45
46#ifdef __ASSEMBLER__
47#define IOMEM(x) (x)
48#else
49#define IOMEM(x) ((void __force __iomem *)(x))
50#endif
51
46/* 52/*
47 * --------------------------------------------------------------------------- 53 * ---------------------------------------------------------------------------
48 * Common definitions for all OMAP processors 54 * Common definitions for all OMAP processors
diff --git a/arch/arm/plat-omap/include/plat/hwa742.h b/arch/arm/plat-omap/include/plat/hwa742.h
deleted file mode 100644
index 886248d32b4..00000000000
--- a/arch/arm/plat-omap/include/plat/hwa742.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _HWA742_H
2#define _HWA742_H
3
4struct hwa742_platform_data {
5 unsigned te_connected:1;
6};
7
8#endif
diff --git a/arch/arm/plat-omap/include/plat/keypad.h b/arch/arm/plat-omap/include/plat/keypad.h
index 793ce9d5329..a6b21eddb21 100644
--- a/arch/arm/plat-omap/include/plat/keypad.h
+++ b/arch/arm/plat-omap/include/plat/keypad.h
@@ -12,6 +12,8 @@
12 12
13#ifndef CONFIG_ARCH_OMAP1 13#ifndef CONFIG_ARCH_OMAP1
14#warning Please update the board to use matrix-keypad driver 14#warning Please update the board to use matrix-keypad driver
15#define omap_readw(reg) 0
16#define omap_writew(val, reg) do {} while (0)
15#endif 17#endif
16#include <linux/input/matrix_keypad.h> 18#include <linux/input/matrix_keypad.h>
17 19
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index 8fa74e2c9d6..18814127809 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -27,271 +27,10 @@
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/clk.h> 28#include <linux/clk.h>
29 29
30/* macro for building platform_device for McBSP ports */
31#define OMAP_MCBSP_PLATFORM_DEVICE(port_nr) \
32static struct platform_device omap_mcbsp##port_nr = { \
33 .name = "omap-mcbsp-dai", \
34 .id = port_nr - 1, \
35}
36
37#define MCBSP_CONFIG_TYPE2 0x2 30#define MCBSP_CONFIG_TYPE2 0x2
38#define MCBSP_CONFIG_TYPE3 0x3 31#define MCBSP_CONFIG_TYPE3 0x3
39#define MCBSP_CONFIG_TYPE4 0x4 32#define MCBSP_CONFIG_TYPE4 0x4
40 33
41/* McBSP register numbers. Register address offset = num * reg_step */
42enum {
43 /* Common registers */
44 OMAP_MCBSP_REG_SPCR2 = 4,
45 OMAP_MCBSP_REG_SPCR1,
46 OMAP_MCBSP_REG_RCR2,
47 OMAP_MCBSP_REG_RCR1,
48 OMAP_MCBSP_REG_XCR2,
49 OMAP_MCBSP_REG_XCR1,
50 OMAP_MCBSP_REG_SRGR2,
51 OMAP_MCBSP_REG_SRGR1,
52 OMAP_MCBSP_REG_MCR2,
53 OMAP_MCBSP_REG_MCR1,
54 OMAP_MCBSP_REG_RCERA,
55 OMAP_MCBSP_REG_RCERB,
56 OMAP_MCBSP_REG_XCERA,
57 OMAP_MCBSP_REG_XCERB,
58 OMAP_MCBSP_REG_PCR0,
59 OMAP_MCBSP_REG_RCERC,
60 OMAP_MCBSP_REG_RCERD,
61 OMAP_MCBSP_REG_XCERC,
62 OMAP_MCBSP_REG_XCERD,
63 OMAP_MCBSP_REG_RCERE,
64 OMAP_MCBSP_REG_RCERF,
65 OMAP_MCBSP_REG_XCERE,
66 OMAP_MCBSP_REG_XCERF,
67 OMAP_MCBSP_REG_RCERG,
68 OMAP_MCBSP_REG_RCERH,
69 OMAP_MCBSP_REG_XCERG,
70 OMAP_MCBSP_REG_XCERH,
71
72 /* OMAP1-OMAP2420 registers */
73 OMAP_MCBSP_REG_DRR2 = 0,
74 OMAP_MCBSP_REG_DRR1,
75 OMAP_MCBSP_REG_DXR2,
76 OMAP_MCBSP_REG_DXR1,
77
78 /* OMAP2430 and onwards */
79 OMAP_MCBSP_REG_DRR = 0,
80 OMAP_MCBSP_REG_DXR = 2,
81 OMAP_MCBSP_REG_SYSCON = 35,
82 OMAP_MCBSP_REG_THRSH2,
83 OMAP_MCBSP_REG_THRSH1,
84 OMAP_MCBSP_REG_IRQST = 40,
85 OMAP_MCBSP_REG_IRQEN,
86 OMAP_MCBSP_REG_WAKEUPEN,
87 OMAP_MCBSP_REG_XCCR,
88 OMAP_MCBSP_REG_RCCR,
89 OMAP_MCBSP_REG_XBUFFSTAT,
90 OMAP_MCBSP_REG_RBUFFSTAT,
91 OMAP_MCBSP_REG_SSELCR,
92};
93
94/* OMAP3 sidetone control registers */
95#define OMAP_ST_REG_REV 0x00
96#define OMAP_ST_REG_SYSCONFIG 0x10
97#define OMAP_ST_REG_IRQSTATUS 0x18
98#define OMAP_ST_REG_IRQENABLE 0x1C
99#define OMAP_ST_REG_SGAINCR 0x24
100#define OMAP_ST_REG_SFIRCR 0x28
101#define OMAP_ST_REG_SSELCR 0x2C
102
103/************************** McBSP SPCR1 bit definitions ***********************/
104#define RRST 0x0001
105#define RRDY 0x0002
106#define RFULL 0x0004
107#define RSYNC_ERR 0x0008
108#define RINTM(value) ((value)<<4) /* bits 4:5 */
109#define ABIS 0x0040
110#define DXENA 0x0080
111#define CLKSTP(value) ((value)<<11) /* bits 11:12 */
112#define RJUST(value) ((value)<<13) /* bits 13:14 */
113#define ALB 0x8000
114#define DLB 0x8000
115
116/************************** McBSP SPCR2 bit definitions ***********************/
117#define XRST 0x0001
118#define XRDY 0x0002
119#define XEMPTY 0x0004
120#define XSYNC_ERR 0x0008
121#define XINTM(value) ((value)<<4) /* bits 4:5 */
122#define GRST 0x0040
123#define FRST 0x0080
124#define SOFT 0x0100
125#define FREE 0x0200
126
127/************************** McBSP PCR bit definitions *************************/
128#define CLKRP 0x0001
129#define CLKXP 0x0002
130#define FSRP 0x0004
131#define FSXP 0x0008
132#define DR_STAT 0x0010
133#define DX_STAT 0x0020
134#define CLKS_STAT 0x0040
135#define SCLKME 0x0080
136#define CLKRM 0x0100
137#define CLKXM 0x0200
138#define FSRM 0x0400
139#define FSXM 0x0800
140#define RIOEN 0x1000
141#define XIOEN 0x2000
142#define IDLE_EN 0x4000
143
144/************************** McBSP RCR1 bit definitions ************************/
145#define RWDLEN1(value) ((value)<<5) /* Bits 5:7 */
146#define RFRLEN1(value) ((value)<<8) /* Bits 8:14 */
147
148/************************** McBSP XCR1 bit definitions ************************/
149#define XWDLEN1(value) ((value)<<5) /* Bits 5:7 */
150#define XFRLEN1(value) ((value)<<8) /* Bits 8:14 */
151
152/*************************** McBSP RCR2 bit definitions ***********************/
153#define RDATDLY(value) (value) /* Bits 0:1 */
154#define RFIG 0x0004
155#define RCOMPAND(value) ((value)<<3) /* Bits 3:4 */
156#define RWDLEN2(value) ((value)<<5) /* Bits 5:7 */
157#define RFRLEN2(value) ((value)<<8) /* Bits 8:14 */
158#define RPHASE 0x8000
159
160/*************************** McBSP XCR2 bit definitions ***********************/
161#define XDATDLY(value) (value) /* Bits 0:1 */
162#define XFIG 0x0004
163#define XCOMPAND(value) ((value)<<3) /* Bits 3:4 */
164#define XWDLEN2(value) ((value)<<5) /* Bits 5:7 */
165#define XFRLEN2(value) ((value)<<8) /* Bits 8:14 */
166#define XPHASE 0x8000
167
168/************************* McBSP SRGR1 bit definitions ************************/
169#define CLKGDV(value) (value) /* Bits 0:7 */
170#define FWID(value) ((value)<<8) /* Bits 8:15 */
171
172/************************* McBSP SRGR2 bit definitions ************************/
173#define FPER(value) (value) /* Bits 0:11 */
174#define FSGM 0x1000
175#define CLKSM 0x2000
176#define CLKSP 0x4000
177#define GSYNC 0x8000
178
179/************************* McBSP MCR1 bit definitions *************************/
180#define RMCM 0x0001
181#define RCBLK(value) ((value)<<2) /* Bits 2:4 */
182#define RPABLK(value) ((value)<<5) /* Bits 5:6 */
183#define RPBBLK(value) ((value)<<7) /* Bits 7:8 */
184
185/************************* McBSP MCR2 bit definitions *************************/
186#define XMCM(value) (value) /* Bits 0:1 */
187#define XCBLK(value) ((value)<<2) /* Bits 2:4 */
188#define XPABLK(value) ((value)<<5) /* Bits 5:6 */
189#define XPBBLK(value) ((value)<<7) /* Bits 7:8 */
190
191/*********************** McBSP XCCR bit definitions *************************/
192#define EXTCLKGATE 0x8000
193#define PPCONNECT 0x4000
194#define DXENDLY(value) ((value)<<12) /* Bits 12:13 */
195#define XFULL_CYCLE 0x0800
196#define DILB 0x0020
197#define XDMAEN 0x0008
198#define XDISABLE 0x0001
199
200/********************** McBSP RCCR bit definitions *************************/
201#define RFULL_CYCLE 0x0800
202#define RDMAEN 0x0008
203#define RDISABLE 0x0001
204
205/********************** McBSP SYSCONFIG bit definitions ********************/
206#define CLOCKACTIVITY(value) ((value)<<8)
207#define SIDLEMODE(value) ((value)<<3)
208#define ENAWAKEUP 0x0004
209#define SOFTRST 0x0002
210
211/********************** McBSP SSELCR bit definitions ***********************/
212#define SIDETONEEN 0x0400
213
214/********************** McBSP Sidetone SYSCONFIG bit definitions ***********/
215#define ST_AUTOIDLE 0x0001
216
217/********************** McBSP Sidetone SGAINCR bit definitions *************/
218#define ST_CH1GAIN(value) ((value<<16)) /* Bits 16:31 */
219#define ST_CH0GAIN(value) (value) /* Bits 0:15 */
220
221/********************** McBSP Sidetone SFIRCR bit definitions **************/
222#define ST_FIRCOEFF(value) (value) /* Bits 0:15 */
223
224/********************** McBSP Sidetone SSELCR bit definitions **************/
225#define ST_COEFFWRDONE 0x0004
226#define ST_COEFFWREN 0x0002
227#define ST_SIDETONEEN 0x0001
228
229/********************** McBSP DMA operating modes **************************/
230#define MCBSP_DMA_MODE_ELEMENT 0
231#define MCBSP_DMA_MODE_THRESHOLD 1
232#define MCBSP_DMA_MODE_FRAME 2
233
234/********************** McBSP WAKEUPEN bit definitions *********************/
235#define XEMPTYEOFEN 0x4000
236#define XRDYEN 0x0400
237#define XEOFEN 0x0200
238#define XFSXEN 0x0100
239#define XSYNCERREN 0x0080
240#define RRDYEN 0x0008
241#define REOFEN 0x0004
242#define RFSREN 0x0002
243#define RSYNCERREN 0x0001
244
245/* CLKR signal muxing options */
246#define CLKR_SRC_CLKR 0
247#define CLKR_SRC_CLKX 1
248
249/* FSR signal muxing options */
250#define FSR_SRC_FSR 0
251#define FSR_SRC_FSX 1
252
253/* McBSP functional clock sources */
254#define MCBSP_CLKS_PRCM_SRC 0
255#define MCBSP_CLKS_PAD_SRC 1
256
257/* we don't do multichannel for now */
258struct omap_mcbsp_reg_cfg {
259 u16 spcr2;
260 u16 spcr1;
261 u16 rcr2;
262 u16 rcr1;
263 u16 xcr2;
264 u16 xcr1;
265 u16 srgr2;
266 u16 srgr1;
267 u16 mcr2;
268 u16 mcr1;
269 u16 pcr0;
270 u16 rcerc;
271 u16 rcerd;
272 u16 xcerc;
273 u16 xcerd;
274 u16 rcere;
275 u16 rcerf;
276 u16 xcere;
277 u16 xcerf;
278 u16 rcerg;
279 u16 rcerh;
280 u16 xcerg;
281 u16 xcerh;
282 u16 xccr;
283 u16 rccr;
284};
285
286typedef enum {
287 OMAP_MCBSP_WORD_8 = 0,
288 OMAP_MCBSP_WORD_12,
289 OMAP_MCBSP_WORD_16,
290 OMAP_MCBSP_WORD_20,
291 OMAP_MCBSP_WORD_24,
292 OMAP_MCBSP_WORD_32,
293} omap_mcbsp_word_length;
294
295/* Platform specific configuration */ 34/* Platform specific configuration */
296struct omap_mcbsp_ops { 35struct omap_mcbsp_ops {
297 void (*request)(unsigned int); 36 void (*request)(unsigned int);
@@ -312,43 +51,6 @@ struct omap_mcbsp_platform_data {
312 int (*mux_signal)(struct device *dev, const char *signal, const char *src); 51 int (*mux_signal)(struct device *dev, const char *signal, const char *src);
313}; 52};
314 53
315struct omap_mcbsp_st_data {
316 void __iomem *io_base_st;
317 bool running;
318 bool enabled;
319 s16 taps[128]; /* Sidetone filter coefficients */
320 int nr_taps; /* Number of filter coefficients in use */
321 s16 ch0gain;
322 s16 ch1gain;
323};
324
325struct omap_mcbsp {
326 struct device *dev;
327 unsigned long phys_base;
328 unsigned long phys_dma_base;
329 void __iomem *io_base;
330 u8 id;
331 u8 free;
332
333 int rx_irq;
334 int tx_irq;
335
336 /* DMA stuff */
337 u8 dma_rx_sync;
338 u8 dma_tx_sync;
339
340 /* Protect the field .free, while checking if the mcbsp is in use */
341 spinlock_t lock;
342 struct omap_mcbsp_platform_data *pdata;
343 struct clk *fclk;
344 struct omap_mcbsp_st_data *st_data;
345 int dma_op_mode;
346 u16 max_tx_thres;
347 u16 max_rx_thres;
348 void *reg_cache;
349 int reg_cache_size;
350};
351
352/** 54/**
353 * omap_mcbsp_dev_attr - OMAP McBSP device attributes for omap_hwmod 55 * omap_mcbsp_dev_attr - OMAP McBSP device attributes for omap_hwmod
354 * @sidetone: name of the sidetone device 56 * @sidetone: name of the sidetone device
@@ -357,39 +59,4 @@ struct omap_mcbsp_dev_attr {
357 const char *sidetone; 59 const char *sidetone;
358}; 60};
359 61
360extern struct omap_mcbsp **mcbsp_ptr;
361extern int omap_mcbsp_count;
362
363int omap_mcbsp_init(void);
364void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config);
365void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
366void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
367u16 omap_mcbsp_get_max_tx_threshold(unsigned int id);
368u16 omap_mcbsp_get_max_rx_threshold(unsigned int id);
369u16 omap_mcbsp_get_fifo_size(unsigned int id);
370u16 omap_mcbsp_get_tx_delay(unsigned int id);
371u16 omap_mcbsp_get_rx_delay(unsigned int id);
372int omap_mcbsp_get_dma_op_mode(unsigned int id);
373int omap_mcbsp_request(unsigned int id);
374void omap_mcbsp_free(unsigned int id);
375void omap_mcbsp_start(unsigned int id, int tx, int rx);
376void omap_mcbsp_stop(unsigned int id, int tx, int rx);
377
378/* McBSP functional clock source changing function */
379extern int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id);
380
381/* McBSP signal muxing API */
382void omap2_mcbsp1_mux_clkr_src(u8 mux);
383void omap2_mcbsp1_mux_fsr_src(u8 mux);
384
385int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream);
386int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream);
387
388/* Sidetone specific API */
389int omap_st_set_chgain(unsigned int id, int channel, s16 chgain);
390int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain);
391int omap_st_enable(unsigned int id);
392int omap_st_disable(unsigned int id);
393int omap_st_is_enabled(unsigned int id);
394
395#endif 62#endif
diff --git a/arch/arm/plat-omap/include/plat/mcspi.h b/arch/arm/plat-omap/include/plat/mcspi.h
index 3d51b18131c..a357eb26bd2 100644
--- a/arch/arm/plat-omap/include/plat/mcspi.h
+++ b/arch/arm/plat-omap/include/plat/mcspi.h
@@ -18,9 +18,6 @@ struct omap2_mcspi_dev_attr {
18 18
19struct omap2_mcspi_device_config { 19struct omap2_mcspi_device_config {
20 unsigned turbo_mode:1; 20 unsigned turbo_mode:1;
21
22 /* Do we want one channel enabled at the same time? */
23 unsigned single_channel:1;
24}; 21};
25 22
26#endif 23#endif
diff --git a/arch/arm/plat-omap/include/plat/omap4-keypad.h b/arch/arm/plat-omap/include/plat/omap4-keypad.h
index 9fe6c878323..8ad0a377a54 100644
--- a/arch/arm/plat-omap/include/plat/omap4-keypad.h
+++ b/arch/arm/plat-omap/include/plat/omap4-keypad.h
@@ -1,15 +1,6 @@
1#ifndef ARCH_ARM_PLAT_OMAP4_KEYPAD_H 1#ifndef ARCH_ARM_PLAT_OMAP4_KEYPAD_H
2#define ARCH_ARM_PLAT_OMAP4_KEYPAD_H 2#define ARCH_ARM_PLAT_OMAP4_KEYPAD_H
3 3
4#include <linux/input/matrix_keypad.h>
5
6struct omap4_keypad_platform_data {
7 const struct matrix_keymap_data *keymap_data;
8
9 u8 rows;
10 u8 cols;
11};
12
13extern int omap4_keyboard_init(struct omap4_keypad_platform_data *, 4extern int omap4_keyboard_init(struct omap4_keypad_platform_data *,
14 struct omap_board_data *); 5 struct omap_board_data *);
15#endif 6#endif
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index 51423d2727a..4327b2c90c3 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -36,7 +36,7 @@
36 36
37#include <plat/omap_hwmod.h> 37#include <plat/omap_hwmod.h>
38 38
39extern struct device omap_device_parent; 39extern struct dev_pm_domain omap_device_pm_domain;
40 40
41/* omap_device._state values */ 41/* omap_device._state values */
42#define OMAP_DEVICE_STATE_UNKNOWN 0 42#define OMAP_DEVICE_STATE_UNKNOWN 0
@@ -100,6 +100,13 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
100 struct omap_device_pm_latency *pm_lats, 100 struct omap_device_pm_latency *pm_lats,
101 int pm_lats_cnt, int is_early_device); 101 int pm_lats_cnt, int is_early_device);
102 102
103struct omap_device *omap_device_alloc(struct platform_device *pdev,
104 struct omap_hwmod **ohs, int oh_cnt,
105 struct omap_device_pm_latency *pm_lats,
106 int pm_lats_cnt);
107void omap_device_delete(struct omap_device *od);
108int omap_device_register(struct platform_device *pdev);
109
103void __iomem *omap_device_get_rt_va(struct omap_device *od); 110void __iomem *omap_device_get_rt_va(struct omap_device *od);
104struct device *omap_device_get_by_hwmod_name(const char *oh_name); 111struct device *omap_device_get_by_hwmod_name(const char *oh_name);
105 112
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 647010109af..9e8e63d52aa 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -484,7 +484,6 @@ struct omap_hwmod_class {
484 * @main_clk: main clock: OMAP clock name 484 * @main_clk: main clock: OMAP clock name
485 * @_clk: pointer to the main struct clk (filled in at runtime) 485 * @_clk: pointer to the main struct clk (filled in at runtime)
486 * @opt_clks: other device clocks that drivers can request (0..*) 486 * @opt_clks: other device clocks that drivers can request (0..*)
487 * @vdd_name: voltage domain name
488 * @voltdm: pointer to voltage domain (filled in at runtime) 487 * @voltdm: pointer to voltage domain (filled in at runtime)
489 * @masters: ptr to array of OCP ifs that this hwmod can initiate on 488 * @masters: ptr to array of OCP ifs that this hwmod can initiate on
490 * @slaves: ptr to array of OCP ifs that this hwmod can respond on 489 * @slaves: ptr to array of OCP ifs that this hwmod can respond on
@@ -528,7 +527,6 @@ struct omap_hwmod {
528 struct omap_hwmod_opt_clk *opt_clks; 527 struct omap_hwmod_opt_clk *opt_clks;
529 char *clkdm_name; 528 char *clkdm_name;
530 struct clockdomain *clkdm; 529 struct clockdomain *clkdm;
531 char *vdd_name;
532 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ 530 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */
533 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ 531 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */
534 void *dev_attr; 532 void *dev_attr;
diff --git a/arch/arm/plat-omap/include/plat/remoteproc.h b/arch/arm/plat-omap/include/plat/remoteproc.h
new file mode 100644
index 00000000000..b10eac89e2e
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/remoteproc.h
@@ -0,0 +1,57 @@
1/*
2 * Remote Processor - omap-specific bits
3 *
4 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Copyright (C) 2011 Google, Inc.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef _PLAT_REMOTEPROC_H
18#define _PLAT_REMOTEPROC_H
19
20struct rproc_ops;
21struct platform_device;
22
23/*
24 * struct omap_rproc_pdata - omap remoteproc's platform data
25 * @name: the remoteproc's name
26 * @oh_name: omap hwmod device
27 * @oh_name_opt: optional, secondary omap hwmod device
28 * @firmware: name of firmware file to load
29 * @mbox_name: name of omap mailbox device to use with this rproc
30 * @ops: start/stop rproc handlers
31 * @device_enable: omap-specific handler for enabling a device
32 * @device_shutdown: omap-specific handler for shutting down a device
33 */
34struct omap_rproc_pdata {
35 const char *name;
36 const char *oh_name;
37 const char *oh_name_opt;
38 const char *firmware;
39 const char *mbox_name;
40 const struct rproc_ops *ops;
41 int (*device_enable) (struct platform_device *pdev);
42 int (*device_shutdown) (struct platform_device *pdev);
43};
44
45#if defined(CONFIG_OMAP_REMOTEPROC) || defined(CONFIG_OMAP_REMOTEPROC_MODULE)
46
47void __init omap_rproc_reserve_cma(void);
48
49#else
50
51void __init omap_rproc_reserve_cma(void)
52{
53}
54
55#endif
56
57#endif /* _PLAT_REMOTEPROC_H */
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 198d1e6a4a6..b073e5f2b19 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -110,7 +110,6 @@ struct omap_board_data;
110struct omap_uart_port_info; 110struct omap_uart_port_info;
111 111
112extern void omap_serial_init(void); 112extern void omap_serial_init(void);
113extern int omap_uart_can_sleep(void);
114extern void omap_serial_board_init(struct omap_uart_port_info *platform_data); 113extern void omap_serial_board_init(struct omap_uart_port_info *platform_data);
115extern void omap_serial_init_port(struct omap_board_data *bdata, 114extern void omap_serial_init_port(struct omap_board_data *bdata,
116 struct omap_uart_port_info *platform_data); 115 struct omap_uart_port_info *platform_data);
diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h
index 75aa1b2bef5..227ae265755 100644
--- a/arch/arm/plat-omap/include/plat/sram.h
+++ b/arch/arm/plat-omap/include/plat/sram.h
@@ -101,4 +101,5 @@ static inline void omap_push_sram_idle(void) {}
101#else 101#else
102#define OMAP4_SRAM_PA 0x40300000 102#define OMAP4_SRAM_PA 0x40300000
103#endif 103#endif
104#define AM33XX_SRAM_PA 0x40300000
104#endif 105#endif
diff --git a/arch/arm/plat-omap/include/plat/system.h b/arch/arm/plat-omap/include/plat/system.h
deleted file mode 100644
index 8e5ebd74b12..00000000000
--- a/arch/arm/plat-omap/include/plat/system.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Copied from arch/arm/mach-sa1100/include/mach/system.h
3 * Copyright (c) 1999 Nicolas Pitre <nico@fluxnic.net>
4 */
5#ifndef __ASM_ARCH_SYSTEM_H
6#define __ASM_ARCH_SYSTEM_H
7
8#include <asm/proc-fns.h>
9
10static inline void arch_idle(void)
11{
12 cpu_do_idle();
13}
14
15#endif
diff --git a/arch/arm/plat-omap/include/plat/tc.h b/arch/arm/plat-omap/include/plat/tc.h
index d2fcd789bb9..1b4b2da8620 100644
--- a/arch/arm/plat-omap/include/plat/tc.h
+++ b/arch/arm/plat-omap/include/plat/tc.h
@@ -84,23 +84,6 @@
84#define EMIFS_CCS(n) (EMIFS_CS0_CONFIG + (4 * (n))) 84#define EMIFS_CCS(n) (EMIFS_CS0_CONFIG + (4 * (n)))
85#define EMIFS_ACS(n) (EMIFS_ACS0 + (4 * (n))) 85#define EMIFS_ACS(n) (EMIFS_ACS0 + (4 * (n)))
86 86
87/* Almost all documentation for chip and board memory maps assumes
88 * BM is clear. Most devel boards have a switch to control booting
89 * from NOR flash (using external chipselect 3) rather than mask ROM,
90 * which uses BM to interchange the physical CS0 and CS3 addresses.
91 */
92static inline u32 omap_cs0_phys(void)
93{
94 return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM)
95 ? OMAP_CS3_PHYS : 0;
96}
97
98static inline u32 omap_cs3_phys(void)
99{
100 return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM)
101 ? 0 : OMAP_CS3_PHYS;
102}
103
104#endif /* __ASSEMBLER__ */ 87#endif /* __ASSEMBLER__ */
105 88
106#endif /* __ASM_ARCH_TC_H */ 89#endif /* __ASM_ARCH_TC_H */
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index 6ee90495ca4..cc3f11ba7a9 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -160,6 +160,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
160 DEBUG_LL_OMAP3(3, igep0020); 160 DEBUG_LL_OMAP3(3, igep0020);
161 DEBUG_LL_OMAP3(3, igep0030); 161 DEBUG_LL_OMAP3(3, igep0030);
162 DEBUG_LL_OMAP3(3, nokia_rm680); 162 DEBUG_LL_OMAP3(3, nokia_rm680);
163 DEBUG_LL_OMAP3(3, nokia_rm696);
163 DEBUG_LL_OMAP3(3, nokia_rx51); 164 DEBUG_LL_OMAP3(3, nokia_rx51);
164 DEBUG_LL_OMAP3(3, omap3517evm); 165 DEBUG_LL_OMAP3(3, omap3517evm);
165 DEBUG_LL_OMAP3(3, omap3_beagle); 166 DEBUG_LL_OMAP3(3, omap3_beagle);
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index dc864b580da..d0fc9f4dc15 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -3,6 +3,7 @@
3#ifndef __ASM_ARCH_OMAP_USB_H 3#ifndef __ASM_ARCH_OMAP_USB_H
4#define __ASM_ARCH_OMAP_USB_H 4#define __ASM_ARCH_OMAP_USB_H
5 5
6#include <linux/io.h>
6#include <linux/usb/musb.h> 7#include <linux/usb/musb.h>
7#include <plat/board.h> 8#include <plat/board.h>
8 9
@@ -105,6 +106,46 @@ extern int omap4430_phy_set_clk(struct device *dev, int on);
105extern int omap4430_phy_init(struct device *dev); 106extern int omap4430_phy_init(struct device *dev);
106extern int omap4430_phy_exit(struct device *dev); 107extern int omap4430_phy_exit(struct device *dev);
107extern int omap4430_phy_suspend(struct device *dev, int suspend); 108extern int omap4430_phy_suspend(struct device *dev, int suspend);
109
110/*
111 * NOTE: Please update omap USB drivers to use ioremap + read/write
112 */
113
114#define OMAP2_L4_IO_OFFSET 0xb2000000
115#define IOMEM(x) ((void __force __iomem *)(x))
116#define OMAP2_L4_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L4_IO_OFFSET)
117
118static inline u8 omap_readb(u32 pa)
119{
120 return __raw_readb(OMAP2_L4_IO_ADDRESS(pa));
121}
122
123static inline u16 omap_readw(u32 pa)
124{
125 return __raw_readw(OMAP2_L4_IO_ADDRESS(pa));
126}
127
128static inline u32 omap_readl(u32 pa)
129{
130 return __raw_readl(OMAP2_L4_IO_ADDRESS(pa));
131}
132
133static inline void omap_writeb(u8 v, u32 pa)
134{
135 __raw_writeb(v, OMAP2_L4_IO_ADDRESS(pa));
136}
137
138
139static inline void omap_writew(u16 v, u32 pa)
140{
141 __raw_writew(v, OMAP2_L4_IO_ADDRESS(pa));
142}
143
144static inline void omap_writel(u32 v, u32 pa)
145{
146 __raw_writel(v, OMAP2_L4_IO_ADDRESS(pa));
147}
148
108#endif 149#endif
109 150
110extern void am35x_musb_reset(void); 151extern void am35x_musb_reset(void);
diff --git a/arch/arm/plat-omap/include/plat/vram.h b/arch/arm/plat-omap/include/plat/vram.h
index 0aa4ecd12c7..4d65b7d06e6 100644
--- a/arch/arm/plat-omap/include/plat/vram.h
+++ b/arch/arm/plat-omap/include/plat/vram.h
@@ -23,40 +23,21 @@
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25 25
26#define OMAP_VRAM_MEMTYPE_SDRAM 0
27#define OMAP_VRAM_MEMTYPE_SRAM 1
28#define OMAP_VRAM_MEMTYPE_MAX 1
29
30extern int omap_vram_add_region(unsigned long paddr, size_t size); 26extern int omap_vram_add_region(unsigned long paddr, size_t size);
31extern int omap_vram_free(unsigned long paddr, size_t size); 27extern int omap_vram_free(unsigned long paddr, size_t size);
32extern int omap_vram_alloc(int mtype, size_t size, unsigned long *paddr); 28extern int omap_vram_alloc(size_t size, unsigned long *paddr);
33extern int omap_vram_reserve(unsigned long paddr, size_t size); 29extern int omap_vram_reserve(unsigned long paddr, size_t size);
34extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram, 30extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram,
35 unsigned long *largest_free_block); 31 unsigned long *largest_free_block);
36 32
37#ifdef CONFIG_OMAP2_VRAM 33#ifdef CONFIG_OMAP2_VRAM
38extern void omap_vram_set_sdram_vram(u32 size, u32 start); 34extern void omap_vram_set_sdram_vram(u32 size, u32 start);
39extern void omap_vram_set_sram_vram(u32 size, u32 start);
40 35
41extern void omap_vram_reserve_sdram_memblock(void); 36extern void omap_vram_reserve_sdram_memblock(void);
42extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
43 unsigned long sram_vstart,
44 unsigned long sram_size,
45 unsigned long pstart_avail,
46 unsigned long size_avail);
47#else 37#else
48static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { } 38static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { }
49static inline void omap_vram_set_sram_vram(u32 size, u32 start) { }
50 39
51static inline void omap_vram_reserve_sdram_memblock(void) { } 40static inline void omap_vram_reserve_sdram_memblock(void) { }
52static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
53 unsigned long sram_vstart,
54 unsigned long sram_size,
55 unsigned long pstart_avail,
56 unsigned long size_avail)
57{
58 return 0;
59}
60#endif 41#endif
61 42
62#endif 43#endif
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index ad80112c227..ad32621aa52 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -307,7 +307,7 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
307 if (!--mbox->use_count) { 307 if (!--mbox->use_count) {
308 free_irq(mbox->irq, mbox); 308 free_irq(mbox->irq, mbox);
309 tasklet_kill(&mbox->txq->tasklet); 309 tasklet_kill(&mbox->txq->tasklet);
310 flush_work_sync(&mbox->rxq->work); 310 flush_work_sync(&mbox->rxq->work);
311 mbox_queue_free(mbox->txq); 311 mbox_queue_free(mbox->txq);
312 mbox_queue_free(mbox->rxq); 312 mbox_queue_free(mbox->rxq);
313 } 313 }
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
deleted file mode 100644
index 4b15cd7926d..00000000000
--- a/arch/arm/plat-omap/mcbsp.c
+++ /dev/null
@@ -1,1361 +0,0 @@
1/*
2 * linux/arch/arm/plat-omap/mcbsp.c
3 *
4 * Copyright (C) 2004 Nokia Corporation
5 * Author: Samuel Ortiz <samuel.ortiz@nokia.com>
6 *
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 * Multichannel mode not supported.
13 */
14
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/device.h>
18#include <linux/platform_device.h>
19#include <linux/interrupt.h>
20#include <linux/err.h>
21#include <linux/clk.h>
22#include <linux/delay.h>
23#include <linux/io.h>
24#include <linux/slab.h>
25
26#include <plat/mcbsp.h>
27#include <linux/pm_runtime.h>
28
29struct omap_mcbsp **mcbsp_ptr;
30int omap_mcbsp_count;
31
32#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
33#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
34
35static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
36{
37 void __iomem *addr = mcbsp->io_base + reg * mcbsp->pdata->reg_step;
38
39 if (mcbsp->pdata->reg_size == 2) {
40 ((u16 *)mcbsp->reg_cache)[reg] = (u16)val;
41 __raw_writew((u16)val, addr);
42 } else {
43 ((u32 *)mcbsp->reg_cache)[reg] = val;
44 __raw_writel(val, addr);
45 }
46}
47
48static int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache)
49{
50 void __iomem *addr = mcbsp->io_base + reg * mcbsp->pdata->reg_step;
51
52 if (mcbsp->pdata->reg_size == 2) {
53 return !from_cache ? __raw_readw(addr) :
54 ((u16 *)mcbsp->reg_cache)[reg];
55 } else {
56 return !from_cache ? __raw_readl(addr) :
57 ((u32 *)mcbsp->reg_cache)[reg];
58 }
59}
60
61static void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
62{
63 __raw_writel(val, mcbsp->st_data->io_base_st + reg);
64}
65
66static int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg)
67{
68 return __raw_readl(mcbsp->st_data->io_base_st + reg);
69}
70
71#define MCBSP_READ(mcbsp, reg) \
72 omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 0)
73#define MCBSP_WRITE(mcbsp, reg, val) \
74 omap_mcbsp_write(mcbsp, OMAP_MCBSP_REG_##reg, val)
75#define MCBSP_READ_CACHE(mcbsp, reg) \
76 omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 1)
77
78#define MCBSP_ST_READ(mcbsp, reg) \
79 omap_mcbsp_st_read(mcbsp, OMAP_ST_REG_##reg)
80#define MCBSP_ST_WRITE(mcbsp, reg, val) \
81 omap_mcbsp_st_write(mcbsp, OMAP_ST_REG_##reg, val)
82
83static void omap_mcbsp_dump_reg(u8 id)
84{
85 struct omap_mcbsp *mcbsp = id_to_mcbsp_ptr(id);
86
87 dev_dbg(mcbsp->dev, "**** McBSP%d regs ****\n", mcbsp->id);
88 dev_dbg(mcbsp->dev, "DRR2: 0x%04x\n",
89 MCBSP_READ(mcbsp, DRR2));
90 dev_dbg(mcbsp->dev, "DRR1: 0x%04x\n",
91 MCBSP_READ(mcbsp, DRR1));
92 dev_dbg(mcbsp->dev, "DXR2: 0x%04x\n",
93 MCBSP_READ(mcbsp, DXR2));
94 dev_dbg(mcbsp->dev, "DXR1: 0x%04x\n",
95 MCBSP_READ(mcbsp, DXR1));
96 dev_dbg(mcbsp->dev, "SPCR2: 0x%04x\n",
97 MCBSP_READ(mcbsp, SPCR2));
98 dev_dbg(mcbsp->dev, "SPCR1: 0x%04x\n",
99 MCBSP_READ(mcbsp, SPCR1));
100 dev_dbg(mcbsp->dev, "RCR2: 0x%04x\n",
101 MCBSP_READ(mcbsp, RCR2));
102 dev_dbg(mcbsp->dev, "RCR1: 0x%04x\n",
103 MCBSP_READ(mcbsp, RCR1));
104 dev_dbg(mcbsp->dev, "XCR2: 0x%04x\n",
105 MCBSP_READ(mcbsp, XCR2));
106 dev_dbg(mcbsp->dev, "XCR1: 0x%04x\n",
107 MCBSP_READ(mcbsp, XCR1));
108 dev_dbg(mcbsp->dev, "SRGR2: 0x%04x\n",
109 MCBSP_READ(mcbsp, SRGR2));
110 dev_dbg(mcbsp->dev, "SRGR1: 0x%04x\n",
111 MCBSP_READ(mcbsp, SRGR1));
112 dev_dbg(mcbsp->dev, "PCR0: 0x%04x\n",
113 MCBSP_READ(mcbsp, PCR0));
114 dev_dbg(mcbsp->dev, "***********************\n");
115}
116
117static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id)
118{
119 struct omap_mcbsp *mcbsp_tx = dev_id;
120 u16 irqst_spcr2;
121
122 irqst_spcr2 = MCBSP_READ(mcbsp_tx, SPCR2);
123 dev_dbg(mcbsp_tx->dev, "TX IRQ callback : 0x%x\n", irqst_spcr2);
124
125 if (irqst_spcr2 & XSYNC_ERR) {
126 dev_err(mcbsp_tx->dev, "TX Frame Sync Error! : 0x%x\n",
127 irqst_spcr2);
128 /* Writing zero to XSYNC_ERR clears the IRQ */
129 MCBSP_WRITE(mcbsp_tx, SPCR2, MCBSP_READ_CACHE(mcbsp_tx, SPCR2));
130 }
131
132 return IRQ_HANDLED;
133}
134
135static irqreturn_t omap_mcbsp_rx_irq_handler(int irq, void *dev_id)
136{
137 struct omap_mcbsp *mcbsp_rx = dev_id;
138 u16 irqst_spcr1;
139
140 irqst_spcr1 = MCBSP_READ(mcbsp_rx, SPCR1);
141 dev_dbg(mcbsp_rx->dev, "RX IRQ callback : 0x%x\n", irqst_spcr1);
142
143 if (irqst_spcr1 & RSYNC_ERR) {
144 dev_err(mcbsp_rx->dev, "RX Frame Sync Error! : 0x%x\n",
145 irqst_spcr1);
146 /* Writing zero to RSYNC_ERR clears the IRQ */
147 MCBSP_WRITE(mcbsp_rx, SPCR1, MCBSP_READ_CACHE(mcbsp_rx, SPCR1));
148 }
149
150 return IRQ_HANDLED;
151}
152
153/*
154 * omap_mcbsp_config simply write a config to the
155 * appropriate McBSP.
156 * You either call this function or set the McBSP registers
157 * by yourself before calling omap_mcbsp_start().
158 */
159void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
160{
161 struct omap_mcbsp *mcbsp;
162
163 if (!omap_mcbsp_check_valid_id(id)) {
164 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
165 return;
166 }
167 mcbsp = id_to_mcbsp_ptr(id);
168
169 dev_dbg(mcbsp->dev, "Configuring McBSP%d phys_base: 0x%08lx\n",
170 mcbsp->id, mcbsp->phys_base);
171
172 /* We write the given config */
173 MCBSP_WRITE(mcbsp, SPCR2, config->spcr2);
174 MCBSP_WRITE(mcbsp, SPCR1, config->spcr1);
175 MCBSP_WRITE(mcbsp, RCR2, config->rcr2);
176 MCBSP_WRITE(mcbsp, RCR1, config->rcr1);
177 MCBSP_WRITE(mcbsp, XCR2, config->xcr2);
178 MCBSP_WRITE(mcbsp, XCR1, config->xcr1);
179 MCBSP_WRITE(mcbsp, SRGR2, config->srgr2);
180 MCBSP_WRITE(mcbsp, SRGR1, config->srgr1);
181 MCBSP_WRITE(mcbsp, MCR2, config->mcr2);
182 MCBSP_WRITE(mcbsp, MCR1, config->mcr1);
183 MCBSP_WRITE(mcbsp, PCR0, config->pcr0);
184 if (mcbsp->pdata->has_ccr) {
185 MCBSP_WRITE(mcbsp, XCCR, config->xccr);
186 MCBSP_WRITE(mcbsp, RCCR, config->rccr);
187 }
188}
189EXPORT_SYMBOL(omap_mcbsp_config);
190
191/**
192 * omap_mcbsp_dma_params - returns the dma channel number
193 * @id - mcbsp id
194 * @stream - indicates the direction of data flow (rx or tx)
195 *
196 * Returns the dma channel number for the rx channel or tx channel
197 * based on the value of @stream for the requested mcbsp given by @id
198 */
199int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream)
200{
201 struct omap_mcbsp *mcbsp;
202
203 if (!omap_mcbsp_check_valid_id(id)) {
204 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
205 return -ENODEV;
206 }
207 mcbsp = id_to_mcbsp_ptr(id);
208
209 if (stream)
210 return mcbsp->dma_rx_sync;
211 else
212 return mcbsp->dma_tx_sync;
213}
214EXPORT_SYMBOL(omap_mcbsp_dma_ch_params);
215
216/**
217 * omap_mcbsp_dma_reg_params - returns the address of mcbsp data register
218 * @id - mcbsp id
219 * @stream - indicates the direction of data flow (rx or tx)
220 *
221 * Returns the address of mcbsp data transmit register or data receive register
222 * to be used by DMA for transferring/receiving data based on the value of
223 * @stream for the requested mcbsp given by @id
224 */
225int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream)
226{
227 struct omap_mcbsp *mcbsp;
228 int data_reg;
229
230 if (!omap_mcbsp_check_valid_id(id)) {
231 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
232 return -ENODEV;
233 }
234 mcbsp = id_to_mcbsp_ptr(id);
235
236 if (mcbsp->pdata->reg_size == 2) {
237 if (stream)
238 data_reg = OMAP_MCBSP_REG_DRR1;
239 else
240 data_reg = OMAP_MCBSP_REG_DXR1;
241 } else {
242 if (stream)
243 data_reg = OMAP_MCBSP_REG_DRR;
244 else
245 data_reg = OMAP_MCBSP_REG_DXR;
246 }
247
248 return mcbsp->phys_dma_base + data_reg * mcbsp->pdata->reg_step;
249}
250EXPORT_SYMBOL(omap_mcbsp_dma_reg_params);
251
252static void omap_st_on(struct omap_mcbsp *mcbsp)
253{
254 unsigned int w;
255
256 if (mcbsp->pdata->enable_st_clock)
257 mcbsp->pdata->enable_st_clock(mcbsp->id, 1);
258
259 /* Enable McBSP Sidetone */
260 w = MCBSP_READ(mcbsp, SSELCR);
261 MCBSP_WRITE(mcbsp, SSELCR, w | SIDETONEEN);
262
263 /* Enable Sidetone from Sidetone Core */
264 w = MCBSP_ST_READ(mcbsp, SSELCR);
265 MCBSP_ST_WRITE(mcbsp, SSELCR, w | ST_SIDETONEEN);
266}
267
268static void omap_st_off(struct omap_mcbsp *mcbsp)
269{
270 unsigned int w;
271
272 w = MCBSP_ST_READ(mcbsp, SSELCR);
273 MCBSP_ST_WRITE(mcbsp, SSELCR, w & ~(ST_SIDETONEEN));
274
275 w = MCBSP_READ(mcbsp, SSELCR);
276 MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN));
277
278 if (mcbsp->pdata->enable_st_clock)
279 mcbsp->pdata->enable_st_clock(mcbsp->id, 0);
280}
281
282static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir)
283{
284 u16 val, i;
285
286 val = MCBSP_ST_READ(mcbsp, SSELCR);
287
288 if (val & ST_COEFFWREN)
289 MCBSP_ST_WRITE(mcbsp, SSELCR, val & ~(ST_COEFFWREN));
290
291 MCBSP_ST_WRITE(mcbsp, SSELCR, val | ST_COEFFWREN);
292
293 for (i = 0; i < 128; i++)
294 MCBSP_ST_WRITE(mcbsp, SFIRCR, fir[i]);
295
296 i = 0;
297
298 val = MCBSP_ST_READ(mcbsp, SSELCR);
299 while (!(val & ST_COEFFWRDONE) && (++i < 1000))
300 val = MCBSP_ST_READ(mcbsp, SSELCR);
301
302 MCBSP_ST_WRITE(mcbsp, SSELCR, val & ~(ST_COEFFWREN));
303
304 if (i == 1000)
305 dev_err(mcbsp->dev, "McBSP FIR load error!\n");
306}
307
308static void omap_st_chgain(struct omap_mcbsp *mcbsp)
309{
310 u16 w;
311 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
312
313 w = MCBSP_ST_READ(mcbsp, SSELCR);
314
315 MCBSP_ST_WRITE(mcbsp, SGAINCR, ST_CH0GAIN(st_data->ch0gain) | \
316 ST_CH1GAIN(st_data->ch1gain));
317}
318
319int omap_st_set_chgain(unsigned int id, int channel, s16 chgain)
320{
321 struct omap_mcbsp *mcbsp;
322 struct omap_mcbsp_st_data *st_data;
323 int ret = 0;
324
325 if (!omap_mcbsp_check_valid_id(id)) {
326 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
327 return -ENODEV;
328 }
329
330 mcbsp = id_to_mcbsp_ptr(id);
331 st_data = mcbsp->st_data;
332
333 if (!st_data)
334 return -ENOENT;
335
336 spin_lock_irq(&mcbsp->lock);
337 if (channel == 0)
338 st_data->ch0gain = chgain;
339 else if (channel == 1)
340 st_data->ch1gain = chgain;
341 else
342 ret = -EINVAL;
343
344 if (st_data->enabled)
345 omap_st_chgain(mcbsp);
346 spin_unlock_irq(&mcbsp->lock);
347
348 return ret;
349}
350EXPORT_SYMBOL(omap_st_set_chgain);
351
352int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain)
353{
354 struct omap_mcbsp *mcbsp;
355 struct omap_mcbsp_st_data *st_data;
356 int ret = 0;
357
358 if (!omap_mcbsp_check_valid_id(id)) {
359 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
360 return -ENODEV;
361 }
362
363 mcbsp = id_to_mcbsp_ptr(id);
364 st_data = mcbsp->st_data;
365
366 if (!st_data)
367 return -ENOENT;
368
369 spin_lock_irq(&mcbsp->lock);
370 if (channel == 0)
371 *chgain = st_data->ch0gain;
372 else if (channel == 1)
373 *chgain = st_data->ch1gain;
374 else
375 ret = -EINVAL;
376 spin_unlock_irq(&mcbsp->lock);
377
378 return ret;
379}
380EXPORT_SYMBOL(omap_st_get_chgain);
381
382static int omap_st_start(struct omap_mcbsp *mcbsp)
383{
384 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
385
386 if (st_data && st_data->enabled && !st_data->running) {
387 omap_st_fir_write(mcbsp, st_data->taps);
388 omap_st_chgain(mcbsp);
389
390 if (!mcbsp->free) {
391 omap_st_on(mcbsp);
392 st_data->running = 1;
393 }
394 }
395
396 return 0;
397}
398
399int omap_st_enable(unsigned int id)
400{
401 struct omap_mcbsp *mcbsp;
402 struct omap_mcbsp_st_data *st_data;
403
404 if (!omap_mcbsp_check_valid_id(id)) {
405 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
406 return -ENODEV;
407 }
408
409 mcbsp = id_to_mcbsp_ptr(id);
410 st_data = mcbsp->st_data;
411
412 if (!st_data)
413 return -ENODEV;
414
415 spin_lock_irq(&mcbsp->lock);
416 st_data->enabled = 1;
417 omap_st_start(mcbsp);
418 spin_unlock_irq(&mcbsp->lock);
419
420 return 0;
421}
422EXPORT_SYMBOL(omap_st_enable);
423
424static int omap_st_stop(struct omap_mcbsp *mcbsp)
425{
426 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
427
428 if (st_data && st_data->running) {
429 if (!mcbsp->free) {
430 omap_st_off(mcbsp);
431 st_data->running = 0;
432 }
433 }
434
435 return 0;
436}
437
438int omap_st_disable(unsigned int id)
439{
440 struct omap_mcbsp *mcbsp;
441 struct omap_mcbsp_st_data *st_data;
442 int ret = 0;
443
444 if (!omap_mcbsp_check_valid_id(id)) {
445 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
446 return -ENODEV;
447 }
448
449 mcbsp = id_to_mcbsp_ptr(id);
450 st_data = mcbsp->st_data;
451
452 if (!st_data)
453 return -ENODEV;
454
455 spin_lock_irq(&mcbsp->lock);
456 omap_st_stop(mcbsp);
457 st_data->enabled = 0;
458 spin_unlock_irq(&mcbsp->lock);
459
460 return ret;
461}
462EXPORT_SYMBOL(omap_st_disable);
463
464int omap_st_is_enabled(unsigned int id)
465{
466 struct omap_mcbsp *mcbsp;
467 struct omap_mcbsp_st_data *st_data;
468
469 if (!omap_mcbsp_check_valid_id(id)) {
470 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
471 return -ENODEV;
472 }
473
474 mcbsp = id_to_mcbsp_ptr(id);
475 st_data = mcbsp->st_data;
476
477 if (!st_data)
478 return -ENODEV;
479
480
481 return st_data->enabled;
482}
483EXPORT_SYMBOL(omap_st_is_enabled);
484
485/*
486 * omap_mcbsp_set_rx_threshold configures the transmit threshold in words.
487 * The threshold parameter is 1 based, and it is converted (threshold - 1)
488 * for the THRSH2 register.
489 */
490void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
491{
492 struct omap_mcbsp *mcbsp;
493
494 if (!omap_mcbsp_check_valid_id(id)) {
495 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
496 return;
497 }
498 mcbsp = id_to_mcbsp_ptr(id);
499 if (mcbsp->pdata->buffer_size == 0)
500 return;
501
502 if (threshold && threshold <= mcbsp->max_tx_thres)
503 MCBSP_WRITE(mcbsp, THRSH2, threshold - 1);
504}
505EXPORT_SYMBOL(omap_mcbsp_set_tx_threshold);
506
507/*
508 * omap_mcbsp_set_rx_threshold configures the receive threshold in words.
509 * The threshold parameter is 1 based, and it is converted (threshold - 1)
510 * for the THRSH1 register.
511 */
512void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
513{
514 struct omap_mcbsp *mcbsp;
515
516 if (!omap_mcbsp_check_valid_id(id)) {
517 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
518 return;
519 }
520 mcbsp = id_to_mcbsp_ptr(id);
521 if (mcbsp->pdata->buffer_size == 0)
522 return;
523
524 if (threshold && threshold <= mcbsp->max_rx_thres)
525 MCBSP_WRITE(mcbsp, THRSH1, threshold - 1);
526}
527EXPORT_SYMBOL(omap_mcbsp_set_rx_threshold);
528
529/*
530 * omap_mcbsp_get_max_tx_thres just return the current configured
531 * maximum threshold for transmission
532 */
533u16 omap_mcbsp_get_max_tx_threshold(unsigned int id)
534{
535 struct omap_mcbsp *mcbsp;
536
537 if (!omap_mcbsp_check_valid_id(id)) {
538 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
539 return -ENODEV;
540 }
541 mcbsp = id_to_mcbsp_ptr(id);
542
543 return mcbsp->max_tx_thres;
544}
545EXPORT_SYMBOL(omap_mcbsp_get_max_tx_threshold);
546
547/*
548 * omap_mcbsp_get_max_rx_thres just return the current configured
549 * maximum threshold for reception
550 */
551u16 omap_mcbsp_get_max_rx_threshold(unsigned int id)
552{
553 struct omap_mcbsp *mcbsp;
554
555 if (!omap_mcbsp_check_valid_id(id)) {
556 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
557 return -ENODEV;
558 }
559 mcbsp = id_to_mcbsp_ptr(id);
560
561 return mcbsp->max_rx_thres;
562}
563EXPORT_SYMBOL(omap_mcbsp_get_max_rx_threshold);
564
565u16 omap_mcbsp_get_fifo_size(unsigned int id)
566{
567 struct omap_mcbsp *mcbsp;
568
569 if (!omap_mcbsp_check_valid_id(id)) {
570 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
571 return -ENODEV;
572 }
573 mcbsp = id_to_mcbsp_ptr(id);
574
575 return mcbsp->pdata->buffer_size;
576}
577EXPORT_SYMBOL(omap_mcbsp_get_fifo_size);
578
579/*
580 * omap_mcbsp_get_tx_delay returns the number of used slots in the McBSP FIFO
581 */
582u16 omap_mcbsp_get_tx_delay(unsigned int id)
583{
584 struct omap_mcbsp *mcbsp;
585 u16 buffstat;
586
587 if (!omap_mcbsp_check_valid_id(id)) {
588 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
589 return -ENODEV;
590 }
591 mcbsp = id_to_mcbsp_ptr(id);
592 if (mcbsp->pdata->buffer_size == 0)
593 return 0;
594
595 /* Returns the number of free locations in the buffer */
596 buffstat = MCBSP_READ(mcbsp, XBUFFSTAT);
597
598 /* Number of slots are different in McBSP ports */
599 return mcbsp->pdata->buffer_size - buffstat;
600}
601EXPORT_SYMBOL(omap_mcbsp_get_tx_delay);
602
603/*
604 * omap_mcbsp_get_rx_delay returns the number of free slots in the McBSP FIFO
605 * to reach the threshold value (when the DMA will be triggered to read it)
606 */
607u16 omap_mcbsp_get_rx_delay(unsigned int id)
608{
609 struct omap_mcbsp *mcbsp;
610 u16 buffstat, threshold;
611
612 if (!omap_mcbsp_check_valid_id(id)) {
613 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
614 return -ENODEV;
615 }
616 mcbsp = id_to_mcbsp_ptr(id);
617 if (mcbsp->pdata->buffer_size == 0)
618 return 0;
619
620 /* Returns the number of used locations in the buffer */
621 buffstat = MCBSP_READ(mcbsp, RBUFFSTAT);
622 /* RX threshold */
623 threshold = MCBSP_READ(mcbsp, THRSH1);
624
625 /* Return the number of location till we reach the threshold limit */
626 if (threshold <= buffstat)
627 return 0;
628 else
629 return threshold - buffstat;
630}
631EXPORT_SYMBOL(omap_mcbsp_get_rx_delay);
632
633/*
634 * omap_mcbsp_get_dma_op_mode just return the current configured
635 * operating mode for the mcbsp channel
636 */
637int omap_mcbsp_get_dma_op_mode(unsigned int id)
638{
639 struct omap_mcbsp *mcbsp;
640 int dma_op_mode;
641
642 if (!omap_mcbsp_check_valid_id(id)) {
643 printk(KERN_ERR "%s: Invalid id (%u)\n", __func__, id + 1);
644 return -ENODEV;
645 }
646 mcbsp = id_to_mcbsp_ptr(id);
647
648 dma_op_mode = mcbsp->dma_op_mode;
649
650 return dma_op_mode;
651}
652EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode);
653
654int omap_mcbsp_request(unsigned int id)
655{
656 struct omap_mcbsp *mcbsp;
657 void *reg_cache;
658 int err;
659
660 if (!omap_mcbsp_check_valid_id(id)) {
661 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
662 return -ENODEV;
663 }
664 mcbsp = id_to_mcbsp_ptr(id);
665
666 reg_cache = kzalloc(mcbsp->reg_cache_size, GFP_KERNEL);
667 if (!reg_cache) {
668 return -ENOMEM;
669 }
670
671 spin_lock(&mcbsp->lock);
672 if (!mcbsp->free) {
673 dev_err(mcbsp->dev, "McBSP%d is currently in use\n",
674 mcbsp->id);
675 err = -EBUSY;
676 goto err_kfree;
677 }
678
679 mcbsp->free = false;
680 mcbsp->reg_cache = reg_cache;
681 spin_unlock(&mcbsp->lock);
682
683 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request)
684 mcbsp->pdata->ops->request(id);
685
686 pm_runtime_get_sync(mcbsp->dev);
687
688 /* Enable wakeup behavior */
689 if (mcbsp->pdata->has_wakeup)
690 MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
691
692 /*
693 * Make sure that transmitter, receiver and sample-rate generator are
694 * not running before activating IRQs.
695 */
696 MCBSP_WRITE(mcbsp, SPCR1, 0);
697 MCBSP_WRITE(mcbsp, SPCR2, 0);
698
699 err = request_irq(mcbsp->tx_irq, omap_mcbsp_tx_irq_handler,
700 0, "McBSP", (void *)mcbsp);
701 if (err != 0) {
702 dev_err(mcbsp->dev, "Unable to request TX IRQ %d "
703 "for McBSP%d\n", mcbsp->tx_irq,
704 mcbsp->id);
705 goto err_clk_disable;
706 }
707
708 if (mcbsp->rx_irq) {
709 err = request_irq(mcbsp->rx_irq,
710 omap_mcbsp_rx_irq_handler,
711 0, "McBSP", (void *)mcbsp);
712 if (err != 0) {
713 dev_err(mcbsp->dev, "Unable to request RX IRQ %d "
714 "for McBSP%d\n", mcbsp->rx_irq,
715 mcbsp->id);
716 goto err_free_irq;
717 }
718 }
719
720 return 0;
721err_free_irq:
722 free_irq(mcbsp->tx_irq, (void *)mcbsp);
723err_clk_disable:
724 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
725 mcbsp->pdata->ops->free(id);
726
727 /* Disable wakeup behavior */
728 if (mcbsp->pdata->has_wakeup)
729 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
730
731 pm_runtime_put_sync(mcbsp->dev);
732
733 spin_lock(&mcbsp->lock);
734 mcbsp->free = true;
735 mcbsp->reg_cache = NULL;
736err_kfree:
737 spin_unlock(&mcbsp->lock);
738 kfree(reg_cache);
739
740 return err;
741}
742EXPORT_SYMBOL(omap_mcbsp_request);
743
744void omap_mcbsp_free(unsigned int id)
745{
746 struct omap_mcbsp *mcbsp;
747 void *reg_cache;
748
749 if (!omap_mcbsp_check_valid_id(id)) {
750 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
751 return;
752 }
753 mcbsp = id_to_mcbsp_ptr(id);
754
755 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
756 mcbsp->pdata->ops->free(id);
757
758 /* Disable wakeup behavior */
759 if (mcbsp->pdata->has_wakeup)
760 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
761
762 pm_runtime_put_sync(mcbsp->dev);
763
764 if (mcbsp->rx_irq)
765 free_irq(mcbsp->rx_irq, (void *)mcbsp);
766 free_irq(mcbsp->tx_irq, (void *)mcbsp);
767
768 reg_cache = mcbsp->reg_cache;
769
770 spin_lock(&mcbsp->lock);
771 if (mcbsp->free)
772 dev_err(mcbsp->dev, "McBSP%d was not reserved\n", mcbsp->id);
773 else
774 mcbsp->free = true;
775 mcbsp->reg_cache = NULL;
776 spin_unlock(&mcbsp->lock);
777
778 if (reg_cache)
779 kfree(reg_cache);
780}
781EXPORT_SYMBOL(omap_mcbsp_free);
782
783/*
784 * Here we start the McBSP, by enabling transmitter, receiver or both.
785 * If no transmitter or receiver is active prior calling, then sample-rate
786 * generator and frame sync are started.
787 */
788void omap_mcbsp_start(unsigned int id, int tx, int rx)
789{
790 struct omap_mcbsp *mcbsp;
791 int enable_srg = 0;
792 u16 w;
793
794 if (!omap_mcbsp_check_valid_id(id)) {
795 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
796 return;
797 }
798 mcbsp = id_to_mcbsp_ptr(id);
799
800 if (mcbsp->st_data)
801 omap_st_start(mcbsp);
802
803 /* Only enable SRG, if McBSP is master */
804 w = MCBSP_READ_CACHE(mcbsp, PCR0);
805 if (w & (FSXM | FSRM | CLKXM | CLKRM))
806 enable_srg = !((MCBSP_READ_CACHE(mcbsp, SPCR2) |
807 MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1);
808
809 if (enable_srg) {
810 /* Start the sample generator */
811 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
812 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 6));
813 }
814
815 /* Enable transmitter and receiver */
816 tx &= 1;
817 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
818 MCBSP_WRITE(mcbsp, SPCR2, w | tx);
819
820 rx &= 1;
821 w = MCBSP_READ_CACHE(mcbsp, SPCR1);
822 MCBSP_WRITE(mcbsp, SPCR1, w | rx);
823
824 /*
825 * Worst case: CLKSRG*2 = 8000khz: (1/8000) * 2 * 2 usec
826 * REVISIT: 100us may give enough time for two CLKSRG, however
827 * due to some unknown PM related, clock gating etc. reason it
828 * is now at 500us.
829 */
830 udelay(500);
831
832 if (enable_srg) {
833 /* Start frame sync */
834 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
835 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7));
836 }
837
838 if (mcbsp->pdata->has_ccr) {
839 /* Release the transmitter and receiver */
840 w = MCBSP_READ_CACHE(mcbsp, XCCR);
841 w &= ~(tx ? XDISABLE : 0);
842 MCBSP_WRITE(mcbsp, XCCR, w);
843 w = MCBSP_READ_CACHE(mcbsp, RCCR);
844 w &= ~(rx ? RDISABLE : 0);
845 MCBSP_WRITE(mcbsp, RCCR, w);
846 }
847
848 /* Dump McBSP Regs */
849 omap_mcbsp_dump_reg(id);
850}
851EXPORT_SYMBOL(omap_mcbsp_start);
852
853void omap_mcbsp_stop(unsigned int id, int tx, int rx)
854{
855 struct omap_mcbsp *mcbsp;
856 int idle;
857 u16 w;
858
859 if (!omap_mcbsp_check_valid_id(id)) {
860 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
861 return;
862 }
863
864 mcbsp = id_to_mcbsp_ptr(id);
865
866 /* Reset transmitter */
867 tx &= 1;
868 if (mcbsp->pdata->has_ccr) {
869 w = MCBSP_READ_CACHE(mcbsp, XCCR);
870 w |= (tx ? XDISABLE : 0);
871 MCBSP_WRITE(mcbsp, XCCR, w);
872 }
873 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
874 MCBSP_WRITE(mcbsp, SPCR2, w & ~tx);
875
876 /* Reset receiver */
877 rx &= 1;
878 if (mcbsp->pdata->has_ccr) {
879 w = MCBSP_READ_CACHE(mcbsp, RCCR);
880 w |= (rx ? RDISABLE : 0);
881 MCBSP_WRITE(mcbsp, RCCR, w);
882 }
883 w = MCBSP_READ_CACHE(mcbsp, SPCR1);
884 MCBSP_WRITE(mcbsp, SPCR1, w & ~rx);
885
886 idle = !((MCBSP_READ_CACHE(mcbsp, SPCR2) |
887 MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1);
888
889 if (idle) {
890 /* Reset the sample rate generator */
891 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
892 MCBSP_WRITE(mcbsp, SPCR2, w & ~(1 << 6));
893 }
894
895 if (mcbsp->st_data)
896 omap_st_stop(mcbsp);
897}
898EXPORT_SYMBOL(omap_mcbsp_stop);
899
900int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
901{
902 struct omap_mcbsp *mcbsp;
903 const char *src;
904
905 if (!omap_mcbsp_check_valid_id(id)) {
906 pr_err("%s: Invalid id (%d)\n", __func__, id + 1);
907 return -EINVAL;
908 }
909 mcbsp = id_to_mcbsp_ptr(id);
910
911 if (fck_src_id == MCBSP_CLKS_PAD_SRC)
912 src = "clks_ext";
913 else if (fck_src_id == MCBSP_CLKS_PRCM_SRC)
914 src = "clks_fclk";
915 else
916 return -EINVAL;
917
918 if (mcbsp->pdata->set_clk_src)
919 return mcbsp->pdata->set_clk_src(mcbsp->dev, mcbsp->fclk, src);
920 else
921 return -EINVAL;
922}
923EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
924
925void omap2_mcbsp1_mux_clkr_src(u8 mux)
926{
927 struct omap_mcbsp *mcbsp;
928 const char *src;
929
930 if (mux == CLKR_SRC_CLKR)
931 src = "clkr";
932 else if (mux == CLKR_SRC_CLKX)
933 src = "clkx";
934 else
935 return;
936
937 mcbsp = id_to_mcbsp_ptr(0);
938 if (mcbsp->pdata->mux_signal)
939 mcbsp->pdata->mux_signal(mcbsp->dev, "clkr", src);
940}
941EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src);
942
943void omap2_mcbsp1_mux_fsr_src(u8 mux)
944{
945 struct omap_mcbsp *mcbsp;
946 const char *src;
947
948 if (mux == FSR_SRC_FSR)
949 src = "fsr";
950 else if (mux == FSR_SRC_FSX)
951 src = "fsx";
952 else
953 return;
954
955 mcbsp = id_to_mcbsp_ptr(0);
956 if (mcbsp->pdata->mux_signal)
957 mcbsp->pdata->mux_signal(mcbsp->dev, "fsr", src);
958}
959EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src);
960
961#define max_thres(m) (mcbsp->pdata->buffer_size)
962#define valid_threshold(m, val) ((val) <= max_thres(m))
963#define THRESHOLD_PROP_BUILDER(prop) \
964static ssize_t prop##_show(struct device *dev, \
965 struct device_attribute *attr, char *buf) \
966{ \
967 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); \
968 \
969 return sprintf(buf, "%u\n", mcbsp->prop); \
970} \
971 \
972static ssize_t prop##_store(struct device *dev, \
973 struct device_attribute *attr, \
974 const char *buf, size_t size) \
975{ \
976 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); \
977 unsigned long val; \
978 int status; \
979 \
980 status = strict_strtoul(buf, 0, &val); \
981 if (status) \
982 return status; \
983 \
984 if (!valid_threshold(mcbsp, val)) \
985 return -EDOM; \
986 \
987 mcbsp->prop = val; \
988 return size; \
989} \
990 \
991static DEVICE_ATTR(prop, 0644, prop##_show, prop##_store);
992
993THRESHOLD_PROP_BUILDER(max_tx_thres);
994THRESHOLD_PROP_BUILDER(max_rx_thres);
995
996static const char *dma_op_modes[] = {
997 "element", "threshold", "frame",
998};
999
1000static ssize_t dma_op_mode_show(struct device *dev,
1001 struct device_attribute *attr, char *buf)
1002{
1003 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
1004 int dma_op_mode, i = 0;
1005 ssize_t len = 0;
1006 const char * const *s;
1007
1008 dma_op_mode = mcbsp->dma_op_mode;
1009
1010 for (s = &dma_op_modes[i]; i < ARRAY_SIZE(dma_op_modes); s++, i++) {
1011 if (dma_op_mode == i)
1012 len += sprintf(buf + len, "[%s] ", *s);
1013 else
1014 len += sprintf(buf + len, "%s ", *s);
1015 }
1016 len += sprintf(buf + len, "\n");
1017
1018 return len;
1019}
1020
1021static ssize_t dma_op_mode_store(struct device *dev,
1022 struct device_attribute *attr,
1023 const char *buf, size_t size)
1024{
1025 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
1026 const char * const *s;
1027 int i = 0;
1028
1029 for (s = &dma_op_modes[i]; i < ARRAY_SIZE(dma_op_modes); s++, i++)
1030 if (sysfs_streq(buf, *s))
1031 break;
1032
1033 if (i == ARRAY_SIZE(dma_op_modes))
1034 return -EINVAL;
1035
1036 spin_lock_irq(&mcbsp->lock);
1037 if (!mcbsp->free) {
1038 size = -EBUSY;
1039 goto unlock;
1040 }
1041 mcbsp->dma_op_mode = i;
1042
1043unlock:
1044 spin_unlock_irq(&mcbsp->lock);
1045
1046 return size;
1047}
1048
1049static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
1050
1051static const struct attribute *additional_attrs[] = {
1052 &dev_attr_max_tx_thres.attr,
1053 &dev_attr_max_rx_thres.attr,
1054 &dev_attr_dma_op_mode.attr,
1055 NULL,
1056};
1057
1058static const struct attribute_group additional_attr_group = {
1059 .attrs = (struct attribute **)additional_attrs,
1060};
1061
1062static ssize_t st_taps_show(struct device *dev,
1063 struct device_attribute *attr, char *buf)
1064{
1065 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
1066 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
1067 ssize_t status = 0;
1068 int i;
1069
1070 spin_lock_irq(&mcbsp->lock);
1071 for (i = 0; i < st_data->nr_taps; i++)
1072 status += sprintf(&buf[status], (i ? ", %d" : "%d"),
1073 st_data->taps[i]);
1074 if (i)
1075 status += sprintf(&buf[status], "\n");
1076 spin_unlock_irq(&mcbsp->lock);
1077
1078 return status;
1079}
1080
1081static ssize_t st_taps_store(struct device *dev,
1082 struct device_attribute *attr,
1083 const char *buf, size_t size)
1084{
1085 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
1086 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
1087 int val, tmp, status, i = 0;
1088
1089 spin_lock_irq(&mcbsp->lock);
1090 memset(st_data->taps, 0, sizeof(st_data->taps));
1091 st_data->nr_taps = 0;
1092
1093 do {
1094 status = sscanf(buf, "%d%n", &val, &tmp);
1095 if (status < 0 || status == 0) {
1096 size = -EINVAL;
1097 goto out;
1098 }
1099 if (val < -32768 || val > 32767) {
1100 size = -EINVAL;
1101 goto out;
1102 }
1103 st_data->taps[i++] = val;
1104 buf += tmp;
1105 if (*buf != ',')
1106 break;
1107 buf++;
1108 } while (1);
1109
1110 st_data->nr_taps = i;
1111
1112out:
1113 spin_unlock_irq(&mcbsp->lock);
1114
1115 return size;
1116}
1117
1118static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
1119
1120static const struct attribute *sidetone_attrs[] = {
1121 &dev_attr_st_taps.attr,
1122 NULL,
1123};
1124
1125static const struct attribute_group sidetone_attr_group = {
1126 .attrs = (struct attribute **)sidetone_attrs,
1127};
1128
1129static int __devinit omap_st_add(struct omap_mcbsp *mcbsp,
1130 struct resource *res)
1131{
1132 struct omap_mcbsp_st_data *st_data;
1133 int err;
1134
1135 st_data = kzalloc(sizeof(*mcbsp->st_data), GFP_KERNEL);
1136 if (!st_data) {
1137 err = -ENOMEM;
1138 goto err1;
1139 }
1140
1141 st_data->io_base_st = ioremap(res->start, resource_size(res));
1142 if (!st_data->io_base_st) {
1143 err = -ENOMEM;
1144 goto err2;
1145 }
1146
1147 err = sysfs_create_group(&mcbsp->dev->kobj, &sidetone_attr_group);
1148 if (err)
1149 goto err3;
1150
1151 mcbsp->st_data = st_data;
1152 return 0;
1153
1154err3:
1155 iounmap(st_data->io_base_st);
1156err2:
1157 kfree(st_data);
1158err1:
1159 return err;
1160
1161}
1162
1163static void __devexit omap_st_remove(struct omap_mcbsp *mcbsp)
1164{
1165 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
1166
1167 sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
1168 iounmap(st_data->io_base_st);
1169 kfree(st_data);
1170}
1171
1172/*
1173 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510.
1174 * 730 has only 2 McBSP, and both of them are MPU peripherals.
1175 */
1176static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
1177{
1178 struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data;
1179 struct omap_mcbsp *mcbsp;
1180 int id = pdev->id - 1;
1181 struct resource *res;
1182 int ret = 0;
1183
1184 if (!pdata) {
1185 dev_err(&pdev->dev, "McBSP device initialized without"
1186 "platform data\n");
1187 ret = -EINVAL;
1188 goto exit;
1189 }
1190
1191 dev_dbg(&pdev->dev, "Initializing OMAP McBSP (%d).\n", pdev->id);
1192
1193 if (id >= omap_mcbsp_count) {
1194 dev_err(&pdev->dev, "Invalid McBSP device id (%d)\n", id);
1195 ret = -EINVAL;
1196 goto exit;
1197 }
1198
1199 mcbsp = kzalloc(sizeof(struct omap_mcbsp), GFP_KERNEL);
1200 if (!mcbsp) {
1201 ret = -ENOMEM;
1202 goto exit;
1203 }
1204
1205 spin_lock_init(&mcbsp->lock);
1206 mcbsp->id = id + 1;
1207 mcbsp->free = true;
1208
1209 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
1210 if (!res) {
1211 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1212 if (!res) {
1213 dev_err(&pdev->dev, "%s:mcbsp%d has invalid memory"
1214 "resource\n", __func__, pdev->id);
1215 ret = -ENOMEM;
1216 goto exit;
1217 }
1218 }
1219 mcbsp->phys_base = res->start;
1220 mcbsp->reg_cache_size = resource_size(res);
1221 mcbsp->io_base = ioremap(res->start, resource_size(res));
1222 if (!mcbsp->io_base) {
1223 ret = -ENOMEM;
1224 goto err_ioremap;
1225 }
1226
1227 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
1228 if (!res)
1229 mcbsp->phys_dma_base = mcbsp->phys_base;
1230 else
1231 mcbsp->phys_dma_base = res->start;
1232
1233 mcbsp->tx_irq = platform_get_irq_byname(pdev, "tx");
1234 mcbsp->rx_irq = platform_get_irq_byname(pdev, "rx");
1235
1236 /* From OMAP4 there will be a single irq line */
1237 if (mcbsp->tx_irq == -ENXIO)
1238 mcbsp->tx_irq = platform_get_irq(pdev, 0);
1239
1240 res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
1241 if (!res) {
1242 dev_err(&pdev->dev, "%s:mcbsp%d has invalid rx DMA channel\n",
1243 __func__, pdev->id);
1244 ret = -ENODEV;
1245 goto err_res;
1246 }
1247 mcbsp->dma_rx_sync = res->start;
1248
1249 res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
1250 if (!res) {
1251 dev_err(&pdev->dev, "%s:mcbsp%d has invalid tx DMA channel\n",
1252 __func__, pdev->id);
1253 ret = -ENODEV;
1254 goto err_res;
1255 }
1256 mcbsp->dma_tx_sync = res->start;
1257
1258 mcbsp->fclk = clk_get(&pdev->dev, "fck");
1259 if (IS_ERR(mcbsp->fclk)) {
1260 ret = PTR_ERR(mcbsp->fclk);
1261 dev_err(&pdev->dev, "unable to get fck: %d\n", ret);
1262 goto err_res;
1263 }
1264
1265 mcbsp->pdata = pdata;
1266 mcbsp->dev = &pdev->dev;
1267 mcbsp_ptr[id] = mcbsp;
1268 platform_set_drvdata(pdev, mcbsp);
1269 pm_runtime_enable(mcbsp->dev);
1270
1271 mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT;
1272 if (mcbsp->pdata->buffer_size) {
1273 /*
1274 * Initially configure the maximum thresholds to a safe value.
1275 * The McBSP FIFO usage with these values should not go under
1276 * 16 locations.
1277 * If the whole FIFO without safety buffer is used, than there
1278 * is a possibility that the DMA will be not able to push the
1279 * new data on time, causing channel shifts in runtime.
1280 */
1281 mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10;
1282 mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10;
1283
1284 ret = sysfs_create_group(&mcbsp->dev->kobj,
1285 &additional_attr_group);
1286 if (ret) {
1287 dev_err(mcbsp->dev,
1288 "Unable to create additional controls\n");
1289 goto err_thres;
1290 }
1291 } else {
1292 mcbsp->max_tx_thres = -EINVAL;
1293 mcbsp->max_rx_thres = -EINVAL;
1294 }
1295
1296 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sidetone");
1297 if (res) {
1298 ret = omap_st_add(mcbsp, res);
1299 if (ret) {
1300 dev_err(mcbsp->dev,
1301 "Unable to create sidetone controls\n");
1302 goto err_st;
1303 }
1304 }
1305
1306 return 0;
1307
1308err_st:
1309 if (mcbsp->pdata->buffer_size)
1310 sysfs_remove_group(&mcbsp->dev->kobj,
1311 &additional_attr_group);
1312err_thres:
1313 clk_put(mcbsp->fclk);
1314err_res:
1315 iounmap(mcbsp->io_base);
1316err_ioremap:
1317 kfree(mcbsp);
1318exit:
1319 return ret;
1320}
1321
1322static int __devexit omap_mcbsp_remove(struct platform_device *pdev)
1323{
1324 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
1325
1326 platform_set_drvdata(pdev, NULL);
1327 if (mcbsp) {
1328
1329 if (mcbsp->pdata && mcbsp->pdata->ops &&
1330 mcbsp->pdata->ops->free)
1331 mcbsp->pdata->ops->free(mcbsp->id);
1332
1333 if (mcbsp->pdata->buffer_size)
1334 sysfs_remove_group(&mcbsp->dev->kobj,
1335 &additional_attr_group);
1336
1337 if (mcbsp->st_data)
1338 omap_st_remove(mcbsp);
1339
1340 clk_put(mcbsp->fclk);
1341
1342 iounmap(mcbsp->io_base);
1343 kfree(mcbsp);
1344 }
1345
1346 return 0;
1347}
1348
1349static struct platform_driver omap_mcbsp_driver = {
1350 .probe = omap_mcbsp_probe,
1351 .remove = __devexit_p(omap_mcbsp_remove),
1352 .driver = {
1353 .name = "omap-mcbsp",
1354 },
1355};
1356
1357int __init omap_mcbsp_init(void)
1358{
1359 /* Register the McBSP driver */
1360 return platform_driver_register(&omap_mcbsp_driver);
1361}
diff --git a/arch/arm/plat-omap/mux.c b/arch/arm/plat-omap/mux.c
index 0d4aa0d5876..cff8712122b 100644
--- a/arch/arm/plat-omap/mux.c
+++ b/arch/arm/plat-omap/mux.c
@@ -26,8 +26,11 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <asm/system.h>
30#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30
31#include <asm/system.h>
32
33#include <plat/cpu.h>
31#include <plat/mux.h> 34#include <plat/mux.h>
32 35
33#ifdef CONFIG_OMAP_MUX 36#ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/plat-omap/omap-pm-noop.c
index 3dc3801aace..5a97b4d98d4 100644
--- a/arch/arm/plat-omap/omap-pm-noop.c
+++ b/arch/arm/plat-omap/omap-pm-noop.c
@@ -319,7 +319,7 @@ int omap_pm_get_dev_context_loss_count(struct device *dev)
319 if (WARN_ON(!dev)) 319 if (WARN_ON(!dev))
320 return -ENODEV; 320 return -ENODEV;
321 321
322 if (dev->parent == &omap_device_parent) { 322 if (dev->pm_domain == &omap_device_pm_domain) {
323 count = omap_device_get_context_loss_count(pdev); 323 count = omap_device_get_context_loss_count(pdev);
324 } else { 324 } else {
325 WARN_ONCE(off_mode_enabled, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device", 325 WARN_ONCE(off_mode_enabled, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device",
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index e8d98693d2d..d50cbc6385b 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * omap_device implementation 3 * omap_device implementation
3 * 4 *
@@ -97,14 +98,7 @@
97#define USE_WAKEUP_LAT 0 98#define USE_WAKEUP_LAT 0
98#define IGNORE_WAKEUP_LAT 1 99#define IGNORE_WAKEUP_LAT 1
99 100
100static int omap_device_register(struct platform_device *pdev);
101static int omap_early_device_register(struct platform_device *pdev); 101static int omap_early_device_register(struct platform_device *pdev);
102static struct omap_device *omap_device_alloc(struct platform_device *pdev,
103 struct omap_hwmod **ohs, int oh_cnt,
104 struct omap_device_pm_latency *pm_lats,
105 int pm_lats_cnt);
106static void omap_device_delete(struct omap_device *od);
107
108 102
109static struct omap_device_pm_latency omap_default_latency[] = { 103static struct omap_device_pm_latency omap_default_latency[] = {
110 { 104 {
@@ -320,8 +314,6 @@ static void _add_hwmod_clocks_clkdev(struct omap_device *od,
320} 314}
321 315
322 316
323static struct dev_pm_domain omap_device_pm_domain;
324
325/** 317/**
326 * omap_device_build_from_dt - build an omap_device with multiple hwmods 318 * omap_device_build_from_dt - build an omap_device with multiple hwmods
327 * @pdev_name: name of the platform_device driver to use 319 * @pdev_name: name of the platform_device driver to use
@@ -348,7 +340,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
348 340
349 oh_cnt = of_property_count_strings(node, "ti,hwmods"); 341 oh_cnt = of_property_count_strings(node, "ti,hwmods");
350 if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) { 342 if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) {
351 dev_warn(&pdev->dev, "No 'hwmods' to build omap_device\n"); 343 dev_dbg(&pdev->dev, "No 'hwmods' to build omap_device\n");
352 return -ENODEV; 344 return -ENODEV;
353 } 345 }
354 346
@@ -509,7 +501,7 @@ static int omap_device_fill_resources(struct omap_device *od,
509 * 501 *
510 * Returns an struct omap_device pointer or ERR_PTR() on error; 502 * Returns an struct omap_device pointer or ERR_PTR() on error;
511 */ 503 */
512static struct omap_device *omap_device_alloc(struct platform_device *pdev, 504struct omap_device *omap_device_alloc(struct platform_device *pdev,
513 struct omap_hwmod **ohs, int oh_cnt, 505 struct omap_hwmod **ohs, int oh_cnt,
514 struct omap_device_pm_latency *pm_lats, 506 struct omap_device_pm_latency *pm_lats,
515 int pm_lats_cnt) 507 int pm_lats_cnt)
@@ -591,7 +583,7 @@ oda_exit1:
591 return ERR_PTR(ret); 583 return ERR_PTR(ret);
592} 584}
593 585
594static void omap_device_delete(struct omap_device *od) 586void omap_device_delete(struct omap_device *od)
595{ 587{
596 if (!od) 588 if (!od)
597 return; 589 return;
@@ -619,7 +611,7 @@ static void omap_device_delete(struct omap_device *od)
619 * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise, 611 * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise,
620 * passes along the return value of omap_device_build_ss(). 612 * passes along the return value of omap_device_build_ss().
621 */ 613 */
622struct platform_device *omap_device_build(const char *pdev_name, int pdev_id, 614struct platform_device __init *omap_device_build(const char *pdev_name, int pdev_id,
623 struct omap_hwmod *oh, void *pdata, 615 struct omap_hwmod *oh, void *pdata,
624 int pdata_len, 616 int pdata_len,
625 struct omap_device_pm_latency *pm_lats, 617 struct omap_device_pm_latency *pm_lats,
@@ -652,7 +644,7 @@ struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
652 * platform_device record. Returns an ERR_PTR() on error, or passes 644 * platform_device record. Returns an ERR_PTR() on error, or passes
653 * along the return value of omap_device_register(). 645 * along the return value of omap_device_register().
654 */ 646 */
655struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id, 647struct platform_device __init *omap_device_build_ss(const char *pdev_name, int pdev_id,
656 struct omap_hwmod **ohs, int oh_cnt, 648 struct omap_hwmod **ohs, int oh_cnt,
657 void *pdata, int pdata_len, 649 void *pdata, int pdata_len,
658 struct omap_device_pm_latency *pm_lats, 650 struct omap_device_pm_latency *pm_lats,
@@ -717,7 +709,7 @@ odbs_exit:
717 * platform_early_add_device() on the underlying platform_device. 709 * platform_early_add_device() on the underlying platform_device.
718 * Returns 0 by default. 710 * Returns 0 by default.
719 */ 711 */
720static int omap_early_device_register(struct platform_device *pdev) 712static int __init omap_early_device_register(struct platform_device *pdev)
721{ 713{
722 struct platform_device *devices[1]; 714 struct platform_device *devices[1];
723 715
@@ -762,14 +754,12 @@ static int _od_suspend_noirq(struct device *dev)
762 struct omap_device *od = to_omap_device(pdev); 754 struct omap_device *od = to_omap_device(pdev);
763 int ret; 755 int ret;
764 756
765 if (od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND)
766 return pm_generic_suspend_noirq(dev);
767
768 ret = pm_generic_suspend_noirq(dev); 757 ret = pm_generic_suspend_noirq(dev);
769 758
770 if (!ret && !pm_runtime_status_suspended(dev)) { 759 if (!ret && !pm_runtime_status_suspended(dev)) {
771 if (pm_generic_runtime_suspend(dev) == 0) { 760 if (pm_generic_runtime_suspend(dev) == 0) {
772 omap_device_idle(pdev); 761 if (!(od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND))
762 omap_device_idle(pdev);
773 od->flags |= OMAP_DEVICE_SUSPENDED; 763 od->flags |= OMAP_DEVICE_SUSPENDED;
774 } 764 }
775 } 765 }
@@ -782,13 +772,11 @@ static int _od_resume_noirq(struct device *dev)
782 struct platform_device *pdev = to_platform_device(dev); 772 struct platform_device *pdev = to_platform_device(dev);
783 struct omap_device *od = to_omap_device(pdev); 773 struct omap_device *od = to_omap_device(pdev);
784 774
785 if (od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND)
786 return pm_generic_resume_noirq(dev);
787
788 if ((od->flags & OMAP_DEVICE_SUSPENDED) && 775 if ((od->flags & OMAP_DEVICE_SUSPENDED) &&
789 !pm_runtime_status_suspended(dev)) { 776 !pm_runtime_status_suspended(dev)) {
790 od->flags &= ~OMAP_DEVICE_SUSPENDED; 777 od->flags &= ~OMAP_DEVICE_SUSPENDED;
791 omap_device_enable(pdev); 778 if (!(od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND))
779 omap_device_enable(pdev);
792 pm_generic_runtime_resume(dev); 780 pm_generic_runtime_resume(dev);
793 } 781 }
794 782
@@ -799,7 +787,7 @@ static int _od_resume_noirq(struct device *dev)
799#define _od_resume_noirq NULL 787#define _od_resume_noirq NULL
800#endif 788#endif
801 789
802static struct dev_pm_domain omap_device_pm_domain = { 790struct dev_pm_domain omap_device_pm_domain = {
803 .ops = { 791 .ops = {
804 SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume, 792 SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume,
805 _od_runtime_idle) 793 _od_runtime_idle)
@@ -817,11 +805,10 @@ static struct dev_pm_domain omap_device_pm_domain = {
817 * platform_device_register() on the underlying platform_device. 805 * platform_device_register() on the underlying platform_device.
818 * Returns the return value of platform_device_register(). 806 * Returns the return value of platform_device_register().
819 */ 807 */
820static int omap_device_register(struct platform_device *pdev) 808int omap_device_register(struct platform_device *pdev)
821{ 809{
822 pr_debug("omap_device: %s: registering\n", pdev->name); 810 pr_debug("omap_device: %s: registering\n", pdev->name);
823 811
824 pdev->dev.parent = &omap_device_parent;
825 pdev->dev.pm_domain = &omap_device_pm_domain; 812 pdev->dev.pm_domain = &omap_device_pm_domain;
826 return platform_device_add(pdev); 813 return platform_device_add(pdev);
827} 814}
@@ -1130,11 +1117,6 @@ int omap_device_enable_clocks(struct omap_device *od)
1130 return 0; 1117 return 0;
1131} 1118}
1132 1119
1133struct device omap_device_parent = {
1134 .init_name = "omap",
1135 .parent = &platform_bus,
1136};
1137
1138static struct notifier_block platform_nb = { 1120static struct notifier_block platform_nb = {
1139 .notifier_call = _omap_device_notifier_call, 1121 .notifier_call = _omap_device_notifier_call,
1140}; 1122};
@@ -1142,6 +1124,6 @@ static struct notifier_block platform_nb = {
1142static int __init omap_device_init(void) 1124static int __init omap_device_init(void)
1143{ 1125{
1144 bus_register_notifier(&platform_bus_type, &platform_nb); 1126 bus_register_notifier(&platform_bus_type, &platform_nb);
1145 return device_register(&omap_device_parent); 1127 return 0;
1146} 1128}
1147core_initcall(omap_device_init); 1129core_initcall(omap_device_init);
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 4243bdcc87b..eec98afa0f8 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -31,11 +31,10 @@
31 31
32#include "sram.h" 32#include "sram.h"
33 33
34/* XXX These "sideways" includes are a sign that something is wrong */ 34/* XXX These "sideways" includes will disappear when sram.c becomes a driver */
35#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 35#include "../mach-omap2/iomap.h"
36# include "../mach-omap2/prm2xxx_3xxx.h" 36#include "../mach-omap2/prm2xxx_3xxx.h"
37# include "../mach-omap2/sdrc.h" 37#include "../mach-omap2/sdrc.h"
38#endif
39 38
40#define OMAP1_SRAM_PA 0x20000000 39#define OMAP1_SRAM_PA 0x20000000
41#define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800) 40#define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800)
@@ -86,7 +85,7 @@ static int is_sram_locked(void)
86 __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0); /* all i-read */ 85 __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0); /* all i-read */
87 __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */ 86 __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
88 } 87 }
89 if (cpu_is_omap34xx()) { 88 if (cpu_is_omap34xx() && !cpu_is_am33xx()) {
90 __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */ 89 __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
91 __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0); /* all i-read */ 90 __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0); /* all i-read */
92 __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */ 91 __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
@@ -124,7 +123,10 @@ static void __init omap_detect_sram(void)
124 omap_sram_size = 0x800; /* 2K */ 123 omap_sram_size = 0x800; /* 2K */
125 } 124 }
126 } else { 125 } else {
127 if (cpu_is_omap34xx()) { 126 if (cpu_is_am33xx()) {
127 omap_sram_start = AM33XX_SRAM_PA;
128 omap_sram_size = 0x10000; /* 64K */
129 } else if (cpu_is_omap34xx()) {
128 omap_sram_start = OMAP3_SRAM_PA; 130 omap_sram_start = OMAP3_SRAM_PA;
129 omap_sram_size = 0x10000; /* 64K */ 131 omap_sram_size = 0x10000; /* 64K */
130 } else if (cpu_is_omap44xx()) { 132 } else if (cpu_is_omap44xx()) {
@@ -368,6 +370,11 @@ static inline int omap34xx_sram_init(void)
368 return 0; 370 return 0;
369} 371}
370 372
373static inline int am33xx_sram_init(void)
374{
375 return 0;
376}
377
371int __init omap_sram_init(void) 378int __init omap_sram_init(void)
372{ 379{
373 omap_detect_sram(); 380 omap_detect_sram();
@@ -379,6 +386,8 @@ int __init omap_sram_init(void)
379 omap242x_sram_init(); 386 omap242x_sram_init();
380 else if (cpu_is_omap2430()) 387 else if (cpu_is_omap2430())
381 omap243x_sram_init(); 388 omap243x_sram_init();
389 else if (cpu_is_am33xx())
390 am33xx_sram_init();
382 else if (cpu_is_omap34xx()) 391 else if (cpu_is_omap34xx())
383 omap34xx_sram_init(); 392 omap34xx_sram_init();
384 393
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index f3570884883..d2bbfd1cb0b 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -29,6 +29,10 @@
29#include <plat/usb.h> 29#include <plat/usb.h>
30#include <plat/board.h> 30#include <plat/board.h>
31 31
32#include <mach/hardware.h>
33
34#include "../mach-omap2/common.h"
35
32#ifdef CONFIG_ARCH_OMAP_OTG 36#ifdef CONFIG_ARCH_OMAP_OTG
33 37
34void __init 38void __init
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index d8973ac46bc..21bf6adb919 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -4,7 +4,7 @@
4 4
5config PLAT_S3C24XX 5config PLAT_S3C24XX
6 bool 6 bool
7 depends on ARCH_S3C2410 7 depends on ARCH_S3C24XX
8 default y 8 default y
9 select NO_IOPORT 9 select NO_IOPORT
10 select ARCH_REQUIRE_GPIOLIB 10 select ARCH_REQUIRE_GPIOLIB
@@ -44,12 +44,6 @@ config S3C2410_CLOCK
44 Clock code for the S3C2410, and similar processors which 44 Clock code for the S3C2410, and similar processors which
45 is currently includes the S3C2410, S3C2440, S3C2442. 45 is currently includes the S3C2410, S3C2440, S3C2442.
46 46
47config S3C2443_CLOCK
48 bool
49 help
50 Clock code for the S3C2443 and similar processors, which includes
51 the S3C2416 and S3C2450.
52
53config S3C24XX_DCLK 47config S3C24XX_DCLK
54 bool 48 bool
55 help 49 help
@@ -76,15 +70,9 @@ config S3C24XX_GPIO_EXTRA128
76 Add an extra 128 gpio numbers to the available GPIO pool. This is 70 Add an extra 128 gpio numbers to the available GPIO pool. This is
77 available for boards that need extra gpios for external devices. 71 available for boards that need extra gpios for external devices.
78 72
79config PM_SIMTEC 73config S3C24XX_DMA
80 bool
81 help
82 Common power management code for systems that are
83 compatible with the Simtec style of power management
84
85config S3C2410_DMA
86 bool "S3C2410 DMA support" 74 bool "S3C2410 DMA support"
87 depends on ARCH_S3C2410 75 depends on ARCH_S3C24XX
88 select S3C_DMA 76 select S3C_DMA
89 help 77 help
90 S3C2410 DMA support. This is needed for drivers like sound which 78 S3C2410 DMA support. This is needed for drivers like sound which
@@ -93,31 +81,11 @@ config S3C2410_DMA
93 81
94config S3C2410_DMA_DEBUG 82config S3C2410_DMA_DEBUG
95 bool "S3C2410 DMA support debug" 83 bool "S3C2410 DMA support debug"
96 depends on ARCH_S3C2410 && S3C2410_DMA 84 depends on ARCH_S3C24XX && S3C2410_DMA
97 help 85 help
98 Enable debugging output for the DMA code. This option sends info 86 Enable debugging output for the DMA code. This option sends info
99 to the kernel log, at priority KERN_DEBUG. 87 to the kernel log, at priority KERN_DEBUG.
100 88
101# SPI default pin configuration code
102
103config S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13
104 bool
105 help
106 SPI GPIO configuration code for BUS0 when connected to
107 GPE11, GPE12 and GPE13.
108
109config S3C24XX_SPI_BUS1_GPG5_GPG6_GPG7
110 bool
111 help
112 SPI GPIO configuration code for BUS 1 when connected to
113 GPG5, GPG6 and GPG7.
114
115config S3C24XX_SPI_BUS1_GPD8_GPD9_GPD10
116 bool
117 help
118 SPI GPIO configuration code for BUS 1 when connected to
119 GPD8, GPD9 and GPD10.
120
121# common code for s3c24xx based machines, such as the SMDKs. 89# common code for s3c24xx based machines, such as the SMDKs.
122 90
123# cpu frequency items common between s3c2410 and s3c2440/s3c2442 91# cpu frequency items common between s3c2410 and s3c2440/s3c2442
@@ -145,21 +113,4 @@ config S3C2412_IOTIMING
145 Intel node to select io timing code that is common to the s3c2412 113 Intel node to select io timing code that is common to the s3c2412
146 and the s3c2443. 114 and the s3c2443.
147 115
148config MACH_SMDK
149 bool
150 help
151 Common machine code for SMDK2410 and SMDK2440
152
153config S3C24XX_SIMTEC_AUDIO
154 bool
155 depends on (ARCH_BAST || MACH_VR1000 || MACH_OSIRIS || MACH_ANUBIS)
156 default y
157 help
158 Add audio devices for common Simtec S3C24XX boards
159
160config S3C2410_SETUP_TS
161 bool
162 help
163 Compile in platform device definition for Samsung TouchScreen.
164
165endif 116endif
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
index b2b01125de6..2467b800cc7 100644
--- a/arch/arm/plat-s3c24xx/Makefile
+++ b/arch/arm/plat-s3c24xx/Makefile
@@ -23,28 +23,11 @@ obj-$(CONFIG_CPU_FREQ_S3C24XX_DEBUGFS) += cpu-freq-debugfs.o
23 23
24# Architecture dependent builds 24# Architecture dependent builds
25 25
26obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o
27obj-$(CONFIG_PM) += pm.o 26obj-$(CONFIG_PM) += pm.o
28obj-$(CONFIG_PM) += irq-pm.o 27obj-$(CONFIG_PM) += irq-pm.o
29obj-$(CONFIG_PM) += sleep.o 28obj-$(CONFIG_PM) += sleep.o
30obj-$(CONFIG_S3C2410_CLOCK) += s3c2410-clock.o 29obj-$(CONFIG_S3C2410_CLOCK) += s3c2410-clock.o
31obj-$(CONFIG_S3C2443_CLOCK) += s3c2443-clock.o 30obj-$(CONFIG_S3C24XX_DMA) += dma.o
32obj-$(CONFIG_S3C2410_DMA) += dma.o
33obj-$(CONFIG_S3C2410_IOTIMING) += s3c2410-iotiming.o 31obj-$(CONFIG_S3C2410_IOTIMING) += s3c2410-iotiming.o
34obj-$(CONFIG_S3C2412_IOTIMING) += s3c2412-iotiming.o 32obj-$(CONFIG_S3C2412_IOTIMING) += s3c2412-iotiming.o
35obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += s3c2410-cpufreq-utils.o 33obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += s3c2410-cpufreq-utils.o
36
37# device specific setup and/or initialisation
38obj-$(CONFIG_ARCH_S3C2410) += setup-i2c.o
39obj-$(CONFIG_S3C2410_SETUP_TS) += setup-ts.o
40
41# SPI gpio central GPIO functions
42
43obj-$(CONFIG_S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13) += spi-bus0-gpe11_12_13.o
44obj-$(CONFIG_S3C24XX_SPI_BUS1_GPG5_GPG6_GPG7) += spi-bus1-gpg5_6_7.o
45obj-$(CONFIG_S3C24XX_SPI_BUS1_GPD8_GPD9_GPD10) += spi-bus1-gpd8_9_10.o
46
47# machine common support
48
49obj-$(CONFIG_MACH_SMDK) += common-smdk.o
50obj-$(CONFIG_S3C24XX_SIMTEC_AUDIO) += simtec-audio.o
diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
index 21f1fda8b66..32a09931350 100644
--- a/arch/arm/plat-s3c24xx/cpu.c
+++ b/arch/arm/plat-s3c24xx/cpu.c
@@ -32,6 +32,7 @@
32#include <linux/io.h> 32#include <linux/io.h>
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/regs-clock.h>
35#include <asm/irq.h> 36#include <asm/irq.h>
36#include <asm/cacheflush.h> 37#include <asm/cacheflush.h>
37 38
@@ -190,8 +191,34 @@ static unsigned long s3c24xx_read_idcode_v4(void)
190 return __raw_readl(S3C2410_GSTATUS1); 191 return __raw_readl(S3C2410_GSTATUS1);
191} 192}
192 193
194static void s3c24xx_default_idle(void)
195{
196 unsigned long tmp;
197 int i;
198
199 /* idle the system by using the idle mode which will wait for an
200 * interrupt to happen before restarting the system.
201 */
202
203 /* Warning: going into idle state upsets jtag scanning */
204
205 __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
206 S3C2410_CLKCON);
207
208 /* the samsung port seems to do a loop and then unset idle.. */
209 for (i = 0; i < 50; i++)
210 tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
211
212 /* this bit is not cleared on re-start... */
213
214 __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
215 S3C2410_CLKCON);
216}
217
193void __init s3c24xx_init_io(struct map_desc *mach_desc, int size) 218void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
194{ 219{
220 arm_pm_idle = s3c24xx_default_idle;
221
195 /* initialise the io descriptors we need for initialisation */ 222 /* initialise the io descriptors we need for initialisation */
196 iotable_init(mach_desc, size); 223 iotable_init(mach_desc, size);
197 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc)); 224 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
diff --git a/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c b/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c
deleted file mode 100644
index 704175b0573..00000000000
--- a/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c
+++ /dev/null
@@ -1,36 +0,0 @@
1/* linux/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX SPI - gpio configuration for bus 0 on gpe11,12,13
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.
12*/
13
14#include <linux/kernel.h>
15#include <linux/gpio.h>
16
17#include <mach/spi.h>
18#include <mach/regs-gpio.h>
19
20void s3c24xx_spi_gpiocfg_bus0_gpe11_12_13(struct s3c2410_spi_info *spi,
21 int enable)
22{
23 if (enable) {
24 s3c_gpio_cfgpin(S3C2410_GPE(13), S3C2410_GPE13_SPICLK0);
25 s3c_gpio_cfgpin(S3C2410_GPE(12), S3C2410_GPE12_SPIMOSI0);
26 s3c_gpio_cfgpin(S3C2410_GPE(11), S3C2410_GPE11_SPIMISO0);
27 s3c2410_gpio_pullup(S3C2410_GPE(11), 0);
28 s3c2410_gpio_pullup(S3C2410_GPE(13), 0);
29 } else {
30 s3c_gpio_cfgpin(S3C2410_GPE(13), S3C2410_GPIO_INPUT);
31 s3c_gpio_cfgpin(S3C2410_GPE(11), S3C2410_GPIO_INPUT);
32 s3c_gpio_setpull(S3C2410_GPE(11), S3C_GPIO_PULL_NONE);
33 s3c_gpio_setpull(S3C2410_GPE(12), S3C_GPIO_PULL_NONE);
34 s3c_gpio_setpull(S3C2410_GPE(13), S3C_GPIO_PULL_NONE);
35 }
36}
diff --git a/arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c b/arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c
deleted file mode 100644
index 72457afd625..00000000000
--- a/arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/* linux/arch/arm/plat-s3c24xx/spi-bus0-gpd8_9_10.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX SPI - gpio configuration for bus 1 on gpd8,9,10
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.
12*/
13
14#include <linux/kernel.h>
15#include <linux/gpio.h>
16
17#include <mach/spi.h>
18#include <mach/regs-gpio.h>
19
20void s3c24xx_spi_gpiocfg_bus1_gpd8_9_10(struct s3c2410_spi_info *spi,
21 int enable)
22{
23
24 printk(KERN_INFO "%s(%d)\n", __func__, enable);
25 if (enable) {
26 s3c_gpio_cfgpin(S3C2410_GPD(10), S3C2440_GPD10_SPICLK1);
27 s3c_gpio_cfgpin(S3C2410_GPD(9), S3C2440_GPD9_SPIMOSI1);
28 s3c_gpio_cfgpin(S3C2410_GPD(8), S3C2440_GPD8_SPIMISO1);
29 s3c2410_gpio_pullup(S3C2410_GPD(10), 0);
30 s3c2410_gpio_pullup(S3C2410_GPD(9), 0);
31 } else {
32 s3c_gpio_cfgpin(S3C2410_GPD(8), S3C2410_GPIO_INPUT);
33 s3c_gpio_cfgpin(S3C2410_GPD(9), S3C2410_GPIO_INPUT);
34 s3c_gpio_setpull(S3C2410_GPD(10), S3C_GPIO_PULL_NONE);
35 s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
36 s3c_gpio_setpull(S3C2410_GPD(8), S3C_GPIO_PULL_NONE);
37 }
38}
diff --git a/arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c b/arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c
deleted file mode 100644
index c3972b645d1..00000000000
--- a/arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c
+++ /dev/null
@@ -1,36 +0,0 @@
1/* linux/arch/arm/plat-s3c24xx/spi-bus0-gpg5_6_7.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX SPI - gpio configuration for bus 1 on gpg5,6,7
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.
12*/
13
14#include <linux/kernel.h>
15#include <linux/gpio.h>
16
17#include <mach/spi.h>
18#include <mach/regs-gpio.h>
19
20void s3c24xx_spi_gpiocfg_bus1_gpg5_6_7(struct s3c2410_spi_info *spi,
21 int enable)
22{
23 if (enable) {
24 s3c_gpio_cfgpin(S3C2410_GPG(7), S3C2410_GPG7_SPICLK1);
25 s3c_gpio_cfgpin(S3C2410_GPG(6), S3C2410_GPG6_SPIMOSI1);
26 s3c_gpio_cfgpin(S3C2410_GPG(5), S3C2410_GPG5_SPIMISO1);
27 s3c2410_gpio_pullup(S3C2410_GPG(5), 0);
28 s3c2410_gpio_pullup(S3C2410_GPG(6), 0);
29 } else {
30 s3c_gpio_cfgpin(S3C2410_GPG(7), S3C2410_GPIO_INPUT);
31 s3c_gpio_cfgpin(S3C2410_GPG(5), S3C2410_GPIO_INPUT);
32 s3c_gpio_setpull(S3C2410_GPG(5), S3C_GPIO_PULL_NONE);
33 s3c_gpio_setpull(S3C2410_GPG(6), S3C_GPIO_PULL_NONE);
34 s3c_gpio_setpull(S3C2410_GPG(7), S3C_GPIO_PULL_NONE);
35 }
36}
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index 8167ce66188..7a308699f81 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -80,6 +80,16 @@ config S5P_DEV_FIMC3
80 help 80 help
81 Compile in platform device definitions for FIMC controller 3 81 Compile in platform device definitions for FIMC controller 3
82 82
83config S5P_DEV_JPEG
84 bool
85 help
86 Compile in platform device definitions for JPEG codec
87
88config S5P_DEV_G2D
89 bool
90 help
91 Compile in platform device definitions for G2D device
92
83config S5P_DEV_FIMD0 93config S5P_DEV_FIMD0
84 bool 94 bool
85 help 95 help
diff --git a/arch/arm/plat-s5p/irq-eint.c b/arch/arm/plat-s5p/irq-eint.c
index c496b359c37..139c050918c 100644
--- a/arch/arm/plat-s5p/irq-eint.c
+++ b/arch/arm/plat-s5p/irq-eint.c
@@ -200,7 +200,7 @@ static struct irq_chip s5p_irq_vic_eint = {
200#endif 200#endif
201}; 201};
202 202
203int __init s5p_init_irq_eint(void) 203static int __init s5p_init_irq_eint(void)
204{ 204{
205 int irq; 205 int irq;
206 206
diff --git a/arch/arm/plat-s5p/irq-gpioint.c b/arch/arm/plat-s5p/irq-gpioint.c
index 1fdfaa4599c..82c7311017a 100644
--- a/arch/arm/plat-s5p/irq-gpioint.c
+++ b/arch/arm/plat-s5p/irq-gpioint.c
@@ -41,7 +41,7 @@ struct s5p_gpioint_bank {
41 void (*handler)(unsigned int, struct irq_desc *); 41 void (*handler)(unsigned int, struct irq_desc *);
42}; 42};
43 43
44LIST_HEAD(banks); 44static LIST_HEAD(banks);
45 45
46static int s5p_gpioint_set_type(struct irq_data *d, unsigned int type) 46static int s5p_gpioint_set_type(struct irq_data *d, unsigned int type)
47{ 47{
diff --git a/arch/arm/plat-s5p/sleep.S b/arch/arm/plat-s5p/sleep.S
index 0fd591bfc9f..006bd01eda0 100644
--- a/arch/arm/plat-s5p/sleep.S
+++ b/arch/arm/plat-s5p/sleep.S
@@ -23,9 +23,18 @@
23*/ 23*/
24 24
25#include <linux/linkage.h> 25#include <linux/linkage.h>
26#include <asm/assembler.h> 26#include <asm/asm-offsets.h>
27#include <asm/hardware/cache-l2x0.h>
27 28
28 .text 29/*
30 * The following code is located into the .data section. This is to
31 * allow l2x0_regs_phys to be accessed with a relative load while we
32 * can't rely on any MMU translation. We could have put l2x0_regs_phys
33 * in the .text section as well, but some setups might insist on it to
34 * be truly read-only. (Reference from: arch/arm/kernel/sleep.S)
35 */
36 .data
37 .align
29 38
30 /* 39 /*
31 * sleep magic, to allow the bootloader to check for an valid 40 * sleep magic, to allow the bootloader to check for an valid
@@ -39,11 +48,34 @@
39 * s3c_cpu_resume 48 * s3c_cpu_resume
40 * 49 *
41 * resume code entry for bootloader to call 50 * resume code entry for bootloader to call
42 *
43 * we must put this code here in the data segment as we have no
44 * other way of restoring the stack pointer after sleep, and we
45 * must not write to the code segment (code is read-only)
46 */ 51 */
47 52
48ENTRY(s3c_cpu_resume) 53ENTRY(s3c_cpu_resume)
54#ifdef CONFIG_CACHE_L2X0
55 adr r0, l2x0_regs_phys
56 ldr r0, [r0]
57 ldr r1, [r0, #L2X0_R_PHY_BASE]
58 ldr r2, [r1, #L2X0_CTRL]
59 tst r2, #0x1
60 bne resume_l2on
61 ldr r2, [r0, #L2X0_R_AUX_CTRL]
62 str r2, [r1, #L2X0_AUX_CTRL]
63 ldr r2, [r0, #L2X0_R_TAG_LATENCY]
64 str r2, [r1, #L2X0_TAG_LATENCY_CTRL]
65 ldr r2, [r0, #L2X0_R_DATA_LATENCY]
66 str r2, [r1, #L2X0_DATA_LATENCY_CTRL]
67 ldr r2, [r0, #L2X0_R_PREFETCH_CTRL]
68 str r2, [r1, #L2X0_PREFETCH_CTRL]
69 ldr r2, [r0, #L2X0_R_PWR_CTRL]
70 str r2, [r1, #L2X0_POWER_CTRL]
71 mov r2, #1
72 str r2, [r1, #L2X0_CTRL]
73resume_l2on:
74#endif
49 b cpu_resume 75 b cpu_resume
76ENDPROC(s3c_cpu_resume)
77#ifdef CONFIG_CACHE_L2X0
78 .globl l2x0_regs_phys
79l2x0_regs_phys:
80 .long 0
81#endif
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 6a2abe67c8b..71553f41001 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -205,7 +205,7 @@ config S3C_DEV_USB_HSOTG
205 205
206config S3C_DEV_WDT 206config S3C_DEV_WDT
207 bool 207 bool
208 default y if ARCH_S3C2410 208 default y if ARCH_S3C24XX
209 help 209 help
210 Complie in platform device definition for Watchdog Timer 210 Complie in platform device definition for Watchdog Timer
211 211
@@ -264,7 +264,7 @@ config SAMSUNG_DEV_KEYPAD
264 264
265config SAMSUNG_DEV_PWM 265config SAMSUNG_DEV_PWM
266 bool 266 bool
267 default y if ARCH_S3C2410 267 default y if ARCH_S3C24XX
268 help 268 help
269 Compile in platform device definition for PWM Timer 269 Compile in platform device definition for PWM Timer
270 270
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index 10f71179071..65c5eca475e 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -84,31 +84,35 @@ static int clk_null_enable(struct clk *clk, int enable)
84 84
85int clk_enable(struct clk *clk) 85int clk_enable(struct clk *clk)
86{ 86{
87 unsigned long flags;
88
87 if (IS_ERR(clk) || clk == NULL) 89 if (IS_ERR(clk) || clk == NULL)
88 return -EINVAL; 90 return -EINVAL;
89 91
90 clk_enable(clk->parent); 92 clk_enable(clk->parent);
91 93
92 spin_lock(&clocks_lock); 94 spin_lock_irqsave(&clocks_lock, flags);
93 95
94 if ((clk->usage++) == 0) 96 if ((clk->usage++) == 0)
95 (clk->enable)(clk, 1); 97 (clk->enable)(clk, 1);
96 98
97 spin_unlock(&clocks_lock); 99 spin_unlock_irqrestore(&clocks_lock, flags);
98 return 0; 100 return 0;
99} 101}
100 102
101void clk_disable(struct clk *clk) 103void clk_disable(struct clk *clk)
102{ 104{
105 unsigned long flags;
106
103 if (IS_ERR(clk) || clk == NULL) 107 if (IS_ERR(clk) || clk == NULL)
104 return; 108 return;
105 109
106 spin_lock(&clocks_lock); 110 spin_lock_irqsave(&clocks_lock, flags);
107 111
108 if ((--clk->usage) == 0) 112 if ((--clk->usage) == 0)
109 (clk->enable)(clk, 0); 113 (clk->enable)(clk, 0);
110 114
111 spin_unlock(&clocks_lock); 115 spin_unlock_irqrestore(&clocks_lock, flags);
112 clk_disable(clk->parent); 116 clk_disable(clk->parent);
113} 117}
114 118
diff --git a/arch/arm/plat-samsung/dev-backlight.c b/arch/arm/plat-samsung/dev-backlight.c
index a976c023b28..5f197dcaf10 100644
--- a/arch/arm/plat-samsung/dev-backlight.c
+++ b/arch/arm/plat-samsung/dev-backlight.c
@@ -77,7 +77,7 @@ static struct platform_device samsung_dfl_bl_device __initdata = {
77 * @gpio_info: structure containing GPIO info for PWM timer 77 * @gpio_info: structure containing GPIO info for PWM timer
78 * @bl_data: structure containing Backlight control data 78 * @bl_data: structure containing Backlight control data
79 */ 79 */
80void samsung_bl_set(struct samsung_bl_gpio_info *gpio_info, 80void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
81 struct platform_pwm_backlight_data *bl_data) 81 struct platform_pwm_backlight_data *bl_data)
82{ 82{
83 int ret = 0; 83 int ret = 0;
@@ -115,6 +115,8 @@ void samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
115 samsung_bl_data->init = bl_data->init; 115 samsung_bl_data->init = bl_data->init;
116 if (bl_data->notify) 116 if (bl_data->notify)
117 samsung_bl_data->notify = bl_data->notify; 117 samsung_bl_data->notify = bl_data->notify;
118 if (bl_data->notify_after)
119 samsung_bl_data->notify_after = bl_data->notify_after;
118 if (bl_data->exit) 120 if (bl_data->exit)
119 samsung_bl_data->exit = bl_data->exit; 121 samsung_bl_data->exit = bl_data->exit;
120 if (bl_data->check_fb) 122 if (bl_data->check_fb)
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index d21d744e4d9..8b928f9bc1c 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -57,6 +57,7 @@
57#include <plat/sdhci.h> 57#include <plat/sdhci.h>
58#include <plat/ts.h> 58#include <plat/ts.h>
59#include <plat/udc.h> 59#include <plat/udc.h>
60#include <plat/udc-hs.h>
60#include <plat/usb-control.h> 61#include <plat/usb-control.h>
61#include <plat/usb-phy.h> 62#include <plat/usb-phy.h>
62#include <plat/regs-iic.h> 63#include <plat/regs-iic.h>
@@ -267,6 +268,52 @@ struct platform_device s5p_device_fimc3 = {
267}; 268};
268#endif /* CONFIG_S5P_DEV_FIMC3 */ 269#endif /* CONFIG_S5P_DEV_FIMC3 */
269 270
271/* G2D */
272
273#ifdef CONFIG_S5P_DEV_G2D
274static struct resource s5p_g2d_resource[] = {
275 [0] = {
276 .start = S5P_PA_G2D,
277 .end = S5P_PA_G2D + SZ_4K - 1,
278 .flags = IORESOURCE_MEM,
279 },
280 [1] = {
281 .start = IRQ_2D,
282 .end = IRQ_2D,
283 .flags = IORESOURCE_IRQ,
284 },
285};
286
287struct platform_device s5p_device_g2d = {
288 .name = "s5p-g2d",
289 .id = 0,
290 .num_resources = ARRAY_SIZE(s5p_g2d_resource),
291 .resource = s5p_g2d_resource,
292 .dev = {
293 .dma_mask = &samsung_device_dma_mask,
294 .coherent_dma_mask = DMA_BIT_MASK(32),
295 },
296};
297#endif /* CONFIG_S5P_DEV_G2D */
298
299#ifdef CONFIG_S5P_DEV_JPEG
300static struct resource s5p_jpeg_resource[] = {
301 [0] = DEFINE_RES_MEM(S5P_PA_JPEG, SZ_4K),
302 [1] = DEFINE_RES_IRQ(IRQ_JPEG),
303};
304
305struct platform_device s5p_device_jpeg = {
306 .name = "s5p-jpeg",
307 .id = 0,
308 .num_resources = ARRAY_SIZE(s5p_jpeg_resource),
309 .resource = s5p_jpeg_resource,
310 .dev = {
311 .dma_mask = &samsung_device_dma_mask,
312 .coherent_dma_mask = DMA_BIT_MASK(32),
313 },
314};
315#endif /* CONFIG_S5P_DEV_JPEG */
316
270/* FIMD0 */ 317/* FIMD0 */
271 318
272#ifdef CONFIG_S5P_DEV_FIMD0 319#ifdef CONFIG_S5P_DEV_FIMD0
@@ -744,17 +791,6 @@ struct platform_device s3c_device_iis = {
744}; 791};
745#endif /* CONFIG_PLAT_S3C24XX */ 792#endif /* CONFIG_PLAT_S3C24XX */
746 793
747#ifdef CONFIG_CPU_S3C2440
748struct platform_device s3c2412_device_iis = {
749 .name = "s3c2412-iis",
750 .id = -1,
751 .dev = {
752 .dma_mask = &samsung_device_dma_mask,
753 .coherent_dma_mask = DMA_BIT_MASK(32),
754 }
755};
756#endif /* CONFIG_CPU_S3C2440 */
757
758/* IDE CFCON */ 794/* IDE CFCON */
759 795
760#ifdef CONFIG_SAMSUNG_DEV_IDE 796#ifdef CONFIG_SAMSUNG_DEV_IDE
@@ -769,7 +805,7 @@ struct platform_device s3c_device_cfcon = {
769 .resource = s3c_cfcon_resource, 805 .resource = s3c_cfcon_resource,
770}; 806};
771 807
772void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata) 808void __init s3c_ide_set_platdata(struct s3c_ide_platdata *pdata)
773{ 809{
774 s3c_set_platdata(pdata, sizeof(struct s3c_ide_platdata), 810 s3c_set_platdata(pdata, sizeof(struct s3c_ide_platdata),
775 &s3c_device_cfcon); 811 &s3c_device_cfcon);
@@ -887,7 +923,7 @@ struct platform_device s5p_device_mfc_r = {
887 923
888#ifdef CONFIG_S5P_DEV_CSIS0 924#ifdef CONFIG_S5P_DEV_CSIS0
889static struct resource s5p_mipi_csis0_resource[] = { 925static struct resource s5p_mipi_csis0_resource[] = {
890 [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS0, SZ_4K), 926 [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS0, SZ_16K),
891 [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS0), 927 [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS0),
892}; 928};
893 929
@@ -901,7 +937,7 @@ struct platform_device s5p_device_mipi_csis0 = {
901 937
902#ifdef CONFIG_S5P_DEV_CSIS1 938#ifdef CONFIG_S5P_DEV_CSIS1
903static struct resource s5p_mipi_csis1_resource[] = { 939static struct resource s5p_mipi_csis1_resource[] = {
904 [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS1, SZ_4K), 940 [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS1, SZ_16K),
905 [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS1), 941 [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS1),
906}; 942};
907 943
@@ -1049,7 +1085,7 @@ struct platform_device s3c64xx_device_onenand1 = {
1049 .resource = s3c64xx_onenand1_resources, 1085 .resource = s3c64xx_onenand1_resources,
1050}; 1086};
1051 1087
1052void s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata) 1088void __init s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata)
1053{ 1089{
1054 s3c_set_platdata(pdata, sizeof(struct onenand_platform_data), 1090 s3c_set_platdata(pdata, sizeof(struct onenand_platform_data),
1055 &s3c64xx_device_onenand1); 1091 &s3c64xx_device_onenand1);
@@ -1078,7 +1114,7 @@ static struct resource s5p_pmu_resource[] = {
1078 DEFINE_RES_IRQ(IRQ_PMU) 1114 DEFINE_RES_IRQ(IRQ_PMU)
1079}; 1115};
1080 1116
1081struct platform_device s5p_device_pmu = { 1117static struct platform_device s5p_device_pmu = {
1082 .name = "arm-pmu", 1118 .name = "arm-pmu",
1083 .id = ARM_PMU_DEVICE_CPU, 1119 .id = ARM_PMU_DEVICE_CPU,
1084 .num_resources = ARRAY_SIZE(s5p_pmu_resource), 1120 .num_resources = ARRAY_SIZE(s5p_pmu_resource),
@@ -1423,6 +1459,19 @@ struct platform_device s3c_device_usb_hsotg = {
1423 .coherent_dma_mask = DMA_BIT_MASK(32), 1459 .coherent_dma_mask = DMA_BIT_MASK(32),
1424 }, 1460 },
1425}; 1461};
1462
1463void __init s3c_hsotg_set_platdata(struct s3c_hsotg_plat *pd)
1464{
1465 struct s3c_hsotg_plat *npd;
1466
1467 npd = s3c_set_platdata(pd, sizeof(struct s3c_hsotg_plat),
1468 &s3c_device_usb_hsotg);
1469
1470 if (!npd->phy_init)
1471 npd->phy_init = s5p_usb_phy_init;
1472 if (!npd->phy_exit)
1473 npd->phy_exit = s5p_usb_phy_exit;
1474}
1426#endif /* CONFIG_S3C_DEV_USB_HSOTG */ 1475#endif /* CONFIG_S3C_DEV_USB_HSOTG */
1427 1476
1428/* USB High Spped 2.0 Device (Gadget) */ 1477/* USB High Spped 2.0 Device (Gadget) */
diff --git a/arch/arm/plat-samsung/dma-ops.c b/arch/arm/plat-samsung/dma-ops.c
index 0747c77a2fd..301d9c319d0 100644
--- a/arch/arm/plat-samsung/dma-ops.c
+++ b/arch/arm/plat-samsung/dma-ops.c
@@ -116,7 +116,7 @@ static inline int samsung_dmadev_flush(unsigned ch)
116 return dmaengine_terminate_all((struct dma_chan *)ch); 116 return dmaengine_terminate_all((struct dma_chan *)ch);
117} 117}
118 118
119struct samsung_dma_ops dmadev_ops = { 119static struct samsung_dma_ops dmadev_ops = {
120 .request = samsung_dmadev_request, 120 .request = samsung_dmadev_request,
121 .release = samsung_dmadev_release, 121 .release = samsung_dmadev_release,
122 .prepare = samsung_dmadev_prepare, 122 .prepare = samsung_dmadev_prepare,
diff --git a/arch/arm/plat-samsung/include/plat/audio-simtec.h b/arch/arm/plat-samsung/include/plat/audio-simtec.h
index 5345364e742..376af5286a3 100644
--- a/arch/arm/plat-samsung/include/plat/audio-simtec.h
+++ b/arch/arm/plat-samsung/include/plat/audio-simtec.h
@@ -32,6 +32,3 @@ struct s3c24xx_audio_simtec_pdata {
32 32
33 void (*startup)(void); 33 void (*startup)(void);
34}; 34};
35
36extern int simtec_audio_add(const char *codec_name, bool has_lr_routing,
37 struct s3c24xx_audio_simtec_pdata *pdata);
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h
index 73c66d4d10f..a62753dc15b 100644
--- a/arch/arm/plat-samsung/include/plat/clock.h
+++ b/arch/arm/plat-samsung/include/plat/clock.h
@@ -79,6 +79,10 @@ extern struct clk clk_epll;
79extern struct clk clk_xtal; 79extern struct clk clk_xtal;
80extern struct clk clk_ext; 80extern struct clk clk_ext;
81 81
82/* S3C2443/S3C2416 specific clocks */
83extern struct clksrc_clk clk_epllref;
84extern struct clksrc_clk clk_esysclk;
85
82/* S3C64XX specific clocks */ 86/* S3C64XX specific clocks */
83extern struct clk clk_h2; 87extern struct clk clk_h2;
84extern struct clk clk_27m; 88extern struct clk clk_27m;
@@ -114,7 +118,23 @@ extern void s3c24xx_setup_clocks(unsigned long fclk,
114extern void s3c2410_setup_clocks(void); 118extern void s3c2410_setup_clocks(void);
115extern void s3c2412_setup_clocks(void); 119extern void s3c2412_setup_clocks(void);
116extern void s3c244x_setup_clocks(void); 120extern void s3c244x_setup_clocks(void);
117extern void s3c2443_setup_clocks(void); 121
122/* S3C2410 specific clock functions */
123
124extern int s3c2410_baseclk_add(void);
125
126/* S3C2443/S3C2416 specific clock functions */
127
128typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base);
129
130extern void s3c2443_common_setup_clocks(pll_fn get_mpll);
131extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
132 unsigned int *divs, int nr_divs,
133 int divmask);
134
135extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable);
136extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable);
137extern int s3c2443_clkcon_enable_s(struct clk *clk, int enable);
118 138
119/* S3C64XX specific functions and clocks */ 139/* S3C64XX specific functions and clocks */
120 140
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index 4214ea0ff8f..5e7972de3ed 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -79,6 +79,8 @@ extern struct platform_device s5p_device_fimc1;
79extern struct platform_device s5p_device_fimc2; 79extern struct platform_device s5p_device_fimc2;
80extern struct platform_device s5p_device_fimc3; 80extern struct platform_device s5p_device_fimc3;
81extern struct platform_device s5p_device_fimc_md; 81extern struct platform_device s5p_device_fimc_md;
82extern struct platform_device s5p_device_jpeg;
83extern struct platform_device s5p_device_g2d;
82extern struct platform_device s5p_device_fimd0; 84extern struct platform_device s5p_device_fimd0;
83extern struct platform_device s5p_device_hdmi; 85extern struct platform_device s5p_device_hdmi;
84extern struct platform_device s5p_device_i2c_hdmiphy; 86extern struct platform_device s5p_device_i2c_hdmiphy;
diff --git a/arch/arm/plat-samsung/include/plat/dma-pl330.h b/arch/arm/plat-samsung/include/plat/dma-pl330.h
index c5eaad529de..0670f37aaae 100644
--- a/arch/arm/plat-samsung/include/plat/dma-pl330.h
+++ b/arch/arm/plat-samsung/include/plat/dma-pl330.h
@@ -82,6 +82,22 @@ enum dma_ch {
82 DMACH_SLIMBUS4_TX, 82 DMACH_SLIMBUS4_TX,
83 DMACH_SLIMBUS5_RX, 83 DMACH_SLIMBUS5_RX,
84 DMACH_SLIMBUS5_TX, 84 DMACH_SLIMBUS5_TX,
85 DMACH_MIPI_HSI0,
86 DMACH_MIPI_HSI1,
87 DMACH_MIPI_HSI2,
88 DMACH_MIPI_HSI3,
89 DMACH_MIPI_HSI4,
90 DMACH_MIPI_HSI5,
91 DMACH_MIPI_HSI6,
92 DMACH_MIPI_HSI7,
93 DMACH_MTOM_0,
94 DMACH_MTOM_1,
95 DMACH_MTOM_2,
96 DMACH_MTOM_3,
97 DMACH_MTOM_4,
98 DMACH_MTOM_5,
99 DMACH_MTOM_6,
100 DMACH_MTOM_7,
85 /* END Marker, also used to denote a reserved channel */ 101 /* END Marker, also used to denote a reserved channel */
86 DMACH_MAX, 102 DMACH_MAX,
87}; 103};
diff --git a/arch/arm/plat-samsung/include/plat/regs-dma.h b/arch/arm/plat-samsung/include/plat/regs-dma.h
index 178bccbe480..a7d622ef16a 100644
--- a/arch/arm/plat-samsung/include/plat/regs-dma.h
+++ b/arch/arm/plat-samsung/include/plat/regs-dma.h
@@ -119,7 +119,7 @@
119#define S3C2412_DMAREQSEL_UART2_1 S3C2412_DMAREQSEL_SRC(24) 119#define S3C2412_DMAREQSEL_UART2_1 S3C2412_DMAREQSEL_SRC(24)
120#endif /* CONFIG_CPU_S3C2412 */ 120#endif /* CONFIG_CPU_S3C2412 */
121 121
122#ifdef CONFIG_CPU_S3C2443 122#if defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2443)
123 123
124#define S3C2443_DMAREQSEL_SRC(x) ((x) << 1) 124#define S3C2443_DMAREQSEL_SRC(x) ((x) << 1)
125 125
diff --git a/arch/arm/plat-samsung/include/plat/regs-fb.h b/arch/arm/plat-samsung/include/plat/regs-fb.h
index 8f39aa5b26e..9a78012d6f4 100644
--- a/arch/arm/plat-samsung/include/plat/regs-fb.h
+++ b/arch/arm/plat-samsung/include/plat/regs-fb.h
@@ -91,6 +91,9 @@
91#define VIDCON1_VSTATUS_BACKPORCH (0x1 << 13) 91#define VIDCON1_VSTATUS_BACKPORCH (0x1 << 13)
92#define VIDCON1_VSTATUS_ACTIVE (0x2 << 13) 92#define VIDCON1_VSTATUS_ACTIVE (0x2 << 13)
93#define VIDCON1_VSTATUS_FRONTPORCH (0x0 << 13) 93#define VIDCON1_VSTATUS_FRONTPORCH (0x0 << 13)
94#define VIDCON1_VCLK_MASK (0x3 << 9)
95#define VIDCON1_VCLK_HOLD (0x0 << 9)
96#define VIDCON1_VCLK_RUN (0x1 << 9)
94 97
95#define VIDCON1_INV_VCLK (1 << 7) 98#define VIDCON1_INV_VCLK (1 << 7)
96#define VIDCON1_INV_HSYNC (1 << 6) 99#define VIDCON1_INV_HSYNC (1 << 6)
@@ -164,15 +167,17 @@
164#define VIDTCON1_HSPW(_x) ((_x) << 0) 167#define VIDTCON1_HSPW(_x) ((_x) << 0)
165 168
166#define VIDTCON2 (0x18) 169#define VIDTCON2 (0x18)
170#define VIDTCON2_LINEVAL_E(_x) ((((_x) & 0x800) >> 11) << 23)
167#define VIDTCON2_LINEVAL_MASK (0x7ff << 11) 171#define VIDTCON2_LINEVAL_MASK (0x7ff << 11)
168#define VIDTCON2_LINEVAL_SHIFT (11) 172#define VIDTCON2_LINEVAL_SHIFT (11)
169#define VIDTCON2_LINEVAL_LIMIT (0x7ff) 173#define VIDTCON2_LINEVAL_LIMIT (0x7ff)
170#define VIDTCON2_LINEVAL(_x) ((_x) << 11) 174#define VIDTCON2_LINEVAL(_x) (((_x) & 0x7ff) << 11)
171 175
176#define VIDTCON2_HOZVAL_E(_x) ((((_x) & 0x800) >> 11) << 22)
172#define VIDTCON2_HOZVAL_MASK (0x7ff << 0) 177#define VIDTCON2_HOZVAL_MASK (0x7ff << 0)
173#define VIDTCON2_HOZVAL_SHIFT (0) 178#define VIDTCON2_HOZVAL_SHIFT (0)
174#define VIDTCON2_HOZVAL_LIMIT (0x7ff) 179#define VIDTCON2_HOZVAL_LIMIT (0x7ff)
175#define VIDTCON2_HOZVAL(_x) ((_x) << 0) 180#define VIDTCON2_HOZVAL(_x) (((_x) & 0x7ff) << 0)
176 181
177/* WINCONx */ 182/* WINCONx */
178 183
@@ -228,25 +233,29 @@
228/* Local input channels (windows 0-2) */ 233/* Local input channels (windows 0-2) */
229#define SHADOWCON_CHx_LOCAL_ENABLE(_win) (1 << (5 + (_win))) 234#define SHADOWCON_CHx_LOCAL_ENABLE(_win) (1 << (5 + (_win)))
230 235
236#define VIDOSDxA_TOPLEFT_X_E(_x) ((((_x) & 0x800) >> 11) << 23)
231#define VIDOSDxA_TOPLEFT_X_MASK (0x7ff << 11) 237#define VIDOSDxA_TOPLEFT_X_MASK (0x7ff << 11)
232#define VIDOSDxA_TOPLEFT_X_SHIFT (11) 238#define VIDOSDxA_TOPLEFT_X_SHIFT (11)
233#define VIDOSDxA_TOPLEFT_X_LIMIT (0x7ff) 239#define VIDOSDxA_TOPLEFT_X_LIMIT (0x7ff)
234#define VIDOSDxA_TOPLEFT_X(_x) ((_x) << 11) 240#define VIDOSDxA_TOPLEFT_X(_x) (((_x) & 0x7ff) << 11)
235 241
242#define VIDOSDxA_TOPLEFT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22)
236#define VIDOSDxA_TOPLEFT_Y_MASK (0x7ff << 0) 243#define VIDOSDxA_TOPLEFT_Y_MASK (0x7ff << 0)
237#define VIDOSDxA_TOPLEFT_Y_SHIFT (0) 244#define VIDOSDxA_TOPLEFT_Y_SHIFT (0)
238#define VIDOSDxA_TOPLEFT_Y_LIMIT (0x7ff) 245#define VIDOSDxA_TOPLEFT_Y_LIMIT (0x7ff)
239#define VIDOSDxA_TOPLEFT_Y(_x) ((_x) << 0) 246#define VIDOSDxA_TOPLEFT_Y(_x) (((_x) & 0x7ff) << 0)
240 247
248#define VIDOSDxB_BOTRIGHT_X_E(_x) ((((_x) & 0x800) >> 11) << 23)
241#define VIDOSDxB_BOTRIGHT_X_MASK (0x7ff << 11) 249#define VIDOSDxB_BOTRIGHT_X_MASK (0x7ff << 11)
242#define VIDOSDxB_BOTRIGHT_X_SHIFT (11) 250#define VIDOSDxB_BOTRIGHT_X_SHIFT (11)
243#define VIDOSDxB_BOTRIGHT_X_LIMIT (0x7ff) 251#define VIDOSDxB_BOTRIGHT_X_LIMIT (0x7ff)
244#define VIDOSDxB_BOTRIGHT_X(_x) ((_x) << 11) 252#define VIDOSDxB_BOTRIGHT_X(_x) (((_x) & 0x7ff) << 11)
245 253
254#define VIDOSDxB_BOTRIGHT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22)
246#define VIDOSDxB_BOTRIGHT_Y_MASK (0x7ff << 0) 255#define VIDOSDxB_BOTRIGHT_Y_MASK (0x7ff << 0)
247#define VIDOSDxB_BOTRIGHT_Y_SHIFT (0) 256#define VIDOSDxB_BOTRIGHT_Y_SHIFT (0)
248#define VIDOSDxB_BOTRIGHT_Y_LIMIT (0x7ff) 257#define VIDOSDxB_BOTRIGHT_Y_LIMIT (0x7ff)
249#define VIDOSDxB_BOTRIGHT_Y(_x) ((_x) << 0) 258#define VIDOSDxB_BOTRIGHT_Y(_x) (((_x) & 0x7ff) << 0)
250 259
251/* For VIDOSD[1..4]C */ 260/* For VIDOSD[1..4]C */
252#define VIDISD14C_ALPHA0_R(_x) ((_x) << 20) 261#define VIDISD14C_ALPHA0_R(_x) ((_x) << 20)
@@ -278,15 +287,17 @@
278#define VIDW_BUF_END1(_buff) (0xD4 + ((_buff) * 8)) 287#define VIDW_BUF_END1(_buff) (0xD4 + ((_buff) * 8))
279#define VIDW_BUF_SIZE(_buff) (0x100 + ((_buff) * 4)) 288#define VIDW_BUF_SIZE(_buff) (0x100 + ((_buff) * 4))
280 289
290#define VIDW_BUF_SIZE_OFFSET_E(_x) ((((_x) & 0x2000) >> 13) << 27)
281#define VIDW_BUF_SIZE_OFFSET_MASK (0x1fff << 13) 291#define VIDW_BUF_SIZE_OFFSET_MASK (0x1fff << 13)
282#define VIDW_BUF_SIZE_OFFSET_SHIFT (13) 292#define VIDW_BUF_SIZE_OFFSET_SHIFT (13)
283#define VIDW_BUF_SIZE_OFFSET_LIMIT (0x1fff) 293#define VIDW_BUF_SIZE_OFFSET_LIMIT (0x1fff)
284#define VIDW_BUF_SIZE_OFFSET(_x) ((_x) << 13) 294#define VIDW_BUF_SIZE_OFFSET(_x) (((_x) & 0x1fff) << 13)
285 295
296#define VIDW_BUF_SIZE_PAGEWIDTH_E(_x) ((((_x) & 0x2000) >> 13) << 26)
286#define VIDW_BUF_SIZE_PAGEWIDTH_MASK (0x1fff << 0) 297#define VIDW_BUF_SIZE_PAGEWIDTH_MASK (0x1fff << 0)
287#define VIDW_BUF_SIZE_PAGEWIDTH_SHIFT (0) 298#define VIDW_BUF_SIZE_PAGEWIDTH_SHIFT (0)
288#define VIDW_BUF_SIZE_PAGEWIDTH_LIMIT (0x1fff) 299#define VIDW_BUF_SIZE_PAGEWIDTH_LIMIT (0x1fff)
289#define VIDW_BUF_SIZE_PAGEWIDTH(_x) ((_x) << 0) 300#define VIDW_BUF_SIZE_PAGEWIDTH(_x) (((_x) & 0x1fff) << 0)
290 301
291/* Interrupt controls and status */ 302/* Interrupt controls and status */
292 303
@@ -384,3 +395,9 @@
384#define WPALCON_W0PAL_16BPP_A555 (0x5 << 0) 395#define WPALCON_W0PAL_16BPP_A555 (0x5 << 0)
385#define WPALCON_W0PAL_16BPP_565 (0x6 << 0) 396#define WPALCON_W0PAL_16BPP_565 (0x6 << 0)
386 397
398/* Blending equation control */
399#define BLENDCON (0x260)
400#define BLENDCON_NEW_MASK (1 << 0)
401#define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0)
402#define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0)
403
diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index 30b7cc14cef..0f8263e93ee 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -18,51 +18,54 @@
18#define S3C2410_INTP_ALM (1 << 1) 18#define S3C2410_INTP_ALM (1 << 1)
19#define S3C2410_INTP_TIC (1 << 0) 19#define S3C2410_INTP_TIC (1 << 0)
20 20
21#define S3C2410_RTCCON S3C2410_RTCREG(0x40) 21#define S3C2410_RTCCON S3C2410_RTCREG(0x40)
22#define S3C2410_RTCCON_RTCEN (1<<0) 22#define S3C2410_RTCCON_RTCEN (1 << 0)
23#define S3C2410_RTCCON_CLKSEL (1<<1) 23#define S3C2410_RTCCON_CNTSEL (1 << 2)
24#define S3C2410_RTCCON_CNTSEL (1<<2) 24#define S3C2410_RTCCON_CLKRST (1 << 3)
25#define S3C2410_RTCCON_CLKRST (1<<3) 25#define S3C2443_RTCCON_TICSEL (1 << 4)
26#define S3C64XX_RTCCON_TICEN (1<<8) 26#define S3C64XX_RTCCON_TICEN (1 << 8)
27 27
28#define S3C64XX_RTCCON_TICMSK (0xF<<7) 28#define S3C2410_TICNT S3C2410_RTCREG(0x44)
29#define S3C64XX_RTCCON_TICSHT (7) 29#define S3C2410_TICNT_ENABLE (1 << 7)
30 30
31#define S3C2410_TICNT S3C2410_RTCREG(0x44) 31/* S3C2443: tick count is 15 bit wide
32#define S3C2410_TICNT_ENABLE (1<<7) 32 * TICNT[6:0] contains upper 7 bits
33 * TICNT1[7:0] contains lower 8 bits
34 */
35#define S3C2443_TICNT_PART(x) ((x & 0x7f00) >> 8)
36#define S3C2443_TICNT1 S3C2410_RTCREG(0x4C)
37#define S3C2443_TICNT1_PART(x) (x & 0xff)
33 38
34#define S3C2410_RTCALM S3C2410_RTCREG(0x50) 39/* S3C2416: tick count is 32 bit wide
35#define S3C2410_RTCALM_ALMEN (1<<6) 40 * TICNT[6:0] contains bits [14:8]
36#define S3C2410_RTCALM_YEAREN (1<<5) 41 * TICNT1[7:0] contains lower 8 bits
37#define S3C2410_RTCALM_MONEN (1<<4) 42 * TICNT2[16:0] contains upper 17 bits
38#define S3C2410_RTCALM_DAYEN (1<<3) 43 */
39#define S3C2410_RTCALM_HOUREN (1<<2) 44#define S3C2416_TICNT2 S3C2410_RTCREG(0x48)
40#define S3C2410_RTCALM_MINEN (1<<1) 45#define S3C2416_TICNT2_PART(x) ((x & 0xffff8000) >> 15)
41#define S3C2410_RTCALM_SECEN (1<<0)
42 46
43#define S3C2410_RTCALM_ALL \ 47#define S3C2410_RTCALM S3C2410_RTCREG(0x50)
44 S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\ 48#define S3C2410_RTCALM_ALMEN (1 << 6)
45 S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\ 49#define S3C2410_RTCALM_YEAREN (1 << 5)
46 S3C2410_RTCALM_SECEN 50#define S3C2410_RTCALM_MONEN (1 << 4)
51#define S3C2410_RTCALM_DAYEN (1 << 3)
52#define S3C2410_RTCALM_HOUREN (1 << 2)
53#define S3C2410_RTCALM_MINEN (1 << 1)
54#define S3C2410_RTCALM_SECEN (1 << 0)
47 55
56#define S3C2410_ALMSEC S3C2410_RTCREG(0x54)
57#define S3C2410_ALMMIN S3C2410_RTCREG(0x58)
58#define S3C2410_ALMHOUR S3C2410_RTCREG(0x5c)
48 59
49#define S3C2410_ALMSEC S3C2410_RTCREG(0x54) 60#define S3C2410_ALMDATE S3C2410_RTCREG(0x60)
50#define S3C2410_ALMMIN S3C2410_RTCREG(0x58) 61#define S3C2410_ALMMON S3C2410_RTCREG(0x64)
51#define S3C2410_ALMHOUR S3C2410_RTCREG(0x5c) 62#define S3C2410_ALMYEAR S3C2410_RTCREG(0x68)
52
53#define S3C2410_ALMDATE S3C2410_RTCREG(0x60)
54#define S3C2410_ALMMON S3C2410_RTCREG(0x64)
55#define S3C2410_ALMYEAR S3C2410_RTCREG(0x68)
56
57#define S3C2410_RTCRST S3C2410_RTCREG(0x6c)
58
59#define S3C2410_RTCSEC S3C2410_RTCREG(0x70)
60#define S3C2410_RTCMIN S3C2410_RTCREG(0x74)
61#define S3C2410_RTCHOUR S3C2410_RTCREG(0x78)
62#define S3C2410_RTCDATE S3C2410_RTCREG(0x7c)
63#define S3C2410_RTCDAY S3C2410_RTCREG(0x80)
64#define S3C2410_RTCMON S3C2410_RTCREG(0x84)
65#define S3C2410_RTCYEAR S3C2410_RTCREG(0x88)
66 63
64#define S3C2410_RTCSEC S3C2410_RTCREG(0x70)
65#define S3C2410_RTCMIN S3C2410_RTCREG(0x74)
66#define S3C2410_RTCHOUR S3C2410_RTCREG(0x78)
67#define S3C2410_RTCDATE S3C2410_RTCREG(0x7c)
68#define S3C2410_RTCMON S3C2410_RTCREG(0x84)
69#define S3C2410_RTCYEAR S3C2410_RTCREG(0x88)
67 70
68#endif /* __ASM_ARCH_REGS_RTC_H */ 71#endif /* __ASM_ARCH_REGS_RTC_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h b/arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h
index a111ad87183..fcf27966206 100644
--- a/arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h
+++ b/arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h
@@ -25,8 +25,9 @@
25#define S3C_HSOTG_PHYREG(x) ((x) + S3C_VA_USB_HSPHY) 25#define S3C_HSOTG_PHYREG(x) ((x) + S3C_VA_USB_HSPHY)
26 26
27#define S3C_PHYPWR S3C_HSOTG_PHYREG(0x00) 27#define S3C_PHYPWR S3C_HSOTG_PHYREG(0x00)
28#define SRC_PHYPWR_OTG_DISABLE (1 << 4) 28#define S3C_PHYPWR_NORMAL_MASK (0x19 << 0)
29#define SRC_PHYPWR_ANALOG_POWERDOWN (1 << 3) 29#define S3C_PHYPWR_OTG_DISABLE (1 << 4)
30#define S3C_PHYPWR_ANALOG_POWERDOWN (1 << 3)
30#define SRC_PHYPWR_FORCE_SUSPEND (1 << 1) 31#define SRC_PHYPWR_FORCE_SUSPEND (1 << 1)
31 32
32#define S3C_PHYCLK S3C_HSOTG_PHYREG(0x04) 33#define S3C_PHYCLK S3C_HSOTG_PHYREG(0x04)
@@ -42,7 +43,7 @@
42 43
43#define S3C_RSTCON S3C_HSOTG_PHYREG(0x08) 44#define S3C_RSTCON S3C_HSOTG_PHYREG(0x08)
44#define S3C_RSTCON_PHYCLK (1 << 2) 45#define S3C_RSTCON_PHYCLK (1 << 2)
45#define S3C_RSTCON_HCLK (1 << 2) 46#define S3C_RSTCON_HCLK (1 << 1)
46#define S3C_RSTCON_PHY (1 << 0) 47#define S3C_RSTCON_PHY (1 << 0)
47 48
48#define S3C_PHYTUNE S3C_HSOTG_PHYREG(0x20) 49#define S3C_PHYTUNE S3C_HSOTG_PHYREG(0x20)
diff --git a/arch/arm/plat-samsung/include/plat/rtc-core.h b/arch/arm/plat-samsung/include/plat/rtc-core.h
new file mode 100644
index 00000000000..21d8594d37c
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/rtc-core.h
@@ -0,0 +1,27 @@
1/* linux/arch/arm/plat-samsung/include/plat/rtc-core.h
2 *
3 * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
4 *
5 * Samsung RTC Controller core functions
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __ASM_PLAT_RTC_CORE_H
13#define __ASM_PLAT_RTC_CORE_H __FILE__
14
15/* These functions are only for use with the core support code, such as
16 * the cpu specific initialisation code
17 */
18
19/* re-define device name depending on support. */
20static inline void s3c_rtc_setname(char *name)
21{
22#if defined(CONFIG_SAMSUNG_DEV_RTC) || defined(CONFIG_PLAT_S3C24XX)
23 s3c_device_rtc.name = name;
24#endif
25}
26
27#endif /* __ASM_PLAT_RTC_CORE_H */
diff --git a/arch/arm/plat-samsung/include/plat/s3c2410.h b/arch/arm/plat-samsung/include/plat/s3c2410.h
index 3986497dd3f..55b0e5f51e9 100644
--- a/arch/arm/plat-samsung/include/plat/s3c2410.h
+++ b/arch/arm/plat-samsung/include/plat/s3c2410.h
@@ -29,5 +29,3 @@ extern void s3c2410_init_clocks(int xtal);
29#define s3c2410_init NULL 29#define s3c2410_init NULL
30#define s3c2410a_init NULL 30#define s3c2410a_init NULL
31#endif 31#endif
32
33extern int s3c2410_baseclk_add(void);
diff --git a/arch/arm/plat-samsung/include/plat/s3c2443.h b/arch/arm/plat-samsung/include/plat/s3c2443.h
index dce05b43d51..a5b794ff838 100644
--- a/arch/arm/plat-samsung/include/plat/s3c2443.h
+++ b/arch/arm/plat-samsung/include/plat/s3c2443.h
@@ -32,23 +32,3 @@ extern void s3c2443_restart(char mode, const char *cmd);
32#define s3c2443_init NULL 32#define s3c2443_init NULL
33#define s3c2443_restart NULL 33#define s3c2443_restart NULL
34#endif 34#endif
35
36/* common code used by s3c2443 and others.
37 * note, not to be used outside of arch/arm/mach-s3c* */
38
39struct clk; /* some files don't need clk.h otherwise */
40
41typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base);
42
43extern void s3c2443_common_setup_clocks(pll_fn get_mpll);
44extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
45 unsigned int *divs, int nr_divs,
46 int divmask);
47
48extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable);
49extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable);
50extern int s3c2443_clkcon_enable_s(struct clk *clk, int enable);
51
52extern struct clksrc_clk clk_epllref;
53extern struct clksrc_clk clk_esysclk;
54extern struct clksrc_clk clk_msysclk;
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index f82f888b91a..317e246ffc5 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -40,6 +40,7 @@ enum clk_types {
40 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI 40 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
41 * @max_width: The maximum number of data bits supported. 41 * @max_width: The maximum number of data bits supported.
42 * @host_caps: Standard MMC host capabilities bit field. 42 * @host_caps: Standard MMC host capabilities bit field.
43 * @host_caps2: The second standard MMC host capabilities bit field.
43 * @cd_type: Type of Card Detection method (see cd_types enum above) 44 * @cd_type: Type of Card Detection method (see cd_types enum above)
44 * @clk_type: Type of clock divider method (see clk_types enum above) 45 * @clk_type: Type of clock divider method (see clk_types enum above)
45 * @ext_cd_init: Initialize external card detect subsystem. Called on 46 * @ext_cd_init: Initialize external card detect subsystem. Called on
@@ -63,6 +64,7 @@ enum clk_types {
63struct s3c_sdhci_platdata { 64struct s3c_sdhci_platdata {
64 unsigned int max_width; 65 unsigned int max_width;
65 unsigned int host_caps; 66 unsigned int host_caps;
67 unsigned int host_caps2;
66 unsigned int pm_caps; 68 unsigned int pm_caps;
67 enum cd_types cd_type; 69 enum cd_types cd_type;
68 enum clk_types clk_type; 70 enum clk_types clk_type;
diff --git a/arch/arm/plat-samsung/include/plat/udc-hs.h b/arch/arm/plat-samsung/include/plat/udc-hs.h
index a22a4f2eea9..c9e3667cb2b 100644
--- a/arch/arm/plat-samsung/include/plat/udc-hs.h
+++ b/arch/arm/plat-samsung/include/plat/udc-hs.h
@@ -26,4 +26,9 @@ enum s3c_hsotg_dmamode {
26struct s3c_hsotg_plat { 26struct s3c_hsotg_plat {
27 enum s3c_hsotg_dmamode dma; 27 enum s3c_hsotg_dmamode dma;
28 unsigned int is_osc : 1; 28 unsigned int is_osc : 1;
29
30 int (*phy_init)(struct platform_device *pdev, int type);
31 int (*phy_exit)(struct platform_device *pdev, int type);
29}; 32};
33
34extern void s3c_hsotg_set_platdata(struct s3c_hsotg_plat *pd);
diff --git a/arch/arm/plat-samsung/platformdata.c b/arch/arm/plat-samsung/platformdata.c
index 0f707184eae..fa78aa710ed 100644
--- a/arch/arm/plat-samsung/platformdata.c
+++ b/arch/arm/plat-samsung/platformdata.c
@@ -53,6 +53,8 @@ void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
53 set->cfg_gpio = pd->cfg_gpio; 53 set->cfg_gpio = pd->cfg_gpio;
54 if (pd->host_caps) 54 if (pd->host_caps)
55 set->host_caps |= pd->host_caps; 55 set->host_caps |= pd->host_caps;
56 if (pd->host_caps2)
57 set->host_caps2 |= pd->host_caps2;
56 if (pd->pm_caps) 58 if (pd->pm_caps)
57 set->pm_caps |= pd->pm_caps; 59 set->pm_caps |= pd->pm_caps;
58 if (pd->clk_type) 60 if (pd->clk_type)
diff --git a/arch/arm/plat-spear/include/plat/keyboard.h b/arch/arm/plat-spear/include/plat/keyboard.h
index 68b5394fc58..c16cc31ecbe 100644
--- a/arch/arm/plat-spear/include/plat/keyboard.h
+++ b/arch/arm/plat-spear/include/plat/keyboard.h
@@ -15,7 +15,7 @@
15#include <linux/input/matrix_keypad.h> 15#include <linux/input/matrix_keypad.h>
16#include <linux/types.h> 16#include <linux/types.h>
17 17
18#define DECLARE_KEYMAP(_name) \ 18#define DECLARE_9x9_KEYMAP(_name) \
19int _name[] = { \ 19int _name[] = { \
20 KEY(0, 0, KEY_ESC), \ 20 KEY(0, 0, KEY_ESC), \
21 KEY(0, 1, KEY_1), \ 21 KEY(0, 1, KEY_1), \
@@ -62,24 +62,6 @@ int _name[] = { \
62 KEY(4, 6, KEY_Z), \ 62 KEY(4, 6, KEY_Z), \
63 KEY(4, 7, KEY_X), \ 63 KEY(4, 7, KEY_X), \
64 KEY(4, 8, KEY_C), \ 64 KEY(4, 8, KEY_C), \
65 KEY(4, 0, KEY_L), \
66 KEY(4, 1, KEY_SEMICOLON), \
67 KEY(4, 2, KEY_APOSTROPHE), \
68 KEY(4, 3, KEY_GRAVE), \
69 KEY(4, 4, KEY_LEFTSHIFT), \
70 KEY(4, 5, KEY_BACKSLASH), \
71 KEY(4, 6, KEY_Z), \
72 KEY(4, 7, KEY_X), \
73 KEY(4, 8, KEY_C), \
74 KEY(4, 0, KEY_L), \
75 KEY(4, 1, KEY_SEMICOLON), \
76 KEY(4, 2, KEY_APOSTROPHE), \
77 KEY(4, 3, KEY_GRAVE), \
78 KEY(4, 4, KEY_LEFTSHIFT), \
79 KEY(4, 5, KEY_BACKSLASH), \
80 KEY(4, 6, KEY_Z), \
81 KEY(4, 7, KEY_X), \
82 KEY(4, 8, KEY_C), \
83 KEY(5, 0, KEY_V), \ 65 KEY(5, 0, KEY_V), \
84 KEY(5, 1, KEY_B), \ 66 KEY(5, 1, KEY_B), \
85 KEY(5, 2, KEY_N), \ 67 KEY(5, 2, KEY_N), \
@@ -118,10 +100,55 @@ int _name[] = { \
118 KEY(8, 8, KEY_KP0), \ 100 KEY(8, 8, KEY_KP0), \
119} 101}
120 102
103#define DECLARE_6x6_KEYMAP(_name) \
104int _name[] = { \
105 KEY(0, 0, KEY_RESERVED), \
106 KEY(0, 1, KEY_1), \
107 KEY(0, 2, KEY_2), \
108 KEY(0, 3, KEY_3), \
109 KEY(0, 4, KEY_4), \
110 KEY(0, 5, KEY_5), \
111 KEY(1, 0, KEY_Q), \
112 KEY(1, 1, KEY_W), \
113 KEY(1, 2, KEY_E), \
114 KEY(1, 3, KEY_R), \
115 KEY(1, 4, KEY_T), \
116 KEY(1, 5, KEY_Y), \
117 KEY(2, 0, KEY_D), \
118 KEY(2, 1, KEY_F), \
119 KEY(2, 2, KEY_G), \
120 KEY(2, 3, KEY_H), \
121 KEY(2, 4, KEY_J), \
122 KEY(2, 5, KEY_K), \
123 KEY(3, 0, KEY_B), \
124 KEY(3, 1, KEY_N), \
125 KEY(3, 2, KEY_M), \
126 KEY(3, 3, KEY_COMMA), \
127 KEY(3, 4, KEY_DOT), \
128 KEY(3, 5, KEY_SLASH), \
129 KEY(4, 0, KEY_F6), \
130 KEY(4, 1, KEY_F7), \
131 KEY(4, 2, KEY_F8), \
132 KEY(4, 3, KEY_F9), \
133 KEY(4, 4, KEY_F10), \
134 KEY(4, 5, KEY_NUMLOCK), \
135 KEY(5, 0, KEY_KP2), \
136 KEY(5, 1, KEY_KP3), \
137 KEY(5, 2, KEY_KP0), \
138 KEY(5, 3, KEY_KPDOT), \
139 KEY(5, 4, KEY_RO), \
140 KEY(5, 5, KEY_ZENKAKUHANKAKU), \
141}
142
143#define KEYPAD_9x9 0
144#define KEYPAD_6x6 1
145#define KEYPAD_2x2 2
146
121/** 147/**
122 * struct kbd_platform_data - spear keyboard platform data 148 * struct kbd_platform_data - spear keyboard platform data
123 * keymap: pointer to keymap data (table and size) 149 * keymap: pointer to keymap data (table and size)
124 * rep: enables key autorepeat 150 * rep: enables key autorepeat
151 * mode: choose keyboard support(9x9, 6x6, 2x2)
125 * 152 *
126 * This structure is supposed to be used by platform code to supply 153 * This structure is supposed to be used by platform code to supply
127 * keymaps to drivers that implement keyboards. 154 * keymaps to drivers that implement keyboards.
@@ -129,6 +156,7 @@ int _name[] = { \
129struct kbd_platform_data { 156struct kbd_platform_data {
130 const struct matrix_keymap_data *keymap; 157 const struct matrix_keymap_data *keymap;
131 bool rep; 158 bool rep;
159 unsigned int mode;
132}; 160};
133 161
134/* This function is used to set platform data field of pdev->dev */ 162/* This function is used to set platform data field of pdev->dev */
diff --git a/arch/arm/plat-spear/include/plat/system.h b/arch/arm/plat-spear/include/plat/system.h
deleted file mode 100644
index 86c6f83b44c..00000000000
--- a/arch/arm/plat-spear/include/plat/system.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/plat-spear/include/plat/system.h
3 *
4 * SPEAr platform specific architecture functions
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.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 __PLAT_SYSTEM_H
15#define __PLAT_SYSTEM_H
16
17static inline void arch_idle(void)
18{
19 /*
20 * This should do all the clock switching
21 * and wait for interrupt tricks
22 */
23 cpu_do_idle();
24}
25
26#endif /* __PLAT_SYSTEM_H */
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile
index 69714db47c3..a5cb1945bdc 100644
--- a/arch/arm/plat-versatile/Makefile
+++ b/arch/arm/plat-versatile/Makefile
@@ -1,5 +1,4 @@
1obj-y := clock.o 1obj-y := clock.o
2obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
3obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o 2obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o
4obj-$(CONFIG_PLAT_VERSATILE_FPGA_IRQ) += fpga-irq.o 3obj-$(CONFIG_PLAT_VERSATILE_FPGA_IRQ) += fpga-irq.o
5obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o 4obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o
diff --git a/arch/arm/plat-versatile/localtimer.c b/arch/arm/plat-versatile/localtimer.c
deleted file mode 100644
index 0fb3961999b..00000000000
--- a/arch/arm/plat-versatile/localtimer.c
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * linux/arch/arm/plat-versatile/localtimer.c
3 *
4 * Copyright (C) 2002 ARM Ltd.
5 * All Rights Reserved
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/init.h>
12#include <linux/smp.h>
13#include <linux/clockchips.h>
14
15#include <asm/smp_twd.h>
16#include <asm/localtimer.h>
17#include <mach/irqs.h>
18
19/*
20 * Setup the local clock events for a CPU.
21 */
22int __cpuinit local_timer_setup(struct clock_event_device *evt)
23{
24 evt->irq = IRQ_LOCALTIMER;
25 twd_timer_setup(evt);
26 return 0;
27}
diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h
index 22c97ef9220..cf60d0a9f17 100644
--- a/arch/avr32/include/asm/io.h
+++ b/arch/avr32/include/asm/io.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_AVR32_IO_H 1#ifndef __ASM_AVR32_IO_H
2#define __ASM_AVR32_IO_H 2#define __ASM_AVR32_IO_H
3 3
4#include <linux/bug.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/string.h> 6#include <linux/string.h>
6#include <linux/types.h> 7#include <linux/types.h>
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 402a7bb7266..889c544688c 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1055,8 +1055,6 @@ struct platform_device *__init at32_add_device_usart(unsigned int id)
1055 return at32_usarts[id]; 1055 return at32_usarts[id];
1056} 1056}
1057 1057
1058struct platform_device *atmel_default_console_device;
1059
1060void __init at32_setup_serial_console(unsigned int usart_id) 1058void __init at32_setup_serial_console(unsigned int usart_id)
1061{ 1059{
1062 atmel_default_console_device = at32_usarts[usart_id]; 1060 atmel_default_console_device = at32_usarts[usart_id];
diff --git a/arch/avr32/mach-at32ap/include/mach/cpu.h b/arch/avr32/mach-at32ap/include/mach/cpu.h
index 8181293115e..16a24b14146 100644
--- a/arch/avr32/mach-at32ap/include/mach/cpu.h
+++ b/arch/avr32/mach-at32ap/include/mach/cpu.h
@@ -30,9 +30,6 @@
30#define cpu_is_at91sam9261() (0) 30#define cpu_is_at91sam9261() (0)
31#define cpu_is_at91sam9263() (0) 31#define cpu_is_at91sam9263() (0)
32#define cpu_is_at91sam9rl() (0) 32#define cpu_is_at91sam9rl() (0)
33#define cpu_is_at91cap9() (0)
34#define cpu_is_at91cap9_revB() (0)
35#define cpu_is_at91cap9_revC() (0)
36#define cpu_is_at91sam9g10() (0) 33#define cpu_is_at91sam9g10() (0)
37#define cpu_is_at91sam9g20() (0) 34#define cpu_is_at91sam9g20() (0)
38#define cpu_is_at91sam9g45() (0) 35#define cpu_is_at91sam9g45() (0)
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index abe5a9e8514..c1269a1085e 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -36,6 +36,7 @@ config BLACKFIN
36 select GENERIC_ATOMIC64 36 select GENERIC_ATOMIC64
37 select GENERIC_IRQ_PROBE 37 select GENERIC_IRQ_PROBE
38 select IRQ_PER_CPU if SMP 38 select IRQ_PER_CPU if SMP
39 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG
39 40
40config GENERIC_CSUM 41config GENERIC_CSUM
41 def_bool y 42 def_bool y
diff --git a/arch/blackfin/configs/BF518F-EZBRD_defconfig b/arch/blackfin/configs/BF518F-EZBRD_defconfig
index 0b7039cf07f..383007877b2 100644
--- a/arch/blackfin/configs/BF518F-EZBRD_defconfig
+++ b/arch/blackfin/configs/BF518F-EZBRD_defconfig
@@ -4,9 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EXPERT=y 7CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
12# CONFIG_SIGNALFD is not set 10# CONFIG_SIGNALFD is not set
@@ -35,7 +33,6 @@ CONFIG_C_CDPRIO=y
35CONFIG_BANK_3=0x99B2 33CONFIG_BANK_3=0x99B2
36CONFIG_BINFMT_FLAT=y 34CONFIG_BINFMT_FLAT=y
37CONFIG_BINFMT_ZFLAT=y 35CONFIG_BINFMT_ZFLAT=y
38CONFIG_PM=y
39CONFIG_NET=y 36CONFIG_NET=y
40CONFIG_PACKET=y 37CONFIG_PACKET=y
41CONFIG_UNIX=y 38CONFIG_UNIX=y
@@ -51,7 +48,6 @@ CONFIG_IP_PNP=y
51CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 48CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
52# CONFIG_FW_LOADER is not set 49# CONFIG_FW_LOADER is not set
53CONFIG_MTD=y 50CONFIG_MTD=y
54CONFIG_MTD_PARTITIONS=y
55CONFIG_MTD_CHAR=y 51CONFIG_MTD_CHAR=y
56CONFIG_MTD_BLOCK=y 52CONFIG_MTD_BLOCK=y
57CONFIG_MTD_JEDECPROBE=m 53CONFIG_MTD_JEDECPROBE=m
@@ -60,20 +56,28 @@ CONFIG_MTD_ROM=m
60CONFIG_MTD_COMPLEX_MAPPINGS=y 56CONFIG_MTD_COMPLEX_MAPPINGS=y
61CONFIG_BLK_DEV_RAM=y 57CONFIG_BLK_DEV_RAM=y
62CONFIG_NETDEVICES=y 58CONFIG_NETDEVICES=y
63CONFIG_NET_ETHERNET=y 59CONFIG_NET_BFIN=y
64CONFIG_BFIN_MAC=y 60CONFIG_BFIN_MAC=y
65# CONFIG_NETDEV_1000 is not set 61# CONFIG_NET_VENDOR_BROADCOM is not set
66# CONFIG_NETDEV_10000 is not set 62# CONFIG_NET_VENDOR_CHELSIO is not set
63# CONFIG_NET_VENDOR_INTEL is not set
64# CONFIG_NET_VENDOR_MARVELL is not set
65# CONFIG_NET_VENDOR_MICREL is not set
66# CONFIG_NET_VENDOR_MICROCHIP is not set
67# CONFIG_NET_VENDOR_NATSEMI is not set
68# CONFIG_NET_VENDOR_SEEQ is not set
69# CONFIG_NET_VENDOR_SMSC is not set
70# CONFIG_NET_VENDOR_STMICRO is not set
67# CONFIG_WLAN is not set 71# CONFIG_WLAN is not set
68# CONFIG_INPUT is not set 72# CONFIG_INPUT is not set
69# CONFIG_SERIO is not set 73# CONFIG_SERIO is not set
70# CONFIG_VT is not set 74# CONFIG_VT is not set
71# CONFIG_DEVKMEM is not set 75# CONFIG_LEGACY_PTYS is not set
72CONFIG_BFIN_JTAG_COMM=m 76CONFIG_BFIN_JTAG_COMM=m
77# CONFIG_DEVKMEM is not set
73CONFIG_SERIAL_BFIN=y 78CONFIG_SERIAL_BFIN=y
74CONFIG_SERIAL_BFIN_CONSOLE=y 79CONFIG_SERIAL_BFIN_CONSOLE=y
75CONFIG_SERIAL_BFIN_UART0=y 80CONFIG_SERIAL_BFIN_UART0=y
76# CONFIG_LEGACY_PTYS is not set
77# CONFIG_HW_RANDOM is not set 81# CONFIG_HW_RANDOM is not set
78CONFIG_I2C=y 82CONFIG_I2C=y
79CONFIG_I2C_CHARDEV=y 83CONFIG_I2C_CHARDEV=y
@@ -97,16 +101,13 @@ CONFIG_EXT2_FS=m
97CONFIG_VFAT_FS=m 101CONFIG_VFAT_FS=m
98CONFIG_NFS_FS=m 102CONFIG_NFS_FS=m
99CONFIG_NFS_V3=y 103CONFIG_NFS_V3=y
100CONFIG_SMB_FS=m
101CONFIG_NLS_CODEPAGE_437=m 104CONFIG_NLS_CODEPAGE_437=m
102CONFIG_NLS_CODEPAGE_936=m 105CONFIG_NLS_CODEPAGE_936=m
103CONFIG_NLS_ISO8859_1=m 106CONFIG_NLS_ISO8859_1=m
104CONFIG_NLS_UTF8=m 107CONFIG_NLS_UTF8=m
105CONFIG_DEBUG_KERNEL=y
106CONFIG_DEBUG_SHIRQ=y 108CONFIG_DEBUG_SHIRQ=y
107CONFIG_DETECT_HUNG_TASK=y 109CONFIG_DETECT_HUNG_TASK=y
108CONFIG_DEBUG_INFO=y 110CONFIG_DEBUG_INFO=y
109# CONFIG_RCU_CPU_STALL_DETECTOR is not set
110# CONFIG_FTRACE is not set 111# CONFIG_FTRACE is not set
111CONFIG_DEBUG_MMRS=y 112CONFIG_DEBUG_MMRS=y
112CONFIG_DEBUG_HWERR=y 113CONFIG_DEBUG_HWERR=y
diff --git a/arch/blackfin/configs/BF526-EZBRD_defconfig b/arch/blackfin/configs/BF526-EZBRD_defconfig
index 5553205d7cb..2f2c6acf210 100644
--- a/arch/blackfin/configs/BF526-EZBRD_defconfig
+++ b/arch/blackfin/configs/BF526-EZBRD_defconfig
@@ -4,9 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EXPERT=y 7CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
12# CONFIG_SIGNALFD is not set 10# CONFIG_SIGNALFD is not set
@@ -40,7 +38,6 @@ CONFIG_C_CDPRIO=y
40CONFIG_BANK_3=0x99B2 38CONFIG_BANK_3=0x99B2
41CONFIG_BINFMT_FLAT=y 39CONFIG_BINFMT_FLAT=y
42CONFIG_BINFMT_ZFLAT=y 40CONFIG_BINFMT_ZFLAT=y
43CONFIG_PM=y
44CONFIG_NET=y 41CONFIG_NET=y
45CONFIG_PACKET=y 42CONFIG_PACKET=y
46CONFIG_UNIX=y 43CONFIG_UNIX=y
@@ -56,7 +53,6 @@ CONFIG_IP_PNP=y
56CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 53CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
57# CONFIG_FW_LOADER is not set 54# CONFIG_FW_LOADER is not set
58CONFIG_MTD=y 55CONFIG_MTD=y
59CONFIG_MTD_PARTITIONS=y
60CONFIG_MTD_CHAR=y 56CONFIG_MTD_CHAR=y
61CONFIG_MTD_BLOCK=y 57CONFIG_MTD_BLOCK=y
62CONFIG_MTD_CFI=y 58CONFIG_MTD_CFI=y
@@ -74,10 +70,18 @@ CONFIG_BLK_DEV_SD=y
74CONFIG_BLK_DEV_SR=m 70CONFIG_BLK_DEV_SR=m
75# CONFIG_SCSI_LOWLEVEL is not set 71# CONFIG_SCSI_LOWLEVEL is not set
76CONFIG_NETDEVICES=y 72CONFIG_NETDEVICES=y
77CONFIG_NET_ETHERNET=y 73CONFIG_NET_BFIN=y
78CONFIG_BFIN_MAC=y 74CONFIG_BFIN_MAC=y
79# CONFIG_NETDEV_1000 is not set 75# CONFIG_NET_VENDOR_BROADCOM is not set
80# CONFIG_NETDEV_10000 is not set 76# CONFIG_NET_VENDOR_CHELSIO is not set
77# CONFIG_NET_VENDOR_INTEL is not set
78# CONFIG_NET_VENDOR_MARVELL is not set
79# CONFIG_NET_VENDOR_MICREL is not set
80# CONFIG_NET_VENDOR_MICROCHIP is not set
81# CONFIG_NET_VENDOR_NATSEMI is not set
82# CONFIG_NET_VENDOR_SEEQ is not set
83# CONFIG_NET_VENDOR_SMSC is not set
84# CONFIG_NET_VENDOR_STMICRO is not set
81# CONFIG_WLAN is not set 85# CONFIG_WLAN is not set
82CONFIG_INPUT_FF_MEMLESS=m 86CONFIG_INPUT_FF_MEMLESS=m
83# CONFIG_INPUT_MOUSEDEV is not set 87# CONFIG_INPUT_MOUSEDEV is not set
@@ -85,12 +89,12 @@ CONFIG_INPUT_FF_MEMLESS=m
85# CONFIG_INPUT_MOUSE is not set 89# CONFIG_INPUT_MOUSE is not set
86CONFIG_INPUT_MISC=y 90CONFIG_INPUT_MISC=y
87# CONFIG_SERIO is not set 91# CONFIG_SERIO is not set
88# CONFIG_DEVKMEM is not set 92# CONFIG_LEGACY_PTYS is not set
89CONFIG_BFIN_JTAG_COMM=m 93CONFIG_BFIN_JTAG_COMM=m
94# CONFIG_DEVKMEM is not set
90CONFIG_SERIAL_BFIN=y 95CONFIG_SERIAL_BFIN=y
91CONFIG_SERIAL_BFIN_CONSOLE=y 96CONFIG_SERIAL_BFIN_CONSOLE=y
92CONFIG_SERIAL_BFIN_UART1=y 97CONFIG_SERIAL_BFIN_UART1=y
93# CONFIG_LEGACY_PTYS is not set
94# CONFIG_HW_RANDOM is not set 98# CONFIG_HW_RANDOM is not set
95CONFIG_I2C=y 99CONFIG_I2C=y
96CONFIG_I2C_CHARDEV=m 100CONFIG_I2C_CHARDEV=m
@@ -123,7 +127,6 @@ CONFIG_USB_DEVICEFS=y
123# CONFIG_USB_DEVICE_CLASS is not set 127# CONFIG_USB_DEVICE_CLASS is not set
124CONFIG_USB_OTG_BLACKLIST_HUB=y 128CONFIG_USB_OTG_BLACKLIST_HUB=y
125CONFIG_USB_MON=y 129CONFIG_USB_MON=y
126CONFIG_USB_MUSB_HDRC=y
127CONFIG_USB_STORAGE=y 130CONFIG_USB_STORAGE=y
128CONFIG_RTC_CLASS=y 131CONFIG_RTC_CLASS=y
129CONFIG_RTC_DRV_BFIN=y 132CONFIG_RTC_DRV_BFIN=y
@@ -135,16 +138,13 @@ CONFIG_VFAT_FS=m
135CONFIG_JFFS2_FS=m 138CONFIG_JFFS2_FS=m
136CONFIG_NFS_FS=m 139CONFIG_NFS_FS=m
137CONFIG_NFS_V3=y 140CONFIG_NFS_V3=y
138CONFIG_SMB_FS=m
139CONFIG_NLS_CODEPAGE_437=m 141CONFIG_NLS_CODEPAGE_437=m
140CONFIG_NLS_CODEPAGE_936=m 142CONFIG_NLS_CODEPAGE_936=m
141CONFIG_NLS_ISO8859_1=m 143CONFIG_NLS_ISO8859_1=m
142CONFIG_NLS_UTF8=m 144CONFIG_NLS_UTF8=m
143CONFIG_DEBUG_KERNEL=y
144CONFIG_DEBUG_SHIRQ=y 145CONFIG_DEBUG_SHIRQ=y
145CONFIG_DETECT_HUNG_TASK=y 146CONFIG_DETECT_HUNG_TASK=y
146CONFIG_DEBUG_INFO=y 147CONFIG_DEBUG_INFO=y
147# CONFIG_RCU_CPU_STALL_DETECTOR is not set
148# CONFIG_FTRACE is not set 148# CONFIG_FTRACE is not set
149CONFIG_DEBUG_MMRS=y 149CONFIG_DEBUG_MMRS=y
150CONFIG_DEBUG_HWERR=y 150CONFIG_DEBUG_HWERR=y
diff --git a/arch/blackfin/configs/BF527-EZKIT-V2_defconfig b/arch/blackfin/configs/BF527-EZKIT-V2_defconfig
index 498f64a8705..91535c38e7f 100644
--- a/arch/blackfin/configs/BF527-EZKIT-V2_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT-V2_defconfig
@@ -4,9 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EXPERT=y 7CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
12# CONFIG_SIGNALFD is not set 10# CONFIG_SIGNALFD is not set
@@ -39,7 +37,6 @@ CONFIG_C_CDPRIO=y
39CONFIG_BANK_3=0x99B2 37CONFIG_BANK_3=0x99B2
40CONFIG_BINFMT_FLAT=y 38CONFIG_BINFMT_FLAT=y
41CONFIG_BINFMT_ZFLAT=y 39CONFIG_BINFMT_ZFLAT=y
42CONFIG_PM=y
43CONFIG_NET=y 40CONFIG_NET=y
44CONFIG_PACKET=y 41CONFIG_PACKET=y
45CONFIG_UNIX=y 42CONFIG_UNIX=y
@@ -61,7 +58,6 @@ CONFIG_BFIN_SIR0=y
61CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 58CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
62# CONFIG_FW_LOADER is not set 59# CONFIG_FW_LOADER is not set
63CONFIG_MTD=y 60CONFIG_MTD=y
64CONFIG_MTD_PARTITIONS=y
65CONFIG_MTD_CHAR=m 61CONFIG_MTD_CHAR=m
66CONFIG_MTD_BLOCK=y 62CONFIG_MTD_BLOCK=y
67CONFIG_MTD_JEDECPROBE=m 63CONFIG_MTD_JEDECPROBE=m
@@ -77,10 +73,18 @@ CONFIG_BLK_DEV_SD=y
77CONFIG_BLK_DEV_SR=m 73CONFIG_BLK_DEV_SR=m
78# CONFIG_SCSI_LOWLEVEL is not set 74# CONFIG_SCSI_LOWLEVEL is not set
79CONFIG_NETDEVICES=y 75CONFIG_NETDEVICES=y
80CONFIG_NET_ETHERNET=y 76CONFIG_NET_BFIN=y
81CONFIG_BFIN_MAC=y 77CONFIG_BFIN_MAC=y
82# CONFIG_NETDEV_1000 is not set 78# CONFIG_NET_VENDOR_BROADCOM is not set
83# CONFIG_NETDEV_10000 is not set 79# CONFIG_NET_VENDOR_CHELSIO is not set
80# CONFIG_NET_VENDOR_INTEL is not set
81# CONFIG_NET_VENDOR_MARVELL is not set
82# CONFIG_NET_VENDOR_MICREL is not set
83# CONFIG_NET_VENDOR_MICROCHIP is not set
84# CONFIG_NET_VENDOR_NATSEMI is not set
85# CONFIG_NET_VENDOR_SEEQ is not set
86# CONFIG_NET_VENDOR_SMSC is not set
87# CONFIG_NET_VENDOR_STMICRO is not set
84# CONFIG_WLAN is not set 88# CONFIG_WLAN is not set
85CONFIG_INPUT_FF_MEMLESS=m 89CONFIG_INPUT_FF_MEMLESS=m
86# CONFIG_INPUT_MOUSEDEV is not set 90# CONFIG_INPUT_MOUSEDEV is not set
@@ -93,12 +97,12 @@ CONFIG_TOUCHSCREEN_AD7879=y
93CONFIG_TOUCHSCREEN_AD7879_I2C=y 97CONFIG_TOUCHSCREEN_AD7879_I2C=y
94CONFIG_INPUT_MISC=y 98CONFIG_INPUT_MISC=y
95# CONFIG_SERIO is not set 99# CONFIG_SERIO is not set
96# CONFIG_DEVKMEM is not set 100# CONFIG_LEGACY_PTYS is not set
97CONFIG_BFIN_JTAG_COMM=m 101CONFIG_BFIN_JTAG_COMM=m
102# CONFIG_DEVKMEM is not set
98CONFIG_SERIAL_BFIN=y 103CONFIG_SERIAL_BFIN=y
99CONFIG_SERIAL_BFIN_CONSOLE=y 104CONFIG_SERIAL_BFIN_CONSOLE=y
100CONFIG_SERIAL_BFIN_UART1=y 105CONFIG_SERIAL_BFIN_UART1=y
101# CONFIG_LEGACY_PTYS is not set
102# CONFIG_HW_RANDOM is not set 106# CONFIG_HW_RANDOM is not set
103CONFIG_I2C=y 107CONFIG_I2C=y
104CONFIG_I2C_CHARDEV=m 108CONFIG_I2C_CHARDEV=m
@@ -148,7 +152,9 @@ CONFIG_USB_DEVICEFS=y
148CONFIG_USB_OTG_BLACKLIST_HUB=y 152CONFIG_USB_OTG_BLACKLIST_HUB=y
149CONFIG_USB_MON=y 153CONFIG_USB_MON=y
150CONFIG_USB_MUSB_HDRC=y 154CONFIG_USB_MUSB_HDRC=y
155CONFIG_USB_MUSB_BLACKFIN=y
151CONFIG_USB_STORAGE=y 156CONFIG_USB_STORAGE=y
157CONFIG_USB_GADGET=y
152CONFIG_NEW_LEDS=y 158CONFIG_NEW_LEDS=y
153CONFIG_LEDS_CLASS=y 159CONFIG_LEDS_CLASS=y
154CONFIG_LEDS_ADP5520=y 160CONFIG_LEDS_ADP5520=y
@@ -163,16 +169,13 @@ CONFIG_VFAT_FS=m
163CONFIG_JFFS2_FS=m 169CONFIG_JFFS2_FS=m
164CONFIG_NFS_FS=m 170CONFIG_NFS_FS=m
165CONFIG_NFS_V3=y 171CONFIG_NFS_V3=y
166CONFIG_SMB_FS=m
167CONFIG_NLS_CODEPAGE_437=m 172CONFIG_NLS_CODEPAGE_437=m
168CONFIG_NLS_CODEPAGE_936=m 173CONFIG_NLS_CODEPAGE_936=m
169CONFIG_NLS_ISO8859_1=m 174CONFIG_NLS_ISO8859_1=m
170CONFIG_NLS_UTF8=m 175CONFIG_NLS_UTF8=m
171CONFIG_DEBUG_KERNEL=y
172CONFIG_DEBUG_SHIRQ=y 176CONFIG_DEBUG_SHIRQ=y
173CONFIG_DETECT_HUNG_TASK=y 177CONFIG_DETECT_HUNG_TASK=y
174CONFIG_DEBUG_INFO=y 178CONFIG_DEBUG_INFO=y
175# CONFIG_RCU_CPU_STALL_DETECTOR is not set
176# CONFIG_FTRACE is not set 179# CONFIG_FTRACE is not set
177CONFIG_DEBUG_MMRS=y 180CONFIG_DEBUG_MMRS=y
178CONFIG_DEBUG_HWERR=y 181CONFIG_DEBUG_HWERR=y
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index 72e0317565e..9ccc18a6b4d 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -4,9 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EXPERT=y 7CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
12# CONFIG_SIGNALFD is not set 10# CONFIG_SIGNALFD is not set
@@ -38,7 +36,6 @@ CONFIG_C_CDPRIO=y
38CONFIG_BANK_3=0x99B2 36CONFIG_BANK_3=0x99B2
39CONFIG_BINFMT_FLAT=y 37CONFIG_BINFMT_FLAT=y
40CONFIG_BINFMT_ZFLAT=y 38CONFIG_BINFMT_ZFLAT=y
41CONFIG_PM=y
42CONFIG_NET=y 39CONFIG_NET=y
43CONFIG_PACKET=y 40CONFIG_PACKET=y
44CONFIG_UNIX=y 41CONFIG_UNIX=y
@@ -60,7 +57,6 @@ CONFIG_BFIN_SIR0=y
60CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 57CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
61# CONFIG_FW_LOADER is not set 58# CONFIG_FW_LOADER is not set
62CONFIG_MTD=y 59CONFIG_MTD=y
63CONFIG_MTD_PARTITIONS=y
64CONFIG_MTD_CHAR=m 60CONFIG_MTD_CHAR=m
65CONFIG_MTD_BLOCK=y 61CONFIG_MTD_BLOCK=y
66CONFIG_MTD_JEDECPROBE=m 62CONFIG_MTD_JEDECPROBE=m
@@ -76,10 +72,18 @@ CONFIG_BLK_DEV_SD=y
76CONFIG_BLK_DEV_SR=m 72CONFIG_BLK_DEV_SR=m
77# CONFIG_SCSI_LOWLEVEL is not set 73# CONFIG_SCSI_LOWLEVEL is not set
78CONFIG_NETDEVICES=y 74CONFIG_NETDEVICES=y
79CONFIG_NET_ETHERNET=y 75CONFIG_NET_BFIN=y
80CONFIG_BFIN_MAC=y 76CONFIG_BFIN_MAC=y
81# CONFIG_NETDEV_1000 is not set 77# CONFIG_NET_VENDOR_BROADCOM is not set
82# CONFIG_NETDEV_10000 is not set 78# CONFIG_NET_VENDOR_CHELSIO is not set
79# CONFIG_NET_VENDOR_INTEL is not set
80# CONFIG_NET_VENDOR_MARVELL is not set
81# CONFIG_NET_VENDOR_MICREL is not set
82# CONFIG_NET_VENDOR_MICROCHIP is not set
83# CONFIG_NET_VENDOR_NATSEMI is not set
84# CONFIG_NET_VENDOR_SEEQ is not set
85# CONFIG_NET_VENDOR_SMSC is not set
86# CONFIG_NET_VENDOR_STMICRO is not set
83# CONFIG_WLAN is not set 87# CONFIG_WLAN is not set
84CONFIG_INPUT_FF_MEMLESS=m 88CONFIG_INPUT_FF_MEMLESS=m
85# CONFIG_INPUT_MOUSEDEV is not set 89# CONFIG_INPUT_MOUSEDEV is not set
@@ -87,12 +91,12 @@ CONFIG_INPUT_FF_MEMLESS=m
87# CONFIG_INPUT_MOUSE is not set 91# CONFIG_INPUT_MOUSE is not set
88CONFIG_INPUT_MISC=y 92CONFIG_INPUT_MISC=y
89# CONFIG_SERIO is not set 93# CONFIG_SERIO is not set
90# CONFIG_DEVKMEM is not set 94# CONFIG_LEGACY_PTYS is not set
91CONFIG_BFIN_JTAG_COMM=m 95CONFIG_BFIN_JTAG_COMM=m
96# CONFIG_DEVKMEM is not set
92CONFIG_SERIAL_BFIN=y 97CONFIG_SERIAL_BFIN=y
93CONFIG_SERIAL_BFIN_CONSOLE=y 98CONFIG_SERIAL_BFIN_CONSOLE=y
94CONFIG_SERIAL_BFIN_UART1=y 99CONFIG_SERIAL_BFIN_UART1=y
95# CONFIG_LEGACY_PTYS is not set
96# CONFIG_HW_RANDOM is not set 100# CONFIG_HW_RANDOM is not set
97CONFIG_I2C=y 101CONFIG_I2C=y
98CONFIG_I2C_CHARDEV=m 102CONFIG_I2C_CHARDEV=m
@@ -142,8 +146,9 @@ CONFIG_USB_DEVICEFS=y
142CONFIG_USB_OTG_BLACKLIST_HUB=y 146CONFIG_USB_OTG_BLACKLIST_HUB=y
143CONFIG_USB_MON=y 147CONFIG_USB_MON=y
144CONFIG_USB_MUSB_HDRC=y 148CONFIG_USB_MUSB_HDRC=y
145CONFIG_MUSB_PIO_ONLY=y 149CONFIG_USB_MUSB_BLACKFIN=y
146CONFIG_USB_STORAGE=y 150CONFIG_USB_STORAGE=y
151CONFIG_USB_GADGET=y
147CONFIG_RTC_CLASS=y 152CONFIG_RTC_CLASS=y
148CONFIG_RTC_DRV_BFIN=y 153CONFIG_RTC_DRV_BFIN=y
149CONFIG_EXT2_FS=m 154CONFIG_EXT2_FS=m
@@ -155,16 +160,13 @@ CONFIG_VFAT_FS=m
155CONFIG_JFFS2_FS=m 160CONFIG_JFFS2_FS=m
156CONFIG_NFS_FS=m 161CONFIG_NFS_FS=m
157CONFIG_NFS_V3=y 162CONFIG_NFS_V3=y
158CONFIG_SMB_FS=m
159CONFIG_NLS_CODEPAGE_437=m 163CONFIG_NLS_CODEPAGE_437=m
160CONFIG_NLS_CODEPAGE_936=m 164CONFIG_NLS_CODEPAGE_936=m
161CONFIG_NLS_ISO8859_1=m 165CONFIG_NLS_ISO8859_1=m
162CONFIG_NLS_UTF8=m 166CONFIG_NLS_UTF8=m
163CONFIG_DEBUG_KERNEL=y
164CONFIG_DEBUG_SHIRQ=y 167CONFIG_DEBUG_SHIRQ=y
165CONFIG_DETECT_HUNG_TASK=y 168CONFIG_DETECT_HUNG_TASK=y
166CONFIG_DEBUG_INFO=y 169CONFIG_DEBUG_INFO=y
167# CONFIG_RCU_CPU_STALL_DETECTOR is not set
168# CONFIG_FTRACE is not set 170# CONFIG_FTRACE is not set
169CONFIG_DEBUG_MMRS=y 171CONFIG_DEBUG_MMRS=y
170CONFIG_DEBUG_HWERR=y 172CONFIG_DEBUG_HWERR=y
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 2f075e0b262..127f20df75a 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -4,9 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EXPERT=y 7CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
12# CONFIG_SIGNALFD is not set 10# CONFIG_SIGNALFD is not set
@@ -32,7 +30,6 @@ CONFIG_C_CDPRIO=y
32CONFIG_BANK_3=0xAAC2 30CONFIG_BANK_3=0xAAC2
33CONFIG_BINFMT_FLAT=y 31CONFIG_BINFMT_FLAT=y
34CONFIG_BINFMT_ZFLAT=y 32CONFIG_BINFMT_ZFLAT=y
35CONFIG_PM=y
36CONFIG_NET=y 33CONFIG_NET=y
37CONFIG_PACKET=y 34CONFIG_PACKET=y
38CONFIG_UNIX=y 35CONFIG_UNIX=y
@@ -53,7 +50,6 @@ CONFIG_IRTTY_SIR=m
53CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 50CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
54# CONFIG_FW_LOADER is not set 51# CONFIG_FW_LOADER is not set
55CONFIG_MTD=y 52CONFIG_MTD=y
56CONFIG_MTD_PARTITIONS=y
57CONFIG_MTD_CHAR=m 53CONFIG_MTD_CHAR=m
58CONFIG_MTD_BLOCK=y 54CONFIG_MTD_BLOCK=y
59CONFIG_MTD_JEDECPROBE=m 55CONFIG_MTD_JEDECPROBE=m
@@ -62,10 +58,16 @@ CONFIG_MTD_ROM=m
62CONFIG_MTD_COMPLEX_MAPPINGS=y 58CONFIG_MTD_COMPLEX_MAPPINGS=y
63CONFIG_BLK_DEV_RAM=y 59CONFIG_BLK_DEV_RAM=y
64CONFIG_NETDEVICES=y 60CONFIG_NETDEVICES=y
65CONFIG_NET_ETHERNET=y 61# CONFIG_NET_VENDOR_BROADCOM is not set
62# CONFIG_NET_VENDOR_CHELSIO is not set
63# CONFIG_NET_VENDOR_INTEL is not set
64# CONFIG_NET_VENDOR_MARVELL is not set
65# CONFIG_NET_VENDOR_MICREL is not set
66# CONFIG_NET_VENDOR_MICROCHIP is not set
67# CONFIG_NET_VENDOR_NATSEMI is not set
68# CONFIG_NET_VENDOR_SEEQ is not set
66CONFIG_SMC91X=y 69CONFIG_SMC91X=y
67# CONFIG_NETDEV_1000 is not set 70# CONFIG_NET_VENDOR_STMICRO is not set
68# CONFIG_NETDEV_10000 is not set
69# CONFIG_WLAN is not set 71# CONFIG_WLAN is not set
70CONFIG_INPUT=m 72CONFIG_INPUT=m
71# CONFIG_INPUT_MOUSEDEV is not set 73# CONFIG_INPUT_MOUSEDEV is not set
@@ -74,11 +76,11 @@ CONFIG_INPUT_EVDEV=m
74# CONFIG_INPUT_MOUSE is not set 76# CONFIG_INPUT_MOUSE is not set
75# CONFIG_SERIO is not set 77# CONFIG_SERIO is not set
76# CONFIG_VT is not set 78# CONFIG_VT is not set
77# CONFIG_DEVKMEM is not set 79# CONFIG_LEGACY_PTYS is not set
78CONFIG_BFIN_JTAG_COMM=m 80CONFIG_BFIN_JTAG_COMM=m
81# CONFIG_DEVKMEM is not set
79CONFIG_SERIAL_BFIN=y 82CONFIG_SERIAL_BFIN=y
80CONFIG_SERIAL_BFIN_CONSOLE=y 83CONFIG_SERIAL_BFIN_CONSOLE=y
81# CONFIG_LEGACY_PTYS is not set
82# CONFIG_HW_RANDOM is not set 84# CONFIG_HW_RANDOM is not set
83CONFIG_SPI=y 85CONFIG_SPI=y
84CONFIG_SPI_BFIN5XX=y 86CONFIG_SPI_BFIN5XX=y
@@ -94,12 +96,9 @@ CONFIG_RTC_DRV_BFIN=y
94CONFIG_JFFS2_FS=m 96CONFIG_JFFS2_FS=m
95CONFIG_NFS_FS=m 97CONFIG_NFS_FS=m
96CONFIG_NFS_V3=y 98CONFIG_NFS_V3=y
97CONFIG_SMB_FS=m
98CONFIG_DEBUG_KERNEL=y
99CONFIG_DEBUG_SHIRQ=y 99CONFIG_DEBUG_SHIRQ=y
100CONFIG_DETECT_HUNG_TASK=y 100CONFIG_DETECT_HUNG_TASK=y
101CONFIG_DEBUG_INFO=y 101CONFIG_DEBUG_INFO=y
102# CONFIG_RCU_CPU_STALL_DETECTOR is not set
103# CONFIG_FTRACE is not set 102# CONFIG_FTRACE is not set
104CONFIG_DEBUG_MMRS=y 103CONFIG_DEBUG_MMRS=y
105CONFIG_DEBUG_HWERR=y 104CONFIG_DEBUG_HWERR=y
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index ab38a82597b..0df2f921f7e 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -4,9 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EXPERT=y 7CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
12# CONFIG_SIGNALFD is not set 10# CONFIG_SIGNALFD is not set
@@ -30,7 +28,6 @@ CONFIG_C_CDPRIO=y
30CONFIG_BANK_3=0xAAC2 28CONFIG_BANK_3=0xAAC2
31CONFIG_BINFMT_FLAT=y 29CONFIG_BINFMT_FLAT=y
32CONFIG_BINFMT_ZFLAT=y 30CONFIG_BINFMT_ZFLAT=y
33CONFIG_PM=y
34CONFIG_NET=y 31CONFIG_NET=y
35CONFIG_PACKET=y 32CONFIG_PACKET=y
36CONFIG_UNIX=y 33CONFIG_UNIX=y
@@ -62,10 +59,16 @@ CONFIG_MTD_ROM=m
62CONFIG_MTD_COMPLEX_MAPPINGS=y 59CONFIG_MTD_COMPLEX_MAPPINGS=y
63CONFIG_BLK_DEV_RAM=y 60CONFIG_BLK_DEV_RAM=y
64CONFIG_NETDEVICES=y 61CONFIG_NETDEVICES=y
65CONFIG_NET_ETHERNET=y 62# CONFIG_NET_VENDOR_BROADCOM is not set
63# CONFIG_NET_VENDOR_CHELSIO is not set
64# CONFIG_NET_VENDOR_INTEL is not set
65# CONFIG_NET_VENDOR_MARVELL is not set
66# CONFIG_NET_VENDOR_MICREL is not set
67# CONFIG_NET_VENDOR_MICROCHIP is not set
68# CONFIG_NET_VENDOR_NATSEMI is not set
69# CONFIG_NET_VENDOR_SEEQ is not set
66CONFIG_SMC91X=y 70CONFIG_SMC91X=y
67# CONFIG_NETDEV_1000 is not set 71# CONFIG_NET_VENDOR_STMICRO is not set
68# CONFIG_NETDEV_10000 is not set
69# CONFIG_WLAN is not set 72# CONFIG_WLAN is not set
70# CONFIG_INPUT_MOUSEDEV is not set 73# CONFIG_INPUT_MOUSEDEV is not set
71CONFIG_INPUT_EVDEV=m 74CONFIG_INPUT_EVDEV=m
@@ -74,11 +77,11 @@ CONFIG_INPUT_EVDEV=m
74CONFIG_INPUT_MISC=y 77CONFIG_INPUT_MISC=y
75# CONFIG_SERIO is not set 78# CONFIG_SERIO is not set
76# CONFIG_VT is not set 79# CONFIG_VT is not set
77# CONFIG_DEVKMEM is not set 80# CONFIG_LEGACY_PTYS is not set
78CONFIG_BFIN_JTAG_COMM=m 81CONFIG_BFIN_JTAG_COMM=m
82# CONFIG_DEVKMEM is not set
79CONFIG_SERIAL_BFIN=y 83CONFIG_SERIAL_BFIN=y
80CONFIG_SERIAL_BFIN_CONSOLE=y 84CONFIG_SERIAL_BFIN_CONSOLE=y
81# CONFIG_LEGACY_PTYS is not set
82# CONFIG_HW_RANDOM is not set 85# CONFIG_HW_RANDOM is not set
83CONFIG_I2C=m 86CONFIG_I2C=m
84CONFIG_I2C_CHARDEV=m 87CONFIG_I2C_CHARDEV=m
@@ -106,12 +109,9 @@ CONFIG_RTC_DRV_BFIN=y
106CONFIG_JFFS2_FS=m 109CONFIG_JFFS2_FS=m
107CONFIG_NFS_FS=m 110CONFIG_NFS_FS=m
108CONFIG_NFS_V3=y 111CONFIG_NFS_V3=y
109CONFIG_SMB_FS=m
110CONFIG_DEBUG_KERNEL=y
111CONFIG_DEBUG_SHIRQ=y 112CONFIG_DEBUG_SHIRQ=y
112CONFIG_DETECT_HUNG_TASK=y 113CONFIG_DETECT_HUNG_TASK=y
113CONFIG_DEBUG_INFO=y 114CONFIG_DEBUG_INFO=y
114# CONFIG_RCU_CPU_STALL_DETECTOR is not set
115# CONFIG_FTRACE is not set 115# CONFIG_FTRACE is not set
116CONFIG_DEBUG_MMRS=y 116CONFIG_DEBUG_MMRS=y
117CONFIG_DEBUG_HWERR=y 117CONFIG_DEBUG_HWERR=y
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index 5c802d6bbbc..91d3eda4274 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -4,9 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EXPERT=y 7CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
12# CONFIG_SIGNALFD is not set 10# CONFIG_SIGNALFD is not set
@@ -30,7 +28,6 @@ CONFIG_C_CDPRIO=y
30CONFIG_BANK_3=0x99B2 28CONFIG_BANK_3=0x99B2
31CONFIG_BINFMT_FLAT=y 29CONFIG_BINFMT_FLAT=y
32CONFIG_BINFMT_ZFLAT=y 30CONFIG_BINFMT_ZFLAT=y
33CONFIG_PM=y
34CONFIG_NET=y 31CONFIG_NET=y
35CONFIG_PACKET=y 32CONFIG_PACKET=y
36CONFIG_UNIX=y 33CONFIG_UNIX=y
@@ -45,7 +42,6 @@ CONFIG_IP_PNP=y
45CONFIG_CAN=m 42CONFIG_CAN=m
46CONFIG_CAN_RAW=m 43CONFIG_CAN_RAW=m
47CONFIG_CAN_BCM=m 44CONFIG_CAN_BCM=m
48CONFIG_CAN_DEV=m
49CONFIG_CAN_BFIN=m 45CONFIG_CAN_BFIN=m
50CONFIG_IRDA=m 46CONFIG_IRDA=m
51CONFIG_IRLAN=m 47CONFIG_IRLAN=m
@@ -58,7 +54,6 @@ CONFIG_BFIN_SIR1=y
58CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 54CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
59# CONFIG_FW_LOADER is not set 55# CONFIG_FW_LOADER is not set
60CONFIG_MTD=y 56CONFIG_MTD=y
61CONFIG_MTD_PARTITIONS=y
62CONFIG_MTD_CMDLINE_PARTS=y 57CONFIG_MTD_CMDLINE_PARTS=y
63CONFIG_MTD_CHAR=m 58CONFIG_MTD_CHAR=m
64CONFIG_MTD_BLOCK=y 59CONFIG_MTD_BLOCK=y
@@ -69,11 +64,18 @@ CONFIG_MTD_ROM=m
69CONFIG_MTD_PHYSMAP=m 64CONFIG_MTD_PHYSMAP=m
70CONFIG_BLK_DEV_RAM=y 65CONFIG_BLK_DEV_RAM=y
71CONFIG_NETDEVICES=y 66CONFIG_NETDEVICES=y
72CONFIG_SMSC_PHY=y 67CONFIG_NET_BFIN=y
73CONFIG_NET_ETHERNET=y
74CONFIG_BFIN_MAC=y 68CONFIG_BFIN_MAC=y
75# CONFIG_NETDEV_1000 is not set 69# CONFIG_NET_VENDOR_BROADCOM is not set
76# CONFIG_NETDEV_10000 is not set 70# CONFIG_NET_VENDOR_CHELSIO is not set
71# CONFIG_NET_VENDOR_INTEL is not set
72# CONFIG_NET_VENDOR_MARVELL is not set
73# CONFIG_NET_VENDOR_MICREL is not set
74# CONFIG_NET_VENDOR_MICROCHIP is not set
75# CONFIG_NET_VENDOR_NATSEMI is not set
76# CONFIG_NET_VENDOR_SEEQ is not set
77# CONFIG_NET_VENDOR_SMSC is not set
78# CONFIG_NET_VENDOR_STMICRO is not set
77# CONFIG_WLAN is not set 79# CONFIG_WLAN is not set
78# CONFIG_INPUT_MOUSEDEV is not set 80# CONFIG_INPUT_MOUSEDEV is not set
79CONFIG_INPUT_EVDEV=m 81CONFIG_INPUT_EVDEV=m
@@ -82,12 +84,12 @@ CONFIG_INPUT_EVDEV=m
82CONFIG_INPUT_MISC=y 84CONFIG_INPUT_MISC=y
83# CONFIG_SERIO is not set 85# CONFIG_SERIO is not set
84# CONFIG_VT is not set 86# CONFIG_VT is not set
85# CONFIG_DEVKMEM is not set 87# CONFIG_LEGACY_PTYS is not set
86CONFIG_BFIN_JTAG_COMM=m 88CONFIG_BFIN_JTAG_COMM=m
89# CONFIG_DEVKMEM is not set
87CONFIG_SERIAL_BFIN=y 90CONFIG_SERIAL_BFIN=y
88CONFIG_SERIAL_BFIN_CONSOLE=y 91CONFIG_SERIAL_BFIN_CONSOLE=y
89CONFIG_SERIAL_BFIN_UART0=y 92CONFIG_SERIAL_BFIN_UART0=y
90# CONFIG_LEGACY_PTYS is not set
91# CONFIG_HW_RANDOM is not set 93# CONFIG_HW_RANDOM is not set
92CONFIG_I2C=m 94CONFIG_I2C=m
93CONFIG_I2C_CHARDEV=m 95CONFIG_I2C_CHARDEV=m
@@ -117,12 +119,9 @@ CONFIG_RTC_DRV_BFIN=y
117CONFIG_JFFS2_FS=m 119CONFIG_JFFS2_FS=m
118CONFIG_NFS_FS=m 120CONFIG_NFS_FS=m
119CONFIG_NFS_V3=y 121CONFIG_NFS_V3=y
120CONFIG_SMB_FS=m
121CONFIG_DEBUG_KERNEL=y
122CONFIG_DEBUG_SHIRQ=y 122CONFIG_DEBUG_SHIRQ=y
123CONFIG_DETECT_HUNG_TASK=y 123CONFIG_DETECT_HUNG_TASK=y
124CONFIG_DEBUG_INFO=y 124CONFIG_DEBUG_INFO=y
125# CONFIG_RCU_CPU_STALL_DETECTOR is not set
126# CONFIG_FTRACE is not set 125# CONFIG_FTRACE is not set
127CONFIG_DEBUG_MMRS=y 126CONFIG_DEBUG_MMRS=y
128CONFIG_DEBUG_HWERR=y 127CONFIG_DEBUG_HWERR=y
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index 7a1e3bf2b04..e716fdfd2cf 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -5,7 +5,6 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7CONFIG_EXPERT=y 7CONFIG_EXPERT=y
8# CONFIG_SYSCTL_SYSCALL is not set
9# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
10# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
11# CONFIG_SIGNALFD is not set 10# CONFIG_SIGNALFD is not set
@@ -85,10 +84,16 @@ CONFIG_ATA=y
85# CONFIG_SATA_PMP is not set 84# CONFIG_SATA_PMP is not set
86CONFIG_PATA_BF54X=y 85CONFIG_PATA_BF54X=y
87CONFIG_NETDEVICES=y 86CONFIG_NETDEVICES=y
88CONFIG_NET_ETHERNET=y 87# CONFIG_NET_VENDOR_BROADCOM is not set
88# CONFIG_NET_VENDOR_CHELSIO is not set
89# CONFIG_NET_VENDOR_INTEL is not set
90# CONFIG_NET_VENDOR_MARVELL is not set
91# CONFIG_NET_VENDOR_MICREL is not set
92# CONFIG_NET_VENDOR_MICROCHIP is not set
93# CONFIG_NET_VENDOR_NATSEMI is not set
94# CONFIG_NET_VENDOR_SEEQ is not set
89CONFIG_SMSC911X=y 95CONFIG_SMSC911X=y
90# CONFIG_NETDEV_1000 is not set 96# CONFIG_NET_VENDOR_STMICRO is not set
91# CONFIG_NETDEV_10000 is not set
92# CONFIG_WLAN is not set 97# CONFIG_WLAN is not set
93CONFIG_INPUT_FF_MEMLESS=m 98CONFIG_INPUT_FF_MEMLESS=m
94# CONFIG_INPUT_MOUSEDEV is not set 99# CONFIG_INPUT_MOUSEDEV is not set
@@ -161,6 +166,7 @@ CONFIG_USB_MON=y
161CONFIG_USB_MUSB_HDRC=y 166CONFIG_USB_MUSB_HDRC=y
162CONFIG_USB_MUSB_BLACKFIN=y 167CONFIG_USB_MUSB_BLACKFIN=y
163CONFIG_USB_STORAGE=y 168CONFIG_USB_STORAGE=y
169CONFIG_USB_GADGET=y
164CONFIG_MMC=y 170CONFIG_MMC=y
165CONFIG_MMC_BLOCK=m 171CONFIG_MMC_BLOCK=m
166CONFIG_SDH_BFIN=y 172CONFIG_SDH_BFIN=y
@@ -187,7 +193,6 @@ CONFIG_NLS_CODEPAGE_437=m
187CONFIG_NLS_CODEPAGE_936=m 193CONFIG_NLS_CODEPAGE_936=m
188CONFIG_NLS_ISO8859_1=m 194CONFIG_NLS_ISO8859_1=m
189CONFIG_NLS_UTF8=m 195CONFIG_NLS_UTF8=m
190CONFIG_DEBUG_KERNEL=y
191CONFIG_DEBUG_SHIRQ=y 196CONFIG_DEBUG_SHIRQ=y
192CONFIG_DETECT_HUNG_TASK=y 197CONFIG_DETECT_HUNG_TASK=y
193CONFIG_DEBUG_INFO=y 198CONFIG_DEBUG_INFO=y
diff --git a/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig b/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig
index 78adbbf3982..680730eeaf2 100644
--- a/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig
@@ -4,9 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EXPERT=y 7CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
12# CONFIG_SIGNALFD is not set 10# CONFIG_SIGNALFD is not set
@@ -23,17 +21,18 @@ CONFIG_MODULE_UNLOAD=y
23# CONFIG_IOSCHED_CFQ is not set 21# CONFIG_IOSCHED_CFQ is not set
24CONFIG_PREEMPT_VOLUNTARY=y 22CONFIG_PREEMPT_VOLUNTARY=y
25CONFIG_BF561=y 23CONFIG_BF561=y
26CONFIG_SMP=y
27CONFIG_IRQ_TIMER0=10 24CONFIG_IRQ_TIMER0=10
28CONFIG_CLKIN_HZ=30000000 25CONFIG_CLKIN_HZ=30000000
29CONFIG_HIGH_RES_TIMERS=y 26CONFIG_HIGH_RES_TIMERS=y
30CONFIG_NOMMU_INITIAL_TRIM_EXCESS=0 27CONFIG_NOMMU_INITIAL_TRIM_EXCESS=0
31CONFIG_BFIN_GPTIMERS=m 28CONFIG_BFIN_GPTIMERS=m
29CONFIG_BFIN_EXTMEM_WRITETHROUGH=y
30CONFIG_BFIN_L2_DCACHEABLE=y
31CONFIG_BFIN_L2_WRITETHROUGH=y
32CONFIG_C_CDPRIO=y 32CONFIG_C_CDPRIO=y
33CONFIG_BANK_3=0xAAC2 33CONFIG_BANK_3=0xAAC2
34CONFIG_BINFMT_FLAT=y 34CONFIG_BINFMT_FLAT=y
35CONFIG_BINFMT_ZFLAT=y 35CONFIG_BINFMT_ZFLAT=y
36CONFIG_PM=y
37CONFIG_NET=y 36CONFIG_NET=y
38CONFIG_PACKET=y 37CONFIG_PACKET=y
39CONFIG_UNIX=y 38CONFIG_UNIX=y
@@ -54,21 +53,26 @@ CONFIG_IRTTY_SIR=m
54CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 53CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
55# CONFIG_FW_LOADER is not set 54# CONFIG_FW_LOADER is not set
56CONFIG_MTD=y 55CONFIG_MTD=y
57CONFIG_MTD_PARTITIONS=y
58CONFIG_MTD_CMDLINE_PARTS=y 56CONFIG_MTD_CMDLINE_PARTS=y
59CONFIG_MTD_CHAR=m 57CONFIG_MTD_CHAR=y
60CONFIG_MTD_BLOCK=y 58CONFIG_MTD_BLOCK=y
61CONFIG_MTD_CFI=m 59CONFIG_MTD_CFI=y
62CONFIG_MTD_CFI_AMDSTD=m 60CONFIG_MTD_CFI_AMDSTD=y
63CONFIG_MTD_RAM=y 61CONFIG_MTD_RAM=y
64CONFIG_MTD_ROM=m 62CONFIG_MTD_ROM=m
65CONFIG_MTD_PHYSMAP=m 63CONFIG_MTD_PHYSMAP=y
66CONFIG_BLK_DEV_RAM=y 64CONFIG_BLK_DEV_RAM=y
67CONFIG_NETDEVICES=y 65CONFIG_NETDEVICES=y
68CONFIG_NET_ETHERNET=y 66# CONFIG_NET_VENDOR_BROADCOM is not set
67# CONFIG_NET_VENDOR_CHELSIO is not set
68# CONFIG_NET_VENDOR_INTEL is not set
69# CONFIG_NET_VENDOR_MARVELL is not set
70# CONFIG_NET_VENDOR_MICREL is not set
71# CONFIG_NET_VENDOR_MICROCHIP is not set
72# CONFIG_NET_VENDOR_NATSEMI is not set
73# CONFIG_NET_VENDOR_SEEQ is not set
69CONFIG_SMC91X=y 74CONFIG_SMC91X=y
70# CONFIG_NETDEV_1000 is not set 75# CONFIG_NET_VENDOR_STMICRO is not set
71# CONFIG_NETDEV_10000 is not set
72# CONFIG_WLAN is not set 76# CONFIG_WLAN is not set
73CONFIG_INPUT=m 77CONFIG_INPUT=m
74# CONFIG_INPUT_MOUSEDEV is not set 78# CONFIG_INPUT_MOUSEDEV is not set
@@ -77,11 +81,11 @@ CONFIG_INPUT_EVDEV=m
77# CONFIG_INPUT_MOUSE is not set 81# CONFIG_INPUT_MOUSE is not set
78# CONFIG_SERIO is not set 82# CONFIG_SERIO is not set
79# CONFIG_VT is not set 83# CONFIG_VT is not set
80# CONFIG_DEVKMEM is not set 84# CONFIG_LEGACY_PTYS is not set
81CONFIG_BFIN_JTAG_COMM=m 85CONFIG_BFIN_JTAG_COMM=m
86# CONFIG_DEVKMEM is not set
82CONFIG_SERIAL_BFIN=y 87CONFIG_SERIAL_BFIN=y
83CONFIG_SERIAL_BFIN_CONSOLE=y 88CONFIG_SERIAL_BFIN_CONSOLE=y
84# CONFIG_LEGACY_PTYS is not set
85# CONFIG_HW_RANDOM is not set 89# CONFIG_HW_RANDOM is not set
86CONFIG_SPI=y 90CONFIG_SPI=y
87CONFIG_SPI_BFIN5XX=y 91CONFIG_SPI_BFIN5XX=y
@@ -95,12 +99,9 @@ CONFIG_BFIN_WDT=y
95CONFIG_JFFS2_FS=m 99CONFIG_JFFS2_FS=m
96CONFIG_NFS_FS=m 100CONFIG_NFS_FS=m
97CONFIG_NFS_V3=y 101CONFIG_NFS_V3=y
98CONFIG_SMB_FS=m
99CONFIG_DEBUG_KERNEL=y
100CONFIG_DEBUG_SHIRQ=y 102CONFIG_DEBUG_SHIRQ=y
101CONFIG_DETECT_HUNG_TASK=y 103CONFIG_DETECT_HUNG_TASK=y
102CONFIG_DEBUG_INFO=y 104CONFIG_DEBUG_INFO=y
103# CONFIG_RCU_CPU_STALL_DETECTOR is not set
104# CONFIG_FTRACE is not set 105# CONFIG_FTRACE is not set
105CONFIG_DEBUG_MMRS=y 106CONFIG_DEBUG_MMRS=y
106CONFIG_DEBUG_HWERR=y 107CONFIG_DEBUG_HWERR=y
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index d3cd0f561c8..680730eeaf2 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -4,9 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EXPERT=y 7CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
12# CONFIG_SIGNALFD is not set 10# CONFIG_SIGNALFD is not set
@@ -35,7 +33,6 @@ CONFIG_C_CDPRIO=y
35CONFIG_BANK_3=0xAAC2 33CONFIG_BANK_3=0xAAC2
36CONFIG_BINFMT_FLAT=y 34CONFIG_BINFMT_FLAT=y
37CONFIG_BINFMT_ZFLAT=y 35CONFIG_BINFMT_ZFLAT=y
38CONFIG_PM=y
39CONFIG_NET=y 36CONFIG_NET=y
40CONFIG_PACKET=y 37CONFIG_PACKET=y
41CONFIG_UNIX=y 38CONFIG_UNIX=y
@@ -56,7 +53,6 @@ CONFIG_IRTTY_SIR=m
56CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 53CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
57# CONFIG_FW_LOADER is not set 54# CONFIG_FW_LOADER is not set
58CONFIG_MTD=y 55CONFIG_MTD=y
59CONFIG_MTD_PARTITIONS=y
60CONFIG_MTD_CMDLINE_PARTS=y 56CONFIG_MTD_CMDLINE_PARTS=y
61CONFIG_MTD_CHAR=y 57CONFIG_MTD_CHAR=y
62CONFIG_MTD_BLOCK=y 58CONFIG_MTD_BLOCK=y
@@ -67,10 +63,16 @@ CONFIG_MTD_ROM=m
67CONFIG_MTD_PHYSMAP=y 63CONFIG_MTD_PHYSMAP=y
68CONFIG_BLK_DEV_RAM=y 64CONFIG_BLK_DEV_RAM=y
69CONFIG_NETDEVICES=y 65CONFIG_NETDEVICES=y
70CONFIG_NET_ETHERNET=y 66# CONFIG_NET_VENDOR_BROADCOM is not set
67# CONFIG_NET_VENDOR_CHELSIO is not set
68# CONFIG_NET_VENDOR_INTEL is not set
69# CONFIG_NET_VENDOR_MARVELL is not set
70# CONFIG_NET_VENDOR_MICREL is not set
71# CONFIG_NET_VENDOR_MICROCHIP is not set
72# CONFIG_NET_VENDOR_NATSEMI is not set
73# CONFIG_NET_VENDOR_SEEQ is not set
71CONFIG_SMC91X=y 74CONFIG_SMC91X=y
72# CONFIG_NETDEV_1000 is not set 75# CONFIG_NET_VENDOR_STMICRO is not set
73# CONFIG_NETDEV_10000 is not set
74# CONFIG_WLAN is not set 76# CONFIG_WLAN is not set
75CONFIG_INPUT=m 77CONFIG_INPUT=m
76# CONFIG_INPUT_MOUSEDEV is not set 78# CONFIG_INPUT_MOUSEDEV is not set
@@ -79,11 +81,11 @@ CONFIG_INPUT_EVDEV=m
79# CONFIG_INPUT_MOUSE is not set 81# CONFIG_INPUT_MOUSE is not set
80# CONFIG_SERIO is not set 82# CONFIG_SERIO is not set
81# CONFIG_VT is not set 83# CONFIG_VT is not set
82# CONFIG_DEVKMEM is not set 84# CONFIG_LEGACY_PTYS is not set
83CONFIG_BFIN_JTAG_COMM=m 85CONFIG_BFIN_JTAG_COMM=m
86# CONFIG_DEVKMEM is not set
84CONFIG_SERIAL_BFIN=y 87CONFIG_SERIAL_BFIN=y
85CONFIG_SERIAL_BFIN_CONSOLE=y 88CONFIG_SERIAL_BFIN_CONSOLE=y
86# CONFIG_LEGACY_PTYS is not set
87# CONFIG_HW_RANDOM is not set 89# CONFIG_HW_RANDOM is not set
88CONFIG_SPI=y 90CONFIG_SPI=y
89CONFIG_SPI_BFIN5XX=y 91CONFIG_SPI_BFIN5XX=y
@@ -97,12 +99,9 @@ CONFIG_BFIN_WDT=y
97CONFIG_JFFS2_FS=m 99CONFIG_JFFS2_FS=m
98CONFIG_NFS_FS=m 100CONFIG_NFS_FS=m
99CONFIG_NFS_V3=y 101CONFIG_NFS_V3=y
100CONFIG_SMB_FS=m
101CONFIG_DEBUG_KERNEL=y
102CONFIG_DEBUG_SHIRQ=y 102CONFIG_DEBUG_SHIRQ=y
103CONFIG_DETECT_HUNG_TASK=y 103CONFIG_DETECT_HUNG_TASK=y
104CONFIG_DEBUG_INFO=y 104CONFIG_DEBUG_INFO=y
105# CONFIG_RCU_CPU_STALL_DETECTOR is not set
106# CONFIG_FTRACE is not set 105# CONFIG_FTRACE is not set
107CONFIG_DEBUG_MMRS=y 106CONFIG_DEBUG_MMRS=y
108CONFIG_DEBUG_HWERR=y 107CONFIG_DEBUG_HWERR=y
diff --git a/arch/blackfin/include/asm/atomic.h b/arch/blackfin/include/asm/atomic.h
index 54c6e2887e9..c8db653c72d 100644
--- a/arch/blackfin/include/asm/atomic.h
+++ b/arch/blackfin/include/asm/atomic.h
@@ -7,6 +7,8 @@
7#ifndef __ARCH_BLACKFIN_ATOMIC__ 7#ifndef __ARCH_BLACKFIN_ATOMIC__
8#define __ARCH_BLACKFIN_ATOMIC__ 8#define __ARCH_BLACKFIN_ATOMIC__
9 9
10#include <asm/cmpxchg.h>
11
10#ifdef CONFIG_SMP 12#ifdef CONFIG_SMP
11 13
12#include <linux/linkage.h> 14#include <linux/linkage.h>
diff --git a/arch/blackfin/include/asm/barrier.h b/arch/blackfin/include/asm/barrier.h
new file mode 100644
index 00000000000..ebb189507dd
--- /dev/null
+++ b/arch/blackfin/include/asm/barrier.h
@@ -0,0 +1,48 @@
1/*
2 * Copyright 2004-2009 Analog Devices Inc.
3 * Tony Kou (tonyko@lineo.ca)
4 *
5 * Licensed under the GPL-2 or later
6 */
7
8#ifndef _BLACKFIN_BARRIER_H
9#define _BLACKFIN_BARRIER_H
10
11#include <asm/cache.h>
12
13#define nop() __asm__ __volatile__ ("nop;\n\t" : : )
14
15/*
16 * Force strict CPU ordering.
17 */
18#ifdef CONFIG_SMP
19
20#ifdef __ARCH_SYNC_CORE_DCACHE
21/* Force Core data cache coherence */
22# define mb() do { barrier(); smp_check_barrier(); smp_mark_barrier(); } while (0)
23# define rmb() do { barrier(); smp_check_barrier(); } while (0)
24# define wmb() do { barrier(); smp_mark_barrier(); } while (0)
25# define read_barrier_depends() do { barrier(); smp_check_barrier(); } while (0)
26#else
27# define mb() barrier()
28# define rmb() barrier()
29# define wmb() barrier()
30# define read_barrier_depends() do { } while (0)
31#endif
32
33#else /* !CONFIG_SMP */
34
35#define mb() barrier()
36#define rmb() barrier()
37#define wmb() barrier()
38#define read_barrier_depends() do { } while (0)
39
40#endif /* !CONFIG_SMP */
41
42#define smp_mb() mb()
43#define smp_rmb() rmb()
44#define smp_wmb() wmb()
45#define set_mb(var, value) do { var = value; mb(); } while (0)
46#define smp_read_barrier_depends() read_barrier_depends()
47
48#endif /* _BLACKFIN_BARRIER_H */
diff --git a/arch/blackfin/include/asm/bfin5xx_spi.h b/arch/blackfin/include/asm/bfin5xx_spi.h
index 5392583d025..fb95c853bb1 100644
--- a/arch/blackfin/include/asm/bfin5xx_spi.h
+++ b/arch/blackfin/include/asm/bfin5xx_spi.h
@@ -77,7 +77,6 @@ struct bfin5xx_spi_master {
77struct bfin5xx_spi_chip { 77struct bfin5xx_spi_chip {
78 u16 ctl_reg; 78 u16 ctl_reg;
79 u8 enable_dma; 79 u8 enable_dma;
80 u8 bits_per_word;
81 u16 cs_chg_udelay; /* Some devices require 16-bit delays */ 80 u16 cs_chg_udelay; /* Some devices require 16-bit delays */
82 /* Value to send if no TX value is supplied, usually 0x0 or 0xFFFF */ 81 /* Value to send if no TX value is supplied, usually 0x0 or 0xFFFF */
83 u16 idle_tx_val; 82 u16 idle_tx_val;
diff --git a/arch/blackfin/include/asm/bfin_simple_timer.h b/arch/blackfin/include/asm/bfin_simple_timer.h
index 5248c133bc6..aadfb1ad1fa 100644
--- a/arch/blackfin/include/asm/bfin_simple_timer.h
+++ b/arch/blackfin/include/asm/bfin_simple_timer.h
@@ -11,9 +11,11 @@
11 11
12#define BFIN_SIMPLE_TIMER_IOCTL_MAGIC 't' 12#define BFIN_SIMPLE_TIMER_IOCTL_MAGIC 't'
13 13
14#define BFIN_SIMPLE_TIMER_SET_PERIOD _IO (BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 2) 14#define BFIN_SIMPLE_TIMER_SET_PERIOD _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 2)
15#define BFIN_SIMPLE_TIMER_START _IO (BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 6) 15#define BFIN_SIMPLE_TIMER_SET_WIDTH _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 3)
16#define BFIN_SIMPLE_TIMER_STOP _IO (BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 8) 16#define BFIN_SIMPLE_TIMER_SET_MODE _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 4)
17#define BFIN_SIMPLE_TIMER_READ _IO (BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 10) 17#define BFIN_SIMPLE_TIMER_START _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 6)
18#define BFIN_SIMPLE_TIMER_STOP _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 8)
19#define BFIN_SIMPLE_TIMER_READ _IO(BFIN_SIMPLE_TIMER_IOCTL_MAGIC, 10)
18 20
19#endif 21#endif
diff --git a/arch/blackfin/include/asm/bfin_sport.h b/arch/blackfin/include/asm/bfin_sport.h
index f8568a31d0a..0afcfbd54a8 100644
--- a/arch/blackfin/include/asm/bfin_sport.h
+++ b/arch/blackfin/include/asm/bfin_sport.h
@@ -13,6 +13,7 @@
13#define NORM_MODE 0x0 13#define NORM_MODE 0x0
14#define TDM_MODE 0x1 14#define TDM_MODE 0x1
15#define I2S_MODE 0x2 15#define I2S_MODE 0x2
16#define NDSO_MODE 0x3
16 17
17/* Data format, normal, a-law or u-law */ 18/* Data format, normal, a-law or u-law */
18#define NORM_FORMAT 0x0 19#define NORM_FORMAT 0x0
@@ -56,6 +57,8 @@ struct sport_config {
56/* Userspace interface */ 57/* Userspace interface */
57#define SPORT_IOC_MAGIC 'P' 58#define SPORT_IOC_MAGIC 'P'
58#define SPORT_IOC_CONFIG _IOWR('P', 0x01, struct sport_config) 59#define SPORT_IOC_CONFIG _IOWR('P', 0x01, struct sport_config)
60#define SPORT_IOC_GET_SYSTEMCLOCK _IOR('P', 0x02, unsigned long)
61#define SPORT_IOC_SET_BAUDRATE _IOW('P', 0x03, unsigned long)
59 62
60#ifdef __KERNEL__ 63#ifdef __KERNEL__
61 64
diff --git a/arch/blackfin/include/asm/blackfin.h b/arch/blackfin/include/asm/blackfin.h
index 0928700b6bc..7be5368c051 100644
--- a/arch/blackfin/include/asm/blackfin.h
+++ b/arch/blackfin/include/asm/blackfin.h
@@ -17,22 +17,16 @@
17static inline void SSYNC(void) 17static inline void SSYNC(void)
18{ 18{
19 int _tmp; 19 int _tmp;
20 if (ANOMALY_05000312) 20 if (ANOMALY_05000312 || ANOMALY_05000244)
21 __asm__ __volatile__( 21 __asm__ __volatile__(
22 "cli %0;" 22 "cli %0;"
23 "nop;" 23 "nop;"
24 "nop;" 24 "nop;"
25 "nop;"
25 "ssync;" 26 "ssync;"
26 "sti %0;" 27 "sti %0;"
27 : "=d" (_tmp) 28 : "=d" (_tmp)
28 ); 29 );
29 else if (ANOMALY_05000244)
30 __asm__ __volatile__(
31 "nop;"
32 "nop;"
33 "nop;"
34 "ssync;"
35 );
36 else 30 else
37 __asm__ __volatile__("ssync;"); 31 __asm__ __volatile__("ssync;");
38} 32}
@@ -41,22 +35,16 @@ static inline void SSYNC(void)
41static inline void CSYNC(void) 35static inline void CSYNC(void)
42{ 36{
43 int _tmp; 37 int _tmp;
44 if (ANOMALY_05000312) 38 if (ANOMALY_05000312 || ANOMALY_05000244)
45 __asm__ __volatile__( 39 __asm__ __volatile__(
46 "cli %0;" 40 "cli %0;"
47 "nop;" 41 "nop;"
48 "nop;" 42 "nop;"
43 "nop;"
49 "csync;" 44 "csync;"
50 "sti %0;" 45 "sti %0;"
51 : "=d" (_tmp) 46 : "=d" (_tmp)
52 ); 47 );
53 else if (ANOMALY_05000244)
54 __asm__ __volatile__(
55 "nop;"
56 "nop;"
57 "nop;"
58 "csync;"
59 );
60 else 48 else
61 __asm__ __volatile__("csync;"); 49 __asm__ __volatile__("csync;");
62} 50}
@@ -73,18 +61,26 @@ static inline void CSYNC(void)
73#define ssync(x) SSYNC(x) 61#define ssync(x) SSYNC(x)
74#define csync(x) CSYNC(x) 62#define csync(x) CSYNC(x)
75 63
76#if ANOMALY_05000312 64#if ANOMALY_05000312 || ANOMALY_05000244
77#define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch; 65#define SSYNC(scratch) \
78#define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch; 66do { \
79 67 cli scratch; \
80#elif ANOMALY_05000244 68 nop; nop; nop; \
81#define SSYNC(scratch) nop; nop; nop; SSYNC; 69 SSYNC; \
82#define CSYNC(scratch) nop; nop; nop; CSYNC; 70 sti scratch; \
71} while (0)
72
73#define CSYNC(scratch) \
74do { \
75 cli scratch; \
76 nop; nop; nop; \
77 CSYNC; \
78 sti scratch; \
79} while (0)
83 80
84#else 81#else
85#define SSYNC(scratch) SSYNC; 82#define SSYNC(scratch) SSYNC;
86#define CSYNC(scratch) CSYNC; 83#define CSYNC(scratch) CSYNC;
87
88#endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */ 84#endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */
89 85
90#endif /* __ASSEMBLY__ */ 86#endif /* __ASSEMBLY__ */
diff --git a/arch/blackfin/include/asm/cmpxchg.h b/arch/blackfin/include/asm/cmpxchg.h
new file mode 100644
index 00000000000..ba2484f4cb2
--- /dev/null
+++ b/arch/blackfin/include/asm/cmpxchg.h
@@ -0,0 +1,132 @@
1/*
2 * Copyright 2004-2011 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
7#ifndef __ARCH_BLACKFIN_CMPXCHG__
8#define __ARCH_BLACKFIN_CMPXCHG__
9
10#ifdef CONFIG_SMP
11
12#include <linux/linkage.h>
13
14asmlinkage unsigned long __raw_xchg_1_asm(volatile void *ptr, unsigned long value);
15asmlinkage unsigned long __raw_xchg_2_asm(volatile void *ptr, unsigned long value);
16asmlinkage unsigned long __raw_xchg_4_asm(volatile void *ptr, unsigned long value);
17asmlinkage unsigned long __raw_cmpxchg_1_asm(volatile void *ptr,
18 unsigned long new, unsigned long old);
19asmlinkage unsigned long __raw_cmpxchg_2_asm(volatile void *ptr,
20 unsigned long new, unsigned long old);
21asmlinkage unsigned long __raw_cmpxchg_4_asm(volatile void *ptr,
22 unsigned long new, unsigned long old);
23
24static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
25 int size)
26{
27 unsigned long tmp;
28
29 switch (size) {
30 case 1:
31 tmp = __raw_xchg_1_asm(ptr, x);
32 break;
33 case 2:
34 tmp = __raw_xchg_2_asm(ptr, x);
35 break;
36 case 4:
37 tmp = __raw_xchg_4_asm(ptr, x);
38 break;
39 }
40
41 return tmp;
42}
43
44/*
45 * Atomic compare and exchange. Compare OLD with MEM, if identical,
46 * store NEW in MEM. Return the initial value in MEM. Success is
47 * indicated by comparing RETURN with OLD.
48 */
49static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
50 unsigned long new, int size)
51{
52 unsigned long tmp;
53
54 switch (size) {
55 case 1:
56 tmp = __raw_cmpxchg_1_asm(ptr, new, old);
57 break;
58 case 2:
59 tmp = __raw_cmpxchg_2_asm(ptr, new, old);
60 break;
61 case 4:
62 tmp = __raw_cmpxchg_4_asm(ptr, new, old);
63 break;
64 }
65
66 return tmp;
67}
68#define cmpxchg(ptr, o, n) \
69 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
70 (unsigned long)(n), sizeof(*(ptr))))
71
72#else /* !CONFIG_SMP */
73
74#include <mach/blackfin.h>
75#include <asm/irqflags.h>
76
77struct __xchg_dummy {
78 unsigned long a[100];
79};
80#define __xg(x) ((volatile struct __xchg_dummy *)(x))
81
82static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
83 int size)
84{
85 unsigned long tmp = 0;
86 unsigned long flags;
87
88 flags = hard_local_irq_save();
89
90 switch (size) {
91 case 1:
92 __asm__ __volatile__
93 ("%0 = b%2 (z);\n\t"
94 "b%2 = %1;\n\t"
95 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
96 break;
97 case 2:
98 __asm__ __volatile__
99 ("%0 = w%2 (z);\n\t"
100 "w%2 = %1;\n\t"
101 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
102 break;
103 case 4:
104 __asm__ __volatile__
105 ("%0 = %2;\n\t"
106 "%2 = %1;\n\t"
107 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
108 break;
109 }
110 hard_local_irq_restore(flags);
111 return tmp;
112}
113
114#include <asm-generic/cmpxchg-local.h>
115
116/*
117 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
118 * them available.
119 */
120#define cmpxchg_local(ptr, o, n) \
121 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
122 (unsigned long)(n), sizeof(*(ptr))))
123#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
124
125#include <asm-generic/cmpxchg.h>
126
127#endif /* !CONFIG_SMP */
128
129#define xchg(ptr, x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
130#define tas(ptr) ((void)xchg((ptr), 1))
131
132#endif /* __ARCH_BLACKFIN_CMPXCHG__ */
diff --git a/arch/blackfin/include/asm/exec.h b/arch/blackfin/include/asm/exec.h
new file mode 100644
index 00000000000..54c2e1db274
--- /dev/null
+++ b/arch/blackfin/include/asm/exec.h
@@ -0,0 +1 @@
/* define arch_align_stack() here */
diff --git a/arch/blackfin/include/asm/irq.h b/arch/blackfin/include/asm/irq.h
index 12f4060a31b..89de539ed01 100644
--- a/arch/blackfin/include/asm/irq.h
+++ b/arch/blackfin/include/asm/irq.h
@@ -38,8 +38,4 @@
38 38
39#include <asm-generic/irq.h> 39#include <asm-generic/irq.h>
40 40
41#ifdef CONFIG_NMI_WATCHDOG
42# define ARCH_HAS_NMI_WATCHDOG
43#endif
44
45#endif /* _BFIN_IRQ_H_ */ 41#endif /* _BFIN_IRQ_H_ */
diff --git a/arch/blackfin/include/asm/irq_handler.h b/arch/blackfin/include/asm/irq_handler.h
index ee73f79aef1..4fbf83575db 100644
--- a/arch/blackfin/include/asm/irq_handler.h
+++ b/arch/blackfin/include/asm/irq_handler.h
@@ -9,6 +9,7 @@
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <mach/irq.h>
12 13
13/* init functions only */ 14/* init functions only */
14extern int __init init_arch_irq(void); 15extern int __init init_arch_irq(void);
diff --git a/arch/blackfin/include/asm/kgdb.h b/arch/blackfin/include/asm/kgdb.h
index aaf884591b0..2703ddeeb5d 100644
--- a/arch/blackfin/include/asm/kgdb.h
+++ b/arch/blackfin/include/asm/kgdb.h
@@ -109,6 +109,7 @@ static inline void arch_kgdb_breakpoint(void)
109# define CACHE_FLUSH_IS_SAFE 1 109# define CACHE_FLUSH_IS_SAFE 1
110#endif 110#endif
111#define GDB_ADJUSTS_BREAK_OFFSET 111#define GDB_ADJUSTS_BREAK_OFFSET
112#define GDB_SKIP_HW_WATCH_TEST
112#define HW_INST_WATCHPOINT_NUM 6 113#define HW_INST_WATCHPOINT_NUM 6
113#define HW_WATCHPOINT_NUM 8 114#define HW_WATCHPOINT_NUM 8
114#define TYPE_INST_WATCHPOINT 0 115#define TYPE_INST_WATCHPOINT 0
diff --git a/arch/blackfin/include/asm/mmu_context.h b/arch/blackfin/include/asm/mmu_context.h
index 3828c70e7a2..15b16d3e8de 100644
--- a/arch/blackfin/include/asm/mmu_context.h
+++ b/arch/blackfin/include/asm/mmu_context.h
@@ -30,8 +30,11 @@ extern void *l1sram_alloc_max(void*);
30static inline void free_l1stack(void) 30static inline void free_l1stack(void)
31{ 31{
32 nr_l1stack_tasks--; 32 nr_l1stack_tasks--;
33 if (nr_l1stack_tasks == 0) 33 if (nr_l1stack_tasks == 0) {
34 l1sram_free(l1_stack_base); 34 l1sram_free(l1_stack_base);
35 l1_stack_base = NULL;
36 l1_stack_len = 0;
37 }
35} 38}
36 39
37static inline unsigned long 40static inline unsigned long
diff --git a/arch/blackfin/include/asm/switch_to.h b/arch/blackfin/include/asm/switch_to.h
new file mode 100644
index 00000000000..aaf671be924
--- /dev/null
+++ b/arch/blackfin/include/asm/switch_to.h
@@ -0,0 +1,39 @@
1/*
2 * Copyright 2004-2009 Analog Devices Inc.
3 * Tony Kou (tonyko@lineo.ca)
4 *
5 * Licensed under the GPL-2 or later
6 */
7
8#ifndef _BLACKFIN_SWITCH_TO_H
9#define _BLACKFIN_SWITCH_TO_H
10
11#define prepare_to_switch() do { } while(0)
12
13/*
14 * switch_to(n) should switch tasks to task ptr, first checking that
15 * ptr isn't the current task, in which case it does nothing.
16 */
17
18#include <asm/l1layout.h>
19#include <asm/mem_map.h>
20
21asmlinkage struct task_struct *resume(struct task_struct *prev, struct task_struct *next);
22
23#ifndef CONFIG_SMP
24#define switch_to(prev,next,last) \
25do { \
26 memcpy (&task_thread_info(prev)->l1_task_info, L1_SCRATCH_TASK_INFO, \
27 sizeof *L1_SCRATCH_TASK_INFO); \
28 memcpy (L1_SCRATCH_TASK_INFO, &task_thread_info(next)->l1_task_info, \
29 sizeof *L1_SCRATCH_TASK_INFO); \
30 (last) = resume (prev, next); \
31} while (0)
32#else
33#define switch_to(prev, next, last) \
34do { \
35 (last) = resume(prev, next); \
36} while (0)
37#endif
38
39#endif /* _BLACKFIN_SWITCH_TO_H */
diff --git a/arch/blackfin/include/asm/system.h b/arch/blackfin/include/asm/system.h
index 44bd0cced72..a7f40578587 100644
--- a/arch/blackfin/include/asm/system.h
+++ b/arch/blackfin/include/asm/system.h
@@ -1,192 +1,5 @@
1/* 1/* FILE TO BE DELETED. DO NOT ADD STUFF HERE! */
2 * Copyright 2004-2009 Analog Devices Inc. 2#include <asm/barrier.h>
3 * Tony Kou (tonyko@lineo.ca) 3#include <asm/cmpxchg.h>
4 * 4#include <asm/exec.h>
5 * Licensed under the GPL-2 or later 5#include <asm/switch_to.h>
6 */
7
8#ifndef _BLACKFIN_SYSTEM_H
9#define _BLACKFIN_SYSTEM_H
10
11#include <linux/linkage.h>
12#include <linux/irqflags.h>
13#include <mach/anomaly.h>
14#include <asm/cache.h>
15#include <asm/pda.h>
16#include <asm/irq.h>
17
18/*
19 * Force strict CPU ordering.
20 */
21#define nop() __asm__ __volatile__ ("nop;\n\t" : : )
22#define smp_mb() mb()
23#define smp_rmb() rmb()
24#define smp_wmb() wmb()
25#define set_mb(var, value) do { var = value; mb(); } while (0)
26#define smp_read_barrier_depends() read_barrier_depends()
27
28#ifdef CONFIG_SMP
29asmlinkage unsigned long __raw_xchg_1_asm(volatile void *ptr, unsigned long value);
30asmlinkage unsigned long __raw_xchg_2_asm(volatile void *ptr, unsigned long value);
31asmlinkage unsigned long __raw_xchg_4_asm(volatile void *ptr, unsigned long value);
32asmlinkage unsigned long __raw_cmpxchg_1_asm(volatile void *ptr,
33 unsigned long new, unsigned long old);
34asmlinkage unsigned long __raw_cmpxchg_2_asm(volatile void *ptr,
35 unsigned long new, unsigned long old);
36asmlinkage unsigned long __raw_cmpxchg_4_asm(volatile void *ptr,
37 unsigned long new, unsigned long old);
38
39#ifdef __ARCH_SYNC_CORE_DCACHE
40/* Force Core data cache coherence */
41# define mb() do { barrier(); smp_check_barrier(); smp_mark_barrier(); } while (0)
42# define rmb() do { barrier(); smp_check_barrier(); } while (0)
43# define wmb() do { barrier(); smp_mark_barrier(); } while (0)
44# define read_barrier_depends() do { barrier(); smp_check_barrier(); } while (0)
45#else
46# define mb() barrier()
47# define rmb() barrier()
48# define wmb() barrier()
49# define read_barrier_depends() do { } while (0)
50#endif
51
52static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
53 int size)
54{
55 unsigned long tmp;
56
57 switch (size) {
58 case 1:
59 tmp = __raw_xchg_1_asm(ptr, x);
60 break;
61 case 2:
62 tmp = __raw_xchg_2_asm(ptr, x);
63 break;
64 case 4:
65 tmp = __raw_xchg_4_asm(ptr, x);
66 break;
67 }
68
69 return tmp;
70}
71
72/*
73 * Atomic compare and exchange. Compare OLD with MEM, if identical,
74 * store NEW in MEM. Return the initial value in MEM. Success is
75 * indicated by comparing RETURN with OLD.
76 */
77static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
78 unsigned long new, int size)
79{
80 unsigned long tmp;
81
82 switch (size) {
83 case 1:
84 tmp = __raw_cmpxchg_1_asm(ptr, new, old);
85 break;
86 case 2:
87 tmp = __raw_cmpxchg_2_asm(ptr, new, old);
88 break;
89 case 4:
90 tmp = __raw_cmpxchg_4_asm(ptr, new, old);
91 break;
92 }
93
94 return tmp;
95}
96#define cmpxchg(ptr, o, n) \
97 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
98 (unsigned long)(n), sizeof(*(ptr))))
99
100#else /* !CONFIG_SMP */
101
102#define mb() barrier()
103#define rmb() barrier()
104#define wmb() barrier()
105#define read_barrier_depends() do { } while (0)
106
107struct __xchg_dummy {
108 unsigned long a[100];
109};
110#define __xg(x) ((volatile struct __xchg_dummy *)(x))
111
112#include <mach/blackfin.h>
113
114static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
115 int size)
116{
117 unsigned long tmp = 0;
118 unsigned long flags;
119
120 flags = hard_local_irq_save();
121
122 switch (size) {
123 case 1:
124 __asm__ __volatile__
125 ("%0 = b%2 (z);\n\t"
126 "b%2 = %1;\n\t"
127 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
128 break;
129 case 2:
130 __asm__ __volatile__
131 ("%0 = w%2 (z);\n\t"
132 "w%2 = %1;\n\t"
133 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
134 break;
135 case 4:
136 __asm__ __volatile__
137 ("%0 = %2;\n\t"
138 "%2 = %1;\n\t"
139 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
140 break;
141 }
142 hard_local_irq_restore(flags);
143 return tmp;
144}
145
146#include <asm-generic/cmpxchg-local.h>
147
148/*
149 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
150 * them available.
151 */
152#define cmpxchg_local(ptr, o, n) \
153 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
154 (unsigned long)(n), sizeof(*(ptr))))
155#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
156
157#include <asm-generic/cmpxchg.h>
158
159#endif /* !CONFIG_SMP */
160
161#define xchg(ptr, x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
162#define tas(ptr) ((void)xchg((ptr), 1))
163
164#define prepare_to_switch() do { } while(0)
165
166/*
167 * switch_to(n) should switch tasks to task ptr, first checking that
168 * ptr isn't the current task, in which case it does nothing.
169 */
170
171#include <asm/l1layout.h>
172#include <asm/mem_map.h>
173
174asmlinkage struct task_struct *resume(struct task_struct *prev, struct task_struct *next);
175
176#ifndef CONFIG_SMP
177#define switch_to(prev,next,last) \
178do { \
179 memcpy (&task_thread_info(prev)->l1_task_info, L1_SCRATCH_TASK_INFO, \
180 sizeof *L1_SCRATCH_TASK_INFO); \
181 memcpy (L1_SCRATCH_TASK_INFO, &task_thread_info(next)->l1_task_info, \
182 sizeof *L1_SCRATCH_TASK_INFO); \
183 (last) = resume (prev, next); \
184} while (0)
185#else
186#define switch_to(prev, next, last) \
187do { \
188 (last) = resume(prev, next); \
189} while (0)
190#endif
191
192#endif /* _BLACKFIN_SYSTEM_H */
diff --git a/arch/blackfin/include/asm/thread_info.h b/arch/blackfin/include/asm/thread_info.h
index 53ad10005ae..02560fd8a12 100644
--- a/arch/blackfin/include/asm/thread_info.h
+++ b/arch/blackfin/include/asm/thread_info.h
@@ -100,6 +100,7 @@ static inline struct thread_info *current_thread_info(void)
100 TIF_NEED_RESCHED */ 100 TIF_NEED_RESCHED */
101#define TIF_MEMDIE 4 /* is terminating due to OOM killer */ 101#define TIF_MEMDIE 4 /* is terminating due to OOM killer */
102#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ 102#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
103#define TIF_FREEZE 6 /* is freezing for suspend */
103#define TIF_IRQ_SYNC 7 /* sync pipeline stage */ 104#define TIF_IRQ_SYNC 7 /* sync pipeline stage */
104#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ 105#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */
105#define TIF_SINGLESTEP 9 106#define TIF_SINGLESTEP 9
@@ -110,6 +111,7 @@ static inline struct thread_info *current_thread_info(void)
110#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 111#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
111#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 112#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
112#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 113#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
114#define _TIF_FREEZE (1<<TIF_FREEZE)
113#define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC) 115#define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC)
114#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 116#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
115#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 117#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h
index 0ccba60b9cc..75ec9df5318 100644
--- a/arch/blackfin/include/asm/unistd.h
+++ b/arch/blackfin/include/asm/unistd.h
@@ -399,8 +399,10 @@
399#define __NR_syncfs 378 399#define __NR_syncfs 378
400#define __NR_setns 379 400#define __NR_setns 379
401#define __NR_sendmmsg 380 401#define __NR_sendmmsg 380
402#define __NR_process_vm_readv 381
403#define __NR_process_vm_writev 382
402 404
403#define __NR_syscall 381 405#define __NR_syscall 383
404#define NR_syscalls __NR_syscall 406#define NR_syscalls __NR_syscall
405 407
406/* Old optional stuff no one actually uses */ 408/* Old optional stuff no one actually uses */
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile
index 1f88edd4572..9a0d6d70644 100644
--- a/arch/blackfin/kernel/Makefile
+++ b/arch/blackfin/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := init_task.o vmlinux.lds
7obj-y := \ 7obj-y := \
8 entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \ 8 entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \
9 sys_bfin.o traps.o irqchip.o dma-mapping.o flat.o \ 9 sys_bfin.o traps.o irqchip.o dma-mapping.o flat.o \
10 fixed_code.o reboot.o bfin_gpio.o bfin_dma_5xx.o \ 10 fixed_code.o reboot.o bfin_gpio.o bfin_dma.o \
11 exception.o dumpstack.o 11 exception.o dumpstack.o
12 12
13ifeq ($(CONFIG_GENERIC_CLOCKEVENTS),y) 13ifeq ($(CONFIG_GENERIC_CLOCKEVENTS),y)
diff --git a/arch/blackfin/kernel/asm-offsets.c b/arch/blackfin/kernel/asm-offsets.c
index 17e35465a41..37fcae95021 100644
--- a/arch/blackfin/kernel/asm-offsets.c
+++ b/arch/blackfin/kernel/asm-offsets.c
@@ -14,6 +14,7 @@
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/thread_info.h> 15#include <linux/thread_info.h>
16#include <linux/kbuild.h> 16#include <linux/kbuild.h>
17#include <asm/pda.h>
17 18
18int main(void) 19int main(void)
19{ 20{
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma.c
index 71dbaa4a48a..40c2ed61258 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * bfin_dma_5xx.c - Blackfin DMA implementation 2 * bfin_dma.c - Blackfin DMA implementation
3 * 3 *
4 * Copyright 2004-2008 Analog Devices Inc. 4 * Copyright 2004-2008 Analog Devices Inc.
5 * 5 *
@@ -218,6 +218,9 @@ int blackfin_dma_suspend(void)
218 dma_ch[i].saved_peripheral_map = dma_ch[i].regs->peripheral_map; 218 dma_ch[i].saved_peripheral_map = dma_ch[i].regs->peripheral_map;
219 } 219 }
220 220
221#if ANOMALY_05000480
222 bfin_write_DMAC_TC_PER(0x0);
223#endif
221 return 0; 224 return 0;
222} 225}
223 226
@@ -231,6 +234,9 @@ void blackfin_dma_resume(void)
231 if (i < MAX_DMA_SUSPEND_CHANNELS) 234 if (i < MAX_DMA_SUSPEND_CHANNELS)
232 dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map; 235 dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map;
233 } 236 }
237#if ANOMALY_05000480
238 bfin_write_DMAC_TC_PER(0x0111);
239#endif
234} 240}
235#endif 241#endif
236 242
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
index 8de92299b3e..b56bd8514b7 100644
--- a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
+++ b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
@@ -120,6 +120,7 @@ MGR_ATTR static noinline int dcplb_miss(unsigned int cpu)
120 d_data = L2_DMEMORY; 120 d_data = L2_DMEMORY;
121 } else if (addr >= physical_mem_end) { 121 } else if (addr >= physical_mem_end) {
122 if (addr >= ASYNC_BANK0_BASE && addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE) { 122 if (addr >= ASYNC_BANK0_BASE && addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE) {
123#if defined(CONFIG_ROMFS_ON_MTD) && defined(CONFIG_MTD_ROM)
123 mask = current_rwx_mask[cpu]; 124 mask = current_rwx_mask[cpu];
124 if (mask) { 125 if (mask) {
125 int page = (addr - (ASYNC_BANK0_BASE - _ramend)) >> PAGE_SHIFT; 126 int page = (addr - (ASYNC_BANK0_BASE - _ramend)) >> PAGE_SHIFT;
@@ -129,6 +130,7 @@ MGR_ATTR static noinline int dcplb_miss(unsigned int cpu)
129 if (mask[idx] & bit) 130 if (mask[idx] & bit)
130 d_data |= CPLB_USER_RD; 131 d_data |= CPLB_USER_RD;
131 } 132 }
133#endif
132 } else if (addr >= BOOT_ROM_START && addr < BOOT_ROM_START + BOOT_ROM_LENGTH 134 } else if (addr >= BOOT_ROM_START && addr < BOOT_ROM_START + BOOT_ROM_LENGTH
133 && (status & (FAULT_RW | FAULT_USERSUPV)) == FAULT_USERSUPV) { 135 && (status & (FAULT_RW | FAULT_USERSUPV)) == FAULT_USERSUPV) {
134 addr &= ~(1 * 1024 * 1024 - 1); 136 addr &= ~(1 * 1024 * 1024 - 1);
diff --git a/arch/blackfin/kernel/ipipe.c b/arch/blackfin/kernel/ipipe.c
index dbe11220cc5..f657b38163e 100644
--- a/arch/blackfin/kernel/ipipe.c
+++ b/arch/blackfin/kernel/ipipe.c
@@ -31,7 +31,6 @@
31#include <linux/kthread.h> 31#include <linux/kthread.h>
32#include <linux/unistd.h> 32#include <linux/unistd.h>
33#include <linux/io.h> 33#include <linux/io.h>
34#include <asm/system.h>
35#include <linux/atomic.h> 34#include <linux/atomic.h>
36#include <asm/irq_handler.h> 35#include <asm/irq_handler.h>
37 36
diff --git a/arch/blackfin/kernel/kgdb_test.c b/arch/blackfin/kernel/kgdb_test.c
index 4a7dcfea98a..18ab004aea1 100644
--- a/arch/blackfin/kernel/kgdb_test.c
+++ b/arch/blackfin/kernel/kgdb_test.c
@@ -13,7 +13,6 @@
13 13
14#include <asm/current.h> 14#include <asm/current.h>
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include <asm/system.h>
17 16
18#include <asm/blackfin.h> 17#include <asm/blackfin.h>
19 18
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index a80a643f369..c0f4fe287eb 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -19,6 +19,7 @@
19#include <asm/blackfin.h> 19#include <asm/blackfin.h>
20#include <asm/fixed_code.h> 20#include <asm/fixed_code.h>
21#include <asm/mem_map.h> 21#include <asm/mem_map.h>
22#include <asm/irq.h>
22 23
23asmlinkage void ret_from_fork(void); 24asmlinkage void ret_from_fork(void);
24 25
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index 75089f80855..e1f88e028cf 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -20,7 +20,6 @@
20 20
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23#include <asm/system.h>
24#include <asm/processor.h> 23#include <asm/processor.h>
25#include <asm/asm-offsets.h> 24#include <asm/asm-offsets.h>
26#include <asm/dma.h> 25#include <asm/dma.h>
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
index c4c0081b199..b0434f89e8d 100644
--- a/arch/blackfin/kernel/reboot.c
+++ b/arch/blackfin/kernel/reboot.c
@@ -9,7 +9,6 @@
9#include <linux/interrupt.h> 9#include <linux/interrupt.h>
10#include <asm/bfin-global.h> 10#include <asm/bfin-global.h>
11#include <asm/reboot.h> 11#include <asm/reboot.h>
12#include <asm/system.h>
13#include <asm/bfrom.h> 12#include <asm/bfrom.h>
14 13
15/* A system soft reset makes external memory unusable so force 14/* A system soft reset makes external memory unusable so force
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index d6102c86d03..2aa01936850 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -30,6 +30,7 @@
30#include <asm/fixed_code.h> 30#include <asm/fixed_code.h>
31#include <asm/early_printk.h> 31#include <asm/early_printk.h>
32#include <asm/irq_handler.h> 32#include <asm/irq_handler.h>
33#include <asm/pda.h>
33 34
34u16 _bfin_swrst; 35u16 _bfin_swrst;
35EXPORT_SYMBOL(_bfin_swrst); 36EXPORT_SYMBOL(_bfin_swrst);
diff --git a/arch/blackfin/kernel/trace.c b/arch/blackfin/kernel/trace.c
index 050db44fe91..44bbf2f564c 100644
--- a/arch/blackfin/kernel/trace.c
+++ b/arch/blackfin/kernel/trace.c
@@ -21,6 +21,7 @@
21#include <asm/fixed_code.h> 21#include <asm/fixed_code.h>
22#include <asm/traps.h> 22#include <asm/traps.h>
23#include <asm/irq_handler.h> 23#include <asm/irq_handler.h>
24#include <asm/pda.h>
24 25
25void decode_address(char *buf, unsigned long address) 26void decode_address(char *buf, unsigned long address)
26{ 27{
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 655f25d139a..de5c2c3ebd9 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -17,6 +17,7 @@
17#include <asm/trace.h> 17#include <asm/trace.h>
18#include <asm/fixed_code.h> 18#include <asm/fixed_code.h>
19#include <asm/pseudo_instructions.h> 19#include <asm/pseudo_instructions.h>
20#include <asm/pda.h>
20 21
21#ifdef CONFIG_KGDB 22#ifdef CONFIG_KGDB
22# include <linux/kgdb.h> 23# include <linux/kgdb.h>
diff --git a/arch/blackfin/lib/ins.S b/arch/blackfin/lib/ins.S
index 79caccea85c..d59608deccc 100644
--- a/arch/blackfin/lib/ins.S
+++ b/arch/blackfin/lib/ins.S
@@ -66,7 +66,7 @@
66 * - turns interrupts off every loop (low overhead, but longer latency) 66 * - turns interrupts off every loop (low overhead, but longer latency)
67 * - DMA version, which do not suffer from this issue. DMA versions have 67 * - DMA version, which do not suffer from this issue. DMA versions have
68 * different name (prefixed by dma_ ), and are located in 68 * different name (prefixed by dma_ ), and are located in
69 * ../kernel/bfin_dma_5xx.c 69 * ../kernel/bfin_dma.c
70 * Using the dma related functions are recommended for transferring large 70 * Using the dma related functions are recommended for transferring large
71 * buffers in/out of FIFOs. 71 * buffers in/out of FIFOs.
72 */ 72 */
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index e9507feea31..6b395510405 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -101,7 +101,6 @@ static struct platform_device smc91x_device = {
101 101
102#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 102#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
103#include <linux/bfin_mac.h> 103#include <linux/bfin_mac.h>
104#include <linux/export.h>
105static const unsigned short bfin_mac_peripherals[] = P_RMII0; 104static const unsigned short bfin_mac_peripherals[] = P_RMII0;
106 105
107static struct bfin_phydev_platform_data bfin_phydev_data[] = { 106static struct bfin_phydev_platform_data bfin_phydev_data[] = {
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 0b807253f4d..f3562b0922a 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -975,7 +975,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
975 }, 975 },
976#endif 976#endif
977 977
978#if defined(CONFIG_SND_BF5XX_SOC_AD193X) || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE) 978#ifdef CONFIG_SND_SOC_AD193X_SPI
979 { 979 {
980 .modalias = "ad193x", 980 .modalias = "ad193x",
981 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ 981 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
@@ -2171,7 +2171,7 @@ static unsigned long adt7316_i2c_data[2] = {
2171#endif 2171#endif
2172 2172
2173static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 2173static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
2174#if defined(CONFIG_SND_BF5XX_SOC_AD193X) || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE) 2174#ifdef CONFIG_SND_SOC_AD193X_I2C
2175 { 2175 {
2176 I2C_BOARD_INFO("ad1937", 0x04), 2176 I2C_BOARD_INFO("ad1937", 0x04),
2177 }, 2177 },
@@ -2593,6 +2593,21 @@ static struct platform_device bfin_ac97_pcm = {
2593}; 2593};
2594#endif 2594#endif
2595 2595
2596#if defined(CONFIG_SND_BF5XX_SOC_AD73311) || \
2597 defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE)
2598static const unsigned ad73311_gpio[] = {
2599 GPIO_PF4,
2600};
2601
2602static struct platform_device bfin_ad73311_machine = {
2603 .name = "bfin-snd-ad73311",
2604 .id = 1,
2605 .dev = {
2606 .platform_data = (void *)ad73311_gpio,
2607 },
2608};
2609#endif
2610
2596#if defined(CONFIG_SND_SOC_AD73311) || defined(CONFIG_SND_SOC_AD73311_MODULE) 2611#if defined(CONFIG_SND_SOC_AD73311) || defined(CONFIG_SND_SOC_AD73311_MODULE)
2597static struct platform_device bfin_ad73311_codec_device = { 2612static struct platform_device bfin_ad73311_codec_device = {
2598 .name = "ad73311", 2613 .name = "ad73311",
@@ -2862,6 +2877,11 @@ static struct platform_device *stamp_devices[] __initdata = {
2862 &bfin_ac97_pcm, 2877 &bfin_ac97_pcm,
2863#endif 2878#endif
2864 2879
2880#if defined(CONFIG_SND_BF5XX_SOC_AD73311) || \
2881 defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE)
2882 &bfin_ad73311_machine,
2883#endif
2884
2865#if defined(CONFIG_SND_SOC_AD73311) || defined(CONFIG_SND_SOC_AD73311_MODULE) 2885#if defined(CONFIG_SND_SOC_AD73311) || defined(CONFIG_SND_SOC_AD73311_MODULE)
2866 &bfin_ad73311_codec_device, 2886 &bfin_ad73311_codec_device,
2867#endif 2887#endif
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 3ea45f8bd61..4cadaf8d0b5 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -1237,6 +1237,8 @@ static struct bfin_capture_config bfin_capture_data = {
1237 }, 1237 },
1238 .ppi_info = &ppi_info, 1238 .ppi_info = &ppi_info,
1239 .ppi_control = (POLC | PACKEN | DLEN_8 | XFR_TYPE | 0x20), 1239 .ppi_control = (POLC | PACKEN | DLEN_8 | XFR_TYPE | 0x20),
1240 .int_mask = 0xFFFFFFFF, /* disable error interrupt on eppi */
1241 .blank_clocks = 8, /* 8 clocks as SAV and EAV */
1240}; 1242};
1241#endif 1243#endif
1242 1244
@@ -1293,6 +1295,11 @@ static struct platform_device i2c_bfin_twi1_device = {
1293#endif 1295#endif
1294 1296
1295static struct i2c_board_info __initdata bfin_i2c_board_info0[] = { 1297static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
1298#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
1299 {
1300 I2C_BOARD_INFO("ssm2602", 0x1b),
1301 },
1302#endif
1296}; 1303};
1297 1304
1298#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ 1305#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
@@ -1385,6 +1392,8 @@ static struct platform_device bfin_dpmc = {
1385static const u16 bfin_snd_pin[][7] = { 1392static const u16 bfin_snd_pin[][7] = {
1386 SPORT_REQ(0), 1393 SPORT_REQ(0),
1387 SPORT_REQ(1), 1394 SPORT_REQ(1),
1395 SPORT_REQ(2),
1396 SPORT_REQ(3),
1388}; 1397};
1389 1398
1390static struct bfin_snd_platform_data bfin_snd_data[] = { 1399static struct bfin_snd_platform_data bfin_snd_data[] = {
@@ -1394,6 +1403,12 @@ static struct bfin_snd_platform_data bfin_snd_data[] = {
1394 { 1403 {
1395 .pin_req = &bfin_snd_pin[1][0], 1404 .pin_req = &bfin_snd_pin[1][0],
1396 }, 1405 },
1406 {
1407 .pin_req = &bfin_snd_pin[2][0],
1408 },
1409 {
1410 .pin_req = &bfin_snd_pin[3][0],
1411 },
1397}; 1412};
1398 1413
1399#define BFIN_SND_RES(x) \ 1414#define BFIN_SND_RES(x) \
@@ -1423,10 +1438,28 @@ static struct bfin_snd_platform_data bfin_snd_data[] = {
1423static struct resource bfin_snd_resources[][4] = { 1438static struct resource bfin_snd_resources[][4] = {
1424 BFIN_SND_RES(0), 1439 BFIN_SND_RES(0),
1425 BFIN_SND_RES(1), 1440 BFIN_SND_RES(1),
1441 BFIN_SND_RES(2),
1442 BFIN_SND_RES(3),
1426}; 1443};
1444#endif
1427 1445
1428static struct platform_device bfin_pcm = { 1446#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1429 .name = "bfin-pcm-audio", 1447static struct platform_device bfin_i2s_pcm = {
1448 .name = "bfin-i2s-pcm-audio",
1449 .id = -1,
1450};
1451#endif
1452
1453#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1454static struct platform_device bfin_tdm_pcm = {
1455 .name = "bfin-tdm-pcm-audio",
1456 .id = -1,
1457};
1458#endif
1459
1460#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1461static struct platform_device bfin_ac97_pcm = {
1462 .name = "bfin-ac97-pcm-audio",
1430 .id = -1, 1463 .id = -1,
1431}; 1464};
1432#endif 1465#endif
@@ -1599,10 +1632,14 @@ static struct platform_device *ezkit_devices[] __initdata = {
1599 &ezkit_flash_device, 1632 &ezkit_flash_device,
1600#endif 1633#endif
1601 1634
1602#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ 1635#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1603 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \ 1636 &bfin_i2s_pcm,
1604 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 1637#endif
1605 &bfin_pcm, 1638#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1639 &bfin_tdm_pcm,
1640#endif
1641#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1642 &bfin_ac97_pcm,
1606#endif 1643#endif
1607 1644
1608#if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE) 1645#if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE)
diff --git a/arch/blackfin/mach-bf561/atomic.S b/arch/blackfin/mach-bf561/atomic.S
index 52d6f73fcce..2a08df8e8c4 100644
--- a/arch/blackfin/mach-bf561/atomic.S
+++ b/arch/blackfin/mach-bf561/atomic.S
@@ -72,6 +72,13 @@ ENTRY(_get_core_lock_noflush)
72 SSYNC(r2); 72 SSYNC(r2);
73 jump .Lretry_corelock_noflush 73 jump .Lretry_corelock_noflush
74.Ldone_corelock_noflush: 74.Ldone_corelock_noflush:
75 /*
76 * SMP kgdb runs into dead loop without NOP here, when one core
77 * single steps over get_core_lock_noflush and the other executes
78 * get_core_lock as a slave node.
79 */
80 nop;
81 CSYNC(r2);
75 rts; 82 rts;
76ENDPROC(_get_core_lock_noflush) 83ENDPROC(_get_core_lock_noflush)
77 84
diff --git a/arch/blackfin/mach-bf561/include/mach/defBF561.h b/arch/blackfin/mach-bf561/include/mach/defBF561.h
index 71e805ea74e..5f0ac5a77a3 100644
--- a/arch/blackfin/mach-bf561/include/mach/defBF561.h
+++ b/arch/blackfin/mach-bf561/include/mach/defBF561.h
@@ -479,61 +479,61 @@
479#define DMA1_11_PERIPHERAL_MAP 0xFFC01EEC /* DMA1 Channel 11 Peripheral Map Register */ 479#define DMA1_11_PERIPHERAL_MAP 0xFFC01EEC /* DMA1 Channel 11 Peripheral Map Register */
480 480
481/* Memory DMA1 Controller registers (0xFFC0 1E80-0xFFC0 1FFF) */ 481/* Memory DMA1 Controller registers (0xFFC0 1E80-0xFFC0 1FFF) */
482#define MDMA_D2_CONFIG 0xFFC01F08 /*MemDMA1 Stream 0 Destination Configuration */ 482#define MDMA_D0_CONFIG 0xFFC01F08 /*MemDMA1 Stream 0 Destination Configuration */
483#define MDMA_D2_NEXT_DESC_PTR 0xFFC01F00 /*MemDMA1 Stream 0 Destination Next Descriptor Ptr Reg */ 483#define MDMA_D0_NEXT_DESC_PTR 0xFFC01F00 /*MemDMA1 Stream 0 Destination Next Descriptor Ptr Reg */
484#define MDMA_D2_START_ADDR 0xFFC01F04 /*MemDMA1 Stream 0 Destination Start Address */ 484#define MDMA_D0_START_ADDR 0xFFC01F04 /*MemDMA1 Stream 0 Destination Start Address */
485#define MDMA_D2_X_COUNT 0xFFC01F10 /*MemDMA1 Stream 0 Destination Inner-Loop Count */ 485#define MDMA_D0_X_COUNT 0xFFC01F10 /*MemDMA1 Stream 0 Destination Inner-Loop Count */
486#define MDMA_D2_Y_COUNT 0xFFC01F18 /*MemDMA1 Stream 0 Destination Outer-Loop Count */ 486#define MDMA_D0_Y_COUNT 0xFFC01F18 /*MemDMA1 Stream 0 Destination Outer-Loop Count */
487#define MDMA_D2_X_MODIFY 0xFFC01F14 /*MemDMA1 Stream 0 Dest Inner-Loop Address-Increment */ 487#define MDMA_D0_X_MODIFY 0xFFC01F14 /*MemDMA1 Stream 0 Dest Inner-Loop Address-Increment */
488#define MDMA_D2_Y_MODIFY 0xFFC01F1C /*MemDMA1 Stream 0 Dest Outer-Loop Address-Increment */ 488#define MDMA_D0_Y_MODIFY 0xFFC01F1C /*MemDMA1 Stream 0 Dest Outer-Loop Address-Increment */
489#define MDMA_D2_CURR_DESC_PTR 0xFFC01F20 /*MemDMA1 Stream 0 Dest Current Descriptor Ptr reg */ 489#define MDMA_D0_CURR_DESC_PTR 0xFFC01F20 /*MemDMA1 Stream 0 Dest Current Descriptor Ptr reg */
490#define MDMA_D2_CURR_ADDR 0xFFC01F24 /*MemDMA1 Stream 0 Destination Current Address */ 490#define MDMA_D0_CURR_ADDR 0xFFC01F24 /*MemDMA1 Stream 0 Destination Current Address */
491#define MDMA_D2_CURR_X_COUNT 0xFFC01F30 /*MemDMA1 Stream 0 Dest Current Inner-Loop Count */ 491#define MDMA_D0_CURR_X_COUNT 0xFFC01F30 /*MemDMA1 Stream 0 Dest Current Inner-Loop Count */
492#define MDMA_D2_CURR_Y_COUNT 0xFFC01F38 /*MemDMA1 Stream 0 Dest Current Outer-Loop Count */ 492#define MDMA_D0_CURR_Y_COUNT 0xFFC01F38 /*MemDMA1 Stream 0 Dest Current Outer-Loop Count */
493#define MDMA_D2_IRQ_STATUS 0xFFC01F28 /*MemDMA1 Stream 0 Destination Interrupt/Status */ 493#define MDMA_D0_IRQ_STATUS 0xFFC01F28 /*MemDMA1 Stream 0 Destination Interrupt/Status */
494#define MDMA_D2_PERIPHERAL_MAP 0xFFC01F2C /*MemDMA1 Stream 0 Destination Peripheral Map */ 494#define MDMA_D0_PERIPHERAL_MAP 0xFFC01F2C /*MemDMA1 Stream 0 Destination Peripheral Map */
495 495
496#define MDMA_S2_CONFIG 0xFFC01F48 /*MemDMA1 Stream 0 Source Configuration */ 496#define MDMA_S0_CONFIG 0xFFC01F48 /*MemDMA1 Stream 0 Source Configuration */
497#define MDMA_S2_NEXT_DESC_PTR 0xFFC01F40 /*MemDMA1 Stream 0 Source Next Descriptor Ptr Reg */ 497#define MDMA_S0_NEXT_DESC_PTR 0xFFC01F40 /*MemDMA1 Stream 0 Source Next Descriptor Ptr Reg */
498#define MDMA_S2_START_ADDR 0xFFC01F44 /*MemDMA1 Stream 0 Source Start Address */ 498#define MDMA_S0_START_ADDR 0xFFC01F44 /*MemDMA1 Stream 0 Source Start Address */
499#define MDMA_S2_X_COUNT 0xFFC01F50 /*MemDMA1 Stream 0 Source Inner-Loop Count */ 499#define MDMA_S0_X_COUNT 0xFFC01F50 /*MemDMA1 Stream 0 Source Inner-Loop Count */
500#define MDMA_S2_Y_COUNT 0xFFC01F58 /*MemDMA1 Stream 0 Source Outer-Loop Count */ 500#define MDMA_S0_Y_COUNT 0xFFC01F58 /*MemDMA1 Stream 0 Source Outer-Loop Count */
501#define MDMA_S2_X_MODIFY 0xFFC01F54 /*MemDMA1 Stream 0 Source Inner-Loop Address-Increment */ 501#define MDMA_S0_X_MODIFY 0xFFC01F54 /*MemDMA1 Stream 0 Source Inner-Loop Address-Increment */
502#define MDMA_S2_Y_MODIFY 0xFFC01F5C /*MemDMA1 Stream 0 Source Outer-Loop Address-Increment */ 502#define MDMA_S0_Y_MODIFY 0xFFC01F5C /*MemDMA1 Stream 0 Source Outer-Loop Address-Increment */
503#define MDMA_S2_CURR_DESC_PTR 0xFFC01F60 /*MemDMA1 Stream 0 Source Current Descriptor Ptr reg */ 503#define MDMA_S0_CURR_DESC_PTR 0xFFC01F60 /*MemDMA1 Stream 0 Source Current Descriptor Ptr reg */
504#define MDMA_S2_CURR_ADDR 0xFFC01F64 /*MemDMA1 Stream 0 Source Current Address */ 504#define MDMA_S0_CURR_ADDR 0xFFC01F64 /*MemDMA1 Stream 0 Source Current Address */
505#define MDMA_S2_CURR_X_COUNT 0xFFC01F70 /*MemDMA1 Stream 0 Source Current Inner-Loop Count */ 505#define MDMA_S0_CURR_X_COUNT 0xFFC01F70 /*MemDMA1 Stream 0 Source Current Inner-Loop Count */
506#define MDMA_S2_CURR_Y_COUNT 0xFFC01F78 /*MemDMA1 Stream 0 Source Current Outer-Loop Count */ 506#define MDMA_S0_CURR_Y_COUNT 0xFFC01F78 /*MemDMA1 Stream 0 Source Current Outer-Loop Count */
507#define MDMA_S2_IRQ_STATUS 0xFFC01F68 /*MemDMA1 Stream 0 Source Interrupt/Status */ 507#define MDMA_S0_IRQ_STATUS 0xFFC01F68 /*MemDMA1 Stream 0 Source Interrupt/Status */
508#define MDMA_S2_PERIPHERAL_MAP 0xFFC01F6C /*MemDMA1 Stream 0 Source Peripheral Map */ 508#define MDMA_S0_PERIPHERAL_MAP 0xFFC01F6C /*MemDMA1 Stream 0 Source Peripheral Map */
509 509
510#define MDMA_D3_CONFIG 0xFFC01F88 /*MemDMA1 Stream 1 Destination Configuration */ 510#define MDMA_D1_CONFIG 0xFFC01F88 /*MemDMA1 Stream 1 Destination Configuration */
511#define MDMA_D3_NEXT_DESC_PTR 0xFFC01F80 /*MemDMA1 Stream 1 Destination Next Descriptor Ptr Reg */ 511#define MDMA_D1_NEXT_DESC_PTR 0xFFC01F80 /*MemDMA1 Stream 1 Destination Next Descriptor Ptr Reg */
512#define MDMA_D3_START_ADDR 0xFFC01F84 /*MemDMA1 Stream 1 Destination Start Address */ 512#define MDMA_D1_START_ADDR 0xFFC01F84 /*MemDMA1 Stream 1 Destination Start Address */
513#define MDMA_D3_X_COUNT 0xFFC01F90 /*MemDMA1 Stream 1 Destination Inner-Loop Count */ 513#define MDMA_D1_X_COUNT 0xFFC01F90 /*MemDMA1 Stream 1 Destination Inner-Loop Count */
514#define MDMA_D3_Y_COUNT 0xFFC01F98 /*MemDMA1 Stream 1 Destination Outer-Loop Count */ 514#define MDMA_D1_Y_COUNT 0xFFC01F98 /*MemDMA1 Stream 1 Destination Outer-Loop Count */
515#define MDMA_D3_X_MODIFY 0xFFC01F94 /*MemDMA1 Stream 1 Dest Inner-Loop Address-Increment */ 515#define MDMA_D1_X_MODIFY 0xFFC01F94 /*MemDMA1 Stream 1 Dest Inner-Loop Address-Increment */
516#define MDMA_D3_Y_MODIFY 0xFFC01F9C /*MemDMA1 Stream 1 Dest Outer-Loop Address-Increment */ 516#define MDMA_D1_Y_MODIFY 0xFFC01F9C /*MemDMA1 Stream 1 Dest Outer-Loop Address-Increment */
517#define MDMA_D3_CURR_DESC_PTR 0xFFC01FA0 /*MemDMA1 Stream 1 Dest Current Descriptor Ptr reg */ 517#define MDMA_D1_CURR_DESC_PTR 0xFFC01FA0 /*MemDMA1 Stream 1 Dest Current Descriptor Ptr reg */
518#define MDMA_D3_CURR_ADDR 0xFFC01FA4 /*MemDMA1 Stream 1 Dest Current Address */ 518#define MDMA_D1_CURR_ADDR 0xFFC01FA4 /*MemDMA1 Stream 1 Dest Current Address */
519#define MDMA_D3_CURR_X_COUNT 0xFFC01FB0 /*MemDMA1 Stream 1 Dest Current Inner-Loop Count */ 519#define MDMA_D1_CURR_X_COUNT 0xFFC01FB0 /*MemDMA1 Stream 1 Dest Current Inner-Loop Count */
520#define MDMA_D3_CURR_Y_COUNT 0xFFC01FB8 /*MemDMA1 Stream 1 Dest Current Outer-Loop Count */ 520#define MDMA_D1_CURR_Y_COUNT 0xFFC01FB8 /*MemDMA1 Stream 1 Dest Current Outer-Loop Count */
521#define MDMA_D3_IRQ_STATUS 0xFFC01FA8 /*MemDMA1 Stream 1 Dest Interrupt/Status */ 521#define MDMA_D1_IRQ_STATUS 0xFFC01FA8 /*MemDMA1 Stream 1 Dest Interrupt/Status */
522#define MDMA_D3_PERIPHERAL_MAP 0xFFC01FAC /*MemDMA1 Stream 1 Dest Peripheral Map */ 522#define MDMA_D1_PERIPHERAL_MAP 0xFFC01FAC /*MemDMA1 Stream 1 Dest Peripheral Map */
523 523
524#define MDMA_S3_CONFIG 0xFFC01FC8 /*MemDMA1 Stream 1 Source Configuration */ 524#define MDMA_S1_CONFIG 0xFFC01FC8 /*MemDMA1 Stream 1 Source Configuration */
525#define MDMA_S3_NEXT_DESC_PTR 0xFFC01FC0 /*MemDMA1 Stream 1 Source Next Descriptor Ptr Reg */ 525#define MDMA_S1_NEXT_DESC_PTR 0xFFC01FC0 /*MemDMA1 Stream 1 Source Next Descriptor Ptr Reg */
526#define MDMA_S3_START_ADDR 0xFFC01FC4 /*MemDMA1 Stream 1 Source Start Address */ 526#define MDMA_S1_START_ADDR 0xFFC01FC4 /*MemDMA1 Stream 1 Source Start Address */
527#define MDMA_S3_X_COUNT 0xFFC01FD0 /*MemDMA1 Stream 1 Source Inner-Loop Count */ 527#define MDMA_S1_X_COUNT 0xFFC01FD0 /*MemDMA1 Stream 1 Source Inner-Loop Count */
528#define MDMA_S3_Y_COUNT 0xFFC01FD8 /*MemDMA1 Stream 1 Source Outer-Loop Count */ 528#define MDMA_S1_Y_COUNT 0xFFC01FD8 /*MemDMA1 Stream 1 Source Outer-Loop Count */
529#define MDMA_S3_X_MODIFY 0xFFC01FD4 /*MemDMA1 Stream 1 Source Inner-Loop Address-Increment */ 529#define MDMA_S1_X_MODIFY 0xFFC01FD4 /*MemDMA1 Stream 1 Source Inner-Loop Address-Increment */
530#define MDMA_S3_Y_MODIFY 0xFFC01FDC /*MemDMA1 Stream 1 Source Outer-Loop Address-Increment */ 530#define MDMA_S1_Y_MODIFY 0xFFC01FDC /*MemDMA1 Stream 1 Source Outer-Loop Address-Increment */
531#define MDMA_S3_CURR_DESC_PTR 0xFFC01FE0 /*MemDMA1 Stream 1 Source Current Descriptor Ptr reg */ 531#define MDMA_S1_CURR_DESC_PTR 0xFFC01FE0 /*MemDMA1 Stream 1 Source Current Descriptor Ptr reg */
532#define MDMA_S3_CURR_ADDR 0xFFC01FE4 /*MemDMA1 Stream 1 Source Current Address */ 532#define MDMA_S1_CURR_ADDR 0xFFC01FE4 /*MemDMA1 Stream 1 Source Current Address */
533#define MDMA_S3_CURR_X_COUNT 0xFFC01FF0 /*MemDMA1 Stream 1 Source Current Inner-Loop Count */ 533#define MDMA_S1_CURR_X_COUNT 0xFFC01FF0 /*MemDMA1 Stream 1 Source Current Inner-Loop Count */
534#define MDMA_S3_CURR_Y_COUNT 0xFFC01FF8 /*MemDMA1 Stream 1 Source Current Outer-Loop Count */ 534#define MDMA_S1_CURR_Y_COUNT 0xFFC01FF8 /*MemDMA1 Stream 1 Source Current Outer-Loop Count */
535#define MDMA_S3_IRQ_STATUS 0xFFC01FE8 /*MemDMA1 Stream 1 Source Interrupt/Status */ 535#define MDMA_S1_IRQ_STATUS 0xFFC01FE8 /*MemDMA1 Stream 1 Source Interrupt/Status */
536#define MDMA_S3_PERIPHERAL_MAP 0xFFC01FEC /*MemDMA1 Stream 1 Source Peripheral Map */ 536#define MDMA_S1_PERIPHERAL_MAP 0xFFC01FEC /*MemDMA1 Stream 1 Source Peripheral Map */
537 537
538/* DMA2 Controller registers (0xFFC0 0C00-0xFFC0 0DFF) */ 538/* DMA2 Controller registers (0xFFC0 0C00-0xFFC0 0DFF) */
539#define DMA2_0_CONFIG 0xFFC00C08 /* DMA2 Channel 0 Configuration register */ 539#define DMA2_0_CONFIG 0xFFC00C08 /* DMA2 Channel 0 Configuration register */
@@ -705,61 +705,61 @@
705#define DMA2_11_PERIPHERAL_MAP 0xFFC00EEC /* DMA2 Channel 11 Peripheral Map Register */ 705#define DMA2_11_PERIPHERAL_MAP 0xFFC00EEC /* DMA2 Channel 11 Peripheral Map Register */
706 706
707/* Memory DMA2 Controller registers (0xFFC0 0E80-0xFFC0 0FFF) */ 707/* Memory DMA2 Controller registers (0xFFC0 0E80-0xFFC0 0FFF) */
708#define MDMA_D0_CONFIG 0xFFC00F08 /*MemDMA2 Stream 0 Destination Configuration register */ 708#define MDMA_D2_CONFIG 0xFFC00F08 /*MemDMA2 Stream 0 Destination Configuration register */
709#define MDMA_D0_NEXT_DESC_PTR 0xFFC00F00 /*MemDMA2 Stream 0 Destination Next Descriptor Ptr Reg */ 709#define MDMA_D2_NEXT_DESC_PTR 0xFFC00F00 /*MemDMA2 Stream 0 Destination Next Descriptor Ptr Reg */
710#define MDMA_D0_START_ADDR 0xFFC00F04 /*MemDMA2 Stream 0 Destination Start Address */ 710#define MDMA_D2_START_ADDR 0xFFC00F04 /*MemDMA2 Stream 0 Destination Start Address */
711#define MDMA_D0_X_COUNT 0xFFC00F10 /*MemDMA2 Stream 0 Dest Inner-Loop Count register */ 711#define MDMA_D2_X_COUNT 0xFFC00F10 /*MemDMA2 Stream 0 Dest Inner-Loop Count register */
712#define MDMA_D0_Y_COUNT 0xFFC00F18 /*MemDMA2 Stream 0 Dest Outer-Loop Count register */ 712#define MDMA_D2_Y_COUNT 0xFFC00F18 /*MemDMA2 Stream 0 Dest Outer-Loop Count register */
713#define MDMA_D0_X_MODIFY 0xFFC00F14 /*MemDMA2 Stream 0 Dest Inner-Loop Address-Increment */ 713#define MDMA_D2_X_MODIFY 0xFFC00F14 /*MemDMA2 Stream 0 Dest Inner-Loop Address-Increment */
714#define MDMA_D0_Y_MODIFY 0xFFC00F1C /*MemDMA2 Stream 0 Dest Outer-Loop Address-Increment */ 714#define MDMA_D2_Y_MODIFY 0xFFC00F1C /*MemDMA2 Stream 0 Dest Outer-Loop Address-Increment */
715#define MDMA_D0_CURR_DESC_PTR 0xFFC00F20 /*MemDMA2 Stream 0 Dest Current Descriptor Ptr reg */ 715#define MDMA_D2_CURR_DESC_PTR 0xFFC00F20 /*MemDMA2 Stream 0 Dest Current Descriptor Ptr reg */
716#define MDMA_D0_CURR_ADDR 0xFFC00F24 /*MemDMA2 Stream 0 Destination Current Address */ 716#define MDMA_D2_CURR_ADDR 0xFFC00F24 /*MemDMA2 Stream 0 Destination Current Address */
717#define MDMA_D0_CURR_X_COUNT 0xFFC00F30 /*MemDMA2 Stream 0 Dest Current Inner-Loop Count reg */ 717#define MDMA_D2_CURR_X_COUNT 0xFFC00F30 /*MemDMA2 Stream 0 Dest Current Inner-Loop Count reg */
718#define MDMA_D0_CURR_Y_COUNT 0xFFC00F38 /*MemDMA2 Stream 0 Dest Current Outer-Loop Count reg */ 718#define MDMA_D2_CURR_Y_COUNT 0xFFC00F38 /*MemDMA2 Stream 0 Dest Current Outer-Loop Count reg */
719#define MDMA_D0_IRQ_STATUS 0xFFC00F28 /*MemDMA2 Stream 0 Dest Interrupt/Status Register */ 719#define MDMA_D2_IRQ_STATUS 0xFFC00F28 /*MemDMA2 Stream 0 Dest Interrupt/Status Register */
720#define MDMA_D0_PERIPHERAL_MAP 0xFFC00F2C /*MemDMA2 Stream 0 Destination Peripheral Map register */ 720#define MDMA_D2_PERIPHERAL_MAP 0xFFC00F2C /*MemDMA2 Stream 0 Destination Peripheral Map register */
721 721
722#define MDMA_S0_CONFIG 0xFFC00F48 /*MemDMA2 Stream 0 Source Configuration register */ 722#define MDMA_S2_CONFIG 0xFFC00F48 /*MemDMA2 Stream 0 Source Configuration register */
723#define MDMA_S0_NEXT_DESC_PTR 0xFFC00F40 /*MemDMA2 Stream 0 Source Next Descriptor Ptr Reg */ 723#define MDMA_S2_NEXT_DESC_PTR 0xFFC00F40 /*MemDMA2 Stream 0 Source Next Descriptor Ptr Reg */
724#define MDMA_S0_START_ADDR 0xFFC00F44 /*MemDMA2 Stream 0 Source Start Address */ 724#define MDMA_S2_START_ADDR 0xFFC00F44 /*MemDMA2 Stream 0 Source Start Address */
725#define MDMA_S0_X_COUNT 0xFFC00F50 /*MemDMA2 Stream 0 Source Inner-Loop Count register */ 725#define MDMA_S2_X_COUNT 0xFFC00F50 /*MemDMA2 Stream 0 Source Inner-Loop Count register */
726#define MDMA_S0_Y_COUNT 0xFFC00F58 /*MemDMA2 Stream 0 Source Outer-Loop Count register */ 726#define MDMA_S2_Y_COUNT 0xFFC00F58 /*MemDMA2 Stream 0 Source Outer-Loop Count register */
727#define MDMA_S0_X_MODIFY 0xFFC00F54 /*MemDMA2 Stream 0 Src Inner-Loop Addr-Increment reg */ 727#define MDMA_S2_X_MODIFY 0xFFC00F54 /*MemDMA2 Stream 0 Src Inner-Loop Addr-Increment reg */
728#define MDMA_S0_Y_MODIFY 0xFFC00F5C /*MemDMA2 Stream 0 Src Outer-Loop Addr-Increment reg */ 728#define MDMA_S2_Y_MODIFY 0xFFC00F5C /*MemDMA2 Stream 0 Src Outer-Loop Addr-Increment reg */
729#define MDMA_S0_CURR_DESC_PTR 0xFFC00F60 /*MemDMA2 Stream 0 Source Current Descriptor Ptr reg */ 729#define MDMA_S2_CURR_DESC_PTR 0xFFC00F60 /*MemDMA2 Stream 0 Source Current Descriptor Ptr reg */
730#define MDMA_S0_CURR_ADDR 0xFFC00F64 /*MemDMA2 Stream 0 Source Current Address */ 730#define MDMA_S2_CURR_ADDR 0xFFC00F64 /*MemDMA2 Stream 0 Source Current Address */
731#define MDMA_S0_CURR_X_COUNT 0xFFC00F70 /*MemDMA2 Stream 0 Src Current Inner-Loop Count reg */ 731#define MDMA_S2_CURR_X_COUNT 0xFFC00F70 /*MemDMA2 Stream 0 Src Current Inner-Loop Count reg */
732#define MDMA_S0_CURR_Y_COUNT 0xFFC00F78 /*MemDMA2 Stream 0 Src Current Outer-Loop Count reg */ 732#define MDMA_S2_CURR_Y_COUNT 0xFFC00F78 /*MemDMA2 Stream 0 Src Current Outer-Loop Count reg */
733#define MDMA_S0_IRQ_STATUS 0xFFC00F68 /*MemDMA2 Stream 0 Source Interrupt/Status Register */ 733#define MDMA_S2_IRQ_STATUS 0xFFC00F68 /*MemDMA2 Stream 0 Source Interrupt/Status Register */
734#define MDMA_S0_PERIPHERAL_MAP 0xFFC00F6C /*MemDMA2 Stream 0 Source Peripheral Map register */ 734#define MDMA_S2_PERIPHERAL_MAP 0xFFC00F6C /*MemDMA2 Stream 0 Source Peripheral Map register */
735 735
736#define MDMA_D1_CONFIG 0xFFC00F88 /*MemDMA2 Stream 1 Destination Configuration register */ 736#define MDMA_D3_CONFIG 0xFFC00F88 /*MemDMA2 Stream 1 Destination Configuration register */
737#define MDMA_D1_NEXT_DESC_PTR 0xFFC00F80 /*MemDMA2 Stream 1 Destination Next Descriptor Ptr Reg */ 737#define MDMA_D3_NEXT_DESC_PTR 0xFFC00F80 /*MemDMA2 Stream 1 Destination Next Descriptor Ptr Reg */
738#define MDMA_D1_START_ADDR 0xFFC00F84 /*MemDMA2 Stream 1 Destination Start Address */ 738#define MDMA_D3_START_ADDR 0xFFC00F84 /*MemDMA2 Stream 1 Destination Start Address */
739#define MDMA_D1_X_COUNT 0xFFC00F90 /*MemDMA2 Stream 1 Dest Inner-Loop Count register */ 739#define MDMA_D3_X_COUNT 0xFFC00F90 /*MemDMA2 Stream 1 Dest Inner-Loop Count register */
740#define MDMA_D1_Y_COUNT 0xFFC00F98 /*MemDMA2 Stream 1 Dest Outer-Loop Count register */ 740#define MDMA_D3_Y_COUNT 0xFFC00F98 /*MemDMA2 Stream 1 Dest Outer-Loop Count register */
741#define MDMA_D1_X_MODIFY 0xFFC00F94 /*MemDMA2 Stream 1 Dest Inner-Loop Address-Increment */ 741#define MDMA_D3_X_MODIFY 0xFFC00F94 /*MemDMA2 Stream 1 Dest Inner-Loop Address-Increment */
742#define MDMA_D1_Y_MODIFY 0xFFC00F9C /*MemDMA2 Stream 1 Dest Outer-Loop Address-Increment */ 742#define MDMA_D3_Y_MODIFY 0xFFC00F9C /*MemDMA2 Stream 1 Dest Outer-Loop Address-Increment */
743#define MDMA_D1_CURR_DESC_PTR 0xFFC00FA0 /*MemDMA2 Stream 1 Destination Current Descriptor Ptr */ 743#define MDMA_D3_CURR_DESC_PTR 0xFFC00FA0 /*MemDMA2 Stream 1 Destination Current Descriptor Ptr */
744#define MDMA_D1_CURR_ADDR 0xFFC00FA4 /*MemDMA2 Stream 1 Destination Current Address reg */ 744#define MDMA_D3_CURR_ADDR 0xFFC00FA4 /*MemDMA2 Stream 1 Destination Current Address reg */
745#define MDMA_D1_CURR_X_COUNT 0xFFC00FB0 /*MemDMA2 Stream 1 Dest Current Inner-Loop Count reg */ 745#define MDMA_D3_CURR_X_COUNT 0xFFC00FB0 /*MemDMA2 Stream 1 Dest Current Inner-Loop Count reg */
746#define MDMA_D1_CURR_Y_COUNT 0xFFC00FB8 /*MemDMA2 Stream 1 Dest Current Outer-Loop Count reg */ 746#define MDMA_D3_CURR_Y_COUNT 0xFFC00FB8 /*MemDMA2 Stream 1 Dest Current Outer-Loop Count reg */
747#define MDMA_D1_IRQ_STATUS 0xFFC00FA8 /*MemDMA2 Stream 1 Destination Interrupt/Status Reg */ 747#define MDMA_D3_IRQ_STATUS 0xFFC00FA8 /*MemDMA2 Stream 1 Destination Interrupt/Status Reg */
748#define MDMA_D1_PERIPHERAL_MAP 0xFFC00FAC /*MemDMA2 Stream 1 Destination Peripheral Map register */ 748#define MDMA_D3_PERIPHERAL_MAP 0xFFC00FAC /*MemDMA2 Stream 1 Destination Peripheral Map register */
749 749
750#define MDMA_S1_CONFIG 0xFFC00FC8 /*MemDMA2 Stream 1 Source Configuration register */ 750#define MDMA_S3_CONFIG 0xFFC00FC8 /*MemDMA2 Stream 1 Source Configuration register */
751#define MDMA_S1_NEXT_DESC_PTR 0xFFC00FC0 /*MemDMA2 Stream 1 Source Next Descriptor Ptr Reg */ 751#define MDMA_S3_NEXT_DESC_PTR 0xFFC00FC0 /*MemDMA2 Stream 1 Source Next Descriptor Ptr Reg */
752#define MDMA_S1_START_ADDR 0xFFC00FC4 /*MemDMA2 Stream 1 Source Start Address */ 752#define MDMA_S3_START_ADDR 0xFFC00FC4 /*MemDMA2 Stream 1 Source Start Address */
753#define MDMA_S1_X_COUNT 0xFFC00FD0 /*MemDMA2 Stream 1 Source Inner-Loop Count register */ 753#define MDMA_S3_X_COUNT 0xFFC00FD0 /*MemDMA2 Stream 1 Source Inner-Loop Count register */
754#define MDMA_S1_Y_COUNT 0xFFC00FD8 /*MemDMA2 Stream 1 Source Outer-Loop Count register */ 754#define MDMA_S3_Y_COUNT 0xFFC00FD8 /*MemDMA2 Stream 1 Source Outer-Loop Count register */
755#define MDMA_S1_X_MODIFY 0xFFC00FD4 /*MemDMA2 Stream 1 Src Inner-Loop Address-Increment */ 755#define MDMA_S3_X_MODIFY 0xFFC00FD4 /*MemDMA2 Stream 1 Src Inner-Loop Address-Increment */
756#define MDMA_S1_Y_MODIFY 0xFFC00FDC /*MemDMA2 Stream 1 Source Outer-Loop Address-Increment */ 756#define MDMA_S3_Y_MODIFY 0xFFC00FDC /*MemDMA2 Stream 1 Source Outer-Loop Address-Increment */
757#define MDMA_S1_CURR_DESC_PTR 0xFFC00FE0 /*MemDMA2 Stream 1 Source Current Descriptor Ptr reg */ 757#define MDMA_S3_CURR_DESC_PTR 0xFFC00FE0 /*MemDMA2 Stream 1 Source Current Descriptor Ptr reg */
758#define MDMA_S1_CURR_ADDR 0xFFC00FE4 /*MemDMA2 Stream 1 Source Current Address */ 758#define MDMA_S3_CURR_ADDR 0xFFC00FE4 /*MemDMA2 Stream 1 Source Current Address */
759#define MDMA_S1_CURR_X_COUNT 0xFFC00FF0 /*MemDMA2 Stream 1 Source Current Inner-Loop Count */ 759#define MDMA_S3_CURR_X_COUNT 0xFFC00FF0 /*MemDMA2 Stream 1 Source Current Inner-Loop Count */
760#define MDMA_S1_CURR_Y_COUNT 0xFFC00FF8 /*MemDMA2 Stream 1 Source Current Outer-Loop Count */ 760#define MDMA_S3_CURR_Y_COUNT 0xFFC00FF8 /*MemDMA2 Stream 1 Source Current Outer-Loop Count */
761#define MDMA_S1_IRQ_STATUS 0xFFC00FE8 /*MemDMA2 Stream 1 Source Interrupt/Status Register */ 761#define MDMA_S3_IRQ_STATUS 0xFFC00FE8 /*MemDMA2 Stream 1 Source Interrupt/Status Register */
762#define MDMA_S1_PERIPHERAL_MAP 0xFFC00FEC /*MemDMA2 Stream 1 Source Peripheral Map register */ 762#define MDMA_S3_PERIPHERAL_MAP 0xFFC00FEC /*MemDMA2 Stream 1 Source Peripheral Map register */
763 763
764/* Internal Memory DMA Registers (0xFFC0_1800 - 0xFFC0_19FF) */ 764/* Internal Memory DMA Registers (0xFFC0_1800 - 0xFFC0_19FF) */
765#define IMDMA_D0_CONFIG 0xFFC01808 /*IMDMA Stream 0 Destination Configuration */ 765#define IMDMA_D0_CONFIG 0xFFC01808 /*IMDMA Stream 0 Destination Configuration */
@@ -879,6 +879,13 @@
879#define DLENGTH 0x00003800 /* PPI Data Length */ 879#define DLENGTH 0x00003800 /* PPI Data Length */
880#define DLEN_8 0x0 /* PPI Data Length mask for DLEN=8 */ 880#define DLEN_8 0x0 /* PPI Data Length mask for DLEN=8 */
881#define DLEN(x) (((x-9) & 0x07) << 11) /* PPI Data Length (only works for x=10-->x=16) */ 881#define DLEN(x) (((x-9) & 0x07) << 11) /* PPI Data Length (only works for x=10-->x=16) */
882#define DLEN_10 0x00000800 /* Data Length = 10 Bits */
883#define DLEN_11 0x00001000 /* Data Length = 11 Bits */
884#define DLEN_12 0x00001800 /* Data Length = 12 Bits */
885#define DLEN_13 0x00002000 /* Data Length = 13 Bits */
886#define DLEN_14 0x00002800 /* Data Length = 14 Bits */
887#define DLEN_15 0x00003000 /* Data Length = 15 Bits */
888#define DLEN_16 0x00003800 /* Data Length = 16 Bits */
882#define POL 0x0000C000 /* PPI Signal Polarities */ 889#define POL 0x0000C000 /* PPI Signal Polarities */
883#define POLC 0x4000 /* PPI Clock Polarity */ 890#define POLC 0x4000 /* PPI Clock Polarity */
884#define POLS 0x8000 /* PPI Frame Sync Polarity */ 891#define POLS 0x8000 /* PPI Frame Sync Polarity */
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index e4137297b79..4698a980052 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -1244,7 +1244,7 @@ ENTRY(_software_trace_buff)
1244 .endr 1244 .endr
1245#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */ 1245#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */
1246 1246
1247#if CONFIG_EARLY_PRINTK 1247#ifdef CONFIG_EARLY_PRINTK
1248__INIT 1248__INIT
1249ENTRY(_early_trap) 1249ENTRY(_early_trap)
1250 SAVE_ALL_SYS 1250 SAVE_ALL_SYS
@@ -1755,6 +1755,8 @@ ENTRY(_sys_call_table)
1755 .long _sys_syncfs 1755 .long _sys_syncfs
1756 .long _sys_setns 1756 .long _sys_setns
1757 .long _sys_sendmmsg /* 380 */ 1757 .long _sys_sendmmsg /* 380 */
1758 .long _sys_process_vm_readv
1759 .long _sys_process_vm_writev
1758 1760
1759 .rept NR_syscalls-(.-_sys_call_table)/4 1761 .rept NR_syscalls-(.-_sys_call_table)/4
1760 .long _sys_ni_syscall 1762 .long _sys_ni_syscall
diff --git a/arch/c6x/include/asm/pgtable.h b/arch/c6x/include/asm/pgtable.h
index 68c8af4f1f9..38a4312eb2c 100644
--- a/arch/c6x/include/asm/pgtable.h
+++ b/arch/c6x/include/asm/pgtable.h
@@ -73,9 +73,6 @@ extern unsigned long empty_zero_page;
73#define pgtable_cache_init() do { } while (0) 73#define pgtable_cache_init() do { } while (0)
74#define io_remap_pfn_range remap_pfn_range 74#define io_remap_pfn_range remap_pfn_range
75 75
76#define io_remap_page_range(vma, vaddr, paddr, size, prot) \
77 remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot)
78
79#include <asm-generic/pgtable.h> 76#include <asm-generic/pgtable.h>
80 77
81#endif /* _ASM_C6X_PGTABLE_H */ 78#endif /* _ASM_C6X_PGTABLE_H */
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c
index b45be318119..ecbab345760 100644
--- a/arch/hexagon/kernel/signal.c
+++ b/arch/hexagon/kernel/signal.c
@@ -192,12 +192,7 @@ static int handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,
192 if (rc) 192 if (rc)
193 return rc; 193 return rc;
194 194
195 spin_lock_irq(&current->sighand->siglock); 195 block_sigmask(ka, sig);
196 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
197 if (!(ka->sa.sa_flags & SA_NODEFER))
198 sigaddset(&current->blocked, sig);
199 recalc_sigpending();
200 spin_unlock_irq(&current->sighand->siglock);
201 196
202 return 0; 197 return 0;
203} 198}
@@ -305,10 +300,7 @@ asmlinkage int sys_rt_sigreturn(void)
305 goto badframe; 300 goto badframe;
306 301
307 sigdelsetmask(&blocked, ~_BLOCKABLE); 302 sigdelsetmask(&blocked, ~_BLOCKABLE);
308 spin_lock_irq(&current->sighand->siglock); 303 set_current_blocked(&blocked);
309 current->blocked = blocked;
310 recalc_sigpending();
311 spin_unlock_irq(&current->sighand->siglock);
312 304
313 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 305 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
314 goto badframe; 306 goto badframe;
diff --git a/arch/hexagon/kernel/vdso.c b/arch/hexagon/kernel/vdso.c
index 16277c33308..f212a453b52 100644
--- a/arch/hexagon/kernel/vdso.c
+++ b/arch/hexagon/kernel/vdso.c
@@ -78,8 +78,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
78 /* MAYWRITE to allow gdb to COW and set breakpoints. */ 78 /* MAYWRITE to allow gdb to COW and set breakpoints. */
79 ret = install_special_mapping(mm, vdso_base, PAGE_SIZE, 79 ret = install_special_mapping(mm, vdso_base, PAGE_SIZE,
80 VM_READ|VM_EXEC| 80 VM_READ|VM_EXEC|
81 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| 81 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
82 VM_ALWAYSDUMP,
83 &vdso_page); 82 &vdso_page);
84 83
85 if (ret) 84 if (ret)
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 279b38ae74a..b22e5f5fa59 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -108,12 +108,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
108 return (pci_domain_nr(bus) != 0); 108 return (pci_domain_nr(bus) != 0);
109} 109}
110 110
111extern void pcibios_resource_to_bus(struct pci_dev *dev,
112 struct pci_bus_region *region, struct resource *res);
113
114extern void pcibios_bus_to_resource(struct pci_dev *dev,
115 struct resource *res, struct pci_bus_region *region);
116
117static inline struct resource * 111static inline struct resource *
118pcibios_select_root(struct pci_dev *pdev, struct resource *res) 112pcibios_select_root(struct pci_dev *pdev, struct resource *res)
119{ 113{
diff --git a/arch/ia64/include/asm/xen/interface.h b/arch/ia64/include/asm/xen/interface.h
index fbb519828aa..09d5f7fd9db 100644
--- a/arch/ia64/include/asm/xen/interface.h
+++ b/arch/ia64/include/asm/xen/interface.h
@@ -77,6 +77,7 @@ DEFINE_GUEST_HANDLE(int);
77DEFINE_GUEST_HANDLE(long); 77DEFINE_GUEST_HANDLE(long);
78DEFINE_GUEST_HANDLE(void); 78DEFINE_GUEST_HANDLE(void);
79DEFINE_GUEST_HANDLE(uint64_t); 79DEFINE_GUEST_HANDLE(uint64_t);
80DEFINE_GUEST_HANDLE(uint32_t);
80 81
81typedef unsigned long xen_pfn_t; 82typedef unsigned long xen_pfn_t;
82DEFINE_GUEST_HANDLE(xen_pfn_t); 83DEFINE_GUEST_HANDLE(xen_pfn_t);
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 5207035dc06..2d801bfe16a 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -349,11 +349,11 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
349 349
350 iosapic_override_isa_irq(p->source_irq, p->global_irq, 350 iosapic_override_isa_irq(p->source_irq, p->global_irq,
351 ((p->inti_flags & ACPI_MADT_POLARITY_MASK) == 351 ((p->inti_flags & ACPI_MADT_POLARITY_MASK) ==
352 ACPI_MADT_POLARITY_ACTIVE_HIGH) ? 352 ACPI_MADT_POLARITY_ACTIVE_LOW) ?
353 IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, 353 IOSAPIC_POL_LOW : IOSAPIC_POL_HIGH,
354 ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) == 354 ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) ==
355 ACPI_MADT_TRIGGER_EDGE) ? 355 ACPI_MADT_TRIGGER_LEVEL) ?
356 IOSAPIC_EDGE : IOSAPIC_LEVEL); 356 IOSAPIC_LEVEL : IOSAPIC_EDGE);
357 return 0; 357 return 0;
358} 358}
359 359
diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c
index 4eed3581499..070e8effa17 100644
--- a/arch/ia64/kernel/machine_kexec.c
+++ b/arch/ia64/kernel/machine_kexec.c
@@ -157,7 +157,7 @@ void arch_crash_save_vmcoreinfo(void)
157#endif 157#endif
158#ifdef CONFIG_PGTABLE_3 158#ifdef CONFIG_PGTABLE_3
159 VMCOREINFO_CONFIG(PGTABLE_3); 159 VMCOREINFO_CONFIG(PGTABLE_3);
160#elif CONFIG_PGTABLE_4 160#elif defined(CONFIG_PGTABLE_4)
161 VMCOREINFO_CONFIG(PGTABLE_4); 161 VMCOREINFO_CONFIG(PGTABLE_4);
162#endif 162#endif
163} 163}
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 84fb405eee8..8192009cb92 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -1447,6 +1447,8 @@ out:
1447 /* Get the CMC error record and log it */ 1447 /* Get the CMC error record and log it */
1448 ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CMC); 1448 ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CMC);
1449 1449
1450 local_irq_disable();
1451
1450 return IRQ_HANDLED; 1452 return IRQ_HANDLED;
1451} 1453}
1452 1454
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index f82f5d4b65f..d1ce3200147 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -320,7 +320,8 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
320 * Ignore these tiny memory ranges */ 320 * Ignore these tiny memory ranges */
321 if (!((window->resource.flags & IORESOURCE_MEM) && 321 if (!((window->resource.flags & IORESOURCE_MEM) &&
322 (window->resource.end - window->resource.start < 16))) 322 (window->resource.end - window->resource.start < 16)))
323 pci_add_resource(&info->resources, &window->resource); 323 pci_add_resource_offset(&info->resources, &window->resource,
324 window->offset);
324 325
325 return AE_OK; 326 return AE_OK;
326} 327}
@@ -395,54 +396,6 @@ out1:
395 return NULL; 396 return NULL;
396} 397}
397 398
398void pcibios_resource_to_bus(struct pci_dev *dev,
399 struct pci_bus_region *region, struct resource *res)
400{
401 struct pci_controller *controller = PCI_CONTROLLER(dev);
402 unsigned long offset = 0;
403 int i;
404
405 for (i = 0; i < controller->windows; i++) {
406 struct pci_window *window = &controller->window[i];
407 if (!(window->resource.flags & res->flags))
408 continue;
409 if (window->resource.start > res->start)
410 continue;
411 if (window->resource.end < res->end)
412 continue;
413 offset = window->offset;
414 break;
415 }
416
417 region->start = res->start - offset;
418 region->end = res->end - offset;
419}
420EXPORT_SYMBOL(pcibios_resource_to_bus);
421
422void pcibios_bus_to_resource(struct pci_dev *dev,
423 struct resource *res, struct pci_bus_region *region)
424{
425 struct pci_controller *controller = PCI_CONTROLLER(dev);
426 unsigned long offset = 0;
427 int i;
428
429 for (i = 0; i < controller->windows; i++) {
430 struct pci_window *window = &controller->window[i];
431 if (!(window->resource.flags & res->flags))
432 continue;
433 if (window->resource.start - window->offset > region->start)
434 continue;
435 if (window->resource.end - window->offset < region->end)
436 continue;
437 offset = window->offset;
438 break;
439 }
440
441 res->start = region->start + offset;
442 res->end = region->end + offset;
443}
444EXPORT_SYMBOL(pcibios_bus_to_resource);
445
446static int __devinit is_valid_resource(struct pci_dev *dev, int idx) 399static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
447{ 400{
448 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 401 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
@@ -464,15 +417,11 @@ static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
464static void __devinit 417static void __devinit
465pcibios_fixup_resources(struct pci_dev *dev, int start, int limit) 418pcibios_fixup_resources(struct pci_dev *dev, int start, int limit)
466{ 419{
467 struct pci_bus_region region;
468 int i; 420 int i;
469 421
470 for (i = start; i < limit; i++) { 422 for (i = start; i < limit; i++) {
471 if (!dev->resource[i].flags) 423 if (!dev->resource[i].flags)
472 continue; 424 continue;
473 region.start = dev->resource[i].start;
474 region.end = dev->resource[i].end;
475 pcibios_bus_to_resource(dev, &dev->resource[i], &region);
476 if ((is_valid_resource(dev, i))) 425 if ((is_valid_resource(dev, i)))
477 pci_claim_resource(dev, i); 426 pci_claim_resource(dev, i);
478 } 427 }
diff --git a/arch/ia64/sn/kernel/huberror.c b/arch/ia64/sn/kernel/huberror.c
index 08b0d9bb62e..f925dec2da9 100644
--- a/arch/ia64/sn/kernel/huberror.c
+++ b/arch/ia64/sn/kernel/huberror.c
@@ -192,6 +192,7 @@ void hub_error_init(struct hubdev_info *hubdev_info)
192 hubdev_info); 192 hubdev_info);
193 return; 193 return;
194 } 194 }
195 irq_set_handler(SGI_II_ERROR, handle_level_irq);
195 sn_set_err_irq_affinity(SGI_II_ERROR); 196 sn_set_err_irq_affinity(SGI_II_ERROR);
196} 197}
197 198
@@ -213,6 +214,7 @@ void ice_error_init(struct hubdev_info *hubdev_info)
213 hubdev_info); 214 hubdev_info);
214 return; 215 return;
215 } 216 }
217 irq_set_handler(SGI_TIO_ERROR, handle_level_irq);
216 sn_set_err_irq_affinity(SGI_TIO_ERROR); 218 sn_set_err_irq_affinity(SGI_TIO_ERROR);
217} 219}
218 220
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index 4433dd019d3..fbb5f2f87ee 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/bootmem.h> 9#include <linux/bootmem.h>
10#include <linux/export.h>
10#include <linux/slab.h> 11#include <linux/slab.h>
11#include <asm/sn/types.h> 12#include <asm/sn/types.h>
12#include <asm/sn/addrs.h> 13#include <asm/sn/addrs.h>
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 0a36f082eaf..238e2c511d9 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -297,7 +297,8 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
297 s64 status = 0; 297 s64 status = 0;
298 struct pci_controller *controller; 298 struct pci_controller *controller;
299 struct pcibus_bussoft *prom_bussoft_ptr; 299 struct pcibus_bussoft *prom_bussoft_ptr;
300 300 LIST_HEAD(resources);
301 int i;
301 302
302 status = sal_get_pcibus_info((u64) segment, (u64) busnum, 303 status = sal_get_pcibus_info((u64) segment, (u64) busnum,
303 (u64) ia64_tpa(&prom_bussoft_ptr)); 304 (u64) ia64_tpa(&prom_bussoft_ptr));
@@ -315,7 +316,15 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
315 */ 316 */
316 controller->platform_data = prom_bussoft_ptr; 317 controller->platform_data = prom_bussoft_ptr;
317 318
318 bus = pci_scan_bus(busnum, &pci_root_ops, controller); 319 sn_legacy_pci_window_fixup(controller,
320 prom_bussoft_ptr->bs_legacy_io,
321 prom_bussoft_ptr->bs_legacy_mem);
322 for (i = 0; i < controller->windows; i++)
323 pci_add_resource_offset(&resources,
324 &controller->window[i].resource,
325 controller->window[i].offset);
326 bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
327 &resources);
319 if (bus == NULL) 328 if (bus == NULL)
320 goto error_return; /* error, or bus already scanned */ 329 goto error_return; /* error, or bus already scanned */
321 330
@@ -348,9 +357,6 @@ sn_bus_fixup(struct pci_bus *bus)
348 return; 357 return;
349 } 358 }
350 sn_common_bus_fixup(bus, prom_bussoft_ptr); 359 sn_common_bus_fixup(bus, prom_bussoft_ptr);
351 sn_legacy_pci_window_fixup(PCI_CONTROLLER(bus),
352 prom_bussoft_ptr->bs_legacy_io,
353 prom_bussoft_ptr->bs_legacy_mem);
354 } 360 }
355 list_for_each_entry(pci_dev, &bus->devices, bus_list) { 361 list_for_each_entry(pci_dev, &bus->devices, bus_list) {
356 sn_io_slot_fixup(pci_dev); 362 sn_io_slot_fixup(pci_dev);
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index dfac09ab027..62cf4dde6a0 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -352,6 +352,8 @@ void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
352 spin_lock(&sn_irq_info_lock); 352 spin_lock(&sn_irq_info_lock);
353 list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]); 353 list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]);
354 reserve_irq_vector(sn_irq_info->irq_irq); 354 reserve_irq_vector(sn_irq_info->irq_irq);
355 if (sn_irq_info->irq_int_bit != -1)
356 irq_set_handler(sn_irq_info->irq_irq, handle_level_irq);
355 spin_unlock(&sn_irq_info_lock); 357 spin_unlock(&sn_irq_info_lock);
356 358
357 register_intr_pda(sn_irq_info); 359 register_intr_pda(sn_irq_info);
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 2de41d44266..4554f68b786 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -25,6 +25,7 @@
25 25
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/export.h>
28#include <linux/vmalloc.h> 29#include <linux/vmalloc.h>
29#include <linux/seq_file.h> 30#include <linux/seq_file.h>
30#include <linux/miscdevice.h> 31#include <linux/miscdevice.h>
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index c1bd1cfda32..2f406f509d4 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -191,6 +191,7 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
191 struct hubdev_info *hubdev, int bt) 191 struct hubdev_info *hubdev, int bt)
192{ 192{
193 struct cx_dev *cx_dev; 193 struct cx_dev *cx_dev;
194 int r;
194 195
195 cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL); 196 cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL);
196 DBG("cx_dev= 0x%p\n", cx_dev); 197 DBG("cx_dev= 0x%p\n", cx_dev);
@@ -207,7 +208,11 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
207 cx_dev->dev.bus = &tiocx_bus_type; 208 cx_dev->dev.bus = &tiocx_bus_type;
208 cx_dev->dev.release = tiocx_bus_release; 209 cx_dev->dev.release = tiocx_bus_release;
209 dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid); 210 dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid);
210 device_register(&cx_dev->dev); 211 r = device_register(&cx_dev->dev);
212 if (r) {
213 kfree(cx_dev);
214 return r;
215 }
211 get_device(&cx_dev->dev); 216 get_device(&cx_dev->dev);
212 217
213 device_create_file(&cx_dev->dev, &dev_attr_cxdev_control); 218 device_create_file(&cx_dev->dev, &dev_attr_cxdev_control);
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index 8886a0bc4a1..8dbbef4a4f4 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -146,6 +146,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
146 printk(KERN_WARNING 146 printk(KERN_WARNING
147 "pcibr cannot allocate interrupt for error handler\n"); 147 "pcibr cannot allocate interrupt for error handler\n");
148 } 148 }
149 irq_set_handler(SGI_PCIASIC_ERROR, handle_level_irq);
149 sn_set_err_irq_affinity(SGI_PCIASIC_ERROR); 150 sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
150 151
151 /* 152 /*
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index e77c477245f..a70b11fd57d 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -649,6 +649,7 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
649 __func__, SGI_TIOCA_ERROR, 649 __func__, SGI_TIOCA_ERROR,
650 (int)tioca_common->ca_common.bs_persist_busnum); 650 (int)tioca_common->ca_common.bs_persist_busnum);
651 651
652 irq_set_handler(SGI_TIOCA_ERROR, handle_level_irq);
652 sn_set_err_irq_affinity(SGI_TIOCA_ERROR); 653 sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
653 654
654 /* Setup locality information */ 655 /* Setup locality information */
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c
index 27faba035f3..46d3df4b03a 100644
--- a/arch/ia64/sn/pci/tioce_provider.c
+++ b/arch/ia64/sn/pci/tioce_provider.c
@@ -1037,6 +1037,7 @@ tioce_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
1037 tioce_common->ce_pcibus.bs_persist_segment, 1037 tioce_common->ce_pcibus.bs_persist_segment,
1038 tioce_common->ce_pcibus.bs_persist_busnum); 1038 tioce_common->ce_pcibus.bs_persist_busnum);
1039 1039
1040 irq_set_handler(SGI_PCIASIC_ERROR, handle_level_irq);
1040 sn_set_err_irq_affinity(SGI_PCIASIC_ERROR); 1041 sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
1041 return tioce_common; 1042 return tioce_common;
1042} 1043}
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index ae413d4a8bb..d318c606c88 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -7,6 +7,7 @@ config M68K
7 select GENERIC_IRQ_SHOW 7 select GENERIC_IRQ_SHOW
8 select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS 8 select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
9 select GENERIC_CPU_DEVICES 9 select GENERIC_CPU_DEVICES
10 select FPU if MMU
10 11
11config RWSEM_GENERIC_SPINLOCK 12config RWSEM_GENERIC_SPINLOCK
12 bool 13 bool
@@ -24,9 +25,6 @@ config ARCH_HAS_ILOG2_U64
24config GENERIC_CLOCKEVENTS 25config GENERIC_CLOCKEVENTS
25 bool 26 bool
26 27
27config GENERIC_CMOS_UPDATE
28 def_bool !MMU
29
30config GENERIC_GPIO 28config GENERIC_GPIO
31 bool 29 bool
32 30
@@ -67,6 +65,9 @@ config CPU_HAS_NO_MULDIV64
67config CPU_HAS_ADDRESS_SPACES 65config CPU_HAS_ADDRESS_SPACES
68 bool 66 bool
69 67
68config FPU
69 bool
70
70config HZ 71config HZ
71 int 72 int
72 default 1000 if CLEOPATRA 73 default 1000 if CLEOPATRA
diff --git a/arch/m68k/include/asm/m5206sim.h b/arch/m68k/include/asm/m5206sim.h
index 9015eadd5c0..69722366b08 100644
--- a/arch/m68k/include/asm/m5206sim.h
+++ b/arch/m68k/include/asm/m5206sim.h
@@ -100,11 +100,11 @@
100#define MCFDMA_BASE1 (MCF_MBAR + 0x240) /* Base address DMA 1 */ 100#define MCFDMA_BASE1 (MCF_MBAR + 0x240) /* Base address DMA 1 */
101 101
102#if defined(CONFIG_NETtel) 102#if defined(CONFIG_NETtel)
103#define MCFUART_BASE1 0x180 /* Base address of UART1 */ 103#define MCFUART_BASE0 (MCF_MBAR + 0x180) /* Base address UART0 */
104#define MCFUART_BASE2 0x140 /* Base address of UART2 */ 104#define MCFUART_BASE1 (MCF_MBAR + 0x140) /* Base address UART1 */
105#else 105#else
106#define MCFUART_BASE1 0x140 /* Base address of UART1 */ 106#define MCFUART_BASE0 (MCF_MBAR + 0x140) /* Base address UART0 */
107#define MCFUART_BASE2 0x180 /* Base address of UART2 */ 107#define MCFUART_BASE1 (MCF_MBAR + 0x180) /* Base address UART1 */
108#endif 108#endif
109 109
110/* 110/*
@@ -112,6 +112,8 @@
112 */ 112 */
113#define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */ 113#define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */
114#define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */ 114#define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */
115#define MCF_IRQ_UART0 73 /* UART0 */
116#define MCF_IRQ_UART1 74 /* UART1 */
115 117
116/* 118/*
117 * Generic GPIO 119 * Generic GPIO
diff --git a/arch/m68k/include/asm/m520xsim.h b/arch/m68k/include/asm/m520xsim.h
index eda62de7e60..17f2aab9cf9 100644
--- a/arch/m68k/include/asm/m520xsim.h
+++ b/arch/m68k/include/asm/m520xsim.h
@@ -48,8 +48,21 @@
48#define MCFINT_UART1 27 /* Interrupt number for UART1 */ 48#define MCFINT_UART1 27 /* Interrupt number for UART1 */
49#define MCFINT_UART2 28 /* Interrupt number for UART2 */ 49#define MCFINT_UART2 28 /* Interrupt number for UART2 */
50#define MCFINT_QSPI 31 /* Interrupt number for QSPI */ 50#define MCFINT_QSPI 31 /* Interrupt number for QSPI */
51#define MCFINT_FECRX0 36 /* Interrupt number for FEC RX */
52#define MCFINT_FECTX0 40 /* Interrupt number for FEC RX */
53#define MCFINT_FECENTC0 42 /* Interrupt number for FEC RX */
51#define MCFINT_PIT1 4 /* Interrupt number for PIT1 (PIT0 in processor) */ 54#define MCFINT_PIT1 4 /* Interrupt number for PIT1 (PIT0 in processor) */
52 55
56#define MCF_IRQ_UART0 (MCFINT_VECBASE + MCFINT_UART0)
57#define MCF_IRQ_UART1 (MCFINT_VECBASE + MCFINT_UART1)
58#define MCF_IRQ_UART2 (MCFINT_VECBASE + MCFINT_UART2)
59
60#define MCF_IRQ_FECRX0 (MCFINT_VECBASE + MCFINT_FECRX0)
61#define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0)
62#define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0)
63
64#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI)
65
53/* 66/*
54 * SDRAM configuration registers. 67 * SDRAM configuration registers.
55 */ 68 */
@@ -144,15 +157,25 @@
144/* 157/*
145 * UART module. 158 * UART module.
146 */ 159 */
147#define MCFUART_BASE1 0xFC060000 /* Base address of UART1 */ 160#define MCFUART_BASE0 0xFC060000 /* Base address of UART0 */
148#define MCFUART_BASE2 0xFC064000 /* Base address of UART2 */ 161#define MCFUART_BASE1 0xFC064000 /* Base address of UART1 */
149#define MCFUART_BASE3 0xFC068000 /* Base address of UART2 */ 162#define MCFUART_BASE2 0xFC068000 /* Base address of UART2 */
150 163
151/* 164/*
152 * FEC module. 165 * FEC module.
153 */ 166 */
154#define MCFFEC_BASE 0xFC030000 /* Base of FEC ethernet */ 167#define MCFFEC_BASE0 0xFC030000 /* Base of FEC ethernet */
155#define MCFFEC_SIZE 0x800 /* Register set size */ 168#define MCFFEC_SIZE0 0x800 /* Register set size */
169
170/*
171 * QSPI module.
172 */
173#define MCFQSPI_BASE 0xFC05C000 /* Base of QSPI module */
174#define MCFQSPI_SIZE 0x40 /* Register set size */
175
176#define MCFQSPI_CS0 46
177#define MCFQSPI_CS1 47
178#define MCFQSPI_CS2 27
156 179
157/* 180/*
158 * Reset Control Unit. 181 * Reset Control Unit.
diff --git a/arch/m68k/include/asm/m523xsim.h b/arch/m68k/include/asm/m523xsim.h
index 6235921eca4..075062d4eec 100644
--- a/arch/m68k/include/asm/m523xsim.h
+++ b/arch/m68k/include/asm/m523xsim.h
@@ -35,8 +35,23 @@
35 35
36#define MCFINT_VECBASE 64 /* Vector base number */ 36#define MCFINT_VECBASE 64 /* Vector base number */
37#define MCFINT_UART0 13 /* Interrupt number for UART0 */ 37#define MCFINT_UART0 13 /* Interrupt number for UART0 */
38#define MCFINT_PIT1 36 /* Interrupt number for PIT1 */ 38#define MCFINT_UART1 14 /* Interrupt number for UART1 */
39#define MCFINT_UART2 15 /* Interrupt number for UART2 */
39#define MCFINT_QSPI 18 /* Interrupt number for QSPI */ 40#define MCFINT_QSPI 18 /* Interrupt number for QSPI */
41#define MCFINT_FECRX0 23 /* Interrupt number for FEC */
42#define MCFINT_FECTX0 27 /* Interrupt number for FEC */
43#define MCFINT_FECENTC0 29 /* Interrupt number for FEC */
44#define MCFINT_PIT1 36 /* Interrupt number for PIT1 */
45
46#define MCF_IRQ_UART0 (MCFINT_VECBASE + MCFINT_UART0)
47#define MCF_IRQ_UART1 (MCFINT_VECBASE + MCFINT_UART1)
48#define MCF_IRQ_UART2 (MCFINT_VECBASE + MCFINT_UART2)
49
50#define MCF_IRQ_FECRX0 (MCFINT_VECBASE + MCFINT_FECRX0)
51#define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0)
52#define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0)
53
54#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI)
40 55
41/* 56/*
42 * SDRAM configuration registers. 57 * SDRAM configuration registers.
@@ -50,8 +65,8 @@
50/* 65/*
51 * Reset Control Unit (relative to IPSBAR). 66 * Reset Control Unit (relative to IPSBAR).
52 */ 67 */
53#define MCF_RCR 0x110000 68#define MCF_RCR (MCF_IPSBAR + 0x110000)
54#define MCF_RSR 0x110001 69#define MCF_RSR (MCF_IPSBAR + 0x110001)
55 70
56#define MCF_RCR_SWRESET 0x80 /* Software reset bit */ 71#define MCF_RCR_SWRESET 0x80 /* Software reset bit */
57#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */ 72#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */
@@ -59,15 +74,26 @@
59/* 74/*
60 * UART module. 75 * UART module.
61 */ 76 */
62#define MCFUART_BASE1 (MCF_IPSBAR + 0x200) 77#define MCFUART_BASE0 (MCF_IPSBAR + 0x200)
63#define MCFUART_BASE2 (MCF_IPSBAR + 0x240) 78#define MCFUART_BASE1 (MCF_IPSBAR + 0x240)
64#define MCFUART_BASE3 (MCF_IPSBAR + 0x280) 79#define MCFUART_BASE2 (MCF_IPSBAR + 0x280)
65 80
66/* 81/*
67 * FEC ethernet module. 82 * FEC ethernet module.
68 */ 83 */
69#define MCFFEC_BASE (MCF_IPSBAR + 0x1000) 84#define MCFFEC_BASE0 (MCF_IPSBAR + 0x1000)
70#define MCFFEC_SIZE 0x800 85#define MCFFEC_SIZE0 0x800
86
87/*
88 * QSPI module.
89 */
90#define MCFQSPI_BASE (MCF_IPSBAR + 0x340)
91#define MCFQSPI_SIZE 0x40
92
93#define MCFQSPI_CS0 91
94#define MCFQSPI_CS1 92
95#define MCFQSPI_CS2 103
96#define MCFQSPI_CS3 99
71 97
72/* 98/*
73 * GPIO module. 99 * GPIO module.
diff --git a/arch/m68k/include/asm/m5249sim.h b/arch/m68k/include/asm/m5249sim.h
index 805714ca8d7..7f0c2c3660f 100644
--- a/arch/m68k/include/asm/m5249sim.h
+++ b/arch/m68k/include/asm/m5249sim.h
@@ -76,8 +76,19 @@
76/* 76/*
77 * UART module. 77 * UART module.
78 */ 78 */
79#define MCFUART_BASE1 0x1c0 /* Base address of UART1 */ 79#define MCFUART_BASE0 (MCF_MBAR + 0x1c0) /* Base address UART0 */
80#define MCFUART_BASE2 0x200 /* Base address of UART2 */ 80#define MCFUART_BASE1 (MCF_MBAR + 0x200) /* Base address UART1 */
81
82/*
83 * QSPI module.
84 */
85#define MCFQSPI_BASE (MCF_MBAR + 0x300) /* Base address QSPI */
86#define MCFQSPI_SIZE 0x40 /* Register set size */
87
88#define MCFQSPI_CS0 29
89#define MCFQSPI_CS1 24
90#define MCFQSPI_CS2 21
91#define MCFQSPI_CS3 22
81 92
82/* 93/*
83 * DMA unit base addresses. 94 * DMA unit base addresses.
@@ -108,6 +119,9 @@
108#define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */ 119#define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */
109#define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */ 120#define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */
110 121
122#define MCF_IRQ_UART0 73 /* UART0 */
123#define MCF_IRQ_UART1 74 /* UART1 */
124
111/* 125/*
112 * General purpose IO registers (in MBAR2). 126 * General purpose IO registers (in MBAR2).
113 */ 127 */
diff --git a/arch/m68k/include/asm/m5272sim.h b/arch/m68k/include/asm/m5272sim.h
index 759c2b07a99..a58f1760d85 100644
--- a/arch/m68k/include/asm/m5272sim.h
+++ b/arch/m68k/include/asm/m5272sim.h
@@ -68,8 +68,8 @@
68#define MCFSIM_DCMR1 0x5c /* DRAM 1 Mask reg (r/w) */ 68#define MCFSIM_DCMR1 0x5c /* DRAM 1 Mask reg (r/w) */
69#define MCFSIM_DCCR1 0x63 /* DRAM 1 Control reg (r/w) */ 69#define MCFSIM_DCCR1 0x63 /* DRAM 1 Control reg (r/w) */
70 70
71#define MCFUART_BASE1 0x100 /* Base address of UART1 */ 71#define MCFUART_BASE0 (MCF_MBAR + 0x100) /* Base address UART0 */
72#define MCFUART_BASE2 0x140 /* Base address of UART2 */ 72#define MCFUART_BASE1 (MCF_MBAR + 0x140) /* Base address UART1 */
73 73
74#define MCFSIM_PACNT (MCF_MBAR + 0x80) /* Port A Control (r/w) */ 74#define MCFSIM_PACNT (MCF_MBAR + 0x80) /* Port A Control (r/w) */
75#define MCFSIM_PADDR (MCF_MBAR + 0x84) /* Port A Direction (r/w) */ 75#define MCFSIM_PADDR (MCF_MBAR + 0x84) /* Port A Direction (r/w) */
@@ -88,6 +88,9 @@
88#define MCFTIMER_BASE3 (MCF_MBAR + 0x240) /* Base address TIMER4 */ 88#define MCFTIMER_BASE3 (MCF_MBAR + 0x240) /* Base address TIMER4 */
89#define MCFTIMER_BASE4 (MCF_MBAR + 0x260) /* Base address TIMER3 */ 89#define MCFTIMER_BASE4 (MCF_MBAR + 0x260) /* Base address TIMER3 */
90 90
91#define MCFFEC_BASE0 (MCF_MBAR + 0x840) /* Base FEC ethernet */
92#define MCFFEC_SIZE0 0x1d0
93
91/* 94/*
92 * Define system peripheral IRQ usage. 95 * Define system peripheral IRQ usage.
93 */ 96 */
@@ -101,8 +104,8 @@
101#define MCF_IRQ_TIMER2 70 /* Timer 2 */ 104#define MCF_IRQ_TIMER2 70 /* Timer 2 */
102#define MCF_IRQ_TIMER3 71 /* Timer 3 */ 105#define MCF_IRQ_TIMER3 71 /* Timer 3 */
103#define MCF_IRQ_TIMER4 72 /* Timer 4 */ 106#define MCF_IRQ_TIMER4 72 /* Timer 4 */
104#define MCF_IRQ_UART1 73 /* UART 1 */ 107#define MCF_IRQ_UART0 73 /* UART 0 */
105#define MCF_IRQ_UART2 74 /* UART 2 */ 108#define MCF_IRQ_UART1 74 /* UART 1 */
106#define MCF_IRQ_PLIP 75 /* PLIC 2Khz Periodic */ 109#define MCF_IRQ_PLIP 75 /* PLIC 2Khz Periodic */
107#define MCF_IRQ_PLIA 76 /* PLIC Asynchronous */ 110#define MCF_IRQ_PLIA 76 /* PLIC Asynchronous */
108#define MCF_IRQ_USB0 77 /* USB Endpoint 0 */ 111#define MCF_IRQ_USB0 77 /* USB Endpoint 0 */
@@ -114,9 +117,9 @@
114#define MCF_IRQ_USB6 83 /* USB Endpoint 6 */ 117#define MCF_IRQ_USB6 83 /* USB Endpoint 6 */
115#define MCF_IRQ_USB7 84 /* USB Endpoint 7 */ 118#define MCF_IRQ_USB7 84 /* USB Endpoint 7 */
116#define MCF_IRQ_DMA 85 /* DMA Controller */ 119#define MCF_IRQ_DMA 85 /* DMA Controller */
117#define MCF_IRQ_ERX 86 /* Ethernet Receiver */ 120#define MCF_IRQ_FECRX0 86 /* Ethernet Receiver */
118#define MCF_IRQ_ETX 87 /* Ethernet Transmitter */ 121#define MCF_IRQ_FECTX0 87 /* Ethernet Transmitter */
119#define MCF_IRQ_ENTC 88 /* Ethernet Non-Time Critical */ 122#define MCF_IRQ_FECENTC0 88 /* Ethernet Non-Time Critical */
120#define MCF_IRQ_QSPI 89 /* Queued Serial Interface */ 123#define MCF_IRQ_QSPI 89 /* Queued Serial Interface */
121#define MCF_IRQ_EINT5 90 /* External Interrupt 5 */ 124#define MCF_IRQ_EINT5 90 /* External Interrupt 5 */
122#define MCF_IRQ_EINT6 91 /* External Interrupt 6 */ 125#define MCF_IRQ_EINT6 91 /* External Interrupt 6 */
diff --git a/arch/m68k/include/asm/m527xsim.h b/arch/m68k/include/asm/m527xsim.h
index 758810ef91e..83db8106f50 100644
--- a/arch/m68k/include/asm/m527xsim.h
+++ b/arch/m68k/include/asm/m527xsim.h
@@ -38,8 +38,29 @@
38#define MCFINT_UART1 14 /* Interrupt number for UART1 */ 38#define MCFINT_UART1 14 /* Interrupt number for UART1 */
39#define MCFINT_UART2 15 /* Interrupt number for UART2 */ 39#define MCFINT_UART2 15 /* Interrupt number for UART2 */
40#define MCFINT_QSPI 18 /* Interrupt number for QSPI */ 40#define MCFINT_QSPI 18 /* Interrupt number for QSPI */
41#define MCFINT_FECRX0 23 /* Interrupt number for FEC0 */
42#define MCFINT_FECTX0 27 /* Interrupt number for FEC0 */
43#define MCFINT_FECENTC0 29 /* Interrupt number for FEC0 */
41#define MCFINT_PIT1 36 /* Interrupt number for PIT1 */ 44#define MCFINT_PIT1 36 /* Interrupt number for PIT1 */
42 45
46#define MCFINT2_VECBASE 128 /* Vector base number 2 */
47#define MCFINT2_FECRX1 23 /* Interrupt number for FEC1 */
48#define MCFINT2_FECTX1 27 /* Interrupt number for FEC1 */
49#define MCFINT2_FECENTC1 29 /* Interrupt number for FEC1 */
50
51#define MCF_IRQ_UART0 (MCFINT_VECBASE + MCFINT_UART0)
52#define MCF_IRQ_UART1 (MCFINT_VECBASE + MCFINT_UART1)
53#define MCF_IRQ_UART2 (MCFINT_VECBASE + MCFINT_UART2)
54
55#define MCF_IRQ_FECRX0 (MCFINT_VECBASE + MCFINT_FECRX0)
56#define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0)
57#define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0)
58#define MCF_IRQ_FECRX1 (MCFINT2_VECBASE + MCFINT2_FECRX1)
59#define MCF_IRQ_FECTX1 (MCFINT2_VECBASE + MCFINT2_FECTX1)
60#define MCF_IRQ_FECENTC1 (MCFINT2_VECBASE + MCFINT2_FECENTC1)
61
62#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI)
63
43/* 64/*
44 * SDRAM configuration registers. 65 * SDRAM configuration registers.
45 */ 66 */
@@ -72,9 +93,9 @@
72/* 93/*
73 * UART module. 94 * UART module.
74 */ 95 */
75#define MCFUART_BASE1 (MCF_IPSBAR + 0x200) 96#define MCFUART_BASE0 (MCF_IPSBAR + 0x200)
76#define MCFUART_BASE2 (MCF_IPSBAR + 0x240) 97#define MCFUART_BASE1 (MCF_IPSBAR + 0x240)
77#define MCFUART_BASE3 (MCF_IPSBAR + 0x280) 98#define MCFUART_BASE2 (MCF_IPSBAR + 0x280)
78 99
79/* 100/*
80 * FEC ethernet module. 101 * FEC ethernet module.
@@ -84,6 +105,28 @@
84#define MCFFEC_BASE1 (MCF_IPSBAR + 0x1800) 105#define MCFFEC_BASE1 (MCF_IPSBAR + 0x1800)
85#define MCFFEC_SIZE1 0x800 106#define MCFFEC_SIZE1 0x800
86 107
108/*
109 * QSPI module.
110 */
111#define MCFQSPI_BASE (MCF_IPSBAR + 0x340)
112#define MCFQSPI_SIZE 0x40
113
114#ifdef CONFIG_M5271
115#define MCFQSPI_CS0 91
116#define MCFQSPI_CS1 92
117#define MCFQSPI_CS2 99
118#define MCFQSPI_CS3 103
119#endif
120#ifdef CONFIG_M5275
121#define MCFQSPI_CS0 59
122#define MCFQSPI_CS1 60
123#define MCFQSPI_CS2 61
124#define MCFQSPI_CS3 62
125#endif
126
127/*
128 * GPIO module.
129 */
87#ifdef CONFIG_M5271 130#ifdef CONFIG_M5271
88#define MCFGPIO_PODR_ADDR (MCF_IPSBAR + 0x100000) 131#define MCFGPIO_PODR_ADDR (MCF_IPSBAR + 0x100000)
89#define MCFGPIO_PODR_DATAH (MCF_IPSBAR + 0x100001) 132#define MCFGPIO_PODR_DATAH (MCF_IPSBAR + 0x100001)
@@ -285,8 +328,8 @@
285/* 328/*
286 * Reset Control Unit (relative to IPSBAR). 329 * Reset Control Unit (relative to IPSBAR).
287 */ 330 */
288#define MCF_RCR 0x110000 331#define MCF_RCR (MCF_IPSBAR + 0x110000)
289#define MCF_RSR 0x110001 332#define MCF_RSR (MCF_IPSBAR + 0x110001)
290 333
291#define MCF_RCR_SWRESET 0x80 /* Software reset bit */ 334#define MCF_RCR_SWRESET 0x80 /* Software reset bit */
292#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */ 335#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */
diff --git a/arch/m68k/include/asm/m528xsim.h b/arch/m68k/include/asm/m528xsim.h
index d798bd5df56..569476fba18 100644
--- a/arch/m68k/include/asm/m528xsim.h
+++ b/arch/m68k/include/asm/m528xsim.h
@@ -35,9 +35,24 @@
35 35
36#define MCFINT_VECBASE 64 /* Vector base number */ 36#define MCFINT_VECBASE 64 /* Vector base number */
37#define MCFINT_UART0 13 /* Interrupt number for UART0 */ 37#define MCFINT_UART0 13 /* Interrupt number for UART0 */
38#define MCFINT_UART1 14 /* Interrupt number for UART1 */
39#define MCFINT_UART2 15 /* Interrupt number for UART2 */
38#define MCFINT_QSPI 18 /* Interrupt number for QSPI */ 40#define MCFINT_QSPI 18 /* Interrupt number for QSPI */
41#define MCFINT_FECRX0 23 /* Interrupt number for FEC */
42#define MCFINT_FECTX0 27 /* Interrupt number for FEC */
43#define MCFINT_FECENTC0 29 /* Interrupt number for FEC */
39#define MCFINT_PIT1 55 /* Interrupt number for PIT1 */ 44#define MCFINT_PIT1 55 /* Interrupt number for PIT1 */
40 45
46#define MCF_IRQ_UART0 (MCFINT_VECBASE + MCFINT_UART0)
47#define MCF_IRQ_UART1 (MCFINT_VECBASE + MCFINT_UART1)
48#define MCF_IRQ_UART2 (MCFINT_VECBASE + MCFINT_UART2)
49
50#define MCF_IRQ_FECRX0 (MCFINT_VECBASE + MCFINT_FECRX0)
51#define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0)
52#define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0)
53
54#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI)
55
41/* 56/*
42 * SDRAM configuration registers. 57 * SDRAM configuration registers.
43 */ 58 */
@@ -58,15 +73,26 @@
58/* 73/*
59 * UART module. 74 * UART module.
60 */ 75 */
61#define MCFUART_BASE1 (MCF_IPSBAR + 0x00000200) 76#define MCFUART_BASE0 (MCF_IPSBAR + 0x00000200)
62#define MCFUART_BASE2 (MCF_IPSBAR + 0x00000240) 77#define MCFUART_BASE1 (MCF_IPSBAR + 0x00000240)
63#define MCFUART_BASE3 (MCF_IPSBAR + 0x00000280) 78#define MCFUART_BASE2 (MCF_IPSBAR + 0x00000280)
64 79
65/* 80/*
66 * FEC ethernet module. 81 * FEC ethernet module.
67 */ 82 */
68#define MCFFEC_BASE (MCF_IPSBAR + 0x00001000) 83#define MCFFEC_BASE0 (MCF_IPSBAR + 0x00001000)
69#define MCFFEC_SIZE 0x800 84#define MCFFEC_SIZE0 0x800
85
86/*
87 * QSPI module.
88 */
89#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340)
90#define MCFQSPI_SIZE 0x40
91
92#define MCFQSPI_CS0 147
93#define MCFQSPI_CS1 148
94#define MCFQSPI_CS2 149
95#define MCFQSPI_CS3 150
70 96
71/* 97/*
72 * GPIO registers 98 * GPIO registers
@@ -246,8 +272,8 @@
246/* 272/*
247 * Reset Control Unit (relative to IPSBAR). 273 * Reset Control Unit (relative to IPSBAR).
248 */ 274 */
249#define MCF_RCR 0x110000 275#define MCF_RCR (MCF_IPSBAR + 0x110000)
250#define MCF_RSR 0x110001 276#define MCF_RSR (MCF_IPSBAR + 0x110001)
251 277
252#define MCF_RCR_SWRESET 0x80 /* Software reset bit */ 278#define MCF_RCR_SWRESET 0x80 /* Software reset bit */
253#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */ 279#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */
diff --git a/arch/m68k/include/asm/m5307sim.h b/arch/m68k/include/asm/m5307sim.h
index 8f8609fcc9b..3bc3adaa7ee 100644
--- a/arch/m68k/include/asm/m5307sim.h
+++ b/arch/m68k/include/asm/m5307sim.h
@@ -117,11 +117,11 @@
117 * UART module. 117 * UART module.
118 */ 118 */
119#if defined(CONFIG_NETtel) || defined(CONFIG_SECUREEDGEMP3) 119#if defined(CONFIG_NETtel) || defined(CONFIG_SECUREEDGEMP3)
120#define MCFUART_BASE1 0x200 /* Base address of UART1 */ 120#define MCFUART_BASE0 (MCF_MBAR + 0x200) /* Base address UART0 */
121#define MCFUART_BASE2 0x1c0 /* Base address of UART2 */ 121#define MCFUART_BASE1 (MCF_MBAR + 0x1c0) /* Base address UART1 */
122#else 122#else
123#define MCFUART_BASE1 0x1c0 /* Base address of UART1 */ 123#define MCFUART_BASE0 (MCF_MBAR + 0x1c0) /* Base address UART0 */
124#define MCFUART_BASE2 0x200 /* Base address of UART2 */ 124#define MCFUART_BASE1 (MCF_MBAR + 0x200) /* Base address UART1 */
125#endif 125#endif
126 126
127/* 127/*
@@ -176,6 +176,8 @@
176 */ 176 */
177#define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */ 177#define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */
178#define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */ 178#define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */
179#define MCF_IRQ_UART0 73 /* UART0 */
180#define MCF_IRQ_UART1 74 /* UART1 */
179 181
180/****************************************************************************/ 182/****************************************************************************/
181#endif /* m5307sim_h */ 183#endif /* m5307sim_h */
diff --git a/arch/m68k/include/asm/m532xsim.h b/arch/m68k/include/asm/m532xsim.h
index ba4cc784f57..29b66e21413 100644
--- a/arch/m68k/include/asm/m532xsim.h
+++ b/arch/m68k/include/asm/m532xsim.h
@@ -24,6 +24,19 @@
24#define MCFINT_UART1 27 /* Interrupt number for UART1 */ 24#define MCFINT_UART1 27 /* Interrupt number for UART1 */
25#define MCFINT_UART2 28 /* Interrupt number for UART2 */ 25#define MCFINT_UART2 28 /* Interrupt number for UART2 */
26#define MCFINT_QSPI 31 /* Interrupt number for QSPI */ 26#define MCFINT_QSPI 31 /* Interrupt number for QSPI */
27#define MCFINT_FECRX0 36 /* Interrupt number for FEC */
28#define MCFINT_FECTX0 40 /* Interrupt number for FEC */
29#define MCFINT_FECENTC0 42 /* Interrupt number for FEC */
30
31#define MCF_IRQ_UART0 (MCFINT_VECBASE + MCFINT_UART0)
32#define MCF_IRQ_UART1 (MCFINT_VECBASE + MCFINT_UART1)
33#define MCF_IRQ_UART2 (MCFINT_VECBASE + MCFINT_UART2)
34
35#define MCF_IRQ_FECRX0 (MCFINT_VECBASE + MCFINT_FECRX0)
36#define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0)
37#define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0)
38
39#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI)
27 40
28#define MCF_WTM_WCR MCF_REG16(0xFC098000) 41#define MCF_WTM_WCR MCF_REG16(0xFC098000)
29 42
@@ -82,9 +95,25 @@
82/* 95/*
83 * UART module. 96 * UART module.
84 */ 97 */
85#define MCFUART_BASE1 0xFC060000 /* Base address of UART1 */ 98#define MCFUART_BASE0 0xFC060000 /* Base address of UART1 */
86#define MCFUART_BASE2 0xFC064000 /* Base address of UART2 */ 99#define MCFUART_BASE1 0xFC064000 /* Base address of UART2 */
87#define MCFUART_BASE3 0xFC068000 /* Base address of UART3 */ 100#define MCFUART_BASE2 0xFC068000 /* Base address of UART3 */
101
102/*
103 * FEC module.
104 */
105#define MCFFEC_BASE0 0xFC030000 /* Base address of FEC0 */
106#define MCFFEC_SIZE0 0x800 /* Size of FEC0 region */
107
108/*
109 * QSPI module.
110 */
111#define MCFQSPI_BASE 0xFC058000 /* Base address of QSPI */
112#define MCFQSPI_SIZE 0x40 /* Size of QSPI region */
113
114#define MCFQSPI_CS0 84
115#define MCFQSPI_CS1 85
116#define MCFQSPI_CS2 86
88 117
89/* 118/*
90 * Timer module. 119 * Timer module.
diff --git a/arch/m68k/include/asm/m5407sim.h b/arch/m68k/include/asm/m5407sim.h
index 51e00b00b8a..79f58dd6a83 100644
--- a/arch/m68k/include/asm/m5407sim.h
+++ b/arch/m68k/include/asm/m5407sim.h
@@ -85,8 +85,8 @@
85#define MCFTIMER_BASE1 (MCF_MBAR + 0x140) /* Base of TIMER1 */ 85#define MCFTIMER_BASE1 (MCF_MBAR + 0x140) /* Base of TIMER1 */
86#define MCFTIMER_BASE2 (MCF_MBAR + 0x180) /* Base of TIMER2 */ 86#define MCFTIMER_BASE2 (MCF_MBAR + 0x180) /* Base of TIMER2 */
87 87
88#define MCFUART_BASE1 0x1c0 /* Base address of UART1 */ 88#define MCFUART_BASE0 (MCF_MBAR + 0x1c0) /* Base address UART0 */
89#define MCFUART_BASE2 0x200 /* Base address of UART2 */ 89#define MCFUART_BASE1 (MCF_MBAR + 0x200) /* Base address UART1 */
90 90
91#define MCFSIM_PADDR (MCF_MBAR + 0x244) 91#define MCFSIM_PADDR (MCF_MBAR + 0x244)
92#define MCFSIM_PADAT (MCF_MBAR + 0x248) 92#define MCFSIM_PADAT (MCF_MBAR + 0x248)
@@ -139,6 +139,8 @@
139 */ 139 */
140#define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */ 140#define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */
141#define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */ 141#define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */
142#define MCF_IRQ_UART0 73 /* UART0 */
143#define MCF_IRQ_UART1 74 /* UART1 */
142 144
143/****************************************************************************/ 145/****************************************************************************/
144#endif /* m5407sim_h */ 146#endif /* m5407sim_h */
diff --git a/arch/m68k/include/asm/m54xxsim.h b/arch/m68k/include/asm/m54xxsim.h
index 1ed8bfb0277..ae56b8848a9 100644
--- a/arch/m68k/include/asm/m54xxsim.h
+++ b/arch/m68k/include/asm/m54xxsim.h
@@ -31,16 +31,20 @@
31/* 31/*
32 * UART module. 32 * UART module.
33 */ 33 */
34#define MCFUART_BASE1 0x8600 /* Base address of UART1 */ 34#define MCFUART_BASE0 (MCF_MBAR + 0x8600) /* Base address UART0 */
35#define MCFUART_BASE2 0x8700 /* Base address of UART2 */ 35#define MCFUART_BASE1 (MCF_MBAR + 0x8700) /* Base address UART1 */
36#define MCFUART_BASE3 0x8800 /* Base address of UART3 */ 36#define MCFUART_BASE2 (MCF_MBAR + 0x8800) /* Base address UART2 */
37#define MCFUART_BASE4 0x8900 /* Base address of UART4 */ 37#define MCFUART_BASE3 (MCF_MBAR + 0x8900) /* Base address UART3 */
38 38
39/* 39/*
40 * Define system peripheral IRQ usage. 40 * Define system peripheral IRQ usage.
41 */ 41 */
42#define MCF_IRQ_TIMER (64 + 54) /* Slice Timer 0 */ 42#define MCF_IRQ_TIMER (MCFINT_VECBASE + 54) /* Slice Timer 0 */
43#define MCF_IRQ_PROFILER (64 + 53) /* Slice Timer 1 */ 43#define MCF_IRQ_PROFILER (MCFINT_VECBASE + 53) /* Slice Timer 1 */
44#define MCF_IRQ_UART0 (MCFINT_VECBASE + 35)
45#define MCF_IRQ_UART1 (MCFINT_VECBASE + 34)
46#define MCF_IRQ_UART2 (MCFINT_VECBASE + 33)
47#define MCF_IRQ_UART3 (MCFINT_VECBASE + 32)
44 48
45/* 49/*
46 * Generic GPIO support 50 * Generic GPIO support
diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h
index 789f3b2de0e..825c1c81319 100644
--- a/arch/m68k/include/asm/machdep.h
+++ b/arch/m68k/include/asm/machdep.h
@@ -22,8 +22,6 @@ extern unsigned int (*mach_get_ss)(void);
22extern int (*mach_get_rtc_pll)(struct rtc_pll_info *); 22extern int (*mach_get_rtc_pll)(struct rtc_pll_info *);
23extern int (*mach_set_rtc_pll)(struct rtc_pll_info *); 23extern int (*mach_set_rtc_pll)(struct rtc_pll_info *);
24extern int (*mach_set_clock_mmss)(unsigned long); 24extern int (*mach_set_clock_mmss)(unsigned long);
25extern void (*mach_gettod)(int *year, int *mon, int *day, int *hour,
26 int *min, int *sec);
27extern void (*mach_reset)( void ); 25extern void (*mach_reset)( void );
28extern void (*mach_halt)( void ); 26extern void (*mach_halt)( void );
29extern void (*mach_power_off)( void ); 27extern void (*mach_power_off)( void );
@@ -35,9 +33,8 @@ extern void (*mach_l2_flush) (int);
35extern void (*mach_beep) (unsigned int, unsigned int); 33extern void (*mach_beep) (unsigned int, unsigned int);
36 34
37/* Hardware clock functions */ 35/* Hardware clock functions */
38extern void hw_timer_init(void); 36extern void hw_timer_init(irq_handler_t handler);
39extern unsigned long hw_timer_offset(void); 37extern unsigned long hw_timer_offset(void);
40extern irqreturn_t arch_timer_interrupt(int irq, void *dummy);
41 38
42extern void config_BSP(char *command, int len); 39extern void config_BSP(char *command, int len);
43 40
diff --git a/arch/m68k/include/asm/mcfqspi.h b/arch/m68k/include/asm/mcfqspi.h
index 7fe631972f1..7b51416ccae 100644
--- a/arch/m68k/include/asm/mcfqspi.h
+++ b/arch/m68k/include/asm/mcfqspi.h
@@ -21,17 +21,6 @@
21#ifndef mcfqspi_h 21#ifndef mcfqspi_h
22#define mcfqspi_h 22#define mcfqspi_h
23 23
24#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
25#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340)
26#elif defined(CONFIG_M5249)
27#define MCFQSPI_IOBASE (MCF_MBAR + 0x300)
28#elif defined(CONFIG_M520x)
29#define MCFQSPI_IOBASE 0xFC05C000
30#elif defined(CONFIG_M532x)
31#define MCFQSPI_IOBASE 0xFC058000
32#endif
33#define MCFQSPI_IOSIZE 0x40
34
35/** 24/**
36 * struct mcfqspi_cs_control - chip select control for the coldfire qspi driver 25 * struct mcfqspi_cs_control - chip select control for the coldfire qspi driver
37 * @setup: setup the control; allocate gpio's, etc. May be NULL. 26 * @setup: setup the control; allocate gpio's, etc. May be NULL.
diff --git a/arch/m68k/include/asm/mcfuart.h b/arch/m68k/include/asm/mcfuart.h
index 2abedff0a69..2d3bc774b3c 100644
--- a/arch/m68k/include/asm/mcfuart.h
+++ b/arch/m68k/include/asm/mcfuart.h
@@ -41,7 +41,10 @@ struct mcf_platform_uart {
41#define MCFUART_UTF 0x28 /* Transmitter FIFO (r/w) */ 41#define MCFUART_UTF 0x28 /* Transmitter FIFO (r/w) */
42#define MCFUART_URF 0x2c /* Receiver FIFO (r/w) */ 42#define MCFUART_URF 0x2c /* Receiver FIFO (r/w) */
43#define MCFUART_UFPD 0x30 /* Frac Prec. Divider (r/w) */ 43#define MCFUART_UFPD 0x30 /* Frac Prec. Divider (r/w) */
44#else 44#endif
45#if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || \
46 defined(CONFIG_M5249) || defined(CONFIG_M5307) || \
47 defined(CONFIG_M5407)
45#define MCFUART_UIVR 0x30 /* Interrupt Vector (r/w) */ 48#define MCFUART_UIVR 0x30 /* Interrupt Vector (r/w) */
46#endif 49#endif
47#define MCFUART_UIPR 0x34 /* Input Port (r) */ 50#define MCFUART_UIPR 0x34 /* Input Port (r) */
diff --git a/arch/m68k/include/asm/system.h b/arch/m68k/include/asm/system.h
index 47b01f4726b..8dc68178716 100644
--- a/arch/m68k/include/asm/system.h
+++ b/arch/m68k/include/asm/system.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/linkage.h> 4#include <linux/linkage.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/bug.h>
6#include <linux/irqflags.h> 7#include <linux/irqflags.h>
7#include <asm/segment.h> 8#include <asm/segment.h>
8#include <asm/entry.h> 9#include <asm/entry.h>
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 6cf4bd6e34f..c54ef927e48 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -1,5 +1,378 @@
1/*
2 * linux/arch/m68k/kernel/process.c
3 *
4 * Copyright (C) 1995 Hamish Macdonald
5 *
6 * 68060 fixes by Jesper Skov
7 */
8
9/*
10 * This file handles the architecture-dependent parts of process handling..
11 */
12
13#include <linux/errno.h>
14#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/mm.h>
18#include <linux/slab.h>
19#include <linux/fs.h>
20#include <linux/smp.h>
21#include <linux/stddef.h>
22#include <linux/unistd.h>
23#include <linux/ptrace.h>
24#include <linux/user.h>
25#include <linux/reboot.h>
26#include <linux/init_task.h>
27#include <linux/mqueue.h>
28
29#include <asm/uaccess.h>
30#include <asm/system.h>
31#include <asm/traps.h>
32#include <asm/machdep.h>
33#include <asm/setup.h>
34#include <asm/pgtable.h>
35
36
37asmlinkage void ret_from_fork(void);
38
39
40/*
41 * Return saved PC from a blocked thread
42 */
43unsigned long thread_saved_pc(struct task_struct *tsk)
44{
45 struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp;
46 /* Check whether the thread is blocked in resume() */
47 if (in_sched_functions(sw->retpc))
48 return ((unsigned long *)sw->a6)[1];
49 else
50 return sw->retpc;
51}
52
53/*
54 * The idle loop on an m68k..
55 */
56static void default_idle(void)
57{
58 if (!need_resched())
59#if defined(MACH_ATARI_ONLY)
60 /* block out HSYNC on the atari (falcon) */
61 __asm__("stop #0x2200" : : : "cc");
62#else
63 __asm__("stop #0x2000" : : : "cc");
64#endif
65}
66
67void (*idle)(void) = default_idle;
68
69/*
70 * The idle thread. There's no useful work to be
71 * done, so just try to conserve power and have a
72 * low exit latency (ie sit in a loop waiting for
73 * somebody to say that they'd like to reschedule)
74 */
75void cpu_idle(void)
76{
77 /* endless idle loop with no priority at all */
78 while (1) {
79 while (!need_resched())
80 idle();
81 schedule_preempt_disabled();
82 }
83}
84
85void machine_restart(char * __unused)
86{
87 if (mach_reset)
88 mach_reset();
89 for (;;);
90}
91
92void machine_halt(void)
93{
94 if (mach_halt)
95 mach_halt();
96 for (;;);
97}
98
99void machine_power_off(void)
100{
101 if (mach_power_off)
102 mach_power_off();
103 for (;;);
104}
105
106void (*pm_power_off)(void) = machine_power_off;
107EXPORT_SYMBOL(pm_power_off);
108
109void show_regs(struct pt_regs * regs)
110{
111 printk("\n");
112 printk("Format %02x Vector: %04x PC: %08lx Status: %04x %s\n",
113 regs->format, regs->vector, regs->pc, regs->sr, print_tainted());
114 printk("ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n",
115 regs->orig_d0, regs->d0, regs->a2, regs->a1);
116 printk("A0: %08lx D5: %08lx D4: %08lx\n",
117 regs->a0, regs->d5, regs->d4);
118 printk("D3: %08lx D2: %08lx D1: %08lx\n",
119 regs->d3, regs->d2, regs->d1);
120 if (!(regs->sr & PS_S))
121 printk("USP: %08lx\n", rdusp());
122}
123
124/*
125 * Create a kernel thread
126 */
127int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
128{
129 int pid;
130 mm_segment_t fs;
131
132 fs = get_fs();
133 set_fs (KERNEL_DS);
134
135 {
136 register long retval __asm__ ("d0");
137 register long clone_arg __asm__ ("d1") = flags | CLONE_VM | CLONE_UNTRACED;
138
139 retval = __NR_clone;
140 __asm__ __volatile__
141 ("clrl %%d2\n\t"
142 "trap #0\n\t" /* Linux/m68k system call */
143 "tstl %0\n\t" /* child or parent */
144 "jne 1f\n\t" /* parent - jump */
145#ifdef CONFIG_MMU
146 "lea %%sp@(%c7),%6\n\t" /* reload current */
147 "movel %6@,%6\n\t"
148#endif
149 "movel %3,%%sp@-\n\t" /* push argument */
150 "jsr %4@\n\t" /* call fn */
151 "movel %0,%%d1\n\t" /* pass exit value */
152 "movel %2,%%d0\n\t" /* exit */
153 "trap #0\n"
154 "1:"
155 : "+d" (retval)
156 : "i" (__NR_clone), "i" (__NR_exit),
157 "r" (arg), "a" (fn), "d" (clone_arg), "r" (current),
158 "i" (-THREAD_SIZE)
159 : "d2");
160
161 pid = retval;
162 }
163
164 set_fs (fs);
165 return pid;
166}
167EXPORT_SYMBOL(kernel_thread);
168
169void flush_thread(void)
170{
171 current->thread.fs = __USER_DS;
172#ifdef CONFIG_FPU
173 if (!FPU_IS_EMU) {
174 unsigned long zero = 0;
175 asm volatile("frestore %0": :"m" (zero));
176 }
177#endif
178}
179
180/*
181 * "m68k_fork()".. By the time we get here, the
182 * non-volatile registers have also been saved on the
183 * stack. We do some ugly pointer stuff here.. (see
184 * also copy_thread)
185 */
186
187asmlinkage int m68k_fork(struct pt_regs *regs)
188{
1#ifdef CONFIG_MMU 189#ifdef CONFIG_MMU
2#include "process_mm.c" 190 return do_fork(SIGCHLD, rdusp(), regs, 0, NULL, NULL);
3#else 191#else
4#include "process_no.c" 192 return -EINVAL;
5#endif 193#endif
194}
195
196asmlinkage int m68k_vfork(struct pt_regs *regs)
197{
198 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0,
199 NULL, NULL);
200}
201
202asmlinkage int m68k_clone(struct pt_regs *regs)
203{
204 unsigned long clone_flags;
205 unsigned long newsp;
206 int __user *parent_tidptr, *child_tidptr;
207
208 /* syscall2 puts clone_flags in d1 and usp in d2 */
209 clone_flags = regs->d1;
210 newsp = regs->d2;
211 parent_tidptr = (int __user *)regs->d3;
212 child_tidptr = (int __user *)regs->d4;
213 if (!newsp)
214 newsp = rdusp();
215 return do_fork(clone_flags, newsp, regs, 0,
216 parent_tidptr, child_tidptr);
217}
218
219int copy_thread(unsigned long clone_flags, unsigned long usp,
220 unsigned long unused,
221 struct task_struct * p, struct pt_regs * regs)
222{
223 struct pt_regs * childregs;
224 struct switch_stack * childstack, *stack;
225 unsigned long *retp;
226
227 childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1;
228
229 *childregs = *regs;
230 childregs->d0 = 0;
231
232 retp = ((unsigned long *) regs);
233 stack = ((struct switch_stack *) retp) - 1;
234
235 childstack = ((struct switch_stack *) childregs) - 1;
236 *childstack = *stack;
237 childstack->retpc = (unsigned long)ret_from_fork;
238
239 p->thread.usp = usp;
240 p->thread.ksp = (unsigned long)childstack;
241
242 if (clone_flags & CLONE_SETTLS)
243 task_thread_info(p)->tp_value = regs->d5;
244
245 /*
246 * Must save the current SFC/DFC value, NOT the value when
247 * the parent was last descheduled - RGH 10-08-96
248 */
249 p->thread.fs = get_fs().seg;
250
251#ifdef CONFIG_FPU
252 if (!FPU_IS_EMU) {
253 /* Copy the current fpu state */
254 asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory");
255
256 if (!CPU_IS_060 ? p->thread.fpstate[0] : p->thread.fpstate[2]) {
257 if (CPU_IS_COLDFIRE) {
258 asm volatile ("fmovemd %/fp0-%/fp7,%0\n\t"
259 "fmovel %/fpiar,%1\n\t"
260 "fmovel %/fpcr,%2\n\t"
261 "fmovel %/fpsr,%3"
262 :
263 : "m" (p->thread.fp[0]),
264 "m" (p->thread.fpcntl[0]),
265 "m" (p->thread.fpcntl[1]),
266 "m" (p->thread.fpcntl[2])
267 : "memory");
268 } else {
269 asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t"
270 "fmoveml %/fpiar/%/fpcr/%/fpsr,%1"
271 :
272 : "m" (p->thread.fp[0]),
273 "m" (p->thread.fpcntl[0])
274 : "memory");
275 }
276 }
277
278 /* Restore the state in case the fpu was busy */
279 asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0]));
280 }
281#endif /* CONFIG_FPU */
282
283 return 0;
284}
285
286/* Fill in the fpu structure for a core dump. */
287#ifdef CONFIG_FPU
288int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
289{
290 char fpustate[216];
291
292 if (FPU_IS_EMU) {
293 int i;
294
295 memcpy(fpu->fpcntl, current->thread.fpcntl, 12);
296 memcpy(fpu->fpregs, current->thread.fp, 96);
297 /* Convert internal fpu reg representation
298 * into long double format
299 */
300 for (i = 0; i < 24; i += 3)
301 fpu->fpregs[i] = ((fpu->fpregs[i] & 0xffff0000) << 15) |
302 ((fpu->fpregs[i] & 0x0000ffff) << 16);
303 return 1;
304 }
305
306 /* First dump the fpu context to avoid protocol violation. */
307 asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
308 if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
309 return 0;
310
311 if (CPU_IS_COLDFIRE) {
312 asm volatile ("fmovel %/fpiar,%0\n\t"
313 "fmovel %/fpcr,%1\n\t"
314 "fmovel %/fpsr,%2\n\t"
315 "fmovemd %/fp0-%/fp7,%3"
316 :
317 : "m" (fpu->fpcntl[0]),
318 "m" (fpu->fpcntl[1]),
319 "m" (fpu->fpcntl[2]),
320 "m" (fpu->fpregs[0])
321 : "memory");
322 } else {
323 asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0"
324 :
325 : "m" (fpu->fpcntl[0])
326 : "memory");
327 asm volatile ("fmovemx %/fp0-%/fp7,%0"
328 :
329 : "m" (fpu->fpregs[0])
330 : "memory");
331 }
332
333 return 1;
334}
335EXPORT_SYMBOL(dump_fpu);
336#endif /* CONFIG_FPU */
337
338/*
339 * sys_execve() executes a new program.
340 */
341asmlinkage int sys_execve(const char __user *name,
342 const char __user *const __user *argv,
343 const char __user *const __user *envp)
344{
345 int error;
346 char * filename;
347 struct pt_regs *regs = (struct pt_regs *) &name;
348
349 filename = getname(name);
350 error = PTR_ERR(filename);
351 if (IS_ERR(filename))
352 return error;
353 error = do_execve(filename, argv, envp, regs);
354 putname(filename);
355 return error;
356}
357
358unsigned long get_wchan(struct task_struct *p)
359{
360 unsigned long fp, pc;
361 unsigned long stack_page;
362 int count = 0;
363 if (!p || p == current || p->state == TASK_RUNNING)
364 return 0;
365
366 stack_page = (unsigned long)task_stack_page(p);
367 fp = ((struct switch_stack *)p->thread.ksp)->a6;
368 do {
369 if (fp < stack_page+sizeof(struct thread_info) ||
370 fp >= 8184+stack_page)
371 return 0;
372 pc = ((unsigned long *)fp)[1];
373 if (!in_sched_functions(pc))
374 return pc;
375 fp = *(unsigned long *) fp;
376 } while (count++ < 16);
377 return 0;
378}
diff --git a/arch/m68k/kernel/process_mm.c b/arch/m68k/kernel/process_mm.c
deleted file mode 100644
index fe4186b5fc3..00000000000
--- a/arch/m68k/kernel/process_mm.c
+++ /dev/null
@@ -1,367 +0,0 @@
1/*
2 * linux/arch/m68k/kernel/process.c
3 *
4 * Copyright (C) 1995 Hamish Macdonald
5 *
6 * 68060 fixes by Jesper Skov
7 */
8
9/*
10 * This file handles the architecture-dependent parts of process handling..
11 */
12
13#include <linux/errno.h>
14#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/mm.h>
18#include <linux/slab.h>
19#include <linux/fs.h>
20#include <linux/smp.h>
21#include <linux/stddef.h>
22#include <linux/unistd.h>
23#include <linux/ptrace.h>
24#include <linux/user.h>
25#include <linux/reboot.h>
26#include <linux/init_task.h>
27#include <linux/mqueue.h>
28
29#include <asm/uaccess.h>
30#include <asm/system.h>
31#include <asm/traps.h>
32#include <asm/machdep.h>
33#include <asm/setup.h>
34#include <asm/pgtable.h>
35
36
37asmlinkage void ret_from_fork(void);
38
39
40/*
41 * Return saved PC from a blocked thread
42 */
43unsigned long thread_saved_pc(struct task_struct *tsk)
44{
45 struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp;
46 /* Check whether the thread is blocked in resume() */
47 if (in_sched_functions(sw->retpc))
48 return ((unsigned long *)sw->a6)[1];
49 else
50 return sw->retpc;
51}
52
53/*
54 * The idle loop on an m68k..
55 */
56static void default_idle(void)
57{
58 if (!need_resched())
59#if defined(MACH_ATARI_ONLY)
60 /* block out HSYNC on the atari (falcon) */
61 __asm__("stop #0x2200" : : : "cc");
62#else
63 __asm__("stop #0x2000" : : : "cc");
64#endif
65}
66
67void (*idle)(void) = default_idle;
68
69/*
70 * The idle thread. There's no useful work to be
71 * done, so just try to conserve power and have a
72 * low exit latency (ie sit in a loop waiting for
73 * somebody to say that they'd like to reschedule)
74 */
75void cpu_idle(void)
76{
77 /* endless idle loop with no priority at all */
78 while (1) {
79 while (!need_resched())
80 idle();
81 schedule_preempt_disabled();
82 }
83}
84
85void machine_restart(char * __unused)
86{
87 if (mach_reset)
88 mach_reset();
89 for (;;);
90}
91
92void machine_halt(void)
93{
94 if (mach_halt)
95 mach_halt();
96 for (;;);
97}
98
99void machine_power_off(void)
100{
101 if (mach_power_off)
102 mach_power_off();
103 for (;;);
104}
105
106void (*pm_power_off)(void) = machine_power_off;
107EXPORT_SYMBOL(pm_power_off);
108
109void show_regs(struct pt_regs * regs)
110{
111 printk("\n");
112 printk("Format %02x Vector: %04x PC: %08lx Status: %04x %s\n",
113 regs->format, regs->vector, regs->pc, regs->sr, print_tainted());
114 printk("ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n",
115 regs->orig_d0, regs->d0, regs->a2, regs->a1);
116 printk("A0: %08lx D5: %08lx D4: %08lx\n",
117 regs->a0, regs->d5, regs->d4);
118 printk("D3: %08lx D2: %08lx D1: %08lx\n",
119 regs->d3, regs->d2, regs->d1);
120 if (!(regs->sr & PS_S))
121 printk("USP: %08lx\n", rdusp());
122}
123
124/*
125 * Create a kernel thread
126 */
127int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
128{
129 int pid;
130 mm_segment_t fs;
131
132 fs = get_fs();
133 set_fs (KERNEL_DS);
134
135 {
136 register long retval __asm__ ("d0");
137 register long clone_arg __asm__ ("d1") = flags | CLONE_VM | CLONE_UNTRACED;
138
139 retval = __NR_clone;
140 __asm__ __volatile__
141 ("clrl %%d2\n\t"
142 "trap #0\n\t" /* Linux/m68k system call */
143 "tstl %0\n\t" /* child or parent */
144 "jne 1f\n\t" /* parent - jump */
145 "lea %%sp@(%c7),%6\n\t" /* reload current */
146 "movel %6@,%6\n\t"
147 "movel %3,%%sp@-\n\t" /* push argument */
148 "jsr %4@\n\t" /* call fn */
149 "movel %0,%%d1\n\t" /* pass exit value */
150 "movel %2,%%d0\n\t" /* exit */
151 "trap #0\n"
152 "1:"
153 : "+d" (retval)
154 : "i" (__NR_clone), "i" (__NR_exit),
155 "r" (arg), "a" (fn), "d" (clone_arg), "r" (current),
156 "i" (-THREAD_SIZE)
157 : "d2");
158
159 pid = retval;
160 }
161
162 set_fs (fs);
163 return pid;
164}
165EXPORT_SYMBOL(kernel_thread);
166
167void flush_thread(void)
168{
169 unsigned long zero = 0;
170
171 current->thread.fs = __USER_DS;
172 if (!FPU_IS_EMU)
173 asm volatile("frestore %0": :"m" (zero));
174}
175
176/*
177 * "m68k_fork()".. By the time we get here, the
178 * non-volatile registers have also been saved on the
179 * stack. We do some ugly pointer stuff here.. (see
180 * also copy_thread)
181 */
182
183asmlinkage int m68k_fork(struct pt_regs *regs)
184{
185 return do_fork(SIGCHLD, rdusp(), regs, 0, NULL, NULL);
186}
187
188asmlinkage int m68k_vfork(struct pt_regs *regs)
189{
190 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0,
191 NULL, NULL);
192}
193
194asmlinkage int m68k_clone(struct pt_regs *regs)
195{
196 unsigned long clone_flags;
197 unsigned long newsp;
198 int __user *parent_tidptr, *child_tidptr;
199
200 /* syscall2 puts clone_flags in d1 and usp in d2 */
201 clone_flags = regs->d1;
202 newsp = regs->d2;
203 parent_tidptr = (int __user *)regs->d3;
204 child_tidptr = (int __user *)regs->d4;
205 if (!newsp)
206 newsp = rdusp();
207 return do_fork(clone_flags, newsp, regs, 0,
208 parent_tidptr, child_tidptr);
209}
210
211int copy_thread(unsigned long clone_flags, unsigned long usp,
212 unsigned long unused,
213 struct task_struct * p, struct pt_regs * regs)
214{
215 struct pt_regs * childregs;
216 struct switch_stack * childstack, *stack;
217 unsigned long *retp;
218
219 childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1;
220
221 *childregs = *regs;
222 childregs->d0 = 0;
223
224 retp = ((unsigned long *) regs);
225 stack = ((struct switch_stack *) retp) - 1;
226
227 childstack = ((struct switch_stack *) childregs) - 1;
228 *childstack = *stack;
229 childstack->retpc = (unsigned long)ret_from_fork;
230
231 p->thread.usp = usp;
232 p->thread.ksp = (unsigned long)childstack;
233
234 if (clone_flags & CLONE_SETTLS)
235 task_thread_info(p)->tp_value = regs->d5;
236
237 /*
238 * Must save the current SFC/DFC value, NOT the value when
239 * the parent was last descheduled - RGH 10-08-96
240 */
241 p->thread.fs = get_fs().seg;
242
243 if (!FPU_IS_EMU) {
244 /* Copy the current fpu state */
245 asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory");
246
247 if (!CPU_IS_060 ? p->thread.fpstate[0] : p->thread.fpstate[2]) {
248 if (CPU_IS_COLDFIRE) {
249 asm volatile ("fmovemd %/fp0-%/fp7,%0\n\t"
250 "fmovel %/fpiar,%1\n\t"
251 "fmovel %/fpcr,%2\n\t"
252 "fmovel %/fpsr,%3"
253 :
254 : "m" (p->thread.fp[0]),
255 "m" (p->thread.fpcntl[0]),
256 "m" (p->thread.fpcntl[1]),
257 "m" (p->thread.fpcntl[2])
258 : "memory");
259 } else {
260 asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t"
261 "fmoveml %/fpiar/%/fpcr/%/fpsr,%1"
262 :
263 : "m" (p->thread.fp[0]),
264 "m" (p->thread.fpcntl[0])
265 : "memory");
266 }
267 }
268
269 /* Restore the state in case the fpu was busy */
270 asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0]));
271 }
272
273 return 0;
274}
275
276/* Fill in the fpu structure for a core dump. */
277
278int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
279{
280 char fpustate[216];
281
282 if (FPU_IS_EMU) {
283 int i;
284
285 memcpy(fpu->fpcntl, current->thread.fpcntl, 12);
286 memcpy(fpu->fpregs, current->thread.fp, 96);
287 /* Convert internal fpu reg representation
288 * into long double format
289 */
290 for (i = 0; i < 24; i += 3)
291 fpu->fpregs[i] = ((fpu->fpregs[i] & 0xffff0000) << 15) |
292 ((fpu->fpregs[i] & 0x0000ffff) << 16);
293 return 1;
294 }
295
296 /* First dump the fpu context to avoid protocol violation. */
297 asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
298 if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
299 return 0;
300
301 if (CPU_IS_COLDFIRE) {
302 asm volatile ("fmovel %/fpiar,%0\n\t"
303 "fmovel %/fpcr,%1\n\t"
304 "fmovel %/fpsr,%2\n\t"
305 "fmovemd %/fp0-%/fp7,%3"
306 :
307 : "m" (fpu->fpcntl[0]),
308 "m" (fpu->fpcntl[1]),
309 "m" (fpu->fpcntl[2]),
310 "m" (fpu->fpregs[0])
311 : "memory");
312 } else {
313 asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0"
314 :
315 : "m" (fpu->fpcntl[0])
316 : "memory");
317 asm volatile ("fmovemx %/fp0-%/fp7,%0"
318 :
319 : "m" (fpu->fpregs[0])
320 : "memory");
321 }
322
323 return 1;
324}
325EXPORT_SYMBOL(dump_fpu);
326
327/*
328 * sys_execve() executes a new program.
329 */
330asmlinkage int sys_execve(const char __user *name,
331 const char __user *const __user *argv,
332 const char __user *const __user *envp)
333{
334 int error;
335 char * filename;
336 struct pt_regs *regs = (struct pt_regs *) &name;
337
338 filename = getname(name);
339 error = PTR_ERR(filename);
340 if (IS_ERR(filename))
341 return error;
342 error = do_execve(filename, argv, envp, regs);
343 putname(filename);
344 return error;
345}
346
347unsigned long get_wchan(struct task_struct *p)
348{
349 unsigned long fp, pc;
350 unsigned long stack_page;
351 int count = 0;
352 if (!p || p == current || p->state == TASK_RUNNING)
353 return 0;
354
355 stack_page = (unsigned long)task_stack_page(p);
356 fp = ((struct switch_stack *)p->thread.ksp)->a6;
357 do {
358 if (fp < stack_page+sizeof(struct thread_info) ||
359 fp >= 8184+stack_page)
360 return 0;
361 pc = ((unsigned long *)fp)[1];
362 if (!in_sched_functions(pc))
363 return pc;
364 fp = *(unsigned long *) fp;
365 } while (count++ < 16);
366 return 0;
367}
diff --git a/arch/m68k/kernel/process_no.c b/arch/m68k/kernel/process_no.c
deleted file mode 100644
index f7fe6c34859..00000000000
--- a/arch/m68k/kernel/process_no.c
+++ /dev/null
@@ -1,404 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/process.c
3 *
4 * Copyright (C) 1995 Hamish Macdonald
5 *
6 * 68060 fixes by Jesper Skov
7 *
8 * uClinux changes
9 * Copyright (C) 2000-2002, David McCullough <davidm@snapgear.com>
10 */
11
12/*
13 * This file handles the architecture-dependent parts of process handling..
14 */
15
16#include <linux/module.h>
17#include <linux/errno.h>
18#include <linux/sched.h>
19#include <linux/kernel.h>
20#include <linux/mm.h>
21#include <linux/smp.h>
22#include <linux/stddef.h>
23#include <linux/unistd.h>
24#include <linux/ptrace.h>
25#include <linux/user.h>
26#include <linux/interrupt.h>
27#include <linux/reboot.h>
28#include <linux/fs.h>
29#include <linux/slab.h>
30
31#include <asm/uaccess.h>
32#include <asm/system.h>
33#include <asm/traps.h>
34#include <asm/machdep.h>
35#include <asm/setup.h>
36#include <asm/pgtable.h>
37
38asmlinkage void ret_from_fork(void);
39
40/*
41 * The following aren't currently used.
42 */
43void (*pm_idle)(void);
44EXPORT_SYMBOL(pm_idle);
45
46void (*pm_power_off)(void);
47EXPORT_SYMBOL(pm_power_off);
48
49/*
50 * The idle loop on an m68knommu..
51 */
52static void default_idle(void)
53{
54 local_irq_disable();
55 while (!need_resched()) {
56 /* This stop will re-enable interrupts */
57 __asm__("stop #0x2000" : : : "cc");
58 local_irq_disable();
59 }
60 local_irq_enable();
61}
62
63void (*idle)(void) = default_idle;
64
65/*
66 * The idle thread. There's no useful work to be
67 * done, so just try to conserve power and have a
68 * low exit latency (ie sit in a loop waiting for
69 * somebody to say that they'd like to reschedule)
70 */
71void cpu_idle(void)
72{
73 /* endless idle loop with no priority at all */
74 while (1) {
75 idle();
76 schedule_preempt_disabled();
77 }
78}
79
80void machine_restart(char * __unused)
81{
82 if (mach_reset)
83 mach_reset();
84 for (;;);
85}
86
87void machine_halt(void)
88{
89 if (mach_halt)
90 mach_halt();
91 for (;;);
92}
93
94void machine_power_off(void)
95{
96 if (mach_power_off)
97 mach_power_off();
98 for (;;);
99}
100
101void show_regs(struct pt_regs * regs)
102{
103 printk(KERN_NOTICE "\n");
104 printk(KERN_NOTICE "Format %02x Vector: %04x PC: %08lx Status: %04x %s\n",
105 regs->format, regs->vector, regs->pc, regs->sr, print_tainted());
106 printk(KERN_NOTICE "ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n",
107 regs->orig_d0, regs->d0, regs->a2, regs->a1);
108 printk(KERN_NOTICE "A0: %08lx D5: %08lx D4: %08lx\n",
109 regs->a0, regs->d5, regs->d4);
110 printk(KERN_NOTICE "D3: %08lx D2: %08lx D1: %08lx\n",
111 regs->d3, regs->d2, regs->d1);
112 if (!(regs->sr & PS_S))
113 printk(KERN_NOTICE "USP: %08lx\n", rdusp());
114}
115
116/*
117 * Create a kernel thread
118 */
119int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
120{
121 int retval;
122 long clone_arg = flags | CLONE_VM;
123 mm_segment_t fs;
124
125 fs = get_fs();
126 set_fs(KERNEL_DS);
127
128 __asm__ __volatile__ (
129 "movel %%sp, %%d2\n\t"
130 "movel %5, %%d1\n\t"
131 "movel %1, %%d0\n\t"
132 "trap #0\n\t"
133 "cmpl %%sp, %%d2\n\t"
134 "jeq 1f\n\t"
135 "movel %3, %%sp@-\n\t"
136 "jsr %4@\n\t"
137 "movel %2, %%d0\n\t"
138 "trap #0\n"
139 "1:\n\t"
140 "movel %%d0, %0\n"
141 : "=d" (retval)
142 : "i" (__NR_clone),
143 "i" (__NR_exit),
144 "a" (arg),
145 "a" (fn),
146 "a" (clone_arg)
147 : "cc", "%d0", "%d1", "%d2");
148
149 set_fs(fs);
150 return retval;
151}
152EXPORT_SYMBOL(kernel_thread);
153
154void flush_thread(void)
155{
156#ifdef CONFIG_FPU
157 unsigned long zero = 0;
158#endif
159
160 current->thread.fs = __USER_DS;
161#ifdef CONFIG_FPU
162 if (!FPU_IS_EMU)
163 asm volatile (".chip 68k/68881\n\t"
164 "frestore %0\n\t"
165 ".chip 68k" : : "m" (zero));
166#endif
167}
168
169/*
170 * "m68k_fork()".. By the time we get here, the
171 * non-volatile registers have also been saved on the
172 * stack. We do some ugly pointer stuff here.. (see
173 * also copy_thread)
174 */
175
176asmlinkage int m68k_fork(struct pt_regs *regs)
177{
178 /* fork almost works, enough to trick you into looking elsewhere :-( */
179 return(-EINVAL);
180}
181
182asmlinkage int m68k_vfork(struct pt_regs *regs)
183{
184 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL, NULL);
185}
186
187asmlinkage int m68k_clone(struct pt_regs *regs)
188{
189 unsigned long clone_flags;
190 unsigned long newsp;
191
192 /* syscall2 puts clone_flags in d1 and usp in d2 */
193 clone_flags = regs->d1;
194 newsp = regs->d2;
195 if (!newsp)
196 newsp = rdusp();
197 return do_fork(clone_flags, newsp, regs, 0, NULL, NULL);
198}
199
200int copy_thread(unsigned long clone_flags,
201 unsigned long usp, unsigned long topstk,
202 struct task_struct * p, struct pt_regs * regs)
203{
204 struct pt_regs * childregs;
205 struct switch_stack * childstack, *stack;
206 unsigned long *retp;
207
208 childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1;
209
210 *childregs = *regs;
211 childregs->d0 = 0;
212
213 retp = ((unsigned long *) regs);
214 stack = ((struct switch_stack *) retp) - 1;
215
216 childstack = ((struct switch_stack *) childregs) - 1;
217 *childstack = *stack;
218 childstack->retpc = (unsigned long)ret_from_fork;
219
220 p->thread.usp = usp;
221 p->thread.ksp = (unsigned long)childstack;
222
223 if (clone_flags & CLONE_SETTLS)
224 task_thread_info(p)->tp_value = regs->d5;
225
226 /*
227 * Must save the current SFC/DFC value, NOT the value when
228 * the parent was last descheduled - RGH 10-08-96
229 */
230 p->thread.fs = get_fs().seg;
231
232#ifdef CONFIG_FPU
233 if (!FPU_IS_EMU) {
234 /* Copy the current fpu state */
235 asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory");
236
237 if (p->thread.fpstate[0])
238 asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t"
239 "fmoveml %/fpiar/%/fpcr/%/fpsr,%1"
240 : : "m" (p->thread.fp[0]), "m" (p->thread.fpcntl[0])
241 : "memory");
242 /* Restore the state in case the fpu was busy */
243 asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0]));
244 }
245#endif
246
247 return 0;
248}
249
250/* Fill in the fpu structure for a core dump. */
251
252int dump_fpu(struct pt_regs *regs, struct user_m68kfp_struct *fpu)
253{
254#ifdef CONFIG_FPU
255 char fpustate[216];
256
257 if (FPU_IS_EMU) {
258 int i;
259
260 memcpy(fpu->fpcntl, current->thread.fpcntl, 12);
261 memcpy(fpu->fpregs, current->thread.fp, 96);
262 /* Convert internal fpu reg representation
263 * into long double format
264 */
265 for (i = 0; i < 24; i += 3)
266 fpu->fpregs[i] = ((fpu->fpregs[i] & 0xffff0000) << 15) |
267 ((fpu->fpregs[i] & 0x0000ffff) << 16);
268 return 1;
269 }
270
271 /* First dump the fpu context to avoid protocol violation. */
272 asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
273 if (!fpustate[0])
274 return 0;
275
276 asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0"
277 :: "m" (fpu->fpcntl[0])
278 : "memory");
279 asm volatile ("fmovemx %/fp0-%/fp7,%0"
280 :: "m" (fpu->fpregs[0])
281 : "memory");
282#endif
283 return 1;
284}
285EXPORT_SYMBOL(dump_fpu);
286
287/*
288 * Generic dumping code. Used for panic and debug.
289 */
290void dump(struct pt_regs *fp)
291{
292 unsigned long *sp;
293 unsigned char *tp;
294 int i;
295
296 printk(KERN_EMERG "\nCURRENT PROCESS:\n\n");
297 printk(KERN_EMERG "COMM=%s PID=%d\n", current->comm, current->pid);
298
299 if (current->mm) {
300 printk(KERN_EMERG "TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
301 (int) current->mm->start_code,
302 (int) current->mm->end_code,
303 (int) current->mm->start_data,
304 (int) current->mm->end_data,
305 (int) current->mm->end_data,
306 (int) current->mm->brk);
307 printk(KERN_EMERG "USER-STACK=%08x KERNEL-STACK=%08x\n\n",
308 (int) current->mm->start_stack,
309 (int)(((unsigned long) current) + THREAD_SIZE));
310 }
311
312 printk(KERN_EMERG "PC: %08lx\n", fp->pc);
313 printk(KERN_EMERG "SR: %08lx SP: %08lx\n", (long) fp->sr, (long) fp);
314 printk(KERN_EMERG "d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
315 fp->d0, fp->d1, fp->d2, fp->d3);
316 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
317 fp->d4, fp->d5, fp->a0, fp->a1);
318 printk(KERN_EMERG "\nUSP: %08x TRAPFRAME: %p\n",
319 (unsigned int) rdusp(), fp);
320
321 printk(KERN_EMERG "\nCODE:");
322 tp = ((unsigned char *) fp->pc) - 0x20;
323 for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) {
324 if ((i % 0x10) == 0)
325 printk(KERN_EMERG "%p: ", tp + i);
326 printk("%08x ", (int) *sp++);
327 }
328 printk(KERN_EMERG "\n");
329
330 printk(KERN_EMERG "KERNEL STACK:");
331 tp = ((unsigned char *) fp) - 0x40;
332 for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) {
333 if ((i % 0x10) == 0)
334 printk(KERN_EMERG "%p: ", tp + i);
335 printk("%08x ", (int) *sp++);
336 }
337 printk(KERN_EMERG "\n");
338
339 printk(KERN_EMERG "USER STACK:");
340 tp = (unsigned char *) (rdusp() - 0x10);
341 for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) {
342 if ((i % 0x10) == 0)
343 printk(KERN_EMERG "%p: ", tp + i);
344 printk("%08x ", (int) *sp++);
345 }
346 printk(KERN_EMERG "\n");
347}
348
349/*
350 * sys_execve() executes a new program.
351 */
352asmlinkage int sys_execve(const char *name,
353 const char *const *argv,
354 const char *const *envp)
355{
356 int error;
357 char * filename;
358 struct pt_regs *regs = (struct pt_regs *) &name;
359
360 filename = getname(name);
361 error = PTR_ERR(filename);
362 if (IS_ERR(filename))
363 return error;
364 error = do_execve(filename, argv, envp, regs);
365 putname(filename);
366 return error;
367}
368
369unsigned long get_wchan(struct task_struct *p)
370{
371 unsigned long fp, pc;
372 unsigned long stack_page;
373 int count = 0;
374 if (!p || p == current || p->state == TASK_RUNNING)
375 return 0;
376
377 stack_page = (unsigned long)p;
378 fp = ((struct switch_stack *)p->thread.ksp)->a6;
379 do {
380 if (fp < stack_page+sizeof(struct thread_info) ||
381 fp >= THREAD_SIZE-8+stack_page)
382 return 0;
383 pc = ((unsigned long *)fp)[1];
384 if (!in_sched_functions(pc))
385 return pc;
386 fp = *(unsigned long *) fp;
387 } while (count++ < 16);
388 return 0;
389}
390
391/*
392 * Return saved PC of a blocked thread.
393 */
394unsigned long thread_saved_pc(struct task_struct *tsk)
395{
396 struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp;
397
398 /* Check whether the thread is blocked in resume() */
399 if (in_sched_functions(sw->retpc))
400 return ((unsigned long *)sw->a6)[1];
401 else
402 return sw->retpc;
403}
404
diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c
index 07a417550e9..149a05f8b9e 100644
--- a/arch/m68k/kernel/ptrace.c
+++ b/arch/m68k/kernel/ptrace.c
@@ -1,5 +1,305 @@
1/*
2 * linux/arch/m68k/kernel/ptrace.c
3 *
4 * Copyright (C) 1994 by Hamish Macdonald
5 * Taken from linux/kernel/ptrace.c and modified for M680x0.
6 * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds
7 *
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of
10 * this archive for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/mm.h>
16#include <linux/smp.h>
17#include <linux/errno.h>
18#include <linux/ptrace.h>
19#include <linux/user.h>
20#include <linux/signal.h>
21#include <linux/tracehook.h>
22
23#include <asm/uaccess.h>
24#include <asm/page.h>
25#include <asm/pgtable.h>
26#include <asm/system.h>
27#include <asm/processor.h>
28
29/*
30 * does not yet catch signals sent when the child dies.
31 * in exit.c or in signal.c.
32 */
33
34/* determines which bits in the SR the user has access to. */
35/* 1 = access 0 = no access */
36#define SR_MASK 0x001f
37
38/* sets the trace bits. */
39#define TRACE_BITS 0xC000
40#define T1_BIT 0x8000
41#define T0_BIT 0x4000
42
43/* Find the stack offset for a register, relative to thread.esp0. */
44#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg)
45#define SW_REG(reg) ((long)&((struct switch_stack *)0)->reg \
46 - sizeof(struct switch_stack))
47/* Mapping from PT_xxx to the stack offset at which the register is
48 saved. Notice that usp has no stack-slot and needs to be treated
49 specially (see get_reg/put_reg below). */
50static const int regoff[] = {
51 [0] = PT_REG(d1),
52 [1] = PT_REG(d2),
53 [2] = PT_REG(d3),
54 [3] = PT_REG(d4),
55 [4] = PT_REG(d5),
56 [5] = SW_REG(d6),
57 [6] = SW_REG(d7),
58 [7] = PT_REG(a0),
59 [8] = PT_REG(a1),
60 [9] = PT_REG(a2),
61 [10] = SW_REG(a3),
62 [11] = SW_REG(a4),
63 [12] = SW_REG(a5),
64 [13] = SW_REG(a6),
65 [14] = PT_REG(d0),
66 [15] = -1,
67 [16] = PT_REG(orig_d0),
68 [17] = PT_REG(sr),
69 [18] = PT_REG(pc),
70};
71
72/*
73 * Get contents of register REGNO in task TASK.
74 */
75static inline long get_reg(struct task_struct *task, int regno)
76{
77 unsigned long *addr;
78
79 if (regno == PT_USP)
80 addr = &task->thread.usp;
81 else if (regno < ARRAY_SIZE(regoff))
82 addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
83 else
84 return 0;
85 /* Need to take stkadj into account. */
86 if (regno == PT_SR || regno == PT_PC) {
87 long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj));
88 addr = (unsigned long *) ((unsigned long)addr + stkadj);
89 /* The sr is actually a 16 bit register. */
90 if (regno == PT_SR)
91 return *(unsigned short *)addr;
92 }
93 return *addr;
94}
95
96/*
97 * Write contents of register REGNO in task TASK.
98 */
99static inline int put_reg(struct task_struct *task, int regno,
100 unsigned long data)
101{
102 unsigned long *addr;
103
104 if (regno == PT_USP)
105 addr = &task->thread.usp;
106 else if (regno < ARRAY_SIZE(regoff))
107 addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
108 else
109 return -1;
110 /* Need to take stkadj into account. */
111 if (regno == PT_SR || regno == PT_PC) {
112 long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj));
113 addr = (unsigned long *) ((unsigned long)addr + stkadj);
114 /* The sr is actually a 16 bit register. */
115 if (regno == PT_SR) {
116 *(unsigned short *)addr = data;
117 return 0;
118 }
119 }
120 *addr = data;
121 return 0;
122}
123
124/*
125 * Make sure the single step bit is not set.
126 */
127static inline void singlestep_disable(struct task_struct *child)
128{
129 unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS;
130 put_reg(child, PT_SR, tmp);
131 clear_tsk_thread_flag(child, TIF_DELAYED_TRACE);
132}
133
134/*
135 * Called by kernel/ptrace.c when detaching..
136 */
137void ptrace_disable(struct task_struct *child)
138{
139 singlestep_disable(child);
140}
141
142void user_enable_single_step(struct task_struct *child)
143{
144 unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS;
145 put_reg(child, PT_SR, tmp | T1_BIT);
146 set_tsk_thread_flag(child, TIF_DELAYED_TRACE);
147}
148
1#ifdef CONFIG_MMU 149#ifdef CONFIG_MMU
2#include "ptrace_mm.c" 150void user_enable_block_step(struct task_struct *child)
3#else 151{
4#include "ptrace_no.c" 152 unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS;
153 put_reg(child, PT_SR, tmp | T0_BIT);
154}
5#endif 155#endif
156
157void user_disable_single_step(struct task_struct *child)
158{
159 singlestep_disable(child);
160}
161
162long arch_ptrace(struct task_struct *child, long request,
163 unsigned long addr, unsigned long data)
164{
165 unsigned long tmp;
166 int i, ret = 0;
167 int regno = addr >> 2; /* temporary hack. */
168 unsigned long __user *datap = (unsigned long __user *) data;
169
170 switch (request) {
171 /* read the word at location addr in the USER area. */
172 case PTRACE_PEEKUSR:
173 if (addr & 3)
174 goto out_eio;
175
176 if (regno >= 0 && regno < 19) {
177 tmp = get_reg(child, regno);
178 } else if (regno >= 21 && regno < 49) {
179 tmp = child->thread.fp[regno - 21];
180 /* Convert internal fpu reg representation
181 * into long double format
182 */
183 if (FPU_IS_EMU && (regno < 45) && !(regno % 3))
184 tmp = ((tmp & 0xffff0000) << 15) |
185 ((tmp & 0x0000ffff) << 16);
186#ifndef CONFIG_MMU
187 } else if (regno == 49) {
188 tmp = child->mm->start_code;
189 } else if (regno == 50) {
190 tmp = child->mm->start_data;
191 } else if (regno == 51) {
192 tmp = child->mm->end_code;
193#endif
194 } else
195 goto out_eio;
196 ret = put_user(tmp, datap);
197 break;
198
199 case PTRACE_POKEUSR:
200 /* write the word at location addr in the USER area */
201 if (addr & 3)
202 goto out_eio;
203
204 if (regno == PT_SR) {
205 data &= SR_MASK;
206 data |= get_reg(child, PT_SR) & ~SR_MASK;
207 }
208 if (regno >= 0 && regno < 19) {
209 if (put_reg(child, regno, data))
210 goto out_eio;
211 } else if (regno >= 21 && regno < 48) {
212 /* Convert long double format
213 * into internal fpu reg representation
214 */
215 if (FPU_IS_EMU && (regno < 45) && !(regno % 3)) {
216 data <<= 15;
217 data = (data & 0xffff0000) |
218 ((data & 0x0000ffff) >> 1);
219 }
220 child->thread.fp[regno - 21] = data;
221 } else
222 goto out_eio;
223 break;
224
225 case PTRACE_GETREGS: /* Get all gp regs from the child. */
226 for (i = 0; i < 19; i++) {
227 tmp = get_reg(child, i);
228 ret = put_user(tmp, datap);
229 if (ret)
230 break;
231 datap++;
232 }
233 break;
234
235 case PTRACE_SETREGS: /* Set all gp regs in the child. */
236 for (i = 0; i < 19; i++) {
237 ret = get_user(tmp, datap);
238 if (ret)
239 break;
240 if (i == PT_SR) {
241 tmp &= SR_MASK;
242 tmp |= get_reg(child, PT_SR) & ~SR_MASK;
243 }
244 put_reg(child, i, tmp);
245 datap++;
246 }
247 break;
248
249 case PTRACE_GETFPREGS: /* Get the child FPU state. */
250 if (copy_to_user(datap, &child->thread.fp,
251 sizeof(struct user_m68kfp_struct)))
252 ret = -EFAULT;
253 break;
254
255 case PTRACE_SETFPREGS: /* Set the child FPU state. */
256 if (copy_from_user(&child->thread.fp, datap,
257 sizeof(struct user_m68kfp_struct)))
258 ret = -EFAULT;
259 break;
260
261 case PTRACE_GET_THREAD_AREA:
262 ret = put_user(task_thread_info(child)->tp_value, datap);
263 break;
264
265 default:
266 ret = ptrace_request(child, request, addr, data);
267 break;
268 }
269
270 return ret;
271out_eio:
272 return -EIO;
273}
274
275asmlinkage void syscall_trace(void)
276{
277 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
278 ? 0x80 : 0));
279 /*
280 * this isn't the same as continuing with a signal, but it will do
281 * for normal use. strace only continues with a signal if the
282 * stopping signal is not SIGTRAP. -brl
283 */
284 if (current->exit_code) {
285 send_sig(current->exit_code, current, 1);
286 current->exit_code = 0;
287 }
288}
289
290#ifdef CONFIG_COLDFIRE
291asmlinkage int syscall_trace_enter(void)
292{
293 int ret = 0;
294
295 if (test_thread_flag(TIF_SYSCALL_TRACE))
296 ret = tracehook_report_syscall_entry(task_pt_regs(current));
297 return ret;
298}
299
300asmlinkage void syscall_trace_leave(void)
301{
302 if (test_thread_flag(TIF_SYSCALL_TRACE))
303 tracehook_report_syscall_exit(task_pt_regs(current), 0);
304}
305#endif /* CONFIG_COLDFIRE */
diff --git a/arch/m68k/kernel/ptrace_mm.c b/arch/m68k/kernel/ptrace_mm.c
deleted file mode 100644
index 7bc999b7352..00000000000
--- a/arch/m68k/kernel/ptrace_mm.c
+++ /dev/null
@@ -1,295 +0,0 @@
1/*
2 * linux/arch/m68k/kernel/ptrace.c
3 *
4 * Copyright (C) 1994 by Hamish Macdonald
5 * Taken from linux/kernel/ptrace.c and modified for M680x0.
6 * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds
7 *
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of
10 * this archive for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/mm.h>
16#include <linux/smp.h>
17#include <linux/errno.h>
18#include <linux/ptrace.h>
19#include <linux/user.h>
20#include <linux/signal.h>
21#include <linux/tracehook.h>
22
23#include <asm/uaccess.h>
24#include <asm/page.h>
25#include <asm/pgtable.h>
26#include <asm/system.h>
27#include <asm/processor.h>
28
29/*
30 * does not yet catch signals sent when the child dies.
31 * in exit.c or in signal.c.
32 */
33
34/* determines which bits in the SR the user has access to. */
35/* 1 = access 0 = no access */
36#define SR_MASK 0x001f
37
38/* sets the trace bits. */
39#define TRACE_BITS 0xC000
40#define T1_BIT 0x8000
41#define T0_BIT 0x4000
42
43/* Find the stack offset for a register, relative to thread.esp0. */
44#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg)
45#define SW_REG(reg) ((long)&((struct switch_stack *)0)->reg \
46 - sizeof(struct switch_stack))
47/* Mapping from PT_xxx to the stack offset at which the register is
48 saved. Notice that usp has no stack-slot and needs to be treated
49 specially (see get_reg/put_reg below). */
50static const int regoff[] = {
51 [0] = PT_REG(d1),
52 [1] = PT_REG(d2),
53 [2] = PT_REG(d3),
54 [3] = PT_REG(d4),
55 [4] = PT_REG(d5),
56 [5] = SW_REG(d6),
57 [6] = SW_REG(d7),
58 [7] = PT_REG(a0),
59 [8] = PT_REG(a1),
60 [9] = PT_REG(a2),
61 [10] = SW_REG(a3),
62 [11] = SW_REG(a4),
63 [12] = SW_REG(a5),
64 [13] = SW_REG(a6),
65 [14] = PT_REG(d0),
66 [15] = -1,
67 [16] = PT_REG(orig_d0),
68 [17] = PT_REG(sr),
69 [18] = PT_REG(pc),
70};
71
72/*
73 * Get contents of register REGNO in task TASK.
74 */
75static inline long get_reg(struct task_struct *task, int regno)
76{
77 unsigned long *addr;
78
79 if (regno == PT_USP)
80 addr = &task->thread.usp;
81 else if (regno < ARRAY_SIZE(regoff))
82 addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
83 else
84 return 0;
85 /* Need to take stkadj into account. */
86 if (regno == PT_SR || regno == PT_PC) {
87 long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj));
88 addr = (unsigned long *) ((unsigned long)addr + stkadj);
89 /* The sr is actually a 16 bit register. */
90 if (regno == PT_SR)
91 return *(unsigned short *)addr;
92 }
93 return *addr;
94}
95
96/*
97 * Write contents of register REGNO in task TASK.
98 */
99static inline int put_reg(struct task_struct *task, int regno,
100 unsigned long data)
101{
102 unsigned long *addr;
103
104 if (regno == PT_USP)
105 addr = &task->thread.usp;
106 else if (regno < ARRAY_SIZE(regoff))
107 addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
108 else
109 return -1;
110 /* Need to take stkadj into account. */
111 if (regno == PT_SR || regno == PT_PC) {
112 long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj));
113 addr = (unsigned long *) ((unsigned long)addr + stkadj);
114 /* The sr is actually a 16 bit register. */
115 if (regno == PT_SR) {
116 *(unsigned short *)addr = data;
117 return 0;
118 }
119 }
120 *addr = data;
121 return 0;
122}
123
124/*
125 * Make sure the single step bit is not set.
126 */
127static inline void singlestep_disable(struct task_struct *child)
128{
129 unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS;
130 put_reg(child, PT_SR, tmp);
131 clear_tsk_thread_flag(child, TIF_DELAYED_TRACE);
132}
133
134/*
135 * Called by kernel/ptrace.c when detaching..
136 */
137void ptrace_disable(struct task_struct *child)
138{
139 singlestep_disable(child);
140}
141
142void user_enable_single_step(struct task_struct *child)
143{
144 unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS;
145 put_reg(child, PT_SR, tmp | T1_BIT);
146 set_tsk_thread_flag(child, TIF_DELAYED_TRACE);
147}
148
149void user_enable_block_step(struct task_struct *child)
150{
151 unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS;
152 put_reg(child, PT_SR, tmp | T0_BIT);
153}
154
155void user_disable_single_step(struct task_struct *child)
156{
157 singlestep_disable(child);
158}
159
160long arch_ptrace(struct task_struct *child, long request,
161 unsigned long addr, unsigned long data)
162{
163 unsigned long tmp;
164 int i, ret = 0;
165 int regno = addr >> 2; /* temporary hack. */
166 unsigned long __user *datap = (unsigned long __user *) data;
167
168 switch (request) {
169 /* read the word at location addr in the USER area. */
170 case PTRACE_PEEKUSR:
171 if (addr & 3)
172 goto out_eio;
173
174 if (regno >= 0 && regno < 19) {
175 tmp = get_reg(child, regno);
176 } else if (regno >= 21 && regno < 49) {
177 tmp = child->thread.fp[regno - 21];
178 /* Convert internal fpu reg representation
179 * into long double format
180 */
181 if (FPU_IS_EMU && (regno < 45) && !(regno % 3))
182 tmp = ((tmp & 0xffff0000) << 15) |
183 ((tmp & 0x0000ffff) << 16);
184 } else
185 goto out_eio;
186 ret = put_user(tmp, datap);
187 break;
188
189 case PTRACE_POKEUSR:
190 /* write the word at location addr in the USER area */
191 if (addr & 3)
192 goto out_eio;
193
194 if (regno == PT_SR) {
195 data &= SR_MASK;
196 data |= get_reg(child, PT_SR) & ~SR_MASK;
197 }
198 if (regno >= 0 && regno < 19) {
199 if (put_reg(child, regno, data))
200 goto out_eio;
201 } else if (regno >= 21 && regno < 48) {
202 /* Convert long double format
203 * into internal fpu reg representation
204 */
205 if (FPU_IS_EMU && (regno < 45) && !(regno % 3)) {
206 data <<= 15;
207 data = (data & 0xffff0000) |
208 ((data & 0x0000ffff) >> 1);
209 }
210 child->thread.fp[regno - 21] = data;
211 } else
212 goto out_eio;
213 break;
214
215 case PTRACE_GETREGS: /* Get all gp regs from the child. */
216 for (i = 0; i < 19; i++) {
217 tmp = get_reg(child, i);
218 ret = put_user(tmp, datap);
219 if (ret)
220 break;
221 datap++;
222 }
223 break;
224
225 case PTRACE_SETREGS: /* Set all gp regs in the child. */
226 for (i = 0; i < 19; i++) {
227 ret = get_user(tmp, datap);
228 if (ret)
229 break;
230 if (i == PT_SR) {
231 tmp &= SR_MASK;
232 tmp |= get_reg(child, PT_SR) & ~SR_MASK;
233 }
234 put_reg(child, i, tmp);
235 datap++;
236 }
237 break;
238
239 case PTRACE_GETFPREGS: /* Get the child FPU state. */
240 if (copy_to_user(datap, &child->thread.fp,
241 sizeof(struct user_m68kfp_struct)))
242 ret = -EFAULT;
243 break;
244
245 case PTRACE_SETFPREGS: /* Set the child FPU state. */
246 if (copy_from_user(&child->thread.fp, datap,
247 sizeof(struct user_m68kfp_struct)))
248 ret = -EFAULT;
249 break;
250
251 case PTRACE_GET_THREAD_AREA:
252 ret = put_user(task_thread_info(child)->tp_value, datap);
253 break;
254
255 default:
256 ret = ptrace_request(child, request, addr, data);
257 break;
258 }
259
260 return ret;
261out_eio:
262 return -EIO;
263}
264
265asmlinkage void syscall_trace(void)
266{
267 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
268 ? 0x80 : 0));
269 /*
270 * this isn't the same as continuing with a signal, but it will do
271 * for normal use. strace only continues with a signal if the
272 * stopping signal is not SIGTRAP. -brl
273 */
274 if (current->exit_code) {
275 send_sig(current->exit_code, current, 1);
276 current->exit_code = 0;
277 }
278}
279
280#ifdef CONFIG_COLDFIRE
281asmlinkage int syscall_trace_enter(void)
282{
283 int ret = 0;
284
285 if (test_thread_flag(TIF_SYSCALL_TRACE))
286 ret = tracehook_report_syscall_entry(task_pt_regs(current));
287 return ret;
288}
289
290asmlinkage void syscall_trace_leave(void)
291{
292 if (test_thread_flag(TIF_SYSCALL_TRACE))
293 tracehook_report_syscall_exit(task_pt_regs(current), 0);
294}
295#endif /* CONFIG_COLDFIRE */
diff --git a/arch/m68k/kernel/ptrace_no.c b/arch/m68k/kernel/ptrace_no.c
deleted file mode 100644
index 6709fb70733..00000000000
--- a/arch/m68k/kernel/ptrace_no.c
+++ /dev/null
@@ -1,255 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/ptrace.c
3 *
4 * Copyright (C) 1994 by Hamish Macdonald
5 * Taken from linux/kernel/ptrace.c and modified for M680x0.
6 * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds
7 *
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of
10 * this archive for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/mm.h>
16#include <linux/smp.h>
17#include <linux/errno.h>
18#include <linux/ptrace.h>
19#include <linux/user.h>
20#include <linux/signal.h>
21#include <linux/tracehook.h>
22
23#include <asm/uaccess.h>
24#include <asm/page.h>
25#include <asm/pgtable.h>
26#include <asm/system.h>
27#include <asm/processor.h>
28
29/*
30 * does not yet catch signals sent when the child dies.
31 * in exit.c or in signal.c.
32 */
33
34/* determines which bits in the SR the user has access to. */
35/* 1 = access 0 = no access */
36#define SR_MASK 0x001f
37
38/* sets the trace bits. */
39#define TRACE_BITS 0x8000
40
41/* Find the stack offset for a register, relative to thread.esp0. */
42#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg)
43#define SW_REG(reg) ((long)&((struct switch_stack *)0)->reg \
44 - sizeof(struct switch_stack))
45/* Mapping from PT_xxx to the stack offset at which the register is
46 saved. Notice that usp has no stack-slot and needs to be treated
47 specially (see get_reg/put_reg below). */
48static int regoff[] = {
49 PT_REG(d1), PT_REG(d2), PT_REG(d3), PT_REG(d4),
50 PT_REG(d5), SW_REG(d6), SW_REG(d7), PT_REG(a0),
51 PT_REG(a1), PT_REG(a2), SW_REG(a3), SW_REG(a4),
52 SW_REG(a5), SW_REG(a6), PT_REG(d0), -1,
53 PT_REG(orig_d0), PT_REG(sr), PT_REG(pc),
54};
55
56/*
57 * Get contents of register REGNO in task TASK.
58 */
59static inline long get_reg(struct task_struct *task, int regno)
60{
61 unsigned long *addr;
62
63 if (regno == PT_USP)
64 addr = &task->thread.usp;
65 else if (regno < ARRAY_SIZE(regoff))
66 addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
67 else
68 return 0;
69 return *addr;
70}
71
72/*
73 * Write contents of register REGNO in task TASK.
74 */
75static inline int put_reg(struct task_struct *task, int regno,
76 unsigned long data)
77{
78 unsigned long *addr;
79
80 if (regno == PT_USP)
81 addr = &task->thread.usp;
82 else if (regno < ARRAY_SIZE(regoff))
83 addr = (unsigned long *) (task->thread.esp0 + regoff[regno]);
84 else
85 return -1;
86 *addr = data;
87 return 0;
88}
89
90void user_enable_single_step(struct task_struct *task)
91{
92 unsigned long srflags;
93 srflags = get_reg(task, PT_SR) | (TRACE_BITS << 16);
94 put_reg(task, PT_SR, srflags);
95}
96
97void user_disable_single_step(struct task_struct *task)
98{
99 unsigned long srflags;
100 srflags = get_reg(task, PT_SR) & ~(TRACE_BITS << 16);
101 put_reg(task, PT_SR, srflags);
102}
103
104/*
105 * Called by kernel/ptrace.c when detaching..
106 *
107 * Make sure the single step bit is not set.
108 */
109void ptrace_disable(struct task_struct *child)
110{
111 /* make sure the single step bit is not set. */
112 user_disable_single_step(child);
113}
114
115long arch_ptrace(struct task_struct *child, long request,
116 unsigned long addr, unsigned long data)
117{
118 int ret;
119 int regno = addr >> 2;
120 unsigned long __user *datap = (unsigned long __user *) data;
121
122 switch (request) {
123 /* read the word at location addr in the USER area. */
124 case PTRACE_PEEKUSR: {
125 unsigned long tmp;
126
127 ret = -EIO;
128 if ((addr & 3) || addr > sizeof(struct user) - 3)
129 break;
130
131 tmp = 0; /* Default return condition */
132 ret = -EIO;
133 if (regno < 19) {
134 tmp = get_reg(child, regno);
135 if (regno == PT_SR)
136 tmp >>= 16;
137 } else if (regno >= 21 && regno < 49) {
138 tmp = child->thread.fp[regno - 21];
139 } else if (regno == 49) {
140 tmp = child->mm->start_code;
141 } else if (regno == 50) {
142 tmp = child->mm->start_data;
143 } else if (regno == 51) {
144 tmp = child->mm->end_code;
145 } else
146 break;
147 ret = put_user(tmp, datap);
148 break;
149 }
150
151 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
152 ret = -EIO;
153 if ((addr & 3) || addr > sizeof(struct user) - 3)
154 break;
155
156 if (regno == PT_SR) {
157 data &= SR_MASK;
158 data <<= 16;
159 data |= get_reg(child, PT_SR) & ~(SR_MASK << 16);
160 }
161 if (regno < 19) {
162 if (put_reg(child, regno, data))
163 break;
164 ret = 0;
165 break;
166 }
167 if (regno >= 21 && regno < 48)
168 {
169 child->thread.fp[regno - 21] = data;
170 ret = 0;
171 }
172 break;
173
174 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
175 int i;
176 unsigned long tmp;
177 for (i = 0; i < 19; i++) {
178 tmp = get_reg(child, i);
179 if (i == PT_SR)
180 tmp >>= 16;
181 if (put_user(tmp, datap)) {
182 ret = -EFAULT;
183 break;
184 }
185 datap++;
186 }
187 ret = 0;
188 break;
189 }
190
191 case PTRACE_SETREGS: { /* Set all gp regs in the child. */
192 int i;
193 unsigned long tmp;
194 for (i = 0; i < 19; i++) {
195 if (get_user(tmp, datap)) {
196 ret = -EFAULT;
197 break;
198 }
199 if (i == PT_SR) {
200 tmp &= SR_MASK;
201 tmp <<= 16;
202 tmp |= get_reg(child, PT_SR) & ~(SR_MASK << 16);
203 }
204 put_reg(child, i, tmp);
205 datap++;
206 }
207 ret = 0;
208 break;
209 }
210
211#ifdef PTRACE_GETFPREGS
212 case PTRACE_GETFPREGS: { /* Get the child FPU state. */
213 ret = 0;
214 if (copy_to_user(datap, &child->thread.fp,
215 sizeof(struct user_m68kfp_struct)))
216 ret = -EFAULT;
217 break;
218 }
219#endif
220
221#ifdef PTRACE_SETFPREGS
222 case PTRACE_SETFPREGS: { /* Set the child FPU state. */
223 ret = 0;
224 if (copy_from_user(&child->thread.fp, datap,
225 sizeof(struct user_m68kfp_struct)))
226 ret = -EFAULT;
227 break;
228 }
229#endif
230
231 case PTRACE_GET_THREAD_AREA:
232 ret = put_user(task_thread_info(child)->tp_value, datap);
233 break;
234
235 default:
236 ret = ptrace_request(child, request, addr, data);
237 break;
238 }
239 return ret;
240}
241
242asmlinkage int syscall_trace_enter(void)
243{
244 int ret = 0;
245
246 if (test_thread_flag(TIF_SYSCALL_TRACE))
247 ret = tracehook_report_syscall_entry(task_pt_regs(current));
248 return ret;
249}
250
251asmlinkage void syscall_trace_leave(void)
252{
253 if (test_thread_flag(TIF_SYSCALL_TRACE))
254 tracehook_report_syscall_exit(task_pt_regs(current), 0);
255}
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index ca3df0dc7e8..7dc186b7a85 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -31,6 +31,7 @@
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/initrd.h> 32#include <linux/initrd.h>
33#include <linux/root_dev.h> 33#include <linux/root_dev.h>
34#include <linux/rtc.h>
34 35
35#include <asm/setup.h> 36#include <asm/setup.h>
36#include <asm/irq.h> 37#include <asm/irq.h>
@@ -47,7 +48,9 @@ EXPORT_SYMBOL(memory_end);
47char __initdata command_line[COMMAND_LINE_SIZE]; 48char __initdata command_line[COMMAND_LINE_SIZE];
48 49
49/* machine dependent timer functions */ 50/* machine dependent timer functions */
51void (*mach_sched_init)(irq_handler_t handler) __initdata = NULL;
50int (*mach_set_clock_mmss)(unsigned long); 52int (*mach_set_clock_mmss)(unsigned long);
53int (*mach_hwclk) (int, struct rtc_time*);
51 54
52/* machine dependent reboot functions */ 55/* machine dependent reboot functions */
53void (*mach_reset)(void); 56void (*mach_reset)(void);
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 75ab79b3bde..d7deb7fc7eb 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -1,5 +1,111 @@
1#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE) 1/*
2#include "time_mm.c" 2 * linux/arch/m68k/kernel/time.c
3#else 3 *
4#include "time_no.c" 4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5#endif 5 *
6 * This file contains the m68k-specific time handling details.
7 * Most of the stuff is located in the machine specific files.
8 *
9 * 1997-09-10 Updated NTP code according to technical memorandum Jan '96
10 * "A Kernel Model for Precision Timekeeping" by Dave Mills
11 */
12
13#include <linux/errno.h>
14#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/param.h>
18#include <linux/string.h>
19#include <linux/mm.h>
20#include <linux/rtc.h>
21#include <linux/platform_device.h>
22
23#include <asm/machdep.h>
24#include <asm/io.h>
25#include <asm/irq_regs.h>
26
27#include <linux/time.h>
28#include <linux/timex.h>
29#include <linux/profile.h>
30
31/*
32 * timer_interrupt() needs to keep up the real-time clock,
33 * as well as call the "xtime_update()" routine every clocktick
34 */
35static irqreturn_t timer_interrupt(int irq, void *dummy)
36{
37 xtime_update(1);
38 update_process_times(user_mode(get_irq_regs()));
39 profile_tick(CPU_PROFILING);
40
41#ifdef CONFIG_HEARTBEAT
42 /* use power LED as a heartbeat instead -- much more useful
43 for debugging -- based on the version for PReP by Cort */
44 /* acts like an actual heart beat -- ie thump-thump-pause... */
45 if (mach_heartbeat) {
46 static unsigned cnt = 0, period = 0, dist = 0;
47
48 if (cnt == 0 || cnt == dist)
49 mach_heartbeat( 1 );
50 else if (cnt == 7 || cnt == dist+7)
51 mach_heartbeat( 0 );
52
53 if (++cnt > period) {
54 cnt = 0;
55 /* The hyperbolic function below modifies the heartbeat period
56 * length in dependency of the current (5min) load. It goes
57 * through the points f(0)=126, f(1)=86, f(5)=51,
58 * f(inf)->30. */
59 period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
60 dist = period / 4;
61 }
62 }
63#endif /* CONFIG_HEARTBEAT */
64 return IRQ_HANDLED;
65}
66
67void read_persistent_clock(struct timespec *ts)
68{
69 struct rtc_time time;
70 ts->tv_sec = 0;
71 ts->tv_nsec = 0;
72
73 if (mach_hwclk) {
74 mach_hwclk(0, &time);
75
76 if ((time.tm_year += 1900) < 1970)
77 time.tm_year += 100;
78 ts->tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday,
79 time.tm_hour, time.tm_min, time.tm_sec);
80 }
81}
82
83void __init time_init(void)
84{
85 mach_sched_init(timer_interrupt);
86}
87
88#ifdef CONFIG_M68KCLASSIC
89
90u32 arch_gettimeoffset(void)
91{
92 return mach_gettimeoffset() * 1000;
93}
94
95static int __init rtc_init(void)
96{
97 struct platform_device *pdev;
98
99 if (!mach_hwclk)
100 return -ENODEV;
101
102 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
103 if (IS_ERR(pdev))
104 return PTR_ERR(pdev);
105
106 return 0;
107}
108
109module_init(rtc_init);
110
111#endif /* CONFIG_M68KCLASSIC */
diff --git a/arch/m68k/kernel/time_mm.c b/arch/m68k/kernel/time_mm.c
deleted file mode 100644
index 18b34ee5db3..00000000000
--- a/arch/m68k/kernel/time_mm.c
+++ /dev/null
@@ -1,114 +0,0 @@
1/*
2 * linux/arch/m68k/kernel/time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 *
6 * This file contains the m68k-specific time handling details.
7 * Most of the stuff is located in the machine specific files.
8 *
9 * 1997-09-10 Updated NTP code according to technical memorandum Jan '96
10 * "A Kernel Model for Precision Timekeeping" by Dave Mills
11 */
12
13#include <linux/errno.h>
14#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/param.h>
18#include <linux/string.h>
19#include <linux/mm.h>
20#include <linux/rtc.h>
21#include <linux/platform_device.h>
22
23#include <asm/machdep.h>
24#include <asm/io.h>
25#include <asm/irq_regs.h>
26
27#include <linux/time.h>
28#include <linux/timex.h>
29#include <linux/profile.h>
30
31static inline int set_rtc_mmss(unsigned long nowtime)
32{
33 if (mach_set_clock_mmss)
34 return mach_set_clock_mmss (nowtime);
35 return -1;
36}
37
38/*
39 * timer_interrupt() needs to keep up the real-time clock,
40 * as well as call the "xtime_update()" routine every clocktick
41 */
42static irqreturn_t timer_interrupt(int irq, void *dummy)
43{
44 xtime_update(1);
45 update_process_times(user_mode(get_irq_regs()));
46 profile_tick(CPU_PROFILING);
47
48#ifdef CONFIG_HEARTBEAT
49 /* use power LED as a heartbeat instead -- much more useful
50 for debugging -- based on the version for PReP by Cort */
51 /* acts like an actual heart beat -- ie thump-thump-pause... */
52 if (mach_heartbeat) {
53 static unsigned cnt = 0, period = 0, dist = 0;
54
55 if (cnt == 0 || cnt == dist)
56 mach_heartbeat( 1 );
57 else if (cnt == 7 || cnt == dist+7)
58 mach_heartbeat( 0 );
59
60 if (++cnt > period) {
61 cnt = 0;
62 /* The hyperbolic function below modifies the heartbeat period
63 * length in dependency of the current (5min) load. It goes
64 * through the points f(0)=126, f(1)=86, f(5)=51,
65 * f(inf)->30. */
66 period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
67 dist = period / 4;
68 }
69 }
70#endif /* CONFIG_HEARTBEAT */
71 return IRQ_HANDLED;
72}
73
74void read_persistent_clock(struct timespec *ts)
75{
76 struct rtc_time time;
77 ts->tv_sec = 0;
78 ts->tv_nsec = 0;
79
80 if (mach_hwclk) {
81 mach_hwclk(0, &time);
82
83 if ((time.tm_year += 1900) < 1970)
84 time.tm_year += 100;
85 ts->tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday,
86 time.tm_hour, time.tm_min, time.tm_sec);
87 }
88}
89
90void __init time_init(void)
91{
92 mach_sched_init(timer_interrupt);
93}
94
95u32 arch_gettimeoffset(void)
96{
97 return mach_gettimeoffset() * 1000;
98}
99
100static int __init rtc_init(void)
101{
102 struct platform_device *pdev;
103
104 if (!mach_hwclk)
105 return -ENODEV;
106
107 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
108 if (IS_ERR(pdev))
109 return PTR_ERR(pdev);
110
111 return 0;
112}
113
114module_init(rtc_init);
diff --git a/arch/m68k/kernel/time_no.c b/arch/m68k/kernel/time_no.c
deleted file mode 100644
index 3ef0f7768dc..00000000000
--- a/arch/m68k/kernel/time_no.c
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 *
6 * This file contains the m68k-specific time handling details.
7 * Most of the stuff is located in the machine specific files.
8 *
9 * 1997-09-10 Updated NTP code according to technical memorandum Jan '96
10 * "A Kernel Model for Precision Timekeeping" by Dave Mills
11 */
12
13#include <linux/errno.h>
14#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/param.h>
18#include <linux/string.h>
19#include <linux/mm.h>
20#include <linux/profile.h>
21#include <linux/time.h>
22#include <linux/timex.h>
23
24#include <asm/machdep.h>
25#include <asm/irq_regs.h>
26
27#define TICK_SIZE (tick_nsec / 1000)
28
29/* machine dependent timer functions */
30void (*mach_gettod)(int*, int*, int*, int*, int*, int*);
31
32static inline int set_rtc_mmss(unsigned long nowtime)
33{
34 if (mach_set_clock_mmss)
35 return mach_set_clock_mmss (nowtime);
36 return -1;
37}
38
39#ifndef CONFIG_GENERIC_CLOCKEVENTS
40/*
41 * timer_interrupt() needs to keep up the real-time clock,
42 * as well as call the "xtime_update()" routine every clocktick
43 */
44irqreturn_t arch_timer_interrupt(int irq, void *dummy)
45{
46
47 if (current->pid)
48 profile_tick(CPU_PROFILING);
49
50 xtime_update(1);
51
52 update_process_times(user_mode(get_irq_regs()));
53
54 return(IRQ_HANDLED);
55}
56#endif
57
58static unsigned long read_rtc_mmss(void)
59{
60 unsigned int year, mon, day, hour, min, sec;
61
62 if (mach_gettod) {
63 mach_gettod(&year, &mon, &day, &hour, &min, &sec);
64 if ((year += 1900) < 1970)
65 year += 100;
66 } else {
67 year = 1970;
68 mon = day = 1;
69 hour = min = sec = 0;
70 }
71
72
73 return mktime(year, mon, day, hour, min, sec);
74}
75
76void read_persistent_clock(struct timespec *ts)
77{
78 ts->tv_sec = read_rtc_mmss();
79 ts->tv_nsec = 0;
80}
81
82int update_persistent_clock(struct timespec now)
83{
84 return set_rtc_mmss(now.tv_sec);
85}
86
87void time_init(void)
88{
89 hw_timer_init();
90}
diff --git a/arch/m68k/kernel/vmlinux-nommu.lds b/arch/m68k/kernel/vmlinux-nommu.lds
index 8e66ccb0935..40e02d9c38b 100644
--- a/arch/m68k/kernel/vmlinux-nommu.lds
+++ b/arch/m68k/kernel/vmlinux-nommu.lds
@@ -1,195 +1,93 @@
1/* 1/*
2 * vmlinux.lds.S -- master linker script for m68knommu arch 2 * vmlinux.lds.S -- master linker script for m68knommu arch
3 * 3 *
4 * (C) Copyright 2002-2006, Greg Ungerer <gerg@snapgear.com> 4 * (C) Copyright 2002-2012, Greg Ungerer <gerg@snapgear.com>
5 * 5 *
6 * This linker script is equipped to build either ROM loaded or RAM 6 * This linker script is equipped to build either ROM loaded or RAM
7 * run kernels. 7 * run kernels.
8 */ 8 */
9 9
10#include <asm-generic/vmlinux.lds.h>
11#include <asm/page.h>
12#include <asm/thread_info.h>
13
14#if defined(CONFIG_RAMKERNEL) 10#if defined(CONFIG_RAMKERNEL)
15#define RAM_START CONFIG_KERNELBASE 11#define KTEXT_ADDR CONFIG_KERNELBASE
16#define RAM_LENGTH (CONFIG_RAMBASE + CONFIG_RAMSIZE - CONFIG_KERNELBASE)
17#define TEXT ram
18#define DATA ram
19#define INIT ram
20#define BSSS ram
21#endif
22#if defined(CONFIG_ROMKERNEL) || defined(CONFIG_HIMEMKERNEL)
23#define RAM_START CONFIG_RAMBASE
24#define RAM_LENGTH CONFIG_RAMSIZE
25#define ROMVEC_START CONFIG_ROMVEC
26#define ROMVEC_LENGTH CONFIG_ROMVECSIZE
27#define ROM_START CONFIG_ROMSTART
28#define ROM_LENGTH CONFIG_ROMSIZE
29#define TEXT rom
30#define DATA ram
31#define INIT ram
32#define BSSS ram
33#endif 12#endif
34 13#if defined(CONFIG_ROMKERNEL)
35#ifndef DATA_ADDR 14#define KTEXT_ADDR CONFIG_ROMSTART
36#define DATA_ADDR 15#define KDATA_ADDR CONFIG_KERNELBASE
16#define LOAD_OFFSET KDATA_ADDR + (ADDR(.text) + SIZEOF(.text))
37#endif 17#endif
38 18
19#include <asm/page.h>
20#include <asm/thread_info.h>
21#include <asm-generic/vmlinux.lds.h>
39 22
40OUTPUT_ARCH(m68k) 23OUTPUT_ARCH(m68k)
41ENTRY(_start) 24ENTRY(_start)
42 25
43MEMORY {
44 ram : ORIGIN = RAM_START, LENGTH = RAM_LENGTH
45#ifdef ROM_START
46 romvec : ORIGIN = ROMVEC_START, LENGTH = ROMVEC_LENGTH
47 rom : ORIGIN = ROM_START, LENGTH = ROM_LENGTH
48#endif
49}
50
51jiffies = jiffies_64 + 4; 26jiffies = jiffies_64 + 4;
52 27
53SECTIONS { 28SECTIONS {
54 29
55#ifdef ROMVEC_START 30#ifdef CONFIG_ROMVEC
56 . = ROMVEC_START ; 31 . = CONFIG_ROMVEC;
57 .romvec : { 32 .romvec : {
58 __rom_start = . ; 33 __rom_start = .;
59 _romvec = .; 34 _romvec = .;
35 *(.romvec)
60 *(.data..initvect) 36 *(.data..initvect)
61 } > romvec 37 }
62#endif 38#endif
63 39
40 . = KTEXT_ADDR;
41
42 _text = .;
43 _stext = .;
64 .text : { 44 .text : {
65 _text = .;
66 _stext = . ;
67 HEAD_TEXT 45 HEAD_TEXT
68 TEXT_TEXT 46 TEXT_TEXT
69 SCHED_TEXT 47 SCHED_TEXT
70 LOCK_TEXT 48 LOCK_TEXT
71 *(.text..lock)
72 *(.fixup) 49 *(.fixup)
50 . = ALIGN(16);
51 }
52 _etext = .;
53
54#ifdef KDATA_ADDR
55 . = KDATA_ADDR;
56#endif
57
58 _sdata = .;
59 RO_DATA_SECTION(PAGE_SIZE)
60 RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE)
61 _edata = .;
73 62
74 . = ALIGN(16); /* Exception table */ 63 EXCEPTION_TABLE(16)
75 __start___ex_table = .; 64 NOTES
76 *(__ex_table)
77 __stop___ex_table = .;
78
79 *(.rodata) *(.rodata.*)
80 *(__vermagic) /* Kernel version magic */
81 *(.rodata1)
82 *(.rodata.str1.1)
83
84 /* Kernel symbol table: Normal symbols */
85 . = ALIGN(4);
86 __start___ksymtab = .;
87 *(SORT(___ksymtab+*))
88 __stop___ksymtab = .;
89
90 /* Kernel symbol table: GPL-only symbols */
91 __start___ksymtab_gpl = .;
92 *(SORT(___ksymtab_gpl+*))
93 __stop___ksymtab_gpl = .;
94
95 /* Kernel symbol table: Normal unused symbols */
96 __start___ksymtab_unused = .;
97 *(SORT(___ksymtab_unused+*))
98 __stop___ksymtab_unused = .;
99
100 /* Kernel symbol table: GPL-only unused symbols */
101 __start___ksymtab_unused_gpl = .;
102 *(SORT(___ksymtab_unused_gpl+*))
103 __stop___ksymtab_unused_gpl = .;
104
105 /* Kernel symbol table: GPL-future symbols */
106 __start___ksymtab_gpl_future = .;
107 *(SORT(___ksymtab_gpl_future+*))
108 __stop___ksymtab_gpl_future = .;
109
110 /* Kernel symbol table: Normal symbols */
111 __start___kcrctab = .;
112 *(SORT(___kcrctab+*))
113 __stop___kcrctab = .;
114
115 /* Kernel symbol table: GPL-only symbols */
116 __start___kcrctab_gpl = .;
117 *(SORT(___kcrctab_gpl+*))
118 __stop___kcrctab_gpl = .;
119
120 /* Kernel symbol table: Normal unused symbols */
121 __start___kcrctab_unused = .;
122 *(SORT(___kcrctab_unused+*))
123 __stop___kcrctab_unused = .;
124
125 /* Kernel symbol table: GPL-only unused symbols */
126 __start___kcrctab_unused_gpl = .;
127 *(SORT(___kcrctab_unused_gpl+*))
128 __stop___kcrctab_unused_gpl = .;
129
130 /* Kernel symbol table: GPL-future symbols */
131 __start___kcrctab_gpl_future = .;
132 *(SORT(___kcrctab_gpl_future+*))
133 __stop___kcrctab_gpl_future = .;
134
135 /* Kernel symbol table: strings */
136 *(__ksymtab_strings)
137
138 /* Built-in module parameters */
139 . = ALIGN(4) ;
140 __start___param = .;
141 *(__param)
142 __stop___param = .;
143
144 /* Built-in module versions */
145 . = ALIGN(4) ;
146 __start___modver = .;
147 *(__modver)
148 __stop___modver = .;
149
150 . = ALIGN(4) ;
151 _etext = . ;
152 } > TEXT
153
154 .data DATA_ADDR : {
155 . = ALIGN(4);
156 _sdata = . ;
157 DATA_DATA
158 CACHELINE_ALIGNED_DATA(32)
159 PAGE_ALIGNED_DATA(PAGE_SIZE)
160 *(.data..shared_aligned)
161 INIT_TASK_DATA(THREAD_SIZE)
162 _edata = . ;
163 } > DATA
164 65
66 . = ALIGN(PAGE_SIZE);
67 __init_begin = .;
68 INIT_TEXT_SECTION(PAGE_SIZE)
69 INIT_DATA_SECTION(16)
70 PERCPU_SECTION(16)
165 .m68k_fixup : { 71 .m68k_fixup : {
166 __start_fixup = .; 72 __start_fixup = .;
167 *(.m68k_fixup) 73 *(.m68k_fixup)
168 __stop_fixup = .; 74 __stop_fixup = .;
169 } > DATA 75 }
170 NOTES > DATA
171
172 .init.text : {
173 . = ALIGN(PAGE_SIZE);
174 __init_begin = .;
175 } > INIT
176 INIT_TEXT_SECTION(PAGE_SIZE) > INIT
177 INIT_DATA_SECTION(16) > INIT
178 .init.data : { 76 .init.data : {
179 . = ALIGN(PAGE_SIZE); 77 . = ALIGN(PAGE_SIZE);
180 __init_end = .; 78 __init_end = .;
181 } > INIT 79 }
182 80
183 .bss : { 81 _sbss = .;
184 . = ALIGN(4); 82 BSS_SECTION(0, 0, 0)
185 _sbss = . ; 83 _ebss = .;
186 *(.bss) 84
187 *(COMMON) 85 _end = .;
188 . = ALIGN(4) ; 86
189 _ebss = . ; 87 STABS_DEBUG
190 _end = . ; 88 .comment 0 : { *(.comment) }
191 } > BSSS
192 89
90 /* Sections to be discarded */
193 DISCARDS 91 DISCARDS
194} 92}
195 93
diff --git a/arch/m68k/platform/5206/config.c b/arch/m68k/platform/5206/config.c
index 6fa3f800277..6bfbeebd231 100644
--- a/arch/m68k/platform/5206/config.c
+++ b/arch/m68k/platform/5206/config.c
@@ -16,83 +16,6 @@
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfuart.h>
20
21/***************************************************************************/
22
23static struct mcf_platform_uart m5206_uart_platform[] = {
24 {
25 .mapbase = MCF_MBAR + MCFUART_BASE1,
26 .irq = 73,
27 },
28 {
29 .mapbase = MCF_MBAR + MCFUART_BASE2,
30 .irq = 74,
31 },
32 { },
33};
34
35static struct platform_device m5206_uart = {
36 .name = "mcfuart",
37 .id = 0,
38 .dev.platform_data = m5206_uart_platform,
39};
40
41static struct platform_device *m5206_devices[] __initdata = {
42 &m5206_uart,
43};
44
45/***************************************************************************/
46
47static void __init m5206_uart_init_line(int line, int irq)
48{
49 if (line == 0) {
50 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
51 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
52 mcf_mapirq2imr(irq, MCFINTC_UART0);
53 } else if (line == 1) {
54 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
55 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
56 mcf_mapirq2imr(irq, MCFINTC_UART1);
57 }
58}
59
60static void __init m5206_uarts_init(void)
61{
62 const int nrlines = ARRAY_SIZE(m5206_uart_platform);
63 int line;
64
65 for (line = 0; (line < nrlines); line++)
66 m5206_uart_init_line(line, m5206_uart_platform[line].irq);
67}
68
69/***************************************************************************/
70
71static void __init m5206_timers_init(void)
72{
73 /* Timer1 is always used as system timer */
74 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
75 MCF_MBAR + MCFSIM_TIMER1ICR);
76 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
77
78#ifdef CONFIG_HIGHPROFILE
79 /* Timer2 is to be used as a high speed profile timer */
80 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
81 MCF_MBAR + MCFSIM_TIMER2ICR);
82 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
83#endif
84}
85
86/***************************************************************************/
87
88void m5206_cpu_reset(void)
89{
90 local_irq_disable();
91 /* Set watchdog to soft reset, and enabled */
92 __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
93 for (;;)
94 /* wait for watchdog to timeout */;
95}
96 19
97/***************************************************************************/ 20/***************************************************************************/
98 21
@@ -104,9 +27,7 @@ void __init config_BSP(char *commandp, int size)
104 commandp[size-1] = 0; 27 commandp[size-1] = 0;
105#endif /* CONFIG_NETtel */ 28#endif /* CONFIG_NETtel */
106 29
107 mach_reset = m5206_cpu_reset; 30 mach_sched_init = hw_timer_init;
108 m5206_timers_init();
109 m5206_uarts_init();
110 31
111 /* Only support the external interrupts on their primary level */ 32 /* Only support the external interrupts on their primary level */
112 mcf_mapirq2imr(25, MCFINTC_EINT1); 33 mcf_mapirq2imr(25, MCFINTC_EINT1);
@@ -115,13 +36,3 @@ void __init config_BSP(char *commandp, int size)
115} 36}
116 37
117/***************************************************************************/ 38/***************************************************************************/
118
119static int __init init_BSP(void)
120{
121 platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices));
122 return 0;
123}
124
125arch_initcall(init_BSP);
126
127/***************************************************************************/
diff --git a/arch/m68k/platform/520x/config.c b/arch/m68k/platform/520x/config.c
index 8a98683f1b1..235947844f2 100644
--- a/arch/m68k/platform/520x/config.c
+++ b/arch/m68k/platform/520x/config.c
@@ -15,194 +15,14 @@
15#include <linux/param.h> 15#include <linux/param.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/spi/spi.h>
19#include <linux/gpio.h>
20#include <asm/machdep.h> 18#include <asm/machdep.h>
21#include <asm/coldfire.h> 19#include <asm/coldfire.h>
22#include <asm/mcfsim.h> 20#include <asm/mcfsim.h>
23#include <asm/mcfuart.h> 21#include <asm/mcfuart.h>
24#include <asm/mcfqspi.h>
25 22
26/***************************************************************************/ 23/***************************************************************************/
27 24
28static struct mcf_platform_uart m520x_uart_platform[] = { 25#ifdef CONFIG_SPI_COLDFIRE_QSPI
29 {
30 .mapbase = MCFUART_BASE1,
31 .irq = MCFINT_VECBASE + MCFINT_UART0,
32 },
33 {
34 .mapbase = MCFUART_BASE2,
35 .irq = MCFINT_VECBASE + MCFINT_UART1,
36 },
37 {
38 .mapbase = MCFUART_BASE3,
39 .irq = MCFINT_VECBASE + MCFINT_UART2,
40 },
41 { },
42};
43
44static struct platform_device m520x_uart = {
45 .name = "mcfuart",
46 .id = 0,
47 .dev.platform_data = m520x_uart_platform,
48};
49
50static struct resource m520x_fec_resources[] = {
51 {
52 .start = MCFFEC_BASE,
53 .end = MCFFEC_BASE + MCFFEC_SIZE - 1,
54 .flags = IORESOURCE_MEM,
55 },
56 {
57 .start = 64 + 36,
58 .end = 64 + 36,
59 .flags = IORESOURCE_IRQ,
60 },
61 {
62 .start = 64 + 40,
63 .end = 64 + 40,
64 .flags = IORESOURCE_IRQ,
65 },
66 {
67 .start = 64 + 42,
68 .end = 64 + 42,
69 .flags = IORESOURCE_IRQ,
70 },
71};
72
73static struct platform_device m520x_fec = {
74 .name = "fec",
75 .id = 0,
76 .num_resources = ARRAY_SIZE(m520x_fec_resources),
77 .resource = m520x_fec_resources,
78};
79
80#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
81static struct resource m520x_qspi_resources[] = {
82 {
83 .start = MCFQSPI_IOBASE,
84 .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1,
85 .flags = IORESOURCE_MEM,
86 },
87 {
88 .start = MCFINT_VECBASE + MCFINT_QSPI,
89 .end = MCFINT_VECBASE + MCFINT_QSPI,
90 .flags = IORESOURCE_IRQ,
91 },
92};
93
94#define MCFQSPI_CS0 46
95#define MCFQSPI_CS1 47
96#define MCFQSPI_CS2 27
97
98static int m520x_cs_setup(struct mcfqspi_cs_control *cs_control)
99{
100 int status;
101
102 status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
103 if (status) {
104 pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
105 goto fail0;
106 }
107 status = gpio_direction_output(MCFQSPI_CS0, 1);
108 if (status) {
109 pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
110 goto fail1;
111 }
112
113 status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
114 if (status) {
115 pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
116 goto fail1;
117 }
118 status = gpio_direction_output(MCFQSPI_CS1, 1);
119 if (status) {
120 pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
121 goto fail2;
122 }
123
124 status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
125 if (status) {
126 pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
127 goto fail2;
128 }
129 status = gpio_direction_output(MCFQSPI_CS2, 1);
130 if (status) {
131 pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
132 goto fail3;
133 }
134
135 return 0;
136
137fail3:
138 gpio_free(MCFQSPI_CS2);
139fail2:
140 gpio_free(MCFQSPI_CS1);
141fail1:
142 gpio_free(MCFQSPI_CS0);
143fail0:
144 return status;
145}
146
147static void m520x_cs_teardown(struct mcfqspi_cs_control *cs_control)
148{
149 gpio_free(MCFQSPI_CS2);
150 gpio_free(MCFQSPI_CS1);
151 gpio_free(MCFQSPI_CS0);
152}
153
154static void m520x_cs_select(struct mcfqspi_cs_control *cs_control,
155 u8 chip_select, bool cs_high)
156{
157 switch (chip_select) {
158 case 0:
159 gpio_set_value(MCFQSPI_CS0, cs_high);
160 break;
161 case 1:
162 gpio_set_value(MCFQSPI_CS1, cs_high);
163 break;
164 case 2:
165 gpio_set_value(MCFQSPI_CS2, cs_high);
166 break;
167 }
168}
169
170static void m520x_cs_deselect(struct mcfqspi_cs_control *cs_control,
171 u8 chip_select, bool cs_high)
172{
173 switch (chip_select) {
174 case 0:
175 gpio_set_value(MCFQSPI_CS0, !cs_high);
176 break;
177 case 1:
178 gpio_set_value(MCFQSPI_CS1, !cs_high);
179 break;
180 case 2:
181 gpio_set_value(MCFQSPI_CS2, !cs_high);
182 break;
183 }
184}
185
186static struct mcfqspi_cs_control m520x_cs_control = {
187 .setup = m520x_cs_setup,
188 .teardown = m520x_cs_teardown,
189 .select = m520x_cs_select,
190 .deselect = m520x_cs_deselect,
191};
192
193static struct mcfqspi_platform_data m520x_qspi_data = {
194 .bus_num = 0,
195 .num_chipselect = 3,
196 .cs_control = &m520x_cs_control,
197};
198
199static struct platform_device m520x_qspi = {
200 .name = "mcfqspi",
201 .id = 0,
202 .num_resources = ARRAY_SIZE(m520x_qspi_resources),
203 .resource = m520x_qspi_resources,
204 .dev.platform_data = &m520x_qspi_data,
205};
206 26
207static void __init m520x_qspi_init(void) 27static void __init m520x_qspi_init(void)
208{ 28{
@@ -214,54 +34,28 @@ static void __init m520x_qspi_init(void)
214 par &= 0x00ff; 34 par &= 0x00ff;
215 writew(par, MCF_GPIO_PAR_UART); 35 writew(par, MCF_GPIO_PAR_UART);
216} 36}
217#endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */
218
219 37
220static struct platform_device *m520x_devices[] __initdata = { 38#endif /* CONFIG_SPI_COLDFIRE_QSPI */
221 &m520x_uart,
222 &m520x_fec,
223#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
224 &m520x_qspi,
225#endif
226};
227 39
228/***************************************************************************/ 40/***************************************************************************/
229 41
230static void __init m520x_uart_init_line(int line, int irq) 42static void __init m520x_uarts_init(void)
231{ 43{
232 u16 par; 44 u16 par;
233 u8 par2; 45 u8 par2;
234 46
235 switch (line) { 47 /* UART0 and UART1 GPIO pin setup */
236 case 0: 48 par = readw(MCF_GPIO_PAR_UART);
237 par = readw(MCF_GPIO_PAR_UART); 49 par |= MCF_GPIO_PAR_UART_PAR_UTXD0 | MCF_GPIO_PAR_UART_PAR_URXD0;
238 par |= MCF_GPIO_PAR_UART_PAR_UTXD0 | 50 par |= MCF_GPIO_PAR_UART_PAR_UTXD1 | MCF_GPIO_PAR_UART_PAR_URXD1;
239 MCF_GPIO_PAR_UART_PAR_URXD0; 51 writew(par, MCF_GPIO_PAR_UART);
240 writew(par, MCF_GPIO_PAR_UART);
241 break;
242 case 1:
243 par = readw(MCF_GPIO_PAR_UART);
244 par |= MCF_GPIO_PAR_UART_PAR_UTXD1 |
245 MCF_GPIO_PAR_UART_PAR_URXD1;
246 writew(par, MCF_GPIO_PAR_UART);
247 break;
248 case 2:
249 par2 = readb(MCF_GPIO_PAR_FECI2C);
250 par2 &= ~0x0F;
251 par2 |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 |
252 MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2;
253 writeb(par2, MCF_GPIO_PAR_FECI2C);
254 break;
255 }
256}
257
258static void __init m520x_uarts_init(void)
259{
260 const int nrlines = ARRAY_SIZE(m520x_uart_platform);
261 int line;
262 52
263 for (line = 0; (line < nrlines); line++) 53 /* UART1 GPIO pin setup */
264 m520x_uart_init_line(line, m520x_uart_platform[line].irq); 54 par2 = readb(MCF_GPIO_PAR_FECI2C);
55 par2 &= ~0x0F;
56 par2 |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 |
57 MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2;
58 writeb(par2, MCF_GPIO_PAR_FECI2C);
265} 59}
266 60
267/***************************************************************************/ 61/***************************************************************************/
@@ -280,32 +74,14 @@ static void __init m520x_fec_init(void)
280 74
281/***************************************************************************/ 75/***************************************************************************/
282 76
283static void m520x_cpu_reset(void)
284{
285 local_irq_disable();
286 __raw_writeb(MCF_RCR_SWRESET, MCF_RCR);
287}
288
289/***************************************************************************/
290
291void __init config_BSP(char *commandp, int size) 77void __init config_BSP(char *commandp, int size)
292{ 78{
293 mach_reset = m520x_cpu_reset; 79 mach_sched_init = hw_timer_init;
294 m520x_uarts_init(); 80 m520x_uarts_init();
295 m520x_fec_init(); 81 m520x_fec_init();
296#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 82#ifdef CONFIG_SPI_COLDFIRE_QSPI
297 m520x_qspi_init(); 83 m520x_qspi_init();
298#endif 84#endif
299} 85}
300 86
301/***************************************************************************/ 87/***************************************************************************/
302
303static int __init init_BSP(void)
304{
305 platform_add_devices(m520x_devices, ARRAY_SIZE(m520x_devices));
306 return 0;
307}
308
309arch_initcall(init_BSP);
310
311/***************************************************************************/
diff --git a/arch/m68k/platform/523x/config.c b/arch/m68k/platform/523x/config.c
index 71f4436ec80..c8b405d5a96 100644
--- a/arch/m68k/platform/523x/config.c
+++ b/arch/m68k/platform/523x/config.c
@@ -16,215 +16,13 @@
16#include <linux/param.h> 16#include <linux/param.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/spi/spi.h>
20#include <linux/gpio.h>
21#include <asm/machdep.h> 19#include <asm/machdep.h>
22#include <asm/coldfire.h> 20#include <asm/coldfire.h>
23#include <asm/mcfsim.h> 21#include <asm/mcfsim.h>
24#include <asm/mcfuart.h>
25#include <asm/mcfqspi.h>
26 22
27/***************************************************************************/ 23/***************************************************************************/
28 24
29static struct mcf_platform_uart m523x_uart_platform[] = { 25#ifdef CONFIG_SPI_COLDFIRE_QSPI
30 {
31 .mapbase = MCFUART_BASE1,
32 .irq = MCFINT_VECBASE + MCFINT_UART0,
33 },
34 {
35 .mapbase = MCFUART_BASE2,
36 .irq = MCFINT_VECBASE + MCFINT_UART0 + 1,
37 },
38 {
39 .mapbase = MCFUART_BASE3,
40 .irq = MCFINT_VECBASE + MCFINT_UART0 + 2,
41 },
42 { },
43};
44
45static struct platform_device m523x_uart = {
46 .name = "mcfuart",
47 .id = 0,
48 .dev.platform_data = m523x_uart_platform,
49};
50
51static struct resource m523x_fec_resources[] = {
52 {
53 .start = MCFFEC_BASE,
54 .end = MCFFEC_BASE + MCFFEC_SIZE - 1,
55 .flags = IORESOURCE_MEM,
56 },
57 {
58 .start = 64 + 23,
59 .end = 64 + 23,
60 .flags = IORESOURCE_IRQ,
61 },
62 {
63 .start = 64 + 27,
64 .end = 64 + 27,
65 .flags = IORESOURCE_IRQ,
66 },
67 {
68 .start = 64 + 29,
69 .end = 64 + 29,
70 .flags = IORESOURCE_IRQ,
71 },
72};
73
74static struct platform_device m523x_fec = {
75 .name = "fec",
76 .id = 0,
77 .num_resources = ARRAY_SIZE(m523x_fec_resources),
78 .resource = m523x_fec_resources,
79};
80
81#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
82static struct resource m523x_qspi_resources[] = {
83 {
84 .start = MCFQSPI_IOBASE,
85 .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1,
86 .flags = IORESOURCE_MEM,
87 },
88 {
89 .start = MCFINT_VECBASE + MCFINT_QSPI,
90 .end = MCFINT_VECBASE + MCFINT_QSPI,
91 .flags = IORESOURCE_IRQ,
92 },
93};
94
95#define MCFQSPI_CS0 91
96#define MCFQSPI_CS1 92
97#define MCFQSPI_CS2 103
98#define MCFQSPI_CS3 99
99
100static int m523x_cs_setup(struct mcfqspi_cs_control *cs_control)
101{
102 int status;
103
104 status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
105 if (status) {
106 pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
107 goto fail0;
108 }
109 status = gpio_direction_output(MCFQSPI_CS0, 1);
110 if (status) {
111 pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
112 goto fail1;
113 }
114
115 status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
116 if (status) {
117 pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
118 goto fail1;
119 }
120 status = gpio_direction_output(MCFQSPI_CS1, 1);
121 if (status) {
122 pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
123 goto fail2;
124 }
125
126 status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
127 if (status) {
128 pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
129 goto fail2;
130 }
131 status = gpio_direction_output(MCFQSPI_CS2, 1);
132 if (status) {
133 pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
134 goto fail3;
135 }
136
137 status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3");
138 if (status) {
139 pr_debug("gpio_request for MCFQSPI_CS3 failed\n");
140 goto fail3;
141 }
142 status = gpio_direction_output(MCFQSPI_CS3, 1);
143 if (status) {
144 pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n");
145 goto fail4;
146 }
147
148 return 0;
149
150fail4:
151 gpio_free(MCFQSPI_CS3);
152fail3:
153 gpio_free(MCFQSPI_CS2);
154fail2:
155 gpio_free(MCFQSPI_CS1);
156fail1:
157 gpio_free(MCFQSPI_CS0);
158fail0:
159 return status;
160}
161
162static void m523x_cs_teardown(struct mcfqspi_cs_control *cs_control)
163{
164 gpio_free(MCFQSPI_CS3);
165 gpio_free(MCFQSPI_CS2);
166 gpio_free(MCFQSPI_CS1);
167 gpio_free(MCFQSPI_CS0);
168}
169
170static void m523x_cs_select(struct mcfqspi_cs_control *cs_control,
171 u8 chip_select, bool cs_high)
172{
173 switch (chip_select) {
174 case 0:
175 gpio_set_value(MCFQSPI_CS0, cs_high);
176 break;
177 case 1:
178 gpio_set_value(MCFQSPI_CS1, cs_high);
179 break;
180 case 2:
181 gpio_set_value(MCFQSPI_CS2, cs_high);
182 break;
183 case 3:
184 gpio_set_value(MCFQSPI_CS3, cs_high);
185 break;
186 }
187}
188
189static void m523x_cs_deselect(struct mcfqspi_cs_control *cs_control,
190 u8 chip_select, bool cs_high)
191{
192 switch (chip_select) {
193 case 0:
194 gpio_set_value(MCFQSPI_CS0, !cs_high);
195 break;
196 case 1:
197 gpio_set_value(MCFQSPI_CS1, !cs_high);
198 break;
199 case 2:
200 gpio_set_value(MCFQSPI_CS2, !cs_high);
201 break;
202 case 3:
203 gpio_set_value(MCFQSPI_CS3, !cs_high);
204 break;
205 }
206}
207
208static struct mcfqspi_cs_control m523x_cs_control = {
209 .setup = m523x_cs_setup,
210 .teardown = m523x_cs_teardown,
211 .select = m523x_cs_select,
212 .deselect = m523x_cs_deselect,
213};
214
215static struct mcfqspi_platform_data m523x_qspi_data = {
216 .bus_num = 0,
217 .num_chipselect = 4,
218 .cs_control = &m523x_cs_control,
219};
220
221static struct platform_device m523x_qspi = {
222 .name = "mcfqspi",
223 .id = 0,
224 .num_resources = ARRAY_SIZE(m523x_qspi_resources),
225 .resource = m523x_qspi_resources,
226 .dev.platform_data = &m523x_qspi_data,
227};
228 26
229static void __init m523x_qspi_init(void) 27static void __init m523x_qspi_init(void)
230{ 28{
@@ -237,15 +35,8 @@ static void __init m523x_qspi_init(void)
237 par &= 0x3f3f; 35 par &= 0x3f3f;
238 writew(par, MCFGPIO_PAR_TIMER); 36 writew(par, MCFGPIO_PAR_TIMER);
239} 37}
240#endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */
241 38
242static struct platform_device *m523x_devices[] __initdata = { 39#endif /* CONFIG_SPI_COLDFIRE_QSPI */
243 &m523x_uart,
244 &m523x_fec,
245#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
246 &m523x_qspi,
247#endif
248};
249 40
250/***************************************************************************/ 41/***************************************************************************/
251 42
@@ -263,31 +54,13 @@ static void __init m523x_fec_init(void)
263 54
264/***************************************************************************/ 55/***************************************************************************/
265 56
266static void m523x_cpu_reset(void)
267{
268 local_irq_disable();
269 __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR);
270}
271
272/***************************************************************************/
273
274void __init config_BSP(char *commandp, int size) 57void __init config_BSP(char *commandp, int size)
275{ 58{
276 mach_reset = m523x_cpu_reset; 59 mach_sched_init = hw_timer_init;
277}
278
279/***************************************************************************/
280
281static int __init init_BSP(void)
282{
283 m523x_fec_init(); 60 m523x_fec_init();
284#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 61#ifdef CONFIG_SPI_COLDFIRE_QSPI
285 m523x_qspi_init(); 62 m523x_qspi_init();
286#endif 63#endif
287 platform_add_devices(m523x_devices, ARRAY_SIZE(m523x_devices));
288 return 0;
289} 64}
290 65
291arch_initcall(init_BSP);
292
293/***************************************************************************/ 66/***************************************************************************/
diff --git a/arch/m68k/platform/5249/config.c b/arch/m68k/platform/5249/config.c
index ceb31e5744a..bbf05135bb9 100644
--- a/arch/m68k/platform/5249/config.c
+++ b/arch/m68k/platform/5249/config.c
@@ -12,34 +12,13 @@
12#include <linux/param.h> 12#include <linux/param.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/spi/spi.h> 15#include <linux/platform_device.h>
16#include <linux/gpio.h>
17#include <asm/machdep.h> 16#include <asm/machdep.h>
18#include <asm/coldfire.h> 17#include <asm/coldfire.h>
19#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
20#include <asm/mcfuart.h>
21#include <asm/mcfqspi.h>
22 19
23/***************************************************************************/ 20/***************************************************************************/
24 21
25static struct mcf_platform_uart m5249_uart_platform[] = {
26 {
27 .mapbase = MCF_MBAR + MCFUART_BASE1,
28 .irq = 73,
29 },
30 {
31 .mapbase = MCF_MBAR + MCFUART_BASE2,
32 .irq = 74,
33 },
34 { },
35};
36
37static struct platform_device m5249_uart = {
38 .name = "mcfuart",
39 .id = 0,
40 .dev.platform_data = m5249_uart_platform,
41};
42
43#ifdef CONFIG_M5249C3 22#ifdef CONFIG_M5249C3
44 23
45static struct resource m5249_smc91x_resources[] = { 24static struct resource m5249_smc91x_resources[] = {
@@ -64,153 +43,15 @@ static struct platform_device m5249_smc91x = {
64 43
65#endif /* CONFIG_M5249C3 */ 44#endif /* CONFIG_M5249C3 */
66 45
67#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 46static struct platform_device *m5249_devices[] __initdata = {
68static struct resource m5249_qspi_resources[] = { 47#ifdef CONFIG_M5249C3
69 { 48 &m5249_smc91x,
70 .start = MCFQSPI_IOBASE, 49#endif
71 .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1,
72 .flags = IORESOURCE_MEM,
73 },
74 {
75 .start = MCF_IRQ_QSPI,
76 .end = MCF_IRQ_QSPI,
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81#define MCFQSPI_CS0 29
82#define MCFQSPI_CS1 24
83#define MCFQSPI_CS2 21
84#define MCFQSPI_CS3 22
85
86static int m5249_cs_setup(struct mcfqspi_cs_control *cs_control)
87{
88 int status;
89
90 status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
91 if (status) {
92 pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
93 goto fail0;
94 }
95 status = gpio_direction_output(MCFQSPI_CS0, 1);
96 if (status) {
97 pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
98 goto fail1;
99 }
100
101 status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
102 if (status) {
103 pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
104 goto fail1;
105 }
106 status = gpio_direction_output(MCFQSPI_CS1, 1);
107 if (status) {
108 pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
109 goto fail2;
110 }
111
112 status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
113 if (status) {
114 pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
115 goto fail2;
116 }
117 status = gpio_direction_output(MCFQSPI_CS2, 1);
118 if (status) {
119 pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
120 goto fail3;
121 }
122
123 status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3");
124 if (status) {
125 pr_debug("gpio_request for MCFQSPI_CS3 failed\n");
126 goto fail3;
127 }
128 status = gpio_direction_output(MCFQSPI_CS3, 1);
129 if (status) {
130 pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n");
131 goto fail4;
132 }
133
134 return 0;
135
136fail4:
137 gpio_free(MCFQSPI_CS3);
138fail3:
139 gpio_free(MCFQSPI_CS2);
140fail2:
141 gpio_free(MCFQSPI_CS1);
142fail1:
143 gpio_free(MCFQSPI_CS0);
144fail0:
145 return status;
146}
147
148static void m5249_cs_teardown(struct mcfqspi_cs_control *cs_control)
149{
150 gpio_free(MCFQSPI_CS3);
151 gpio_free(MCFQSPI_CS2);
152 gpio_free(MCFQSPI_CS1);
153 gpio_free(MCFQSPI_CS0);
154}
155
156static void m5249_cs_select(struct mcfqspi_cs_control *cs_control,
157 u8 chip_select, bool cs_high)
158{
159 switch (chip_select) {
160 case 0:
161 gpio_set_value(MCFQSPI_CS0, cs_high);
162 break;
163 case 1:
164 gpio_set_value(MCFQSPI_CS1, cs_high);
165 break;
166 case 2:
167 gpio_set_value(MCFQSPI_CS2, cs_high);
168 break;
169 case 3:
170 gpio_set_value(MCFQSPI_CS3, cs_high);
171 break;
172 }
173}
174
175static void m5249_cs_deselect(struct mcfqspi_cs_control *cs_control,
176 u8 chip_select, bool cs_high)
177{
178 switch (chip_select) {
179 case 0:
180 gpio_set_value(MCFQSPI_CS0, !cs_high);
181 break;
182 case 1:
183 gpio_set_value(MCFQSPI_CS1, !cs_high);
184 break;
185 case 2:
186 gpio_set_value(MCFQSPI_CS2, !cs_high);
187 break;
188 case 3:
189 gpio_set_value(MCFQSPI_CS3, !cs_high);
190 break;
191 }
192}
193
194static struct mcfqspi_cs_control m5249_cs_control = {
195 .setup = m5249_cs_setup,
196 .teardown = m5249_cs_teardown,
197 .select = m5249_cs_select,
198 .deselect = m5249_cs_deselect,
199}; 50};
200 51
201static struct mcfqspi_platform_data m5249_qspi_data = { 52/***************************************************************************/
202 .bus_num = 0,
203 .num_chipselect = 4,
204 .cs_control = &m5249_cs_control,
205};
206 53
207static struct platform_device m5249_qspi = { 54#ifdef CONFIG_SPI_COLDFIRE_QSPI
208 .name = "mcfqspi",
209 .id = 0,
210 .num_resources = ARRAY_SIZE(m5249_qspi_resources),
211 .resource = m5249_qspi_resources,
212 .dev.platform_data = &m5249_qspi_data,
213};
214 55
215static void __init m5249_qspi_init(void) 56static void __init m5249_qspi_init(void)
216{ 57{
@@ -219,42 +60,8 @@ static void __init m5249_qspi_init(void)
219 MCF_MBAR + MCFSIM_QSPIICR); 60 MCF_MBAR + MCFSIM_QSPIICR);
220 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI); 61 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI);
221} 62}
222#endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */
223 63
224 64#endif /* CONFIG_SPI_COLDFIRE_QSPI */
225static struct platform_device *m5249_devices[] __initdata = {
226 &m5249_uart,
227#ifdef CONFIG_M5249C3
228 &m5249_smc91x,
229#endif
230#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
231 &m5249_qspi,
232#endif
233};
234
235/***************************************************************************/
236
237static void __init m5249_uart_init_line(int line, int irq)
238{
239 if (line == 0) {
240 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
241 writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR);
242 mcf_mapirq2imr(irq, MCFINTC_UART0);
243 } else if (line == 1) {
244 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
245 writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR);
246 mcf_mapirq2imr(irq, MCFINTC_UART1);
247 }
248}
249
250static void __init m5249_uarts_init(void)
251{
252 const int nrlines = ARRAY_SIZE(m5249_uart_platform);
253 int line;
254
255 for (line = 0; (line < nrlines); line++)
256 m5249_uart_init_line(line, m5249_uart_platform[line].irq);
257}
258 65
259/***************************************************************************/ 66/***************************************************************************/
260 67
@@ -276,43 +83,14 @@ static void __init m5249_smc91x_init(void)
276 83
277/***************************************************************************/ 84/***************************************************************************/
278 85
279static void __init m5249_timers_init(void)
280{
281 /* Timer1 is always used as system timer */
282 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
283 MCF_MBAR + MCFSIM_TIMER1ICR);
284 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
285
286#ifdef CONFIG_HIGHPROFILE
287 /* Timer2 is to be used as a high speed profile timer */
288 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
289 MCF_MBAR + MCFSIM_TIMER2ICR);
290 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
291#endif
292}
293
294/***************************************************************************/
295
296void m5249_cpu_reset(void)
297{
298 local_irq_disable();
299 /* Set watchdog to soft reset, and enabled */
300 __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
301 for (;;)
302 /* wait for watchdog to timeout */;
303}
304
305/***************************************************************************/
306
307void __init config_BSP(char *commandp, int size) 86void __init config_BSP(char *commandp, int size)
308{ 87{
309 mach_reset = m5249_cpu_reset; 88 mach_sched_init = hw_timer_init;
310 m5249_timers_init(); 89
311 m5249_uarts_init();
312#ifdef CONFIG_M5249C3 90#ifdef CONFIG_M5249C3
313 m5249_smc91x_init(); 91 m5249_smc91x_init();
314#endif 92#endif
315#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 93#ifdef CONFIG_SPI_COLDFIRE_QSPI
316 m5249_qspi_init(); 94 m5249_qspi_init();
317#endif 95#endif
318} 96}
diff --git a/arch/m68k/platform/5272/config.c b/arch/m68k/platform/5272/config.c
index 65bb582734e..e68bc7a148e 100644
--- a/arch/m68k/platform/5272/config.c
+++ b/arch/m68k/platform/5272/config.c
@@ -30,84 +30,18 @@ unsigned char ledbank = 0xff;
30 30
31/***************************************************************************/ 31/***************************************************************************/
32 32
33static struct mcf_platform_uart m5272_uart_platform[] = { 33static void __init m5272_uarts_init(void)
34 {
35 .mapbase = MCF_MBAR + MCFUART_BASE1,
36 .irq = MCF_IRQ_UART1,
37 },
38 {
39 .mapbase = MCF_MBAR + MCFUART_BASE2,
40 .irq = MCF_IRQ_UART2,
41 },
42 { },
43};
44
45static struct platform_device m5272_uart = {
46 .name = "mcfuart",
47 .id = 0,
48 .dev.platform_data = m5272_uart_platform,
49};
50
51static struct resource m5272_fec_resources[] = {
52 {
53 .start = MCF_MBAR + 0x840,
54 .end = MCF_MBAR + 0x840 + 0x1cf,
55 .flags = IORESOURCE_MEM,
56 },
57 {
58 .start = MCF_IRQ_ERX,
59 .end = MCF_IRQ_ERX,
60 .flags = IORESOURCE_IRQ,
61 },
62 {
63 .start = MCF_IRQ_ETX,
64 .end = MCF_IRQ_ETX,
65 .flags = IORESOURCE_IRQ,
66 },
67 {
68 .start = MCF_IRQ_ENTC,
69 .end = MCF_IRQ_ENTC,
70 .flags = IORESOURCE_IRQ,
71 },
72};
73
74static struct platform_device m5272_fec = {
75 .name = "fec",
76 .id = 0,
77 .num_resources = ARRAY_SIZE(m5272_fec_resources),
78 .resource = m5272_fec_resources,
79};
80
81static struct platform_device *m5272_devices[] __initdata = {
82 &m5272_uart,
83 &m5272_fec,
84};
85
86/***************************************************************************/
87
88static void __init m5272_uart_init_line(int line, int irq)
89{ 34{
90 u32 v; 35 u32 v;
91 36
92 if ((line >= 0) && (line < 2)) { 37 /* Enable the output lines for the serial ports */
93 /* Enable the output lines for the serial ports */ 38 v = readl(MCF_MBAR + MCFSIM_PBCNT);
94 v = readl(MCF_MBAR + MCFSIM_PBCNT); 39 v = (v & ~0x000000ff) | 0x00000055;
95 v = (v & ~0x000000ff) | 0x00000055; 40 writel(v, MCF_MBAR + MCFSIM_PBCNT);
96 writel(v, MCF_MBAR + MCFSIM_PBCNT);
97
98 v = readl(MCF_MBAR + MCFSIM_PDCNT);
99 v = (v & ~0x000003fc) | 0x000002a8;
100 writel(v, MCF_MBAR + MCFSIM_PDCNT);
101 }
102}
103
104static void __init m5272_uarts_init(void)
105{
106 const int nrlines = ARRAY_SIZE(m5272_uart_platform);
107 int line;
108 41
109 for (line = 0; (line < nrlines); line++) 42 v = readl(MCF_MBAR + MCFSIM_PDCNT);
110 m5272_uart_init_line(line, m5272_uart_platform[line].irq); 43 v = (v & ~0x000003fc) | 0x000002a8;
44 writel(v, MCF_MBAR + MCFSIM_PDCNT);
111} 45}
112 46
113/***************************************************************************/ 47/***************************************************************************/
@@ -146,6 +80,7 @@ void __init config_BSP(char *commandp, int size)
146#endif 80#endif
147 81
148 mach_reset = m5272_cpu_reset; 82 mach_reset = m5272_cpu_reset;
83 mach_sched_init = hw_timer_init;
149} 84}
150 85
151/***************************************************************************/ 86/***************************************************************************/
@@ -167,7 +102,6 @@ static int __init init_BSP(void)
167{ 102{
168 m5272_uarts_init(); 103 m5272_uarts_init();
169 fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status); 104 fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status);
170 platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));
171 return 0; 105 return 0;
172} 106}
173 107
diff --git a/arch/m68k/platform/527x/config.c b/arch/m68k/platform/527x/config.c
index 3ebc769cefd..7ed848c3b84 100644
--- a/arch/m68k/platform/527x/config.c
+++ b/arch/m68k/platform/527x/config.c
@@ -16,253 +16,14 @@
16#include <linux/param.h> 16#include <linux/param.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/spi/spi.h>
20#include <linux/gpio.h>
21#include <asm/machdep.h> 19#include <asm/machdep.h>
22#include <asm/coldfire.h> 20#include <asm/coldfire.h>
23#include <asm/mcfsim.h> 21#include <asm/mcfsim.h>
24#include <asm/mcfuart.h> 22#include <asm/mcfuart.h>
25#include <asm/mcfqspi.h>
26 23
27/***************************************************************************/ 24/***************************************************************************/
28 25
29static struct mcf_platform_uart m527x_uart_platform[] = { 26#ifdef CONFIG_SPI_COLDFIRE_QSPI
30 {
31 .mapbase = MCFUART_BASE1,
32 .irq = MCFINT_VECBASE + MCFINT_UART0,
33 },
34 {
35 .mapbase = MCFUART_BASE2,
36 .irq = MCFINT_VECBASE + MCFINT_UART1,
37 },
38 {
39 .mapbase = MCFUART_BASE3,
40 .irq = MCFINT_VECBASE + MCFINT_UART2,
41 },
42 { },
43};
44
45static struct platform_device m527x_uart = {
46 .name = "mcfuart",
47 .id = 0,
48 .dev.platform_data = m527x_uart_platform,
49};
50
51static struct resource m527x_fec0_resources[] = {
52 {
53 .start = MCFFEC_BASE0,
54 .end = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1,
55 .flags = IORESOURCE_MEM,
56 },
57 {
58 .start = 64 + 23,
59 .end = 64 + 23,
60 .flags = IORESOURCE_IRQ,
61 },
62 {
63 .start = 64 + 27,
64 .end = 64 + 27,
65 .flags = IORESOURCE_IRQ,
66 },
67 {
68 .start = 64 + 29,
69 .end = 64 + 29,
70 .flags = IORESOURCE_IRQ,
71 },
72};
73
74static struct resource m527x_fec1_resources[] = {
75 {
76 .start = MCFFEC_BASE1,
77 .end = MCFFEC_BASE1 + MCFFEC_SIZE1 - 1,
78 .flags = IORESOURCE_MEM,
79 },
80 {
81 .start = 128 + 23,
82 .end = 128 + 23,
83 .flags = IORESOURCE_IRQ,
84 },
85 {
86 .start = 128 + 27,
87 .end = 128 + 27,
88 .flags = IORESOURCE_IRQ,
89 },
90 {
91 .start = 128 + 29,
92 .end = 128 + 29,
93 .flags = IORESOURCE_IRQ,
94 },
95};
96
97static struct platform_device m527x_fec[] = {
98 {
99 .name = "fec",
100 .id = 0,
101 .num_resources = ARRAY_SIZE(m527x_fec0_resources),
102 .resource = m527x_fec0_resources,
103 },
104 {
105 .name = "fec",
106 .id = 1,
107 .num_resources = ARRAY_SIZE(m527x_fec1_resources),
108 .resource = m527x_fec1_resources,
109 },
110};
111
112#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
113static struct resource m527x_qspi_resources[] = {
114 {
115 .start = MCFQSPI_IOBASE,
116 .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1,
117 .flags = IORESOURCE_MEM,
118 },
119 {
120 .start = MCFINT_VECBASE + MCFINT_QSPI,
121 .end = MCFINT_VECBASE + MCFINT_QSPI,
122 .flags = IORESOURCE_IRQ,
123 },
124};
125
126#if defined(CONFIG_M5271)
127#define MCFQSPI_CS0 91
128#define MCFQSPI_CS1 92
129#define MCFQSPI_CS2 99
130#define MCFQSPI_CS3 103
131#elif defined(CONFIG_M5275)
132#define MCFQSPI_CS0 59
133#define MCFQSPI_CS1 60
134#define MCFQSPI_CS2 61
135#define MCFQSPI_CS3 62
136#endif
137
138static int m527x_cs_setup(struct mcfqspi_cs_control *cs_control)
139{
140 int status;
141
142 status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
143 if (status) {
144 pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
145 goto fail0;
146 }
147 status = gpio_direction_output(MCFQSPI_CS0, 1);
148 if (status) {
149 pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
150 goto fail1;
151 }
152
153 status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
154 if (status) {
155 pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
156 goto fail1;
157 }
158 status = gpio_direction_output(MCFQSPI_CS1, 1);
159 if (status) {
160 pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
161 goto fail2;
162 }
163
164 status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
165 if (status) {
166 pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
167 goto fail2;
168 }
169 status = gpio_direction_output(MCFQSPI_CS2, 1);
170 if (status) {
171 pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
172 goto fail3;
173 }
174
175 status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3");
176 if (status) {
177 pr_debug("gpio_request for MCFQSPI_CS3 failed\n");
178 goto fail3;
179 }
180 status = gpio_direction_output(MCFQSPI_CS3, 1);
181 if (status) {
182 pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n");
183 goto fail4;
184 }
185
186 return 0;
187
188fail4:
189 gpio_free(MCFQSPI_CS3);
190fail3:
191 gpio_free(MCFQSPI_CS2);
192fail2:
193 gpio_free(MCFQSPI_CS1);
194fail1:
195 gpio_free(MCFQSPI_CS0);
196fail0:
197 return status;
198}
199
200static void m527x_cs_teardown(struct mcfqspi_cs_control *cs_control)
201{
202 gpio_free(MCFQSPI_CS3);
203 gpio_free(MCFQSPI_CS2);
204 gpio_free(MCFQSPI_CS1);
205 gpio_free(MCFQSPI_CS0);
206}
207
208static void m527x_cs_select(struct mcfqspi_cs_control *cs_control,
209 u8 chip_select, bool cs_high)
210{
211 switch (chip_select) {
212 case 0:
213 gpio_set_value(MCFQSPI_CS0, cs_high);
214 break;
215 case 1:
216 gpio_set_value(MCFQSPI_CS1, cs_high);
217 break;
218 case 2:
219 gpio_set_value(MCFQSPI_CS2, cs_high);
220 break;
221 case 3:
222 gpio_set_value(MCFQSPI_CS3, cs_high);
223 break;
224 }
225}
226
227static void m527x_cs_deselect(struct mcfqspi_cs_control *cs_control,
228 u8 chip_select, bool cs_high)
229{
230 switch (chip_select) {
231 case 0:
232 gpio_set_value(MCFQSPI_CS0, !cs_high);
233 break;
234 case 1:
235 gpio_set_value(MCFQSPI_CS1, !cs_high);
236 break;
237 case 2:
238 gpio_set_value(MCFQSPI_CS2, !cs_high);
239 break;
240 case 3:
241 gpio_set_value(MCFQSPI_CS3, !cs_high);
242 break;
243 }
244}
245
246static struct mcfqspi_cs_control m527x_cs_control = {
247 .setup = m527x_cs_setup,
248 .teardown = m527x_cs_teardown,
249 .select = m527x_cs_select,
250 .deselect = m527x_cs_deselect,
251};
252
253static struct mcfqspi_platform_data m527x_qspi_data = {
254 .bus_num = 0,
255 .num_chipselect = 4,
256 .cs_control = &m527x_cs_control,
257};
258
259static struct platform_device m527x_qspi = {
260 .name = "mcfqspi",
261 .id = 0,
262 .num_resources = ARRAY_SIZE(m527x_qspi_resources),
263 .resource = m527x_qspi_resources,
264 .dev.platform_data = &m527x_qspi_data,
265};
266 27
267static void __init m527x_qspi_init(void) 28static void __init m527x_qspi_init(void)
268{ 29{
@@ -280,50 +41,23 @@ static void __init m527x_qspi_init(void)
280 writew(0x003e, MCFGPIO_PAR_QSPI); 41 writew(0x003e, MCFGPIO_PAR_QSPI);
281#endif 42#endif
282} 43}
283#endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */
284 44
285static struct platform_device *m527x_devices[] __initdata = { 45#endif /* CONFIG_SPI_COLDFIRE_QSPI */
286 &m527x_uart,
287 &m527x_fec[0],
288#ifdef CONFIG_FEC2
289 &m527x_fec[1],
290#endif
291#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
292 &m527x_qspi,
293#endif
294};
295 46
296/***************************************************************************/ 47/***************************************************************************/
297 48
298static void __init m527x_uart_init_line(int line, int irq) 49static void __init m527x_uarts_init(void)
299{ 50{
300 u16 sepmask; 51 u16 sepmask;
301 52
302 if ((line < 0) || (line > 2))
303 return;
304
305 /* 53 /*
306 * External Pin Mask Setting & Enable External Pin for Interface 54 * External Pin Mask Setting & Enable External Pin for Interface
307 */ 55 */
308 sepmask = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART); 56 sepmask = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART);
309 if (line == 0) 57 sepmask |= UART0_ENABLE_MASK | UART1_ENABLE_MASK | UART2_ENABLE_MASK;
310 sepmask |= UART0_ENABLE_MASK;
311 else if (line == 1)
312 sepmask |= UART1_ENABLE_MASK;
313 else if (line == 2)
314 sepmask |= UART2_ENABLE_MASK;
315 writew(sepmask, MCF_IPSBAR + MCF_GPIO_PAR_UART); 58 writew(sepmask, MCF_IPSBAR + MCF_GPIO_PAR_UART);
316} 59}
317 60
318static void __init m527x_uarts_init(void)
319{
320 const int nrlines = ARRAY_SIZE(m527x_uart_platform);
321 int line;
322
323 for (line = 0; (line < nrlines); line++)
324 m527x_uart_init_line(line, m527x_uart_platform[line].irq);
325}
326
327/***************************************************************************/ 61/***************************************************************************/
328 62
329static void __init m527x_fec_init(void) 63static void __init m527x_fec_init(void)
@@ -353,32 +87,14 @@ static void __init m527x_fec_init(void)
353 87
354/***************************************************************************/ 88/***************************************************************************/
355 89
356static void m527x_cpu_reset(void)
357{
358 local_irq_disable();
359 __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR);
360}
361
362/***************************************************************************/
363
364void __init config_BSP(char *commandp, int size) 90void __init config_BSP(char *commandp, int size)
365{ 91{
366 mach_reset = m527x_cpu_reset; 92 mach_sched_init = hw_timer_init;
367 m527x_uarts_init(); 93 m527x_uarts_init();
368 m527x_fec_init(); 94 m527x_fec_init();
369#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 95#ifdef CONFIG_SPI_COLDFIRE_QSPI
370 m527x_qspi_init(); 96 m527x_qspi_init();
371#endif 97#endif
372} 98}
373 99
374/***************************************************************************/ 100/***************************************************************************/
375
376static int __init init_BSP(void)
377{
378 platform_add_devices(m527x_devices, ARRAY_SIZE(m527x_devices));
379 return 0;
380}
381
382arch_initcall(init_BSP);
383
384/***************************************************************************/
diff --git a/arch/m68k/platform/528x/config.c b/arch/m68k/platform/528x/config.c
index 7abe77a2f3e..d4492926614 100644
--- a/arch/m68k/platform/528x/config.c
+++ b/arch/m68k/platform/528x/config.c
@@ -17,229 +17,33 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/spi/spi.h>
21#include <linux/gpio.h>
22#include <asm/machdep.h> 20#include <asm/machdep.h>
23#include <asm/coldfire.h> 21#include <asm/coldfire.h>
24#include <asm/mcfsim.h> 22#include <asm/mcfsim.h>
25#include <asm/mcfuart.h> 23#include <asm/mcfuart.h>
26#include <asm/mcfqspi.h>
27 24
28/***************************************************************************/ 25/***************************************************************************/
29 26
30static struct mcf_platform_uart m528x_uart_platform[] = { 27#ifdef CONFIG_SPI_COLDFIRE_QSPI
31 {
32 .mapbase = MCFUART_BASE1,
33 .irq = MCFINT_VECBASE + MCFINT_UART0,
34 },
35 {
36 .mapbase = MCFUART_BASE2,
37 .irq = MCFINT_VECBASE + MCFINT_UART0 + 1,
38 },
39 {
40 .mapbase = MCFUART_BASE3,
41 .irq = MCFINT_VECBASE + MCFINT_UART0 + 2,
42 },
43 { },
44};
45
46static struct platform_device m528x_uart = {
47 .name = "mcfuart",
48 .id = 0,
49 .dev.platform_data = m528x_uart_platform,
50};
51
52static struct resource m528x_fec_resources[] = {
53 {
54 .start = MCFFEC_BASE,
55 .end = MCFFEC_BASE + MCFFEC_SIZE - 1,
56 .flags = IORESOURCE_MEM,
57 },
58 {
59 .start = 64 + 23,
60 .end = 64 + 23,
61 .flags = IORESOURCE_IRQ,
62 },
63 {
64 .start = 64 + 27,
65 .end = 64 + 27,
66 .flags = IORESOURCE_IRQ,
67 },
68 {
69 .start = 64 + 29,
70 .end = 64 + 29,
71 .flags = IORESOURCE_IRQ,
72 },
73};
74
75static struct platform_device m528x_fec = {
76 .name = "fec",
77 .id = 0,
78 .num_resources = ARRAY_SIZE(m528x_fec_resources),
79 .resource = m528x_fec_resources,
80};
81
82#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
83static struct resource m528x_qspi_resources[] = {
84 {
85 .start = MCFQSPI_IOBASE,
86 .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1,
87 .flags = IORESOURCE_MEM,
88 },
89 {
90 .start = MCFINT_VECBASE + MCFINT_QSPI,
91 .end = MCFINT_VECBASE + MCFINT_QSPI,
92 .flags = IORESOURCE_IRQ,
93 },
94};
95
96#define MCFQSPI_CS0 147
97#define MCFQSPI_CS1 148
98#define MCFQSPI_CS2 149
99#define MCFQSPI_CS3 150
100
101static int m528x_cs_setup(struct mcfqspi_cs_control *cs_control)
102{
103 int status;
104
105 status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
106 if (status) {
107 pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
108 goto fail0;
109 }
110 status = gpio_direction_output(MCFQSPI_CS0, 1);
111 if (status) {
112 pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
113 goto fail1;
114 }
115
116 status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
117 if (status) {
118 pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
119 goto fail1;
120 }
121 status = gpio_direction_output(MCFQSPI_CS1, 1);
122 if (status) {
123 pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
124 goto fail2;
125 }
126
127 status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
128 if (status) {
129 pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
130 goto fail2;
131 }
132 status = gpio_direction_output(MCFQSPI_CS2, 1);
133 if (status) {
134 pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
135 goto fail3;
136 }
137
138 status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3");
139 if (status) {
140 pr_debug("gpio_request for MCFQSPI_CS3 failed\n");
141 goto fail3;
142 }
143 status = gpio_direction_output(MCFQSPI_CS3, 1);
144 if (status) {
145 pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n");
146 goto fail4;
147 }
148
149 return 0;
150
151fail4:
152 gpio_free(MCFQSPI_CS3);
153fail3:
154 gpio_free(MCFQSPI_CS2);
155fail2:
156 gpio_free(MCFQSPI_CS1);
157fail1:
158 gpio_free(MCFQSPI_CS0);
159fail0:
160 return status;
161}
162
163static void m528x_cs_teardown(struct mcfqspi_cs_control *cs_control)
164{
165 gpio_free(MCFQSPI_CS3);
166 gpio_free(MCFQSPI_CS2);
167 gpio_free(MCFQSPI_CS1);
168 gpio_free(MCFQSPI_CS0);
169}
170
171static void m528x_cs_select(struct mcfqspi_cs_control *cs_control,
172 u8 chip_select, bool cs_high)
173{
174 gpio_set_value(MCFQSPI_CS0 + chip_select, cs_high);
175}
176
177static void m528x_cs_deselect(struct mcfqspi_cs_control *cs_control,
178 u8 chip_select, bool cs_high)
179{
180 gpio_set_value(MCFQSPI_CS0 + chip_select, !cs_high);
181}
182
183static struct mcfqspi_cs_control m528x_cs_control = {
184 .setup = m528x_cs_setup,
185 .teardown = m528x_cs_teardown,
186 .select = m528x_cs_select,
187 .deselect = m528x_cs_deselect,
188};
189
190static struct mcfqspi_platform_data m528x_qspi_data = {
191 .bus_num = 0,
192 .num_chipselect = 4,
193 .cs_control = &m528x_cs_control,
194};
195
196static struct platform_device m528x_qspi = {
197 .name = "mcfqspi",
198 .id = 0,
199 .num_resources = ARRAY_SIZE(m528x_qspi_resources),
200 .resource = m528x_qspi_resources,
201 .dev.platform_data = &m528x_qspi_data,
202};
203 28
204static void __init m528x_qspi_init(void) 29static void __init m528x_qspi_init(void)
205{ 30{
206 /* setup Port QS for QSPI with gpio CS control */ 31 /* setup Port QS for QSPI with gpio CS control */
207 __raw_writeb(0x07, MCFGPIO_PQSPAR); 32 __raw_writeb(0x07, MCFGPIO_PQSPAR);
208} 33}
209#endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */
210 34
211static struct platform_device *m528x_devices[] __initdata = { 35#endif /* CONFIG_SPI_COLDFIRE_QSPI */
212 &m528x_uart,
213 &m528x_fec,
214#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
215 &m528x_qspi,
216#endif
217};
218 36
219/***************************************************************************/ 37/***************************************************************************/
220 38
221static void __init m528x_uart_init_line(int line, int irq) 39static void __init m528x_uarts_init(void)
222{ 40{
223 u8 port; 41 u8 port;
224 42
225 if ((line < 0) || (line > 2))
226 return;
227
228 /* make sure PUAPAR is set for UART0 and UART1 */ 43 /* make sure PUAPAR is set for UART0 and UART1 */
229 if (line < 2) { 44 port = readb(MCF5282_GPIO_PUAPAR);
230 port = readb(MCF5282_GPIO_PUAPAR); 45 port |= 0x03 | (0x03 << 2);
231 port |= (0x03 << (line * 2)); 46 writeb(port, MCF5282_GPIO_PUAPAR);
232 writeb(port, MCF5282_GPIO_PUAPAR);
233 }
234}
235
236static void __init m528x_uarts_init(void)
237{
238 const int nrlines = ARRAY_SIZE(m528x_uart_platform);
239 int line;
240
241 for (line = 0; (line < nrlines); line++)
242 m528x_uart_init_line(line, m528x_uart_platform[line].irq);
243} 47}
244 48
245/***************************************************************************/ 49/***************************************************************************/
@@ -256,14 +60,6 @@ static void __init m528x_fec_init(void)
256 60
257/***************************************************************************/ 61/***************************************************************************/
258 62
259static void m528x_cpu_reset(void)
260{
261 local_irq_disable();
262 __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR);
263}
264
265/***************************************************************************/
266
267#ifdef CONFIG_WILDFIRE 63#ifdef CONFIG_WILDFIRE
268void wildfire_halt(void) 64void wildfire_halt(void)
269{ 65{
@@ -299,22 +95,12 @@ void __init config_BSP(char *commandp, int size)
299#ifdef CONFIG_WILDFIREMOD 95#ifdef CONFIG_WILDFIREMOD
300 mach_halt = wildfiremod_halt; 96 mach_halt = wildfiremod_halt;
301#endif 97#endif
302} 98 mach_sched_init = hw_timer_init;
303
304/***************************************************************************/
305
306static int __init init_BSP(void)
307{
308 mach_reset = m528x_cpu_reset;
309 m528x_uarts_init(); 99 m528x_uarts_init();
310 m528x_fec_init(); 100 m528x_fec_init();
311#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 101#ifdef CONFIG_SPI_COLDFIRE_QSPI
312 m528x_qspi_init(); 102 m528x_qspi_init();
313#endif 103#endif
314 platform_add_devices(m528x_devices, ARRAY_SIZE(m528x_devices));
315 return 0;
316} 104}
317 105
318arch_initcall(init_BSP);
319
320/***************************************************************************/ 106/***************************************************************************/
diff --git a/arch/m68k/platform/5307/config.c b/arch/m68k/platform/5307/config.c
index 00900ac06a9..a568d2870d1 100644
--- a/arch/m68k/platform/5307/config.c
+++ b/arch/m68k/platform/5307/config.c
@@ -16,7 +16,6 @@
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfuart.h>
20#include <asm/mcfwdebug.h> 19#include <asm/mcfwdebug.h>
21 20
22/***************************************************************************/ 21/***************************************************************************/
@@ -29,82 +28,6 @@ unsigned char ledbank = 0xff;
29 28
30/***************************************************************************/ 29/***************************************************************************/
31 30
32static struct mcf_platform_uart m5307_uart_platform[] = {
33 {
34 .mapbase = MCF_MBAR + MCFUART_BASE1,
35 .irq = 73,
36 },
37 {
38 .mapbase = MCF_MBAR + MCFUART_BASE2,
39 .irq = 74,
40 },
41 { },
42};
43
44static struct platform_device m5307_uart = {
45 .name = "mcfuart",
46 .id = 0,
47 .dev.platform_data = m5307_uart_platform,
48};
49
50static struct platform_device *m5307_devices[] __initdata = {
51 &m5307_uart,
52};
53
54/***************************************************************************/
55
56static void __init m5307_uart_init_line(int line, int irq)
57{
58 if (line == 0) {
59 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
60 writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR);
61 mcf_mapirq2imr(irq, MCFINTC_UART0);
62 } else if (line == 1) {
63 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
64 writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR);
65 mcf_mapirq2imr(irq, MCFINTC_UART1);
66 }
67}
68
69static void __init m5307_uarts_init(void)
70{
71 const int nrlines = ARRAY_SIZE(m5307_uart_platform);
72 int line;
73
74 for (line = 0; (line < nrlines); line++)
75 m5307_uart_init_line(line, m5307_uart_platform[line].irq);
76}
77
78/***************************************************************************/
79
80static void __init m5307_timers_init(void)
81{
82 /* Timer1 is always used as system timer */
83 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
84 MCF_MBAR + MCFSIM_TIMER1ICR);
85 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
86
87#ifdef CONFIG_HIGHPROFILE
88 /* Timer2 is to be used as a high speed profile timer */
89 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
90 MCF_MBAR + MCFSIM_TIMER2ICR);
91 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
92#endif
93}
94
95/***************************************************************************/
96
97void m5307_cpu_reset(void)
98{
99 local_irq_disable();
100 /* Set watchdog to soft reset, and enabled */
101 __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
102 for (;;)
103 /* wait for watchdog to timeout */;
104}
105
106/***************************************************************************/
107
108void __init config_BSP(char *commandp, int size) 31void __init config_BSP(char *commandp, int size)
109{ 32{
110#if defined(CONFIG_NETtel) || \ 33#if defined(CONFIG_NETtel) || \
@@ -114,9 +37,7 @@ void __init config_BSP(char *commandp, int size)
114 commandp[size-1] = 0; 37 commandp[size-1] = 0;
115#endif 38#endif
116 39
117 mach_reset = m5307_cpu_reset; 40 mach_sched_init = hw_timer_init;
118 m5307_timers_init();
119 m5307_uarts_init();
120 41
121 /* Only support the external interrupts on their primary level */ 42 /* Only support the external interrupts on their primary level */
122 mcf_mapirq2imr(25, MCFINTC_EINT1); 43 mcf_mapirq2imr(25, MCFINTC_EINT1);
@@ -135,13 +56,3 @@ void __init config_BSP(char *commandp, int size)
135} 56}
136 57
137/***************************************************************************/ 58/***************************************************************************/
138
139static int __init init_BSP(void)
140{
141 platform_add_devices(m5307_devices, ARRAY_SIZE(m5307_devices));
142 return 0;
143}
144
145arch_initcall(init_BSP);
146
147/***************************************************************************/
diff --git a/arch/m68k/platform/532x/config.c b/arch/m68k/platform/532x/config.c
index ca51323f957..2bec3477b73 100644
--- a/arch/m68k/platform/532x/config.c
+++ b/arch/m68k/platform/532x/config.c
@@ -21,214 +21,33 @@
21#include <linux/param.h> 21#include <linux/param.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/spi/spi.h>
25#include <linux/gpio.h>
26#include <asm/machdep.h> 24#include <asm/machdep.h>
27#include <asm/coldfire.h> 25#include <asm/coldfire.h>
28#include <asm/mcfsim.h> 26#include <asm/mcfsim.h>
29#include <asm/mcfuart.h> 27#include <asm/mcfuart.h>
30#include <asm/mcfdma.h> 28#include <asm/mcfdma.h>
31#include <asm/mcfwdebug.h> 29#include <asm/mcfwdebug.h>
32#include <asm/mcfqspi.h>
33 30
34/***************************************************************************/ 31/***************************************************************************/
35 32
36static struct mcf_platform_uart m532x_uart_platform[] = { 33#ifdef CONFIG_SPI_COLDFIRE_QSPI
37 {
38 .mapbase = MCFUART_BASE1,
39 .irq = MCFINT_VECBASE + MCFINT_UART0,
40 },
41 {
42 .mapbase = MCFUART_BASE2,
43 .irq = MCFINT_VECBASE + MCFINT_UART1,
44 },
45 {
46 .mapbase = MCFUART_BASE3,
47 .irq = MCFINT_VECBASE + MCFINT_UART2,
48 },
49 { },
50};
51
52static struct platform_device m532x_uart = {
53 .name = "mcfuart",
54 .id = 0,
55 .dev.platform_data = m532x_uart_platform,
56};
57
58static struct resource m532x_fec_resources[] = {
59 {
60 .start = 0xfc030000,
61 .end = 0xfc0307ff,
62 .flags = IORESOURCE_MEM,
63 },
64 {
65 .start = 64 + 36,
66 .end = 64 + 36,
67 .flags = IORESOURCE_IRQ,
68 },
69 {
70 .start = 64 + 40,
71 .end = 64 + 40,
72 .flags = IORESOURCE_IRQ,
73 },
74 {
75 .start = 64 + 42,
76 .end = 64 + 42,
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81static struct platform_device m532x_fec = {
82 .name = "fec",
83 .id = 0,
84 .num_resources = ARRAY_SIZE(m532x_fec_resources),
85 .resource = m532x_fec_resources,
86};
87
88#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
89static struct resource m532x_qspi_resources[] = {
90 {
91 .start = MCFQSPI_IOBASE,
92 .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1,
93 .flags = IORESOURCE_MEM,
94 },
95 {
96 .start = MCFINT_VECBASE + MCFINT_QSPI,
97 .end = MCFINT_VECBASE + MCFINT_QSPI,
98 .flags = IORESOURCE_IRQ,
99 },
100};
101
102#define MCFQSPI_CS0 84
103#define MCFQSPI_CS1 85
104#define MCFQSPI_CS2 86
105
106static int m532x_cs_setup(struct mcfqspi_cs_control *cs_control)
107{
108 int status;
109
110 status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
111 if (status) {
112 pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
113 goto fail0;
114 }
115 status = gpio_direction_output(MCFQSPI_CS0, 1);
116 if (status) {
117 pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
118 goto fail1;
119 }
120
121 status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
122 if (status) {
123 pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
124 goto fail1;
125 }
126 status = gpio_direction_output(MCFQSPI_CS1, 1);
127 if (status) {
128 pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
129 goto fail2;
130 }
131
132 status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
133 if (status) {
134 pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
135 goto fail2;
136 }
137 status = gpio_direction_output(MCFQSPI_CS2, 1);
138 if (status) {
139 pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
140 goto fail3;
141 }
142
143 return 0;
144
145fail3:
146 gpio_free(MCFQSPI_CS2);
147fail2:
148 gpio_free(MCFQSPI_CS1);
149fail1:
150 gpio_free(MCFQSPI_CS0);
151fail0:
152 return status;
153}
154
155static void m532x_cs_teardown(struct mcfqspi_cs_control *cs_control)
156{
157 gpio_free(MCFQSPI_CS2);
158 gpio_free(MCFQSPI_CS1);
159 gpio_free(MCFQSPI_CS0);
160}
161
162static void m532x_cs_select(struct mcfqspi_cs_control *cs_control,
163 u8 chip_select, bool cs_high)
164{
165 gpio_set_value(MCFQSPI_CS0 + chip_select, cs_high);
166}
167
168static void m532x_cs_deselect(struct mcfqspi_cs_control *cs_control,
169 u8 chip_select, bool cs_high)
170{
171 gpio_set_value(MCFQSPI_CS0 + chip_select, !cs_high);
172}
173
174static struct mcfqspi_cs_control m532x_cs_control = {
175 .setup = m532x_cs_setup,
176 .teardown = m532x_cs_teardown,
177 .select = m532x_cs_select,
178 .deselect = m532x_cs_deselect,
179};
180
181static struct mcfqspi_platform_data m532x_qspi_data = {
182 .bus_num = 0,
183 .num_chipselect = 3,
184 .cs_control = &m532x_cs_control,
185};
186
187static struct platform_device m532x_qspi = {
188 .name = "mcfqspi",
189 .id = 0,
190 .num_resources = ARRAY_SIZE(m532x_qspi_resources),
191 .resource = m532x_qspi_resources,
192 .dev.platform_data = &m532x_qspi_data,
193};
194 34
195static void __init m532x_qspi_init(void) 35static void __init m532x_qspi_init(void)
196{ 36{
197 /* setup QSPS pins for QSPI with gpio CS control */ 37 /* setup QSPS pins for QSPI with gpio CS control */
198 writew(0x01f0, MCF_GPIO_PAR_QSPI); 38 writew(0x01f0, MCF_GPIO_PAR_QSPI);
199} 39}
200#endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */
201 40
202 41#endif /* CONFIG_SPI_COLDFIRE_QSPI */
203static struct platform_device *m532x_devices[] __initdata = {
204 &m532x_uart,
205 &m532x_fec,
206#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
207 &m532x_qspi,
208#endif
209};
210 42
211/***************************************************************************/ 43/***************************************************************************/
212 44
213static void __init m532x_uart_init_line(int line, int irq)
214{
215 if (line == 0) {
216 /* GPIO initialization */
217 MCF_GPIO_PAR_UART |= 0x000F;
218 } else if (line == 1) {
219 /* GPIO initialization */
220 MCF_GPIO_PAR_UART |= 0x0FF0;
221 }
222}
223
224static void __init m532x_uarts_init(void) 45static void __init m532x_uarts_init(void)
225{ 46{
226 const int nrlines = ARRAY_SIZE(m532x_uart_platform); 47 /* UART GPIO initialization */
227 int line; 48 MCF_GPIO_PAR_UART |= 0x0FFF;
228
229 for (line = 0; (line < nrlines); line++)
230 m532x_uart_init_line(line, m532x_uart_platform[line].irq);
231} 49}
50
232/***************************************************************************/ 51/***************************************************************************/
233 52
234static void __init m532x_fec_init(void) 53static void __init m532x_fec_init(void)
@@ -242,14 +61,6 @@ static void __init m532x_fec_init(void)
242 61
243/***************************************************************************/ 62/***************************************************************************/
244 63
245static void m532x_cpu_reset(void)
246{
247 local_irq_disable();
248 __raw_writeb(MCF_RCR_SWRESET, MCF_RCR);
249}
250
251/***************************************************************************/
252
253void __init config_BSP(char *commandp, int size) 64void __init config_BSP(char *commandp, int size)
254{ 65{
255#if !defined(CONFIG_BOOTPARAM) 66#if !defined(CONFIG_BOOTPARAM)
@@ -263,6 +74,13 @@ void __init config_BSP(char *commandp, int size)
263 } 74 }
264#endif 75#endif
265 76
77 mach_sched_init = hw_timer_init;
78 m532x_uarts_init();
79 m532x_fec_init();
80#ifdef CONFIG_SPI_COLDFIRE_QSPI
81 m532x_qspi_init();
82#endif
83
266#ifdef CONFIG_BDM_DISABLE 84#ifdef CONFIG_BDM_DISABLE
267 /* 85 /*
268 * Disable the BDM clocking. This also turns off most of the rest of 86 * Disable the BDM clocking. This also turns off most of the rest of
@@ -274,21 +92,6 @@ void __init config_BSP(char *commandp, int size)
274} 92}
275 93
276/***************************************************************************/ 94/***************************************************************************/
277
278static int __init init_BSP(void)
279{
280 m532x_uarts_init();
281 m532x_fec_init();
282#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
283 m532x_qspi_init();
284#endif
285 platform_add_devices(m532x_devices, ARRAY_SIZE(m532x_devices));
286 return 0;
287}
288
289arch_initcall(init_BSP);
290
291/***************************************************************************/
292/* Board initialization */ 95/* Board initialization */
293/***************************************************************************/ 96/***************************************************************************/
294/* 97/*
diff --git a/arch/m68k/platform/5407/config.c b/arch/m68k/platform/5407/config.c
index 70ea789a400..bb6c746ae81 100644
--- a/arch/m68k/platform/5407/config.c
+++ b/arch/m68k/platform/5407/config.c
@@ -16,91 +16,12 @@
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfuart.h>
20
21/***************************************************************************/
22
23static struct mcf_platform_uart m5407_uart_platform[] = {
24 {
25 .mapbase = MCF_MBAR + MCFUART_BASE1,
26 .irq = 73,
27 },
28 {
29 .mapbase = MCF_MBAR + MCFUART_BASE2,
30 .irq = 74,
31 },
32 { },
33};
34
35static struct platform_device m5407_uart = {
36 .name = "mcfuart",
37 .id = 0,
38 .dev.platform_data = m5407_uart_platform,
39};
40
41static struct platform_device *m5407_devices[] __initdata = {
42 &m5407_uart,
43};
44
45/***************************************************************************/
46
47static void __init m5407_uart_init_line(int line, int irq)
48{
49 if (line == 0) {
50 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
51 writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR);
52 mcf_mapirq2imr(irq, MCFINTC_UART0);
53 } else if (line == 1) {
54 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
55 writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR);
56 mcf_mapirq2imr(irq, MCFINTC_UART1);
57 }
58}
59
60static void __init m5407_uarts_init(void)
61{
62 const int nrlines = ARRAY_SIZE(m5407_uart_platform);
63 int line;
64
65 for (line = 0; (line < nrlines); line++)
66 m5407_uart_init_line(line, m5407_uart_platform[line].irq);
67}
68
69/***************************************************************************/
70
71static void __init m5407_timers_init(void)
72{
73 /* Timer1 is always used as system timer */
74 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
75 MCF_MBAR + MCFSIM_TIMER1ICR);
76 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
77
78#ifdef CONFIG_HIGHPROFILE
79 /* Timer2 is to be used as a high speed profile timer */
80 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
81 MCF_MBAR + MCFSIM_TIMER2ICR);
82 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
83#endif
84}
85
86/***************************************************************************/
87
88void m5407_cpu_reset(void)
89{
90 local_irq_disable();
91 /* set watchdog to soft reset, and enabled */
92 __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
93 for (;;)
94 /* wait for watchdog to timeout */;
95}
96 19
97/***************************************************************************/ 20/***************************************************************************/
98 21
99void __init config_BSP(char *commandp, int size) 22void __init config_BSP(char *commandp, int size)
100{ 23{
101 mach_reset = m5407_cpu_reset; 24 mach_sched_init = hw_timer_init;
102 m5407_timers_init();
103 m5407_uarts_init();
104 25
105 /* Only support the external interrupts on their primary level */ 26 /* Only support the external interrupts on their primary level */
106 mcf_mapirq2imr(25, MCFINTC_EINT1); 27 mcf_mapirq2imr(25, MCFINTC_EINT1);
@@ -110,13 +31,3 @@ void __init config_BSP(char *commandp, int size)
110} 31}
111 32
112/***************************************************************************/ 33/***************************************************************************/
113
114static int __init init_BSP(void)
115{
116 platform_add_devices(m5407_devices, ARRAY_SIZE(m5407_devices));
117 return 0;
118}
119
120arch_initcall(init_BSP);
121
122/***************************************************************************/
diff --git a/arch/m68k/platform/54xx/config.c b/arch/m68k/platform/54xx/config.c
index ee043540bfa..2081c6cbb3d 100644
--- a/arch/m68k/platform/54xx/config.c
+++ b/arch/m68k/platform/54xx/config.c
@@ -27,64 +27,17 @@
27 27
28/***************************************************************************/ 28/***************************************************************************/
29 29
30static struct mcf_platform_uart m54xx_uart_platform[] = {
31 {
32 .mapbase = MCF_MBAR + MCFUART_BASE1,
33 .irq = 64 + 35,
34 },
35 {
36 .mapbase = MCF_MBAR + MCFUART_BASE2,
37 .irq = 64 + 34,
38 },
39 {
40 .mapbase = MCF_MBAR + MCFUART_BASE3,
41 .irq = 64 + 33,
42 },
43 {
44 .mapbase = MCF_MBAR + MCFUART_BASE4,
45 .irq = 64 + 32,
46 },
47};
48
49static struct platform_device m54xx_uart = {
50 .name = "mcfuart",
51 .id = 0,
52 .dev.platform_data = m54xx_uart_platform,
53};
54
55static struct platform_device *m54xx_devices[] __initdata = {
56 &m54xx_uart,
57};
58
59
60/***************************************************************************/
61
62static void __init m54xx_uart_init_line(int line, int irq)
63{
64 int rts_cts;
65
66 /* enable io pins */
67 switch (line) {
68 case 0:
69 rts_cts = 0; break;
70 case 1:
71 rts_cts = MCF_PAR_PSC_RTS_RTS; break;
72 case 2:
73 rts_cts = MCF_PAR_PSC_RTS_RTS | MCF_PAR_PSC_CTS_CTS; break;
74 case 3:
75 rts_cts = 0; break;
76 }
77 __raw_writeb(MCF_PAR_PSC_TXD | rts_cts | MCF_PAR_PSC_RXD,
78 MCF_MBAR + MCF_PAR_PSC(line));
79}
80
81static void __init m54xx_uarts_init(void) 30static void __init m54xx_uarts_init(void)
82{ 31{
83 const int nrlines = ARRAY_SIZE(m54xx_uart_platform); 32 /* enable io pins */
84 int line; 33 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD,
85 34 MCF_MBAR + MCF_PAR_PSC(0));
86 for (line = 0; (line < nrlines); line++) 35 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS,
87 m54xx_uart_init_line(line, m54xx_uart_platform[line].irq); 36 MCF_MBAR + MCF_PAR_PSC(1));
37 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS |
38 MCF_PAR_PSC_CTS_CTS, MCF_MBAR + MCF_PAR_PSC(2));
39 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD,
40 MCF_MBAR + MCF_PAR_PSC(3));
88} 41}
89 42
90/***************************************************************************/ 43/***************************************************************************/
@@ -145,18 +98,8 @@ void __init config_BSP(char *commandp, int size)
145 mmu_context_init(); 98 mmu_context_init();
146#endif 99#endif
147 mach_reset = mcf54xx_reset; 100 mach_reset = mcf54xx_reset;
101 mach_sched_init = hw_timer_init;
148 m54xx_uarts_init(); 102 m54xx_uarts_init();
149} 103}
150 104
151/***************************************************************************/ 105/***************************************************************************/
152
153static int __init init_BSP(void)
154{
155
156 platform_add_devices(m54xx_devices, ARRAY_SIZE(m54xx_devices));
157 return 0;
158}
159
160arch_initcall(init_BSP);
161
162/***************************************************************************/
diff --git a/arch/m68k/platform/68328/config.c b/arch/m68k/platform/68328/config.c
index d70bf2623db..44b86654431 100644
--- a/arch/m68k/platform/68328/config.c
+++ b/arch/m68k/platform/68328/config.c
@@ -17,6 +17,7 @@
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/rtc.h>
20#include <asm/system.h> 21#include <asm/system.h>
21#include <asm/machdep.h> 22#include <asm/machdep.h>
22#include <asm/MC68328.h> 23#include <asm/MC68328.h>
@@ -26,7 +27,7 @@
26 27
27/***************************************************************************/ 28/***************************************************************************/
28 29
29void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); 30int m68328_hwclk(int set, struct rtc_time *t);
30 31
31/***************************************************************************/ 32/***************************************************************************/
32 33
@@ -48,7 +49,7 @@ void config_BSP(char *command, int len)
48 printk(KERN_INFO "68328 support Kenneth Albanowski <kjahds@kjshds.com>\n"); 49 printk(KERN_INFO "68328 support Kenneth Albanowski <kjahds@kjshds.com>\n");
49 printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de>\n"); 50 printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de>\n");
50 51
51 mach_gettod = m68328_timer_gettod; 52 mach_hwclk = m68328_hwclk;
52 mach_reset = m68328_reset; 53 mach_reset = m68328_reset;
53} 54}
54 55
diff --git a/arch/m68k/platform/68328/ints.c b/arch/m68k/platform/68328/ints.c
index 4bd456531f9..b3810febb3e 100644
--- a/arch/m68k/platform/68328/ints.c
+++ b/arch/m68k/platform/68328/ints.c
@@ -68,8 +68,6 @@ asmlinkage irqreturn_t inthandler5(void);
68asmlinkage irqreturn_t inthandler6(void); 68asmlinkage irqreturn_t inthandler6(void);
69asmlinkage irqreturn_t inthandler7(void); 69asmlinkage irqreturn_t inthandler7(void);
70 70
71extern e_vector *_ramvec;
72
73/* The 68k family did not have a good way to determine the source 71/* The 68k family did not have a good way to determine the source
74 * of interrupts until later in the family. The EC000 core does 72 * of interrupts until later in the family. The EC000 core does
75 * not provide the vector number on the stack, we vector everything 73 * not provide the vector number on the stack, we vector everything
diff --git a/arch/m68k/platform/68328/timers.c b/arch/m68k/platform/68328/timers.c
index f2678866067..b15ddef1ec7 100644
--- a/arch/m68k/platform/68328/timers.c
+++ b/arch/m68k/platform/68328/timers.c
@@ -20,6 +20,7 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/clocksource.h> 22#include <linux/clocksource.h>
23#include <linux/rtc.h>
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/system.h> 25#include <asm/system.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
@@ -119,14 +120,17 @@ void hw_timer_init(void)
119 120
120/***************************************************************************/ 121/***************************************************************************/
121 122
122void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec) 123int m68328_hwclk(int set, struct rtc_time *t)
123{ 124{
124 long now = RTCTIME; 125 if (!set) {
125 126 long now = RTCTIME;
126 *year = *mon = *day = 1; 127 t->tm_year = t->tm_mon = t->tm_mday = 1;
127 *hour = (now >> 24) % 24; 128 t->tm_hour = (now >> 24) % 24;
128 *min = (now >> 16) % 60; 129 t->tm_min = (now >> 16) % 60;
129 *sec = now % 60; 130 t->tm_sec = now % 60;
131 }
132
133 return 0;
130} 134}
131 135
132/***************************************************************************/ 136/***************************************************************************/
diff --git a/arch/m68k/platform/68360/config.c b/arch/m68k/platform/68360/config.c
index 9dd5bca3874..599a5949f32 100644
--- a/arch/m68k/platform/68360/config.c
+++ b/arch/m68k/platform/68360/config.c
@@ -103,11 +103,6 @@ void hw_timer_init(void)
103 pquicc->timer_tgcr = tgcr_save; 103 pquicc->timer_tgcr = tgcr_save;
104} 104}
105 105
106void BSP_gettod (int *yearp, int *monp, int *dayp,
107 int *hourp, int *minp, int *secp)
108{
109}
110
111int BSP_set_clock_mmss(unsigned long nowtime) 106int BSP_set_clock_mmss(unsigned long nowtime)
112{ 107{
113#if 0 108#if 0
@@ -181,6 +176,5 @@ void config_BSP(char *command, int len)
181 scc1_hwaddr = "\00\01\02\03\04\05"; 176 scc1_hwaddr = "\00\01\02\03\04\05";
182#endif 177#endif
183 178
184 mach_gettod = BSP_gettod; 179 mach_reset = BSP_reset;
185 mach_reset = BSP_reset;
186} 180}
diff --git a/arch/m68k/platform/68360/ints.c b/arch/m68k/platform/68360/ints.c
index 7b40202d963..8cd42692331 100644
--- a/arch/m68k/platform/68360/ints.c
+++ b/arch/m68k/platform/68360/ints.c
@@ -32,8 +32,6 @@ asmlinkage void trap(void);
32asmlinkage void bad_interrupt(void); 32asmlinkage void bad_interrupt(void);
33asmlinkage void inthandler(void); 33asmlinkage void inthandler(void);
34 34
35extern void *_ramvec[];
36
37static void intc_irq_unmask(struct irq_data *d) 35static void intc_irq_unmask(struct irq_data *d)
38{ 36{
39 pquicc->intr_cimr |= (1 << d->irq); 37 pquicc->intr_cimr |= (1 << d->irq);
diff --git a/arch/m68k/platform/68EZ328/config.c b/arch/m68k/platform/68EZ328/config.c
index 1be1a16f689..dd2c5355434 100644
--- a/arch/m68k/platform/68EZ328/config.c
+++ b/arch/m68k/platform/68EZ328/config.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/rtc.h>
18#include <asm/system.h> 19#include <asm/system.h>
19#include <asm/pgtable.h> 20#include <asm/pgtable.h>
20#include <asm/machdep.h> 21#include <asm/machdep.h>
@@ -25,7 +26,7 @@
25 26
26/***************************************************************************/ 27/***************************************************************************/
27 28
28void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); 29int m68328_hwclk(int set, struct rtc_time *t);
29 30
30/***************************************************************************/ 31/***************************************************************************/
31 32
@@ -69,7 +70,7 @@ void config_BSP(char *command, int len)
69 else command[0] = 0; 70 else command[0] = 0;
70#endif 71#endif
71 72
72 mach_gettod = m68328_timer_gettod; 73 mach_hwclk = m68328_hwclk;
73 mach_reset = m68ez328_reset; 74 mach_reset = m68ez328_reset;
74} 75}
75 76
diff --git a/arch/m68k/platform/68VZ328/config.c b/arch/m68k/platform/68VZ328/config.c
index eabaabe8af3..25ec673edc2 100644
--- a/arch/m68k/platform/68VZ328/config.c
+++ b/arch/m68k/platform/68VZ328/config.c
@@ -20,6 +20,7 @@
20#include <linux/netdevice.h> 20#include <linux/netdevice.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/rtc.h>
23 24
24#include <asm/system.h> 25#include <asm/system.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
@@ -33,7 +34,7 @@
33 34
34/***************************************************************************/ 35/***************************************************************************/
35 36
36void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); 37int m68328_hwclk(int set, struct rtc_time *t);
37 38
38/***************************************************************************/ 39/***************************************************************************/
39/* Init Drangon Engine hardware */ 40/* Init Drangon Engine hardware */
@@ -181,7 +182,7 @@ void config_BSP(char *command, int size)
181 182
182 init_hardware(command, size); 183 init_hardware(command, size);
183 184
184 mach_gettod = m68328_timer_gettod; 185 mach_hwclk = m68328_hwclk;
185 mach_reset = m68vz328_reset; 186 mach_reset = m68vz328_reset;
186} 187}
187 188
diff --git a/arch/m68k/platform/coldfire/Makefile b/arch/m68k/platform/coldfire/Makefile
index a8967baabd7..a0815c61dec 100644
--- a/arch/m68k/platform/coldfire/Makefile
+++ b/arch/m68k/platform/coldfire/Makefile
@@ -14,18 +14,18 @@
14 14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16 16
17obj-$(CONFIG_COLDFIRE) += cache.o clk.o dma.o entry.o vectors.o 17obj-$(CONFIG_COLDFIRE) += cache.o clk.o device.o dma.o entry.o vectors.o
18obj-$(CONFIG_M5206) += timers.o intc.o 18obj-$(CONFIG_M5206) += timers.o intc.o reset.o
19obj-$(CONFIG_M5206e) += timers.o intc.o 19obj-$(CONFIG_M5206e) += timers.o intc.o reset.o
20obj-$(CONFIG_M520x) += pit.o intc-simr.o 20obj-$(CONFIG_M520x) += pit.o intc-simr.o reset.o
21obj-$(CONFIG_M523x) += pit.o dma_timer.o intc-2.o 21obj-$(CONFIG_M523x) += pit.o dma_timer.o intc-2.o reset.o
22obj-$(CONFIG_M5249) += timers.o intc.o 22obj-$(CONFIG_M5249) += timers.o intc.o reset.o
23obj-$(CONFIG_M527x) += pit.o intc-2.o 23obj-$(CONFIG_M527x) += pit.o intc-2.o reset.o
24obj-$(CONFIG_M5272) += timers.o 24obj-$(CONFIG_M5272) += timers.o
25obj-$(CONFIG_M528x) += pit.o intc-2.o 25obj-$(CONFIG_M528x) += pit.o intc-2.o reset.o
26obj-$(CONFIG_M5307) += timers.o intc.o 26obj-$(CONFIG_M5307) += timers.o intc.o reset.o
27obj-$(CONFIG_M532x) += timers.o intc-simr.o 27obj-$(CONFIG_M532x) += timers.o intc-simr.o reset.o
28obj-$(CONFIG_M5407) += timers.o intc.o 28obj-$(CONFIG_M5407) += timers.o intc.o reset.o
29obj-$(CONFIG_M54xx) += sltimers.o intc-2.o 29obj-$(CONFIG_M54xx) += sltimers.o intc-2.o
30 30
31obj-y += pinmux.o gpio.o 31obj-y += pinmux.o gpio.o
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c
new file mode 100644
index 00000000000..fa50c48292f
--- /dev/null
+++ b/arch/m68k/platform/coldfire/device.c
@@ -0,0 +1,318 @@
1/*
2 * device.c -- common ColdFire SoC device support
3 *
4 * (C) Copyright 2011, Greg Ungerer <gerg@uclinux.org>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/io.h>
14#include <linux/spi/spi.h>
15#include <linux/gpio.h>
16#include <asm/traps.h>
17#include <asm/coldfire.h>
18#include <asm/mcfsim.h>
19#include <asm/mcfuart.h>
20#include <asm/mcfqspi.h>
21
22/*
23 * All current ColdFire parts contain from 2, 3 or 4 UARTS.
24 */
25static struct mcf_platform_uart mcf_uart_platform_data[] = {
26 {
27 .mapbase = MCFUART_BASE0,
28 .irq = MCF_IRQ_UART0,
29 },
30 {
31 .mapbase = MCFUART_BASE1,
32 .irq = MCF_IRQ_UART1,
33 },
34#ifdef MCFUART_BASE2
35 {
36 .mapbase = MCFUART_BASE2,
37 .irq = MCF_IRQ_UART2,
38 },
39#endif
40#ifdef MCFUART_BASE3
41 {
42 .mapbase = MCFUART_BASE3,
43 .irq = MCF_IRQ_UART3,
44 },
45#endif
46 { },
47};
48
49static struct platform_device mcf_uart = {
50 .name = "mcfuart",
51 .id = 0,
52 .dev.platform_data = mcf_uart_platform_data,
53};
54
55#ifdef CONFIG_FEC
56/*
57 * Some ColdFire cores contain the Fast Ethernet Controller (FEC)
58 * block. It is Freescale's own hardware block. Some ColdFires
59 * have 2 of these.
60 */
61static struct resource mcf_fec0_resources[] = {
62 {
63 .start = MCFFEC_BASE0,
64 .end = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1,
65 .flags = IORESOURCE_MEM,
66 },
67 {
68 .start = MCF_IRQ_FECRX0,
69 .end = MCF_IRQ_FECRX0,
70 .flags = IORESOURCE_IRQ,
71 },
72 {
73 .start = MCF_IRQ_FECTX0,
74 .end = MCF_IRQ_FECTX0,
75 .flags = IORESOURCE_IRQ,
76 },
77 {
78 .start = MCF_IRQ_FECENTC0,
79 .end = MCF_IRQ_FECENTC0,
80 .flags = IORESOURCE_IRQ,
81 },
82};
83
84static struct platform_device mcf_fec0 = {
85 .name = "fec",
86 .id = 0,
87 .num_resources = ARRAY_SIZE(mcf_fec0_resources),
88 .resource = mcf_fec0_resources,
89};
90
91#ifdef MCFFEC_BASE1
92static struct resource mcf_fec1_resources[] = {
93 {
94 .start = MCFFEC_BASE1,
95 .end = MCFFEC_BASE1 + MCFFEC_SIZE1 - 1,
96 .flags = IORESOURCE_MEM,
97 },
98 {
99 .start = MCF_IRQ_FECRX1,
100 .end = MCF_IRQ_FECRX1,
101 .flags = IORESOURCE_IRQ,
102 },
103 {
104 .start = MCF_IRQ_FECTX1,
105 .end = MCF_IRQ_FECTX1,
106 .flags = IORESOURCE_IRQ,
107 },
108 {
109 .start = MCF_IRQ_FECENTC1,
110 .end = MCF_IRQ_FECENTC1,
111 .flags = IORESOURCE_IRQ,
112 },
113};
114
115static struct platform_device mcf_fec1 = {
116 .name = "fec",
117 .id = 0,
118 .num_resources = ARRAY_SIZE(mcf_fec1_resources),
119 .resource = mcf_fec1_resources,
120};
121#endif /* MCFFEC_BASE1 */
122#endif /* CONFIG_FEC */
123
124#ifdef CONFIG_SPI_COLDFIRE_QSPI
125/*
126 * The ColdFire QSPI module is an SPI protocol hardware block used
127 * on a number of different ColdFire CPUs.
128 */
129static struct resource mcf_qspi_resources[] = {
130 {
131 .start = MCFQSPI_BASE,
132 .end = MCFQSPI_BASE + MCFQSPI_SIZE - 1,
133 .flags = IORESOURCE_MEM,
134 },
135 {
136 .start = MCF_IRQ_QSPI,
137 .end = MCF_IRQ_QSPI,
138 .flags = IORESOURCE_IRQ,
139 },
140};
141
142static int mcf_cs_setup(struct mcfqspi_cs_control *cs_control)
143{
144 int status;
145
146 status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
147 if (status) {
148 pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
149 goto fail0;
150 }
151 status = gpio_direction_output(MCFQSPI_CS0, 1);
152 if (status) {
153 pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
154 goto fail1;
155 }
156
157 status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
158 if (status) {
159 pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
160 goto fail1;
161 }
162 status = gpio_direction_output(MCFQSPI_CS1, 1);
163 if (status) {
164 pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
165 goto fail2;
166 }
167
168 status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
169 if (status) {
170 pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
171 goto fail2;
172 }
173 status = gpio_direction_output(MCFQSPI_CS2, 1);
174 if (status) {
175 pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
176 goto fail3;
177 }
178
179#ifdef MCFQSPI_CS3
180 status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3");
181 if (status) {
182 pr_debug("gpio_request for MCFQSPI_CS3 failed\n");
183 goto fail3;
184 }
185 status = gpio_direction_output(MCFQSPI_CS3, 1);
186 if (status) {
187 pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n");
188 gpio_free(MCFQSPI_CS3);
189 goto fail3;
190 }
191#endif
192
193 return 0;
194
195fail3:
196 gpio_free(MCFQSPI_CS2);
197fail2:
198 gpio_free(MCFQSPI_CS1);
199fail1:
200 gpio_free(MCFQSPI_CS0);
201fail0:
202 return status;
203}
204
205static void mcf_cs_teardown(struct mcfqspi_cs_control *cs_control)
206{
207#ifdef MCFQSPI_CS3
208 gpio_free(MCFQSPI_CS3);
209#endif
210 gpio_free(MCFQSPI_CS2);
211 gpio_free(MCFQSPI_CS1);
212 gpio_free(MCFQSPI_CS0);
213}
214
215static void mcf_cs_select(struct mcfqspi_cs_control *cs_control,
216 u8 chip_select, bool cs_high)
217{
218 switch (chip_select) {
219 case 0:
220 gpio_set_value(MCFQSPI_CS0, cs_high);
221 break;
222 case 1:
223 gpio_set_value(MCFQSPI_CS1, cs_high);
224 break;
225 case 2:
226 gpio_set_value(MCFQSPI_CS2, cs_high);
227 break;
228#ifdef MCFQSPI_CS3
229 case 3:
230 gpio_set_value(MCFQSPI_CS3, cs_high);
231 break;
232#endif
233 }
234}
235
236static void mcf_cs_deselect(struct mcfqspi_cs_control *cs_control,
237 u8 chip_select, bool cs_high)
238{
239 switch (chip_select) {
240 case 0:
241 gpio_set_value(MCFQSPI_CS0, !cs_high);
242 break;
243 case 1:
244 gpio_set_value(MCFQSPI_CS1, !cs_high);
245 break;
246 case 2:
247 gpio_set_value(MCFQSPI_CS2, !cs_high);
248 break;
249#ifdef MCFQSPI_CS3
250 case 3:
251 gpio_set_value(MCFQSPI_CS3, !cs_high);
252 break;
253#endif
254 }
255}
256
257static struct mcfqspi_cs_control mcf_cs_control = {
258 .setup = mcf_cs_setup,
259 .teardown = mcf_cs_teardown,
260 .select = mcf_cs_select,
261 .deselect = mcf_cs_deselect,
262};
263
264static struct mcfqspi_platform_data mcf_qspi_data = {
265 .bus_num = 0,
266 .num_chipselect = 4,
267 .cs_control = &mcf_cs_control,
268};
269
270static struct platform_device mcf_qspi = {
271 .name = "mcfqspi",
272 .id = 0,
273 .num_resources = ARRAY_SIZE(mcf_qspi_resources),
274 .resource = mcf_qspi_resources,
275 .dev.platform_data = &mcf_qspi_data,
276};
277#endif /* CONFIG_SPI_COLDFIRE_QSPI */
278
279static struct platform_device *mcf_devices[] __initdata = {
280 &mcf_uart,
281#ifdef CONFIG_FEC
282 &mcf_fec0,
283#ifdef MCFFEC_BASE1
284 &mcf_fec1,
285#endif
286#endif
287#ifdef CONFIG_SPI_COLDFIRE_QSPI
288 &mcf_qspi,
289#endif
290};
291
292/*
293 * Some ColdFire UARTs let you set the IRQ line to use.
294 */
295static void __init mcf_uart_set_irq(void)
296{
297#ifdef MCFUART_UIVR
298 /* UART0 interrupt setup */
299 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
300 writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
301 mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
302
303 /* UART1 interrupt setup */
304 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
305 writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
306 mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
307#endif
308}
309
310static int __init mcf_init_devices(void)
311{
312 mcf_uart_set_irq();
313 platform_add_devices(mcf_devices, ARRAY_SIZE(mcf_devices));
314 return 0;
315}
316
317arch_initcall(mcf_init_devices);
318
diff --git a/arch/m68k/platform/coldfire/head.S b/arch/m68k/platform/coldfire/head.S
index 38f04a3f620..c3db70ed33b 100644
--- a/arch/m68k/platform/coldfire/head.S
+++ b/arch/m68k/platform/coldfire/head.S
@@ -158,6 +158,10 @@ _start:
158#if defined(CONFIG_UBOOT) 158#if defined(CONFIG_UBOOT)
159 movel %sp,_init_sp /* save initial stack pointer */ 159 movel %sp,_init_sp /* save initial stack pointer */
160#endif 160#endif
161#ifdef CONFIG_MBAR
162 movel #CONFIG_MBAR+1,%d0 /* configured MBAR address */
163 movec %d0,%MBAR /* set it */
164#endif
161 165
162 /* 166 /*
163 * Do any platform or board specific setup now. Most boards 167 * Do any platform or board specific setup now. Most boards
diff --git a/arch/m68k/platform/coldfire/pit.c b/arch/m68k/platform/coldfire/pit.c
index 02663d25822..e62dbbcb10f 100644
--- a/arch/m68k/platform/coldfire/pit.c
+++ b/arch/m68k/platform/coldfire/pit.c
@@ -149,7 +149,7 @@ static struct clocksource pit_clk = {
149 149
150/***************************************************************************/ 150/***************************************************************************/
151 151
152void hw_timer_init(void) 152void hw_timer_init(irq_handler_t handler)
153{ 153{
154 cf_pit_clockevent.cpumask = cpumask_of(smp_processor_id()); 154 cf_pit_clockevent.cpumask = cpumask_of(smp_processor_id());
155 cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32); 155 cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32);
diff --git a/arch/m68k/platform/coldfire/reset.c b/arch/m68k/platform/coldfire/reset.c
new file mode 100644
index 00000000000..933e54eacc6
--- /dev/null
+++ b/arch/m68k/platform/coldfire/reset.c
@@ -0,0 +1,50 @@
1/*
2 * reset.c -- common ColdFire SoC reset support
3 *
4 * (C) Copyright 2012, Greg Ungerer <gerg@uclinux.org>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/io.h>
14#include <asm/machdep.h>
15#include <asm/coldfire.h>
16#include <asm/mcfsim.h>
17
18/*
19 * There are 2 common methods amongst the ColdFure parts for reseting
20 * the CPU. But there are couple of exceptions, the 5272 and the 547x
21 * have something completely special to them, and we let their specific
22 * subarch code handle them.
23 */
24
25#ifdef MCFSIM_SYPCR
26static void mcf_cpu_reset(void)
27{
28 local_irq_disable();
29 /* Set watchdog to soft reset, and enabled */
30 __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
31 for (;;)
32 /* wait for watchdog to timeout */;
33}
34#endif
35
36#ifdef MCF_RCR
37static void mcf_cpu_reset(void)
38{
39 local_irq_disable();
40 __raw_writeb(MCF_RCR_SWRESET, MCF_RCR);
41}
42#endif
43
44static int __init mcf_setup_reset(void)
45{
46 mach_reset = mcf_cpu_reset;
47 return 0;
48}
49
50arch_initcall(mcf_setup_reset);
diff --git a/arch/m68k/platform/coldfire/sltimers.c b/arch/m68k/platform/coldfire/sltimers.c
index 54e1452f853..2027fc20b87 100644
--- a/arch/m68k/platform/coldfire/sltimers.c
+++ b/arch/m68k/platform/coldfire/sltimers.c
@@ -81,12 +81,14 @@ void mcfslt_profile_init(void)
81static u32 mcfslt_cycles_per_jiffy; 81static u32 mcfslt_cycles_per_jiffy;
82static u32 mcfslt_cnt; 82static u32 mcfslt_cnt;
83 83
84static irq_handler_t timer_interrupt;
85
84static irqreturn_t mcfslt_tick(int irq, void *dummy) 86static irqreturn_t mcfslt_tick(int irq, void *dummy)
85{ 87{
86 /* Reset Slice Timer 0 */ 88 /* Reset Slice Timer 0 */
87 __raw_writel(MCFSLT_SSR_BE | MCFSLT_SSR_TE, TA(MCFSLT_SSR)); 89 __raw_writel(MCFSLT_SSR_BE | MCFSLT_SSR_TE, TA(MCFSLT_SSR));
88 mcfslt_cnt += mcfslt_cycles_per_jiffy; 90 mcfslt_cnt += mcfslt_cycles_per_jiffy;
89 return arch_timer_interrupt(irq, dummy); 91 return timer_interrupt(irq, dummy);
90} 92}
91 93
92static struct irqaction mcfslt_timer_irq = { 94static struct irqaction mcfslt_timer_irq = {
@@ -121,7 +123,7 @@ static struct clocksource mcfslt_clk = {
121 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 123 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
122}; 124};
123 125
124void hw_timer_init(void) 126void hw_timer_init(irq_handler_t handler)
125{ 127{
126 mcfslt_cycles_per_jiffy = MCF_BUSCLK / HZ; 128 mcfslt_cycles_per_jiffy = MCF_BUSCLK / HZ;
127 /* 129 /*
@@ -136,6 +138,7 @@ void hw_timer_init(void)
136 /* initialize mcfslt_cnt knowing that slice timers count down */ 138 /* initialize mcfslt_cnt knowing that slice timers count down */
137 mcfslt_cnt = mcfslt_cycles_per_jiffy; 139 mcfslt_cnt = mcfslt_cycles_per_jiffy;
138 140
141 timer_interrupt = handler;
139 setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq); 142 setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq);
140 143
141 clocksource_register_hz(&mcfslt_clk, MCF_BUSCLK); 144 clocksource_register_hz(&mcfslt_clk, MCF_BUSCLK);
diff --git a/arch/m68k/platform/coldfire/timers.c b/arch/m68k/platform/coldfire/timers.c
index 0d90da32fcd..ed96ce50d79 100644
--- a/arch/m68k/platform/coldfire/timers.c
+++ b/arch/m68k/platform/coldfire/timers.c
@@ -47,6 +47,27 @@ void coldfire_profile_init(void);
47static u32 mcftmr_cycles_per_jiffy; 47static u32 mcftmr_cycles_per_jiffy;
48static u32 mcftmr_cnt; 48static u32 mcftmr_cnt;
49 49
50static irq_handler_t timer_interrupt;
51
52/***************************************************************************/
53
54static void init_timer_irq(void)
55{
56#ifdef MCFSIM_ICR_AUTOVEC
57 /* Timer1 is always used as system timer */
58 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
59 MCF_MBAR + MCFSIM_TIMER1ICR);
60 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
61
62#ifdef CONFIG_HIGHPROFILE
63 /* Timer2 is to be used as a high speed profile timer */
64 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
65 MCF_MBAR + MCFSIM_TIMER2ICR);
66 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
67#endif
68#endif /* MCFSIM_ICR_AUTOVEC */
69}
70
50/***************************************************************************/ 71/***************************************************************************/
51 72
52static irqreturn_t mcftmr_tick(int irq, void *dummy) 73static irqreturn_t mcftmr_tick(int irq, void *dummy)
@@ -55,7 +76,7 @@ static irqreturn_t mcftmr_tick(int irq, void *dummy)
55 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER)); 76 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER));
56 77
57 mcftmr_cnt += mcftmr_cycles_per_jiffy; 78 mcftmr_cnt += mcftmr_cycles_per_jiffy;
58 return arch_timer_interrupt(irq, dummy); 79 return timer_interrupt(irq, dummy);
59} 80}
60 81
61/***************************************************************************/ 82/***************************************************************************/
@@ -94,7 +115,7 @@ static struct clocksource mcftmr_clk = {
94 115
95/***************************************************************************/ 116/***************************************************************************/
96 117
97void hw_timer_init(void) 118void hw_timer_init(irq_handler_t handler)
98{ 119{
99 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR)); 120 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
100 mcftmr_cycles_per_jiffy = FREQ / HZ; 121 mcftmr_cycles_per_jiffy = FREQ / HZ;
@@ -110,6 +131,8 @@ void hw_timer_init(void)
110 131
111 clocksource_register_hz(&mcftmr_clk, FREQ); 132 clocksource_register_hz(&mcftmr_clk, FREQ);
112 133
134 timer_interrupt = handler;
135 init_timer_irq();
113 setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq); 136 setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq);
114 137
115#ifdef CONFIG_HIGHPROFILE 138#ifdef CONFIG_HIGHPROFILE
diff --git a/arch/m68k/platform/coldfire/vectors.c b/arch/m68k/platform/coldfire/vectors.c
index 3a7cc524ecd..a4dbdecbec7 100644
--- a/arch/m68k/platform/coldfire/vectors.c
+++ b/arch/m68k/platform/coldfire/vectors.c
@@ -33,8 +33,6 @@ asmlinkage void dbginterrupt_c(struct frame *fp)
33 33
34/***************************************************************************/ 34/***************************************************************************/
35 35
36extern e_vector *_ramvec;
37
38/* Assembler routines */ 36/* Assembler routines */
39asmlinkage void buserr(void); 37asmlinkage void buserr(void);
40asmlinkage void trap(void); 38asmlinkage void trap(void);
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index ad10fecec2f..be936480b96 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -24,6 +24,7 @@
24#include <linux/rtc.h> 24#include <linux/rtc.h>
25#include <linux/vt_kern.h> 25#include <linux/vt_kern.h>
26#include <linux/bcd.h> 26#include <linux/bcd.h>
27#include <linux/platform_device.h>
27 28
28#include <asm/io.h> 29#include <asm/io.h>
29#include <asm/rtc.h> 30#include <asm/rtc.h>
@@ -329,3 +330,15 @@ static int q40_set_rtc_pll(struct rtc_pll_info *pll)
329 } else 330 } else
330 return -EINVAL; 331 return -EINVAL;
331} 332}
333
334static __init int q40_add_kbd_device(void)
335{
336 struct platform_device *pdev;
337
338 pdev = platform_device_register_simple("q40kbd", -1, NULL, 0);
339 if (IS_ERR(pdev))
340 return PTR_ERR(pdev);
341
342 return 0;
343}
344arch_initcall(q40_add_kbd_device);
diff --git a/arch/microblaze/include/asm/pci-bridge.h b/arch/microblaze/include/asm/pci-bridge.h
index e9834b2991d..cb5d3979480 100644
--- a/arch/microblaze/include/asm/pci-bridge.h
+++ b/arch/microblaze/include/asm/pci-bridge.h
@@ -10,7 +10,6 @@
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/ioport.h> 12#include <linux/ioport.h>
13#include <asm-generic/pci-bridge.h>
14 13
15struct device_node; 14struct device_node;
16 15
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index 033137628e8..a0da88bf70c 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -94,14 +94,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
94 */ 94 */
95#define PCI_DMA_BUS_IS_PHYS (1) 95#define PCI_DMA_BUS_IS_PHYS (1)
96 96
97extern void pcibios_resource_to_bus(struct pci_dev *dev,
98 struct pci_bus_region *region,
99 struct resource *res);
100
101extern void pcibios_bus_to_resource(struct pci_dev *dev,
102 struct resource *res,
103 struct pci_bus_region *region);
104
105static inline struct resource *pcibios_select_root(struct pci_dev *pdev, 97static inline struct resource *pcibios_select_root(struct pci_dev *pdev,
106 struct resource *res) 98 struct resource *res)
107{ 99{
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index b2af42311a1..44dc67aa027 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -543,8 +543,6 @@ extern unsigned long iopa(unsigned long addr);
543/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ 543/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
544#define kern_addr_valid(addr) (1) 544#define kern_addr_valid(addr) (1)
545 545
546#define io_remap_page_range remap_page_range
547
548/* 546/*
549 * No page table caches to initialise 547 * No page table caches to initialise
550 */ 548 */
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 85f2ac1230a..d10403dadd2 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -46,9 +46,6 @@ static int global_phb_number; /* Global phb counter */
46/* ISA Memory physical address */ 46/* ISA Memory physical address */
47resource_size_t isa_mem_base; 47resource_size_t isa_mem_base;
48 48
49/* Default PCI flags is 0 on ppc32, modified at boot on ppc64 */
50unsigned int pci_flags;
51
52static struct dma_map_ops *pci_dma_ops = &dma_direct_ops; 49static struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
53 50
54unsigned long isa_io_base; 51unsigned long isa_io_base;
@@ -833,64 +830,7 @@ int pci_proc_domain(struct pci_bus *bus)
833{ 830{
834 struct pci_controller *hose = pci_bus_to_host(bus); 831 struct pci_controller *hose = pci_bus_to_host(bus);
835 832
836 if (!(pci_flags & PCI_ENABLE_PROC_DOMAINS)) 833 return 0;
837 return 0;
838 if (pci_flags & PCI_COMPAT_DOMAIN_0)
839 return hose->global_number != 0;
840 return 1;
841}
842
843void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
844 struct resource *res)
845{
846 resource_size_t offset = 0, mask = (resource_size_t)-1;
847 struct pci_controller *hose = pci_bus_to_host(dev->bus);
848
849 if (!hose)
850 return;
851 if (res->flags & IORESOURCE_IO) {
852 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
853 mask = 0xffffffffu;
854 } else if (res->flags & IORESOURCE_MEM)
855 offset = hose->pci_mem_offset;
856
857 region->start = (res->start - offset) & mask;
858 region->end = (res->end - offset) & mask;
859}
860EXPORT_SYMBOL(pcibios_resource_to_bus);
861
862void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
863 struct pci_bus_region *region)
864{
865 resource_size_t offset = 0, mask = (resource_size_t)-1;
866 struct pci_controller *hose = pci_bus_to_host(dev->bus);
867
868 if (!hose)
869 return;
870 if (res->flags & IORESOURCE_IO) {
871 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
872 mask = 0xffffffffu;
873 } else if (res->flags & IORESOURCE_MEM)
874 offset = hose->pci_mem_offset;
875 res->start = (region->start + offset) & mask;
876 res->end = (region->end + offset) & mask;
877}
878EXPORT_SYMBOL(pcibios_bus_to_resource);
879
880/* Fixup a bus resource into a linux resource */
881static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
882{
883 struct pci_controller *hose = pci_bus_to_host(dev->bus);
884 resource_size_t offset = 0, mask = (resource_size_t)-1;
885
886 if (res->flags & IORESOURCE_IO) {
887 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
888 mask = 0xffffffffu;
889 } else if (res->flags & IORESOURCE_MEM)
890 offset = hose->pci_mem_offset;
891
892 res->start = (res->start + offset) & mask;
893 res->end = (res->end + offset) & mask;
894} 834}
895 835
896/* This header fixup will do the resource fixup for all devices as they are 836/* This header fixup will do the resource fixup for all devices as they are
@@ -910,13 +850,7 @@ static void __devinit pcibios_fixup_resources(struct pci_dev *dev)
910 struct resource *res = dev->resource + i; 850 struct resource *res = dev->resource + i;
911 if (!res->flags) 851 if (!res->flags)
912 continue; 852 continue;
913 /* On platforms that have PCI_PROBE_ONLY set, we don't 853 if (res->start == 0) {
914 * consider 0 as an unassigned BAR value. It's technically
915 * a valid value, but linux doesn't like it... so when we can
916 * re-assign things, we do so, but if we can't, we keep it
917 * around and hope for the best...
918 */
919 if (res->start == 0 && !(pci_flags & PCI_PROBE_ONLY)) {
920 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]" \ 854 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]" \
921 "is unassigned\n", 855 "is unassigned\n",
922 pci_name(dev), i, 856 pci_name(dev), i,
@@ -929,18 +863,11 @@ static void __devinit pcibios_fixup_resources(struct pci_dev *dev)
929 continue; 863 continue;
930 } 864 }
931 865
932 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] fixup...\n", 866 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]\n",
933 pci_name(dev), i, 867 pci_name(dev), i,
934 (unsigned long long)res->start,\ 868 (unsigned long long)res->start,\
935 (unsigned long long)res->end, 869 (unsigned long long)res->end,
936 (unsigned int)res->flags); 870 (unsigned int)res->flags);
937
938 fixup_resource(res, dev);
939
940 pr_debug("PCI:%s %016llx-%016llx\n",
941 pci_name(dev),
942 (unsigned long long)res->start,
943 (unsigned long long)res->end);
944 } 871 }
945} 872}
946DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources); 873DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
@@ -959,10 +886,6 @@ static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
959 u16 command; 886 u16 command;
960 int i; 887 int i;
961 888
962 /* We don't do anything if PCI_PROBE_ONLY is set */
963 if (pci_flags & PCI_PROBE_ONLY)
964 return 0;
965
966 /* Job is a bit different between memory and IO */ 889 /* Job is a bit different between memory and IO */
967 if (res->flags & IORESOURCE_MEM) { 890 if (res->flags & IORESOURCE_MEM) {
968 /* If the BAR is non-0 (res != pci_mem_offset) then it's 891 /* If the BAR is non-0 (res != pci_mem_offset) then it's
@@ -1037,9 +960,6 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
1037 (unsigned long long)res->end, 960 (unsigned long long)res->end,
1038 (unsigned int)res->flags); 961 (unsigned int)res->flags);
1039 962
1040 /* Perform fixup */
1041 fixup_resource(res, dev);
1042
1043 /* Try to detect uninitialized P2P bridge resources, 963 /* Try to detect uninitialized P2P bridge resources,
1044 * and clear them out so they get re-assigned later 964 * and clear them out so they get re-assigned later
1045 */ 965 */
@@ -1107,9 +1027,6 @@ EXPORT_SYMBOL(pcibios_fixup_bus);
1107 1027
1108static int skip_isa_ioresource_align(struct pci_dev *dev) 1028static int skip_isa_ioresource_align(struct pci_dev *dev)
1109{ 1029{
1110 if ((pci_flags & PCI_CAN_SKIP_ISA_ALIGN) &&
1111 !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA))
1112 return 1;
1113 return 0; 1030 return 0;
1114} 1031}
1115 1032
@@ -1236,8 +1153,6 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
1236 * and as such ensure proper re-allocation 1153 * and as such ensure proper re-allocation
1237 * later. 1154 * later.
1238 */ 1155 */
1239 if (pci_flags & PCI_REASSIGN_ALL_RSRC)
1240 goto clear_resource;
1241 pr = pci_find_parent_resource(bus->self, res); 1156 pr = pci_find_parent_resource(bus->self, res);
1242 if (pr == res) { 1157 if (pr == res) {
1243 /* this happens when the generic PCI 1158 /* this happens when the generic PCI
@@ -1422,27 +1337,19 @@ void __init pcibios_resource_survey(void)
1422 list_for_each_entry(b, &pci_root_buses, node) 1337 list_for_each_entry(b, &pci_root_buses, node)
1423 pcibios_allocate_bus_resources(b); 1338 pcibios_allocate_bus_resources(b);
1424 1339
1425 if (!(pci_flags & PCI_REASSIGN_ALL_RSRC)) { 1340 pcibios_allocate_resources(0);
1426 pcibios_allocate_resources(0); 1341 pcibios_allocate_resources(1);
1427 pcibios_allocate_resources(1);
1428 }
1429 1342
1430 /* Before we start assigning unassigned resource, we try to reserve 1343 /* Before we start assigning unassigned resource, we try to reserve
1431 * the low IO area and the VGA memory area if they intersect the 1344 * the low IO area and the VGA memory area if they intersect the
1432 * bus available resources to avoid allocating things on top of them 1345 * bus available resources to avoid allocating things on top of them
1433 */ 1346 */
1434 if (!(pci_flags & PCI_PROBE_ONLY)) { 1347 list_for_each_entry(b, &pci_root_buses, node)
1435 list_for_each_entry(b, &pci_root_buses, node) 1348 pcibios_reserve_legacy_regions(b);
1436 pcibios_reserve_legacy_regions(b);
1437 }
1438 1349
1439 /* Now, if the platform didn't decide to blindly trust the firmware, 1350 /* Now proceed to assigning things that were left unassigned */
1440 * we proceed to assigning things that were left unassigned 1351 pr_debug("PCI: Assigning unassigned resources...\n");
1441 */ 1352 pci_assign_unassigned_resources();
1442 if (!(pci_flags & PCI_PROBE_ONLY)) {
1443 pr_debug("PCI: Assigning unassigned resources...\n");
1444 pci_assign_unassigned_resources();
1445 }
1446} 1353}
1447 1354
1448#ifdef CONFIG_HOTPLUG 1355#ifdef CONFIG_HOTPLUG
@@ -1535,7 +1442,7 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, s
1535 res->end = res->start + IO_SPACE_LIMIT; 1442 res->end = res->start + IO_SPACE_LIMIT;
1536 res->flags = IORESOURCE_IO; 1443 res->flags = IORESOURCE_IO;
1537 } 1444 }
1538 pci_add_resource(resources, res); 1445 pci_add_resource_offset(resources, res, hose->io_base_virt - _IO_BASE);
1539 1446
1540 pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n", 1447 pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n",
1541 (unsigned long long)res->start, 1448 (unsigned long long)res->start,
@@ -1558,7 +1465,7 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, s
1558 res->flags = IORESOURCE_MEM; 1465 res->flags = IORESOURCE_MEM;
1559 1466
1560 } 1467 }
1561 pci_add_resource(resources, res); 1468 pci_add_resource_offset(resources, res, hose->pci_mem_offset);
1562 1469
1563 pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", 1470 pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n",
1564 i, (unsigned long long)res->start, 1471 i, (unsigned long long)res->start,
diff --git a/arch/mips/fw/arc/cmdline.c b/arch/mips/fw/arc/cmdline.c
index 9fdf07e50f1..c0122a1dc58 100644
--- a/arch/mips/fw/arc/cmdline.c
+++ b/arch/mips/fw/arc/cmdline.c
@@ -7,6 +7,7 @@
7 * 7 *
8 * Copyright (C) 1996 David S. Miller (davem@davemloft.net) 8 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
9 */ 9 */
10#include <linux/bug.h>
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/kernel.h> 12#include <linux/kernel.h>
12#include <linux/string.h> 13#include <linux/string.h>
diff --git a/arch/mips/fw/arc/identify.c b/arch/mips/fw/arc/identify.c
index 788060a53dc..54a33c756f6 100644
--- a/arch/mips/fw/arc/identify.c
+++ b/arch/mips/fw/arc/identify.c
@@ -11,6 +11,7 @@
11 * 11 *
12 * Copyright (C) 1996 David S. Miller (davem@davemloft.net) 12 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
13 */ 13 */
14#include <linux/bug.h>
14#include <linux/init.h> 15#include <linux/init.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/types.h> 17#include <linux/types.h>
diff --git a/arch/mips/include/asm/mman.h b/arch/mips/include/asm/mman.h
index 785b4ea4ec3..46d3da0d4b9 100644
--- a/arch/mips/include/asm/mman.h
+++ b/arch/mips/include/asm/mman.h
@@ -80,6 +80,10 @@
80#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ 80#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
81#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ 81#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
82 82
83#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
84 overrides the coredump filter bits */
85#define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */
86
83/* compatibility flags */ 87/* compatibility flags */
84#define MAP_FILE 0 88#define MAP_FILE 0
85 89
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 576397c6992..fcd4060f642 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -92,6 +92,7 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
92#include <asm/scatterlist.h> 92#include <asm/scatterlist.h>
93#include <linux/string.h> 93#include <linux/string.h>
94#include <asm/io.h> 94#include <asm/io.h>
95#include <asm-generic/pci-bridge.h>
95 96
96struct pci_dev; 97struct pci_dev;
97 98
@@ -112,12 +113,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
112} 113}
113#endif 114#endif
114 115
115extern void pcibios_resource_to_bus(struct pci_dev *dev,
116 struct pci_bus_region *region, struct resource *res);
117
118extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
119 struct pci_bus_region *region);
120
121#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 116#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
122 117
123static inline int pci_proc_domain(struct pci_bus *bus) 118static inline int pci_proc_domain(struct pci_bus *bus)
@@ -145,8 +140,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
145#define arch_setup_msi_irqs arch_setup_msi_irqs 140#define arch_setup_msi_irqs arch_setup_msi_irqs
146#endif 141#endif
147 142
148extern int pci_probe_only;
149
150extern char * (*pcibios_plat_setup)(char *str); 143extern char * (*pcibios_plat_setup)(char *str);
151 144
152#endif /* _ASM_PCI_H */ 145#endif /* _ASM_PCI_H */
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c
index 639e3ce6c26..9a91fe9de69 100644
--- a/arch/mips/jz4740/board-qi_lb60.c
+++ b/arch/mips/jz4740/board-qi_lb60.c
@@ -418,6 +418,11 @@ static struct platform_device qi_lb60_charger_device = {
418 }, 418 },
419}; 419};
420 420
421/* audio */
422static struct platform_device qi_lb60_audio_device = {
423 .name = "qi-lb60-audio",
424 .id = -1,
425};
421 426
422static struct platform_device *jz_platform_devices[] __initdata = { 427static struct platform_device *jz_platform_devices[] __initdata = {
423 &jz4740_udc_device, 428 &jz4740_udc_device,
@@ -434,6 +439,7 @@ static struct platform_device *jz_platform_devices[] __initdata = {
434 &qi_lb60_gpio_keys, 439 &qi_lb60_gpio_keys,
435 &qi_lb60_pwm_beeper, 440 &qi_lb60_pwm_beeper,
436 &qi_lb60_charger_device, 441 &qi_lb60_charger_device,
442 &qi_lb60_audio_device,
437}; 443};
438 444
439static void __init board_gpio_setup(void) 445static void __init board_gpio_setup(void)
diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
index e5cdfd603f8..0f1af58b036 100644
--- a/arch/mips/kernel/vdso.c
+++ b/arch/mips/kernel/vdso.c
@@ -88,8 +88,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
88 88
89 ret = install_special_mapping(mm, addr, PAGE_SIZE, 89 ret = install_special_mapping(mm, addr, PAGE_SIZE,
90 VM_READ|VM_EXEC| 90 VM_READ|VM_EXEC|
91 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| 91 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
92 VM_ALWAYSDUMP,
93 &vdso_page); 92 &vdso_page);
94 93
95 if (ret) 94 if (ret)
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c
index acacd1407c6..9553b14002d 100644
--- a/arch/mips/pci/fixup-cobalt.c
+++ b/arch/mips/pci/fixup-cobalt.c
@@ -51,67 +51,6 @@ static void qube_raq_galileo_early_fixup(struct pci_dev *dev)
51DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111, 51DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111,
52 qube_raq_galileo_early_fixup); 52 qube_raq_galileo_early_fixup);
53 53
54static void __devinit cobalt_legacy_ide_resource_fixup(struct pci_dev *dev,
55 struct resource *res)
56{
57 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
58 unsigned long offset = hose->io_offset;
59 struct resource orig = *res;
60
61 if (!(res->flags & IORESOURCE_IO) ||
62 !(res->flags & IORESOURCE_PCI_FIXED))
63 return;
64
65 res->start -= offset;
66 res->end -= offset;
67 dev_printk(KERN_DEBUG, &dev->dev, "converted legacy %pR to bus %pR\n",
68 &orig, res);
69}
70
71static void __devinit cobalt_legacy_ide_fixup(struct pci_dev *dev)
72{
73 u32 class;
74 u8 progif;
75
76 /*
77 * If the IDE controller is in legacy mode, pci_setup_device() fills in
78 * the resources with the legacy addresses that normally appear on the
79 * PCI bus, just as if we had read them from a BAR.
80 *
81 * However, with the GT-64111, those legacy addresses, e.g., 0x1f0,
82 * will never appear on the PCI bus because it converts memory accesses
83 * in the PCI I/O region (which is never at address zero) into I/O port
84 * accesses with no address translation.
85 *
86 * For example, if GT_DEF_PCI0_IO_BASE is 0x10000000, a load or store
87 * to physical address 0x100001f0 will become a PCI access to I/O port
88 * 0x100001f0. There's no way to generate an access to I/O port 0x1f0,
89 * but the VT82C586 IDE controller does respond at 0x100001f0 because
90 * it only decodes the low 24 bits of the address.
91 *
92 * When this quirk runs, the pci_dev resources should contain bus
93 * addresses, not Linux I/O port numbers, so convert legacy addresses
94 * like 0x1f0 to bus addresses like 0x100001f0. Later, we'll convert
95 * them back with pcibios_fixup_bus() or pcibios_bus_to_resource().
96 */
97 class = dev->class >> 8;
98 if (class != PCI_CLASS_STORAGE_IDE)
99 return;
100
101 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
102 if ((progif & 1) == 0) {
103 cobalt_legacy_ide_resource_fixup(dev, &dev->resource[0]);
104 cobalt_legacy_ide_resource_fixup(dev, &dev->resource[1]);
105 }
106 if ((progif & 4) == 0) {
107 cobalt_legacy_ide_resource_fixup(dev, &dev->resource[2]);
108 cobalt_legacy_ide_resource_fixup(dev, &dev->resource[3]);
109 }
110}
111
112DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1,
113 cobalt_legacy_ide_fixup);
114
115static void qube_raq_via_bmIDE_fixup(struct pci_dev *dev) 54static void qube_raq_via_bmIDE_fixup(struct pci_dev *dev)
116{ 55{
117 unsigned short cfgword; 56 unsigned short cfgword;
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c
index af8c3199696..37b52dc3d27 100644
--- a/arch/mips/pci/pci-bcm1480.c
+++ b/arch/mips/pci/pci-bcm1480.c
@@ -204,7 +204,7 @@ static int __init bcm1480_pcibios_init(void)
204 uint64_t reg; 204 uint64_t reg;
205 205
206 /* CFE will assign PCI resources */ 206 /* CFE will assign PCI resources */
207 pci_probe_only = 1; 207 pci_set_flags(PCI_PROBE_ONLY);
208 208
209 /* Avoid ISA compat ranges. */ 209 /* Avoid ISA compat ranges. */
210 PCIBIOS_MIN_IO = 0x00008000UL; 210 PCIBIOS_MIN_IO = 0x00008000UL;
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index 193e9494f98..0fbe4c0c170 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -50,7 +50,7 @@ int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid)
50 bridge_t *bridge; 50 bridge_t *bridge;
51 int slot; 51 int slot;
52 52
53 pci_probe_only = 1; 53 pci_set_flags(PCI_PROBE_ONLY);
54 54
55 printk("a bridge\n"); 55 printk("a bridge\n");
56 56
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index be1e1afe12c..030c77e7926 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -270,7 +270,8 @@ static int __devinit ltq_pci_probe(struct platform_device *pdev)
270{ 270{
271 struct ltq_pci_data *ltq_pci_data = 271 struct ltq_pci_data *ltq_pci_data =
272 (struct ltq_pci_data *) pdev->dev.platform_data; 272 (struct ltq_pci_data *) pdev->dev.platform_data;
273 pci_probe_only = 0; 273
274 pci_clear_flags(PCI_PROBE_ONLY);
274 ltq_pci_irq_map = ltq_pci_data->irq; 275 ltq_pci_irq_map = ltq_pci_data->irq;
275 ltq_pci_membase = ioremap_nocache(PCI_CR_BASE_ADDR, PCI_CR_SIZE); 276 ltq_pci_membase = ioremap_nocache(PCI_CR_BASE_ADDR, PCI_CR_SIZE);
276 ltq_pci_mapped_cfg = 277 ltq_pci_mapped_cfg =
diff --git a/arch/mips/pci/pci-sb1250.c b/arch/mips/pci/pci-sb1250.c
index 1711e8e101b..dd97f3a83ba 100644
--- a/arch/mips/pci/pci-sb1250.c
+++ b/arch/mips/pci/pci-sb1250.c
@@ -213,7 +213,7 @@ static int __init sb1250_pcibios_init(void)
213 uint64_t reg; 213 uint64_t reg;
214 214
215 /* CFE will assign PCI resources */ 215 /* CFE will assign PCI resources */
216 pci_probe_only = 1; 216 pci_set_flags(PCI_PROBE_ONLY);
217 217
218 /* Avoid ISA compat ranges. */ 218 /* Avoid ISA compat ranges. */
219 PCIBIOS_MIN_IO = 0x00008000UL; 219 PCIBIOS_MIN_IO = 0x00008000UL;
diff --git a/arch/mips/pci/pci-xlr.c b/arch/mips/pci/pci-xlr.c
index 3d701a962ef..1644805a673 100644
--- a/arch/mips/pci/pci-xlr.c
+++ b/arch/mips/pci/pci-xlr.c
@@ -292,7 +292,7 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
292static int __init pcibios_init(void) 292static int __init pcibios_init(void)
293{ 293{
294 /* PSB assigns PCI resources */ 294 /* PSB assigns PCI resources */
295 pci_probe_only = 1; 295 pci_set_flags(PCI_PROBE_ONLY);
296 pci_config_base = ioremap(DEFAULT_PCI_CONFIG_BASE, 16 << 20); 296 pci_config_base = ioremap(DEFAULT_PCI_CONFIG_BASE, 16 << 20);
297 297
298 /* Extend IO port for memory mapped io */ 298 /* Extend IO port for memory mapped io */
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 15521505ebe..0514866fa92 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -20,16 +20,9 @@
20#include <asm/cpu-info.h> 20#include <asm/cpu-info.h>
21 21
22/* 22/*
23 * Indicate whether we respect the PCI setup left by the firmware. 23 * If PCI_PROBE_ONLY in pci_flags is set, we don't change any PCI resource
24 * 24 * assignments.
25 * Make this long-lived so that we know when shutting down
26 * whether we probed only or not.
27 */ 25 */
28int pci_probe_only;
29
30#define PCI_ASSIGN_ALL_BUSSES 1
31
32unsigned int pci_probe = PCI_ASSIGN_ALL_BUSSES;
33 26
34/* 27/*
35 * The PCI controller list. 28 * The PCI controller list.
@@ -92,11 +85,12 @@ static void __devinit pcibios_scanbus(struct pci_controller *hose)
92 if (!hose->iommu) 85 if (!hose->iommu)
93 PCI_DMA_BUS_IS_PHYS = 1; 86 PCI_DMA_BUS_IS_PHYS = 1;
94 87
95 if (hose->get_busno && pci_probe_only) 88 if (hose->get_busno && pci_has_flag(PCI_PROBE_ONLY))
96 next_busno = (*hose->get_busno)(); 89 next_busno = (*hose->get_busno)();
97 90
98 pci_add_resource(&resources, hose->mem_resource); 91 pci_add_resource_offset(&resources,
99 pci_add_resource(&resources, hose->io_resource); 92 hose->mem_resource, hose->mem_offset);
93 pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
100 bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose, 94 bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
101 &resources); 95 &resources);
102 if (!bus) 96 if (!bus)
@@ -115,7 +109,7 @@ static void __devinit pcibios_scanbus(struct pci_controller *hose)
115 need_domain_info = 1; 109 need_domain_info = 1;
116 } 110 }
117 111
118 if (!pci_probe_only) { 112 if (!pci_has_flag(PCI_PROBE_ONLY)) {
119 pci_bus_size_bridges(bus); 113 pci_bus_size_bridges(bus);
120 pci_bus_assign_resources(bus); 114 pci_bus_assign_resources(bus);
121 pci_enable_bridges(bus); 115 pci_enable_bridges(bus);
@@ -241,7 +235,7 @@ static int pcibios_enable_resources(struct pci_dev *dev, int mask)
241 235
242unsigned int pcibios_assign_all_busses(void) 236unsigned int pcibios_assign_all_busses(void)
243{ 237{
244 return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0; 238 return 1;
245} 239}
246 240
247int pcibios_enable_device(struct pci_dev *dev, int mask) 241int pcibios_enable_device(struct pci_dev *dev, int mask)
@@ -254,42 +248,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
254 return pcibios_plat_dev_init(dev); 248 return pcibios_plat_dev_init(dev);
255} 249}
256 250
257static void pcibios_fixup_device_resources(struct pci_dev *dev,
258 struct pci_bus *bus)
259{
260 /* Update device resources. */
261 struct pci_controller *hose = (struct pci_controller *)bus->sysdata;
262 unsigned long offset = 0;
263 int i;
264
265 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
266 if (!dev->resource[i].start)
267 continue;
268 if (dev->resource[i].flags & IORESOURCE_IO)
269 offset = hose->io_offset;
270 else if (dev->resource[i].flags & IORESOURCE_MEM)
271 offset = hose->mem_offset;
272
273 dev->resource[i].start += offset;
274 dev->resource[i].end += offset;
275 }
276}
277
278void __devinit pcibios_fixup_bus(struct pci_bus *bus) 251void __devinit pcibios_fixup_bus(struct pci_bus *bus)
279{ 252{
280 /* Propagate hose info into the subordinate devices. */
281
282 struct pci_dev *dev = bus->self; 253 struct pci_dev *dev = bus->self;
283 254
284 if (pci_probe_only && dev && 255 if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
285 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { 256 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
286 pci_read_bridge_bases(bus); 257 pci_read_bridge_bases(bus);
287 pcibios_fixup_device_resources(dev, bus);
288 }
289
290 list_for_each_entry(dev, &bus->devices, bus_list) {
291 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
292 pcibios_fixup_device_resources(dev, bus);
293 } 258 }
294} 259}
295 260
@@ -299,40 +264,7 @@ pcibios_update_irq(struct pci_dev *dev, int irq)
299 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); 264 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
300} 265}
301 266
302void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
303 struct resource *res)
304{
305 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
306 unsigned long offset = 0;
307
308 if (res->flags & IORESOURCE_IO)
309 offset = hose->io_offset;
310 else if (res->flags & IORESOURCE_MEM)
311 offset = hose->mem_offset;
312
313 region->start = res->start - offset;
314 region->end = res->end - offset;
315}
316
317void __devinit
318pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
319 struct pci_bus_region *region)
320{
321 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
322 unsigned long offset = 0;
323
324 if (res->flags & IORESOURCE_IO)
325 offset = hose->io_offset;
326 else if (res->flags & IORESOURCE_MEM)
327 offset = hose->mem_offset;
328
329 res->start = region->start + offset;
330 res->end = region->end + offset;
331}
332
333#ifdef CONFIG_HOTPLUG 267#ifdef CONFIG_HOTPLUG
334EXPORT_SYMBOL(pcibios_resource_to_bus);
335EXPORT_SYMBOL(pcibios_bus_to_resource);
336EXPORT_SYMBOL(PCIBIOS_MIN_IO); 268EXPORT_SYMBOL(PCIBIOS_MIN_IO);
337EXPORT_SYMBOL(PCIBIOS_MIN_MEM); 269EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
338#endif 270#endif
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 8f1c40d5817..3aa3de01715 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -5,6 +5,7 @@ config MN10300
5 select GENERIC_IRQ_SHOW 5 select GENERIC_IRQ_SHOW
6 select HAVE_ARCH_TRACEHOOK 6 select HAVE_ARCH_TRACEHOOK
7 select HAVE_ARCH_KGDB 7 select HAVE_ARCH_KGDB
8 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER
8 9
9config AM33_2 10config AM33_2
10 def_bool n 11 def_bool n
diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h
index 6095a28561d..8137c25c4e1 100644
--- a/arch/mn10300/include/asm/pci.h
+++ b/arch/mn10300/include/asm/pci.h
@@ -85,22 +85,6 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
85/* implement the pci_ DMA API in terms of the generic device dma_ one */ 85/* implement the pci_ DMA API in terms of the generic device dma_ one */
86#include <asm-generic/pci-dma-compat.h> 86#include <asm-generic/pci-dma-compat.h>
87 87
88/**
89 * pcibios_resource_to_bus - convert resource to PCI bus address
90 * @dev: device which owns this resource
91 * @region: converted bus-centric region (start,end)
92 * @res: resource to convert
93 *
94 * Convert a resource to a PCI device bus address or bus window.
95 */
96extern void pcibios_resource_to_bus(struct pci_dev *dev,
97 struct pci_bus_region *region,
98 struct resource *res);
99
100extern void pcibios_bus_to_resource(struct pci_dev *dev,
101 struct resource *res,
102 struct pci_bus_region *region);
103
104static inline struct resource * 88static inline struct resource *
105pcibios_select_root(struct pci_dev *pdev, struct resource *res) 89pcibios_select_root(struct pci_dev *pdev, struct resource *res)
106{ 90{
diff --git a/arch/mn10300/include/asm/reset-regs.h b/arch/mn10300/include/asm/reset-regs.h
index 10c7502a113..8ca2a42d365 100644
--- a/arch/mn10300/include/asm/reset-regs.h
+++ b/arch/mn10300/include/asm/reset-regs.h
@@ -17,10 +17,6 @@
17 17
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19 19
20#ifdef CONFIG_MN10300_WD_TIMER
21#define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */
22#endif
23
24/* 20/*
25 * watchdog timer registers 21 * watchdog timer registers
26 */ 22 */
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index a7c5f08ca9f..6dce9fc2cf3 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -32,8 +32,7 @@ struct pci_ops *pci_root_ops;
32 * insert specific PCI bus resources instead of using the platform-level bus 32 * insert specific PCI bus resources instead of using the platform-level bus
33 * resources directly for the PCI root bus. 33 * resources directly for the PCI root bus.
34 * 34 *
35 * These are configured and inserted by pcibios_init() and are attached to the 35 * These are configured and inserted by pcibios_init().
36 * root bus by pcibios_fixup_bus().
37 */ 36 */
38static struct resource pci_ioport_resource = { 37static struct resource pci_ioport_resource = {
39 .name = "PCI IO", 38 .name = "PCI IO",
@@ -78,52 +77,6 @@ static inline int __query(const struct pci_bus *bus, unsigned int devfn)
78} 77}
79 78
80/* 79/*
81 * translate Linuxcentric addresses to PCI bus addresses
82 */
83void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
84 struct resource *res)
85{
86 if (res->flags & IORESOURCE_IO) {
87 region->start = (res->start & 0x00ffffff);
88 region->end = (res->end & 0x00ffffff);
89 }
90
91 if (res->flags & IORESOURCE_MEM) {
92 region->start = (res->start & 0x03ffffff) | MEM_PAGING_REG;
93 region->end = (res->end & 0x03ffffff) | MEM_PAGING_REG;
94 }
95
96#if 0
97 printk(KERN_DEBUG "RES->BUS: %lx-%lx => %lx-%lx\n",
98 res->start, res->end, region->start, region->end);
99#endif
100}
101EXPORT_SYMBOL(pcibios_resource_to_bus);
102
103/*
104 * translate PCI bus addresses to Linuxcentric addresses
105 */
106void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
107 struct pci_bus_region *region)
108{
109 if (res->flags & IORESOURCE_IO) {
110 res->start = (region->start & 0x00ffffff) | 0xbe000000;
111 res->end = (region->end & 0x00ffffff) | 0xbe000000;
112 }
113
114 if (res->flags & IORESOURCE_MEM) {
115 res->start = (region->start & 0x03ffffff) | 0xb8000000;
116 res->end = (region->end & 0x03ffffff) | 0xb8000000;
117 }
118
119#if 0
120 printk(KERN_INFO "BUS->RES: %lx-%lx => %lx-%lx\n",
121 region->start, region->end, res->start, res->end);
122#endif
123}
124EXPORT_SYMBOL(pcibios_bus_to_resource);
125
126/*
127 * 80 *
128 */ 81 */
129static int pci_ampci_read_config_byte(struct pci_bus *bus, unsigned int devfn, 82static int pci_ampci_read_config_byte(struct pci_bus *bus, unsigned int devfn,
@@ -364,9 +317,6 @@ static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
364 if (!dev->resource[i].flags) 317 if (!dev->resource[i].flags)
365 continue; 318 continue;
366 319
367 region.start = dev->resource[i].start;
368 region.end = dev->resource[i].end;
369 pcibios_bus_to_resource(dev, &dev->resource[i], &region);
370 if (is_valid_resource(dev, i)) 320 if (is_valid_resource(dev, i))
371 pci_claim_resource(dev, i); 321 pci_claim_resource(dev, i);
372 } 322 }
@@ -397,6 +347,7 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
397 */ 347 */
398static int __init pcibios_init(void) 348static int __init pcibios_init(void)
399{ 349{
350 resource_size_t io_offset, mem_offset;
400 LIST_HEAD(resources); 351 LIST_HEAD(resources);
401 352
402 ioport_resource.start = 0xA0000000; 353 ioport_resource.start = 0xA0000000;
@@ -420,8 +371,13 @@ static int __init pcibios_init(void)
420 printk(KERN_INFO "PCI: Probing PCI hardware [mempage %08x]\n", 371 printk(KERN_INFO "PCI: Probing PCI hardware [mempage %08x]\n",
421 MEM_PAGING_REG); 372 MEM_PAGING_REG);
422 373
423 pci_add_resource(&resources, &pci_ioport_resource); 374 io_offset = pci_ioport_resource.start -
424 pci_add_resource(&resources, &pci_iomem_resource); 375 (pci_ioport_resource.start & 0x00ffffff);
376 mem_offset = pci_iomem_resource.start -
377 ((pci_iomem_resource.start & 0x03ffffff) | MEM_PAGING_REG);
378
379 pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset);
380 pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset);
425 pci_root_bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, 381 pci_root_bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL,
426 &resources); 382 &resources);
427 383
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index bc428b5f126..a4787197d8f 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -16,6 +16,7 @@ config OPENRISC
16 select GENERIC_IRQ_SHOW 16 select GENERIC_IRQ_SHOW
17 select GENERIC_IOMAP 17 select GENERIC_IOMAP
18 select GENERIC_CPU_DEVICES 18 select GENERIC_CPU_DEVICES
19 select GENERIC_ATOMIC64
19 20
20config MMU 21config MMU
21 def_bool y 22 def_bool y
diff --git a/arch/openrisc/include/asm/page.h b/arch/openrisc/include/asm/page.h
index b041b344b22..108906f991d 100644
--- a/arch/openrisc/include/asm/page.h
+++ b/arch/openrisc/include/asm/page.h
@@ -71,9 +71,6 @@ typedef struct page *pgtable_t;
71#define __pgd(x) ((pgd_t) { (x) }) 71#define __pgd(x) ((pgd_t) { (x) })
72#define __pgprot(x) ((pgprot_t) { (x) }) 72#define __pgprot(x) ((pgprot_t) { (x) })
73 73
74extern unsigned long memory_start;
75extern unsigned long memory_end;
76
77#endif /* !__ASSEMBLY__ */ 74#endif /* !__ASSEMBLY__ */
78 75
79 76
@@ -94,8 +91,7 @@ extern unsigned long memory_end;
94 91
95#define pfn_valid(pfn) ((pfn) < max_mapnr) 92#define pfn_valid(pfn) ((pfn) < max_mapnr)
96 93
97#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ 94#define virt_addr_valid(kaddr) (pfn_valid(virt_to_pfn(kaddr)))
98 ((void *)(kaddr) < (void *)memory_end))
99 95
100#endif /* __ASSEMBLY__ */ 96#endif /* __ASSEMBLY__ */
101 97
diff --git a/arch/openrisc/include/asm/pgtable.h b/arch/openrisc/include/asm/pgtable.h
index 043505d7f68..14c900cfd30 100644
--- a/arch/openrisc/include/asm/pgtable.h
+++ b/arch/openrisc/include/asm/pgtable.h
@@ -455,7 +455,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
455 * No page table caches to initialise 455 * No page table caches to initialise
456 */ 456 */
457#define pgtable_cache_init() do { } while (0) 457#define pgtable_cache_init() do { } while (0)
458#define io_remap_page_range remap_page_range
459 458
460typedef pte_t *pte_addr_t; 459typedef pte_t *pte_addr_t;
461 460
diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h
index bb54c97b978..f7516fa78b5 100644
--- a/arch/openrisc/include/asm/processor.h
+++ b/arch/openrisc/include/asm/processor.h
@@ -81,8 +81,8 @@ extern inline void prepare_to_copy(struct task_struct *tsk)
81#define INIT_THREAD { } 81#define INIT_THREAD { }
82 82
83 83
84#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc); 84#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
85#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp); 85#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp)
86 86
87 87
88extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); 88extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
diff --git a/arch/openrisc/include/asm/ptrace.h b/arch/openrisc/include/asm/ptrace.h
index e612ce4512c..4651a737591 100644
--- a/arch/openrisc/include/asm/ptrace.h
+++ b/arch/openrisc/include/asm/ptrace.h
@@ -73,9 +73,13 @@ struct pt_regs {
73 }; 73 };
74 }; 74 };
75 long pc; 75 long pc;
76 /* For restarting system calls:
77 * Set to syscall number for syscall exceptions,
78 * -1 for all other exceptions.
79 */
76 long orig_gpr11; /* For restarting system calls */ 80 long orig_gpr11; /* For restarting system calls */
77 long syscallno; /* Syscall number (used by strace) */
78 long dummy; /* Cheap alignment fix */ 81 long dummy; /* Cheap alignment fix */
82 long dummy2; /* Cheap alignment fix */
79}; 83};
80 84
81/* TODO: Rename this to REDZONE because that's what it is */ 85/* TODO: Rename this to REDZONE because that's what it is */
diff --git a/arch/openrisc/include/asm/syscall.h b/arch/openrisc/include/asm/syscall.h
index 9f0337055d2..b752bb67891 100644
--- a/arch/openrisc/include/asm/syscall.h
+++ b/arch/openrisc/include/asm/syscall.h
@@ -25,7 +25,7 @@
25static inline int 25static inline int
26syscall_get_nr(struct task_struct *task, struct pt_regs *regs) 26syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
27{ 27{
28 return regs->syscallno ? regs->syscallno : -1; 28 return regs->orig_gpr11;
29} 29}
30 30
31static inline void 31static inline void
@@ -50,10 +50,7 @@ static inline void
50syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, 50syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
51 int error, long val) 51 int error, long val)
52{ 52{
53 if (error) 53 regs->gpr[11] = (long) error ?: val;
54 regs->gpr[11] = -error;
55 else
56 regs->gpr[11] = val;
57} 54}
58 55
59static inline void 56static inline void
diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h
index c310e45b538..f5abaa0ffc3 100644
--- a/arch/openrisc/include/asm/uaccess.h
+++ b/arch/openrisc/include/asm/uaccess.h
@@ -26,7 +26,6 @@
26#include <linux/thread_info.h> 26#include <linux/thread_info.h>
27#include <linux/prefetch.h> 27#include <linux/prefetch.h>
28#include <linux/string.h> 28#include <linux/string.h>
29#include <linux/thread_info.h>
30#include <asm/page.h> 29#include <asm/page.h>
31 30
32#define VERIFY_READ 0 31#define VERIFY_READ 0
diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
index d5f9c35a583..6e61af8682b 100644
--- a/arch/openrisc/kernel/entry.S
+++ b/arch/openrisc/kernel/entry.S
@@ -95,7 +95,6 @@ handler: ;\
95 /* r1, EPCR, ESR a already saved */ ;\ 95 /* r1, EPCR, ESR a already saved */ ;\
96 l.sw PT_GPR2(r1),r2 ;\ 96 l.sw PT_GPR2(r1),r2 ;\
97 l.sw PT_GPR3(r1),r3 ;\ 97 l.sw PT_GPR3(r1),r3 ;\
98 l.sw PT_ORIG_GPR11(r1),r11 ;\
99 /* r4 already save */ ;\ 98 /* r4 already save */ ;\
100 l.sw PT_GPR5(r1),r5 ;\ 99 l.sw PT_GPR5(r1),r5 ;\
101 l.sw PT_GPR6(r1),r6 ;\ 100 l.sw PT_GPR6(r1),r6 ;\
@@ -125,7 +124,9 @@ handler: ;\
125 /* r30 already save */ ;\ 124 /* r30 already save */ ;\
126/* l.sw PT_GPR30(r1),r30*/ ;\ 125/* l.sw PT_GPR30(r1),r30*/ ;\
127 l.sw PT_GPR31(r1),r31 ;\ 126 l.sw PT_GPR31(r1),r31 ;\
128 l.sw PT_SYSCALLNO(r1),r0 127 /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\
128 l.addi r30,r0,-1 ;\
129 l.sw PT_ORIG_GPR11(r1),r30
129 130
130#define UNHANDLED_EXCEPTION(handler,vector) \ 131#define UNHANDLED_EXCEPTION(handler,vector) \
131 .global handler ;\ 132 .global handler ;\
@@ -133,7 +134,6 @@ handler: ;\
133 /* r1, EPCR, ESR already saved */ ;\ 134 /* r1, EPCR, ESR already saved */ ;\
134 l.sw PT_GPR2(r1),r2 ;\ 135 l.sw PT_GPR2(r1),r2 ;\
135 l.sw PT_GPR3(r1),r3 ;\ 136 l.sw PT_GPR3(r1),r3 ;\
136 l.sw PT_ORIG_GPR11(r1),r11 ;\
137 l.sw PT_GPR5(r1),r5 ;\ 137 l.sw PT_GPR5(r1),r5 ;\
138 l.sw PT_GPR6(r1),r6 ;\ 138 l.sw PT_GPR6(r1),r6 ;\
139 l.sw PT_GPR7(r1),r7 ;\ 139 l.sw PT_GPR7(r1),r7 ;\
@@ -162,7 +162,9 @@ handler: ;\
162 /* r31 already saved */ ;\ 162 /* r31 already saved */ ;\
163 l.sw PT_GPR30(r1),r30 ;\ 163 l.sw PT_GPR30(r1),r30 ;\
164/* l.sw PT_GPR31(r1),r31 */ ;\ 164/* l.sw PT_GPR31(r1),r31 */ ;\
165 l.sw PT_SYSCALLNO(r1),r0 ;\ 165 /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\
166 l.addi r30,r0,-1 ;\
167 l.sw PT_ORIG_GPR11(r1),r30 ;\
166 l.addi r3,r1,0 ;\ 168 l.addi r3,r1,0 ;\
167 /* r4 is exception EA */ ;\ 169 /* r4 is exception EA */ ;\
168 l.addi r5,r0,vector ;\ 170 l.addi r5,r0,vector ;\
@@ -554,6 +556,7 @@ ENTRY(_sys_call_handler)
554 l.sw PT_GPR9(r1),r9 556 l.sw PT_GPR9(r1),r9
555 /* r10 already saved */ 557 /* r10 already saved */
556 l.sw PT_GPR11(r1),r11 558 l.sw PT_GPR11(r1),r11
559 /* orig_gpr11 must be set for syscalls */
557 l.sw PT_ORIG_GPR11(r1),r11 560 l.sw PT_ORIG_GPR11(r1),r11
558 /* r12,r13 already saved */ 561 /* r12,r13 already saved */
559 562
@@ -567,9 +570,6 @@ ENTRY(_sys_call_handler)
567 /* r30 is the only register we clobber in the fast path */ 570 /* r30 is the only register we clobber in the fast path */
568 /* r30 already saved */ 571 /* r30 already saved */
569/* l.sw PT_GPR30(r1),r30 */ 572/* l.sw PT_GPR30(r1),r30 */
570 /* This is used by do_signal to determine whether to check for
571 * syscall restart or not */
572 l.sw PT_SYSCALLNO(r1),r11
573 573
574_syscall_check_trace_enter: 574_syscall_check_trace_enter:
575 /* If TIF_SYSCALL_TRACE is set, then we want to do syscall tracing */ 575 /* If TIF_SYSCALL_TRACE is set, then we want to do syscall tracing */
@@ -731,7 +731,7 @@ _syscall_trace_enter:
731 * so that we can do the syscall for real and return to the syscall 731 * so that we can do the syscall for real and return to the syscall
732 * hot path. 732 * hot path.
733 */ 733 */
734 l.lwz r11,PT_SYSCALLNO(r1) 734 l.lwz r11,PT_GPR11(r1)
735 l.lwz r3,PT_GPR3(r1) 735 l.lwz r3,PT_GPR3(r1)
736 l.lwz r4,PT_GPR4(r1) 736 l.lwz r4,PT_GPR4(r1)
737 l.lwz r5,PT_GPR5(r1) 737 l.lwz r5,PT_GPR5(r1)
diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S
index c75018d2264..1088b5fca3b 100644
--- a/arch/openrisc/kernel/head.S
+++ b/arch/openrisc/kernel/head.S
@@ -26,6 +26,7 @@
26#include <asm/cache.h> 26#include <asm/cache.h>
27#include <asm/spr_defs.h> 27#include <asm/spr_defs.h>
28#include <asm/asm-offsets.h> 28#include <asm/asm-offsets.h>
29#include <linux/of_fdt.h>
29 30
30#define tophys(rd,rs) \ 31#define tophys(rd,rs) \
31 l.movhi rd,hi(-KERNELBASE) ;\ 32 l.movhi rd,hi(-KERNELBASE) ;\
@@ -440,6 +441,9 @@ _dispatch_do_ipage_fault:
440 __HEAD 441 __HEAD
441 .global _start 442 .global _start
442_start: 443_start:
444 /* save kernel parameters */
445 l.or r25,r0,r3 /* pointer to fdt */
446
443 /* 447 /*
444 * ensure a deterministic start 448 * ensure a deterministic start
445 */ 449 */
@@ -471,7 +475,6 @@ _start:
471 CLEAR_GPR(r22) 475 CLEAR_GPR(r22)
472 CLEAR_GPR(r23) 476 CLEAR_GPR(r23)
473 CLEAR_GPR(r24) 477 CLEAR_GPR(r24)
474 CLEAR_GPR(r25)
475 CLEAR_GPR(r26) 478 CLEAR_GPR(r26)
476 CLEAR_GPR(r27) 479 CLEAR_GPR(r27)
477 CLEAR_GPR(r28) 480 CLEAR_GPR(r28)
@@ -565,6 +568,18 @@ enable_mmu:
565 // reset the simulation counters 568 // reset the simulation counters
566 l.nop 5 569 l.nop 5
567 570
571 /* check fdt header magic word */
572 l.lwz r3,0(r25) /* load magic from fdt into r3 */
573 l.movhi r4,hi(OF_DT_HEADER)
574 l.ori r4,r4,lo(OF_DT_HEADER)
575 l.sfeq r3,r4
576 l.bf _fdt_found
577 l.nop
578 /* magic number mismatch, set fdt pointer to null */
579 l.or r25,r0,r0
580_fdt_found:
581 /* pass fdt pointer to or32_early_setup in r3 */
582 l.or r3,r0,r25
568 LOAD_SYMBOL_2_GPR(r24, or32_early_setup) 583 LOAD_SYMBOL_2_GPR(r24, or32_early_setup)
569 l.jalr r24 584 l.jalr r24
570 l.nop 585 l.nop
diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c
index 7259047d5f9..6deacb6b95a 100644
--- a/arch/openrisc/kernel/ptrace.c
+++ b/arch/openrisc/kernel/ptrace.c
@@ -188,11 +188,11 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
188 */ 188 */
189 ret = -1L; 189 ret = -1L;
190 190
191 audit_syscall_entry(audit_arch(), regs->syscallno, 191 audit_syscall_entry(audit_arch(), regs->gpr[11],
192 regs->gpr[3], regs->gpr[4], 192 regs->gpr[3], regs->gpr[4],
193 regs->gpr[5], regs->gpr[6]); 193 regs->gpr[5], regs->gpr[6]);
194 194
195 return ret ? : regs->syscallno; 195 return ret ? : regs->gpr[11];
196} 196}
197 197
198asmlinkage void do_syscall_trace_leave(struct pt_regs *regs) 198asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index 1422f747f52..bf5eba22ce9 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -207,18 +207,18 @@ void __init setup_cpuinfo(void)
207 * Handles the pointer to the device tree that this kernel is to use 207 * Handles the pointer to the device tree that this kernel is to use
208 * for establishing the available platform devices. 208 * for establishing the available platform devices.
209 * 209 *
210 * For now, this is limited to using the built-in device tree. In the future, 210 * Falls back on built-in device tree in case null pointer is passed.
211 * it is intended that this function will take a pointer to the device tree
212 * that is potentially built-in, but potentially also passed in by the
213 * bootloader, or discovered by some equally clever means...
214 */ 211 */
215 212
216void __init or32_early_setup(void) 213void __init or32_early_setup(unsigned int fdt)
217{ 214{
218 215 if (fdt) {
219 early_init_devtree(__dtb_start); 216 early_init_devtree((void*) fdt);
220 217 printk(KERN_INFO "FDT at 0x%08x\n", fdt);
221 printk(KERN_INFO "Compiled-in FDT at 0x%p\n", __dtb_start); 218 } else {
219 early_init_devtree(__dtb_start);
220 printk(KERN_INFO "Compiled-in FDT at %p\n", __dtb_start);
221 }
222} 222}
223 223
224static int __init openrisc_device_probe(void) 224static int __init openrisc_device_probe(void)
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index 95207ab0c99..e970743251a 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -102,10 +102,7 @@ asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs)
102 goto badframe; 102 goto badframe;
103 103
104 sigdelsetmask(&set, ~_BLOCKABLE); 104 sigdelsetmask(&set, ~_BLOCKABLE);
105 spin_lock_irq(&current->sighand->siglock); 105 set_current_blocked(&set);
106 current->blocked = set;
107 recalc_sigpending();
108 spin_unlock_irq(&current->sighand->siglock);
109 106
110 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 107 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
111 goto badframe; 108 goto badframe;
@@ -189,8 +186,8 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
189 * trampoline which performs the syscall sigreturn, or a provided 186 * trampoline which performs the syscall sigreturn, or a provided
190 * user-mode trampoline. 187 * user-mode trampoline.
191 */ 188 */
192static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 189static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
193 sigset_t *set, struct pt_regs *regs) 190 sigset_t *set, struct pt_regs *regs)
194{ 191{
195 struct rt_sigframe *frame; 192 struct rt_sigframe *frame;
196 unsigned long return_ip; 193 unsigned long return_ip;
@@ -247,31 +244,27 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
247 /* actually move the usp to reflect the stacked frame */ 244 /* actually move the usp to reflect the stacked frame */
248 regs->sp = (unsigned long)frame; 245 regs->sp = (unsigned long)frame;
249 246
250 return; 247 return 0;
251 248
252give_sigsegv: 249give_sigsegv:
253 if (sig == SIGSEGV) 250 force_sigsegv(sig, current);
254 ka->sa.sa_handler = SIG_DFL; 251 return -EFAULT;
255 force_sig(SIGSEGV, current);
256} 252}
257 253
258static inline void 254static inline int
259handle_signal(unsigned long sig, 255handle_signal(unsigned long sig,
260 siginfo_t *info, struct k_sigaction *ka, 256 siginfo_t *info, struct k_sigaction *ka,
261 sigset_t *oldset, struct pt_regs *regs) 257 sigset_t *oldset, struct pt_regs *regs)
262{ 258{
263 setup_rt_frame(sig, ka, info, oldset, regs); 259 int ret;
264 260
265 if (ka->sa.sa_flags & SA_ONESHOT) 261 ret = setup_rt_frame(sig, ka, info, oldset, regs);
266 ka->sa.sa_handler = SIG_DFL; 262 if (ret)
263 return ret;
267 264
268 spin_lock_irq(&current->sighand->siglock); 265 block_sigmask(ka, sig);
269 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
270 if (!(ka->sa.sa_flags & SA_NODEFER))
271 sigaddset(&current->blocked, sig);
272 recalc_sigpending();
273 266
274 spin_unlock_irq(&current->sighand->siglock); 267 return 0;
275} 268}
276 269
277/* 270/*
@@ -312,7 +305,7 @@ void do_signal(struct pt_regs *regs)
312 * below mean that the syscall executed to completion and no 305 * below mean that the syscall executed to completion and no
313 * restart is necessary. 306 * restart is necessary.
314 */ 307 */
315 if (regs->syscallno) { 308 if (regs->orig_gpr11) {
316 int restart = 0; 309 int restart = 0;
317 310
318 switch (regs->gpr[11]) { 311 switch (regs->gpr[11]) {
@@ -360,13 +353,13 @@ void do_signal(struct pt_regs *regs)
360 oldset = &current->blocked; 353 oldset = &current->blocked;
361 354
362 /* Whee! Actually deliver the signal. */ 355 /* Whee! Actually deliver the signal. */
363 handle_signal(signr, &info, &ka, oldset, regs); 356 if (!handle_signal(signr, &info, &ka, oldset, regs)) {
364 /* a signal was successfully delivered; the saved 357 /* a signal was successfully delivered; the saved
365 * sigmask will have been stored in the signal frame, 358 * sigmask will have been stored in the signal frame,
366 * and will be restored by sigreturn, so we can simply 359 * and will be restored by sigreturn, so we can simply
367 * clear the TIF_RESTORE_SIGMASK flag */ 360 * clear the TIF_RESTORE_SIGMASK flag */
368 if (test_thread_flag(TIF_RESTORE_SIGMASK))
369 clear_thread_flag(TIF_RESTORE_SIGMASK); 361 clear_thread_flag(TIF_RESTORE_SIGMASK);
362 }
370 363
371 tracehook_signal_handler(signr, &info, &ka, regs, 364 tracehook_signal_handler(signr, &info, &ka, regs,
372 test_thread_flag(TIF_SINGLESTEP)); 365 test_thread_flag(TIF_SINGLESTEP));
diff --git a/arch/openrisc/kernel/time.c b/arch/openrisc/kernel/time.c
index bd946ef1623..7c52e9494a8 100644
--- a/arch/openrisc/kernel/time.c
+++ b/arch/openrisc/kernel/time.c
@@ -125,16 +125,13 @@ irqreturn_t __irq_entry timer_interrupt(struct pt_regs *regs)
125 125
126static __init void openrisc_clockevent_init(void) 126static __init void openrisc_clockevent_init(void)
127{ 127{
128 clockevents_calc_mult_shift(&clockevent_openrisc_timer, 128 clockevent_openrisc_timer.cpumask = cpumask_of(0);
129 cpuinfo.clock_frequency, 4);
130 129
131 /* We only have 28 bits */ 130 /* We only have 28 bits */
132 clockevent_openrisc_timer.max_delta_ns = 131 clockevents_config_and_register(&clockevent_openrisc_timer,
133 clockevent_delta2ns((u32) 0x0fffffff, &clockevent_openrisc_timer); 132 cpuinfo.clock_frequency,
134 clockevent_openrisc_timer.min_delta_ns = 133 100, 0x0fffffff);
135 clockevent_delta2ns(1, &clockevent_openrisc_timer); 134
136 clockevent_openrisc_timer.cpumask = cpumask_of(0);
137 clockevents_register_device(&clockevent_openrisc_timer);
138} 135}
139 136
140/** 137/**
diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c
index a4ec44a052b..a2ee12948f4 100644
--- a/arch/openrisc/kernel/traps.c
+++ b/arch/openrisc/kernel/traps.c
@@ -115,6 +115,7 @@ void dump_stack(void)
115 115
116 show_stack(current, &stack); 116 show_stack(current, &stack);
117} 117}
118EXPORT_SYMBOL(dump_stack);
118 119
119void show_registers(struct pt_regs *regs) 120void show_registers(struct pt_regs *regs)
120{ 121{
@@ -145,8 +146,8 @@ void show_registers(struct pt_regs *regs)
145 regs->gpr[24], regs->gpr[25], regs->gpr[26], regs->gpr[27]); 146 regs->gpr[24], regs->gpr[25], regs->gpr[26], regs->gpr[27]);
146 printk("GPR28: %08lx GPR29: %08lx GPR30: %08lx GPR31: %08lx\n", 147 printk("GPR28: %08lx GPR29: %08lx GPR30: %08lx GPR31: %08lx\n",
147 regs->gpr[28], regs->gpr[29], regs->gpr[30], regs->gpr[31]); 148 regs->gpr[28], regs->gpr[29], regs->gpr[30], regs->gpr[31]);
148 printk(" RES: %08lx oGPR11: %08lx syscallno: %08lx\n", 149 printk(" RES: %08lx oGPR11: %08lx\n",
149 regs->gpr[11], regs->orig_gpr11, regs->syscallno); 150 regs->gpr[11], regs->orig_gpr11);
150 151
151 printk("Process %s (pid: %d, stackpage=%08lx)\n", 152 printk("Process %s (pid: %d, stackpage=%08lx)\n",
152 current->comm, current->pid, (unsigned long)current); 153 current->comm, current->pid, (unsigned long)current);
@@ -207,8 +208,8 @@ void nommu_dump_state(struct pt_regs *regs,
207 regs->gpr[24], regs->gpr[25], regs->gpr[26], regs->gpr[27]); 208 regs->gpr[24], regs->gpr[25], regs->gpr[26], regs->gpr[27]);
208 printk("GPR28: %08lx GPR29: %08lx GPR30: %08lx GPR31: %08lx\n", 209 printk("GPR28: %08lx GPR29: %08lx GPR30: %08lx GPR31: %08lx\n",
209 regs->gpr[28], regs->gpr[29], regs->gpr[30], regs->gpr[31]); 210 regs->gpr[28], regs->gpr[29], regs->gpr[30], regs->gpr[31]);
210 printk(" RES: %08lx oGPR11: %08lx syscallno: %08lx\n", 211 printk(" RES: %08lx oGPR11: %08lx\n",
211 regs->gpr[11], regs->orig_gpr11, regs->syscallno); 212 regs->gpr[11], regs->orig_gpr11);
212 213
213 printk("Process %s (pid: %d, stackpage=%08lx)\n", 214 printk("Process %s (pid: %d, stackpage=%08lx)\n",
214 ((struct task_struct *)(__pa(current)))->comm, 215 ((struct task_struct *)(__pa(current)))->comm,
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
index 359dcb20fe8..736f6b2f30a 100644
--- a/arch/openrisc/mm/init.c
+++ b/arch/openrisc/mm/init.c
@@ -222,8 +222,7 @@ void __init mem_init(void)
222{ 222{
223 int codesize, reservedpages, datasize, initsize; 223 int codesize, reservedpages, datasize, initsize;
224 224
225 if (!mem_map) 225 BUG_ON(!mem_map);
226 BUG();
227 226
228 set_max_mapnr_init(); 227 set_max_mapnr_init();
229 228
diff --git a/arch/parisc/include/asm/mman.h b/arch/parisc/include/asm/mman.h
index f5b7bf5fba6..12219ebce86 100644
--- a/arch/parisc/include/asm/mman.h
+++ b/arch/parisc/include/asm/mman.h
@@ -62,6 +62,10 @@
62#define MADV_HUGEPAGE 67 /* Worth backing with hugepages */ 62#define MADV_HUGEPAGE 67 /* Worth backing with hugepages */
63#define MADV_NOHUGEPAGE 68 /* Not worth backing with hugepages */ 63#define MADV_NOHUGEPAGE 68 /* Not worth backing with hugepages */
64 64
65#define MADV_DONTDUMP 69 /* Explicity exclude from the core dump,
66 overrides the coredump filter bits */
67#define MADV_DODUMP 70 /* Clear the MADV_NODUMP flag */
68
65/* compatibility flags */ 69/* compatibility flags */
66#define MAP_FILE 0 70#define MAP_FILE 0
67#define MAP_VARIABLE 0 71#define MAP_VARIABLE 0
diff --git a/arch/parisc/include/asm/pci.h b/arch/parisc/include/asm/pci.h
index 2242a5c636c..3234f492d57 100644
--- a/arch/parisc/include/asm/pci.h
+++ b/arch/parisc/include/asm/pci.h
@@ -82,38 +82,8 @@ struct pci_hba_data {
82 82
83#ifdef CONFIG_64BIT 83#ifdef CONFIG_64BIT
84#define PCI_F_EXTEND 0xffffffff00000000UL 84#define PCI_F_EXTEND 0xffffffff00000000UL
85#define PCI_IS_LMMIO(hba,a) pci_is_lmmio(hba,a)
86
87/* We need to know if an address is LMMMIO or GMMIO.
88 * LMMIO requires mangling and GMMIO we must use as-is.
89 */
90static __inline__ int pci_is_lmmio(struct pci_hba_data *hba, unsigned long a)
91{
92 return(((a) & PCI_F_EXTEND) == PCI_F_EXTEND);
93}
94
95/*
96** Convert between PCI (IO_VIEW) addresses and processor (PA_VIEW) addresses.
97** See pci.c for more conversions used by Generic PCI code.
98**
99** Platform characteristics/firmware guarantee that
100** (1) PA_VIEW - IO_VIEW = lmmio_offset for both LMMIO and ELMMIO
101** (2) PA_VIEW == IO_VIEW for GMMIO
102*/
103#define PCI_BUS_ADDR(hba,a) (PCI_IS_LMMIO(hba,a) \
104 ? ((a) - hba->lmmio_space_offset) /* mangle LMMIO */ \
105 : (a)) /* GMMIO */
106#define PCI_HOST_ADDR(hba,a) (((a) & PCI_F_EXTEND) == 0 \
107 ? (a) + hba->lmmio_space_offset \
108 : (a))
109
110#else /* !CONFIG_64BIT */ 85#else /* !CONFIG_64BIT */
111
112#define PCI_BUS_ADDR(hba,a) (a)
113#define PCI_HOST_ADDR(hba,a) (a)
114#define PCI_F_EXTEND 0UL 86#define PCI_F_EXTEND 0UL
115#define PCI_IS_LMMIO(hba,a) (1) /* 32-bit doesn't support GMMIO */
116
117#endif /* !CONFIG_64BIT */ 87#endif /* !CONFIG_64BIT */
118 88
119/* 89/*
@@ -245,14 +215,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
245} 215}
246#endif 216#endif
247 217
248extern void
249pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
250 struct resource *res);
251
252extern void
253pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
254 struct pci_bus_region *region);
255
256static inline void pcibios_penalize_isa_irq(int irq, int active) 218static inline void pcibios_penalize_isa_irq(int irq, int active)
257{ 219{
258 /* We don't need to penalize isa irq's */ 220 /* We don't need to penalize isa irq's */
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index 9efd9740531..74d544b1cd2 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -195,58 +195,6 @@ void __init pcibios_init_bus(struct pci_bus *bus)
195 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, bridge_ctl); 195 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, bridge_ctl);
196} 196}
197 197
198/* called by drivers/pci/setup-bus.c:pci_setup_bridge(). */
199void __devinit pcibios_resource_to_bus(struct pci_dev *dev,
200 struct pci_bus_region *region, struct resource *res)
201{
202#ifdef CONFIG_64BIT
203 struct pci_hba_data *hba = HBA_DATA(dev->bus->bridge->platform_data);
204#endif
205
206 if (res->flags & IORESOURCE_IO) {
207 /*
208 ** I/O space may see busnumbers here. Something
209 ** in the form of 0xbbxxxx where bb is the bus num
210 ** and xxxx is the I/O port space address.
211 ** Remaining address translation are done in the
212 ** PCI Host adapter specific code - ie dino_out8.
213 */
214 region->start = PCI_PORT_ADDR(res->start);
215 region->end = PCI_PORT_ADDR(res->end);
216 } else if (res->flags & IORESOURCE_MEM) {
217 /* Convert MMIO addr to PCI addr (undo global virtualization) */
218 region->start = PCI_BUS_ADDR(hba, res->start);
219 region->end = PCI_BUS_ADDR(hba, res->end);
220 }
221
222 DBG_RES("pcibios_resource_to_bus(%02x %s [%lx,%lx])\n",
223 dev->bus->number, res->flags & IORESOURCE_IO ? "IO" : "MEM",
224 region->start, region->end);
225}
226
227void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
228 struct pci_bus_region *region)
229{
230#ifdef CONFIG_64BIT
231 struct pci_hba_data *hba = HBA_DATA(dev->bus->bridge->platform_data);
232#endif
233
234 if (res->flags & IORESOURCE_MEM) {
235 res->start = PCI_HOST_ADDR(hba, region->start);
236 res->end = PCI_HOST_ADDR(hba, region->end);
237 }
238
239 if (res->flags & IORESOURCE_IO) {
240 res->start = region->start;
241 res->end = region->end;
242 }
243}
244
245#ifdef CONFIG_HOTPLUG
246EXPORT_SYMBOL(pcibios_resource_to_bus);
247EXPORT_SYMBOL(pcibios_bus_to_resource);
248#endif
249
250/* 198/*
251 * pcibios align resources() is called every time generic PCI code 199 * pcibios align resources() is called every time generic PCI code
252 * wants to generate a new address. The process of looking for 200 * wants to generate a new address. The process of looking for
diff --git a/arch/parisc/math-emu/fpudispatch.c b/arch/parisc/math-emu/fpudispatch.c
index 6e28f9f4c62..673b73e8420 100644
--- a/arch/parisc/math-emu/fpudispatch.c
+++ b/arch/parisc/math-emu/fpudispatch.c
@@ -50,6 +50,7 @@
50#define FPUDEBUG 0 50#define FPUDEBUG 0
51 51
52#include "float.h" 52#include "float.h"
53#include <linux/bug.h>
53#include <linux/kernel.h> 54#include <linux/kernel.h>
54#include <asm/processor.h> 55#include <asm/processor.h>
55/* #include <sys/debug.h> */ 56/* #include <sys/debug.h> */
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 303703d716f..d219ebecabf 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -134,6 +134,7 @@ config PPC
134 select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64 134 select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64
135 select HAVE_GENERIC_HARDIRQS 135 select HAVE_GENERIC_HARDIRQS
136 select HAVE_SPARSE_IRQ 136 select HAVE_SPARSE_IRQ
137 select SPARSE_IRQ
137 select IRQ_PER_CPU 138 select IRQ_PER_CPU
138 select IRQ_DOMAIN 139 select IRQ_DOMAIN
139 select GENERIC_IRQ_SHOW 140 select GENERIC_IRQ_SHOW
@@ -377,13 +378,16 @@ config CRASH_DUMP
377 The same kernel binary can be used as production kernel and dump 378 The same kernel binary can be used as production kernel and dump
378 capture kernel. 379 capture kernel.
379 380
380config PHYP_DUMP 381config FA_DUMP
381 bool "Hypervisor-assisted dump (EXPERIMENTAL)" 382 bool "Firmware-assisted dump"
382 depends on PPC_PSERIES && EXPERIMENTAL 383 depends on PPC64 && PPC_RTAS && CRASH_DUMP
383 help 384 help
384 Hypervisor-assisted dump is meant to be a kdump replacement 385 A robust mechanism to get reliable kernel crash dump with
385 offering robustness and speed not possible without system 386 assistance from firmware. This approach does not use kexec,
386 hypervisor assistance. 387 instead firmware assists in booting the kdump kernel
388 while preserving memory contents. Firmware-assisted dump
389 is meant to be a kdump replacement offering robustness and
390 speed not possible without system firmware assistance.
387 391
388 If unsure, say "N" 392 If unsure, say "N"
389 393
@@ -612,7 +616,7 @@ endmenu
612 616
613config ISA_DMA_API 617config ISA_DMA_API
614 bool 618 bool
615 default !PPC_ISERIES || PCI 619 default PCI
616 620
617menu "Bus options" 621menu "Bus options"
618 622
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 4ccb2a009f7..72d55dbc611 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -196,13 +196,6 @@ config PPC_EARLY_DEBUG_MAPLE
196 help 196 help
197 Select this to enable early debugging for Maple. 197 Select this to enable early debugging for Maple.
198 198
199config PPC_EARLY_DEBUG_ISERIES
200 bool "iSeries HV Console"
201 depends on PPC_ISERIES
202 help
203 Select this to enable early debugging for legacy iSeries. You need
204 to hit "Ctrl-x Ctrl-x" to see the messages on the console.
205
206config PPC_EARLY_DEBUG_PAS_REALMODE 199config PPC_EARLY_DEBUG_PAS_REALMODE
207 bool "PA Semi real mode" 200 bool "PA Semi real mode"
208 depends on PPC_PASEMI 201 depends on PPC_PASEMI
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index b8b105c01c6..6524c6e2189 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -157,6 +157,7 @@ core-y += arch/powerpc/kernel/ \
157 arch/powerpc/net/ 157 arch/powerpc/net/
158core-$(CONFIG_XMON) += arch/powerpc/xmon/ 158core-$(CONFIG_XMON) += arch/powerpc/xmon/
159core-$(CONFIG_KVM) += arch/powerpc/kvm/ 159core-$(CONFIG_KVM) += arch/powerpc/kvm/
160core-$(CONFIG_PERF_EVENTS) += arch/powerpc/perf/
160 161
161drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ 162drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
162 163
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 8844a17ce8e..e8461cb18d0 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -184,7 +184,6 @@ image-$(CONFIG_PPC_EFIKA) += zImage.chrp
184image-$(CONFIG_PPC_PMAC) += zImage.pmac 184image-$(CONFIG_PPC_PMAC) += zImage.pmac
185image-$(CONFIG_PPC_HOLLY) += dtbImage.holly 185image-$(CONFIG_PPC_HOLLY) += dtbImage.holly
186image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800 186image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800
187image-$(CONFIG_PPC_ISERIES) += zImage.iseries
188image-$(CONFIG_DEFAULT_UIMAGE) += uImage 187image-$(CONFIG_DEFAULT_UIMAGE) += uImage
189image-$(CONFIG_EPAPR_BOOT) += zImage.epapr 188image-$(CONFIG_EPAPR_BOOT) += zImage.epapr
190 189
@@ -247,7 +246,7 @@ image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot
247image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads 246image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads
248image-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads 247image-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads
249image-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \ 248image-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \
250 cuImage.mpc8548cds \ 249 cuImage.mpc8548cds_32b \
251 cuImage.mpc8555cds 250 cuImage.mpc8555cds
252image-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds 251image-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds
253image-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \ 252image-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \
@@ -311,12 +310,6 @@ $(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb
311$(obj)/vmlinux.strip: vmlinux 310$(obj)/vmlinux.strip: vmlinux
312 $(STRIP) -s -R .comment $< -o $@ 311 $(STRIP) -s -R .comment $< -o $@
313 312
314# The iseries hypervisor won't take an ET_DYN executable, so this
315# changes the type (byte 17) in the file to ET_EXEC (2).
316$(obj)/zImage.iseries: vmlinux
317 $(STRIP) -s -R .comment $< -o $@
318 printf "\x02" | dd of=$@ conv=notrunc bs=1 seek=17
319
320$(obj)/uImage: vmlinux $(wrapperbits) 313$(obj)/uImage: vmlinux $(wrapperbits)
321 $(call if_changed,wrap,uboot) 314 $(call if_changed,wrap,uboot)
322 315
@@ -364,7 +357,7 @@ install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
364# anything not in $(targets) 357# anything not in $(targets)
365clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \ 358clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
366 zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \ 359 zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
367 zImage.iseries zImage.miboot zImage.pmac zImage.pseries \ 360 zImage.miboot zImage.pmac zImage.pseries \
368 zImage.maple simpleImage.* otheros.bld *.dtb 361 zImage.maple simpleImage.* otheros.bld *.dtb
369 362
370# clean up files cached by wrapper 363# clean up files cached by wrapper
diff --git a/arch/powerpc/boot/dts/a4m072.dts b/arch/powerpc/boot/dts/a4m072.dts
new file mode 100644
index 00000000000..fabe7b7d5f1
--- /dev/null
+++ b/arch/powerpc/boot/dts/a4m072.dts
@@ -0,0 +1,168 @@
1/*
2 * a4m072 board Device Tree Source
3 *
4 * Copyright (C) 2011 DENX Software Engineering GmbH
5 * Heiko Schocher <hs@denx.de>
6 *
7 * Copyright (C) 2007 Semihalf
8 * Marian Balakowicz <m8@semihalf.com>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16/include/ "mpc5200b.dtsi"
17
18/ {
19 model = "anonymous,a4m072";
20 compatible = "anonymous,a4m072";
21
22 soc5200@f0000000 {
23 #address-cells = <1>;
24 #size-cells = <1>;
25 compatible = "fsl,mpc5200b-immr";
26 ranges = <0 0xf0000000 0x0000c000>;
27 reg = <0xf0000000 0x00000100>;
28 bus-frequency = <0>; /* From boot loader */
29 system-frequency = <0>; /* From boot loader */
30
31 cdm@200 {
32 fsl,init-ext-48mhz-en = <0x0>;
33 fsl,init-fd-enable = <0x01>;
34 fsl,init-fd-counters = <0x3333>;
35 };
36
37 timer@600 {
38 fsl,has-wdt;
39 };
40
41 gpt3: timer@630 { /* General Purpose Timer in GPIO mode */
42 compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio";
43 gpio-controller;
44 #gpio-cells = <2>;
45 };
46
47 gpt4: timer@640 { /* General Purpose Timer in GPIO mode */
48 compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio";
49 gpio-controller;
50 #gpio-cells = <2>;
51 };
52
53 gpt5: timer@650 { /* General Purpose Timer in GPIO mode */
54 compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio";
55 gpio-controller;
56 #gpio-cells = <2>;
57 };
58
59 spi@f00 {
60 status = "disabled";
61 };
62
63 psc@2000 {
64 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
65 reg = <0x2000 0x100>;
66 interrupts = <2 1 0>;
67 };
68
69 psc@2200 {
70 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
71 reg = <0x2200 0x100>;
72 interrupts = <2 2 0>;
73 };
74
75 psc@2400 {
76 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
77 reg = <0x2400 0x100>;
78 interrupts = <2 3 0>;
79 };
80
81 psc@2600 {
82 status = "disabled";
83 };
84
85 psc@2800 {
86 status = "disabled";
87 };
88
89 psc@2c00 {
90 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
91 reg = <0x2c00 0x100>;
92 interrupts = <2 4 0>;
93 };
94
95 ethernet@3000 {
96 phy-handle = <&phy0>;
97 };
98
99 mdio@3000 {
100 phy0: ethernet-phy@1f {
101 reg = <0x1f>;
102 interrupts = <1 2 0>; /* IRQ 2 active low */
103 };
104 };
105
106 i2c@3d00 {
107 status = "disabled";
108 };
109
110 i2c@3d40 {
111 hwmon@2e {
112 compatible = "nsc,lm87";
113 reg = <0x2e>;
114 };
115 rtc@51 {
116 compatible = "nxp,rtc8564";
117 reg = <0x51>;
118 };
119 };
120 };
121
122 localbus {
123 compatible = "fsl,mpc5200b-lpb","simple-bus";
124 #address-cells = <2>;
125 #size-cells = <1>;
126 ranges = <0 0 0xfe000000 0x02000000
127 1 0 0x62000000 0x00400000
128 2 0 0x64000000 0x00200000
129 3 0 0x66000000 0x01000000
130 6 0 0x68000000 0x01000000
131 7 0 0x6a000000 0x00000004>;
132
133 flash@0,0 {
134 compatible = "cfi-flash";
135 reg = <0 0 0x02000000>;
136 bank-width = <2>;
137 #size-cells = <1>;
138 #address-cells = <1>;
139 };
140 sram0@1,0 {
141 compatible = "mtd-ram";
142 reg = <1 0x00000 0x00400000>;
143 bank-width = <2>;
144 };
145 };
146
147 pci@f0000d00 {
148 #interrupt-cells = <1>;
149 #size-cells = <2>;
150 #address-cells = <3>;
151 device_type = "pci";
152 compatible = "fsl,mpc5200-pci";
153 reg = <0xf0000d00 0x100>;
154 interrupt-map-mask = <0xf800 0 0 7>;
155 interrupt-map = <
156 /* IDSEL 0x16 */
157 0xc000 0 0 1 &mpc5200_pic 1 3 3
158 0xc000 0 0 2 &mpc5200_pic 1 3 3
159 0xc000 0 0 3 &mpc5200_pic 1 3 3
160 0xc000 0 0 4 &mpc5200_pic 1 3 3>;
161 clock-frequency = <0>; /* From boot loader */
162 interrupts = <2 8 0 2 9 0 2 10 0>;
163 bus-range = <0 0>;
164 ranges = <0x42000000 0 0x80000000 0x80000000 0 0x10000000
165 0x02000000 0 0x90000000 0x90000000 0 0x10000000
166 0x01000000 0 0x00000000 0xa0000000 0 0x01000000>;
167 };
168};
diff --git a/arch/powerpc/boot/dts/bluestone.dts b/arch/powerpc/boot/dts/bluestone.dts
index 74876f73740..7bda373f10e 100644
--- a/arch/powerpc/boot/dts/bluestone.dts
+++ b/arch/powerpc/boot/dts/bluestone.dts
@@ -33,7 +33,7 @@
33 aliases { 33 aliases {
34 ethernet0 = &EMAC0; 34 ethernet0 = &EMAC0;
35 serial0 = &UART0; 35 serial0 = &UART0;
36 //serial1 = &UART1; --gcl missing UART1 label 36 serial1 = &UART1;
37 }; 37 };
38 38
39 cpus { 39 cpus {
@@ -52,7 +52,7 @@
52 d-cache-size = <32768>; 52 d-cache-size = <32768>;
53 dcr-controller; 53 dcr-controller;
54 dcr-access-method = "native"; 54 dcr-access-method = "native";
55 //next-level-cache = <&L2C0>; --gcl missing L2C0 label 55 next-level-cache = <&L2C0>;
56 }; 56 };
57 }; 57 };
58 58
@@ -117,6 +117,16 @@
117 dcr-reg = <0x00c 0x002>; 117 dcr-reg = <0x00c 0x002>;
118 }; 118 };
119 119
120 L2C0: l2c {
121 compatible = "ibm,l2-cache-apm82181", "ibm,l2-cache";
122 dcr-reg = <0x020 0x008
123 0x030 0x008>;
124 cache-line-size = <32>;
125 cache-size = <262144>;
126 interrupt-parent = <&UIC1>;
127 interrupts = <11 1>;
128 };
129
120 plb { 130 plb {
121 compatible = "ibm,plb4"; 131 compatible = "ibm,plb4";
122 #address-cells = <2>; 132 #address-cells = <2>;
@@ -182,6 +192,53 @@
182 reg = <0x001a0000 0x00060000>; 192 reg = <0x001a0000 0x00060000>;
183 }; 193 };
184 }; 194 };
195
196 ndfc@1,0 {
197 compatible = "ibm,ndfc";
198 reg = <0x00000003 0x00000000 0x00002000>;
199 ccr = <0x00001000>;
200 bank-settings = <0x80002222>;
201 #address-cells = <1>;
202 #size-cells = <1>;
203 /* 2Gb Nand Flash */
204 nand {
205 #address-cells = <1>;
206 #size-cells = <1>;
207
208 partition@0 {
209 label = "firmware";
210 reg = <0x00000000 0x00C00000>;
211 };
212 partition@c00000 {
213 label = "environment";
214 reg = <0x00C00000 0x00B00000>;
215 };
216 partition@1700000 {
217 label = "kernel";
218 reg = <0x01700000 0x00E00000>;
219 };
220 partition@2500000 {
221 label = "root";
222 reg = <0x02500000 0x08200000>;
223 };
224 partition@a700000 {
225 label = "device-tree";
226 reg = <0x0A700000 0x00B00000>;
227 };
228 partition@b200000 {
229 label = "config";
230 reg = <0x0B200000 0x00D00000>;
231 };
232 partition@bf00000 {
233 label = "diag";
234 reg = <0x0BF00000 0x00C00000>;
235 };
236 partition@cb00000 {
237 label = "vendor";
238 reg = <0x0CB00000 0x3500000>;
239 };
240 };
241 };
185 }; 242 };
186 243
187 UART0: serial@ef600300 { 244 UART0: serial@ef600300 {
@@ -195,11 +252,36 @@
195 interrupts = <0x1 0x4>; 252 interrupts = <0x1 0x4>;
196 }; 253 };
197 254
255 UART1: serial@ef600400 {
256 device_type = "serial";
257 compatible = "ns16550";
258 reg = <0xef600400 0x00000008>;
259 virtual-reg = <0xef600400>;
260 clock-frequency = <0>; /* Filled in by U-Boot */
261 current-speed = <0>; /* Filled in by U-Boot */
262 interrupt-parent = <&UIC0>;
263 interrupts = <0x1 0x4>;
264 };
265
198 IIC0: i2c@ef600700 { 266 IIC0: i2c@ef600700 {
199 compatible = "ibm,iic"; 267 compatible = "ibm,iic";
200 reg = <0xef600700 0x00000014>; 268 reg = <0xef600700 0x00000014>;
201 interrupt-parent = <&UIC0>; 269 interrupt-parent = <&UIC0>;
202 interrupts = <0x2 0x4>; 270 interrupts = <0x2 0x4>;
271 #address-cells = <1>;
272 #size-cells = <0>;
273 rtc@68 {
274 compatible = "stm,m41t80";
275 reg = <0x68>;
276 interrupt-parent = <&UIC0>;
277 interrupts = <0x9 0x8>;
278 };
279 sttm@4C {
280 compatible = "adm,adm1032";
281 reg = <0x4C>;
282 interrupt-parent = <&UIC1>;
283 interrupts = <0x1E 0x8>; /* CPU_THERNAL_L */
284 };
203 }; 285 };
204 286
205 IIC1: i2c@ef600800 { 287 IIC1: i2c@ef600800 {
@@ -250,5 +332,46 @@
250 }; 332 };
251 }; 333 };
252 334
335 PCIE0: pciex@d00000000 {
336 device_type = "pci";
337 #interrupt-cells = <1>;
338 #size-cells = <2>;
339 #address-cells = <3>;
340 compatible = "ibm,plb-pciex-apm821xx", "ibm,plb-pciex";
341 primary;
342 port = <0x0>; /* port number */
343 reg = <0x0000000d 0x00000000 0x20000000 /* Config space access */
344 0x0000000c 0x08010000 0x00001000>; /* Registers */
345 dcr-reg = <0x100 0x020>;
346 sdr-base = <0x300>;
347
348 /* Outbound ranges, one memory and one IO,
349 * later cannot be changed
350 */
351 ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x00000000 0x00000000 0x80000000
352 0x02000000 0x00000000 0x00000000 0x0000000f 0x00000000 0x00000000 0x00100000
353 0x01000000 0x00000000 0x00000000 0x0000000f 0x80000000 0x00000000 0x00010000>;
354
355 /* Inbound 2GB range starting at 0 */
356 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x80000000>;
357
358 /* This drives busses 40 to 0x7f */
359 bus-range = <0x40 0x7f>;
360
361 /* Legacy interrupts (note the weird polarity, the bridge seems
362 * to invert PCIe legacy interrupts).
363 * We are de-swizzling here because the numbers are actually for
364 * port of the root complex virtual P2P bridge. But I want
365 * to avoid putting a node for it in the tree, so the numbers
366 * below are basically de-swizzled numbers.
367 * The real slot is on idsel 0, so the swizzling is 1:1
368 */
369 interrupt-map-mask = <0x0 0x0 0x0 0x7>;
370 interrupt-map = <
371 0x0 0x0 0x0 0x1 &UIC3 0xc 0x4 /* swizzled int A */
372 0x0 0x0 0x0 0x2 &UIC3 0xd 0x4 /* swizzled int B */
373 0x0 0x0 0x0 0x3 &UIC3 0xe 0x4 /* swizzled int C */
374 0x0 0x0 0x0 0x4 &UIC3 0xf 0x4 /* swizzled int D */>;
375 };
253 }; 376 };
254}; 377};
diff --git a/arch/powerpc/boot/dts/fsl/mpc8536si-post.dtsi b/arch/powerpc/boot/dts/fsl/mpc8536si-post.dtsi
index b37da56018b..c8b2daa40ac 100644
--- a/arch/powerpc/boot/dts/fsl/mpc8536si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8536si-post.dtsi
@@ -202,7 +202,7 @@
202/include/ "pq3-etsec1-timer-0.dtsi" 202/include/ "pq3-etsec1-timer-0.dtsi"
203 203
204 usb@22000 { 204 usb@22000 {
205 compatible = "fsl,mpc8536-usb2-mph", "fsl-usb2-mph"; 205 compatible = "fsl-usb2-mph-v1.2", "fsl,mpc8536-usb2-mph", "fsl-usb2-mph";
206 reg = <0x22000 0x1000>; 206 reg = <0x22000 0x1000>;
207 #address-cells = <1>; 207 #address-cells = <1>;
208 #size-cells = <0>; 208 #size-cells = <0>;
@@ -210,7 +210,7 @@
210 }; 210 };
211 211
212 usb@23000 { 212 usb@23000 {
213 compatible = "fsl,mpc8536-usb2-mph", "fsl-usb2-mph"; 213 compatible = "fsl-usb2-mph-v1.2", "fsl,mpc8536-usb2-mph", "fsl-usb2-mph";
214 reg = <0x23000 0x1000>; 214 reg = <0x23000 0x1000>;
215 #address-cells = <1>; 215 #address-cells = <1>;
216 #size-cells = <0>; 216 #size-cells = <0>;
diff --git a/arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi b/arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi
index 9d8023a69d7..579d76cb8e3 100644
--- a/arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi
@@ -89,6 +89,21 @@
89 }; 89 };
90}; 90};
91 91
92&rio {
93 compatible = "fsl,srio";
94 interrupts = <48 2 0 0>;
95 #address-cells = <2>;
96 #size-cells = <2>;
97 fsl,srio-rmu-handle = <&rmu>;
98 ranges;
99
100 port1 {
101 #address-cells = <2>;
102 #size-cells = <2>;
103 cell-index = <1>;
104 };
105};
106
92&soc { 107&soc {
93 #address-cells = <1>; 108 #address-cells = <1>;
94 #size-cells = <1>; 109 #size-cells = <1>;
@@ -134,6 +149,7 @@
134 149
135/include/ "pq3-sec2.1-0.dtsi" 150/include/ "pq3-sec2.1-0.dtsi"
136/include/ "pq3-mpic.dtsi" 151/include/ "pq3-mpic.dtsi"
152/include/ "pq3-rmu-0.dtsi"
137 153
138 global-utilities@e0000 { 154 global-utilities@e0000 {
139 compatible = "fsl,mpc8548-guts"; 155 compatible = "fsl,mpc8548-guts";
diff --git a/arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi b/arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi
index 289f1218d75..720422d8352 100644
--- a/arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi
@@ -43,7 +43,9 @@
43 serial0 = &serial0; 43 serial0 = &serial0;
44 serial1 = &serial1; 44 serial1 = &serial1;
45 ethernet0 = &enet0; 45 ethernet0 = &enet0;
46 ethernet1 = &enet2; 46 ethernet1 = &enet1;
47 ethernet2 = &enet2;
48 ethernet3 = &enet3;
47 pci0 = &pci0; 49 pci0 = &pci0;
48 pci1 = &pci1; 50 pci1 = &pci1;
49 pci2 = &pci2; 51 pci2 = &pci2;
diff --git a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
index a97d1263372..0bde9ee8afa 100644
--- a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
@@ -156,6 +156,9 @@
156 156
157/include/ "pq3-dma-0.dtsi" 157/include/ "pq3-dma-0.dtsi"
158/include/ "pq3-usb2-dr-0.dtsi" 158/include/ "pq3-usb2-dr-0.dtsi"
159 usb@22000 {
160 compatible = "fsl-usb2-dr-v1.6", "fsl-usb2-dr";
161 };
159/include/ "pq3-esdhc-0.dtsi" 162/include/ "pq3-esdhc-0.dtsi"
160 sdhc@2e000 { 163 sdhc@2e000 {
161 compatible = "fsl,p1010-esdhc", "fsl,esdhc"; 164 compatible = "fsl,p1010-esdhc", "fsl,esdhc";
diff --git a/arch/powerpc/boot/dts/fsl/p1020si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1020si-post.dtsi
index 5de5fc35131..68cc5e7f647 100644
--- a/arch/powerpc/boot/dts/fsl/p1020si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1020si-post.dtsi
@@ -142,7 +142,13 @@
142 142
143/include/ "pq3-dma-0.dtsi" 143/include/ "pq3-dma-0.dtsi"
144/include/ "pq3-usb2-dr-0.dtsi" 144/include/ "pq3-usb2-dr-0.dtsi"
145 usb@22000 {
146 compatible = "fsl-usb2-dr-v1.6", "fsl-usb2-dr";
147 };
145/include/ "pq3-usb2-dr-1.dtsi" 148/include/ "pq3-usb2-dr-1.dtsi"
149 usb@23000 {
150 compatible = "fsl-usb2-dr-v1.6", "fsl-usb2-dr";
151 };
146 152
147/include/ "pq3-esdhc-0.dtsi" 153/include/ "pq3-esdhc-0.dtsi"
148 sdhc@2e000 { 154 sdhc@2e000 {
diff --git a/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi
index 38ba54d1e32..4252ef85fb7 100644
--- a/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi
@@ -142,8 +142,15 @@
142 142
143/include/ "pq3-dma-0.dtsi" 143/include/ "pq3-dma-0.dtsi"
144/include/ "pq3-usb2-dr-0.dtsi" 144/include/ "pq3-usb2-dr-0.dtsi"
145 usb@22000 {
146 compatible = "fsl-usb2-dr-v1.6", "fsl-usb2-dr";
147 };
145 148
146/include/ "pq3-esdhc-0.dtsi" 149/include/ "pq3-esdhc-0.dtsi"
150 sdhc@2e000 {
151 sdhci,auto-cmd12;
152 };
153
147/include/ "pq3-sec3.3-0.dtsi" 154/include/ "pq3-sec3.3-0.dtsi"
148 155
149/include/ "pq3-mpic.dtsi" 156/include/ "pq3-mpic.dtsi"
diff --git a/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
index ff9ed1d8792..06216b8c0af 100644
--- a/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
@@ -35,7 +35,11 @@
35&lbc { 35&lbc {
36 #address-cells = <2>; 36 #address-cells = <2>;
37 #size-cells = <1>; 37 #size-cells = <1>;
38 compatible = "fsl,p1022-elbc", "fsl,elbc", "simple-bus"; 38 /*
39 * The localbus on the P1022 is not a simple-bus because of the eLBC
40 * pin muxing when the DIU is enabled.
41 */
42 compatible = "fsl,p1022-elbc", "fsl,elbc";
39 interrupts = <19 2 0 0>; 43 interrupts = <19 2 0 0>;
40}; 44};
41 45
@@ -199,7 +203,13 @@
199 203
200/include/ "pq3-dma-0.dtsi" 204/include/ "pq3-dma-0.dtsi"
201/include/ "pq3-usb2-dr-0.dtsi" 205/include/ "pq3-usb2-dr-0.dtsi"
206 usb@22000 {
207 compatible = "fsl-usb2-dr-v1.6", "fsl-usb2-dr";
208 };
202/include/ "pq3-usb2-dr-1.dtsi" 209/include/ "pq3-usb2-dr-1.dtsi"
210 usb@23000 {
211 compatible = "fsl-usb2-dr-v1.6", "fsl-usb2-dr";
212 };
203 213
204/include/ "pq3-esdhc-0.dtsi" 214/include/ "pq3-esdhc-0.dtsi"
205 sdhc@2e000 { 215 sdhc@2e000 {
diff --git a/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi
index b06bb4cc1fe..941fa159cef 100644
--- a/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi
@@ -142,6 +142,9 @@
142 142
143/include/ "pq3-dma-0.dtsi" 143/include/ "pq3-dma-0.dtsi"
144/include/ "pq3-usb2-dr-0.dtsi" 144/include/ "pq3-usb2-dr-0.dtsi"
145 usb@22000 {
146 compatible = "fsl-usb2-dr-v1.6", "fsl-usb2-dr";
147 };
145 148
146 crypto: crypto@300000 { 149 crypto: crypto@300000 {
147 compatible = "fsl,sec-v4.2", "fsl,sec-v4.0"; 150 compatible = "fsl,sec-v4.2", "fsl,sec-v4.0";
diff --git a/arch/powerpc/boot/dts/fsl/p2020si-post.dtsi b/arch/powerpc/boot/dts/fsl/p2020si-post.dtsi
index 332e9e75e6c..884e01bcb24 100644
--- a/arch/powerpc/boot/dts/fsl/p2020si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p2020si-post.dtsi
@@ -171,6 +171,9 @@
171 171
172/include/ "pq3-dma-0.dtsi" 172/include/ "pq3-dma-0.dtsi"
173/include/ "pq3-usb2-dr-0.dtsi" 173/include/ "pq3-usb2-dr-0.dtsi"
174 usb@22000 {
175 compatible = "fsl-usb2-dr-v1.6", "fsl-usb2-dr";
176 };
174/include/ "pq3-etsec1-0.dtsi" 177/include/ "pq3-etsec1-0.dtsi"
175/include/ "pq3-etsec1-timer-0.dtsi" 178/include/ "pq3-etsec1-timer-0.dtsi"
176 179
diff --git a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi
index 234a399ddeb..531eab82c6c 100644
--- a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi
@@ -309,12 +309,14 @@
309/include/ "qoriq-gpio-0.dtsi" 309/include/ "qoriq-gpio-0.dtsi"
310/include/ "qoriq-usb2-mph-0.dtsi" 310/include/ "qoriq-usb2-mph-0.dtsi"
311 usb0: usb@210000 { 311 usb0: usb@210000 {
312 compatible = "fsl-usb2-mph-v1.6", "fsl,mpc85xx-usb2-mph", "fsl-usb2-mph";
312 phy_type = "utmi"; 313 phy_type = "utmi";
313 port0; 314 port0;
314 }; 315 };
315 316
316/include/ "qoriq-usb2-dr-0.dtsi" 317/include/ "qoriq-usb2-dr-0.dtsi"
317 usb1: usb@211000 { 318 usb1: usb@211000 {
319 compatible = "fsl-usb2-dr-v1.6", "fsl,mpc85xx-usb2-dr", "fsl-usb2-dr";
318 dr_mode = "host"; 320 dr_mode = "host";
319 phy_type = "utmi"; 321 phy_type = "utmi";
320 }; 322 };
diff --git a/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi
index d41d08de7f7..af4ebc8009e 100644
--- a/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi
@@ -336,12 +336,14 @@
336/include/ "qoriq-gpio-0.dtsi" 336/include/ "qoriq-gpio-0.dtsi"
337/include/ "qoriq-usb2-mph-0.dtsi" 337/include/ "qoriq-usb2-mph-0.dtsi"
338 usb0: usb@210000 { 338 usb0: usb@210000 {
339 compatible = "fsl-usb2-mph-v1.6", "fsl-usb2-mph";
339 phy_type = "utmi"; 340 phy_type = "utmi";
340 port0; 341 port0;
341 }; 342 };
342 343
343/include/ "qoriq-usb2-dr-0.dtsi" 344/include/ "qoriq-usb2-dr-0.dtsi"
344 usb1: usb@211000 { 345 usb1: usb@211000 {
346 compatible = "fsl-usb2-dr-v1.6", "fsl,mpc85xx-usb2-dr", "fsl-usb2-dr";
345 dr_mode = "host"; 347 dr_mode = "host";
346 phy_type = "utmi"; 348 phy_type = "utmi";
347 }; 349 };
diff --git a/arch/powerpc/boot/dts/fsl/p3060si-post.dtsi b/arch/powerpc/boot/dts/fsl/p3060si-post.dtsi
index a63edd195ae..b3e56929eee 100644
--- a/arch/powerpc/boot/dts/fsl/p3060si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p3060si-post.dtsi
@@ -291,6 +291,12 @@
291/include/ "qoriq-duart-1.dtsi" 291/include/ "qoriq-duart-1.dtsi"
292/include/ "qoriq-gpio-0.dtsi" 292/include/ "qoriq-gpio-0.dtsi"
293/include/ "qoriq-usb2-mph-0.dtsi" 293/include/ "qoriq-usb2-mph-0.dtsi"
294 usb@210000 {
295 compatible = "fsl-usb2-mph-v2.2", "fsl,mpc85xx-usb2-mph", "fsl-usb2-mph";
296 };
294/include/ "qoriq-usb2-dr-0.dtsi" 297/include/ "qoriq-usb2-dr-0.dtsi"
298 usb@211000 {
299 compatible = "fsl-usb2-dr-v2.2", "fsl,mpc85xx-usb2-dr", "fsl-usb2-dr";
300 };
295/include/ "qoriq-sec4.1-0.dtsi" 301/include/ "qoriq-sec4.1-0.dtsi"
296}; 302};
diff --git a/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi b/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi
index 914074b91a8..64b6abea846 100644
--- a/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi
@@ -339,12 +339,14 @@
339/include/ "qoriq-gpio-0.dtsi" 339/include/ "qoriq-gpio-0.dtsi"
340/include/ "qoriq-usb2-mph-0.dtsi" 340/include/ "qoriq-usb2-mph-0.dtsi"
341 usb0: usb@210000 { 341 usb0: usb@210000 {
342 compatible = "fsl-usb2-mph-v1.6", "fsl,mpc85xx-usb2-mph", "fsl-usb2-mph";
342 phy_type = "utmi"; 343 phy_type = "utmi";
343 port0; 344 port0;
344 }; 345 };
345 346
346/include/ "qoriq-usb2-dr-0.dtsi" 347/include/ "qoriq-usb2-dr-0.dtsi"
347 usb1: usb@211000 { 348 usb1: usb@211000 {
349 compatible = "fsl-usb2-dr-v1.6", "fsl,mpc85xx-usb2-dr", "fsl-usb2-dr";
348 dr_mode = "host"; 350 dr_mode = "host";
349 phy_type = "utmi"; 351 phy_type = "utmi";
350 }; 352 };
diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec1-0.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec1-0.dtsi
index a1979ae334a..3b0650a9847 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-etsec1-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec1-0.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * PQ3 eTSEC device tree stub [ @ offsets 0x24000 ] 2 * PQ3 eTSEC device tree stub [ @ offsets 0x24000 ]
3 * 3 *
4 * Copyright 2011 Freescale Semiconductor Inc. 4 * Copyright 2011-2012 Freescale Semiconductor Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
@@ -41,6 +41,7 @@ ethernet@24000 {
41 compatible = "gianfar"; 41 compatible = "gianfar";
42 reg = <0x24000 0x1000>; 42 reg = <0x24000 0x1000>;
43 ranges = <0x0 0x24000 0x1000>; 43 ranges = <0x0 0x24000 0x1000>;
44 fsl,magic-packet;
44 local-mac-address = [ 00 00 00 00 00 00 ]; 45 local-mac-address = [ 00 00 00 00 00 00 ];
45 interrupts = <29 2 0 0 30 2 0 0 34 2 0 0>; 46 interrupts = <29 2 0 0 30 2 0 0 34 2 0 0>;
46}; 47};
diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec1-1.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec1-1.dtsi
index 4c4fdde1ec2..96693b41f0f 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-etsec1-1.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec1-1.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * PQ3 eTSEC device tree stub [ @ offsets 0x25000 ] 2 * PQ3 eTSEC device tree stub [ @ offsets 0x25000 ]
3 * 3 *
4 * Copyright 2011 Freescale Semiconductor Inc. 4 * Copyright 2011-2012 Freescale Semiconductor Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
@@ -41,6 +41,7 @@ ethernet@25000 {
41 compatible = "gianfar"; 41 compatible = "gianfar";
42 reg = <0x25000 0x1000>; 42 reg = <0x25000 0x1000>;
43 ranges = <0x0 0x25000 0x1000>; 43 ranges = <0x0 0x25000 0x1000>;
44 fsl,magic-packet;
44 local-mac-address = [ 00 00 00 00 00 00 ]; 45 local-mac-address = [ 00 00 00 00 00 00 ];
45 interrupts = <35 2 0 0 36 2 0 0 40 2 0 0>; 46 interrupts = <35 2 0 0 36 2 0 0 40 2 0 0>;
46}; 47};
diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec1-2.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec1-2.dtsi
index 4b8ab438668..6b3fab19da1 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-etsec1-2.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec1-2.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * PQ3 eTSEC device tree stub [ @ offsets 0x26000 ] 2 * PQ3 eTSEC device tree stub [ @ offsets 0x26000 ]
3 * 3 *
4 * Copyright 2011 Freescale Semiconductor Inc. 4 * Copyright 2011-2012 Freescale Semiconductor Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
@@ -41,6 +41,7 @@ ethernet@26000 {
41 compatible = "gianfar"; 41 compatible = "gianfar";
42 reg = <0x26000 0x1000>; 42 reg = <0x26000 0x1000>;
43 ranges = <0x0 0x26000 0x1000>; 43 ranges = <0x0 0x26000 0x1000>;
44 fsl,magic-packet;
44 local-mac-address = [ 00 00 00 00 00 00 ]; 45 local-mac-address = [ 00 00 00 00 00 00 ];
45 interrupts = <31 2 0 0 32 2 0 0 33 2 0 0>; 46 interrupts = <31 2 0 0 32 2 0 0 33 2 0 0>;
46}; 47};
diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec1-3.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec1-3.dtsi
index 40c9137729a..0da592d93dd 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-etsec1-3.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec1-3.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * PQ3 eTSEC device tree stub [ @ offsets 0x27000 ] 2 * PQ3 eTSEC device tree stub [ @ offsets 0x27000 ]
3 * 3 *
4 * Copyright 2011 Freescale Semiconductor Inc. 4 * Copyright 2011-2012 Freescale Semiconductor Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
@@ -41,6 +41,7 @@ ethernet@27000 {
41 compatible = "gianfar"; 41 compatible = "gianfar";
42 reg = <0x27000 0x1000>; 42 reg = <0x27000 0x1000>;
43 ranges = <0x0 0x27000 0x1000>; 43 ranges = <0x0 0x27000 0x1000>;
44 fsl,magic-packet;
44 local-mac-address = [ 00 00 00 00 00 00 ]; 45 local-mac-address = [ 00 00 00 00 00 00 ];
45 interrupts = <37 2 0 0 38 2 0 0 39 2 0 0>; 46 interrupts = <37 2 0 0 38 2 0 0 39 2 0 0>;
46}; 47};
diff --git a/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi b/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
index 5c804606584..fdedf7b1fe0 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
@@ -39,6 +39,9 @@ mpic: pic@40000 {
39 reg = <0x40000 0x40000>; 39 reg = <0x40000 0x40000>;
40 compatible = "fsl,mpic"; 40 compatible = "fsl,mpic";
41 device_type = "open-pic"; 41 device_type = "open-pic";
42 big-endian;
43 single-cpu-affinity;
44 last-interrupt-source = <255>;
42}; 45};
43 46
44timer@41100 { 47timer@41100 {
diff --git a/arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi b/arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi
index bf957a7fca2..d4c9d5daab2 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi
@@ -33,32 +33,32 @@
33 */ 33 */
34 34
35crypto@30000 { 35crypto@30000 {
36 compatible = "fsl,sec4.4", "fsl,sec4.0"; 36 compatible = "fsl,sec-v4.4", "fsl,sec-v4.0";
37 #address-cells = <1>; 37 #address-cells = <1>;
38 #size-cells = <1>; 38 #size-cells = <1>;
39 reg = <0x30000 0x10000>; 39 reg = <0x30000 0x10000>;
40 interrupts = <58 2 0 0>; 40 interrupts = <58 2 0 0>;
41 41
42 sec_jr0: jr@1000 { 42 sec_jr0: jr@1000 {
43 compatible = "fsl,sec4.4-job-ring", "fsl,sec4.0-job-ring"; 43 compatible = "fsl,sec-v4.4-job-ring", "fsl,sec-v4.0-job-ring";
44 reg = <0x1000 0x1000>; 44 reg = <0x1000 0x1000>;
45 interrupts = <45 2 0 0>; 45 interrupts = <45 2 0 0>;
46 }; 46 };
47 47
48 sec_jr1: jr@2000 { 48 sec_jr1: jr@2000 {
49 compatible = "fsl,sec4.4-job-ring", "fsl,sec4.0-job-ring"; 49 compatible = "fsl,sec-v4.4-job-ring", "fsl,sec-v4.0-job-ring";
50 reg = <0x2000 0x1000>; 50 reg = <0x2000 0x1000>;
51 interrupts = <45 2 0 0>; 51 interrupts = <45 2 0 0>;
52 }; 52 };
53 53
54 sec_jr2: jr@3000 { 54 sec_jr2: jr@3000 {
55 compatible = "fsl,sec4.4-job-ring", "fsl,sec4.0-job-ring"; 55 compatible = "fsl,sec-v4.4-job-ring", "fsl,sec-v4.0-job-ring";
56 reg = <0x3000 0x1000>; 56 reg = <0x3000 0x1000>;
57 interrupts = <45 2 0 0>; 57 interrupts = <45 2 0 0>;
58 }; 58 };
59 59
60 sec_jr3: jr@4000 { 60 sec_jr3: jr@4000 {
61 compatible = "fsl,sec4.4-job-ring", "fsl,sec4.0-job-ring"; 61 compatible = "fsl,sec-v4.4-job-ring", "fsl,sec-v4.0-job-ring";
62 reg = <0x4000 0x1000>; 62 reg = <0x4000 0x1000>;
63 interrupts = <45 2 0 0>; 63 interrupts = <45 2 0 0>;
64 }; 64 };
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-mpic.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-mpic.dtsi
index b9bada6a87d..08f42271f86 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-mpic.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-mpic.dtsi
@@ -53,7 +53,7 @@ timer@41100 {
53 53
54msi0: msi@41600 { 54msi0: msi@41600 {
55 compatible = "fsl,mpic-msi"; 55 compatible = "fsl,mpic-msi";
56 reg = <0x41600 0x200>; 56 reg = <0x41600 0x200 0x44140 4>;
57 msi-available-ranges = <0 0x100>; 57 msi-available-ranges = <0 0x100>;
58 interrupts = < 58 interrupts = <
59 0xe0 0 0 0 59 0xe0 0 0 0
@@ -68,7 +68,7 @@ msi0: msi@41600 {
68 68
69msi1: msi@41800 { 69msi1: msi@41800 {
70 compatible = "fsl,mpic-msi"; 70 compatible = "fsl,mpic-msi";
71 reg = <0x41800 0x200>; 71 reg = <0x41800 0x200 0x45140 4>;
72 msi-available-ranges = <0 0x100>; 72 msi-available-ranges = <0 0x100>;
73 interrupts = < 73 interrupts = <
74 0xe8 0 0 0 74 0xe8 0 0 0
@@ -83,7 +83,7 @@ msi1: msi@41800 {
83 83
84msi2: msi@41a00 { 84msi2: msi@41a00 {
85 compatible = "fsl,mpic-msi"; 85 compatible = "fsl,mpic-msi";
86 reg = <0x41a00 0x200>; 86 reg = <0x41a00 0x200 0x46140 4>;
87 msi-available-ranges = <0 0x100>; 87 msi-available-ranges = <0 0x100>;
88 interrupts = < 88 interrupts = <
89 0xf0 0 0 0 89 0xf0 0 0 0
diff --git a/arch/powerpc/boot/dts/ge_imp3a.dts b/arch/powerpc/boot/dts/ge_imp3a.dts
new file mode 100644
index 00000000000..fefae416a09
--- /dev/null
+++ b/arch/powerpc/boot/dts/ge_imp3a.dts
@@ -0,0 +1,255 @@
1/*
2 * GE IMP3A Device Tree Source
3 *
4 * Copyright 2010-2011 GE Intelligent Platforms Embedded Systems, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * Based on: P2020 DS Device Tree Source
12 * Copyright 2009 Freescale Semiconductor Inc.
13 */
14
15/include/ "fsl/p2020si-pre.dtsi"
16
17/ {
18 model = "GE_IMP3A";
19 compatible = "ge,imp3a";
20
21 memory {
22 device_type = "memory";
23 };
24
25 lbc: localbus@fef05000 {
26 reg = <0 0xfef05000 0 0x1000>;
27
28 ranges = <0x0 0x0 0x0 0xff000000 0x01000000
29 0x1 0x0 0x0 0xe0000000 0x08000000
30 0x2 0x0 0x0 0xe8000000 0x08000000
31 0x3 0x0 0x0 0xfc100000 0x00020000
32 0x4 0x0 0x0 0xfc000000 0x00008000
33 0x5 0x0 0x0 0xfc008000 0x00008000
34 0x6 0x0 0x0 0xfee00000 0x00040000
35 0x7 0x0 0x0 0xfee80000 0x00040000>;
36
37 /* nor@0,0 is a mirror of part of the memory in nor@1,0
38 nor@0,0 {
39 #address-cells = <1>;
40 #size-cells = <1>;
41 compatible = "ge,imp3a-firmware-mirror", "cfi-flash";
42 reg = <0x0 0x0 0x1000000>;
43 bank-width = <2>;
44 device-width = <1>;
45
46 partition@0 {
47 label = "firmware";
48 reg = <0x0 0x1000000>;
49 read-only;
50 };
51 };
52 */
53
54 nor@1,0 {
55 #address-cells = <1>;
56 #size-cells = <1>;
57 compatible = "ge,imp3a-paged-flash", "cfi-flash";
58 reg = <0x1 0x0 0x8000000>;
59 bank-width = <2>;
60 device-width = <1>;
61
62 partition@0 {
63 label = "user";
64 reg = <0x0 0x7800000>;
65 };
66
67 partition@7800000 {
68 label = "firmware";
69 reg = <0x7800000 0x800000>;
70 read-only;
71 };
72 };
73
74 nvram@3,0 {
75 device_type = "nvram";
76 compatible = "simtek,stk14ca8";
77 reg = <0x3 0x0 0x20000>;
78 };
79
80 fpga@4,0 {
81 compatible = "ge,imp3a-fpga-regs";
82 reg = <0x4 0x0 0x20>;
83 };
84
85 gef_pic: pic@4,20 {
86 #interrupt-cells = <1>;
87 interrupt-controller;
88 device_type = "interrupt-controller";
89 compatible = "ge,imp3a-fpga-pic", "gef,fpga-pic-1.00";
90 reg = <0x4 0x20 0x20>;
91 interrupts = <6 7 0 0>;
92 };
93
94 gef_gpio: gpio@4,400 {
95 #gpio-cells = <2>;
96 compatible = "ge,imp3a-gpio";
97 reg = <0x4 0x400 0x24>;
98 gpio-controller;
99 };
100
101 wdt@4,800 {
102 compatible = "ge,imp3a-fpga-wdt", "gef,fpga-wdt-1.00",
103 "gef,fpga-wdt";
104 reg = <0x4 0x800 0x8>;
105 interrupts = <10 4>;
106 interrupt-parent = <&gef_pic>;
107 };
108
109 /* Second watchdog available, driver currently supports one.
110 wdt@4,808 {
111 compatible = "gef,imp3a-fpga-wdt", "gef,fpga-wdt-1.00",
112 "gef,fpga-wdt";
113 reg = <0x4 0x808 0x8>;
114 interrupts = <9 4>;
115 interrupt-parent = <&gef_pic>;
116 };
117 */
118
119 nand@6,0 {
120 compatible = "fsl,elbc-fcm-nand";
121 reg = <0x6 0x0 0x40000>;
122 };
123
124 nand@7,0 {
125 compatible = "fsl,elbc-fcm-nand";
126 reg = <0x7 0x0 0x40000>;
127 };
128 };
129
130 soc: soc@fef00000 {
131 ranges = <0x0 0 0xfef00000 0x100000>;
132
133 i2c@3000 {
134 hwmon@48 {
135 compatible = "national,lm92";
136 reg = <0x48>;
137 };
138
139 hwmon@4c {
140 compatible = "adi,adt7461";
141 reg = <0x4c>;
142 };
143
144 rtc@51 {
145 compatible = "epson,rx8581";
146 reg = <0x51>;
147 };
148
149 eti@6b {
150 compatible = "dallas,ds1682";
151 reg = <0x6b>;
152 };
153 };
154
155 usb@22000 {
156 phy_type = "ulpi";
157 dr_mode = "host";
158 };
159
160 mdio@24520 {
161 phy0: ethernet-phy@0 {
162 interrupt-parent = <&gef_pic>;
163 interrupts = <0xc 0x4>;
164 reg = <0x1>;
165 };
166 phy1: ethernet-phy@1 {
167 interrupt-parent = <&gef_pic>;
168 interrupts = <0xb 0x4>;
169 reg = <0x2>;
170 };
171 tbi0: tbi-phy@11 {
172 reg = <0x11>;
173 device_type = "tbi-phy";
174 };
175 };
176
177 mdio@25520 {
178 tbi1: tbi-phy@11 {
179 reg = <0x11>;
180 device_type = "tbi-phy";
181 };
182 };
183
184 mdio@26520 {
185 status = "disabled";
186 };
187
188 enet0: ethernet@24000 {
189 tbi-handle = <&tbi0>;
190 phy-handle = <&phy0>;
191 phy-connection-type = "gmii";
192 };
193
194 enet1: ethernet@25000 {
195 tbi-handle = <&tbi1>;
196 phy-handle = <&phy1>;
197 phy-connection-type = "gmii";
198 };
199
200 enet2: ethernet@26000 {
201 status = "disabled";
202 };
203 };
204
205 pci0: pcie@fef08000 {
206 ranges = <0x2000000 0x0 0xc0000000 0 0xc0000000 0x0 0x20000000
207 0x1000000 0x0 0x00000000 0 0xfe020000 0x0 0x10000>;
208 reg = <0 0xfef08000 0 0x1000>;
209
210 pcie@0 {
211 ranges = <0x2000000 0x0 0xc0000000
212 0x2000000 0x0 0xc0000000
213 0x0 0x20000000
214
215 0x1000000 0x0 0x0
216 0x1000000 0x0 0x0
217 0x0 0x10000>;
218 };
219 };
220
221 pci1: pcie@fef09000 {
222 reg = <0 0xfef09000 0 0x1000>;
223 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
224 0x1000000 0x0 0x00000000 0 0xfe010000 0x0 0x10000>;
225
226 pcie@0 {
227 ranges = <0x2000000 0x0 0xa0000000
228 0x2000000 0x0 0xa0000000
229 0x0 0x20000000
230
231 0x1000000 0x0 0x0
232 0x1000000 0x0 0x0
233 0x0 0x10000>;
234 };
235
236 };
237
238 pci2: pcie@fef0a000 {
239 reg = <0 0xfef0a000 0 0x1000>;
240 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
241 0x1000000 0x0 0x00000000 0 0xfe000000 0x0 0x10000>;
242
243 pcie@0 {
244 ranges = <0x2000000 0x0 0x80000000
245 0x2000000 0x0 0x80000000
246 0x0 0x20000000
247
248 0x1000000 0x0 0x0
249 0x1000000 0x0 0x0
250 0x0 0x10000>;
251 };
252 };
253};
254
255/include/ "fsl/p2020si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index c0e450a551b..81dd513d630 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -405,6 +405,10 @@
405 reg = <0x1>; 405 reg = <0x1>;
406 device_type = "ethernet-phy"; 406 device_type = "ethernet-phy";
407 }; 407 };
408 tbi-phy@2 {
409 device_type = "tbi-phy";
410 reg = <0x2>;
411 };
408 }; 412 };
409 413
410 qeic: interrupt-controller@80 { 414 qeic: interrupt-controller@80 {
diff --git a/arch/powerpc/boot/dts/mpc8536ds.dts b/arch/powerpc/boot/dts/mpc8536ds.dts
index c15881574fd..19736222a0b 100644
--- a/arch/powerpc/boot/dts/mpc8536ds.dts
+++ b/arch/powerpc/boot/dts/mpc8536ds.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * MPC8536 DS Device Tree Source 2 * MPC8536 DS Device Tree Source
3 * 3 *
4 * Copyright 2008 Freescale Semiconductor, Inc. 4 * Copyright 2008, 2011 Freescale Semiconductor, Inc.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -34,6 +34,10 @@
34 34
35 lbc: localbus@ffe05000 { 35 lbc: localbus@ffe05000 {
36 reg = <0 0xffe05000 0 0x1000>; 36 reg = <0 0xffe05000 0 0x1000>;
37
38 ranges = <0x0 0x0 0x0 0xe8000000 0x08000000
39 0x2 0x0 0x0 0xffa00000 0x00040000
40 0x3 0x0 0x0 0xffdf0000 0x00008000>;
37 }; 41 };
38 42
39 board_soc: soc: soc@ffe00000 { 43 board_soc: soc: soc@ffe00000 {
diff --git a/arch/powerpc/boot/dts/mpc8536ds.dtsi b/arch/powerpc/boot/dts/mpc8536ds.dtsi
index 1462e4cf49d..cc46dbd9746 100644
--- a/arch/powerpc/boot/dts/mpc8536ds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8536ds.dtsi
@@ -32,6 +32,99 @@
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35&lbc {
36 nor@0,0 {
37 #address-cells = <1>;
38 #size-cells = <1>;
39 compatible = "cfi-flash";
40 reg = <0x0 0x0 0x8000000>;
41 bank-width = <2>;
42 device-width = <1>;
43
44 partition@0 {
45 reg = <0x0 0x03000000>;
46 label = "ramdisk-nor";
47 };
48
49 partition@3000000 {
50 reg = <0x03000000 0x00e00000>;
51 label = "diagnostic-nor";
52 read-only;
53 };
54
55 partition@3e00000 {
56 reg = <0x03e00000 0x00200000>;
57 label = "dink-nor";
58 read-only;
59 };
60
61 partition@4000000 {
62 reg = <0x04000000 0x00400000>;
63 label = "kernel-nor";
64 };
65
66 partition@4400000 {
67 reg = <0x04400000 0x03b00000>;
68 label = "fs-nor";
69 };
70
71 partition@7f00000 {
72 reg = <0x07f00000 0x00080000>;
73 label = "dtb-nor";
74 };
75
76 partition@7f80000 {
77 reg = <0x07f80000 0x00080000>;
78 label = "u-boot-nor";
79 read-only;
80 };
81 };
82
83 nand@2,0 {
84 #address-cells = <1>;
85 #size-cells = <1>;
86 compatible = "fsl,mpc8536-fcm-nand",
87 "fsl,elbc-fcm-nand";
88 reg = <0x2 0x0 0x40000>;
89
90 partition@0 {
91 reg = <0x0 0x02000000>;
92 label = "u-boot-nand";
93 read-only;
94 };
95
96 partition@2000000 {
97 reg = <0x02000000 0x10000000>;
98 label = "fs-nand";
99 };
100
101 partition@12000000 {
102 reg = <0x12000000 0x08000000>;
103 label = "ramdisk-nand";
104 };
105
106 partition@1a000000 {
107 reg = <0x1a000000 0x04000000>;
108 label = "kernel-nand";
109 };
110
111 partition@1e000000 {
112 reg = <0x1e000000 0x01000000>;
113 label = "dtb-nand";
114 };
115
116 partition@1f000000 {
117 reg = <0x1f000000 0x21000000>;
118 label = "empty-nand";
119 };
120 };
121
122 board-control@3,0 {
123 compatible = "fsl,mpc8536ds-fpga-pixis";
124 reg = <0x3 0x0 0x8000>;
125 };
126};
127
35&board_soc { 128&board_soc {
36 i2c@3100 { 129 i2c@3100 {
37 rtc@68 { 130 rtc@68 {
diff --git a/arch/powerpc/boot/dts/mpc8536ds_36b.dts b/arch/powerpc/boot/dts/mpc8536ds_36b.dts
index 8f4b929b1d1..f8a3b341317 100644
--- a/arch/powerpc/boot/dts/mpc8536ds_36b.dts
+++ b/arch/powerpc/boot/dts/mpc8536ds_36b.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * MPC8536DS Device Tree Source (36-bit address map) 2 * MPC8536DS Device Tree Source (36-bit address map)
3 * 3 *
4 * Copyright 2008-2009 Freescale Semiconductor, Inc. 4 * Copyright 2008-2009, 2011 Freescale Semiconductor, Inc.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -33,7 +33,11 @@
33 }; 33 };
34 34
35 lbc: localbus@ffe05000 { 35 lbc: localbus@ffe05000 {
36 reg = <0 0xffe05000 0 0x1000>; 36 reg = <0xf 0xffe05000 0 0x1000>;
37
38 ranges = <0x0 0x0 0xf 0xe8000000 0x08000000
39 0x2 0x0 0xf 0xffa00000 0x00040000
40 0x3 0x0 0xf 0xffdf0000 0x00008000>;
37 }; 41 };
38 42
39 board_soc: soc: soc@fffe00000 { 43 board_soc: soc: soc@fffe00000 {
diff --git a/arch/powerpc/boot/dts/mpc8548cds.dts b/arch/powerpc/boot/dts/mpc8548cds.dts
deleted file mode 100644
index 07b8dae0f46..00000000000
--- a/arch/powerpc/boot/dts/mpc8548cds.dts
+++ /dev/null
@@ -1,306 +0,0 @@
1/*
2 * MPC8548 CDS Device Tree Source
3 *
4 * Copyright 2006, 2008 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12/include/ "fsl/mpc8548si-pre.dtsi"
13
14/ {
15 model = "MPC8548CDS";
16 compatible = "MPC8548CDS", "MPC85xxCDS";
17
18 aliases {
19 ethernet0 = &enet0;
20 ethernet1 = &enet1;
21 ethernet2 = &enet2;
22 ethernet3 = &enet3;
23 serial0 = &serial0;
24 serial1 = &serial1;
25 pci0 = &pci0;
26 pci1 = &pci1;
27 pci2 = &pci2;
28 };
29
30 memory {
31 device_type = "memory";
32 reg = <0 0 0x0 0x8000000>; // 128M at 0x0
33 };
34
35 lbc: localbus@e0005000 {
36 reg = <0 0xe0005000 0 0x1000>;
37 };
38
39 soc: soc8548@e0000000 {
40 ranges = <0 0x0 0xe0000000 0x100000>;
41
42 i2c@3000 {
43 eeprom@50 {
44 compatible = "atmel,24c64";
45 reg = <0x50>;
46 };
47
48 eeprom@56 {
49 compatible = "atmel,24c64";
50 reg = <0x56>;
51 };
52
53 eeprom@57 {
54 compatible = "atmel,24c64";
55 reg = <0x57>;
56 };
57 };
58
59 i2c@3100 {
60 eeprom@50 {
61 compatible = "atmel,24c64";
62 reg = <0x50>;
63 };
64 };
65
66 enet0: ethernet@24000 {
67 tbi-handle = <&tbi0>;
68 phy-handle = <&phy0>;
69 };
70
71 mdio@24520 {
72 phy0: ethernet-phy@0 {
73 interrupts = <5 1 0 0>;
74 reg = <0x0>;
75 device_type = "ethernet-phy";
76 };
77 phy1: ethernet-phy@1 {
78 interrupts = <5 1 0 0>;
79 reg = <0x1>;
80 device_type = "ethernet-phy";
81 };
82 phy2: ethernet-phy@2 {
83 interrupts = <5 1 0 0>;
84 reg = <0x2>;
85 device_type = "ethernet-phy";
86 };
87 phy3: ethernet-phy@3 {
88 interrupts = <5 1 0 0>;
89 reg = <0x3>;
90 device_type = "ethernet-phy";
91 };
92 tbi0: tbi-phy@11 {
93 reg = <0x11>;
94 device_type = "tbi-phy";
95 };
96 };
97
98 enet1: ethernet@25000 {
99 tbi-handle = <&tbi1>;
100 phy-handle = <&phy1>;
101 };
102
103 mdio@25520 {
104 tbi1: tbi-phy@11 {
105 reg = <0x11>;
106 device_type = "tbi-phy";
107 };
108 };
109
110 enet2: ethernet@26000 {
111 tbi-handle = <&tbi2>;
112 phy-handle = <&phy2>;
113 };
114
115 mdio@26520 {
116 tbi2: tbi-phy@11 {
117 reg = <0x11>;
118 device_type = "tbi-phy";
119 };
120 };
121
122 enet3: ethernet@27000 {
123 tbi-handle = <&tbi3>;
124 phy-handle = <&phy3>;
125 };
126
127 mdio@27520 {
128 tbi3: tbi-phy@11 {
129 reg = <0x11>;
130 device_type = "tbi-phy";
131 };
132 };
133 };
134
135 pci0: pci@e0008000 {
136 reg = <0 0xe0008000 0 0x1000>;
137 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x10000000
138 0x1000000 0x0 0x00000000 0 0xe2000000 0x0 0x800000>;
139 clock-frequency = <66666666>;
140 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
141 interrupt-map = <
142 /* IDSEL 0x4 (PCIX Slot 2) */
143 0x2000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
144 0x2000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
145 0x2000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
146 0x2000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
147
148 /* IDSEL 0x5 (PCIX Slot 3) */
149 0x2800 0x0 0x0 0x1 &mpic 0x1 0x1 0 0
150 0x2800 0x0 0x0 0x2 &mpic 0x2 0x1 0 0
151 0x2800 0x0 0x0 0x3 &mpic 0x3 0x1 0 0
152 0x2800 0x0 0x0 0x4 &mpic 0x0 0x1 0 0
153
154 /* IDSEL 0x6 (PCIX Slot 4) */
155 0x3000 0x0 0x0 0x1 &mpic 0x2 0x1 0 0
156 0x3000 0x0 0x0 0x2 &mpic 0x3 0x1 0 0
157 0x3000 0x0 0x0 0x3 &mpic 0x0 0x1 0 0
158 0x3000 0x0 0x0 0x4 &mpic 0x1 0x1 0 0
159
160 /* IDSEL 0x8 (PCIX Slot 5) */
161 0x4000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
162 0x4000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
163 0x4000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
164 0x4000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
165
166 /* IDSEL 0xC (Tsi310 bridge) */
167 0x6000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
168 0x6000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
169 0x6000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
170 0x6000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
171
172 /* IDSEL 0x14 (Slot 2) */
173 0xa000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
174 0xa000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
175 0xa000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
176 0xa000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
177
178 /* IDSEL 0x15 (Slot 3) */
179 0xa800 0x0 0x0 0x1 &mpic 0x1 0x1 0 0
180 0xa800 0x0 0x0 0x2 &mpic 0x2 0x1 0 0
181 0xa800 0x0 0x0 0x3 &mpic 0x3 0x1 0 0
182 0xa800 0x0 0x0 0x4 &mpic 0x0 0x1 0 0
183
184 /* IDSEL 0x16 (Slot 4) */
185 0xb000 0x0 0x0 0x1 &mpic 0x2 0x1 0 0
186 0xb000 0x0 0x0 0x2 &mpic 0x3 0x1 0 0
187 0xb000 0x0 0x0 0x3 &mpic 0x0 0x1 0 0
188 0xb000 0x0 0x0 0x4 &mpic 0x1 0x1 0 0
189
190 /* IDSEL 0x18 (Slot 5) */
191 0xc000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
192 0xc000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
193 0xc000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
194 0xc000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
195
196 /* IDSEL 0x1C (Tsi310 bridge PCI primary) */
197 0xe000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
198 0xe000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
199 0xe000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
200 0xe000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0>;
201
202 pci_bridge@1c {
203 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
204 interrupt-map = <
205
206 /* IDSEL 0x00 (PrPMC Site) */
207 0000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
208 0000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
209 0000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
210 0000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
211
212 /* IDSEL 0x04 (VIA chip) */
213 0x2000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
214 0x2000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
215 0x2000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
216 0x2000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
217
218 /* IDSEL 0x05 (8139) */
219 0x2800 0x0 0x0 0x1 &mpic 0x1 0x1 0 0
220
221 /* IDSEL 0x06 (Slot 6) */
222 0x3000 0x0 0x0 0x1 &mpic 0x2 0x1 0 0
223 0x3000 0x0 0x0 0x2 &mpic 0x3 0x1 0 0
224 0x3000 0x0 0x0 0x3 &mpic 0x0 0x1 0 0
225 0x3000 0x0 0x0 0x4 &mpic 0x1 0x1 0 0
226
227 /* IDESL 0x07 (Slot 7) */
228 0x3800 0x0 0x0 0x1 &mpic 0x3 0x1 0 0
229 0x3800 0x0 0x0 0x2 &mpic 0x0 0x1 0 0
230 0x3800 0x0 0x0 0x3 &mpic 0x1 0x1 0 0
231 0x3800 0x0 0x0 0x4 &mpic 0x2 0x1 0 0>;
232
233 reg = <0xe000 0x0 0x0 0x0 0x0>;
234 #interrupt-cells = <1>;
235 #size-cells = <2>;
236 #address-cells = <3>;
237 ranges = <0x2000000 0x0 0x80000000
238 0x2000000 0x0 0x80000000
239 0x0 0x20000000
240 0x1000000 0x0 0x0
241 0x1000000 0x0 0x0
242 0x0 0x80000>;
243 clock-frequency = <33333333>;
244
245 isa@4 {
246 device_type = "isa";
247 #interrupt-cells = <2>;
248 #size-cells = <1>;
249 #address-cells = <2>;
250 reg = <0x2000 0x0 0x0 0x0 0x0>;
251 ranges = <0x1 0x0 0x1000000 0x0 0x0 0x1000>;
252 interrupt-parent = <&i8259>;
253
254 i8259: interrupt-controller@20 {
255 interrupt-controller;
256 device_type = "interrupt-controller";
257 reg = <0x1 0x20 0x2
258 0x1 0xa0 0x2
259 0x1 0x4d0 0x2>;
260 #address-cells = <0>;
261 #interrupt-cells = <2>;
262 compatible = "chrp,iic";
263 interrupts = <0 1 0 0>;
264 interrupt-parent = <&mpic>;
265 };
266
267 rtc@70 {
268 compatible = "pnpPNP,b00";
269 reg = <0x1 0x70 0x2>;
270 };
271 };
272 };
273 };
274
275 pci1: pci@e0009000 {
276 reg = <0 0xe0009000 0 0x1000>;
277 ranges = <0x2000000 0x0 0x90000000 0 0x90000000 0x0 0x10000000
278 0x1000000 0x0 0x00000000 0 0xe2800000 0x0 0x800000>;
279 clock-frequency = <66666666>;
280 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
281 interrupt-map = <
282
283 /* IDSEL 0x15 */
284 0xa800 0x0 0x0 0x1 &mpic 0xb 0x1 0 0
285 0xa800 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
286 0xa800 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
287 0xa800 0x0 0x0 0x4 &mpic 0x3 0x1 0 0>;
288 };
289
290 pci2: pcie@e000a000 {
291 reg = <0 0xe000a000 0 0x1000>;
292 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
293 0x1000000 0x0 0x00000000 0 0xe3000000 0x0 0x100000>;
294 pcie@0 {
295 ranges = <0x2000000 0x0 0xa0000000
296 0x2000000 0x0 0xa0000000
297 0x0 0x20000000
298
299 0x1000000 0x0 0x0
300 0x1000000 0x0 0x0
301 0x0 0x100000>;
302 };
303 };
304};
305
306/include/ "fsl/mpc8548si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/mpc8548cds.dtsi b/arch/powerpc/boot/dts/mpc8548cds.dtsi
new file mode 100644
index 00000000000..c61f525e474
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8548cds.dtsi
@@ -0,0 +1,306 @@
1/*
2 * MPC8548CDS Device Tree Source stub (no addresses or top-level ranges)
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35&board_lbc {
36 nor@0,0 {
37 #address-cells = <1>;
38 #size-cells = <1>;
39 compatible = "cfi-flash";
40 reg = <0x0 0x0 0x01000000>;
41 bank-width = <2>;
42 device-width = <2>;
43
44 partition@0 {
45 reg = <0x0 0x0b00000>;
46 label = "ramdisk-nor";
47 };
48
49 partition@300000 {
50 reg = <0x0b00000 0x0400000>;
51 label = "kernel-nor";
52 };
53
54 partition@700000 {
55 reg = <0x0f00000 0x060000>;
56 label = "dtb-nor";
57 };
58
59 partition@760000 {
60 reg = <0x0f60000 0x020000>;
61 label = "env-nor";
62 read-only;
63 };
64
65 partition@780000 {
66 reg = <0x0f80000 0x080000>;
67 label = "u-boot-nor";
68 read-only;
69 };
70 };
71
72 board-control@1,0 {
73 compatible = "fsl,mpc8548cds-fpga";
74 reg = <0x1 0x0 0x1000>;
75 };
76};
77
78&board_soc {
79 i2c@3000 {
80 eeprom@50 {
81 compatible = "atmel,24c64";
82 reg = <0x50>;
83 };
84
85 eeprom@56 {
86 compatible = "atmel,24c64";
87 reg = <0x56>;
88 };
89
90 eeprom@57 {
91 compatible = "atmel,24c64";
92 reg = <0x57>;
93 };
94 };
95
96 i2c@3100 {
97 eeprom@50 {
98 compatible = "atmel,24c64";
99 reg = <0x50>;
100 };
101 };
102
103 enet0: ethernet@24000 {
104 tbi-handle = <&tbi0>;
105 phy-handle = <&phy0>;
106 };
107
108 mdio@24520 {
109 phy0: ethernet-phy@0 {
110 interrupts = <5 1 0 0>;
111 reg = <0x0>;
112 device_type = "ethernet-phy";
113 };
114 phy1: ethernet-phy@1 {
115 interrupts = <5 1 0 0>;
116 reg = <0x1>;
117 device_type = "ethernet-phy";
118 };
119 phy2: ethernet-phy@2 {
120 interrupts = <5 1 0 0>;
121 reg = <0x2>;
122 device_type = "ethernet-phy";
123 };
124 phy3: ethernet-phy@3 {
125 interrupts = <5 1 0 0>;
126 reg = <0x3>;
127 device_type = "ethernet-phy";
128 };
129 tbi0: tbi-phy@11 {
130 reg = <0x11>;
131 device_type = "tbi-phy";
132 };
133 };
134
135 enet1: ethernet@25000 {
136 tbi-handle = <&tbi1>;
137 phy-handle = <&phy1>;
138 };
139
140 mdio@25520 {
141 tbi1: tbi-phy@11 {
142 reg = <0x11>;
143 device_type = "tbi-phy";
144 };
145 };
146
147 enet2: ethernet@26000 {
148 tbi-handle = <&tbi2>;
149 phy-handle = <&phy2>;
150 };
151
152 mdio@26520 {
153 tbi2: tbi-phy@11 {
154 reg = <0x11>;
155 device_type = "tbi-phy";
156 };
157 };
158
159 enet3: ethernet@27000 {
160 tbi-handle = <&tbi3>;
161 phy-handle = <&phy3>;
162 };
163
164 mdio@27520 {
165 tbi3: tbi-phy@11 {
166 reg = <0x11>;
167 device_type = "tbi-phy";
168 };
169 };
170};
171
172&board_pci0 {
173 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
174 interrupt-map = <
175 /* IDSEL 0x4 (PCIX Slot 2) */
176 0x2000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
177 0x2000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
178 0x2000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
179 0x2000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
180
181 /* IDSEL 0x5 (PCIX Slot 3) */
182 0x2800 0x0 0x0 0x1 &mpic 0x1 0x1 0 0
183 0x2800 0x0 0x0 0x2 &mpic 0x2 0x1 0 0
184 0x2800 0x0 0x0 0x3 &mpic 0x3 0x1 0 0
185 0x2800 0x0 0x0 0x4 &mpic 0x0 0x1 0 0
186
187 /* IDSEL 0x6 (PCIX Slot 4) */
188 0x3000 0x0 0x0 0x1 &mpic 0x2 0x1 0 0
189 0x3000 0x0 0x0 0x2 &mpic 0x3 0x1 0 0
190 0x3000 0x0 0x0 0x3 &mpic 0x0 0x1 0 0
191 0x3000 0x0 0x0 0x4 &mpic 0x1 0x1 0 0
192
193 /* IDSEL 0x8 (PCIX Slot 5) */
194 0x4000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
195 0x4000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
196 0x4000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
197 0x4000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
198
199 /* IDSEL 0xC (Tsi310 bridge) */
200 0x6000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
201 0x6000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
202 0x6000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
203 0x6000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
204
205 /* IDSEL 0x14 (Slot 2) */
206 0xa000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
207 0xa000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
208 0xa000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
209 0xa000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
210
211 /* IDSEL 0x15 (Slot 3) */
212 0xa800 0x0 0x0 0x1 &mpic 0x1 0x1 0 0
213 0xa800 0x0 0x0 0x2 &mpic 0x2 0x1 0 0
214 0xa800 0x0 0x0 0x3 &mpic 0x3 0x1 0 0
215 0xa800 0x0 0x0 0x4 &mpic 0x0 0x1 0 0
216
217 /* IDSEL 0x16 (Slot 4) */
218 0xb000 0x0 0x0 0x1 &mpic 0x2 0x1 0 0
219 0xb000 0x0 0x0 0x2 &mpic 0x3 0x1 0 0
220 0xb000 0x0 0x0 0x3 &mpic 0x0 0x1 0 0
221 0xb000 0x0 0x0 0x4 &mpic 0x1 0x1 0 0
222
223 /* IDSEL 0x18 (Slot 5) */
224 0xc000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
225 0xc000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
226 0xc000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
227 0xc000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
228
229 /* IDSEL 0x1C (Tsi310 bridge PCI primary) */
230 0xe000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
231 0xe000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
232 0xe000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
233 0xe000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0>;
234
235 pci_bridge@1c {
236 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
237 interrupt-map = <
238
239 /* IDSEL 0x00 (PrPMC Site) */
240 0000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
241 0000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
242 0000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
243 0000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
244
245 /* IDSEL 0x04 (VIA chip) */
246 0x2000 0x0 0x0 0x1 &mpic 0x0 0x1 0 0
247 0x2000 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
248 0x2000 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
249 0x2000 0x0 0x0 0x4 &mpic 0x3 0x1 0 0
250
251 /* IDSEL 0x05 (8139) */
252 0x2800 0x0 0x0 0x1 &mpic 0x1 0x1 0 0
253
254 /* IDSEL 0x06 (Slot 6) */
255 0x3000 0x0 0x0 0x1 &mpic 0x2 0x1 0 0
256 0x3000 0x0 0x0 0x2 &mpic 0x3 0x1 0 0
257 0x3000 0x0 0x0 0x3 &mpic 0x0 0x1 0 0
258 0x3000 0x0 0x0 0x4 &mpic 0x1 0x1 0 0
259
260 /* IDESL 0x07 (Slot 7) */
261 0x3800 0x0 0x0 0x1 &mpic 0x3 0x1 0 0
262 0x3800 0x0 0x0 0x2 &mpic 0x0 0x1 0 0
263 0x3800 0x0 0x0 0x3 &mpic 0x1 0x1 0 0
264 0x3800 0x0 0x0 0x4 &mpic 0x2 0x1 0 0>;
265
266 reg = <0xe000 0x0 0x0 0x0 0x0>;
267 #interrupt-cells = <1>;
268 #size-cells = <2>;
269 #address-cells = <3>;
270 ranges = <0x2000000 0x0 0x80000000
271 0x2000000 0x0 0x80000000
272 0x0 0x20000000
273 0x1000000 0x0 0x0
274 0x1000000 0x0 0x0
275 0x0 0x80000>;
276 clock-frequency = <33333333>;
277
278 isa@4 {
279 device_type = "isa";
280 #interrupt-cells = <2>;
281 #size-cells = <1>;
282 #address-cells = <2>;
283 reg = <0x2000 0x0 0x0 0x0 0x0>;
284 ranges = <0x1 0x0 0x1000000 0x0 0x0 0x1000>;
285 interrupt-parent = <&i8259>;
286
287 i8259: interrupt-controller@20 {
288 interrupt-controller;
289 device_type = "interrupt-controller";
290 reg = <0x1 0x20 0x2
291 0x1 0xa0 0x2
292 0x1 0x4d0 0x2>;
293 #address-cells = <0>;
294 #interrupt-cells = <2>;
295 compatible = "chrp,iic";
296 interrupts = <0 1 0 0>;
297 interrupt-parent = <&mpic>;
298 };
299
300 rtc@70 {
301 compatible = "pnpPNP,b00";
302 reg = <0x1 0x70 0x2>;
303 };
304 };
305 };
306};
diff --git a/arch/powerpc/boot/dts/mpc8548cds_32b.dts b/arch/powerpc/boot/dts/mpc8548cds_32b.dts
new file mode 100644
index 00000000000..6fd63163fc6
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8548cds_32b.dts
@@ -0,0 +1,86 @@
1/*
2 * MPC8548 CDS Device Tree Source (32-bit address map)
3 *
4 * Copyright 2006, 2008, 2011-2012 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12/include/ "fsl/mpc8548si-pre.dtsi"
13
14/ {
15 model = "MPC8548CDS";
16 compatible = "MPC8548CDS", "MPC85xxCDS";
17
18 memory {
19 device_type = "memory";
20 reg = <0 0 0x0 0x8000000>; // 128M at 0x0
21 };
22
23 board_lbc: lbc: localbus@e0005000 {
24 reg = <0 0xe0005000 0 0x1000>;
25
26 ranges = <0x0 0x0 0x0 0xff000000 0x01000000
27 0x1 0x0 0x0 0xf8004000 0x00001000>;
28
29 };
30
31 board_soc: soc: soc8548@e0000000 {
32 ranges = <0 0x0 0xe0000000 0x100000>;
33 };
34
35 board_pci0: pci0: pci@e0008000 {
36 reg = <0 0xe0008000 0 0x1000>;
37 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x10000000
38 0x1000000 0x0 0x00000000 0 0xe2000000 0x0 0x800000>;
39 clock-frequency = <66666666>;
40 };
41
42 pci1: pci@e0009000 {
43 reg = <0 0xe0009000 0 0x1000>;
44 ranges = <0x2000000 0x0 0x90000000 0 0x90000000 0x0 0x10000000
45 0x1000000 0x0 0x00000000 0 0xe2800000 0x0 0x800000>;
46 clock-frequency = <66666666>;
47 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
48 interrupt-map = <
49
50 /* IDSEL 0x15 */
51 0xa800 0x0 0x0 0x1 &mpic 0xb 0x1 0 0
52 0xa800 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
53 0xa800 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
54 0xa800 0x0 0x0 0x4 &mpic 0x3 0x1 0 0>;
55 };
56
57 pci2: pcie@e000a000 {
58 reg = <0 0xe000a000 0 0x1000>;
59 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
60 0x1000000 0x0 0x00000000 0 0xe3000000 0x0 0x100000>;
61 pcie@0 {
62 ranges = <0x2000000 0x0 0xa0000000
63 0x2000000 0x0 0xa0000000
64 0x0 0x20000000
65
66 0x1000000 0x0 0x0
67 0x1000000 0x0 0x0
68 0x0 0x100000>;
69 };
70 };
71
72 rio: rapidio@e00c0000 {
73 reg = <0x0 0xe00c0000 0x0 0x20000>;
74 port1 {
75 ranges = <0x0 0x0 0x0 0xc0000000 0x0 0x20000000>;
76 };
77 };
78};
79
80/*
81 * mpc8548cds.dtsi must be last to ensure board_pci0 overrides pci0 settings
82 * for interrupt-map & interrupt-map-mask.
83 */
84
85/include/ "fsl/mpc8548si-post.dtsi"
86/include/ "mpc8548cds.dtsi"
diff --git a/arch/powerpc/boot/dts/mpc8548cds_36b.dts b/arch/powerpc/boot/dts/mpc8548cds_36b.dts
new file mode 100644
index 00000000000..10e551b11bd
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8548cds_36b.dts
@@ -0,0 +1,86 @@
1/*
2 * MPC8548 CDS Device Tree Source (36-bit address map)
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12/include/ "fsl/mpc8548si-pre.dtsi"
13
14/ {
15 model = "MPC8548CDS";
16 compatible = "MPC8548CDS", "MPC85xxCDS";
17
18 memory {
19 device_type = "memory";
20 reg = <0 0 0x0 0x8000000>; // 128M at 0x0
21 };
22
23 board_lbc: lbc: localbus@fe0005000 {
24 reg = <0xf 0xe0005000 0 0x1000>;
25
26 ranges = <0x0 0x0 0xf 0xff000000 0x01000000
27 0x1 0x0 0xf 0xf8004000 0x00001000>;
28
29 };
30
31 board_soc: soc: soc8548@fe0000000 {
32 ranges = <0 0xf 0xe0000000 0x100000>;
33 };
34
35 board_pci0: pci0: pci@fe0008000 {
36 reg = <0xf 0xe0008000 0 0x1000>;
37 ranges = <0x2000000 0x0 0xe0000000 0xc 0x00000000 0x0 0x10000000
38 0x1000000 0x0 0x00000000 0xf 0xe2000000 0x0 0x800000>;
39 clock-frequency = <66666666>;
40 };
41
42 pci1: pci@fe0009000 {
43 reg = <0xf 0xe0009000 0 0x1000>;
44 ranges = <0x2000000 0x0 0xe0000000 0xc 0x10000000 0x0 0x10000000
45 0x1000000 0x0 0x00000000 0xf 0xe2800000 0x0 0x800000>;
46 clock-frequency = <66666666>;
47 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
48 interrupt-map = <
49
50 /* IDSEL 0x15 */
51 0xa800 0x0 0x0 0x1 &mpic 0xb 0x1 0 0
52 0xa800 0x0 0x0 0x2 &mpic 0x1 0x1 0 0
53 0xa800 0x0 0x0 0x3 &mpic 0x2 0x1 0 0
54 0xa800 0x0 0x0 0x4 &mpic 0x3 0x1 0 0>;
55 };
56
57 pci2: pcie@fe000a000 {
58 reg = <0xf 0xe000a000 0 0x1000>;
59 ranges = <0x2000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
60 0x1000000 0x0 0x00000000 0xf 0xe3000000 0x0 0x100000>;
61 pcie@0 {
62 ranges = <0x2000000 0x0 0xa0000000
63 0x2000000 0x0 0xa0000000
64 0x0 0x20000000
65
66 0x1000000 0x0 0x0
67 0x1000000 0x0 0x0
68 0x0 0x100000>;
69 };
70 };
71
72 rio: rapidio@fe00c0000 {
73 reg = <0xf 0xe00c0000 0x0 0x20000>;
74 port1 {
75 ranges = <0x0 0x0 0xc 0x40000000 0x0 0x20000000>;
76 };
77 };
78};
79
80/*
81 * mpc8548cds.dtsi must be last to ensure board_pci0 overrides pci0 settings
82 * for interrupt-map & interrupt-map-mask.
83 */
84
85/include/ "fsl/mpc8548si-post.dtsi"
86/include/ "mpc8548cds.dtsi"
diff --git a/arch/powerpc/boot/dts/mpc8572ds.dtsi b/arch/powerpc/boot/dts/mpc8572ds.dtsi
index c3d4fac0532..14178944e22 100644
--- a/arch/powerpc/boot/dts/mpc8572ds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8572ds.dtsi
@@ -41,37 +41,47 @@
41 bank-width = <2>; 41 bank-width = <2>;
42 device-width = <1>; 42 device-width = <1>;
43 43
44 ramdisk@0 { 44 partition@0 {
45 reg = <0x0 0x03000000>; 45 reg = <0x0 0x03000000>;
46 read-only; 46 label = "ramdisk-nor";
47 }; 47 };
48 48
49 diagnostic@3000000 { 49 partition@3000000 {
50 reg = <0x03000000 0x00e00000>; 50 reg = <0x03000000 0x00e00000>;
51 label = "diagnostic-nor";
51 read-only; 52 read-only;
52 }; 53 };
53 54
54 dink@3e00000 { 55 partition@3e00000 {
55 reg = <0x03e00000 0x00200000>; 56 reg = <0x03e00000 0x00200000>;
57 label = "dink-nor";
56 read-only; 58 read-only;
57 }; 59 };
58 60
59 kernel@4000000 { 61 partition@4000000 {
60 reg = <0x04000000 0x00400000>; 62 reg = <0x04000000 0x00400000>;
61 read-only; 63 label = "kernel-nor";
62 }; 64 };
63 65
64 jffs2@4400000 { 66 partition@4400000 {
65 reg = <0x04400000 0x03b00000>; 67 reg = <0x04400000 0x03b00000>;
68 label = "fs-nor";
69 };
70
71 partition@7f00000 {
72 reg = <0x07f00000 0x00060000>;
73 label = "dtb-nor";
66 }; 74 };
67 75
68 dtb@7f00000 { 76 partition@7f60000 {
69 reg = <0x07f00000 0x00080000>; 77 reg = <0x07f60000 0x00020000>;
78 label = "env-nor";
70 read-only; 79 read-only;
71 }; 80 };
72 81
73 u-boot@7f80000 { 82 partition@7f80000 {
74 reg = <0x07f80000 0x00080000>; 83 reg = <0x07f80000 0x00080000>;
84 label = "u-boot-nor";
75 read-only; 85 read-only;
76 }; 86 };
77 }; 87 };
@@ -83,31 +93,35 @@
83 "fsl,elbc-fcm-nand"; 93 "fsl,elbc-fcm-nand";
84 reg = <0x2 0x0 0x40000>; 94 reg = <0x2 0x0 0x40000>;
85 95
86 u-boot@0 { 96 partition@0 {
87 reg = <0x0 0x02000000>; 97 reg = <0x0 0x02000000>;
98 label = "u-boot-nand";
88 read-only; 99 read-only;
89 }; 100 };
90 101
91 jffs2@2000000 { 102 partition@2000000 {
92 reg = <0x02000000 0x10000000>; 103 reg = <0x02000000 0x10000000>;
104 label = "fs-nand";
93 }; 105 };
94 106
95 ramdisk@12000000 { 107 partition@12000000 {
96 reg = <0x12000000 0x08000000>; 108 reg = <0x12000000 0x08000000>;
97 read-only; 109 label = "ramdisk-nand";
98 }; 110 };
99 111
100 kernel@1a000000 { 112 partition@1a000000 {
101 reg = <0x1a000000 0x04000000>; 113 reg = <0x1a000000 0x04000000>;
114 label = "kernel-nand";
102 }; 115 };
103 116
104 dtb@1e000000 { 117 partition@1e000000 {
105 reg = <0x1e000000 0x01000000>; 118 reg = <0x1e000000 0x01000000>;
106 read-only; 119 label = "dtb-nand";
107 }; 120 };
108 121
109 empty@1f000000 { 122 partition@1f000000 {
110 reg = <0x1f000000 0x21000000>; 123 reg = <0x1f000000 0x21000000>;
124 label = "empty-nand";
111 }; 125 };
112 }; 126 };
113 127
diff --git a/arch/powerpc/boot/dts/p1010rdb.dtsi b/arch/powerpc/boot/dts/p1010rdb.dtsi
index d4c4a773028..49776143a1b 100644
--- a/arch/powerpc/boot/dts/p1010rdb.dtsi
+++ b/arch/powerpc/boot/dts/p1010rdb.dtsi
@@ -138,7 +138,7 @@
138 #size-cells = <1>; 138 #size-cells = <1>;
139 compatible = "spansion,s25sl12801"; 139 compatible = "spansion,s25sl12801";
140 reg = <0>; 140 reg = <0>;
141 spi-max-frequency = <50000000>; 141 spi-max-frequency = <40000000>;
142 142
143 partition@0 { 143 partition@0 {
144 /* 1MB for u-boot Bootloader Image */ 144 /* 1MB for u-boot Bootloader Image */
@@ -196,7 +196,7 @@
196 }; 196 };
197 197
198 tbi-phy@3 { 198 tbi-phy@3 {
199 device-type = "tbi-phy"; 199 device_type = "tbi-phy";
200 reg = <0x3>; 200 reg = <0x3>;
201 }; 201 };
202 }; 202 };
diff --git a/arch/powerpc/boot/dts/p1020rdb-pc.dtsi b/arch/powerpc/boot/dts/p1020rdb-pc.dtsi
new file mode 100644
index 00000000000..c952cd37cf6
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1020rdb-pc.dtsi
@@ -0,0 +1,247 @@
1/*
2 * P1020 RDB-PC Device Tree Source stub (no addresses or top-level ranges)
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35&lbc {
36 nor@0,0 {
37 #address-cells = <1>;
38 #size-cells = <1>;
39 compatible = "cfi-flash";
40 reg = <0x0 0x0 0x1000000>;
41 bank-width = <2>;
42 device-width = <1>;
43
44 partition@0 {
45 /* This location must not be altered */
46 /* 256KB for Vitesse 7385 Switch firmware */
47 reg = <0x0 0x00040000>;
48 label = "NOR Vitesse-7385 Firmware";
49 read-only;
50 };
51
52 partition@40000 {
53 /* 256KB for DTB Image */
54 reg = <0x00040000 0x00040000>;
55 label = "NOR DTB Image";
56 };
57
58 partition@80000 {
59 /* 3.5 MB for Linux Kernel Image */
60 reg = <0x00080000 0x00380000>;
61 label = "NOR Linux Kernel Image";
62 };
63
64 partition@400000 {
65 /* 11MB for JFFS2 based Root file System */
66 reg = <0x00400000 0x00b00000>;
67 label = "NOR JFFS2 Root File System";
68 };
69
70 partition@f00000 {
71 /* This location must not be altered */
72 /* 512KB for u-boot Bootloader Image */
73 /* 512KB for u-boot Environment Variables */
74 reg = <0x00f00000 0x00100000>;
75 label = "NOR U-Boot Image";
76 read-only;
77 };
78 };
79
80 nand@1,0 {
81 #address-cells = <1>;
82 #size-cells = <1>;
83 compatible = "fsl,p1020-fcm-nand",
84 "fsl,elbc-fcm-nand";
85 reg = <0x1 0x0 0x40000>;
86
87 partition@0 {
88 /* This location must not be altered */
89 /* 1MB for u-boot Bootloader Image */
90 reg = <0x0 0x00100000>;
91 label = "NAND U-Boot Image";
92 read-only;
93 };
94
95 partition@100000 {
96 /* 1MB for DTB Image */
97 reg = <0x00100000 0x00100000>;
98 label = "NAND DTB Image";
99 };
100
101 partition@200000 {
102 /* 4MB for Linux Kernel Image */
103 reg = <0x00200000 0x00400000>;
104 label = "NAND Linux Kernel Image";
105 };
106
107 partition@600000 {
108 /* 4MB for Compressed Root file System Image */
109 reg = <0x00600000 0x00400000>;
110 label = "NAND Compressed RFS Image";
111 };
112
113 partition@a00000 {
114 /* 7MB for JFFS2 based Root file System */
115 reg = <0x00a00000 0x00700000>;
116 label = "NAND JFFS2 Root File System";
117 };
118
119 partition@1100000 {
120 /* 15MB for JFFS2 based Root file System */
121 reg = <0x01100000 0x00f00000>;
122 label = "NAND Writable User area";
123 };
124 };
125
126 L2switch@2,0 {
127 #address-cells = <1>;
128 #size-cells = <1>;
129 compatible = "vitesse-7385";
130 reg = <0x2 0x0 0x20000>;
131 };
132
133 cpld@3,0 {
134 #address-cells = <1>;
135 #size-cells = <1>;
136 compatible = "cpld";
137 reg = <0x3 0x0 0x20000>;
138 read-only;
139 };
140};
141
142&soc {
143 i2c@3000 {
144 rtc@68 {
145 compatible = "pericom,pt7c4338";
146 reg = <0x68>;
147 };
148 };
149
150 spi@7000 {
151 flash@0 {
152 #address-cells = <1>;
153 #size-cells = <1>;
154 compatible = "spansion,s25sl12801";
155 reg = <0>;
156 spi-max-frequency = <40000000>; /* input clock */
157
158 partition@u-boot {
159 /* 512KB for u-boot Bootloader Image */
160 reg = <0x0 0x00080000>;
161 label = "u-boot";
162 read-only;
163 };
164
165 partition@dtb {
166 /* 512KB for DTB Image*/
167 reg = <0x00080000 0x00080000>;
168 label = "dtb";
169 };
170
171 partition@kernel {
172 /* 4MB for Linux Kernel Image */
173 reg = <0x00100000 0x00400000>;
174 label = "kernel";
175 };
176
177 partition@fs {
178 /* 4MB for Compressed RFS Image */
179 reg = <0x00500000 0x00400000>;
180 label = "file system";
181 };
182
183 partition@jffs-fs {
184 /* 7MB for JFFS2 based RFS */
185 reg = <0x00900000 0x00700000>;
186 label = "file system jffs2";
187 };
188 };
189 };
190
191 usb@22000 {
192 phy_type = "ulpi";
193 };
194
195 /* USB2 is shared with localbus, so it must be disabled
196 by default. We can't put 'status = "disabled";' here
197 since U-Boot doesn't clear the status property when
198 it enables USB2. OTOH, U-Boot does create a new node
199 when there isn't any. So, just comment it out.
200 usb@23000 {
201 phy_type = "ulpi";
202 };
203 */
204
205 mdio@24000 {
206 phy0: ethernet-phy@0 {
207 interrupt-parent = <&mpic>;
208 interrupts = <3 1>;
209 reg = <0x0>;
210 };
211
212 phy1: ethernet-phy@1 {
213 interrupt-parent = <&mpic>;
214 interrupts = <2 1>;
215 reg = <0x1>;
216 };
217
218 tbi0: tbi-phy@11 {
219 device_type = "tbi-phy";
220 reg = <0x11>;
221 };
222 };
223
224 mdio@25000 {
225 tbi1: tbi-phy@11 {
226 reg = <0x11>;
227 device_type = "tbi-phy";
228 };
229 };
230
231 enet0: ethernet@b0000 {
232 fixed-link = <1 1 1000 0 0>;
233 phy-connection-type = "rgmii-id";
234
235 };
236
237 enet1: ethernet@b1000 {
238 phy-handle = <&phy0>;
239 tbi-handle = <&tbi1>;
240 phy-connection-type = "sgmii";
241 };
242
243 enet2: ethernet@b2000 {
244 phy-handle = <&phy1>;
245 phy-connection-type = "rgmii-id";
246 };
247};
diff --git a/arch/powerpc/boot/dts/p1020rdb-pc_32b.dts b/arch/powerpc/boot/dts/p1020rdb-pc_32b.dts
new file mode 100644
index 00000000000..4de69b726dc
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1020rdb-pc_32b.dts
@@ -0,0 +1,90 @@
1/*
2 * P1020 RDB-PC Device Tree Source (32-bit address map)
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p1020si-pre.dtsi"
36/ {
37 model = "fsl,P1020RDB-PC";
38 compatible = "fsl,P1020RDB-PC";
39
40 memory {
41 device_type = "memory";
42 };
43
44 lbc: localbus@ffe05000 {
45 reg = <0 0xffe05000 0 0x1000>;
46
47 /* NOR, NAND Flashes and Vitesse 5 port L2 switch */
48 ranges = <0x0 0x0 0x0 0xef000000 0x01000000
49 0x1 0x0 0x0 0xff800000 0x00040000
50 0x2 0x0 0x0 0xffb00000 0x00020000
51 0x3 0x0 0x0 0xffa00000 0x00020000>;
52 };
53
54 soc: soc@ffe00000 {
55 ranges = <0x0 0x0 0xffe00000 0x100000>;
56 };
57
58 pci0: pcie@ffe09000 {
59 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
60 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
61 reg = <0 0xffe09000 0 0x1000>;
62 pcie@0 {
63 ranges = <0x2000000 0x0 0xa0000000
64 0x2000000 0x0 0xa0000000
65 0x0 0x20000000
66
67 0x1000000 0x0 0x0
68 0x1000000 0x0 0x0
69 0x0 0x100000>;
70 };
71 };
72
73 pci1: pcie@ffe0a000 {
74 reg = <0 0xffe0a000 0 0x1000>;
75 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
76 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
77 pcie@0 {
78 ranges = <0x2000000 0x0 0x80000000
79 0x2000000 0x0 0x80000000
80 0x0 0x20000000
81
82 0x1000000 0x0 0x0
83 0x1000000 0x0 0x0
84 0x0 0x100000>;
85 };
86 };
87};
88
89/include/ "p1020rdb-pc.dtsi"
90/include/ "fsl/p1020si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1020rdb-pc_36b.dts b/arch/powerpc/boot/dts/p1020rdb-pc_36b.dts
new file mode 100644
index 00000000000..5237da7441b
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1020rdb-pc_36b.dts
@@ -0,0 +1,90 @@
1/*
2 * P1020 RDB-PC Device Tree Source (36-bit address map)
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p1020si-pre.dtsi"
36/ {
37 model = "fsl,P1020RDB-PC";
38 compatible = "fsl,P1020RDB-PC";
39
40 memory {
41 device_type = "memory";
42 };
43
44 lbc: localbus@fffe05000 {
45 reg = <0xf 0xffe05000 0 0x1000>;
46
47 /* NOR, NAND Flashes and Vitesse 5 port L2 switch */
48 ranges = <0x0 0x0 0xf 0xef000000 0x01000000
49 0x1 0x0 0xf 0xff800000 0x00040000
50 0x2 0x0 0xf 0xffb00000 0x00040000
51 0x3 0x0 0xf 0xffa00000 0x00020000>;
52 };
53
54 soc: soc@fffe00000 {
55 ranges = <0x0 0xf 0xffe00000 0x100000>;
56 };
57
58 pci0: pcie@fffe09000 {
59 reg = <0xf 0xffe09000 0 0x1000>;
60 ranges = <0x2000000 0x0 0xc0000000 0xc 0x20000000 0x0 0x20000000
61 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
62 pcie@0 {
63 ranges = <0x2000000 0x0 0xc0000000
64 0x2000000 0x0 0xc0000000
65 0x0 0x20000000
66
67 0x1000000 0x0 0x0
68 0x1000000 0x0 0x0
69 0x0 0x100000>;
70 };
71 };
72
73 pci1: pcie@fffe0a000 {
74 reg = <0xf 0xffe0a000 0 0x1000>;
75 ranges = <0x2000000 0x0 0x80000000 0xc 0x00000000 0x0 0x20000000
76 0x1000000 0x0 0x00000000 0xf 0xffc00000 0x0 0x10000>;
77 pcie@0 {
78 ranges = <0x2000000 0x0 0x80000000
79 0x2000000 0x0 0x80000000
80 0x0 0x20000000
81
82 0x1000000 0x0 0x0
83 0x1000000 0x0 0x0
84 0x0 0x100000>;
85 };
86 };
87};
88
89/include/ "p1020rdb-pc.dtsi"
90/include/ "fsl/p1020si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1020rdb-pc_camp_core0.dts b/arch/powerpc/boot/dts/p1020rdb-pc_camp_core0.dts
new file mode 100644
index 00000000000..f411515937e
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1020rdb-pc_camp_core0.dts
@@ -0,0 +1,64 @@
1/*
2 * P1020 RDB-PC Core0 Device Tree Source in CAMP mode.
3 *
4 * In CAMP mode, each core needs to have its own dts. Only mpic and L2 cache
5 * can be shared, all the other devices must be assigned to one core only.
6 * This dts file allows core0 to have memory, l2, i2c, spi, gpio, tdm, dma, usb,
7 * eth1, eth2, sdhc, crypto, global-util, message, pci0, pci1, msi.
8 *
9 * Please note to add "-b 0" for core0's dts compiling.
10 *
11 * Copyright 2012 Freescale Semiconductor Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18
19/include/ "p1020rdb-pc_32b.dts"
20
21/ {
22 model = "fsl,P1020RDB-PC";
23 compatible = "fsl,P1020RDB-PC";
24
25 aliases {
26 ethernet1 = &enet1;
27 ethernet2 = &enet2;
28 serial0 = &serial0;
29 pci0 = &pci0;
30 pci1 = &pci1;
31 };
32
33 cpus {
34 PowerPC,P1020@1 {
35 status = "disabled";
36 };
37 };
38
39 memory {
40 device_type = "memory";
41 };
42
43 localbus@ffe05000 {
44 status = "disabled";
45 };
46
47 soc@ffe00000 {
48 serial1: serial@4600 {
49 status = "disabled";
50 };
51
52 enet0: ethernet@b0000 {
53 status = "disabled";
54 };
55
56 mpic: pic@40000 {
57 protected-sources = <
58 42 29 30 34 /* serial1, enet0-queue-group0 */
59 17 18 24 45 /* enet0-queue-group1, crypto */
60 >;
61 pic-no-reset;
62 };
63 };
64};
diff --git a/arch/powerpc/boot/dts/p1020rdb-pc_camp_core1.dts b/arch/powerpc/boot/dts/p1020rdb-pc_camp_core1.dts
new file mode 100644
index 00000000000..a91335ad82c
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1020rdb-pc_camp_core1.dts
@@ -0,0 +1,142 @@
1/*
2 * P1020 RDB-PC Core1 Device Tree Source in CAMP mode.
3 *
4 * In CAMP mode, each core needs to have its own dts. Only mpic and L2 cache
5 * can be shared, all the other devices must be assigned to one core only.
6 * This dts allows core1 to have l2, eth0, crypto.
7 *
8 * Please note to add "-b 1" for core1's dts compiling.
9 *
10 * Copyright 2012 Freescale Semiconductor Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18/include/ "p1020rdb-pc_32b.dts"
19
20/ {
21 model = "fsl,P1020RDB-PC";
22 compatible = "fsl,P1020RDB-PC";
23
24 aliases {
25 ethernet0 = &enet0;
26 serial0 = &serial1;
27 };
28
29 cpus {
30 PowerPC,P1020@0 {
31 status = "disabled";
32 };
33 };
34
35 memory {
36 device_type = "memory";
37 };
38
39 localbus@ffe05000 {
40 status = "disabled";
41 };
42
43 soc@ffe00000 {
44 ecm-law@0 {
45 status = "disabled";
46 };
47
48 ecm@1000 {
49 status = "disabled";
50 };
51
52 memory-controller@2000 {
53 status = "disabled";
54 };
55
56 i2c@3000 {
57 status = "disabled";
58 };
59
60 i2c@3100 {
61 status = "disabled";
62 };
63
64 serial0: serial@4500 {
65 status = "disabled";
66 };
67
68 spi@7000 {
69 status = "disabled";
70 };
71
72 gpio: gpio-controller@f000 {
73 status = "disabled";
74 };
75
76 dma@21300 {
77 status = "disabled";
78 };
79
80 mdio@24000 {
81 status = "disabled";
82 };
83
84 mdio@25000 {
85 status = "disabled";
86 };
87
88 enet1: ethernet@b1000 {
89 status = "disabled";
90 };
91
92 enet2: ethernet@b2000 {
93 status = "disabled";
94 };
95
96 usb@22000 {
97 status = "disabled";
98 };
99
100 sdhci@2e000 {
101 status = "disabled";
102 };
103
104 mpic: pic@40000 {
105 protected-sources = <
106 16 /* ecm, mem, L2, pci0, pci1 */
107 43 42 59 /* i2c, serial0, spi */
108 47 63 62 /* gpio, tdm */
109 20 21 22 23 /* dma */
110 03 02 /* mdio */
111 35 36 40 /* enet1-queue-group0 */
112 51 52 67 /* enet1-queue-group1 */
113 31 32 33 /* enet2-queue-group0 */
114 25 26 27 /* enet2-queue-group1 */
115 28 72 58 /* usb, sdhci, crypto */
116 0xb0 0xb1 0xb2 /* message */
117 0xb3 0xb4 0xb5
118 0xb6 0xb7
119 0xe0 0xe1 0xe2 /* msi */
120 0xe3 0xe4 0xe5
121 0xe6 0xe7 /* sdhci, crypto , pci */
122 >;
123 pic-no-reset;
124 };
125
126 msi@41600 {
127 status = "disabled";
128 };
129
130 global-utilities@e0000 { //global utilities block
131 status = "disabled";
132 };
133 };
134
135 pci0: pcie@ffe09000 {
136 status = "disabled";
137 };
138
139 pci1: pcie@ffe0a000 {
140 status = "disabled";
141 };
142};
diff --git a/arch/powerpc/boot/dts/p1021rdb.dts b/arch/powerpc/boot/dts/p1021rdb.dts
new file mode 100644
index 00000000000..90b6b4caa27
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1021rdb.dts
@@ -0,0 +1,96 @@
1/*
2 * P1021 RDB Device Tree Source
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p1021si-pre.dtsi"
36/ {
37 model = "fsl,P1021RDB";
38 compatible = "fsl,P1021RDB-PC";
39
40 memory {
41 device_type = "memory";
42 };
43
44 lbc: localbus@ffe05000 {
45 reg = <0 0xffe05000 0 0x1000>;
46
47 /* NOR, NAND Flashes and Vitesse 5 port L2 switch */
48 ranges = <0x0 0x0 0x0 0xef000000 0x01000000
49 0x1 0x0 0x0 0xff800000 0x00040000
50 0x2 0x0 0x0 0xffb00000 0x00020000>;
51 };
52
53 soc: soc@ffe00000 {
54 ranges = <0x0 0x0 0xffe00000 0x100000>;
55 };
56
57 pci0: pcie@ffe09000 {
58 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
59 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
60 reg = <0 0xffe09000 0 0x1000>;
61 pcie@0 {
62 ranges = <0x2000000 0x0 0xa0000000
63 0x2000000 0x0 0xa0000000
64 0x0 0x20000000
65
66 0x1000000 0x0 0x0
67 0x1000000 0x0 0x0
68 0x0 0x100000>;
69 };
70 };
71
72 pci1: pcie@ffe0a000 {
73 reg = <0 0xffe0a000 0 0x1000>;
74 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
75 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
76 pcie@0 {
77 ranges = <0x2000000 0x0 0x80000000
78 0x2000000 0x0 0x80000000
79 0x0 0x20000000
80
81 0x1000000 0x0 0x0
82 0x1000000 0x0 0x0
83 0x0 0x100000>;
84 };
85 };
86
87 qe: qe@ffe80000 {
88 ranges = <0x0 0x0 0xffe80000 0x40000>;
89 reg = <0 0xffe80000 0 0x480>;
90 brg-frequency = <0>;
91 bus-frequency = <0>;
92 };
93};
94
95/include/ "p1021rdb.dtsi"
96/include/ "fsl/p1021si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1021rdb.dtsi b/arch/powerpc/boot/dts/p1021rdb.dtsi
new file mode 100644
index 00000000000..b973461ab75
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1021rdb.dtsi
@@ -0,0 +1,236 @@
1/*
2 * P1021 RDB Device Tree Source stub (no addresses or top-level ranges)
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35&lbc {
36 nor@0,0 {
37 #address-cells = <1>;
38 #size-cells = <1>;
39 compatible = "cfi-flash";
40 reg = <0x0 0x0 0x1000000>;
41 bank-width = <2>;
42 device-width = <1>;
43
44 partition@0 {
45 /* This location must not be altered */
46 /* 256KB for Vitesse 7385 Switch firmware */
47 reg = <0x0 0x00040000>;
48 label = "NOR Vitesse-7385 Firmware";
49 read-only;
50 };
51
52 partition@40000 {
53 /* 256KB for DTB Image */
54 reg = <0x00040000 0x00040000>;
55 label = "NOR DTB Image";
56 };
57
58 partition@80000 {
59 /* 3.5 MB for Linux Kernel Image */
60 reg = <0x00080000 0x00380000>;
61 label = "NOR Linux Kernel Image";
62 };
63
64 partition@400000 {
65 /* 11MB for JFFS2 based Root file System */
66 reg = <0x00400000 0x00b00000>;
67 label = "NOR JFFS2 Root File System";
68 };
69
70 partition@f00000 {
71 /* This location must not be altered */
72 /* 512KB for u-boot Bootloader Image */
73 /* 512KB for u-boot Environment Variables */
74 reg = <0x00f00000 0x00100000>;
75 label = "NOR U-Boot Image";
76 };
77 };
78
79 nand@1,0 {
80 #address-cells = <1>;
81 #size-cells = <1>;
82 compatible = "fsl,p1021-fcm-nand",
83 "fsl,elbc-fcm-nand";
84 reg = <0x1 0x0 0x40000>;
85
86 partition@0 {
87 /* This location must not be altered */
88 /* 1MB for u-boot Bootloader Image */
89 reg = <0x0 0x00100000>;
90 label = "NAND U-Boot Image";
91 read-only;
92 };
93
94 partition@100000 {
95 /* 1MB for DTB Image */
96 reg = <0x00100000 0x00100000>;
97 label = "NAND DTB Image";
98 };
99
100 partition@200000 {
101 /* 4MB for Linux Kernel Image */
102 reg = <0x00200000 0x00400000>;
103 label = "NAND Linux Kernel Image";
104 };
105
106 partition@600000 {
107 /* 4MB for Compressed Root file System Image */
108 reg = <0x00600000 0x00400000>;
109 label = "NAND Compressed RFS Image";
110 };
111
112 partition@a00000 {
113 /* 7MB for JFFS2 based Root file System */
114 reg = <0x00a00000 0x00700000>;
115 label = "NAND JFFS2 Root File System";
116 };
117
118 partition@1100000 {
119 /* 15MB for User Writable Area */
120 reg = <0x01100000 0x00f00000>;
121 label = "NAND Writable User area";
122 };
123 };
124
125 L2switch@2,0 {
126 #address-cells = <1>;
127 #size-cells = <1>;
128 compatible = "vitesse-7385";
129 reg = <0x2 0x0 0x20000>;
130 };
131};
132
133&soc {
134 i2c@3000 {
135 rtc@68 {
136 compatible = "pericom,pt7c4338";
137 reg = <0x68>;
138 };
139 };
140
141 spi@7000 {
142 flash@0 {
143 #address-cells = <1>;
144 #size-cells = <1>;
145 compatible = "spansion,s25sl12801";
146 reg = <0>;
147 spi-max-frequency = <40000000>; /* input clock */
148
149 partition@u-boot {
150 /* 512KB for u-boot Bootloader Image */
151 reg = <0x0 0x00080000>;
152 label = "SPI Flash U-Boot Image";
153 read-only;
154 };
155
156 partition@dtb {
157 /* 512KB for DTB Image */
158 reg = <0x00080000 0x00080000>;
159 label = "SPI Flash DTB Image";
160 };
161
162 partition@kernel {
163 /* 4MB for Linux Kernel Image */
164 reg = <0x00100000 0x00400000>;
165 label = "SPI Flash Linux Kernel Image";
166 };
167
168 partition@fs {
169 /* 4MB for Compressed RFS Image */
170 reg = <0x00500000 0x00400000>;
171 label = "SPI Flash Compressed RFSImage";
172 };
173
174 partition@jffs-fs {
175 /* 7MB for JFFS2 based RFS */
176 reg = <0x00900000 0x00700000>;
177 label = "SPI Flash JFFS2 RFS";
178 };
179 };
180 };
181
182 usb@22000 {
183 phy_type = "ulpi";
184 };
185
186 mdio@24000 {
187 phy0: ethernet-phy@0 {
188 interrupt-parent = <&mpic>;
189 interrupts = <3 1 0 0>;
190 reg = <0x0>;
191 };
192
193 phy1: ethernet-phy@1 {
194 interrupt-parent = <&mpic>;
195 interrupts = <2 1 0 0>;
196 reg = <0x1>;
197 };
198
199 tbi0: tbi-phy@11 {
200 reg = <0x11>;
201 device_type = "tbi-phy";
202 };
203 };
204
205 mdio@25000 {
206 tbi1: tbi-phy@11 {
207 reg = <0x11>;
208 device_type = "tbi-phy";
209 };
210 };
211
212 mdio@26000 {
213 tbi2: tbi-phy@11 {
214 reg = <0x11>;
215 device_type = "tbi-phy";
216 };
217 };
218
219 enet0: ethernet@b0000 {
220 fixed-link = <1 1 1000 0 0>;
221 phy-connection-type = "rgmii-id";
222
223 };
224
225 enet1: ethernet@b1000 {
226 phy-handle = <&phy0>;
227 tbi-handle = <&tbi1>;
228 phy-connection-type = "sgmii";
229 };
230
231 enet2: ethernet@b2000 {
232 phy-handle = <&phy1>;
233 tbi-handle = <&tbi2>;
234 phy-connection-type = "rgmii-id";
235 };
236};
diff --git a/arch/powerpc/boot/dts/p1021rdb_36b.dts b/arch/powerpc/boot/dts/p1021rdb_36b.dts
new file mode 100644
index 00000000000..ea6d8b5fa10
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1021rdb_36b.dts
@@ -0,0 +1,96 @@
1/*
2 * P1021 RDB Device Tree Source (36-bit address map)
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p1021si-pre.dtsi"
36/ {
37 model = "fsl,P1021RDB";
38 compatible = "fsl,P1021RDB-PC";
39
40 memory {
41 device_type = "memory";
42 };
43
44 lbc: localbus@fffe05000 {
45 reg = <0xf 0xffe05000 0 0x1000>;
46
47 /* NOR, NAND Flashes and Vitesse 5 port L2 switch */
48 ranges = <0x0 0x0 0xf 0xef000000 0x01000000
49 0x1 0x0 0xf 0xff800000 0x00040000
50 0x2 0x0 0xf 0xffb00000 0x00020000>;
51 };
52
53 soc: soc@fffe00000 {
54 ranges = <0x0 0xf 0xffe00000 0x100000>;
55 };
56
57 pci0: pcie@fffe09000 {
58 ranges = <0x2000000 0x0 0xc0000000 0xc 0x20000000 0x0 0x20000000
59 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
60 reg = <0xf 0xffe09000 0 0x1000>;
61 pcie@0 {
62 ranges = <0x2000000 0x0 0xa0000000
63 0x2000000 0x0 0xa0000000
64 0x0 0x20000000
65
66 0x1000000 0x0 0x0
67 0x1000000 0x0 0x0
68 0x0 0x100000>;
69 };
70 };
71
72 pci1: pcie@fffe0a000 {
73 reg = <0xf 0xffe0a000 0 0x1000>;
74 ranges = <0x2000000 0x0 0x80000000 0xc 0x00000000 0x0 0x20000000
75 0x1000000 0x0 0x00000000 0xf 0xffc00000 0x0 0x10000>;
76 pcie@0 {
77 ranges = <0x2000000 0x0 0xc0000000
78 0x2000000 0x0 0xc0000000
79 0x0 0x20000000
80
81 0x1000000 0x0 0x0
82 0x1000000 0x0 0x0
83 0x0 0x100000>;
84 };
85 };
86
87 qe: qe@fffe80000 {
88 ranges = <0x0 0xf 0xffe80000 0x40000>;
89 reg = <0xf 0xffe80000 0 0x480>;
90 brg-frequency = <0>;
91 bus-frequency = <0>;
92 };
93};
94
95/include/ "p1021rdb.dtsi"
96/include/ "fsl/p1021si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1022ds.dts b/arch/powerpc/boot/dts/p1022ds.dts
deleted file mode 100644
index ef95717db4b..00000000000
--- a/arch/powerpc/boot/dts/p1022ds.dts
+++ /dev/null
@@ -1,274 +0,0 @@
1/*
2 * P1022 DS 36Bit Physical Address Map Device Tree Source
3 *
4 * Copyright 2010 Freescale Semiconductor, Inc.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/include/ "fsl/p1022si-pre.dtsi"
12/ {
13 model = "fsl,P1022DS";
14 compatible = "fsl,P1022DS";
15
16 memory {
17 device_type = "memory";
18 };
19
20 lbc: localbus@fffe05000 {
21 reg = <0xf 0xffe05000 0 0x1000>;
22 ranges = <0x0 0x0 0xf 0xe8000000 0x08000000
23 0x1 0x0 0xf 0xe0000000 0x08000000
24 0x2 0x0 0xf 0xff800000 0x00040000
25 0x3 0x0 0xf 0xffdf0000 0x00008000>;
26
27 /*
28 * This node is used to access the pixis via "indirect" mode,
29 * which is done by writing the pixis register index to chip
30 * select 0 and the value to/from chip select 1. Indirect
31 * mode is the only way to access the pixis when DIU video
32 * is enabled. Note that this assumes that the first column
33 * of the 'ranges' property above is the chip select number.
34 */
35 board-control@0,0 {
36 compatible = "fsl,p1022ds-indirect-pixis";
37 reg = <0x0 0x0 1 /* CS0 */
38 0x1 0x0 1>; /* CS1 */
39 };
40
41 nor@0,0 {
42 #address-cells = <1>;
43 #size-cells = <1>;
44 compatible = "cfi-flash";
45 reg = <0x0 0x0 0x8000000>;
46 bank-width = <2>;
47 device-width = <1>;
48
49 partition@0 {
50 reg = <0x0 0x03000000>;
51 label = "ramdisk-nor";
52 read-only;
53 };
54
55 partition@3000000 {
56 reg = <0x03000000 0x00e00000>;
57 label = "diagnostic-nor";
58 read-only;
59 };
60
61 partition@3e00000 {
62 reg = <0x03e00000 0x00200000>;
63 label = "dink-nor";
64 read-only;
65 };
66
67 partition@4000000 {
68 reg = <0x04000000 0x00400000>;
69 label = "kernel-nor";
70 read-only;
71 };
72
73 partition@4400000 {
74 reg = <0x04400000 0x03b00000>;
75 label = "jffs2-nor";
76 };
77
78 partition@7f00000 {
79 reg = <0x07f00000 0x00080000>;
80 label = "dtb-nor";
81 read-only;
82 };
83
84 partition@7f80000 {
85 reg = <0x07f80000 0x00080000>;
86 label = "u-boot-nor";
87 read-only;
88 };
89 };
90
91 nand@2,0 {
92 #address-cells = <1>;
93 #size-cells = <1>;
94 compatible = "fsl,elbc-fcm-nand";
95 reg = <0x2 0x0 0x40000>;
96
97 partition@0 {
98 reg = <0x0 0x02000000>;
99 label = "u-boot-nand";
100 read-only;
101 };
102
103 partition@2000000 {
104 reg = <0x02000000 0x10000000>;
105 label = "jffs2-nand";
106 };
107
108 partition@12000000 {
109 reg = <0x12000000 0x10000000>;
110 label = "ramdisk-nand";
111 read-only;
112 };
113
114 partition@22000000 {
115 reg = <0x22000000 0x04000000>;
116 label = "kernel-nand";
117 };
118
119 partition@26000000 {
120 reg = <0x26000000 0x01000000>;
121 label = "dtb-nand";
122 read-only;
123 };
124
125 partition@27000000 {
126 reg = <0x27000000 0x19000000>;
127 label = "reserved-nand";
128 };
129 };
130
131 board-control@3,0 {
132 compatible = "fsl,p1022ds-fpga", "fsl,fpga-ngpixis";
133 reg = <3 0 0x30>;
134 interrupt-parent = <&mpic>;
135 /*
136 * IRQ8 is generated if the "EVENT" switch is pressed
137 * and PX_CTL[EVESEL] is set to 00.
138 */
139 interrupts = <8 8 0 0>;
140 };
141 };
142
143 soc: soc@fffe00000 {
144 ranges = <0x0 0xf 0xffe00000 0x100000>;
145
146 i2c@3100 {
147 wm8776:codec@1a {
148 compatible = "wlf,wm8776";
149 reg = <0x1a>;
150 /*
151 * clock-frequency will be set by U-Boot if
152 * the clock is enabled.
153 */
154 };
155 };
156
157 spi@7000 {
158 flash@0 {
159 #address-cells = <1>;
160 #size-cells = <1>;
161 compatible = "spansion,s25sl12801";
162 reg = <0>;
163 spi-max-frequency = <40000000>; /* input clock */
164
165 partition@0 {
166 label = "u-boot-spi";
167 reg = <0x00000000 0x00100000>;
168 read-only;
169 };
170 partition@100000 {
171 label = "kernel-spi";
172 reg = <0x00100000 0x00500000>;
173 read-only;
174 };
175 partition@600000 {
176 label = "dtb-spi";
177 reg = <0x00600000 0x00100000>;
178 read-only;
179 };
180 partition@700000 {
181 label = "file system-spi";
182 reg = <0x00700000 0x00900000>;
183 };
184 };
185 };
186
187 ssi@15000 {
188 fsl,mode = "i2s-slave";
189 codec-handle = <&wm8776>;
190 fsl,ssi-asynchronous;
191 };
192
193 usb@22000 {
194 phy_type = "ulpi";
195 };
196
197 usb@23000 {
198 status = "disabled";
199 };
200
201 mdio@24000 {
202 phy0: ethernet-phy@0 {
203 interrupts = <3 1 0 0>;
204 reg = <0x1>;
205 };
206 phy1: ethernet-phy@1 {
207 interrupts = <9 1 0 0>;
208 reg = <0x2>;
209 };
210 tbi-phy@2 {
211 device_type = "tbi-phy";
212 reg = <0x2>;
213 };
214 };
215
216 ethernet@b0000 {
217 phy-handle = <&phy0>;
218 phy-connection-type = "rgmii-id";
219 };
220
221 ethernet@b1000 {
222 phy-handle = <&phy1>;
223 phy-connection-type = "rgmii-id";
224 };
225 };
226
227 pci0: pcie@fffe09000 {
228 reg = <0xf 0xffe09000 0 0x1000>;
229 ranges = <0x2000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
230 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
231 pcie@0 {
232 ranges = <0x2000000 0x0 0xe0000000
233 0x2000000 0x0 0xe0000000
234 0x0 0x20000000
235
236 0x1000000 0x0 0x0
237 0x1000000 0x0 0x0
238 0x0 0x100000>;
239 };
240 };
241
242 pci1: pcie@fffe0a000 {
243 reg = <0xf 0xffe0a000 0 0x1000>;
244 ranges = <0x2000000 0x0 0xe0000000 0xc 0x40000000 0x0 0x20000000
245 0x1000000 0x0 0x00000000 0xf 0xffc20000 0x0 0x10000>;
246 pcie@0 {
247 reg = <0x0 0x0 0x0 0x0 0x0>;
248 ranges = <0x2000000 0x0 0xe0000000
249 0x2000000 0x0 0xe0000000
250 0x0 0x20000000
251
252 0x1000000 0x0 0x0
253 0x1000000 0x0 0x0
254 0x0 0x100000>;
255 };
256 };
257
258 pci2: pcie@fffe0b000 {
259 reg = <0xf 0xffe0b000 0 0x1000>;
260 ranges = <0x2000000 0x0 0xe0000000 0xc 0x00000000 0x0 0x20000000
261 0x1000000 0x0 0x00000000 0xf 0xffc00000 0x0 0x10000>;
262 pcie@0 {
263 ranges = <0x2000000 0x0 0xe0000000
264 0x2000000 0x0 0xe0000000
265 0x0 0x20000000
266
267 0x1000000 0x0 0x0
268 0x1000000 0x0 0x0
269 0x0 0x100000>;
270 };
271 };
272};
273
274/include/ "fsl/p1022si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1022ds.dtsi b/arch/powerpc/boot/dts/p1022ds.dtsi
new file mode 100644
index 00000000000..7cdb505036b
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1022ds.dtsi
@@ -0,0 +1,234 @@
1/*
2 * P1022 DS Device Tree Source stub (no addresses or top-level ranges)
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35&board_lbc {
36 /*
37 * This node is used to access the pixis via "indirect" mode,
38 * which is done by writing the pixis register index to chip
39 * select 0 and the value to/from chip select 1. Indirect
40 * mode is the only way to access the pixis when DIU video
41 * is enabled. Note that this assumes that the first column
42 * of the 'ranges' property above is the chip select number.
43 */
44 board-control@0,0 {
45 compatible = "fsl,p1022ds-indirect-pixis";
46 reg = <0x0 0x0 1 /* CS0 */
47 0x1 0x0 1>; /* CS1 */
48 interrupt-parent = <&mpic>;
49 interrupts = <8 0 0 0>;
50 };
51
52 nor@0,0 {
53 #address-cells = <1>;
54 #size-cells = <1>;
55 compatible = "cfi-flash";
56 reg = <0x0 0x0 0x8000000>;
57 bank-width = <2>;
58 device-width = <1>;
59
60 partition@0 {
61 reg = <0x0 0x03000000>;
62 label = "ramdisk-nor";
63 read-only;
64 };
65
66 partition@3000000 {
67 reg = <0x03000000 0x00e00000>;
68 label = "diagnostic-nor";
69 read-only;
70 };
71
72 partition@3e00000 {
73 reg = <0x03e00000 0x00200000>;
74 label = "dink-nor";
75 read-only;
76 };
77
78 partition@4000000 {
79 reg = <0x04000000 0x00400000>;
80 label = "kernel-nor";
81 read-only;
82 };
83
84 partition@4400000 {
85 reg = <0x04400000 0x03b00000>;
86 label = "jffs2-nor";
87 };
88
89 partition@7f00000 {
90 reg = <0x07f00000 0x00080000>;
91 label = "dtb-nor";
92 read-only;
93 };
94
95 partition@7f80000 {
96 reg = <0x07f80000 0x00080000>;
97 label = "u-boot-nor";
98 read-only;
99 };
100 };
101
102 nand@2,0 {
103 #address-cells = <1>;
104 #size-cells = <1>;
105 compatible = "fsl,elbc-fcm-nand";
106 reg = <0x2 0x0 0x40000>;
107
108 partition@0 {
109 reg = <0x0 0x02000000>;
110 label = "u-boot-nand";
111 read-only;
112 };
113
114 partition@2000000 {
115 reg = <0x02000000 0x10000000>;
116 label = "jffs2-nand";
117 };
118
119 partition@12000000 {
120 reg = <0x12000000 0x10000000>;
121 label = "ramdisk-nand";
122 read-only;
123 };
124
125 partition@22000000 {
126 reg = <0x22000000 0x04000000>;
127 label = "kernel-nand";
128 };
129
130 partition@26000000 {
131 reg = <0x26000000 0x01000000>;
132 label = "dtb-nand";
133 read-only;
134 };
135
136 partition@27000000 {
137 reg = <0x27000000 0x19000000>;
138 label = "reserved-nand";
139 };
140 };
141
142 board-control@3,0 {
143 compatible = "fsl,p1022ds-fpga", "fsl,fpga-ngpixis";
144 reg = <3 0 0x30>;
145 interrupt-parent = <&mpic>;
146 /*
147 * IRQ8 is generated if the "EVENT" switch is pressed
148 * and PX_CTL[EVESEL] is set to 00.
149 */
150 interrupts = <8 0 0 0>;
151 };
152};
153
154&board_soc {
155 i2c@3100 {
156 wm8776:codec@1a {
157 compatible = "wlf,wm8776";
158 reg = <0x1a>;
159 /*
160 * clock-frequency will be set by U-Boot if
161 * the clock is enabled.
162 */
163 };
164 };
165
166 spi@7000 {
167 flash@0 {
168 #address-cells = <1>;
169 #size-cells = <1>;
170 compatible = "spansion,s25sl12801";
171 reg = <0>;
172 spi-max-frequency = <40000000>; /* input clock */
173
174 partition@0 {
175 label = "u-boot-spi";
176 reg = <0x00000000 0x00100000>;
177 read-only;
178 };
179 partition@100000 {
180 label = "kernel-spi";
181 reg = <0x00100000 0x00500000>;
182 read-only;
183 };
184 partition@600000 {
185 label = "dtb-spi";
186 reg = <0x00600000 0x00100000>;
187 read-only;
188 };
189 partition@700000 {
190 label = "file system-spi";
191 reg = <0x00700000 0x00900000>;
192 };
193 };
194 };
195
196 ssi@15000 {
197 fsl,mode = "i2s-slave";
198 codec-handle = <&wm8776>;
199 fsl,ssi-asynchronous;
200 };
201
202 usb@22000 {
203 phy_type = "ulpi";
204 };
205
206 usb@23000 {
207 status = "disabled";
208 };
209
210 mdio@24000 {
211 phy0: ethernet-phy@0 {
212 interrupts = <3 1 0 0>;
213 reg = <0x1>;
214 };
215 phy1: ethernet-phy@1 {
216 interrupts = <9 1 0 0>;
217 reg = <0x2>;
218 };
219 tbi-phy@2 {
220 device_type = "tbi-phy";
221 reg = <0x2>;
222 };
223 };
224
225 ethernet@b0000 {
226 phy-handle = <&phy0>;
227 phy-connection-type = "rgmii-id";
228 };
229
230 ethernet@b1000 {
231 phy-handle = <&phy1>;
232 phy-connection-type = "rgmii-id";
233 };
234};
diff --git a/arch/powerpc/boot/dts/p1022ds_32b.dts b/arch/powerpc/boot/dts/p1022ds_32b.dts
new file mode 100644
index 00000000000..d96cae00a9e
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1022ds_32b.dts
@@ -0,0 +1,103 @@
1/*
2 * P1022 DS 32-bit Physical Address Map Device Tree Source
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p1022si-pre.dtsi"
36/ {
37 model = "fsl,P1022DS";
38 compatible = "fsl,P1022DS";
39
40 memory {
41 device_type = "memory";
42 };
43
44 board_lbc: lbc: localbus@ffe05000 {
45 ranges = <0x0 0x0 0x0 0xe8000000 0x08000000
46 0x1 0x0 0x0 0xe0000000 0x08000000
47 0x2 0x0 0x0 0xff800000 0x00040000
48 0x3 0x0 0x0 0xffdf0000 0x00008000>;
49 reg = <0x0 0xffe05000 0 0x1000>;
50 };
51
52 board_soc: soc: soc@ffe00000 {
53 ranges = <0x0 0x0 0xffe00000 0x100000>;
54 };
55
56 pci0: pcie@ffe09000 {
57 ranges = <0x2000000 0x0 0xe0000000 0 0xa0000000 0x0 0x20000000
58 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
59 reg = <0x0 0xffe09000 0 0x1000>;
60 pcie@0 {
61 ranges = <0x2000000 0x0 0xe0000000
62 0x2000000 0x0 0xe0000000
63 0x0 0x20000000
64
65 0x1000000 0x0 0x0
66 0x1000000 0x0 0x0
67 0x0 0x100000>;
68 };
69 };
70
71 pci1: pcie@ffe0a000 {
72 ranges = <0x2000000 0x0 0xe0000000 0 0xc0000000 0x0 0x20000000
73 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x10000>;
74 reg = <0 0xffe0a000 0 0x1000>;
75 pcie@0 {
76 ranges = <0x2000000 0x0 0xe0000000
77 0x2000000 0x0 0xe0000000
78 0x0 0x20000000
79
80 0x1000000 0x0 0x0
81 0x1000000 0x0 0x0
82 0x0 0x100000>;
83 };
84 };
85
86 pci2: pcie@ffe0b000 {
87 ranges = <0x2000000 0x0 0xe0000000 0 0x80000000 0x0 0x20000000
88 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
89 reg = <0 0xffe0b000 0 0x1000>;
90 pcie@0 {
91 ranges = <0x2000000 0x0 0xe0000000
92 0x2000000 0x0 0xe0000000
93 0x0 0x20000000
94
95 0x1000000 0x0 0x0
96 0x1000000 0x0 0x0
97 0x0 0x100000>;
98 };
99 };
100};
101
102/include/ "fsl/p1022si-post.dtsi"
103/include/ "p1022ds.dtsi"
diff --git a/arch/powerpc/boot/dts/p1022ds_36b.dts b/arch/powerpc/boot/dts/p1022ds_36b.dts
new file mode 100644
index 00000000000..f7aacce40bf
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1022ds_36b.dts
@@ -0,0 +1,103 @@
1/*
2 * P1022 DS 36-bit Physical Address Map Device Tree Source
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p1022si-pre.dtsi"
36/ {
37 model = "fsl,P1022DS";
38 compatible = "fsl,P1022DS";
39
40 memory {
41 device_type = "memory";
42 };
43
44 board_lbc: lbc: localbus@fffe05000 {
45 ranges = <0x0 0x0 0xf 0xe8000000 0x08000000
46 0x1 0x0 0xf 0xe0000000 0x08000000
47 0x2 0x0 0xf 0xff800000 0x00040000
48 0x3 0x0 0xf 0xffdf0000 0x00008000>;
49 reg = <0xf 0xffe05000 0 0x1000>;
50 };
51
52 board_soc: soc: soc@fffe00000 {
53 ranges = <0x0 0xf 0xffe00000 0x100000>;
54 };
55
56 pci0: pcie@fffe09000 {
57 ranges = <0x2000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
58 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
59 reg = <0xf 0xffe09000 0 0x1000>;
60 pcie@0 {
61 ranges = <0x2000000 0x0 0xe0000000
62 0x2000000 0x0 0xe0000000
63 0x0 0x20000000
64
65 0x1000000 0x0 0x0
66 0x1000000 0x0 0x0
67 0x0 0x100000>;
68 };
69 };
70
71 pci1: pcie@fffe0a000 {
72 ranges = <0x2000000 0x0 0xe0000000 0xc 0x40000000 0x0 0x20000000
73 0x1000000 0x0 0x00000000 0xf 0xffc20000 0x0 0x10000>;
74 reg = <0xf 0xffe0a000 0 0x1000>;
75 pcie@0 {
76 ranges = <0x2000000 0x0 0xe0000000
77 0x2000000 0x0 0xe0000000
78 0x0 0x20000000
79
80 0x1000000 0x0 0x0
81 0x1000000 0x0 0x0
82 0x0 0x100000>;
83 };
84 };
85
86 pci2: pcie@fffe0b000 {
87 ranges = <0x2000000 0x0 0xe0000000 0xc 0x00000000 0x0 0x20000000
88 0x1000000 0x0 0x00000000 0xf 0xffc00000 0x0 0x10000>;
89 reg = <0xf 0xffe0b000 0 0x1000>;
90 pcie@0 {
91 ranges = <0x2000000 0x0 0xe0000000
92 0x2000000 0x0 0xe0000000
93 0x0 0x20000000
94
95 0x1000000 0x0 0x0
96 0x1000000 0x0 0x0
97 0x0 0x100000>;
98 };
99 };
100};
101
102/include/ "fsl/p1022si-post.dtsi"
103/include/ "p1022ds.dtsi"
diff --git a/arch/powerpc/boot/dts/p1025rdb.dtsi b/arch/powerpc/boot/dts/p1025rdb.dtsi
new file mode 100644
index 00000000000..cf3676fc714
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1025rdb.dtsi
@@ -0,0 +1,286 @@
1/*
2 * P1025 RDB Device Tree Source stub (no addresses or top-level ranges)
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35&lbc {
36 nor@0,0 {
37 #address-cells = <1>;
38 #size-cells = <1>;
39 compatible = "cfi-flash";
40 reg = <0x0 0x0 0x1000000>;
41 bank-width = <2>;
42 device-width = <1>;
43
44 partition@0 {
45 /* This location must not be altered */
46 /* 256KB for Vitesse 7385 Switch firmware */
47 reg = <0x0 0x00040000>;
48 label = "NOR Vitesse-7385 Firmware";
49 read-only;
50 };
51
52 partition@40000 {
53 /* 256KB for DTB Image */
54 reg = <0x00040000 0x00040000>;
55 label = "NOR DTB Image";
56 };
57
58 partition@80000 {
59 /* 3.5 MB for Linux Kernel Image */
60 reg = <0x00080000 0x00380000>;
61 label = "NOR Linux Kernel Image";
62 };
63
64 partition@400000 {
65 /* 11MB for JFFS2 based Root file System */
66 reg = <0x00400000 0x00b00000>;
67 label = "NOR JFFS2 Root File System";
68 };
69
70 partition@f00000 {
71 /* This location must not be altered */
72 /* 512KB for u-boot Bootloader Image */
73 /* 512KB for u-boot Environment Variables */
74 reg = <0x00f00000 0x00100000>;
75 label = "NOR U-Boot Image";
76 read-only;
77 };
78 };
79
80 nand@1,0 {
81 #address-cells = <1>;
82 #size-cells = <1>;
83 compatible = "fsl,p1025-fcm-nand",
84 "fsl,elbc-fcm-nand";
85 reg = <0x1 0x0 0x40000>;
86
87 partition@0 {
88 /* This location must not be altered */
89 /* 1MB for u-boot Bootloader Image */
90 reg = <0x0 0x00100000>;
91 label = "NAND U-Boot Image";
92 read-only;
93 };
94
95 partition@100000 {
96 /* 1MB for DTB Image */
97 reg = <0x00100000 0x00100000>;
98 label = "NAND DTB Image";
99 };
100
101 partition@200000 {
102 /* 4MB for Linux Kernel Image */
103 reg = <0x00200000 0x00400000>;
104 label = "NAND Linux Kernel Image";
105 };
106
107 partition@600000 {
108 /* 4MB for Compressed Root file System Image */
109 reg = <0x00600000 0x00400000>;
110 label = "NAND Compressed RFS Image";
111 };
112
113 partition@a00000 {
114 /* 7MB for JFFS2 based Root file System */
115 reg = <0x00a00000 0x00700000>;
116 label = "NAND JFFS2 Root File System";
117 };
118
119 partition@1100000 {
120 /* 15MB for JFFS2 based Root file System */
121 reg = <0x01100000 0x00f00000>;
122 label = "NAND Writable User area";
123 };
124 };
125
126};
127
128&soc {
129 i2c@3000 {
130 rtc@68 {
131 compatible = "dallas,ds1339";
132 reg = <0x68>;
133 };
134 };
135
136 spi@7000 {
137 flash@0 {
138 #address-cells = <1>;
139 #size-cells = <1>;
140 compatible = "spansion,s25sl12801";
141 reg = <0>;
142 spi-max-frequency = <40000000>; /* input clock */
143
144 partition@u-boot {
145 /* 512KB for u-boot Bootloader Image */
146 reg = <0x0 0x00080000>;
147 label = "u-boot";
148 read-only;
149 };
150
151 partition@dtb {
152 /* 512KB for DTB Image */
153 reg = <0x00080000 0x00080000>;
154 label = "dtb";
155 };
156
157 partition@kernel {
158 /* 4MB for Linux Kernel Image */
159 reg = <0x00100000 0x00400000>;
160 label = "kernel";
161 };
162
163 partition@fs {
164 /* 4MB for Compressed RFS Image */
165 reg = <0x00500000 0x00400000>;
166 label = "file system";
167 };
168
169 partition@jffs-fs {
170 /* 7MB for JFFS2 based RFS */
171 reg = <0x00900000 0x00700000>;
172 label = "file system jffs2";
173 };
174 };
175 };
176
177 usb@22000 {
178 phy_type = "ulpi";
179 };
180
181 /* USB2 is shared with localbus, so it must be disabled
182 by default. We can't put 'status = "disabled";' here
183 since U-Boot doesn't clear the status property when
184 it enables USB2. OTOH, U-Boot does create a new node
185 when there isn't any. So, just comment it out.
186 usb@23000 {
187 phy_type = "ulpi";
188 };
189 */
190
191 mdio@24000 {
192 phy0: ethernet-phy@0 {
193 interrupt-parent = <&mpic>;
194 interrupts = <3 1>;
195 reg = <0x0>;
196 };
197
198 phy1: ethernet-phy@1 {
199 interrupt-parent = <&mpic>;
200 interrupts = <2 1>;
201 reg = <0x1>;
202 };
203
204 tbi0: tbi-phy@11 {
205 reg = <0x11>;
206 device_type = "tbi-phy";
207 };
208 };
209
210 mdio@25000 {
211 tbi1: tbi-phy@11 {
212 reg = <0x11>;
213 device_type = "tbi-phy";
214 };
215 };
216
217 mdio@26000 {
218 tbi2: tbi-phy@11 {
219 reg = <0x11>;
220 device_type = "tbi-phy";
221 };
222 };
223
224 enet0: ethernet@b0000 {
225 fixed-link = <1 1 1000 0 0>;
226 phy-connection-type = "rgmii-id";
227
228 };
229
230 enet1: ethernet@b1000 {
231 phy-handle = <&phy0>;
232 tbi-handle = <&tbi1>;
233 phy-connection-type = "sgmii";
234 };
235
236 enet2: ethernet@b2000 {
237 phy-handle = <&phy1>;
238 phy-connection-type = "rgmii-id";
239 };
240
241 par_io@e0100 {
242 #address-cells = <1>;
243 #size-cells = <1>;
244 reg = <0xe0100 0x60>;
245 ranges = <0x0 0xe0100 0x60>;
246 device_type = "par_io";
247 num-ports = <3>;
248 pio1: ucc_pin@01 {
249 pio-map = <
250 /* port pin dir open_drain assignment has_irq */
251 0x1 0x13 0x1 0x0 0x1 0x0 /* QE_MUX_MDC */
252 0x1 0x14 0x3 0x0 0x1 0x0 /* QE_MUX_MDIO */
253 0x0 0x17 0x2 0x0 0x2 0x0 /* CLK12 */
254 0x0 0x18 0x2 0x0 0x1 0x0 /* CLK9 */
255 0x0 0x7 0x1 0x0 0x2 0x0 /* ENET1_TXD0_SER1_TXD0 */
256 0x0 0x9 0x1 0x0 0x2 0x0 /* ENET1_TXD1_SER1_TXD1 */
257 0x0 0xb 0x1 0x0 0x2 0x0 /* ENET1_TXD2_SER1_TXD2 */
258 0x0 0xc 0x1 0x0 0x2 0x0 /* ENET1_TXD3_SER1_TXD3 */
259 0x0 0x6 0x2 0x0 0x2 0x0 /* ENET1_RXD0_SER1_RXD0 */
260 0x0 0xa 0x2 0x0 0x2 0x0 /* ENET1_RXD1_SER1_RXD1 */
261 0x0 0xe 0x2 0x0 0x2 0x0 /* ENET1_RXD2_SER1_RXD2 */
262 0x0 0xf 0x2 0x0 0x2 0x0 /* ENET1_RXD3_SER1_RXD3 */
263 0x0 0x5 0x1 0x0 0x2 0x0 /* ENET1_TX_EN_SER1_RTS_B */
264 0x0 0xd 0x1 0x0 0x2 0x0 /* ENET1_TX_ER */
265 0x0 0x4 0x2 0x0 0x2 0x0 /* ENET1_RX_DV_SER1_CTS_B */
266 0x0 0x8 0x2 0x0 0x2 0x0 /* ENET1_RX_ER_SER1_CD_B */
267 0x0 0x11 0x2 0x0 0x2 0x0 /* ENET1_CRS */
268 0x0 0x10 0x2 0x0 0x2 0x0>; /* ENET1_COL */
269 };
270
271 pio2: ucc_pin@02 {
272 pio-map = <
273 /* port pin dir open_drain assignment has_irq */
274 0x1 0x13 0x1 0x0 0x1 0x0 /* QE_MUX_MDC */
275 0x1 0x14 0x3 0x0 0x1 0x0 /* QE_MUX_MDIO */
276 0x1 0xb 0x2 0x0 0x1 0x0 /* CLK13 */
277 0x1 0x7 0x1 0x0 0x2 0x0 /* ENET5_TXD0_SER5_TXD0 */
278 0x1 0xa 0x1 0x0 0x2 0x0 /* ENET5_TXD1_SER5_TXD1 */
279 0x1 0x6 0x2 0x0 0x2 0x0 /* ENET5_RXD0_SER5_RXD0 */
280 0x1 0x9 0x2 0x0 0x2 0x0 /* ENET5_RXD1_SER5_RXD1 */
281 0x1 0x5 0x1 0x0 0x2 0x0 /* ENET5_TX_EN_SER5_RTS_B */
282 0x1 0x4 0x2 0x0 0x2 0x0 /* ENET5_RX_DV_SER5_CTS_B */
283 0x1 0x8 0x2 0x0 0x2 0x0>; /* ENET5_RX_ER_SER5_CD_B */
284 };
285 };
286};
diff --git a/arch/powerpc/boot/dts/p1025rdb_32b.dts b/arch/powerpc/boot/dts/p1025rdb_32b.dts
new file mode 100644
index 00000000000..ac5729c14ed
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1025rdb_32b.dts
@@ -0,0 +1,135 @@
1/*
2 * P1025 RDB Device Tree Source (32-bit address map)
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p1021si-pre.dtsi"
36/ {
37 model = "fsl,P1025RDB";
38 compatible = "fsl,P1025RDB";
39
40 memory {
41 device_type = "memory";
42 };
43
44 lbc: localbus@ffe05000 {
45 reg = <0 0xffe05000 0 0x1000>;
46
47 /* NOR, NAND Flashes */
48 ranges = <0x0 0x0 0x0 0xef000000 0x01000000
49 0x1 0x0 0x0 0xff800000 0x00040000>;
50 };
51
52 soc: soc@ffe00000 {
53 ranges = <0x0 0x0 0xffe00000 0x100000>;
54 };
55
56 pci0: pcie@ffe09000 {
57 ranges = <0x2000000 0x0 0xe0000000 0 0xe0000000 0x0 0x20000000
58 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
59 reg = <0 0xffe09000 0 0x1000>;
60 pcie@0 {
61 ranges = <0x2000000 0x0 0xe0000000
62 0x2000000 0x0 0xe0000000
63 0x0 0x20000000
64
65 0x1000000 0x0 0x0
66 0x1000000 0x0 0x0
67 0x0 0x100000>;
68 };
69 };
70
71 pci1: pcie@ffe0a000 {
72 reg = <0 0xffe0a000 0 0x1000>;
73 ranges = <0x2000000 0x0 0xe0000000 0 0xe0000000 0x0 0x20000000
74 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
75 pcie@0 {
76 ranges = <0x2000000 0x0 0xe0000000
77 0x2000000 0x0 0xe0000000
78 0x0 0x20000000
79
80 0x1000000 0x0 0x0
81 0x1000000 0x0 0x0
82 0x0 0x100000>;
83 };
84 };
85
86 qe: qe@ffe80000 {
87 ranges = <0x0 0x0 0xffe80000 0x40000>;
88 reg = <0 0xffe80000 0 0x480>;
89 brg-frequency = <0>;
90 bus-frequency = <0>;
91 status = "disabled"; /* no firmware loaded */
92
93 enet3: ucc@2000 {
94 device_type = "network";
95 compatible = "ucc_geth";
96 rx-clock-name = "clk12";
97 tx-clock-name = "clk9";
98 pio-handle = <&pio1>;
99 phy-handle = <&qe_phy0>;
100 phy-connection-type = "mii";
101 };
102
103 mdio@2120 {
104 qe_phy0: ethernet-phy@0 {
105 interrupt-parent = <&mpic>;
106 interrupts = <4 1 0 0>;
107 reg = <0x6>;
108 device_type = "ethernet-phy";
109 };
110 qe_phy1: ethernet-phy@03 {
111 interrupt-parent = <&mpic>;
112 interrupts = <5 1 0 0>;
113 reg = <0x3>;
114 device_type = "ethernet-phy";
115 };
116 tbi-phy@11 {
117 reg = <0x11>;
118 device_type = "tbi-phy";
119 };
120 };
121
122 enet4: ucc@2400 {
123 device_type = "network";
124 compatible = "ucc_geth";
125 rx-clock-name = "none";
126 tx-clock-name = "clk13";
127 pio-handle = <&pio2>;
128 phy-handle = <&qe_phy1>;
129 phy-connection-type = "rmii";
130 };
131 };
132};
133
134/include/ "p1025rdb.dtsi"
135/include/ "fsl/p1021si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1025rdb_36b.dts b/arch/powerpc/boot/dts/p1025rdb_36b.dts
new file mode 100644
index 00000000000..4ce4bfa0eda
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1025rdb_36b.dts
@@ -0,0 +1,88 @@
1/*
2 * P1025 RDB Device Tree Source (36-bit address map)
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p1021si-pre.dtsi"
36/ {
37 model = "fsl,P1025RDB";
38 compatible = "fsl,P1025RDB";
39
40 memory {
41 device_type = "memory";
42 };
43
44 lbc: localbus@fffe05000 {
45 reg = <0xf 0xffe05000 0 0x1000>;
46
47 /* NOR, NAND Flashes */
48 ranges = <0x0 0x0 0xf 0xef000000 0x01000000
49 0x1 0x0 0xf 0xff800000 0x00040000>;
50 };
51
52 soc: soc@fffe00000 {
53 ranges = <0x0 0xf 0xffe00000 0x100000>;
54 };
55
56 pci0: pcie@fffe09000 {
57 reg = <0xf 0xffe09000 0 0x1000>;
58 ranges = <0x2000000 0x0 0xe0000000 0xe 0x20000000 0x0 0x20000000
59 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
60 pcie@0 {
61 ranges = <0x2000000 0x0 0xe0000000
62 0x2000000 0x0 0xe0000000
63 0x0 0x20000000
64
65 0x1000000 0x0 0x0
66 0x1000000 0x0 0x0
67 0x0 0x100000>;
68 };
69 };
70
71 pci1: pcie@fffe0a000 {
72 reg = <0xf 0xffe0a000 0 0x1000>;
73 ranges = <0x2000000 0x0 0xe0000000 0xc 0x00000000 0x0 0x20000000
74 0x1000000 0x0 0x00000000 0xf 0xffc00000 0x0 0x10000>;
75 pcie@0 {
76 ranges = <0x2000000 0x0 0xe0000000
77 0x2000000 0x0 0xe0000000
78 0x0 0x20000000
79
80 0x1000000 0x0 0x0
81 0x1000000 0x0 0x0
82 0x0 0x100000>;
83 };
84 };
85};
86
87/include/ "p1025rdb.dtsi"
88/include/ "fsl/p1021si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p2020rdb-pc.dtsi b/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
new file mode 100644
index 00000000000..c21d1c7d16c
--- /dev/null
+++ b/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
@@ -0,0 +1,241 @@
1/*
2 * P2020 RDB-PC Device Tree Source stub (no addresses or top-level ranges)
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35&lbc {
36 nor@0,0 {
37 #address-cells = <1>;
38 #size-cells = <1>;
39 compatible = "cfi-flash";
40 reg = <0x0 0x0 0x1000000>;
41 bank-width = <2>;
42 device-width = <1>;
43
44 partition@0 {
45 /* This location must not be altered */
46 /* 256KB for Vitesse 7385 Switch firmware */
47 reg = <0x0 0x00040000>;
48 label = "NOR Vitesse-7385 Firmware";
49 read-only;
50 };
51
52 partition@40000 {
53 /* 256KB for DTB Image */
54 reg = <0x00040000 0x00040000>;
55 label = "NOR DTB Image";
56 };
57
58 partition@80000 {
59 /* 3.5 MB for Linux Kernel Image */
60 reg = <0x00080000 0x00380000>;
61 label = "NOR Linux Kernel Image";
62 };
63
64 partition@400000 {
65 /* 11MB for JFFS2 based Root file System */
66 reg = <0x00400000 0x00b00000>;
67 label = "NOR JFFS2 Root File System";
68 };
69
70 partition@f00000 {
71 /* This location must not be altered */
72 /* 512KB for u-boot Bootloader Image */
73 /* 512KB for u-boot Environment Variables */
74 reg = <0x00f00000 0x00100000>;
75 label = "NOR U-Boot Image";
76 read-only;
77 };
78 };
79
80 nand@1,0 {
81 #address-cells = <1>;
82 #size-cells = <1>;
83 compatible = "fsl,p2020-fcm-nand",
84 "fsl,elbc-fcm-nand";
85 reg = <0x1 0x0 0x40000>;
86
87 partition@0 {
88 /* This location must not be altered */
89 /* 1MB for u-boot Bootloader Image */
90 reg = <0x0 0x00100000>;
91 label = "NAND U-Boot Image";
92 read-only;
93 };
94
95 partition@100000 {
96 /* 1MB for DTB Image */
97 reg = <0x00100000 0x00100000>;
98 label = "NAND DTB Image";
99 };
100
101 partition@200000 {
102 /* 4MB for Linux Kernel Image */
103 reg = <0x00200000 0x00400000>;
104 label = "NAND Linux Kernel Image";
105 };
106
107 partition@600000 {
108 /* 4MB for Compressed Root file System Image */
109 reg = <0x00600000 0x00400000>;
110 label = "NAND Compressed RFS Image";
111 };
112
113 partition@a00000 {
114 /* 7MB for JFFS2 based Root file System */
115 reg = <0x00a00000 0x00700000>;
116 label = "NAND JFFS2 Root File System";
117 };
118
119 partition@1100000 {
120 /* 15MB for JFFS2 based Root file System */
121 reg = <0x01100000 0x00f00000>;
122 label = "NAND Writable User area";
123 };
124 };
125
126 L2switch@2,0 {
127 #address-cells = <1>;
128 #size-cells = <1>;
129 compatible = "vitesse-7385";
130 reg = <0x2 0x0 0x20000>;
131 };
132
133 cpld@3,0 {
134 #address-cells = <1>;
135 #size-cells = <1>;
136 compatible = "cpld";
137 reg = <0x3 0x0 0x20000>;
138 read-only;
139 };
140};
141
142&soc {
143 i2c@3000 {
144 rtc@68 {
145 compatible = "pericom,pt7c4338";
146 reg = <0x68>;
147 };
148 };
149
150 spi@7000 {
151 flash@0 {
152 #address-cells = <1>;
153 #size-cells = <1>;
154 compatible = "spansion,m25p80";
155 reg = <0>;
156 spi-max-frequency = <40000000>;
157
158 partition@0 {
159 /* 512KB for u-boot Bootloader Image */
160 reg = <0x0 0x00080000>;
161 label = "SPI U-Boot Image";
162 read-only;
163 };
164
165 partition@80000 {
166 /* 512KB for DTB Image */
167 reg = <0x00080000 0x00080000>;
168 label = "SPI DTB Image";
169 };
170
171 partition@100000 {
172 /* 4MB for Linux Kernel Image */
173 reg = <0x00100000 0x00400000>;
174 label = "SPI Linux Kernel Image";
175 };
176
177 partition@500000 {
178 /* 4MB for Compressed RFS Image */
179 reg = <0x00500000 0x00400000>;
180 label = "SPI Compressed RFS Image";
181 };
182
183 partition@900000 {
184 /* 7MB for JFFS2 based RFS */
185 reg = <0x00900000 0x00700000>;
186 label = "SPI JFFS2 RFS";
187 };
188 };
189 };
190
191 usb@22000 {
192 phy_type = "ulpi";
193 };
194
195 mdio@24520 {
196 phy0: ethernet-phy@0 {
197 interrupts = <3 1 0 0>;
198 reg = <0x0>;
199 };
200 phy1: ethernet-phy@1 {
201 interrupts = <2 1 0 0>;
202 reg = <0x1>;
203 };
204 };
205
206 mdio@25520 {
207 tbi0: tbi-phy@11 {
208 reg = <0x11>;
209 device_type = "tbi-phy";
210 };
211 };
212
213 mdio@26520 {
214 status = "disabled";
215 };
216
217 ptp_clock@24e00 {
218 fsl,tclk-period = <5>;
219 fsl,tmr-prsc = <200>;
220 fsl,tmr-add = <0xCCCCCCCD>;
221 fsl,tmr-fiper1 = <0x3B9AC9FB>;
222 fsl,tmr-fiper2 = <0x0001869B>;
223 fsl,max-adj = <249999999>;
224 };
225
226 enet0: ethernet@24000 {
227 fixed-link = <1 1 1000 0 0>;
228 phy-connection-type = "rgmii-id";
229 };
230
231 enet1: ethernet@25000 {
232 tbi-handle = <&tbi0>;
233 phy-handle = <&phy0>;
234 phy-connection-type = "sgmii";
235 };
236
237 enet2: ethernet@26000 {
238 phy-handle = <&phy1>;
239 phy-connection-type = "rgmii-id";
240 };
241};
diff --git a/arch/powerpc/boot/dts/p2020rdb-pc_32b.dts b/arch/powerpc/boot/dts/p2020rdb-pc_32b.dts
new file mode 100644
index 00000000000..852e5b27485
--- /dev/null
+++ b/arch/powerpc/boot/dts/p2020rdb-pc_32b.dts
@@ -0,0 +1,96 @@
1/*
2 * P2020 RDB-PC 32Bit Physical Address Map Device Tree Source
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p2020si-pre.dtsi"
36
37/ {
38 model = "fsl,P2020RDB";
39 compatible = "fsl,P2020RDB-PC";
40
41 memory {
42 device_type = "memory";
43 };
44
45 lbc: localbus@ffe05000 {
46 reg = <0 0xffe05000 0 0x1000>;
47
48 /* NOR and NAND Flashes */
49 ranges = <0x0 0x0 0x0 0xef000000 0x01000000
50 0x1 0x0 0x0 0xff800000 0x00040000
51 0x2 0x0 0x0 0xffb00000 0x00020000
52 0x3 0x0 0x0 0xffa00000 0x00020000>;
53 };
54
55 soc: soc@ffe00000 {
56 ranges = <0x0 0x0 0xffe00000 0x100000>;
57 };
58
59 pci0: pcie@ffe08000 {
60 reg = <0 0xffe08000 0 0x1000>;
61 status = "disabled";
62 };
63
64 pci1: pcie@ffe09000 {
65 reg = <0 0xffe09000 0 0x1000>;
66 ranges = <0x2000000 0x0 0xe0000000 0 0xa0000000 0x0 0x20000000
67 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
68 pcie@0 {
69 ranges = <0x2000000 0x0 0xe0000000
70 0x2000000 0x0 0xe0000000
71 0x0 0x20000000
72
73 0x1000000 0x0 0x0
74 0x1000000 0x0 0x0
75 0x0 0x100000>;
76 };
77 };
78
79 pci2: pcie@ffe0a000 {
80 reg = <0 0xffe0a000 0 0x1000>;
81 ranges = <0x2000000 0x0 0xe0000000 0 0x80000000 0x0 0x20000000
82 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
83 pcie@0 {
84 ranges = <0x2000000 0x0 0xe0000000
85 0x2000000 0x0 0xe0000000
86 0x0 0x20000000
87
88 0x1000000 0x0 0x0
89 0x1000000 0x0 0x0
90 0x0 0x100000>;
91 };
92 };
93};
94
95/include/ "p2020rdb-pc.dtsi"
96/include/ "fsl/p2020si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p2020rdb-pc_36b.dts b/arch/powerpc/boot/dts/p2020rdb-pc_36b.dts
new file mode 100644
index 00000000000..b5a56ca51cf
--- /dev/null
+++ b/arch/powerpc/boot/dts/p2020rdb-pc_36b.dts
@@ -0,0 +1,96 @@
1/*
2 * P2020 RDB-PC 36Bit Physical Address Map Device Tree Source
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p2020si-pre.dtsi"
36
37/ {
38 model = "fsl,P2020RDB";
39 compatible = "fsl,P2020RDB-PC";
40
41 memory {
42 device_type = "memory";
43 };
44
45 lbc: localbus@fffe05000 {
46 reg = <0xf 0xffe05000 0 0x1000>;
47
48 /* NOR and NAND Flashes */
49 ranges = <0x0 0x0 0xf 0xef000000 0x01000000
50 0x1 0x0 0xf 0xff800000 0x00040000
51 0x2 0x0 0xf 0xffb00000 0x00020000
52 0x3 0x0 0xf 0xffa00000 0x00020000>;
53 };
54
55 soc: soc@fffe00000 {
56 ranges = <0x0 0xf 0xffe00000 0x100000>;
57 };
58
59 pci0: pcie@fffe08000 {
60 reg = <0xf 0xffe08000 0 0x1000>;
61 status = "disabled";
62 };
63
64 pci1: pcie@fffe09000 {
65 reg = <0xf 0xffe09000 0 0x1000>;
66 ranges = <0x2000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
67 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
68 pcie@0 {
69 ranges = <0x2000000 0x0 0xe0000000
70 0x2000000 0x0 0xe0000000
71 0x0 0x20000000
72
73 0x1000000 0x0 0x0
74 0x1000000 0x0 0x0
75 0x0 0x100000>;
76 };
77 };
78
79 pci2: pcie@fffe0a000 {
80 reg = <0xf 0xffe0a000 0 0x1000>;
81 ranges = <0x2000000 0x0 0xe0000000 0xc 0x00000000 0x0 0x20000000
82 0x1000000 0x0 0x00000000 0xf 0xffc00000 0x0 0x10000>;
83 pcie@0 {
84 ranges = <0x2000000 0x0 0xe0000000
85 0x2000000 0x0 0xe0000000
86 0x0 0x20000000
87
88 0x1000000 0x0 0x0
89 0x1000000 0x0 0x0
90 0x0 0x100000>;
91 };
92 };
93};
94
95/include/ "p2020rdb-pc.dtsi"
96/include/ "fsl/p2020si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p2020rdb.dts b/arch/powerpc/boot/dts/p2020rdb.dts
index eb8a6aa2bda..153bc76bb48 100644
--- a/arch/powerpc/boot/dts/p2020rdb.dts
+++ b/arch/powerpc/boot/dts/p2020rdb.dts
@@ -34,7 +34,7 @@
34 34
35 /* NOR and NAND Flashes */ 35 /* NOR and NAND Flashes */
36 ranges = <0x0 0x0 0x0 0xef000000 0x01000000 36 ranges = <0x0 0x0 0x0 0xef000000 0x01000000
37 0x1 0x0 0x0 0xffa00000 0x00040000 37 0x1 0x0 0x0 0xff800000 0x00040000
38 0x2 0x0 0x0 0xffb00000 0x00020000>; 38 0x2 0x0 0x0 0xffb00000 0x00020000>;
39 39
40 nor@0,0 { 40 nor@0,0 {
@@ -157,7 +157,7 @@
157 #size-cells = <1>; 157 #size-cells = <1>;
158 compatible = "spansion,s25sl12801"; 158 compatible = "spansion,s25sl12801";
159 reg = <0>; 159 reg = <0>;
160 spi-max-frequency = <50000000>; 160 spi-max-frequency = <40000000>;
161 161
162 partition@0 { 162 partition@0 {
163 /* 512KB for u-boot Bootloader Image */ 163 /* 512KB for u-boot Bootloader Image */
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index f090e6d2907..6761c746048 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -144,6 +144,7 @@ tmp=$tmpdir/zImage.$$.o
144ksection=.kernel:vmlinux.strip 144ksection=.kernel:vmlinux.strip
145isection=.kernel:initrd 145isection=.kernel:initrd
146link_address='0x400000' 146link_address='0x400000'
147make_space=y
147 148
148case "$platform" in 149case "$platform" in
149pseries) 150pseries)
@@ -210,6 +211,7 @@ ps3)
210 ksection=.kernel:vmlinux.bin 211 ksection=.kernel:vmlinux.bin
211 isection=.kernel:initrd 212 isection=.kernel:initrd
212 link_address='' 213 link_address=''
214 make_space=n
213 pie= 215 pie=
214 ;; 216 ;;
215ep88xc|ep405|ep8248e) 217ep88xc|ep405|ep8248e)
@@ -278,17 +280,19 @@ else
278 rm -f $vmz.$$ 280 rm -f $vmz.$$
279fi 281fi
280 282
281# Round the size to next higher MB limit 283if [ "$make_space" = "y" ]; then
282round_size=$(((strip_size + 0xfffff) & 0xfff00000)) 284 # Round the size to next higher MB limit
285 round_size=$(((strip_size + 0xfffff) & 0xfff00000))
283 286
284round_size=0x$(printf "%x" $round_size) 287 round_size=0x$(printf "%x" $round_size)
285link_addr=$(printf "%d" $link_address) 288 link_addr=$(printf "%d" $link_address)
286 289
287if [ $link_addr -lt $strip_size ]; then 290 if [ $link_addr -lt $strip_size ]; then
288 echo "INFO: Uncompressed kernel (size 0x$(printf "%x\n" $strip_size))" \ 291 echo "INFO: Uncompressed kernel (size 0x$(printf "%x\n" $strip_size))" \
289 "overlaps the address of the wrapper($link_address)" 292 "overlaps the address of the wrapper($link_address)"
290 echo "INFO: Fixing the link_address of wrapper to ($round_size)" 293 echo "INFO: Fixing the link_address of wrapper to ($round_size)"
291 link_address=$round_size 294 link_address=$round_size
295 fi
292fi 296fi
293 297
294vmz="$vmz$gzip" 298vmz="$vmz$gzip"
diff --git a/arch/powerpc/configs/85xx/ge_imp3a_defconfig b/arch/powerpc/configs/85xx/ge_imp3a_defconfig
new file mode 100644
index 00000000000..f8c51a4ab99
--- /dev/null
+++ b/arch/powerpc/configs/85xx/ge_imp3a_defconfig
@@ -0,0 +1,257 @@
1CONFIG_PPC_85xx=y
2CONFIG_SMP=y
3CONFIG_NR_CPUS=2
4CONFIG_EXPERIMENTAL=y
5CONFIG_SYSVIPC=y
6CONFIG_POSIX_MQUEUE=y
7CONFIG_BSD_PROCESS_ACCT=y
8CONFIG_BSD_PROCESS_ACCT_V3=y
9CONFIG_SPARSE_IRQ=y
10CONFIG_IKCONFIG=y
11CONFIG_IKCONFIG_PROC=y
12# CONFIG_UTS_NS is not set
13# CONFIG_IPC_NS is not set
14# CONFIG_USER_NS is not set
15# CONFIG_PID_NS is not set
16# CONFIG_NET_NS is not set
17CONFIG_SYSFS_DEPRECATED=y
18CONFIG_SYSFS_DEPRECATED_V2=y
19CONFIG_RELAY=y
20CONFIG_BLK_DEV_INITRD=y
21CONFIG_PERF_EVENTS=y
22CONFIG_SLAB=y
23CONFIG_MODULES=y
24CONFIG_MODULE_UNLOAD=y
25# CONFIG_BLK_DEV_BSG is not set
26CONFIG_GE_IMP3A=y
27CONFIG_QUICC_ENGINE=y
28CONFIG_QE_GPIO=y
29CONFIG_CPM2=y
30CONFIG_HIGHMEM=y
31CONFIG_HIGH_RES_TIMERS=y
32CONFIG_HZ_1000=y
33CONFIG_PREEMPT=y
34# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
35CONFIG_BINFMT_MISC=m
36CONFIG_MATH_EMULATION=y
37CONFIG_IRQ_ALL_CPUS=y
38CONFIG_FORCE_MAX_ZONEORDER=17
39CONFIG_PCI=y
40CONFIG_PCIEPORTBUS=y
41CONFIG_PCI_MSI=y
42CONFIG_PCCARD=y
43# CONFIG_PCMCIA_LOAD_CIS is not set
44CONFIG_YENTA=y
45CONFIG_NET=y
46CONFIG_PACKET=y
47CONFIG_UNIX=y
48CONFIG_XFRM_USER=m
49CONFIG_NET_KEY=y
50CONFIG_INET=y
51CONFIG_IP_MULTICAST=y
52CONFIG_IP_ADVANCED_ROUTER=y
53CONFIG_IP_MULTIPLE_TABLES=y
54CONFIG_IP_ROUTE_MULTIPATH=y
55CONFIG_IP_ROUTE_VERBOSE=y
56CONFIG_IP_PNP=y
57CONFIG_IP_PNP_DHCP=y
58CONFIG_IP_PNP_BOOTP=y
59CONFIG_IP_PNP_RARP=y
60CONFIG_NET_IPIP=m
61CONFIG_IP_MROUTE=y
62CONFIG_IP_PIMSM_V1=y
63CONFIG_IP_PIMSM_V2=y
64CONFIG_SYN_COOKIES=y
65CONFIG_INET_AH=m
66CONFIG_INET_ESP=m
67CONFIG_INET_IPCOMP=m
68# CONFIG_INET_XFRM_MODE_BEET is not set
69CONFIG_INET6_AH=m
70CONFIG_INET6_IPCOMP=m
71CONFIG_IPV6_TUNNEL=m
72CONFIG_NET_PKTGEN=m
73CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
74CONFIG_MTD=y
75CONFIG_MTD_OF_PARTS=y
76CONFIG_MTD_CHAR=y
77CONFIG_MTD_BLOCK=y
78CONFIG_MTD_CFI=y
79CONFIG_MTD_JEDECPROBE=y
80CONFIG_MTD_CFI_INTELEXT=y
81CONFIG_MTD_CFI_AMDSTD=y
82CONFIG_MTD_PHYSMAP_OF=y
83CONFIG_MTD_NAND=y
84CONFIG_MTD_NAND_FSL_ELBC=y
85CONFIG_PROC_DEVICETREE=y
86CONFIG_BLK_DEV_LOOP=m
87CONFIG_BLK_DEV_CRYPTOLOOP=m
88CONFIG_BLK_DEV_NBD=m
89CONFIG_BLK_DEV_RAM=y
90CONFIG_BLK_DEV_RAM_SIZE=131072
91CONFIG_MISC_DEVICES=y
92CONFIG_DS1682=y
93CONFIG_BLK_DEV_SD=y
94CONFIG_CHR_DEV_ST=y
95CONFIG_BLK_DEV_SR=y
96CONFIG_ATA=y
97CONFIG_SATA_AHCI=y
98CONFIG_SATA_SIL24=y
99# CONFIG_ATA_SFF is not set
100CONFIG_NETDEVICES=y
101CONFIG_BONDING=m
102CONFIG_DUMMY=m
103CONFIG_NETCONSOLE=y
104CONFIG_NETPOLL_TRAP=y
105CONFIG_TUN=m
106# CONFIG_NET_VENDOR_3COM is not set
107CONFIG_FS_ENET=y
108CONFIG_UCC_GETH=y
109CONFIG_GIANFAR=y
110CONFIG_PPP=m
111CONFIG_PPP_BSDCOMP=m
112CONFIG_PPP_DEFLATE=m
113CONFIG_PPP_FILTER=y
114CONFIG_PPP_MULTILINK=y
115CONFIG_PPPOE=m
116CONFIG_PPP_ASYNC=m
117CONFIG_PPP_SYNC_TTY=m
118CONFIG_SLIP=m
119CONFIG_SLIP_COMPRESSED=y
120CONFIG_SLIP_SMART=y
121CONFIG_SLIP_MODE_SLIP6=y
122# CONFIG_INPUT_KEYBOARD is not set
123# CONFIG_INPUT_MOUSE is not set
124# CONFIG_SERIO is not set
125# CONFIG_LEGACY_PTYS is not set
126CONFIG_SERIAL_8250=y
127CONFIG_SERIAL_8250_CONSOLE=y
128CONFIG_SERIAL_8250_NR_UARTS=2
129CONFIG_SERIAL_8250_RUNTIME_UARTS=2
130CONFIG_SERIAL_8250_EXTENDED=y
131CONFIG_SERIAL_8250_MANY_PORTS=y
132CONFIG_SERIAL_8250_DETECT_IRQ=y
133CONFIG_SERIAL_8250_RSA=y
134CONFIG_SERIAL_QE=m
135CONFIG_NVRAM=y
136CONFIG_I2C=y
137CONFIG_I2C_CHARDEV=y
138CONFIG_I2C_CPM=m
139CONFIG_I2C_MPC=y
140CONFIG_GPIO_SYSFS=y
141CONFIG_GPIO_GE_FPGA=y
142CONFIG_SENSORS_LM90=y
143CONFIG_SENSORS_LM92=y
144CONFIG_WATCHDOG=y
145CONFIG_GEF_WDT=y
146CONFIG_VIDEO_OUTPUT_CONTROL=m
147CONFIG_HID_DRAGONRISE=y
148CONFIG_HID_GYRATION=y
149CONFIG_HID_TWINHAN=y
150CONFIG_HID_ORTEK=y
151CONFIG_HID_PANTHERLORD=y
152CONFIG_HID_PETALYNX=y
153CONFIG_HID_SAMSUNG=y
154CONFIG_HID_SONY=y
155CONFIG_HID_SUNPLUS=y
156CONFIG_HID_GREENASIA=y
157CONFIG_HID_SMARTJOYPLUS=y
158CONFIG_HID_TOPSEED=y
159CONFIG_HID_THRUSTMASTER=y
160CONFIG_HID_ZEROPLUS=y
161CONFIG_USB=y
162CONFIG_USB_DEVICEFS=y
163CONFIG_USB_EHCI_HCD=y
164# CONFIG_USB_EHCI_TT_NEWSCHED is not set
165CONFIG_USB_EHCI_FSL=y
166CONFIG_USB_OHCI_HCD=y
167CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
168CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
169CONFIG_USB_STORAGE=y
170CONFIG_EDAC=y
171CONFIG_EDAC_MM_EDAC=y
172CONFIG_EDAC_MPC85XX=y
173CONFIG_RTC_CLASS=y
174# CONFIG_RTC_INTF_PROC is not set
175CONFIG_RTC_DRV_RX8581=y
176CONFIG_DMADEVICES=y
177CONFIG_FSL_DMA=y
178# CONFIG_NET_DMA is not set
179CONFIG_EXT2_FS=y
180CONFIG_EXT2_FS_XATTR=y
181CONFIG_EXT2_FS_POSIX_ACL=y
182CONFIG_EXT3_FS=y
183# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
184CONFIG_EXT3_FS_POSIX_ACL=y
185CONFIG_EXT4_FS=y
186CONFIG_FUSE_FS=y
187CONFIG_ISO9660_FS=y
188CONFIG_JOLIET=y
189CONFIG_ZISOFS=y
190CONFIG_UDF_FS=y
191CONFIG_MSDOS_FS=y
192CONFIG_VFAT_FS=y
193CONFIG_FAT_DEFAULT_CODEPAGE=850
194CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
195CONFIG_NTFS_FS=y
196CONFIG_PROC_KCORE=y
197CONFIG_TMPFS=y
198CONFIG_JFFS2_FS=y
199CONFIG_NFS_FS=y
200CONFIG_NFS_V3=y
201CONFIG_NFS_V4=y
202CONFIG_ROOT_NFS=y
203CONFIG_NFSD=y
204CONFIG_NFSD_V4=y
205CONFIG_CIFS=m
206CONFIG_CIFS_XATTR=y
207CONFIG_CIFS_POSIX=y
208CONFIG_NLS_CODEPAGE_437=y
209CONFIG_NLS_CODEPAGE_737=m
210CONFIG_NLS_CODEPAGE_775=m
211CONFIG_NLS_CODEPAGE_850=y
212CONFIG_NLS_CODEPAGE_852=m
213CONFIG_NLS_CODEPAGE_855=m
214CONFIG_NLS_CODEPAGE_857=m
215CONFIG_NLS_CODEPAGE_860=m
216CONFIG_NLS_CODEPAGE_861=m
217CONFIG_NLS_CODEPAGE_862=m
218CONFIG_NLS_CODEPAGE_863=m
219CONFIG_NLS_CODEPAGE_864=m
220CONFIG_NLS_CODEPAGE_865=m
221CONFIG_NLS_CODEPAGE_866=m
222CONFIG_NLS_CODEPAGE_869=m
223CONFIG_NLS_CODEPAGE_936=m
224CONFIG_NLS_CODEPAGE_950=m
225CONFIG_NLS_CODEPAGE_932=m
226CONFIG_NLS_CODEPAGE_949=m
227CONFIG_NLS_CODEPAGE_874=m
228CONFIG_NLS_ISO8859_8=m
229CONFIG_NLS_CODEPAGE_1250=m
230CONFIG_NLS_CODEPAGE_1251=m
231CONFIG_NLS_ASCII=y
232CONFIG_NLS_ISO8859_1=y
233CONFIG_NLS_ISO8859_2=m
234CONFIG_NLS_ISO8859_3=m
235CONFIG_NLS_ISO8859_4=m
236CONFIG_NLS_ISO8859_5=m
237CONFIG_NLS_ISO8859_6=m
238CONFIG_NLS_ISO8859_7=m
239CONFIG_NLS_ISO8859_9=m
240CONFIG_NLS_ISO8859_13=m
241CONFIG_NLS_ISO8859_14=m
242CONFIG_NLS_ISO8859_15=y
243CONFIG_NLS_KOI8_R=m
244CONFIG_NLS_KOI8_U=m
245CONFIG_NLS_UTF8=y
246CONFIG_CRC_CCITT=y
247CONFIG_CRC_T10DIF=y
248CONFIG_LIBCRC32C=y
249CONFIG_MAGIC_SYSRQ=y
250CONFIG_SYSCTL_SYSCALL_CHECK=y
251CONFIG_CRYPTO_CBC=y
252CONFIG_CRYPTO_MD5=y
253CONFIG_CRYPTO_SHA256=m
254CONFIG_CRYPTO_SHA512=m
255CONFIG_CRYPTO_DES=y
256# CONFIG_CRYPTO_ANSI_CPRNG is not set
257CONFIG_CRYPTO_DEV_TALITOS=y
diff --git a/arch/powerpc/configs/86xx/gef_ppc9a_defconfig b/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
index d41857a5152..da731c2fe98 100644
--- a/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
+++ b/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
@@ -131,6 +131,7 @@ CONFIG_I2C=y
131CONFIG_I2C_CHARDEV=y 131CONFIG_I2C_CHARDEV=y
132CONFIG_I2C_MPC=y 132CONFIG_I2C_MPC=y
133CONFIG_GPIO_SYSFS=y 133CONFIG_GPIO_SYSFS=y
134CONFIG_GPIO_GE_FPGA=y
134CONFIG_SENSORS_LM90=y 135CONFIG_SENSORS_LM90=y
135CONFIG_SENSORS_LM92=y 136CONFIG_SENSORS_LM92=y
136CONFIG_WATCHDOG=y 137CONFIG_WATCHDOG=y
diff --git a/arch/powerpc/configs/86xx/gef_sbc310_defconfig b/arch/powerpc/configs/86xx/gef_sbc310_defconfig
index 38303ec11bc..2149360a1e6 100644
--- a/arch/powerpc/configs/86xx/gef_sbc310_defconfig
+++ b/arch/powerpc/configs/86xx/gef_sbc310_defconfig
@@ -132,6 +132,7 @@ CONFIG_I2C=y
132CONFIG_I2C_CHARDEV=y 132CONFIG_I2C_CHARDEV=y
133CONFIG_I2C_MPC=y 133CONFIG_I2C_MPC=y
134CONFIG_GPIO_SYSFS=y 134CONFIG_GPIO_SYSFS=y
135CONFIG_GPIO_GE_FPGA=y
135CONFIG_SENSORS_LM90=y 136CONFIG_SENSORS_LM90=y
136CONFIG_SENSORS_LM92=y 137CONFIG_SENSORS_LM92=y
137CONFIG_WATCHDOG=y 138CONFIG_WATCHDOG=y
diff --git a/arch/powerpc/configs/86xx/gef_sbc610_defconfig b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
index 98533973d20..af2e8e1edba 100644
--- a/arch/powerpc/configs/86xx/gef_sbc610_defconfig
+++ b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
@@ -183,6 +183,8 @@ CONFIG_NVRAM=y
183CONFIG_I2C=y 183CONFIG_I2C=y
184CONFIG_I2C_CHARDEV=y 184CONFIG_I2C_CHARDEV=y
185CONFIG_I2C_MPC=y 185CONFIG_I2C_MPC=y
186CONFIG_GPIO_SYSFS=y
187CONFIG_GPIO_GE_FPGA=y
186CONFIG_SENSORS_LM90=y 188CONFIG_SENSORS_LM90=y
187CONFIG_SENSORS_LM92=y 189CONFIG_SENSORS_LM92=y
188CONFIG_WATCHDOG=y 190CONFIG_WATCHDOG=y
diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig
deleted file mode 100644
index 27c46d67996..00000000000
--- a/arch/powerpc/configs/iseries_defconfig
+++ /dev/null
@@ -1,236 +0,0 @@
1CONFIG_PPC64=y
2CONFIG_SMP=y
3CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y
6CONFIG_AUDIT=y
7CONFIG_AUDITSYSCALL=y
8CONFIG_IKCONFIG=y
9CONFIG_IKCONFIG_PROC=y
10CONFIG_BLK_DEV_INITRD=y
11# CONFIG_COMPAT_BRK is not set
12CONFIG_MODULES=y
13CONFIG_MODULE_UNLOAD=y
14CONFIG_MODVERSIONS=y
15CONFIG_MODULE_SRCVERSION_ALL=y
16# CONFIG_PPC_PSERIES is not set
17CONFIG_LPARCFG=y
18CONFIG_PPC_ISERIES=y
19CONFIG_VIODASD=y
20CONFIG_VIOCD=m
21CONFIG_VIOTAPE=m
22# CONFIG_PPC_PMAC is not set
23CONFIG_NO_HZ=y
24CONFIG_HIGH_RES_TIMERS=y
25CONFIG_IRQ_ALL_CPUS=y
26# CONFIG_MIGRATION is not set
27CONFIG_PACKET=y
28CONFIG_UNIX=y
29CONFIG_XFRM_USER=m
30CONFIG_XFRM_SUB_POLICY=y
31CONFIG_NET_KEY=m
32CONFIG_INET=y
33CONFIG_IP_MULTICAST=y
34CONFIG_NET_IPIP=y
35CONFIG_SYN_COOKIES=y
36CONFIG_INET_AH=m
37CONFIG_INET_ESP=m
38CONFIG_INET_IPCOMP=m
39CONFIG_INET_XFRM_MODE_BEET=m
40# CONFIG_INET_LRO is not set
41# CONFIG_IPV6 is not set
42CONFIG_NETFILTER=y
43CONFIG_NETFILTER_NETLINK_QUEUE=m
44CONFIG_NETFILTER_NETLINK_LOG=m
45CONFIG_NF_CONNTRACK=m
46CONFIG_NF_CONNTRACK_EVENTS=y
47# CONFIG_NF_CT_PROTO_SCTP is not set
48CONFIG_NF_CONNTRACK_FTP=m
49CONFIG_NF_CONNTRACK_IRC=m
50CONFIG_NF_CONNTRACK_TFTP=m
51CONFIG_NF_CT_NETLINK=m
52CONFIG_NETFILTER_TPROXY=m
53CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
54CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
55CONFIG_NETFILTER_XT_TARGET_DSCP=m
56CONFIG_NETFILTER_XT_TARGET_MARK=m
57CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
58CONFIG_NETFILTER_XT_TARGET_TPROXY=m
59CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
60CONFIG_NETFILTER_XT_MATCH_COMMENT=m
61CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
62CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
63CONFIG_NETFILTER_XT_MATCH_DSCP=m
64CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
65CONFIG_NETFILTER_XT_MATCH_LENGTH=m
66CONFIG_NETFILTER_XT_MATCH_LIMIT=m
67CONFIG_NETFILTER_XT_MATCH_MAC=m
68CONFIG_NETFILTER_XT_MATCH_MARK=m
69CONFIG_NETFILTER_XT_MATCH_OWNER=m
70CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
71CONFIG_NETFILTER_XT_MATCH_RATEEST=m
72CONFIG_NETFILTER_XT_MATCH_REALM=m
73CONFIG_NETFILTER_XT_MATCH_RECENT=m
74CONFIG_NETFILTER_XT_MATCH_STRING=m
75CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
76CONFIG_NETFILTER_XT_MATCH_TIME=m
77CONFIG_NF_CONNTRACK_IPV4=m
78CONFIG_IP_NF_QUEUE=m
79CONFIG_IP_NF_IPTABLES=m
80CONFIG_IP_NF_MATCH_ADDRTYPE=m
81CONFIG_IP_NF_MATCH_ECN=m
82CONFIG_IP_NF_MATCH_TTL=m
83CONFIG_IP_NF_FILTER=m
84CONFIG_IP_NF_TARGET_REJECT=m
85CONFIG_IP_NF_TARGET_LOG=m
86CONFIG_IP_NF_TARGET_ULOG=m
87CONFIG_NF_NAT=m
88CONFIG_IP_NF_TARGET_MASQUERADE=m
89CONFIG_IP_NF_TARGET_NETMAP=m
90CONFIG_IP_NF_TARGET_REDIRECT=m
91CONFIG_IP_NF_MANGLE=m
92CONFIG_IP_NF_TARGET_CLUSTERIP=m
93CONFIG_IP_NF_TARGET_ECN=m
94CONFIG_IP_NF_TARGET_TTL=m
95CONFIG_IP_NF_RAW=m
96CONFIG_IP_NF_ARPTABLES=m
97CONFIG_IP_NF_ARPFILTER=m
98CONFIG_IP_NF_ARP_MANGLE=m
99CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
100CONFIG_PROC_DEVICETREE=y
101CONFIG_BLK_DEV_LOOP=y
102CONFIG_BLK_DEV_NBD=m
103CONFIG_BLK_DEV_RAM=y
104CONFIG_BLK_DEV_RAM_SIZE=65536
105CONFIG_SCSI=y
106CONFIG_BLK_DEV_SD=y
107CONFIG_CHR_DEV_ST=y
108CONFIG_BLK_DEV_SR=y
109CONFIG_BLK_DEV_SR_VENDOR=y
110CONFIG_CHR_DEV_SG=y
111CONFIG_SCSI_MULTI_LUN=y
112CONFIG_SCSI_CONSTANTS=y
113CONFIG_SCSI_SPI_ATTRS=y
114CONFIG_SCSI_FC_ATTRS=y
115CONFIG_SCSI_SAS_LIBSAS=m
116CONFIG_SCSI_IBMVSCSI=m
117CONFIG_MD=y
118CONFIG_BLK_DEV_MD=y
119CONFIG_MD_LINEAR=y
120CONFIG_MD_RAID0=y
121CONFIG_MD_RAID1=y
122CONFIG_MD_RAID10=m
123CONFIG_MD_MULTIPATH=m
124CONFIG_MD_FAULTY=m
125CONFIG_BLK_DEV_DM=y
126CONFIG_DM_CRYPT=m
127CONFIG_DM_SNAPSHOT=m
128CONFIG_DM_MIRROR=m
129CONFIG_DM_ZERO=m
130CONFIG_NETDEVICES=y
131CONFIG_DUMMY=m
132CONFIG_BONDING=m
133CONFIG_TUN=m
134CONFIG_NET_ETHERNET=y
135CONFIG_NET_PCI=y
136CONFIG_PCNET32=y
137CONFIG_E100=y
138CONFIG_ACENIC=m
139CONFIG_E1000=m
140CONFIG_ISERIES_VETH=y
141CONFIG_PPP=m
142CONFIG_PPP_ASYNC=m
143CONFIG_PPP_SYNC_TTY=m
144CONFIG_PPP_DEFLATE=m
145CONFIG_PPP_BSDCOMP=m
146CONFIG_PPPOE=m
147CONFIG_NETCONSOLE=y
148CONFIG_NETPOLL_TRAP=y
149# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
150# CONFIG_INPUT_KEYBOARD is not set
151# CONFIG_INPUT_MOUSE is not set
152# CONFIG_SERIO is not set
153CONFIG_SERIAL_ICOM=m
154# CONFIG_HW_RANDOM is not set
155CONFIG_GEN_RTC=y
156CONFIG_RAW_DRIVER=y
157# CONFIG_HWMON is not set
158# CONFIG_HID_SUPPORT is not set
159# CONFIG_USB_SUPPORT is not set
160CONFIG_EXT2_FS=y
161CONFIG_EXT2_FS_XATTR=y
162CONFIG_EXT2_FS_POSIX_ACL=y
163CONFIG_EXT2_FS_SECURITY=y
164CONFIG_EXT2_FS_XIP=y
165CONFIG_EXT3_FS=y
166CONFIG_EXT3_FS_POSIX_ACL=y
167CONFIG_EXT3_FS_SECURITY=y
168CONFIG_EXT4_FS=y
169CONFIG_REISERFS_FS=y
170CONFIG_REISERFS_FS_XATTR=y
171CONFIG_REISERFS_FS_POSIX_ACL=y
172CONFIG_REISERFS_FS_SECURITY=y
173CONFIG_JFS_FS=m
174CONFIG_JFS_POSIX_ACL=y
175CONFIG_JFS_SECURITY=y
176CONFIG_XFS_FS=m
177CONFIG_XFS_POSIX_ACL=y
178CONFIG_GFS2_FS=m
179CONFIG_AUTOFS_FS=m
180CONFIG_ISO9660_FS=y
181CONFIG_JOLIET=y
182CONFIG_ZISOFS=y
183CONFIG_UDF_FS=m
184CONFIG_MSDOS_FS=y
185CONFIG_VFAT_FS=y
186CONFIG_PROC_KCORE=y
187CONFIG_TMPFS=y
188CONFIG_TMPFS_POSIX_ACL=y
189CONFIG_CRAMFS=y
190CONFIG_NFS_FS=y
191CONFIG_NFS_V3=y
192CONFIG_NFS_V3_ACL=y
193CONFIG_NFS_V4=y
194CONFIG_NFSD=m
195CONFIG_NFSD_V3_ACL=y
196CONFIG_NFSD_V4=y
197CONFIG_RPCSEC_GSS_SPKM3=m
198CONFIG_CIFS=m
199CONFIG_CIFS_XATTR=y
200CONFIG_CIFS_POSIX=y
201CONFIG_NLS_CODEPAGE_437=y
202CONFIG_NLS_ASCII=y
203CONFIG_NLS_ISO8859_1=y
204CONFIG_DLM=m
205CONFIG_CRC_T10DIF=y
206CONFIG_MAGIC_SYSRQ=y
207CONFIG_DEBUG_FS=y
208CONFIG_DEBUG_KERNEL=y
209# CONFIG_RCU_CPU_STALL_DETECTOR is not set
210CONFIG_LATENCYTOP=y
211CONFIG_SYSCTL_SYSCALL_CHECK=y
212CONFIG_DEBUG_STACKOVERFLOW=y
213CONFIG_DEBUG_STACK_USAGE=y
214CONFIG_CRYPTO_NULL=m
215CONFIG_CRYPTO_TEST=m
216CONFIG_CRYPTO_ECB=m
217CONFIG_CRYPTO_PCBC=m
218CONFIG_CRYPTO_HMAC=y
219CONFIG_CRYPTO_MD4=m
220CONFIG_CRYPTO_MICHAEL_MIC=m
221CONFIG_CRYPTO_SHA256=m
222CONFIG_CRYPTO_SHA512=m
223CONFIG_CRYPTO_TGR192=m
224CONFIG_CRYPTO_WP512=m
225CONFIG_CRYPTO_AES=m
226CONFIG_CRYPTO_ANUBIS=m
227CONFIG_CRYPTO_ARC4=m
228CONFIG_CRYPTO_BLOWFISH=m
229CONFIG_CRYPTO_CAST6=m
230CONFIG_CRYPTO_KHAZAD=m
231CONFIG_CRYPTO_SEED=m
232CONFIG_CRYPTO_SERPENT=m
233CONFIG_CRYPTO_TEA=m
234CONFIG_CRYPTO_TWOFISH=m
235# CONFIG_CRYPTO_ANSI_CPRNG is not set
236# CONFIG_CRYPTO_HW is not set
diff --git a/arch/powerpc/configs/mpc5200_defconfig b/arch/powerpc/configs/mpc5200_defconfig
index 2a1320fb272..6640a35bebb 100644
--- a/arch/powerpc/configs/mpc5200_defconfig
+++ b/arch/powerpc/configs/mpc5200_defconfig
@@ -1,8 +1,8 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_SPARSE_IRQ=y
3CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_MODULES=y 6CONFIG_MODULES=y
7CONFIG_MODULE_UNLOAD=y 7CONFIG_MODULE_UNLOAD=y
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
@@ -13,15 +13,12 @@ CONFIG_PPC_EFIKA=y
13CONFIG_PPC_LITE5200=y 13CONFIG_PPC_LITE5200=y
14CONFIG_PPC_MEDIA5200=y 14CONFIG_PPC_MEDIA5200=y
15CONFIG_PPC_MPC5200_BUGFIX=y 15CONFIG_PPC_MPC5200_BUGFIX=y
16CONFIG_PPC_MPC5200_GPIO=y
17CONFIG_PPC_MPC5200_LPBFIFO=m 16CONFIG_PPC_MPC5200_LPBFIFO=m
18# CONFIG_PPC_PMAC is not set 17# CONFIG_PPC_PMAC is not set
19CONFIG_PPC_BESTCOMM=y 18CONFIG_PPC_BESTCOMM=y
20CONFIG_SIMPLE_GPIO=y 19CONFIG_SIMPLE_GPIO=y
21CONFIG_NO_HZ=y 20CONFIG_NO_HZ=y
22CONFIG_HIGH_RES_TIMERS=y 21CONFIG_HIGH_RES_TIMERS=y
23CONFIG_SPARSE_IRQ=y
24CONFIG_PM=y
25CONFIG_NET=y 22CONFIG_NET=y
26CONFIG_PACKET=y 23CONFIG_PACKET=y
27CONFIG_UNIX=y 24CONFIG_UNIX=y
@@ -36,23 +33,20 @@ CONFIG_SYN_COOKIES=y
36# CONFIG_IPV6 is not set 33# CONFIG_IPV6 is not set
37CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 34CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
38CONFIG_MTD=y 35CONFIG_MTD=y
39CONFIG_MTD_CONCAT=y
40CONFIG_MTD_PARTITIONS=y
41CONFIG_MTD_CMDLINE_PARTS=y 36CONFIG_MTD_CMDLINE_PARTS=y
42CONFIG_MTD_OF_PARTS=y 37CONFIG_MTD_OF_PARTS=y
43CONFIG_MTD_CHAR=y 38CONFIG_MTD_CHAR=y
44CONFIG_MTD_BLOCK=y 39CONFIG_MTD_BLOCK=y
45CONFIG_MTD_CFI=y 40CONFIG_MTD_CFI=y
46CONFIG_MTD_CFI_AMDSTD=y 41CONFIG_MTD_CFI_AMDSTD=y
47CONFIG_MTD_RAM=y
48CONFIG_MTD_ROM=y 42CONFIG_MTD_ROM=y
49CONFIG_MTD_PHYSMAP_OF=y 43CONFIG_MTD_PHYSMAP_OF=y
44CONFIG_MTD_PLATRAM=y
50CONFIG_MTD_UBI=m 45CONFIG_MTD_UBI=m
51CONFIG_PROC_DEVICETREE=y 46CONFIG_PROC_DEVICETREE=y
52CONFIG_BLK_DEV_LOOP=y 47CONFIG_BLK_DEV_LOOP=y
53CONFIG_BLK_DEV_RAM=y 48CONFIG_BLK_DEV_RAM=y
54CONFIG_BLK_DEV_RAM_SIZE=32768 49CONFIG_BLK_DEV_RAM_SIZE=32768
55CONFIG_MISC_DEVICES=y
56CONFIG_EEPROM_AT24=y 50CONFIG_EEPROM_AT24=y
57CONFIG_SCSI_TGT=y 51CONFIG_SCSI_TGT=y
58CONFIG_BLK_DEV_SD=y 52CONFIG_BLK_DEV_SD=y
@@ -61,11 +55,10 @@ CONFIG_ATA=y
61CONFIG_PATA_MPC52xx=y 55CONFIG_PATA_MPC52xx=y
62CONFIG_PATA_PLATFORM=y 56CONFIG_PATA_PLATFORM=y
63CONFIG_NETDEVICES=y 57CONFIG_NETDEVICES=y
64CONFIG_LXT_PHY=y
65CONFIG_NET_ETHERNET=y
66CONFIG_FEC_MPC52xx=y 58CONFIG_FEC_MPC52xx=y
67# CONFIG_NETDEV_1000 is not set 59CONFIG_AMD_PHY=y
68# CONFIG_NETDEV_10000 is not set 60CONFIG_LXT_PHY=y
61CONFIG_FIXED_PHY=y
69# CONFIG_INPUT_KEYBOARD is not set 62# CONFIG_INPUT_KEYBOARD is not set
70# CONFIG_INPUT_MOUSE is not set 63# CONFIG_INPUT_MOUSE is not set
71# CONFIG_SERIO is not set 64# CONFIG_SERIO is not set
@@ -80,11 +73,17 @@ CONFIG_SPI_GPIO=m
80CONFIG_SPI_MPC52xx=m 73CONFIG_SPI_MPC52xx=m
81CONFIG_SPI_MPC52xx_PSC=m 74CONFIG_SPI_MPC52xx_PSC=m
82CONFIG_SPI_SPIDEV=m 75CONFIG_SPI_SPIDEV=m
76CONFIG_GPIO_SYSFS=y
77CONFIG_SENSORS_LM80=y
78CONFIG_SENSORS_LM87=m
83CONFIG_WATCHDOG=y 79CONFIG_WATCHDOG=y
80CONFIG_MFD_SM501=m
84CONFIG_DRM=y 81CONFIG_DRM=y
85CONFIG_VIDEO_OUTPUT_CONTROL=y 82CONFIG_VIDEO_OUTPUT_CONTROL=y
86CONFIG_FB=y 83CONFIG_FB=y
84CONFIG_FB_FOREIGN_ENDIAN=y
87CONFIG_FB_RADEON=y 85CONFIG_FB_RADEON=y
86CONFIG_FB_SM501=m
88# CONFIG_VGA_CONSOLE is not set 87# CONFIG_VGA_CONSOLE is not set
89CONFIG_FRAMEBUFFER_CONSOLE=y 88CONFIG_FRAMEBUFFER_CONSOLE=y
90CONFIG_LOGO=y 89CONFIG_LOGO=y
@@ -124,10 +123,11 @@ CONFIG_USB_STORAGE=y
124CONFIG_NEW_LEDS=y 123CONFIG_NEW_LEDS=y
125CONFIG_RTC_CLASS=y 124CONFIG_RTC_CLASS=y
126CONFIG_RTC_DRV_DS1307=y 125CONFIG_RTC_DRV_DS1307=y
126CONFIG_RTC_DRV_DS1374=y
127CONFIG_RTC_DRV_PCF8563=m
127CONFIG_EXT2_FS=y 128CONFIG_EXT2_FS=y
128CONFIG_EXT3_FS=y 129CONFIG_EXT3_FS=y
129# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 130# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
130CONFIG_INOTIFY=y
131CONFIG_MSDOS_FS=y 131CONFIG_MSDOS_FS=y
132CONFIG_VFAT_FS=y 132CONFIG_VFAT_FS=y
133CONFIG_PROC_KCORE=y 133CONFIG_PROC_KCORE=y
@@ -145,5 +145,4 @@ CONFIG_PRINTK_TIME=y
145CONFIG_DEBUG_KERNEL=y 145CONFIG_DEBUG_KERNEL=y
146CONFIG_DETECT_HUNG_TASK=y 146CONFIG_DETECT_HUNG_TASK=y
147CONFIG_DEBUG_INFO=y 147CONFIG_DEBUG_INFO=y
148# CONFIG_RCU_CPU_STALL_DETECTOR is not set
149# CONFIG_CRYPTO_ANSI_CPRNG is not set 148# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index f37a2ab4888..5fb0c8a9481 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -1,4 +1,5 @@
1CONFIG_PPC_85xx=y 1CONFIG_PPC_85xx=y
2CONFIG_PHYS_64BIT=y
2CONFIG_EXPERIMENTAL=y 3CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 5CONFIG_POSIX_MQUEUE=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index abdcd317cda..fb51bc90edd 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -1,4 +1,5 @@
1CONFIG_PPC_85xx=y 1CONFIG_PPC_85xx=y
2CONFIG_PHYS_64BIT=y
2CONFIG_SMP=y 3CONFIG_SMP=y
3CONFIG_NR_CPUS=8 4CONFIG_NR_CPUS=8
4CONFIG_EXPERIMENTAL=y 5CONFIG_EXPERIMENTAL=y
diff --git a/arch/powerpc/include/asm/abs_addr.h b/arch/powerpc/include/asm/abs_addr.h
index 5ab0b71531b..9d92ba04b03 100644
--- a/arch/powerpc/include/asm/abs_addr.h
+++ b/arch/powerpc/include/asm/abs_addr.h
@@ -17,7 +17,6 @@
17#include <asm/types.h> 17#include <asm/types.h>
18#include <asm/page.h> 18#include <asm/page.h>
19#include <asm/prom.h> 19#include <asm/prom.h>
20#include <asm/firmware.h>
21 20
22struct mschunks_map { 21struct mschunks_map {
23 unsigned long num_chunks; 22 unsigned long num_chunks;
@@ -46,30 +45,12 @@ static inline unsigned long addr_to_chunk(unsigned long addr)
46 45
47static inline unsigned long phys_to_abs(unsigned long pa) 46static inline unsigned long phys_to_abs(unsigned long pa)
48{ 47{
49 unsigned long chunk; 48 return pa;
50
51 /* This is a no-op on non-iSeries */
52 if (!firmware_has_feature(FW_FEATURE_ISERIES))
53 return pa;
54
55 chunk = addr_to_chunk(pa);
56
57 if (chunk < mschunks_map.num_chunks)
58 chunk = mschunks_map.mapping[chunk];
59
60 return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK);
61} 49}
62 50
63/* Convenience macros */ 51/* Convenience macros */
64#define virt_to_abs(va) phys_to_abs(__pa(va)) 52#define virt_to_abs(va) phys_to_abs(__pa(va))
65#define abs_to_virt(aa) __va(aa) 53#define abs_to_virt(aa) __va(aa)
66 54
67/*
68 * Converts Virtual Address to Real Address for
69 * Legacy iSeries Hypervisor calls
70 */
71#define iseries_hv_addr(virtaddr) \
72 (0x8000000000000000UL | virt_to_abs(virtaddr))
73
74#endif /* __KERNEL__ */ 55#endif /* __KERNEL__ */
75#endif /* _ASM_POWERPC_ABS_ADDR_H */ 56#endif /* _ASM_POWERPC_ABS_ADDR_H */
diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
index 02e41b53488..14174e838ad 100644
--- a/arch/powerpc/include/asm/atomic.h
+++ b/arch/powerpc/include/asm/atomic.h
@@ -212,6 +212,36 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
212 return t; 212 return t;
213} 213}
214 214
215/**
216 * atomic_inc_not_zero - increment unless the number is zero
217 * @v: pointer of type atomic_t
218 *
219 * Atomically increments @v by 1, so long as @v is non-zero.
220 * Returns non-zero if @v was non-zero, and zero otherwise.
221 */
222static __inline__ int atomic_inc_not_zero(atomic_t *v)
223{
224 int t1, t2;
225
226 __asm__ __volatile__ (
227 PPC_ATOMIC_ENTRY_BARRIER
228"1: lwarx %0,0,%2 # atomic_inc_not_zero\n\
229 cmpwi 0,%0,0\n\
230 beq- 2f\n\
231 addic %1,%0,1\n"
232 PPC405_ERR77(0,%2)
233" stwcx. %1,0,%2\n\
234 bne- 1b\n"
235 PPC_ATOMIC_EXIT_BARRIER
236 "\n\
2372:"
238 : "=&r" (t1), "=&r" (t2)
239 : "r" (&v->counter)
240 : "cc", "xer", "memory");
241
242 return t1;
243}
244#define atomic_inc_not_zero(v) atomic_inc_not_zero((v))
215 245
216#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0) 246#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0)
217#define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0) 247#define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0)
@@ -467,7 +497,34 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
467 return t != u; 497 return t != u;
468} 498}
469 499
470#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 500/**
501 * atomic_inc64_not_zero - increment unless the number is zero
502 * @v: pointer of type atomic64_t
503 *
504 * Atomically increments @v by 1, so long as @v is non-zero.
505 * Returns non-zero if @v was non-zero, and zero otherwise.
506 */
507static __inline__ long atomic64_inc_not_zero(atomic64_t *v)
508{
509 long t1, t2;
510
511 __asm__ __volatile__ (
512 PPC_ATOMIC_ENTRY_BARRIER
513"1: ldarx %0,0,%2 # atomic64_inc_not_zero\n\
514 cmpdi 0,%0,0\n\
515 beq- 2f\n\
516 addic %1,%0,1\n\
517 stdcx. %1,0,%2\n\
518 bne- 1b\n"
519 PPC_ATOMIC_EXIT_BARRIER
520 "\n\
5212:"
522 : "=&r" (t1), "=&r" (t2)
523 : "r" (&v->counter)
524 : "cc", "xer", "memory");
525
526 return t1;
527}
471 528
472#endif /* __powerpc64__ */ 529#endif /* __powerpc64__ */
473 530
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index ad55a1ccb9f..b9219e99bd2 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -390,6 +390,10 @@ extern const char *powerpc_base_platform;
390 CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \ 390 CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \
391 CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ 391 CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
392 CPU_FTR_DEBUG_LVL_EXC) 392 CPU_FTR_DEBUG_LVL_EXC)
393#define CPU_FTRS_E6500 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN | \
394 CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \
395 CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
396 CPU_FTR_DEBUG_LVL_EXC)
393#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) 397#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
394 398
395/* 64-bit CPUs */ 399/* 64-bit CPUs */
@@ -442,7 +446,7 @@ extern const char *powerpc_base_platform;
442 446
443#ifdef __powerpc64__ 447#ifdef __powerpc64__
444#ifdef CONFIG_PPC_BOOK3E 448#ifdef CONFIG_PPC_BOOK3E
445#define CPU_FTRS_POSSIBLE (CPU_FTRS_E5500 | CPU_FTRS_A2) 449#define CPU_FTRS_POSSIBLE (CPU_FTRS_E6500 | CPU_FTRS_E5500 | CPU_FTRS_A2)
446#else 450#else
447#define CPU_FTRS_POSSIBLE \ 451#define CPU_FTRS_POSSIBLE \
448 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ 452 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \
@@ -483,7 +487,7 @@ enum {
483#endif 487#endif
484#ifdef CONFIG_E500 488#ifdef CONFIG_E500
485 CPU_FTRS_E500 | CPU_FTRS_E500_2 | CPU_FTRS_E500MC | 489 CPU_FTRS_E500 | CPU_FTRS_E500_2 | CPU_FTRS_E500MC |
486 CPU_FTRS_E5500 | 490 CPU_FTRS_E5500 | CPU_FTRS_E6500 |
487#endif 491#endif
488 0, 492 0,
489}; 493};
@@ -491,7 +495,7 @@ enum {
491 495
492#ifdef __powerpc64__ 496#ifdef __powerpc64__
493#ifdef CONFIG_PPC_BOOK3E 497#ifdef CONFIG_PPC_BOOK3E
494#define CPU_FTRS_ALWAYS (CPU_FTRS_E5500 & CPU_FTRS_A2) 498#define CPU_FTRS_ALWAYS (CPU_FTRS_E6500 & CPU_FTRS_E5500 & CPU_FTRS_A2)
495#else 499#else
496#define CPU_FTRS_ALWAYS \ 500#define CPU_FTRS_ALWAYS \
497 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \ 501 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \
@@ -528,7 +532,7 @@ enum {
528#endif 532#endif
529#ifdef CONFIG_E500 533#ifdef CONFIG_E500
530 CPU_FTRS_E500 & CPU_FTRS_E500_2 & CPU_FTRS_E500MC & 534 CPU_FTRS_E500 & CPU_FTRS_E500_2 & CPU_FTRS_E500MC &
531 CPU_FTRS_E5500 & 535 CPU_FTRS_E5500 & CPU_FTRS_E6500 &
532#endif 536#endif
533 CPU_FTRS_POSSIBLE, 537 CPU_FTRS_POSSIBLE,
534}; 538};
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index d57c08acedf..63d5ca49cec 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -31,6 +31,9 @@ struct dev_archdata {
31#ifdef CONFIG_SWIOTLB 31#ifdef CONFIG_SWIOTLB
32 dma_addr_t max_direct_dma_addr; 32 dma_addr_t max_direct_dma_addr;
33#endif 33#endif
34#ifdef CONFIG_EEH
35 struct eeh_dev *edev;
36#endif
34}; 37};
35 38
36struct pdev_archdata { 39struct pdev_archdata {
diff --git a/arch/powerpc/include/asm/dma.h b/arch/powerpc/include/asm/dma.h
index a7e06e25c70..adadb994361 100644
--- a/arch/powerpc/include/asm/dma.h
+++ b/arch/powerpc/include/asm/dma.h
@@ -34,8 +34,6 @@
34/* Doesn't really apply... */ 34/* Doesn't really apply... */
35#define MAX_DMA_ADDRESS (~0UL) 35#define MAX_DMA_ADDRESS (~0UL)
36 36
37#if !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)
38
39#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER 37#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
40#define dma_outb outb_p 38#define dma_outb outb_p
41#else 39#else
@@ -354,7 +352,5 @@ extern int isa_dma_bridge_buggy;
354#define isa_dma_bridge_buggy (0) 352#define isa_dma_bridge_buggy (0)
355#endif 353#endif
356 354
357#endif /* !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) */
358
359#endif /* __KERNEL__ */ 355#endif /* __KERNEL__ */
360#endif /* _ASM_POWERPC_DMA_H */ 356#endif /* _ASM_POWERPC_DMA_H */
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 66ea9b8b95c..d60f99814ff 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * eeh.h
3 * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation. 2 * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation.
3 * Copyright 2001-2012 IBM Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -31,44 +31,105 @@ struct device_node;
31 31
32#ifdef CONFIG_EEH 32#ifdef CONFIG_EEH
33 33
34extern int eeh_subsystem_enabled; 34/*
35 * The struct is used to trace EEH state for the associated
36 * PCI device node or PCI device. In future, it might
37 * represent PE as well so that the EEH device to form
38 * another tree except the currently existing tree of PCI
39 * buses and PCI devices
40 */
41#define EEH_MODE_SUPPORTED (1<<0) /* EEH supported on the device */
42#define EEH_MODE_NOCHECK (1<<1) /* EEH check should be skipped */
43#define EEH_MODE_ISOLATED (1<<2) /* The device has been isolated */
44#define EEH_MODE_RECOVERING (1<<3) /* Recovering the device */
45#define EEH_MODE_IRQ_DISABLED (1<<4) /* Interrupt disabled */
46
47struct eeh_dev {
48 int mode; /* EEH mode */
49 int class_code; /* Class code of the device */
50 int config_addr; /* Config address */
51 int pe_config_addr; /* PE config address */
52 int check_count; /* Times of ignored error */
53 int freeze_count; /* Times of froze up */
54 int false_positives; /* Times of reported #ff's */
55 u32 config_space[16]; /* Saved PCI config space */
56 struct pci_controller *phb; /* Associated PHB */
57 struct device_node *dn; /* Associated device node */
58 struct pci_dev *pdev; /* Associated PCI device */
59};
60
61static inline struct device_node *eeh_dev_to_of_node(struct eeh_dev *edev)
62{
63 return edev->dn;
64}
65
66static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
67{
68 return edev->pdev;
69}
35 70
36/* Values for eeh_mode bits in device_node */ 71/*
37#define EEH_MODE_SUPPORTED (1<<0) 72 * The struct is used to trace the registered EEH operation
38#define EEH_MODE_NOCHECK (1<<1) 73 * callback functions. Actually, those operation callback
39#define EEH_MODE_ISOLATED (1<<2) 74 * functions are heavily platform dependent. That means the
40#define EEH_MODE_RECOVERING (1<<3) 75 * platform should register its own EEH operation callback
41#define EEH_MODE_IRQ_DISABLED (1<<4) 76 * functions before any EEH further operations.
77 */
78#define EEH_OPT_DISABLE 0 /* EEH disable */
79#define EEH_OPT_ENABLE 1 /* EEH enable */
80#define EEH_OPT_THAW_MMIO 2 /* MMIO enable */
81#define EEH_OPT_THAW_DMA 3 /* DMA enable */
82#define EEH_STATE_UNAVAILABLE (1 << 0) /* State unavailable */
83#define EEH_STATE_NOT_SUPPORT (1 << 1) /* EEH not supported */
84#define EEH_STATE_RESET_ACTIVE (1 << 2) /* Active reset */
85#define EEH_STATE_MMIO_ACTIVE (1 << 3) /* Active MMIO */
86#define EEH_STATE_DMA_ACTIVE (1 << 4) /* Active DMA */
87#define EEH_STATE_MMIO_ENABLED (1 << 5) /* MMIO enabled */
88#define EEH_STATE_DMA_ENABLED (1 << 6) /* DMA enabled */
89#define EEH_RESET_DEACTIVATE 0 /* Deactivate the PE reset */
90#define EEH_RESET_HOT 1 /* Hot reset */
91#define EEH_RESET_FUNDAMENTAL 3 /* Fundamental reset */
92#define EEH_LOG_TEMP 1 /* EEH temporary error log */
93#define EEH_LOG_PERM 2 /* EEH permanent error log */
94
95struct eeh_ops {
96 char *name;
97 int (*init)(void);
98 int (*set_option)(struct device_node *dn, int option);
99 int (*get_pe_addr)(struct device_node *dn);
100 int (*get_state)(struct device_node *dn, int *state);
101 int (*reset)(struct device_node *dn, int option);
102 int (*wait_state)(struct device_node *dn, int max_wait);
103 int (*get_log)(struct device_node *dn, int severity, char *drv_log, unsigned long len);
104 int (*configure_bridge)(struct device_node *dn);
105 int (*read_config)(struct device_node *dn, int where, int size, u32 *val);
106 int (*write_config)(struct device_node *dn, int where, int size, u32 val);
107};
108
109extern struct eeh_ops *eeh_ops;
110extern int eeh_subsystem_enabled;
42 111
43/* Max number of EEH freezes allowed before we consider the device 112/*
44 * to be permanently disabled. */ 113 * Max number of EEH freezes allowed before we consider the device
114 * to be permanently disabled.
115 */
45#define EEH_MAX_ALLOWED_FREEZES 5 116#define EEH_MAX_ALLOWED_FREEZES 5
46 117
118void * __devinit eeh_dev_init(struct device_node *dn, void *data);
119void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb);
120void __init eeh_dev_phb_init(void);
47void __init eeh_init(void); 121void __init eeh_init(void);
122#ifdef CONFIG_PPC_PSERIES
123int __init eeh_pseries_init(void);
124#endif
125int __init eeh_ops_register(struct eeh_ops *ops);
126int __exit eeh_ops_unregister(const char *name);
48unsigned long eeh_check_failure(const volatile void __iomem *token, 127unsigned long eeh_check_failure(const volatile void __iomem *token,
49 unsigned long val); 128 unsigned long val);
50int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev); 129int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev);
51void __init pci_addr_cache_build(void); 130void __init pci_addr_cache_build(void);
52
53/**
54 * eeh_add_device_early
55 * eeh_add_device_late
56 *
57 * Perform eeh initialization for devices added after boot.
58 * Call eeh_add_device_early before doing any i/o to the
59 * device (including config space i/o). Call eeh_add_device_late
60 * to finish the eeh setup for this device.
61 */
62void eeh_add_device_tree_early(struct device_node *); 131void eeh_add_device_tree_early(struct device_node *);
63void eeh_add_device_tree_late(struct pci_bus *); 132void eeh_add_device_tree_late(struct pci_bus *);
64
65/**
66 * eeh_remove_device_recursive - undo EEH for device & children.
67 * @dev: pci device to be removed
68 *
69 * As above, this removes the device; it also removes child
70 * pci devices as well.
71 */
72void eeh_remove_bus_device(struct pci_dev *); 133void eeh_remove_bus_device(struct pci_dev *);
73 134
74/** 135/**
@@ -87,8 +148,25 @@ void eeh_remove_bus_device(struct pci_dev *);
87#define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8)) 148#define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8))
88 149
89#else /* !CONFIG_EEH */ 150#else /* !CONFIG_EEH */
151
152static inline void *eeh_dev_init(struct device_node *dn, void *data)
153{
154 return NULL;
155}
156
157static inline void eeh_dev_phb_init_dynamic(struct pci_controller *phb) { }
158
159static inline void eeh_dev_phb_init(void) { }
160
90static inline void eeh_init(void) { } 161static inline void eeh_init(void) { }
91 162
163#ifdef CONFIG_PPC_PSERIES
164static inline int eeh_pseries_init(void)
165{
166 return 0;
167}
168#endif /* CONFIG_PPC_PSERIES */
169
92static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) 170static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
93{ 171{
94 return val; 172 return val;
diff --git a/arch/powerpc/include/asm/eeh_event.h b/arch/powerpc/include/asm/eeh_event.h
index cc3cb04539a..c68b012b779 100644
--- a/arch/powerpc/include/asm/eeh_event.h
+++ b/arch/powerpc/include/asm/eeh_event.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * eeh_event.h
3 *
4 * This program is free software; you can redistribute it and/or modify 2 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 3 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or 4 * the Free Software Foundation; either version 2 of the License, or
@@ -22,32 +20,19 @@
22#define ASM_POWERPC_EEH_EVENT_H 20#define ASM_POWERPC_EEH_EVENT_H
23#ifdef __KERNEL__ 21#ifdef __KERNEL__
24 22
25/** EEH event -- structure holding pci controller data that describes 23/*
26 * a change in the isolation status of a PCI slot. A pointer 24 * structure holding pci controller data that describes a
27 * to this struct is passed as the data pointer in a notify callback. 25 * change in the isolation status of a PCI slot. A pointer
26 * to this struct is passed as the data pointer in a notify
27 * callback.
28 */ 28 */
29struct eeh_event { 29struct eeh_event {
30 struct list_head list; 30 struct list_head list; /* to form event queue */
31 struct device_node *dn; /* struct device node */ 31 struct eeh_dev *edev; /* EEH device */
32 struct pci_dev *dev; /* affected device */
33}; 32};
34 33
35/** 34int eeh_send_failure_event(struct eeh_dev *edev);
36 * eeh_send_failure_event - generate a PCI error event 35struct eeh_dev *handle_eeh_events(struct eeh_event *);
37 * @dev pci device
38 *
39 * This routine builds a PCI error event which will be delivered
40 * to all listeners on the eeh_notifier_chain.
41 *
42 * This routine can be called within an interrupt context;
43 * the actual event will be delivered in a normal context
44 * (from a workqueue).
45 */
46int eeh_send_failure_event (struct device_node *dn,
47 struct pci_dev *dev);
48
49/* Main recovery function */
50struct pci_dn * handle_eeh_events (struct eeh_event *);
51 36
52#endif /* __KERNEL__ */ 37#endif /* __KERNEL__ */
53#endif /* ASM_POWERPC_EEH_EVENT_H */ 38#endif /* ASM_POWERPC_EEH_EVENT_H */
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 8057f4f6980..548da3aa0a3 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -232,23 +232,30 @@ label##_hv: \
232 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, \ 232 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
233 EXC_HV, KVMTEST, vec) 233 EXC_HV, KVMTEST, vec)
234 234
235#define __SOFTEN_TEST(h) \ 235/* This associate vector numbers with bits in paca->irq_happened */
236#define SOFTEN_VALUE_0x500 PACA_IRQ_EE
237#define SOFTEN_VALUE_0x502 PACA_IRQ_EE
238#define SOFTEN_VALUE_0x900 PACA_IRQ_DEC
239#define SOFTEN_VALUE_0x982 PACA_IRQ_DEC
240
241#define __SOFTEN_TEST(h, vec) \
236 lbz r10,PACASOFTIRQEN(r13); \ 242 lbz r10,PACASOFTIRQEN(r13); \
237 cmpwi r10,0; \ 243 cmpwi r10,0; \
244 li r10,SOFTEN_VALUE_##vec; \
238 beq masked_##h##interrupt 245 beq masked_##h##interrupt
239#define _SOFTEN_TEST(h) __SOFTEN_TEST(h) 246#define _SOFTEN_TEST(h, vec) __SOFTEN_TEST(h, vec)
240 247
241#define SOFTEN_TEST_PR(vec) \ 248#define SOFTEN_TEST_PR(vec) \
242 KVMTEST_PR(vec); \ 249 KVMTEST_PR(vec); \
243 _SOFTEN_TEST(EXC_STD) 250 _SOFTEN_TEST(EXC_STD, vec)
244 251
245#define SOFTEN_TEST_HV(vec) \ 252#define SOFTEN_TEST_HV(vec) \
246 KVMTEST(vec); \ 253 KVMTEST(vec); \
247 _SOFTEN_TEST(EXC_HV) 254 _SOFTEN_TEST(EXC_HV, vec)
248 255
249#define SOFTEN_TEST_HV_201(vec) \ 256#define SOFTEN_TEST_HV_201(vec) \
250 KVMTEST(vec); \ 257 KVMTEST(vec); \
251 _SOFTEN_TEST(EXC_STD) 258 _SOFTEN_TEST(EXC_STD, vec)
252 259
253#define __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra) \ 260#define __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra) \
254 HMT_MEDIUM; \ 261 HMT_MEDIUM; \
@@ -272,73 +279,55 @@ label##_hv: \
272 _MASKABLE_EXCEPTION_PSERIES(vec, label, \ 279 _MASKABLE_EXCEPTION_PSERIES(vec, label, \
273 EXC_HV, SOFTEN_TEST_HV) 280 EXC_HV, SOFTEN_TEST_HV)
274 281
275#ifdef CONFIG_PPC_ISERIES 282/*
276#define DISABLE_INTS \ 283 * Our exception common code can be passed various "additions"
277 li r11,0; \ 284 * to specify the behaviour of interrupts, whether to kick the
278 stb r11,PACASOFTIRQEN(r13); \ 285 * runlatch, etc...
279BEGIN_FW_FTR_SECTION; \ 286 */
280 stb r11,PACAHARDIRQEN(r13); \ 287
281END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES); \ 288/* Exception addition: Hard disable interrupts */
282 TRACE_DISABLE_INTS; \ 289#define DISABLE_INTS SOFT_DISABLE_INTS(r10,r11)
283BEGIN_FW_FTR_SECTION; \
284 mfmsr r10; \
285 ori r10,r10,MSR_EE; \
286 mtmsrd r10,1; \
287END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
288#else
289#define DISABLE_INTS \
290 li r11,0; \
291 stb r11,PACASOFTIRQEN(r13); \
292 stb r11,PACAHARDIRQEN(r13); \
293 TRACE_DISABLE_INTS
294#endif /* CONFIG_PPC_ISERIES */
295 290
291/* Exception addition: Keep interrupt state */
296#define ENABLE_INTS \ 292#define ENABLE_INTS \
293 ld r11,PACAKMSR(r13); \
297 ld r12,_MSR(r1); \ 294 ld r12,_MSR(r1); \
298 mfmsr r11; \
299 rlwimi r11,r12,0,MSR_EE; \ 295 rlwimi r11,r12,0,MSR_EE; \
300 mtmsrd r11,1 296 mtmsrd r11,1
301 297
302#define STD_EXCEPTION_COMMON(trap, label, hdlr) \ 298#define ADD_NVGPRS \
303 .align 7; \ 299 bl .save_nvgprs
304 .globl label##_common; \ 300
305label##_common: \ 301#define RUNLATCH_ON \
306 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ 302BEGIN_FTR_SECTION \
307 DISABLE_INTS; \ 303 clrrdi r3,r1,THREAD_SHIFT; \
308 bl .save_nvgprs; \ 304 ld r4,TI_LOCAL_FLAGS(r3); \
309 addi r3,r1,STACK_FRAME_OVERHEAD; \ 305 andi. r0,r4,_TLF_RUNLATCH; \
310 bl hdlr; \ 306 beql ppc64_runlatch_on_trampoline; \
311 b .ret_from_except 307END_FTR_SECTION_IFSET(CPU_FTR_CTRL)
308
309#define EXCEPTION_COMMON(trap, label, hdlr, ret, additions) \
310 .align 7; \
311 .globl label##_common; \
312label##_common: \
313 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
314 additions; \
315 addi r3,r1,STACK_FRAME_OVERHEAD; \
316 bl hdlr; \
317 b ret
318
319#define STD_EXCEPTION_COMMON(trap, label, hdlr) \
320 EXCEPTION_COMMON(trap, label, hdlr, ret_from_except, \
321 ADD_NVGPRS;DISABLE_INTS)
312 322
313/* 323/*
314 * Like STD_EXCEPTION_COMMON, but for exceptions that can occur 324 * Like STD_EXCEPTION_COMMON, but for exceptions that can occur
315 * in the idle task and therefore need the special idle handling. 325 * in the idle task and therefore need the special idle handling
326 * (finish nap and runlatch)
316 */ 327 */
317#define STD_EXCEPTION_COMMON_IDLE(trap, label, hdlr) \ 328#define STD_EXCEPTION_COMMON_ASYNC(trap, label, hdlr) \
318 .align 7; \ 329 EXCEPTION_COMMON(trap, label, hdlr, ret_from_except_lite, \
319 .globl label##_common; \ 330 FINISH_NAP;RUNLATCH_ON;DISABLE_INTS)
320label##_common: \
321 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
322 FINISH_NAP; \
323 DISABLE_INTS; \
324 bl .save_nvgprs; \
325 addi r3,r1,STACK_FRAME_OVERHEAD; \
326 bl hdlr; \
327 b .ret_from_except
328
329#define STD_EXCEPTION_COMMON_LITE(trap, label, hdlr) \
330 .align 7; \
331 .globl label##_common; \
332label##_common: \
333 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
334 FINISH_NAP; \
335 DISABLE_INTS; \
336BEGIN_FTR_SECTION \
337 bl .ppc64_runlatch_on; \
338END_FTR_SECTION_IFSET(CPU_FTR_CTRL) \
339 addi r3,r1,STACK_FRAME_OVERHEAD; \
340 bl hdlr; \
341 b .ret_from_except_lite
342 331
343/* 332/*
344 * When the idle code in power4_idle puts the CPU into NAP mode, 333 * When the idle code in power4_idle puts the CPU into NAP mode,
diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h
new file mode 100644
index 00000000000..88dbf965918
--- /dev/null
+++ b/arch/powerpc/include/asm/fadump.h
@@ -0,0 +1,218 @@
1/*
2 * Firmware Assisted dump header file.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright 2011 IBM Corporation
19 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
20 */
21
22#ifndef __PPC64_FA_DUMP_H__
23#define __PPC64_FA_DUMP_H__
24
25#ifdef CONFIG_FA_DUMP
26
27/*
28 * The RMA region will be saved for later dumping when kernel crashes.
29 * RMA is Real Mode Area, the first block of logical memory address owned
30 * by logical partition, containing the storage that may be accessed with
31 * translate off.
32 */
33#define RMA_START 0x0
34#define RMA_END (ppc64_rma_size)
35
36/*
37 * On some Power systems where RMO is 128MB, it still requires minimum of
38 * 256MB for kernel to boot successfully. When kdump infrastructure is
39 * configured to save vmcore over network, we run into OOM issue while
40 * loading modules related to network setup. Hence we need aditional 64M
41 * of memory to avoid OOM issue.
42 */
43#define MIN_BOOT_MEM (((RMA_END < (0x1UL << 28)) ? (0x1UL << 28) : RMA_END) \
44 + (0x1UL << 26))
45
46#define memblock_num_regions(memblock_type) (memblock.memblock_type.cnt)
47
48#ifndef ELF_CORE_EFLAGS
49#define ELF_CORE_EFLAGS 0
50#endif
51
52/* Firmware provided dump sections */
53#define FADUMP_CPU_STATE_DATA 0x0001
54#define FADUMP_HPTE_REGION 0x0002
55#define FADUMP_REAL_MODE_REGION 0x0011
56
57/* Dump request flag */
58#define FADUMP_REQUEST_FLAG 0x00000001
59
60/* FAD commands */
61#define FADUMP_REGISTER 1
62#define FADUMP_UNREGISTER 2
63#define FADUMP_INVALIDATE 3
64
65/* Dump status flag */
66#define FADUMP_ERROR_FLAG 0x2000
67
68#define FADUMP_CPU_ID_MASK ((1UL << 32) - 1)
69
70#define CPU_UNKNOWN (~((u32)0))
71
72/* Utility macros */
73#define SKIP_TO_NEXT_CPU(reg_entry) \
74({ \
75 while (reg_entry->reg_id != REG_ID("CPUEND")) \
76 reg_entry++; \
77 reg_entry++; \
78})
79
80/* Kernel Dump section info */
81struct fadump_section {
82 u32 request_flag;
83 u16 source_data_type;
84 u16 error_flags;
85 u64 source_address;
86 u64 source_len;
87 u64 bytes_dumped;
88 u64 destination_address;
89};
90
91/* ibm,configure-kernel-dump header. */
92struct fadump_section_header {
93 u32 dump_format_version;
94 u16 dump_num_sections;
95 u16 dump_status_flag;
96 u32 offset_first_dump_section;
97
98 /* Fields for disk dump option. */
99 u32 dd_block_size;
100 u64 dd_block_offset;
101 u64 dd_num_blocks;
102 u32 dd_offset_disk_path;
103
104 /* Maximum time allowed to prevent an automatic dump-reboot. */
105 u32 max_time_auto;
106};
107
108/*
109 * Firmware Assisted dump memory structure. This structure is required for
110 * registering future kernel dump with power firmware through rtas call.
111 *
112 * No disk dump option. Hence disk dump path string section is not included.
113 */
114struct fadump_mem_struct {
115 struct fadump_section_header header;
116
117 /* Kernel dump sections */
118 struct fadump_section cpu_state_data;
119 struct fadump_section hpte_region;
120 struct fadump_section rmr_region;
121};
122
123/* Firmware-assisted dump configuration details. */
124struct fw_dump {
125 unsigned long cpu_state_data_size;
126 unsigned long hpte_region_size;
127 unsigned long boot_memory_size;
128 unsigned long reserve_dump_area_start;
129 unsigned long reserve_dump_area_size;
130 /* cmd line option during boot */
131 unsigned long reserve_bootvar;
132
133 unsigned long fadumphdr_addr;
134 unsigned long cpu_notes_buf;
135 unsigned long cpu_notes_buf_size;
136
137 int ibm_configure_kernel_dump;
138
139 unsigned long fadump_enabled:1;
140 unsigned long fadump_supported:1;
141 unsigned long dump_active:1;
142 unsigned long dump_registered:1;
143};
144
145/*
146 * Copy the ascii values for first 8 characters from a string into u64
147 * variable at their respective indexes.
148 * e.g.
149 * The string "FADMPINF" will be converted into 0x4641444d50494e46
150 */
151static inline u64 str_to_u64(const char *str)
152{
153 u64 val = 0;
154 int i;
155
156 for (i = 0; i < sizeof(val); i++)
157 val = (*str) ? (val << 8) | *str++ : val << 8;
158 return val;
159}
160#define STR_TO_HEX(x) str_to_u64(x)
161#define REG_ID(x) str_to_u64(x)
162
163#define FADUMP_CRASH_INFO_MAGIC STR_TO_HEX("FADMPINF")
164#define REGSAVE_AREA_MAGIC STR_TO_HEX("REGSAVE")
165
166/* The firmware-assisted dump format.
167 *
168 * The register save area is an area in the partition's memory used to preserve
169 * the register contents (CPU state data) for the active CPUs during a firmware
170 * assisted dump. The dump format contains register save area header followed
171 * by register entries. Each list of registers for a CPU starts with
172 * "CPUSTRT" and ends with "CPUEND".
173 */
174
175/* Register save area header. */
176struct fadump_reg_save_area_header {
177 u64 magic_number;
178 u32 version;
179 u32 num_cpu_offset;
180};
181
182/* Register entry. */
183struct fadump_reg_entry {
184 u64 reg_id;
185 u64 reg_value;
186};
187
188/* fadump crash info structure */
189struct fadump_crash_info_header {
190 u64 magic_number;
191 u64 elfcorehdr_addr;
192 u32 crashing_cpu;
193 struct pt_regs regs;
194 struct cpumask cpu_online_mask;
195};
196
197/* Crash memory ranges */
198#define INIT_CRASHMEM_RANGES (INIT_MEMBLOCK_REGIONS + 2)
199
200struct fad_crash_memory_ranges {
201 unsigned long long base;
202 unsigned long long size;
203};
204
205extern int early_init_dt_scan_fw_dump(unsigned long node,
206 const char *uname, int depth, void *data);
207extern int fadump_reserve_mem(void);
208extern int setup_fadump(void);
209extern int is_fadump_active(void);
210extern void crash_fadump(struct pt_regs *, const char *);
211extern void fadump_cleanup(void);
212
213extern void vmcore_cleanup(void);
214#else /* CONFIG_FA_DUMP */
215static inline int is_fadump_active(void) { return 0; }
216static inline void crash_fadump(struct pt_regs *regs, const char *str) { }
217#endif
218#endif
diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h
index 14db29b18d0..ad0b751b0d7 100644
--- a/arch/powerpc/include/asm/firmware.h
+++ b/arch/powerpc/include/asm/firmware.h
@@ -41,7 +41,6 @@
41#define FW_FEATURE_XDABR ASM_CONST(0x0000000000040000) 41#define FW_FEATURE_XDABR ASM_CONST(0x0000000000040000)
42#define FW_FEATURE_MULTITCE ASM_CONST(0x0000000000080000) 42#define FW_FEATURE_MULTITCE ASM_CONST(0x0000000000080000)
43#define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000) 43#define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000)
44#define FW_FEATURE_ISERIES ASM_CONST(0x0000000000200000)
45#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000) 44#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000)
46#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000) 45#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000)
47#define FW_FEATURE_BEAT ASM_CONST(0x0000000001000000) 46#define FW_FEATURE_BEAT ASM_CONST(0x0000000001000000)
@@ -65,8 +64,6 @@ enum {
65 FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR | 64 FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR |
66 FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO, 65 FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO,
67 FW_FEATURE_PSERIES_ALWAYS = 0, 66 FW_FEATURE_PSERIES_ALWAYS = 0,
68 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
69 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
70 FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_OPALv2, 67 FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_OPALv2,
71 FW_FEATURE_POWERNV_ALWAYS = 0, 68 FW_FEATURE_POWERNV_ALWAYS = 0,
72 FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, 69 FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
@@ -79,9 +76,6 @@ enum {
79#ifdef CONFIG_PPC_PSERIES 76#ifdef CONFIG_PPC_PSERIES
80 FW_FEATURE_PSERIES_POSSIBLE | 77 FW_FEATURE_PSERIES_POSSIBLE |
81#endif 78#endif
82#ifdef CONFIG_PPC_ISERIES
83 FW_FEATURE_ISERIES_POSSIBLE |
84#endif
85#ifdef CONFIG_PPC_POWERNV 79#ifdef CONFIG_PPC_POWERNV
86 FW_FEATURE_POWERNV_POSSIBLE | 80 FW_FEATURE_POWERNV_POSSIBLE |
87#endif 81#endif
@@ -99,9 +93,6 @@ enum {
99#ifdef CONFIG_PPC_PSERIES 93#ifdef CONFIG_PPC_PSERIES
100 FW_FEATURE_PSERIES_ALWAYS & 94 FW_FEATURE_PSERIES_ALWAYS &
101#endif 95#endif
102#ifdef CONFIG_PPC_ISERIES
103 FW_FEATURE_ISERIES_ALWAYS &
104#endif
105#ifdef CONFIG_PPC_POWERNV 96#ifdef CONFIG_PPC_POWERNV
106 FW_FEATURE_POWERNV_ALWAYS & 97 FW_FEATURE_POWERNV_ALWAYS &
107#endif 98#endif
diff --git a/arch/powerpc/include/asm/fsl_guts.h b/arch/powerpc/include/asm/fsl_guts.h
index bebd12463ec..ce04530d200 100644
--- a/arch/powerpc/include/asm/fsl_guts.h
+++ b/arch/powerpc/include/asm/fsl_guts.h
@@ -4,7 +4,7 @@
4 * Authors: Jeff Brown 4 * Authors: Jeff Brown
5 * Timur Tabi <timur@freescale.com> 5 * Timur Tabi <timur@freescale.com>
6 * 6 *
7 * Copyright 2004,2007 Freescale Semiconductor, Inc 7 * Copyright 2004,2007,2012 Freescale Semiconductor, Inc
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -114,6 +114,10 @@ struct ccsr_guts_86xx {
114 __be32 srds2cr1; /* 0x.0f44 - SerDes2 Control Register 0 */ 114 __be32 srds2cr1; /* 0x.0f44 - SerDes2 Control Register 0 */
115} __attribute__ ((packed)); 115} __attribute__ ((packed));
116 116
117
118/* Alternate function signal multiplex control */
119#define MPC85xx_PMUXCR_QE(x) (0x8000 >> (x))
120
117#ifdef CONFIG_PPC_86xx 121#ifdef CONFIG_PPC_86xx
118 122
119#define CCSR_GUTS_DMACR_DEV_SSI 0 /* DMA controller/channel set to SSI */ 123#define CCSR_GUTS_DMACR_DEV_SSI 0 /* DMA controller/channel set to SSI */
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index bb712c9488b..51010bfc792 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -11,6 +11,27 @@
11#include <asm/ptrace.h> 11#include <asm/ptrace.h>
12#include <asm/processor.h> 12#include <asm/processor.h>
13 13
14#ifdef CONFIG_PPC64
15
16/*
17 * PACA flags in paca->irq_happened.
18 *
19 * This bits are set when interrupts occur while soft-disabled
20 * and allow a proper replay. Additionally, PACA_IRQ_HARD_DIS
21 * is set whenever we manually hard disable.
22 */
23#define PACA_IRQ_HARD_DIS 0x01
24#define PACA_IRQ_DBELL 0x02
25#define PACA_IRQ_EE 0x04
26#define PACA_IRQ_DEC 0x08 /* Or FIT */
27#define PACA_IRQ_EE_EDGE 0x10 /* BookE only */
28
29#endif /* CONFIG_PPC64 */
30
31#ifndef __ASSEMBLY__
32
33extern void __replay_interrupt(unsigned int vector);
34
14extern void timer_interrupt(struct pt_regs *); 35extern void timer_interrupt(struct pt_regs *);
15 36
16#ifdef CONFIG_PPC64 37#ifdef CONFIG_PPC64
@@ -42,7 +63,6 @@ static inline unsigned long arch_local_irq_disable(void)
42} 63}
43 64
44extern void arch_local_irq_restore(unsigned long); 65extern void arch_local_irq_restore(unsigned long);
45extern void iseries_handle_interrupts(void);
46 66
47static inline void arch_local_irq_enable(void) 67static inline void arch_local_irq_enable(void)
48{ 68{
@@ -68,16 +88,33 @@ static inline bool arch_irqs_disabled(void)
68#define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory"); 88#define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory");
69#define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory"); 89#define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory");
70#else 90#else
71#define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1) 91#define __hard_irq_enable() __mtmsrd(local_paca->kernel_msr | MSR_EE, 1)
72#define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1) 92#define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1)
73#endif 93#endif
74 94
75#define hard_irq_disable() \ 95static inline void hard_irq_disable(void)
76 do { \ 96{
77 __hard_irq_disable(); \ 97 __hard_irq_disable();
78 get_paca()->soft_enabled = 0; \ 98 get_paca()->soft_enabled = 0;
79 get_paca()->hard_enabled = 0; \ 99 get_paca()->irq_happened |= PACA_IRQ_HARD_DIS;
80 } while(0) 100}
101
102/*
103 * This is called by asynchronous interrupts to conditionally
104 * re-enable hard interrupts when soft-disabled after having
105 * cleared the source of the interrupt
106 */
107static inline void may_hard_irq_enable(void)
108{
109 get_paca()->irq_happened &= ~PACA_IRQ_HARD_DIS;
110 if (!(get_paca()->irq_happened & PACA_IRQ_EE))
111 __hard_irq_enable();
112}
113
114static inline bool arch_irq_disabled_regs(struct pt_regs *regs)
115{
116 return !regs->softe;
117}
81 118
82#else /* CONFIG_PPC64 */ 119#else /* CONFIG_PPC64 */
83 120
@@ -139,6 +176,13 @@ static inline bool arch_irqs_disabled(void)
139 176
140#define hard_irq_disable() arch_local_irq_disable() 177#define hard_irq_disable() arch_local_irq_disable()
141 178
179static inline bool arch_irq_disabled_regs(struct pt_regs *regs)
180{
181 return !(regs->msr & MSR_EE);
182}
183
184static inline void may_hard_irq_enable(void) { }
185
142#endif /* CONFIG_PPC64 */ 186#endif /* CONFIG_PPC64 */
143 187
144#define ARCH_IRQ_INIT_FLAGS IRQ_NOREQUEST 188#define ARCH_IRQ_INIT_FLAGS IRQ_NOREQUEST
@@ -149,5 +193,6 @@ static inline bool arch_irqs_disabled(void)
149 */ 193 */
150struct irq_chip; 194struct irq_chip;
151 195
196#endif /* __ASSEMBLY__ */
152#endif /* __KERNEL__ */ 197#endif /* __KERNEL__ */
153#endif /* _ASM_POWERPC_HW_IRQ_H */ 198#endif /* _ASM_POWERPC_HW_IRQ_H */
diff --git a/arch/powerpc/include/asm/irqflags.h b/arch/powerpc/include/asm/irqflags.h
index b0b06d85788..6f9b6e23dc5 100644
--- a/arch/powerpc/include/asm/irqflags.h
+++ b/arch/powerpc/include/asm/irqflags.h
@@ -39,24 +39,31 @@
39#define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on) 39#define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on)
40#define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off) 40#define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off)
41 41
42#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \ 42/*
43 cmpdi en,0; \ 43 * This is used by assembly code to soft-disable interrupts
44 bne 95f; \ 44 */
45 stb en,PACASOFTIRQEN(r13); \ 45#define SOFT_DISABLE_INTS(__rA, __rB) \
46 TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off) \ 46 lbz __rA,PACASOFTIRQEN(r13); \
47 b skip; \ 47 lbz __rB,PACAIRQHAPPENED(r13); \
4895: TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on) \ 48 cmpwi cr0,__rA,0; \
49 li en,1; 49 li __rA,0; \
50#define TRACE_AND_RESTORE_IRQ(en) \ 50 ori __rB,__rB,PACA_IRQ_HARD_DIS; \
51 TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \ 51 stb __rB,PACAIRQHAPPENED(r13); \
52 stb en,PACASOFTIRQEN(r13); \ 52 beq 44f; \
5396: 53 stb __rA,PACASOFTIRQEN(r13); \
54 TRACE_DISABLE_INTS; \
5544:
56
54#else 57#else
55#define TRACE_ENABLE_INTS 58#define TRACE_ENABLE_INTS
56#define TRACE_DISABLE_INTS 59#define TRACE_DISABLE_INTS
57#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) 60
58#define TRACE_AND_RESTORE_IRQ(en) \ 61#define SOFT_DISABLE_INTS(__rA, __rB) \
59 stb en,PACASOFTIRQEN(r13) 62 lbz __rA,PACAIRQHAPPENED(r13); \
63 li __rB,0; \
64 ori __rA,__rA,PACA_IRQ_HARD_DIS; \
65 stb __rB,PACASOFTIRQEN(r13); \
66 stb __rA,PACAIRQHAPPENED(r13)
60#endif 67#endif
61#endif 68#endif
62 69
diff --git a/arch/powerpc/include/asm/iseries/alpaca.h b/arch/powerpc/include/asm/iseries/alpaca.h
deleted file mode 100644
index c0cce6727a6..00000000000
--- a/arch/powerpc/include/asm/iseries/alpaca.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright © 2008 Stephen Rothwell IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ASM_POWERPC_ISERIES_ALPACA_H
19#define _ASM_POWERPC_ISERIES_ALPACA_H
20
21/*
22 * This is the part of the paca that the iSeries hypervisor
23 * needs to be statically initialised. Immediately after boot
24 * we switch to the normal Linux paca.
25 */
26struct alpaca {
27 struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */
28 const void *reg_save_ptr; /* Pointer to LpRegSave for PLIC */
29};
30
31#endif /* _ASM_POWERPC_ISERIES_ALPACA_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_call.h b/arch/powerpc/include/asm/iseries/hv_call.h
deleted file mode 100644
index 162d653ad51..00000000000
--- a/arch/powerpc/include/asm/iseries/hv_call.h
+++ /dev/null
@@ -1,111 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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 * This file contains the "hypervisor call" interface which is used to
19 * drive the hypervisor from the OS.
20 */
21#ifndef _ASM_POWERPC_ISERIES_HV_CALL_H
22#define _ASM_POWERPC_ISERIES_HV_CALL_H
23
24#include <asm/iseries/hv_call_sc.h>
25#include <asm/iseries/hv_types.h>
26#include <asm/paca.h>
27
28/* Type of yield for HvCallBaseYieldProcessor */
29#define HvCall_YieldTimed 0 /* Yield until specified time (tb) */
30#define HvCall_YieldToActive 1 /* Yield until all active procs have run */
31#define HvCall_YieldToProc 2 /* Yield until the specified processor has run */
32
33/* interrupt masks for setEnabledInterrupts */
34#define HvCall_MaskIPI 0x00000001
35#define HvCall_MaskLpEvent 0x00000002
36#define HvCall_MaskLpProd 0x00000004
37#define HvCall_MaskTimeout 0x00000008
38
39/* Log buffer formats */
40#define HvCall_LogBuffer_ASCII 0
41#define HvCall_LogBuffer_EBCDIC 1
42
43#define HvCallBaseAckDeferredInts HvCallBase + 0
44#define HvCallBaseCpmPowerOff HvCallBase + 1
45#define HvCallBaseGetHwPatch HvCallBase + 2
46#define HvCallBaseReIplSpAttn HvCallBase + 3
47#define HvCallBaseSetASR HvCallBase + 4
48#define HvCallBaseSetASRAndRfi HvCallBase + 5
49#define HvCallBaseSetIMR HvCallBase + 6
50#define HvCallBaseSendIPI HvCallBase + 7
51#define HvCallBaseTerminateMachine HvCallBase + 8
52#define HvCallBaseTerminateMachineSrc HvCallBase + 9
53#define HvCallBaseProcessPlicInterrupts HvCallBase + 10
54#define HvCallBaseIsPrimaryCpmOrMsdIpl HvCallBase + 11
55#define HvCallBaseSetVirtualSIT HvCallBase + 12
56#define HvCallBaseVaryOffThisProcessor HvCallBase + 13
57#define HvCallBaseVaryOffMemoryChunk HvCallBase + 14
58#define HvCallBaseVaryOffInteractivePercentage HvCallBase + 15
59#define HvCallBaseSendLpProd HvCallBase + 16
60#define HvCallBaseSetEnabledInterrupts HvCallBase + 17
61#define HvCallBaseYieldProcessor HvCallBase + 18
62#define HvCallBaseVaryOffSharedProcUnits HvCallBase + 19
63#define HvCallBaseSetVirtualDecr HvCallBase + 20
64#define HvCallBaseClearLogBuffer HvCallBase + 21
65#define HvCallBaseGetLogBufferCodePage HvCallBase + 22
66#define HvCallBaseGetLogBufferFormat HvCallBase + 23
67#define HvCallBaseGetLogBufferLength HvCallBase + 24
68#define HvCallBaseReadLogBuffer HvCallBase + 25
69#define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26
70#define HvCallBaseWriteLogBuffer HvCallBase + 27
71#define HvCallBaseRouter28 HvCallBase + 28
72#define HvCallBaseRouter29 HvCallBase + 29
73#define HvCallBaseRouter30 HvCallBase + 30
74#define HvCallBaseSetDebugBus HvCallBase + 31
75
76#define HvCallCcSetDABR HvCallCc + 7
77
78static inline void HvCall_setVirtualDecr(void)
79{
80 /*
81 * Ignore any error return codes - most likely means that the
82 * target value for the LP has been increased and this vary off
83 * would bring us below the new target.
84 */
85 HvCall0(HvCallBaseSetVirtualDecr);
86}
87
88static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm)
89{
90 HvCall2(HvCallBaseYieldProcessor, typeOfYield, yieldParm);
91}
92
93static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts)
94{
95 HvCall1(HvCallBaseSetEnabledInterrupts, enabledInterrupts);
96}
97
98static inline void HvCall_setLogBufferFormatAndCodepage(int format,
99 u32 codePage)
100{
101 HvCall2(HvCallBaseSetLogBufferFormatAndCodePage, format, codePage);
102}
103
104extern void HvCall_writeLogBuffer(const void *buffer, u64 bufLen);
105
106static inline void HvCall_sendIPI(struct paca_struct *targetPaca)
107{
108 HvCall1(HvCallBaseSendIPI, targetPaca->paca_index);
109}
110
111#endif /* _ASM_POWERPC_ISERIES_HV_CALL_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_call_event.h b/arch/powerpc/include/asm/iseries/hv_call_event.h
deleted file mode 100644
index cc029d388e1..00000000000
--- a/arch/powerpc/include/asm/iseries/hv_call_event.h
+++ /dev/null
@@ -1,201 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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 * This file contains the "hypervisor call" interface which is used to
19 * drive the hypervisor from the OS.
20 */
21#ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
22#define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
23
24#include <linux/types.h>
25#include <linux/dma-mapping.h>
26
27#include <asm/iseries/hv_call_sc.h>
28#include <asm/iseries/hv_types.h>
29#include <asm/abs_addr.h>
30
31struct HvLpEvent;
32
33typedef u8 HvLpEvent_Type;
34typedef u8 HvLpEvent_AckInd;
35typedef u8 HvLpEvent_AckType;
36
37typedef u8 HvLpDma_Direction;
38typedef u8 HvLpDma_AddressType;
39
40typedef u64 HvLpEvent_Rc;
41typedef u64 HvLpDma_Rc;
42
43#define HvCallEventAckLpEvent HvCallEvent + 0
44#define HvCallEventCancelLpEvent HvCallEvent + 1
45#define HvCallEventCloseLpEventPath HvCallEvent + 2
46#define HvCallEventDmaBufList HvCallEvent + 3
47#define HvCallEventDmaSingle HvCallEvent + 4
48#define HvCallEventDmaToSp HvCallEvent + 5
49#define HvCallEventGetOverflowLpEvents HvCallEvent + 6
50#define HvCallEventGetSourceLpInstanceId HvCallEvent + 7
51#define HvCallEventGetTargetLpInstanceId HvCallEvent + 8
52#define HvCallEventOpenLpEventPath HvCallEvent + 9
53#define HvCallEventSetLpEventStack HvCallEvent + 10
54#define HvCallEventSignalLpEvent HvCallEvent + 11
55#define HvCallEventSignalLpEventParms HvCallEvent + 12
56#define HvCallEventSetInterLpQueueIndex HvCallEvent + 13
57#define HvCallEventSetLpEventQueueInterruptProc HvCallEvent + 14
58#define HvCallEventRouter15 HvCallEvent + 15
59
60static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex)
61{
62 HvCall1(HvCallEventGetOverflowLpEvents, queueIndex);
63}
64
65static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex)
66{
67 HvCall1(HvCallEventSetInterLpQueueIndex, queueIndex);
68}
69
70static inline void HvCallEvent_setLpEventStack(u8 queueIndex,
71 char *eventStackAddr, u32 eventStackSize)
72{
73 HvCall3(HvCallEventSetLpEventStack, queueIndex,
74 virt_to_abs(eventStackAddr), eventStackSize);
75}
76
77static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
78 u16 lpLogicalProcIndex)
79{
80 HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex,
81 lpLogicalProcIndex);
82}
83
84static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event)
85{
86 return HvCall1(HvCallEventSignalLpEvent, virt_to_abs(event));
87}
88
89static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
90 HvLpEvent_Type type, u16 subtype, HvLpEvent_AckInd ackInd,
91 HvLpEvent_AckType ackType, HvLpInstanceId sourceInstanceId,
92 HvLpInstanceId targetInstanceId, u64 correlationToken,
93 u64 eventData1, u64 eventData2, u64 eventData3,
94 u64 eventData4, u64 eventData5)
95{
96 /* Pack the misc bits into a single Dword to pass to PLIC */
97 union {
98 struct {
99 u8 ack_and_target;
100 u8 type;
101 u16 subtype;
102 HvLpInstanceId src_inst;
103 HvLpInstanceId target_inst;
104 } parms;
105 u64 dword;
106 } packed;
107
108 packed.parms.ack_and_target = (ackType << 7) | (ackInd << 6) | targetLp;
109 packed.parms.type = type;
110 packed.parms.subtype = subtype;
111 packed.parms.src_inst = sourceInstanceId;
112 packed.parms.target_inst = targetInstanceId;
113
114 return HvCall7(HvCallEventSignalLpEventParms, packed.dword,
115 correlationToken, eventData1, eventData2,
116 eventData3, eventData4, eventData5);
117}
118
119extern void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag);
120extern void iseries_hv_free(size_t size, void *vaddr, dma_addr_t dma_handle);
121extern dma_addr_t iseries_hv_map(void *vaddr, size_t size,
122 enum dma_data_direction direction);
123extern void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
124 enum dma_data_direction direction);
125
126static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event)
127{
128 return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event));
129}
130
131static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event)
132{
133 return HvCall1(HvCallEventCancelLpEvent, virt_to_abs(event));
134}
135
136static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId(
137 HvLpIndex targetLp, HvLpEvent_Type type)
138{
139 return HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type);
140}
141
142static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId(
143 HvLpIndex targetLp, HvLpEvent_Type type)
144{
145 return HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type);
146}
147
148static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp,
149 HvLpEvent_Type type)
150{
151 HvCall2(HvCallEventOpenLpEventPath, targetLp, type);
152}
153
154static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp,
155 HvLpEvent_Type type)
156{
157 HvCall2(HvCallEventCloseLpEventPath, targetLp, type);
158}
159
160static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
161 HvLpIndex remoteLp, HvLpDma_Direction direction,
162 HvLpInstanceId localInstanceId,
163 HvLpInstanceId remoteInstanceId,
164 HvLpDma_AddressType localAddressType,
165 HvLpDma_AddressType remoteAddressType,
166 /* Do these need to be converted to absolute addresses? */
167 u64 localBufList, u64 remoteBufList, u32 transferLength)
168{
169 /* Pack the misc bits into a single Dword to pass to PLIC */
170 union {
171 struct {
172 u8 flags;
173 HvLpIndex remote;
174 u8 type;
175 u8 reserved;
176 HvLpInstanceId local_inst;
177 HvLpInstanceId remote_inst;
178 } parms;
179 u64 dword;
180 } packed;
181
182 packed.parms.flags = (direction << 7) |
183 (localAddressType << 6) | (remoteAddressType << 5);
184 packed.parms.remote = remoteLp;
185 packed.parms.type = type;
186 packed.parms.reserved = 0;
187 packed.parms.local_inst = localInstanceId;
188 packed.parms.remote_inst = remoteInstanceId;
189
190 return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList,
191 remoteBufList, transferLength);
192}
193
194static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote,
195 u32 length, HvLpDma_Direction dir)
196{
197 return HvCall4(HvCallEventDmaToSp, virt_to_abs(local), remote,
198 length, dir);
199}
200
201#endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_call_sc.h b/arch/powerpc/include/asm/iseries/hv_call_sc.h
deleted file mode 100644
index f5d21095925..00000000000
--- a/arch/powerpc/include/asm/iseries/hv_call_sc.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ASM_POWERPC_ISERIES_HV_CALL_SC_H
19#define _ASM_POWERPC_ISERIES_HV_CALL_SC_H
20
21#include <linux/types.h>
22
23#define HvCallBase 0x8000000000000000ul
24#define HvCallCc 0x8001000000000000ul
25#define HvCallCfg 0x8002000000000000ul
26#define HvCallEvent 0x8003000000000000ul
27#define HvCallHpt 0x8004000000000000ul
28#define HvCallPci 0x8005000000000000ul
29#define HvCallSm 0x8007000000000000ul
30#define HvCallXm 0x8009000000000000ul
31
32extern u64 HvCall0(u64);
33extern u64 HvCall1(u64, u64);
34extern u64 HvCall2(u64, u64, u64);
35extern u64 HvCall3(u64, u64, u64, u64);
36extern u64 HvCall4(u64, u64, u64, u64, u64);
37extern u64 HvCall5(u64, u64, u64, u64, u64, u64);
38extern u64 HvCall6(u64, u64, u64, u64, u64, u64, u64);
39extern u64 HvCall7(u64, u64, u64, u64, u64, u64, u64, u64);
40
41extern u64 HvCall0Ret16(u64, void *);
42extern u64 HvCall1Ret16(u64, void *, u64);
43extern u64 HvCall2Ret16(u64, void *, u64, u64);
44extern u64 HvCall3Ret16(u64, void *, u64, u64, u64);
45extern u64 HvCall4Ret16(u64, void *, u64, u64, u64, u64);
46extern u64 HvCall5Ret16(u64, void *, u64, u64, u64, u64, u64);
47extern u64 HvCall6Ret16(u64, void *, u64, u64, u64, u64, u64, u64);
48extern u64 HvCall7Ret16(u64, void *, u64, u64 ,u64 ,u64 ,u64 ,u64 ,u64);
49
50#endif /* _ASM_POWERPC_ISERIES_HV_CALL_SC_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_call_xm.h b/arch/powerpc/include/asm/iseries/hv_call_xm.h
deleted file mode 100644
index 392ac3f54df..00000000000
--- a/arch/powerpc/include/asm/iseries/hv_call_xm.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * This file contains the "hypervisor call" interface which is used to
3 * drive the hypervisor from SLIC.
4 */
5#ifndef _ASM_POWERPC_ISERIES_HV_CALL_XM_H
6#define _ASM_POWERPC_ISERIES_HV_CALL_XM_H
7
8#include <asm/iseries/hv_call_sc.h>
9#include <asm/iseries/hv_types.h>
10
11#define HvCallXmGetTceTableParms HvCallXm + 0
12#define HvCallXmTestBus HvCallXm + 1
13#define HvCallXmConnectBusUnit HvCallXm + 2
14#define HvCallXmLoadTod HvCallXm + 8
15#define HvCallXmTestBusUnit HvCallXm + 9
16#define HvCallXmSetTce HvCallXm + 11
17#define HvCallXmSetTces HvCallXm + 13
18
19static inline void HvCallXm_getTceTableParms(u64 cb)
20{
21 HvCall1(HvCallXmGetTceTableParms, cb);
22}
23
24static inline u64 HvCallXm_setTce(u64 tceTableToken, u64 tceOffset, u64 tce)
25{
26 return HvCall3(HvCallXmSetTce, tceTableToken, tceOffset, tce);
27}
28
29static inline u64 HvCallXm_setTces(u64 tceTableToken, u64 tceOffset,
30 u64 numTces, u64 tce1, u64 tce2, u64 tce3, u64 tce4)
31{
32 return HvCall7(HvCallXmSetTces, tceTableToken, tceOffset, numTces,
33 tce1, tce2, tce3, tce4);
34}
35
36static inline u64 HvCallXm_testBus(u16 busNumber)
37{
38 return HvCall1(HvCallXmTestBus, busNumber);
39}
40
41static inline u64 HvCallXm_testBusUnit(u16 busNumber, u8 subBusNumber,
42 u8 deviceId)
43{
44 return HvCall2(HvCallXmTestBusUnit, busNumber,
45 (subBusNumber << 8) | deviceId);
46}
47
48static inline u64 HvCallXm_connectBusUnit(u16 busNumber, u8 subBusNumber,
49 u8 deviceId, u64 interruptToken)
50{
51 return HvCall5(HvCallXmConnectBusUnit, busNumber,
52 (subBusNumber << 8) | deviceId, interruptToken, 0,
53 0 /* HvLpConfig::mapDsaToQueueIndex(HvLpDSA(busNumber, xBoard, xCard)) */);
54}
55
56static inline u64 HvCallXm_loadTod(void)
57{
58 return HvCall0(HvCallXmLoadTod);
59}
60
61#endif /* _ASM_POWERPC_ISERIES_HV_CALL_XM_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_lp_config.h b/arch/powerpc/include/asm/iseries/hv_lp_config.h
deleted file mode 100644
index a006fd1e4a2..00000000000
--- a/arch/powerpc/include/asm/iseries/hv_lp_config.h
+++ /dev/null
@@ -1,128 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H
19#define _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H
20
21/*
22 * This file contains the interface to the LPAR configuration data
23 * to determine which resources should be allocated to each partition.
24 */
25
26#include <asm/iseries/hv_call_sc.h>
27#include <asm/iseries/hv_types.h>
28
29enum {
30 HvCallCfg_Cur = 0,
31 HvCallCfg_Init = 1,
32 HvCallCfg_Max = 2,
33 HvCallCfg_Min = 3
34};
35
36#define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6
37#define HvCallCfgGetPhysicalProcessors HvCallCfg + 7
38#define HvCallCfgGetMsChunks HvCallCfg + 9
39#define HvCallCfgGetSharedPoolIndex HvCallCfg + 20
40#define HvCallCfgGetSharedProcUnits HvCallCfg + 21
41#define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22
42#define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30
43#define HvCallCfgGetHostingLpIndex HvCallCfg + 32
44
45extern HvLpIndex HvLpConfig_getLpIndex_outline(void);
46extern HvLpIndex HvLpConfig_getLpIndex(void);
47extern HvLpIndex HvLpConfig_getPrimaryLpIndex(void);
48
49static inline u64 HvLpConfig_getMsChunks(void)
50{
51 return HvCall2(HvCallCfgGetMsChunks, HvLpConfig_getLpIndex(),
52 HvCallCfg_Cur);
53}
54
55static inline u64 HvLpConfig_getSystemPhysicalProcessors(void)
56{
57 return HvCall0(HvCallCfgGetSystemPhysicalProcessors);
58}
59
60static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI)
61{
62 return (u16)HvCall1(HvCallCfgGetNumProcsInSharedPool, sPI);
63}
64
65static inline u64 HvLpConfig_getPhysicalProcessors(void)
66{
67 return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(),
68 HvCallCfg_Cur);
69}
70
71static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void)
72{
73 return HvCall1(HvCallCfgGetSharedPoolIndex, HvLpConfig_getLpIndex());
74}
75
76static inline u64 HvLpConfig_getSharedProcUnits(void)
77{
78 return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(),
79 HvCallCfg_Cur);
80}
81
82static inline u64 HvLpConfig_getMaxSharedProcUnits(void)
83{
84 return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(),
85 HvCallCfg_Max);
86}
87
88static inline u64 HvLpConfig_getMaxPhysicalProcessors(void)
89{
90 return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(),
91 HvCallCfg_Max);
92}
93
94static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp(
95 HvLpIndex lp)
96{
97 /*
98 * This is a new function in V5R1 so calls to this on older
99 * hypervisors will return -1
100 */
101 u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp);
102 if (retVal == -1)
103 retVal = 0;
104 return retVal;
105}
106
107static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void)
108{
109 return HvLpConfig_getVirtualLanIndexMapForLp(
110 HvLpConfig_getLpIndex_outline());
111}
112
113static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1,
114 HvLpIndex lp2)
115{
116 HvLpVirtualLanIndexMap virtualLanIndexMap1 =
117 HvLpConfig_getVirtualLanIndexMapForLp(lp1);
118 HvLpVirtualLanIndexMap virtualLanIndexMap2 =
119 HvLpConfig_getVirtualLanIndexMapForLp(lp2);
120 return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0);
121}
122
123static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp)
124{
125 return HvCall1(HvCallCfgGetHostingLpIndex, lp);
126}
127
128#endif /* _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_lp_event.h b/arch/powerpc/include/asm/iseries/hv_lp_event.h
deleted file mode 100644
index 8f5da7d7720..00000000000
--- a/arch/powerpc/include/asm/iseries/hv_lp_event.h
+++ /dev/null
@@ -1,162 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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/* This file contains the class for HV events in the system. */
20
21#ifndef _ASM_POWERPC_ISERIES_HV_LP_EVENT_H
22#define _ASM_POWERPC_ISERIES_HV_LP_EVENT_H
23
24#include <asm/types.h>
25#include <asm/ptrace.h>
26#include <asm/iseries/hv_types.h>
27#include <asm/iseries/hv_call_event.h>
28
29/*
30 * HvLpEvent is the structure for Lp Event messages passed between
31 * partitions through PLIC.
32 */
33
34struct HvLpEvent {
35 u8 flags; /* Event flags x00-x00 */
36 u8 xType; /* Type of message x01-x01 */
37 u16 xSubtype; /* Subtype for event x02-x03 */
38 u8 xSourceLp; /* Source LP x04-x04 */
39 u8 xTargetLp; /* Target LP x05-x05 */
40 u8 xSizeMinus1; /* Size of Derived class - 1 x06-x06 */
41 u8 xRc; /* RC for Ack flows x07-x07 */
42 u16 xSourceInstanceId; /* Source sides instance id x08-x09 */
43 u16 xTargetInstanceId; /* Target sides instance id x0A-x0B */
44 union {
45 u32 xSubtypeData; /* Data usable by the subtype x0C-x0F */
46 u16 xSubtypeDataShort[2]; /* Data as 2 shorts */
47 u8 xSubtypeDataChar[4]; /* Data as 4 chars */
48 } x;
49
50 u64 xCorrelationToken; /* Unique value for source/type x10-x17 */
51};
52
53typedef void (*LpEventHandler)(struct HvLpEvent *);
54
55/* Register a handler for an event type - returns 0 on success */
56extern int HvLpEvent_registerHandler(HvLpEvent_Type eventType,
57 LpEventHandler hdlr);
58
59/*
60 * Unregister a handler for an event type
61 *
62 * This call will sleep until the handler being removed is guaranteed to
63 * be no longer executing on any CPU. Do not call with locks held.
64 *
65 * returns 0 on success
66 * Unregister will fail if there are any paths open for the type
67 */
68extern int HvLpEvent_unregisterHandler(HvLpEvent_Type eventType);
69
70/*
71 * Open an Lp Event Path for an event type
72 * returns 0 on success
73 * openPath will fail if there is no handler registered for the event type.
74 * The lpIndex specified is the partition index for the target partition
75 * (for VirtualIo, VirtualLan and SessionMgr) other types specify zero)
76 */
77extern int HvLpEvent_openPath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
78
79/*
80 * Close an Lp Event Path for a type and partition
81 * returns 0 on success
82 */
83extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
84
85#define HvLpEvent_Type_Hypervisor 0
86#define HvLpEvent_Type_MachineFac 1
87#define HvLpEvent_Type_SessionMgr 2
88#define HvLpEvent_Type_SpdIo 3
89#define HvLpEvent_Type_VirtualBus 4
90#define HvLpEvent_Type_PciIo 5
91#define HvLpEvent_Type_RioIo 6
92#define HvLpEvent_Type_VirtualLan 7
93#define HvLpEvent_Type_VirtualIo 8
94#define HvLpEvent_Type_NumTypes 9
95
96#define HvLpEvent_Rc_Good 0
97#define HvLpEvent_Rc_BufferNotAvailable 1
98#define HvLpEvent_Rc_Cancelled 2
99#define HvLpEvent_Rc_GenericError 3
100#define HvLpEvent_Rc_InvalidAddress 4
101#define HvLpEvent_Rc_InvalidPartition 5
102#define HvLpEvent_Rc_InvalidSize 6
103#define HvLpEvent_Rc_InvalidSubtype 7
104#define HvLpEvent_Rc_InvalidSubtypeData 8
105#define HvLpEvent_Rc_InvalidType 9
106#define HvLpEvent_Rc_PartitionDead 10
107#define HvLpEvent_Rc_PathClosed 11
108#define HvLpEvent_Rc_SubtypeError 12
109
110#define HvLpEvent_Function_Ack 0
111#define HvLpEvent_Function_Int 1
112
113#define HvLpEvent_AckInd_NoAck 0
114#define HvLpEvent_AckInd_DoAck 1
115
116#define HvLpEvent_AckType_ImmediateAck 0
117#define HvLpEvent_AckType_DeferredAck 1
118
119#define HV_LP_EVENT_INT 0x01
120#define HV_LP_EVENT_DO_ACK 0x02
121#define HV_LP_EVENT_DEFERRED_ACK 0x04
122#define HV_LP_EVENT_VALID 0x80
123
124#define HvLpDma_Direction_LocalToRemote 0
125#define HvLpDma_Direction_RemoteToLocal 1
126
127#define HvLpDma_AddressType_TceIndex 0
128#define HvLpDma_AddressType_RealAddress 1
129
130#define HvLpDma_Rc_Good 0
131#define HvLpDma_Rc_Error 1
132#define HvLpDma_Rc_PartitionDead 2
133#define HvLpDma_Rc_PathClosed 3
134#define HvLpDma_Rc_InvalidAddress 4
135#define HvLpDma_Rc_InvalidLength 5
136
137static inline int hvlpevent_is_valid(struct HvLpEvent *h)
138{
139 return h->flags & HV_LP_EVENT_VALID;
140}
141
142static inline void hvlpevent_invalidate(struct HvLpEvent *h)
143{
144 h->flags &= ~ HV_LP_EVENT_VALID;
145}
146
147static inline int hvlpevent_is_int(struct HvLpEvent *h)
148{
149 return h->flags & HV_LP_EVENT_INT;
150}
151
152static inline int hvlpevent_is_ack(struct HvLpEvent *h)
153{
154 return !hvlpevent_is_int(h);
155}
156
157static inline int hvlpevent_need_ack(struct HvLpEvent *h)
158{
159 return h->flags & HV_LP_EVENT_DO_ACK;
160}
161
162#endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_types.h b/arch/powerpc/include/asm/iseries/hv_types.h
deleted file mode 100644
index c3e6d2a1d1c..00000000000
--- a/arch/powerpc/include/asm/iseries/hv_types.h
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ASM_POWERPC_ISERIES_HV_TYPES_H
19#define _ASM_POWERPC_ISERIES_HV_TYPES_H
20
21/*
22 * General typedefs for the hypervisor.
23 */
24
25#include <asm/types.h>
26
27typedef u8 HvLpIndex;
28typedef u16 HvLpInstanceId;
29typedef u64 HvLpTOD;
30typedef u64 HvLpSystemSerialNum;
31typedef u8 HvLpDeviceSerialNum[12];
32typedef u16 HvLpSanHwSet;
33typedef u16 HvLpBus;
34typedef u16 HvLpBoard;
35typedef u16 HvLpCard;
36typedef u8 HvLpDeviceType[4];
37typedef u8 HvLpDeviceModel[3];
38typedef u64 HvIoToken;
39typedef u8 HvLpName[8];
40typedef u32 HvIoId;
41typedef u64 HvRealMemoryIndex;
42typedef u32 HvLpIndexMap; /* Must hold HVMAXARCHITECTEDLPS bits!!! */
43typedef u16 HvLpVrmIndex;
44typedef u32 HvXmGenerationId;
45typedef u8 HvLpBusPool;
46typedef u8 HvLpSharedPoolIndex;
47typedef u16 HvLpSharedProcUnitsX100;
48typedef u8 HvLpVirtualLanIndex;
49typedef u16 HvLpVirtualLanIndexMap; /* Must hold HVMAXARCHITECTEDVIRTUALLANS bits!!! */
50typedef u16 HvBusNumber; /* Hypervisor Bus Number */
51typedef u8 HvSubBusNumber; /* Hypervisor SubBus Number */
52typedef u8 HvAgentId; /* Hypervisor DevFn */
53
54
55#define HVMAXARCHITECTEDLPS 32
56#define HVMAXARCHITECTEDVIRTUALLANS 16
57#define HVMAXARCHITECTEDVIRTUALDISKS 32
58#define HVMAXARCHITECTEDVIRTUALCDROMS 8
59#define HVMAXARCHITECTEDVIRTUALTAPES 8
60#define HVCHUNKSIZE (256 * 1024)
61#define HVPAGESIZE (4 * 1024)
62#define HVLPMINMEGSPRIMARY 256
63#define HVLPMINMEGSSECONDARY 64
64#define HVCHUNKSPERMEG 4
65#define HVPAGESPERMEG 256
66#define HVPAGESPERCHUNK 64
67
68#define HvLpIndexInvalid ((HvLpIndex)0xff)
69
70/*
71 * Enums for the sub-components under PLIC
72 * Used in HvCall and HvPrimaryCall
73 */
74enum {
75 HvCallCompId = 0,
76 HvCallCpuCtlsCompId = 1,
77 HvCallCfgCompId = 2,
78 HvCallEventCompId = 3,
79 HvCallHptCompId = 4,
80 HvCallPciCompId = 5,
81 HvCallSlmCompId = 6,
82 HvCallSmCompId = 7,
83 HvCallSpdCompId = 8,
84 HvCallXmCompId = 9,
85 HvCallRioCompId = 10,
86 HvCallRsvd3CompId = 11,
87 HvCallRsvd2CompId = 12,
88 HvCallRsvd1CompId = 13,
89 HvCallMaxCompId = 14,
90 HvPrimaryCallCompId = 0,
91 HvPrimaryCallCfgCompId = 1,
92 HvPrimaryCallPciCompId = 2,
93 HvPrimaryCallSmCompId = 3,
94 HvPrimaryCallSpdCompId = 4,
95 HvPrimaryCallXmCompId = 5,
96 HvPrimaryCallRioCompId = 6,
97 HvPrimaryCallRsvd7CompId = 7,
98 HvPrimaryCallRsvd6CompId = 8,
99 HvPrimaryCallRsvd5CompId = 9,
100 HvPrimaryCallRsvd4CompId = 10,
101 HvPrimaryCallRsvd3CompId = 11,
102 HvPrimaryCallRsvd2CompId = 12,
103 HvPrimaryCallRsvd1CompId = 13,
104 HvPrimaryCallMaxCompId = HvCallMaxCompId
105};
106
107struct HvLpBufferList {
108 u64 addr;
109 u64 len;
110};
111
112#endif /* _ASM_POWERPC_ISERIES_HV_TYPES_H */
diff --git a/arch/powerpc/include/asm/iseries/iommu.h b/arch/powerpc/include/asm/iseries/iommu.h
deleted file mode 100644
index 1b9692c6089..00000000000
--- a/arch/powerpc/include/asm/iseries/iommu.h
+++ /dev/null
@@ -1,37 +0,0 @@
1#ifndef _ASM_POWERPC_ISERIES_IOMMU_H
2#define _ASM_POWERPC_ISERIES_IOMMU_H
3
4/*
5 * Copyright (C) 2005 Stephen Rothwell, IBM Corporation
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:
19 * Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330,
21 * Boston, MA 02111-1307 USA
22 */
23
24struct pci_dev;
25struct vio_dev;
26struct device_node;
27struct iommu_table;
28
29/* Get table parameters from HV */
30extern void iommu_table_getparms_iSeries(unsigned long busno,
31 unsigned char slotno, unsigned char virtbus,
32 struct iommu_table *tbl);
33
34extern struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev);
35extern void iommu_vio_init(void);
36
37#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */
diff --git a/arch/powerpc/include/asm/iseries/it_lp_queue.h b/arch/powerpc/include/asm/iseries/it_lp_queue.h
deleted file mode 100644
index 42827883882..00000000000
--- a/arch/powerpc/include/asm/iseries/it_lp_queue.h
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H
19#define _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H
20
21/*
22 * This control block defines the simple LP queue structure that is
23 * shared between the hypervisor (PLIC) and the OS in order to send
24 * events to an LP.
25 */
26
27#include <asm/types.h>
28#include <asm/ptrace.h>
29
30#define IT_LP_MAX_QUEUES 8
31
32#define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */
33#define IT_LP_DEDICATED_IO 1 /* Queue dedicated to IO processor specified */
34#define IT_LP_DEDICATED_LP 2 /* Queue dedicated to LP specified */
35#define IT_LP_SHARED 3 /* Queue shared for both IO and LP */
36
37#define IT_LP_EVENT_STACK_SIZE 4096
38#define IT_LP_EVENT_MAX_SIZE 256
39#define IT_LP_EVENT_ALIGN 64
40
41struct hvlpevent_queue {
42/*
43 * The hq_current_event is the pointer to the next event stack entry
44 * that will become valid. The OS must peek at this entry to determine
45 * if it is valid. PLIC will set the valid indicator as the very last
46 * store into that entry.
47 *
48 * When the OS has completed processing of the event then it will mark
49 * the event as invalid so that PLIC knows it can store into that event
50 * location again.
51 *
52 * If the event stack fills and there are overflow events, then PLIC
53 * will set the hq_overflow_pending flag in which case the OS will
54 * have to fetch the additional LP events once they have drained the
55 * event stack.
56 *
57 * The first 16-bytes are known by both the OS and PLIC. The remainder
58 * of the cache line is for use by the OS.
59 */
60 u8 hq_overflow_pending; /* 0x00 Overflow events are pending */
61 u8 hq_status; /* 0x01 DedicatedIo or DedicatedLp or NotUsed */
62 u16 hq_proc_index; /* 0x02 Logical Proc Index for correlation */
63 u8 hq_reserved1[12]; /* 0x04 */
64 char *hq_current_event; /* 0x10 */
65 char *hq_last_event; /* 0x18 */
66 char *hq_event_stack; /* 0x20 */
67 u8 hq_index; /* 0x28 unique sequential index. */
68 u8 hq_reserved2[3]; /* 0x29-2b */
69 spinlock_t hq_lock;
70};
71
72extern struct hvlpevent_queue hvlpevent_queue;
73
74extern int hvlpevent_is_pending(void);
75extern void process_hvlpevents(void);
76extern void setup_hvlpevent_queue(void);
77
78#endif /* _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H */
diff --git a/arch/powerpc/include/asm/iseries/lpar_map.h b/arch/powerpc/include/asm/iseries/lpar_map.h
deleted file mode 100644
index 5e9f3e128ee..00000000000
--- a/arch/powerpc/include/asm/iseries/lpar_map.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ASM_POWERPC_ISERIES_LPAR_MAP_H
19#define _ASM_POWERPC_ISERIES_LPAR_MAP_H
20
21#ifndef __ASSEMBLY__
22
23#include <asm/types.h>
24
25#endif
26
27/*
28 * The iSeries hypervisor will set up mapping for one or more
29 * ESID/VSID pairs (in SLB/segment registers) and will set up
30 * mappings of one or more ranges of pages to VAs.
31 * We will have the hypervisor set up the ESID->VSID mapping
32 * for the four kernel segments (C-F). With shared processors,
33 * the hypervisor will clear all segment registers and reload
34 * these four whenever the processor is switched from one
35 * partition to another.
36 */
37
38/* The Vsid and Esid identified below will be used by the hypervisor
39 * to set up a memory mapping for part of the load area before giving
40 * control to the Linux kernel. The load area is 64 MB, but this must
41 * not attempt to map the whole load area. The Hashed Page Table may
42 * need to be located within the load area (if the total partition size
43 * is 64 MB), but cannot be mapped. Typically, this should specify
44 * to map half (32 MB) of the load area.
45 *
46 * The hypervisor will set up page table entries for the number of
47 * pages specified.
48 *
49 * In 32-bit mode, the hypervisor will load all four of the
50 * segment registers (identified by the low-order four bits of the
51 * Esid field. In 64-bit mode, the hypervisor will load one SLB
52 * entry to map the Esid to the Vsid.
53*/
54
55#define HvEsidsToMap 2
56#define HvRangesToMap 1
57
58/* Hypervisor initially maps 32MB of the load area */
59#define HvPagesToMap 8192
60
61#ifndef __ASSEMBLY__
62struct LparMap {
63 u64 xNumberEsids; // Number of ESID/VSID pairs
64 u64 xNumberRanges; // Number of VA ranges to map
65 u64 xSegmentTableOffs; // Page number within load area of seg table
66 u64 xRsvd[5];
67 struct {
68 u64 xKernelEsid; // Esid used to map kernel load
69 u64 xKernelVsid; // Vsid used to map kernel load
70 } xEsids[HvEsidsToMap];
71 struct {
72 u64 xPages; // Number of pages to be mapped
73 u64 xOffset; // Offset from start of load area
74 u64 xVPN; // Virtual Page Number
75 } xRanges[HvRangesToMap];
76};
77
78extern const struct LparMap xLparMap;
79
80#endif /* __ASSEMBLY__ */
81
82/* the fixed address where the LparMap exists */
83#define LPARMAP_PHYS 0x7000
84
85#endif /* _ASM_POWERPC_ISERIES_LPAR_MAP_H */
diff --git a/arch/powerpc/include/asm/iseries/mf.h b/arch/powerpc/include/asm/iseries/mf.h
deleted file mode 100644
index eb851a9c9e5..00000000000
--- a/arch/powerpc/include/asm/iseries/mf.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * Copyright (C) 2001 Troy D. Armstrong IBM Corporation
3 * Copyright (C) 2004 Stephen Rothwell IBM Corporation
4 *
5 * This modules exists as an interface between a Linux secondary partition
6 * running on an iSeries and the primary partition's Virtual Service
7 * Processor (VSP) object. The VSP has final authority over powering on/off
8 * all partitions in the iSeries. It also provides miscellaneous low-level
9 * machine facility type operations.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#ifndef _ASM_POWERPC_ISERIES_MF_H
26#define _ASM_POWERPC_ISERIES_MF_H
27
28#include <linux/types.h>
29
30#include <asm/iseries/hv_types.h>
31#include <asm/iseries/hv_call_event.h>
32
33struct rtc_time;
34
35typedef void (*MFCompleteHandler)(void *clientToken, int returnCode);
36
37extern void mf_allocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type,
38 unsigned size, unsigned amount, MFCompleteHandler hdlr,
39 void *userToken);
40extern void mf_deallocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type,
41 unsigned count, MFCompleteHandler hdlr, void *userToken);
42
43extern void mf_power_off(void);
44extern void mf_reboot(char *cmd);
45
46extern void mf_display_src(u32 word);
47extern void mf_display_progress(u16 value);
48
49extern void mf_init(void);
50
51#endif /* _ASM_POWERPC_ISERIES_MF_H */
diff --git a/arch/powerpc/include/asm/iseries/vio.h b/arch/powerpc/include/asm/iseries/vio.h
deleted file mode 100644
index f9ac0d00b95..00000000000
--- a/arch/powerpc/include/asm/iseries/vio.h
+++ /dev/null
@@ -1,265 +0,0 @@
1/* -*- linux-c -*-
2 *
3 * iSeries Virtual I/O Message Path header
4 *
5 * Authors: Dave Boutcher <boutcher@us.ibm.com>
6 * Ryan Arnold <ryanarn@us.ibm.com>
7 * Colin Devilbiss <devilbis@us.ibm.com>
8 *
9 * (C) Copyright 2000 IBM Corporation
10 *
11 * This header file is used by the iSeries virtual I/O device
12 * drivers. It defines the interfaces to the common functions
13 * (implemented in drivers/char/viopath.h) as well as defining
14 * common functions and structures. Currently (at the time I
15 * wrote this comment) the iSeries virtual I/O device drivers
16 * that use this are
17 * drivers/block/viodasd.c
18 * drivers/char/viocons.c
19 * drivers/char/viotape.c
20 * drivers/cdrom/viocd.c
21 *
22 * The iSeries virtual ethernet support (veth.c) uses a whole
23 * different set of functions.
24 *
25 * This program is free software; you can redistribute it and/or
26 * modify it under the terms of the GNU General Public License as
27 * published by the Free Software Foundation; either version 2 of the
28 * License, or (at your option) anyu later version.
29 *
30 * This program is distributed in the hope that it will be useful, but
31 * WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33 * General Public License for more details.
34 *
35 * You should have received a copy of the GNU General Public License
36 * along with this program; if not, write to the Free Software Foundation,
37 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 *
39 */
40#ifndef _ASM_POWERPC_ISERIES_VIO_H
41#define _ASM_POWERPC_ISERIES_VIO_H
42
43#include <asm/iseries/hv_types.h>
44#include <asm/iseries/hv_lp_event.h>
45
46/*
47 * iSeries virtual I/O events use the subtype field in
48 * HvLpEvent to figure out what kind of vio event is coming
49 * in. We use a table to route these, and this defines
50 * the maximum number of distinct subtypes
51 */
52#define VIO_MAX_SUBTYPES 8
53
54#define VIOMAXBLOCKDMA 12
55
56struct open_data {
57 u64 disk_size;
58 u16 max_disk;
59 u16 cylinders;
60 u16 tracks;
61 u16 sectors;
62 u16 bytes_per_sector;
63};
64
65struct rw_data {
66 u64 offset;
67 struct {
68 u32 token;
69 u32 reserved;
70 u64 len;
71 } dma_info[VIOMAXBLOCKDMA];
72};
73
74struct vioblocklpevent {
75 struct HvLpEvent event;
76 u32 reserved;
77 u16 version;
78 u16 sub_result;
79 u16 disk;
80 u16 flags;
81 union {
82 struct open_data open_data;
83 struct rw_data rw_data;
84 u64 changed;
85 } u;
86};
87
88#define vioblockflags_ro 0x0001
89
90enum vioblocksubtype {
91 vioblockopen = 0x0001,
92 vioblockclose = 0x0002,
93 vioblockread = 0x0003,
94 vioblockwrite = 0x0004,
95 vioblockflush = 0x0005,
96 vioblockcheck = 0x0007
97};
98
99struct viocdlpevent {
100 struct HvLpEvent event;
101 u32 reserved;
102 u16 version;
103 u16 sub_result;
104 u16 disk;
105 u16 flags;
106 u32 token;
107 u64 offset; /* On open, max number of disks */
108 u64 len; /* On open, size of the disk */
109 u32 block_size; /* Only set on open */
110 u32 media_size; /* Only set on open */
111};
112
113enum viocdsubtype {
114 viocdopen = 0x0001,
115 viocdclose = 0x0002,
116 viocdread = 0x0003,
117 viocdwrite = 0x0004,
118 viocdlockdoor = 0x0005,
119 viocdgetinfo = 0x0006,
120 viocdcheck = 0x0007
121};
122
123struct viotapelpevent {
124 struct HvLpEvent event;
125 u32 reserved;
126 u16 version;
127 u16 sub_type_result;
128 u16 tape;
129 u16 flags;
130 u32 token;
131 u64 len;
132 union {
133 struct {
134 u32 tape_op;
135 u32 count;
136 } op;
137 struct {
138 u32 type;
139 u32 resid;
140 u32 dsreg;
141 u32 gstat;
142 u32 erreg;
143 u32 file_no;
144 u32 block_no;
145 } get_status;
146 struct {
147 u32 block_no;
148 } get_pos;
149 } u;
150};
151
152enum viotapesubtype {
153 viotapeopen = 0x0001,
154 viotapeclose = 0x0002,
155 viotaperead = 0x0003,
156 viotapewrite = 0x0004,
157 viotapegetinfo = 0x0005,
158 viotapeop = 0x0006,
159 viotapegetpos = 0x0007,
160 viotapesetpos = 0x0008,
161 viotapegetstatus = 0x0009
162};
163
164/*
165 * Each subtype can register a handler to process their events.
166 * The handler must have this interface.
167 */
168typedef void (vio_event_handler_t) (struct HvLpEvent * event);
169
170extern int viopath_open(HvLpIndex remoteLp, int subtype, int numReq);
171extern int viopath_close(HvLpIndex remoteLp, int subtype, int numReq);
172extern int vio_setHandler(int subtype, vio_event_handler_t * beh);
173extern int vio_clearHandler(int subtype);
174extern int viopath_isactive(HvLpIndex lp);
175extern HvLpInstanceId viopath_sourceinst(HvLpIndex lp);
176extern HvLpInstanceId viopath_targetinst(HvLpIndex lp);
177extern void vio_set_hostlp(void);
178extern void *vio_get_event_buffer(int subtype);
179extern void vio_free_event_buffer(int subtype, void *buffer);
180
181extern struct vio_dev *vio_create_viodasd(u32 unit);
182
183extern HvLpIndex viopath_hostLp;
184extern HvLpIndex viopath_ourLp;
185
186#define VIOCHAR_MAX_DATA 200
187
188#define VIOMAJOR_SUBTYPE_MASK 0xff00
189#define VIOMINOR_SUBTYPE_MASK 0x00ff
190#define VIOMAJOR_SUBTYPE_SHIFT 8
191
192#define VIOVERSION 0x0101
193
194/*
195 * This is the general structure for VIO errors; each module should have
196 * a table of them, and each table should be terminated by an entry of
197 * { 0, 0, NULL }. Then, to find a specific error message, a module
198 * should pass its local table and the return code.
199 */
200struct vio_error_entry {
201 u16 rc;
202 int errno;
203 const char *msg;
204};
205extern const struct vio_error_entry *vio_lookup_rc(
206 const struct vio_error_entry *local_table, u16 rc);
207
208enum viosubtypes {
209 viomajorsubtype_monitor = 0x0100,
210 viomajorsubtype_blockio = 0x0200,
211 viomajorsubtype_chario = 0x0300,
212 viomajorsubtype_config = 0x0400,
213 viomajorsubtype_cdio = 0x0500,
214 viomajorsubtype_tape = 0x0600,
215 viomajorsubtype_scsi = 0x0700
216};
217
218enum vioconfigsubtype {
219 vioconfigget = 0x0001,
220};
221
222enum viorc {
223 viorc_good = 0x0000,
224 viorc_noConnection = 0x0001,
225 viorc_noReceiver = 0x0002,
226 viorc_noBufferAvailable = 0x0003,
227 viorc_invalidMessageType = 0x0004,
228 viorc_invalidRange = 0x0201,
229 viorc_invalidToken = 0x0202,
230 viorc_DMAError = 0x0203,
231 viorc_useError = 0x0204,
232 viorc_releaseError = 0x0205,
233 viorc_invalidDisk = 0x0206,
234 viorc_openRejected = 0x0301
235};
236
237/*
238 * The structure of the events that flow between us and OS/400 for chario
239 * events. You can't mess with this unless the OS/400 side changes too.
240 */
241struct viocharlpevent {
242 struct HvLpEvent event;
243 u32 reserved;
244 u16 version;
245 u16 subtype_result_code;
246 u8 virtual_device;
247 u8 len;
248 u8 data[VIOCHAR_MAX_DATA];
249};
250
251#define VIOCHAR_WINDOW 10
252
253enum viocharsubtype {
254 viocharopen = 0x0001,
255 viocharclose = 0x0002,
256 viochardata = 0x0003,
257 viocharack = 0x0004,
258 viocharconfig = 0x0005
259};
260
261enum viochar_rc {
262 viochar_rc_ebusy = 1
263};
264
265#endif /* _ASM_POWERPC_ISERIES_VIO_H */
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h
index e0298d26ce5..a76254af0aa 100644
--- a/arch/powerpc/include/asm/lppaca.h
+++ b/arch/powerpc/include/asm/lppaca.h
@@ -41,15 +41,7 @@
41 * We only have to have statically allocated lppaca structs on 41 * We only have to have statically allocated lppaca structs on
42 * legacy iSeries, which supports at most 64 cpus. 42 * legacy iSeries, which supports at most 64 cpus.
43 */ 43 */
44#ifdef CONFIG_PPC_ISERIES
45#if NR_CPUS < 64
46#define NR_LPPACAS NR_CPUS
47#else
48#define NR_LPPACAS 64
49#endif
50#else /* not iSeries */
51#define NR_LPPACAS 1 44#define NR_LPPACAS 1
52#endif
53 45
54 46
55/* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k 47/* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
index a5b7c56237f..c65b9294376 100644
--- a/arch/powerpc/include/asm/mpic.h
+++ b/arch/powerpc/include/asm/mpic.h
@@ -273,7 +273,6 @@ struct mpic
273 unsigned int isu_size; 273 unsigned int isu_size;
274 unsigned int isu_shift; 274 unsigned int isu_shift;
275 unsigned int isu_mask; 275 unsigned int isu_mask;
276 unsigned int irq_count;
277 /* Number of sources */ 276 /* Number of sources */
278 unsigned int num_sources; 277 unsigned int num_sources;
279 /* default senses array */ 278 /* default senses array */
@@ -349,8 +348,6 @@ struct mpic
349#define MPIC_U3_HT_IRQS 0x00000004 348#define MPIC_U3_HT_IRQS 0x00000004
350/* Broken IPI registers (autodetected) */ 349/* Broken IPI registers (autodetected) */
351#define MPIC_BROKEN_IPI 0x00000008 350#define MPIC_BROKEN_IPI 0x00000008
352/* MPIC wants a reset */
353#define MPIC_WANTS_RESET 0x00000010
354/* Spurious vector requires EOI */ 351/* Spurious vector requires EOI */
355#define MPIC_SPV_EOI 0x00000020 352#define MPIC_SPV_EOI 0x00000020
356/* No passthrough disable */ 353/* No passthrough disable */
@@ -363,15 +360,11 @@ struct mpic
363#define MPIC_ENABLE_MCK 0x00000200 360#define MPIC_ENABLE_MCK 0x00000200
364/* Disable bias among target selection, spread interrupts evenly */ 361/* Disable bias among target selection, spread interrupts evenly */
365#define MPIC_NO_BIAS 0x00000400 362#define MPIC_NO_BIAS 0x00000400
366/* Ignore NIRQS as reported by FRR */
367#define MPIC_BROKEN_FRR_NIRQS 0x00000800
368/* Destination only supports a single CPU at a time */ 363/* Destination only supports a single CPU at a time */
369#define MPIC_SINGLE_DEST_CPU 0x00001000 364#define MPIC_SINGLE_DEST_CPU 0x00001000
370/* Enable CoreInt delivery of interrupts */ 365/* Enable CoreInt delivery of interrupts */
371#define MPIC_ENABLE_COREINT 0x00002000 366#define MPIC_ENABLE_COREINT 0x00002000
372/* Disable resetting of the MPIC. 367/* Do not reset the MPIC during initialization */
373 * NOTE: This flag trumps MPIC_WANTS_RESET.
374 */
375#define MPIC_NO_RESET 0x00004000 368#define MPIC_NO_RESET 0x00004000
376/* Freescale MPIC (compatible includes "fsl,mpic") */ 369/* Freescale MPIC (compatible includes "fsl,mpic") */
377#define MPIC_FSL 0x00008000 370#define MPIC_FSL 0x00008000
diff --git a/arch/powerpc/include/asm/mpic_msgr.h b/arch/powerpc/include/asm/mpic_msgr.h
new file mode 100644
index 00000000000..3ec37dc9003
--- /dev/null
+++ b/arch/powerpc/include/asm/mpic_msgr.h
@@ -0,0 +1,132 @@
1/*
2 * Copyright 2011-2012, Meador Inge, Mentor Graphics Corporation.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; version 2 of the
7 * License.
8 *
9 */
10
11#ifndef _ASM_MPIC_MSGR_H
12#define _ASM_MPIC_MSGR_H
13
14#include <linux/types.h>
15#include <linux/spinlock.h>
16
17struct mpic_msgr {
18 u32 __iomem *base;
19 u32 __iomem *mer;
20 int irq;
21 unsigned char in_use;
22 raw_spinlock_t lock;
23 int num;
24};
25
26/* Get a message register
27 *
28 * @reg_num: the MPIC message register to get
29 *
30 * A pointer to the message register is returned. If
31 * the message register asked for is already in use, then
32 * EBUSY is returned. If the number given is not associated
33 * with an actual message register, then ENODEV is returned.
34 * Successfully getting the register marks it as in use.
35 */
36extern struct mpic_msgr *mpic_msgr_get(unsigned int reg_num);
37
38/* Relinquish a message register
39 *
40 * @msgr: the message register to return
41 *
42 * Disables the given message register and marks it as free.
43 * After this call has completed successully the message
44 * register is available to be acquired by a call to
45 * mpic_msgr_get.
46 */
47extern void mpic_msgr_put(struct mpic_msgr *msgr);
48
49/* Enable a message register
50 *
51 * @msgr: the message register to enable
52 *
53 * The given message register is enabled for sending
54 * messages.
55 */
56extern void mpic_msgr_enable(struct mpic_msgr *msgr);
57
58/* Disable a message register
59 *
60 * @msgr: the message register to disable
61 *
62 * The given message register is disabled for sending
63 * messages.
64 */
65extern void mpic_msgr_disable(struct mpic_msgr *msgr);
66
67/* Write a message to a message register
68 *
69 * @msgr: the message register to write to
70 * @message: the message to write
71 *
72 * The given 32-bit message is written to the given message
73 * register. Writing to an enabled message registers fires
74 * an interrupt.
75 */
76static inline void mpic_msgr_write(struct mpic_msgr *msgr, u32 message)
77{
78 out_be32(msgr->base, message);
79}
80
81/* Read a message from a message register
82 *
83 * @msgr: the message register to read from
84 *
85 * Returns the 32-bit value currently in the given message register.
86 * Upon reading the register any interrupts for that register are
87 * cleared.
88 */
89static inline u32 mpic_msgr_read(struct mpic_msgr *msgr)
90{
91 return in_be32(msgr->base);
92}
93
94/* Clear a message register
95 *
96 * @msgr: the message register to clear
97 *
98 * Clears any interrupts associated with the given message register.
99 */
100static inline void mpic_msgr_clear(struct mpic_msgr *msgr)
101{
102 (void) mpic_msgr_read(msgr);
103}
104
105/* Set the destination CPU for the message register
106 *
107 * @msgr: the message register whose destination is to be set
108 * @cpu_num: the Linux CPU number to bind the message register to
109 *
110 * Note that the CPU number given is the CPU number used by the kernel
111 * and *not* the actual hardware CPU number.
112 */
113static inline void mpic_msgr_set_destination(struct mpic_msgr *msgr,
114 u32 cpu_num)
115{
116 out_be32(msgr->base, 1 << get_hard_smp_processor_id(cpu_num));
117}
118
119/* Get the IRQ number for the message register
120 * @msgr: the message register whose IRQ is to be returned
121 *
122 * Returns the IRQ number associated with the given message register.
123 * NO_IRQ is returned if this message register is not capable of
124 * receiving interrupts. What message register can and cannot receive
125 * interrupts is specified in the device tree for the system.
126 */
127static inline int mpic_msgr_get_irq(struct mpic_msgr *msgr)
128{
129 return msgr->irq;
130}
131
132#endif
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 269c05a36d9..daf813fea91 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -132,7 +132,7 @@ struct paca_struct {
132 u64 saved_msr; /* MSR saved here by enter_rtas */ 132 u64 saved_msr; /* MSR saved here by enter_rtas */
133 u16 trap_save; /* Used when bad stack is encountered */ 133 u16 trap_save; /* Used when bad stack is encountered */
134 u8 soft_enabled; /* irq soft-enable flag */ 134 u8 soft_enabled; /* irq soft-enable flag */
135 u8 hard_enabled; /* set if irqs are enabled in MSR */ 135 u8 irq_happened; /* irq happened while soft-disabled */
136 u8 io_sync; /* writel() needs spin_unlock sync */ 136 u8 io_sync; /* writel() needs spin_unlock sync */
137 u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ 137 u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */
138 u8 nap_state_lost; /* NV GPR values lost in power7_idle */ 138 u8 nap_state_lost; /* NV GPR values lost in power7_idle */
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index f54b3d26ce9..6653f2743c4 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -154,14 +154,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
154 154
155#endif /* CONFIG_PPC64 */ 155#endif /* CONFIG_PPC64 */
156 156
157extern void pcibios_resource_to_bus(struct pci_dev *dev,
158 struct pci_bus_region *region,
159 struct resource *res);
160
161extern void pcibios_bus_to_resource(struct pci_dev *dev,
162 struct resource *res,
163 struct pci_bus_region *region);
164
165extern void pcibios_claim_one_bus(struct pci_bus *b); 157extern void pcibios_claim_one_bus(struct pci_bus *b);
166 158
167extern void pcibios_finish_adding_to_bus(struct pci_bus *bus); 159extern void pcibios_finish_adding_to_bus(struct pci_bus *bus);
@@ -190,6 +182,7 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
190 const struct resource *rsrc, 182 const struct resource *rsrc,
191 resource_size_t *start, resource_size_t *end); 183 resource_size_t *start, resource_size_t *end);
192 184
185extern resource_size_t pcibios_io_space_offset(struct pci_controller *hose);
193extern void pcibios_setup_bus_devices(struct pci_bus *bus); 186extern void pcibios_setup_bus_devices(struct pci_bus *bus);
194extern void pcibios_setup_bus_self(struct pci_bus *bus); 187extern void pcibios_setup_bus_self(struct pci_bus *bus);
195extern void pcibios_setup_phb_io_space(struct pci_controller *hose); 188extern void pcibios_setup_phb_io_space(struct pci_controller *hose);
diff --git a/arch/powerpc/include/asm/phyp_dump.h b/arch/powerpc/include/asm/phyp_dump.h
deleted file mode 100644
index fa74c6c3e10..00000000000
--- a/arch/powerpc/include/asm/phyp_dump.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * Hypervisor-assisted dump
3 *
4 * Linas Vepstas, Manish Ahuja 2008
5 * Copyright 2008 IBM Corp.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifndef _PPC64_PHYP_DUMP_H
14#define _PPC64_PHYP_DUMP_H
15
16#ifdef CONFIG_PHYP_DUMP
17
18/* The RMR region will be saved for later dumping
19 * whenever the kernel crashes. Set this to 256MB. */
20#define PHYP_DUMP_RMR_START 0x0
21#define PHYP_DUMP_RMR_END (1UL<<28)
22
23struct phyp_dump {
24 /* Memory that is reserved during very early boot. */
25 unsigned long init_reserve_start;
26 unsigned long init_reserve_size;
27 /* cmd line options during boot */
28 unsigned long reserve_bootvar;
29 unsigned long phyp_dump_at_boot;
30 /* Check status during boot if dump supported, active & present*/
31 unsigned long phyp_dump_configured;
32 unsigned long phyp_dump_is_active;
33 /* store cpu & hpte size */
34 unsigned long cpu_state_size;
35 unsigned long hpte_region_size;
36 /* previous scratch area values */
37 unsigned long reserved_scratch_addr;
38 unsigned long reserved_scratch_size;
39};
40
41extern struct phyp_dump *phyp_dump_info;
42
43int early_init_dt_scan_phyp_dump(unsigned long node,
44 const char *uname, int depth, void *data);
45
46#endif /* CONFIG_PHYP_DUMP */
47#endif /* _PPC64_PHYP_DUMP_H */
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index 6d422979eba..80fa704d410 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -45,94 +45,21 @@ extern void init_pci_config_tokens (void);
45extern unsigned long get_phb_buid (struct device_node *); 45extern unsigned long get_phb_buid (struct device_node *);
46extern int rtas_setup_phb(struct pci_controller *phb); 46extern int rtas_setup_phb(struct pci_controller *phb);
47 47
48extern unsigned long pci_probe_only;
49
50/* ---- EEH internal-use-only related routines ---- */
51#ifdef CONFIG_EEH 48#ifdef CONFIG_EEH
52 49
50void pci_addr_cache_build(void);
53void pci_addr_cache_insert_device(struct pci_dev *dev); 51void pci_addr_cache_insert_device(struct pci_dev *dev);
54void pci_addr_cache_remove_device(struct pci_dev *dev); 52void pci_addr_cache_remove_device(struct pci_dev *dev);
55void pci_addr_cache_build(void); 53struct pci_dev *pci_addr_cache_get_device(unsigned long addr);
56struct pci_dev *pci_get_device_by_addr(unsigned long addr); 54void eeh_slot_error_detail(struct eeh_dev *edev, int severity);
57 55int eeh_pci_enable(struct eeh_dev *edev, int function);
58/** 56int eeh_reset_pe(struct eeh_dev *);
59 * eeh_slot_error_detail -- record and EEH error condition to the log 57void eeh_restore_bars(struct eeh_dev *);
60 * @pdn: pci device node
61 * @severity: EEH_LOG_TEMP_FAILURE or EEH_LOG_PERM_FAILURE
62 *
63 * Obtains the EEH error details from the RTAS subsystem,
64 * and then logs these details with the RTAS error log system.
65 */
66#define EEH_LOG_TEMP_FAILURE 1
67#define EEH_LOG_PERM_FAILURE 2
68void eeh_slot_error_detail (struct pci_dn *pdn, int severity);
69
70/**
71 * rtas_pci_enable - enable IO transfers for this slot
72 * @pdn: pci device node
73 * @function: either EEH_THAW_MMIO or EEH_THAW_DMA
74 *
75 * Enable I/O transfers to this slot
76 */
77#define EEH_THAW_MMIO 2
78#define EEH_THAW_DMA 3
79int rtas_pci_enable(struct pci_dn *pdn, int function);
80
81/**
82 * rtas_set_slot_reset -- unfreeze a frozen slot
83 * @pdn: pci device node
84 *
85 * Clear the EEH-frozen condition on a slot. This routine
86 * does this by asserting the PCI #RST line for 1/8th of
87 * a second; this routine will sleep while the adapter is
88 * being reset.
89 *
90 * Returns a non-zero value if the reset failed.
91 */
92int rtas_set_slot_reset (struct pci_dn *);
93int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs);
94
95/**
96 * eeh_restore_bars - Restore device configuration info.
97 * @pdn: pci device node
98 *
99 * A reset of a PCI device will clear out its config space.
100 * This routines will restore the config space for this
101 * device, and is children, to values previously obtained
102 * from the firmware.
103 */
104void eeh_restore_bars(struct pci_dn *);
105
106/**
107 * rtas_configure_bridge -- firmware initialization of pci bridge
108 * @pdn: pci device node
109 *
110 * Ask the firmware to configure all PCI bridges devices
111 * located behind the indicated node. Required after a
112 * pci device reset. Does essentially the same hing as
113 * eeh_restore_bars, but for brdges, and lets firmware
114 * do the work.
115 */
116void rtas_configure_bridge(struct pci_dn *);
117
118int rtas_write_config(struct pci_dn *, int where, int size, u32 val); 58int rtas_write_config(struct pci_dn *, int where, int size, u32 val);
119int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); 59int rtas_read_config(struct pci_dn *, int where, int size, u32 *val);
120 60void eeh_mark_slot(struct device_node *dn, int mode_flag);
121/** 61void eeh_clear_slot(struct device_node *dn, int mode_flag);
122 * eeh_mark_slot -- set mode flags for pertition endpoint 62struct device_node *eeh_find_device_pe(struct device_node *dn);
123 * @pdn: pci device node
124 *
125 * mark and clear slots: find "partition endpoint" PE and set or
126 * clear the flags for each subnode of the PE.
127 */
128void eeh_mark_slot (struct device_node *dn, int mode_flag);
129void eeh_clear_slot (struct device_node *dn, int mode_flag);
130
131/**
132 * find_device_pe -- Find the associated "Partiationable Endpoint" PE
133 * @pdn: pci device node
134 */
135struct device_node * find_device_pe(struct device_node *dn);
136 63
137void eeh_sysfs_add_device(struct pci_dev *pdev); 64void eeh_sysfs_add_device(struct pci_dev *pdev);
138void eeh_sysfs_remove_device(struct pci_dev *pdev); 65void eeh_sysfs_remove_device(struct pci_dev *pdev);
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 368f72f7980..50f73aa2ba2 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -60,6 +60,8 @@ BEGIN_FW_FTR_SECTION; \
60 cmpd cr1,r11,r10; \ 60 cmpd cr1,r11,r10; \
61 beq+ cr1,33f; \ 61 beq+ cr1,33f; \
62 bl .accumulate_stolen_time; \ 62 bl .accumulate_stolen_time; \
63 ld r12,_MSR(r1); \
64 andi. r10,r12,MSR_PR; /* Restore cr0 (coming from user) */ \
6333: \ 6533: \
64END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) 66END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
65 67
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 7fdc2c0b7fa..b1a215eabef 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1079,30 +1079,12 @@
1079 1079
1080#define proc_trap() asm volatile("trap") 1080#define proc_trap() asm volatile("trap")
1081 1081
1082#ifdef CONFIG_PPC64 1082#define __get_SP() ({unsigned long sp; \
1083 1083 asm volatile("mr %0,1": "=r" (sp)); sp;})
1084extern void ppc64_runlatch_on(void);
1085extern void __ppc64_runlatch_off(void);
1086
1087#define ppc64_runlatch_off() \
1088 do { \
1089 if (cpu_has_feature(CPU_FTR_CTRL) && \
1090 test_thread_flag(TIF_RUNLATCH)) \
1091 __ppc64_runlatch_off(); \
1092 } while (0)
1093 1084
1094extern unsigned long scom970_read(unsigned int address); 1085extern unsigned long scom970_read(unsigned int address);
1095extern void scom970_write(unsigned int address, unsigned long value); 1086extern void scom970_write(unsigned int address, unsigned long value);
1096 1087
1097#else
1098#define ppc64_runlatch_on()
1099#define ppc64_runlatch_off()
1100
1101#endif /* CONFIG_PPC64 */
1102
1103#define __get_SP() ({unsigned long sp; \
1104 asm volatile("mr %0,1": "=r" (sp)); sp;})
1105
1106struct pt_regs; 1088struct pt_regs;
1107 1089
1108extern void ppc_save_regs(struct pt_regs *regs); 1090extern void ppc_save_regs(struct pt_regs *regs);
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index 500fe1dc43e..8a97aa7289d 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -62,6 +62,7 @@
62#define SPRN_DVC2 0x13F /* Data Value Compare Register 2 */ 62#define SPRN_DVC2 0x13F /* Data Value Compare Register 2 */
63#define SPRN_MAS8 0x155 /* MMU Assist Register 8 */ 63#define SPRN_MAS8 0x155 /* MMU Assist Register 8 */
64#define SPRN_TLB0PS 0x158 /* TLB 0 Page Size Register */ 64#define SPRN_TLB0PS 0x158 /* TLB 0 Page Size Register */
65#define SPRN_TLB1PS 0x159 /* TLB 1 Page Size Register */
65#define SPRN_MAS5_MAS6 0x15c /* MMU Assist Register 5 || 6 */ 66#define SPRN_MAS5_MAS6 0x15c /* MMU Assist Register 5 || 6 */
66#define SPRN_MAS8_MAS1 0x15d /* MMU Assist Register 8 || 1 */ 67#define SPRN_MAS8_MAS1 0x15d /* MMU Assist Register 8 || 1 */
67#define SPRN_EPTCFG 0x15e /* Embedded Page Table Config */ 68#define SPRN_EPTCFG 0x15e /* Embedded Page Table Config */
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
index f9611bd69ed..7124fc06ad4 100644
--- a/arch/powerpc/include/asm/spinlock.h
+++ b/arch/powerpc/include/asm/spinlock.h
@@ -23,7 +23,6 @@
23#ifdef CONFIG_PPC64 23#ifdef CONFIG_PPC64
24#include <asm/paca.h> 24#include <asm/paca.h>
25#include <asm/hvcall.h> 25#include <asm/hvcall.h>
26#include <asm/iseries/hv_call.h>
27#endif 26#endif
28#include <asm/asm-compat.h> 27#include <asm/asm-compat.h>
29#include <asm/synch.h> 28#include <asm/synch.h>
@@ -95,12 +94,12 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)
95 * value. 94 * value.
96 */ 95 */
97 96
98#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) 97#if defined(CONFIG_PPC_SPLPAR)
99/* We only yield to the hypervisor if we are in shared processor mode */ 98/* We only yield to the hypervisor if we are in shared processor mode */
100#define SHARED_PROCESSOR (get_lppaca()->shared_proc) 99#define SHARED_PROCESSOR (get_lppaca()->shared_proc)
101extern void __spin_yield(arch_spinlock_t *lock); 100extern void __spin_yield(arch_spinlock_t *lock);
102extern void __rw_yield(arch_rwlock_t *lock); 101extern void __rw_yield(arch_rwlock_t *lock);
103#else /* SPLPAR || ISERIES */ 102#else /* SPLPAR */
104#define __spin_yield(x) barrier() 103#define __spin_yield(x) barrier()
105#define __rw_yield(x) barrier() 104#define __rw_yield(x) barrier()
106#define SHARED_PROCESSOR 0 105#define SHARED_PROCESSOR 0
diff --git a/arch/powerpc/include/asm/system.h b/arch/powerpc/include/asm/system.h
index c377457d1b8..a02883d5af4 100644
--- a/arch/powerpc/include/asm/system.h
+++ b/arch/powerpc/include/asm/system.h
@@ -550,5 +550,43 @@ extern void reloc_got2(unsigned long);
550 550
551extern struct dentry *powerpc_debugfs_root; 551extern struct dentry *powerpc_debugfs_root;
552 552
553#ifdef CONFIG_PPC64
554
555extern void __ppc64_runlatch_on(void);
556extern void __ppc64_runlatch_off(void);
557
558/*
559 * We manually hard enable-disable, this is called
560 * in the idle loop and we don't want to mess up
561 * with soft-disable/enable & interrupt replay.
562 */
563#define ppc64_runlatch_off() \
564 do { \
565 if (cpu_has_feature(CPU_FTR_CTRL) && \
566 test_thread_local_flags(_TLF_RUNLATCH)) { \
567 unsigned long msr = mfmsr(); \
568 __hard_irq_disable(); \
569 __ppc64_runlatch_off(); \
570 if (msr & MSR_EE) \
571 __hard_irq_enable(); \
572 } \
573 } while (0)
574
575#define ppc64_runlatch_on() \
576 do { \
577 if (cpu_has_feature(CPU_FTR_CTRL) && \
578 !test_thread_local_flags(_TLF_RUNLATCH)) { \
579 unsigned long msr = mfmsr(); \
580 __hard_irq_disable(); \
581 __ppc64_runlatch_on(); \
582 if (msr & MSR_EE) \
583 __hard_irq_enable(); \
584 } \
585 } while (0)
586#else
587#define ppc64_runlatch_on()
588#define ppc64_runlatch_off()
589#endif /* CONFIG_PPC64 */
590
553#endif /* __KERNEL__ */ 591#endif /* __KERNEL__ */
554#endif /* _ASM_POWERPC_SYSTEM_H */ 592#endif /* _ASM_POWERPC_SYSTEM_H */
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 96471494096..4a741c7efd0 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -110,7 +110,6 @@ static inline struct thread_info *current_thread_info(void)
110#define TIF_NOERROR 12 /* Force successful syscall return */ 110#define TIF_NOERROR 12 /* Force successful syscall return */
111#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ 111#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */
112#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */ 112#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */
113#define TIF_RUNLATCH 16 /* Is the runlatch enabled? */
114 113
115/* as above, but as bit values */ 114/* as above, but as bit values */
116#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 115#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -141,11 +140,13 @@ static inline struct thread_info *current_thread_info(void)
141#define TLF_SLEEPING 1 /* suspend code enabled SLEEP mode */ 140#define TLF_SLEEPING 1 /* suspend code enabled SLEEP mode */
142#define TLF_RESTORE_SIGMASK 2 /* Restore signal mask in do_signal */ 141#define TLF_RESTORE_SIGMASK 2 /* Restore signal mask in do_signal */
143#define TLF_LAZY_MMU 3 /* tlb_batch is active */ 142#define TLF_LAZY_MMU 3 /* tlb_batch is active */
143#define TLF_RUNLATCH 4 /* Is the runlatch enabled? */
144 144
145#define _TLF_NAPPING (1 << TLF_NAPPING) 145#define _TLF_NAPPING (1 << TLF_NAPPING)
146#define _TLF_SLEEPING (1 << TLF_SLEEPING) 146#define _TLF_SLEEPING (1 << TLF_SLEEPING)
147#define _TLF_RESTORE_SIGMASK (1 << TLF_RESTORE_SIGMASK) 147#define _TLF_RESTORE_SIGMASK (1 << TLF_RESTORE_SIGMASK)
148#define _TLF_LAZY_MMU (1 << TLF_LAZY_MMU) 148#define _TLF_LAZY_MMU (1 << TLF_LAZY_MMU)
149#define _TLF_RUNLATCH (1 << TLF_RUNLATCH)
149 150
150#ifndef __ASSEMBLY__ 151#ifndef __ASSEMBLY__
151#define HAVE_SET_RESTORE_SIGMASK 1 152#define HAVE_SET_RESTORE_SIGMASK 1
@@ -156,6 +157,12 @@ static inline void set_restore_sigmask(void)
156 set_bit(TIF_SIGPENDING, &ti->flags); 157 set_bit(TIF_SIGPENDING, &ti->flags);
157} 158}
158 159
160static inline bool test_thread_local_flags(unsigned int flags)
161{
162 struct thread_info *ti = current_thread_info();
163 return (ti->local_flags & flags) != 0;
164}
165
159#ifdef CONFIG_PPC64 166#ifdef CONFIG_PPC64
160#define is_32bit_task() (test_thread_flag(TIF_32BIT)) 167#define is_32bit_task() (test_thread_flag(TIF_32BIT))
161#else 168#else
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
index 7eb10fb96cd..2136f58a54e 100644
--- a/arch/powerpc/include/asm/time.h
+++ b/arch/powerpc/include/asm/time.h
@@ -18,11 +18,6 @@
18#include <linux/percpu.h> 18#include <linux/percpu.h>
19 19
20#include <asm/processor.h> 20#include <asm/processor.h>
21#ifdef CONFIG_PPC_ISERIES
22#include <asm/paca.h>
23#include <asm/firmware.h>
24#include <asm/iseries/hv_call.h>
25#endif
26 21
27/* time.c */ 22/* time.c */
28extern unsigned long tb_ticks_per_jiffy; 23extern unsigned long tb_ticks_per_jiffy;
@@ -167,15 +162,6 @@ static inline void set_dec(int val)
167#ifndef CONFIG_BOOKE 162#ifndef CONFIG_BOOKE
168 --val; 163 --val;
169#endif 164#endif
170#ifdef CONFIG_PPC_ISERIES
171 if (firmware_has_feature(FW_FEATURE_ISERIES) &&
172 get_lppaca()->shared_proc) {
173 get_lppaca()->virtual_decr = val;
174 if (get_dec() > val)
175 HvCall_setVirtualDecr();
176 return;
177 }
178#endif
179 mtspr(SPRN_DEC, val); 165 mtspr(SPRN_DEC, val);
180#endif /* not 40x or 8xx_CPU6 */ 166#endif /* not 40x or 8xx_CPU6 */
181} 167}
@@ -217,7 +203,6 @@ DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
217#endif 203#endif
218 204
219extern void secondary_cpu_time_init(void); 205extern void secondary_cpu_time_init(void);
220extern void iSeries_time_init_early(void);
221 206
222DECLARE_PER_CPU(u64, decrementers_next_tb); 207DECLARE_PER_CPU(u64, decrementers_next_tb);
223 208
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index ee728e433aa..f5808a35688 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_IBMVIO) += vio.o
60obj-$(CONFIG_IBMEBUS) += ibmebus.o 60obj-$(CONFIG_IBMEBUS) += ibmebus.o
61obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o 61obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o
62obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 62obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
63obj-$(CONFIG_FA_DUMP) += fadump.o
63ifeq ($(CONFIG_PPC32),y) 64ifeq ($(CONFIG_PPC32),y)
64obj-$(CONFIG_E500) += idle_e500.o 65obj-$(CONFIG_E500) += idle_e500.o
65endif 66endif
@@ -113,15 +114,6 @@ obj-$(CONFIG_PPC_IO_WORKAROUNDS) += io-workarounds.o
113obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 114obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
114obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 115obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
115obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o 116obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
116obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
117
118obj-$(CONFIG_PPC_PERF_CTRS) += perf_event.o
119obj64-$(CONFIG_PPC_PERF_CTRS) += power4-pmu.o ppc970-pmu.o power5-pmu.o \
120 power5+-pmu.o power6-pmu.o power7-pmu.o
121obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o
122
123obj-$(CONFIG_FSL_EMB_PERF_EVENT) += perf_event_fsl_emb.o
124obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o
125 117
126obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o 118obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o
127 119
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 04caee7d9bc..cc492e48ddf 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -46,9 +46,6 @@
46#include <asm/hvcall.h> 46#include <asm/hvcall.h>
47#include <asm/xics.h> 47#include <asm/xics.h>
48#endif 48#endif
49#ifdef CONFIG_PPC_ISERIES
50#include <asm/iseries/alpaca.h>
51#endif
52#ifdef CONFIG_PPC_POWERNV 49#ifdef CONFIG_PPC_POWERNV
53#include <asm/opal.h> 50#include <asm/opal.h>
54#endif 51#endif
@@ -147,7 +144,7 @@ int main(void)
147 DEFINE(PACAKBASE, offsetof(struct paca_struct, kernelbase)); 144 DEFINE(PACAKBASE, offsetof(struct paca_struct, kernelbase));
148 DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr)); 145 DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr));
149 DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled)); 146 DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled));
150 DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled)); 147 DEFINE(PACAIRQHAPPENED, offsetof(struct paca_struct, irq_happened));
151 DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id)); 148 DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id));
152#ifdef CONFIG_PPC_MM_SLICES 149#ifdef CONFIG_PPC_MM_SLICES
153 DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct, 150 DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct,
@@ -384,17 +381,6 @@ int main(void)
384 DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry)); 381 DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry));
385#endif 382#endif
386 383
387#ifdef CONFIG_PPC_ISERIES
388 /* the assembler miscalculates the VSID values */
389 DEFINE(PAGE_OFFSET_ESID, GET_ESID(PAGE_OFFSET));
390 DEFINE(PAGE_OFFSET_VSID, KERNEL_VSID(PAGE_OFFSET));
391 DEFINE(VMALLOC_START_ESID, GET_ESID(VMALLOC_START));
392 DEFINE(VMALLOC_START_VSID, KERNEL_VSID(VMALLOC_START));
393
394 /* alpaca */
395 DEFINE(ALPACA_SIZE, sizeof(struct alpaca));
396#endif
397
398 DEFINE(PGD_TABLE_SIZE, PGD_TABLE_SIZE); 384 DEFINE(PGD_TABLE_SIZE, PGD_TABLE_SIZE);
399 DEFINE(PTE_SIZE, sizeof(pte_t)); 385 DEFINE(PTE_SIZE, sizeof(pte_t));
400 386
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 81db9e2a8a2..138ae183c44 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -1816,7 +1816,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1816 .platform = "ppc440", 1816 .platform = "ppc440",
1817 }, 1817 },
1818 { /* 464 in APM821xx */ 1818 { /* 464 in APM821xx */
1819 .pvr_mask = 0xffffff00, 1819 .pvr_mask = 0xfffffff0,
1820 .pvr_value = 0x12C41C80, 1820 .pvr_value = 0x12C41C80,
1821 .cpu_name = "APM821XX", 1821 .cpu_name = "APM821XX",
1822 .cpu_features = CPU_FTRS_44X, 1822 .cpu_features = CPU_FTRS_44X,
@@ -2019,6 +2019,24 @@ static struct cpu_spec __initdata cpu_specs[] = {
2019 .machine_check = machine_check_e500mc, 2019 .machine_check = machine_check_e500mc,
2020 .platform = "ppce5500", 2020 .platform = "ppce5500",
2021 }, 2021 },
2022 { /* e6500 */
2023 .pvr_mask = 0xffff0000,
2024 .pvr_value = 0x80400000,
2025 .cpu_name = "e6500",
2026 .cpu_features = CPU_FTRS_E6500,
2027 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
2028 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS |
2029 MMU_FTR_USE_TLBILX,
2030 .icache_bsize = 64,
2031 .dcache_bsize = 64,
2032 .num_pmcs = 4,
2033 .oprofile_cpu_type = "ppc/e6500",
2034 .oprofile_type = PPC_OPROFILE_FSL_EMB,
2035 .cpu_setup = __setup_cpu_e5500,
2036 .cpu_restore = __restore_cpu_e5500,
2037 .machine_check = machine_check_e500mc,
2038 .platform = "ppce6500",
2039 },
2022#ifdef CONFIG_PPC32 2040#ifdef CONFIG_PPC32
2023 { /* default match */ 2041 { /* default match */
2024 .pvr_mask = 0x00000000, 2042 .pvr_mask = 0x00000000,
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c
index 2cc451aaaca..5b25c8060fd 100644
--- a/arch/powerpc/kernel/dbell.c
+++ b/arch/powerpc/kernel/dbell.c
@@ -37,6 +37,8 @@ void doorbell_exception(struct pt_regs *regs)
37 37
38 irq_enter(); 38 irq_enter();
39 39
40 may_hard_irq_enable();
41
40 smp_ipi_demux(); 42 smp_ipi_demux();
41 43
42 irq_exit(); 44 irq_exit();
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 866462cbe2d..f8a7a1a1a9f 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -32,6 +32,7 @@
32#include <asm/ptrace.h> 32#include <asm/ptrace.h>
33#include <asm/irqflags.h> 33#include <asm/irqflags.h>
34#include <asm/ftrace.h> 34#include <asm/ftrace.h>
35#include <asm/hw_irq.h>
35 36
36/* 37/*
37 * System calls. 38 * System calls.
@@ -115,39 +116,33 @@ BEGIN_FW_FTR_SECTION
115END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) 116END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
116#endif /* CONFIG_VIRT_CPU_ACCOUNTING && CONFIG_PPC_SPLPAR */ 117#endif /* CONFIG_VIRT_CPU_ACCOUNTING && CONFIG_PPC_SPLPAR */
117 118
118#ifdef CONFIG_TRACE_IRQFLAGS 119 /*
119 bl .trace_hardirqs_on 120 * A syscall should always be called with interrupts enabled
120 REST_GPR(0,r1) 121 * so we just unconditionally hard-enable here. When some kind
121 REST_4GPRS(3,r1) 122 * of irq tracing is used, we additionally check that condition
122 REST_2GPRS(7,r1) 123 * is correct
123 addi r9,r1,STACK_FRAME_OVERHEAD 124 */
124 ld r12,_MSR(r1) 125#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_BUG)
125#endif /* CONFIG_TRACE_IRQFLAGS */ 126 lbz r10,PACASOFTIRQEN(r13)
126 li r10,1 127 xori r10,r10,1
127 stb r10,PACASOFTIRQEN(r13) 1281: tdnei r10,0
128 stb r10,PACAHARDIRQEN(r13) 129 EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING
129 std r10,SOFTE(r1) 130#endif
130#ifdef CONFIG_PPC_ISERIES
131BEGIN_FW_FTR_SECTION
132 /* Hack for handling interrupts when soft-enabling on iSeries */
133 cmpdi cr1,r0,0x5555 /* syscall 0x5555 */
134 andi. r10,r12,MSR_PR /* from kernel */
135 crand 4*cr0+eq,4*cr1+eq,4*cr0+eq
136 bne 2f
137 b hardware_interrupt_entry
1382:
139END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
140#endif /* CONFIG_PPC_ISERIES */
141 131
142 /* Hard enable interrupts */
143#ifdef CONFIG_PPC_BOOK3E 132#ifdef CONFIG_PPC_BOOK3E
144 wrteei 1 133 wrteei 1
145#else 134#else
146 mfmsr r11 135 ld r11,PACAKMSR(r13)
147 ori r11,r11,MSR_EE 136 ori r11,r11,MSR_EE
148 mtmsrd r11,1 137 mtmsrd r11,1
149#endif /* CONFIG_PPC_BOOK3E */ 138#endif /* CONFIG_PPC_BOOK3E */
150 139
140 /* We do need to set SOFTE in the stack frame or the return
141 * from interrupt will be painful
142 */
143 li r10,1
144 std r10,SOFTE(r1)
145
151#ifdef SHOW_SYSCALLS 146#ifdef SHOW_SYSCALLS
152 bl .do_show_syscall 147 bl .do_show_syscall
153 REST_GPR(0,r1) 148 REST_GPR(0,r1)
@@ -198,16 +193,14 @@ syscall_exit:
198 andi. r10,r8,MSR_RI 193 andi. r10,r8,MSR_RI
199 beq- unrecov_restore 194 beq- unrecov_restore
200#endif 195#endif
201 196 /*
202 /* Disable interrupts so current_thread_info()->flags can't change, 197 * Disable interrupts so current_thread_info()->flags can't change,
203 * and so that we don't get interrupted after loading SRR0/1. 198 * and so that we don't get interrupted after loading SRR0/1.
204 */ 199 */
205#ifdef CONFIG_PPC_BOOK3E 200#ifdef CONFIG_PPC_BOOK3E
206 wrteei 0 201 wrteei 0
207#else 202#else
208 mfmsr r10 203 ld r10,PACAKMSR(r13)
209 rldicl r10,r10,48,1
210 rotldi r10,r10,16
211 mtmsrd r10,1 204 mtmsrd r10,1
212#endif /* CONFIG_PPC_BOOK3E */ 205#endif /* CONFIG_PPC_BOOK3E */
213 206
@@ -319,7 +312,7 @@ syscall_exit_work:
319#ifdef CONFIG_PPC_BOOK3E 312#ifdef CONFIG_PPC_BOOK3E
320 wrteei 1 313 wrteei 1
321#else 314#else
322 mfmsr r10 315 ld r10,PACAKMSR(r13)
323 ori r10,r10,MSR_EE 316 ori r10,r10,MSR_EE
324 mtmsrd r10,1 317 mtmsrd r10,1
325#endif /* CONFIG_PPC_BOOK3E */ 318#endif /* CONFIG_PPC_BOOK3E */
@@ -565,10 +558,8 @@ _GLOBAL(ret_from_except_lite)
565#ifdef CONFIG_PPC_BOOK3E 558#ifdef CONFIG_PPC_BOOK3E
566 wrteei 0 559 wrteei 0
567#else 560#else
568 mfmsr r10 /* Get current interrupt state */ 561 ld r10,PACAKMSR(r13) /* Get kernel MSR without EE */
569 rldicl r9,r10,48,1 /* clear MSR_EE */ 562 mtmsrd r10,1 /* Update machine state */
570 rotldi r9,r9,16
571 mtmsrd r9,1 /* Update machine state */
572#endif /* CONFIG_PPC_BOOK3E */ 563#endif /* CONFIG_PPC_BOOK3E */
573 564
574#ifdef CONFIG_PREEMPT 565#ifdef CONFIG_PREEMPT
@@ -591,25 +582,74 @@ _GLOBAL(ret_from_except_lite)
591 ld r4,TI_FLAGS(r9) 582 ld r4,TI_FLAGS(r9)
592 andi. r0,r4,_TIF_USER_WORK_MASK 583 andi. r0,r4,_TIF_USER_WORK_MASK
593 bne do_work 584 bne do_work
594#endif 585#endif /* !CONFIG_PREEMPT */
595 586
587 .globl fast_exc_return_irq
588fast_exc_return_irq:
596restore: 589restore:
597BEGIN_FW_FTR_SECTION 590 /*
591 * This is the main kernel exit path, we first check if we
592 * have to change our interrupt state.
593 */
598 ld r5,SOFTE(r1) 594 ld r5,SOFTE(r1)
599FW_FTR_SECTION_ELSE 595 lbz r6,PACASOFTIRQEN(r13)
600 b .Liseries_check_pending_irqs 596 cmpwi cr1,r5,0
601ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES) 597 cmpw cr0,r5,r6
6022: 598 beq cr0,4f
603 TRACE_AND_RESTORE_IRQ(r5); 599
600 /* We do, handle disable first, which is easy */
601 bne cr1,3f;
602 li r0,0
603 stb r0,PACASOFTIRQEN(r13);
604 TRACE_DISABLE_INTS
605 b 4f
604 606
605 /* extract EE bit and use it to restore paca->hard_enabled */ 6073: /*
606 ld r3,_MSR(r1) 608 * We are about to soft-enable interrupts (we are hard disabled
607 rldicl r4,r3,49,63 /* r0 = (r3 >> 15) & 1 */ 609 * at this point). We check if there's anything that needs to
608 stb r4,PACAHARDIRQEN(r13) 610 * be replayed first.
611 */
612 lbz r0,PACAIRQHAPPENED(r13)
613 cmpwi cr0,r0,0
614 bne- restore_check_irq_replay
609 615
616 /*
617 * Get here when nothing happened while soft-disabled, just
618 * soft-enable and move-on. We will hard-enable as a side
619 * effect of rfi
620 */
621restore_no_replay:
622 TRACE_ENABLE_INTS
623 li r0,1
624 stb r0,PACASOFTIRQEN(r13);
625
626 /*
627 * Final return path. BookE is handled in a different file
628 */
6294:
610#ifdef CONFIG_PPC_BOOK3E 630#ifdef CONFIG_PPC_BOOK3E
611 b .exception_return_book3e 631 b .exception_return_book3e
612#else 632#else
633 /*
634 * Clear the reservation. If we know the CPU tracks the address of
635 * the reservation then we can potentially save some cycles and use
636 * a larx. On POWER6 and POWER7 this is significantly faster.
637 */
638BEGIN_FTR_SECTION
639 stdcx. r0,0,r1 /* to clear the reservation */
640FTR_SECTION_ELSE
641 ldarx r4,0,r1
642ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
643
644 /*
645 * Some code path such as load_up_fpu or altivec return directly
646 * here. They run entirely hard disabled and do not alter the
647 * interrupt state. They also don't use lwarx/stwcx. and thus
648 * are known not to leave dangling reservations.
649 */
650 .globl fast_exception_return
651fast_exception_return:
652 ld r3,_MSR(r1)
613 ld r4,_CTR(r1) 653 ld r4,_CTR(r1)
614 ld r0,_LINK(r1) 654 ld r0,_LINK(r1)
615 mtctr r4 655 mtctr r4
@@ -623,28 +663,18 @@ ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES)
623 beq- unrecov_restore 663 beq- unrecov_restore
624 664
625 /* 665 /*
626 * Clear the reservation. If we know the CPU tracks the address of
627 * the reservation then we can potentially save some cycles and use
628 * a larx. On POWER6 and POWER7 this is significantly faster.
629 */
630BEGIN_FTR_SECTION
631 stdcx. r0,0,r1 /* to clear the reservation */
632FTR_SECTION_ELSE
633 ldarx r4,0,r1
634ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
635
636 /*
637 * Clear RI before restoring r13. If we are returning to 666 * Clear RI before restoring r13. If we are returning to
638 * userspace and we take an exception after restoring r13, 667 * userspace and we take an exception after restoring r13,
639 * we end up corrupting the userspace r13 value. 668 * we end up corrupting the userspace r13 value.
640 */ 669 */
641 mfmsr r4 670 ld r4,PACAKMSR(r13) /* Get kernel MSR without EE */
642 andc r4,r4,r0 /* r0 contains MSR_RI here */ 671 andc r4,r4,r0 /* r0 contains MSR_RI here */
643 mtmsrd r4,1 672 mtmsrd r4,1
644 673
645 /* 674 /*
646 * r13 is our per cpu area, only restore it if we are returning to 675 * r13 is our per cpu area, only restore it if we are returning to
647 * userspace 676 * userspace the value stored in the stack frame may belong to
677 * another CPU.
648 */ 678 */
649 andi. r0,r3,MSR_PR 679 andi. r0,r3,MSR_PR
650 beq 1f 680 beq 1f
@@ -669,30 +699,55 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
669 699
670#endif /* CONFIG_PPC_BOOK3E */ 700#endif /* CONFIG_PPC_BOOK3E */
671 701
672.Liseries_check_pending_irqs: 702 /*
673#ifdef CONFIG_PPC_ISERIES 703 * Something did happen, check if a re-emit is needed
674 ld r5,SOFTE(r1) 704 * (this also clears paca->irq_happened)
675 cmpdi 0,r5,0 705 */
676 beq 2b 706restore_check_irq_replay:
677 /* Check for pending interrupts (iSeries) */ 707 /* XXX: We could implement a fast path here where we check
678 ld r3,PACALPPACAPTR(r13) 708 * for irq_happened being just 0x01, in which case we can
679 ld r3,LPPACAANYINT(r3) 709 * clear it and return. That means that we would potentially
680 cmpdi r3,0 710 * miss a decrementer having wrapped all the way around.
681 beq+ 2b /* skip do_IRQ if no interrupts */ 711 *
682 712 * Still, this might be useful for things like hash_page
683 li r3,0 713 */
684 stb r3,PACASOFTIRQEN(r13) /* ensure we are soft-disabled */ 714 bl .__check_irq_replay
685#ifdef CONFIG_TRACE_IRQFLAGS 715 cmpwi cr0,r3,0
686 bl .trace_hardirqs_off 716 beq restore_no_replay
687 mfmsr r10 717
688#endif 718 /*
689 ori r10,r10,MSR_EE 719 * We need to re-emit an interrupt. We do so by re-using our
690 mtmsrd r10 /* hard-enable again */ 720 * existing exception frame. We first change the trap value,
691 addi r3,r1,STACK_FRAME_OVERHEAD 721 * but we need to ensure we preserve the low nibble of it
692 bl .do_IRQ 722 */
693 b .ret_from_except_lite /* loop back and handle more */ 723 ld r4,_TRAP(r1)
694#endif 724 clrldi r4,r4,60
725 or r4,r4,r3
726 std r4,_TRAP(r1)
695 727
728 /*
729 * Then find the right handler and call it. Interrupts are
730 * still soft-disabled and we keep them that way.
731 */
732 cmpwi cr0,r3,0x500
733 bne 1f
734 addi r3,r1,STACK_FRAME_OVERHEAD;
735 bl .do_IRQ
736 b .ret_from_except
7371: cmpwi cr0,r3,0x900
738 bne 1f
739 addi r3,r1,STACK_FRAME_OVERHEAD;
740 bl .timer_interrupt
741 b .ret_from_except
742#ifdef CONFIG_PPC_BOOK3E
7431: cmpwi cr0,r3,0x280
744 bne 1f
745 addi r3,r1,STACK_FRAME_OVERHEAD;
746 bl .doorbell_exception
747 b .ret_from_except
748#endif /* CONFIG_PPC_BOOK3E */
7491: b .ret_from_except /* What else to do here ? */
750
696do_work: 751do_work:
697#ifdef CONFIG_PREEMPT 752#ifdef CONFIG_PREEMPT
698 andi. r0,r3,MSR_PR /* Returning to user mode? */ 753 andi. r0,r3,MSR_PR /* Returning to user mode? */
@@ -705,31 +760,22 @@ do_work:
705 crandc eq,cr1*4+eq,eq 760 crandc eq,cr1*4+eq,eq
706 bne restore 761 bne restore
707 762
708 /* Here we are preempting the current task. 763 /*
709 * 764 * Here we are preempting the current task. We want to make
710 * Ensure interrupts are soft-disabled. We also properly mark 765 * sure we are soft-disabled first
711 * the PACA to reflect the fact that they are hard-disabled
712 * and trace the change
713 */ 766 */
714 li r0,0 767 SOFT_DISABLE_INTS(r3,r4)
715 stb r0,PACASOFTIRQEN(r13)
716 stb r0,PACAHARDIRQEN(r13)
717 TRACE_DISABLE_INTS
718
719 /* Call the scheduler with soft IRQs off */
7201: bl .preempt_schedule_irq 7681: bl .preempt_schedule_irq
721 769
722 /* Hard-disable interrupts again (and update PACA) */ 770 /* Hard-disable interrupts again (and update PACA) */
723#ifdef CONFIG_PPC_BOOK3E 771#ifdef CONFIG_PPC_BOOK3E
724 wrteei 0 772 wrteei 0
725#else 773#else
726 mfmsr r10 774 ld r10,PACAKMSR(r13) /* Get kernel MSR without EE */
727 rldicl r10,r10,48,1
728 rotldi r10,r10,16
729 mtmsrd r10,1 775 mtmsrd r10,1
730#endif /* CONFIG_PPC_BOOK3E */ 776#endif /* CONFIG_PPC_BOOK3E */
731 li r0,0 777 li r0,PACA_IRQ_HARD_DIS
732 stb r0,PACAHARDIRQEN(r13) 778 stb r0,PACAIRQHAPPENED(r13)
733 779
734 /* Re-test flags and eventually loop */ 780 /* Re-test flags and eventually loop */
735 clrrdi r9,r1,THREAD_SHIFT 781 clrrdi r9,r1,THREAD_SHIFT
@@ -751,14 +797,12 @@ user_work:
751 797
752 andi. r0,r4,_TIF_NEED_RESCHED 798 andi. r0,r4,_TIF_NEED_RESCHED
753 beq 1f 799 beq 1f
754 li r5,1 800 bl .restore_interrupts
755 TRACE_AND_RESTORE_IRQ(r5);
756 bl .schedule 801 bl .schedule
757 b .ret_from_except_lite 802 b .ret_from_except_lite
758 803
7591: bl .save_nvgprs 8041: bl .save_nvgprs
760 li r5,1 805 bl .restore_interrupts
761 TRACE_AND_RESTORE_IRQ(r5);
762 addi r3,r1,STACK_FRAME_OVERHEAD 806 addi r3,r1,STACK_FRAME_OVERHEAD
763 bl .do_notify_resume 807 bl .do_notify_resume
764 b .ret_from_except 808 b .ret_from_except
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 429983c06f9..7215cc2495d 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -24,6 +24,7 @@
24#include <asm/ptrace.h> 24#include <asm/ptrace.h>
25#include <asm/ppc-opcode.h> 25#include <asm/ppc-opcode.h>
26#include <asm/mmu.h> 26#include <asm/mmu.h>
27#include <asm/hw_irq.h>
27 28
28/* XXX This will ultimately add space for a special exception save 29/* XXX This will ultimately add space for a special exception save
29 * structure used to save things like SRR0/SRR1, SPRGs, MAS, etc... 30 * structure used to save things like SRR0/SRR1, SPRGs, MAS, etc...
@@ -77,59 +78,55 @@
77#define SPRN_MC_SRR1 SPRN_MCSRR1 78#define SPRN_MC_SRR1 SPRN_MCSRR1
78 79
79#define NORMAL_EXCEPTION_PROLOG(n, addition) \ 80#define NORMAL_EXCEPTION_PROLOG(n, addition) \
80 EXCEPTION_PROLOG(n, GEN, addition##_GEN) 81 EXCEPTION_PROLOG(n, GEN, addition##_GEN(n))
81 82
82#define CRIT_EXCEPTION_PROLOG(n, addition) \ 83#define CRIT_EXCEPTION_PROLOG(n, addition) \
83 EXCEPTION_PROLOG(n, CRIT, addition##_CRIT) 84 EXCEPTION_PROLOG(n, CRIT, addition##_CRIT(n))
84 85
85#define DBG_EXCEPTION_PROLOG(n, addition) \ 86#define DBG_EXCEPTION_PROLOG(n, addition) \
86 EXCEPTION_PROLOG(n, DBG, addition##_DBG) 87 EXCEPTION_PROLOG(n, DBG, addition##_DBG(n))
87 88
88#define MC_EXCEPTION_PROLOG(n, addition) \ 89#define MC_EXCEPTION_PROLOG(n, addition) \
89 EXCEPTION_PROLOG(n, MC, addition##_MC) 90 EXCEPTION_PROLOG(n, MC, addition##_MC(n))
90 91
91 92
92/* Variants of the "addition" argument for the prolog 93/* Variants of the "addition" argument for the prolog
93 */ 94 */
94#define PROLOG_ADDITION_NONE_GEN 95#define PROLOG_ADDITION_NONE_GEN(n)
95#define PROLOG_ADDITION_NONE_CRIT 96#define PROLOG_ADDITION_NONE_CRIT(n)
96#define PROLOG_ADDITION_NONE_DBG 97#define PROLOG_ADDITION_NONE_DBG(n)
97#define PROLOG_ADDITION_NONE_MC 98#define PROLOG_ADDITION_NONE_MC(n)
98 99
99#define PROLOG_ADDITION_MASKABLE_GEN \ 100#define PROLOG_ADDITION_MASKABLE_GEN(n) \
100 lbz r11,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \ 101 lbz r11,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \
101 cmpwi cr0,r11,0; /* yes -> go out of line */ \ 102 cmpwi cr0,r11,0; /* yes -> go out of line */ \
102 beq masked_interrupt_book3e; 103 beq masked_interrupt_book3e_##n
103 104
104#define PROLOG_ADDITION_2REGS_GEN \ 105#define PROLOG_ADDITION_2REGS_GEN(n) \
105 std r14,PACA_EXGEN+EX_R14(r13); \ 106 std r14,PACA_EXGEN+EX_R14(r13); \
106 std r15,PACA_EXGEN+EX_R15(r13) 107 std r15,PACA_EXGEN+EX_R15(r13)
107 108
108#define PROLOG_ADDITION_1REG_GEN \ 109#define PROLOG_ADDITION_1REG_GEN(n) \
109 std r14,PACA_EXGEN+EX_R14(r13); 110 std r14,PACA_EXGEN+EX_R14(r13);
110 111
111#define PROLOG_ADDITION_2REGS_CRIT \ 112#define PROLOG_ADDITION_2REGS_CRIT(n) \
112 std r14,PACA_EXCRIT+EX_R14(r13); \ 113 std r14,PACA_EXCRIT+EX_R14(r13); \
113 std r15,PACA_EXCRIT+EX_R15(r13) 114 std r15,PACA_EXCRIT+EX_R15(r13)
114 115
115#define PROLOG_ADDITION_2REGS_DBG \ 116#define PROLOG_ADDITION_2REGS_DBG(n) \
116 std r14,PACA_EXDBG+EX_R14(r13); \ 117 std r14,PACA_EXDBG+EX_R14(r13); \
117 std r15,PACA_EXDBG+EX_R15(r13) 118 std r15,PACA_EXDBG+EX_R15(r13)
118 119
119#define PROLOG_ADDITION_2REGS_MC \ 120#define PROLOG_ADDITION_2REGS_MC(n) \
120 std r14,PACA_EXMC+EX_R14(r13); \ 121 std r14,PACA_EXMC+EX_R14(r13); \
121 std r15,PACA_EXMC+EX_R15(r13) 122 std r15,PACA_EXMC+EX_R15(r13)
122 123
123#define PROLOG_ADDITION_DOORBELL_GEN \
124 lbz r11,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \
125 cmpwi cr0,r11,0; /* yes -> go out of line */ \
126 beq masked_doorbell_book3e
127
128 124
129/* Core exception code for all exceptions except TLB misses. 125/* Core exception code for all exceptions except TLB misses.
130 * XXX: Needs to make SPRN_SPRG_GEN depend on exception type 126 * XXX: Needs to make SPRN_SPRG_GEN depend on exception type
131 */ 127 */
132#define EXCEPTION_COMMON(n, excf, ints) \ 128#define EXCEPTION_COMMON(n, excf, ints) \
129exc_##n##_common: \
133 std r0,GPR0(r1); /* save r0 in stackframe */ \ 130 std r0,GPR0(r1); /* save r0 in stackframe */ \
134 std r2,GPR2(r1); /* save r2 in stackframe */ \ 131 std r2,GPR2(r1); /* save r2 in stackframe */ \
135 SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \ 132 SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \
@@ -167,20 +164,21 @@
167 std r0,RESULT(r1); /* clear regs->result */ \ 164 std r0,RESULT(r1); /* clear regs->result */ \
168 ints; 165 ints;
169 166
170/* Variants for the "ints" argument */ 167/* Variants for the "ints" argument. This one does nothing when we want
168 * to keep interrupts in their original state
169 */
171#define INTS_KEEP 170#define INTS_KEEP
172#define INTS_DISABLE_SOFT \ 171
173 stb r0,PACASOFTIRQEN(r13); /* mark interrupts soft-disabled */ \ 172/* This second version is meant for exceptions that don't immediately
174 TRACE_DISABLE_INTS; 173 * hard-enable. We set a bit in paca->irq_happened to ensure that
175#define INTS_DISABLE_HARD \ 174 * a subsequent call to arch_local_irq_restore() will properly
176 stb r0,PACAHARDIRQEN(r13); /* and hard disabled */ 175 * hard-enable and avoid the fast-path
177#define INTS_DISABLE_ALL \ 176 */
178 INTS_DISABLE_SOFT \ 177#define INTS_DISABLE SOFT_DISABLE_INTS(r3,r4)
179 INTS_DISABLE_HARD 178
180 179/* This is called by exceptions that used INTS_KEEP (that did not touch
181/* This is called by exceptions that used INTS_KEEP (that is did not clear 180 * irq indicators in the PACA). This will restore MSR:EE to it's previous
182 * neither soft nor hard IRQ indicators in the PACA. This will restore MSR:EE 181 * value
183 * to it's previous value
184 * 182 *
185 * XXX In the long run, we may want to open-code it in order to separate the 183 * XXX In the long run, we may want to open-code it in order to separate the
186 * load from the wrtee, thus limiting the latency caused by the dependency 184 * load from the wrtee, thus limiting the latency caused by the dependency
@@ -238,7 +236,7 @@ exc_##n##_bad_stack: \
238#define MASKABLE_EXCEPTION(trapnum, label, hdlr, ack) \ 236#define MASKABLE_EXCEPTION(trapnum, label, hdlr, ack) \
239 START_EXCEPTION(label); \ 237 START_EXCEPTION(label); \
240 NORMAL_EXCEPTION_PROLOG(trapnum, PROLOG_ADDITION_MASKABLE) \ 238 NORMAL_EXCEPTION_PROLOG(trapnum, PROLOG_ADDITION_MASKABLE) \
241 EXCEPTION_COMMON(trapnum, PACA_EXGEN, INTS_DISABLE_ALL) \ 239 EXCEPTION_COMMON(trapnum, PACA_EXGEN, INTS_DISABLE) \
242 ack(r8); \ 240 ack(r8); \
243 CHECK_NAPPING(); \ 241 CHECK_NAPPING(); \
244 addi r3,r1,STACK_FRAME_OVERHEAD; \ 242 addi r3,r1,STACK_FRAME_OVERHEAD; \
@@ -289,7 +287,7 @@ interrupt_end_book3e:
289/* Critical Input Interrupt */ 287/* Critical Input Interrupt */
290 START_EXCEPTION(critical_input); 288 START_EXCEPTION(critical_input);
291 CRIT_EXCEPTION_PROLOG(0x100, PROLOG_ADDITION_NONE) 289 CRIT_EXCEPTION_PROLOG(0x100, PROLOG_ADDITION_NONE)
292// EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE_ALL) 290// EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE)
293// bl special_reg_save_crit 291// bl special_reg_save_crit
294// CHECK_NAPPING(); 292// CHECK_NAPPING();
295// addi r3,r1,STACK_FRAME_OVERHEAD 293// addi r3,r1,STACK_FRAME_OVERHEAD
@@ -300,7 +298,7 @@ interrupt_end_book3e:
300/* Machine Check Interrupt */ 298/* Machine Check Interrupt */
301 START_EXCEPTION(machine_check); 299 START_EXCEPTION(machine_check);
302 CRIT_EXCEPTION_PROLOG(0x200, PROLOG_ADDITION_NONE) 300 CRIT_EXCEPTION_PROLOG(0x200, PROLOG_ADDITION_NONE)
303// EXCEPTION_COMMON(0x200, PACA_EXMC, INTS_DISABLE_ALL) 301// EXCEPTION_COMMON(0x200, PACA_EXMC, INTS_DISABLE)
304// bl special_reg_save_mc 302// bl special_reg_save_mc
305// addi r3,r1,STACK_FRAME_OVERHEAD 303// addi r3,r1,STACK_FRAME_OVERHEAD
306// CHECK_NAPPING(); 304// CHECK_NAPPING();
@@ -313,7 +311,7 @@ interrupt_end_book3e:
313 NORMAL_EXCEPTION_PROLOG(0x300, PROLOG_ADDITION_2REGS) 311 NORMAL_EXCEPTION_PROLOG(0x300, PROLOG_ADDITION_2REGS)
314 mfspr r14,SPRN_DEAR 312 mfspr r14,SPRN_DEAR
315 mfspr r15,SPRN_ESR 313 mfspr r15,SPRN_ESR
316 EXCEPTION_COMMON(0x300, PACA_EXGEN, INTS_KEEP) 314 EXCEPTION_COMMON(0x300, PACA_EXGEN, INTS_DISABLE)
317 b storage_fault_common 315 b storage_fault_common
318 316
319/* Instruction Storage Interrupt */ 317/* Instruction Storage Interrupt */
@@ -321,7 +319,7 @@ interrupt_end_book3e:
321 NORMAL_EXCEPTION_PROLOG(0x400, PROLOG_ADDITION_2REGS) 319 NORMAL_EXCEPTION_PROLOG(0x400, PROLOG_ADDITION_2REGS)
322 li r15,0 320 li r15,0
323 mr r14,r10 321 mr r14,r10
324 EXCEPTION_COMMON(0x400, PACA_EXGEN, INTS_KEEP) 322 EXCEPTION_COMMON(0x400, PACA_EXGEN, INTS_DISABLE)
325 b storage_fault_common 323 b storage_fault_common
326 324
327/* External Input Interrupt */ 325/* External Input Interrupt */
@@ -339,12 +337,11 @@ interrupt_end_book3e:
339 START_EXCEPTION(program); 337 START_EXCEPTION(program);
340 NORMAL_EXCEPTION_PROLOG(0x700, PROLOG_ADDITION_1REG) 338 NORMAL_EXCEPTION_PROLOG(0x700, PROLOG_ADDITION_1REG)
341 mfspr r14,SPRN_ESR 339 mfspr r14,SPRN_ESR
342 EXCEPTION_COMMON(0x700, PACA_EXGEN, INTS_DISABLE_SOFT) 340 EXCEPTION_COMMON(0x700, PACA_EXGEN, INTS_DISABLE)
343 std r14,_DSISR(r1) 341 std r14,_DSISR(r1)
344 addi r3,r1,STACK_FRAME_OVERHEAD 342 addi r3,r1,STACK_FRAME_OVERHEAD
345 ld r14,PACA_EXGEN+EX_R14(r13) 343 ld r14,PACA_EXGEN+EX_R14(r13)
346 bl .save_nvgprs 344 bl .save_nvgprs
347 INTS_RESTORE_HARD
348 bl .program_check_exception 345 bl .program_check_exception
349 b .ret_from_except 346 b .ret_from_except
350 347
@@ -353,15 +350,16 @@ interrupt_end_book3e:
353 NORMAL_EXCEPTION_PROLOG(0x800, PROLOG_ADDITION_NONE) 350 NORMAL_EXCEPTION_PROLOG(0x800, PROLOG_ADDITION_NONE)
354 /* we can probably do a shorter exception entry for that one... */ 351 /* we can probably do a shorter exception entry for that one... */
355 EXCEPTION_COMMON(0x800, PACA_EXGEN, INTS_KEEP) 352 EXCEPTION_COMMON(0x800, PACA_EXGEN, INTS_KEEP)
356 bne 1f /* if from user, just load it up */ 353 ld r12,_MSR(r1)
354 andi. r0,r12,MSR_PR;
355 beq- 1f
356 bl .load_up_fpu
357 b fast_exception_return
3581: INTS_DISABLE
357 bl .save_nvgprs 359 bl .save_nvgprs
358 addi r3,r1,STACK_FRAME_OVERHEAD 360 addi r3,r1,STACK_FRAME_OVERHEAD
359 INTS_RESTORE_HARD
360 bl .kernel_fp_unavailable_exception 361 bl .kernel_fp_unavailable_exception
361 BUG_OPCODE 362 b .ret_from_except
3621: ld r12,_MSR(r1)
363 bl .load_up_fpu
364 b fast_exception_return
365 363
366/* Decrementer Interrupt */ 364/* Decrementer Interrupt */
367 MASKABLE_EXCEPTION(0x900, decrementer, .timer_interrupt, ACK_DEC) 365 MASKABLE_EXCEPTION(0x900, decrementer, .timer_interrupt, ACK_DEC)
@@ -372,7 +370,7 @@ interrupt_end_book3e:
372/* Watchdog Timer Interrupt */ 370/* Watchdog Timer Interrupt */
373 START_EXCEPTION(watchdog); 371 START_EXCEPTION(watchdog);
374 CRIT_EXCEPTION_PROLOG(0x9f0, PROLOG_ADDITION_NONE) 372 CRIT_EXCEPTION_PROLOG(0x9f0, PROLOG_ADDITION_NONE)
375// EXCEPTION_COMMON(0x9f0, PACA_EXCRIT, INTS_DISABLE_ALL) 373// EXCEPTION_COMMON(0x9f0, PACA_EXCRIT, INTS_DISABLE)
376// bl special_reg_save_crit 374// bl special_reg_save_crit
377// CHECK_NAPPING(); 375// CHECK_NAPPING();
378// addi r3,r1,STACK_FRAME_OVERHEAD 376// addi r3,r1,STACK_FRAME_OVERHEAD
@@ -391,10 +389,9 @@ interrupt_end_book3e:
391/* Auxiliary Processor Unavailable Interrupt */ 389/* Auxiliary Processor Unavailable Interrupt */
392 START_EXCEPTION(ap_unavailable); 390 START_EXCEPTION(ap_unavailable);
393 NORMAL_EXCEPTION_PROLOG(0xf20, PROLOG_ADDITION_NONE) 391 NORMAL_EXCEPTION_PROLOG(0xf20, PROLOG_ADDITION_NONE)
394 EXCEPTION_COMMON(0xf20, PACA_EXGEN, INTS_KEEP) 392 EXCEPTION_COMMON(0xf20, PACA_EXGEN, INTS_DISABLE)
395 addi r3,r1,STACK_FRAME_OVERHEAD
396 bl .save_nvgprs 393 bl .save_nvgprs
397 INTS_RESTORE_HARD 394 addi r3,r1,STACK_FRAME_OVERHEAD
398 bl .unknown_exception 395 bl .unknown_exception
399 b .ret_from_except 396 b .ret_from_except
400 397
@@ -450,7 +447,7 @@ interrupt_end_book3e:
450 mfspr r15,SPRN_SPRG_CRIT_SCRATCH 447 mfspr r15,SPRN_SPRG_CRIT_SCRATCH
451 mtspr SPRN_SPRG_GEN_SCRATCH,r15 448 mtspr SPRN_SPRG_GEN_SCRATCH,r15
452 mfspr r14,SPRN_DBSR 449 mfspr r14,SPRN_DBSR
453 EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE_ALL) 450 EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE)
454 std r14,_DSISR(r1) 451 std r14,_DSISR(r1)
455 addi r3,r1,STACK_FRAME_OVERHEAD 452 addi r3,r1,STACK_FRAME_OVERHEAD
456 mr r4,r14 453 mr r4,r14
@@ -465,7 +462,7 @@ kernel_dbg_exc:
465 462
466/* Debug exception as a debug interrupt*/ 463/* Debug exception as a debug interrupt*/
467 START_EXCEPTION(debug_debug); 464 START_EXCEPTION(debug_debug);
468 DBG_EXCEPTION_PROLOG(0xd00, PROLOG_ADDITION_2REGS) 465 DBG_EXCEPTION_PROLOG(0xd08, PROLOG_ADDITION_2REGS)
469 466
470 /* 467 /*
471 * If there is a single step or branch-taken exception in an 468 * If there is a single step or branch-taken exception in an
@@ -515,7 +512,7 @@ kernel_dbg_exc:
515 mfspr r15,SPRN_SPRG_DBG_SCRATCH 512 mfspr r15,SPRN_SPRG_DBG_SCRATCH
516 mtspr SPRN_SPRG_GEN_SCRATCH,r15 513 mtspr SPRN_SPRG_GEN_SCRATCH,r15
517 mfspr r14,SPRN_DBSR 514 mfspr r14,SPRN_DBSR
518 EXCEPTION_COMMON(0xd00, PACA_EXDBG, INTS_DISABLE_ALL) 515 EXCEPTION_COMMON(0xd08, PACA_EXDBG, INTS_DISABLE)
519 std r14,_DSISR(r1) 516 std r14,_DSISR(r1)
520 addi r3,r1,STACK_FRAME_OVERHEAD 517 addi r3,r1,STACK_FRAME_OVERHEAD
521 mr r4,r14 518 mr r4,r14
@@ -525,21 +522,20 @@ kernel_dbg_exc:
525 bl .DebugException 522 bl .DebugException
526 b .ret_from_except 523 b .ret_from_except
527 524
528 MASKABLE_EXCEPTION(0x260, perfmon, .performance_monitor_exception, ACK_NONE) 525 START_EXCEPTION(perfmon);
529 526 NORMAL_EXCEPTION_PROLOG(0x260, PROLOG_ADDITION_NONE)
530/* Doorbell interrupt */ 527 EXCEPTION_COMMON(0x260, PACA_EXGEN, INTS_DISABLE)
531 START_EXCEPTION(doorbell)
532 NORMAL_EXCEPTION_PROLOG(0x2070, PROLOG_ADDITION_DOORBELL)
533 EXCEPTION_COMMON(0x2070, PACA_EXGEN, INTS_DISABLE_ALL)
534 CHECK_NAPPING()
535 addi r3,r1,STACK_FRAME_OVERHEAD 528 addi r3,r1,STACK_FRAME_OVERHEAD
536 bl .doorbell_exception 529 bl .performance_monitor_exception
537 b .ret_from_except_lite 530 b .ret_from_except_lite
538 531
532/* Doorbell interrupt */
533 MASKABLE_EXCEPTION(0x280, doorbell, .doorbell_exception, ACK_NONE)
534
539/* Doorbell critical Interrupt */ 535/* Doorbell critical Interrupt */
540 START_EXCEPTION(doorbell_crit); 536 START_EXCEPTION(doorbell_crit);
541 CRIT_EXCEPTION_PROLOG(0x2080, PROLOG_ADDITION_NONE) 537 CRIT_EXCEPTION_PROLOG(0x2a0, PROLOG_ADDITION_NONE)
542// EXCEPTION_COMMON(0x2080, PACA_EXCRIT, INTS_DISABLE_ALL) 538// EXCEPTION_COMMON(0x2a0, PACA_EXCRIT, INTS_DISABLE)
543// bl special_reg_save_crit 539// bl special_reg_save_crit
544// CHECK_NAPPING(); 540// CHECK_NAPPING();
545// addi r3,r1,STACK_FRAME_OVERHEAD 541// addi r3,r1,STACK_FRAME_OVERHEAD
@@ -547,36 +543,114 @@ kernel_dbg_exc:
547// b ret_from_crit_except 543// b ret_from_crit_except
548 b . 544 b .
549 545
546/* Guest Doorbell */
550 MASKABLE_EXCEPTION(0x2c0, guest_doorbell, .unknown_exception, ACK_NONE) 547 MASKABLE_EXCEPTION(0x2c0, guest_doorbell, .unknown_exception, ACK_NONE)
551 MASKABLE_EXCEPTION(0x2e0, guest_doorbell_crit, .unknown_exception, ACK_NONE)
552 MASKABLE_EXCEPTION(0x310, hypercall, .unknown_exception, ACK_NONE)
553 MASKABLE_EXCEPTION(0x320, ehpriv, .unknown_exception, ACK_NONE)
554 548
549/* Guest Doorbell critical Interrupt */
550 START_EXCEPTION(guest_doorbell_crit);
551 CRIT_EXCEPTION_PROLOG(0x2e0, PROLOG_ADDITION_NONE)
552// EXCEPTION_COMMON(0x2e0, PACA_EXCRIT, INTS_DISABLE)
553// bl special_reg_save_crit
554// CHECK_NAPPING();
555// addi r3,r1,STACK_FRAME_OVERHEAD
556// bl .guest_doorbell_critical_exception
557// b ret_from_crit_except
558 b .
559
560/* Hypervisor call */
561 START_EXCEPTION(hypercall);
562 NORMAL_EXCEPTION_PROLOG(0x310, PROLOG_ADDITION_NONE)
563 EXCEPTION_COMMON(0x310, PACA_EXGEN, INTS_KEEP)
564 addi r3,r1,STACK_FRAME_OVERHEAD
565 bl .save_nvgprs
566 INTS_RESTORE_HARD
567 bl .unknown_exception
568 b .ret_from_except
569
570/* Embedded Hypervisor priviledged */
571 START_EXCEPTION(ehpriv);
572 NORMAL_EXCEPTION_PROLOG(0x320, PROLOG_ADDITION_NONE)
573 EXCEPTION_COMMON(0x320, PACA_EXGEN, INTS_KEEP)
574 addi r3,r1,STACK_FRAME_OVERHEAD
575 bl .save_nvgprs
576 INTS_RESTORE_HARD
577 bl .unknown_exception
578 b .ret_from_except
555 579
556/* 580/*
557 * An interrupt came in while soft-disabled; clear EE in SRR1, 581 * An interrupt came in while soft-disabled; We mark paca->irq_happened
558 * clear paca->hard_enabled and return. 582 * accordingly and if the interrupt is level sensitive, we hard disable
559 */ 583 */
560masked_doorbell_book3e:
561 mtcr r10
562 /* Resend the doorbell to fire again when ints enabled */
563 mfspr r10,SPRN_PIR
564 PPC_MSGSND(r10)
565 b masked_interrupt_book3e_common
566 584
567masked_interrupt_book3e: 585masked_interrupt_book3e_0x500:
586 /* XXX When adding support for EPR, use PACA_IRQ_EE_EDGE */
587 li r11,PACA_IRQ_EE
588 b masked_interrupt_book3e_full_mask
589
590masked_interrupt_book3e_0x900:
591 ACK_DEC(r11);
592 li r11,PACA_IRQ_DEC
593 b masked_interrupt_book3e_no_mask
594masked_interrupt_book3e_0x980:
595 ACK_FIT(r11);
596 li r11,PACA_IRQ_DEC
597 b masked_interrupt_book3e_no_mask
598masked_interrupt_book3e_0x280:
599masked_interrupt_book3e_0x2c0:
600 li r11,PACA_IRQ_DBELL
601 b masked_interrupt_book3e_no_mask
602
603masked_interrupt_book3e_no_mask:
604 mtcr r10
605 lbz r10,PACAIRQHAPPENED(r13)
606 or r10,r10,r11
607 stb r10,PACAIRQHAPPENED(r13)
608 b 1f
609masked_interrupt_book3e_full_mask:
568 mtcr r10 610 mtcr r10
569masked_interrupt_book3e_common: 611 lbz r10,PACAIRQHAPPENED(r13)
570 stb r11,PACAHARDIRQEN(r13) 612 or r10,r10,r11
613 stb r10,PACAIRQHAPPENED(r13)
571 mfspr r10,SPRN_SRR1 614 mfspr r10,SPRN_SRR1
572 rldicl r11,r10,48,1 /* clear MSR_EE */ 615 rldicl r11,r10,48,1 /* clear MSR_EE */
573 rotldi r10,r11,16 616 rotldi r10,r11,16
574 mtspr SPRN_SRR1,r10 617 mtspr SPRN_SRR1,r10
575 ld r10,PACA_EXGEN+EX_R10(r13); /* restore registers */ 6181: ld r10,PACA_EXGEN+EX_R10(r13);
576 ld r11,PACA_EXGEN+EX_R11(r13); 619 ld r11,PACA_EXGEN+EX_R11(r13);
577 mfspr r13,SPRN_SPRG_GEN_SCRATCH; 620 mfspr r13,SPRN_SPRG_GEN_SCRATCH;
578 rfi 621 rfi
579 b . 622 b .
623/*
624 * Called from arch_local_irq_enable when an interrupt needs
625 * to be resent. r3 contains either 0x500,0x900,0x260 or 0x280
626 * to indicate the kind of interrupt. MSR:EE is already off.
627 * We generate a stackframe like if a real interrupt had happened.
628 *
629 * Note: While MSR:EE is off, we need to make sure that _MSR
630 * in the generated frame has EE set to 1 or the exception
631 * handler will not properly re-enable them.
632 */
633_GLOBAL(__replay_interrupt)
634 /* We are going to jump to the exception common code which
635 * will retrieve various register values from the PACA which
636 * we don't give a damn about.
637 */
638 mflr r10
639 mfmsr r11
640 mfcr r4
641 mtspr SPRN_SPRG_GEN_SCRATCH,r13;
642 std r1,PACA_EXGEN+EX_R1(r13);
643 stw r4,PACA_EXGEN+EX_CR(r13);
644 ori r11,r11,MSR_EE
645 subi r1,r1,INT_FRAME_SIZE;
646 cmpwi cr0,r3,0x500
647 beq exc_0x500_common
648 cmpwi cr0,r3,0x900
649 beq exc_0x900_common
650 cmpwi cr0,r3,0x280
651 beq exc_0x280_common
652 blr
653
580 654
581/* 655/*
582 * This is called from 0x300 and 0x400 handlers after the prologs with 656 * This is called from 0x300 and 0x400 handlers after the prologs with
@@ -591,7 +665,6 @@ storage_fault_common:
591 mr r5,r15 665 mr r5,r15
592 ld r14,PACA_EXGEN+EX_R14(r13) 666 ld r14,PACA_EXGEN+EX_R14(r13)
593 ld r15,PACA_EXGEN+EX_R15(r13) 667 ld r15,PACA_EXGEN+EX_R15(r13)
594 INTS_RESTORE_HARD
595 bl .do_page_fault 668 bl .do_page_fault
596 cmpdi r3,0 669 cmpdi r3,0
597 bne- 1f 670 bne- 1f
@@ -680,6 +753,8 @@ BAD_STACK_TRAMPOLINE(0x000)
680BAD_STACK_TRAMPOLINE(0x100) 753BAD_STACK_TRAMPOLINE(0x100)
681BAD_STACK_TRAMPOLINE(0x200) 754BAD_STACK_TRAMPOLINE(0x200)
682BAD_STACK_TRAMPOLINE(0x260) 755BAD_STACK_TRAMPOLINE(0x260)
756BAD_STACK_TRAMPOLINE(0x280)
757BAD_STACK_TRAMPOLINE(0x2a0)
683BAD_STACK_TRAMPOLINE(0x2c0) 758BAD_STACK_TRAMPOLINE(0x2c0)
684BAD_STACK_TRAMPOLINE(0x2e0) 759BAD_STACK_TRAMPOLINE(0x2e0)
685BAD_STACK_TRAMPOLINE(0x300) 760BAD_STACK_TRAMPOLINE(0x300)
@@ -697,11 +772,10 @@ BAD_STACK_TRAMPOLINE(0xa00)
697BAD_STACK_TRAMPOLINE(0xb00) 772BAD_STACK_TRAMPOLINE(0xb00)
698BAD_STACK_TRAMPOLINE(0xc00) 773BAD_STACK_TRAMPOLINE(0xc00)
699BAD_STACK_TRAMPOLINE(0xd00) 774BAD_STACK_TRAMPOLINE(0xd00)
775BAD_STACK_TRAMPOLINE(0xd08)
700BAD_STACK_TRAMPOLINE(0xe00) 776BAD_STACK_TRAMPOLINE(0xe00)
701BAD_STACK_TRAMPOLINE(0xf00) 777BAD_STACK_TRAMPOLINE(0xf00)
702BAD_STACK_TRAMPOLINE(0xf20) 778BAD_STACK_TRAMPOLINE(0xf20)
703BAD_STACK_TRAMPOLINE(0x2070)
704BAD_STACK_TRAMPOLINE(0x2080)
705 779
706 .globl bad_stack_book3e 780 .globl bad_stack_book3e
707bad_stack_book3e: 781bad_stack_book3e:
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 15c5a4f6de0..2d0868a4e2f 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -12,6 +12,7 @@
12 * 12 *
13 */ 13 */
14 14
15#include <asm/hw_irq.h>
15#include <asm/exception-64s.h> 16#include <asm/exception-64s.h>
16#include <asm/ptrace.h> 17#include <asm/ptrace.h>
17 18
@@ -19,7 +20,7 @@
19 * We layout physical memory as follows: 20 * We layout physical memory as follows:
20 * 0x0000 - 0x00ff : Secondary processor spin code 21 * 0x0000 - 0x00ff : Secondary processor spin code
21 * 0x0100 - 0x2fff : pSeries Interrupt prologs 22 * 0x0100 - 0x2fff : pSeries Interrupt prologs
22 * 0x3000 - 0x5fff : interrupt support, iSeries and common interrupt prologs 23 * 0x3000 - 0x5fff : interrupt support common interrupt prologs
23 * 0x6000 - 0x6fff : Initial (CPU0) segment table 24 * 0x6000 - 0x6fff : Initial (CPU0) segment table
24 * 0x7000 - 0x7fff : FWNMI data area 25 * 0x7000 - 0x7fff : FWNMI data area
25 * 0x8000 - : Early init and support code 26 * 0x8000 - : Early init and support code
@@ -356,34 +357,60 @@ do_stab_bolted_pSeries:
356 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf40) 357 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf40)
357 358
358/* 359/*
359 * An interrupt came in while soft-disabled; clear EE in SRR1, 360 * An interrupt came in while soft-disabled. We set paca->irq_happened,
360 * clear paca->hard_enabled and return. 361 * then, if it was a decrementer interrupt, we bump the dec to max and
362 * and return, else we hard disable and return. This is called with
363 * r10 containing the value to OR to the paca field.
361 */ 364 */
362masked_interrupt: 365#define MASKED_INTERRUPT(_H) \
363 stb r10,PACAHARDIRQEN(r13) 366masked_##_H##interrupt: \
364 mtcrf 0x80,r9 367 std r11,PACA_EXGEN+EX_R11(r13); \
365 ld r9,PACA_EXGEN+EX_R9(r13) 368 lbz r11,PACAIRQHAPPENED(r13); \
366 mfspr r10,SPRN_SRR1 369 or r11,r11,r10; \
367 rldicl r10,r10,48,1 /* clear MSR_EE */ 370 stb r11,PACAIRQHAPPENED(r13); \
368 rotldi r10,r10,16 371 andi. r10,r10,PACA_IRQ_DEC; \
369 mtspr SPRN_SRR1,r10 372 beq 1f; \
370 ld r10,PACA_EXGEN+EX_R10(r13) 373 lis r10,0x7fff; \
371 GET_SCRATCH0(r13) 374 ori r10,r10,0xffff; \
372 rfid 375 mtspr SPRN_DEC,r10; \
376 b 2f; \
3771: mfspr r10,SPRN_##_H##SRR1; \
378 rldicl r10,r10,48,1; /* clear MSR_EE */ \
379 rotldi r10,r10,16; \
380 mtspr SPRN_##_H##SRR1,r10; \
3812: mtcrf 0x80,r9; \
382 ld r9,PACA_EXGEN+EX_R9(r13); \
383 ld r10,PACA_EXGEN+EX_R10(r13); \
384 ld r11,PACA_EXGEN+EX_R11(r13); \
385 GET_SCRATCH0(r13); \
386 ##_H##rfid; \
373 b . 387 b .
388
389 MASKED_INTERRUPT()
390 MASKED_INTERRUPT(H)
374 391
375masked_Hinterrupt: 392/*
376 stb r10,PACAHARDIRQEN(r13) 393 * Called from arch_local_irq_enable when an interrupt needs
377 mtcrf 0x80,r9 394 * to be resent. r3 contains 0x500 or 0x900 to indicate which
378 ld r9,PACA_EXGEN+EX_R9(r13) 395 * kind of interrupt. MSR:EE is already off. We generate a
379 mfspr r10,SPRN_HSRR1 396 * stackframe like if a real interrupt had happened.
380 rldicl r10,r10,48,1 /* clear MSR_EE */ 397 *
381 rotldi r10,r10,16 398 * Note: While MSR:EE is off, we need to make sure that _MSR
382 mtspr SPRN_HSRR1,r10 399 * in the generated frame has EE set to 1 or the exception
383 ld r10,PACA_EXGEN+EX_R10(r13) 400 * handler will not properly re-enable them.
384 GET_SCRATCH0(r13) 401 */
385 hrfid 402_GLOBAL(__replay_interrupt)
386 b . 403 /* We are going to jump to the exception common code which
404 * will retrieve various register values from the PACA which
405 * we don't give a damn about, so we don't bother storing them.
406 */
407 mfmsr r12
408 mflr r11
409 mfcr r9
410 ori r12,r12,MSR_EE
411 andi. r3,r3,0x0800
412 bne decrementer_common
413 b hardware_interrupt_common
387 414
388#ifdef CONFIG_PPC_PSERIES 415#ifdef CONFIG_PPC_PSERIES
389/* 416/*
@@ -458,14 +485,15 @@ machine_check_common:
458 bl .machine_check_exception 485 bl .machine_check_exception
459 b .ret_from_except 486 b .ret_from_except
460 487
461 STD_EXCEPTION_COMMON_LITE(0x900, decrementer, .timer_interrupt) 488 STD_EXCEPTION_COMMON_ASYNC(0x500, hardware_interrupt, do_IRQ)
489 STD_EXCEPTION_COMMON_ASYNC(0x900, decrementer, .timer_interrupt)
462 STD_EXCEPTION_COMMON(0xa00, trap_0a, .unknown_exception) 490 STD_EXCEPTION_COMMON(0xa00, trap_0a, .unknown_exception)
463 STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception) 491 STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception)
464 STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception) 492 STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception)
465 STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception) 493 STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception)
466 STD_EXCEPTION_COMMON(0xe40, emulation_assist, .program_check_exception) 494 STD_EXCEPTION_COMMON(0xe40, emulation_assist, .program_check_exception)
467 STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception) 495 STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception)
468 STD_EXCEPTION_COMMON_IDLE(0xf00, performance_monitor, .performance_monitor_exception) 496 STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, .performance_monitor_exception)
469 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception) 497 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception)
470#ifdef CONFIG_ALTIVEC 498#ifdef CONFIG_ALTIVEC
471 STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception) 499 STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception)
@@ -482,6 +510,9 @@ machine_check_common:
482system_call_entry: 510system_call_entry:
483 b system_call_common 511 b system_call_common
484 512
513ppc64_runlatch_on_trampoline:
514 b .__ppc64_runlatch_on
515
485/* 516/*
486 * Here we have detected that the kernel stack pointer is bad. 517 * Here we have detected that the kernel stack pointer is bad.
487 * R9 contains the saved CR, r13 points to the paca, 518 * R9 contains the saved CR, r13 points to the paca,
@@ -555,6 +586,8 @@ data_access_common:
555 mfspr r10,SPRN_DSISR 586 mfspr r10,SPRN_DSISR
556 stw r10,PACA_EXGEN+EX_DSISR(r13) 587 stw r10,PACA_EXGEN+EX_DSISR(r13)
557 EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN) 588 EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN)
589 DISABLE_INTS
590 ld r12,_MSR(r1)
558 ld r3,PACA_EXGEN+EX_DAR(r13) 591 ld r3,PACA_EXGEN+EX_DAR(r13)
559 lwz r4,PACA_EXGEN+EX_DSISR(r13) 592 lwz r4,PACA_EXGEN+EX_DSISR(r13)
560 li r5,0x300 593 li r5,0x300
@@ -569,6 +602,7 @@ h_data_storage_common:
569 stw r10,PACA_EXGEN+EX_DSISR(r13) 602 stw r10,PACA_EXGEN+EX_DSISR(r13)
570 EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN) 603 EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN)
571 bl .save_nvgprs 604 bl .save_nvgprs
605 DISABLE_INTS
572 addi r3,r1,STACK_FRAME_OVERHEAD 606 addi r3,r1,STACK_FRAME_OVERHEAD
573 bl .unknown_exception 607 bl .unknown_exception
574 b .ret_from_except 608 b .ret_from_except
@@ -577,6 +611,8 @@ h_data_storage_common:
577 .globl instruction_access_common 611 .globl instruction_access_common
578instruction_access_common: 612instruction_access_common:
579 EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN) 613 EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN)
614 DISABLE_INTS
615 ld r12,_MSR(r1)
580 ld r3,_NIP(r1) 616 ld r3,_NIP(r1)
581 andis. r4,r12,0x5820 617 andis. r4,r12,0x5820
582 li r5,0x400 618 li r5,0x400
@@ -672,12 +708,6 @@ _GLOBAL(slb_miss_realmode)
672 ld r10,PACA_EXSLB+EX_LR(r13) 708 ld r10,PACA_EXSLB+EX_LR(r13)
673 ld r3,PACA_EXSLB+EX_R3(r13) 709 ld r3,PACA_EXSLB+EX_R3(r13)
674 lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */ 710 lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
675#ifdef CONFIG_PPC_ISERIES
676BEGIN_FW_FTR_SECTION
677 ld r11,PACALPPACAPTR(r13)
678 ld r11,LPPACASRR0(r11) /* get SRR0 value */
679END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
680#endif /* CONFIG_PPC_ISERIES */
681 711
682 mtlr r10 712 mtlr r10
683 713
@@ -690,12 +720,6 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
690 mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */ 720 mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */
691.machine pop 721.machine pop
692 722
693#ifdef CONFIG_PPC_ISERIES
694BEGIN_FW_FTR_SECTION
695 mtspr SPRN_SRR0,r11
696 mtspr SPRN_SRR1,r12
697END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
698#endif /* CONFIG_PPC_ISERIES */
699 ld r9,PACA_EXSLB+EX_R9(r13) 723 ld r9,PACA_EXSLB+EX_R9(r13)
700 ld r10,PACA_EXSLB+EX_R10(r13) 724 ld r10,PACA_EXSLB+EX_R10(r13)
701 ld r11,PACA_EXSLB+EX_R11(r13) 725 ld r11,PACA_EXSLB+EX_R11(r13)
@@ -704,13 +728,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
704 rfid 728 rfid
705 b . /* prevent speculative execution */ 729 b . /* prevent speculative execution */
706 730
7072: 7312: mfspr r11,SPRN_SRR0
708#ifdef CONFIG_PPC_ISERIES
709BEGIN_FW_FTR_SECTION
710 b unrecov_slb
711END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
712#endif /* CONFIG_PPC_ISERIES */
713 mfspr r11,SPRN_SRR0
714 ld r10,PACAKBASE(r13) 732 ld r10,PACAKBASE(r13)
715 LOAD_HANDLER(r10,unrecov_slb) 733 LOAD_HANDLER(r10,unrecov_slb)
716 mtspr SPRN_SRR0,r10 734 mtspr SPRN_SRR0,r10
@@ -727,20 +745,6 @@ unrecov_slb:
727 bl .unrecoverable_exception 745 bl .unrecoverable_exception
728 b 1b 746 b 1b
729 747
730 .align 7
731 .globl hardware_interrupt_common
732 .globl hardware_interrupt_entry
733hardware_interrupt_common:
734 EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN)
735 FINISH_NAP
736hardware_interrupt_entry:
737 DISABLE_INTS
738BEGIN_FTR_SECTION
739 bl .ppc64_runlatch_on
740END_FTR_SECTION_IFSET(CPU_FTR_CTRL)
741 addi r3,r1,STACK_FRAME_OVERHEAD
742 bl .do_IRQ
743 b .ret_from_except_lite
744 748
745#ifdef CONFIG_PPC_970_NAP 749#ifdef CONFIG_PPC_970_NAP
746power4_fixup_nap: 750power4_fixup_nap:
@@ -785,8 +789,8 @@ fp_unavailable_common:
785 EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN) 789 EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN)
786 bne 1f /* if from user, just load it up */ 790 bne 1f /* if from user, just load it up */
787 bl .save_nvgprs 791 bl .save_nvgprs
792 DISABLE_INTS
788 addi r3,r1,STACK_FRAME_OVERHEAD 793 addi r3,r1,STACK_FRAME_OVERHEAD
789 ENABLE_INTS
790 bl .kernel_fp_unavailable_exception 794 bl .kernel_fp_unavailable_exception
791 BUG_OPCODE 795 BUG_OPCODE
7921: bl .load_up_fpu 7961: bl .load_up_fpu
@@ -805,8 +809,8 @@ BEGIN_FTR_SECTION
805END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 809END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
806#endif 810#endif
807 bl .save_nvgprs 811 bl .save_nvgprs
812 DISABLE_INTS
808 addi r3,r1,STACK_FRAME_OVERHEAD 813 addi r3,r1,STACK_FRAME_OVERHEAD
809 ENABLE_INTS
810 bl .altivec_unavailable_exception 814 bl .altivec_unavailable_exception
811 b .ret_from_except 815 b .ret_from_except
812 816
@@ -816,13 +820,14 @@ vsx_unavailable_common:
816 EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN) 820 EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN)
817#ifdef CONFIG_VSX 821#ifdef CONFIG_VSX
818BEGIN_FTR_SECTION 822BEGIN_FTR_SECTION
819 bne .load_up_vsx 823 beq 1f
824 b .load_up_vsx
8201: 8251:
821END_FTR_SECTION_IFSET(CPU_FTR_VSX) 826END_FTR_SECTION_IFSET(CPU_FTR_VSX)
822#endif 827#endif
823 bl .save_nvgprs 828 bl .save_nvgprs
829 DISABLE_INTS
824 addi r3,r1,STACK_FRAME_OVERHEAD 830 addi r3,r1,STACK_FRAME_OVERHEAD
825 ENABLE_INTS
826 bl .vsx_unavailable_exception 831 bl .vsx_unavailable_exception
827 b .ret_from_except 832 b .ret_from_except
828 833
@@ -831,66 +836,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
831__end_handlers: 836__end_handlers:
832 837
833/* 838/*
834 * Return from an exception with minimal checks.
835 * The caller is assumed to have done EXCEPTION_PROLOG_COMMON.
836 * If interrupts have been enabled, or anything has been
837 * done that might have changed the scheduling status of
838 * any task or sent any task a signal, you should use
839 * ret_from_except or ret_from_except_lite instead of this.
840 */
841fast_exc_return_irq: /* restores irq state too */
842 ld r3,SOFTE(r1)
843 TRACE_AND_RESTORE_IRQ(r3);
844 ld r12,_MSR(r1)
845 rldicl r4,r12,49,63 /* get MSR_EE to LSB */
846 stb r4,PACAHARDIRQEN(r13) /* restore paca->hard_enabled */
847 b 1f
848
849 .globl fast_exception_return
850fast_exception_return:
851 ld r12,_MSR(r1)
8521: ld r11,_NIP(r1)
853 andi. r3,r12,MSR_RI /* check if RI is set */
854 beq- unrecov_fer
855
856#ifdef CONFIG_VIRT_CPU_ACCOUNTING
857 andi. r3,r12,MSR_PR
858 beq 2f
859 ACCOUNT_CPU_USER_EXIT(r3, r4)
8602:
861#endif
862
863 ld r3,_CCR(r1)
864 ld r4,_LINK(r1)
865 ld r5,_CTR(r1)
866 ld r6,_XER(r1)
867 mtcr r3
868 mtlr r4
869 mtctr r5
870 mtxer r6
871 REST_GPR(0, r1)
872 REST_8GPRS(2, r1)
873
874 mfmsr r10
875 rldicl r10,r10,48,1 /* clear EE */
876 rldicr r10,r10,16,61 /* clear RI (LE is 0 already) */
877 mtmsrd r10,1
878
879 mtspr SPRN_SRR1,r12
880 mtspr SPRN_SRR0,r11
881 REST_4GPRS(10, r1)
882 ld r1,GPR1(r1)
883 rfid
884 b . /* prevent speculative execution */
885
886unrecov_fer:
887 bl .save_nvgprs
8881: addi r3,r1,STACK_FRAME_OVERHEAD
889 bl .unrecoverable_exception
890 b 1b
891
892
893/*
894 * Hash table stuff 839 * Hash table stuff
895 */ 840 */
896 .align 7 841 .align 7
@@ -912,28 +857,6 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
912 lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ 857 lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */
913 andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ 858 andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */
914 bne 77f /* then don't call hash_page now */ 859 bne 77f /* then don't call hash_page now */
915
916 /*
917 * On iSeries, we soft-disable interrupts here, then
918 * hard-enable interrupts so that the hash_page code can spin on
919 * the hash_table_lock without problems on a shared processor.
920 */
921 DISABLE_INTS
922
923 /*
924 * Currently, trace_hardirqs_off() will be called by DISABLE_INTS
925 * and will clobber volatile registers when irq tracing is enabled
926 * so we need to reload them. It may be possible to be smarter here
927 * and move the irq tracing elsewhere but let's keep it simple for
928 * now
929 */
930#ifdef CONFIG_TRACE_IRQFLAGS
931 ld r3,_DAR(r1)
932 ld r4,_DSISR(r1)
933 ld r5,_TRAP(r1)
934 ld r12,_MSR(r1)
935 clrrdi r5,r5,4
936#endif /* CONFIG_TRACE_IRQFLAGS */
937 /* 860 /*
938 * We need to set the _PAGE_USER bit if MSR_PR is set or if we are 861 * We need to set the _PAGE_USER bit if MSR_PR is set or if we are
939 * accessing a userspace segment (even from the kernel). We assume 862 * accessing a userspace segment (even from the kernel). We assume
@@ -951,62 +874,25 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
951 * r4 contains the required access permissions 874 * r4 contains the required access permissions
952 * r5 contains the trap number 875 * r5 contains the trap number
953 * 876 *
954 * at return r3 = 0 for success 877 * at return r3 = 0 for success, 1 for page fault, negative for error
955 */ 878 */
956 bl .hash_page /* build HPTE if possible */ 879 bl .hash_page /* build HPTE if possible */
957 cmpdi r3,0 /* see if hash_page succeeded */ 880 cmpdi r3,0 /* see if hash_page succeeded */
958 881
959BEGIN_FW_FTR_SECTION 882 /* Success */
960 /*
961 * If we had interrupts soft-enabled at the point where the
962 * DSI/ISI occurred, and an interrupt came in during hash_page,
963 * handle it now.
964 * We jump to ret_from_except_lite rather than fast_exception_return
965 * because ret_from_except_lite will check for and handle pending
966 * interrupts if necessary.
967 */
968 beq 13f
969END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
970
971BEGIN_FW_FTR_SECTION
972 /*
973 * Here we have interrupts hard-disabled, so it is sufficient
974 * to restore paca->{soft,hard}_enable and get out.
975 */
976 beq fast_exc_return_irq /* Return from exception on success */ 883 beq fast_exc_return_irq /* Return from exception on success */
977END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES)
978
979 /* For a hash failure, we don't bother re-enabling interrupts */
980 ble- 12f
981
982 /*
983 * hash_page couldn't handle it, set soft interrupt enable back
984 * to what it was before the trap. Note that .arch_local_irq_restore
985 * handles any interrupts pending at this point.
986 */
987 ld r3,SOFTE(r1)
988 TRACE_AND_RESTORE_IRQ_PARTIAL(r3, 11f)
989 bl .arch_local_irq_restore
990 b 11f
991 884
992/* We have a data breakpoint exception - handle it */ 885 /* Error */
993handle_dabr_fault: 886 blt- 13f
994 bl .save_nvgprs
995 ld r4,_DAR(r1)
996 ld r5,_DSISR(r1)
997 addi r3,r1,STACK_FRAME_OVERHEAD
998 bl .do_dabr
999 b .ret_from_except_lite
1000 887
1001/* Here we have a page fault that hash_page can't handle. */ 888/* Here we have a page fault that hash_page can't handle. */
1002handle_page_fault: 889handle_page_fault:
1003 ENABLE_INTS
100411: ld r4,_DAR(r1) 89011: ld r4,_DAR(r1)
1005 ld r5,_DSISR(r1) 891 ld r5,_DSISR(r1)
1006 addi r3,r1,STACK_FRAME_OVERHEAD 892 addi r3,r1,STACK_FRAME_OVERHEAD
1007 bl .do_page_fault 893 bl .do_page_fault
1008 cmpdi r3,0 894 cmpdi r3,0
1009 beq+ 13f 895 beq+ 12f
1010 bl .save_nvgprs 896 bl .save_nvgprs
1011 mr r5,r3 897 mr r5,r3
1012 addi r3,r1,STACK_FRAME_OVERHEAD 898 addi r3,r1,STACK_FRAME_OVERHEAD
@@ -1014,12 +900,20 @@ handle_page_fault:
1014 bl .bad_page_fault 900 bl .bad_page_fault
1015 b .ret_from_except 901 b .ret_from_except
1016 902
101713: b .ret_from_except_lite 903/* We have a data breakpoint exception - handle it */
904handle_dabr_fault:
905 bl .save_nvgprs
906 ld r4,_DAR(r1)
907 ld r5,_DSISR(r1)
908 addi r3,r1,STACK_FRAME_OVERHEAD
909 bl .do_dabr
91012: b .ret_from_except_lite
911
1018 912
1019/* We have a page fault that hash_page could handle but HV refused 913/* We have a page fault that hash_page could handle but HV refused
1020 * the PTE insertion 914 * the PTE insertion
1021 */ 915 */
102212: bl .save_nvgprs 91613: bl .save_nvgprs
1023 mr r5,r3 917 mr r5,r3
1024 addi r3,r1,STACK_FRAME_OVERHEAD 918 addi r3,r1,STACK_FRAME_OVERHEAD
1025 ld r4,_DAR(r1) 919 ld r4,_DAR(r1)
@@ -1141,51 +1035,19 @@ _GLOBAL(do_stab_bolted)
1141 .= 0x7000 1035 .= 0x7000
1142 .globl fwnmi_data_area 1036 .globl fwnmi_data_area
1143fwnmi_data_area: 1037fwnmi_data_area:
1144#endif /* defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */
1145 1038
1146 /* iSeries does not use the FWNMI stuff, so it is safe to put
1147 * this here, even if we later allow kernels that will boot on
1148 * both pSeries and iSeries */
1149#ifdef CONFIG_PPC_ISERIES
1150 . = LPARMAP_PHYS
1151 .globl xLparMap
1152xLparMap:
1153 .quad HvEsidsToMap /* xNumberEsids */
1154 .quad HvRangesToMap /* xNumberRanges */
1155 .quad STAB0_PAGE /* xSegmentTableOffs */
1156 .zero 40 /* xRsvd */
1157 /* xEsids (HvEsidsToMap entries of 2 quads) */
1158 .quad PAGE_OFFSET_ESID /* xKernelEsid */
1159 .quad PAGE_OFFSET_VSID /* xKernelVsid */
1160 .quad VMALLOC_START_ESID /* xKernelEsid */
1161 .quad VMALLOC_START_VSID /* xKernelVsid */
1162 /* xRanges (HvRangesToMap entries of 3 quads) */
1163 .quad HvPagesToMap /* xPages */
1164 .quad 0 /* xOffset */
1165 .quad PAGE_OFFSET_VSID << (SID_SHIFT - HW_PAGE_SHIFT) /* xVPN */
1166
1167#endif /* CONFIG_PPC_ISERIES */
1168
1169#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
1170 /* pseries and powernv need to keep the whole page from 1039 /* pseries and powernv need to keep the whole page from
1171 * 0x7000 to 0x8000 free for use by the firmware 1040 * 0x7000 to 0x8000 free for use by the firmware
1172 */ 1041 */
1173 . = 0x8000 1042 . = 0x8000
1174#endif /* defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */ 1043#endif /* defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */
1175 1044
1176/* 1045/* Space for CPU0's segment table */
1177 * Space for CPU0's segment table. 1046 .balign 4096
1178 *
1179 * On iSeries, the hypervisor must fill in at least one entry before
1180 * we get control (with relocate on). The address is given to the hv
1181 * as a page number (see xLparMap above), so this must be at a
1182 * fixed address (the linker can't compute (u64)&initial_stab >>
1183 * PAGE_SHIFT).
1184 */
1185 . = STAB0_OFFSET /* 0x8000 */
1186 .globl initial_stab 1047 .globl initial_stab
1187initial_stab: 1048initial_stab:
1188 .space 4096 1049 .space 4096
1050
1189#ifdef CONFIG_PPC_POWERNV 1051#ifdef CONFIG_PPC_POWERNV
1190_GLOBAL(opal_mc_secondary_handler) 1052_GLOBAL(opal_mc_secondary_handler)
1191 HMT_MEDIUM 1053 HMT_MEDIUM
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
new file mode 100644
index 00000000000..cfe7a38708c
--- /dev/null
+++ b/arch/powerpc/kernel/fadump.c
@@ -0,0 +1,1315 @@
1/*
2 * Firmware Assisted dump: A robust mechanism to get reliable kernel crash
3 * dump with assistance from firmware. This approach does not use kexec,
4 * instead firmware assists in booting the kdump kernel while preserving
5 * memory contents. The most of the code implementation has been adapted
6 * from phyp assisted dump implementation written by Linas Vepstas and
7 * Manish Ahuja
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 *
23 * Copyright 2011 IBM Corporation
24 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
25 */
26
27#undef DEBUG
28#define pr_fmt(fmt) "fadump: " fmt
29
30#include <linux/string.h>
31#include <linux/memblock.h>
32#include <linux/delay.h>
33#include <linux/debugfs.h>
34#include <linux/seq_file.h>
35#include <linux/crash_dump.h>
36#include <linux/kobject.h>
37#include <linux/sysfs.h>
38
39#include <asm/page.h>
40#include <asm/prom.h>
41#include <asm/rtas.h>
42#include <asm/fadump.h>
43
44static struct fw_dump fw_dump;
45static struct fadump_mem_struct fdm;
46static const struct fadump_mem_struct *fdm_active;
47
48static DEFINE_MUTEX(fadump_mutex);
49struct fad_crash_memory_ranges crash_memory_ranges[INIT_CRASHMEM_RANGES];
50int crash_mem_ranges;
51
52/* Scan the Firmware Assisted dump configuration details. */
53int __init early_init_dt_scan_fw_dump(unsigned long node,
54 const char *uname, int depth, void *data)
55{
56 __be32 *sections;
57 int i, num_sections;
58 unsigned long size;
59 const int *token;
60
61 if (depth != 1 || strcmp(uname, "rtas") != 0)
62 return 0;
63
64 /*
65 * Check if Firmware Assisted dump is supported. if yes, check
66 * if dump has been initiated on last reboot.
67 */
68 token = of_get_flat_dt_prop(node, "ibm,configure-kernel-dump", NULL);
69 if (!token)
70 return 0;
71
72 fw_dump.fadump_supported = 1;
73 fw_dump.ibm_configure_kernel_dump = *token;
74
75 /*
76 * The 'ibm,kernel-dump' rtas node is present only if there is
77 * dump data waiting for us.
78 */
79 fdm_active = of_get_flat_dt_prop(node, "ibm,kernel-dump", NULL);
80 if (fdm_active)
81 fw_dump.dump_active = 1;
82
83 /* Get the sizes required to store dump data for the firmware provided
84 * dump sections.
85 * For each dump section type supported, a 32bit cell which defines
86 * the ID of a supported section followed by two 32 bit cells which
87 * gives teh size of the section in bytes.
88 */
89 sections = of_get_flat_dt_prop(node, "ibm,configure-kernel-dump-sizes",
90 &size);
91
92 if (!sections)
93 return 0;
94
95 num_sections = size / (3 * sizeof(u32));
96
97 for (i = 0; i < num_sections; i++, sections += 3) {
98 u32 type = (u32)of_read_number(sections, 1);
99
100 switch (type) {
101 case FADUMP_CPU_STATE_DATA:
102 fw_dump.cpu_state_data_size =
103 of_read_ulong(&sections[1], 2);
104 break;
105 case FADUMP_HPTE_REGION:
106 fw_dump.hpte_region_size =
107 of_read_ulong(&sections[1], 2);
108 break;
109 }
110 }
111 return 1;
112}
113
114int is_fadump_active(void)
115{
116 return fw_dump.dump_active;
117}
118
119/* Print firmware assisted dump configurations for debugging purpose. */
120static void fadump_show_config(void)
121{
122 pr_debug("Support for firmware-assisted dump (fadump): %s\n",
123 (fw_dump.fadump_supported ? "present" : "no support"));
124
125 if (!fw_dump.fadump_supported)
126 return;
127
128 pr_debug("Fadump enabled : %s\n",
129 (fw_dump.fadump_enabled ? "yes" : "no"));
130 pr_debug("Dump Active : %s\n",
131 (fw_dump.dump_active ? "yes" : "no"));
132 pr_debug("Dump section sizes:\n");
133 pr_debug(" CPU state data size: %lx\n", fw_dump.cpu_state_data_size);
134 pr_debug(" HPTE region size : %lx\n", fw_dump.hpte_region_size);
135 pr_debug("Boot memory size : %lx\n", fw_dump.boot_memory_size);
136}
137
138static unsigned long init_fadump_mem_struct(struct fadump_mem_struct *fdm,
139 unsigned long addr)
140{
141 if (!fdm)
142 return 0;
143
144 memset(fdm, 0, sizeof(struct fadump_mem_struct));
145 addr = addr & PAGE_MASK;
146
147 fdm->header.dump_format_version = 0x00000001;
148 fdm->header.dump_num_sections = 3;
149 fdm->header.dump_status_flag = 0;
150 fdm->header.offset_first_dump_section =
151 (u32)offsetof(struct fadump_mem_struct, cpu_state_data);
152
153 /*
154 * Fields for disk dump option.
155 * We are not using disk dump option, hence set these fields to 0.
156 */
157 fdm->header.dd_block_size = 0;
158 fdm->header.dd_block_offset = 0;
159 fdm->header.dd_num_blocks = 0;
160 fdm->header.dd_offset_disk_path = 0;
161
162 /* set 0 to disable an automatic dump-reboot. */
163 fdm->header.max_time_auto = 0;
164
165 /* Kernel dump sections */
166 /* cpu state data section. */
167 fdm->cpu_state_data.request_flag = FADUMP_REQUEST_FLAG;
168 fdm->cpu_state_data.source_data_type = FADUMP_CPU_STATE_DATA;
169 fdm->cpu_state_data.source_address = 0;
170 fdm->cpu_state_data.source_len = fw_dump.cpu_state_data_size;
171 fdm->cpu_state_data.destination_address = addr;
172 addr += fw_dump.cpu_state_data_size;
173
174 /* hpte region section */
175 fdm->hpte_region.request_flag = FADUMP_REQUEST_FLAG;
176 fdm->hpte_region.source_data_type = FADUMP_HPTE_REGION;
177 fdm->hpte_region.source_address = 0;
178 fdm->hpte_region.source_len = fw_dump.hpte_region_size;
179 fdm->hpte_region.destination_address = addr;
180 addr += fw_dump.hpte_region_size;
181
182 /* RMA region section */
183 fdm->rmr_region.request_flag = FADUMP_REQUEST_FLAG;
184 fdm->rmr_region.source_data_type = FADUMP_REAL_MODE_REGION;
185 fdm->rmr_region.source_address = RMA_START;
186 fdm->rmr_region.source_len = fw_dump.boot_memory_size;
187 fdm->rmr_region.destination_address = addr;
188 addr += fw_dump.boot_memory_size;
189
190 return addr;
191}
192
193/**
194 * fadump_calculate_reserve_size(): reserve variable boot area 5% of System RAM
195 *
196 * Function to find the largest memory size we need to reserve during early
197 * boot process. This will be the size of the memory that is required for a
198 * kernel to boot successfully.
199 *
200 * This function has been taken from phyp-assisted dump feature implementation.
201 *
202 * returns larger of 256MB or 5% rounded down to multiples of 256MB.
203 *
204 * TODO: Come up with better approach to find out more accurate memory size
205 * that is required for a kernel to boot successfully.
206 *
207 */
208static inline unsigned long fadump_calculate_reserve_size(void)
209{
210 unsigned long size;
211
212 /*
213 * Check if the size is specified through fadump_reserve_mem= cmdline
214 * option. If yes, then use that.
215 */
216 if (fw_dump.reserve_bootvar)
217 return fw_dump.reserve_bootvar;
218
219 /* divide by 20 to get 5% of value */
220 size = memblock_end_of_DRAM() / 20;
221
222 /* round it down in multiples of 256 */
223 size = size & ~0x0FFFFFFFUL;
224
225 /* Truncate to memory_limit. We don't want to over reserve the memory.*/
226 if (memory_limit && size > memory_limit)
227 size = memory_limit;
228
229 return (size > MIN_BOOT_MEM ? size : MIN_BOOT_MEM);
230}
231
232/*
233 * Calculate the total memory size required to be reserved for
234 * firmware-assisted dump registration.
235 */
236static unsigned long get_fadump_area_size(void)
237{
238 unsigned long size = 0;
239
240 size += fw_dump.cpu_state_data_size;
241 size += fw_dump.hpte_region_size;
242 size += fw_dump.boot_memory_size;
243 size += sizeof(struct fadump_crash_info_header);
244 size += sizeof(struct elfhdr); /* ELF core header.*/
245 size += sizeof(struct elf_phdr); /* place holder for cpu notes */
246 /* Program headers for crash memory regions. */
247 size += sizeof(struct elf_phdr) * (memblock_num_regions(memory) + 2);
248
249 size = PAGE_ALIGN(size);
250 return size;
251}
252
253int __init fadump_reserve_mem(void)
254{
255 unsigned long base, size, memory_boundary;
256
257 if (!fw_dump.fadump_enabled)
258 return 0;
259
260 if (!fw_dump.fadump_supported) {
261 printk(KERN_INFO "Firmware-assisted dump is not supported on"
262 " this hardware\n");
263 fw_dump.fadump_enabled = 0;
264 return 0;
265 }
266 /*
267 * Initialize boot memory size
268 * If dump is active then we have already calculated the size during
269 * first kernel.
270 */
271 if (fdm_active)
272 fw_dump.boot_memory_size = fdm_active->rmr_region.source_len;
273 else
274 fw_dump.boot_memory_size = fadump_calculate_reserve_size();
275
276 /*
277 * Calculate the memory boundary.
278 * If memory_limit is less than actual memory boundary then reserve
279 * the memory for fadump beyond the memory_limit and adjust the
280 * memory_limit accordingly, so that the running kernel can run with
281 * specified memory_limit.
282 */
283 if (memory_limit && memory_limit < memblock_end_of_DRAM()) {
284 size = get_fadump_area_size();
285 if ((memory_limit + size) < memblock_end_of_DRAM())
286 memory_limit += size;
287 else
288 memory_limit = memblock_end_of_DRAM();
289 printk(KERN_INFO "Adjusted memory_limit for firmware-assisted"
290 " dump, now %#016llx\n",
291 (unsigned long long)memory_limit);
292 }
293 if (memory_limit)
294 memory_boundary = memory_limit;
295 else
296 memory_boundary = memblock_end_of_DRAM();
297
298 if (fw_dump.dump_active) {
299 printk(KERN_INFO "Firmware-assisted dump is active.\n");
300 /*
301 * If last boot has crashed then reserve all the memory
302 * above boot_memory_size so that we don't touch it until
303 * dump is written to disk by userspace tool. This memory
304 * will be released for general use once the dump is saved.
305 */
306 base = fw_dump.boot_memory_size;
307 size = memory_boundary - base;
308 memblock_reserve(base, size);
309 printk(KERN_INFO "Reserved %ldMB of memory at %ldMB "
310 "for saving crash dump\n",
311 (unsigned long)(size >> 20),
312 (unsigned long)(base >> 20));
313
314 fw_dump.fadumphdr_addr =
315 fdm_active->rmr_region.destination_address +
316 fdm_active->rmr_region.source_len;
317 pr_debug("fadumphdr_addr = %p\n",
318 (void *) fw_dump.fadumphdr_addr);
319 } else {
320 /* Reserve the memory at the top of memory. */
321 size = get_fadump_area_size();
322 base = memory_boundary - size;
323 memblock_reserve(base, size);
324 printk(KERN_INFO "Reserved %ldMB of memory at %ldMB "
325 "for firmware-assisted dump\n",
326 (unsigned long)(size >> 20),
327 (unsigned long)(base >> 20));
328 }
329 fw_dump.reserve_dump_area_start = base;
330 fw_dump.reserve_dump_area_size = size;
331 return 1;
332}
333
334/* Look for fadump= cmdline option. */
335static int __init early_fadump_param(char *p)
336{
337 if (!p)
338 return 1;
339
340 if (strncmp(p, "on", 2) == 0)
341 fw_dump.fadump_enabled = 1;
342 else if (strncmp(p, "off", 3) == 0)
343 fw_dump.fadump_enabled = 0;
344
345 return 0;
346}
347early_param("fadump", early_fadump_param);
348
349/* Look for fadump_reserve_mem= cmdline option */
350static int __init early_fadump_reserve_mem(char *p)
351{
352 if (p)
353 fw_dump.reserve_bootvar = memparse(p, &p);
354 return 0;
355}
356early_param("fadump_reserve_mem", early_fadump_reserve_mem);
357
358static void register_fw_dump(struct fadump_mem_struct *fdm)
359{
360 int rc;
361 unsigned int wait_time;
362
363 pr_debug("Registering for firmware-assisted kernel dump...\n");
364
365 /* TODO: Add upper time limit for the delay */
366 do {
367 rc = rtas_call(fw_dump.ibm_configure_kernel_dump, 3, 1, NULL,
368 FADUMP_REGISTER, fdm,
369 sizeof(struct fadump_mem_struct));
370
371 wait_time = rtas_busy_delay_time(rc);
372 if (wait_time)
373 mdelay(wait_time);
374
375 } while (wait_time);
376
377 switch (rc) {
378 case -1:
379 printk(KERN_ERR "Failed to register firmware-assisted kernel"
380 " dump. Hardware Error(%d).\n", rc);
381 break;
382 case -3:
383 printk(KERN_ERR "Failed to register firmware-assisted kernel"
384 " dump. Parameter Error(%d).\n", rc);
385 break;
386 case -9:
387 printk(KERN_ERR "firmware-assisted kernel dump is already "
388 " registered.");
389 fw_dump.dump_registered = 1;
390 break;
391 case 0:
392 printk(KERN_INFO "firmware-assisted kernel dump registration"
393 " is successful\n");
394 fw_dump.dump_registered = 1;
395 break;
396 }
397}
398
399void crash_fadump(struct pt_regs *regs, const char *str)
400{
401 struct fadump_crash_info_header *fdh = NULL;
402
403 if (!fw_dump.dump_registered || !fw_dump.fadumphdr_addr)
404 return;
405
406 fdh = __va(fw_dump.fadumphdr_addr);
407 crashing_cpu = smp_processor_id();
408 fdh->crashing_cpu = crashing_cpu;
409 crash_save_vmcoreinfo();
410
411 if (regs)
412 fdh->regs = *regs;
413 else
414 ppc_save_regs(&fdh->regs);
415
416 fdh->cpu_online_mask = *cpu_online_mask;
417
418 /* Call ibm,os-term rtas call to trigger firmware assisted dump */
419 rtas_os_term((char *)str);
420}
421
422#define GPR_MASK 0xffffff0000000000
423static inline int fadump_gpr_index(u64 id)
424{
425 int i = -1;
426 char str[3];
427
428 if ((id & GPR_MASK) == REG_ID("GPR")) {
429 /* get the digits at the end */
430 id &= ~GPR_MASK;
431 id >>= 24;
432 str[2] = '\0';
433 str[1] = id & 0xff;
434 str[0] = (id >> 8) & 0xff;
435 sscanf(str, "%d", &i);
436 if (i > 31)
437 i = -1;
438 }
439 return i;
440}
441
442static inline void fadump_set_regval(struct pt_regs *regs, u64 reg_id,
443 u64 reg_val)
444{
445 int i;
446
447 i = fadump_gpr_index(reg_id);
448 if (i >= 0)
449 regs->gpr[i] = (unsigned long)reg_val;
450 else if (reg_id == REG_ID("NIA"))
451 regs->nip = (unsigned long)reg_val;
452 else if (reg_id == REG_ID("MSR"))
453 regs->msr = (unsigned long)reg_val;
454 else if (reg_id == REG_ID("CTR"))
455 regs->ctr = (unsigned long)reg_val;
456 else if (reg_id == REG_ID("LR"))
457 regs->link = (unsigned long)reg_val;
458 else if (reg_id == REG_ID("XER"))
459 regs->xer = (unsigned long)reg_val;
460 else if (reg_id == REG_ID("CR"))
461 regs->ccr = (unsigned long)reg_val;
462 else if (reg_id == REG_ID("DAR"))
463 regs->dar = (unsigned long)reg_val;
464 else if (reg_id == REG_ID("DSISR"))
465 regs->dsisr = (unsigned long)reg_val;
466}
467
468static struct fadump_reg_entry*
469fadump_read_registers(struct fadump_reg_entry *reg_entry, struct pt_regs *regs)
470{
471 memset(regs, 0, sizeof(struct pt_regs));
472
473 while (reg_entry->reg_id != REG_ID("CPUEND")) {
474 fadump_set_regval(regs, reg_entry->reg_id,
475 reg_entry->reg_value);
476 reg_entry++;
477 }
478 reg_entry++;
479 return reg_entry;
480}
481
482static u32 *fadump_append_elf_note(u32 *buf, char *name, unsigned type,
483 void *data, size_t data_len)
484{
485 struct elf_note note;
486
487 note.n_namesz = strlen(name) + 1;
488 note.n_descsz = data_len;
489 note.n_type = type;
490 memcpy(buf, &note, sizeof(note));
491 buf += (sizeof(note) + 3)/4;
492 memcpy(buf, name, note.n_namesz);
493 buf += (note.n_namesz + 3)/4;
494 memcpy(buf, data, note.n_descsz);
495 buf += (note.n_descsz + 3)/4;
496
497 return buf;
498}
499
500static void fadump_final_note(u32 *buf)
501{
502 struct elf_note note;
503
504 note.n_namesz = 0;
505 note.n_descsz = 0;
506 note.n_type = 0;
507 memcpy(buf, &note, sizeof(note));
508}
509
510static u32 *fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs)
511{
512 struct elf_prstatus prstatus;
513
514 memset(&prstatus, 0, sizeof(prstatus));
515 /*
516 * FIXME: How do i get PID? Do I really need it?
517 * prstatus.pr_pid = ????
518 */
519 elf_core_copy_kernel_regs(&prstatus.pr_reg, regs);
520 buf = fadump_append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS,
521 &prstatus, sizeof(prstatus));
522 return buf;
523}
524
525static void fadump_update_elfcore_header(char *bufp)
526{
527 struct elfhdr *elf;
528 struct elf_phdr *phdr;
529
530 elf = (struct elfhdr *)bufp;
531 bufp += sizeof(struct elfhdr);
532
533 /* First note is a place holder for cpu notes info. */
534 phdr = (struct elf_phdr *)bufp;
535
536 if (phdr->p_type == PT_NOTE) {
537 phdr->p_paddr = fw_dump.cpu_notes_buf;
538 phdr->p_offset = phdr->p_paddr;
539 phdr->p_filesz = fw_dump.cpu_notes_buf_size;
540 phdr->p_memsz = fw_dump.cpu_notes_buf_size;
541 }
542 return;
543}
544
545static void *fadump_cpu_notes_buf_alloc(unsigned long size)
546{
547 void *vaddr;
548 struct page *page;
549 unsigned long order, count, i;
550
551 order = get_order(size);
552 vaddr = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, order);
553 if (!vaddr)
554 return NULL;
555
556 count = 1 << order;
557 page = virt_to_page(vaddr);
558 for (i = 0; i < count; i++)
559 SetPageReserved(page + i);
560 return vaddr;
561}
562
563static void fadump_cpu_notes_buf_free(unsigned long vaddr, unsigned long size)
564{
565 struct page *page;
566 unsigned long order, count, i;
567
568 order = get_order(size);
569 count = 1 << order;
570 page = virt_to_page(vaddr);
571 for (i = 0; i < count; i++)
572 ClearPageReserved(page + i);
573 __free_pages(page, order);
574}
575
576/*
577 * Read CPU state dump data and convert it into ELF notes.
578 * The CPU dump starts with magic number "REGSAVE". NumCpusOffset should be
579 * used to access the data to allow for additional fields to be added without
580 * affecting compatibility. Each list of registers for a CPU starts with
581 * "CPUSTRT" and ends with "CPUEND". Each register entry is of 16 bytes,
582 * 8 Byte ASCII identifier and 8 Byte register value. The register entry
583 * with identifier "CPUSTRT" and "CPUEND" contains 4 byte cpu id as part
584 * of register value. For more details refer to PAPR document.
585 *
586 * Only for the crashing cpu we ignore the CPU dump data and get exact
587 * state from fadump crash info structure populated by first kernel at the
588 * time of crash.
589 */
590static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm)
591{
592 struct fadump_reg_save_area_header *reg_header;
593 struct fadump_reg_entry *reg_entry;
594 struct fadump_crash_info_header *fdh = NULL;
595 void *vaddr;
596 unsigned long addr;
597 u32 num_cpus, *note_buf;
598 struct pt_regs regs;
599 int i, rc = 0, cpu = 0;
600
601 if (!fdm->cpu_state_data.bytes_dumped)
602 return -EINVAL;
603
604 addr = fdm->cpu_state_data.destination_address;
605 vaddr = __va(addr);
606
607 reg_header = vaddr;
608 if (reg_header->magic_number != REGSAVE_AREA_MAGIC) {
609 printk(KERN_ERR "Unable to read register save area.\n");
610 return -ENOENT;
611 }
612 pr_debug("--------CPU State Data------------\n");
613 pr_debug("Magic Number: %llx\n", reg_header->magic_number);
614 pr_debug("NumCpuOffset: %x\n", reg_header->num_cpu_offset);
615
616 vaddr += reg_header->num_cpu_offset;
617 num_cpus = *((u32 *)(vaddr));
618 pr_debug("NumCpus : %u\n", num_cpus);
619 vaddr += sizeof(u32);
620 reg_entry = (struct fadump_reg_entry *)vaddr;
621
622 /* Allocate buffer to hold cpu crash notes. */
623 fw_dump.cpu_notes_buf_size = num_cpus * sizeof(note_buf_t);
624 fw_dump.cpu_notes_buf_size = PAGE_ALIGN(fw_dump.cpu_notes_buf_size);
625 note_buf = fadump_cpu_notes_buf_alloc(fw_dump.cpu_notes_buf_size);
626 if (!note_buf) {
627 printk(KERN_ERR "Failed to allocate 0x%lx bytes for "
628 "cpu notes buffer\n", fw_dump.cpu_notes_buf_size);
629 return -ENOMEM;
630 }
631 fw_dump.cpu_notes_buf = __pa(note_buf);
632
633 pr_debug("Allocated buffer for cpu notes of size %ld at %p\n",
634 (num_cpus * sizeof(note_buf_t)), note_buf);
635
636 if (fw_dump.fadumphdr_addr)
637 fdh = __va(fw_dump.fadumphdr_addr);
638
639 for (i = 0; i < num_cpus; i++) {
640 if (reg_entry->reg_id != REG_ID("CPUSTRT")) {
641 printk(KERN_ERR "Unable to read CPU state data\n");
642 rc = -ENOENT;
643 goto error_out;
644 }
645 /* Lower 4 bytes of reg_value contains logical cpu id */
646 cpu = reg_entry->reg_value & FADUMP_CPU_ID_MASK;
647 if (!cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) {
648 SKIP_TO_NEXT_CPU(reg_entry);
649 continue;
650 }
651 pr_debug("Reading register data for cpu %d...\n", cpu);
652 if (fdh && fdh->crashing_cpu == cpu) {
653 regs = fdh->regs;
654 note_buf = fadump_regs_to_elf_notes(note_buf, &regs);
655 SKIP_TO_NEXT_CPU(reg_entry);
656 } else {
657 reg_entry++;
658 reg_entry = fadump_read_registers(reg_entry, &regs);
659 note_buf = fadump_regs_to_elf_notes(note_buf, &regs);
660 }
661 }
662 fadump_final_note(note_buf);
663
664 pr_debug("Updating elfcore header (%llx) with cpu notes\n",
665 fdh->elfcorehdr_addr);
666 fadump_update_elfcore_header((char *)__va(fdh->elfcorehdr_addr));
667 return 0;
668
669error_out:
670 fadump_cpu_notes_buf_free((unsigned long)__va(fw_dump.cpu_notes_buf),
671 fw_dump.cpu_notes_buf_size);
672 fw_dump.cpu_notes_buf = 0;
673 fw_dump.cpu_notes_buf_size = 0;
674 return rc;
675
676}
677
678/*
679 * Validate and process the dump data stored by firmware before exporting
680 * it through '/proc/vmcore'.
681 */
682static int __init process_fadump(const struct fadump_mem_struct *fdm_active)
683{
684 struct fadump_crash_info_header *fdh;
685 int rc = 0;
686
687 if (!fdm_active || !fw_dump.fadumphdr_addr)
688 return -EINVAL;
689
690 /* Check if the dump data is valid. */
691 if ((fdm_active->header.dump_status_flag == FADUMP_ERROR_FLAG) ||
692 (fdm_active->cpu_state_data.error_flags != 0) ||
693 (fdm_active->rmr_region.error_flags != 0)) {
694 printk(KERN_ERR "Dump taken by platform is not valid\n");
695 return -EINVAL;
696 }
697 if ((fdm_active->rmr_region.bytes_dumped !=
698 fdm_active->rmr_region.source_len) ||
699 !fdm_active->cpu_state_data.bytes_dumped) {
700 printk(KERN_ERR "Dump taken by platform is incomplete\n");
701 return -EINVAL;
702 }
703
704 /* Validate the fadump crash info header */
705 fdh = __va(fw_dump.fadumphdr_addr);
706 if (fdh->magic_number != FADUMP_CRASH_INFO_MAGIC) {
707 printk(KERN_ERR "Crash info header is not valid.\n");
708 return -EINVAL;
709 }
710
711 rc = fadump_build_cpu_notes(fdm_active);
712 if (rc)
713 return rc;
714
715 /*
716 * We are done validating dump info and elfcore header is now ready
717 * to be exported. set elfcorehdr_addr so that vmcore module will
718 * export the elfcore header through '/proc/vmcore'.
719 */
720 elfcorehdr_addr = fdh->elfcorehdr_addr;
721
722 return 0;
723}
724
725static inline void fadump_add_crash_memory(unsigned long long base,
726 unsigned long long end)
727{
728 if (base == end)
729 return;
730
731 pr_debug("crash_memory_range[%d] [%#016llx-%#016llx], %#llx bytes\n",
732 crash_mem_ranges, base, end - 1, (end - base));
733 crash_memory_ranges[crash_mem_ranges].base = base;
734 crash_memory_ranges[crash_mem_ranges].size = end - base;
735 crash_mem_ranges++;
736}
737
738static void fadump_exclude_reserved_area(unsigned long long start,
739 unsigned long long end)
740{
741 unsigned long long ra_start, ra_end;
742
743 ra_start = fw_dump.reserve_dump_area_start;
744 ra_end = ra_start + fw_dump.reserve_dump_area_size;
745
746 if ((ra_start < end) && (ra_end > start)) {
747 if ((start < ra_start) && (end > ra_end)) {
748 fadump_add_crash_memory(start, ra_start);
749 fadump_add_crash_memory(ra_end, end);
750 } else if (start < ra_start) {
751 fadump_add_crash_memory(start, ra_start);
752 } else if (ra_end < end) {
753 fadump_add_crash_memory(ra_end, end);
754 }
755 } else
756 fadump_add_crash_memory(start, end);
757}
758
759static int fadump_init_elfcore_header(char *bufp)
760{
761 struct elfhdr *elf;
762
763 elf = (struct elfhdr *) bufp;
764 bufp += sizeof(struct elfhdr);
765 memcpy(elf->e_ident, ELFMAG, SELFMAG);
766 elf->e_ident[EI_CLASS] = ELF_CLASS;
767 elf->e_ident[EI_DATA] = ELF_DATA;
768 elf->e_ident[EI_VERSION] = EV_CURRENT;
769 elf->e_ident[EI_OSABI] = ELF_OSABI;
770 memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD);
771 elf->e_type = ET_CORE;
772 elf->e_machine = ELF_ARCH;
773 elf->e_version = EV_CURRENT;
774 elf->e_entry = 0;
775 elf->e_phoff = sizeof(struct elfhdr);
776 elf->e_shoff = 0;
777 elf->e_flags = ELF_CORE_EFLAGS;
778 elf->e_ehsize = sizeof(struct elfhdr);
779 elf->e_phentsize = sizeof(struct elf_phdr);
780 elf->e_phnum = 0;
781 elf->e_shentsize = 0;
782 elf->e_shnum = 0;
783 elf->e_shstrndx = 0;
784
785 return 0;
786}
787
788/*
789 * Traverse through memblock structure and setup crash memory ranges. These
790 * ranges will be used create PT_LOAD program headers in elfcore header.
791 */
792static void fadump_setup_crash_memory_ranges(void)
793{
794 struct memblock_region *reg;
795 unsigned long long start, end;
796
797 pr_debug("Setup crash memory ranges.\n");
798 crash_mem_ranges = 0;
799 /*
800 * add the first memory chunk (RMA_START through boot_memory_size) as
801 * a separate memory chunk. The reason is, at the time crash firmware
802 * will move the content of this memory chunk to different location
803 * specified during fadump registration. We need to create a separate
804 * program header for this chunk with the correct offset.
805 */
806 fadump_add_crash_memory(RMA_START, fw_dump.boot_memory_size);
807
808 for_each_memblock(memory, reg) {
809 start = (unsigned long long)reg->base;
810 end = start + (unsigned long long)reg->size;
811 if (start == RMA_START && end >= fw_dump.boot_memory_size)
812 start = fw_dump.boot_memory_size;
813
814 /* add this range excluding the reserved dump area. */
815 fadump_exclude_reserved_area(start, end);
816 }
817}
818
819/*
820 * If the given physical address falls within the boot memory region then
821 * return the relocated address that points to the dump region reserved
822 * for saving initial boot memory contents.
823 */
824static inline unsigned long fadump_relocate(unsigned long paddr)
825{
826 if (paddr > RMA_START && paddr < fw_dump.boot_memory_size)
827 return fdm.rmr_region.destination_address + paddr;
828 else
829 return paddr;
830}
831
832static int fadump_create_elfcore_headers(char *bufp)
833{
834 struct elfhdr *elf;
835 struct elf_phdr *phdr;
836 int i;
837
838 fadump_init_elfcore_header(bufp);
839 elf = (struct elfhdr *)bufp;
840 bufp += sizeof(struct elfhdr);
841
842 /*
843 * setup ELF PT_NOTE, place holder for cpu notes info. The notes info
844 * will be populated during second kernel boot after crash. Hence
845 * this PT_NOTE will always be the first elf note.
846 *
847 * NOTE: Any new ELF note addition should be placed after this note.
848 */
849 phdr = (struct elf_phdr *)bufp;
850 bufp += sizeof(struct elf_phdr);
851 phdr->p_type = PT_NOTE;
852 phdr->p_flags = 0;
853 phdr->p_vaddr = 0;
854 phdr->p_align = 0;
855
856 phdr->p_offset = 0;
857 phdr->p_paddr = 0;
858 phdr->p_filesz = 0;
859 phdr->p_memsz = 0;
860
861 (elf->e_phnum)++;
862
863 /* setup ELF PT_NOTE for vmcoreinfo */
864 phdr = (struct elf_phdr *)bufp;
865 bufp += sizeof(struct elf_phdr);
866 phdr->p_type = PT_NOTE;
867 phdr->p_flags = 0;
868 phdr->p_vaddr = 0;
869 phdr->p_align = 0;
870
871 phdr->p_paddr = fadump_relocate(paddr_vmcoreinfo_note());
872 phdr->p_offset = phdr->p_paddr;
873 phdr->p_memsz = vmcoreinfo_max_size;
874 phdr->p_filesz = vmcoreinfo_max_size;
875
876 /* Increment number of program headers. */
877 (elf->e_phnum)++;
878
879 /* setup PT_LOAD sections. */
880
881 for (i = 0; i < crash_mem_ranges; i++) {
882 unsigned long long mbase, msize;
883 mbase = crash_memory_ranges[i].base;
884 msize = crash_memory_ranges[i].size;
885
886 if (!msize)
887 continue;
888
889 phdr = (struct elf_phdr *)bufp;
890 bufp += sizeof(struct elf_phdr);
891 phdr->p_type = PT_LOAD;
892 phdr->p_flags = PF_R|PF_W|PF_X;
893 phdr->p_offset = mbase;
894
895 if (mbase == RMA_START) {
896 /*
897 * The entire RMA region will be moved by firmware
898 * to the specified destination_address. Hence set
899 * the correct offset.
900 */
901 phdr->p_offset = fdm.rmr_region.destination_address;
902 }
903
904 phdr->p_paddr = mbase;
905 phdr->p_vaddr = (unsigned long)__va(mbase);
906 phdr->p_filesz = msize;
907 phdr->p_memsz = msize;
908 phdr->p_align = 0;
909
910 /* Increment number of program headers. */
911 (elf->e_phnum)++;
912 }
913 return 0;
914}
915
916static unsigned long init_fadump_header(unsigned long addr)
917{
918 struct fadump_crash_info_header *fdh;
919
920 if (!addr)
921 return 0;
922
923 fw_dump.fadumphdr_addr = addr;
924 fdh = __va(addr);
925 addr += sizeof(struct fadump_crash_info_header);
926
927 memset(fdh, 0, sizeof(struct fadump_crash_info_header));
928 fdh->magic_number = FADUMP_CRASH_INFO_MAGIC;
929 fdh->elfcorehdr_addr = addr;
930 /* We will set the crashing cpu id in crash_fadump() during crash. */
931 fdh->crashing_cpu = CPU_UNKNOWN;
932
933 return addr;
934}
935
936static void register_fadump(void)
937{
938 unsigned long addr;
939 void *vaddr;
940
941 /*
942 * If no memory is reserved then we can not register for firmware-
943 * assisted dump.
944 */
945 if (!fw_dump.reserve_dump_area_size)
946 return;
947
948 fadump_setup_crash_memory_ranges();
949
950 addr = fdm.rmr_region.destination_address + fdm.rmr_region.source_len;
951 /* Initialize fadump crash info header. */
952 addr = init_fadump_header(addr);
953 vaddr = __va(addr);
954
955 pr_debug("Creating ELF core headers at %#016lx\n", addr);
956 fadump_create_elfcore_headers(vaddr);
957
958 /* register the future kernel dump with firmware. */
959 register_fw_dump(&fdm);
960}
961
962static int fadump_unregister_dump(struct fadump_mem_struct *fdm)
963{
964 int rc = 0;
965 unsigned int wait_time;
966
967 pr_debug("Un-register firmware-assisted dump\n");
968
969 /* TODO: Add upper time limit for the delay */
970 do {
971 rc = rtas_call(fw_dump.ibm_configure_kernel_dump, 3, 1, NULL,
972 FADUMP_UNREGISTER, fdm,
973 sizeof(struct fadump_mem_struct));
974
975 wait_time = rtas_busy_delay_time(rc);
976 if (wait_time)
977 mdelay(wait_time);
978 } while (wait_time);
979
980 if (rc) {
981 printk(KERN_ERR "Failed to un-register firmware-assisted dump."
982 " unexpected error(%d).\n", rc);
983 return rc;
984 }
985 fw_dump.dump_registered = 0;
986 return 0;
987}
988
989static int fadump_invalidate_dump(struct fadump_mem_struct *fdm)
990{
991 int rc = 0;
992 unsigned int wait_time;
993
994 pr_debug("Invalidating firmware-assisted dump registration\n");
995
996 /* TODO: Add upper time limit for the delay */
997 do {
998 rc = rtas_call(fw_dump.ibm_configure_kernel_dump, 3, 1, NULL,
999 FADUMP_INVALIDATE, fdm,
1000 sizeof(struct fadump_mem_struct));
1001
1002 wait_time = rtas_busy_delay_time(rc);
1003 if (wait_time)
1004 mdelay(wait_time);
1005 } while (wait_time);
1006
1007 if (rc) {
1008 printk(KERN_ERR "Failed to invalidate firmware-assisted dump "
1009 "rgistration. unexpected error(%d).\n", rc);
1010 return rc;
1011 }
1012 fw_dump.dump_active = 0;
1013 fdm_active = NULL;
1014 return 0;
1015}
1016
1017void fadump_cleanup(void)
1018{
1019 /* Invalidate the registration only if dump is active. */
1020 if (fw_dump.dump_active) {
1021 init_fadump_mem_struct(&fdm,
1022 fdm_active->cpu_state_data.destination_address);
1023 fadump_invalidate_dump(&fdm);
1024 }
1025}
1026
1027/*
1028 * Release the memory that was reserved in early boot to preserve the memory
1029 * contents. The released memory will be available for general use.
1030 */
1031static void fadump_release_memory(unsigned long begin, unsigned long end)
1032{
1033 unsigned long addr;
1034 unsigned long ra_start, ra_end;
1035
1036 ra_start = fw_dump.reserve_dump_area_start;
1037 ra_end = ra_start + fw_dump.reserve_dump_area_size;
1038
1039 for (addr = begin; addr < end; addr += PAGE_SIZE) {
1040 /*
1041 * exclude the dump reserve area. Will reuse it for next
1042 * fadump registration.
1043 */
1044 if (addr <= ra_end && ((addr + PAGE_SIZE) > ra_start))
1045 continue;
1046
1047 ClearPageReserved(pfn_to_page(addr >> PAGE_SHIFT));
1048 init_page_count(pfn_to_page(addr >> PAGE_SHIFT));
1049 free_page((unsigned long)__va(addr));
1050 totalram_pages++;
1051 }
1052}
1053
1054static void fadump_invalidate_release_mem(void)
1055{
1056 unsigned long reserved_area_start, reserved_area_end;
1057 unsigned long destination_address;
1058
1059 mutex_lock(&fadump_mutex);
1060 if (!fw_dump.dump_active) {
1061 mutex_unlock(&fadump_mutex);
1062 return;
1063 }
1064
1065 destination_address = fdm_active->cpu_state_data.destination_address;
1066 fadump_cleanup();
1067 mutex_unlock(&fadump_mutex);
1068
1069 /*
1070 * Save the current reserved memory bounds we will require them
1071 * later for releasing the memory for general use.
1072 */
1073 reserved_area_start = fw_dump.reserve_dump_area_start;
1074 reserved_area_end = reserved_area_start +
1075 fw_dump.reserve_dump_area_size;
1076 /*
1077 * Setup reserve_dump_area_start and its size so that we can
1078 * reuse this reserved memory for Re-registration.
1079 */
1080 fw_dump.reserve_dump_area_start = destination_address;
1081 fw_dump.reserve_dump_area_size = get_fadump_area_size();
1082
1083 fadump_release_memory(reserved_area_start, reserved_area_end);
1084 if (fw_dump.cpu_notes_buf) {
1085 fadump_cpu_notes_buf_free(
1086 (unsigned long)__va(fw_dump.cpu_notes_buf),
1087 fw_dump.cpu_notes_buf_size);
1088 fw_dump.cpu_notes_buf = 0;
1089 fw_dump.cpu_notes_buf_size = 0;
1090 }
1091 /* Initialize the kernel dump memory structure for FAD registration. */
1092 init_fadump_mem_struct(&fdm, fw_dump.reserve_dump_area_start);
1093}
1094
1095static ssize_t fadump_release_memory_store(struct kobject *kobj,
1096 struct kobj_attribute *attr,
1097 const char *buf, size_t count)
1098{
1099 if (!fw_dump.dump_active)
1100 return -EPERM;
1101
1102 if (buf[0] == '1') {
1103 /*
1104 * Take away the '/proc/vmcore'. We are releasing the dump
1105 * memory, hence it will not be valid anymore.
1106 */
1107 vmcore_cleanup();
1108 fadump_invalidate_release_mem();
1109
1110 } else
1111 return -EINVAL;
1112 return count;
1113}
1114
1115static ssize_t fadump_enabled_show(struct kobject *kobj,
1116 struct kobj_attribute *attr,
1117 char *buf)
1118{
1119 return sprintf(buf, "%d\n", fw_dump.fadump_enabled);
1120}
1121
1122static ssize_t fadump_register_show(struct kobject *kobj,
1123 struct kobj_attribute *attr,
1124 char *buf)
1125{
1126 return sprintf(buf, "%d\n", fw_dump.dump_registered);
1127}
1128
1129static ssize_t fadump_register_store(struct kobject *kobj,
1130 struct kobj_attribute *attr,
1131 const char *buf, size_t count)
1132{
1133 int ret = 0;
1134
1135 if (!fw_dump.fadump_enabled || fdm_active)
1136 return -EPERM;
1137
1138 mutex_lock(&fadump_mutex);
1139
1140 switch (buf[0]) {
1141 case '0':
1142 if (fw_dump.dump_registered == 0) {
1143 ret = -EINVAL;
1144 goto unlock_out;
1145 }
1146 /* Un-register Firmware-assisted dump */
1147 fadump_unregister_dump(&fdm);
1148 break;
1149 case '1':
1150 if (fw_dump.dump_registered == 1) {
1151 ret = -EINVAL;
1152 goto unlock_out;
1153 }
1154 /* Register Firmware-assisted dump */
1155 register_fadump();
1156 break;
1157 default:
1158 ret = -EINVAL;
1159 break;
1160 }
1161
1162unlock_out:
1163 mutex_unlock(&fadump_mutex);
1164 return ret < 0 ? ret : count;
1165}
1166
1167static int fadump_region_show(struct seq_file *m, void *private)
1168{
1169 const struct fadump_mem_struct *fdm_ptr;
1170
1171 if (!fw_dump.fadump_enabled)
1172 return 0;
1173
1174 mutex_lock(&fadump_mutex);
1175 if (fdm_active)
1176 fdm_ptr = fdm_active;
1177 else {
1178 mutex_unlock(&fadump_mutex);
1179 fdm_ptr = &fdm;
1180 }
1181
1182 seq_printf(m,
1183 "CPU : [%#016llx-%#016llx] %#llx bytes, "
1184 "Dumped: %#llx\n",
1185 fdm_ptr->cpu_state_data.destination_address,
1186 fdm_ptr->cpu_state_data.destination_address +
1187 fdm_ptr->cpu_state_data.source_len - 1,
1188 fdm_ptr->cpu_state_data.source_len,
1189 fdm_ptr->cpu_state_data.bytes_dumped);
1190 seq_printf(m,
1191 "HPTE: [%#016llx-%#016llx] %#llx bytes, "
1192 "Dumped: %#llx\n",
1193 fdm_ptr->hpte_region.destination_address,
1194 fdm_ptr->hpte_region.destination_address +
1195 fdm_ptr->hpte_region.source_len - 1,
1196 fdm_ptr->hpte_region.source_len,
1197 fdm_ptr->hpte_region.bytes_dumped);
1198 seq_printf(m,
1199 "DUMP: [%#016llx-%#016llx] %#llx bytes, "
1200 "Dumped: %#llx\n",
1201 fdm_ptr->rmr_region.destination_address,
1202 fdm_ptr->rmr_region.destination_address +
1203 fdm_ptr->rmr_region.source_len - 1,
1204 fdm_ptr->rmr_region.source_len,
1205 fdm_ptr->rmr_region.bytes_dumped);
1206
1207 if (!fdm_active ||
1208 (fw_dump.reserve_dump_area_start ==
1209 fdm_ptr->cpu_state_data.destination_address))
1210 goto out;
1211
1212 /* Dump is active. Show reserved memory region. */
1213 seq_printf(m,
1214 " : [%#016llx-%#016llx] %#llx bytes, "
1215 "Dumped: %#llx\n",
1216 (unsigned long long)fw_dump.reserve_dump_area_start,
1217 fdm_ptr->cpu_state_data.destination_address - 1,
1218 fdm_ptr->cpu_state_data.destination_address -
1219 fw_dump.reserve_dump_area_start,
1220 fdm_ptr->cpu_state_data.destination_address -
1221 fw_dump.reserve_dump_area_start);
1222out:
1223 if (fdm_active)
1224 mutex_unlock(&fadump_mutex);
1225 return 0;
1226}
1227
1228static struct kobj_attribute fadump_release_attr = __ATTR(fadump_release_mem,
1229 0200, NULL,
1230 fadump_release_memory_store);
1231static struct kobj_attribute fadump_attr = __ATTR(fadump_enabled,
1232 0444, fadump_enabled_show,
1233 NULL);
1234static struct kobj_attribute fadump_register_attr = __ATTR(fadump_registered,
1235 0644, fadump_register_show,
1236 fadump_register_store);
1237
1238static int fadump_region_open(struct inode *inode, struct file *file)
1239{
1240 return single_open(file, fadump_region_show, inode->i_private);
1241}
1242
1243static const struct file_operations fadump_region_fops = {
1244 .open = fadump_region_open,
1245 .read = seq_read,
1246 .llseek = seq_lseek,
1247 .release = single_release,
1248};
1249
1250static void fadump_init_files(void)
1251{
1252 struct dentry *debugfs_file;
1253 int rc = 0;
1254
1255 rc = sysfs_create_file(kernel_kobj, &fadump_attr.attr);
1256 if (rc)
1257 printk(KERN_ERR "fadump: unable to create sysfs file"
1258 " fadump_enabled (%d)\n", rc);
1259
1260 rc = sysfs_create_file(kernel_kobj, &fadump_register_attr.attr);
1261 if (rc)
1262 printk(KERN_ERR "fadump: unable to create sysfs file"
1263 " fadump_registered (%d)\n", rc);
1264
1265 debugfs_file = debugfs_create_file("fadump_region", 0444,
1266 powerpc_debugfs_root, NULL,
1267 &fadump_region_fops);
1268 if (!debugfs_file)
1269 printk(KERN_ERR "fadump: unable to create debugfs file"
1270 " fadump_region\n");
1271
1272 if (fw_dump.dump_active) {
1273 rc = sysfs_create_file(kernel_kobj, &fadump_release_attr.attr);
1274 if (rc)
1275 printk(KERN_ERR "fadump: unable to create sysfs file"
1276 " fadump_release_mem (%d)\n", rc);
1277 }
1278 return;
1279}
1280
1281/*
1282 * Prepare for firmware-assisted dump.
1283 */
1284int __init setup_fadump(void)
1285{
1286 if (!fw_dump.fadump_enabled)
1287 return 0;
1288
1289 if (!fw_dump.fadump_supported) {
1290 printk(KERN_ERR "Firmware-assisted dump is not supported on"
1291 " this hardware\n");
1292 return 0;
1293 }
1294
1295 fadump_show_config();
1296 /*
1297 * If dump data is available then see if it is valid and prepare for
1298 * saving it to the disk.
1299 */
1300 if (fw_dump.dump_active) {
1301 /*
1302 * if dump process fails then invalidate the registration
1303 * and release memory before proceeding for re-registration.
1304 */
1305 if (process_fadump(fdm_active) < 0)
1306 fadump_invalidate_release_mem();
1307 }
1308 /* Initialize the kernel dump memory structure for FAD registration. */
1309 else if (fw_dump.reserve_dump_area_size)
1310 init_fadump_mem_struct(&fdm, fw_dump.reserve_dump_area_start);
1311 fadump_init_files();
1312
1313 return 1;
1314}
1315subsys_initcall(setup_fadump);
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 0654dba2c1f..dc0488b6f6e 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -395,7 +395,7 @@ DataAccess:
395 bl hash_page 395 bl hash_page
3961: lwz r5,_DSISR(r11) /* get DSISR value */ 3961: lwz r5,_DSISR(r11) /* get DSISR value */
397 mfspr r4,SPRN_DAR 397 mfspr r4,SPRN_DAR
398 EXC_XFER_EE_LITE(0x300, handle_page_fault) 398 EXC_XFER_LITE(0x300, handle_page_fault)
399 399
400 400
401/* Instruction access exception. */ 401/* Instruction access exception. */
@@ -410,7 +410,7 @@ InstructionAccess:
410 bl hash_page 410 bl hash_page
4111: mr r4,r12 4111: mr r4,r12
412 mr r5,r9 412 mr r5,r9
413 EXC_XFER_EE_LITE(0x400, handle_page_fault) 413 EXC_XFER_LITE(0x400, handle_page_fault)
414 414
415/* External interrupt */ 415/* External interrupt */
416 EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE) 416 EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index 872a6af83ba..4989661b710 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -394,7 +394,7 @@ label:
394 NORMAL_EXCEPTION_PROLOG 394 NORMAL_EXCEPTION_PROLOG
395 mr r4,r12 /* Pass SRR0 as arg2 */ 395 mr r4,r12 /* Pass SRR0 as arg2 */
396 li r5,0 /* Pass zero as arg3 */ 396 li r5,0 /* Pass zero as arg3 */
397 EXC_XFER_EE_LITE(0x400, handle_page_fault) 397 EXC_XFER_LITE(0x400, handle_page_fault)
398 398
399/* 0x0500 - External Interrupt Exception */ 399/* 0x0500 - External Interrupt Exception */
400 EXCEPTION(0x0500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE) 400 EXCEPTION(0x0500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
@@ -747,7 +747,7 @@ DataAccess:
747 mfspr r5,SPRN_ESR /* Grab the ESR, save it, pass arg3 */ 747 mfspr r5,SPRN_ESR /* Grab the ESR, save it, pass arg3 */
748 stw r5,_ESR(r11) 748 stw r5,_ESR(r11)
749 mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */ 749 mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */
750 EXC_XFER_EE_LITE(0x300, handle_page_fault) 750 EXC_XFER_LITE(0x300, handle_page_fault)
751 751
752/* Other PowerPC processors, namely those derived from the 6xx-series 752/* Other PowerPC processors, namely those derived from the 6xx-series
753 * have vectors from 0x2100 through 0x2F00 defined, but marked as reserved. 753 * have vectors from 0x2100 through 0x2F00 defined, but marked as reserved.
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 06c7251c1bf..58bddee8e1e 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -32,13 +32,13 @@
32#include <asm/cputable.h> 32#include <asm/cputable.h>
33#include <asm/setup.h> 33#include <asm/setup.h>
34#include <asm/hvcall.h> 34#include <asm/hvcall.h>
35#include <asm/iseries/lpar_map.h>
36#include <asm/thread_info.h> 35#include <asm/thread_info.h>
37#include <asm/firmware.h> 36#include <asm/firmware.h>
38#include <asm/page_64.h> 37#include <asm/page_64.h>
39#include <asm/irqflags.h> 38#include <asm/irqflags.h>
40#include <asm/kvm_book3s_asm.h> 39#include <asm/kvm_book3s_asm.h>
41#include <asm/ptrace.h> 40#include <asm/ptrace.h>
41#include <asm/hw_irq.h>
42 42
43/* The physical memory is laid out such that the secondary processor 43/* The physical memory is laid out such that the secondary processor
44 * spin code sits at 0x0000...0x00ff. On server, the vectors follow 44 * spin code sits at 0x0000...0x00ff. On server, the vectors follow
@@ -57,10 +57,6 @@
57 * entry in r9 for debugging purposes 57 * entry in r9 for debugging purposes
58 * 2. Secondary processors enter at 0x60 with PIR in gpr3 58 * 2. Secondary processors enter at 0x60 with PIR in gpr3
59 * 59 *
60 * For iSeries:
61 * 1. The MMU is on (as it always is for iSeries)
62 * 2. The kernel is entered at system_reset_iSeries
63 *
64 * For Book3E processors: 60 * For Book3E processors:
65 * 1. The MMU is on running in AS0 in a state defined in ePAPR 61 * 1. The MMU is on running in AS0 in a state defined in ePAPR
66 * 2. The kernel is entered at __start 62 * 2. The kernel is entered at __start
@@ -93,15 +89,6 @@ __secondary_hold_spinloop:
93__secondary_hold_acknowledge: 89__secondary_hold_acknowledge:
94 .llong 0x0 90 .llong 0x0
95 91
96#ifdef CONFIG_PPC_ISERIES
97 /*
98 * At offset 0x20, there is a pointer to iSeries LPAR data.
99 * This is required by the hypervisor
100 */
101 . = 0x20
102 .llong hvReleaseData-KERNELBASE
103#endif /* CONFIG_PPC_ISERIES */
104
105#ifdef CONFIG_RELOCATABLE 92#ifdef CONFIG_RELOCATABLE
106 /* This flag is set to 1 by a loader if the kernel should run 93 /* This flag is set to 1 by a loader if the kernel should run
107 * at the loaded address instead of the linked address. This 94 * at the loaded address instead of the linked address. This
@@ -564,7 +551,8 @@ _GLOBAL(pmac_secondary_start)
564 */ 551 */
565 li r0,0 552 li r0,0
566 stb r0,PACASOFTIRQEN(r13) 553 stb r0,PACASOFTIRQEN(r13)
567 stb r0,PACAHARDIRQEN(r13) 554 li r0,PACA_IRQ_HARD_DIS
555 stb r0,PACAIRQHAPPENED(r13)
568 556
569 /* Create a temp kernel stack for use before relocation is on. */ 557 /* Create a temp kernel stack for use before relocation is on. */
570 ld r1,PACAEMERGSP(r13) 558 ld r1,PACAEMERGSP(r13)
@@ -582,7 +570,7 @@ _GLOBAL(pmac_secondary_start)
582 * 1. Processor number 570 * 1. Processor number
583 * 2. Segment table pointer (virtual address) 571 * 2. Segment table pointer (virtual address)
584 * On entry the following are set: 572 * On entry the following are set:
585 * r1 = stack pointer. vaddr for iSeries, raddr (temp stack) for pSeries 573 * r1 = stack pointer (real addr of temp stack)
586 * r24 = cpu# (in Linux terms) 574 * r24 = cpu# (in Linux terms)
587 * r13 = paca virtual address 575 * r13 = paca virtual address
588 * SPRG_PACA = paca virtual address 576 * SPRG_PACA = paca virtual address
@@ -595,7 +583,7 @@ __secondary_start:
595 /* Set thread priority to MEDIUM */ 583 /* Set thread priority to MEDIUM */
596 HMT_MEDIUM 584 HMT_MEDIUM
597 585
598 /* Initialize the kernel stack. Just a repeat for iSeries. */ 586 /* Initialize the kernel stack */
599 LOAD_REG_ADDR(r3, current_set) 587 LOAD_REG_ADDR(r3, current_set)
600 sldi r28,r24,3 /* get current_set[cpu#] */ 588 sldi r28,r24,3 /* get current_set[cpu#] */
601 ldx r14,r3,r28 589 ldx r14,r3,r28
@@ -615,20 +603,16 @@ __secondary_start:
615 li r7,0 603 li r7,0
616 mtlr r7 604 mtlr r7
617 605
606 /* Mark interrupts soft and hard disabled (they might be enabled
607 * in the PACA when doing hotplug)
608 */
609 stb r7,PACASOFTIRQEN(r13)
610 li r0,PACA_IRQ_HARD_DIS
611 stb r0,PACAIRQHAPPENED(r13)
612
618 /* enable MMU and jump to start_secondary */ 613 /* enable MMU and jump to start_secondary */
619 LOAD_REG_ADDR(r3, .start_secondary_prolog) 614 LOAD_REG_ADDR(r3, .start_secondary_prolog)
620 LOAD_REG_IMMEDIATE(r4, MSR_KERNEL) 615 LOAD_REG_IMMEDIATE(r4, MSR_KERNEL)
621#ifdef CONFIG_PPC_ISERIES
622BEGIN_FW_FTR_SECTION
623 ori r4,r4,MSR_EE
624 li r8,1
625 stb r8,PACAHARDIRQEN(r13)
626END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
627#endif
628BEGIN_FW_FTR_SECTION
629 stb r7,PACAHARDIRQEN(r13)
630END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES)
631 stb r7,PACASOFTIRQEN(r13)
632 616
633 mtspr SPRN_SRR0,r3 617 mtspr SPRN_SRR0,r3
634 mtspr SPRN_SRR1,r4 618 mtspr SPRN_SRR1,r4
@@ -771,22 +755,18 @@ _INIT_GLOBAL(start_here_common)
771 /* Load the TOC (virtual address) */ 755 /* Load the TOC (virtual address) */
772 ld r2,PACATOC(r13) 756 ld r2,PACATOC(r13)
773 757
758 /* Do more system initializations in virtual mode */
774 bl .setup_system 759 bl .setup_system
775 760
776 /* Load up the kernel context */ 761 /* Mark interrupts soft and hard disabled (they might be enabled
7775: 762 * in the PACA when doing hotplug)
778 li r5,0 763 */
779 stb r5,PACASOFTIRQEN(r13) /* Soft Disabled */ 764 li r0,0
780#ifdef CONFIG_PPC_ISERIES 765 stb r0,PACASOFTIRQEN(r13)
781BEGIN_FW_FTR_SECTION 766 li r0,PACA_IRQ_HARD_DIS
782 mfmsr r5 767 stb r0,PACAIRQHAPPENED(r13)
783 ori r5,r5,MSR_EE /* Hard Enabled on iSeries*/
784 mtmsrd r5
785 li r5,1
786END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
787#endif
788 stb r5,PACAHARDIRQEN(r13) /* Hard Disabled on others */
789 768
769 /* Generic kernel entry */
790 bl .start_kernel 770 bl .start_kernel
791 771
792 /* Not reached */ 772 /* Not reached */
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index b68cb173ba2..b2a5860accf 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -220,7 +220,7 @@ DataAccess:
220 mfspr r4,SPRN_DAR 220 mfspr r4,SPRN_DAR
221 li r10,0x00f0 221 li r10,0x00f0
222 mtspr SPRN_DAR,r10 /* Tag DAR, to be used in DTLB Error */ 222 mtspr SPRN_DAR,r10 /* Tag DAR, to be used in DTLB Error */
223 EXC_XFER_EE_LITE(0x300, handle_page_fault) 223 EXC_XFER_LITE(0x300, handle_page_fault)
224 224
225/* Instruction access exception. 225/* Instruction access exception.
226 * This is "never generated" by the MPC8xx. We jump to it for other 226 * This is "never generated" by the MPC8xx. We jump to it for other
@@ -231,7 +231,7 @@ InstructionAccess:
231 EXCEPTION_PROLOG 231 EXCEPTION_PROLOG
232 mr r4,r12 232 mr r4,r12
233 mr r5,r9 233 mr r5,r9
234 EXC_XFER_EE_LITE(0x400, handle_page_fault) 234 EXC_XFER_LITE(0x400, handle_page_fault)
235 235
236/* External interrupt */ 236/* External interrupt */
237 EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE) 237 EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h
index fc921bf62e1..0e4175388f4 100644
--- a/arch/powerpc/kernel/head_booke.h
+++ b/arch/powerpc/kernel/head_booke.h
@@ -359,7 +359,7 @@ label:
359 mfspr r5,SPRN_ESR; /* Grab the ESR and save it */ \ 359 mfspr r5,SPRN_ESR; /* Grab the ESR and save it */ \
360 stw r5,_ESR(r11); \ 360 stw r5,_ESR(r11); \
361 mfspr r4,SPRN_DEAR; /* Grab the DEAR */ \ 361 mfspr r4,SPRN_DEAR; /* Grab the DEAR */ \
362 EXC_XFER_EE_LITE(0x0300, handle_page_fault) 362 EXC_XFER_LITE(0x0300, handle_page_fault)
363 363
364#define INSTRUCTION_STORAGE_EXCEPTION \ 364#define INSTRUCTION_STORAGE_EXCEPTION \
365 START_EXCEPTION(InstructionStorage) \ 365 START_EXCEPTION(InstructionStorage) \
@@ -368,7 +368,7 @@ label:
368 stw r5,_ESR(r11); \ 368 stw r5,_ESR(r11); \
369 mr r4,r12; /* Pass SRR0 as arg2 */ \ 369 mr r4,r12; /* Pass SRR0 as arg2 */ \
370 li r5,0; /* Pass zero as arg3 */ \ 370 li r5,0; /* Pass zero as arg3 */ \
371 EXC_XFER_EE_LITE(0x0400, handle_page_fault) 371 EXC_XFER_LITE(0x0400, handle_page_fault)
372 372
373#define ALIGNMENT_EXCEPTION \ 373#define ALIGNMENT_EXCEPTION \
374 START_EXCEPTION(Alignment) \ 374 START_EXCEPTION(Alignment) \
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index d5d78c4ceef..28e62598d0e 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -319,7 +319,7 @@ interrupt_base:
319 mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */ 319 mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */
320 andis. r10,r5,(ESR_ILK|ESR_DLK)@h 320 andis. r10,r5,(ESR_ILK|ESR_DLK)@h
321 bne 1f 321 bne 1f
322 EXC_XFER_EE_LITE(0x0300, handle_page_fault) 322 EXC_XFER_LITE(0x0300, handle_page_fault)
3231: 3231:
324 addi r3,r1,STACK_FRAME_OVERHEAD 324 addi r3,r1,STACK_FRAME_OVERHEAD
325 EXC_XFER_EE_LITE(0x0300, CacheLockingException) 325 EXC_XFER_EE_LITE(0x0300, CacheLockingException)
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index c97fc60c790..e8e821146f3 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -84,7 +84,11 @@ void cpu_idle(void)
84 84
85 start_critical_timings(); 85 start_critical_timings();
86 86
87 local_irq_enable(); 87 /* Some power_save functions return with
88 * interrupts enabled, some don't.
89 */
90 if (irqs_disabled())
91 local_irq_enable();
88 set_thread_flag(TIF_POLLING_NRFLAG); 92 set_thread_flag(TIF_POLLING_NRFLAG);
89 93
90 } else { 94 } else {
diff --git a/arch/powerpc/kernel/idle_book3e.S b/arch/powerpc/kernel/idle_book3e.S
index 16c002d6bdf..ff007b59448 100644
--- a/arch/powerpc/kernel/idle_book3e.S
+++ b/arch/powerpc/kernel/idle_book3e.S
@@ -29,43 +29,30 @@ _GLOBAL(book3e_idle)
29 wrteei 0 29 wrteei 0
30 30
31 /* Now check if an interrupt came in while we were soft disabled 31 /* Now check if an interrupt came in while we were soft disabled
32 * since we may otherwise lose it (doorbells etc...). We know 32 * since we may otherwise lose it (doorbells etc...).
33 * that since PACAHARDIRQEN will have been cleared in that case.
34 */ 33 */
35 lbz r3,PACAHARDIRQEN(r13) 34 lbz r3,PACAIRQHAPPENED(r13)
36 cmpwi cr0,r3,0 35 cmpwi cr0,r3,0
37 beqlr 36 bnelr
38 37
39 /* Now we are going to mark ourselves as soft and hard enables in 38 /* Now we are going to mark ourselves as soft and hard enabled in
40 * order to be able to take interrupts while asleep. We inform lockdep 39 * order to be able to take interrupts while asleep. We inform lockdep
41 * of that. We don't actually turn interrupts on just yet tho. 40 * of that. We don't actually turn interrupts on just yet tho.
42 */ 41 */
43#ifdef CONFIG_TRACE_IRQFLAGS 42#ifdef CONFIG_TRACE_IRQFLAGS
44 stdu r1,-128(r1) 43 stdu r1,-128(r1)
45 bl .trace_hardirqs_on 44 bl .trace_hardirqs_on
45 addi r1,r1,128
46#endif 46#endif
47 li r0,1 47 li r0,1
48 stb r0,PACASOFTIRQEN(r13) 48 stb r0,PACASOFTIRQEN(r13)
49 stb r0,PACAHARDIRQEN(r13)
50 49
51 /* Interrupts will make use return to LR, so get something we want 50 /* Interrupts will make use return to LR, so get something we want
52 * in there 51 * in there
53 */ 52 */
54 bl 1f 53 bl 1f
55 54
56 /* Hard disable interrupts again */ 55 /* And return (interrupts are on) */
57 wrteei 0
58
59 /* Mark them off again in the PACA as well */
60 li r0,0
61 stb r0,PACASOFTIRQEN(r13)
62 stb r0,PACAHARDIRQEN(r13)
63
64 /* Tell lockdep about it */
65#ifdef CONFIG_TRACE_IRQFLAGS
66 bl .trace_hardirqs_off
67 addi r1,r1,128
68#endif
69 ld r0,16(r1) 56 ld r0,16(r1)
70 mtlr r0 57 mtlr r0
71 blr 58 blr
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index ba319547860..2c71b0fc9f9 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -14,6 +14,7 @@
14#include <asm/thread_info.h> 14#include <asm/thread_info.h>
15#include <asm/ppc_asm.h> 15#include <asm/ppc_asm.h>
16#include <asm/asm-offsets.h> 16#include <asm/asm-offsets.h>
17#include <asm/irqflags.h>
17 18
18#undef DEBUG 19#undef DEBUG
19 20
@@ -29,14 +30,31 @@ END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
29 cmpwi 0,r4,0 30 cmpwi 0,r4,0
30 beqlr 31 beqlr
31 32
32 /* Go to NAP now */ 33 /* Hard disable interrupts */
33 mfmsr r7 34 mfmsr r7
34 rldicl r0,r7,48,1 35 rldicl r0,r7,48,1
35 rotldi r0,r0,16 36 rotldi r0,r0,16
36 mtmsrd r0,1 /* hard-disable interrupts */ 37 mtmsrd r0,1
38
39 /* Check if something happened while soft-disabled */
40 lbz r0,PACAIRQHAPPENED(r13)
41 cmpwi cr0,r0,0
42 bnelr
43
44 /* Soft-enable interrupts */
45#ifdef CONFIG_TRACE_IRQFLAGS
46 mflr r0
47 std r0,16(r1)
48 stdu r1,-128(r1)
49 bl .trace_hardirqs_on
50 addi r1,r1,128
51 ld r0,16(r1)
52 mtlr r0
53 mfmsr r7
54#endif /* CONFIG_TRACE_IRQFLAGS */
55
37 li r0,1 56 li r0,1
38 stb r0,PACASOFTIRQEN(r13) /* we'll hard-enable shortly */ 57 stb r0,PACASOFTIRQEN(r13) /* we'll hard-enable shortly */
39 stb r0,PACAHARDIRQEN(r13)
40BEGIN_FTR_SECTION 58BEGIN_FTR_SECTION
41 DSSALL 59 DSSALL
42 sync 60 sync
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S
index fcdff198da4..0cdc9a39283 100644
--- a/arch/powerpc/kernel/idle_power7.S
+++ b/arch/powerpc/kernel/idle_power7.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file contains the power_save function for 970-family CPUs. 2 * This file contains the power_save function for Power7 CPUs.
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
@@ -15,6 +15,7 @@
15#include <asm/ppc_asm.h> 15#include <asm/ppc_asm.h>
16#include <asm/asm-offsets.h> 16#include <asm/asm-offsets.h>
17#include <asm/ppc-opcode.h> 17#include <asm/ppc-opcode.h>
18#include <asm/hw_irq.h>
18 19
19#undef DEBUG 20#undef DEBUG
20 21
@@ -51,9 +52,25 @@ _GLOBAL(power7_idle)
51 rldicl r9,r9,48,1 52 rldicl r9,r9,48,1
52 rotldi r9,r9,16 53 rotldi r9,r9,16
53 mtmsrd r9,1 /* hard-disable interrupts */ 54 mtmsrd r9,1 /* hard-disable interrupts */
55
56 /* Check if something happened while soft-disabled */
57 lbz r0,PACAIRQHAPPENED(r13)
58 cmpwi cr0,r0,0
59 beq 1f
60 addi r1,r1,INT_FRAME_SIZE
61 ld r0,16(r1)
62 mtlr r0
63 blr
64
651: /* We mark irqs hard disabled as this is the state we'll
66 * be in when returning and we need to tell arch_local_irq_restore()
67 * about it
68 */
69 li r0,PACA_IRQ_HARD_DIS
70 stb r0,PACAIRQHAPPENED(r13)
71
72 /* We haven't lost state ... yet */
54 li r0,0 73 li r0,0
55 stb r0,PACASOFTIRQEN(r13) /* we'll hard-enable shortly */
56 stb r0,PACAHARDIRQEN(r13)
57 stb r0,PACA_NAPSTATELOST(r13) 74 stb r0,PACA_NAPSTATELOST(r13)
58 75
59 /* Continue saving state */ 76 /* Continue saving state */
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 0cfcf98aafc..359f078571c 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -39,6 +39,7 @@
39#include <asm/pci-bridge.h> 39#include <asm/pci-bridge.h>
40#include <asm/machdep.h> 40#include <asm/machdep.h>
41#include <asm/kdump.h> 41#include <asm/kdump.h>
42#include <asm/fadump.h>
42 43
43#define DBG(...) 44#define DBG(...)
44 45
@@ -445,7 +446,12 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
445 446
446static void iommu_table_clear(struct iommu_table *tbl) 447static void iommu_table_clear(struct iommu_table *tbl)
447{ 448{
448 if (!is_kdump_kernel()) { 449 /*
450 * In case of firmware assisted dump system goes through clean
451 * reboot process at the time of system crash. Hence it's safe to
452 * clear the TCE entries if firmware assisted dump is active.
453 */
454 if (!is_kdump_kernel() || is_fadump_active()) {
449 /* Clear the table in case firmware left allocations in it */ 455 /* Clear the table in case firmware left allocations in it */
450 ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size); 456 ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size);
451 return; 457 return;
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index bdfb3eee3e6..a3d128e94cf 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -93,20 +93,16 @@ extern int tau_interrupts(int);
93 93
94#ifdef CONFIG_PPC64 94#ifdef CONFIG_PPC64
95 95
96#ifndef CONFIG_SPARSE_IRQ
97EXPORT_SYMBOL(irq_desc);
98#endif
99
100int distribute_irqs = 1; 96int distribute_irqs = 1;
101 97
102static inline notrace unsigned long get_hard_enabled(void) 98static inline notrace unsigned long get_irq_happened(void)
103{ 99{
104 unsigned long enabled; 100 unsigned long happened;
105 101
106 __asm__ __volatile__("lbz %0,%1(13)" 102 __asm__ __volatile__("lbz %0,%1(13)"
107 : "=r" (enabled) : "i" (offsetof(struct paca_struct, hard_enabled))); 103 : "=r" (happened) : "i" (offsetof(struct paca_struct, irq_happened)));
108 104
109 return enabled; 105 return happened;
110} 106}
111 107
112static inline notrace void set_soft_enabled(unsigned long enable) 108static inline notrace void set_soft_enabled(unsigned long enable)
@@ -115,88 +111,162 @@ static inline notrace void set_soft_enabled(unsigned long enable)
115 : : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled))); 111 : : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled)));
116} 112}
117 113
118static inline notrace void decrementer_check_overflow(void) 114static inline notrace int decrementer_check_overflow(void)
119{ 115{
120 u64 now = get_tb_or_rtc(); 116 u64 now = get_tb_or_rtc();
121 u64 *next_tb; 117 u64 *next_tb = &__get_cpu_var(decrementers_next_tb);
122 118
123 preempt_disable();
124 next_tb = &__get_cpu_var(decrementers_next_tb);
125
126 if (now >= *next_tb) 119 if (now >= *next_tb)
127 set_dec(1); 120 set_dec(1);
128 preempt_enable(); 121 return now >= *next_tb;
129} 122}
130 123
131notrace void arch_local_irq_restore(unsigned long en) 124/* This is called whenever we are re-enabling interrupts
125 * and returns either 0 (nothing to do) or 500/900 if there's
126 * either an EE or a DEC to generate.
127 *
128 * This is called in two contexts: From arch_local_irq_restore()
129 * before soft-enabling interrupts, and from the exception exit
130 * path when returning from an interrupt from a soft-disabled to
131 * a soft enabled context. In both case we have interrupts hard
132 * disabled.
133 *
134 * We take care of only clearing the bits we handled in the
135 * PACA irq_happened field since we can only re-emit one at a
136 * time and we don't want to "lose" one.
137 */
138notrace unsigned int __check_irq_replay(void)
132{ 139{
133 /* 140 /*
134 * get_paca()->soft_enabled = en; 141 * We use local_paca rather than get_paca() to avoid all
135 * Is it ever valid to use local_irq_restore(0) when soft_enabled is 1? 142 * the debug_smp_processor_id() business in this low level
136 * That was allowed before, and in such a case we do need to take care 143 * function
137 * that gcc will set soft_enabled directly via r13, not choose to use
138 * an intermediate register, lest we're preempted to a different cpu.
139 */ 144 */
140 set_soft_enabled(en); 145 unsigned char happened = local_paca->irq_happened;
141 if (!en)
142 return;
143 146
144#ifdef CONFIG_PPC_STD_MMU_64 147 /* Clear bit 0 which we wouldn't clear otherwise */
145 if (firmware_has_feature(FW_FEATURE_ISERIES)) { 148 local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS;
146 /* 149
147 * Do we need to disable preemption here? Not really: in the 150 /*
148 * unlikely event that we're preempted to a different cpu in 151 * Force the delivery of pending soft-disabled interrupts on PS3.
149 * between getting r13, loading its lppaca_ptr, and loading 152 * Any HV call will have this side effect.
150 * its any_int, we might call iseries_handle_interrupts without 153 */
151 * an interrupt pending on the new cpu, but that's no disaster, 154 if (firmware_has_feature(FW_FEATURE_PS3_LV1)) {
152 * is it? And the business of preempting us off the old cpu 155 u64 tmp, tmp2;
153 * would itself involve a local_irq_restore which handles the 156 lv1_get_version_info(&tmp, &tmp2);
154 * interrupt to that cpu.
155 *
156 * But use "local_paca->lppaca_ptr" instead of "get_lppaca()"
157 * to avoid any preemption checking added into get_paca().
158 */
159 if (local_paca->lppaca_ptr->int_dword.any_int)
160 iseries_handle_interrupts();
161 } 157 }
162#endif /* CONFIG_PPC_STD_MMU_64 */
163 158
164 /* 159 /*
165 * if (get_paca()->hard_enabled) return; 160 * We may have missed a decrementer interrupt. We check the
166 * But again we need to take care that gcc gets hard_enabled directly 161 * decrementer itself rather than the paca irq_happened field
167 * via r13, not choose to use an intermediate register, lest we're 162 * in case we also had a rollover while hard disabled
168 * preempted to a different cpu in between the two instructions. 163 */
164 local_paca->irq_happened &= ~PACA_IRQ_DEC;
165 if (decrementer_check_overflow())
166 return 0x900;
167
168 /* Finally check if an external interrupt happened */
169 local_paca->irq_happened &= ~PACA_IRQ_EE;
170 if (happened & PACA_IRQ_EE)
171 return 0x500;
172
173#ifdef CONFIG_PPC_BOOK3E
174 /* Finally check if an EPR external interrupt happened
175 * this bit is typically set if we need to handle another
176 * "edge" interrupt from within the MPIC "EPR" handler
169 */ 177 */
170 if (get_hard_enabled()) 178 local_paca->irq_happened &= ~PACA_IRQ_EE_EDGE;
179 if (happened & PACA_IRQ_EE_EDGE)
180 return 0x500;
181
182 local_paca->irq_happened &= ~PACA_IRQ_DBELL;
183 if (happened & PACA_IRQ_DBELL)
184 return 0x280;
185#endif /* CONFIG_PPC_BOOK3E */
186
187 /* There should be nothing left ! */
188 BUG_ON(local_paca->irq_happened != 0);
189
190 return 0;
191}
192
193notrace void arch_local_irq_restore(unsigned long en)
194{
195 unsigned char irq_happened;
196 unsigned int replay;
197
198 /* Write the new soft-enabled value */
199 set_soft_enabled(en);
200 if (!en)
201 return;
202 /*
203 * From this point onward, we can take interrupts, preempt,
204 * etc... unless we got hard-disabled. We check if an event
205 * happened. If none happened, we know we can just return.
206 *
207 * We may have preempted before the check below, in which case
208 * we are checking the "new" CPU instead of the old one. This
209 * is only a problem if an event happened on the "old" CPU.
210 *
211 * External interrupt events on non-iseries will have caused
212 * interrupts to be hard-disabled, so there is no problem, we
213 * cannot have preempted.
214 */
215 irq_happened = get_irq_happened();
216 if (!irq_happened)
171 return; 217 return;
172 218
173 /* 219 /*
174 * Need to hard-enable interrupts here. Since currently disabled, 220 * We need to hard disable to get a trusted value from
175 * no need to take further asm precautions against preemption; but 221 * __check_irq_replay(). We also need to soft-disable
176 * use local_paca instead of get_paca() to avoid preemption checking. 222 * again to avoid warnings in there due to the use of
223 * per-cpu variables.
224 *
225 * We know that if the value in irq_happened is exactly 0x01
226 * then we are already hard disabled (there are other less
227 * common cases that we'll ignore for now), so we skip the
228 * (expensive) mtmsrd.
177 */ 229 */
178 local_paca->hard_enabled = en; 230 if (unlikely(irq_happened != PACA_IRQ_HARD_DIS))
231 __hard_irq_disable();
232 set_soft_enabled(0);
179 233
180 /* 234 /*
181 * Trigger the decrementer if we have a pending event. Some processors 235 * Check if anything needs to be re-emitted. We haven't
182 * only trigger on edge transitions of the sign bit. We might also 236 * soft-enabled yet to avoid warnings in decrementer_check_overflow
183 * have disabled interrupts long enough that the decrementer wrapped 237 * accessing per-cpu variables
184 * to positive.
185 */ 238 */
186 decrementer_check_overflow(); 239 replay = __check_irq_replay();
240
241 /* We can soft-enable now */
242 set_soft_enabled(1);
187 243
188 /* 244 /*
189 * Force the delivery of pending soft-disabled interrupts on PS3. 245 * And replay if we have to. This will return with interrupts
190 * Any HV call will have this side effect. 246 * hard-enabled.
191 */ 247 */
192 if (firmware_has_feature(FW_FEATURE_PS3_LV1)) { 248 if (replay) {
193 u64 tmp, tmp2; 249 __replay_interrupt(replay);
194 lv1_get_version_info(&tmp, &tmp2); 250 return;
195 } 251 }
196 252
253 /* Finally, let's ensure we are hard enabled */
197 __hard_irq_enable(); 254 __hard_irq_enable();
198} 255}
199EXPORT_SYMBOL(arch_local_irq_restore); 256EXPORT_SYMBOL(arch_local_irq_restore);
257
258/*
259 * This is specifically called by assembly code to re-enable interrupts
260 * if they are currently disabled. This is typically called before
261 * schedule() or do_signal() when returning to userspace. We do it
262 * in C to avoid the burden of dealing with lockdep etc...
263 */
264void restore_interrupts(void)
265{
266 if (irqs_disabled())
267 local_irq_enable();
268}
269
200#endif /* CONFIG_PPC64 */ 270#endif /* CONFIG_PPC64 */
201 271
202int arch_show_interrupts(struct seq_file *p, int prec) 272int arch_show_interrupts(struct seq_file *p, int prec)
@@ -364,8 +434,17 @@ void do_IRQ(struct pt_regs *regs)
364 434
365 check_stack_overflow(); 435 check_stack_overflow();
366 436
437 /*
438 * Query the platform PIC for the interrupt & ack it.
439 *
440 * This will typically lower the interrupt line to the CPU
441 */
367 irq = ppc_md.get_irq(); 442 irq = ppc_md.get_irq();
368 443
444 /* We can hard enable interrupts now */
445 may_hard_irq_enable();
446
447 /* And finally process it */
369 if (irq != NO_IRQ && irq != NO_IRQ_IGNORE) 448 if (irq != NO_IRQ && irq != NO_IRQ_IGNORE)
370 handle_one_irq(irq); 449 handle_one_irq(irq);
371 else if (irq != NO_IRQ_IGNORE) 450 else if (irq != NO_IRQ_IGNORE)
@@ -374,15 +453,6 @@ void do_IRQ(struct pt_regs *regs)
374 irq_exit(); 453 irq_exit();
375 set_irq_regs(old_regs); 454 set_irq_regs(old_regs);
376 455
377#ifdef CONFIG_PPC_ISERIES
378 if (firmware_has_feature(FW_FEATURE_ISERIES) &&
379 get_lppaca()->int_dword.fields.decr_int) {
380 get_lppaca()->int_dword.fields.decr_int = 0;
381 /* Signal a fake decrementer interrupt */
382 timer_interrupt(regs);
383 }
384#endif
385
386 trace_irq_exit(regs); 456 trace_irq_exit(regs);
387} 457}
388 458
diff --git a/arch/powerpc/kernel/isa-bridge.c b/arch/powerpc/kernel/isa-bridge.c
index 479752901ec..d45ec58703c 100644
--- a/arch/powerpc/kernel/isa-bridge.c
+++ b/arch/powerpc/kernel/isa-bridge.c
@@ -29,7 +29,6 @@
29#include <asm/pci-bridge.h> 29#include <asm/pci-bridge.h>
30#include <asm/machdep.h> 30#include <asm/machdep.h>
31#include <asm/ppc-pci.h> 31#include <asm/ppc-pci.h>
32#include <asm/firmware.h>
33 32
34unsigned long isa_io_base; /* NULL if no ISA bus */ 33unsigned long isa_io_base; /* NULL if no ISA bus */
35EXPORT_SYMBOL(isa_io_base); 34EXPORT_SYMBOL(isa_io_base);
@@ -261,8 +260,6 @@ static struct notifier_block isa_bridge_notifier = {
261 */ 260 */
262static int __init isa_bridge_init(void) 261static int __init isa_bridge_init(void)
263{ 262{
264 if (firmware_has_feature(FW_FEATURE_ISERIES))
265 return 0;
266 bus_register_notifier(&pci_bus_type, &isa_bridge_notifier); 263 bus_register_notifier(&pci_bus_type, &isa_bridge_notifier);
267 return 0; 264 return 0;
268} 265}
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 578f35f1872..ac12bd80ad9 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -26,7 +26,6 @@
26#include <linux/seq_file.h> 26#include <linux/seq_file.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/iseries/hv_lp_config.h>
30#include <asm/lppaca.h> 29#include <asm/lppaca.h>
31#include <asm/hvcall.h> 30#include <asm/hvcall.h>
32#include <asm/firmware.h> 31#include <asm/firmware.h>
@@ -55,80 +54,14 @@ static unsigned long get_purr(void)
55 int cpu; 54 int cpu;
56 55
57 for_each_possible_cpu(cpu) { 56 for_each_possible_cpu(cpu) {
58 if (firmware_has_feature(FW_FEATURE_ISERIES)) 57 struct cpu_usage *cu;
59 sum_purr += lppaca_of(cpu).emulated_time_base;
60 else {
61 struct cpu_usage *cu;
62 58
63 cu = &per_cpu(cpu_usage_array, cpu); 59 cu = &per_cpu(cpu_usage_array, cpu);
64 sum_purr += cu->current_tb; 60 sum_purr += cu->current_tb;
65 }
66 } 61 }
67 return sum_purr; 62 return sum_purr;
68} 63}
69 64
70#ifdef CONFIG_PPC_ISERIES
71
72/*
73 * Methods used to fetch LPAR data when running on an iSeries platform.
74 */
75static int iseries_lparcfg_data(struct seq_file *m, void *v)
76{
77 unsigned long pool_id;
78 int shared, entitled_capacity, max_entitled_capacity;
79 int processors, max_processors;
80 unsigned long purr = get_purr();
81
82 shared = (int)(local_paca->lppaca_ptr->shared_proc);
83
84 seq_printf(m, "system_active_processors=%d\n",
85 (int)HvLpConfig_getSystemPhysicalProcessors());
86
87 seq_printf(m, "system_potential_processors=%d\n",
88 (int)HvLpConfig_getSystemPhysicalProcessors());
89
90 processors = (int)HvLpConfig_getPhysicalProcessors();
91 seq_printf(m, "partition_active_processors=%d\n", processors);
92
93 max_processors = (int)HvLpConfig_getMaxPhysicalProcessors();
94 seq_printf(m, "partition_potential_processors=%d\n", max_processors);
95
96 if (shared) {
97 entitled_capacity = HvLpConfig_getSharedProcUnits();
98 max_entitled_capacity = HvLpConfig_getMaxSharedProcUnits();
99 } else {
100 entitled_capacity = processors * 100;
101 max_entitled_capacity = max_processors * 100;
102 }
103 seq_printf(m, "partition_entitled_capacity=%d\n", entitled_capacity);
104
105 seq_printf(m, "partition_max_entitled_capacity=%d\n",
106 max_entitled_capacity);
107
108 if (shared) {
109 pool_id = HvLpConfig_getSharedPoolIndex();
110 seq_printf(m, "pool=%d\n", (int)pool_id);
111 seq_printf(m, "pool_capacity=%d\n",
112 (int)(HvLpConfig_getNumProcsInSharedPool(pool_id) *
113 100));
114 seq_printf(m, "purr=%ld\n", purr);
115 }
116
117 seq_printf(m, "shared_processor_mode=%d\n", shared);
118
119 return 0;
120}
121
122#else /* CONFIG_PPC_ISERIES */
123
124static int iseries_lparcfg_data(struct seq_file *m, void *v)
125{
126 return 0;
127}
128
129#endif /* CONFIG_PPC_ISERIES */
130
131#ifdef CONFIG_PPC_PSERIES
132/* 65/*
133 * Methods used to fetch LPAR data when running on a pSeries platform. 66 * Methods used to fetch LPAR data when running on a pSeries platform.
134 */ 67 */
@@ -648,8 +581,7 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
648 u8 new_weight, *new_weight_ptr = &new_weight; 581 u8 new_weight, *new_weight_ptr = &new_weight;
649 ssize_t retval; 582 ssize_t retval;
650 583
651 if (!firmware_has_feature(FW_FEATURE_SPLPAR) || 584 if (!firmware_has_feature(FW_FEATURE_SPLPAR))
652 firmware_has_feature(FW_FEATURE_ISERIES))
653 return -EINVAL; 585 return -EINVAL;
654 586
655 if (count > kbuf_sz) 587 if (count > kbuf_sz)
@@ -709,21 +641,6 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
709 return retval; 641 return retval;
710} 642}
711 643
712#else /* CONFIG_PPC_PSERIES */
713
714static int pseries_lparcfg_data(struct seq_file *m, void *v)
715{
716 return 0;
717}
718
719static ssize_t lparcfg_write(struct file *file, const char __user * buf,
720 size_t count, loff_t * off)
721{
722 return -EINVAL;
723}
724
725#endif /* CONFIG_PPC_PSERIES */
726
727static int lparcfg_data(struct seq_file *m, void *v) 644static int lparcfg_data(struct seq_file *m, void *v)
728{ 645{
729 struct device_node *rootdn; 646 struct device_node *rootdn;
@@ -738,19 +655,11 @@ static int lparcfg_data(struct seq_file *m, void *v)
738 rootdn = of_find_node_by_path("/"); 655 rootdn = of_find_node_by_path("/");
739 if (rootdn) { 656 if (rootdn) {
740 tmp = of_get_property(rootdn, "model", NULL); 657 tmp = of_get_property(rootdn, "model", NULL);
741 if (tmp) { 658 if (tmp)
742 model = tmp; 659 model = tmp;
743 /* Skip "IBM," - see platforms/iseries/dt.c */
744 if (firmware_has_feature(FW_FEATURE_ISERIES))
745 model += 4;
746 }
747 tmp = of_get_property(rootdn, "system-id", NULL); 660 tmp = of_get_property(rootdn, "system-id", NULL);
748 if (tmp) { 661 if (tmp)
749 system_id = tmp; 662 system_id = tmp;
750 /* Skip "IBM," - see platforms/iseries/dt.c */
751 if (firmware_has_feature(FW_FEATURE_ISERIES))
752 system_id += 4;
753 }
754 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no", 663 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no",
755 NULL); 664 NULL);
756 if (lp_index_ptr) 665 if (lp_index_ptr)
@@ -761,8 +670,6 @@ static int lparcfg_data(struct seq_file *m, void *v)
761 seq_printf(m, "system_type=%s\n", model); 670 seq_printf(m, "system_type=%s\n", model);
762 seq_printf(m, "partition_id=%d\n", (int)lp_index); 671 seq_printf(m, "partition_id=%d\n", (int)lp_index);
763 672
764 if (firmware_has_feature(FW_FEATURE_ISERIES))
765 return iseries_lparcfg_data(m, v);
766 return pseries_lparcfg_data(m, v); 673 return pseries_lparcfg_data(m, v);
767} 674}
768 675
@@ -786,8 +693,7 @@ static int __init lparcfg_init(void)
786 umode_t mode = S_IRUSR | S_IRGRP | S_IROTH; 693 umode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
787 694
788 /* Allow writing if we have FW_FEATURE_SPLPAR */ 695 /* Allow writing if we have FW_FEATURE_SPLPAR */
789 if (firmware_has_feature(FW_FEATURE_SPLPAR) && 696 if (firmware_has_feature(FW_FEATURE_SPLPAR))
790 !firmware_has_feature(FW_FEATURE_ISERIES))
791 mode |= S_IWUSR; 697 mode |= S_IWUSR;
792 698
793 ent = proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops); 699 ent = proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops);
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
index b69463ec201..ba16874fe29 100644
--- a/arch/powerpc/kernel/misc.S
+++ b/arch/powerpc/kernel/misc.S
@@ -5,7 +5,6 @@
5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu) 5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
6 * and Paul Mackerras. 6 * and Paul Mackerras.
7 * 7 *
8 * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
9 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com) 8 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
10 * 9 *
11 * setjmp/longjmp code by Paul Mackerras. 10 * setjmp/longjmp code by Paul Mackerras.
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index e1612dfb4a9..2049f2d00ff 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -21,12 +21,13 @@
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_device.h> 22#include <linux/of_device.h>
23#include <linux/of_platform.h> 23#include <linux/of_platform.h>
24#include <linux/atomic.h>
24 25
25#include <asm/errno.h> 26#include <asm/errno.h>
26#include <asm/topology.h> 27#include <asm/topology.h>
27#include <asm/pci-bridge.h> 28#include <asm/pci-bridge.h>
28#include <asm/ppc-pci.h> 29#include <asm/ppc-pci.h>
29#include <linux/atomic.h> 30#include <asm/eeh.h>
30 31
31#ifdef CONFIG_PPC_OF_PLATFORM_PCI 32#ifdef CONFIG_PPC_OF_PLATFORM_PCI
32 33
@@ -66,6 +67,9 @@ static int __devinit of_pci_phb_probe(struct platform_device *dev)
66 /* Init pci_dn data structures */ 67 /* Init pci_dn data structures */
67 pci_devs_phb_init_dynamic(phb); 68 pci_devs_phb_init_dynamic(phb);
68 69
70 /* Create EEH devices for the PHB */
71 eeh_dev_phb_init_dynamic(phb);
72
69 /* Register devices with EEH */ 73 /* Register devices with EEH */
70#ifdef CONFIG_EEH 74#ifdef CONFIG_EEH
71 if (dev->dev.of_node->child) 75 if (dev->dev.of_node->child)
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 41456ff55e1..0bb1f98613b 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -11,13 +11,10 @@
11#include <linux/export.h> 11#include <linux/export.h>
12#include <linux/memblock.h> 12#include <linux/memblock.h>
13 13
14#include <asm/firmware.h>
15#include <asm/lppaca.h> 14#include <asm/lppaca.h>
16#include <asm/paca.h> 15#include <asm/paca.h>
17#include <asm/sections.h> 16#include <asm/sections.h>
18#include <asm/pgtable.h> 17#include <asm/pgtable.h>
19#include <asm/iseries/lpar_map.h>
20#include <asm/iseries/hv_types.h>
21#include <asm/kexec.h> 18#include <asm/kexec.h>
22 19
23/* This symbol is provided by the linker - let it fill in the paca 20/* This symbol is provided by the linker - let it fill in the paca
@@ -30,8 +27,8 @@ extern unsigned long __toc_start;
30 * The structure which the hypervisor knows about - this structure 27 * The structure which the hypervisor knows about - this structure
31 * should not cross a page boundary. The vpa_init/register_vpa call 28 * should not cross a page boundary. The vpa_init/register_vpa call
32 * is now known to fail if the lppaca structure crosses a page 29 * is now known to fail if the lppaca structure crosses a page
33 * boundary. The lppaca is also used on legacy iSeries and POWER5 30 * boundary. The lppaca is also used on POWER5 pSeries boxes.
34 * pSeries boxes. The lppaca is 640 bytes long, and cannot readily 31 * The lppaca is 640 bytes long, and cannot readily
35 * change since the hypervisor knows its layout, so a 1kB alignment 32 * change since the hypervisor knows its layout, so a 1kB alignment
36 * will suffice to ensure that it doesn't cross a page boundary. 33 * will suffice to ensure that it doesn't cross a page boundary.
37 */ 34 */
@@ -183,12 +180,9 @@ void __init allocate_pacas(void)
183 /* 180 /*
184 * We can't take SLB misses on the paca, and we want to access them 181 * We can't take SLB misses on the paca, and we want to access them
185 * in real mode, so allocate them within the RMA and also within 182 * in real mode, so allocate them within the RMA and also within
186 * the first segment. On iSeries they must be within the area mapped 183 * the first segment.
187 * by the HV, which is HvPagesToMap * HVPAGESIZE bytes.
188 */ 184 */
189 limit = min(0x10000000ULL, ppc64_rma_size); 185 limit = min(0x10000000ULL, ppc64_rma_size);
190 if (firmware_has_feature(FW_FEATURE_ISERIES))
191 limit = min(limit, HvPagesToMap * HVPAGESIZE);
192 186
193 paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpu_ids); 187 paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpu_ids);
194 188
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index cce98d76e90..8e78e93c818 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -38,7 +38,6 @@
38#include <asm/byteorder.h> 38#include <asm/byteorder.h>
39#include <asm/machdep.h> 39#include <asm/machdep.h>
40#include <asm/ppc-pci.h> 40#include <asm/ppc-pci.h>
41#include <asm/firmware.h>
42#include <asm/eeh.h> 41#include <asm/eeh.h>
43 42
44static DEFINE_SPINLOCK(hose_spinlock); 43static DEFINE_SPINLOCK(hose_spinlock);
@@ -50,9 +49,6 @@ static int global_phb_number; /* Global phb counter */
50/* ISA Memory physical address */ 49/* ISA Memory physical address */
51resource_size_t isa_mem_base; 50resource_size_t isa_mem_base;
52 51
53/* Default PCI flags is 0 on ppc32, modified at boot on ppc64 */
54unsigned int pci_flags = 0;
55
56 52
57static struct dma_map_ops *pci_dma_ops = &dma_direct_ops; 53static struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
58 54
@@ -219,20 +215,6 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
219 struct of_irq oirq; 215 struct of_irq oirq;
220 unsigned int virq; 216 unsigned int virq;
221 217
222 /* The current device-tree that iSeries generates from the HV
223 * PCI informations doesn't contain proper interrupt routing,
224 * and all the fallback would do is print out crap, so we
225 * don't attempt to resolve the interrupts here at all, some
226 * iSeries specific fixup does it.
227 *
228 * In the long run, we will hopefully fix the generated device-tree
229 * instead.
230 */
231#ifdef CONFIG_PPC_ISERIES
232 if (firmware_has_feature(FW_FEATURE_ISERIES))
233 return -1;
234#endif
235
236 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev)); 218 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
237 219
238#ifdef DEBUG 220#ifdef DEBUG
@@ -849,60 +831,6 @@ int pci_proc_domain(struct pci_bus *bus)
849 return 1; 831 return 1;
850} 832}
851 833
852void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
853 struct resource *res)
854{
855 resource_size_t offset = 0, mask = (resource_size_t)-1;
856 struct pci_controller *hose = pci_bus_to_host(dev->bus);
857
858 if (!hose)
859 return;
860 if (res->flags & IORESOURCE_IO) {
861 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
862 mask = 0xffffffffu;
863 } else if (res->flags & IORESOURCE_MEM)
864 offset = hose->pci_mem_offset;
865
866 region->start = (res->start - offset) & mask;
867 region->end = (res->end - offset) & mask;
868}
869EXPORT_SYMBOL(pcibios_resource_to_bus);
870
871void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
872 struct pci_bus_region *region)
873{
874 resource_size_t offset = 0, mask = (resource_size_t)-1;
875 struct pci_controller *hose = pci_bus_to_host(dev->bus);
876
877 if (!hose)
878 return;
879 if (res->flags & IORESOURCE_IO) {
880 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
881 mask = 0xffffffffu;
882 } else if (res->flags & IORESOURCE_MEM)
883 offset = hose->pci_mem_offset;
884 res->start = (region->start + offset) & mask;
885 res->end = (region->end + offset) & mask;
886}
887EXPORT_SYMBOL(pcibios_bus_to_resource);
888
889/* Fixup a bus resource into a linux resource */
890static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
891{
892 struct pci_controller *hose = pci_bus_to_host(dev->bus);
893 resource_size_t offset = 0, mask = (resource_size_t)-1;
894
895 if (res->flags & IORESOURCE_IO) {
896 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
897 mask = 0xffffffffu;
898 } else if (res->flags & IORESOURCE_MEM)
899 offset = hose->pci_mem_offset;
900
901 res->start = (res->start + offset) & mask;
902 res->end = (res->end + offset) & mask;
903}
904
905
906/* This header fixup will do the resource fixup for all devices as they are 834/* This header fixup will do the resource fixup for all devices as they are
907 * probed, but not for bridge ranges 835 * probed, but not for bridge ranges
908 */ 836 */
@@ -942,18 +870,11 @@ static void __devinit pcibios_fixup_resources(struct pci_dev *dev)
942 continue; 870 continue;
943 } 871 }
944 872
945 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] fixup...\n", 873 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]\n",
946 pci_name(dev), i, 874 pci_name(dev), i,
947 (unsigned long long)res->start,\ 875 (unsigned long long)res->start,\
948 (unsigned long long)res->end, 876 (unsigned long long)res->end,
949 (unsigned int)res->flags); 877 (unsigned int)res->flags);
950
951 fixup_resource(res, dev);
952
953 pr_debug("PCI:%s %016llx-%016llx\n",
954 pci_name(dev),
955 (unsigned long long)res->start,
956 (unsigned long long)res->end);
957 } 878 }
958 879
959 /* Call machine specific resource fixup */ 880 /* Call machine specific resource fixup */
@@ -1055,27 +976,18 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
1055 continue; 976 continue;
1056 } 977 }
1057 978
1058 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n", 979 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x]\n",
1059 pci_name(dev), i, 980 pci_name(dev), i,
1060 (unsigned long long)res->start,\ 981 (unsigned long long)res->start,\
1061 (unsigned long long)res->end, 982 (unsigned long long)res->end,
1062 (unsigned int)res->flags); 983 (unsigned int)res->flags);
1063 984
1064 /* Perform fixup */
1065 fixup_resource(res, dev);
1066
1067 /* Try to detect uninitialized P2P bridge resources, 985 /* Try to detect uninitialized P2P bridge resources,
1068 * and clear them out so they get re-assigned later 986 * and clear them out so they get re-assigned later
1069 */ 987 */
1070 if (pcibios_uninitialized_bridge_resource(bus, res)) { 988 if (pcibios_uninitialized_bridge_resource(bus, res)) {
1071 res->flags = 0; 989 res->flags = 0;
1072 pr_debug("PCI:%s (unassigned)\n", pci_name(dev)); 990 pr_debug("PCI:%s (unassigned)\n", pci_name(dev));
1073 } else {
1074
1075 pr_debug("PCI:%s %016llx-%016llx\n",
1076 pci_name(dev),
1077 (unsigned long long)res->start,
1078 (unsigned long long)res->end);
1079 } 991 }
1080 } 992 }
1081} 993}
@@ -1565,6 +1477,11 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
1565 return pci_enable_resources(dev, mask); 1477 return pci_enable_resources(dev, mask);
1566} 1478}
1567 1479
1480resource_size_t pcibios_io_space_offset(struct pci_controller *hose)
1481{
1482 return (unsigned long) hose->io_base_virt - _IO_BASE;
1483}
1484
1568static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources) 1485static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources)
1569{ 1486{
1570 struct resource *res; 1487 struct resource *res;
@@ -1589,7 +1506,7 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, s
1589 (unsigned long long)res->start, 1506 (unsigned long long)res->start,
1590 (unsigned long long)res->end, 1507 (unsigned long long)res->end,
1591 (unsigned long)res->flags); 1508 (unsigned long)res->flags);
1592 pci_add_resource(resources, res); 1509 pci_add_resource_offset(resources, res, pcibios_io_space_offset(hose));
1593 1510
1594 /* Hookup PHB Memory resources */ 1511 /* Hookup PHB Memory resources */
1595 for (i = 0; i < 3; ++i) { 1512 for (i = 0; i < 3; ++i) {
@@ -1612,7 +1529,7 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, s
1612 (unsigned long long)res->start, 1529 (unsigned long long)res->start,
1613 (unsigned long long)res->end, 1530 (unsigned long long)res->end,
1614 (unsigned long)res->flags); 1531 (unsigned long)res->flags);
1615 pci_add_resource(resources, res); 1532 pci_add_resource_offset(resources, res, hose->pci_mem_offset);
1616 } 1533 }
1617 1534
1618 pr_debug("PCI: PHB MEM offset = %016llx\n", 1535 pr_debug("PCI: PHB MEM offset = %016llx\n",
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index fdd1a3d951d..4b06ec5a502 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -219,9 +219,9 @@ void __devinit pcibios_setup_phb_io_space(struct pci_controller *hose)
219 struct resource *res = &hose->io_resource; 219 struct resource *res = &hose->io_resource;
220 220
221 /* Fixup IO space offset */ 221 /* Fixup IO space offset */
222 io_offset = (unsigned long)hose->io_base_virt - isa_io_base; 222 io_offset = pcibios_io_space_offset(hose);
223 res->start = (res->start + io_offset) & 0xffffffffu; 223 res->start += io_offset;
224 res->end = (res->end + io_offset) & 0xffffffffu; 224 res->end += io_offset;
225} 225}
226 226
227static int __init pcibios_init(void) 227static int __init pcibios_init(void)
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 3318d39b7d4..94a54f61d34 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -33,8 +33,6 @@
33#include <asm/machdep.h> 33#include <asm/machdep.h>
34#include <asm/ppc-pci.h> 34#include <asm/ppc-pci.h>
35 35
36unsigned long pci_probe_only = 1;
37
38/* pci_io_base -- the base address from which io bars are offsets. 36/* pci_io_base -- the base address from which io bars are offsets.
39 * This is the lowest I/O base address (so bar values are always positive), 37 * This is the lowest I/O base address (so bar values are always positive),
40 * and it *must* be the start of ISA space if an ISA bus exists because 38 * and it *must* be the start of ISA space if an ISA bus exists because
@@ -55,9 +53,6 @@ static int __init pcibios_init(void)
55 */ 53 */
56 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot; 54 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
57 55
58 if (pci_probe_only)
59 pci_add_flags(PCI_PROBE_ONLY);
60
61 /* On ppc64, we always enable PCI domains and we keep domain 0 56 /* On ppc64, we always enable PCI domains and we keep domain 0
62 * backward compatible in /proc for video cards 57 * backward compatible in /proc for video cards
63 */ 58 */
@@ -173,7 +168,7 @@ static int __devinit pcibios_map_phb_io_space(struct pci_controller *hose)
173 return -ENOMEM; 168 return -ENOMEM;
174 169
175 /* Fixup hose IO resource */ 170 /* Fixup hose IO resource */
176 io_virt_offset = (unsigned long)hose->io_base_virt - _IO_BASE; 171 io_virt_offset = pcibios_io_space_offset(hose);
177 hose->io_resource.start += io_virt_offset; 172 hose->io_resource.start += io_virt_offset;
178 hose->io_resource.end += io_virt_offset; 173 hose->io_resource.end += io_virt_offset;
179 174
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index b37d0b5a796..89dde171a6f 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -75,6 +75,7 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
75{ 75{
76 u64 base, size; 76 u64 base, size;
77 unsigned int flags; 77 unsigned int flags;
78 struct pci_bus_region region;
78 struct resource *res; 79 struct resource *res;
79 const u32 *addrs; 80 const u32 *addrs;
80 u32 i; 81 u32 i;
@@ -106,10 +107,11 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
106 printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i); 107 printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);
107 continue; 108 continue;
108 } 109 }
109 res->start = base;
110 res->end = base + size - 1;
111 res->flags = flags; 110 res->flags = flags;
112 res->name = pci_name(dev); 111 res->name = pci_name(dev);
112 region.start = base;
113 region.end = base + size - 1;
114 pcibios_bus_to_resource(dev, res, &region);
113 } 115 }
114} 116}
115 117
@@ -209,6 +211,7 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
209 struct pci_bus *bus; 211 struct pci_bus *bus;
210 const u32 *busrange, *ranges; 212 const u32 *busrange, *ranges;
211 int len, i, mode; 213 int len, i, mode;
214 struct pci_bus_region region;
212 struct resource *res; 215 struct resource *res;
213 unsigned int flags; 216 unsigned int flags;
214 u64 size; 217 u64 size;
@@ -270,9 +273,10 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
270 res = bus->resource[i]; 273 res = bus->resource[i];
271 ++i; 274 ++i;
272 } 275 }
273 res->start = of_read_number(&ranges[1], 2);
274 res->end = res->start + size - 1;
275 res->flags = flags; 276 res->flags = flags;
277 region.start = of_read_number(&ranges[1], 2);
278 region.end = region.start + size - 1;
279 pcibios_bus_to_resource(dev, res, &region);
276 } 280 }
277 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 281 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
278 bus->number); 282 bus->number);
diff --git a/arch/powerpc/kernel/pmc.c b/arch/powerpc/kernel/pmc.c
index a841a9d136a..58eaa3ddf7b 100644
--- a/arch/powerpc/kernel/pmc.c
+++ b/arch/powerpc/kernel/pmc.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/bug.h>
16#include <linux/spinlock.h> 17#include <linux/spinlock.h>
17#include <linux/export.h> 18#include <linux/export.h>
18 19
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index d817ab01848..e40707032ac 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -647,6 +647,9 @@ void show_regs(struct pt_regs * regs)
647 printk("MSR: "REG" ", regs->msr); 647 printk("MSR: "REG" ", regs->msr);
648 printbits(regs->msr, msr_bits); 648 printbits(regs->msr, msr_bits);
649 printk(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer); 649 printk(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer);
650#ifdef CONFIG_PPC64
651 printk("SOFTE: %ld\n", regs->softe);
652#endif
650 trap = TRAP(regs); 653 trap = TRAP(regs);
651 if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR)) 654 if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
652 printk("CFAR: "REG"\n", regs->orig_gpr3); 655 printk("CFAR: "REG"\n", regs->orig_gpr3);
@@ -1220,34 +1223,32 @@ void dump_stack(void)
1220EXPORT_SYMBOL(dump_stack); 1223EXPORT_SYMBOL(dump_stack);
1221 1224
1222#ifdef CONFIG_PPC64 1225#ifdef CONFIG_PPC64
1223void ppc64_runlatch_on(void) 1226/* Called with hard IRQs off */
1227void __ppc64_runlatch_on(void)
1224{ 1228{
1229 struct thread_info *ti = current_thread_info();
1225 unsigned long ctrl; 1230 unsigned long ctrl;
1226 1231
1227 if (cpu_has_feature(CPU_FTR_CTRL) && !test_thread_flag(TIF_RUNLATCH)) { 1232 ctrl = mfspr(SPRN_CTRLF);
1228 HMT_medium(); 1233 ctrl |= CTRL_RUNLATCH;
1229 1234 mtspr(SPRN_CTRLT, ctrl);
1230 ctrl = mfspr(SPRN_CTRLF);
1231 ctrl |= CTRL_RUNLATCH;
1232 mtspr(SPRN_CTRLT, ctrl);
1233 1235
1234 set_thread_flag(TIF_RUNLATCH); 1236 ti->local_flags |= TLF_RUNLATCH;
1235 }
1236} 1237}
1237 1238
1239/* Called with hard IRQs off */
1238void __ppc64_runlatch_off(void) 1240void __ppc64_runlatch_off(void)
1239{ 1241{
1242 struct thread_info *ti = current_thread_info();
1240 unsigned long ctrl; 1243 unsigned long ctrl;
1241 1244
1242 HMT_medium(); 1245 ti->local_flags &= ~TLF_RUNLATCH;
1243
1244 clear_thread_flag(TIF_RUNLATCH);
1245 1246
1246 ctrl = mfspr(SPRN_CTRLF); 1247 ctrl = mfspr(SPRN_CTRLF);
1247 ctrl &= ~CTRL_RUNLATCH; 1248 ctrl &= ~CTRL_RUNLATCH;
1248 mtspr(SPRN_CTRLT, ctrl); 1249 mtspr(SPRN_CTRLT, ctrl);
1249} 1250}
1250#endif 1251#endif /* CONFIG_PPC64 */
1251 1252
1252#if THREAD_SHIFT < PAGE_SHIFT 1253#if THREAD_SHIFT < PAGE_SHIFT
1253 1254
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index abe405dab34..89e850af3dd 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -52,9 +52,9 @@
52#include <asm/machdep.h> 52#include <asm/machdep.h>
53#include <asm/pSeries_reconfig.h> 53#include <asm/pSeries_reconfig.h>
54#include <asm/pci-bridge.h> 54#include <asm/pci-bridge.h>
55#include <asm/phyp_dump.h>
56#include <asm/kexec.h> 55#include <asm/kexec.h>
57#include <asm/opal.h> 56#include <asm/opal.h>
57#include <asm/fadump.h>
58 58
59#include <mm/mmu_decl.h> 59#include <mm/mmu_decl.h>
60 60
@@ -615,86 +615,6 @@ static void __init early_reserve_mem(void)
615 } 615 }
616} 616}
617 617
618#ifdef CONFIG_PHYP_DUMP
619/**
620 * phyp_dump_calculate_reserve_size() - reserve variable boot area 5% or arg
621 *
622 * Function to find the largest size we need to reserve
623 * during early boot process.
624 *
625 * It either looks for boot param and returns that OR
626 * returns larger of 256 or 5% rounded down to multiples of 256MB.
627 *
628 */
629static inline unsigned long phyp_dump_calculate_reserve_size(void)
630{
631 unsigned long tmp;
632
633 if (phyp_dump_info->reserve_bootvar)
634 return phyp_dump_info->reserve_bootvar;
635
636 /* divide by 20 to get 5% of value */
637 tmp = memblock_end_of_DRAM();
638 do_div(tmp, 20);
639
640 /* round it down in multiples of 256 */
641 tmp = tmp & ~0x0FFFFFFFUL;
642
643 return (tmp > PHYP_DUMP_RMR_END ? tmp : PHYP_DUMP_RMR_END);
644}
645
646/**
647 * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory
648 *
649 * This routine may reserve memory regions in the kernel only
650 * if the system is supported and a dump was taken in last
651 * boot instance or if the hardware is supported and the
652 * scratch area needs to be setup. In other instances it returns
653 * without reserving anything. The memory in case of dump being
654 * active is freed when the dump is collected (by userland tools).
655 */
656static void __init phyp_dump_reserve_mem(void)
657{
658 unsigned long base, size;
659 unsigned long variable_reserve_size;
660
661 if (!phyp_dump_info->phyp_dump_configured) {
662 printk(KERN_ERR "Phyp-dump not supported on this hardware\n");
663 return;
664 }
665
666 if (!phyp_dump_info->phyp_dump_at_boot) {
667 printk(KERN_INFO "Phyp-dump disabled at boot time\n");
668 return;
669 }
670
671 variable_reserve_size = phyp_dump_calculate_reserve_size();
672
673 if (phyp_dump_info->phyp_dump_is_active) {
674 /* Reserve *everything* above RMR.Area freed by userland tools*/
675 base = variable_reserve_size;
676 size = memblock_end_of_DRAM() - base;
677
678 /* XXX crashed_ram_end is wrong, since it may be beyond
679 * the memory_limit, it will need to be adjusted. */
680 memblock_reserve(base, size);
681
682 phyp_dump_info->init_reserve_start = base;
683 phyp_dump_info->init_reserve_size = size;
684 } else {
685 size = phyp_dump_info->cpu_state_size +
686 phyp_dump_info->hpte_region_size +
687 variable_reserve_size;
688 base = memblock_end_of_DRAM() - size;
689 memblock_reserve(base, size);
690 phyp_dump_info->init_reserve_start = base;
691 phyp_dump_info->init_reserve_size = size;
692 }
693}
694#else
695static inline void __init phyp_dump_reserve_mem(void) {}
696#endif /* CONFIG_PHYP_DUMP && CONFIG_PPC_RTAS */
697
698void __init early_init_devtree(void *params) 618void __init early_init_devtree(void *params)
699{ 619{
700 phys_addr_t limit; 620 phys_addr_t limit;
@@ -714,9 +634,9 @@ void __init early_init_devtree(void *params)
714 of_scan_flat_dt(early_init_dt_scan_opal, NULL); 634 of_scan_flat_dt(early_init_dt_scan_opal, NULL);
715#endif 635#endif
716 636
717#ifdef CONFIG_PHYP_DUMP 637#ifdef CONFIG_FA_DUMP
718 /* scan tree to see if dump occurred during last boot */ 638 /* scan tree to see if dump is active during last boot */
719 of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL); 639 of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL);
720#endif 640#endif
721 641
722 /* Pre-initialize the cmd_line with the content of boot_commmand_line, 642 /* Pre-initialize the cmd_line with the content of boot_commmand_line,
@@ -750,9 +670,15 @@ void __init early_init_devtree(void *params)
750 if (PHYSICAL_START > MEMORY_START) 670 if (PHYSICAL_START > MEMORY_START)
751 memblock_reserve(MEMORY_START, 0x8000); 671 memblock_reserve(MEMORY_START, 0x8000);
752 reserve_kdump_trampoline(); 672 reserve_kdump_trampoline();
753 reserve_crashkernel(); 673#ifdef CONFIG_FA_DUMP
674 /*
675 * If we fail to reserve memory for firmware-assisted dump then
676 * fallback to kexec based kdump.
677 */
678 if (fadump_reserve_mem() == 0)
679#endif
680 reserve_crashkernel();
754 early_reserve_mem(); 681 early_reserve_mem();
755 phyp_dump_reserve_mem();
756 682
757 /* 683 /*
758 * Ensure that total memory size is page-aligned, because otherwise 684 * Ensure that total memory size is page-aligned, because otherwise
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index eca626ea3f2..e2d59904814 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -48,14 +48,6 @@
48#include <linux/linux_logo.h> 48#include <linux/linux_logo.h>
49 49
50/* 50/*
51 * Properties whose value is longer than this get excluded from our
52 * copy of the device tree. This value does need to be big enough to
53 * ensure that we don't lose things like the interrupt-map property
54 * on a PCI-PCI bridge.
55 */
56#define MAX_PROPERTY_LENGTH (1UL * 1024 * 1024)
57
58/*
59 * Eventually bump that one up 51 * Eventually bump that one up
60 */ 52 */
61#define DEVTREE_CHUNK_SIZE 0x100000 53#define DEVTREE_CHUNK_SIZE 0x100000
@@ -2273,13 +2265,6 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
2273 /* sanity checks */ 2265 /* sanity checks */
2274 if (l == PROM_ERROR) 2266 if (l == PROM_ERROR)
2275 continue; 2267 continue;
2276 if (l > MAX_PROPERTY_LENGTH) {
2277 prom_printf("WARNING: ignoring large property ");
2278 /* It seems OF doesn't null-terminate the path :-( */
2279 prom_printf("[%s] ", path);
2280 prom_printf("%s length 0x%x\n", RELOC(pname), l);
2281 continue;
2282 }
2283 2268
2284 /* push property head */ 2269 /* push property head */
2285 dt_push_token(OF_DT_PROP, mem_start, mem_end); 2270 dt_push_token(OF_DT_PROP, mem_start, mem_end);
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 6cd8f0196b6..179af906dcd 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -275,8 +275,11 @@ void __init find_and_init_phbs(void)
275 of_node_put(root); 275 of_node_put(root);
276 pci_devs_phb_init(); 276 pci_devs_phb_init();
277 277
278 /* Create EEH devices for all PHBs */
279 eeh_dev_phb_init();
280
278 /* 281 /*
279 * pci_probe_only and pci_assign_all_buses can be set via properties 282 * PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties
280 * in chosen. 283 * in chosen.
281 */ 284 */
282 if (of_chosen) { 285 if (of_chosen) {
@@ -284,8 +287,12 @@ void __init find_and_init_phbs(void)
284 287
285 prop = of_get_property(of_chosen, 288 prop = of_get_property(of_chosen,
286 "linux,pci-probe-only", NULL); 289 "linux,pci-probe-only", NULL);
287 if (prop) 290 if (prop) {
288 pci_probe_only = *prop; 291 if (*prop)
292 pci_add_flags(PCI_PROBE_ONLY);
293 else
294 pci_clear_flags(PCI_PROBE_ONLY);
295 }
289 296
290#ifdef CONFIG_PPC32 /* Will be made generic soon */ 297#ifdef CONFIG_PPC32 /* Will be made generic soon */
291 prop = of_get_property(of_chosen, 298 prop = of_get_property(of_chosen,
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 77bb77da05c..b0ebdeab949 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -61,6 +61,7 @@
61#include <asm/xmon.h> 61#include <asm/xmon.h>
62#include <asm/cputhreads.h> 62#include <asm/cputhreads.h>
63#include <mm/mmu_decl.h> 63#include <mm/mmu_decl.h>
64#include <asm/fadump.h>
64 65
65#include "setup.h" 66#include "setup.h"
66 67
@@ -109,6 +110,14 @@ EXPORT_SYMBOL(ppc_do_canonicalize_irqs);
109/* also used by kexec */ 110/* also used by kexec */
110void machine_shutdown(void) 111void machine_shutdown(void)
111{ 112{
113#ifdef CONFIG_FA_DUMP
114 /*
115 * if fadump is active, cleanup the fadump registration before we
116 * shutdown.
117 */
118 fadump_cleanup();
119#endif
120
112 if (ppc_md.machine_shutdown) 121 if (ppc_md.machine_shutdown)
113 ppc_md.machine_shutdown(); 122 ppc_md.machine_shutdown();
114} 123}
@@ -639,6 +648,11 @@ EXPORT_SYMBOL(check_legacy_ioport);
639static int ppc_panic_event(struct notifier_block *this, 648static int ppc_panic_event(struct notifier_block *this,
640 unsigned long event, void *ptr) 649 unsigned long event, void *ptr)
641{ 650{
651 /*
652 * If firmware-assisted dump has been registered then trigger
653 * firmware-assisted dump and let firmware handle everything else.
654 */
655 crash_fadump(NULL, ptr);
642 ppc_md.panic(ptr); /* May not return */ 656 ppc_md.panic(ptr); /* May not return */
643 return NOTIFY_DONE; 657 return NOTIFY_DONE;
644} 658}
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index ac6e437b102..7006b7f4267 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -57,10 +57,7 @@ void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
57void restore_sigmask(sigset_t *set) 57void restore_sigmask(sigset_t *set)
58{ 58{
59 sigdelsetmask(set, ~_BLOCKABLE); 59 sigdelsetmask(set, ~_BLOCKABLE);
60 spin_lock_irq(&current->sighand->siglock); 60 set_current_blocked(set);
61 current->blocked = *set;
62 recalc_sigpending();
63 spin_unlock_irq(&current->sighand->siglock);
64} 61}
65 62
66static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka, 63static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka,
@@ -169,13 +166,7 @@ static int do_signal(struct pt_regs *regs)
169 166
170 regs->trap = 0; 167 regs->trap = 0;
171 if (ret) { 168 if (ret) {
172 spin_lock_irq(&current->sighand->siglock); 169 block_sigmask(&ka, signr);
173 sigorsets(&current->blocked, &current->blocked,
174 &ka.sa.sa_mask);
175 if (!(ka.sa.sa_flags & SA_NODEFER))
176 sigaddset(&current->blocked, signr);
177 recalc_sigpending();
178 spin_unlock_irq(&current->sighand->siglock);
179 170
180 /* 171 /*
181 * A signal was successfully delivered; the saved sigmask is in 172 * A signal was successfully delivered; the saved sigmask is in
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 836a5a19eb2..e061ef5dd44 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -242,12 +242,13 @@ static inline int restore_general_regs(struct pt_regs *regs,
242 */ 242 */
243long sys_sigsuspend(old_sigset_t mask) 243long sys_sigsuspend(old_sigset_t mask)
244{ 244{
245 mask &= _BLOCKABLE; 245 sigset_t blocked;
246 spin_lock_irq(&current->sighand->siglock); 246
247 current->saved_sigmask = current->blocked; 247 current->saved_sigmask = current->blocked;
248 siginitset(&current->blocked, mask); 248
249 recalc_sigpending(); 249 mask &= _BLOCKABLE;
250 spin_unlock_irq(&current->sighand->siglock); 250 siginitset(&blocked, mask);
251 set_current_blocked(&blocked);
251 252
252 current->state = TASK_INTERRUPTIBLE; 253 current->state = TASK_INTERRUPTIBLE;
253 schedule(); 254 schedule();
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 883e74c0d1b..0c683d376b1 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -12,7 +12,6 @@
12#include <asm/current.h> 12#include <asm/current.h>
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/cputable.h> 14#include <asm/cputable.h>
15#include <asm/firmware.h>
16#include <asm/hvcall.h> 15#include <asm/hvcall.h>
17#include <asm/prom.h> 16#include <asm/prom.h>
18#include <asm/machdep.h> 17#include <asm/machdep.h>
@@ -341,8 +340,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
341 int i, nattrs; 340 int i, nattrs;
342 341
343#ifdef CONFIG_PPC64 342#ifdef CONFIG_PPC64
344 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 343 if (cpu_has_feature(CPU_FTR_SMT))
345 cpu_has_feature(CPU_FTR_SMT))
346 device_create_file(s, &dev_attr_smt_snooze_delay); 344 device_create_file(s, &dev_attr_smt_snooze_delay);
347#endif 345#endif
348 346
@@ -414,8 +412,7 @@ static void unregister_cpu_online(unsigned int cpu)
414 BUG_ON(!c->hotpluggable); 412 BUG_ON(!c->hotpluggable);
415 413
416#ifdef CONFIG_PPC64 414#ifdef CONFIG_PPC64
417 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 415 if (cpu_has_feature(CPU_FTR_SMT))
418 cpu_has_feature(CPU_FTR_SMT))
419 device_remove_file(s, &dev_attr_smt_snooze_delay); 416 device_remove_file(s, &dev_attr_smt_snooze_delay);
420#endif 417#endif
421 418
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 567dd7c3ac2..2c42cd72d0f 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -17,8 +17,7 @@
17 * 17 *
18 * TODO (not necessarily in this file): 18 * TODO (not necessarily in this file):
19 * - improve precision and reproducibility of timebase frequency 19 * - improve precision and reproducibility of timebase frequency
20 * measurement at boot time. (for iSeries, we calibrate the timebase 20 * measurement at boot time.
21 * against the Titan chip's clock.)
22 * - for astronomical applications: add a new function to get 21 * - for astronomical applications: add a new function to get
23 * non ambiguous timestamps even around leap seconds. This needs 22 * non ambiguous timestamps even around leap seconds. This needs
24 * a new timestamp format and a good name. 23 * a new timestamp format and a good name.
@@ -70,10 +69,6 @@
70#include <asm/vdso_datapage.h> 69#include <asm/vdso_datapage.h>
71#include <asm/firmware.h> 70#include <asm/firmware.h>
72#include <asm/cputime.h> 71#include <asm/cputime.h>
73#ifdef CONFIG_PPC_ISERIES
74#include <asm/iseries/it_lp_queue.h>
75#include <asm/iseries/hv_call_xm.h>
76#endif
77 72
78/* powerpc clocksource/clockevent code */ 73/* powerpc clocksource/clockevent code */
79 74
@@ -117,14 +112,6 @@ static struct clock_event_device decrementer_clockevent = {
117DEFINE_PER_CPU(u64, decrementers_next_tb); 112DEFINE_PER_CPU(u64, decrementers_next_tb);
118static DEFINE_PER_CPU(struct clock_event_device, decrementers); 113static DEFINE_PER_CPU(struct clock_event_device, decrementers);
119 114
120#ifdef CONFIG_PPC_ISERIES
121static unsigned long __initdata iSeries_recal_titan;
122static signed long __initdata iSeries_recal_tb;
123
124/* Forward declaration is only needed for iSereis compiles */
125static void __init clocksource_init(void);
126#endif
127
128#define XSEC_PER_SEC (1024*1024) 115#define XSEC_PER_SEC (1024*1024)
129 116
130#ifdef CONFIG_PPC64 117#ifdef CONFIG_PPC64
@@ -259,7 +246,6 @@ void accumulate_stolen_time(void)
259 u64 sst, ust; 246 u64 sst, ust;
260 247
261 u8 save_soft_enabled = local_paca->soft_enabled; 248 u8 save_soft_enabled = local_paca->soft_enabled;
262 u8 save_hard_enabled = local_paca->hard_enabled;
263 249
264 /* We are called early in the exception entry, before 250 /* We are called early in the exception entry, before
265 * soft/hard_enabled are sync'ed to the expected state 251 * soft/hard_enabled are sync'ed to the expected state
@@ -268,7 +254,6 @@ void accumulate_stolen_time(void)
268 * complain 254 * complain
269 */ 255 */
270 local_paca->soft_enabled = 0; 256 local_paca->soft_enabled = 0;
271 local_paca->hard_enabled = 0;
272 257
273 sst = scan_dispatch_log(local_paca->starttime_user); 258 sst = scan_dispatch_log(local_paca->starttime_user);
274 ust = scan_dispatch_log(local_paca->starttime); 259 ust = scan_dispatch_log(local_paca->starttime);
@@ -277,7 +262,6 @@ void accumulate_stolen_time(void)
277 local_paca->stolen_time += ust + sst; 262 local_paca->stolen_time += ust + sst;
278 263
279 local_paca->soft_enabled = save_soft_enabled; 264 local_paca->soft_enabled = save_soft_enabled;
280 local_paca->hard_enabled = save_hard_enabled;
281} 265}
282 266
283static inline u64 calculate_stolen_time(u64 stop_tb) 267static inline u64 calculate_stolen_time(u64 stop_tb)
@@ -426,74 +410,6 @@ unsigned long profile_pc(struct pt_regs *regs)
426EXPORT_SYMBOL(profile_pc); 410EXPORT_SYMBOL(profile_pc);
427#endif 411#endif
428 412
429#ifdef CONFIG_PPC_ISERIES
430
431/*
432 * This function recalibrates the timebase based on the 49-bit time-of-day
433 * value in the Titan chip. The Titan is much more accurate than the value
434 * returned by the service processor for the timebase frequency.
435 */
436
437static int __init iSeries_tb_recal(void)
438{
439 unsigned long titan, tb;
440
441 /* Make sure we only run on iSeries */
442 if (!firmware_has_feature(FW_FEATURE_ISERIES))
443 return -ENODEV;
444
445 tb = get_tb();
446 titan = HvCallXm_loadTod();
447 if ( iSeries_recal_titan ) {
448 unsigned long tb_ticks = tb - iSeries_recal_tb;
449 unsigned long titan_usec = (titan - iSeries_recal_titan) >> 12;
450 unsigned long new_tb_ticks_per_sec = (tb_ticks * USEC_PER_SEC)/titan_usec;
451 unsigned long new_tb_ticks_per_jiffy =
452 DIV_ROUND_CLOSEST(new_tb_ticks_per_sec, HZ);
453 long tick_diff = new_tb_ticks_per_jiffy - tb_ticks_per_jiffy;
454 char sign = '+';
455 /* make sure tb_ticks_per_sec and tb_ticks_per_jiffy are consistent */
456 new_tb_ticks_per_sec = new_tb_ticks_per_jiffy * HZ;
457
458 if ( tick_diff < 0 ) {
459 tick_diff = -tick_diff;
460 sign = '-';
461 }
462 if ( tick_diff ) {
463 if ( tick_diff < tb_ticks_per_jiffy/25 ) {
464 printk( "Titan recalibrate: new tb_ticks_per_jiffy = %lu (%c%ld)\n",
465 new_tb_ticks_per_jiffy, sign, tick_diff );
466 tb_ticks_per_jiffy = new_tb_ticks_per_jiffy;
467 tb_ticks_per_sec = new_tb_ticks_per_sec;
468 calc_cputime_factors();
469 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec;
470 setup_cputime_one_jiffy();
471 }
472 else {
473 printk( "Titan recalibrate: FAILED (difference > 4 percent)\n"
474 " new tb_ticks_per_jiffy = %lu\n"
475 " old tb_ticks_per_jiffy = %lu\n",
476 new_tb_ticks_per_jiffy, tb_ticks_per_jiffy );
477 }
478 }
479 }
480 iSeries_recal_titan = titan;
481 iSeries_recal_tb = tb;
482
483 /* Called here as now we know accurate values for the timebase */
484 clocksource_init();
485 return 0;
486}
487late_initcall(iSeries_tb_recal);
488
489/* Called from platform early init */
490void __init iSeries_time_init_early(void)
491{
492 iSeries_recal_tb = get_tb();
493 iSeries_recal_titan = HvCallXm_loadTod();
494}
495#endif /* CONFIG_PPC_ISERIES */
496
497#ifdef CONFIG_IRQ_WORK 413#ifdef CONFIG_IRQ_WORK
498 414
499/* 415/*
@@ -550,16 +466,6 @@ void arch_irq_work_raise(void)
550#endif /* CONFIG_IRQ_WORK */ 466#endif /* CONFIG_IRQ_WORK */
551 467
552/* 468/*
553 * For iSeries shared processors, we have to let the hypervisor
554 * set the hardware decrementer. We set a virtual decrementer
555 * in the lppaca and call the hypervisor if the virtual
556 * decrementer is less than the current value in the hardware
557 * decrementer. (almost always the new decrementer value will
558 * be greater than the current hardware decementer so the hypervisor
559 * call will not be needed)
560 */
561
562/*
563 * timer_interrupt - gets called when the decrementer overflows, 469 * timer_interrupt - gets called when the decrementer overflows,
564 * with interrupts disabled. 470 * with interrupts disabled.
565 */ 471 */
@@ -580,6 +486,11 @@ void timer_interrupt(struct pt_regs * regs)
580 if (!cpu_online(smp_processor_id())) 486 if (!cpu_online(smp_processor_id()))
581 return; 487 return;
582 488
489 /* Conditionally hard-enable interrupts now that the DEC has been
490 * bumped to its maximum value
491 */
492 may_hard_irq_enable();
493
583 trace_timer_interrupt_entry(regs); 494 trace_timer_interrupt_entry(regs);
584 495
585 __get_cpu_var(irq_stat).timer_irqs++; 496 __get_cpu_var(irq_stat).timer_irqs++;
@@ -597,20 +508,10 @@ void timer_interrupt(struct pt_regs * regs)
597 irq_work_run(); 508 irq_work_run();
598 } 509 }
599 510
600#ifdef CONFIG_PPC_ISERIES
601 if (firmware_has_feature(FW_FEATURE_ISERIES))
602 get_lppaca()->int_dword.fields.decr_int = 0;
603#endif
604
605 *next_tb = ~(u64)0; 511 *next_tb = ~(u64)0;
606 if (evt->event_handler) 512 if (evt->event_handler)
607 evt->event_handler(evt); 513 evt->event_handler(evt);
608 514
609#ifdef CONFIG_PPC_ISERIES
610 if (firmware_has_feature(FW_FEATURE_ISERIES) && hvlpevent_is_pending())
611 process_hvlpevents();
612#endif
613
614#ifdef CONFIG_PPC64 515#ifdef CONFIG_PPC64
615 /* collect purr register values often, for accurate calculations */ 516 /* collect purr register values often, for accurate calculations */
616 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 517 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
@@ -982,9 +883,8 @@ void __init time_init(void)
982 */ 883 */
983 start_cpu_decrementer(); 884 start_cpu_decrementer();
984 885
985 /* Register the clocksource, if we're not running on iSeries */ 886 /* Register the clocksource */
986 if (!firmware_has_feature(FW_FEATURE_ISERIES)) 887 clocksource_init();
987 clocksource_init();
988 888
989 init_decrementer_clockevent(); 889 init_decrementer_clockevent();
990} 890}
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index c091527efd8..a750409ccc4 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -57,6 +57,7 @@
57#include <asm/kexec.h> 57#include <asm/kexec.h>
58#include <asm/ppc-opcode.h> 58#include <asm/ppc-opcode.h>
59#include <asm/rio.h> 59#include <asm/rio.h>
60#include <asm/fadump.h>
60 61
61#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC) 62#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
62int (*__debugger)(struct pt_regs *regs) __read_mostly; 63int (*__debugger)(struct pt_regs *regs) __read_mostly;
@@ -145,6 +146,8 @@ static void __kprobes oops_end(unsigned long flags, struct pt_regs *regs,
145 arch_spin_unlock(&die_lock); 146 arch_spin_unlock(&die_lock);
146 raw_local_irq_restore(flags); 147 raw_local_irq_restore(flags);
147 148
149 crash_fadump(regs, "die oops");
150
148 /* 151 /*
149 * A system reset (0x100) is a request to dump, so we always send 152 * A system reset (0x100) is a request to dump, so we always send
150 * it through the crashdump code. 153 * it through the crashdump code.
@@ -244,6 +247,9 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
244 addr, regs->nip, regs->link, code); 247 addr, regs->nip, regs->link, code);
245 } 248 }
246 249
250 if (!arch_irq_disabled_regs(regs))
251 local_irq_enable();
252
247 memset(&info, 0, sizeof(info)); 253 memset(&info, 0, sizeof(info));
248 info.si_signo = signr; 254 info.si_signo = signr;
249 info.si_code = code; 255 info.si_code = code;
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 7d14bb697d4..d36ee1055f8 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -263,17 +263,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
263 * the "data" page of the vDSO or you'll stop getting kernel updates 263 * the "data" page of the vDSO or you'll stop getting kernel updates
264 * and your nice userland gettimeofday will be totally dead. 264 * and your nice userland gettimeofday will be totally dead.
265 * It's fine to use that for setting breakpoints in the vDSO code 265 * It's fine to use that for setting breakpoints in the vDSO code
266 * pages though 266 * pages though.
267 *
268 * Make sure the vDSO gets into every core dump.
269 * Dumping its contents makes post-mortem fully interpretable later
270 * without matching up the same kernel and hardware config to see
271 * what PC values meant.
272 */ 267 */
273 rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT, 268 rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
274 VM_READ|VM_EXEC| 269 VM_READ|VM_EXEC|
275 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| 270 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
276 VM_ALWAYSDUMP,
277 vdso_pagelist); 271 vdso_pagelist);
278 if (rc) { 272 if (rc) {
279 current->mm->context.vdso_base = 0; 273 current->mm->context.vdso_base = 0;
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 8b086299ba2..bca3fc427b4 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -34,11 +34,6 @@
34#include <asm/abs_addr.h> 34#include <asm/abs_addr.h>
35#include <asm/page.h> 35#include <asm/page.h>
36#include <asm/hvcall.h> 36#include <asm/hvcall.h>
37#include <asm/iseries/vio.h>
38#include <asm/iseries/hv_types.h>
39#include <asm/iseries/hv_lp_config.h>
40#include <asm/iseries/hv_call_xm.h>
41#include <asm/iseries/iommu.h>
42 37
43static struct bus_type vio_bus_type; 38static struct bus_type vio_bus_type;
44 39
@@ -1042,7 +1037,6 @@ static void vio_cmo_sysfs_init(void)
1042 vio_bus_type.bus_attrs = vio_cmo_bus_attrs; 1037 vio_bus_type.bus_attrs = vio_cmo_bus_attrs;
1043} 1038}
1044#else /* CONFIG_PPC_SMLPAR */ 1039#else /* CONFIG_PPC_SMLPAR */
1045/* Dummy functions for iSeries platform */
1046int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; } 1040int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
1047void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired) {} 1041void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired) {}
1048static int vio_cmo_bus_probe(struct vio_dev *viodev) { return 0; } 1042static int vio_cmo_bus_probe(struct vio_dev *viodev) { return 0; }
@@ -1060,9 +1054,6 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
1060 struct iommu_table *tbl; 1054 struct iommu_table *tbl;
1061 unsigned long offset, size; 1055 unsigned long offset, size;
1062 1056
1063 if (firmware_has_feature(FW_FEATURE_ISERIES))
1064 return vio_build_iommu_table_iseries(dev);
1065
1066 dma_window = of_get_property(dev->dev.of_node, 1057 dma_window = of_get_property(dev->dev.of_node,
1067 "ibm,my-dma-window", NULL); 1058 "ibm,my-dma-window", NULL);
1068 if (!dma_window) 1059 if (!dma_window)
@@ -1195,8 +1186,7 @@ static void __devinit vio_dev_release(struct device *dev)
1195{ 1186{
1196 struct iommu_table *tbl = get_iommu_table_base(dev); 1187 struct iommu_table *tbl = get_iommu_table_base(dev);
1197 1188
1198 /* iSeries uses a common table for all vio devices */ 1189 if (tbl)
1199 if (!firmware_has_feature(FW_FEATURE_ISERIES) && tbl)
1200 iommu_free_table(tbl, dev->of_node ? 1190 iommu_free_table(tbl, dev->of_node ?
1201 dev->of_node->full_name : dev_name(dev)); 1191 dev->of_node->full_name : dev_name(dev));
1202 of_node_put(dev->of_node); 1192 of_node_put(dev->of_node);
@@ -1244,12 +1234,6 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
1244 viodev->name = of_node->name; 1234 viodev->name = of_node->name;
1245 viodev->type = of_node->type; 1235 viodev->type = of_node->type;
1246 viodev->unit_address = *unit_address; 1236 viodev->unit_address = *unit_address;
1247 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
1248 unit_address = of_get_property(of_node,
1249 "linux,unit_address", NULL);
1250 if (unit_address != NULL)
1251 viodev->unit_address = *unit_address;
1252 }
1253 viodev->dev.of_node = of_node_get(of_node); 1237 viodev->dev.of_node = of_node_get(of_node);
1254 1238
1255 if (firmware_has_feature(FW_FEATURE_CMO)) 1239 if (firmware_has_feature(FW_FEATURE_CMO))
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 710a54005df..65d1c08cf09 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -109,11 +109,6 @@ SECTIONS
109 __ptov_table_begin = .; 109 __ptov_table_begin = .;
110 *(.ptov_fixup); 110 *(.ptov_fixup);
111 __ptov_table_end = .; 111 __ptov_table_end = .;
112#ifdef CONFIG_PPC_ISERIES
113 __dt_strings_start = .;
114 *(.dt_strings);
115 __dt_strings_end = .;
116#endif
117 } 112 }
118 113
119 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { 114 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 336983da9e7..a7267167a55 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -46,7 +46,6 @@
46#include <asm/page.h> 46#include <asm/page.h>
47#include <asm/hvcall.h> 47#include <asm/hvcall.h>
48#include <linux/gfp.h> 48#include <linux/gfp.h>
49#include <linux/sched.h>
50#include <linux/vmalloc.h> 49#include <linux/vmalloc.h>
51#include <linux/highmem.h> 50#include <linux/highmem.h>
52 51
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c
index a6ebba56fdd..bb7cfecf278 100644
--- a/arch/powerpc/lib/locks.c
+++ b/arch/powerpc/lib/locks.c
@@ -19,11 +19,9 @@
19#include <linux/smp.h> 19#include <linux/smp.h>
20 20
21/* waiting for a spinlock... */ 21/* waiting for a spinlock... */
22#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) 22#if defined(CONFIG_PPC_SPLPAR)
23#include <asm/hvcall.h> 23#include <asm/hvcall.h>
24#include <asm/iseries/hv_call.h>
25#include <asm/smp.h> 24#include <asm/smp.h>
26#include <asm/firmware.h>
27 25
28void __spin_yield(arch_spinlock_t *lock) 26void __spin_yield(arch_spinlock_t *lock)
29{ 27{
@@ -40,14 +38,8 @@ void __spin_yield(arch_spinlock_t *lock)
40 rmb(); 38 rmb();
41 if (lock->slock != lock_value) 39 if (lock->slock != lock_value)
42 return; /* something has changed */ 40 return; /* something has changed */
43 if (firmware_has_feature(FW_FEATURE_ISERIES)) 41 plpar_hcall_norets(H_CONFER,
44 HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, 42 get_hard_smp_processor_id(holder_cpu), yield_count);
45 ((u64)holder_cpu << 32) | yield_count);
46#ifdef CONFIG_PPC_SPLPAR
47 else
48 plpar_hcall_norets(H_CONFER,
49 get_hard_smp_processor_id(holder_cpu), yield_count);
50#endif
51} 43}
52 44
53/* 45/*
@@ -71,14 +63,8 @@ void __rw_yield(arch_rwlock_t *rw)
71 rmb(); 63 rmb();
72 if (rw->lock != lock_value) 64 if (rw->lock != lock_value)
73 return; /* something has changed */ 65 return; /* something has changed */
74 if (firmware_has_feature(FW_FEATURE_ISERIES)) 66 plpar_hcall_norets(H_CONFER,
75 HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, 67 get_hard_smp_processor_id(holder_cpu), yield_count);
76 ((u64)holder_cpu << 32) | yield_count);
77#ifdef CONFIG_PPC_SPLPAR
78 else
79 plpar_hcall_norets(H_CONFER,
80 get_hard_smp_processor_id(holder_cpu), yield_count);
81#endif
82} 68}
83#endif 69#endif
84 70
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 2f0d1b032a8..19f2f9498b2 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -105,6 +105,82 @@ static int store_updates_sp(struct pt_regs *regs)
105 } 105 }
106 return 0; 106 return 0;
107} 107}
108/*
109 * do_page_fault error handling helpers
110 */
111
112#define MM_FAULT_RETURN 0
113#define MM_FAULT_CONTINUE -1
114#define MM_FAULT_ERR(sig) (sig)
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)
130{
131 siginfo_t info;
132
133 up_read(&current->mm->mmap_sem);
134
135 if (user_mode(regs)) {
136 info.si_signo = SIGBUS;
137 info.si_errno = 0;
138 info.si_code = BUS_ADRERR;
139 info.si_addr = (void __user *)address;
140 force_sig_info(SIGBUS, &info, current);
141 return MM_FAULT_RETURN;
142 }
143 return MM_FAULT_ERR(SIGBUS);
144}
145
146static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
147{
148 /*
149 * Pagefault was interrupted by SIGKILL. We have no reason to
150 * continue the pagefault.
151 */
152 if (fatal_signal_pending(current)) {
153 /*
154 * If we have retry set, the mmap semaphore will have
155 * alrady been released in __lock_page_or_retry(). Else
156 * we release it now.
157 */
158 if (!(fault & VM_FAULT_RETRY))
159 up_read(&current->mm->mmap_sem);
160 /* Coming from kernel, we need to deal with uaccess fixups */
161 if (user_mode(regs))
162 return MM_FAULT_RETURN;
163 return MM_FAULT_ERR(SIGKILL);
164 }
165
166 /* No fault: be happy */
167 if (!(fault & VM_FAULT_ERROR))
168 return MM_FAULT_CONTINUE;
169
170 /* Out of memory */
171 if (fault & VM_FAULT_OOM)
172 return out_of_memory(regs);
173
174 /* Bus error. x86 handles HWPOISON here, we'll add this if/when
175 * we support the feature in HW
176 */
177 if (fault & VM_FAULT_SIGBUS)
178 return do_sigbus(regs, addr);
179
180 /* We don't understand the fault code, this is fatal */
181 BUG();
182 return MM_FAULT_CONTINUE;
183}
108 184
109/* 185/*
110 * For 600- and 800-family processors, the error_code parameter is DSISR 186 * For 600- and 800-family processors, the error_code parameter is DSISR
@@ -124,11 +200,12 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
124{ 200{
125 struct vm_area_struct * vma; 201 struct vm_area_struct * vma;
126 struct mm_struct *mm = current->mm; 202 struct mm_struct *mm = current->mm;
127 siginfo_t info; 203 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
128 int code = SEGV_MAPERR; 204 int code = SEGV_MAPERR;
129 int is_write = 0, ret; 205 int is_write = 0;
130 int trap = TRAP(regs); 206 int trap = TRAP(regs);
131 int is_exec = trap == 0x400; 207 int is_exec = trap == 0x400;
208 int fault;
132 209
133#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) 210#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
134 /* 211 /*
@@ -145,6 +222,9 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
145 is_write = error_code & ESR_DST; 222 is_write = error_code & ESR_DST;
146#endif /* CONFIG_4xx || CONFIG_BOOKE */ 223#endif /* CONFIG_4xx || CONFIG_BOOKE */
147 224
225 if (is_write)
226 flags |= FAULT_FLAG_WRITE;
227
148#ifdef CONFIG_PPC_ICSWX 228#ifdef CONFIG_PPC_ICSWX
149 /* 229 /*
150 * we need to do this early because this "data storage 230 * we need to do this early because this "data storage
@@ -152,13 +232,11 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
152 * look at it 232 * look at it
153 */ 233 */
154 if (error_code & ICSWX_DSI_UCT) { 234 if (error_code & ICSWX_DSI_UCT) {
155 int ret; 235 int rc = acop_handle_fault(regs, address, error_code);
156 236 if (rc)
157 ret = acop_handle_fault(regs, address, error_code); 237 return rc;
158 if (ret)
159 return ret;
160 } 238 }
161#endif 239#endif /* CONFIG_PPC_ICSWX */
162 240
163 if (notify_page_fault(regs)) 241 if (notify_page_fault(regs))
164 return 0; 242 return 0;
@@ -179,6 +257,10 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
179 } 257 }
180#endif 258#endif
181 259
260 /* We restore the interrupt state now */
261 if (!arch_irq_disabled_regs(regs))
262 local_irq_enable();
263
182 if (in_atomic() || mm == NULL) { 264 if (in_atomic() || mm == NULL) {
183 if (!user_mode(regs)) 265 if (!user_mode(regs))
184 return SIGSEGV; 266 return SIGSEGV;
@@ -212,7 +294,15 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
212 if (!user_mode(regs) && !search_exception_tables(regs->nip)) 294 if (!user_mode(regs) && !search_exception_tables(regs->nip))
213 goto bad_area_nosemaphore; 295 goto bad_area_nosemaphore;
214 296
297retry:
215 down_read(&mm->mmap_sem); 298 down_read(&mm->mmap_sem);
299 } else {
300 /*
301 * The above down_read_trylock() might have succeeded in
302 * which case we'll have missed the might_sleep() from
303 * down_read():
304 */
305 might_sleep();
216 } 306 }
217 307
218 vma = find_vma(mm, address); 308 vma = find_vma(mm, address);
@@ -327,30 +417,43 @@ good_area:
327 * make sure we exit gracefully rather than endlessly redo 417 * make sure we exit gracefully rather than endlessly redo
328 * the fault. 418 * the fault.
329 */ 419 */
330 ret = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0); 420 fault = handle_mm_fault(mm, vma, address, flags);
331 if (unlikely(ret & VM_FAULT_ERROR)) { 421 if (unlikely(fault & (VM_FAULT_RETRY|VM_FAULT_ERROR))) {
332 if (ret & VM_FAULT_OOM) 422 int rc = mm_fault_error(regs, address, fault);
333 goto out_of_memory; 423 if (rc >= MM_FAULT_RETURN)
334 else if (ret & VM_FAULT_SIGBUS) 424 return rc;
335 goto do_sigbus;
336 BUG();
337 } 425 }
338 if (ret & VM_FAULT_MAJOR) { 426
339 current->maj_flt++; 427 /*
340 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 428 * Major/minor page fault accounting is only done on the
341 regs, address); 429 * initial attempt. If we go through a retry, it is extremely
430 * likely that the page will be found in page cache at that point.
431 */
432 if (flags & FAULT_FLAG_ALLOW_RETRY) {
433 if (fault & VM_FAULT_MAJOR) {
434 current->maj_flt++;
435 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
436 regs, address);
342#ifdef CONFIG_PPC_SMLPAR 437#ifdef CONFIG_PPC_SMLPAR
343 if (firmware_has_feature(FW_FEATURE_CMO)) { 438 if (firmware_has_feature(FW_FEATURE_CMO)) {
344 preempt_disable(); 439 preempt_disable();
345 get_lppaca()->page_ins += (1 << PAGE_FACTOR); 440 get_lppaca()->page_ins += (1 << PAGE_FACTOR);
346 preempt_enable(); 441 preempt_enable();
442 }
443#endif /* CONFIG_PPC_SMLPAR */
444 } else {
445 current->min_flt++;
446 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
447 regs, address);
448 }
449 if (fault & VM_FAULT_RETRY) {
450 /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
451 * of starvation. */
452 flags &= ~FAULT_FLAG_ALLOW_RETRY;
453 goto retry;
347 } 454 }
348#endif
349 } else {
350 current->min_flt++;
351 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
352 regs, address);
353 } 455 }
456
354 up_read(&mm->mmap_sem); 457 up_read(&mm->mmap_sem);
355 return 0; 458 return 0;
356 459
@@ -371,28 +474,6 @@ bad_area_nosemaphore:
371 474
372 return SIGSEGV; 475 return SIGSEGV;
373 476
374/*
375 * We ran out of memory, or some other thing happened to us that made
376 * us unable to handle the page fault gracefully.
377 */
378out_of_memory:
379 up_read(&mm->mmap_sem);
380 if (!user_mode(regs))
381 return SIGKILL;
382 pagefault_out_of_memory();
383 return 0;
384
385do_sigbus:
386 up_read(&mm->mmap_sem);
387 if (user_mode(regs)) {
388 info.si_signo = SIGBUS;
389 info.si_errno = 0;
390 info.si_code = BUS_ADRERR;
391 info.si_addr = (void __user *)address;
392 force_sig_info(SIGBUS, &info, current);
393 return 0;
394 }
395 return SIGBUS;
396} 477}
397 478
398/* 479/*
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 66a6fd38e9c..07ba45b0f07 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -149,12 +149,19 @@ static void settlbcam(int index, unsigned long virt, phys_addr_t phys,
149unsigned long calc_cam_sz(unsigned long ram, unsigned long virt, 149unsigned long calc_cam_sz(unsigned long ram, unsigned long virt,
150 phys_addr_t phys) 150 phys_addr_t phys)
151{ 151{
152 unsigned int camsize = __ilog2(ram) & ~1U; 152 unsigned int camsize = __ilog2(ram);
153 unsigned int align = __ffs(virt | phys) & ~1U; 153 unsigned int align = __ffs(virt | phys);
154 unsigned long max_cam = (mfspr(SPRN_TLB1CFG) >> 16) & 0xf; 154 unsigned long max_cam;
155 155
156 /* Convert (4^max) kB to (2^max) bytes */ 156 if ((mfspr(SPRN_MMUCFG) & MMUCFG_MAVN) == MMUCFG_MAVN_V1) {
157 max_cam = max_cam * 2 + 10; 157 /* Convert (4^max) kB to (2^max) bytes */
158 max_cam = ((mfspr(SPRN_TLB1CFG) >> 16) & 0xf) * 2 + 10;
159 camsize &= ~1U;
160 align &= ~1U;
161 } else {
162 /* Convert (2^max) kB to (2^max) bytes */
163 max_cam = __ilog2(mfspr(SPRN_TLB1PS)) + 10;
164 }
158 165
159 if (camsize > align) 166 if (camsize > align)
160 camsize = align; 167 camsize = align;
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 2d282186cb4..3e8c37a4e39 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -55,6 +55,8 @@
55#include <asm/spu.h> 55#include <asm/spu.h>
56#include <asm/udbg.h> 56#include <asm/udbg.h>
57#include <asm/code-patching.h> 57#include <asm/code-patching.h>
58#include <asm/fadump.h>
59#include <asm/firmware.h>
58 60
59#ifdef DEBUG 61#ifdef DEBUG
60#define DBG(fmt...) udbg_printf(fmt) 62#define DBG(fmt...) udbg_printf(fmt)
@@ -625,6 +627,16 @@ static void __init htab_initialize(void)
625 /* Using a hypervisor which owns the htab */ 627 /* Using a hypervisor which owns the htab */
626 htab_address = NULL; 628 htab_address = NULL;
627 _SDR1 = 0; 629 _SDR1 = 0;
630#ifdef CONFIG_FA_DUMP
631 /*
632 * If firmware assisted dump is active firmware preserves
633 * the contents of htab along with entire partition memory.
634 * Clear the htab if firmware assisted dump is active so
635 * that we dont end up using old mappings.
636 */
637 if (is_fadump_active() && ppc_md.hpte_clear_all)
638 ppc_md.hpte_clear_all();
639#endif
628 } else { 640 } else {
629 /* Find storage for the HPT. Must be contiguous in 641 /* Find storage for the HPT. Must be contiguous in
630 * the absolute address space. On cell we want it to be 642 * the absolute address space. On cell we want it to be
@@ -745,12 +757,9 @@ void __init early_init_mmu(void)
745 */ 757 */
746 htab_initialize(); 758 htab_initialize();
747 759
748 /* Initialize stab / SLB management except on iSeries 760 /* Initialize stab / SLB management */
749 */
750 if (mmu_has_feature(MMU_FTR_SLB)) 761 if (mmu_has_feature(MMU_FTR_SLB))
751 slb_initialize(); 762 slb_initialize();
752 else if (!firmware_has_feature(FW_FEATURE_ISERIES))
753 stab_initialize(get_paca()->stab_real);
754} 763}
755 764
756#ifdef CONFIG_SMP 765#ifdef CONFIG_SMP
@@ -761,8 +770,7 @@ void __cpuinit early_init_mmu_secondary(void)
761 mtspr(SPRN_SDR1, _SDR1); 770 mtspr(SPRN_SDR1, _SDR1);
762 771
763 /* Initialize STAB/SLB. We use a virtual address as it works 772 /* Initialize STAB/SLB. We use a virtual address as it works
764 * in real mode on pSeries and we want a virtual address on 773 * in real mode on pSeries.
765 * iSeries anyway
766 */ 774 */
767 if (mmu_has_feature(MMU_FTR_SLB)) 775 if (mmu_has_feature(MMU_FTR_SLB))
768 slb_initialize(); 776 slb_initialize();
diff --git a/arch/powerpc/mm/icswx.c b/arch/powerpc/mm/icswx.c
index 5d9a59eaad9..8cdbd8634a5 100644
--- a/arch/powerpc/mm/icswx.c
+++ b/arch/powerpc/mm/icswx.c
@@ -163,7 +163,7 @@ EXPORT_SYMBOL_GPL(drop_cop);
163 163
164static int acop_use_cop(int ct) 164static int acop_use_cop(int ct)
165{ 165{
166 /* todo */ 166 /* There is no alternate policy, yet */
167 return -1; 167 return -1;
168} 168}
169 169
@@ -227,11 +227,30 @@ int acop_handle_fault(struct pt_regs *regs, unsigned long address,
227 ct = (ccw >> 16) & 0x3f; 227 ct = (ccw >> 16) & 0x3f;
228 } 228 }
229 229
230 /*
231 * We could be here because another thread has enabled acop
232 * but the ACOP register has yet to be updated.
233 *
234 * This should have been taken care of by the IPI to sync all
235 * the threads (see smp_call_function(sync_cop, mm, 1)), but
236 * that could take forever if there are a significant amount
237 * of threads.
238 *
239 * Given the number of threads on some of these systems,
240 * perhaps this is the best way to sync ACOP rather than whack
241 * every thread with an IPI.
242 */
243 if ((acop_copro_type_bit(ct) & current->active_mm->context.acop) != 0) {
244 sync_cop(current->active_mm);
245 return 0;
246 }
247
248 /* check for alternate policy */
230 if (!acop_use_cop(ct)) 249 if (!acop_use_cop(ct))
231 return 0; 250 return 0;
232 251
233 /* at this point the CT is unknown to the system */ 252 /* at this point the CT is unknown to the system */
234 pr_warn("%s[%d]: Coprocessor %d is unavailable", 253 pr_warn("%s[%d]: Coprocessor %d is unavailable\n",
235 current->comm, current->pid, ct); 254 current->comm, current->pid, ct);
236 255
237 /* get inst if we don't already have it */ 256 /* get inst if we don't already have it */
diff --git a/arch/powerpc/mm/icswx.h b/arch/powerpc/mm/icswx.h
index 42176bd0884..6dedc08e62c 100644
--- a/arch/powerpc/mm/icswx.h
+++ b/arch/powerpc/mm/icswx.h
@@ -59,4 +59,10 @@ extern void free_cop_pid(int free_pid);
59 59
60extern int acop_handle_fault(struct pt_regs *regs, unsigned long address, 60extern int acop_handle_fault(struct pt_regs *regs, unsigned long address,
61 unsigned long error_code); 61 unsigned long error_code);
62
63static inline u64 acop_copro_type_bit(unsigned int type)
64{
65 return 1ULL << (63 - type);
66}
67
62#endif /* !_ARCH_POWERPC_MM_ICSWX_H_ */ 68#endif /* !_ARCH_POWERPC_MM_ICSWX_H_ */
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 51f87956f8f..0907f92ce30 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -207,7 +207,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
207 */ 207 */
208 if (mem_init_done && (p < virt_to_phys(high_memory)) && 208 if (mem_init_done && (p < virt_to_phys(high_memory)) &&
209 !(__allow_ioremap_reserved && memblock_is_region_reserved(p, size))) { 209 !(__allow_ioremap_reserved && memblock_is_region_reserved(p, size))) {
210 printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n", 210 printk("__ioremap(): phys addr 0x%llx is RAM lr %pf\n",
211 (unsigned long long)p, __builtin_return_address(0)); 211 (unsigned long long)p, __builtin_return_address(0));
212 return NULL; 212 return NULL;
213 } 213 }
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index e22276cb67a..a538c80db2d 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -21,7 +21,6 @@
21#include <asm/cputable.h> 21#include <asm/cputable.h>
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/smp.h> 23#include <asm/smp.h>
24#include <asm/firmware.h>
25#include <linux/compiler.h> 24#include <linux/compiler.h>
26#include <asm/udbg.h> 25#include <asm/udbg.h>
27#include <asm/code-patching.h> 26#include <asm/code-patching.h>
@@ -307,11 +306,6 @@ void slb_initialize(void)
307 306
308 get_paca()->stab_rr = SLB_NUM_BOLTED; 307 get_paca()->stab_rr = SLB_NUM_BOLTED;
309 308
310 /* On iSeries the bolted entries have already been set up by
311 * the hypervisor from the lparMap data in head.S */
312 if (firmware_has_feature(FW_FEATURE_ISERIES))
313 return;
314
315 lflags = SLB_VSID_KERNEL | linear_llp; 309 lflags = SLB_VSID_KERNEL | linear_llp;
316 vflags = SLB_VSID_KERNEL | vmalloc_llp; 310 vflags = SLB_VSID_KERNEL | vmalloc_llp;
317 311
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index ef653dc95b6..b9ee79ce220 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -217,21 +217,6 @@ slb_finish_load:
217 * free slot first but that took too long. Unfortunately we 217 * free slot first but that took too long. Unfortunately we
218 * dont have any LRU information to help us choose a slot. 218 * dont have any LRU information to help us choose a slot.
219 */ 219 */
220#ifdef CONFIG_PPC_ISERIES
221BEGIN_FW_FTR_SECTION
222 /*
223 * On iSeries, the "bolted" stack segment can be cast out on
224 * shared processor switch so we need to check for a miss on
225 * it and restore it to the right slot.
226 */
227 ld r9,PACAKSAVE(r13)
228 clrrdi r9,r9,28
229 clrrdi r3,r3,28
230 li r10,SLB_NUM_BOLTED-1 /* Stack goes in last bolted slot */
231 cmpld r9,r3
232 beq 3f
233END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
234#endif /* CONFIG_PPC_ISERIES */
235 220
2367: ld r10,PACASTABRR(r13) 2217: ld r10,PACASTABRR(r13)
237 addi r10,r10,1 222 addi r10,r10,1
@@ -282,7 +267,6 @@ _GLOBAL(slb_compare_rr_to_size)
282 267
283/* 268/*
284 * Finish loading of a 1T SLB entry (for the kernel linear mapping) and return. 269 * Finish loading of a 1T SLB entry (for the kernel linear mapping) and return.
285 * We assume legacy iSeries will never have 1T segments.
286 * 270 *
287 * r3 = EA, r10 = proto-VSID, r11 = flags, clobbers r9 271 * r3 = EA, r10 = proto-VSID, r11 = flags, clobbers r9
288 */ 272 */
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 41e31642a86..9106ebb118f 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -21,8 +21,6 @@
21#include <asm/cputable.h> 21#include <asm/cputable.h>
22#include <asm/prom.h> 22#include <asm/prom.h>
23#include <asm/abs_addr.h> 23#include <asm/abs_addr.h>
24#include <asm/firmware.h>
25#include <asm/iseries/hv_call.h>
26 24
27struct stab_entry { 25struct stab_entry {
28 unsigned long esid_data; 26 unsigned long esid_data;
@@ -285,12 +283,5 @@ void stab_initialize(unsigned long stab)
285 /* Set ASR */ 283 /* Set ASR */
286 stabreal = get_paca()->stab_real | 0x1ul; 284 stabreal = get_paca()->stab_real | 0x1ul;
287 285
288#ifdef CONFIG_PPC_ISERIES
289 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
290 HvCall1(HvCallBaseSetASR, stabreal);
291 return;
292 }
293#endif /* CONFIG_PPC_ISERIES */
294
295 mtspr(SPRN_ASR, stabreal); 286 mtspr(SPRN_ASR, stabreal);
296} 287}
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index d65e68f3cb2..6f01624f317 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -195,9 +195,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
195 if (!cur_cpu_spec->oprofile_cpu_type) 195 if (!cur_cpu_spec->oprofile_cpu_type)
196 return -ENODEV; 196 return -ENODEV;
197 197
198 if (firmware_has_feature(FW_FEATURE_ISERIES))
199 return -ENODEV;
200
201 switch (cur_cpu_spec->oprofile_type) { 198 switch (cur_cpu_spec->oprofile_type) {
202#ifdef CONFIG_PPC_BOOK3S_64 199#ifdef CONFIG_PPC_BOOK3S_64
203#ifdef CONFIG_OPROFILE_CELL 200#ifdef CONFIG_OPROFILE_CELL
diff --git a/arch/powerpc/perf/Makefile b/arch/powerpc/perf/Makefile
new file mode 100644
index 00000000000..af3fac23768
--- /dev/null
+++ b/arch/powerpc/perf/Makefile
@@ -0,0 +1,14 @@
1subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
2
3obj-$(CONFIG_PERF_EVENTS) += callchain.o
4
5obj-$(CONFIG_PPC_PERF_CTRS) += core-book3s.o
6obj64-$(CONFIG_PPC_PERF_CTRS) += power4-pmu.o ppc970-pmu.o power5-pmu.o \
7 power5+-pmu.o power6-pmu.o power7-pmu.o
8obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o
9
10obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o
11obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o
12
13obj-$(CONFIG_PPC64) += $(obj64-y)
14obj-$(CONFIG_PPC32) += $(obj32-y)
diff --git a/arch/powerpc/kernel/perf_callchain.c b/arch/powerpc/perf/callchain.c
index 564c1d8bdb5..e8a18d1cc7c 100644
--- a/arch/powerpc/kernel/perf_callchain.c
+++ b/arch/powerpc/perf/callchain.c
@@ -20,7 +20,7 @@
20#include <asm/ucontext.h> 20#include <asm/ucontext.h>
21#include <asm/vdso.h> 21#include <asm/vdso.h>
22#ifdef CONFIG_PPC64 22#ifdef CONFIG_PPC64
23#include "ppc32.h" 23#include "../kernel/ppc32.h"
24#endif 24#endif
25 25
26 26
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/perf/core-book3s.c
index c2e27ede07e..c2e27ede07e 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/perf/core-book3s.c
diff --git a/arch/powerpc/kernel/perf_event_fsl_emb.c b/arch/powerpc/perf/core-fsl-emb.c
index 0a6d2a9d569..0a6d2a9d569 100644
--- a/arch/powerpc/kernel/perf_event_fsl_emb.c
+++ b/arch/powerpc/perf/core-fsl-emb.c
diff --git a/arch/powerpc/kernel/e500-pmu.c b/arch/powerpc/perf/e500-pmu.c
index cb2e2949c8d..cb2e2949c8d 100644
--- a/arch/powerpc/kernel/e500-pmu.c
+++ b/arch/powerpc/perf/e500-pmu.c
diff --git a/arch/powerpc/kernel/mpc7450-pmu.c b/arch/powerpc/perf/mpc7450-pmu.c
index fe21b515ca4..fe21b515ca4 100644
--- a/arch/powerpc/kernel/mpc7450-pmu.c
+++ b/arch/powerpc/perf/mpc7450-pmu.c
diff --git a/arch/powerpc/kernel/power4-pmu.c b/arch/powerpc/perf/power4-pmu.c
index b4f1dda4d08..b4f1dda4d08 100644
--- a/arch/powerpc/kernel/power4-pmu.c
+++ b/arch/powerpc/perf/power4-pmu.c
diff --git a/arch/powerpc/kernel/power5+-pmu.c b/arch/powerpc/perf/power5+-pmu.c
index a8757baa28f..a8757baa28f 100644
--- a/arch/powerpc/kernel/power5+-pmu.c
+++ b/arch/powerpc/perf/power5+-pmu.c
diff --git a/arch/powerpc/kernel/power5-pmu.c b/arch/powerpc/perf/power5-pmu.c
index e7f06eb7a86..e7f06eb7a86 100644
--- a/arch/powerpc/kernel/power5-pmu.c
+++ b/arch/powerpc/perf/power5-pmu.c
diff --git a/arch/powerpc/kernel/power6-pmu.c b/arch/powerpc/perf/power6-pmu.c
index 0bbc901e7ef..31128e086fe 100644
--- a/arch/powerpc/kernel/power6-pmu.c
+++ b/arch/powerpc/perf/power6-pmu.c
@@ -131,7 +131,7 @@ static u32 marked_bus_events[16] = {
131 0x00000022, /* BFP set 2: byte 0 bits 1, 5 */ 131 0x00000022, /* BFP set 2: byte 0 bits 1, 5 */
132 0, 0 132 0, 0
133}; 133};
134 134
135/* 135/*
136 * Returns 1 if event counts things relating to marked instructions 136 * Returns 1 if event counts things relating to marked instructions
137 * and thus needs the MMCRA_SAMPLE_ENABLE bit set, or 0 if not. 137 * and thus needs the MMCRA_SAMPLE_ENABLE bit set, or 0 if not.
diff --git a/arch/powerpc/kernel/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c
index 1251e4d7e26..1251e4d7e26 100644
--- a/arch/powerpc/kernel/power7-pmu.c
+++ b/arch/powerpc/perf/power7-pmu.c
diff --git a/arch/powerpc/kernel/ppc970-pmu.c b/arch/powerpc/perf/ppc970-pmu.c
index 8c219020696..111eb25bb0b 100644
--- a/arch/powerpc/kernel/ppc970-pmu.c
+++ b/arch/powerpc/perf/ppc970-pmu.c
@@ -252,7 +252,7 @@ static int p970_get_alternatives(u64 event, unsigned int flags, u64 alt[])
252 alt[1] = event ^ 0x1000; 252 alt[1] = event ^ 0x1000;
253 return 2; 253 return 2;
254 } 254 }
255 255
256 return 1; 256 return 1;
257} 257}
258 258
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index fcf6bf2ceee..2e4e64abfab 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -23,6 +23,7 @@ config BLUESTONE
23 default n 23 default n
24 select PPC44x_SIMPLE 24 select PPC44x_SIMPLE
25 select APM821xx 25 select APM821xx
26 select PPC4xx_PCI_EXPRESS
26 select IBM_EMAC_RGMII 27 select IBM_EMAC_RGMII
27 help 28 help
28 This option enables support for the APM APM821xx Evaluation board. 29 This option enables support for the APM APM821xx Evaluation board.
diff --git a/arch/powerpc/platforms/44x/currituck.c b/arch/powerpc/platforms/44x/currituck.c
index 3f6229b5dee..583e67fee37 100644
--- a/arch/powerpc/platforms/44x/currituck.c
+++ b/arch/powerpc/platforms/44x/currituck.c
@@ -83,7 +83,7 @@ static void __init ppc47x_init_irq(void)
83 * device-tree, just pass 0 to all arguments 83 * device-tree, just pass 0 to all arguments
84 */ 84 */
85 struct mpic *mpic = 85 struct mpic *mpic =
86 mpic_alloc(np, 0, 0, 0, 0, " MPIC "); 86 mpic_alloc(np, 0, MPIC_NO_RESET, 0, 0, " MPIC ");
87 BUG_ON(mpic == NULL); 87 BUG_ON(mpic == NULL);
88 mpic_init(mpic); 88 mpic_init(mpic);
89 ppc_md.get_irq = mpic_get_irq; 89 ppc_md.get_irq = mpic_get_irq;
diff --git a/arch/powerpc/platforms/44x/iss4xx.c b/arch/powerpc/platforms/44x/iss4xx.c
index 5b8cdbb82f8..a28a8629727 100644
--- a/arch/powerpc/platforms/44x/iss4xx.c
+++ b/arch/powerpc/platforms/44x/iss4xx.c
@@ -71,8 +71,7 @@ static void __init iss4xx_init_irq(void)
71 /* The MPIC driver will get everything it needs from the 71 /* The MPIC driver will get everything it needs from the
72 * device-tree, just pass 0 to all arguments 72 * device-tree, just pass 0 to all arguments
73 */ 73 */
74 struct mpic *mpic = mpic_alloc(np, 0, 0, 0, 0, 74 struct mpic *mpic = mpic_alloc(np, 0, MPIC_NO_RESET, 0, 0, " MPIC ");
75 " MPIC ");
76 BUG_ON(mpic == NULL); 75 BUG_ON(mpic == NULL);
77 mpic_init(mpic); 76 mpic_init(mpic);
78 ppc_md.get_irq = mpic_get_irq; 77 ppc_md.get_irq = mpic_get_irq;
diff --git a/arch/powerpc/platforms/44x/ppc44x_simple.c b/arch/powerpc/platforms/44x/ppc44x_simple.c
index 8d220276341..3ffb915446e 100644
--- a/arch/powerpc/platforms/44x/ppc44x_simple.c
+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
@@ -52,7 +52,7 @@ machine_device_initcall(ppc44x_simple, ppc44x_device_probe);
52static char *board[] __initdata = { 52static char *board[] __initdata = {
53 "amcc,arches", 53 "amcc,arches",
54 "amcc,bamboo", 54 "amcc,bamboo",
55 "amcc,bluestone", 55 "apm,bluestone",
56 "amcc,glacier", 56 "amcc,glacier",
57 "ibm,ebony", 57 "ibm,ebony",
58 "amcc,eiger", 58 "amcc,eiger",
diff --git a/arch/powerpc/platforms/52xx/mpc5200_simple.c b/arch/powerpc/platforms/52xx/mpc5200_simple.c
index 846b789fb19..c0aa04068d6 100644
--- a/arch/powerpc/platforms/52xx/mpc5200_simple.c
+++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c
@@ -50,6 +50,7 @@ static void __init mpc5200_simple_setup_arch(void)
50 50
51/* list of the supported boards */ 51/* list of the supported boards */
52static const char *board[] __initdata = { 52static const char *board[] __initdata = {
53 "anonymous,a4m072",
53 "anon,charon", 54 "anon,charon",
54 "intercontrol,digsy-mtc", 55 "intercontrol,digsy-mtc",
55 "manroland,mucmc52", 56 "manroland,mucmc52",
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 369fd5457a3..d7e94f49532 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -98,13 +98,11 @@ struct mpc52xx_gpio_wkup __iomem *wkup_gpio;
98 * of the localplus bus to the of_platform 98 * of the localplus bus to the of_platform
99 * bus. 99 * bus.
100 */ 100 */
101void __init 101void __init mpc52xx_declare_of_platform_devices(void)
102mpc52xx_declare_of_platform_devices(void)
103{ 102{
104 /* Find every child of the SOC node and add it to of_platform */ 103 /* Find all the 'platform' devices and register them. */
105 if (of_platform_bus_probe(NULL, mpc52xx_bus_ids, NULL)) 104 if (of_platform_populate(NULL, mpc52xx_bus_ids, NULL, NULL))
106 printk(KERN_ERR __FILE__ ": " 105 pr_err(__FILE__ ": Error while populating devices from DT\n");
107 "Error while probing of_platform bus\n");
108} 106}
109 107
110/* 108/*
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index d7946be298b..f000d81c4e3 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -6,6 +6,7 @@ menuconfig FSL_SOC_BOOKE
6 select MPIC 6 select MPIC
7 select PPC_PCI_CHOICE 7 select PPC_PCI_CHOICE
8 select FSL_PCI if PCI 8 select FSL_PCI if PCI
9 select SERIAL_8250_EXTENDED if SERIAL_8250
9 select SERIAL_8250_SHARE_IRQ if SERIAL_8250 10 select SERIAL_8250_SHARE_IRQ if SERIAL_8250
10 default y 11 default y
11 12
@@ -13,6 +14,15 @@ if FSL_SOC_BOOKE
13 14
14if PPC32 15if PPC32
15 16
17config FSL_85XX_CACHE_SRAM
18 bool
19 select PPC_LIB_RHEAP
20 help
21 When selected, this option enables cache-sram support
22 for memory allocation on P1/P2 QorIQ platforms.
23 cache-sram-size and cache-sram-offset kernel boot
24 parameters should be passed when this option is enabled.
25
16config MPC8540_ADS 26config MPC8540_ADS
17 bool "Freescale MPC8540 ADS" 27 bool "Freescale MPC8540 ADS"
18 select DEFAULT_UIMAGE 28 select DEFAULT_UIMAGE
@@ -30,6 +40,7 @@ config MPC85xx_CDS
30 bool "Freescale MPC85xx CDS" 40 bool "Freescale MPC85xx CDS"
31 select DEFAULT_UIMAGE 41 select DEFAULT_UIMAGE
32 select PPC_I8259 42 select PPC_I8259
43 select HAS_RAPIDIO
33 help 44 help
34 This option enables support for the MPC85xx CDS board 45 This option enables support for the MPC85xx CDS board
35 46
@@ -80,7 +91,6 @@ config P1010_RDB
80config P1022_DS 91config P1022_DS
81 bool "Freescale P1022 DS" 92 bool "Freescale P1022 DS"
82 select DEFAULT_UIMAGE 93 select DEFAULT_UIMAGE
83 select PHYS_64BIT # The DTS has 36-bit addresses
84 select SWIOTLB 94 select SWIOTLB
85 help 95 help
86 This option enables support for the Freescale P1022DS reference board. 96 This option enables support for the Freescale P1022DS reference board.
@@ -171,6 +181,21 @@ config SBC8560
171 help 181 help
172 This option enables support for the Wind River SBC8560 board 182 This option enables support for the Wind River SBC8560 board
173 183
184config GE_IMP3A
185 bool "GE Intelligent Platforms IMP3A"
186 select DEFAULT_UIMAGE
187 select SWIOTLB
188 select MMIO_NVRAM
189 select GENERIC_GPIO
190 select ARCH_REQUIRE_GPIOLIB
191 select GE_FPGA
192 help
193 This option enables support for the GE Intelligent Platforms IMP3A
194 board.
195
196 This board is a 3U CompactPCI Single Board Computer with a Freescale
197 P2020 processor.
198
174config P2041_RDB 199config P2041_RDB
175 bool "Freescale P2041 RDB" 200 bool "Freescale P2041 RDB"
176 select DEFAULT_UIMAGE 201 select DEFAULT_UIMAGE
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 9cb2d4320dc..2125d4ca068 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -27,3 +27,4 @@ obj-$(CONFIG_SBC8548) += sbc8548.o
27obj-$(CONFIG_SOCRATES) += socrates.o socrates_fpga_pic.o 27obj-$(CONFIG_SOCRATES) += socrates.o socrates_fpga_pic.o
28obj-$(CONFIG_KSI8560) += ksi8560.o 28obj-$(CONFIG_KSI8560) += ksi8560.o
29obj-$(CONFIG_XES_MPC85xx) += xes_mpc85xx.o 29obj-$(CONFIG_XES_MPC85xx) += xes_mpc85xx.o
30obj-$(CONFIG_GE_IMP3A) += ge_imp3a.o
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
index 07e3e6c4737..df69e99e511 100644
--- a/arch/powerpc/platforms/85xx/corenet_ds.c
+++ b/arch/powerpc/platforms/85xx/corenet_ds.c
@@ -36,8 +36,8 @@
36void __init corenet_ds_pic_init(void) 36void __init corenet_ds_pic_init(void)
37{ 37{
38 struct mpic *mpic; 38 struct mpic *mpic;
39 unsigned int flags = MPIC_BIG_ENDIAN | 39 unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU |
40 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU; 40 MPIC_NO_RESET;
41 41
42 if (ppc_md.get_irq == mpic_get_coreint_irq) 42 if (ppc_md.get_irq == mpic_get_coreint_irq)
43 flags |= MPIC_ENABLE_COREINT; 43 flags |= MPIC_ENABLE_COREINT;
diff --git a/arch/powerpc/platforms/85xx/ge_imp3a.c b/arch/powerpc/platforms/85xx/ge_imp3a.c
new file mode 100644
index 00000000000..d50056f424f
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/ge_imp3a.c
@@ -0,0 +1,246 @@
1/*
2 * GE IMP3A Board Setup
3 *
4 * Author Martyn Welch <martyn.welch@ge.com>
5 *
6 * Copyright 2010 GE Intelligent Platforms Embedded Systems, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * Based on: mpc85xx_ds.c (MPC85xx DS Board Setup)
14 * Copyright 2007 Freescale Semiconductor Inc.
15 */
16
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/pci.h>
20#include <linux/kdev_t.h>
21#include <linux/delay.h>
22#include <linux/seq_file.h>
23#include <linux/interrupt.h>
24#include <linux/of_platform.h>
25#include <linux/memblock.h>
26
27#include <asm/system.h>
28#include <asm/time.h>
29#include <asm/machdep.h>
30#include <asm/pci-bridge.h>
31#include <mm/mmu_decl.h>
32#include <asm/prom.h>
33#include <asm/udbg.h>
34#include <asm/mpic.h>
35#include <asm/swiotlb.h>
36#include <asm/nvram.h>
37
38#include <sysdev/fsl_soc.h>
39#include <sysdev/fsl_pci.h>
40#include "smp.h"
41
42#include "mpc85xx.h"
43#include <sysdev/ge/ge_pic.h>
44
45void __iomem *imp3a_regs;
46
47void __init ge_imp3a_pic_init(void)
48{
49 struct mpic *mpic;
50 struct device_node *np;
51 struct device_node *cascade_node = NULL;
52 unsigned long root = of_get_flat_dt_root();
53
54 if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) {
55 mpic = mpic_alloc(NULL, 0,
56 MPIC_NO_RESET |
57 MPIC_BIG_ENDIAN |
58 MPIC_SINGLE_DEST_CPU,
59 0, 256, " OpenPIC ");
60 } else {
61 mpic = mpic_alloc(NULL, 0,
62 MPIC_BIG_ENDIAN |
63 MPIC_SINGLE_DEST_CPU,
64 0, 256, " OpenPIC ");
65 }
66
67 BUG_ON(mpic == NULL);
68 mpic_init(mpic);
69 /*
70 * There is a simple interrupt handler in the main FPGA, this needs
71 * to be cascaded into the MPIC
72 */
73 for_each_node_by_type(np, "interrupt-controller")
74 if (of_device_is_compatible(np, "gef,fpga-pic-1.00")) {
75 cascade_node = np;
76 break;
77 }
78
79 if (cascade_node == NULL) {
80 printk(KERN_WARNING "IMP3A: No FPGA PIC\n");
81 return;
82 }
83
84 gef_pic_init(cascade_node);
85 of_node_put(cascade_node);
86}
87
88#ifdef CONFIG_PCI
89static int primary_phb_addr;
90#endif /* CONFIG_PCI */
91
92/*
93 * Setup the architecture
94 */
95static void __init ge_imp3a_setup_arch(void)
96{
97 struct device_node *regs;
98#ifdef CONFIG_PCI
99 struct device_node *np;
100 struct pci_controller *hose;
101#endif
102 dma_addr_t max = 0xffffffff;
103
104 if (ppc_md.progress)
105 ppc_md.progress("ge_imp3a_setup_arch()", 0);
106
107#ifdef CONFIG_PCI
108 for_each_node_by_type(np, "pci") {
109 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
110 of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
111 of_device_is_compatible(np, "fsl,p2020-pcie")) {
112 struct resource rsrc;
113 of_address_to_resource(np, 0, &rsrc);
114 if ((rsrc.start & 0xfffff) == primary_phb_addr)
115 fsl_add_bridge(np, 1);
116 else
117 fsl_add_bridge(np, 0);
118
119 hose = pci_find_hose_for_OF_device(np);
120 max = min(max, hose->dma_window_base_cur +
121 hose->dma_window_size);
122 }
123 }
124#endif
125
126 mpc85xx_smp_init();
127
128#ifdef CONFIG_SWIOTLB
129 if (memblock_end_of_DRAM() > max) {
130 ppc_swiotlb_enable = 1;
131 set_pci_dma_ops(&swiotlb_dma_ops);
132 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
133 }
134#endif
135
136 /* Remap basic board registers */
137 regs = of_find_compatible_node(NULL, NULL, "ge,imp3a-fpga-regs");
138 if (regs) {
139 imp3a_regs = of_iomap(regs, 0);
140 if (imp3a_regs == NULL)
141 printk(KERN_WARNING "Unable to map board registers\n");
142 of_node_put(regs);
143 }
144
145#if defined(CONFIG_MMIO_NVRAM)
146 mmio_nvram_init();
147#endif
148
149 printk(KERN_INFO "GE Intelligent Platforms IMP3A 3U cPCI SBC\n");
150}
151
152/* Return the PCB revision */
153static unsigned int ge_imp3a_get_pcb_rev(void)
154{
155 unsigned int reg;
156
157 reg = ioread16(imp3a_regs);
158 return (reg >> 8) & 0xff;
159}
160
161/* Return the board (software) revision */
162static unsigned int ge_imp3a_get_board_rev(void)
163{
164 unsigned int reg;
165
166 reg = ioread16(imp3a_regs + 0x2);
167 return reg & 0xff;
168}
169
170/* Return the FPGA revision */
171static unsigned int ge_imp3a_get_fpga_rev(void)
172{
173 unsigned int reg;
174
175 reg = ioread16(imp3a_regs + 0x2);
176 return (reg >> 8) & 0xff;
177}
178
179/* Return compactPCI Geographical Address */
180static unsigned int ge_imp3a_get_cpci_geo_addr(void)
181{
182 unsigned int reg;
183
184 reg = ioread16(imp3a_regs + 0x6);
185 return (reg & 0x0f00) >> 8;
186}
187
188/* Return compactPCI System Controller Status */
189static unsigned int ge_imp3a_get_cpci_is_syscon(void)
190{
191 unsigned int reg;
192
193 reg = ioread16(imp3a_regs + 0x6);
194 return reg & (1 << 12);
195}
196
197static void ge_imp3a_show_cpuinfo(struct seq_file *m)
198{
199 seq_printf(m, "Vendor\t\t: GE Intelligent Platforms\n");
200
201 seq_printf(m, "Revision\t: %u%c\n", ge_imp3a_get_pcb_rev(),
202 ('A' + ge_imp3a_get_board_rev() - 1));
203
204 seq_printf(m, "FPGA Revision\t: %u\n", ge_imp3a_get_fpga_rev());
205
206 seq_printf(m, "cPCI geo. addr\t: %u\n", ge_imp3a_get_cpci_geo_addr());
207
208 seq_printf(m, "cPCI syscon\t: %s\n",
209 ge_imp3a_get_cpci_is_syscon() ? "yes" : "no");
210}
211
212/*
213 * Called very early, device-tree isn't unflattened
214 */
215static int __init ge_imp3a_probe(void)
216{
217 unsigned long root = of_get_flat_dt_root();
218
219 if (of_flat_dt_is_compatible(root, "ge,IMP3A")) {
220#ifdef CONFIG_PCI
221 primary_phb_addr = 0x9000;
222#endif
223 return 1;
224 }
225
226 return 0;
227}
228
229machine_device_initcall(ge_imp3a, mpc85xx_common_publish_devices);
230
231machine_arch_initcall(ge_imp3a, swiotlb_setup_bus_notifier);
232
233define_machine(ge_imp3a) {
234 .name = "GE_IMP3A",
235 .probe = ge_imp3a_probe,
236 .setup_arch = ge_imp3a_setup_arch,
237 .init_IRQ = ge_imp3a_pic_init,
238 .show_cpuinfo = ge_imp3a_show_cpuinfo,
239#ifdef CONFIG_PCI
240 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
241#endif
242 .get_irq = mpic_get_irq,
243 .restart = fsl_rstcr_restart,
244 .calibrate_decr = generic_calibrate_decr,
245 .progress = udbg_progress,
246};
diff --git a/arch/powerpc/platforms/85xx/ksi8560.c b/arch/powerpc/platforms/85xx/ksi8560.c
index 20f75d7819c..60120e55da4 100644
--- a/arch/powerpc/platforms/85xx/ksi8560.c
+++ b/arch/powerpc/platforms/85xx/ksi8560.c
@@ -57,8 +57,7 @@ static void machine_restart(char *cmd)
57 57
58static void __init ksi8560_pic_init(void) 58static void __init ksi8560_pic_init(void)
59{ 59{
60 struct mpic *mpic = mpic_alloc(NULL, 0, 60 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
61 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
62 0, 256, " OpenPIC "); 61 0, 256, " OpenPIC ");
63 BUG_ON(mpic == NULL); 62 BUG_ON(mpic == NULL);
64 mpic_init(mpic); 63 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index cf266826682..f58872688d8 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -36,9 +36,7 @@
36 36
37void __init mpc8536_ds_pic_init(void) 37void __init mpc8536_ds_pic_init(void)
38{ 38{
39 struct mpic *mpic = mpic_alloc(NULL, 0, 39 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
40 MPIC_WANTS_RESET |
41 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
42 0, 256, " OpenPIC "); 40 0, 256, " OpenPIC ");
43 BUG_ON(mpic == NULL); 41 BUG_ON(mpic == NULL);
44 mpic_init(mpic); 42 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 3bebb5173bf..d19f675cb36 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -50,8 +50,7 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
50 50
51static void __init mpc85xx_ads_pic_init(void) 51static void __init mpc85xx_ads_pic_init(void)
52{ 52{
53 struct mpic *mpic = mpic_alloc(NULL, 0, 53 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
54 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
55 0, 256, " OpenPIC "); 54 0, 256, " OpenPIC ");
56 BUG_ON(mpic == NULL); 55 BUG_ON(mpic == NULL);
57 mpic_init(mpic); 56 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 40f03da616a..ab5f0bf1945 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information) 4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 * 5 *
6 * Copyright 2005 Freescale Semiconductor Inc. 6 * Copyright 2005, 2011-2012 Freescale Semiconductor Inc.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -48,17 +48,24 @@
48 48
49#include "mpc85xx.h" 49#include "mpc85xx.h"
50 50
51/* CADMUS info */ 51/*
52/* xxx - galak, move into device tree */ 52 * The CDS board contains an FPGA/CPLD called "Cadmus", which collects
53#define CADMUS_BASE (0xf8004000) 53 * various logic and performs system control functions.
54#define CADMUS_SIZE (256) 54 * Here is the FPGA/CPLD register map.
55#define CM_VER (0) 55 */
56#define CM_CSR (1) 56struct cadmus_reg {
57#define CM_RST (2) 57 u8 cm_ver; /* Board version */
58 58 u8 cm_csr; /* General control/status */
59 u8 cm_rst; /* Reset control */
60 u8 cm_hsclk; /* High speed clock */
61 u8 cm_hsxclk; /* High speed clock extended */
62 u8 cm_led; /* LED data */
63 u8 cm_pci; /* PCI control/status */
64 u8 cm_dma; /* DMA control */
65 u8 res[248]; /* Total 256 bytes */
66};
59 67
60static int cds_pci_slot = 2; 68static struct cadmus_reg *cadmus;
61static volatile u8 *cadmus;
62 69
63#ifdef CONFIG_PCI 70#ifdef CONFIG_PCI
64 71
@@ -158,6 +165,33 @@ DECLARE_PCI_FIXUP_EARLY(0x1957, 0x3fff, skip_fake_bridge);
158DECLARE_PCI_FIXUP_EARLY(0x3fff, 0x1957, skip_fake_bridge); 165DECLARE_PCI_FIXUP_EARLY(0x3fff, 0x1957, skip_fake_bridge);
159DECLARE_PCI_FIXUP_EARLY(0xff3f, 0x5719, skip_fake_bridge); 166DECLARE_PCI_FIXUP_EARLY(0xff3f, 0x5719, skip_fake_bridge);
160 167
168#define PCI_DEVICE_ID_IDT_TSI310 0x01a7
169
170/*
171 * Fix Tsi310 PCI-X bridge resource.
172 * Force the bridge to open a window from 0x0000-0x1fff in PCI I/O space.
173 * This allows legacy I/O(i8259, etc) on the VIA southbridge to be accessed.
174 */
175void mpc85xx_cds_fixup_bus(struct pci_bus *bus)
176{
177 struct pci_dev *dev = bus->self;
178 struct resource *res = bus->resource[0];
179
180 if (dev != NULL &&
181 dev->vendor == PCI_VENDOR_ID_IBM &&
182 dev->device == PCI_DEVICE_ID_IDT_TSI310) {
183 if (res) {
184 res->start = 0;
185 res->end = 0x1fff;
186 res->flags = IORESOURCE_IO;
187 pr_info("mpc85xx_cds: PCI bridge resource fixup applied\n");
188 pr_info("mpc85xx_cds: %pR\n", res);
189 }
190 }
191
192 fsl_pcibios_fixup_bus(bus);
193}
194
161#ifdef CONFIG_PPC_I8259 195#ifdef CONFIG_PPC_I8259
162static void mpc85xx_8259_cascade_handler(unsigned int irq, 196static void mpc85xx_8259_cascade_handler(unsigned int irq,
163 struct irq_desc *desc) 197 struct irq_desc *desc)
@@ -188,8 +222,7 @@ static struct irqaction mpc85xxcds_8259_irqaction = {
188static void __init mpc85xx_cds_pic_init(void) 222static void __init mpc85xx_cds_pic_init(void)
189{ 223{
190 struct mpic *mpic; 224 struct mpic *mpic;
191 mpic = mpic_alloc(NULL, 0, 225 mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
192 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
193 0, 256, " OpenPIC "); 226 0, 256, " OpenPIC ");
194 BUG_ON(mpic == NULL); 227 BUG_ON(mpic == NULL);
195 mpic_init(mpic); 228 mpic_init(mpic);
@@ -249,20 +282,30 @@ machine_device_initcall(mpc85xx_cds, mpc85xx_cds_8259_attach);
249 */ 282 */
250static void __init mpc85xx_cds_setup_arch(void) 283static void __init mpc85xx_cds_setup_arch(void)
251{ 284{
252#ifdef CONFIG_PCI
253 struct device_node *np; 285 struct device_node *np;
254#endif 286 int cds_pci_slot;
255 287
256 if (ppc_md.progress) 288 if (ppc_md.progress)
257 ppc_md.progress("mpc85xx_cds_setup_arch()", 0); 289 ppc_md.progress("mpc85xx_cds_setup_arch()", 0);
258 290
259 cadmus = ioremap(CADMUS_BASE, CADMUS_SIZE); 291 np = of_find_compatible_node(NULL, NULL, "fsl,mpc8548cds-fpga");
260 cds_pci_slot = ((cadmus[CM_CSR] >> 6) & 0x3) + 1; 292 if (!np) {
293 pr_err("Could not find FPGA node.\n");
294 return;
295 }
296
297 cadmus = of_iomap(np, 0);
298 of_node_put(np);
299 if (!cadmus) {
300 pr_err("Fail to map FPGA area.\n");
301 return;
302 }
261 303
262 if (ppc_md.progress) { 304 if (ppc_md.progress) {
263 char buf[40]; 305 char buf[40];
306 cds_pci_slot = ((in_8(&cadmus->cm_csr) >> 6) & 0x3) + 1;
264 snprintf(buf, 40, "CDS Version = 0x%x in slot %d\n", 307 snprintf(buf, 40, "CDS Version = 0x%x in slot %d\n",
265 cadmus[CM_VER], cds_pci_slot); 308 in_8(&cadmus->cm_ver), cds_pci_slot);
266 ppc_md.progress(buf, 0); 309 ppc_md.progress(buf, 0);
267 } 310 }
268 311
@@ -292,7 +335,8 @@ static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)
292 svid = mfspr(SPRN_SVR); 335 svid = mfspr(SPRN_SVR);
293 336
294 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n"); 337 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
295 seq_printf(m, "Machine\t\t: MPC85xx CDS (0x%x)\n", cadmus[CM_VER]); 338 seq_printf(m, "Machine\t\t: MPC85xx CDS (0x%x)\n",
339 in_8(&cadmus->cm_ver));
296 seq_printf(m, "PVR\t\t: 0x%x\n", pvid); 340 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
297 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 341 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
298 342
@@ -323,7 +367,7 @@ define_machine(mpc85xx_cds) {
323 .get_irq = mpic_get_irq, 367 .get_irq = mpic_get_irq,
324#ifdef CONFIG_PCI 368#ifdef CONFIG_PCI
325 .restart = mpc85xx_cds_restart, 369 .restart = mpc85xx_cds_restart,
326 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 370 .pcibios_fixup_bus = mpc85xx_cds_fixup_bus,
327#else 371#else
328 .restart = fsl_rstcr_restart, 372 .restart = fsl_rstcr_restart,
329#endif 373#endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index eefbb91e1d6..6e23e3e34bd 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -72,13 +72,13 @@ void __init mpc85xx_ds_pic_init(void)
72 72
73 if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) { 73 if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) {
74 mpic = mpic_alloc(NULL, 0, 74 mpic = mpic_alloc(NULL, 0,
75 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | 75 MPIC_NO_RESET |
76 MPIC_BIG_ENDIAN |
76 MPIC_SINGLE_DEST_CPU, 77 MPIC_SINGLE_DEST_CPU,
77 0, 256, " OpenPIC "); 78 0, 256, " OpenPIC ");
78 } else { 79 } else {
79 mpic = mpic_alloc(NULL, 0, 80 mpic = mpic_alloc(NULL, 0,
80 MPIC_WANTS_RESET | 81 MPIC_BIG_ENDIAN |
81 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
82 MPIC_SINGLE_DEST_CPU, 82 MPIC_SINGLE_DEST_CPU,
83 0, 256, " OpenPIC "); 83 0, 256, " OpenPIC ");
84 } 84 }
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 1d15a0cd2c8..f33662b46b8 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (C) Freescale Semicondutor, Inc. 2006-2010. All rights reserved. 2 * Copyright (C) 2006-2010, 2012 Freescale Semicondutor, Inc.
3 * All rights reserved.
3 * 4 *
4 * Author: Andy Fleming <afleming@freescale.com> 5 * Author: Andy Fleming <afleming@freescale.com>
5 * 6 *
@@ -51,6 +52,7 @@
51#include <asm/qe_ic.h> 52#include <asm/qe_ic.h>
52#include <asm/mpic.h> 53#include <asm/mpic.h>
53#include <asm/swiotlb.h> 54#include <asm/swiotlb.h>
55#include <asm/fsl_guts.h>
54#include "smp.h" 56#include "smp.h"
55 57
56#include "mpc85xx.h" 58#include "mpc85xx.h"
@@ -268,34 +270,27 @@ static void __init mpc85xx_mds_qe_init(void)
268 mpc85xx_mds_reset_ucc_phys(); 270 mpc85xx_mds_reset_ucc_phys();
269 271
270 if (machine_is(p1021_mds)) { 272 if (machine_is(p1021_mds)) {
271#define MPC85xx_PMUXCR_OFFSET 0x60
272#define MPC85xx_PMUXCR_QE0 0x00008000
273#define MPC85xx_PMUXCR_QE3 0x00001000
274#define MPC85xx_PMUXCR_QE9 0x00000040
275#define MPC85xx_PMUXCR_QE12 0x00000008
276 static __be32 __iomem *pmuxcr;
277 273
278 np = of_find_node_by_name(NULL, "global-utilities"); 274 struct ccsr_guts_85xx __iomem *guts;
279 275
276 np = of_find_node_by_name(NULL, "global-utilities");
280 if (np) { 277 if (np) {
281 pmuxcr = of_iomap(np, 0) + MPC85xx_PMUXCR_OFFSET; 278 guts = of_iomap(np, 0);
282 279 if (!guts)
283 if (!pmuxcr) 280 pr_err("mpc85xx-rdb: could not map global utilities register\n");
284 printk(KERN_EMERG "Error: Alternate function" 281 else{
285 " signal multiplex control register not"
286 " mapped!\n");
287 else
288 /* P1021 has pins muxed for QE and other functions. To 282 /* P1021 has pins muxed for QE and other functions. To
289 * enable QE UEC mode, we need to set bit QE0 for UCC1 283 * enable QE UEC mode, we need to set bit QE0 for UCC1
290 * in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9 284 * in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9
291 * and QE12 for QE MII management signals in PMUXCR 285 * and QE12 for QE MII management signals in PMUXCR
292 * register. 286 * register.
293 */ 287 */
294 setbits32(pmuxcr, MPC85xx_PMUXCR_QE0 | 288 setbits32(&guts->pmuxcr, MPC85xx_PMUXCR_QE(0) |
295 MPC85xx_PMUXCR_QE3 | 289 MPC85xx_PMUXCR_QE(3) |
296 MPC85xx_PMUXCR_QE9 | 290 MPC85xx_PMUXCR_QE(9) |
297 MPC85xx_PMUXCR_QE12); 291 MPC85xx_PMUXCR_QE(12));
298 292 iounmap(guts);
293 }
299 of_node_put(np); 294 of_node_put(np);
300 } 295 }
301 296
@@ -434,9 +429,8 @@ machine_arch_initcall(p1021_mds, swiotlb_setup_bus_notifier);
434 429
435static void __init mpc85xx_mds_pic_init(void) 430static void __init mpc85xx_mds_pic_init(void)
436{ 431{
437 struct mpic *mpic = mpic_alloc(NULL, 0, 432 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
438 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN | 433 MPIC_SINGLE_DEST_CPU,
439 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
440 0, 256, " OpenPIC "); 434 0, 256, " OpenPIC ");
441 BUG_ON(mpic == NULL); 435 BUG_ON(mpic == NULL);
442 436
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index ccf520e890b..db214cd4c82 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * MPC85xx RDB Board Setup 2 * MPC85xx RDB Board Setup
3 * 3 *
4 * Copyright 2009 Freescale Semiconductor Inc. 4 * Copyright 2009,2012 Freescale Semiconductor Inc.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -26,6 +26,9 @@
26#include <asm/prom.h> 26#include <asm/prom.h>
27#include <asm/udbg.h> 27#include <asm/udbg.h>
28#include <asm/mpic.h> 28#include <asm/mpic.h>
29#include <asm/qe.h>
30#include <asm/qe_ic.h>
31#include <asm/fsl_guts.h>
29 32
30#include <sysdev/fsl_soc.h> 33#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h> 34#include <sysdev/fsl_pci.h>
@@ -47,21 +50,36 @@ void __init mpc85xx_rdb_pic_init(void)
47 struct mpic *mpic; 50 struct mpic *mpic;
48 unsigned long root = of_get_flat_dt_root(); 51 unsigned long root = of_get_flat_dt_root();
49 52
53#ifdef CONFIG_QUICC_ENGINE
54 struct device_node *np;
55#endif
56
50 if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) { 57 if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
51 mpic = mpic_alloc(NULL, 0, 58 mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET |
52 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | 59 MPIC_BIG_ENDIAN |
53 MPIC_SINGLE_DEST_CPU, 60 MPIC_SINGLE_DEST_CPU,
54 0, 256, " OpenPIC "); 61 0, 256, " OpenPIC ");
55 } else { 62 } else {
56 mpic = mpic_alloc(NULL, 0, 63 mpic = mpic_alloc(NULL, 0,
57 MPIC_WANTS_RESET | 64 MPIC_BIG_ENDIAN |
58 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
59 MPIC_SINGLE_DEST_CPU, 65 MPIC_SINGLE_DEST_CPU,
60 0, 256, " OpenPIC "); 66 0, 256, " OpenPIC ");
61 } 67 }
62 68
63 BUG_ON(mpic == NULL); 69 BUG_ON(mpic == NULL);
64 mpic_init(mpic); 70 mpic_init(mpic);
71
72#ifdef CONFIG_QUICC_ENGINE
73 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
74 if (np) {
75 qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
76 qe_ic_cascade_high_mpic);
77 of_node_put(np);
78
79 } else
80 pr_err("%s: Could not find qe-ic node\n", __func__);
81#endif
82
65} 83}
66 84
67/* 85/*
@@ -69,7 +87,7 @@ void __init mpc85xx_rdb_pic_init(void)
69 */ 87 */
70static void __init mpc85xx_rdb_setup_arch(void) 88static void __init mpc85xx_rdb_setup_arch(void)
71{ 89{
72#ifdef CONFIG_PCI 90#if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE)
73 struct device_node *np; 91 struct device_node *np;
74#endif 92#endif
75 93
@@ -85,11 +103,73 @@ static void __init mpc85xx_rdb_setup_arch(void)
85#endif 103#endif
86 104
87 mpc85xx_smp_init(); 105 mpc85xx_smp_init();
106
107#ifdef CONFIG_QUICC_ENGINE
108 np = of_find_compatible_node(NULL, NULL, "fsl,qe");
109 if (!np) {
110 pr_err("%s: Could not find Quicc Engine node\n", __func__);
111 goto qe_fail;
112 }
113
114 qe_reset();
115 of_node_put(np);
116
117 np = of_find_node_by_name(NULL, "par_io");
118 if (np) {
119 struct device_node *ucc;
120
121 par_io_init(np);
122 of_node_put(np);
123
124 for_each_node_by_name(ucc, "ucc")
125 par_io_of_config(ucc);
126
127 }
128#if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE)
129 if (machine_is(p1025_rdb)) {
130
131 struct ccsr_guts_85xx __iomem *guts;
132
133 np = of_find_node_by_name(NULL, "global-utilities");
134 if (np) {
135 guts = of_iomap(np, 0);
136 if (!guts) {
137
138 pr_err("mpc85xx-rdb: could not map global utilities register\n");
139
140 } else {
141 /* P1025 has pins muxed for QE and other functions. To
142 * enable QE UEC mode, we need to set bit QE0 for UCC1
143 * in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9
144 * and QE12 for QE MII management singals in PMUXCR
145 * register.
146 */
147 setbits32(&guts->pmuxcr, MPC85xx_PMUXCR_QE(0) |
148 MPC85xx_PMUXCR_QE(3) |
149 MPC85xx_PMUXCR_QE(9) |
150 MPC85xx_PMUXCR_QE(12));
151 iounmap(guts);
152 }
153 of_node_put(np);
154 }
155
156 }
157#endif
158
159qe_fail:
160#endif /* CONFIG_QUICC_ENGINE */
161
88 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); 162 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
89} 163}
90 164
91machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices); 165machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices);
166machine_device_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices);
167machine_device_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices);
92machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices); 168machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices);
169machine_device_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices);
170machine_device_initcall(p1020_utm_pc, mpc85xx_common_publish_devices);
171machine_device_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices);
172machine_device_initcall(p1025_rdb, mpc85xx_common_publish_devices);
93 173
94/* 174/*
95 * Called very early, device-tree isn't unflattened 175 * Called very early, device-tree isn't unflattened
@@ -112,6 +192,52 @@ static int __init p1020_rdb_probe(void)
112 return 0; 192 return 0;
113} 193}
114 194
195static int __init p1020_rdb_pc_probe(void)
196{
197 unsigned long root = of_get_flat_dt_root();
198
199 return of_flat_dt_is_compatible(root, "fsl,P1020RDB-PC");
200}
201
202static int __init p1021_rdb_pc_probe(void)
203{
204 unsigned long root = of_get_flat_dt_root();
205
206 if (of_flat_dt_is_compatible(root, "fsl,P1021RDB-PC"))
207 return 1;
208 return 0;
209}
210
211static int __init p2020_rdb_pc_probe(void)
212{
213 unsigned long root = of_get_flat_dt_root();
214
215 if (of_flat_dt_is_compatible(root, "fsl,P2020RDB-PC"))
216 return 1;
217 return 0;
218}
219
220static int __init p1025_rdb_probe(void)
221{
222 unsigned long root = of_get_flat_dt_root();
223
224 return of_flat_dt_is_compatible(root, "fsl,P1025RDB");
225}
226
227static int __init p1020_mbg_pc_probe(void)
228{
229 unsigned long root = of_get_flat_dt_root();
230
231 return of_flat_dt_is_compatible(root, "fsl,P1020MBG-PC");
232}
233
234static int __init p1020_utm_pc_probe(void)
235{
236 unsigned long root = of_get_flat_dt_root();
237
238 return of_flat_dt_is_compatible(root, "fsl,P1020UTM-PC");
239}
240
115define_machine(p2020_rdb) { 241define_machine(p2020_rdb) {
116 .name = "P2020 RDB", 242 .name = "P2020 RDB",
117 .probe = p2020_rdb_probe, 243 .probe = p2020_rdb_probe,
@@ -139,3 +265,87 @@ define_machine(p1020_rdb) {
139 .calibrate_decr = generic_calibrate_decr, 265 .calibrate_decr = generic_calibrate_decr,
140 .progress = udbg_progress, 266 .progress = udbg_progress,
141}; 267};
268
269define_machine(p1021_rdb_pc) {
270 .name = "P1021 RDB-PC",
271 .probe = p1021_rdb_pc_probe,
272 .setup_arch = mpc85xx_rdb_setup_arch,
273 .init_IRQ = mpc85xx_rdb_pic_init,
274#ifdef CONFIG_PCI
275 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
276#endif
277 .get_irq = mpic_get_irq,
278 .restart = fsl_rstcr_restart,
279 .calibrate_decr = generic_calibrate_decr,
280 .progress = udbg_progress,
281};
282
283define_machine(p2020_rdb_pc) {
284 .name = "P2020RDB-PC",
285 .probe = p2020_rdb_pc_probe,
286 .setup_arch = mpc85xx_rdb_setup_arch,
287 .init_IRQ = mpc85xx_rdb_pic_init,
288#ifdef CONFIG_PCI
289 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
290#endif
291 .get_irq = mpic_get_irq,
292 .restart = fsl_rstcr_restart,
293 .calibrate_decr = generic_calibrate_decr,
294 .progress = udbg_progress,
295};
296
297define_machine(p1025_rdb) {
298 .name = "P1025 RDB",
299 .probe = p1025_rdb_probe,
300 .setup_arch = mpc85xx_rdb_setup_arch,
301 .init_IRQ = mpc85xx_rdb_pic_init,
302#ifdef CONFIG_PCI
303 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
304#endif
305 .get_irq = mpic_get_irq,
306 .restart = fsl_rstcr_restart,
307 .calibrate_decr = generic_calibrate_decr,
308 .progress = udbg_progress,
309};
310
311define_machine(p1020_mbg_pc) {
312 .name = "P1020 MBG-PC",
313 .probe = p1020_mbg_pc_probe,
314 .setup_arch = mpc85xx_rdb_setup_arch,
315 .init_IRQ = mpc85xx_rdb_pic_init,
316#ifdef CONFIG_PCI
317 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
318#endif
319 .get_irq = mpic_get_irq,
320 .restart = fsl_rstcr_restart,
321 .calibrate_decr = generic_calibrate_decr,
322 .progress = udbg_progress,
323};
324
325define_machine(p1020_utm_pc) {
326 .name = "P1020 UTM-PC",
327 .probe = p1020_utm_pc_probe,
328 .setup_arch = mpc85xx_rdb_setup_arch,
329 .init_IRQ = mpc85xx_rdb_pic_init,
330#ifdef CONFIG_PCI
331 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
332#endif
333 .get_irq = mpic_get_irq,
334 .restart = fsl_rstcr_restart,
335 .calibrate_decr = generic_calibrate_decr,
336 .progress = udbg_progress,
337};
338
339define_machine(p1020_rdb_pc) {
340 .name = "P1020RDB-PC",
341 .probe = p1020_rdb_pc_probe,
342 .setup_arch = mpc85xx_rdb_setup_arch,
343 .init_IRQ = mpc85xx_rdb_pic_init,
344#ifdef CONFIG_PCI
345 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
346#endif
347 .get_irq = mpic_get_irq,
348 .restart = fsl_rstcr_restart,
349 .calibrate_decr = generic_calibrate_decr,
350 .progress = udbg_progress,
351};
diff --git a/arch/powerpc/platforms/85xx/p1010rdb.c b/arch/powerpc/platforms/85xx/p1010rdb.c
index 538bc3f57e9..d8bd6563d9c 100644
--- a/arch/powerpc/platforms/85xx/p1010rdb.c
+++ b/arch/powerpc/platforms/85xx/p1010rdb.c
@@ -32,9 +32,8 @@
32 32
33void __init p1010_rdb_pic_init(void) 33void __init p1010_rdb_pic_init(void)
34{ 34{
35 struct mpic *mpic = mpic_alloc(NULL, 0, 35 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
36 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN | 36 MPIC_SINGLE_DEST_CPU,
37 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
38 0, 256, " OpenPIC "); 37 0, 256, " OpenPIC ");
39 38
40 BUG_ON(mpic == NULL); 39 BUG_ON(mpic == NULL);
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index b0984ada3f8..0fe88e39945 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -33,6 +33,10 @@
33 33
34#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 34#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
35 35
36#define PMUXCR_ELBCDIU_MASK 0xc0000000
37#define PMUXCR_ELBCDIU_NOR16 0x80000000
38#define PMUXCR_ELBCDIU_DIU 0x40000000
39
36/* 40/*
37 * Board-specific initialization of the DIU. This code should probably be 41 * Board-specific initialization of the DIU. This code should probably be
38 * executed when the DIU is opened, rather than in arch code, but the DIU 42 * executed when the DIU is opened, rather than in arch code, but the DIU
@@ -50,11 +54,22 @@
50#define CLKDVDR_PXCLK_MASK 0x00FF0000 54#define CLKDVDR_PXCLK_MASK 0x00FF0000
51 55
52/* Some ngPIXIS register definitions */ 56/* Some ngPIXIS register definitions */
57#define PX_CTL 3
58#define PX_BRDCFG0 8
59#define PX_BRDCFG1 9
60
61#define PX_BRDCFG0_ELBC_SPI_MASK 0xc0
62#define PX_BRDCFG0_ELBC_SPI_ELBC 0x00
63#define PX_BRDCFG0_ELBC_SPI_NULL 0xc0
64#define PX_BRDCFG0_ELBC_DIU 0x02
65
53#define PX_BRDCFG1_DVIEN 0x80 66#define PX_BRDCFG1_DVIEN 0x80
54#define PX_BRDCFG1_DFPEN 0x40 67#define PX_BRDCFG1_DFPEN 0x40
55#define PX_BRDCFG1_BACKLIGHT 0x20 68#define PX_BRDCFG1_BACKLIGHT 0x20
56#define PX_BRDCFG1_DDCEN 0x10 69#define PX_BRDCFG1_DDCEN 0x10
57 70
71#define PX_CTL_ALTACC 0x80
72
58/* 73/*
59 * DIU Area Descriptor 74 * DIU Area Descriptor
60 * 75 *
@@ -133,44 +148,117 @@ static void p1022ds_set_gamma_table(enum fsl_diu_monitor_port port,
133 */ 148 */
134static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port) 149static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
135{ 150{
136 struct device_node *np; 151 struct device_node *guts_node;
137 void __iomem *pixis; 152 struct device_node *indirect_node = NULL;
138 u8 __iomem *brdcfg1; 153 struct ccsr_guts_85xx __iomem *guts;
139 154 u8 __iomem *lbc_lcs0_ba = NULL;
140 np = of_find_compatible_node(NULL, NULL, "fsl,p1022ds-fpga"); 155 u8 __iomem *lbc_lcs1_ba = NULL;
141 if (!np) 156 u8 b;
142 /* older device trees used "fsl,p1022ds-pixis" */ 157
143 np = of_find_compatible_node(NULL, NULL, "fsl,p1022ds-pixis"); 158 /* Map the global utilities registers. */
144 if (!np) { 159 guts_node = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts");
145 pr_err("p1022ds: missing ngPIXIS node\n"); 160 if (!guts_node) {
161 pr_err("p1022ds: missing global utilties device node\n");
146 return; 162 return;
147 } 163 }
148 164
149 pixis = of_iomap(np, 0); 165 guts = of_iomap(guts_node, 0);
150 if (!pixis) { 166 if (!guts) {
151 pr_err("p1022ds: could not map ngPIXIS registers\n"); 167 pr_err("p1022ds: could not map global utilties device\n");
152 return; 168 goto exit;
153 } 169 }
154 brdcfg1 = pixis + 9; /* BRDCFG1 is at offset 9 in the ngPIXIS */ 170
171 indirect_node = of_find_compatible_node(NULL, NULL,
172 "fsl,p1022ds-indirect-pixis");
173 if (!indirect_node) {
174 pr_err("p1022ds: missing pixis indirect mode node\n");
175 goto exit;
176 }
177
178 lbc_lcs0_ba = of_iomap(indirect_node, 0);
179 if (!lbc_lcs0_ba) {
180 pr_err("p1022ds: could not map localbus chip select 0\n");
181 goto exit;
182 }
183
184 lbc_lcs1_ba = of_iomap(indirect_node, 1);
185 if (!lbc_lcs1_ba) {
186 pr_err("p1022ds: could not map localbus chip select 1\n");
187 goto exit;
188 }
189
190 /* Make sure we're in indirect mode first. */
191 if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) !=
192 PMUXCR_ELBCDIU_DIU) {
193 struct device_node *pixis_node;
194 void __iomem *pixis;
195
196 pixis_node =
197 of_find_compatible_node(NULL, NULL, "fsl,p1022ds-fpga");
198 if (!pixis_node) {
199 pr_err("p1022ds: missing pixis node\n");
200 goto exit;
201 }
202
203 pixis = of_iomap(pixis_node, 0);
204 of_node_put(pixis_node);
205 if (!pixis) {
206 pr_err("p1022ds: could not map pixis registers\n");
207 goto exit;
208 }
209
210 /* Enable indirect PIXIS mode. */
211 setbits8(pixis + PX_CTL, PX_CTL_ALTACC);
212 iounmap(pixis);
213
214 /* Switch the board mux to the DIU */
215 out_8(lbc_lcs0_ba, PX_BRDCFG0); /* BRDCFG0 */
216 b = in_8(lbc_lcs1_ba);
217 b |= PX_BRDCFG0_ELBC_DIU;
218 out_8(lbc_lcs1_ba, b);
219
220 /* Set the chip mux to DIU mode. */
221 clrsetbits_be32(&guts->pmuxcr, PMUXCR_ELBCDIU_MASK,
222 PMUXCR_ELBCDIU_DIU);
223 in_be32(&guts->pmuxcr);
224 }
225
155 226
156 switch (port) { 227 switch (port) {
157 case FSL_DIU_PORT_DVI: 228 case FSL_DIU_PORT_DVI:
158 printk(KERN_INFO "%s:%u\n", __func__, __LINE__);
159 /* Enable the DVI port, disable the DFP and the backlight */ 229 /* Enable the DVI port, disable the DFP and the backlight */
160 clrsetbits_8(brdcfg1, PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT, 230 out_8(lbc_lcs0_ba, PX_BRDCFG1);
161 PX_BRDCFG1_DVIEN); 231 b = in_8(lbc_lcs1_ba);
232 b &= ~(PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT);
233 b |= PX_BRDCFG1_DVIEN;
234 out_8(lbc_lcs1_ba, b);
162 break; 235 break;
163 case FSL_DIU_PORT_LVDS: 236 case FSL_DIU_PORT_LVDS:
164 printk(KERN_INFO "%s:%u\n", __func__, __LINE__); 237 /*
238 * LVDS also needs backlight enabled, otherwise the display
239 * will be blank.
240 */
165 /* Enable the DFP port, disable the DVI and the backlight */ 241 /* Enable the DFP port, disable the DVI and the backlight */
166 clrsetbits_8(brdcfg1, PX_BRDCFG1_DVIEN | PX_BRDCFG1_BACKLIGHT, 242 out_8(lbc_lcs0_ba, PX_BRDCFG1);
167 PX_BRDCFG1_DFPEN); 243 b = in_8(lbc_lcs1_ba);
244 b &= ~PX_BRDCFG1_DVIEN;
245 b |= PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT;
246 out_8(lbc_lcs1_ba, b);
168 break; 247 break;
169 default: 248 default:
170 pr_err("p1022ds: unsupported monitor port %i\n", port); 249 pr_err("p1022ds: unsupported monitor port %i\n", port);
171 } 250 }
172 251
173 iounmap(pixis); 252exit:
253 if (lbc_lcs1_ba)
254 iounmap(lbc_lcs1_ba);
255 if (lbc_lcs0_ba)
256 iounmap(lbc_lcs0_ba);
257 if (guts)
258 iounmap(guts);
259
260 of_node_put(indirect_node);
261 of_node_put(guts_node);
174} 262}
175 263
176/** 264/**
@@ -242,15 +330,56 @@ p1022ds_valid_monitor_port(enum fsl_diu_monitor_port port)
242 330
243void __init p1022_ds_pic_init(void) 331void __init p1022_ds_pic_init(void)
244{ 332{
245 struct mpic *mpic = mpic_alloc(NULL, 0, 333 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
246 MPIC_WANTS_RESET |
247 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
248 MPIC_SINGLE_DEST_CPU, 334 MPIC_SINGLE_DEST_CPU,
249 0, 256, " OpenPIC "); 335 0, 256, " OpenPIC ");
250 BUG_ON(mpic == NULL); 336 BUG_ON(mpic == NULL);
251 mpic_init(mpic); 337 mpic_init(mpic);
252} 338}
253 339
340#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
341
342/*
343 * Disables a node in the device tree.
344 *
345 * This function is called before kmalloc() is available, so the 'new' object
346 * should be allocated in the global area. The easiest way is to do that is
347 * to allocate one static local variable for each call to this function.
348 */
349static void __init disable_one_node(struct device_node *np, struct property *new)
350{
351 struct property *old;
352
353 old = of_find_property(np, new->name, NULL);
354 if (old)
355 prom_update_property(np, new, old);
356 else
357 prom_add_property(np, new);
358}
359
360/* TRUE if there is a "video=fslfb" command-line parameter. */
361static bool fslfb;
362
363/*
364 * Search for a "video=fslfb" command-line parameter, and set 'fslfb' to
365 * true if we find it.
366 *
367 * We need to use early_param() instead of __setup() because the normal
368 * __setup() gets called to late. However, early_param() gets called very
369 * early, before the device tree is unflattened, so all we can do now is set a
370 * global variable. Later on, p1022_ds_setup_arch() will use that variable
371 * to determine if we need to update the device tree.
372 */
373static int __init early_video_setup(char *options)
374{
375 fslfb = (strncmp(options, "fslfb:", 6) == 0);
376
377 return 0;
378}
379early_param("video", early_video_setup);
380
381#endif
382
254/* 383/*
255 * Setup the architecture 384 * Setup the architecture
256 */ 385 */
@@ -288,6 +417,34 @@ static void __init p1022_ds_setup_arch(void)
288 diu_ops.set_monitor_port = p1022ds_set_monitor_port; 417 diu_ops.set_monitor_port = p1022ds_set_monitor_port;
289 diu_ops.set_pixel_clock = p1022ds_set_pixel_clock; 418 diu_ops.set_pixel_clock = p1022ds_set_pixel_clock;
290 diu_ops.valid_monitor_port = p1022ds_valid_monitor_port; 419 diu_ops.valid_monitor_port = p1022ds_valid_monitor_port;
420
421 /*
422 * Disable the NOR flash node if there is video=fslfb... command-line
423 * parameter. When the DIU is active, NOR flash is unavailable, so we
424 * have to disable the node before the MTD driver loads.
425 */
426 if (fslfb) {
427 struct device_node *np =
428 of_find_compatible_node(NULL, NULL, "fsl,p1022-elbc");
429
430 if (np) {
431 np = of_find_compatible_node(np, NULL, "cfi-flash");
432 if (np) {
433 static struct property nor_status = {
434 .name = "status",
435 .value = "disabled",
436 .length = sizeof("disabled"),
437 };
438
439 pr_info("p1022ds: disabling %s node",
440 np->full_name);
441 disable_one_node(np, &nor_status);
442 of_node_put(np);
443 }
444 }
445
446 }
447
291#endif 448#endif
292 449
293 mpc85xx_smp_init(); 450 mpc85xx_smp_init();
diff --git a/arch/powerpc/platforms/85xx/p1023_rds.c b/arch/powerpc/platforms/85xx/p1023_rds.c
index d951e7027bb..6b07398e436 100644
--- a/arch/powerpc/platforms/85xx/p1023_rds.c
+++ b/arch/powerpc/platforms/85xx/p1023_rds.c
@@ -93,9 +93,8 @@ machine_device_initcall(p1023_rds, mpc85xx_common_publish_devices);
93 93
94static void __init mpc85xx_rds_pic_init(void) 94static void __init mpc85xx_rds_pic_init(void)
95{ 95{
96 struct mpic *mpic = mpic_alloc(NULL, 0, 96 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
97 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN | 97 MPIC_SINGLE_DEST_CPU,
98 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
99 0, 256, " OpenPIC "); 98 0, 256, " OpenPIC ");
100 99
101 BUG_ON(mpic == NULL); 100 BUG_ON(mpic == NULL);
diff --git a/arch/powerpc/platforms/85xx/sbc8548.c b/arch/powerpc/platforms/85xx/sbc8548.c
index 184a5078461..1677b8a2267 100644
--- a/arch/powerpc/platforms/85xx/sbc8548.c
+++ b/arch/powerpc/platforms/85xx/sbc8548.c
@@ -54,8 +54,7 @@ static int sbc_rev;
54 54
55static void __init sbc8548_pic_init(void) 55static void __init sbc8548_pic_init(void)
56{ 56{
57 struct mpic *mpic = mpic_alloc(NULL, 0, 57 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
58 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
59 0, 256, " OpenPIC "); 58 0, 256, " OpenPIC ");
60 BUG_ON(mpic == NULL); 59 BUG_ON(mpic == NULL);
61 mpic_init(mpic); 60 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c
index 940752e9305..3c3bbcc2756 100644
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -41,8 +41,7 @@
41 41
42static void __init sbc8560_pic_init(void) 42static void __init sbc8560_pic_init(void)
43{ 43{
44 struct mpic *mpic = mpic_alloc(NULL, 0, 44 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
45 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
46 0, 256, " OpenPIC "); 45 0, 256, " OpenPIC ");
47 BUG_ON(mpic == NULL); 46 BUG_ON(mpic == NULL);
48 mpic_init(mpic); 47 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/85xx/socrates.c b/arch/powerpc/platforms/85xx/socrates.c
index 18f635906b2..b7191921775 100644
--- a/arch/powerpc/platforms/85xx/socrates.c
+++ b/arch/powerpc/platforms/85xx/socrates.c
@@ -48,8 +48,7 @@ static void __init socrates_pic_init(void)
48{ 48{
49 struct device_node *np; 49 struct device_node *np;
50 50
51 struct mpic *mpic = mpic_alloc(NULL, 0, 51 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
52 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
53 0, 256, " OpenPIC "); 52 0, 256, " OpenPIC ");
54 BUG_ON(mpic == NULL); 53 BUG_ON(mpic == NULL);
55 mpic_init(mpic); 54 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/85xx/stx_gp3.c b/arch/powerpc/platforms/85xx/stx_gp3.c
index e9e5234b4e7..27ca3a7b04a 100644
--- a/arch/powerpc/platforms/85xx/stx_gp3.c
+++ b/arch/powerpc/platforms/85xx/stx_gp3.c
@@ -48,8 +48,7 @@
48 48
49static void __init stx_gp3_pic_init(void) 49static void __init stx_gp3_pic_init(void)
50{ 50{
51 struct mpic *mpic = mpic_alloc(NULL, 0, 51 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
52 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
53 0, 256, " OpenPIC "); 52 0, 256, " OpenPIC ");
54 BUG_ON(mpic == NULL); 53 BUG_ON(mpic == NULL);
55 mpic_init(mpic); 54 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c
index bf7c89fb75b..d7504cefe01 100644
--- a/arch/powerpc/platforms/85xx/tqm85xx.c
+++ b/arch/powerpc/platforms/85xx/tqm85xx.c
@@ -47,7 +47,7 @@
47static void __init tqm85xx_pic_init(void) 47static void __init tqm85xx_pic_init(void)
48{ 48{
49 struct mpic *mpic = mpic_alloc(NULL, 0, 49 struct mpic *mpic = mpic_alloc(NULL, 0,
50 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN, 50 MPIC_BIG_ENDIAN,
51 0, 256, " OpenPIC "); 51 0, 256, " OpenPIC ");
52 BUG_ON(mpic == NULL); 52 BUG_ON(mpic == NULL);
53 mpic_init(mpic); 53 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/85xx/xes_mpc85xx.c b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
index 3a69f8b77de..503c21596c6 100644
--- a/arch/powerpc/platforms/85xx/xes_mpc85xx.c
+++ b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
@@ -43,9 +43,7 @@
43 43
44void __init xes_mpc85xx_pic_init(void) 44void __init xes_mpc85xx_pic_init(void)
45{ 45{
46 struct mpic *mpic = mpic_alloc(NULL, 0, 46 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
47 MPIC_WANTS_RESET |
48 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
49 0, 256, " OpenPIC "); 47 0, 256, " OpenPIC ");
50 BUG_ON(mpic == NULL); 48 BUG_ON(mpic == NULL);
51 mpic_init(mpic); 49 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 8d6599d54ea..7a6279e3821 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -39,6 +39,7 @@ config GEF_PPC9A
39 select MMIO_NVRAM 39 select MMIO_NVRAM
40 select GENERIC_GPIO 40 select GENERIC_GPIO
41 select ARCH_REQUIRE_GPIOLIB 41 select ARCH_REQUIRE_GPIOLIB
42 select GE_FPGA
42 help 43 help
43 This option enables support for the GE PPC9A. 44 This option enables support for the GE PPC9A.
44 45
@@ -48,6 +49,7 @@ config GEF_SBC310
48 select MMIO_NVRAM 49 select MMIO_NVRAM
49 select GENERIC_GPIO 50 select GENERIC_GPIO
50 select ARCH_REQUIRE_GPIOLIB 51 select ARCH_REQUIRE_GPIOLIB
52 select GE_FPGA
51 help 53 help
52 This option enables support for the GE SBC310. 54 This option enables support for the GE SBC310.
53 55
@@ -57,6 +59,7 @@ config GEF_SBC610
57 select MMIO_NVRAM 59 select MMIO_NVRAM
58 select GENERIC_GPIO 60 select GENERIC_GPIO
59 select ARCH_REQUIRE_GPIOLIB 61 select ARCH_REQUIRE_GPIOLIB
62 select GE_FPGA
60 select HAS_RAPIDIO 63 select HAS_RAPIDIO
61 help 64 help
62 This option enables support for the GE SBC610. 65 This option enables support for the GE SBC610.
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile
index 4b0d7b1aa00..ede815d6489 100644
--- a/arch/powerpc/platforms/86xx/Makefile
+++ b/arch/powerpc/platforms/86xx/Makefile
@@ -7,7 +7,6 @@ obj-$(CONFIG_SMP) += mpc86xx_smp.o
7obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o 7obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o
8obj-$(CONFIG_SBC8641D) += sbc8641d.o 8obj-$(CONFIG_SBC8641D) += sbc8641d.o
9obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o 9obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o
10gef-gpio-$(CONFIG_GPIOLIB) += gef_gpio.o 10obj-$(CONFIG_GEF_SBC610) += gef_sbc610.o
11obj-$(CONFIG_GEF_SBC610) += gef_sbc610.o gef_pic.o $(gef-gpio-y) 11obj-$(CONFIG_GEF_SBC310) += gef_sbc310.o
12obj-$(CONFIG_GEF_SBC310) += gef_sbc310.o gef_pic.o $(gef-gpio-y) 12obj-$(CONFIG_GEF_PPC9A) += gef_ppc9a.o
13obj-$(CONFIG_GEF_PPC9A) += gef_ppc9a.o gef_pic.o $(gef-gpio-y)
diff --git a/arch/powerpc/platforms/86xx/gef_gpio.c b/arch/powerpc/platforms/86xx/gef_gpio.c
deleted file mode 100644
index 2a703365e66..00000000000
--- a/arch/powerpc/platforms/86xx/gef_gpio.c
+++ /dev/null
@@ -1,171 +0,0 @@
1/*
2 * Driver for GE FPGA based GPIO
3 *
4 * Author: Martyn Welch <martyn.welch@ge.com>
5 *
6 * 2008 (c) GE Intelligent Platforms Embedded Systems, Inc.
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 */
12
13/* TODO
14 *
15 * Configuration of output modes (totem-pole/open-drain)
16 * Interrupt configuration - interrupts are always generated the FPGA relies on
17 * the I/O interrupt controllers mask to stop them propergating
18 */
19
20#include <linux/kernel.h>
21#include <linux/compiler.h>
22#include <linux/init.h>
23#include <linux/io.h>
24#include <linux/of.h>
25#include <linux/of_device.h>
26#include <linux/of_platform.h>
27#include <linux/of_gpio.h>
28#include <linux/gpio.h>
29#include <linux/slab.h>
30#include <linux/module.h>
31
32#define GEF_GPIO_DIRECT 0x00
33#define GEF_GPIO_IN 0x04
34#define GEF_GPIO_OUT 0x08
35#define GEF_GPIO_TRIG 0x0C
36#define GEF_GPIO_POLAR_A 0x10
37#define GEF_GPIO_POLAR_B 0x14
38#define GEF_GPIO_INT_STAT 0x18
39#define GEF_GPIO_OVERRUN 0x1C
40#define GEF_GPIO_MODE 0x20
41
42static void _gef_gpio_set(void __iomem *reg, unsigned int offset, int value)
43{
44 unsigned int data;
45
46 data = ioread32be(reg);
47 /* value: 0=low; 1=high */
48 if (value & 0x1)
49 data = data | (0x1 << offset);
50 else
51 data = data & ~(0x1 << offset);
52
53 iowrite32be(data, reg);
54}
55
56
57static int gef_gpio_dir_in(struct gpio_chip *chip, unsigned offset)
58{
59 unsigned int data;
60 struct of_mm_gpio_chip *mmchip = to_of_mm_gpio_chip(chip);
61
62 data = ioread32be(mmchip->regs + GEF_GPIO_DIRECT);
63 data = data | (0x1 << offset);
64 iowrite32be(data, mmchip->regs + GEF_GPIO_DIRECT);
65
66 return 0;
67}
68
69static int gef_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int value)
70{
71 unsigned int data;
72 struct of_mm_gpio_chip *mmchip = to_of_mm_gpio_chip(chip);
73
74 /* Set direction before switching to input */
75 _gef_gpio_set(mmchip->regs + GEF_GPIO_OUT, offset, value);
76
77 data = ioread32be(mmchip->regs + GEF_GPIO_DIRECT);
78 data = data & ~(0x1 << offset);
79 iowrite32be(data, mmchip->regs + GEF_GPIO_DIRECT);
80
81 return 0;
82}
83
84static int gef_gpio_get(struct gpio_chip *chip, unsigned offset)
85{
86 unsigned int data;
87 int state = 0;
88 struct of_mm_gpio_chip *mmchip = to_of_mm_gpio_chip(chip);
89
90 data = ioread32be(mmchip->regs + GEF_GPIO_IN);
91 state = (int)((data >> offset) & 0x1);
92
93 return state;
94}
95
96static void gef_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
97{
98 struct of_mm_gpio_chip *mmchip = to_of_mm_gpio_chip(chip);
99
100 _gef_gpio_set(mmchip->regs + GEF_GPIO_OUT, offset, value);
101}
102
103static int __init gef_gpio_init(void)
104{
105 struct device_node *np;
106 int retval;
107 struct of_mm_gpio_chip *gef_gpio_chip;
108
109 for_each_compatible_node(np, NULL, "gef,sbc610-gpio") {
110
111 pr_debug("%s: Initialising GEF GPIO\n", np->full_name);
112
113 /* Allocate chip structure */
114 gef_gpio_chip = kzalloc(sizeof(*gef_gpio_chip), GFP_KERNEL);
115 if (!gef_gpio_chip) {
116 pr_err("%s: Unable to allocate structure\n",
117 np->full_name);
118 continue;
119 }
120
121 /* Setup pointers to chip functions */
122 gef_gpio_chip->gc.of_gpio_n_cells = 2;
123 gef_gpio_chip->gc.ngpio = 19;
124 gef_gpio_chip->gc.direction_input = gef_gpio_dir_in;
125 gef_gpio_chip->gc.direction_output = gef_gpio_dir_out;
126 gef_gpio_chip->gc.get = gef_gpio_get;
127 gef_gpio_chip->gc.set = gef_gpio_set;
128
129 /* This function adds a memory mapped GPIO chip */
130 retval = of_mm_gpiochip_add(np, gef_gpio_chip);
131 if (retval) {
132 kfree(gef_gpio_chip);
133 pr_err("%s: Unable to add GPIO\n", np->full_name);
134 }
135 }
136
137 for_each_compatible_node(np, NULL, "gef,sbc310-gpio") {
138
139 pr_debug("%s: Initialising GEF GPIO\n", np->full_name);
140
141 /* Allocate chip structure */
142 gef_gpio_chip = kzalloc(sizeof(*gef_gpio_chip), GFP_KERNEL);
143 if (!gef_gpio_chip) {
144 pr_err("%s: Unable to allocate structure\n",
145 np->full_name);
146 continue;
147 }
148
149 /* Setup pointers to chip functions */
150 gef_gpio_chip->gc.of_gpio_n_cells = 2;
151 gef_gpio_chip->gc.ngpio = 6;
152 gef_gpio_chip->gc.direction_input = gef_gpio_dir_in;
153 gef_gpio_chip->gc.direction_output = gef_gpio_dir_out;
154 gef_gpio_chip->gc.get = gef_gpio_get;
155 gef_gpio_chip->gc.set = gef_gpio_set;
156
157 /* This function adds a memory mapped GPIO chip */
158 retval = of_mm_gpiochip_add(np, gef_gpio_chip);
159 if (retval) {
160 kfree(gef_gpio_chip);
161 pr_err("%s: Unable to add GPIO\n", np->full_name);
162 }
163 }
164
165 return 0;
166};
167arch_initcall(gef_gpio_init);
168
169MODULE_DESCRIPTION("GE I/O FPGA GPIO driver");
170MODULE_AUTHOR("Martyn Welch <martyn.welch@ge.com");
171MODULE_LICENSE("GPL");
diff --git a/arch/powerpc/platforms/86xx/gef_ppc9a.c b/arch/powerpc/platforms/86xx/gef_ppc9a.c
index 60ce07e3910..ed58b6cfd60 100644
--- a/arch/powerpc/platforms/86xx/gef_ppc9a.c
+++ b/arch/powerpc/platforms/86xx/gef_ppc9a.c
@@ -37,9 +37,9 @@
37 37
38#include <sysdev/fsl_pci.h> 38#include <sysdev/fsl_pci.h>
39#include <sysdev/fsl_soc.h> 39#include <sysdev/fsl_soc.h>
40#include <sysdev/ge/ge_pic.h>
40 41
41#include "mpc86xx.h" 42#include "mpc86xx.h"
42#include "gef_pic.h"
43 43
44#undef DEBUG 44#undef DEBUG
45 45
diff --git a/arch/powerpc/platforms/86xx/gef_sbc310.c b/arch/powerpc/platforms/86xx/gef_sbc310.c
index 3ecee25bf3e..710db69bd52 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc310.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc310.c
@@ -37,9 +37,9 @@
37 37
38#include <sysdev/fsl_pci.h> 38#include <sysdev/fsl_pci.h>
39#include <sysdev/fsl_soc.h> 39#include <sysdev/fsl_soc.h>
40#include <sysdev/ge/ge_pic.h>
40 41
41#include "mpc86xx.h" 42#include "mpc86xx.h"
42#include "gef_pic.h"
43 43
44#undef DEBUG 44#undef DEBUG
45 45
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
index 5090d608d9e..4a13d2f4ac2 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc610.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -37,9 +37,9 @@
37 37
38#include <sysdev/fsl_pci.h> 38#include <sysdev/fsl_pci.h>
39#include <sysdev/fsl_soc.h> 39#include <sysdev/fsl_soc.h>
40#include <sysdev/ge/ge_pic.h>
40 41
41#include "mpc86xx.h" 42#include "mpc86xx.h"
42#include "gef_pic.h"
43 43
44#undef DEBUG 44#undef DEBUG
45 45
diff --git a/arch/powerpc/platforms/86xx/pic.c b/arch/powerpc/platforms/86xx/pic.c
index 52bbfa03153..22cc3571ae1 100644
--- a/arch/powerpc/platforms/86xx/pic.c
+++ b/arch/powerpc/platforms/86xx/pic.c
@@ -37,9 +37,8 @@ void __init mpc86xx_init_irq(void)
37 int cascade_irq; 37 int cascade_irq;
38#endif 38#endif
39 39
40 struct mpic *mpic = mpic_alloc(NULL, 0, 40 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
41 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN | 41 MPIC_SINGLE_DEST_CPU,
42 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
43 0, 256, " MPIC "); 42 0, 256, " MPIC ");
44 BUG_ON(mpic == NULL); 43 BUG_ON(mpic == NULL);
45 44
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 0cfb46d54b8..a35ca44ade6 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -2,7 +2,6 @@ menu "Platform support"
2 2
3source "arch/powerpc/platforms/powernv/Kconfig" 3source "arch/powerpc/platforms/powernv/Kconfig"
4source "arch/powerpc/platforms/pseries/Kconfig" 4source "arch/powerpc/platforms/pseries/Kconfig"
5source "arch/powerpc/platforms/iseries/Kconfig"
6source "arch/powerpc/platforms/chrp/Kconfig" 5source "arch/powerpc/platforms/chrp/Kconfig"
7source "arch/powerpc/platforms/512x/Kconfig" 6source "arch/powerpc/platforms/512x/Kconfig"
8source "arch/powerpc/platforms/52xx/Kconfig" 7source "arch/powerpc/platforms/52xx/Kconfig"
@@ -87,6 +86,14 @@ config MPIC_WEIRD
87 bool 86 bool
88 default n 87 default n
89 88
89config MPIC_MSGR
90 bool "MPIC message register support"
91 depends on MPIC
92 default n
93 help
94 Enables support for the MPIC message registers. These
95 registers are used for inter-processor communication.
96
90config PPC_I8259 97config PPC_I8259
91 bool 98 bool
92 default n 99 default n
@@ -138,7 +145,7 @@ config MPIC_BROKEN_REGREAD
138 of the register contents in software. 145 of the register contents in software.
139 146
140config IBMVIO 147config IBMVIO
141 depends on PPC_PSERIES || PPC_ISERIES 148 depends on PPC_PSERIES
142 bool 149 bool
143 default y 150 default y
144 151
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index 2635a22bade..879b4a44849 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -16,7 +16,6 @@ obj-$(CONFIG_FSL_SOC_BOOKE) += 85xx/
16obj-$(CONFIG_PPC_86xx) += 86xx/ 16obj-$(CONFIG_PPC_86xx) += 86xx/
17obj-$(CONFIG_PPC_POWERNV) += powernv/ 17obj-$(CONFIG_PPC_POWERNV) += powernv/
18obj-$(CONFIG_PPC_PSERIES) += pseries/ 18obj-$(CONFIG_PPC_PSERIES) += pseries/
19obj-$(CONFIG_PPC_ISERIES) += iseries/
20obj-$(CONFIG_PPC_MAPLE) += maple/ 19obj-$(CONFIG_PPC_MAPLE) += maple/
21obj-$(CONFIG_PPC_PASEMI) += pasemi/ 20obj-$(CONFIG_PPC_PASEMI) += pasemi/
22obj-$(CONFIG_PPC_CELL) += cell/ 21obj-$(CONFIG_PPC_CELL) += cell/
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 62002a7edfe..fa3e294fd34 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -197,7 +197,8 @@ static void __init mpic_init_IRQ(void)
197 /* The MPIC driver will get everything it needs from the 197 /* The MPIC driver will get everything it needs from the
198 * device-tree, just pass 0 to all arguments 198 * device-tree, just pass 0 to all arguments
199 */ 199 */
200 mpic = mpic_alloc(dn, 0, MPIC_SECONDARY, 0, 0, " MPIC "); 200 mpic = mpic_alloc(dn, 0, MPIC_SECONDARY | MPIC_NO_RESET,
201 0, 0, " MPIC ");
201 if (mpic == NULL) 202 if (mpic == NULL)
202 continue; 203 continue;
203 mpic_init(mpic); 204 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index d4a094ca96f..1d75c92ea8f 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -646,6 +646,7 @@ long spufs_create(struct path *path, struct dentry *dentry,
646 646
647out: 647out:
648 mutex_unlock(&path->dentry->d_inode->i_mutex); 648 mutex_unlock(&path->dentry->d_inode->i_mutex);
649 dput(dentry);
649 return ret; 650 return ret;
650} 651}
651 652
@@ -757,9 +758,9 @@ spufs_create_root(struct super_block *sb, void *data)
757 goto out_iput; 758 goto out_iput;
758 759
759 ret = -ENOMEM; 760 ret = -ENOMEM;
760 sb->s_root = d_alloc_root(inode); 761 sb->s_root = d_make_root(inode);
761 if (!sb->s_root) 762 if (!sb->s_root)
762 goto out_iput; 763 goto out;
763 764
764 return 0; 765 return 0;
765out_iput: 766out_iput:
@@ -828,19 +829,19 @@ static int __init spufs_init(void)
828 ret = spu_sched_init(); 829 ret = spu_sched_init();
829 if (ret) 830 if (ret)
830 goto out_cache; 831 goto out_cache;
831 ret = register_filesystem(&spufs_type); 832 ret = register_spu_syscalls(&spufs_calls);
832 if (ret) 833 if (ret)
833 goto out_sched; 834 goto out_sched;
834 ret = register_spu_syscalls(&spufs_calls); 835 ret = register_filesystem(&spufs_type);
835 if (ret) 836 if (ret)
836 goto out_fs; 837 goto out_syscalls;
837 838
838 spufs_init_isolated_loader(); 839 spufs_init_isolated_loader();
839 840
840 return 0; 841 return 0;
841 842
842out_fs: 843out_syscalls:
843 unregister_filesystem(&spufs_type); 844 unregister_spu_syscalls(&spufs_calls);
844out_sched: 845out_sched:
845 spu_sched_exit(); 846 spu_sched_exit();
846out_cache: 847out_cache:
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 8591bb62d7f..5665dcc382c 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -70,8 +70,6 @@ static long do_spu_create(const char __user *pathname, unsigned int flags,
70 ret = PTR_ERR(dentry); 70 ret = PTR_ERR(dentry);
71 if (!IS_ERR(dentry)) { 71 if (!IS_ERR(dentry)) {
72 ret = spufs_create(&path, dentry, flags, mode, neighbor); 72 ret = spufs_create(&path, dentry, flags, mode, neighbor);
73 mutex_unlock(&path.dentry->d_inode->i_mutex);
74 dput(dentry);
75 path_put(&path); 73 path_put(&path);
76 } 74 }
77 75
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index f1f17bb2c33..c665d7de6c9 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -435,7 +435,8 @@ static void __init chrp_find_openpic(void)
435 if (len > 1) 435 if (len > 1)
436 isu_size = iranges[3]; 436 isu_size = iranges[3];
437 437
438 chrp_mpic = mpic_alloc(np, opaddr, 0, isu_size, 0, " MPIC "); 438 chrp_mpic = mpic_alloc(np, opaddr, MPIC_NO_RESET,
439 isu_size, 0, " MPIC ");
439 if (chrp_mpic == NULL) { 440 if (chrp_mpic == NULL) {
440 printk(KERN_ERR "Failed to allocate MPIC structure\n"); 441 printk(KERN_ERR "Failed to allocate MPIC structure\n");
441 goto bail; 442 goto bail;
diff --git a/arch/powerpc/platforms/embedded6xx/holly.c b/arch/powerpc/platforms/embedded6xx/holly.c
index 9cfcf20c056..ab51b21b4bd 100644
--- a/arch/powerpc/platforms/embedded6xx/holly.c
+++ b/arch/powerpc/platforms/embedded6xx/holly.c
@@ -154,11 +154,9 @@ static void __init holly_init_IRQ(void)
154 struct device_node *cascade_node = NULL; 154 struct device_node *cascade_node = NULL;
155#endif 155#endif
156 156
157 mpic = mpic_alloc(NULL, 0, 157 mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
158 MPIC_BIG_ENDIAN | MPIC_WANTS_RESET |
159 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108, 158 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108,
160 24, 159 24, 0,
161 NR_IRQS-4, /* num_sources used */
162 "Tsi108_PIC"); 160 "Tsi108_PIC");
163 161
164 BUG_ON(mpic == NULL); 162 BUG_ON(mpic == NULL);
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index bcfad92c9ce..455e7c08742 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -82,8 +82,7 @@ static void __init linkstation_init_IRQ(void)
82{ 82{
83 struct mpic *mpic; 83 struct mpic *mpic;
84 84
85 mpic = mpic_alloc(NULL, 0, MPIC_WANTS_RESET, 85 mpic = mpic_alloc(NULL, 0, 0, 4, 0, " EPIC ");
86 4, 32, " EPIC ");
87 BUG_ON(mpic == NULL); 86 BUG_ON(mpic == NULL);
88 87
89 /* PCI IRQs */ 88 /* PCI IRQs */
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index f3350d786f5..74ccce36bae 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -108,11 +108,9 @@ static void __init mpc7448_hpc2_init_IRQ(void)
108 struct device_node *cascade_node = NULL; 108 struct device_node *cascade_node = NULL;
109#endif 109#endif
110 110
111 mpic = mpic_alloc(NULL, 0, 111 mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
112 MPIC_BIG_ENDIAN | MPIC_WANTS_RESET |
113 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108, 112 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108,
114 24, 113 24, 0,
115 NR_IRQS-4, /* num_sources used */
116 "Tsi108_PIC"); 114 "Tsi108_PIC");
117 115
118 BUG_ON(mpic == NULL); 116 BUG_ON(mpic == NULL);
diff --git a/arch/powerpc/platforms/embedded6xx/storcenter.c b/arch/powerpc/platforms/embedded6xx/storcenter.c
index afa63883496..e0ed3c71d69 100644
--- a/arch/powerpc/platforms/embedded6xx/storcenter.c
+++ b/arch/powerpc/platforms/embedded6xx/storcenter.c
@@ -84,8 +84,7 @@ static void __init storcenter_init_IRQ(void)
84{ 84{
85 struct mpic *mpic; 85 struct mpic *mpic;
86 86
87 mpic = mpic_alloc(NULL, 0, MPIC_WANTS_RESET, 87 mpic = mpic_alloc(NULL, 0, 0, 16, 0, " OpenPIC ");
88 16, 32, " OpenPIC ");
89 BUG_ON(mpic == NULL); 88 BUG_ON(mpic == NULL);
90 89
91 /* 90 /*
diff --git a/arch/powerpc/platforms/iseries/Kconfig b/arch/powerpc/platforms/iseries/Kconfig
deleted file mode 100644
index 63835e09e5c..00000000000
--- a/arch/powerpc/platforms/iseries/Kconfig
+++ /dev/null
@@ -1,39 +0,0 @@
1config PPC_ISERIES
2 bool "IBM Legacy iSeries"
3 depends on PPC64 && PPC_BOOK3S
4 select OF_DYNAMIC
5 select PPC_SMP_MUXED_IPI
6 select PPC_INDIRECT_PIO
7 select PPC_INDIRECT_MMIO
8 select PPC_PCI_CHOICE if EXPERT
9
10menu "iSeries device drivers"
11 depends on PPC_ISERIES
12
13config VIODASD
14 tristate "iSeries Virtual I/O disk support"
15 depends on BLOCK
16 select VIOPATH
17 help
18 If you are running on an iSeries system and you want to use
19 virtual disks created and managed by OS/400, say Y.
20
21config VIOCD
22 tristate "iSeries Virtual I/O CD support"
23 depends on BLOCK
24 select VIOPATH
25 help
26 If you are running Linux on an IBM iSeries system and you want to
27 read a CD drive owned by OS/400, say Y here.
28
29config VIOTAPE
30 tristate "iSeries Virtual Tape Support"
31 select VIOPATH
32 help
33 If you are running Linux on an iSeries system and you want Linux
34 to read and/or write a tape drive owned by OS/400, say Y here.
35
36endmenu
37
38config VIOPATH
39 bool
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
deleted file mode 100644
index a7602b11ed9..00000000000
--- a/arch/powerpc/platforms/iseries/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1ccflags-y := -mno-minimal-toc
2
3obj-y += exception.o
4obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt.o mf.o lpevents.o \
5 hvcall.o proc.o htab.o iommu.o misc.o irq.o
6obj-$(CONFIG_PCI) += pci.o
7obj-$(CONFIG_SMP) += smp.o
8obj-$(CONFIG_VIOPATH) += viopath.o vio.o
9obj-$(CONFIG_MODULES) += ksyms.o
diff --git a/arch/powerpc/platforms/iseries/call_hpt.h b/arch/powerpc/platforms/iseries/call_hpt.h
deleted file mode 100644
index 8d95fe4b554..00000000000
--- a/arch/powerpc/platforms/iseries/call_hpt.h
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _PLATFORMS_ISERIES_CALL_HPT_H
19#define _PLATFORMS_ISERIES_CALL_HPT_H
20
21/*
22 * This file contains the "hypervisor call" interface which is used to
23 * drive the hypervisor from the OS.
24 */
25
26#include <asm/iseries/hv_call_sc.h>
27#include <asm/iseries/hv_types.h>
28#include <asm/mmu.h>
29
30#define HvCallHptGetHptAddress HvCallHpt + 0
31#define HvCallHptGetHptPages HvCallHpt + 1
32#define HvCallHptSetPp HvCallHpt + 5
33#define HvCallHptSetSwBits HvCallHpt + 6
34#define HvCallHptUpdate HvCallHpt + 7
35#define HvCallHptInvalidateNoSyncICache HvCallHpt + 8
36#define HvCallHptGet HvCallHpt + 11
37#define HvCallHptFindNextValid HvCallHpt + 12
38#define HvCallHptFindValid HvCallHpt + 13
39#define HvCallHptAddValidate HvCallHpt + 16
40#define HvCallHptInvalidateSetSwBitsGet HvCallHpt + 18
41
42
43static inline u64 HvCallHpt_getHptAddress(void)
44{
45 return HvCall0(HvCallHptGetHptAddress);
46}
47
48static inline u64 HvCallHpt_getHptPages(void)
49{
50 return HvCall0(HvCallHptGetHptPages);
51}
52
53static inline void HvCallHpt_setPp(u32 hpteIndex, u8 value)
54{
55 HvCall2(HvCallHptSetPp, hpteIndex, value);
56}
57
58static inline void HvCallHpt_setSwBits(u32 hpteIndex, u8 bitson, u8 bitsoff)
59{
60 HvCall3(HvCallHptSetSwBits, hpteIndex, bitson, bitsoff);
61}
62
63static inline void HvCallHpt_invalidateNoSyncICache(u32 hpteIndex)
64{
65 HvCall1(HvCallHptInvalidateNoSyncICache, hpteIndex);
66}
67
68static inline u64 HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson,
69 u8 bitsoff)
70{
71 u64 compressedStatus;
72
73 compressedStatus = HvCall4(HvCallHptInvalidateSetSwBitsGet,
74 hpteIndex, bitson, bitsoff, 1);
75 HvCall1(HvCallHptInvalidateNoSyncICache, hpteIndex);
76 return compressedStatus;
77}
78
79static inline u64 HvCallHpt_findValid(struct hash_pte *hpte, u64 vpn)
80{
81 return HvCall3Ret16(HvCallHptFindValid, hpte, vpn, 0, 0);
82}
83
84static inline u64 HvCallHpt_findNextValid(struct hash_pte *hpte, u32 hpteIndex,
85 u8 bitson, u8 bitsoff)
86{
87 return HvCall3Ret16(HvCallHptFindNextValid, hpte, hpteIndex,
88 bitson, bitsoff);
89}
90
91static inline void HvCallHpt_get(struct hash_pte *hpte, u32 hpteIndex)
92{
93 HvCall2Ret16(HvCallHptGet, hpte, hpteIndex, 0);
94}
95
96static inline void HvCallHpt_addValidate(u32 hpteIndex, u32 hBit,
97 struct hash_pte *hpte)
98{
99 HvCall4(HvCallHptAddValidate, hpteIndex, hBit, hpte->v, hpte->r);
100}
101
102#endif /* _PLATFORMS_ISERIES_CALL_HPT_H */
diff --git a/arch/powerpc/platforms/iseries/call_pci.h b/arch/powerpc/platforms/iseries/call_pci.h
deleted file mode 100644
index dbdf69850ed..00000000000
--- a/arch/powerpc/platforms/iseries/call_pci.h
+++ /dev/null
@@ -1,309 +0,0 @@
1/*
2 * Provides the Hypervisor PCI calls for iSeries Linux Parition.
3 * Copyright (C) 2001 <Wayne G Holm> <IBM Corporation>
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 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the:
17 * Free Software Foundation, Inc.,
18 * 59 Temple Place, Suite 330,
19 * Boston, MA 02111-1307 USA
20 *
21 * Change Activity:
22 * Created, Jan 9, 2001
23 */
24
25#ifndef _PLATFORMS_ISERIES_CALL_PCI_H
26#define _PLATFORMS_ISERIES_CALL_PCI_H
27
28#include <asm/iseries/hv_call_sc.h>
29#include <asm/iseries/hv_types.h>
30
31/*
32 * DSA == Direct Select Address
33 * this struct must be 64 bits in total
34 */
35struct HvCallPci_DsaAddr {
36 u16 busNumber; /* PHB index? */
37 u8 subBusNumber; /* PCI bus number? */
38 u8 deviceId; /* device and function? */
39 u8 barNumber;
40 u8 reserved[3];
41};
42
43union HvDsaMap {
44 u64 DsaAddr;
45 struct HvCallPci_DsaAddr Dsa;
46};
47
48struct HvCallPci_LoadReturn {
49 u64 rc;
50 u64 value;
51};
52
53enum HvCallPci_DeviceType {
54 HvCallPci_NodeDevice = 1,
55 HvCallPci_SpDevice = 2,
56 HvCallPci_IopDevice = 3,
57 HvCallPci_BridgeDevice = 4,
58 HvCallPci_MultiFunctionDevice = 5,
59 HvCallPci_IoaDevice = 6
60};
61
62
63struct HvCallPci_DeviceInfo {
64 u32 deviceType; /* See DeviceType enum for values */
65};
66
67struct HvCallPci_BusUnitInfo {
68 u32 sizeReturned; /* length of data returned */
69 u32 deviceType; /* see DeviceType enum for values */
70};
71
72struct HvCallPci_BridgeInfo {
73 struct HvCallPci_BusUnitInfo busUnitInfo; /* Generic bus unit info */
74 u8 subBusNumber; /* Bus number of secondary bus */
75 u8 maxAgents; /* Max idsels on secondary bus */
76 u8 maxSubBusNumber; /* Max Sub Bus */
77 u8 logicalSlotNumber; /* Logical Slot Number for IOA */
78};
79
80
81/*
82 * Maximum BusUnitInfo buffer size. Provided for clients so
83 * they can allocate a buffer big enough for any type of bus
84 * unit. Increase as needed.
85 */
86enum {HvCallPci_MaxBusUnitInfoSize = 128};
87
88struct HvCallPci_BarParms {
89 u64 vaddr;
90 u64 raddr;
91 u64 size;
92 u64 protectStart;
93 u64 protectEnd;
94 u64 relocationOffset;
95 u64 pciAddress;
96 u64 reserved[3];
97};
98
99enum HvCallPci_VpdType {
100 HvCallPci_BusVpd = 1,
101 HvCallPci_BusAdapterVpd = 2
102};
103
104#define HvCallPciConfigLoad8 HvCallPci + 0
105#define HvCallPciConfigLoad16 HvCallPci + 1
106#define HvCallPciConfigLoad32 HvCallPci + 2
107#define HvCallPciConfigStore8 HvCallPci + 3
108#define HvCallPciConfigStore16 HvCallPci + 4
109#define HvCallPciConfigStore32 HvCallPci + 5
110#define HvCallPciEoi HvCallPci + 16
111#define HvCallPciGetBarParms HvCallPci + 18
112#define HvCallPciMaskFisr HvCallPci + 20
113#define HvCallPciUnmaskFisr HvCallPci + 21
114#define HvCallPciSetSlotReset HvCallPci + 25
115#define HvCallPciGetDeviceInfo HvCallPci + 27
116#define HvCallPciGetCardVpd HvCallPci + 28
117#define HvCallPciBarLoad8 HvCallPci + 40
118#define HvCallPciBarLoad16 HvCallPci + 41
119#define HvCallPciBarLoad32 HvCallPci + 42
120#define HvCallPciBarLoad64 HvCallPci + 43
121#define HvCallPciBarStore8 HvCallPci + 44
122#define HvCallPciBarStore16 HvCallPci + 45
123#define HvCallPciBarStore32 HvCallPci + 46
124#define HvCallPciBarStore64 HvCallPci + 47
125#define HvCallPciMaskInterrupts HvCallPci + 48
126#define HvCallPciUnmaskInterrupts HvCallPci + 49
127#define HvCallPciGetBusUnitInfo HvCallPci + 50
128
129static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
130 u8 deviceId, u32 offset, u16 *value)
131{
132 struct HvCallPci_DsaAddr dsa;
133 struct HvCallPci_LoadReturn retVal;
134
135 *((u64*)&dsa) = 0;
136
137 dsa.busNumber = busNumber;
138 dsa.subBusNumber = subBusNumber;
139 dsa.deviceId = deviceId;
140
141 HvCall3Ret16(HvCallPciConfigLoad16, &retVal, *(u64 *)&dsa, offset, 0);
142
143 *value = retVal.value;
144
145 return retVal.rc;
146}
147
148static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber,
149 u8 deviceId, u32 offset, u32 *value)
150{
151 struct HvCallPci_DsaAddr dsa;
152 struct HvCallPci_LoadReturn retVal;
153
154 *((u64*)&dsa) = 0;
155
156 dsa.busNumber = busNumber;
157 dsa.subBusNumber = subBusNumber;
158 dsa.deviceId = deviceId;
159
160 HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0);
161
162 *value = retVal.value;
163
164 return retVal.rc;
165}
166
167static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
168 u8 deviceId, u32 offset, u8 value)
169{
170 struct HvCallPci_DsaAddr dsa;
171
172 *((u64*)&dsa) = 0;
173
174 dsa.busNumber = busNumber;
175 dsa.subBusNumber = subBusNumber;
176 dsa.deviceId = deviceId;
177
178 return HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0);
179}
180
181static inline u64 HvCallPci_eoi(u16 busNumberParm, u8 subBusParm,
182 u8 deviceIdParm)
183{
184 struct HvCallPci_DsaAddr dsa;
185 struct HvCallPci_LoadReturn retVal;
186
187 *((u64*)&dsa) = 0;
188
189 dsa.busNumber = busNumberParm;
190 dsa.subBusNumber = subBusParm;
191 dsa.deviceId = deviceIdParm;
192
193 HvCall1Ret16(HvCallPciEoi, &retVal, *(u64*)&dsa);
194
195 return retVal.rc;
196}
197
198static inline u64 HvCallPci_getBarParms(u16 busNumberParm, u8 subBusParm,
199 u8 deviceIdParm, u8 barNumberParm, u64 parms, u32 sizeofParms)
200{
201 struct HvCallPci_DsaAddr dsa;
202
203 *((u64*)&dsa) = 0;
204
205 dsa.busNumber = busNumberParm;
206 dsa.subBusNumber = subBusParm;
207 dsa.deviceId = deviceIdParm;
208 dsa.barNumber = barNumberParm;
209
210 return HvCall3(HvCallPciGetBarParms, *(u64*)&dsa, parms, sizeofParms);
211}
212
213static inline u64 HvCallPci_maskFisr(u16 busNumberParm, u8 subBusParm,
214 u8 deviceIdParm, u64 fisrMask)
215{
216 struct HvCallPci_DsaAddr dsa;
217
218 *((u64*)&dsa) = 0;
219
220 dsa.busNumber = busNumberParm;
221 dsa.subBusNumber = subBusParm;
222 dsa.deviceId = deviceIdParm;
223
224 return HvCall2(HvCallPciMaskFisr, *(u64*)&dsa, fisrMask);
225}
226
227static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, u8 subBusParm,
228 u8 deviceIdParm, u64 fisrMask)
229{
230 struct HvCallPci_DsaAddr dsa;
231
232 *((u64*)&dsa) = 0;
233
234 dsa.busNumber = busNumberParm;
235 dsa.subBusNumber = subBusParm;
236 dsa.deviceId = deviceIdParm;
237
238 return HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask);
239}
240
241static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, u8 subBusParm,
242 u8 deviceNumberParm, u64 parms, u32 sizeofParms)
243{
244 struct HvCallPci_DsaAddr dsa;
245
246 *((u64*)&dsa) = 0;
247
248 dsa.busNumber = busNumberParm;
249 dsa.subBusNumber = subBusParm;
250 dsa.deviceId = deviceNumberParm << 4;
251
252 return HvCall3(HvCallPciGetDeviceInfo, *(u64*)&dsa, parms, sizeofParms);
253}
254
255static inline u64 HvCallPci_maskInterrupts(u16 busNumberParm, u8 subBusParm,
256 u8 deviceIdParm, u64 interruptMask)
257{
258 struct HvCallPci_DsaAddr dsa;
259
260 *((u64*)&dsa) = 0;
261
262 dsa.busNumber = busNumberParm;
263 dsa.subBusNumber = subBusParm;
264 dsa.deviceId = deviceIdParm;
265
266 return HvCall2(HvCallPciMaskInterrupts, *(u64*)&dsa, interruptMask);
267}
268
269static inline u64 HvCallPci_unmaskInterrupts(u16 busNumberParm, u8 subBusParm,
270 u8 deviceIdParm, u64 interruptMask)
271{
272 struct HvCallPci_DsaAddr dsa;
273
274 *((u64*)&dsa) = 0;
275
276 dsa.busNumber = busNumberParm;
277 dsa.subBusNumber = subBusParm;
278 dsa.deviceId = deviceIdParm;
279
280 return HvCall2(HvCallPciUnmaskInterrupts, *(u64*)&dsa, interruptMask);
281}
282
283static inline u64 HvCallPci_getBusUnitInfo(u16 busNumberParm, u8 subBusParm,
284 u8 deviceIdParm, u64 parms, u32 sizeofParms)
285{
286 struct HvCallPci_DsaAddr dsa;
287
288 *((u64*)&dsa) = 0;
289
290 dsa.busNumber = busNumberParm;
291 dsa.subBusNumber = subBusParm;
292 dsa.deviceId = deviceIdParm;
293
294 return HvCall3(HvCallPciGetBusUnitInfo, *(u64*)&dsa, parms,
295 sizeofParms);
296}
297
298static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm,
299 u16 sizeParm)
300{
301 u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm,
302 sizeParm, HvCallPci_BusVpd);
303 if (xRc == -1)
304 return -1;
305 else
306 return xRc & 0xFFFF;
307}
308
309#endif /* _PLATFORMS_ISERIES_CALL_PCI_H */
diff --git a/arch/powerpc/platforms/iseries/call_sm.h b/arch/powerpc/platforms/iseries/call_sm.h
deleted file mode 100644
index c7e251619f4..00000000000
--- a/arch/powerpc/platforms/iseries/call_sm.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ISERIES_CALL_SM_H
19#define _ISERIES_CALL_SM_H
20
21/*
22 * This file contains the "hypervisor call" interface which is used to
23 * drive the hypervisor from the OS.
24 */
25
26#include <asm/iseries/hv_call_sc.h>
27#include <asm/iseries/hv_types.h>
28
29#define HvCallSmGet64BitsOfAccessMap HvCallSm + 11
30
31static inline u64 HvCallSm_get64BitsOfAccessMap(HvLpIndex lpIndex,
32 u64 indexIntoBitMap)
33{
34 return HvCall2(HvCallSmGet64BitsOfAccessMap, lpIndex, indexIntoBitMap);
35}
36
37#endif /* _ISERIES_CALL_SM_H */
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c
deleted file mode 100644
index f0491cc2890..00000000000
--- a/arch/powerpc/platforms/iseries/dt.c
+++ /dev/null
@@ -1,643 +0,0 @@
1/*
2 * Copyright (C) 2005-2006 Michael Ellerman, IBM Corporation
3 * Copyright (C) 2000-2004, IBM Corporation
4 *
5 * Description:
6 * This file contains all the routines to build a flattened device
7 * tree for a legacy iSeries machine.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#undef DEBUG
16
17#include <linux/types.h>
18#include <linux/init.h>
19#include <linux/pci.h>
20#include <linux/pci_regs.h>
21#include <linux/pci_ids.h>
22#include <linux/threads.h>
23#include <linux/bitops.h>
24#include <linux/string.h>
25#include <linux/kernel.h>
26#include <linux/if_ether.h> /* ETH_ALEN */
27
28#include <asm/machdep.h>
29#include <asm/prom.h>
30#include <asm/lppaca.h>
31#include <asm/cputable.h>
32#include <asm/abs_addr.h>
33#include <asm/system.h>
34#include <asm/iseries/hv_types.h>
35#include <asm/iseries/hv_lp_config.h>
36#include <asm/iseries/hv_call_xm.h>
37#include <asm/udbg.h>
38
39#include "processor_vpd.h"
40#include "call_hpt.h"
41#include "call_pci.h"
42#include "pci.h"
43#include "it_exp_vpd_panel.h"
44#include "naca.h"
45
46#ifdef DEBUG
47#define DBG(fmt...) udbg_printf(fmt)
48#else
49#define DBG(fmt...)
50#endif
51
52/*
53 * These are created by the linker script at the start and end
54 * of the section containing all the strings marked with the DS macro.
55 */
56extern char __dt_strings_start[];
57extern char __dt_strings_end[];
58
59#define DS(s) ({ \
60 static const char __s[] __attribute__((section(".dt_strings"))) = s; \
61 __s; \
62})
63
64struct iseries_flat_dt {
65 struct boot_param_header header;
66 u64 reserve_map[2];
67};
68
69static void * __initdata dt_data;
70
71/*
72 * Putting these strings here keeps them out of the .dt_strings section
73 * that we capture for the strings blob of the flattened device tree.
74 */
75static char __initdata device_type_cpu[] = "cpu";
76static char __initdata device_type_memory[] = "memory";
77static char __initdata device_type_serial[] = "serial";
78static char __initdata device_type_network[] = "network";
79static char __initdata device_type_pci[] = "pci";
80static char __initdata device_type_vdevice[] = "vdevice";
81static char __initdata device_type_vscsi[] = "vscsi";
82
83
84/* EBCDIC to ASCII conversion routines */
85
86static unsigned char __init e2a(unsigned char x)
87{
88 switch (x) {
89 case 0x81 ... 0x89:
90 return x - 0x81 + 'a';
91 case 0x91 ... 0x99:
92 return x - 0x91 + 'j';
93 case 0xA2 ... 0xA9:
94 return x - 0xA2 + 's';
95 case 0xC1 ... 0xC9:
96 return x - 0xC1 + 'A';
97 case 0xD1 ... 0xD9:
98 return x - 0xD1 + 'J';
99 case 0xE2 ... 0xE9:
100 return x - 0xE2 + 'S';
101 case 0xF0 ... 0xF9:
102 return x - 0xF0 + '0';
103 }
104 return ' ';
105}
106
107static unsigned char * __init strne2a(unsigned char *dest,
108 const unsigned char *src, size_t n)
109{
110 int i;
111
112 n = strnlen(src, n);
113
114 for (i = 0; i < n; i++)
115 dest[i] = e2a(src[i]);
116
117 return dest;
118}
119
120static struct iseries_flat_dt * __init dt_init(void)
121{
122 struct iseries_flat_dt *dt;
123 unsigned long str_len;
124
125 str_len = __dt_strings_end - __dt_strings_start;
126 dt = (struct iseries_flat_dt *)ALIGN(klimit, 8);
127 dt->header.off_mem_rsvmap =
128 offsetof(struct iseries_flat_dt, reserve_map);
129 dt->header.off_dt_strings = ALIGN(sizeof(*dt), 8);
130 dt->header.off_dt_struct = dt->header.off_dt_strings
131 + ALIGN(str_len, 8);
132 dt_data = (void *)((unsigned long)dt + dt->header.off_dt_struct);
133 dt->header.dt_strings_size = str_len;
134
135 /* There is no notion of hardware cpu id on iSeries */
136 dt->header.boot_cpuid_phys = smp_processor_id();
137
138 memcpy((char *)dt + dt->header.off_dt_strings, __dt_strings_start,
139 str_len);
140
141 dt->header.magic = OF_DT_HEADER;
142 dt->header.version = 0x10;
143 dt->header.last_comp_version = 0x10;
144
145 dt->reserve_map[0] = 0;
146 dt->reserve_map[1] = 0;
147
148 return dt;
149}
150
151static void __init dt_push_u32(struct iseries_flat_dt *dt, u32 value)
152{
153 *((u32 *)dt_data) = value;
154 dt_data += sizeof(u32);
155}
156
157#ifdef notyet
158static void __init dt_push_u64(struct iseries_flat_dt *dt, u64 value)
159{
160 *((u64 *)dt_data) = value;
161 dt_data += sizeof(u64);
162}
163#endif
164
165static void __init dt_push_bytes(struct iseries_flat_dt *dt, const char *data,
166 int len)
167{
168 memcpy(dt_data, data, len);
169 dt_data += ALIGN(len, 4);
170}
171
172static void __init dt_start_node(struct iseries_flat_dt *dt, const char *name)
173{
174 dt_push_u32(dt, OF_DT_BEGIN_NODE);
175 dt_push_bytes(dt, name, strlen(name) + 1);
176}
177
178#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE)
179
180static void __init __dt_prop(struct iseries_flat_dt *dt, const char *name,
181 const void *data, int len)
182{
183 unsigned long offset;
184
185 dt_push_u32(dt, OF_DT_PROP);
186
187 /* Length of the data */
188 dt_push_u32(dt, len);
189
190 offset = name - __dt_strings_start;
191
192 /* The offset of the properties name in the string blob. */
193 dt_push_u32(dt, (u32)offset);
194
195 /* The actual data. */
196 dt_push_bytes(dt, data, len);
197}
198#define dt_prop(dt, name, data, len) __dt_prop((dt), DS(name), (data), (len))
199
200#define dt_prop_str(dt, name, data) \
201 dt_prop((dt), name, (data), strlen((data)) + 1); /* + 1 for NULL */
202
203static void __init __dt_prop_u32(struct iseries_flat_dt *dt, const char *name,
204 u32 data)
205{
206 __dt_prop(dt, name, &data, sizeof(u32));
207}
208#define dt_prop_u32(dt, name, data) __dt_prop_u32((dt), DS(name), (data))
209
210static void __init __maybe_unused __dt_prop_u64(struct iseries_flat_dt *dt,
211 const char *name, u64 data)
212{
213 __dt_prop(dt, name, &data, sizeof(u64));
214}
215#define dt_prop_u64(dt, name, data) __dt_prop_u64((dt), DS(name), (data))
216
217#define dt_prop_u64_list(dt, name, data, n) \
218 dt_prop((dt), name, (data), sizeof(u64) * (n))
219
220#define dt_prop_u32_list(dt, name, data, n) \
221 dt_prop((dt), name, (data), sizeof(u32) * (n))
222
223#define dt_prop_empty(dt, name) dt_prop((dt), name, NULL, 0)
224
225static void __init dt_cpus(struct iseries_flat_dt *dt)
226{
227 unsigned char buf[32];
228 unsigned char *p;
229 unsigned int i, index;
230 struct IoHriProcessorVpd *d;
231 u32 pft_size[2];
232
233 /* yuck */
234 snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name);
235 p = strchr(buf, ' ');
236 if (!p) p = buf + strlen(buf);
237
238 dt_start_node(dt, "cpus");
239 dt_prop_u32(dt, "#address-cells", 1);
240 dt_prop_u32(dt, "#size-cells", 0);
241
242 pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA */
243 pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE);
244
245 for (i = 0; i < NR_LPPACAS; i++) {
246 if (lppaca[i].dyn_proc_status >= 2)
247 continue;
248
249 snprintf(p, 32 - (p - buf), "@%d", i);
250 dt_start_node(dt, buf);
251
252 dt_prop_str(dt, "device_type", device_type_cpu);
253
254 index = lppaca[i].dyn_hv_phys_proc_index;
255 d = &xIoHriProcessorVpd[index];
256
257 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024);
258 dt_prop_u32(dt, "i-cache-line-size", d->xInstCacheOperandSize);
259
260 dt_prop_u32(dt, "d-cache-size", d->xDataL1CacheSizeKB * 1024);
261 dt_prop_u32(dt, "d-cache-line-size", d->xDataCacheOperandSize);
262
263 /* magic conversions to Hz copied from old code */
264 dt_prop_u32(dt, "clock-frequency",
265 ((1UL << 34) * 1000000) / d->xProcFreq);
266 dt_prop_u32(dt, "timebase-frequency",
267 ((1UL << 32) * 1000000) / d->xTimeBaseFreq);
268
269 dt_prop_u32(dt, "reg", i);
270
271 dt_prop_u32_list(dt, "ibm,pft-size", pft_size, 2);
272
273 dt_end_node(dt);
274 }
275
276 dt_end_node(dt);
277}
278
279static void __init dt_model(struct iseries_flat_dt *dt)
280{
281 char buf[16] = "IBM,";
282
283 /* N.B. lparcfg.c knows about the "IBM," prefixes ... */
284 /* "IBM," + mfgId[2:3] + systemSerial[1:5] */
285 strne2a(buf + 4, xItExtVpdPanel.mfgID + 2, 2);
286 strne2a(buf + 6, xItExtVpdPanel.systemSerial + 1, 5);
287 buf[11] = '\0';
288 dt_prop_str(dt, "system-id", buf);
289
290 /* "IBM," + machineType[0:4] */
291 strne2a(buf + 4, xItExtVpdPanel.machineType, 4);
292 buf[8] = '\0';
293 dt_prop_str(dt, "model", buf);
294
295 dt_prop_str(dt, "compatible", "IBM,iSeries");
296 dt_prop_u32(dt, "ibm,partition-no", HvLpConfig_getLpIndex());
297}
298
299static void __init dt_initrd(struct iseries_flat_dt *dt)
300{
301#ifdef CONFIG_BLK_DEV_INITRD
302 if (naca.xRamDisk) {
303 dt_prop_u64(dt, "linux,initrd-start", (u64)naca.xRamDisk);
304 dt_prop_u64(dt, "linux,initrd-end",
305 (u64)naca.xRamDisk + naca.xRamDiskSize * HW_PAGE_SIZE);
306 }
307#endif
308}
309
310static void __init dt_do_vdevice(struct iseries_flat_dt *dt,
311 const char *name, u32 reg, int unit,
312 const char *type, const char *compat, int end)
313{
314 char buf[32];
315
316 snprintf(buf, 32, "%s@%08x", name, reg + ((unit >= 0) ? unit : 0));
317 dt_start_node(dt, buf);
318 dt_prop_str(dt, "device_type", type);
319 if (compat)
320 dt_prop_str(dt, "compatible", compat);
321 dt_prop_u32(dt, "reg", reg + ((unit >= 0) ? unit : 0));
322 if (unit >= 0)
323 dt_prop_u32(dt, "linux,unit_address", unit);
324 if (end)
325 dt_end_node(dt);
326}
327
328static void __init dt_vdevices(struct iseries_flat_dt *dt)
329{
330 u32 reg = 0;
331 HvLpIndexMap vlan_map;
332 int i;
333
334 dt_start_node(dt, "vdevice");
335 dt_prop_str(dt, "device_type", device_type_vdevice);
336 dt_prop_str(dt, "compatible", "IBM,iSeries-vdevice");
337 dt_prop_u32(dt, "#address-cells", 1);
338 dt_prop_u32(dt, "#size-cells", 0);
339
340 dt_do_vdevice(dt, "vty", reg, -1, device_type_serial,
341 "IBM,iSeries-vty", 1);
342 reg++;
343
344 dt_do_vdevice(dt, "v-scsi", reg, -1, device_type_vscsi,
345 "IBM,v-scsi", 1);
346 reg++;
347
348 vlan_map = HvLpConfig_getVirtualLanIndexMap();
349 for (i = 0; i < HVMAXARCHITECTEDVIRTUALLANS; i++) {
350 unsigned char mac_addr[ETH_ALEN];
351
352 if ((vlan_map & (0x8000 >> i)) == 0)
353 continue;
354 dt_do_vdevice(dt, "l-lan", reg, i, device_type_network,
355 "IBM,iSeries-l-lan", 0);
356 mac_addr[0] = 0x02;
357 mac_addr[1] = 0x01;
358 mac_addr[2] = 0xff;
359 mac_addr[3] = i;
360 mac_addr[4] = 0xff;
361 mac_addr[5] = HvLpConfig_getLpIndex_outline();
362 dt_prop(dt, "local-mac-address", (char *)mac_addr, ETH_ALEN);
363 dt_prop(dt, "mac-address", (char *)mac_addr, ETH_ALEN);
364 dt_prop_u32(dt, "max-frame-size", 9000);
365 dt_prop_u32(dt, "address-bits", 48);
366
367 dt_end_node(dt);
368 }
369
370 dt_end_node(dt);
371}
372
373struct pci_class_name {
374 u16 code;
375 const char *name;
376 const char *type;
377};
378
379static struct pci_class_name __initdata pci_class_name[] = {
380 { PCI_CLASS_NETWORK_ETHERNET, "ethernet", device_type_network },
381};
382
383static struct pci_class_name * __init dt_find_pci_class_name(u16 class_code)
384{
385 struct pci_class_name *cp;
386
387 for (cp = pci_class_name;
388 cp < &pci_class_name[ARRAY_SIZE(pci_class_name)]; cp++)
389 if (cp->code == class_code)
390 return cp;
391 return NULL;
392}
393
394/*
395 * This assumes that the node slot is always on the primary bus!
396 */
397static void __init scan_bridge_slot(struct iseries_flat_dt *dt,
398 HvBusNumber bus, struct HvCallPci_BridgeInfo *bridge_info)
399{
400 HvSubBusNumber sub_bus = bridge_info->subBusNumber;
401 u16 vendor_id;
402 u16 device_id;
403 u32 class_id;
404 int err;
405 char buf[32];
406 u32 reg[5];
407 int id_sel = ISERIES_GET_DEVICE_FROM_SUBBUS(sub_bus);
408 int function = ISERIES_GET_FUNCTION_FROM_SUBBUS(sub_bus);
409 HvAgentId eads_id_sel = ISERIES_PCI_AGENTID(id_sel, function);
410 u8 devfn;
411 struct pci_class_name *cp;
412
413 /*
414 * Connect all functions of any device found.
415 */
416 for (id_sel = 1; id_sel <= bridge_info->maxAgents; id_sel++) {
417 for (function = 0; function < 8; function++) {
418 HvAgentId agent_id = ISERIES_PCI_AGENTID(id_sel,
419 function);
420 err = HvCallXm_connectBusUnit(bus, sub_bus,
421 agent_id, 0);
422 if (err) {
423 if (err != 0x302)
424 DBG("connectBusUnit(%x, %x, %x) %x\n",
425 bus, sub_bus, agent_id, err);
426 continue;
427 }
428
429 err = HvCallPci_configLoad16(bus, sub_bus, agent_id,
430 PCI_VENDOR_ID, &vendor_id);
431 if (err) {
432 DBG("ReadVendor(%x, %x, %x) %x\n",
433 bus, sub_bus, agent_id, err);
434 continue;
435 }
436 err = HvCallPci_configLoad16(bus, sub_bus, agent_id,
437 PCI_DEVICE_ID, &device_id);
438 if (err) {
439 DBG("ReadDevice(%x, %x, %x) %x\n",
440 bus, sub_bus, agent_id, err);
441 continue;
442 }
443 err = HvCallPci_configLoad32(bus, sub_bus, agent_id,
444 PCI_CLASS_REVISION , &class_id);
445 if (err) {
446 DBG("ReadClass(%x, %x, %x) %x\n",
447 bus, sub_bus, agent_id, err);
448 continue;
449 }
450
451 devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(eads_id_sel),
452 function);
453 cp = dt_find_pci_class_name(class_id >> 16);
454 if (cp && cp->name)
455 strncpy(buf, cp->name, sizeof(buf) - 1);
456 else
457 snprintf(buf, sizeof(buf), "pci%x,%x",
458 vendor_id, device_id);
459 buf[sizeof(buf) - 1] = '\0';
460 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
461 "@%x", PCI_SLOT(devfn));
462 buf[sizeof(buf) - 1] = '\0';
463 if (function != 0)
464 snprintf(buf + strlen(buf),
465 sizeof(buf) - strlen(buf),
466 ",%x", function);
467 dt_start_node(dt, buf);
468 reg[0] = (bus << 16) | (devfn << 8);
469 reg[1] = 0;
470 reg[2] = 0;
471 reg[3] = 0;
472 reg[4] = 0;
473 dt_prop_u32_list(dt, "reg", reg, 5);
474 if (cp && (cp->type || cp->name))
475 dt_prop_str(dt, "device_type",
476 cp->type ? cp->type : cp->name);
477 dt_prop_u32(dt, "vendor-id", vendor_id);
478 dt_prop_u32(dt, "device-id", device_id);
479 dt_prop_u32(dt, "class-code", class_id >> 8);
480 dt_prop_u32(dt, "revision-id", class_id & 0xff);
481 dt_prop_u32(dt, "linux,subbus", sub_bus);
482 dt_prop_u32(dt, "linux,agent-id", agent_id);
483 dt_prop_u32(dt, "linux,logical-slot-number",
484 bridge_info->logicalSlotNumber);
485 dt_end_node(dt);
486
487 }
488 }
489}
490
491static void __init scan_bridge(struct iseries_flat_dt *dt, HvBusNumber bus,
492 HvSubBusNumber sub_bus, int id_sel)
493{
494 struct HvCallPci_BridgeInfo bridge_info;
495 HvAgentId agent_id;
496 int function;
497 int ret;
498
499 /* Note: hvSubBus and irq is always be 0 at this level! */
500 for (function = 0; function < 8; ++function) {
501 agent_id = ISERIES_PCI_AGENTID(id_sel, function);
502 ret = HvCallXm_connectBusUnit(bus, sub_bus, agent_id, 0);
503 if (ret != 0) {
504 if (ret != 0xb)
505 DBG("connectBusUnit(%x, %x, %x) %x\n",
506 bus, sub_bus, agent_id, ret);
507 continue;
508 }
509 DBG("found device at bus %d idsel %d func %d (AgentId %x)\n",
510 bus, id_sel, function, agent_id);
511 ret = HvCallPci_getBusUnitInfo(bus, sub_bus, agent_id,
512 iseries_hv_addr(&bridge_info),
513 sizeof(struct HvCallPci_BridgeInfo));
514 if (ret != 0)
515 continue;
516 DBG("bridge info: type %x subbus %x "
517 "maxAgents %x maxsubbus %x logslot %x\n",
518 bridge_info.busUnitInfo.deviceType,
519 bridge_info.subBusNumber,
520 bridge_info.maxAgents,
521 bridge_info.maxSubBusNumber,
522 bridge_info.logicalSlotNumber);
523 if (bridge_info.busUnitInfo.deviceType ==
524 HvCallPci_BridgeDevice)
525 scan_bridge_slot(dt, bus, &bridge_info);
526 else
527 DBG("PCI: Invalid Bridge Configuration(0x%02X)",
528 bridge_info.busUnitInfo.deviceType);
529 }
530}
531
532static void __init scan_phb(struct iseries_flat_dt *dt, HvBusNumber bus)
533{
534 struct HvCallPci_DeviceInfo dev_info;
535 const HvSubBusNumber sub_bus = 0; /* EADs is always 0. */
536 int err;
537 int id_sel;
538 const int max_agents = 8;
539
540 /*
541 * Probe for EADs Bridges
542 */
543 for (id_sel = 1; id_sel < max_agents; ++id_sel) {
544 err = HvCallPci_getDeviceInfo(bus, sub_bus, id_sel,
545 iseries_hv_addr(&dev_info),
546 sizeof(struct HvCallPci_DeviceInfo));
547 if (err) {
548 if (err != 0x302)
549 DBG("getDeviceInfo(%x, %x, %x) %x\n",
550 bus, sub_bus, id_sel, err);
551 continue;
552 }
553 if (dev_info.deviceType != HvCallPci_NodeDevice) {
554 DBG("PCI: Invalid System Configuration"
555 "(0x%02X) for bus 0x%02x id 0x%02x.\n",
556 dev_info.deviceType, bus, id_sel);
557 continue;
558 }
559 scan_bridge(dt, bus, sub_bus, id_sel);
560 }
561}
562
563static void __init dt_pci_devices(struct iseries_flat_dt *dt)
564{
565 HvBusNumber bus;
566 char buf[32];
567 u32 buses[2];
568 int phb_num = 0;
569
570 /* Check all possible buses. */
571 for (bus = 0; bus < 256; bus++) {
572 int err = HvCallXm_testBus(bus);
573
574 if (err) {
575 /*
576 * Check for Unexpected Return code, a clue that
577 * something has gone wrong.
578 */
579 if (err != 0x0301)
580 DBG("Unexpected Return on Probe(0x%02X) "
581 "0x%04X\n", bus, err);
582 continue;
583 }
584 DBG("bus %d appears to exist\n", bus);
585 snprintf(buf, 32, "pci@%d", phb_num);
586 dt_start_node(dt, buf);
587 dt_prop_str(dt, "device_type", device_type_pci);
588 dt_prop_str(dt, "compatible", "IBM,iSeries-Logical-PHB");
589 dt_prop_u32(dt, "#address-cells", 3);
590 dt_prop_u32(dt, "#size-cells", 2);
591 buses[0] = buses[1] = bus;
592 dt_prop_u32_list(dt, "bus-range", buses, 2);
593 scan_phb(dt, bus);
594 dt_end_node(dt);
595 phb_num++;
596 }
597}
598
599static void dt_finish(struct iseries_flat_dt *dt)
600{
601 dt_push_u32(dt, OF_DT_END);
602 dt->header.totalsize = (unsigned long)dt_data - (unsigned long)dt;
603 klimit = ALIGN((unsigned long)dt_data, 8);
604}
605
606void * __init build_flat_dt(unsigned long phys_mem_size)
607{
608 struct iseries_flat_dt *iseries_dt;
609 u64 tmp[2];
610
611 iseries_dt = dt_init();
612
613 dt_start_node(iseries_dt, "");
614
615 dt_prop_u32(iseries_dt, "#address-cells", 2);
616 dt_prop_u32(iseries_dt, "#size-cells", 2);
617 dt_model(iseries_dt);
618
619 /* /memory */
620 dt_start_node(iseries_dt, "memory@0");
621 dt_prop_str(iseries_dt, "device_type", device_type_memory);
622 tmp[0] = 0;
623 tmp[1] = phys_mem_size;
624 dt_prop_u64_list(iseries_dt, "reg", tmp, 2);
625 dt_end_node(iseries_dt);
626
627 /* /chosen */
628 dt_start_node(iseries_dt, "chosen");
629 dt_prop_str(iseries_dt, "bootargs", cmd_line);
630 dt_initrd(iseries_dt);
631 dt_end_node(iseries_dt);
632
633 dt_cpus(iseries_dt);
634
635 dt_vdevices(iseries_dt);
636 dt_pci_devices(iseries_dt);
637
638 dt_end_node(iseries_dt);
639
640 dt_finish(iseries_dt);
641
642 return iseries_dt;
643}
diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
deleted file mode 100644
index f519ee17ff7..00000000000
--- a/arch/powerpc/platforms/iseries/exception.S
+++ /dev/null
@@ -1,311 +0,0 @@
1/*
2 * Low level routines for legacy iSeries support.
3 *
4 * Extracted from head_64.S
5 *
6 * PowerPC version
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 *
9 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
10 * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
11 * Adapted for Power Macintosh by Paul Mackerras.
12 * Low-level exception handlers and MMU support
13 * rewritten by Paul Mackerras.
14 * Copyright (C) 1996 Paul Mackerras.
15 *
16 * Adapted for 64bit PowerPC by Dave Engebretsen, Peter Bergner, and
17 * Mike Corrigan {engebret|bergner|mikejc}@us.ibm.com
18 *
19 * This file contains the low-level support and setup for the
20 * PowerPC-64 platform, including trap and interrupt dispatch.
21 *
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * as published by the Free Software Foundation; either version
25 * 2 of the License, or (at your option) any later version.
26 */
27
28#include <asm/reg.h>
29#include <asm/ppc_asm.h>
30#include <asm/asm-offsets.h>
31#include <asm/thread_info.h>
32#include <asm/ptrace.h>
33#include <asm/cputable.h>
34#include <asm/mmu.h>
35
36#include "exception.h"
37
38 .text
39
40 .globl system_reset_iSeries
41system_reset_iSeries:
42 bl .relative_toc
43 mfspr r13,SPRN_SPRG3 /* Get alpaca address */
44 LOAD_REG_ADDR(r23, alpaca)
45 li r0,ALPACA_SIZE
46 sub r23,r13,r23
47 divdu r24,r23,r0 /* r24 has cpu number */
48 cmpwi 0,r24,0 /* Are we processor 0? */
49 bne 1f
50 LOAD_REG_ADDR(r13, boot_paca)
51 mtspr SPRN_SPRG_PACA,r13 /* Save it away for the future */
52 mfmsr r23
53 ori r23,r23,MSR_RI
54 mtmsrd r23 /* RI on */
55 b .__start_initialization_iSeries /* Start up the first processor */
561: mfspr r4,SPRN_CTRLF
57 li r5,CTRL_RUNLATCH /* Turn off the run light */
58 andc r4,r4,r5
59 mtspr SPRN_CTRLT,r4
60
61/* Spin on __secondary_hold_spinloop until it is updated by the boot cpu. */
62/* In the UP case we'll yield() later, and we will not access the paca anyway */
63#ifdef CONFIG_SMP
64iSeries_secondary_wait_paca:
65 HMT_LOW
66 LOAD_REG_ADDR(r23, __secondary_hold_spinloop)
67 ld r23,0(r23)
68
69 cmpdi 0,r23,0
70 bne 2f /* go on when the master is ready */
71
72 /* Keep poking the Hypervisor until we're released */
73 /* 8002 is a call to HvCallCfg::getLps, a harmless Hypervisor function */
74 lis r3,0x8002
75 rldicr r3,r3,32,15 /* r0 = (r3 << 32) & 0xffff000000000000 */
76 li r0,-1 /* r0=-1 indicates a Hypervisor call */
77 sc /* Invoke the hypervisor via a system call */
78 b iSeries_secondary_wait_paca
79
802:
81 HMT_MEDIUM
82 sync
83
84 LOAD_REG_ADDR(r3, nr_cpu_ids) /* get number of pacas allocated */
85 lwz r3,0(r3) /* nr_cpus= or NR_CPUS can limit */
86 cmpld 0,r24,r3 /* is our cpu number allocated? */
87 bge iSeries_secondary_yield /* no, yield forever */
88
89 /* Load our paca now that it's been allocated */
90 LOAD_REG_ADDR(r13, paca)
91 ld r13,0(r13)
92 mulli r0,r24,PACA_SIZE
93 add r13,r13,r0
94 mtspr SPRN_SPRG_PACA,r13 /* Save it away for the future */
95 mfmsr r23
96 ori r23,r23,MSR_RI
97 mtmsrd r23 /* RI on */
98
99iSeries_secondary_smp_loop:
100 lbz r23,PACAPROCSTART(r13) /* Test if this processor
101 * should start */
102 cmpwi 0,r23,0
103 bne 3f /* go on when we are told */
104
105 HMT_LOW
106 /* Let the Hypervisor know we are alive */
107 /* 8002 is a call to HvCallCfg::getLps, a harmless Hypervisor function */
108 lis r3,0x8002
109 rldicr r3,r3,32,15 /* r0 = (r3 << 32) & 0xffff000000000000 */
110 li r0,-1 /* r0=-1 indicates a Hypervisor call */
111 sc /* Invoke the hypervisor via a system call */
112 mfspr r13,SPRN_SPRG_PACA /* Put r13 back ???? */
113 b iSeries_secondary_smp_loop /* wait for signal to start */
114
1153:
116 HMT_MEDIUM
117 sync
118 LOAD_REG_ADDR(r3,current_set)
119 sldi r28,r24,3 /* get current_set[cpu#] */
120 ldx r3,r3,r28
121 addi r1,r3,THREAD_SIZE
122 subi r1,r1,STACK_FRAME_OVERHEAD
123
124 b __secondary_start /* Loop until told to go */
125#endif /* CONFIG_SMP */
126
127iSeries_secondary_yield:
128 /* Yield the processor. This is required for non-SMP kernels
129 which are running on multi-threaded machines. */
130 HMT_LOW
131 lis r3,0x8000
132 rldicr r3,r3,32,15 /* r3 = (r3 << 32) & 0xffff000000000000 */
133 addi r3,r3,18 /* r3 = 0x8000000000000012 which is "yield" */
134 li r4,0 /* "yield timed" */
135 li r5,-1 /* "yield forever" */
136 li r0,-1 /* r0=-1 indicates a Hypervisor call */
137 sc /* Invoke the hypervisor via a system call */
138 mfspr r13,SPRN_SPRG_PACA /* Put r13 back ???? */
139 b iSeries_secondary_yield /* If SMP not configured, secondaries
140 * loop forever */
141
142/*** ISeries-LPAR interrupt handlers ***/
143
144 STD_EXCEPTION_ISERIES(machine_check, PACA_EXMC)
145
146 .globl data_access_iSeries
147data_access_iSeries:
148 mtspr SPRN_SPRG_SCRATCH0,r13
149BEGIN_FTR_SECTION
150 mfspr r13,SPRN_SPRG_PACA
151 std r9,PACA_EXSLB+EX_R9(r13)
152 std r10,PACA_EXSLB+EX_R10(r13)
153 mfspr r10,SPRN_DAR
154 mfspr r9,SPRN_DSISR
155 srdi r10,r10,60
156 rlwimi r10,r9,16,0x20
157 mfcr r9
158 cmpwi r10,0x2c
159 beq .do_stab_bolted_iSeries
160 ld r10,PACA_EXSLB+EX_R10(r13)
161 std r11,PACA_EXGEN+EX_R11(r13)
162 ld r11,PACA_EXSLB+EX_R9(r13)
163 std r12,PACA_EXGEN+EX_R12(r13)
164 mfspr r12,SPRN_SPRG_SCRATCH0
165 std r10,PACA_EXGEN+EX_R10(r13)
166 std r11,PACA_EXGEN+EX_R9(r13)
167 std r12,PACA_EXGEN+EX_R13(r13)
168 EXCEPTION_PROLOG_ISERIES_1
169FTR_SECTION_ELSE
170 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0)
171 EXCEPTION_PROLOG_ISERIES_1
172ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_SLB)
173 b data_access_common
174
175.do_stab_bolted_iSeries:
176 std r11,PACA_EXSLB+EX_R11(r13)
177 std r12,PACA_EXSLB+EX_R12(r13)
178 mfspr r10,SPRN_SPRG_SCRATCH0
179 std r10,PACA_EXSLB+EX_R13(r13)
180 EXCEPTION_PROLOG_ISERIES_1
181 b .do_stab_bolted
182
183 .globl data_access_slb_iSeries
184data_access_slb_iSeries:
185 mtspr SPRN_SPRG_SCRATCH0,r13 /* save r13 */
186 mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */
187 std r3,PACA_EXSLB+EX_R3(r13)
188 mfspr r3,SPRN_DAR
189 std r9,PACA_EXSLB+EX_R9(r13)
190 mfcr r9
191#ifdef __DISABLED__
192 cmpdi r3,0
193 bge slb_miss_user_iseries
194#endif
195 std r10,PACA_EXSLB+EX_R10(r13)
196 std r11,PACA_EXSLB+EX_R11(r13)
197 std r12,PACA_EXSLB+EX_R12(r13)
198 mfspr r10,SPRN_SPRG_SCRATCH0
199 std r10,PACA_EXSLB+EX_R13(r13)
200 ld r12,PACALPPACAPTR(r13)
201 ld r12,LPPACASRR1(r12)
202 b .slb_miss_realmode
203
204 STD_EXCEPTION_ISERIES(instruction_access, PACA_EXGEN)
205
206 .globl instruction_access_slb_iSeries
207instruction_access_slb_iSeries:
208 mtspr SPRN_SPRG_SCRATCH0,r13 /* save r13 */
209 mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */
210 std r3,PACA_EXSLB+EX_R3(r13)
211 ld r3,PACALPPACAPTR(r13)
212 ld r3,LPPACASRR0(r3) /* get SRR0 value */
213 std r9,PACA_EXSLB+EX_R9(r13)
214 mfcr r9
215#ifdef __DISABLED__
216 cmpdi r3,0
217 bge slb_miss_user_iseries
218#endif
219 std r10,PACA_EXSLB+EX_R10(r13)
220 std r11,PACA_EXSLB+EX_R11(r13)
221 std r12,PACA_EXSLB+EX_R12(r13)
222 mfspr r10,SPRN_SPRG_SCRATCH0
223 std r10,PACA_EXSLB+EX_R13(r13)
224 ld r12,PACALPPACAPTR(r13)
225 ld r12,LPPACASRR1(r12)
226 b .slb_miss_realmode
227
228#ifdef __DISABLED__
229slb_miss_user_iseries:
230 std r10,PACA_EXGEN+EX_R10(r13)
231 std r11,PACA_EXGEN+EX_R11(r13)
232 std r12,PACA_EXGEN+EX_R12(r13)
233 mfspr r10,SPRG_SCRATCH0
234 ld r11,PACA_EXSLB+EX_R9(r13)
235 ld r12,PACA_EXSLB+EX_R3(r13)
236 std r10,PACA_EXGEN+EX_R13(r13)
237 std r11,PACA_EXGEN+EX_R9(r13)
238 std r12,PACA_EXGEN+EX_R3(r13)
239 EXCEPTION_PROLOG_ISERIES_1
240 b slb_miss_user_common
241#endif
242
243 MASKABLE_EXCEPTION_ISERIES(hardware_interrupt)
244 STD_EXCEPTION_ISERIES(alignment, PACA_EXGEN)
245 STD_EXCEPTION_ISERIES(program_check, PACA_EXGEN)
246 STD_EXCEPTION_ISERIES(fp_unavailable, PACA_EXGEN)
247 MASKABLE_EXCEPTION_ISERIES(decrementer)
248 STD_EXCEPTION_ISERIES(trap_0a, PACA_EXGEN)
249 STD_EXCEPTION_ISERIES(trap_0b, PACA_EXGEN)
250
251 .globl system_call_iSeries
252system_call_iSeries:
253 mr r9,r13
254 mfspr r13,SPRN_SPRG_PACA
255 EXCEPTION_PROLOG_ISERIES_1
256 b system_call_common
257
258 STD_EXCEPTION_ISERIES(single_step, PACA_EXGEN)
259 STD_EXCEPTION_ISERIES(trap_0e, PACA_EXGEN)
260 STD_EXCEPTION_ISERIES(performance_monitor, PACA_EXGEN)
261
262decrementer_iSeries_masked:
263 /* We may not have a valid TOC pointer in here. */
264 li r11,1
265 ld r12,PACALPPACAPTR(r13)
266 stb r11,LPPACADECRINT(r12)
267 li r12,-1
268 clrldi r12,r12,33 /* set DEC to 0x7fffffff */
269 mtspr SPRN_DEC,r12
270 /* fall through */
271
272hardware_interrupt_iSeries_masked:
273 mtcrf 0x80,r9 /* Restore regs */
274 ld r12,PACALPPACAPTR(r13)
275 ld r11,LPPACASRR0(r12)
276 ld r12,LPPACASRR1(r12)
277 mtspr SPRN_SRR0,r11
278 mtspr SPRN_SRR1,r12
279 ld r9,PACA_EXGEN+EX_R9(r13)
280 ld r10,PACA_EXGEN+EX_R10(r13)
281 ld r11,PACA_EXGEN+EX_R11(r13)
282 ld r12,PACA_EXGEN+EX_R12(r13)
283 ld r13,PACA_EXGEN+EX_R13(r13)
284 rfid
285 b . /* prevent speculative execution */
286
287_INIT_STATIC(__start_initialization_iSeries)
288 /* Clear out the BSS */
289 LOAD_REG_ADDR(r11,__bss_stop)
290 LOAD_REG_ADDR(r8,__bss_start)
291 sub r11,r11,r8 /* bss size */
292 addi r11,r11,7 /* round up to an even double word */
293 rldicl. r11,r11,61,3 /* shift right by 3 */
294 beq 4f
295 addi r8,r8,-8
296 li r0,0
297 mtctr r11 /* zero this many doublewords */
2983: stdu r0,8(r8)
299 bdnz 3b
3004:
301 LOAD_REG_ADDR(r1,init_thread_union)
302 addi r1,r1,THREAD_SIZE
303 li r0,0
304 stdu r0,-STACK_FRAME_OVERHEAD(r1)
305
306 bl .iSeries_early_setup
307 bl .early_setup
308
309 /* relocation is on at this point */
310
311 b .start_here_common
diff --git a/arch/powerpc/platforms/iseries/exception.h b/arch/powerpc/platforms/iseries/exception.h
deleted file mode 100644
index 50271b550a9..00000000000
--- a/arch/powerpc/platforms/iseries/exception.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _ASM_POWERPC_ISERIES_EXCEPTION_H
2#define _ASM_POWERPC_ISERIES_EXCEPTION_H
3/*
4 * Extracted from head_64.S
5 *
6 * PowerPC version
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 *
9 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
10 * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
11 * Adapted for Power Macintosh by Paul Mackerras.
12 * Low-level exception handlers and MMU support
13 * rewritten by Paul Mackerras.
14 * Copyright (C) 1996 Paul Mackerras.
15 *
16 * Adapted for 64bit PowerPC by Dave Engebretsen, Peter Bergner, and
17 * Mike Corrigan {engebret|bergner|mikejc}@us.ibm.com
18 *
19 * This file contains the low-level support and setup for the
20 * PowerPC-64 platform, including trap and interrupt dispatch.
21 *
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * as published by the Free Software Foundation; either version
25 * 2 of the License, or (at your option) any later version.
26 */
27#include <asm/exception-64s.h>
28
29#define EXCEPTION_PROLOG_ISERIES_1 \
30 mfmsr r10; \
31 ld r12,PACALPPACAPTR(r13); \
32 ld r11,LPPACASRR0(r12); \
33 ld r12,LPPACASRR1(r12); \
34 ori r10,r10,MSR_RI; \
35 mtmsrd r10,1
36
37#define STD_EXCEPTION_ISERIES(label, area) \
38 .globl label##_iSeries; \
39label##_iSeries: \
40 HMT_MEDIUM; \
41 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
42 EXCEPTION_PROLOG_1(area, NOTEST, 0); \
43 EXCEPTION_PROLOG_ISERIES_1; \
44 b label##_common
45
46#define MASKABLE_EXCEPTION_ISERIES(label) \
47 .globl label##_iSeries; \
48label##_iSeries: \
49 HMT_MEDIUM; \
50 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
51 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0); \
52 lbz r10,PACASOFTIRQEN(r13); \
53 cmpwi 0,r10,0; \
54 beq- label##_iSeries_masked; \
55 EXCEPTION_PROLOG_ISERIES_1; \
56 b label##_common; \
57
58#endif /* _ASM_POWERPC_ISERIES_EXCEPTION_H */
diff --git a/arch/powerpc/platforms/iseries/htab.c b/arch/powerpc/platforms/iseries/htab.c
deleted file mode 100644
index 3ae66ab9d5e..00000000000
--- a/arch/powerpc/platforms/iseries/htab.c
+++ /dev/null
@@ -1,257 +0,0 @@
1/*
2 * iSeries hashtable management.
3 * Derived from pSeries_htab.c
4 *
5 * SMP scalability work:
6 * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#include <asm/machdep.h>
14#include <asm/pgtable.h>
15#include <asm/mmu.h>
16#include <asm/mmu_context.h>
17#include <asm/abs_addr.h>
18#include <linux/spinlock.h>
19
20#include "call_hpt.h"
21
22static spinlock_t iSeries_hlocks[64] __cacheline_aligned_in_smp;
23
24/*
25 * Very primitive algorithm for picking up a lock
26 */
27static inline void iSeries_hlock(unsigned long slot)
28{
29 if (slot & 0x8)
30 slot = ~slot;
31 spin_lock(&iSeries_hlocks[(slot >> 4) & 0x3f]);
32}
33
34static inline void iSeries_hunlock(unsigned long slot)
35{
36 if (slot & 0x8)
37 slot = ~slot;
38 spin_unlock(&iSeries_hlocks[(slot >> 4) & 0x3f]);
39}
40
41static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,
42 unsigned long pa, unsigned long rflags,
43 unsigned long vflags, int psize, int ssize)
44{
45 long slot;
46 struct hash_pte lhpte;
47 int secondary = 0;
48
49 BUG_ON(psize != MMU_PAGE_4K);
50
51 /*
52 * The hypervisor tries both primary and secondary.
53 * If we are being called to insert in the secondary,
54 * it means we have already tried both primary and secondary,
55 * so we return failure immediately.
56 */
57 if (vflags & HPTE_V_SECONDARY)
58 return -1;
59
60 iSeries_hlock(hpte_group);
61
62 slot = HvCallHpt_findValid(&lhpte, va >> HW_PAGE_SHIFT);
63 if (unlikely(lhpte.v & HPTE_V_VALID)) {
64 if (vflags & HPTE_V_BOLTED) {
65 HvCallHpt_setSwBits(slot, 0x10, 0);
66 HvCallHpt_setPp(slot, PP_RWXX);
67 iSeries_hunlock(hpte_group);
68 if (slot < 0)
69 return 0x8 | (slot & 7);
70 else
71 return slot & 7;
72 }
73 BUG();
74 }
75
76 if (slot == -1) { /* No available entry found in either group */
77 iSeries_hunlock(hpte_group);
78 return -1;
79 }
80
81 if (slot < 0) { /* MSB set means secondary group */
82 vflags |= HPTE_V_SECONDARY;
83 secondary = 1;
84 slot &= 0x7fffffffffffffff;
85 }
86
87
88 lhpte.v = hpte_encode_v(va, MMU_PAGE_4K, MMU_SEGSIZE_256M) |
89 vflags | HPTE_V_VALID;
90 lhpte.r = hpte_encode_r(phys_to_abs(pa), MMU_PAGE_4K) | rflags;
91
92 /* Now fill in the actual HPTE */
93 HvCallHpt_addValidate(slot, secondary, &lhpte);
94
95 iSeries_hunlock(hpte_group);
96
97 return (secondary << 3) | (slot & 7);
98}
99
100static unsigned long iSeries_hpte_getword0(unsigned long slot)
101{
102 struct hash_pte hpte;
103
104 HvCallHpt_get(&hpte, slot);
105 return hpte.v;
106}
107
108static long iSeries_hpte_remove(unsigned long hpte_group)
109{
110 unsigned long slot_offset;
111 int i;
112 unsigned long hpte_v;
113
114 /* Pick a random slot to start at */
115 slot_offset = mftb() & 0x7;
116
117 iSeries_hlock(hpte_group);
118
119 for (i = 0; i < HPTES_PER_GROUP; i++) {
120 hpte_v = iSeries_hpte_getword0(hpte_group + slot_offset);
121
122 if (! (hpte_v & HPTE_V_BOLTED)) {
123 HvCallHpt_invalidateSetSwBitsGet(hpte_group +
124 slot_offset, 0, 0);
125 iSeries_hunlock(hpte_group);
126 return i;
127 }
128
129 slot_offset++;
130 slot_offset &= 0x7;
131 }
132
133 iSeries_hunlock(hpte_group);
134
135 return -1;
136}
137
138/*
139 * The HyperVisor expects the "flags" argument in this form:
140 * bits 0..59 : reserved
141 * bit 60 : N
142 * bits 61..63 : PP2,PP1,PP0
143 */
144static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp,
145 unsigned long va, int psize, int ssize, int local)
146{
147 struct hash_pte hpte;
148 unsigned long want_v;
149
150 iSeries_hlock(slot);
151
152 HvCallHpt_get(&hpte, slot);
153 want_v = hpte_encode_v(va, MMU_PAGE_4K, MMU_SEGSIZE_256M);
154
155 if (HPTE_V_COMPARE(hpte.v, want_v) && (hpte.v & HPTE_V_VALID)) {
156 /*
157 * Hypervisor expects bits as NPPP, which is
158 * different from how they are mapped in our PP.
159 */
160 HvCallHpt_setPp(slot, (newpp & 0x3) | ((newpp & 0x4) << 1));
161 iSeries_hunlock(slot);
162 return 0;
163 }
164 iSeries_hunlock(slot);
165
166 return -1;
167}
168
169/*
170 * Functions used to find the PTE for a particular virtual address.
171 * Only used during boot when bolting pages.
172 *
173 * Input : vpn : virtual page number
174 * Output: PTE index within the page table of the entry
175 * -1 on failure
176 */
177static long iSeries_hpte_find(unsigned long vpn)
178{
179 struct hash_pte hpte;
180 long slot;
181
182 /*
183 * The HvCallHpt_findValid interface is as follows:
184 * 0xffffffffffffffff : No entry found.
185 * 0x00000000xxxxxxxx : Entry found in primary group, slot x
186 * 0x80000000xxxxxxxx : Entry found in secondary group, slot x
187 */
188 slot = HvCallHpt_findValid(&hpte, vpn);
189 if (hpte.v & HPTE_V_VALID) {
190 if (slot < 0) {
191 slot &= 0x7fffffffffffffff;
192 slot = -slot;
193 }
194 } else
195 slot = -1;
196 return slot;
197}
198
199/*
200 * Update the page protection bits. Intended to be used to create
201 * guard pages for kernel data structures on pages which are bolted
202 * in the HPT. Assumes pages being operated on will not be stolen.
203 * Does not work on large pages.
204 *
205 * No need to lock here because we should be the only user.
206 */
207static void iSeries_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,
208 int psize, int ssize)
209{
210 unsigned long vsid,va,vpn;
211 long slot;
212
213 BUG_ON(psize != MMU_PAGE_4K);
214
215 vsid = get_kernel_vsid(ea, MMU_SEGSIZE_256M);
216 va = (vsid << 28) | (ea & 0x0fffffff);
217 vpn = va >> HW_PAGE_SHIFT;
218 slot = iSeries_hpte_find(vpn);
219 if (slot == -1)
220 panic("updateboltedpp: Could not find page to bolt\n");
221 HvCallHpt_setPp(slot, newpp);
222}
223
224static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va,
225 int psize, int ssize, int local)
226{
227 unsigned long hpte_v;
228 unsigned long avpn = va >> 23;
229 unsigned long flags;
230
231 local_irq_save(flags);
232
233 iSeries_hlock(slot);
234
235 hpte_v = iSeries_hpte_getword0(slot);
236
237 if ((HPTE_V_AVPN_VAL(hpte_v) == avpn) && (hpte_v & HPTE_V_VALID))
238 HvCallHpt_invalidateSetSwBitsGet(slot, 0, 0);
239
240 iSeries_hunlock(slot);
241
242 local_irq_restore(flags);
243}
244
245void __init hpte_init_iSeries(void)
246{
247 int i;
248
249 for (i = 0; i < ARRAY_SIZE(iSeries_hlocks); i++)
250 spin_lock_init(&iSeries_hlocks[i]);
251
252 ppc_md.hpte_invalidate = iSeries_hpte_invalidate;
253 ppc_md.hpte_updatepp = iSeries_hpte_updatepp;
254 ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp;
255 ppc_md.hpte_insert = iSeries_hpte_insert;
256 ppc_md.hpte_remove = iSeries_hpte_remove;
257}
diff --git a/arch/powerpc/platforms/iseries/hvcall.S b/arch/powerpc/platforms/iseries/hvcall.S
deleted file mode 100644
index 07ae6ad5f49..00000000000
--- a/arch/powerpc/platforms/iseries/hvcall.S
+++ /dev/null
@@ -1,94 +0,0 @@
1/*
2 * This file contains the code to perform calls to the
3 * iSeries LPAR hypervisor
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <asm/ppc_asm.h>
12#include <asm/processor.h>
13#include <asm/ptrace.h> /* XXX for STACK_FRAME_OVERHEAD */
14
15 .text
16
17/*
18 * Hypervisor call
19 *
20 * Invoke the iSeries hypervisor via the System Call instruction
21 * Parameters are passed to this routine in registers r3 - r10
22 *
23 * r3 contains the HV function to be called
24 * r4-r10 contain the operands to the hypervisor function
25 *
26 */
27
28_GLOBAL(HvCall)
29_GLOBAL(HvCall0)
30_GLOBAL(HvCall1)
31_GLOBAL(HvCall2)
32_GLOBAL(HvCall3)
33_GLOBAL(HvCall4)
34_GLOBAL(HvCall5)
35_GLOBAL(HvCall6)
36_GLOBAL(HvCall7)
37
38
39 mfcr r0
40 std r0,-8(r1)
41 stdu r1,-(STACK_FRAME_OVERHEAD+16)(r1)
42
43 /* r0 = 0xffffffffffffffff indicates a hypervisor call */
44
45 li r0,-1
46
47 /* Invoke the hypervisor */
48
49 sc
50
51 ld r1,0(r1)
52 ld r0,-8(r1)
53 mtcrf 0xff,r0
54
55 /* return to caller, return value in r3 */
56
57 blr
58
59_GLOBAL(HvCall0Ret16)
60_GLOBAL(HvCall1Ret16)
61_GLOBAL(HvCall2Ret16)
62_GLOBAL(HvCall3Ret16)
63_GLOBAL(HvCall4Ret16)
64_GLOBAL(HvCall5Ret16)
65_GLOBAL(HvCall6Ret16)
66_GLOBAL(HvCall7Ret16)
67
68 mfcr r0
69 std r0,-8(r1)
70 std r31,-16(r1)
71 stdu r1,-(STACK_FRAME_OVERHEAD+32)(r1)
72
73 mr r31,r4
74 li r0,-1
75 mr r4,r5
76 mr r5,r6
77 mr r6,r7
78 mr r7,r8
79 mr r8,r9
80 mr r9,r10
81
82 sc
83
84 std r3,0(r31)
85 std r4,8(r31)
86
87 mr r3,r5
88
89 ld r1,0(r1)
90 ld r0,-8(r1)
91 mtcrf 0xff,r0
92 ld r31,-16(r1)
93
94 blr
diff --git a/arch/powerpc/platforms/iseries/hvlog.c b/arch/powerpc/platforms/iseries/hvlog.c
deleted file mode 100644
index f476d71194f..00000000000
--- a/arch/powerpc/platforms/iseries/hvlog.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#include <asm/page.h>
11#include <asm/abs_addr.h>
12#include <asm/iseries/hv_call.h>
13#include <asm/iseries/hv_call_sc.h>
14#include <asm/iseries/hv_types.h>
15
16
17void HvCall_writeLogBuffer(const void *buffer, u64 len)
18{
19 struct HvLpBufferList hv_buf;
20 u64 left_this_page;
21 u64 cur = virt_to_abs(buffer);
22
23 while (len) {
24 hv_buf.addr = cur;
25 left_this_page = ((cur & HW_PAGE_MASK) + HW_PAGE_SIZE) - cur;
26 if (left_this_page > len)
27 left_this_page = len;
28 hv_buf.len = left_this_page;
29 len -= left_this_page;
30 HvCall2(HvCallBaseWriteLogBuffer,
31 virt_to_abs(&hv_buf),
32 left_this_page);
33 cur = (cur & HW_PAGE_MASK) + HW_PAGE_SIZE;
34 }
35}
diff --git a/arch/powerpc/platforms/iseries/hvlpconfig.c b/arch/powerpc/platforms/iseries/hvlpconfig.c
deleted file mode 100644
index f62a0c5fa67..00000000000
--- a/arch/powerpc/platforms/iseries/hvlpconfig.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Copyright (C) 2001 Kyle A. Lucke, IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include <linux/export.h>
20#include <asm/iseries/hv_lp_config.h>
21#include "it_lp_naca.h"
22
23HvLpIndex HvLpConfig_getLpIndex_outline(void)
24{
25 return HvLpConfig_getLpIndex();
26}
27EXPORT_SYMBOL(HvLpConfig_getLpIndex_outline);
28
29HvLpIndex HvLpConfig_getLpIndex(void)
30{
31 return itLpNaca.xLpIndex;
32}
33EXPORT_SYMBOL(HvLpConfig_getLpIndex);
34
35HvLpIndex HvLpConfig_getPrimaryLpIndex(void)
36{
37 return itLpNaca.xPrimaryLpIndex;
38}
39EXPORT_SYMBOL_GPL(HvLpConfig_getPrimaryLpIndex);
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
deleted file mode 100644
index 2f3d9110248..00000000000
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ /dev/null
@@ -1,260 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
3 *
4 * Rewrite, cleanup:
5 *
6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
7 * Copyright (C) 2006 Olof Johansson <olof@lixom.net>
8 *
9 * Dynamic DMA mapping support, iSeries-specific parts.
10 *
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#include <linux/types.h>
28#include <linux/dma-mapping.h>
29#include <linux/list.h>
30#include <linux/pci.h>
31#include <linux/export.h>
32#include <linux/slab.h>
33
34#include <asm/iommu.h>
35#include <asm/vio.h>
36#include <asm/tce.h>
37#include <asm/machdep.h>
38#include <asm/abs_addr.h>
39#include <asm/prom.h>
40#include <asm/pci-bridge.h>
41#include <asm/iseries/hv_call_xm.h>
42#include <asm/iseries/hv_call_event.h>
43#include <asm/iseries/iommu.h>
44
45static int tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
46 unsigned long uaddr, enum dma_data_direction direction,
47 struct dma_attrs *attrs)
48{
49 u64 rc;
50 u64 tce, rpn;
51
52 while (npages--) {
53 rpn = virt_to_abs(uaddr) >> TCE_SHIFT;
54 tce = (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
55
56 if (tbl->it_type == TCE_VB) {
57 /* Virtual Bus */
58 tce |= TCE_VALID|TCE_ALLIO;
59 if (direction != DMA_TO_DEVICE)
60 tce |= TCE_VB_WRITE;
61 } else {
62 /* PCI Bus */
63 tce |= TCE_PCI_READ; /* Read allowed */
64 if (direction != DMA_TO_DEVICE)
65 tce |= TCE_PCI_WRITE;
66 }
67
68 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, tce);
69 if (rc)
70 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%llx\n",
71 rc);
72 index++;
73 uaddr += TCE_PAGE_SIZE;
74 }
75 return 0;
76}
77
78static void tce_free_iSeries(struct iommu_table *tbl, long index, long npages)
79{
80 u64 rc;
81
82 while (npages--) {
83 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, 0);
84 if (rc)
85 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%llx\n",
86 rc);
87 index++;
88 }
89}
90
91/*
92 * Structure passed to HvCallXm_getTceTableParms
93 */
94struct iommu_table_cb {
95 unsigned long itc_busno; /* Bus number for this tce table */
96 unsigned long itc_start; /* Will be NULL for secondary */
97 unsigned long itc_totalsize; /* Size (in pages) of whole table */
98 unsigned long itc_offset; /* Index into real tce table of the
99 start of our section */
100 unsigned long itc_size; /* Size (in pages) of our section */
101 unsigned long itc_index; /* Index of this tce table */
102 unsigned short itc_maxtables; /* Max num of tables for partition */
103 unsigned char itc_virtbus; /* Flag to indicate virtual bus */
104 unsigned char itc_slotno; /* IOA Tce Slot Index */
105 unsigned char itc_rsvd[4];
106};
107
108/*
109 * Call Hv with the architected data structure to get TCE table info.
110 * info. Put the returned data into the Linux representation of the
111 * TCE table data.
112 * The Hardware Tce table comes in three flavors.
113 * 1. TCE table shared between Buses.
114 * 2. TCE table per Bus.
115 * 3. TCE Table per IOA.
116 */
117void iommu_table_getparms_iSeries(unsigned long busno,
118 unsigned char slotno,
119 unsigned char virtbus,
120 struct iommu_table* tbl)
121{
122 struct iommu_table_cb *parms;
123
124 parms = kzalloc(sizeof(*parms), GFP_KERNEL);
125 if (parms == NULL)
126 panic("PCI_DMA: TCE Table Allocation failed.");
127
128 parms->itc_busno = busno;
129 parms->itc_slotno = slotno;
130 parms->itc_virtbus = virtbus;
131
132 HvCallXm_getTceTableParms(iseries_hv_addr(parms));
133
134 if (parms->itc_size == 0)
135 panic("PCI_DMA: parms->size is zero, parms is 0x%p", parms);
136
137 /* itc_size is in pages worth of table, it_size is in # of entries */
138 tbl->it_size = (parms->itc_size * TCE_PAGE_SIZE) / TCE_ENTRY_SIZE;
139 tbl->it_busno = parms->itc_busno;
140 tbl->it_offset = parms->itc_offset;
141 tbl->it_index = parms->itc_index;
142 tbl->it_blocksize = 1;
143 tbl->it_type = virtbus ? TCE_VB : TCE_PCI;
144
145 kfree(parms);
146}
147
148
149#ifdef CONFIG_PCI
150/*
151 * This function compares the known tables to find an iommu_table
152 * that has already been built for hardware TCEs.
153 */
154static struct iommu_table *iommu_table_find(struct iommu_table * tbl)
155{
156 struct device_node *node;
157
158 for (node = NULL; (node = of_find_all_nodes(node)); ) {
159 struct pci_dn *pdn = PCI_DN(node);
160 struct iommu_table *it;
161
162 if (pdn == NULL)
163 continue;
164 it = pdn->iommu_table;
165 if ((it != NULL) &&
166 (it->it_type == TCE_PCI) &&
167 (it->it_offset == tbl->it_offset) &&
168 (it->it_index == tbl->it_index) &&
169 (it->it_size == tbl->it_size)) {
170 of_node_put(node);
171 return it;
172 }
173 }
174 return NULL;
175}
176
177
178static void pci_dma_dev_setup_iseries(struct pci_dev *pdev)
179{
180 struct iommu_table *tbl;
181 struct device_node *dn = pci_device_to_OF_node(pdev);
182 struct pci_dn *pdn = PCI_DN(dn);
183 const u32 *lsn = of_get_property(dn, "linux,logical-slot-number", NULL);
184
185 BUG_ON(lsn == NULL);
186
187 tbl = kzalloc(sizeof(struct iommu_table), GFP_KERNEL);
188
189 iommu_table_getparms_iSeries(pdn->busno, *lsn, 0, tbl);
190
191 /* Look for existing tce table */
192 pdn->iommu_table = iommu_table_find(tbl);
193 if (pdn->iommu_table == NULL)
194 pdn->iommu_table = iommu_init_table(tbl, -1);
195 else
196 kfree(tbl);
197 set_iommu_table_base(&pdev->dev, pdn->iommu_table);
198}
199#else
200#define pci_dma_dev_setup_iseries NULL
201#endif
202
203static struct iommu_table veth_iommu_table;
204static struct iommu_table vio_iommu_table;
205
206void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag)
207{
208 return iommu_alloc_coherent(NULL, &vio_iommu_table, size, dma_handle,
209 DMA_BIT_MASK(32), flag, -1);
210}
211EXPORT_SYMBOL_GPL(iseries_hv_alloc);
212
213void iseries_hv_free(size_t size, void *vaddr, dma_addr_t dma_handle)
214{
215 iommu_free_coherent(&vio_iommu_table, size, vaddr, dma_handle);
216}
217EXPORT_SYMBOL_GPL(iseries_hv_free);
218
219dma_addr_t iseries_hv_map(void *vaddr, size_t size,
220 enum dma_data_direction direction)
221{
222 return iommu_map_page(NULL, &vio_iommu_table, virt_to_page(vaddr),
223 (unsigned long)vaddr % PAGE_SIZE, size,
224 DMA_BIT_MASK(32), direction, NULL);
225}
226
227void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
228 enum dma_data_direction direction)
229{
230 iommu_unmap_page(&vio_iommu_table, dma_handle, size, direction, NULL);
231}
232
233void __init iommu_vio_init(void)
234{
235 iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
236 veth_iommu_table.it_size /= 2;
237 vio_iommu_table = veth_iommu_table;
238 vio_iommu_table.it_offset += veth_iommu_table.it_size;
239
240 if (!iommu_init_table(&veth_iommu_table, -1))
241 printk("Virtual Bus VETH TCE table failed.\n");
242 if (!iommu_init_table(&vio_iommu_table, -1))
243 printk("Virtual Bus VIO TCE table failed.\n");
244}
245
246struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev)
247{
248 if (strcmp(dev->type, "network") == 0)
249 return &veth_iommu_table;
250 return &vio_iommu_table;
251}
252
253void iommu_init_early_iSeries(void)
254{
255 ppc_md.tce_build = tce_build_iSeries;
256 ppc_md.tce_free = tce_free_iSeries;
257
258 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_iseries;
259 set_pci_dma_ops(&dma_iommu_ops);
260}
diff --git a/arch/powerpc/platforms/iseries/ipl_parms.h b/arch/powerpc/platforms/iseries/ipl_parms.h
deleted file mode 100644
index 83e4ca42fc5..00000000000
--- a/arch/powerpc/platforms/iseries/ipl_parms.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ISERIES_IPL_PARMS_H
19#define _ISERIES_IPL_PARMS_H
20
21/*
22 * This struct maps the IPL Parameters DMA'd from the SP.
23 *
24 * Warning:
25 * This data must map in exactly 64 bytes and match the architecture for
26 * the IPL parms
27 */
28
29#include <asm/types.h>
30
31struct ItIplParmsReal {
32 u8 xFormat; // Defines format of IplParms x00-x00
33 u8 xRsvd01:6; // Reserved x01-x01
34 u8 xAlternateSearch:1; // Alternate search indicator ...
35 u8 xUaSupplied:1; // UA Supplied on programmed IPL...
36 u8 xLsUaFormat; // Format byte for UA x02-x02
37 u8 xRsvd02; // Reserved x03-x03
38 u32 xLsUa; // LS UA x04-x07
39 u32 xUnusedLsLid; // First OS LID to load x08-x0B
40 u16 xLsBusNumber; // LS Bus Number x0C-x0D
41 u8 xLsCardAdr; // LS Card Address x0E-x0E
42 u8 xLsBoardAdr; // LS Board Address x0F-x0F
43 u32 xRsvd03; // Reserved x10-x13
44 u8 xSpcnPresent:1; // SPCN present x14-x14
45 u8 xCpmPresent:1; // CPM present ...
46 u8 xRsvd04:6; // Reserved ...
47 u8 xRsvd05:4; // Reserved x15-x15
48 u8 xKeyLock:4; // Keylock setting ...
49 u8 xRsvd06:6; // Reserved x16-x16
50 u8 xIplMode:2; // Ipl mode (A|B|C|D) ...
51 u8 xHwIplType; // Fast v slow v slow EC HW IPL x17-x17
52 u16 xCpmEnabledIpl:1; // CPM in effect when IPL initiatedx18-x19
53 u16 xPowerOnResetIpl:1; // Indicate POR condition ...
54 u16 xMainStorePreserved:1; // Main Storage is preserved ...
55 u16 xRsvd07:13; // Reserved ...
56 u16 xIplSource:16; // Ipl source x1A-x1B
57 u8 xIplReason:8; // Reason for this IPL x1C-x1C
58 u8 xRsvd08; // Reserved x1D-x1D
59 u16 xRsvd09; // Reserved x1E-x1F
60 u16 xSysBoxType; // System Box Type x20-x21
61 u16 xSysProcType; // System Processor Type x22-x23
62 u32 xRsvd10; // Reserved x24-x27
63 u64 xRsvd11; // Reserved x28-x2F
64 u64 xRsvd12; // Reserved x30-x37
65 u64 xRsvd13; // Reserved x38-x3F
66};
67
68#endif /* _ISERIES_IPL_PARMS_H */
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
deleted file mode 100644
index 05ce5164caf..00000000000
--- a/arch/powerpc/platforms/iseries/irq.c
+++ /dev/null
@@ -1,399 +0,0 @@
1/*
2 * This module supports the iSeries PCI bus interrupt handling
3 * Copyright (C) 20yy <Robert L Holtorf> <IBM Corp>
4 * Copyright (C) 2004-2005 IBM 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:
18 * Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330,
20 * Boston, MA 02111-1307 USA
21 *
22 * Change Activity:
23 * Created, December 13, 2000 by Wayne Holm
24 * End Change Activity
25 */
26#include <linux/pci.h>
27#include <linux/init.h>
28#include <linux/threads.h>
29#include <linux/smp.h>
30#include <linux/param.h>
31#include <linux/string.h>
32#include <linux/bootmem.h>
33#include <linux/irq.h>
34#include <linux/spinlock.h>
35
36#include <asm/paca.h>
37#include <asm/iseries/hv_types.h>
38#include <asm/iseries/hv_lp_event.h>
39#include <asm/iseries/hv_call_xm.h>
40#include <asm/iseries/it_lp_queue.h>
41
42#include "irq.h"
43#include "pci.h"
44#include "call_pci.h"
45
46#ifdef CONFIG_PCI
47
48enum pci_event_type {
49 pe_bus_created = 0, /* PHB has been created */
50 pe_bus_error = 1, /* PHB has failed */
51 pe_bus_failed = 2, /* Msg to Secondary, Primary failed bus */
52 pe_node_failed = 4, /* Multi-adapter bridge has failed */
53 pe_node_recovered = 5, /* Multi-adapter bridge has recovered */
54 pe_bus_recovered = 12, /* PHB has been recovered */
55 pe_unquiese_bus = 18, /* Secondary bus unqiescing */
56 pe_bridge_error = 21, /* Bridge Error */
57 pe_slot_interrupt = 22 /* Slot interrupt */
58};
59
60struct pci_event {
61 struct HvLpEvent event;
62 union {
63 u64 __align; /* Align on an 8-byte boundary */
64 struct {
65 u32 fisr;
66 HvBusNumber bus_number;
67 HvSubBusNumber sub_bus_number;
68 HvAgentId dev_id;
69 } slot;
70 struct {
71 HvBusNumber bus_number;
72 HvSubBusNumber sub_bus_number;
73 } bus;
74 struct {
75 HvBusNumber bus_number;
76 HvSubBusNumber sub_bus_number;
77 HvAgentId dev_id;
78 } node;
79 } data;
80};
81
82static DEFINE_SPINLOCK(pending_irqs_lock);
83static int num_pending_irqs;
84static int pending_irqs[NR_IRQS];
85
86static void int_received(struct pci_event *event)
87{
88 int irq;
89
90 switch (event->event.xSubtype) {
91 case pe_slot_interrupt:
92 irq = event->event.xCorrelationToken;
93 if (irq < NR_IRQS) {
94 spin_lock(&pending_irqs_lock);
95 pending_irqs[irq]++;
96 num_pending_irqs++;
97 spin_unlock(&pending_irqs_lock);
98 } else {
99 printk(KERN_WARNING "int_received: bad irq number %d\n",
100 irq);
101 HvCallPci_eoi(event->data.slot.bus_number,
102 event->data.slot.sub_bus_number,
103 event->data.slot.dev_id);
104 }
105 break;
106 /* Ignore error recovery events for now */
107 case pe_bus_created:
108 printk(KERN_INFO "int_received: system bus %d created\n",
109 event->data.bus.bus_number);
110 break;
111 case pe_bus_error:
112 case pe_bus_failed:
113 printk(KERN_INFO "int_received: system bus %d failed\n",
114 event->data.bus.bus_number);
115 break;
116 case pe_bus_recovered:
117 case pe_unquiese_bus:
118 printk(KERN_INFO "int_received: system bus %d recovered\n",
119 event->data.bus.bus_number);
120 break;
121 case pe_node_failed:
122 case pe_bridge_error:
123 printk(KERN_INFO
124 "int_received: multi-adapter bridge %d/%d/%d failed\n",
125 event->data.node.bus_number,
126 event->data.node.sub_bus_number,
127 event->data.node.dev_id);
128 break;
129 case pe_node_recovered:
130 printk(KERN_INFO
131 "int_received: multi-adapter bridge %d/%d/%d recovered\n",
132 event->data.node.bus_number,
133 event->data.node.sub_bus_number,
134 event->data.node.dev_id);
135 break;
136 default:
137 printk(KERN_ERR
138 "int_received: unrecognized event subtype 0x%x\n",
139 event->event.xSubtype);
140 break;
141 }
142}
143
144static void pci_event_handler(struct HvLpEvent *event)
145{
146 if (event && (event->xType == HvLpEvent_Type_PciIo)) {
147 if (hvlpevent_is_int(event))
148 int_received((struct pci_event *)event);
149 else
150 printk(KERN_ERR
151 "pci_event_handler: unexpected ack received\n");
152 } else if (event)
153 printk(KERN_ERR
154 "pci_event_handler: Unrecognized PCI event type 0x%x\n",
155 (int)event->xType);
156 else
157 printk(KERN_ERR "pci_event_handler: NULL event received\n");
158}
159
160#define REAL_IRQ_TO_SUBBUS(irq) (((irq) >> 14) & 0xff)
161#define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1)
162#define REAL_IRQ_TO_IDSEL(irq) ((((irq) >> 3) & 7) + 1)
163#define REAL_IRQ_TO_FUNC(irq) ((irq) & 7)
164
165/*
166 * This will be called by device drivers (via enable_IRQ)
167 * to enable INTA in the bridge interrupt status register.
168 */
169static void iseries_enable_IRQ(struct irq_data *d)
170{
171 u32 bus, dev_id, function, mask;
172 const u32 sub_bus = 0;
173 unsigned int rirq = (unsigned int)irqd_to_hwirq(d);
174
175 /* The IRQ has already been locked by the caller */
176 bus = REAL_IRQ_TO_BUS(rirq);
177 function = REAL_IRQ_TO_FUNC(rirq);
178 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
179
180 /* Unmask secondary INTA */
181 mask = 0x80000000;
182 HvCallPci_unmaskInterrupts(bus, sub_bus, dev_id, mask);
183}
184
185/* This is called by iseries_activate_IRQs */
186static unsigned int iseries_startup_IRQ(struct irq_data *d)
187{
188 u32 bus, dev_id, function, mask;
189 const u32 sub_bus = 0;
190 unsigned int rirq = (unsigned int)irqd_to_hwirq(d);
191
192 bus = REAL_IRQ_TO_BUS(rirq);
193 function = REAL_IRQ_TO_FUNC(rirq);
194 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
195
196 /* Link the IRQ number to the bridge */
197 HvCallXm_connectBusUnit(bus, sub_bus, dev_id, d->irq);
198
199 /* Unmask bridge interrupts in the FISR */
200 mask = 0x01010000 << function;
201 HvCallPci_unmaskFisr(bus, sub_bus, dev_id, mask);
202 iseries_enable_IRQ(d);
203 return 0;
204}
205
206/*
207 * This is called out of iSeries_fixup to activate interrupt
208 * generation for usable slots
209 */
210void __init iSeries_activate_IRQs()
211{
212 int irq;
213 unsigned long flags;
214
215 for_each_irq (irq) {
216 struct irq_desc *desc = irq_to_desc(irq);
217 struct irq_chip *chip;
218
219 if (!desc)
220 continue;
221
222 chip = irq_desc_get_chip(desc);
223 if (chip && chip->irq_startup) {
224 raw_spin_lock_irqsave(&desc->lock, flags);
225 chip->irq_startup(&desc->irq_data);
226 raw_spin_unlock_irqrestore(&desc->lock, flags);
227 }
228 }
229}
230
231/* this is not called anywhere currently */
232static void iseries_shutdown_IRQ(struct irq_data *d)
233{
234 u32 bus, dev_id, function, mask;
235 const u32 sub_bus = 0;
236 unsigned int rirq = (unsigned int)irqd_to_hwirq(d);
237
238 /* irq should be locked by the caller */
239 bus = REAL_IRQ_TO_BUS(rirq);
240 function = REAL_IRQ_TO_FUNC(rirq);
241 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
242
243 /* Invalidate the IRQ number in the bridge */
244 HvCallXm_connectBusUnit(bus, sub_bus, dev_id, 0);
245
246 /* Mask bridge interrupts in the FISR */
247 mask = 0x01010000 << function;
248 HvCallPci_maskFisr(bus, sub_bus, dev_id, mask);
249}
250
251/*
252 * This will be called by device drivers (via disable_IRQ)
253 * to disable INTA in the bridge interrupt status register.
254 */
255static void iseries_disable_IRQ(struct irq_data *d)
256{
257 u32 bus, dev_id, function, mask;
258 const u32 sub_bus = 0;
259 unsigned int rirq = (unsigned int)irqd_to_hwirq(d);
260
261 /* The IRQ has already been locked by the caller */
262 bus = REAL_IRQ_TO_BUS(rirq);
263 function = REAL_IRQ_TO_FUNC(rirq);
264 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
265
266 /* Mask secondary INTA */
267 mask = 0x80000000;
268 HvCallPci_maskInterrupts(bus, sub_bus, dev_id, mask);
269}
270
271static void iseries_end_IRQ(struct irq_data *d)
272{
273 unsigned int rirq = (unsigned int)irqd_to_hwirq(d);
274
275 HvCallPci_eoi(REAL_IRQ_TO_BUS(rirq), REAL_IRQ_TO_SUBBUS(rirq),
276 (REAL_IRQ_TO_IDSEL(rirq) << 4) + REAL_IRQ_TO_FUNC(rirq));
277}
278
279static struct irq_chip iseries_pic = {
280 .name = "iSeries",
281 .irq_startup = iseries_startup_IRQ,
282 .irq_shutdown = iseries_shutdown_IRQ,
283 .irq_unmask = iseries_enable_IRQ,
284 .irq_mask = iseries_disable_IRQ,
285 .irq_eoi = iseries_end_IRQ
286};
287
288/*
289 * This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot
290 * It calculates the irq value for the slot.
291 * Note that sub_bus is always 0 (at the moment at least).
292 */
293int __init iSeries_allocate_IRQ(HvBusNumber bus,
294 HvSubBusNumber sub_bus, u32 bsubbus)
295{
296 unsigned int realirq;
297 u8 idsel = ISERIES_GET_DEVICE_FROM_SUBBUS(bsubbus);
298 u8 function = ISERIES_GET_FUNCTION_FROM_SUBBUS(bsubbus);
299
300 realirq = (((((sub_bus << 8) + (bus - 1)) << 3) + (idsel - 1)) << 3)
301 + function;
302
303 return irq_create_mapping(NULL, realirq);
304}
305
306#endif /* CONFIG_PCI */
307
308/*
309 * Get the next pending IRQ.
310 */
311unsigned int iSeries_get_irq(void)
312{
313 int irq = NO_IRQ_IGNORE;
314
315#ifdef CONFIG_SMP
316 if (get_lppaca()->int_dword.fields.ipi_cnt) {
317 get_lppaca()->int_dword.fields.ipi_cnt = 0;
318 smp_ipi_demux();
319 }
320#endif /* CONFIG_SMP */
321 if (hvlpevent_is_pending())
322 process_hvlpevents();
323
324#ifdef CONFIG_PCI
325 if (num_pending_irqs) {
326 spin_lock(&pending_irqs_lock);
327 for (irq = 0; irq < NR_IRQS; irq++) {
328 if (pending_irqs[irq]) {
329 pending_irqs[irq]--;
330 num_pending_irqs--;
331 break;
332 }
333 }
334 spin_unlock(&pending_irqs_lock);
335 if (irq >= NR_IRQS)
336 irq = NO_IRQ_IGNORE;
337 }
338#endif
339
340 return irq;
341}
342
343#ifdef CONFIG_PCI
344
345static int iseries_irq_host_map(struct irq_domain *h, unsigned int virq,
346 irq_hw_number_t hw)
347{
348 irq_set_chip_and_handler(virq, &iseries_pic, handle_fasteoi_irq);
349
350 return 0;
351}
352
353static int iseries_irq_host_match(struct irq_domain *h, struct device_node *np)
354{
355 /* Match all */
356 return 1;
357}
358
359static const struct irq_domain_ops iseries_irq_domain_ops = {
360 .map = iseries_irq_host_map,
361 .match = iseries_irq_host_match,
362};
363
364/*
365 * This is called by init_IRQ. set in ppc_md.init_IRQ by iSeries_setup.c
366 * It must be called before the bus walk.
367 */
368void __init iSeries_init_IRQ(void)
369{
370 /* Register PCI event handler and open an event path */
371 struct irq_domain *host;
372 int ret;
373
374 /*
375 * The Hypervisor only allows us up to 256 interrupt
376 * sources (the irq number is passed in a u8).
377 */
378 irq_set_virq_count(256);
379
380 /* Create irq host. No need for a revmap since HV will give us
381 * back our virtual irq number
382 */
383 host = irq_domain_add_nomap(NULL, &iseries_irq_domain_ops, NULL);
384 BUG_ON(host == NULL);
385 irq_set_default_host(host);
386
387 ret = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo,
388 &pci_event_handler);
389 if (ret == 0) {
390 ret = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0);
391 if (ret != 0)
392 printk(KERN_ERR "iseries_init_IRQ: open event path "
393 "failed with rc 0x%x\n", ret);
394 } else
395 printk(KERN_ERR "iseries_init_IRQ: register handler "
396 "failed with rc 0x%x\n", ret);
397}
398
399#endif /* CONFIG_PCI */
diff --git a/arch/powerpc/platforms/iseries/irq.h b/arch/powerpc/platforms/iseries/irq.h
deleted file mode 100644
index a1c23607403..00000000000
--- a/arch/powerpc/platforms/iseries/irq.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ISERIES_IRQ_H
2#define _ISERIES_IRQ_H
3
4#ifdef CONFIG_PCI
5extern void iSeries_init_IRQ(void);
6extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, u32);
7extern void iSeries_activate_IRQs(void);
8#else
9#define iSeries_init_IRQ NULL
10#endif
11extern unsigned int iSeries_get_irq(void);
12
13#endif /* _ISERIES_IRQ_H */
diff --git a/arch/powerpc/platforms/iseries/it_exp_vpd_panel.h b/arch/powerpc/platforms/iseries/it_exp_vpd_panel.h
deleted file mode 100644
index 6de9097b7f5..00000000000
--- a/arch/powerpc/platforms/iseries/it_exp_vpd_panel.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * Copyright (C) 2002 Dave Boutcher IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H
19#define _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H
20
21/*
22 * This struct maps the panel information
23 *
24 * Warning:
25 * This data must match the architecture for the panel information
26 */
27
28#include <asm/types.h>
29
30struct ItExtVpdPanel {
31 /* Definition of the Extended Vpd On Panel Data Area */
32 char systemSerial[8];
33 char mfgID[4];
34 char reserved1[24];
35 char machineType[4];
36 char systemID[6];
37 char somUniqueCnt[4];
38 char serialNumberCount;
39 char reserved2[7];
40 u16 bbu3;
41 u16 bbu2;
42 u16 bbu1;
43 char xLocationLabel[8];
44 u8 xRsvd1[6];
45 u16 xFrameId;
46 u8 xRsvd2[48];
47};
48
49extern struct ItExtVpdPanel xItExtVpdPanel;
50
51#endif /* _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H */
diff --git a/arch/powerpc/platforms/iseries/it_lp_naca.h b/arch/powerpc/platforms/iseries/it_lp_naca.h
deleted file mode 100644
index cf6dcf6ef07..00000000000
--- a/arch/powerpc/platforms/iseries/it_lp_naca.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _PLATFORMS_ISERIES_IT_LP_NACA_H
19#define _PLATFORMS_ISERIES_IT_LP_NACA_H
20
21#include <linux/types.h>
22
23/*
24 * This control block contains the data that is shared between the
25 * hypervisor (PLIC) and the OS.
26 */
27
28struct ItLpNaca {
29// CACHE_LINE_1 0x0000 - 0x007F Contains read-only data
30 u32 xDesc; // Eye catcher x00-x03
31 u16 xSize; // Size of this class x04-x05
32 u16 xIntHdlrOffset; // Offset to IntHdlr array x06-x07
33 u8 xMaxIntHdlrEntries; // Number of entries in array x08-x08
34 u8 xPrimaryLpIndex; // LP Index of Primary x09-x09
35 u8 xServiceLpIndex; // LP Ind of Service Focal Pointx0A-x0A
36 u8 xLpIndex; // LP Index x0B-x0B
37 u16 xMaxLpQueues; // Number of allocated queues x0C-x0D
38 u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F
39 u8 xPirEnvironMode; // Piranha or hardware x10-x10
40 u8 xPirConsoleMode; // Piranha console indicator x11-x11
41 u8 xPirDasdMode; // Piranha dasd indicator x12-x12
42 u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17
43 u8 flags; // flags, see below x18-x1F
44 u8 xSpVpdFormat; // VPD areas are in CSP format ...
45 u8 xIntProcRatio; // Ratio of int procs to procs ...
46 u8 xRsvd1_2[5]; // Reserved ...
47 u16 xRsvd1_3; // Reserved x20-x21
48 u16 xPlicVrmIndex; // VRM index of PLIC x22-x23
49 u16 xMinSupportedSlicVrmInd;// Min supported OS VRM index x24-x25
50 u16 xMinCompatableSlicVrmInd;// Min compatible OS VRM index x26-x27
51 u64 xLoadAreaAddr; // ER address of load area x28-x2F
52 u32 xLoadAreaChunks; // Chunks for the load area x30-x33
53 u32 xPaseSysCallCRMask; // Mask used to test CR before x34-x37
54 // doing an ASR switch on PASE
55 // system call.
56 u64 xSlicSegmentTablePtr; // Pointer to Slic seg table. x38-x3f
57 u8 xRsvd1_4[64]; // x40-x7F
58
59// CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data
60 u8 xRsvd2_0[128]; // Reserved x00-x7F
61
62// CACHE_LINE_3-6 0x0100 - 0x02FF Contains LP Queue indicators
63// NB: Padding required to keep xInterruptHdlr at x300 which is required
64// for v4r4 PLIC.
65 u8 xOldLpQueue[128]; // LP Queue needed for v4r4 100-17F
66 u8 xRsvd3_0[384]; // Reserved 180-2FF
67
68// CACHE_LINE_7-8 0x0300 - 0x03FF Contains the address of the OS interrupt
69// handlers
70 u64 xInterruptHdlr[32]; // Interrupt handlers 300-x3FF
71};
72
73extern struct ItLpNaca itLpNaca;
74
75#define ITLPNACA_LPAR 0x80 /* Is LPAR installed on the system */
76#define ITLPNACA_PARTITIONED 0x40 /* Is the system partitioned */
77#define ITLPNACA_HWSYNCEDTBS 0x20 /* Hardware synced TBs */
78#define ITLPNACA_HMTINT 0x10 /* Utilize MHT for interrupts */
79
80#endif /* _PLATFORMS_ISERIES_IT_LP_NACA_H */
diff --git a/arch/powerpc/platforms/iseries/ksyms.c b/arch/powerpc/platforms/iseries/ksyms.c
deleted file mode 100644
index 997e234fb8b..00000000000
--- a/arch/powerpc/platforms/iseries/ksyms.c
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * (C) 2001-2005 PPC 64 Team, IBM Corp
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/export.h>
10
11#include <asm/hw_irq.h>
12#include <asm/iseries/hv_call_sc.h>
13
14EXPORT_SYMBOL(HvCall0);
15EXPORT_SYMBOL(HvCall1);
16EXPORT_SYMBOL(HvCall2);
17EXPORT_SYMBOL(HvCall3);
18EXPORT_SYMBOL(HvCall4);
19EXPORT_SYMBOL(HvCall5);
20EXPORT_SYMBOL(HvCall6);
21EXPORT_SYMBOL(HvCall7);
diff --git a/arch/powerpc/platforms/iseries/lpardata.c b/arch/powerpc/platforms/iseries/lpardata.c
deleted file mode 100644
index 00e0ec813a1..00000000000
--- a/arch/powerpc/platforms/iseries/lpardata.c
+++ /dev/null
@@ -1,318 +0,0 @@
1/*
2 * Copyright 2001 Mike Corrigan, IBM Corp
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/types.h>
10#include <linux/threads.h>
11#include <linux/bitops.h>
12#include <asm/processor.h>
13#include <asm/ptrace.h>
14#include <asm/abs_addr.h>
15#include <asm/lppaca.h>
16#include <asm/paca.h>
17#include <asm/iseries/lpar_map.h>
18#include <asm/iseries/it_lp_queue.h>
19#include <asm/iseries/alpaca.h>
20
21#include "naca.h"
22#include "vpd_areas.h"
23#include "spcomm_area.h"
24#include "ipl_parms.h"
25#include "processor_vpd.h"
26#include "release_data.h"
27#include "it_exp_vpd_panel.h"
28#include "it_lp_naca.h"
29
30/* The HvReleaseData is the root of the information shared between
31 * the hypervisor and Linux.
32 */
33const struct HvReleaseData hvReleaseData = {
34 .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */
35 .xSize = sizeof(struct HvReleaseData),
36 .xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas),
37 .xSlicNacaAddr = &naca, /* 64-bit Naca address */
38 .xMsNucDataOffset = LPARMAP_PHYS,
39 .xFlags = HVREL_TAGSINACTIVE /* tags inactive */
40 /* 64 bit */
41 /* shared processors */
42 /* HMT allowed */
43 | 6, /* TEMP: This allows non-GA driver */
44 .xVrmIndex = 4, /* We are v5r2m0 */
45 .xMinSupportedPlicVrmIndex = 3, /* v5r1m0 */
46 .xMinCompatablePlicVrmIndex = 3, /* v5r1m0 */
47 .xVrmName = { 0xd3, 0x89, 0x95, 0xa4, /* "Linux 2.4.64" ebcdic */
48 0xa7, 0x40, 0xf2, 0x4b,
49 0xf4, 0x4b, 0xf6, 0xf4 },
50};
51
52/*
53 * The NACA. The first dword of the naca is required by the iSeries
54 * hypervisor to point to itVpdAreas. The hypervisor finds the NACA
55 * through the pointer in hvReleaseData.
56 */
57struct naca_struct naca = {
58 .xItVpdAreas = &itVpdAreas,
59 .xRamDisk = 0,
60 .xRamDiskSize = 0,
61};
62
63struct ItLpRegSave {
64 u32 xDesc; // Eye catcher "LpRS" ebcdic 000-003
65 u16 xSize; // Size of this class 004-005
66 u8 xInUse; // Area is live 006-007
67 u8 xRsvd1[9]; // Reserved 007-00F
68
69 u8 xFixedRegSave[352]; // Fixed Register Save Area 010-16F
70 u32 xCTRL; // Control Register 170-173
71 u32 xDEC; // Decrementer 174-177
72 u32 xFPSCR; // FP Status and Control Reg 178-17B
73 u32 xPVR; // Processor Version Number 17C-17F
74
75 u64 xMMCR0; // Monitor Mode Control Reg 0 180-187
76 u32 xPMC1; // Perf Monitor Counter 1 188-18B
77 u32 xPMC2; // Perf Monitor Counter 2 18C-18F
78 u32 xPMC3; // Perf Monitor Counter 3 190-193
79 u32 xPMC4; // Perf Monitor Counter 4 194-197
80 u32 xPIR; // Processor ID Reg 198-19B
81
82 u32 xMMCR1; // Monitor Mode Control Reg 1 19C-19F
83 u32 xMMCRA; // Monitor Mode Control Reg A 1A0-1A3
84 u32 xPMC5; // Perf Monitor Counter 5 1A4-1A7
85 u32 xPMC6; // Perf Monitor Counter 6 1A8-1AB
86 u32 xPMC7; // Perf Monitor Counter 7 1AC-1AF
87 u32 xPMC8; // Perf Monitor Counter 8 1B0-1B3
88 u32 xTSC; // Thread Switch Control 1B4-1B7
89 u32 xTST; // Thread Switch Timeout 1B8-1BB
90 u32 xRsvd; // Reserved 1BC-1BF
91
92 u64 xACCR; // Address Compare Control Reg 1C0-1C7
93 u64 xIMR; // Instruction Match Register 1C8-1CF
94 u64 xSDR1; // Storage Description Reg 1 1D0-1D7
95 u64 xSPRG0; // Special Purpose Reg General0 1D8-1DF
96 u64 xSPRG1; // Special Purpose Reg General1 1E0-1E7
97 u64 xSPRG2; // Special Purpose Reg General2 1E8-1EF
98 u64 xSPRG3; // Special Purpose Reg General3 1F0-1F7
99 u64 xTB; // Time Base Register 1F8-1FF
100
101 u64 xFPR[32]; // Floating Point Registers 200-2FF
102
103 u64 xMSR; // Machine State Register 300-307
104 u64 xNIA; // Next Instruction Address 308-30F
105
106 u64 xDABR; // Data Address Breakpoint Reg 310-317
107 u64 xIABR; // Inst Address Breakpoint Reg 318-31F
108
109 u64 xHID0; // HW Implementation Dependent0 320-327
110
111 u64 xHID4; // HW Implementation Dependent4 328-32F
112 u64 xSCOMd; // SCON Data Reg (SPRG4) 330-337
113 u64 xSCOMc; // SCON Command Reg (SPRG5) 338-33F
114 u64 xSDAR; // Sample Data Address Register 340-347
115 u64 xSIAR; // Sample Inst Address Register 348-34F
116
117 u8 xRsvd3[176]; // Reserved 350-3FF
118};
119
120extern void system_reset_iSeries(void);
121extern void machine_check_iSeries(void);
122extern void data_access_iSeries(void);
123extern void instruction_access_iSeries(void);
124extern void hardware_interrupt_iSeries(void);
125extern void alignment_iSeries(void);
126extern void program_check_iSeries(void);
127extern void fp_unavailable_iSeries(void);
128extern void decrementer_iSeries(void);
129extern void trap_0a_iSeries(void);
130extern void trap_0b_iSeries(void);
131extern void system_call_iSeries(void);
132extern void single_step_iSeries(void);
133extern void trap_0e_iSeries(void);
134extern void performance_monitor_iSeries(void);
135extern void data_access_slb_iSeries(void);
136extern void instruction_access_slb_iSeries(void);
137
138struct ItLpNaca itLpNaca = {
139 .xDesc = 0xd397d581, /* "LpNa" ebcdic */
140 .xSize = 0x0400, /* size of ItLpNaca */
141 .xIntHdlrOffset = 0x0300, /* offset to int array */
142 .xMaxIntHdlrEntries = 19, /* # ents */
143 .xPrimaryLpIndex = 0, /* Part # of primary */
144 .xServiceLpIndex = 0, /* Part # of serv */
145 .xLpIndex = 0, /* Part # of me */
146 .xMaxLpQueues = 0, /* # of LP queues */
147 .xLpQueueOffset = 0x100, /* offset of start of LP queues */
148 .xPirEnvironMode = 0, /* Piranha stuff */
149 .xPirConsoleMode = 0,
150 .xPirDasdMode = 0,
151 .flags = 0,
152 .xSpVpdFormat = 0,
153 .xIntProcRatio = 0,
154 .xPlicVrmIndex = 0, /* VRM index of PLIC */
155 .xMinSupportedSlicVrmInd = 0, /* min supported SLIC */
156 .xMinCompatableSlicVrmInd = 0, /* min compat SLIC */
157 .xLoadAreaAddr = 0, /* 64-bit addr of load area */
158 .xLoadAreaChunks = 0, /* chunks for load area */
159 .xPaseSysCallCRMask = 0, /* PASE mask */
160 .xSlicSegmentTablePtr = 0, /* seg table */
161 .xOldLpQueue = { 0 }, /* Old LP Queue */
162 .xInterruptHdlr = {
163 (u64)system_reset_iSeries, /* 0x100 System Reset */
164 (u64)machine_check_iSeries, /* 0x200 Machine Check */
165 (u64)data_access_iSeries, /* 0x300 Data Access */
166 (u64)instruction_access_iSeries, /* 0x400 Instruction Access */
167 (u64)hardware_interrupt_iSeries, /* 0x500 External */
168 (u64)alignment_iSeries, /* 0x600 Alignment */
169 (u64)program_check_iSeries, /* 0x700 Program Check */
170 (u64)fp_unavailable_iSeries, /* 0x800 FP Unavailable */
171 (u64)decrementer_iSeries, /* 0x900 Decrementer */
172 (u64)trap_0a_iSeries, /* 0xa00 Trap 0A */
173 (u64)trap_0b_iSeries, /* 0xb00 Trap 0B */
174 (u64)system_call_iSeries, /* 0xc00 System Call */
175 (u64)single_step_iSeries, /* 0xd00 Single Step */
176 (u64)trap_0e_iSeries, /* 0xe00 Trap 0E */
177 (u64)performance_monitor_iSeries,/* 0xf00 Performance Monitor */
178 0, /* int 0x1000 */
179 0, /* int 0x1010 */
180 0, /* int 0x1020 CPU ctls */
181 (u64)hardware_interrupt_iSeries, /* SC Ret Hdlr */
182 (u64)data_access_slb_iSeries, /* 0x380 D-SLB */
183 (u64)instruction_access_slb_iSeries /* 0x480 I-SLB */
184 }
185};
186
187/* May be filled in by the hypervisor so cannot end up in the BSS */
188static struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data")));
189
190/* May be filled in by the hypervisor so cannot end up in the BSS */
191struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data")));
192
193#define maxPhysicalProcessors 32
194
195struct IoHriProcessorVpd xIoHriProcessorVpd[maxPhysicalProcessors] = {
196 {
197 .xInstCacheOperandSize = 32,
198 .xDataCacheOperandSize = 32,
199 .xProcFreq = 50000000,
200 .xTimeBaseFreq = 50000000,
201 .xPVR = 0x3600
202 }
203};
204
205/* Space for Main Store Vpd 27,200 bytes */
206/* May be filled in by the hypervisor so cannot end up in the BSS */
207u64 xMsVpd[3400] __attribute__((__section__(".data")));
208
209/* Space for Recovery Log Buffer */
210/* May be filled in by the hypervisor so cannot end up in the BSS */
211static u64 xRecoveryLogBuffer[32] __attribute__((__section__(".data")));
212
213static const struct SpCommArea xSpCommArea = {
214 .xDesc = 0xE2D7C3C2,
215 .xFormat = 1,
216};
217
218static const struct ItLpRegSave iseries_reg_save[] = {
219 [0 ... (NR_CPUS-1)] = {
220 .xDesc = 0xd397d9e2, /* "LpRS" */
221 .xSize = sizeof(struct ItLpRegSave),
222 },
223};
224
225#define ALPACA_INIT(number) \
226{ \
227 .lppaca_ptr = &lppaca[number], \
228 .reg_save_ptr = &iseries_reg_save[number], \
229}
230
231const struct alpaca alpaca[] = {
232 ALPACA_INIT( 0),
233#if NR_CPUS > 1
234 ALPACA_INIT( 1), ALPACA_INIT( 2), ALPACA_INIT( 3),
235#if NR_CPUS > 4
236 ALPACA_INIT( 4), ALPACA_INIT( 5), ALPACA_INIT( 6), ALPACA_INIT( 7),
237#if NR_CPUS > 8
238 ALPACA_INIT( 8), ALPACA_INIT( 9), ALPACA_INIT(10), ALPACA_INIT(11),
239 ALPACA_INIT(12), ALPACA_INIT(13), ALPACA_INIT(14), ALPACA_INIT(15),
240 ALPACA_INIT(16), ALPACA_INIT(17), ALPACA_INIT(18), ALPACA_INIT(19),
241 ALPACA_INIT(20), ALPACA_INIT(21), ALPACA_INIT(22), ALPACA_INIT(23),
242 ALPACA_INIT(24), ALPACA_INIT(25), ALPACA_INIT(26), ALPACA_INIT(27),
243 ALPACA_INIT(28), ALPACA_INIT(29), ALPACA_INIT(30), ALPACA_INIT(31),
244#if NR_CPUS > 32
245 ALPACA_INIT(32), ALPACA_INIT(33), ALPACA_INIT(34), ALPACA_INIT(35),
246 ALPACA_INIT(36), ALPACA_INIT(37), ALPACA_INIT(38), ALPACA_INIT(39),
247 ALPACA_INIT(40), ALPACA_INIT(41), ALPACA_INIT(42), ALPACA_INIT(43),
248 ALPACA_INIT(44), ALPACA_INIT(45), ALPACA_INIT(46), ALPACA_INIT(47),
249 ALPACA_INIT(48), ALPACA_INIT(49), ALPACA_INIT(50), ALPACA_INIT(51),
250 ALPACA_INIT(52), ALPACA_INIT(53), ALPACA_INIT(54), ALPACA_INIT(55),
251 ALPACA_INIT(56), ALPACA_INIT(57), ALPACA_INIT(58), ALPACA_INIT(59),
252 ALPACA_INIT(60), ALPACA_INIT(61), ALPACA_INIT(62), ALPACA_INIT(63),
253#endif
254#endif
255#endif
256#endif
257};
258
259/* The LparMap data is now located at offset 0x6000 in head.S
260 * It was put there so that the HvReleaseData could address it
261 * with a 32-bit offset as required by the iSeries hypervisor
262 *
263 * The Naca has a pointer to the ItVpdAreas. The hypervisor finds
264 * the Naca via the HvReleaseData area. The HvReleaseData has the
265 * offset into the Naca of the pointer to the ItVpdAreas.
266 */
267const struct ItVpdAreas itVpdAreas = {
268 .xSlicDesc = 0xc9a3e5c1, /* "ItVA" */
269 .xSlicSize = sizeof(struct ItVpdAreas),
270 .xSlicVpdEntries = ItVpdMaxEntries, /* # VPD array entries */
271 .xSlicDmaEntries = ItDmaMaxEntries, /* # DMA array entries */
272 .xSlicMaxLogicalProcs = NR_CPUS * 2, /* Max logical procs */
273 .xSlicMaxPhysicalProcs = maxPhysicalProcessors, /* Max physical procs */
274 .xSlicDmaToksOffset = offsetof(struct ItVpdAreas, xPlicDmaToks),
275 .xSlicVpdAdrsOffset = offsetof(struct ItVpdAreas, xSlicVpdAdrs),
276 .xSlicDmaLensOffset = offsetof(struct ItVpdAreas, xPlicDmaLens),
277 .xSlicVpdLensOffset = offsetof(struct ItVpdAreas, xSlicVpdLens),
278 .xSlicMaxSlotLabels = 0, /* max slot labels */
279 .xSlicMaxLpQueues = 1, /* max LP queues */
280 .xPlicDmaLens = { 0 }, /* DMA lengths */
281 .xPlicDmaToks = { 0 }, /* DMA tokens */
282 .xSlicVpdLens = { /* VPD lengths */
283 0,0,0, /* 0 - 2 */
284 sizeof(xItExtVpdPanel), /* 3 Extended VPD */
285 sizeof(struct alpaca), /* 4 length of (fake) Paca */
286 0, /* 5 */
287 sizeof(struct ItIplParmsReal),/* 6 length of IPL parms */
288 26992, /* 7 length of MS VPD */
289 0, /* 8 */
290 sizeof(struct ItLpNaca),/* 9 length of LP Naca */
291 0, /* 10 */
292 256, /* 11 length of Recovery Log Buf */
293 sizeof(struct SpCommArea), /* 12 length of SP Comm Area */
294 0,0,0, /* 13 - 15 */
295 sizeof(struct IoHriProcessorVpd),/* 16 length of Proc Vpd */
296 0,0,0,0,0,0, /* 17 - 22 */
297 sizeof(struct hvlpevent_queue), /* 23 length of Lp Queue */
298 0,0 /* 24 - 25 */
299 },
300 .xSlicVpdAdrs = { /* VPD addresses */
301 0,0,0, /* 0 - 2 */
302 &xItExtVpdPanel, /* 3 Extended VPD */
303 &alpaca[0], /* 4 first (fake) Paca */
304 0, /* 5 */
305 &xItIplParmsReal, /* 6 IPL parms */
306 &xMsVpd, /* 7 MS Vpd */
307 0, /* 8 */
308 &itLpNaca, /* 9 LpNaca */
309 0, /* 10 */
310 &xRecoveryLogBuffer, /* 11 Recovery Log Buffer */
311 &xSpCommArea, /* 12 SP Comm Area */
312 0,0,0, /* 13 - 15 */
313 &xIoHriProcessorVpd, /* 16 Proc Vpd */
314 0,0,0,0,0,0, /* 17 - 22 */
315 &hvlpevent_queue, /* 23 Lp Queue */
316 0,0
317 }
318};
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c
deleted file mode 100644
index 202e22798d3..00000000000
--- a/arch/powerpc/platforms/iseries/lpevents.c
+++ /dev/null
@@ -1,341 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#include <linux/stddef.h>
11#include <linux/kernel.h>
12#include <linux/sched.h>
13#include <linux/bootmem.h>
14#include <linux/seq_file.h>
15#include <linux/proc_fs.h>
16#include <linux/export.h>
17
18#include <asm/system.h>
19#include <asm/paca.h>
20#include <asm/firmware.h>
21#include <asm/iseries/it_lp_queue.h>
22#include <asm/iseries/hv_lp_event.h>
23#include <asm/iseries/hv_call_event.h>
24#include "it_lp_naca.h"
25
26/*
27 * The LpQueue is used to pass event data from the hypervisor to
28 * the partition. This is where I/O interrupt events are communicated.
29 *
30 * It is written to by the hypervisor so cannot end up in the BSS.
31 */
32struct hvlpevent_queue hvlpevent_queue __attribute__((__section__(".data")));
33
34DEFINE_PER_CPU(unsigned long[HvLpEvent_Type_NumTypes], hvlpevent_counts);
35
36static char *event_types[HvLpEvent_Type_NumTypes] = {
37 "Hypervisor",
38 "Machine Facilities",
39 "Session Manager",
40 "SPD I/O",
41 "Virtual Bus",
42 "PCI I/O",
43 "RIO I/O",
44 "Virtual Lan",
45 "Virtual I/O"
46};
47
48/* Array of LpEvent handler functions */
49static LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes];
50static unsigned lpEventHandlerPaths[HvLpEvent_Type_NumTypes];
51
52static struct HvLpEvent * get_next_hvlpevent(void)
53{
54 struct HvLpEvent * event;
55 event = (struct HvLpEvent *)hvlpevent_queue.hq_current_event;
56
57 if (hvlpevent_is_valid(event)) {
58 /* rmb() needed only for weakly consistent machines (regatta) */
59 rmb();
60 /* Set pointer to next potential event */
61 hvlpevent_queue.hq_current_event += ((event->xSizeMinus1 +
62 IT_LP_EVENT_ALIGN) / IT_LP_EVENT_ALIGN) *
63 IT_LP_EVENT_ALIGN;
64
65 /* Wrap to beginning if no room at end */
66 if (hvlpevent_queue.hq_current_event >
67 hvlpevent_queue.hq_last_event) {
68 hvlpevent_queue.hq_current_event =
69 hvlpevent_queue.hq_event_stack;
70 }
71 } else {
72 event = NULL;
73 }
74
75 return event;
76}
77
78static unsigned long spread_lpevents = NR_CPUS;
79
80int hvlpevent_is_pending(void)
81{
82 struct HvLpEvent *next_event;
83
84 if (smp_processor_id() >= spread_lpevents)
85 return 0;
86
87 next_event = (struct HvLpEvent *)hvlpevent_queue.hq_current_event;
88
89 return hvlpevent_is_valid(next_event) ||
90 hvlpevent_queue.hq_overflow_pending;
91}
92
93static void hvlpevent_clear_valid(struct HvLpEvent * event)
94{
95 /* Tell the Hypervisor that we're done with this event.
96 * Also clear bits within this event that might look like valid bits.
97 * ie. on 64-byte boundaries.
98 */
99 struct HvLpEvent *tmp;
100 unsigned extra = ((event->xSizeMinus1 + IT_LP_EVENT_ALIGN) /
101 IT_LP_EVENT_ALIGN) - 1;
102
103 switch (extra) {
104 case 3:
105 tmp = (struct HvLpEvent*)((char*)event + 3 * IT_LP_EVENT_ALIGN);
106 hvlpevent_invalidate(tmp);
107 case 2:
108 tmp = (struct HvLpEvent*)((char*)event + 2 * IT_LP_EVENT_ALIGN);
109 hvlpevent_invalidate(tmp);
110 case 1:
111 tmp = (struct HvLpEvent*)((char*)event + 1 * IT_LP_EVENT_ALIGN);
112 hvlpevent_invalidate(tmp);
113 }
114
115 mb();
116
117 hvlpevent_invalidate(event);
118}
119
120void process_hvlpevents(void)
121{
122 struct HvLpEvent * event;
123
124 restart:
125 /* If we have recursed, just return */
126 if (!spin_trylock(&hvlpevent_queue.hq_lock))
127 return;
128
129 for (;;) {
130 event = get_next_hvlpevent();
131 if (event) {
132 /* Call appropriate handler here, passing
133 * a pointer to the LpEvent. The handler
134 * must make a copy of the LpEvent if it
135 * needs it in a bottom half. (perhaps for
136 * an ACK)
137 *
138 * Handlers are responsible for ACK processing
139 *
140 * The Hypervisor guarantees that LpEvents will
141 * only be delivered with types that we have
142 * registered for, so no type check is necessary
143 * here!
144 */
145 if (event->xType < HvLpEvent_Type_NumTypes)
146 __get_cpu_var(hvlpevent_counts)[event->xType]++;
147 if (event->xType < HvLpEvent_Type_NumTypes &&
148 lpEventHandler[event->xType])
149 lpEventHandler[event->xType](event);
150 else {
151 u8 type = event->xType;
152
153 /*
154 * Don't printk in the spinlock as printk
155 * may require ack events form the HV to send
156 * any characters there.
157 */
158 hvlpevent_clear_valid(event);
159 spin_unlock(&hvlpevent_queue.hq_lock);
160 printk(KERN_INFO
161 "Unexpected Lp Event type=%d\n", type);
162 goto restart;
163 }
164
165 hvlpevent_clear_valid(event);
166 } else if (hvlpevent_queue.hq_overflow_pending)
167 /*
168 * No more valid events. If overflow events are
169 * pending process them
170 */
171 HvCallEvent_getOverflowLpEvents(hvlpevent_queue.hq_index);
172 else
173 break;
174 }
175
176 spin_unlock(&hvlpevent_queue.hq_lock);
177}
178
179static int set_spread_lpevents(char *str)
180{
181 unsigned long val = simple_strtoul(str, NULL, 0);
182
183 /*
184 * The parameter is the number of processors to share in processing
185 * lp events.
186 */
187 if (( val > 0) && (val <= NR_CPUS)) {
188 spread_lpevents = val;
189 printk("lpevent processing spread over %ld processors\n", val);
190 } else {
191 printk("invalid spread_lpevents %ld\n", val);
192 }
193
194 return 1;
195}
196__setup("spread_lpevents=", set_spread_lpevents);
197
198void __init setup_hvlpevent_queue(void)
199{
200 void *eventStack;
201
202 spin_lock_init(&hvlpevent_queue.hq_lock);
203
204 /* Allocate a page for the Event Stack. */
205 eventStack = alloc_bootmem_pages(IT_LP_EVENT_STACK_SIZE);
206 memset(eventStack, 0, IT_LP_EVENT_STACK_SIZE);
207
208 /* Invoke the hypervisor to initialize the event stack */
209 HvCallEvent_setLpEventStack(0, eventStack, IT_LP_EVENT_STACK_SIZE);
210
211 hvlpevent_queue.hq_event_stack = eventStack;
212 hvlpevent_queue.hq_current_event = eventStack;
213 hvlpevent_queue.hq_last_event = (char *)eventStack +
214 (IT_LP_EVENT_STACK_SIZE - IT_LP_EVENT_MAX_SIZE);
215 hvlpevent_queue.hq_index = 0;
216}
217
218/* Register a handler for an LpEvent type */
219int HvLpEvent_registerHandler(HvLpEvent_Type eventType, LpEventHandler handler)
220{
221 if (eventType < HvLpEvent_Type_NumTypes) {
222 lpEventHandler[eventType] = handler;
223 return 0;
224 }
225 return 1;
226}
227EXPORT_SYMBOL(HvLpEvent_registerHandler);
228
229int HvLpEvent_unregisterHandler(HvLpEvent_Type eventType)
230{
231 might_sleep();
232
233 if (eventType < HvLpEvent_Type_NumTypes) {
234 if (!lpEventHandlerPaths[eventType]) {
235 lpEventHandler[eventType] = NULL;
236 /*
237 * We now sleep until all other CPUs have scheduled.
238 * This ensures that the deletion is seen by all
239 * other CPUs, and that the deleted handler isn't
240 * still running on another CPU when we return.
241 */
242 synchronize_sched();
243 return 0;
244 }
245 }
246 return 1;
247}
248EXPORT_SYMBOL(HvLpEvent_unregisterHandler);
249
250/*
251 * lpIndex is the partition index of the target partition.
252 * needed only for VirtualIo, VirtualLan and SessionMgr. Zero
253 * indicates to use our partition index - for the other types.
254 */
255int HvLpEvent_openPath(HvLpEvent_Type eventType, HvLpIndex lpIndex)
256{
257 if ((eventType < HvLpEvent_Type_NumTypes) &&
258 lpEventHandler[eventType]) {
259 if (lpIndex == 0)
260 lpIndex = itLpNaca.xLpIndex;
261 HvCallEvent_openLpEventPath(lpIndex, eventType);
262 ++lpEventHandlerPaths[eventType];
263 return 0;
264 }
265 return 1;
266}
267
268int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex)
269{
270 if ((eventType < HvLpEvent_Type_NumTypes) &&
271 lpEventHandler[eventType] &&
272 lpEventHandlerPaths[eventType]) {
273 if (lpIndex == 0)
274 lpIndex = itLpNaca.xLpIndex;
275 HvCallEvent_closeLpEventPath(lpIndex, eventType);
276 --lpEventHandlerPaths[eventType];
277 return 0;
278 }
279 return 1;
280}
281
282static int proc_lpevents_show(struct seq_file *m, void *v)
283{
284 int cpu, i;
285 unsigned long sum;
286 static unsigned long cpu_totals[NR_CPUS];
287
288 /* FIXME: do we care that there's no locking here? */
289 sum = 0;
290 for_each_online_cpu(cpu) {
291 cpu_totals[cpu] = 0;
292 for (i = 0; i < HvLpEvent_Type_NumTypes; i++) {
293 cpu_totals[cpu] += per_cpu(hvlpevent_counts, cpu)[i];
294 }
295 sum += cpu_totals[cpu];
296 }
297
298 seq_printf(m, "LpEventQueue 0\n");
299 seq_printf(m, " events processed:\t%lu\n", sum);
300
301 for (i = 0; i < HvLpEvent_Type_NumTypes; ++i) {
302 sum = 0;
303 for_each_online_cpu(cpu) {
304 sum += per_cpu(hvlpevent_counts, cpu)[i];
305 }
306
307 seq_printf(m, " %-20s %10lu\n", event_types[i], sum);
308 }
309
310 seq_printf(m, "\n events processed by processor:\n");
311
312 for_each_online_cpu(cpu) {
313 seq_printf(m, " CPU%02d %10lu\n", cpu, cpu_totals[cpu]);
314 }
315
316 return 0;
317}
318
319static int proc_lpevents_open(struct inode *inode, struct file *file)
320{
321 return single_open(file, proc_lpevents_show, NULL);
322}
323
324static const struct file_operations proc_lpevents_operations = {
325 .open = proc_lpevents_open,
326 .read = seq_read,
327 .llseek = seq_lseek,
328 .release = single_release,
329};
330
331static int __init proc_lpevents_init(void)
332{
333 if (!firmware_has_feature(FW_FEATURE_ISERIES))
334 return 0;
335
336 proc_create("iSeries/lpevents", S_IFREG|S_IRUGO, NULL,
337 &proc_lpevents_operations);
338 return 0;
339}
340__initcall(proc_lpevents_init);
341
diff --git a/arch/powerpc/platforms/iseries/main_store.h b/arch/powerpc/platforms/iseries/main_store.h
deleted file mode 100644
index 1a7a3f50e40..00000000000
--- a/arch/powerpc/platforms/iseries/main_store.h
+++ /dev/null
@@ -1,165 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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 _ISERIES_MAIN_STORE_H
20#define _ISERIES_MAIN_STORE_H
21
22/* Main Store Vpd for Condor,iStar,sStar */
23struct IoHriMainStoreSegment4 {
24 u8 msArea0Exists:1;
25 u8 msArea1Exists:1;
26 u8 msArea2Exists:1;
27 u8 msArea3Exists:1;
28 u8 reserved1:4;
29 u8 reserved2;
30
31 u8 msArea0Functional:1;
32 u8 msArea1Functional:1;
33 u8 msArea2Functional:1;
34 u8 msArea3Functional:1;
35 u8 reserved3:4;
36 u8 reserved4;
37
38 u32 totalMainStore;
39
40 u64 msArea0Ptr;
41 u64 msArea1Ptr;
42 u64 msArea2Ptr;
43 u64 msArea3Ptr;
44
45 u32 cardProductionLevel;
46
47 u32 msAdrHole;
48
49 u8 msArea0HasRiserVpd:1;
50 u8 msArea1HasRiserVpd:1;
51 u8 msArea2HasRiserVpd:1;
52 u8 msArea3HasRiserVpd:1;
53 u8 reserved5:4;
54 u8 reserved6;
55 u16 reserved7;
56
57 u8 reserved8[28];
58
59 u64 nonInterleavedBlocksStartAdr;
60 u64 nonInterleavedBlocksEndAdr;
61};
62
63/* Main Store VPD for Power4 */
64struct __attribute((packed)) IoHriMainStoreChipInfo1 {
65 u32 chipMfgID;
66 char chipECLevel[4];
67};
68
69struct IoHriMainStoreVpdIdData {
70 char typeNumber[4];
71 char modelNumber[4];
72 char partNumber[12];
73 char serialNumber[12];
74};
75
76struct __attribute((packed)) IoHriMainStoreVpdFruData {
77 char fruLabel[8];
78 u8 numberOfSlots;
79 u8 pluggingType;
80 u16 slotMapIndex;
81};
82
83struct __attribute((packed)) IoHriMainStoreAdrRangeBlock {
84 void *blockStart;
85 void *blockEnd;
86 u32 blockProcChipId;
87};
88
89#define MaxAreaAdrRangeBlocks 4
90
91struct __attribute((packed)) IoHriMainStoreArea4 {
92 u32 msVpdFormat;
93 u8 containedVpdType;
94 u8 reserved1;
95 u16 reserved2;
96
97 u64 msExists;
98 u64 msFunctional;
99
100 u32 memorySize;
101 u32 procNodeId;
102
103 u32 numAdrRangeBlocks;
104 struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks];
105
106 struct IoHriMainStoreChipInfo1 chipInfo0;
107 struct IoHriMainStoreChipInfo1 chipInfo1;
108 struct IoHriMainStoreChipInfo1 chipInfo2;
109 struct IoHriMainStoreChipInfo1 chipInfo3;
110 struct IoHriMainStoreChipInfo1 chipInfo4;
111 struct IoHriMainStoreChipInfo1 chipInfo5;
112 struct IoHriMainStoreChipInfo1 chipInfo6;
113 struct IoHriMainStoreChipInfo1 chipInfo7;
114
115 void *msRamAreaArray;
116 u32 msRamAreaArrayNumEntries;
117 u32 msRamAreaArrayEntrySize;
118
119 u32 numaDimmExists;
120 u32 numaDimmFunctional;
121 void *numaDimmArray;
122 u32 numaDimmArrayNumEntries;
123 u32 numaDimmArrayEntrySize;
124
125 struct IoHriMainStoreVpdIdData idData;
126
127 u64 powerData;
128 u64 cardAssemblyPartNum;
129 u64 chipSerialNum;
130
131 u64 reserved3;
132 char reserved4[16];
133
134 struct IoHriMainStoreVpdFruData fruData;
135
136 u8 vpdPortNum;
137 u8 reserved5;
138 u8 frameId;
139 u8 rackUnit;
140 char asciiKeywordVpd[256];
141 u32 reserved6;
142};
143
144
145struct IoHriMainStoreSegment5 {
146 u16 reserved1;
147 u8 reserved2;
148 u8 msVpdFormat;
149
150 u32 totalMainStore;
151 u64 maxConfiguredMsAdr;
152
153 struct IoHriMainStoreArea4 *msAreaArray;
154 u32 msAreaArrayNumEntries;
155 u32 msAreaArrayEntrySize;
156
157 u32 msAreaExists;
158 u32 msAreaFunctional;
159
160 u64 reserved3;
161};
162
163extern u64 xMsVpd[];
164
165#endif /* _ISERIES_MAIN_STORE_H */
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
deleted file mode 100644
index 254c1fc3d8d..00000000000
--- a/arch/powerpc/platforms/iseries/mf.c
+++ /dev/null
@@ -1,1275 +0,0 @@
1/*
2 * Copyright (C) 2001 Troy D. Armstrong IBM Corporation
3 * Copyright (C) 2004-2005 Stephen Rothwell IBM Corporation
4 *
5 * This modules exists as an interface between a Linux secondary partition
6 * running on an iSeries and the primary partition's Virtual Service
7 * Processor (VSP) object. The VSP has final authority over powering on/off
8 * all partitions in the iSeries. It also provides miscellaneous low-level
9 * machine facility type operations.
10 *
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#include <linux/types.h>
28#include <linux/errno.h>
29#include <linux/kernel.h>
30#include <linux/init.h>
31#include <linux/completion.h>
32#include <linux/delay.h>
33#include <linux/export.h>
34#include <linux/proc_fs.h>
35#include <linux/dma-mapping.h>
36#include <linux/bcd.h>
37#include <linux/rtc.h>
38#include <linux/slab.h>
39
40#include <asm/time.h>
41#include <asm/uaccess.h>
42#include <asm/paca.h>
43#include <asm/abs_addr.h>
44#include <asm/firmware.h>
45#include <asm/iseries/mf.h>
46#include <asm/iseries/hv_lp_config.h>
47#include <asm/iseries/hv_lp_event.h>
48#include <asm/iseries/it_lp_queue.h>
49
50#include "setup.h"
51
52static int mf_initialized;
53
54/*
55 * This is the structure layout for the Machine Facilities LPAR event
56 * flows.
57 */
58struct vsp_cmd_data {
59 u64 token;
60 u16 cmd;
61 HvLpIndex lp_index;
62 u8 result_code;
63 u32 reserved;
64 union {
65 u64 state; /* GetStateOut */
66 u64 ipl_type; /* GetIplTypeOut, Function02SelectIplTypeIn */
67 u64 ipl_mode; /* GetIplModeOut, Function02SelectIplModeIn */
68 u64 page[4]; /* GetSrcHistoryIn */
69 u64 flag; /* GetAutoIplWhenPrimaryIplsOut,
70 SetAutoIplWhenPrimaryIplsIn,
71 WhiteButtonPowerOffIn,
72 Function08FastPowerOffIn,
73 IsSpcnRackPowerIncompleteOut */
74 struct {
75 u64 token;
76 u64 address_type;
77 u64 side;
78 u32 length;
79 u32 offset;
80 } kern; /* SetKernelImageIn, GetKernelImageIn,
81 SetKernelCmdLineIn, GetKernelCmdLineIn */
82 u32 length_out; /* GetKernelImageOut, GetKernelCmdLineOut */
83 u8 reserved[80];
84 } sub_data;
85};
86
87struct vsp_rsp_data {
88 struct completion com;
89 struct vsp_cmd_data *response;
90};
91
92struct alloc_data {
93 u16 size;
94 u16 type;
95 u32 count;
96 u16 reserved1;
97 u8 reserved2;
98 HvLpIndex target_lp;
99};
100
101struct ce_msg_data;
102
103typedef void (*ce_msg_comp_hdlr)(void *token, struct ce_msg_data *vsp_cmd_rsp);
104
105struct ce_msg_comp_data {
106 ce_msg_comp_hdlr handler;
107 void *token;
108};
109
110struct ce_msg_data {
111 u8 ce_msg[12];
112 char reserved[4];
113 struct ce_msg_comp_data *completion;
114};
115
116struct io_mf_lp_event {
117 struct HvLpEvent hp_lp_event;
118 u16 subtype_result_code;
119 u16 reserved1;
120 u32 reserved2;
121 union {
122 struct alloc_data alloc;
123 struct ce_msg_data ce_msg;
124 struct vsp_cmd_data vsp_cmd;
125 } data;
126};
127
128#define subtype_data(a, b, c, d) \
129 (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
130
131/*
132 * All outgoing event traffic is kept on a FIFO queue. The first
133 * pointer points to the one that is outstanding, and all new
134 * requests get stuck on the end. Also, we keep a certain number of
135 * preallocated pending events so that we can operate very early in
136 * the boot up sequence (before kmalloc is ready).
137 */
138struct pending_event {
139 struct pending_event *next;
140 struct io_mf_lp_event event;
141 MFCompleteHandler hdlr;
142 char dma_data[72];
143 unsigned dma_data_length;
144 unsigned remote_address;
145};
146static spinlock_t pending_event_spinlock;
147static struct pending_event *pending_event_head;
148static struct pending_event *pending_event_tail;
149static struct pending_event *pending_event_avail;
150#define PENDING_EVENT_PREALLOC_LEN 16
151static struct pending_event pending_event_prealloc[PENDING_EVENT_PREALLOC_LEN];
152
153/*
154 * Put a pending event onto the available queue, so it can get reused.
155 * Attention! You must have the pending_event_spinlock before calling!
156 */
157static void free_pending_event(struct pending_event *ev)
158{
159 if (ev != NULL) {
160 ev->next = pending_event_avail;
161 pending_event_avail = ev;
162 }
163}
164
165/*
166 * Enqueue the outbound event onto the stack. If the queue was
167 * empty to begin with, we must also issue it via the Hypervisor
168 * interface. There is a section of code below that will touch
169 * the first stack pointer without the protection of the pending_event_spinlock.
170 * This is OK, because we know that nobody else will be modifying
171 * the first pointer when we do this.
172 */
173static int signal_event(struct pending_event *ev)
174{
175 int rc = 0;
176 unsigned long flags;
177 int go = 1;
178 struct pending_event *ev1;
179 HvLpEvent_Rc hv_rc;
180
181 /* enqueue the event */
182 if (ev != NULL) {
183 ev->next = NULL;
184 spin_lock_irqsave(&pending_event_spinlock, flags);
185 if (pending_event_head == NULL)
186 pending_event_head = ev;
187 else {
188 go = 0;
189 pending_event_tail->next = ev;
190 }
191 pending_event_tail = ev;
192 spin_unlock_irqrestore(&pending_event_spinlock, flags);
193 }
194
195 /* send the event */
196 while (go) {
197 go = 0;
198
199 /* any DMA data to send beforehand? */
200 if (pending_event_head->dma_data_length > 0)
201 HvCallEvent_dmaToSp(pending_event_head->dma_data,
202 pending_event_head->remote_address,
203 pending_event_head->dma_data_length,
204 HvLpDma_Direction_LocalToRemote);
205
206 hv_rc = HvCallEvent_signalLpEvent(
207 &pending_event_head->event.hp_lp_event);
208 if (hv_rc != HvLpEvent_Rc_Good) {
209 printk(KERN_ERR "mf.c: HvCallEvent_signalLpEvent() "
210 "failed with %d\n", (int)hv_rc);
211
212 spin_lock_irqsave(&pending_event_spinlock, flags);
213 ev1 = pending_event_head;
214 pending_event_head = pending_event_head->next;
215 if (pending_event_head != NULL)
216 go = 1;
217 spin_unlock_irqrestore(&pending_event_spinlock, flags);
218
219 if (ev1 == ev)
220 rc = -EIO;
221 else if (ev1->hdlr != NULL)
222 (*ev1->hdlr)((void *)ev1->event.hp_lp_event.xCorrelationToken, -EIO);
223
224 spin_lock_irqsave(&pending_event_spinlock, flags);
225 free_pending_event(ev1);
226 spin_unlock_irqrestore(&pending_event_spinlock, flags);
227 }
228 }
229
230 return rc;
231}
232
233/*
234 * Allocate a new pending_event structure, and initialize it.
235 */
236static struct pending_event *new_pending_event(void)
237{
238 struct pending_event *ev = NULL;
239 HvLpIndex primary_lp = HvLpConfig_getPrimaryLpIndex();
240 unsigned long flags;
241 struct HvLpEvent *hev;
242
243 spin_lock_irqsave(&pending_event_spinlock, flags);
244 if (pending_event_avail != NULL) {
245 ev = pending_event_avail;
246 pending_event_avail = pending_event_avail->next;
247 }
248 spin_unlock_irqrestore(&pending_event_spinlock, flags);
249 if (ev == NULL) {
250 ev = kmalloc(sizeof(struct pending_event), GFP_ATOMIC);
251 if (ev == NULL) {
252 printk(KERN_ERR "mf.c: unable to kmalloc %ld bytes\n",
253 sizeof(struct pending_event));
254 return NULL;
255 }
256 }
257 memset(ev, 0, sizeof(struct pending_event));
258 hev = &ev->event.hp_lp_event;
259 hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DO_ACK | HV_LP_EVENT_INT;
260 hev->xType = HvLpEvent_Type_MachineFac;
261 hev->xSourceLp = HvLpConfig_getLpIndex();
262 hev->xTargetLp = primary_lp;
263 hev->xSizeMinus1 = sizeof(ev->event) - 1;
264 hev->xRc = HvLpEvent_Rc_Good;
265 hev->xSourceInstanceId = HvCallEvent_getSourceLpInstanceId(primary_lp,
266 HvLpEvent_Type_MachineFac);
267 hev->xTargetInstanceId = HvCallEvent_getTargetLpInstanceId(primary_lp,
268 HvLpEvent_Type_MachineFac);
269
270 return ev;
271}
272
273static int __maybe_unused
274signal_vsp_instruction(struct vsp_cmd_data *vsp_cmd)
275{
276 struct pending_event *ev = new_pending_event();
277 int rc;
278 struct vsp_rsp_data response;
279
280 if (ev == NULL)
281 return -ENOMEM;
282
283 init_completion(&response.com);
284 response.response = vsp_cmd;
285 ev->event.hp_lp_event.xSubtype = 6;
286 ev->event.hp_lp_event.x.xSubtypeData =
287 subtype_data('M', 'F', 'V', 'I');
288 ev->event.data.vsp_cmd.token = (u64)&response;
289 ev->event.data.vsp_cmd.cmd = vsp_cmd->cmd;
290 ev->event.data.vsp_cmd.lp_index = HvLpConfig_getLpIndex();
291 ev->event.data.vsp_cmd.result_code = 0xFF;
292 ev->event.data.vsp_cmd.reserved = 0;
293 memcpy(&(ev->event.data.vsp_cmd.sub_data),
294 &(vsp_cmd->sub_data), sizeof(vsp_cmd->sub_data));
295 mb();
296
297 rc = signal_event(ev);
298 if (rc == 0)
299 wait_for_completion(&response.com);
300 return rc;
301}
302
303
304/*
305 * Send a 12-byte CE message to the primary partition VSP object
306 */
307static int signal_ce_msg(char *ce_msg, struct ce_msg_comp_data *completion)
308{
309 struct pending_event *ev = new_pending_event();
310
311 if (ev == NULL)
312 return -ENOMEM;
313
314 ev->event.hp_lp_event.xSubtype = 0;
315 ev->event.hp_lp_event.x.xSubtypeData =
316 subtype_data('M', 'F', 'C', 'E');
317 memcpy(ev->event.data.ce_msg.ce_msg, ce_msg, 12);
318 ev->event.data.ce_msg.completion = completion;
319 return signal_event(ev);
320}
321
322/*
323 * Send a 12-byte CE message (with no data) to the primary partition VSP object
324 */
325static int signal_ce_msg_simple(u8 ce_op, struct ce_msg_comp_data *completion)
326{
327 u8 ce_msg[12];
328
329 memset(ce_msg, 0, sizeof(ce_msg));
330 ce_msg[3] = ce_op;
331 return signal_ce_msg(ce_msg, completion);
332}
333
334/*
335 * Send a 12-byte CE message and DMA data to the primary partition VSP object
336 */
337static int dma_and_signal_ce_msg(char *ce_msg,
338 struct ce_msg_comp_data *completion, void *dma_data,
339 unsigned dma_data_length, unsigned remote_address)
340{
341 struct pending_event *ev = new_pending_event();
342
343 if (ev == NULL)
344 return -ENOMEM;
345
346 ev->event.hp_lp_event.xSubtype = 0;
347 ev->event.hp_lp_event.x.xSubtypeData =
348 subtype_data('M', 'F', 'C', 'E');
349 memcpy(ev->event.data.ce_msg.ce_msg, ce_msg, 12);
350 ev->event.data.ce_msg.completion = completion;
351 memcpy(ev->dma_data, dma_data, dma_data_length);
352 ev->dma_data_length = dma_data_length;
353 ev->remote_address = remote_address;
354 return signal_event(ev);
355}
356
357/*
358 * Initiate a nice (hopefully) shutdown of Linux. We simply are
359 * going to try and send the init process a SIGINT signal. If
360 * this fails (why?), we'll simply force it off in a not-so-nice
361 * manner.
362 */
363static int shutdown(void)
364{
365 int rc = kill_cad_pid(SIGINT, 1);
366
367 if (rc) {
368 printk(KERN_ALERT "mf.c: SIGINT to init failed (%d), "
369 "hard shutdown commencing\n", rc);
370 mf_power_off();
371 } else
372 printk(KERN_INFO "mf.c: init has been successfully notified "
373 "to proceed with shutdown\n");
374 return rc;
375}
376
377/*
378 * The primary partition VSP object is sending us a new
379 * event flow. Handle it...
380 */
381static void handle_int(struct io_mf_lp_event *event)
382{
383 struct ce_msg_data *ce_msg_data;
384 struct ce_msg_data *pce_msg_data;
385 unsigned long flags;
386 struct pending_event *pev;
387
388 /* ack the interrupt */
389 event->hp_lp_event.xRc = HvLpEvent_Rc_Good;
390 HvCallEvent_ackLpEvent(&event->hp_lp_event);
391
392 /* process interrupt */
393 switch (event->hp_lp_event.xSubtype) {
394 case 0: /* CE message */
395 ce_msg_data = &event->data.ce_msg;
396 switch (ce_msg_data->ce_msg[3]) {
397 case 0x5B: /* power control notification */
398 if ((ce_msg_data->ce_msg[5] & 0x20) != 0) {
399 printk(KERN_INFO "mf.c: Commencing partition shutdown\n");
400 if (shutdown() == 0)
401 signal_ce_msg_simple(0xDB, NULL);
402 }
403 break;
404 case 0xC0: /* get time */
405 spin_lock_irqsave(&pending_event_spinlock, flags);
406 pev = pending_event_head;
407 if (pev != NULL)
408 pending_event_head = pending_event_head->next;
409 spin_unlock_irqrestore(&pending_event_spinlock, flags);
410 if (pev == NULL)
411 break;
412 pce_msg_data = &pev->event.data.ce_msg;
413 if (pce_msg_data->ce_msg[3] != 0x40)
414 break;
415 if (pce_msg_data->completion != NULL) {
416 ce_msg_comp_hdlr handler =
417 pce_msg_data->completion->handler;
418 void *token = pce_msg_data->completion->token;
419
420 if (handler != NULL)
421 (*handler)(token, ce_msg_data);
422 }
423 spin_lock_irqsave(&pending_event_spinlock, flags);
424 free_pending_event(pev);
425 spin_unlock_irqrestore(&pending_event_spinlock, flags);
426 /* send next waiting event */
427 if (pending_event_head != NULL)
428 signal_event(NULL);
429 break;
430 }
431 break;
432 case 1: /* IT sys shutdown */
433 printk(KERN_INFO "mf.c: Commencing system shutdown\n");
434 shutdown();
435 break;
436 }
437}
438
439/*
440 * The primary partition VSP object is acknowledging the receipt
441 * of a flow we sent to them. If there are other flows queued
442 * up, we must send another one now...
443 */
444static void handle_ack(struct io_mf_lp_event *event)
445{
446 unsigned long flags;
447 struct pending_event *two = NULL;
448 unsigned long free_it = 0;
449 struct ce_msg_data *ce_msg_data;
450 struct ce_msg_data *pce_msg_data;
451 struct vsp_rsp_data *rsp;
452
453 /* handle current event */
454 if (pending_event_head == NULL) {
455 printk(KERN_ERR "mf.c: stack empty for receiving ack\n");
456 return;
457 }
458
459 switch (event->hp_lp_event.xSubtype) {
460 case 0: /* CE msg */
461 ce_msg_data = &event->data.ce_msg;
462 if (ce_msg_data->ce_msg[3] != 0x40) {
463 free_it = 1;
464 break;
465 }
466 if (ce_msg_data->ce_msg[2] == 0)
467 break;
468 free_it = 1;
469 pce_msg_data = &pending_event_head->event.data.ce_msg;
470 if (pce_msg_data->completion != NULL) {
471 ce_msg_comp_hdlr handler =
472 pce_msg_data->completion->handler;
473 void *token = pce_msg_data->completion->token;
474
475 if (handler != NULL)
476 (*handler)(token, ce_msg_data);
477 }
478 break;
479 case 4: /* allocate */
480 case 5: /* deallocate */
481 if (pending_event_head->hdlr != NULL)
482 (*pending_event_head->hdlr)((void *)event->hp_lp_event.xCorrelationToken, event->data.alloc.count);
483 free_it = 1;
484 break;
485 case 6:
486 free_it = 1;
487 rsp = (struct vsp_rsp_data *)event->data.vsp_cmd.token;
488 if (rsp == NULL) {
489 printk(KERN_ERR "mf.c: no rsp\n");
490 break;
491 }
492 if (rsp->response != NULL)
493 memcpy(rsp->response, &event->data.vsp_cmd,
494 sizeof(event->data.vsp_cmd));
495 complete(&rsp->com);
496 break;
497 }
498
499 /* remove from queue */
500 spin_lock_irqsave(&pending_event_spinlock, flags);
501 if ((pending_event_head != NULL) && (free_it == 1)) {
502 struct pending_event *oldHead = pending_event_head;
503
504 pending_event_head = pending_event_head->next;
505 two = pending_event_head;
506 free_pending_event(oldHead);
507 }
508 spin_unlock_irqrestore(&pending_event_spinlock, flags);
509
510 /* send next waiting event */
511 if (two != NULL)
512 signal_event(NULL);
513}
514
515/*
516 * This is the generic event handler we are registering with
517 * the Hypervisor. Ensure the flows are for us, and then
518 * parse it enough to know if it is an interrupt or an
519 * acknowledge.
520 */
521static void hv_handler(struct HvLpEvent *event)
522{
523 if ((event != NULL) && (event->xType == HvLpEvent_Type_MachineFac)) {
524 if (hvlpevent_is_ack(event))
525 handle_ack((struct io_mf_lp_event *)event);
526 else
527 handle_int((struct io_mf_lp_event *)event);
528 } else
529 printk(KERN_ERR "mf.c: alien event received\n");
530}
531
532/*
533 * Global kernel interface to allocate and seed events into the
534 * Hypervisor.
535 */
536void mf_allocate_lp_events(HvLpIndex target_lp, HvLpEvent_Type type,
537 unsigned size, unsigned count, MFCompleteHandler hdlr,
538 void *user_token)
539{
540 struct pending_event *ev = new_pending_event();
541 int rc;
542
543 if (ev == NULL) {
544 rc = -ENOMEM;
545 } else {
546 ev->event.hp_lp_event.xSubtype = 4;
547 ev->event.hp_lp_event.xCorrelationToken = (u64)user_token;
548 ev->event.hp_lp_event.x.xSubtypeData =
549 subtype_data('M', 'F', 'M', 'A');
550 ev->event.data.alloc.target_lp = target_lp;
551 ev->event.data.alloc.type = type;
552 ev->event.data.alloc.size = size;
553 ev->event.data.alloc.count = count;
554 ev->hdlr = hdlr;
555 rc = signal_event(ev);
556 }
557 if ((rc != 0) && (hdlr != NULL))
558 (*hdlr)(user_token, rc);
559}
560EXPORT_SYMBOL(mf_allocate_lp_events);
561
562/*
563 * Global kernel interface to unseed and deallocate events already in
564 * Hypervisor.
565 */
566void mf_deallocate_lp_events(HvLpIndex target_lp, HvLpEvent_Type type,
567 unsigned count, MFCompleteHandler hdlr, void *user_token)
568{
569 struct pending_event *ev = new_pending_event();
570 int rc;
571
572 if (ev == NULL)
573 rc = -ENOMEM;
574 else {
575 ev->event.hp_lp_event.xSubtype = 5;
576 ev->event.hp_lp_event.xCorrelationToken = (u64)user_token;
577 ev->event.hp_lp_event.x.xSubtypeData =
578 subtype_data('M', 'F', 'M', 'D');
579 ev->event.data.alloc.target_lp = target_lp;
580 ev->event.data.alloc.type = type;
581 ev->event.data.alloc.count = count;
582 ev->hdlr = hdlr;
583 rc = signal_event(ev);
584 }
585 if ((rc != 0) && (hdlr != NULL))
586 (*hdlr)(user_token, rc);
587}
588EXPORT_SYMBOL(mf_deallocate_lp_events);
589
590/*
591 * Global kernel interface to tell the VSP object in the primary
592 * partition to power this partition off.
593 */
594void mf_power_off(void)
595{
596 printk(KERN_INFO "mf.c: Down it goes...\n");
597 signal_ce_msg_simple(0x4d, NULL);
598 for (;;)
599 ;
600}
601
602/*
603 * Global kernel interface to tell the VSP object in the primary
604 * partition to reboot this partition.
605 */
606void mf_reboot(char *cmd)
607{
608 printk(KERN_INFO "mf.c: Preparing to bounce...\n");
609 signal_ce_msg_simple(0x4e, NULL);
610 for (;;)
611 ;
612}
613
614/*
615 * Display a single word SRC onto the VSP control panel.
616 */
617void mf_display_src(u32 word)
618{
619 u8 ce[12];
620
621 memset(ce, 0, sizeof(ce));
622 ce[3] = 0x4a;
623 ce[7] = 0x01;
624 ce[8] = word >> 24;
625 ce[9] = word >> 16;
626 ce[10] = word >> 8;
627 ce[11] = word;
628 signal_ce_msg(ce, NULL);
629}
630
631/*
632 * Display a single word SRC of the form "PROGXXXX" on the VSP control panel.
633 */
634static __init void mf_display_progress_src(u16 value)
635{
636 u8 ce[12];
637 u8 src[72];
638
639 memcpy(ce, "\x00\x00\x04\x4A\x00\x00\x00\x48\x00\x00\x00\x00", 12);
640 memcpy(src, "\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
641 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
642 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
643 "\x00\x00\x00\x00PROGxxxx ",
644 72);
645 src[6] = value >> 8;
646 src[7] = value & 255;
647 src[44] = "0123456789ABCDEF"[(value >> 12) & 15];
648 src[45] = "0123456789ABCDEF"[(value >> 8) & 15];
649 src[46] = "0123456789ABCDEF"[(value >> 4) & 15];
650 src[47] = "0123456789ABCDEF"[value & 15];
651 dma_and_signal_ce_msg(ce, NULL, src, sizeof(src), 9 * 64 * 1024);
652}
653
654/*
655 * Clear the VSP control panel. Used to "erase" an SRC that was
656 * previously displayed.
657 */
658static void mf_clear_src(void)
659{
660 signal_ce_msg_simple(0x4b, NULL);
661}
662
663void __init mf_display_progress(u16 value)
664{
665 if (!mf_initialized)
666 return;
667
668 if (0xFFFF == value)
669 mf_clear_src();
670 else
671 mf_display_progress_src(value);
672}
673
674/*
675 * Initialization code here.
676 */
677void __init mf_init(void)
678{
679 int i;
680
681 spin_lock_init(&pending_event_spinlock);
682
683 for (i = 0; i < PENDING_EVENT_PREALLOC_LEN; i++)
684 free_pending_event(&pending_event_prealloc[i]);
685
686 HvLpEvent_registerHandler(HvLpEvent_Type_MachineFac, &hv_handler);
687
688 /* virtual continue ack */
689 signal_ce_msg_simple(0x57, NULL);
690
691 mf_initialized = 1;
692 mb();
693
694 printk(KERN_NOTICE "mf.c: iSeries Linux LPAR Machine Facilities "
695 "initialized\n");
696}
697
698struct rtc_time_data {
699 struct completion com;
700 struct ce_msg_data ce_msg;
701 int rc;
702};
703
704static void get_rtc_time_complete(void *token, struct ce_msg_data *ce_msg)
705{
706 struct rtc_time_data *rtc = token;
707
708 memcpy(&rtc->ce_msg, ce_msg, sizeof(rtc->ce_msg));
709 rtc->rc = 0;
710 complete(&rtc->com);
711}
712
713static int mf_set_rtc(struct rtc_time *tm)
714{
715 char ce_time[12];
716 u8 day, mon, hour, min, sec, y1, y2;
717 unsigned year;
718
719 year = 1900 + tm->tm_year;
720 y1 = year / 100;
721 y2 = year % 100;
722
723 sec = tm->tm_sec;
724 min = tm->tm_min;
725 hour = tm->tm_hour;
726 day = tm->tm_mday;
727 mon = tm->tm_mon + 1;
728
729 sec = bin2bcd(sec);
730 min = bin2bcd(min);
731 hour = bin2bcd(hour);
732 mon = bin2bcd(mon);
733 day = bin2bcd(day);
734 y1 = bin2bcd(y1);
735 y2 = bin2bcd(y2);
736
737 memset(ce_time, 0, sizeof(ce_time));
738 ce_time[3] = 0x41;
739 ce_time[4] = y1;
740 ce_time[5] = y2;
741 ce_time[6] = sec;
742 ce_time[7] = min;
743 ce_time[8] = hour;
744 ce_time[10] = day;
745 ce_time[11] = mon;
746
747 return signal_ce_msg(ce_time, NULL);
748}
749
750static int rtc_set_tm(int rc, u8 *ce_msg, struct rtc_time *tm)
751{
752 tm->tm_wday = 0;
753 tm->tm_yday = 0;
754 tm->tm_isdst = 0;
755 if (rc) {
756 tm->tm_sec = 0;
757 tm->tm_min = 0;
758 tm->tm_hour = 0;
759 tm->tm_mday = 15;
760 tm->tm_mon = 5;
761 tm->tm_year = 52;
762 return rc;
763 }
764
765 if ((ce_msg[2] == 0xa9) ||
766 (ce_msg[2] == 0xaf)) {
767 /* TOD clock is not set */
768 tm->tm_sec = 1;
769 tm->tm_min = 1;
770 tm->tm_hour = 1;
771 tm->tm_mday = 10;
772 tm->tm_mon = 8;
773 tm->tm_year = 71;
774 mf_set_rtc(tm);
775 }
776 {
777 u8 year = ce_msg[5];
778 u8 sec = ce_msg[6];
779 u8 min = ce_msg[7];
780 u8 hour = ce_msg[8];
781 u8 day = ce_msg[10];
782 u8 mon = ce_msg[11];
783
784 sec = bcd2bin(sec);
785 min = bcd2bin(min);
786 hour = bcd2bin(hour);
787 day = bcd2bin(day);
788 mon = bcd2bin(mon);
789 year = bcd2bin(year);
790
791 if (year <= 69)
792 year += 100;
793
794 tm->tm_sec = sec;
795 tm->tm_min = min;
796 tm->tm_hour = hour;
797 tm->tm_mday = day;
798 tm->tm_mon = mon;
799 tm->tm_year = year;
800 }
801
802 return 0;
803}
804
805static int mf_get_rtc(struct rtc_time *tm)
806{
807 struct ce_msg_comp_data ce_complete;
808 struct rtc_time_data rtc_data;
809 int rc;
810
811 memset(&ce_complete, 0, sizeof(ce_complete));
812 memset(&rtc_data, 0, sizeof(rtc_data));
813 init_completion(&rtc_data.com);
814 ce_complete.handler = &get_rtc_time_complete;
815 ce_complete.token = &rtc_data;
816 rc = signal_ce_msg_simple(0x40, &ce_complete);
817 if (rc)
818 return rc;
819 wait_for_completion(&rtc_data.com);
820 return rtc_set_tm(rtc_data.rc, rtc_data.ce_msg.ce_msg, tm);
821}
822
823struct boot_rtc_time_data {
824 int busy;
825 struct ce_msg_data ce_msg;
826 int rc;
827};
828
829static void get_boot_rtc_time_complete(void *token, struct ce_msg_data *ce_msg)
830{
831 struct boot_rtc_time_data *rtc = token;
832
833 memcpy(&rtc->ce_msg, ce_msg, sizeof(rtc->ce_msg));
834 rtc->rc = 0;
835 rtc->busy = 0;
836}
837
838static int mf_get_boot_rtc(struct rtc_time *tm)
839{
840 struct ce_msg_comp_data ce_complete;
841 struct boot_rtc_time_data rtc_data;
842 int rc;
843
844 memset(&ce_complete, 0, sizeof(ce_complete));
845 memset(&rtc_data, 0, sizeof(rtc_data));
846 rtc_data.busy = 1;
847 ce_complete.handler = &get_boot_rtc_time_complete;
848 ce_complete.token = &rtc_data;
849 rc = signal_ce_msg_simple(0x40, &ce_complete);
850 if (rc)
851 return rc;
852 /* We need to poll here as we are not yet taking interrupts */
853 while (rtc_data.busy) {
854 if (hvlpevent_is_pending())
855 process_hvlpevents();
856 }
857 return rtc_set_tm(rtc_data.rc, rtc_data.ce_msg.ce_msg, tm);
858}
859
860#ifdef CONFIG_PROC_FS
861static int mf_cmdline_proc_show(struct seq_file *m, void *v)
862{
863 char *page, *p;
864 struct vsp_cmd_data vsp_cmd;
865 int rc;
866 dma_addr_t dma_addr;
867
868 /* The HV appears to return no more than 256 bytes of command line */
869 page = kmalloc(256, GFP_KERNEL);
870 if (!page)
871 return -ENOMEM;
872
873 dma_addr = iseries_hv_map(page, 256, DMA_FROM_DEVICE);
874 if (dma_addr == DMA_ERROR_CODE) {
875 kfree(page);
876 return -ENOMEM;
877 }
878 memset(page, 0, 256);
879 memset(&vsp_cmd, 0, sizeof(vsp_cmd));
880 vsp_cmd.cmd = 33;
881 vsp_cmd.sub_data.kern.token = dma_addr;
882 vsp_cmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex;
883 vsp_cmd.sub_data.kern.side = (u64)m->private;
884 vsp_cmd.sub_data.kern.length = 256;
885 mb();
886 rc = signal_vsp_instruction(&vsp_cmd);
887 iseries_hv_unmap(dma_addr, 256, DMA_FROM_DEVICE);
888 if (rc) {
889 kfree(page);
890 return rc;
891 }
892 if (vsp_cmd.result_code != 0) {
893 kfree(page);
894 return -ENOMEM;
895 }
896 p = page;
897 while (p - page < 256) {
898 if (*p == '\0' || *p == '\n') {
899 *p = '\n';
900 break;
901 }
902 p++;
903
904 }
905 seq_write(m, page, p - page);
906 kfree(page);
907 return 0;
908}
909
910static int mf_cmdline_proc_open(struct inode *inode, struct file *file)
911{
912 return single_open(file, mf_cmdline_proc_show, PDE(inode)->data);
913}
914
915#if 0
916static int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side)
917{
918 struct vsp_cmd_data vsp_cmd;
919 int rc;
920 int len = *size;
921 dma_addr_t dma_addr;
922
923 dma_addr = iseries_hv_map(buffer, len, DMA_FROM_DEVICE);
924 memset(buffer, 0, len);
925 memset(&vsp_cmd, 0, sizeof(vsp_cmd));
926 vsp_cmd.cmd = 32;
927 vsp_cmd.sub_data.kern.token = dma_addr;
928 vsp_cmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex;
929 vsp_cmd.sub_data.kern.side = side;
930 vsp_cmd.sub_data.kern.offset = offset;
931 vsp_cmd.sub_data.kern.length = len;
932 mb();
933 rc = signal_vsp_instruction(&vsp_cmd);
934 if (rc == 0) {
935 if (vsp_cmd.result_code == 0)
936 *size = vsp_cmd.sub_data.length_out;
937 else
938 rc = -ENOMEM;
939 }
940
941 iseries_hv_unmap(dma_addr, len, DMA_FROM_DEVICE);
942
943 return rc;
944}
945
946static int proc_mf_dump_vmlinux(char *page, char **start, off_t off,
947 int count, int *eof, void *data)
948{
949 int sizeToGet = count;
950
951 if (!capable(CAP_SYS_ADMIN))
952 return -EACCES;
953
954 if (mf_getVmlinuxChunk(page, &sizeToGet, off, (u64)data) == 0) {
955 if (sizeToGet != 0) {
956 *start = page + off;
957 return sizeToGet;
958 }
959 *eof = 1;
960 return 0;
961 }
962 *eof = 1;
963 return 0;
964}
965#endif
966
967static int mf_side_proc_show(struct seq_file *m, void *v)
968{
969 char mf_current_side = ' ';
970 struct vsp_cmd_data vsp_cmd;
971
972 memset(&vsp_cmd, 0, sizeof(vsp_cmd));
973 vsp_cmd.cmd = 2;
974 vsp_cmd.sub_data.ipl_type = 0;
975 mb();
976
977 if (signal_vsp_instruction(&vsp_cmd) == 0) {
978 if (vsp_cmd.result_code == 0) {
979 switch (vsp_cmd.sub_data.ipl_type) {
980 case 0: mf_current_side = 'A';
981 break;
982 case 1: mf_current_side = 'B';
983 break;
984 case 2: mf_current_side = 'C';
985 break;
986 default: mf_current_side = 'D';
987 break;
988 }
989 }
990 }
991
992 seq_printf(m, "%c\n", mf_current_side);
993 return 0;
994}
995
996static int mf_side_proc_open(struct inode *inode, struct file *file)
997{
998 return single_open(file, mf_side_proc_show, NULL);
999}
1000
1001static ssize_t mf_side_proc_write(struct file *file, const char __user *buffer,
1002 size_t count, loff_t *pos)
1003{
1004 char side;
1005 u64 newSide;
1006 struct vsp_cmd_data vsp_cmd;
1007
1008 if (!capable(CAP_SYS_ADMIN))
1009 return -EACCES;
1010
1011 if (count == 0)
1012 return 0;
1013
1014 if (get_user(side, buffer))
1015 return -EFAULT;
1016
1017 switch (side) {
1018 case 'A': newSide = 0;
1019 break;
1020 case 'B': newSide = 1;
1021 break;
1022 case 'C': newSide = 2;
1023 break;
1024 case 'D': newSide = 3;
1025 break;
1026 default:
1027 printk(KERN_ERR "mf_proc.c: proc_mf_change_side: invalid side\n");
1028 return -EINVAL;
1029 }
1030
1031 memset(&vsp_cmd, 0, sizeof(vsp_cmd));
1032 vsp_cmd.sub_data.ipl_type = newSide;
1033 vsp_cmd.cmd = 10;
1034
1035 (void)signal_vsp_instruction(&vsp_cmd);
1036
1037 return count;
1038}
1039
1040static const struct file_operations mf_side_proc_fops = {
1041 .owner = THIS_MODULE,
1042 .open = mf_side_proc_open,
1043 .read = seq_read,
1044 .llseek = seq_lseek,
1045 .release = single_release,
1046 .write = mf_side_proc_write,
1047};
1048
1049static int mf_src_proc_show(struct seq_file *m, void *v)
1050{
1051 return 0;
1052}
1053
1054static int mf_src_proc_open(struct inode *inode, struct file *file)
1055{
1056 return single_open(file, mf_src_proc_show, NULL);
1057}
1058
1059static ssize_t mf_src_proc_write(struct file *file, const char __user *buffer,
1060 size_t count, loff_t *pos)
1061{
1062 char stkbuf[10];
1063
1064 if (!capable(CAP_SYS_ADMIN))
1065 return -EACCES;
1066
1067 if ((count < 4) && (count != 1)) {
1068 printk(KERN_ERR "mf_proc: invalid src\n");
1069 return -EINVAL;
1070 }
1071
1072 if (count > (sizeof(stkbuf) - 1))
1073 count = sizeof(stkbuf) - 1;
1074 if (copy_from_user(stkbuf, buffer, count))
1075 return -EFAULT;
1076
1077 if ((count == 1) && (*stkbuf == '\0'))
1078 mf_clear_src();
1079 else
1080 mf_display_src(*(u32 *)stkbuf);
1081
1082 return count;
1083}
1084
1085static const struct file_operations mf_src_proc_fops = {
1086 .owner = THIS_MODULE,
1087 .open = mf_src_proc_open,
1088 .read = seq_read,
1089 .llseek = seq_lseek,
1090 .release = single_release,
1091 .write = mf_src_proc_write,
1092};
1093
1094static ssize_t mf_cmdline_proc_write(struct file *file, const char __user *buffer,
1095 size_t count, loff_t *pos)
1096{
1097 void *data = PDE(file->f_path.dentry->d_inode)->data;
1098 struct vsp_cmd_data vsp_cmd;
1099 dma_addr_t dma_addr;
1100 char *page;
1101 int ret = -EACCES;
1102
1103 if (!capable(CAP_SYS_ADMIN))
1104 goto out;
1105
1106 dma_addr = 0;
1107 page = iseries_hv_alloc(count, &dma_addr, GFP_ATOMIC);
1108 ret = -ENOMEM;
1109 if (page == NULL)
1110 goto out;
1111
1112 ret = -EFAULT;
1113 if (copy_from_user(page, buffer, count))
1114 goto out_free;
1115
1116 memset(&vsp_cmd, 0, sizeof(vsp_cmd));
1117 vsp_cmd.cmd = 31;
1118 vsp_cmd.sub_data.kern.token = dma_addr;
1119 vsp_cmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex;
1120 vsp_cmd.sub_data.kern.side = (u64)data;
1121 vsp_cmd.sub_data.kern.length = count;
1122 mb();
1123 (void)signal_vsp_instruction(&vsp_cmd);
1124 ret = count;
1125
1126out_free:
1127 iseries_hv_free(count, page, dma_addr);
1128out:
1129 return ret;
1130}
1131
1132static const struct file_operations mf_cmdline_proc_fops = {
1133 .owner = THIS_MODULE,
1134 .open = mf_cmdline_proc_open,
1135 .read = seq_read,
1136 .llseek = seq_lseek,
1137 .release = single_release,
1138 .write = mf_cmdline_proc_write,
1139};
1140
1141static ssize_t proc_mf_change_vmlinux(struct file *file,
1142 const char __user *buf,
1143 size_t count, loff_t *ppos)
1144{
1145 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
1146 ssize_t rc;
1147 dma_addr_t dma_addr;
1148 char *page;
1149 struct vsp_cmd_data vsp_cmd;
1150
1151 rc = -EACCES;
1152 if (!capable(CAP_SYS_ADMIN))
1153 goto out;
1154
1155 dma_addr = 0;
1156 page = iseries_hv_alloc(count, &dma_addr, GFP_ATOMIC);
1157 rc = -ENOMEM;
1158 if (page == NULL) {
1159 printk(KERN_ERR "mf.c: couldn't allocate memory to set vmlinux chunk\n");
1160 goto out;
1161 }
1162 rc = -EFAULT;
1163 if (copy_from_user(page, buf, count))
1164 goto out_free;
1165
1166 memset(&vsp_cmd, 0, sizeof(vsp_cmd));
1167 vsp_cmd.cmd = 30;
1168 vsp_cmd.sub_data.kern.token = dma_addr;
1169 vsp_cmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex;
1170 vsp_cmd.sub_data.kern.side = (u64)dp->data;
1171 vsp_cmd.sub_data.kern.offset = *ppos;
1172 vsp_cmd.sub_data.kern.length = count;
1173 mb();
1174 rc = signal_vsp_instruction(&vsp_cmd);
1175 if (rc)
1176 goto out_free;
1177 rc = -ENOMEM;
1178 if (vsp_cmd.result_code != 0)
1179 goto out_free;
1180
1181 *ppos += count;
1182 rc = count;
1183out_free:
1184 iseries_hv_free(count, page, dma_addr);
1185out:
1186 return rc;
1187}
1188
1189static const struct file_operations proc_vmlinux_operations = {
1190 .write = proc_mf_change_vmlinux,
1191 .llseek = default_llseek,
1192};
1193
1194static int __init mf_proc_init(void)
1195{
1196 struct proc_dir_entry *mf_proc_root;
1197 struct proc_dir_entry *ent;
1198 struct proc_dir_entry *mf;
1199 char name[2];
1200 int i;
1201
1202 if (!firmware_has_feature(FW_FEATURE_ISERIES))
1203 return 0;
1204
1205 mf_proc_root = proc_mkdir("iSeries/mf", NULL);
1206 if (!mf_proc_root)
1207 return 1;
1208
1209 name[1] = '\0';
1210 for (i = 0; i < 4; i++) {
1211 name[0] = 'A' + i;
1212 mf = proc_mkdir(name, mf_proc_root);
1213 if (!mf)
1214 return 1;
1215
1216 ent = proc_create_data("cmdline", S_IRUSR|S_IWUSR, mf,
1217 &mf_cmdline_proc_fops, (void *)(long)i);
1218 if (!ent)
1219 return 1;
1220
1221 if (i == 3) /* no vmlinux entry for 'D' */
1222 continue;
1223
1224 ent = proc_create_data("vmlinux", S_IFREG|S_IWUSR, mf,
1225 &proc_vmlinux_operations,
1226 (void *)(long)i);
1227 if (!ent)
1228 return 1;
1229 }
1230
1231 ent = proc_create("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root,
1232 &mf_side_proc_fops);
1233 if (!ent)
1234 return 1;
1235
1236 ent = proc_create("src", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root,
1237 &mf_src_proc_fops);
1238 if (!ent)
1239 return 1;
1240
1241 return 0;
1242}
1243
1244__initcall(mf_proc_init);
1245
1246#endif /* CONFIG_PROC_FS */
1247
1248/*
1249 * Get the RTC from the virtual service processor
1250 * This requires flowing LpEvents to the primary partition
1251 */
1252void iSeries_get_rtc_time(struct rtc_time *rtc_tm)
1253{
1254 mf_get_rtc(rtc_tm);
1255 rtc_tm->tm_mon--;
1256}
1257
1258/*
1259 * Set the RTC in the virtual service processor
1260 * This requires flowing LpEvents to the primary partition
1261 */
1262int iSeries_set_rtc_time(struct rtc_time *tm)
1263{
1264 mf_set_rtc(tm);
1265 return 0;
1266}
1267
1268unsigned long iSeries_get_boot_time(void)
1269{
1270 struct rtc_time tm;
1271
1272 mf_get_boot_rtc(&tm);
1273 return mktime(tm.tm_year + 1900, tm.tm_mon, tm.tm_mday,
1274 tm.tm_hour, tm.tm_min, tm.tm_sec);
1275}
diff --git a/arch/powerpc/platforms/iseries/misc.S b/arch/powerpc/platforms/iseries/misc.S
deleted file mode 100644
index 2c6ff0fdac9..00000000000
--- a/arch/powerpc/platforms/iseries/misc.S
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * This file contains miscellaneous low-level functions.
3 * Copyright (C) 1995-2005 IBM Corp
4 *
5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
6 * and Paul Mackerras.
7 * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
8 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <asm/processor.h>
17#include <asm/asm-offsets.h>
18#include <asm/ppc_asm.h>
19
20 .text
21
22/* Handle pending interrupts in interrupt context */
23_GLOBAL(iseries_handle_interrupts)
24 li r0,0x5555
25 sc
26 blr
diff --git a/arch/powerpc/platforms/iseries/naca.h b/arch/powerpc/platforms/iseries/naca.h
deleted file mode 100644
index f01708e1286..00000000000
--- a/arch/powerpc/platforms/iseries/naca.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef _PLATFORMS_ISERIES_NACA_H
2#define _PLATFORMS_ISERIES_NACA_H
3
4/*
5 * c 2001 PPC 64 Team, IBM Corp
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <asm/types.h>
14
15struct naca_struct {
16 /* Kernel only data - undefined for user space */
17 const void *xItVpdAreas; /* VPD Data 0x00 */
18 void *xRamDisk; /* iSeries ramdisk 0x08 */
19 u64 xRamDiskSize; /* In pages 0x10 */
20};
21
22extern struct naca_struct naca;
23
24#endif /* _PLATFORMS_ISERIES_NACA_H */
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
deleted file mode 100644
index c7541288462..00000000000
--- a/arch/powerpc/platforms/iseries/pci.c
+++ /dev/null
@@ -1,919 +0,0 @@
1/*
2 * Copyright (C) 2001 Allan Trautman, IBM Corporation
3 * Copyright (C) 2005,2007 Stephen Rothwell, IBM Corp
4 *
5 * iSeries specific routines for PCI.
6 *
7 * Based on code from pci.c and iSeries_pci.c 32bit
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#undef DEBUG
25
26#include <linux/jiffies.h>
27#include <linux/kernel.h>
28#include <linux/list.h>
29#include <linux/string.h>
30#include <linux/slab.h>
31#include <linux/init.h>
32#include <linux/pci.h>
33#include <linux/of.h>
34#include <linux/ratelimit.h>
35
36#include <asm/types.h>
37#include <asm/io.h>
38#include <asm/irq.h>
39#include <asm/prom.h>
40#include <asm/machdep.h>
41#include <asm/pci-bridge.h>
42#include <asm/iommu.h>
43#include <asm/abs_addr.h>
44#include <asm/firmware.h>
45
46#include <asm/iseries/hv_types.h>
47#include <asm/iseries/hv_call_xm.h>
48#include <asm/iseries/mf.h>
49#include <asm/iseries/iommu.h>
50
51#include <asm/ppc-pci.h>
52
53#include "irq.h"
54#include "pci.h"
55#include "call_pci.h"
56
57#define PCI_RETRY_MAX 3
58static int limit_pci_retries = 1; /* Set Retry Error on. */
59
60/*
61 * Table defines
62 * Each Entry size is 4 MB * 1024 Entries = 4GB I/O address space.
63 */
64#define IOMM_TABLE_MAX_ENTRIES 1024
65#define IOMM_TABLE_ENTRY_SIZE 0x0000000000400000UL
66#define BASE_IO_MEMORY 0xE000000000000000UL
67#define END_IO_MEMORY 0xEFFFFFFFFFFFFFFFUL
68
69static unsigned long max_io_memory = BASE_IO_MEMORY;
70static long current_iomm_table_entry;
71
72/*
73 * Lookup Tables.
74 */
75static struct device_node *iomm_table[IOMM_TABLE_MAX_ENTRIES];
76static u64 ds_addr_table[IOMM_TABLE_MAX_ENTRIES];
77
78static DEFINE_SPINLOCK(iomm_table_lock);
79
80/*
81 * Generate a Direct Select Address for the Hypervisor
82 */
83static inline u64 iseries_ds_addr(struct device_node *node)
84{
85 struct pci_dn *pdn = PCI_DN(node);
86 const u32 *sbp = of_get_property(node, "linux,subbus", NULL);
87
88 return ((u64)pdn->busno << 48) + ((u64)(sbp ? *sbp : 0) << 40)
89 + ((u64)0x10 << 32);
90}
91
92/*
93 * Size of Bus VPD data
94 */
95#define BUS_VPDSIZE 1024
96
97/*
98 * Bus Vpd Tags
99 */
100#define VPD_END_OF_AREA 0x79
101#define VPD_ID_STRING 0x82
102#define VPD_VENDOR_AREA 0x84
103
104/*
105 * Mfg Area Tags
106 */
107#define VPD_FRU_FRAME_ID 0x4649 /* "FI" */
108#define VPD_SLOT_MAP_FORMAT 0x4D46 /* "MF" */
109#define VPD_SLOT_MAP 0x534D /* "SM" */
110
111/*
112 * Structures of the areas
113 */
114struct mfg_vpd_area {
115 u16 tag;
116 u8 length;
117 u8 data1;
118 u8 data2;
119};
120#define MFG_ENTRY_SIZE 3
121
122struct slot_map {
123 u8 agent;
124 u8 secondary_agent;
125 u8 phb;
126 char card_location[3];
127 char parms[8];
128 char reserved[2];
129};
130#define SLOT_ENTRY_SIZE 16
131
132/*
133 * Parse the Slot Area
134 */
135static void __init iseries_parse_slot_area(struct slot_map *map, int len,
136 HvAgentId agent, u8 *phb, char card[4])
137{
138 /*
139 * Parse Slot label until we find the one requested
140 */
141 while (len > 0) {
142 if (map->agent == agent) {
143 /*
144 * If Phb wasn't found, grab the entry first one found.
145 */
146 if (*phb == 0xff)
147 *phb = map->phb;
148 /* Found it, extract the data. */
149 if (map->phb == *phb) {
150 memcpy(card, &map->card_location, 3);
151 card[3] = 0;
152 break;
153 }
154 }
155 /* Point to the next Slot */
156 map = (struct slot_map *)((char *)map + SLOT_ENTRY_SIZE);
157 len -= SLOT_ENTRY_SIZE;
158 }
159}
160
161/*
162 * Parse the Mfg Area
163 */
164static void __init iseries_parse_mfg_area(struct mfg_vpd_area *area, int len,
165 HvAgentId agent, u8 *phb, u8 *frame, char card[4])
166{
167 u16 slot_map_fmt = 0;
168
169 /* Parse Mfg Data */
170 while (len > 0) {
171 int mfg_tag_len = area->length;
172 /* Frame ID (FI 4649020310 ) */
173 if (area->tag == VPD_FRU_FRAME_ID)
174 *frame = area->data1;
175 /* Slot Map Format (MF 4D46020004 ) */
176 else if (area->tag == VPD_SLOT_MAP_FORMAT)
177 slot_map_fmt = (area->data1 * 256)
178 + area->data2;
179 /* Slot Map (SM 534D90 */
180 else if (area->tag == VPD_SLOT_MAP) {
181 struct slot_map *slot_map;
182
183 if (slot_map_fmt == 0x1004)
184 slot_map = (struct slot_map *)((char *)area
185 + MFG_ENTRY_SIZE + 1);
186 else
187 slot_map = (struct slot_map *)((char *)area
188 + MFG_ENTRY_SIZE);
189 iseries_parse_slot_area(slot_map, mfg_tag_len,
190 agent, phb, card);
191 }
192 /*
193 * Point to the next Mfg Area
194 * Use defined size, sizeof give wrong answer
195 */
196 area = (struct mfg_vpd_area *)((char *)area + mfg_tag_len
197 + MFG_ENTRY_SIZE);
198 len -= (mfg_tag_len + MFG_ENTRY_SIZE);
199 }
200}
201
202/*
203 * Look for "BUS".. Data is not Null terminated.
204 * PHBID of 0xFF indicates PHB was not found in VPD Data.
205 */
206static u8 __init iseries_parse_phbid(u8 *area, int len)
207{
208 while (len > 0) {
209 if ((*area == 'B') && (*(area + 1) == 'U')
210 && (*(area + 2) == 'S')) {
211 area += 3;
212 while (*area == ' ')
213 area++;
214 return *area & 0x0F;
215 }
216 area++;
217 len--;
218 }
219 return 0xff;
220}
221
222/*
223 * Parse out the VPD Areas
224 */
225static void __init iseries_parse_vpd(u8 *data, int data_len,
226 HvAgentId agent, u8 *frame, char card[4])
227{
228 u8 phb = 0xff;
229
230 while (data_len > 0) {
231 int len;
232 u8 tag = *data;
233
234 if (tag == VPD_END_OF_AREA)
235 break;
236 len = *(data + 1) + (*(data + 2) * 256);
237 data += 3;
238 data_len -= 3;
239 if (tag == VPD_ID_STRING)
240 phb = iseries_parse_phbid(data, len);
241 else if (tag == VPD_VENDOR_AREA)
242 iseries_parse_mfg_area((struct mfg_vpd_area *)data, len,
243 agent, &phb, frame, card);
244 /* Point to next Area. */
245 data += len;
246 data_len -= len;
247 }
248}
249
250static int __init iseries_get_location_code(u16 bus, HvAgentId agent,
251 u8 *frame, char card[4])
252{
253 int status = 0;
254 int bus_vpd_len = 0;
255 u8 *bus_vpd = kmalloc(BUS_VPDSIZE, GFP_KERNEL);
256
257 if (bus_vpd == NULL) {
258 printk("PCI: Bus VPD Buffer allocation failure.\n");
259 return 0;
260 }
261 bus_vpd_len = HvCallPci_getBusVpd(bus, iseries_hv_addr(bus_vpd),
262 BUS_VPDSIZE);
263 if (bus_vpd_len == 0) {
264 printk("PCI: Bus VPD Buffer zero length.\n");
265 goto out_free;
266 }
267 /* printk("PCI: bus_vpd: %p, %d\n",bus_vpd, bus_vpd_len); */
268 /* Make sure this is what I think it is */
269 if (*bus_vpd != VPD_ID_STRING) {
270 printk("PCI: Bus VPD Buffer missing starting tag.\n");
271 goto out_free;
272 }
273 iseries_parse_vpd(bus_vpd, bus_vpd_len, agent, frame, card);
274 status = 1;
275out_free:
276 kfree(bus_vpd);
277 return status;
278}
279
280/*
281 * Prints the device information.
282 * - Pass in pci_dev* pointer to the device.
283 * - Pass in the device count
284 *
285 * Format:
286 * PCI: Bus 0, Device 26, Vendor 0x12AE Frame 1, Card C10 Ethernet
287 * controller
288 */
289static void __init iseries_device_information(struct pci_dev *pdev,
290 u16 bus, HvSubBusNumber subbus)
291{
292 u8 frame = 0;
293 char card[4];
294 HvAgentId agent;
295
296 agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
297 ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
298
299 if (iseries_get_location_code(bus, agent, &frame, card)) {
300 printk(KERN_INFO "PCI: %s, Vendor %04X Frame%3d, "
301 "Card %4s 0x%04X\n", pci_name(pdev), pdev->vendor,
302 frame, card, (int)(pdev->class >> 8));
303 }
304}
305
306/*
307 * iomm_table_allocate_entry
308 *
309 * Adds pci_dev entry in address translation table
310 *
311 * - Allocates the number of entries required in table base on BAR
312 * size.
313 * - Allocates starting at BASE_IO_MEMORY and increases.
314 * - The size is round up to be a multiple of entry size.
315 * - CurrentIndex is incremented to keep track of the last entry.
316 * - Builds the resource entry for allocated BARs.
317 */
318static void __init iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
319{
320 struct resource *bar_res = &dev->resource[bar_num];
321 long bar_size = pci_resource_len(dev, bar_num);
322 struct device_node *dn = pci_device_to_OF_node(dev);
323
324 /*
325 * No space to allocate, quick exit, skip Allocation.
326 */
327 if (bar_size == 0)
328 return;
329 /*
330 * Set Resource values.
331 */
332 spin_lock(&iomm_table_lock);
333 bar_res->start = BASE_IO_MEMORY +
334 IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry;
335 bar_res->end = bar_res->start + bar_size - 1;
336 /*
337 * Allocate the number of table entries needed for BAR.
338 */
339 while (bar_size > 0 ) {
340 iomm_table[current_iomm_table_entry] = dn;
341 ds_addr_table[current_iomm_table_entry] =
342 iseries_ds_addr(dn) | (bar_num << 24);
343 bar_size -= IOMM_TABLE_ENTRY_SIZE;
344 ++current_iomm_table_entry;
345 }
346 max_io_memory = BASE_IO_MEMORY +
347 IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry;
348 spin_unlock(&iomm_table_lock);
349}
350
351/*
352 * allocate_device_bars
353 *
354 * - Allocates ALL pci_dev BAR's and updates the resources with the
355 * BAR value. BARS with zero length will have the resources
356 * The HvCallPci_getBarParms is used to get the size of the BAR
357 * space. It calls iomm_table_allocate_entry to allocate
358 * each entry.
359 * - Loops through The Bar resources(0 - 5) including the ROM
360 * is resource(6).
361 */
362static void __init allocate_device_bars(struct pci_dev *dev)
363{
364 int bar_num;
365
366 for (bar_num = 0; bar_num <= PCI_ROM_RESOURCE; ++bar_num)
367 iomm_table_allocate_entry(dev, bar_num);
368}
369
370/*
371 * Log error information to system console.
372 * Filter out the device not there errors.
373 * PCI: EADs Connect Failed 0x18.58.10 Rc: 0x00xx
374 * PCI: Read Vendor Failed 0x18.58.10 Rc: 0x00xx
375 * PCI: Connect Bus Unit Failed 0x18.58.10 Rc: 0x00xx
376 */
377static void pci_log_error(char *error, int bus, int subbus,
378 int agent, int hv_res)
379{
380 if (hv_res == 0x0302)
381 return;
382 printk(KERN_ERR "PCI: %s Failed: 0x%02X.%02X.%02X Rc: 0x%04X",
383 error, bus, subbus, agent, hv_res);
384}
385
386/*
387 * Look down the chain to find the matching Device Device
388 */
389static struct device_node *find_device_node(int bus, int devfn)
390{
391 struct device_node *node;
392
393 for (node = NULL; (node = of_find_all_nodes(node)); ) {
394 struct pci_dn *pdn = PCI_DN(node);
395
396 if (pdn && (bus == pdn->busno) && (devfn == pdn->devfn))
397 return node;
398 }
399 return NULL;
400}
401
402/*
403 * iSeries_pcibios_fixup_resources
404 *
405 * Fixes up all resources for devices
406 */
407void __init iSeries_pcibios_fixup_resources(struct pci_dev *pdev)
408{
409 const u32 *agent;
410 const u32 *sub_bus;
411 unsigned char bus = pdev->bus->number;
412 struct device_node *node;
413 int i;
414
415 node = pci_device_to_OF_node(pdev);
416 pr_debug("PCI: iSeries %s, pdev %p, node %p\n",
417 pci_name(pdev), pdev, node);
418 if (!node) {
419 printk("PCI: %s disabled, device tree entry not found !\n",
420 pci_name(pdev));
421 for (i = 0; i <= PCI_ROM_RESOURCE; i++)
422 pdev->resource[i].flags = 0;
423 return;
424 }
425 sub_bus = of_get_property(node, "linux,subbus", NULL);
426 agent = of_get_property(node, "linux,agent-id", NULL);
427 if (agent && sub_bus) {
428 u8 irq = iSeries_allocate_IRQ(bus, 0, *sub_bus);
429 int err;
430
431 err = HvCallXm_connectBusUnit(bus, *sub_bus, *agent, irq);
432 if (err)
433 pci_log_error("Connect Bus Unit",
434 bus, *sub_bus, *agent, err);
435 else {
436 err = HvCallPci_configStore8(bus, *sub_bus,
437 *agent, PCI_INTERRUPT_LINE, irq);
438 if (err)
439 pci_log_error("PciCfgStore Irq Failed!",
440 bus, *sub_bus, *agent, err);
441 else
442 pdev->irq = irq;
443 }
444 }
445
446 allocate_device_bars(pdev);
447 if (likely(sub_bus))
448 iseries_device_information(pdev, bus, *sub_bus);
449 else
450 printk(KERN_ERR "PCI: Device node %s has missing or invalid "
451 "linux,subbus property\n", node->full_name);
452}
453
454/*
455 * iSeries_pci_final_fixup(void)
456 */
457void __init iSeries_pci_final_fixup(void)
458{
459 /* Fix up at the device node and pci_dev relationship */
460 mf_display_src(0xC9000100);
461 iSeries_activate_IRQs();
462 mf_display_src(0xC9000200);
463}
464
465/*
466 * Config space read and write functions.
467 * For now at least, we look for the device node for the bus and devfn
468 * that we are asked to access. It may be possible to translate the devfn
469 * to a subbus and deviceid more directly.
470 */
471static u64 hv_cfg_read_func[4] = {
472 HvCallPciConfigLoad8, HvCallPciConfigLoad16,
473 HvCallPciConfigLoad32, HvCallPciConfigLoad32
474};
475
476static u64 hv_cfg_write_func[4] = {
477 HvCallPciConfigStore8, HvCallPciConfigStore16,
478 HvCallPciConfigStore32, HvCallPciConfigStore32
479};
480
481/*
482 * Read PCI config space
483 */
484static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
485 int offset, int size, u32 *val)
486{
487 struct device_node *node = find_device_node(bus->number, devfn);
488 u64 fn;
489 struct HvCallPci_LoadReturn ret;
490
491 if (node == NULL)
492 return PCIBIOS_DEVICE_NOT_FOUND;
493 if (offset > 255) {
494 *val = ~0;
495 return PCIBIOS_BAD_REGISTER_NUMBER;
496 }
497
498 fn = hv_cfg_read_func[(size - 1) & 3];
499 HvCall3Ret16(fn, &ret, iseries_ds_addr(node), offset, 0);
500
501 if (ret.rc != 0) {
502 *val = ~0;
503 return PCIBIOS_DEVICE_NOT_FOUND; /* or something */
504 }
505
506 *val = ret.value;
507 return 0;
508}
509
510/*
511 * Write PCI config space
512 */
513
514static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn,
515 int offset, int size, u32 val)
516{
517 struct device_node *node = find_device_node(bus->number, devfn);
518 u64 fn;
519 u64 ret;
520
521 if (node == NULL)
522 return PCIBIOS_DEVICE_NOT_FOUND;
523 if (offset > 255)
524 return PCIBIOS_BAD_REGISTER_NUMBER;
525
526 fn = hv_cfg_write_func[(size - 1) & 3];
527 ret = HvCall4(fn, iseries_ds_addr(node), offset, val, 0);
528
529 if (ret != 0)
530 return PCIBIOS_DEVICE_NOT_FOUND;
531
532 return 0;
533}
534
535static struct pci_ops iSeries_pci_ops = {
536 .read = iSeries_pci_read_config,
537 .write = iSeries_pci_write_config
538};
539
540/*
541 * Check Return Code
542 * -> On Failure, print and log information.
543 * Increment Retry Count, if exceeds max, panic partition.
544 *
545 * PCI: Device 23.90 ReadL I/O Error( 0): 0x1234
546 * PCI: Device 23.90 ReadL Retry( 1)
547 * PCI: Device 23.90 ReadL Retry Successful(1)
548 */
549static int check_return_code(char *type, struct device_node *dn,
550 int *retry, u64 ret)
551{
552 if (ret != 0) {
553 struct pci_dn *pdn = PCI_DN(dn);
554
555 (*retry)++;
556 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n",
557 type, pdn->busno, pdn->devfn,
558 *retry, (int)ret);
559 /*
560 * Bump the retry and check for retry count exceeded.
561 * If, Exceeded, panic the system.
562 */
563 if (((*retry) > PCI_RETRY_MAX) &&
564 (limit_pci_retries > 0)) {
565 mf_display_src(0xB6000103);
566 panic_timeout = 0;
567 panic("PCI: Hardware I/O Error, SRC B6000103, "
568 "Automatic Reboot Disabled.\n");
569 }
570 return -1; /* Retry Try */
571 }
572 return 0;
573}
574
575/*
576 * Translate the I/O Address into a device node, bar, and bar offset.
577 * Note: Make sure the passed variable end up on the stack to avoid
578 * the exposure of being device global.
579 */
580static inline struct device_node *xlate_iomm_address(
581 const volatile void __iomem *addr,
582 u64 *dsaptr, u64 *bar_offset, const char *func)
583{
584 unsigned long orig_addr;
585 unsigned long base_addr;
586 unsigned long ind;
587 struct device_node *dn;
588
589 orig_addr = (unsigned long __force)addr;
590 if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory)) {
591 static DEFINE_RATELIMIT_STATE(ratelimit, 60 * HZ, 10);
592
593 if (__ratelimit(&ratelimit))
594 printk(KERN_ERR
595 "iSeries_%s: invalid access at IO address %p\n",
596 func, addr);
597 return NULL;
598 }
599 base_addr = orig_addr - BASE_IO_MEMORY;
600 ind = base_addr / IOMM_TABLE_ENTRY_SIZE;
601 dn = iomm_table[ind];
602
603 if (dn != NULL) {
604 *dsaptr = ds_addr_table[ind];
605 *bar_offset = base_addr % IOMM_TABLE_ENTRY_SIZE;
606 } else
607 panic("PCI: Invalid PCI IO address detected!\n");
608 return dn;
609}
610
611/*
612 * Read MM I/O Instructions for the iSeries
613 * On MM I/O error, all ones are returned and iSeries_pci_IoError is cal
614 * else, data is returned in Big Endian format.
615 */
616static u8 iseries_readb(const volatile void __iomem *addr)
617{
618 u64 bar_offset;
619 u64 dsa;
620 int retry = 0;
621 struct HvCallPci_LoadReturn ret;
622 struct device_node *dn =
623 xlate_iomm_address(addr, &dsa, &bar_offset, "read_byte");
624
625 if (dn == NULL)
626 return 0xff;
627 do {
628 HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, bar_offset, 0);
629 } while (check_return_code("RDB", dn, &retry, ret.rc) != 0);
630
631 return ret.value;
632}
633
634static u16 iseries_readw_be(const volatile void __iomem *addr)
635{
636 u64 bar_offset;
637 u64 dsa;
638 int retry = 0;
639 struct HvCallPci_LoadReturn ret;
640 struct device_node *dn =
641 xlate_iomm_address(addr, &dsa, &bar_offset, "read_word");
642
643 if (dn == NULL)
644 return 0xffff;
645 do {
646 HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa,
647 bar_offset, 0);
648 } while (check_return_code("RDW", dn, &retry, ret.rc) != 0);
649
650 return ret.value;
651}
652
653static u32 iseries_readl_be(const volatile void __iomem *addr)
654{
655 u64 bar_offset;
656 u64 dsa;
657 int retry = 0;
658 struct HvCallPci_LoadReturn ret;
659 struct device_node *dn =
660 xlate_iomm_address(addr, &dsa, &bar_offset, "read_long");
661
662 if (dn == NULL)
663 return 0xffffffff;
664 do {
665 HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa,
666 bar_offset, 0);
667 } while (check_return_code("RDL", dn, &retry, ret.rc) != 0);
668
669 return ret.value;
670}
671
672/*
673 * Write MM I/O Instructions for the iSeries
674 *
675 */
676static void iseries_writeb(u8 data, volatile void __iomem *addr)
677{
678 u64 bar_offset;
679 u64 dsa;
680 int retry = 0;
681 u64 rc;
682 struct device_node *dn =
683 xlate_iomm_address(addr, &dsa, &bar_offset, "write_byte");
684
685 if (dn == NULL)
686 return;
687 do {
688 rc = HvCall4(HvCallPciBarStore8, dsa, bar_offset, data, 0);
689 } while (check_return_code("WWB", dn, &retry, rc) != 0);
690}
691
692static void iseries_writew_be(u16 data, volatile void __iomem *addr)
693{
694 u64 bar_offset;
695 u64 dsa;
696 int retry = 0;
697 u64 rc;
698 struct device_node *dn =
699 xlate_iomm_address(addr, &dsa, &bar_offset, "write_word");
700
701 if (dn == NULL)
702 return;
703 do {
704 rc = HvCall4(HvCallPciBarStore16, dsa, bar_offset, data, 0);
705 } while (check_return_code("WWW", dn, &retry, rc) != 0);
706}
707
708static void iseries_writel_be(u32 data, volatile void __iomem *addr)
709{
710 u64 bar_offset;
711 u64 dsa;
712 int retry = 0;
713 u64 rc;
714 struct device_node *dn =
715 xlate_iomm_address(addr, &dsa, &bar_offset, "write_long");
716
717 if (dn == NULL)
718 return;
719 do {
720 rc = HvCall4(HvCallPciBarStore32, dsa, bar_offset, data, 0);
721 } while (check_return_code("WWL", dn, &retry, rc) != 0);
722}
723
724static u16 iseries_readw(const volatile void __iomem *addr)
725{
726 return le16_to_cpu(iseries_readw_be(addr));
727}
728
729static u32 iseries_readl(const volatile void __iomem *addr)
730{
731 return le32_to_cpu(iseries_readl_be(addr));
732}
733
734static void iseries_writew(u16 data, volatile void __iomem *addr)
735{
736 iseries_writew_be(cpu_to_le16(data), addr);
737}
738
739static void iseries_writel(u32 data, volatile void __iomem *addr)
740{
741 iseries_writel(cpu_to_le32(data), addr);
742}
743
744static void iseries_readsb(const volatile void __iomem *addr, void *buf,
745 unsigned long count)
746{
747 u8 *dst = buf;
748 while(count-- > 0)
749 *(dst++) = iseries_readb(addr);
750}
751
752static void iseries_readsw(const volatile void __iomem *addr, void *buf,
753 unsigned long count)
754{
755 u16 *dst = buf;
756 while(count-- > 0)
757 *(dst++) = iseries_readw_be(addr);
758}
759
760static void iseries_readsl(const volatile void __iomem *addr, void *buf,
761 unsigned long count)
762{
763 u32 *dst = buf;
764 while(count-- > 0)
765 *(dst++) = iseries_readl_be(addr);
766}
767
768static void iseries_writesb(volatile void __iomem *addr, const void *buf,
769 unsigned long count)
770{
771 const u8 *src = buf;
772 while(count-- > 0)
773 iseries_writeb(*(src++), addr);
774}
775
776static void iseries_writesw(volatile void __iomem *addr, const void *buf,
777 unsigned long count)
778{
779 const u16 *src = buf;
780 while(count-- > 0)
781 iseries_writew_be(*(src++), addr);
782}
783
784static void iseries_writesl(volatile void __iomem *addr, const void *buf,
785 unsigned long count)
786{
787 const u32 *src = buf;
788 while(count-- > 0)
789 iseries_writel_be(*(src++), addr);
790}
791
792static void iseries_memset_io(volatile void __iomem *addr, int c,
793 unsigned long n)
794{
795 volatile char __iomem *d = addr;
796
797 while (n-- > 0)
798 iseries_writeb(c, d++);
799}
800
801static void iseries_memcpy_fromio(void *dest, const volatile void __iomem *src,
802 unsigned long n)
803{
804 char *d = dest;
805 const volatile char __iomem *s = src;
806
807 while (n-- > 0)
808 *d++ = iseries_readb(s++);
809}
810
811static void iseries_memcpy_toio(volatile void __iomem *dest, const void *src,
812 unsigned long n)
813{
814 const char *s = src;
815 volatile char __iomem *d = dest;
816
817 while (n-- > 0)
818 iseries_writeb(*s++, d++);
819}
820
821/* We only set MMIO ops. The default PIO ops will be default
822 * to the MMIO ops + pci_io_base which is 0 on iSeries as
823 * expected so both should work.
824 *
825 * Note that we don't implement the readq/writeq versions as
826 * I don't know of an HV call for doing so. Thus, the default
827 * operation will be used instead, which will fault a the value
828 * return by iSeries for MMIO addresses always hits a non mapped
829 * area. This is as good as the BUG() we used to have there.
830 */
831static struct ppc_pci_io __initdata iseries_pci_io = {
832 .readb = iseries_readb,
833 .readw = iseries_readw,
834 .readl = iseries_readl,
835 .readw_be = iseries_readw_be,
836 .readl_be = iseries_readl_be,
837 .writeb = iseries_writeb,
838 .writew = iseries_writew,
839 .writel = iseries_writel,
840 .writew_be = iseries_writew_be,
841 .writel_be = iseries_writel_be,
842 .readsb = iseries_readsb,
843 .readsw = iseries_readsw,
844 .readsl = iseries_readsl,
845 .writesb = iseries_writesb,
846 .writesw = iseries_writesw,
847 .writesl = iseries_writesl,
848 .memset_io = iseries_memset_io,
849 .memcpy_fromio = iseries_memcpy_fromio,
850 .memcpy_toio = iseries_memcpy_toio,
851};
852
853/*
854 * iSeries_pcibios_init
855 *
856 * Description:
857 * This function checks for all possible system PCI host bridges that connect
858 * PCI buses. The system hypervisor is queried as to the guest partition
859 * ownership status. A pci_controller is built for any bus which is partially
860 * owned or fully owned by this guest partition.
861 */
862void __init iSeries_pcibios_init(void)
863{
864 struct pci_controller *phb;
865 struct device_node *root = of_find_node_by_path("/");
866 struct device_node *node = NULL;
867
868 /* Install IO hooks */
869 ppc_pci_io = iseries_pci_io;
870
871 pci_probe_only = 1;
872
873 /* iSeries has no IO space in the common sense, it needs to set
874 * the IO base to 0
875 */
876 pci_io_base = 0;
877
878 if (root == NULL) {
879 printk(KERN_CRIT "iSeries_pcibios_init: can't find root "
880 "of device tree\n");
881 return;
882 }
883 while ((node = of_get_next_child(root, node)) != NULL) {
884 HvBusNumber bus;
885 const u32 *busp;
886
887 if ((node->type == NULL) || (strcmp(node->type, "pci") != 0))
888 continue;
889
890 busp = of_get_property(node, "bus-range", NULL);
891 if (busp == NULL)
892 continue;
893 bus = *busp;
894 printk("bus %d appears to exist\n", bus);
895 phb = pcibios_alloc_controller(node);
896 if (phb == NULL)
897 continue;
898 /* All legacy iSeries PHBs are in domain zero */
899 phb->global_number = 0;
900
901 phb->first_busno = bus;
902 phb->last_busno = bus;
903 phb->ops = &iSeries_pci_ops;
904 phb->io_base_virt = (void __iomem *)_IO_BASE;
905 phb->io_resource.flags = IORESOURCE_IO;
906 phb->io_resource.start = BASE_IO_MEMORY;
907 phb->io_resource.end = END_IO_MEMORY;
908 phb->io_resource.name = "iSeries PCI IO";
909 phb->mem_resources[0].flags = IORESOURCE_MEM;
910 phb->mem_resources[0].start = BASE_IO_MEMORY;
911 phb->mem_resources[0].end = END_IO_MEMORY;
912 phb->mem_resources[0].name = "Series PCI MEM";
913 }
914
915 of_node_put(root);
916
917 pci_devs_phb_init();
918}
919
diff --git a/arch/powerpc/platforms/iseries/pci.h b/arch/powerpc/platforms/iseries/pci.h
deleted file mode 100644
index d9cf974c271..00000000000
--- a/arch/powerpc/platforms/iseries/pci.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _PLATFORMS_ISERIES_PCI_H
2#define _PLATFORMS_ISERIES_PCI_H
3
4/*
5 * Created by Allan Trautman on Tue Feb 20, 2001.
6 *
7 * Define some useful macros for the iSeries pci routines.
8 * Copyright (C) 2001 Allan H Trautman, IBM Corporation
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 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the:
22 * Free Software Foundation, Inc.,
23 * 59 Temple Place, Suite 330,
24 * Boston, MA 02111-1307 USA
25 *
26 * Change Activity:
27 * Created Feb 20, 2001
28 * Added device reset, March 22, 2001
29 * Ported to ppc64, May 25, 2001
30 * End Change Activity
31 */
32
33/*
34 * Decodes Linux DevFn to iSeries DevFn, bridge device, or function.
35 * For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h
36 */
37
38#define ISERIES_PCI_AGENTID(idsel, func) \
39 (((idsel & 0x0F) << 4) | (func & 0x07))
40#define ISERIES_ENCODE_DEVICE(agentid) \
41 ((0x10) | ((agentid & 0x20) >> 2) | (agentid & 0x07))
42
43#define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7)
44#define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7)
45
46struct pci_dev;
47
48#ifdef CONFIG_PCI
49extern void iSeries_pcibios_init(void);
50extern void iSeries_pci_final_fixup(void);
51extern void iSeries_pcibios_fixup_resources(struct pci_dev *dev);
52#else
53static inline void iSeries_pcibios_init(void) { }
54static inline void iSeries_pci_final_fixup(void) { }
55static inline void iSeries_pcibios_fixup_resources(struct pci_dev *dev) {}
56#endif
57
58#endif /* _PLATFORMS_ISERIES_PCI_H */
diff --git a/arch/powerpc/platforms/iseries/proc.c b/arch/powerpc/platforms/iseries/proc.c
deleted file mode 100644
index 06763682db4..00000000000
--- a/arch/powerpc/platforms/iseries/proc.c
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2 * Copyright (C) 2001 Kyle A. Lucke IBM Corporation
3 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen IBM Corporation
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 * 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/proc_fs.h>
21#include <linux/seq_file.h>
22#include <linux/param.h> /* for HZ */
23#include <asm/paca.h>
24#include <asm/processor.h>
25#include <asm/time.h>
26#include <asm/lppaca.h>
27#include <asm/firmware.h>
28#include <asm/iseries/hv_call_xm.h>
29
30#include "processor_vpd.h"
31#include "main_store.h"
32
33static int __init iseries_proc_create(void)
34{
35 struct proc_dir_entry *e;
36
37 if (!firmware_has_feature(FW_FEATURE_ISERIES))
38 return 0;
39
40 e = proc_mkdir("iSeries", 0);
41 if (!e)
42 return 1;
43
44 return 0;
45}
46core_initcall(iseries_proc_create);
47
48static unsigned long startTitan = 0;
49static unsigned long startTb = 0;
50
51static int proc_titantod_show(struct seq_file *m, void *v)
52{
53 unsigned long tb0, titan_tod;
54
55 tb0 = get_tb();
56 titan_tod = HvCallXm_loadTod();
57
58 seq_printf(m, "Titan\n" );
59 seq_printf(m, " time base = %016lx\n", tb0);
60 seq_printf(m, " titan tod = %016lx\n", titan_tod);
61 seq_printf(m, " xProcFreq = %016x\n",
62 xIoHriProcessorVpd[0].xProcFreq);
63 seq_printf(m, " xTimeBaseFreq = %016x\n",
64 xIoHriProcessorVpd[0].xTimeBaseFreq);
65 seq_printf(m, " tb_ticks_per_jiffy = %lu\n", tb_ticks_per_jiffy);
66 seq_printf(m, " tb_ticks_per_usec = %lu\n", tb_ticks_per_usec);
67
68 if (!startTitan) {
69 startTitan = titan_tod;
70 startTb = tb0;
71 } else {
72 unsigned long titan_usec = (titan_tod - startTitan) >> 12;
73 unsigned long tb_ticks = (tb0 - startTb);
74 unsigned long titan_jiffies = titan_usec / (1000000/HZ);
75 unsigned long titan_jiff_usec = titan_jiffies * (1000000/HZ);
76 unsigned long titan_jiff_rem_usec =
77 titan_usec - titan_jiff_usec;
78 unsigned long tb_jiffies = tb_ticks / tb_ticks_per_jiffy;
79 unsigned long tb_jiff_ticks = tb_jiffies * tb_ticks_per_jiffy;
80 unsigned long tb_jiff_rem_ticks = tb_ticks - tb_jiff_ticks;
81 unsigned long tb_jiff_rem_usec =
82 tb_jiff_rem_ticks / tb_ticks_per_usec;
83 unsigned long new_tb_ticks_per_jiffy =
84 (tb_ticks * (1000000/HZ))/titan_usec;
85
86 seq_printf(m, " titan elapsed = %lu uSec\n", titan_usec);
87 seq_printf(m, " tb elapsed = %lu ticks\n", tb_ticks);
88 seq_printf(m, " titan jiffies = %lu.%04lu\n", titan_jiffies,
89 titan_jiff_rem_usec);
90 seq_printf(m, " tb jiffies = %lu.%04lu\n", tb_jiffies,
91 tb_jiff_rem_usec);
92 seq_printf(m, " new tb_ticks_per_jiffy = %lu\n",
93 new_tb_ticks_per_jiffy);
94 }
95
96 return 0;
97}
98
99static int proc_titantod_open(struct inode *inode, struct file *file)
100{
101 return single_open(file, proc_titantod_show, NULL);
102}
103
104static const struct file_operations proc_titantod_operations = {
105 .open = proc_titantod_open,
106 .read = seq_read,
107 .llseek = seq_lseek,
108 .release = single_release,
109};
110
111static int __init iseries_proc_init(void)
112{
113 if (!firmware_has_feature(FW_FEATURE_ISERIES))
114 return 0;
115
116 proc_create("iSeries/titanTod", S_IFREG|S_IRUGO, NULL,
117 &proc_titantod_operations);
118 return 0;
119}
120__initcall(iseries_proc_init);
diff --git a/arch/powerpc/platforms/iseries/processor_vpd.h b/arch/powerpc/platforms/iseries/processor_vpd.h
deleted file mode 100644
index 7ac5d0d0dbf..00000000000
--- a/arch/powerpc/platforms/iseries/processor_vpd.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ISERIES_PROCESSOR_VPD_H
19#define _ISERIES_PROCESSOR_VPD_H
20
21#include <asm/types.h>
22
23/*
24 * This struct maps Processor Vpd that is DMAd to SLIC by CSP
25 */
26struct IoHriProcessorVpd {
27 u8 xFormat; // VPD format indicator x00-x00
28 u8 xProcStatus:8; // Processor State x01-x01
29 u8 xSecondaryThreadCount; // Secondary thread cnt x02-x02
30 u8 xSrcType:1; // Src Type x03-x03
31 u8 xSrcSoft:1; // Src stay soft ...
32 u8 xSrcParable:1; // Src parable ...
33 u8 xRsvd1:5; // Reserved ...
34 u16 xHvPhysicalProcIndex; // Hypervisor physical proc index04-x05
35 u16 xRsvd2; // Reserved x06-x07
36 u32 xHwNodeId; // Hardware node id x08-x0B
37 u32 xHwProcId; // Hardware processor id x0C-x0F
38
39 u32 xTypeNum; // Card Type/CCIN number x10-x13
40 u32 xModelNum; // Model/Feature number x14-x17
41 u64 xSerialNum; // Serial number x18-x1F
42 char xPartNum[12]; // Book Part or FPU number x20-x2B
43 char xMfgID[4]; // Manufacturing ID x2C-x2F
44
45 u32 xProcFreq; // Processor Frequency x30-x33
46 u32 xTimeBaseFreq; // Time Base Frequency x34-x37
47
48 u32 xChipEcLevel; // Chip EC Levels x38-x3B
49 u32 xProcIdReg; // PIR SPR value x3C-x3F
50 u32 xPVR; // PVR value x40-x43
51 u8 xRsvd3[12]; // Reserved x44-x4F
52
53 u32 xInstCacheSize; // Instruction cache size in KB x50-x53
54 u32 xInstBlockSize; // Instruction cache block size x54-x57
55 u32 xDataCacheOperandSize; // Data cache operand size x58-x5B
56 u32 xInstCacheOperandSize; // Inst cache operand size x5C-x5F
57
58 u32 xDataL1CacheSizeKB; // L1 data cache size in KB x60-x63
59 u32 xDataL1CacheLineSize; // L1 data cache block size x64-x67
60 u64 xRsvd4; // Reserved x68-x6F
61
62 u32 xDataL2CacheSizeKB; // L2 data cache size in KB x70-x73
63 u32 xDataL2CacheLineSize; // L2 data cache block size x74-x77
64 u64 xRsvd5; // Reserved x78-x7F
65
66 u32 xDataL3CacheSizeKB; // L3 data cache size in KB x80-x83
67 u32 xDataL3CacheLineSize; // L3 data cache block size x84-x87
68 u64 xRsvd6; // Reserved x88-x8F
69
70 u64 xFruLabel; // Card Location Label x90-x97
71 u8 xSlotsOnCard; // Slots on card (0=no slots) x98-x98
72 u8 xPartLocFlag; // Location flag (0-pluggable 1-imbedded) x99-x99
73 u16 xSlotMapIndex; // Index in slot map table x9A-x9B
74 u8 xSmartCardPortNo; // Smart card port number x9C-x9C
75 u8 xRsvd7; // Reserved x9D-x9D
76 u16 xFrameIdAndRackUnit; // Frame ID and rack unit adr x9E-x9F
77
78 u8 xRsvd8[24]; // Reserved xA0-xB7
79
80 char xProcSrc[72]; // CSP format SRC xB8-xFF
81};
82
83extern struct IoHriProcessorVpd xIoHriProcessorVpd[];
84
85#endif /* _ISERIES_PROCESSOR_VPD_H */
diff --git a/arch/powerpc/platforms/iseries/release_data.h b/arch/powerpc/platforms/iseries/release_data.h
deleted file mode 100644
index 6ad7d843e8f..00000000000
--- a/arch/powerpc/platforms/iseries/release_data.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ISERIES_RELEASE_DATA_H
19#define _ISERIES_RELEASE_DATA_H
20
21/*
22 * This control block contains the critical information about the
23 * release so that it can be changed in the future (ie, the virtual
24 * address of the OS's NACA).
25 */
26#include <asm/types.h>
27#include "naca.h"
28
29/*
30 * When we IPL a secondary partition, we will check if if the
31 * secondary xMinPlicVrmIndex > the primary xVrmIndex.
32 * If it is then this tells PLIC that this secondary is not
33 * supported running on this "old" of a level of PLIC.
34 *
35 * Likewise, we will compare the primary xMinSlicVrmIndex to
36 * the secondary xVrmIndex.
37 * If the primary xMinSlicVrmDelta > secondary xVrmDelta then we
38 * know that this PLIC does not support running an OS "that old".
39 */
40
41#define HVREL_TAGSINACTIVE 0x8000
42#define HVREL_32BIT 0x4000
43#define HVREL_NOSHAREDPROCS 0x2000
44#define HVREL_NOHMT 0x1000
45
46struct HvReleaseData {
47 u32 xDesc; /* Descriptor "HvRD" ebcdic x00-x03 */
48 u16 xSize; /* Size of this control block x04-x05 */
49 u16 xVpdAreasPtrOffset; /* Offset in NACA of ItVpdAreas x06-x07 */
50 struct naca_struct *xSlicNacaAddr; /* Virt addr of SLIC NACA x08-x0F */
51 u32 xMsNucDataOffset; /* Offset of Linux Mapping Data x10-x13 */
52 u32 xRsvd1; /* Reserved x14-x17 */
53 u16 xFlags;
54 u16 xVrmIndex; /* VRM Index of OS image x1A-x1B */
55 u16 xMinSupportedPlicVrmIndex; /* Min PLIC level (soft) x1C-x1D */
56 u16 xMinCompatablePlicVrmIndex; /* Min PLIC levelP (hard) x1E-x1F */
57 char xVrmName[12]; /* Displayable name x20-x2B */
58 char xRsvd3[20]; /* Reserved x2C-x3F */
59};
60
61extern const struct HvReleaseData hvReleaseData;
62
63#endif /* _ISERIES_RELEASE_DATA_H */
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
deleted file mode 100644
index a5fbf4cb632..00000000000
--- a/arch/powerpc/platforms/iseries/setup.c
+++ /dev/null
@@ -1,718 +0,0 @@
1/*
2 * Copyright (c) 2000 Mike Corrigan <mikejc@us.ibm.com>
3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
4 *
5 * Description:
6 * Architecture- / platform-specific boot-time initialization code for
7 * the IBM iSeries LPAR. Adapted from original code by Grant Erickson and
8 * code by Gary Thomas, Cort Dougan <cort@fsmlabs.com>, and Dan Malek
9 * <dan@net4x.com>.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16
17#undef DEBUG
18
19#include <linux/init.h>
20#include <linux/threads.h>
21#include <linux/smp.h>
22#include <linux/param.h>
23#include <linux/string.h>
24#include <linux/export.h>
25#include <linux/seq_file.h>
26#include <linux/kdev_t.h>
27#include <linux/kexec.h>
28#include <linux/major.h>
29#include <linux/root_dev.h>
30#include <linux/kernel.h>
31#include <linux/hrtimer.h>
32#include <linux/tick.h>
33
34#include <asm/processor.h>
35#include <asm/machdep.h>
36#include <asm/page.h>
37#include <asm/mmu.h>
38#include <asm/pgtable.h>
39#include <asm/mmu_context.h>
40#include <asm/cputable.h>
41#include <asm/sections.h>
42#include <asm/iommu.h>
43#include <asm/firmware.h>
44#include <asm/system.h>
45#include <asm/time.h>
46#include <asm/paca.h>
47#include <asm/cache.h>
48#include <asm/abs_addr.h>
49#include <asm/iseries/hv_lp_config.h>
50#include <asm/iseries/hv_call_event.h>
51#include <asm/iseries/hv_call_xm.h>
52#include <asm/iseries/it_lp_queue.h>
53#include <asm/iseries/mf.h>
54#include <asm/iseries/hv_lp_event.h>
55#include <asm/iseries/lpar_map.h>
56#include <asm/udbg.h>
57#include <asm/irq.h>
58
59#include "naca.h"
60#include "setup.h"
61#include "irq.h"
62#include "vpd_areas.h"
63#include "processor_vpd.h"
64#include "it_lp_naca.h"
65#include "main_store.h"
66#include "call_sm.h"
67#include "call_hpt.h"
68#include "pci.h"
69
70#ifdef DEBUG
71#define DBG(fmt...) udbg_printf(fmt)
72#else
73#define DBG(fmt...)
74#endif
75
76/* Function Prototypes */
77static unsigned long build_iSeries_Memory_Map(void);
78static void iseries_shared_idle(void);
79static void iseries_dedicated_idle(void);
80
81
82struct MemoryBlock {
83 unsigned long absStart;
84 unsigned long absEnd;
85 unsigned long logicalStart;
86 unsigned long logicalEnd;
87};
88
89/*
90 * Process the main store vpd to determine where the holes in memory are
91 * and return the number of physical blocks and fill in the array of
92 * block data.
93 */
94static unsigned long iSeries_process_Condor_mainstore_vpd(
95 struct MemoryBlock *mb_array, unsigned long max_entries)
96{
97 unsigned long holeFirstChunk, holeSizeChunks;
98 unsigned long numMemoryBlocks = 1;
99 struct IoHriMainStoreSegment4 *msVpd =
100 (struct IoHriMainStoreSegment4 *)xMsVpd;
101 unsigned long holeStart = msVpd->nonInterleavedBlocksStartAdr;
102 unsigned long holeEnd = msVpd->nonInterleavedBlocksEndAdr;
103 unsigned long holeSize = holeEnd - holeStart;
104
105 printk("Mainstore_VPD: Condor\n");
106 /*
107 * Determine if absolute memory has any
108 * holes so that we can interpret the
109 * access map we get back from the hypervisor
110 * correctly.
111 */
112 mb_array[0].logicalStart = 0;
113 mb_array[0].logicalEnd = 0x100000000UL;
114 mb_array[0].absStart = 0;
115 mb_array[0].absEnd = 0x100000000UL;
116
117 if (holeSize) {
118 numMemoryBlocks = 2;
119 holeStart = holeStart & 0x000fffffffffffffUL;
120 holeStart = addr_to_chunk(holeStart);
121 holeFirstChunk = holeStart;
122 holeSize = addr_to_chunk(holeSize);
123 holeSizeChunks = holeSize;
124 printk( "Main store hole: start chunk = %0lx, size = %0lx chunks\n",
125 holeFirstChunk, holeSizeChunks );
126 mb_array[0].logicalEnd = holeFirstChunk;
127 mb_array[0].absEnd = holeFirstChunk;
128 mb_array[1].logicalStart = holeFirstChunk;
129 mb_array[1].logicalEnd = 0x100000000UL - holeSizeChunks;
130 mb_array[1].absStart = holeFirstChunk + holeSizeChunks;
131 mb_array[1].absEnd = 0x100000000UL;
132 }
133 return numMemoryBlocks;
134}
135
136#define MaxSegmentAreas 32
137#define MaxSegmentAdrRangeBlocks 128
138#define MaxAreaRangeBlocks 4
139
140static unsigned long iSeries_process_Regatta_mainstore_vpd(
141 struct MemoryBlock *mb_array, unsigned long max_entries)
142{
143 struct IoHriMainStoreSegment5 *msVpdP =
144 (struct IoHriMainStoreSegment5 *)xMsVpd;
145 unsigned long numSegmentBlocks = 0;
146 u32 existsBits = msVpdP->msAreaExists;
147 unsigned long area_num;
148
149 printk("Mainstore_VPD: Regatta\n");
150
151 for (area_num = 0; area_num < MaxSegmentAreas; ++area_num ) {
152 unsigned long numAreaBlocks;
153 struct IoHriMainStoreArea4 *currentArea;
154
155 if (existsBits & 0x80000000) {
156 unsigned long block_num;
157
158 currentArea = &msVpdP->msAreaArray[area_num];
159 numAreaBlocks = currentArea->numAdrRangeBlocks;
160 printk("ms_vpd: processing area %2ld blocks=%ld",
161 area_num, numAreaBlocks);
162 for (block_num = 0; block_num < numAreaBlocks;
163 ++block_num ) {
164 /* Process an address range block */
165 struct MemoryBlock tempBlock;
166 unsigned long i;
167
168 tempBlock.absStart =
169 (unsigned long)currentArea->xAdrRangeBlock[block_num].blockStart;
170 tempBlock.absEnd =
171 (unsigned long)currentArea->xAdrRangeBlock[block_num].blockEnd;
172 tempBlock.logicalStart = 0;
173 tempBlock.logicalEnd = 0;
174 printk("\n block %ld absStart=%016lx absEnd=%016lx",
175 block_num, tempBlock.absStart,
176 tempBlock.absEnd);
177
178 for (i = 0; i < numSegmentBlocks; ++i) {
179 if (mb_array[i].absStart ==
180 tempBlock.absStart)
181 break;
182 }
183 if (i == numSegmentBlocks) {
184 if (numSegmentBlocks == max_entries)
185 panic("iSeries_process_mainstore_vpd: too many memory blocks");
186 mb_array[numSegmentBlocks] = tempBlock;
187 ++numSegmentBlocks;
188 } else
189 printk(" (duplicate)");
190 }
191 printk("\n");
192 }
193 existsBits <<= 1;
194 }
195 /* Now sort the blocks found into ascending sequence */
196 if (numSegmentBlocks > 1) {
197 unsigned long m, n;
198
199 for (m = 0; m < numSegmentBlocks - 1; ++m) {
200 for (n = numSegmentBlocks - 1; m < n; --n) {
201 if (mb_array[n].absStart <
202 mb_array[n-1].absStart) {
203 struct MemoryBlock tempBlock;
204
205 tempBlock = mb_array[n];
206 mb_array[n] = mb_array[n-1];
207 mb_array[n-1] = tempBlock;
208 }
209 }
210 }
211 }
212 /*
213 * Assign "logical" addresses to each block. These
214 * addresses correspond to the hypervisor "bitmap" space.
215 * Convert all addresses into units of 256K chunks.
216 */
217 {
218 unsigned long i, nextBitmapAddress;
219
220 printk("ms_vpd: %ld sorted memory blocks\n", numSegmentBlocks);
221 nextBitmapAddress = 0;
222 for (i = 0; i < numSegmentBlocks; ++i) {
223 unsigned long length = mb_array[i].absEnd -
224 mb_array[i].absStart;
225
226 mb_array[i].logicalStart = nextBitmapAddress;
227 mb_array[i].logicalEnd = nextBitmapAddress + length;
228 nextBitmapAddress += length;
229 printk(" Bitmap range: %016lx - %016lx\n"
230 " Absolute range: %016lx - %016lx\n",
231 mb_array[i].logicalStart,
232 mb_array[i].logicalEnd,
233 mb_array[i].absStart, mb_array[i].absEnd);
234 mb_array[i].absStart = addr_to_chunk(mb_array[i].absStart &
235 0x000fffffffffffffUL);
236 mb_array[i].absEnd = addr_to_chunk(mb_array[i].absEnd &
237 0x000fffffffffffffUL);
238 mb_array[i].logicalStart =
239 addr_to_chunk(mb_array[i].logicalStart);
240 mb_array[i].logicalEnd = addr_to_chunk(mb_array[i].logicalEnd);
241 }
242 }
243
244 return numSegmentBlocks;
245}
246
247static unsigned long iSeries_process_mainstore_vpd(struct MemoryBlock *mb_array,
248 unsigned long max_entries)
249{
250 unsigned long i;
251 unsigned long mem_blocks = 0;
252
253 if (mmu_has_feature(MMU_FTR_SLB))
254 mem_blocks = iSeries_process_Regatta_mainstore_vpd(mb_array,
255 max_entries);
256 else
257 mem_blocks = iSeries_process_Condor_mainstore_vpd(mb_array,
258 max_entries);
259
260 printk("Mainstore_VPD: numMemoryBlocks = %ld\n", mem_blocks);
261 for (i = 0; i < mem_blocks; ++i) {
262 printk("Mainstore_VPD: block %3ld logical chunks %016lx - %016lx\n"
263 " abs chunks %016lx - %016lx\n",
264 i, mb_array[i].logicalStart, mb_array[i].logicalEnd,
265 mb_array[i].absStart, mb_array[i].absEnd);
266 }
267 return mem_blocks;
268}
269
270static void __init iSeries_get_cmdline(void)
271{
272 char *p, *q;
273
274 /* copy the command line parameter from the primary VSP */
275 HvCallEvent_dmaToSp(cmd_line, 2 * 64* 1024, 256,
276 HvLpDma_Direction_RemoteToLocal);
277
278 p = cmd_line;
279 q = cmd_line + 255;
280 while(p < q) {
281 if (!*p || *p == '\n')
282 break;
283 ++p;
284 }
285 *p = 0;
286}
287
288static void __init iSeries_init_early(void)
289{
290 DBG(" -> iSeries_init_early()\n");
291
292 /* Snapshot the timebase, for use in later recalibration */
293 iSeries_time_init_early();
294
295 /*
296 * Initialize the DMA/TCE management
297 */
298 iommu_init_early_iSeries();
299
300 /* Initialize machine-dependency vectors */
301#ifdef CONFIG_SMP
302 smp_init_iSeries();
303#endif
304
305 /* Associate Lp Event Queue 0 with processor 0 */
306 HvCallEvent_setLpEventQueueInterruptProc(0, 0);
307
308 mf_init();
309
310 DBG(" <- iSeries_init_early()\n");
311}
312
313struct mschunks_map mschunks_map = {
314 /* XXX We don't use these, but Piranha might need them. */
315 .chunk_size = MSCHUNKS_CHUNK_SIZE,
316 .chunk_shift = MSCHUNKS_CHUNK_SHIFT,
317 .chunk_mask = MSCHUNKS_OFFSET_MASK,
318};
319EXPORT_SYMBOL(mschunks_map);
320
321static void mschunks_alloc(unsigned long num_chunks)
322{
323 klimit = _ALIGN(klimit, sizeof(u32));
324 mschunks_map.mapping = (u32 *)klimit;
325 klimit += num_chunks * sizeof(u32);
326 mschunks_map.num_chunks = num_chunks;
327}
328
329/*
330 * The iSeries may have very large memories ( > 128 GB ) and a partition
331 * may get memory in "chunks" that may be anywhere in the 2**52 real
332 * address space. The chunks are 256K in size. To map this to the
333 * memory model Linux expects, the AS/400 specific code builds a
334 * translation table to translate what Linux thinks are "physical"
335 * addresses to the actual real addresses. This allows us to make
336 * it appear to Linux that we have contiguous memory starting at
337 * physical address zero while in fact this could be far from the truth.
338 * To avoid confusion, I'll let the words physical and/or real address
339 * apply to the Linux addresses while I'll use "absolute address" to
340 * refer to the actual hardware real address.
341 *
342 * build_iSeries_Memory_Map gets information from the Hypervisor and
343 * looks at the Main Store VPD to determine the absolute addresses
344 * of the memory that has been assigned to our partition and builds
345 * a table used to translate Linux's physical addresses to these
346 * absolute addresses. Absolute addresses are needed when
347 * communicating with the hypervisor (e.g. to build HPT entries)
348 *
349 * Returns the physical memory size
350 */
351
352static unsigned long __init build_iSeries_Memory_Map(void)
353{
354 u32 loadAreaFirstChunk, loadAreaLastChunk, loadAreaSize;
355 u32 nextPhysChunk;
356 u32 hptFirstChunk, hptLastChunk, hptSizeChunks, hptSizePages;
357 u32 totalChunks,moreChunks;
358 u32 currChunk, thisChunk, absChunk;
359 u32 currDword;
360 u32 chunkBit;
361 u64 map;
362 struct MemoryBlock mb[32];
363 unsigned long numMemoryBlocks, curBlock;
364
365 /* Chunk size on iSeries is 256K bytes */
366 totalChunks = (u32)HvLpConfig_getMsChunks();
367 mschunks_alloc(totalChunks);
368
369 /*
370 * Get absolute address of our load area
371 * and map it to physical address 0
372 * This guarantees that the loadarea ends up at physical 0
373 * otherwise, it might not be returned by PLIC as the first
374 * chunks
375 */
376
377 loadAreaFirstChunk = (u32)addr_to_chunk(itLpNaca.xLoadAreaAddr);
378 loadAreaSize = itLpNaca.xLoadAreaChunks;
379
380 /*
381 * Only add the pages already mapped here.
382 * Otherwise we might add the hpt pages
383 * The rest of the pages of the load area
384 * aren't in the HPT yet and can still
385 * be assigned an arbitrary physical address
386 */
387 if ((loadAreaSize * 64) > HvPagesToMap)
388 loadAreaSize = HvPagesToMap / 64;
389
390 loadAreaLastChunk = loadAreaFirstChunk + loadAreaSize - 1;
391
392 /*
393 * TODO Do we need to do something if the HPT is in the 64MB load area?
394 * This would be required if the itLpNaca.xLoadAreaChunks includes
395 * the HPT size
396 */
397
398 printk("Mapping load area - physical addr = 0000000000000000\n"
399 " absolute addr = %016lx\n",
400 chunk_to_addr(loadAreaFirstChunk));
401 printk("Load area size %dK\n", loadAreaSize * 256);
402
403 for (nextPhysChunk = 0; nextPhysChunk < loadAreaSize; ++nextPhysChunk)
404 mschunks_map.mapping[nextPhysChunk] =
405 loadAreaFirstChunk + nextPhysChunk;
406
407 /*
408 * Get absolute address of our HPT and remember it so
409 * we won't map it to any physical address
410 */
411 hptFirstChunk = (u32)addr_to_chunk(HvCallHpt_getHptAddress());
412 hptSizePages = (u32)HvCallHpt_getHptPages();
413 hptSizeChunks = hptSizePages >>
414 (MSCHUNKS_CHUNK_SHIFT - HW_PAGE_SHIFT);
415 hptLastChunk = hptFirstChunk + hptSizeChunks - 1;
416
417 printk("HPT absolute addr = %016lx, size = %dK\n",
418 chunk_to_addr(hptFirstChunk), hptSizeChunks * 256);
419
420 /*
421 * Determine if absolute memory has any
422 * holes so that we can interpret the
423 * access map we get back from the hypervisor
424 * correctly.
425 */
426 numMemoryBlocks = iSeries_process_mainstore_vpd(mb, 32);
427
428 /*
429 * Process the main store access map from the hypervisor
430 * to build up our physical -> absolute translation table
431 */
432 curBlock = 0;
433 currChunk = 0;
434 currDword = 0;
435 moreChunks = totalChunks;
436
437 while (moreChunks) {
438 map = HvCallSm_get64BitsOfAccessMap(itLpNaca.xLpIndex,
439 currDword);
440 thisChunk = currChunk;
441 while (map) {
442 chunkBit = map >> 63;
443 map <<= 1;
444 if (chunkBit) {
445 --moreChunks;
446 while (thisChunk >= mb[curBlock].logicalEnd) {
447 ++curBlock;
448 if (curBlock >= numMemoryBlocks)
449 panic("out of memory blocks");
450 }
451 if (thisChunk < mb[curBlock].logicalStart)
452 panic("memory block error");
453
454 absChunk = mb[curBlock].absStart +
455 (thisChunk - mb[curBlock].logicalStart);
456 if (((absChunk < hptFirstChunk) ||
457 (absChunk > hptLastChunk)) &&
458 ((absChunk < loadAreaFirstChunk) ||
459 (absChunk > loadAreaLastChunk))) {
460 mschunks_map.mapping[nextPhysChunk] =
461 absChunk;
462 ++nextPhysChunk;
463 }
464 }
465 ++thisChunk;
466 }
467 ++currDword;
468 currChunk += 64;
469 }
470
471 /*
472 * main store size (in chunks) is
473 * totalChunks - hptSizeChunks
474 * which should be equal to
475 * nextPhysChunk
476 */
477 return chunk_to_addr(nextPhysChunk);
478}
479
480/*
481 * Document me.
482 */
483static void __init iSeries_setup_arch(void)
484{
485 if (get_lppaca()->shared_proc) {
486 ppc_md.idle_loop = iseries_shared_idle;
487 printk(KERN_DEBUG "Using shared processor idle loop\n");
488 } else {
489 ppc_md.idle_loop = iseries_dedicated_idle;
490 printk(KERN_DEBUG "Using dedicated idle loop\n");
491 }
492
493 /* Setup the Lp Event Queue */
494 setup_hvlpevent_queue();
495
496 printk("Max logical processors = %d\n",
497 itVpdAreas.xSlicMaxLogicalProcs);
498 printk("Max physical processors = %d\n",
499 itVpdAreas.xSlicMaxPhysicalProcs);
500
501 iSeries_pcibios_init();
502}
503
504static void iSeries_show_cpuinfo(struct seq_file *m)
505{
506 seq_printf(m, "machine\t\t: 64-bit iSeries Logical Partition\n");
507}
508
509static void __init iSeries_progress(char * st, unsigned short code)
510{
511 printk("Progress: [%04x] - %s\n", (unsigned)code, st);
512 mf_display_progress(code);
513}
514
515static void __init iSeries_fixup_klimit(void)
516{
517 /*
518 * Change klimit to take into account any ram disk
519 * that may be included
520 */
521 if (naca.xRamDisk)
522 klimit = KERNELBASE + (u64)naca.xRamDisk +
523 (naca.xRamDiskSize * HW_PAGE_SIZE);
524}
525
526static int __init iSeries_src_init(void)
527{
528 /* clear the progress line */
529 if (firmware_has_feature(FW_FEATURE_ISERIES))
530 ppc_md.progress(" ", 0xffff);
531 return 0;
532}
533
534late_initcall(iSeries_src_init);
535
536static inline void process_iSeries_events(void)
537{
538 asm volatile ("li 0,0x5555; sc" : : : "r0", "r3");
539}
540
541static void yield_shared_processor(void)
542{
543 unsigned long tb;
544
545 HvCall_setEnabledInterrupts(HvCall_MaskIPI |
546 HvCall_MaskLpEvent |
547 HvCall_MaskLpProd |
548 HvCall_MaskTimeout);
549
550 tb = get_tb();
551 /* Compute future tb value when yield should expire */
552 HvCall_yieldProcessor(HvCall_YieldTimed, tb+tb_ticks_per_jiffy);
553
554 /*
555 * The decrementer stops during the yield. Force a fake decrementer
556 * here and let the timer_interrupt code sort out the actual time.
557 */
558 get_lppaca()->int_dword.fields.decr_int = 1;
559 ppc64_runlatch_on();
560 process_iSeries_events();
561}
562
563static void iseries_shared_idle(void)
564{
565 while (1) {
566 tick_nohz_idle_enter();
567 rcu_idle_enter();
568 while (!need_resched() && !hvlpevent_is_pending()) {
569 local_irq_disable();
570 ppc64_runlatch_off();
571
572 /* Recheck with irqs off */
573 if (!need_resched() && !hvlpevent_is_pending())
574 yield_shared_processor();
575
576 HMT_medium();
577 local_irq_enable();
578 }
579
580 ppc64_runlatch_on();
581 rcu_idle_exit();
582 tick_nohz_idle_exit();
583
584 if (hvlpevent_is_pending())
585 process_iSeries_events();
586
587 schedule_preempt_disabled();
588 }
589}
590
591static void iseries_dedicated_idle(void)
592{
593 set_thread_flag(TIF_POLLING_NRFLAG);
594
595 while (1) {
596 tick_nohz_idle_enter();
597 rcu_idle_enter();
598 if (!need_resched()) {
599 while (!need_resched()) {
600 ppc64_runlatch_off();
601 HMT_low();
602
603 if (hvlpevent_is_pending()) {
604 HMT_medium();
605 ppc64_runlatch_on();
606 process_iSeries_events();
607 }
608 }
609
610 HMT_medium();
611 }
612
613 ppc64_runlatch_on();
614 rcu_idle_exit();
615 tick_nohz_idle_exit();
616 schedule_preempt_disabled();
617 }
618}
619
620static void __iomem *iseries_ioremap(phys_addr_t address, unsigned long size,
621 unsigned long flags, void *caller)
622{
623 return (void __iomem *)address;
624}
625
626static void iseries_iounmap(volatile void __iomem *token)
627{
628}
629
630static int __init iseries_probe(void)
631{
632 unsigned long root = of_get_flat_dt_root();
633 if (!of_flat_dt_is_compatible(root, "IBM,iSeries"))
634 return 0;
635
636 hpte_init_iSeries();
637 /* iSeries does not support 16M pages */
638 cur_cpu_spec->mmu_features &= ~MMU_FTR_16M_PAGE;
639
640 return 1;
641}
642
643#ifdef CONFIG_KEXEC
644static int iseries_kexec_prepare(struct kimage *image)
645{
646 return -ENOSYS;
647}
648#endif
649
650define_machine(iseries) {
651 .name = "iSeries",
652 .setup_arch = iSeries_setup_arch,
653 .show_cpuinfo = iSeries_show_cpuinfo,
654 .init_IRQ = iSeries_init_IRQ,
655 .get_irq = iSeries_get_irq,
656 .init_early = iSeries_init_early,
657 .pcibios_fixup = iSeries_pci_final_fixup,
658 .pcibios_fixup_resources= iSeries_pcibios_fixup_resources,
659 .restart = mf_reboot,
660 .power_off = mf_power_off,
661 .halt = mf_power_off,
662 .get_boot_time = iSeries_get_boot_time,
663 .set_rtc_time = iSeries_set_rtc_time,
664 .get_rtc_time = iSeries_get_rtc_time,
665 .calibrate_decr = generic_calibrate_decr,
666 .progress = iSeries_progress,
667 .probe = iseries_probe,
668 .ioremap = iseries_ioremap,
669 .iounmap = iseries_iounmap,
670#ifdef CONFIG_KEXEC
671 .machine_kexec_prepare = iseries_kexec_prepare,
672#endif
673 /* XXX Implement enable_pmcs for iSeries */
674};
675
676void * __init iSeries_early_setup(void)
677{
678 unsigned long phys_mem_size;
679
680 /* Identify CPU type. This is done again by the common code later
681 * on but calling this function multiple times is fine.
682 */
683 identify_cpu(0, mfspr(SPRN_PVR));
684 initialise_paca(&boot_paca, 0);
685
686 powerpc_firmware_features |= FW_FEATURE_ISERIES;
687 powerpc_firmware_features |= FW_FEATURE_LPAR;
688
689#ifdef CONFIG_SMP
690 /* On iSeries we know we can never have more than 64 cpus */
691 nr_cpu_ids = max(nr_cpu_ids, 64);
692#endif
693
694 iSeries_fixup_klimit();
695
696 /*
697 * Initialize the table which translate Linux physical addresses to
698 * AS/400 absolute addresses
699 */
700 phys_mem_size = build_iSeries_Memory_Map();
701
702 iSeries_get_cmdline();
703
704 return (void *) __pa(build_flat_dt(phys_mem_size));
705}
706
707static void hvputc(char c)
708{
709 if (c == '\n')
710 hvputc('\r');
711
712 HvCall_writeLogBuffer(&c, 1);
713}
714
715void __init udbg_init_iseries(void)
716{
717 udbg_putc = hvputc;
718}
diff --git a/arch/powerpc/platforms/iseries/setup.h b/arch/powerpc/platforms/iseries/setup.h
deleted file mode 100644
index 729754bbb01..00000000000
--- a/arch/powerpc/platforms/iseries/setup.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright (c) 2000 Mike Corrigan <mikejc@us.ibm.com>
3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
4 *
5 * Description:
6 * Architecture- / platform-specific boot-time initialization code for
7 * the IBM AS/400 LPAR. Adapted from original code by Grant Erickson and
8 * code by Gary Thomas, Cort Dougan <cort@cs.nmt.edu>, and Dan Malek
9 * <dan@netx4.com>.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16
17#ifndef __ISERIES_SETUP_H__
18#define __ISERIES_SETUP_H__
19
20extern void *iSeries_early_setup(void);
21extern unsigned long iSeries_get_boot_time(void);
22extern int iSeries_set_rtc_time(struct rtc_time *tm);
23extern void iSeries_get_rtc_time(struct rtc_time *tm);
24
25extern void *build_flat_dt(unsigned long phys_mem_size);
26
27#endif /* __ISERIES_SETUP_H__ */
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
deleted file mode 100644
index 02df49fb59f..00000000000
--- a/arch/powerpc/platforms/iseries/smp.c
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * SMP support for iSeries machines.
3 *
4 * Dave Engebretsen, Peter Bergner, and
5 * Mike Corrigan {engebret|bergner|mikec}@us.ibm.com
6 *
7 * Plus various changes from other IBM teams...
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#undef DEBUG
16
17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/smp.h>
20#include <linux/interrupt.h>
21#include <linux/kernel_stat.h>
22#include <linux/delay.h>
23#include <linux/init.h>
24#include <linux/spinlock.h>
25#include <linux/cache.h>
26#include <linux/err.h>
27#include <linux/device.h>
28#include <linux/cpu.h>
29
30#include <asm/ptrace.h>
31#include <linux/atomic.h>
32#include <asm/irq.h>
33#include <asm/page.h>
34#include <asm/pgtable.h>
35#include <asm/io.h>
36#include <asm/smp.h>
37#include <asm/paca.h>
38#include <asm/iseries/hv_call.h>
39#include <asm/time.h>
40#include <asm/machdep.h>
41#include <asm/cputable.h>
42#include <asm/system.h>
43
44static void smp_iSeries_cause_ipi(int cpu, unsigned long data)
45{
46 HvCall_sendIPI(&(paca[cpu]));
47}
48
49static int smp_iSeries_probe(void)
50{
51 return cpumask_weight(cpu_possible_mask);
52}
53
54static int smp_iSeries_kick_cpu(int nr)
55{
56 BUG_ON((nr < 0) || (nr >= NR_CPUS));
57
58 /* Verify that our partition has a processor nr */
59 if (lppaca_of(nr).dyn_proc_status >= 2)
60 return -ENOENT;
61
62 /* The processor is currently spinning, waiting
63 * for the cpu_start field to become non-zero
64 * After we set cpu_start, the processor will
65 * continue on to secondary_start in iSeries_head.S
66 */
67 paca[nr].cpu_start = 1;
68
69 return 0;
70}
71
72static void __devinit smp_iSeries_setup_cpu(int nr)
73{
74}
75
76static struct smp_ops_t iSeries_smp_ops = {
77 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
78 .cause_ipi = smp_iSeries_cause_ipi,
79 .probe = smp_iSeries_probe,
80 .kick_cpu = smp_iSeries_kick_cpu,
81 .setup_cpu = smp_iSeries_setup_cpu,
82};
83
84/* This is called very early. */
85void __init smp_init_iSeries(void)
86{
87 smp_ops = &iSeries_smp_ops;
88}
diff --git a/arch/powerpc/platforms/iseries/spcomm_area.h b/arch/powerpc/platforms/iseries/spcomm_area.h
deleted file mode 100644
index 598b7c14573..00000000000
--- a/arch/powerpc/platforms/iseries/spcomm_area.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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 _ISERIES_SPCOMM_AREA_H
20#define _ISERIES_SPCOMM_AREA_H
21
22
23struct SpCommArea {
24 u32 xDesc; // Descriptor (only in new formats) 000-003
25 u8 xFormat; // Format (only in new formats) 004-004
26 u8 xRsvd1[11]; // Reserved 005-00F
27 u64 xRawTbAtIplStart; // Raw HW TB value when IPL is started 010-017
28 u64 xRawTodAtIplStart; // Raw HW TOD value when IPL is started 018-01F
29 u64 xBcdTimeAtIplStart; // BCD time when IPL is started 020-027
30 u64 xBcdTimeAtOsStart; // BCD time when OS passed control 028-02F
31 u8 xRsvd2[80]; // Reserved 030-07F
32};
33
34#endif /* _ISERIES_SPCOMM_AREA_H */
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
deleted file mode 100644
index 04be62d368a..00000000000
--- a/arch/powerpc/platforms/iseries/vio.c
+++ /dev/null
@@ -1,556 +0,0 @@
1/*
2 * Legacy iSeries specific vio initialisation
3 * that needs to be built in (not a module).
4 *
5 * © Copyright 2007 IBM Corporation
6 * Author: Stephen Rothwell
7 * Some parts collected from various other files
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; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#include <linux/of.h>
24#include <linux/init.h>
25#include <linux/slab.h>
26#include <linux/completion.h>
27#include <linux/proc_fs.h>
28#include <linux/export.h>
29
30#include <asm/firmware.h>
31#include <asm/vio.h>
32#include <asm/iseries/vio.h>
33#include <asm/iseries/iommu.h>
34#include <asm/iseries/hv_types.h>
35#include <asm/iseries/hv_lp_event.h>
36
37#define FIRST_VTY 0
38#define NUM_VTYS 1
39#define FIRST_VSCSI (FIRST_VTY + NUM_VTYS)
40#define NUM_VSCSIS 1
41#define FIRST_VLAN (FIRST_VSCSI + NUM_VSCSIS)
42#define NUM_VLANS HVMAXARCHITECTEDVIRTUALLANS
43#define FIRST_VIODASD (FIRST_VLAN + NUM_VLANS)
44#define NUM_VIODASDS HVMAXARCHITECTEDVIRTUALDISKS
45#define FIRST_VIOCD (FIRST_VIODASD + NUM_VIODASDS)
46#define NUM_VIOCDS HVMAXARCHITECTEDVIRTUALCDROMS
47#define FIRST_VIOTAPE (FIRST_VIOCD + NUM_VIOCDS)
48#define NUM_VIOTAPES HVMAXARCHITECTEDVIRTUALTAPES
49
50struct vio_waitevent {
51 struct completion com;
52 int rc;
53 u16 sub_result;
54};
55
56struct vio_resource {
57 char rsrcname[10];
58 char type[4];
59 char model[3];
60};
61
62static struct property *new_property(const char *name, int length,
63 const void *value)
64{
65 struct property *np = kzalloc(sizeof(*np) + strlen(name) + 1 + length,
66 GFP_KERNEL);
67
68 if (!np)
69 return NULL;
70 np->name = (char *)(np + 1);
71 np->value = np->name + strlen(name) + 1;
72 strcpy(np->name, name);
73 memcpy(np->value, value, length);
74 np->length = length;
75 return np;
76}
77
78static void free_property(struct property *np)
79{
80 kfree(np);
81}
82
83static struct device_node *new_node(const char *path,
84 struct device_node *parent)
85{
86 struct device_node *np = kzalloc(sizeof(*np), GFP_KERNEL);
87
88 if (!np)
89 return NULL;
90 np->full_name = kstrdup(path, GFP_KERNEL);
91 if (!np->full_name) {
92 kfree(np);
93 return NULL;
94 }
95 of_node_set_flag(np, OF_DYNAMIC);
96 kref_init(&np->kref);
97 np->parent = of_node_get(parent);
98 return np;
99}
100
101static void free_node(struct device_node *np)
102{
103 struct property *next;
104 struct property *prop;
105
106 next = np->properties;
107 while (next) {
108 prop = next;
109 next = prop->next;
110 free_property(prop);
111 }
112 of_node_put(np->parent);
113 kfree(np->full_name);
114 kfree(np);
115}
116
117static int add_string_property(struct device_node *np, const char *name,
118 const char *value)
119{
120 struct property *nprop = new_property(name, strlen(value) + 1, value);
121
122 if (!nprop)
123 return 0;
124 prom_add_property(np, nprop);
125 return 1;
126}
127
128static int add_raw_property(struct device_node *np, const char *name,
129 int length, const void *value)
130{
131 struct property *nprop = new_property(name, length, value);
132
133 if (!nprop)
134 return 0;
135 prom_add_property(np, nprop);
136 return 1;
137}
138
139static struct device_node *do_device_node(struct device_node *parent,
140 const char *name, u32 reg, u32 unit, const char *type,
141 const char *compat, struct vio_resource *res)
142{
143 struct device_node *np;
144 char path[32];
145
146 snprintf(path, sizeof(path), "/vdevice/%s@%08x", name, reg);
147 np = new_node(path, parent);
148 if (!np)
149 return NULL;
150 if (!add_string_property(np, "name", name) ||
151 !add_string_property(np, "device_type", type) ||
152 !add_string_property(np, "compatible", compat) ||
153 !add_raw_property(np, "reg", sizeof(reg), &reg) ||
154 !add_raw_property(np, "linux,unit_address",
155 sizeof(unit), &unit)) {
156 goto node_free;
157 }
158 if (res) {
159 if (!add_raw_property(np, "linux,vio_rsrcname",
160 sizeof(res->rsrcname), res->rsrcname) ||
161 !add_raw_property(np, "linux,vio_type",
162 sizeof(res->type), res->type) ||
163 !add_raw_property(np, "linux,vio_model",
164 sizeof(res->model), res->model))
165 goto node_free;
166 }
167 np->name = of_get_property(np, "name", NULL);
168 np->type = of_get_property(np, "device_type", NULL);
169 of_attach_node(np);
170#ifdef CONFIG_PROC_DEVICETREE
171 if (parent->pde) {
172 struct proc_dir_entry *ent;
173
174 ent = proc_mkdir(strrchr(np->full_name, '/') + 1, parent->pde);
175 if (ent)
176 proc_device_tree_add_node(np, ent);
177 }
178#endif
179 return np;
180
181 node_free:
182 free_node(np);
183 return NULL;
184}
185
186/*
187 * This is here so that we can dynamically add viodasd
188 * devices without exposing all the above infrastructure.
189 */
190struct vio_dev *vio_create_viodasd(u32 unit)
191{
192 struct device_node *vio_root;
193 struct device_node *np;
194 struct vio_dev *vdev = NULL;
195
196 vio_root = of_find_node_by_path("/vdevice");
197 if (!vio_root)
198 return NULL;
199 np = do_device_node(vio_root, "viodasd", FIRST_VIODASD + unit, unit,
200 "block", "IBM,iSeries-viodasd", NULL);
201 of_node_put(vio_root);
202 if (np) {
203 vdev = vio_register_device_node(np);
204 if (!vdev)
205 free_node(np);
206 }
207 return vdev;
208}
209EXPORT_SYMBOL_GPL(vio_create_viodasd);
210
211static void __init handle_block_event(struct HvLpEvent *event)
212{
213 struct vioblocklpevent *bevent = (struct vioblocklpevent *)event;
214 struct vio_waitevent *pwe;
215
216 if (event == NULL)
217 /* Notification that a partition went away! */
218 return;
219 /* First, we should NEVER get an int here...only acks */
220 if (hvlpevent_is_int(event)) {
221 printk(KERN_WARNING "handle_viod_request: "
222 "Yikes! got an int in viodasd event handler!\n");
223 if (hvlpevent_need_ack(event)) {
224 event->xRc = HvLpEvent_Rc_InvalidSubtype;
225 HvCallEvent_ackLpEvent(event);
226 }
227 return;
228 }
229
230 switch (event->xSubtype & VIOMINOR_SUBTYPE_MASK) {
231 case vioblockopen:
232 /*
233 * Handle a response to an open request. We get all the
234 * disk information in the response, so update it. The
235 * correlation token contains a pointer to a waitevent
236 * structure that has a completion in it. update the
237 * return code in the waitevent structure and post the
238 * completion to wake up the guy who sent the request
239 */
240 pwe = (struct vio_waitevent *)event->xCorrelationToken;
241 pwe->rc = event->xRc;
242 pwe->sub_result = bevent->sub_result;
243 complete(&pwe->com);
244 break;
245 case vioblockclose:
246 break;
247 default:
248 printk(KERN_WARNING "handle_viod_request: unexpected subtype!");
249 if (hvlpevent_need_ack(event)) {
250 event->xRc = HvLpEvent_Rc_InvalidSubtype;
251 HvCallEvent_ackLpEvent(event);
252 }
253 }
254}
255
256static void __init probe_disk(struct device_node *vio_root, u32 unit)
257{
258 HvLpEvent_Rc hvrc;
259 struct vio_waitevent we;
260 u16 flags = 0;
261
262retry:
263 init_completion(&we.com);
264
265 /* Send the open event to OS/400 */
266 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
267 HvLpEvent_Type_VirtualIo,
268 viomajorsubtype_blockio | vioblockopen,
269 HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
270 viopath_sourceinst(viopath_hostLp),
271 viopath_targetinst(viopath_hostLp),
272 (u64)(unsigned long)&we, VIOVERSION << 16,
273 ((u64)unit << 48) | ((u64)flags<< 32),
274 0, 0, 0);
275 if (hvrc != 0) {
276 printk(KERN_WARNING "probe_disk: bad rc on HV open %d\n",
277 (int)hvrc);
278 return;
279 }
280
281 wait_for_completion(&we.com);
282
283 if (we.rc != 0) {
284 if (flags != 0)
285 return;
286 /* try again with read only flag set */
287 flags = vioblockflags_ro;
288 goto retry;
289 }
290
291 /* Send the close event to OS/400. We DON'T expect a response */
292 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
293 HvLpEvent_Type_VirtualIo,
294 viomajorsubtype_blockio | vioblockclose,
295 HvLpEvent_AckInd_NoAck, HvLpEvent_AckType_ImmediateAck,
296 viopath_sourceinst(viopath_hostLp),
297 viopath_targetinst(viopath_hostLp),
298 0, VIOVERSION << 16,
299 ((u64)unit << 48) | ((u64)flags << 32),
300 0, 0, 0);
301 if (hvrc != 0) {
302 printk(KERN_WARNING "probe_disk: "
303 "bad rc sending event to OS/400 %d\n", (int)hvrc);
304 return;
305 }
306
307 do_device_node(vio_root, "viodasd", FIRST_VIODASD + unit, unit,
308 "block", "IBM,iSeries-viodasd", NULL);
309}
310
311static void __init get_viodasd_info(struct device_node *vio_root)
312{
313 int rc;
314 u32 unit;
315
316 rc = viopath_open(viopath_hostLp, viomajorsubtype_blockio, 2);
317 if (rc) {
318 printk(KERN_WARNING "get_viodasd_info: "
319 "error opening path to host partition %d\n",
320 viopath_hostLp);
321 return;
322 }
323
324 /* Initialize our request handler */
325 vio_setHandler(viomajorsubtype_blockio, handle_block_event);
326
327 for (unit = 0; unit < HVMAXARCHITECTEDVIRTUALDISKS; unit++)
328 probe_disk(vio_root, unit);
329
330 vio_clearHandler(viomajorsubtype_blockio);
331 viopath_close(viopath_hostLp, viomajorsubtype_blockio, 2);
332}
333
334static void __init handle_cd_event(struct HvLpEvent *event)
335{
336 struct viocdlpevent *bevent;
337 struct vio_waitevent *pwe;
338
339 if (!event)
340 /* Notification that a partition went away! */
341 return;
342
343 /* First, we should NEVER get an int here...only acks */
344 if (hvlpevent_is_int(event)) {
345 printk(KERN_WARNING "handle_cd_event: got an unexpected int\n");
346 if (hvlpevent_need_ack(event)) {
347 event->xRc = HvLpEvent_Rc_InvalidSubtype;
348 HvCallEvent_ackLpEvent(event);
349 }
350 return;
351 }
352
353 bevent = (struct viocdlpevent *)event;
354
355 switch (event->xSubtype & VIOMINOR_SUBTYPE_MASK) {
356 case viocdgetinfo:
357 pwe = (struct vio_waitevent *)event->xCorrelationToken;
358 pwe->rc = event->xRc;
359 pwe->sub_result = bevent->sub_result;
360 complete(&pwe->com);
361 break;
362
363 default:
364 printk(KERN_WARNING "handle_cd_event: "
365 "message with unexpected subtype %0x04X!\n",
366 event->xSubtype & VIOMINOR_SUBTYPE_MASK);
367 if (hvlpevent_need_ack(event)) {
368 event->xRc = HvLpEvent_Rc_InvalidSubtype;
369 HvCallEvent_ackLpEvent(event);
370 }
371 }
372}
373
374static void __init get_viocd_info(struct device_node *vio_root)
375{
376 HvLpEvent_Rc hvrc;
377 u32 unit;
378 struct vio_waitevent we;
379 struct vio_resource *unitinfo;
380 dma_addr_t unitinfo_dmaaddr;
381 int ret;
382
383 ret = viopath_open(viopath_hostLp, viomajorsubtype_cdio, 2);
384 if (ret) {
385 printk(KERN_WARNING
386 "get_viocd_info: error opening path to host partition %d\n",
387 viopath_hostLp);
388 return;
389 }
390
391 /* Initialize our request handler */
392 vio_setHandler(viomajorsubtype_cdio, handle_cd_event);
393
394 unitinfo = iseries_hv_alloc(
395 sizeof(*unitinfo) * HVMAXARCHITECTEDVIRTUALCDROMS,
396 &unitinfo_dmaaddr, GFP_ATOMIC);
397 if (!unitinfo) {
398 printk(KERN_WARNING
399 "get_viocd_info: error allocating unitinfo\n");
400 goto clear_handler;
401 }
402
403 memset(unitinfo, 0, sizeof(*unitinfo) * HVMAXARCHITECTEDVIRTUALCDROMS);
404
405 init_completion(&we.com);
406
407 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
408 HvLpEvent_Type_VirtualIo,
409 viomajorsubtype_cdio | viocdgetinfo,
410 HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
411 viopath_sourceinst(viopath_hostLp),
412 viopath_targetinst(viopath_hostLp),
413 (u64)&we, VIOVERSION << 16, unitinfo_dmaaddr, 0,
414 sizeof(*unitinfo) * HVMAXARCHITECTEDVIRTUALCDROMS, 0);
415 if (hvrc != HvLpEvent_Rc_Good) {
416 printk(KERN_WARNING
417 "get_viocd_info: cdrom error sending event. rc %d\n",
418 (int)hvrc);
419 goto hv_free;
420 }
421
422 wait_for_completion(&we.com);
423
424 if (we.rc) {
425 printk(KERN_WARNING "get_viocd_info: bad rc %d:0x%04X\n",
426 we.rc, we.sub_result);
427 goto hv_free;
428 }
429
430 for (unit = 0; (unit < HVMAXARCHITECTEDVIRTUALCDROMS) &&
431 unitinfo[unit].rsrcname[0]; unit++) {
432 if (!do_device_node(vio_root, "viocd", FIRST_VIOCD + unit, unit,
433 "block", "IBM,iSeries-viocd", &unitinfo[unit]))
434 break;
435 }
436
437 hv_free:
438 iseries_hv_free(sizeof(*unitinfo) * HVMAXARCHITECTEDVIRTUALCDROMS,
439 unitinfo, unitinfo_dmaaddr);
440 clear_handler:
441 vio_clearHandler(viomajorsubtype_cdio);
442 viopath_close(viopath_hostLp, viomajorsubtype_cdio, 2);
443}
444
445/* Handle interrupt events for tape */
446static void __init handle_tape_event(struct HvLpEvent *event)
447{
448 struct vio_waitevent *we;
449 struct viotapelpevent *tevent = (struct viotapelpevent *)event;
450
451 if (event == NULL)
452 /* Notification that a partition went away! */
453 return;
454
455 we = (struct vio_waitevent *)event->xCorrelationToken;
456 switch (event->xSubtype & VIOMINOR_SUBTYPE_MASK) {
457 case viotapegetinfo:
458 we->rc = tevent->sub_type_result;
459 complete(&we->com);
460 break;
461 default:
462 printk(KERN_WARNING "handle_tape_event: weird ack\n");
463 }
464}
465
466static void __init get_viotape_info(struct device_node *vio_root)
467{
468 HvLpEvent_Rc hvrc;
469 u32 unit;
470 struct vio_resource *unitinfo;
471 dma_addr_t unitinfo_dmaaddr;
472 size_t len = sizeof(*unitinfo) * HVMAXARCHITECTEDVIRTUALTAPES;
473 struct vio_waitevent we;
474 int ret;
475
476 init_completion(&we.com);
477
478 ret = viopath_open(viopath_hostLp, viomajorsubtype_tape, 2);
479 if (ret) {
480 printk(KERN_WARNING "get_viotape_info: "
481 "error on viopath_open to hostlp %d\n", ret);
482 return;
483 }
484
485 vio_setHandler(viomajorsubtype_tape, handle_tape_event);
486
487 unitinfo = iseries_hv_alloc(len, &unitinfo_dmaaddr, GFP_ATOMIC);
488 if (!unitinfo)
489 goto clear_handler;
490
491 memset(unitinfo, 0, len);
492
493 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
494 HvLpEvent_Type_VirtualIo,
495 viomajorsubtype_tape | viotapegetinfo,
496 HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
497 viopath_sourceinst(viopath_hostLp),
498 viopath_targetinst(viopath_hostLp),
499 (u64)(unsigned long)&we, VIOVERSION << 16,
500 unitinfo_dmaaddr, len, 0, 0);
501 if (hvrc != HvLpEvent_Rc_Good) {
502 printk(KERN_WARNING "get_viotape_info: hv error on op %d\n",
503 (int)hvrc);
504 goto hv_free;
505 }
506
507 wait_for_completion(&we.com);
508
509 for (unit = 0; (unit < HVMAXARCHITECTEDVIRTUALTAPES) &&
510 unitinfo[unit].rsrcname[0]; unit++) {
511 if (!do_device_node(vio_root, "viotape", FIRST_VIOTAPE + unit,
512 unit, "byte", "IBM,iSeries-viotape",
513 &unitinfo[unit]))
514 break;
515 }
516
517 hv_free:
518 iseries_hv_free(len, unitinfo, unitinfo_dmaaddr);
519 clear_handler:
520 vio_clearHandler(viomajorsubtype_tape);
521 viopath_close(viopath_hostLp, viomajorsubtype_tape, 2);
522}
523
524static int __init iseries_vio_init(void)
525{
526 struct device_node *vio_root;
527 int ret = -ENODEV;
528
529 if (!firmware_has_feature(FW_FEATURE_ISERIES))
530 goto out;
531
532 iommu_vio_init();
533
534 vio_root = of_find_node_by_path("/vdevice");
535 if (!vio_root)
536 goto out;
537
538 if (viopath_hostLp == HvLpIndexInvalid) {
539 vio_set_hostlp();
540 /* If we don't have a host, bail out */
541 if (viopath_hostLp == HvLpIndexInvalid)
542 goto put_node;
543 }
544
545 get_viodasd_info(vio_root);
546 get_viocd_info(vio_root);
547 get_viotape_info(vio_root);
548
549 ret = 0;
550
551 put_node:
552 of_node_put(vio_root);
553 out:
554 return ret;
555}
556arch_initcall(iseries_vio_init);
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c
deleted file mode 100644
index 40dad0840eb..00000000000
--- a/arch/powerpc/platforms/iseries/viopath.c
+++ /dev/null
@@ -1,677 +0,0 @@
1/* -*- linux-c -*-
2 *
3 * iSeries Virtual I/O Message Path code
4 *
5 * Authors: Dave Boutcher <boutcher@us.ibm.com>
6 * Ryan Arnold <ryanarn@us.ibm.com>
7 * Colin Devilbiss <devilbis@us.ibm.com>
8 *
9 * (C) Copyright 2000-2005 IBM Corporation
10 *
11 * This code is used by the iSeries virtual disk, cd,
12 * tape, and console to communicate with OS/400 in another
13 * partition.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of the
18 * License, or (at your option) anyu later version.
19 *
20 * This program is distributed in the hope that it will be useful, but
21 * WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software Foundation,
27 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 *
29 */
30#include <linux/export.h>
31#include <linux/kernel.h>
32#include <linux/slab.h>
33#include <linux/errno.h>
34#include <linux/vmalloc.h>
35#include <linux/string.h>
36#include <linux/proc_fs.h>
37#include <linux/dma-mapping.h>
38#include <linux/wait.h>
39#include <linux/seq_file.h>
40#include <linux/interrupt.h>
41#include <linux/completion.h>
42
43#include <asm/system.h>
44#include <asm/uaccess.h>
45#include <asm/prom.h>
46#include <asm/firmware.h>
47#include <asm/iseries/hv_types.h>
48#include <asm/iseries/hv_lp_event.h>
49#include <asm/iseries/hv_lp_config.h>
50#include <asm/iseries/mf.h>
51#include <asm/iseries/vio.h>
52
53/* Status of the path to each other partition in the system.
54 * This is overkill, since we will only ever establish connections
55 * to our hosting partition and the primary partition on the system.
56 * But this allows for other support in the future.
57 */
58static struct viopathStatus {
59 int isOpen; /* Did we open the path? */
60 int isActive; /* Do we have a mon msg outstanding */
61 int users[VIO_MAX_SUBTYPES];
62 HvLpInstanceId mSourceInst;
63 HvLpInstanceId mTargetInst;
64 int numberAllocated;
65} viopathStatus[HVMAXARCHITECTEDLPS];
66
67static DEFINE_SPINLOCK(statuslock);
68
69/*
70 * For each kind of event we allocate a buffer that is
71 * guaranteed not to cross a page boundary
72 */
73static unsigned char event_buffer[VIO_MAX_SUBTYPES * 256]
74 __attribute__((__aligned__(4096)));
75static atomic_t event_buffer_available[VIO_MAX_SUBTYPES];
76static int event_buffer_initialised;
77
78static void handleMonitorEvent(struct HvLpEvent *event);
79
80/*
81 * We use this structure to handle asynchronous responses. The caller
82 * blocks on the semaphore and the handler posts the semaphore. However,
83 * if system_state is not SYSTEM_RUNNING, then wait_atomic is used ...
84 */
85struct alloc_parms {
86 struct completion done;
87 int number;
88 atomic_t wait_atomic;
89 int used_wait_atomic;
90};
91
92/* Put a sequence number in each mon msg. The value is not
93 * important. Start at something other than 0 just for
94 * readability. wrapping this is ok.
95 */
96static u8 viomonseq = 22;
97
98/* Our hosting logical partition. We get this at startup
99 * time, and different modules access this variable directly.
100 */
101HvLpIndex viopath_hostLp = HvLpIndexInvalid;
102EXPORT_SYMBOL(viopath_hostLp);
103HvLpIndex viopath_ourLp = HvLpIndexInvalid;
104EXPORT_SYMBOL(viopath_ourLp);
105
106/* For each kind of incoming event we set a pointer to a
107 * routine to call.
108 */
109static vio_event_handler_t *vio_handler[VIO_MAX_SUBTYPES];
110
111#define VIOPATH_KERN_WARN KERN_WARNING "viopath: "
112#define VIOPATH_KERN_INFO KERN_INFO "viopath: "
113
114static int proc_viopath_show(struct seq_file *m, void *v)
115{
116 char *buf;
117 u16 vlanMap;
118 dma_addr_t handle;
119 HvLpEvent_Rc hvrc;
120 DECLARE_COMPLETION_ONSTACK(done);
121 struct device_node *node;
122 const char *sysid;
123
124 buf = kzalloc(HW_PAGE_SIZE, GFP_KERNEL);
125 if (!buf)
126 return 0;
127
128 handle = iseries_hv_map(buf, HW_PAGE_SIZE, DMA_FROM_DEVICE);
129
130 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
131 HvLpEvent_Type_VirtualIo,
132 viomajorsubtype_config | vioconfigget,
133 HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
134 viopath_sourceinst(viopath_hostLp),
135 viopath_targetinst(viopath_hostLp),
136 (u64)(unsigned long)&done, VIOVERSION << 16,
137 ((u64)handle) << 32, HW_PAGE_SIZE, 0, 0);
138
139 if (hvrc != HvLpEvent_Rc_Good)
140 printk(VIOPATH_KERN_WARN "hv error on op %d\n", (int)hvrc);
141
142 wait_for_completion(&done);
143
144 vlanMap = HvLpConfig_getVirtualLanIndexMap();
145
146 buf[HW_PAGE_SIZE-1] = '\0';
147 seq_printf(m, "%s", buf);
148
149 iseries_hv_unmap(handle, HW_PAGE_SIZE, DMA_FROM_DEVICE);
150 kfree(buf);
151
152 seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap);
153
154 node = of_find_node_by_path("/");
155 sysid = NULL;
156 if (node != NULL)
157 sysid = of_get_property(node, "system-id", NULL);
158
159 if (sysid == NULL)
160 seq_printf(m, "SRLNBR=<UNKNOWN>\n");
161 else
162 /* Skip "IBM," on front of serial number, see dt.c */
163 seq_printf(m, "SRLNBR=%s\n", sysid + 4);
164
165 of_node_put(node);
166
167 return 0;
168}
169
170static int proc_viopath_open(struct inode *inode, struct file *file)
171{
172 return single_open(file, proc_viopath_show, NULL);
173}
174
175static const struct file_operations proc_viopath_operations = {
176 .open = proc_viopath_open,
177 .read = seq_read,
178 .llseek = seq_lseek,
179 .release = single_release,
180};
181
182static int __init vio_proc_init(void)
183{
184 if (!firmware_has_feature(FW_FEATURE_ISERIES))
185 return 0;
186
187 proc_create("iSeries/config", 0, NULL, &proc_viopath_operations);
188 return 0;
189}
190__initcall(vio_proc_init);
191
192/* See if a given LP is active. Allow for invalid lps to be passed in
193 * and just return invalid
194 */
195int viopath_isactive(HvLpIndex lp)
196{
197 if (lp == HvLpIndexInvalid)
198 return 0;
199 if (lp < HVMAXARCHITECTEDLPS)
200 return viopathStatus[lp].isActive;
201 else
202 return 0;
203}
204EXPORT_SYMBOL(viopath_isactive);
205
206/*
207 * We cache the source and target instance ids for each
208 * partition.
209 */
210HvLpInstanceId viopath_sourceinst(HvLpIndex lp)
211{
212 return viopathStatus[lp].mSourceInst;
213}
214EXPORT_SYMBOL(viopath_sourceinst);
215
216HvLpInstanceId viopath_targetinst(HvLpIndex lp)
217{
218 return viopathStatus[lp].mTargetInst;
219}
220EXPORT_SYMBOL(viopath_targetinst);
221
222/*
223 * Send a monitor message. This is a message with the acknowledge
224 * bit on that the other side will NOT explicitly acknowledge. When
225 * the other side goes down, the hypervisor will acknowledge any
226 * outstanding messages....so we will know when the other side dies.
227 */
228static void sendMonMsg(HvLpIndex remoteLp)
229{
230 HvLpEvent_Rc hvrc;
231
232 viopathStatus[remoteLp].mSourceInst =
233 HvCallEvent_getSourceLpInstanceId(remoteLp,
234 HvLpEvent_Type_VirtualIo);
235 viopathStatus[remoteLp].mTargetInst =
236 HvCallEvent_getTargetLpInstanceId(remoteLp,
237 HvLpEvent_Type_VirtualIo);
238
239 /*
240 * Deliberately ignore the return code here. if we call this
241 * more than once, we don't care.
242 */
243 vio_setHandler(viomajorsubtype_monitor, handleMonitorEvent);
244
245 hvrc = HvCallEvent_signalLpEventFast(remoteLp, HvLpEvent_Type_VirtualIo,
246 viomajorsubtype_monitor, HvLpEvent_AckInd_DoAck,
247 HvLpEvent_AckType_DeferredAck,
248 viopathStatus[remoteLp].mSourceInst,
249 viopathStatus[remoteLp].mTargetInst,
250 viomonseq++, 0, 0, 0, 0, 0);
251
252 if (hvrc == HvLpEvent_Rc_Good)
253 viopathStatus[remoteLp].isActive = 1;
254 else {
255 printk(VIOPATH_KERN_WARN "could not connect to partition %d\n",
256 remoteLp);
257 viopathStatus[remoteLp].isActive = 0;
258 }
259}
260
261static void handleMonitorEvent(struct HvLpEvent *event)
262{
263 HvLpIndex remoteLp;
264 int i;
265
266 /*
267 * This handler is _also_ called as part of the loop
268 * at the end of this routine, so it must be able to
269 * ignore NULL events...
270 */
271 if (!event)
272 return;
273
274 /*
275 * First see if this is just a normal monitor message from the
276 * other partition
277 */
278 if (hvlpevent_is_int(event)) {
279 remoteLp = event->xSourceLp;
280 if (!viopathStatus[remoteLp].isActive)
281 sendMonMsg(remoteLp);
282 return;
283 }
284
285 /*
286 * This path is for an acknowledgement; the other partition
287 * died
288 */
289 remoteLp = event->xTargetLp;
290 if ((event->xSourceInstanceId != viopathStatus[remoteLp].mSourceInst) ||
291 (event->xTargetInstanceId != viopathStatus[remoteLp].mTargetInst)) {
292 printk(VIOPATH_KERN_WARN "ignoring ack....mismatched instances\n");
293 return;
294 }
295
296 printk(VIOPATH_KERN_WARN "partition %d ended\n", remoteLp);
297
298 viopathStatus[remoteLp].isActive = 0;
299
300 /*
301 * For each active handler, pass them a NULL
302 * message to indicate that the other partition
303 * died
304 */
305 for (i = 0; i < VIO_MAX_SUBTYPES; i++) {
306 if (vio_handler[i] != NULL)
307 (*vio_handler[i])(NULL);
308 }
309}
310
311int vio_setHandler(int subtype, vio_event_handler_t *beh)
312{
313 subtype = subtype >> VIOMAJOR_SUBTYPE_SHIFT;
314 if ((subtype < 0) || (subtype >= VIO_MAX_SUBTYPES))
315 return -EINVAL;
316 if (vio_handler[subtype] != NULL)
317 return -EBUSY;
318 vio_handler[subtype] = beh;
319 return 0;
320}
321EXPORT_SYMBOL(vio_setHandler);
322
323int vio_clearHandler(int subtype)
324{
325 subtype = subtype >> VIOMAJOR_SUBTYPE_SHIFT;
326 if ((subtype < 0) || (subtype >= VIO_MAX_SUBTYPES))
327 return -EINVAL;
328 if (vio_handler[subtype] == NULL)
329 return -EAGAIN;
330 vio_handler[subtype] = NULL;
331 return 0;
332}
333EXPORT_SYMBOL(vio_clearHandler);
334
335static void handleConfig(struct HvLpEvent *event)
336{
337 if (!event)
338 return;
339 if (hvlpevent_is_int(event)) {
340 printk(VIOPATH_KERN_WARN
341 "unexpected config request from partition %d",
342 event->xSourceLp);
343
344 if (hvlpevent_need_ack(event)) {
345 event->xRc = HvLpEvent_Rc_InvalidSubtype;
346 HvCallEvent_ackLpEvent(event);
347 }
348 return;
349 }
350
351 complete((struct completion *)event->xCorrelationToken);
352}
353
354/*
355 * Initialization of the hosting partition
356 */
357void vio_set_hostlp(void)
358{
359 /*
360 * If this has already been set then we DON'T want to either change
361 * it or re-register the proc file system
362 */
363 if (viopath_hostLp != HvLpIndexInvalid)
364 return;
365
366 /*
367 * Figure out our hosting partition. This isn't allowed to change
368 * while we're active
369 */
370 viopath_ourLp = HvLpConfig_getLpIndex();
371 viopath_hostLp = HvLpConfig_getHostingLpIndex(viopath_ourLp);
372
373 if (viopath_hostLp != HvLpIndexInvalid)
374 vio_setHandler(viomajorsubtype_config, handleConfig);
375}
376EXPORT_SYMBOL(vio_set_hostlp);
377
378static void vio_handleEvent(struct HvLpEvent *event)
379{
380 HvLpIndex remoteLp;
381 int subtype = (event->xSubtype & VIOMAJOR_SUBTYPE_MASK)
382 >> VIOMAJOR_SUBTYPE_SHIFT;
383
384 if (hvlpevent_is_int(event)) {
385 remoteLp = event->xSourceLp;
386 /*
387 * The isActive is checked because if the hosting partition
388 * went down and came back up it would not be active but it
389 * would have different source and target instances, in which
390 * case we'd want to reset them. This case really protects
391 * against an unauthorized active partition sending interrupts
392 * or acks to this linux partition.
393 */
394 if (viopathStatus[remoteLp].isActive
395 && (event->xSourceInstanceId !=
396 viopathStatus[remoteLp].mTargetInst)) {
397 printk(VIOPATH_KERN_WARN
398 "message from invalid partition. "
399 "int msg rcvd, source inst (%d) doesn't match (%d)\n",
400 viopathStatus[remoteLp].mTargetInst,
401 event->xSourceInstanceId);
402 return;
403 }
404
405 if (viopathStatus[remoteLp].isActive
406 && (event->xTargetInstanceId !=
407 viopathStatus[remoteLp].mSourceInst)) {
408 printk(VIOPATH_KERN_WARN
409 "message from invalid partition. "
410 "int msg rcvd, target inst (%d) doesn't match (%d)\n",
411 viopathStatus[remoteLp].mSourceInst,
412 event->xTargetInstanceId);
413 return;
414 }
415 } else {
416 remoteLp = event->xTargetLp;
417 if (event->xSourceInstanceId !=
418 viopathStatus[remoteLp].mSourceInst) {
419 printk(VIOPATH_KERN_WARN
420 "message from invalid partition. "
421 "ack msg rcvd, source inst (%d) doesn't match (%d)\n",
422 viopathStatus[remoteLp].mSourceInst,
423 event->xSourceInstanceId);
424 return;
425 }
426
427 if (event->xTargetInstanceId !=
428 viopathStatus[remoteLp].mTargetInst) {
429 printk(VIOPATH_KERN_WARN
430 "message from invalid partition. "
431 "viopath: ack msg rcvd, target inst (%d) doesn't match (%d)\n",
432 viopathStatus[remoteLp].mTargetInst,
433 event->xTargetInstanceId);
434 return;
435 }
436 }
437
438 if (vio_handler[subtype] == NULL) {
439 printk(VIOPATH_KERN_WARN
440 "unexpected virtual io event subtype %d from partition %d\n",
441 event->xSubtype, remoteLp);
442 /* No handler. Ack if necessary */
443 if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) {
444 event->xRc = HvLpEvent_Rc_InvalidSubtype;
445 HvCallEvent_ackLpEvent(event);
446 }
447 return;
448 }
449
450 /* This innocuous little line is where all the real work happens */
451 (*vio_handler[subtype])(event);
452}
453
454static void viopath_donealloc(void *parm, int number)
455{
456 struct alloc_parms *parmsp = parm;
457
458 parmsp->number = number;
459 if (parmsp->used_wait_atomic)
460 atomic_set(&parmsp->wait_atomic, 0);
461 else
462 complete(&parmsp->done);
463}
464
465static int allocateEvents(HvLpIndex remoteLp, int numEvents)
466{
467 struct alloc_parms parms;
468
469 if (system_state != SYSTEM_RUNNING) {
470 parms.used_wait_atomic = 1;
471 atomic_set(&parms.wait_atomic, 1);
472 } else {
473 parms.used_wait_atomic = 0;
474 init_completion(&parms.done);
475 }
476 mf_allocate_lp_events(remoteLp, HvLpEvent_Type_VirtualIo, 250, /* It would be nice to put a real number here! */
477 numEvents, &viopath_donealloc, &parms);
478 if (system_state != SYSTEM_RUNNING) {
479 while (atomic_read(&parms.wait_atomic))
480 mb();
481 } else
482 wait_for_completion(&parms.done);
483 return parms.number;
484}
485
486int viopath_open(HvLpIndex remoteLp, int subtype, int numReq)
487{
488 int i;
489 unsigned long flags;
490 int tempNumAllocated;
491
492 if ((remoteLp >= HVMAXARCHITECTEDLPS) || (remoteLp == HvLpIndexInvalid))
493 return -EINVAL;
494
495 subtype = subtype >> VIOMAJOR_SUBTYPE_SHIFT;
496 if ((subtype < 0) || (subtype >= VIO_MAX_SUBTYPES))
497 return -EINVAL;
498
499 spin_lock_irqsave(&statuslock, flags);
500
501 if (!event_buffer_initialised) {
502 for (i = 0; i < VIO_MAX_SUBTYPES; i++)
503 atomic_set(&event_buffer_available[i], 1);
504 event_buffer_initialised = 1;
505 }
506
507 viopathStatus[remoteLp].users[subtype]++;
508
509 if (!viopathStatus[remoteLp].isOpen) {
510 viopathStatus[remoteLp].isOpen = 1;
511 HvCallEvent_openLpEventPath(remoteLp, HvLpEvent_Type_VirtualIo);
512
513 /*
514 * Don't hold the spinlock during an operation that
515 * can sleep.
516 */
517 spin_unlock_irqrestore(&statuslock, flags);
518 tempNumAllocated = allocateEvents(remoteLp, 1);
519 spin_lock_irqsave(&statuslock, flags);
520
521 viopathStatus[remoteLp].numberAllocated += tempNumAllocated;
522
523 if (viopathStatus[remoteLp].numberAllocated == 0) {
524 HvCallEvent_closeLpEventPath(remoteLp,
525 HvLpEvent_Type_VirtualIo);
526
527 spin_unlock_irqrestore(&statuslock, flags);
528 return -ENOMEM;
529 }
530
531 viopathStatus[remoteLp].mSourceInst =
532 HvCallEvent_getSourceLpInstanceId(remoteLp,
533 HvLpEvent_Type_VirtualIo);
534 viopathStatus[remoteLp].mTargetInst =
535 HvCallEvent_getTargetLpInstanceId(remoteLp,
536 HvLpEvent_Type_VirtualIo);
537 HvLpEvent_registerHandler(HvLpEvent_Type_VirtualIo,
538 &vio_handleEvent);
539 sendMonMsg(remoteLp);
540 printk(VIOPATH_KERN_INFO "opening connection to partition %d, "
541 "setting sinst %d, tinst %d\n",
542 remoteLp, viopathStatus[remoteLp].mSourceInst,
543 viopathStatus[remoteLp].mTargetInst);
544 }
545
546 spin_unlock_irqrestore(&statuslock, flags);
547 tempNumAllocated = allocateEvents(remoteLp, numReq);
548 spin_lock_irqsave(&statuslock, flags);
549 viopathStatus[remoteLp].numberAllocated += tempNumAllocated;
550 spin_unlock_irqrestore(&statuslock, flags);
551
552 return 0;
553}
554EXPORT_SYMBOL(viopath_open);
555
556int viopath_close(HvLpIndex remoteLp, int subtype, int numReq)
557{
558 unsigned long flags;
559 int i;
560 int numOpen;
561 struct alloc_parms parms;
562
563 if ((remoteLp >= HVMAXARCHITECTEDLPS) || (remoteLp == HvLpIndexInvalid))
564 return -EINVAL;
565
566 subtype = subtype >> VIOMAJOR_SUBTYPE_SHIFT;
567 if ((subtype < 0) || (subtype >= VIO_MAX_SUBTYPES))
568 return -EINVAL;
569
570 spin_lock_irqsave(&statuslock, flags);
571 /*
572 * If the viopath_close somehow gets called before a
573 * viopath_open it could decrement to -1 which is a non
574 * recoverable state so we'll prevent this from
575 * happening.
576 */
577 if (viopathStatus[remoteLp].users[subtype] > 0)
578 viopathStatus[remoteLp].users[subtype]--;
579
580 spin_unlock_irqrestore(&statuslock, flags);
581
582 parms.used_wait_atomic = 0;
583 init_completion(&parms.done);
584 mf_deallocate_lp_events(remoteLp, HvLpEvent_Type_VirtualIo,
585 numReq, &viopath_donealloc, &parms);
586 wait_for_completion(&parms.done);
587
588 spin_lock_irqsave(&statuslock, flags);
589 for (i = 0, numOpen = 0; i < VIO_MAX_SUBTYPES; i++)
590 numOpen += viopathStatus[remoteLp].users[i];
591
592 if ((viopathStatus[remoteLp].isOpen) && (numOpen == 0)) {
593 printk(VIOPATH_KERN_INFO "closing connection to partition %d\n",
594 remoteLp);
595
596 HvCallEvent_closeLpEventPath(remoteLp,
597 HvLpEvent_Type_VirtualIo);
598 viopathStatus[remoteLp].isOpen = 0;
599 viopathStatus[remoteLp].isActive = 0;
600
601 for (i = 0; i < VIO_MAX_SUBTYPES; i++)
602 atomic_set(&event_buffer_available[i], 0);
603 event_buffer_initialised = 0;
604 }
605 spin_unlock_irqrestore(&statuslock, flags);
606 return 0;
607}
608EXPORT_SYMBOL(viopath_close);
609
610void *vio_get_event_buffer(int subtype)
611{
612 subtype = subtype >> VIOMAJOR_SUBTYPE_SHIFT;
613 if ((subtype < 0) || (subtype >= VIO_MAX_SUBTYPES))
614 return NULL;
615
616 if (atomic_dec_if_positive(&event_buffer_available[subtype]) == 0)
617 return &event_buffer[subtype * 256];
618 else
619 return NULL;
620}
621EXPORT_SYMBOL(vio_get_event_buffer);
622
623void vio_free_event_buffer(int subtype, void *buffer)
624{
625 subtype = subtype >> VIOMAJOR_SUBTYPE_SHIFT;
626 if ((subtype < 0) || (subtype >= VIO_MAX_SUBTYPES)) {
627 printk(VIOPATH_KERN_WARN
628 "unexpected subtype %d freeing event buffer\n", subtype);
629 return;
630 }
631
632 if (atomic_read(&event_buffer_available[subtype]) != 0) {
633 printk(VIOPATH_KERN_WARN
634 "freeing unallocated event buffer, subtype %d\n",
635 subtype);
636 return;
637 }
638
639 if (buffer != &event_buffer[subtype * 256]) {
640 printk(VIOPATH_KERN_WARN
641 "freeing invalid event buffer, subtype %d\n", subtype);
642 }
643
644 atomic_set(&event_buffer_available[subtype], 1);
645}
646EXPORT_SYMBOL(vio_free_event_buffer);
647
648static const struct vio_error_entry vio_no_error =
649 { 0, 0, "Non-VIO Error" };
650static const struct vio_error_entry vio_unknown_error =
651 { 0, EIO, "Unknown Error" };
652
653static const struct vio_error_entry vio_default_errors[] = {
654 {0x0001, EIO, "No Connection"},
655 {0x0002, EIO, "No Receiver"},
656 {0x0003, EIO, "No Buffer Available"},
657 {0x0004, EBADRQC, "Invalid Message Type"},
658 {0x0000, 0, NULL},
659};
660
661const struct vio_error_entry *vio_lookup_rc(
662 const struct vio_error_entry *local_table, u16 rc)
663{
664 const struct vio_error_entry *cur;
665
666 if (!rc)
667 return &vio_no_error;
668 if (local_table)
669 for (cur = local_table; cur->rc; ++cur)
670 if (cur->rc == rc)
671 return cur;
672 for (cur = vio_default_errors; cur->rc; ++cur)
673 if (cur->rc == rc)
674 return cur;
675 return &vio_unknown_error;
676}
677EXPORT_SYMBOL(vio_lookup_rc);
diff --git a/arch/powerpc/platforms/iseries/vpd_areas.h b/arch/powerpc/platforms/iseries/vpd_areas.h
deleted file mode 100644
index feb001f3a5f..00000000000
--- a/arch/powerpc/platforms/iseries/vpd_areas.h
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
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#ifndef _ISERIES_VPD_AREAS_H
19#define _ISERIES_VPD_AREAS_H
20
21/*
22 * This file defines the address and length of all of the VPD area passed to
23 * the OS from PLIC (most of which start from the SP).
24 */
25
26#include <asm/types.h>
27
28/* VPD Entry index is carved in stone - cannot be changed (easily). */
29#define ItVpdCecVpd 0
30#define ItVpdDynamicSpace 1
31#define ItVpdExtVpd 2
32#define ItVpdExtVpdOnPanel 3
33#define ItVpdFirstPaca 4
34#define ItVpdIoVpd 5
35#define ItVpdIplParms 6
36#define ItVpdMsVpd 7
37#define ItVpdPanelVpd 8
38#define ItVpdLpNaca 9
39#define ItVpdBackplaneAndMaybeClockCardVpd 10
40#define ItVpdRecoveryLogBuffer 11
41#define ItVpdSpCommArea 12
42#define ItVpdSpLogBuffer 13
43#define ItVpdSpLogBufferSave 14
44#define ItVpdSpCardVpd 15
45#define ItVpdFirstProcVpd 16
46#define ItVpdApModelVpd 17
47#define ItVpdClockCardVpd 18
48#define ItVpdBusExtCardVpd 19
49#define ItVpdProcCapacityVpd 20
50#define ItVpdInteractiveCapacityVpd 21
51#define ItVpdFirstSlotLabel 22
52#define ItVpdFirstLpQueue 23
53#define ItVpdFirstL3CacheVpd 24
54#define ItVpdFirstProcFruVpd 25
55
56#define ItVpdMaxEntries 26
57
58#define ItDmaMaxEntries 10
59
60#define ItVpdAreasMaxSlotLabels 192
61
62
63struct ItVpdAreas {
64 u32 xSlicDesc; // Descriptor 000-003
65 u16 xSlicSize; // Size of this control block 004-005
66 u16 xPlicAdjustVpdLens:1; // Flag to indicate new interface006-007
67 u16 xRsvd1:15; // Reserved bits ...
68 u16 xSlicVpdEntries; // Number of VPD entries 008-009
69 u16 xSlicDmaEntries; // Number of DMA entries 00A-00B
70 u16 xSlicMaxLogicalProcs; // Maximum logical processors 00C-00D
71 u16 xSlicMaxPhysicalProcs; // Maximum physical processors 00E-00F
72 u16 xSlicDmaToksOffset; // Offset into this of array 010-011
73 u16 xSlicVpdAdrsOffset; // Offset into this of array 012-013
74 u16 xSlicDmaLensOffset; // Offset into this of array 014-015
75 u16 xSlicVpdLensOffset; // Offset into this of array 016-017
76 u16 xSlicMaxSlotLabels; // Maximum number of slot labels018-019
77 u16 xSlicMaxLpQueues; // Maximum number of LP Queues 01A-01B
78 u8 xRsvd2[4]; // Reserved 01C-01F
79 u64 xRsvd3[12]; // Reserved 020-07F
80 u32 xPlicDmaLens[ItDmaMaxEntries];// Array of DMA lengths 080-0A7
81 u32 xPlicDmaToks[ItDmaMaxEntries];// Array of DMA tokens 0A8-0CF
82 u32 xSlicVpdLens[ItVpdMaxEntries];// Array of VPD lengths 0D0-12F
83 const void *xSlicVpdAdrs[ItVpdMaxEntries];// Array of VPD buffers 130-1EF
84};
85
86extern const struct ItVpdAreas itVpdAreas;
87
88#endif /* _ISERIES_VPD_AREAS_H */
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 401e3f3f74c..465ee8f5c08 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -620,7 +620,7 @@ void __init maple_pci_init(void)
620 } 620 }
621 621
622 /* Tell pci.c to not change any resource allocations. */ 622 /* Tell pci.c to not change any resource allocations. */
623 pci_probe_only = 1; 623 pci_add_flags(PCI_PROBE_ONLY);
624} 624}
625 625
626int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel) 626int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel)
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 0bcbfe7b2c5..3b7545a51aa 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -262,7 +262,7 @@ static void __init maple_init_IRQ(void)
262 flags |= MPIC_BIG_ENDIAN; 262 flags |= MPIC_BIG_ENDIAN;
263 263
264 /* XXX Maple specific bits */ 264 /* XXX Maple specific bits */
265 flags |= MPIC_U3_HT_IRQS | MPIC_WANTS_RESET; 265 flags |= MPIC_U3_HT_IRQS;
266 /* All U3/U4 are big-endian, older SLOF firmware doesn't encode this */ 266 /* All U3/U4 are big-endian, older SLOF firmware doesn't encode this */
267 flags |= MPIC_BIG_ENDIAN; 267 flags |= MPIC_BIG_ENDIAN;
268 268
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index b6a0ec45c69..aa862713258 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -229,9 +229,6 @@ void __init pas_pci_init(void)
229 229
230 /* Setup the linkage between OF nodes and PHBs */ 230 /* Setup the linkage between OF nodes and PHBs */
231 pci_devs_phb_init(); 231 pci_devs_phb_init();
232
233 /* Use the common resource allocation mechanism */
234 pci_probe_only = 1;
235} 232}
236 233
237void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset) 234void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset)
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 98b7a7c1317..e777ad471a4 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -224,7 +224,7 @@ static __init void pas_init_IRQ(void)
224 openpic_addr = of_read_number(opprop, naddr); 224 openpic_addr = of_read_number(opprop, naddr);
225 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); 225 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
226 226
227 mpic_flags = MPIC_LARGE_VECTORS | MPIC_NO_BIAS; 227 mpic_flags = MPIC_LARGE_VECTORS | MPIC_NO_BIAS | MPIC_NO_RESET;
228 228
229 nmiprop = of_get_property(mpic_node, "nmi-source", NULL); 229 nmiprop = of_get_property(mpic_node, "nmi-source", NULL);
230 if (nmiprop) 230 if (nmiprop)
diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c
index 54d227127c9..da18b26dcc6 100644
--- a/arch/powerpc/platforms/powermac/nvram.c
+++ b/arch/powerpc/platforms/powermac/nvram.c
@@ -279,7 +279,7 @@ static u32 core99_check(u8* datas)
279 279
280static int sm_erase_bank(int bank) 280static int sm_erase_bank(int bank)
281{ 281{
282 int stat, i; 282 int stat;
283 unsigned long timeout; 283 unsigned long timeout;
284 284
285 u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE; 285 u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
@@ -301,11 +301,10 @@ static int sm_erase_bank(int bank)
301 out_8(base, SM_FLASH_CMD_CLEAR_STATUS); 301 out_8(base, SM_FLASH_CMD_CLEAR_STATUS);
302 out_8(base, SM_FLASH_CMD_RESET); 302 out_8(base, SM_FLASH_CMD_RESET);
303 303
304 for (i=0; i<NVRAM_SIZE; i++) 304 if (memchr_inv(base, 0xff, NVRAM_SIZE)) {
305 if (base[i] != 0xff) { 305 printk(KERN_ERR "nvram: Sharp/Micron flash erase failed !\n");
306 printk(KERN_ERR "nvram: Sharp/Micron flash erase failed !\n"); 306 return -ENXIO;
307 return -ENXIO; 307 }
308 }
309 return 0; 308 return 0;
310} 309}
311 310
@@ -336,17 +335,16 @@ static int sm_write_bank(int bank, u8* datas)
336 } 335 }
337 out_8(base, SM_FLASH_CMD_CLEAR_STATUS); 336 out_8(base, SM_FLASH_CMD_CLEAR_STATUS);
338 out_8(base, SM_FLASH_CMD_RESET); 337 out_8(base, SM_FLASH_CMD_RESET);
339 for (i=0; i<NVRAM_SIZE; i++) 338 if (memcmp(base, datas, NVRAM_SIZE)) {
340 if (base[i] != datas[i]) { 339 printk(KERN_ERR "nvram: Sharp/Micron flash write failed !\n");
341 printk(KERN_ERR "nvram: Sharp/Micron flash write failed !\n"); 340 return -ENXIO;
342 return -ENXIO; 341 }
343 }
344 return 0; 342 return 0;
345} 343}
346 344
347static int amd_erase_bank(int bank) 345static int amd_erase_bank(int bank)
348{ 346{
349 int i, stat = 0; 347 int stat = 0;
350 unsigned long timeout; 348 unsigned long timeout;
351 349
352 u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE; 350 u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
@@ -382,12 +380,11 @@ static int amd_erase_bank(int bank)
382 /* Reset */ 380 /* Reset */
383 out_8(base, 0xf0); 381 out_8(base, 0xf0);
384 udelay(1); 382 udelay(1);
385 383
386 for (i=0; i<NVRAM_SIZE; i++) 384 if (memchr_inv(base, 0xff, NVRAM_SIZE)) {
387 if (base[i] != 0xff) { 385 printk(KERN_ERR "nvram: AMD flash erase failed !\n");
388 printk(KERN_ERR "nvram: AMD flash erase failed !\n"); 386 return -ENXIO;
389 return -ENXIO; 387 }
390 }
391 return 0; 388 return 0;
392} 389}
393 390
@@ -429,11 +426,10 @@ static int amd_write_bank(int bank, u8* datas)
429 out_8(base, 0xf0); 426 out_8(base, 0xf0);
430 udelay(1); 427 udelay(1);
431 428
432 for (i=0; i<NVRAM_SIZE; i++) 429 if (memcmp(base, datas, NVRAM_SIZE)) {
433 if (base[i] != datas[i]) { 430 printk(KERN_ERR "nvram: AMD flash write failed !\n");
434 printk(KERN_ERR "nvram: AMD flash write failed !\n"); 431 return -ENXIO;
435 return -ENXIO; 432 }
436 }
437 return 0; 433 return 0;
438} 434}
439 435
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 31a7d3a7ce2..43bbe1bda93 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1059,9 +1059,6 @@ void __init pmac_pci_init(void)
1059 } 1059 }
1060 /* pmac_check_ht_link(); */ 1060 /* pmac_check_ht_link(); */
1061 1061
1062 /* We can allocate missing resources if any */
1063 pci_probe_only = 0;
1064
1065#else /* CONFIG_PPC64 */ 1062#else /* CONFIG_PPC64 */
1066 init_p2pbridge(); 1063 init_p2pbridge();
1067 init_second_ohare(); 1064 init_second_ohare();
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 92afc382a49..66ad93de1d5 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -457,7 +457,6 @@ static struct mpic * __init pmac_setup_one_mpic(struct device_node *np,
457 457
458 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0); 458 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0);
459 459
460 flags |= MPIC_WANTS_RESET;
461 if (of_get_property(np, "big-endian", NULL)) 460 if (of_get_property(np, "big-endian", NULL))
462 flags |= MPIC_BIG_ENDIAN; 461 flags |= MPIC_BIG_ENDIAN;
463 462
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 5e155dfc432..fbdd74dac3a 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1299,15 +1299,14 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
1299 /* Setup MSI support */ 1299 /* Setup MSI support */
1300 pnv_pci_init_ioda_msis(phb); 1300 pnv_pci_init_ioda_msis(phb);
1301 1301
1302 /* We set both probe_only and PCI_REASSIGN_ALL_RSRC. This is an 1302 /* We set both PCI_PROBE_ONLY and PCI_REASSIGN_ALL_RSRC. This is an
1303 * odd combination which essentially means that we skip all resource 1303 * odd combination which essentially means that we skip all resource
1304 * fixups and assignments in the generic code, and do it all 1304 * fixups and assignments in the generic code, and do it all
1305 * ourselves here 1305 * ourselves here
1306 */ 1306 */
1307 pci_probe_only = 1;
1308 ppc_md.pcibios_fixup_phb = pnv_pci_ioda_fixup_phb; 1307 ppc_md.pcibios_fixup_phb = pnv_pci_ioda_fixup_phb;
1309 ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook; 1308 ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook;
1310 pci_add_flags(PCI_REASSIGN_ALL_RSRC); 1309 pci_add_flags(PCI_PROBE_ONLY | PCI_REASSIGN_ALL_RSRC);
1311 1310
1312 /* Reset IODA tables to a clean state */ 1311 /* Reset IODA tables to a clean state */
1313 rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET); 1312 rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET);
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index f92b9ef7340..be3cfc5ceab 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -31,6 +31,7 @@
31#include <asm/iommu.h> 31#include <asm/iommu.h>
32#include <asm/tce.h> 32#include <asm/tce.h>
33#include <asm/abs_addr.h> 33#include <asm/abs_addr.h>
34#include <asm/firmware.h>
34 35
35#include "powernv.h" 36#include "powernv.h"
36#include "pci.h" 37#include "pci.h"
@@ -561,10 +562,7 @@ void __init pnv_pci_init(void)
561{ 562{
562 struct device_node *np; 563 struct device_node *np;
563 564
564 pci_set_flags(PCI_CAN_SKIP_ISA_ALIGN); 565 pci_add_flags(PCI_CAN_SKIP_ISA_ALIGN);
565
566 /* We do not want to just probe */
567 pci_probe_only = 0;
568 566
569 /* OPAL absent, try POPAL first then RTAS detection of PHBs */ 567 /* OPAL absent, try POPAL first then RTAS detection of PHBs */
570 if (!firmware_has_feature(FW_FEATURE_OPAL)) { 568 if (!firmware_has_feature(FW_FEATURE_OPAL)) {
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 467bd4ac682..db1ad1c8f68 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -31,7 +31,6 @@
31#include <asm/xics.h> 31#include <asm/xics.h>
32#include <asm/rtas.h> 32#include <asm/rtas.h>
33#include <asm/opal.h> 33#include <asm/opal.h>
34#include <asm/xics.h>
35 34
36#include "powernv.h" 35#include "powernv.h"
37 36
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index f2556257bbd..aadbe4f6d53 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -73,7 +73,7 @@ config IO_EVENT_IRQ
73 73
74config LPARCFG 74config LPARCFG
75 bool "LPAR Configuration Data" 75 bool "LPAR Configuration Data"
76 depends on PPC_PSERIES || PPC_ISERIES 76 depends on PPC_PSERIES
77 help 77 help
78 Provide system capacity information via human readable 78 Provide system capacity information via human readable
79 <key word>=<value> pairs through a /proc/ppc64/lparcfg interface. 79 <key word>=<value> pairs through a /proc/ppc64/lparcfg interface.
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 236db46b407..c222189f5bb 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -6,7 +6,8 @@ obj-y := lpar.o hvCall.o nvram.o reconfig.o \
6 firmware.o power.o dlpar.o mobility.o 6 firmware.o power.o dlpar.o mobility.o
7obj-$(CONFIG_SMP) += smp.o 7obj-$(CONFIG_SMP) += smp.o
8obj-$(CONFIG_SCANLOG) += scanlog.o 8obj-$(CONFIG_SCANLOG) += scanlog.o
9obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o eeh_sysfs.o 9obj-$(CONFIG_EEH) += eeh.o eeh_dev.o eeh_cache.o eeh_driver.o \
10 eeh_event.o eeh_sysfs.o eeh_pseries.o
10obj-$(CONFIG_KEXEC) += kexec.o 11obj-$(CONFIG_KEXEC) += kexec.o
11obj-$(CONFIG_PCI) += pci.o pci_dlpar.o 12obj-$(CONFIG_PCI) += pci.o pci_dlpar.o
12obj-$(CONFIG_PSERIES_MSI) += msi.o 13obj-$(CONFIG_PSERIES_MSI) += msi.o
@@ -18,7 +19,6 @@ obj-$(CONFIG_MEMORY_HOTPLUG) += hotplug-memory.o
18obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o 19obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
19obj-$(CONFIG_HVCS) += hvcserver.o 20obj-$(CONFIG_HVCS) += hvcserver.o
20obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o 21obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
21obj-$(CONFIG_PHYP_DUMP) += phyp_dump.o
22obj-$(CONFIG_CMM) += cmm.o 22obj-$(CONFIG_CMM) += cmm.o
23obj-$(CONFIG_DTL) += dtl.o 23obj-$(CONFIG_DTL) += dtl.o
24obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o 24obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index c0b40af4ce4..8011088392d 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * eeh.c
3 * Copyright IBM Corporation 2001, 2005, 2006 2 * Copyright IBM Corporation 2001, 2005, 2006
4 * Copyright Dave Engebretsen & Todd Inglett 2001 3 * Copyright Dave Engebretsen & Todd Inglett 2001
5 * Copyright Linas Vepstas 2005, 2006 4 * Copyright Linas Vepstas 2005, 2006
5 * Copyright 2001-2012 IBM Corporation.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
22 */ 22 */
23 23
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/sched.h> /* for init_mm */ 25#include <linux/sched.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
@@ -86,16 +86,8 @@
86/* Time to wait for a PCI slot to report status, in milliseconds */ 86/* Time to wait for a PCI slot to report status, in milliseconds */
87#define PCI_BUS_RESET_WAIT_MSEC (60*1000) 87#define PCI_BUS_RESET_WAIT_MSEC (60*1000)
88 88
89/* RTAS tokens */ 89/* Platform dependent EEH operations */
90static int ibm_set_eeh_option; 90struct eeh_ops *eeh_ops = NULL;
91static int ibm_set_slot_reset;
92static int ibm_read_slot_reset_state;
93static int ibm_read_slot_reset_state2;
94static int ibm_slot_error_detail;
95static int ibm_get_config_addr_info;
96static int ibm_get_config_addr_info2;
97static int ibm_configure_bridge;
98static int ibm_configure_pe;
99 91
100int eeh_subsystem_enabled; 92int eeh_subsystem_enabled;
101EXPORT_SYMBOL(eeh_subsystem_enabled); 93EXPORT_SYMBOL(eeh_subsystem_enabled);
@@ -103,14 +95,6 @@ EXPORT_SYMBOL(eeh_subsystem_enabled);
103/* Lock to avoid races due to multiple reports of an error */ 95/* Lock to avoid races due to multiple reports of an error */
104static DEFINE_RAW_SPINLOCK(confirm_error_lock); 96static DEFINE_RAW_SPINLOCK(confirm_error_lock);
105 97
106/* Buffer for reporting slot-error-detail rtas calls. Its here
107 * in BSS, and not dynamically alloced, so that it ends up in
108 * RMO where RTAS can access it.
109 */
110static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX];
111static DEFINE_SPINLOCK(slot_errbuf_lock);
112static int eeh_error_buf_size;
113
114/* Buffer for reporting pci register dumps. Its here in BSS, and 98/* Buffer for reporting pci register dumps. Its here in BSS, and
115 * not dynamically alloced, so that it ends up in RMO where RTAS 99 * not dynamically alloced, so that it ends up in RMO where RTAS
116 * can access it. 100 * can access it.
@@ -118,74 +102,50 @@ static int eeh_error_buf_size;
118#define EEH_PCI_REGS_LOG_LEN 4096 102#define EEH_PCI_REGS_LOG_LEN 4096
119static unsigned char pci_regs_buf[EEH_PCI_REGS_LOG_LEN]; 103static unsigned char pci_regs_buf[EEH_PCI_REGS_LOG_LEN];
120 104
121/* System monitoring statistics */ 105/*
122static unsigned long no_device; 106 * The struct is used to maintain the EEH global statistic
123static unsigned long no_dn; 107 * information. Besides, the EEH global statistics will be
124static unsigned long no_cfg_addr; 108 * exported to user space through procfs
125static unsigned long ignored_check; 109 */
126static unsigned long total_mmio_ffs; 110struct eeh_stats {
127static unsigned long false_positives; 111 u64 no_device; /* PCI device not found */
128static unsigned long slot_resets; 112 u64 no_dn; /* OF node not found */
129 113 u64 no_cfg_addr; /* Config address not found */
130#define IS_BRIDGE(class_code) (((class_code)<<16) == PCI_BASE_CLASS_BRIDGE) 114 u64 ignored_check; /* EEH check skipped */
131 115 u64 total_mmio_ffs; /* Total EEH checks */
132/* --------------------------------------------------------------- */ 116 u64 false_positives; /* Unnecessary EEH checks */
133/* Below lies the EEH event infrastructure */ 117 u64 slot_resets; /* PE reset */
118};
134 119
135static void rtas_slot_error_detail(struct pci_dn *pdn, int severity, 120static struct eeh_stats eeh_stats;
136 char *driver_log, size_t loglen)
137{
138 int config_addr;
139 unsigned long flags;
140 int rc;
141 121
142 /* Log the error with the rtas logger */ 122#define IS_BRIDGE(class_code) (((class_code)<<16) == PCI_BASE_CLASS_BRIDGE)
143 spin_lock_irqsave(&slot_errbuf_lock, flags);
144 memset(slot_errbuf, 0, eeh_error_buf_size);
145
146 /* Use PE configuration address, if present */
147 config_addr = pdn->eeh_config_addr;
148 if (pdn->eeh_pe_config_addr)
149 config_addr = pdn->eeh_pe_config_addr;
150
151 rc = rtas_call(ibm_slot_error_detail,
152 8, 1, NULL, config_addr,
153 BUID_HI(pdn->phb->buid),
154 BUID_LO(pdn->phb->buid),
155 virt_to_phys(driver_log), loglen,
156 virt_to_phys(slot_errbuf),
157 eeh_error_buf_size,
158 severity);
159
160 if (rc == 0)
161 log_error(slot_errbuf, ERR_TYPE_RTAS_LOG, 0);
162 spin_unlock_irqrestore(&slot_errbuf_lock, flags);
163}
164 123
165/** 124/**
166 * gather_pci_data - copy assorted PCI config space registers to buff 125 * eeh_gather_pci_data - Copy assorted PCI config space registers to buff
167 * @pdn: device to report data for 126 * @edev: device to report data for
168 * @buf: point to buffer in which to log 127 * @buf: point to buffer in which to log
169 * @len: amount of room in buffer 128 * @len: amount of room in buffer
170 * 129 *
171 * This routine captures assorted PCI configuration space data, 130 * This routine captures assorted PCI configuration space data,
172 * and puts them into a buffer for RTAS error logging. 131 * and puts them into a buffer for RTAS error logging.
173 */ 132 */
174static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) 133static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
175{ 134{
176 struct pci_dev *dev = pdn->pcidev; 135 struct device_node *dn = eeh_dev_to_of_node(edev);
136 struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
177 u32 cfg; 137 u32 cfg;
178 int cap, i; 138 int cap, i;
179 int n = 0; 139 int n = 0;
180 140
181 n += scnprintf(buf+n, len-n, "%s\n", pdn->node->full_name); 141 n += scnprintf(buf+n, len-n, "%s\n", dn->full_name);
182 printk(KERN_WARNING "EEH: of node=%s\n", pdn->node->full_name); 142 printk(KERN_WARNING "EEH: of node=%s\n", dn->full_name);
183 143
184 rtas_read_config(pdn, PCI_VENDOR_ID, 4, &cfg); 144 eeh_ops->read_config(dn, PCI_VENDOR_ID, 4, &cfg);
185 n += scnprintf(buf+n, len-n, "dev/vend:%08x\n", cfg); 145 n += scnprintf(buf+n, len-n, "dev/vend:%08x\n", cfg);
186 printk(KERN_WARNING "EEH: PCI device/vendor: %08x\n", cfg); 146 printk(KERN_WARNING "EEH: PCI device/vendor: %08x\n", cfg);
187 147
188 rtas_read_config(pdn, PCI_COMMAND, 4, &cfg); 148 eeh_ops->read_config(dn, PCI_COMMAND, 4, &cfg);
189 n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg); 149 n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg);
190 printk(KERN_WARNING "EEH: PCI cmd/status register: %08x\n", cfg); 150 printk(KERN_WARNING "EEH: PCI cmd/status register: %08x\n", cfg);
191 151
@@ -196,11 +156,11 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
196 156
197 /* Gather bridge-specific registers */ 157 /* Gather bridge-specific registers */
198 if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) { 158 if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) {
199 rtas_read_config(pdn, PCI_SEC_STATUS, 2, &cfg); 159 eeh_ops->read_config(dn, PCI_SEC_STATUS, 2, &cfg);
200 n += scnprintf(buf+n, len-n, "sec stat:%x\n", cfg); 160 n += scnprintf(buf+n, len-n, "sec stat:%x\n", cfg);
201 printk(KERN_WARNING "EEH: Bridge secondary status: %04x\n", cfg); 161 printk(KERN_WARNING "EEH: Bridge secondary status: %04x\n", cfg);
202 162
203 rtas_read_config(pdn, PCI_BRIDGE_CONTROL, 2, &cfg); 163 eeh_ops->read_config(dn, PCI_BRIDGE_CONTROL, 2, &cfg);
204 n += scnprintf(buf+n, len-n, "brdg ctl:%x\n", cfg); 164 n += scnprintf(buf+n, len-n, "brdg ctl:%x\n", cfg);
205 printk(KERN_WARNING "EEH: Bridge control: %04x\n", cfg); 165 printk(KERN_WARNING "EEH: Bridge control: %04x\n", cfg);
206 } 166 }
@@ -208,11 +168,11 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
208 /* Dump out the PCI-X command and status regs */ 168 /* Dump out the PCI-X command and status regs */
209 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); 169 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX);
210 if (cap) { 170 if (cap) {
211 rtas_read_config(pdn, cap, 4, &cfg); 171 eeh_ops->read_config(dn, cap, 4, &cfg);
212 n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg); 172 n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg);
213 printk(KERN_WARNING "EEH: PCI-X cmd: %08x\n", cfg); 173 printk(KERN_WARNING "EEH: PCI-X cmd: %08x\n", cfg);
214 174
215 rtas_read_config(pdn, cap+4, 4, &cfg); 175 eeh_ops->read_config(dn, cap+4, 4, &cfg);
216 n += scnprintf(buf+n, len-n, "pcix-stat:%x\n", cfg); 176 n += scnprintf(buf+n, len-n, "pcix-stat:%x\n", cfg);
217 printk(KERN_WARNING "EEH: PCI-X status: %08x\n", cfg); 177 printk(KERN_WARNING "EEH: PCI-X status: %08x\n", cfg);
218 } 178 }
@@ -225,7 +185,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
225 "EEH: PCI-E capabilities and status follow:\n"); 185 "EEH: PCI-E capabilities and status follow:\n");
226 186
227 for (i=0; i<=8; i++) { 187 for (i=0; i<=8; i++) {
228 rtas_read_config(pdn, cap+4*i, 4, &cfg); 188 eeh_ops->read_config(dn, cap+4*i, 4, &cfg);
229 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); 189 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
230 printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg); 190 printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg);
231 } 191 }
@@ -237,7 +197,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
237 "EEH: PCI-E AER capability register set follows:\n"); 197 "EEH: PCI-E AER capability register set follows:\n");
238 198
239 for (i=0; i<14; i++) { 199 for (i=0; i<14; i++) {
240 rtas_read_config(pdn, cap+4*i, 4, &cfg); 200 eeh_ops->read_config(dn, cap+4*i, 4, &cfg);
241 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); 201 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
242 printk(KERN_WARNING "EEH: PCI-E AER %02x: %08x\n", i, cfg); 202 printk(KERN_WARNING "EEH: PCI-E AER %02x: %08x\n", i, cfg);
243 } 203 }
@@ -246,111 +206,46 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
246 206
247 /* Gather status on devices under the bridge */ 207 /* Gather status on devices under the bridge */
248 if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) { 208 if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) {
249 struct device_node *dn; 209 struct device_node *child;
250 210
251 for_each_child_of_node(pdn->node, dn) { 211 for_each_child_of_node(dn, child) {
252 pdn = PCI_DN(dn); 212 if (of_node_to_eeh_dev(child))
253 if (pdn) 213 n += eeh_gather_pci_data(of_node_to_eeh_dev(child), buf+n, len-n);
254 n += gather_pci_data(pdn, buf+n, len-n);
255 } 214 }
256 } 215 }
257 216
258 return n; 217 return n;
259} 218}
260 219
261void eeh_slot_error_detail(struct pci_dn *pdn, int severity)
262{
263 size_t loglen = 0;
264 pci_regs_buf[0] = 0;
265
266 rtas_pci_enable(pdn, EEH_THAW_MMIO);
267 rtas_configure_bridge(pdn);
268 eeh_restore_bars(pdn);
269 loglen = gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN);
270
271 rtas_slot_error_detail(pdn, severity, pci_regs_buf, loglen);
272}
273
274/** 220/**
275 * read_slot_reset_state - Read the reset state of a device node's slot 221 * eeh_slot_error_detail - Generate combined log including driver log and error log
276 * @dn: device node to read 222 * @edev: device to report error log for
277 * @rets: array to return results in 223 * @severity: temporary or permanent error log
278 */
279static int read_slot_reset_state(struct pci_dn *pdn, int rets[])
280{
281 int token, outputs;
282 int config_addr;
283
284 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) {
285 token = ibm_read_slot_reset_state2;
286 outputs = 4;
287 } else {
288 token = ibm_read_slot_reset_state;
289 rets[2] = 0; /* fake PE Unavailable info */
290 outputs = 3;
291 }
292
293 /* Use PE configuration address, if present */
294 config_addr = pdn->eeh_config_addr;
295 if (pdn->eeh_pe_config_addr)
296 config_addr = pdn->eeh_pe_config_addr;
297
298 return rtas_call(token, 3, outputs, rets, config_addr,
299 BUID_HI(pdn->phb->buid), BUID_LO(pdn->phb->buid));
300}
301
302/**
303 * eeh_wait_for_slot_status - returns error status of slot
304 * @pdn pci device node
305 * @max_wait_msecs maximum number to millisecs to wait
306 *
307 * Return negative value if a permanent error, else return
308 * Partition Endpoint (PE) status value.
309 * 224 *
310 * If @max_wait_msecs is positive, then this routine will 225 * This routine should be called to generate the combined log, which
311 * sleep until a valid status can be obtained, or until 226 * is comprised of driver log and error log. The driver log is figured
312 * the max allowed wait time is exceeded, in which case 227 * out from the config space of the corresponding PCI device, while
313 * a -2 is returned. 228 * the error log is fetched through platform dependent function call.
314 */ 229 */
315int 230void eeh_slot_error_detail(struct eeh_dev *edev, int severity)
316eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs)
317{ 231{
318 int rc; 232 size_t loglen = 0;
319 int rets[3]; 233 pci_regs_buf[0] = 0;
320 int mwait;
321
322 while (1) {
323 rc = read_slot_reset_state(pdn, rets);
324 if (rc) return rc;
325 if (rets[1] == 0) return -1; /* EEH is not supported */
326
327 if (rets[0] != 5) return rets[0]; /* return actual status */
328
329 if (rets[2] == 0) return -1; /* permanently unavailable */
330 234
331 if (max_wait_msecs <= 0) break; 235 eeh_pci_enable(edev, EEH_OPT_THAW_MMIO);
236 eeh_ops->configure_bridge(eeh_dev_to_of_node(edev));
237 eeh_restore_bars(edev);
238 loglen = eeh_gather_pci_data(edev, pci_regs_buf, EEH_PCI_REGS_LOG_LEN);
332 239
333 mwait = rets[2]; 240 eeh_ops->get_log(eeh_dev_to_of_node(edev), severity, pci_regs_buf, loglen);
334 if (mwait <= 0) {
335 printk (KERN_WARNING
336 "EEH: Firmware returned bad wait value=%d\n", mwait);
337 mwait = 1000;
338 } else if (mwait > 300*1000) {
339 printk (KERN_WARNING
340 "EEH: Firmware is taking too long, time=%d\n", mwait);
341 mwait = 300*1000;
342 }
343 max_wait_msecs -= mwait;
344 msleep (mwait);
345 }
346
347 printk(KERN_WARNING "EEH: Timed out waiting for slot status\n");
348 return -2;
349} 241}
350 242
351/** 243/**
352 * eeh_token_to_phys - convert EEH address token to phys address 244 * eeh_token_to_phys - Convert EEH address token to phys address
353 * @token i/o token, should be address in the form 0xA.... 245 * @token: I/O token, should be address in the form 0xA....
246 *
247 * This routine should be called to convert virtual I/O address
248 * to physical one.
354 */ 249 */
355static inline unsigned long eeh_token_to_phys(unsigned long token) 250static inline unsigned long eeh_token_to_phys(unsigned long token)
356{ 251{
@@ -365,36 +260,43 @@ static inline unsigned long eeh_token_to_phys(unsigned long token)
365 return pa | (token & (PAGE_SIZE-1)); 260 return pa | (token & (PAGE_SIZE-1));
366} 261}
367 262
368/** 263/**
369 * Return the "partitionable endpoint" (pe) under which this device lies 264 * eeh_find_device_pe - Retrieve the PE for the given device
265 * @dn: device node
266 *
267 * Return the PE under which this device lies
370 */ 268 */
371struct device_node * find_device_pe(struct device_node *dn) 269struct device_node *eeh_find_device_pe(struct device_node *dn)
372{ 270{
373 while ((dn->parent) && PCI_DN(dn->parent) && 271 while (dn->parent && of_node_to_eeh_dev(dn->parent) &&
374 (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) { 272 (of_node_to_eeh_dev(dn->parent)->mode & EEH_MODE_SUPPORTED)) {
375 dn = dn->parent; 273 dn = dn->parent;
376 } 274 }
377 return dn; 275 return dn;
378} 276}
379 277
380/** Mark all devices that are children of this device as failed. 278/**
381 * Mark the device driver too, so that it can see the failure 279 * __eeh_mark_slot - Mark all child devices as failed
382 * immediately; this is critical, since some drivers poll 280 * @parent: parent device
383 * status registers in interrupts ... If a driver is polling, 281 * @mode_flag: failure flag
384 * and the slot is frozen, then the driver can deadlock in 282 *
385 * an interrupt context, which is bad. 283 * Mark all devices that are children of this device as failed.
284 * Mark the device driver too, so that it can see the failure
285 * immediately; this is critical, since some drivers poll
286 * status registers in interrupts ... If a driver is polling,
287 * and the slot is frozen, then the driver can deadlock in
288 * an interrupt context, which is bad.
386 */ 289 */
387
388static void __eeh_mark_slot(struct device_node *parent, int mode_flag) 290static void __eeh_mark_slot(struct device_node *parent, int mode_flag)
389{ 291{
390 struct device_node *dn; 292 struct device_node *dn;
391 293
392 for_each_child_of_node(parent, dn) { 294 for_each_child_of_node(parent, dn) {
393 if (PCI_DN(dn)) { 295 if (of_node_to_eeh_dev(dn)) {
394 /* Mark the pci device driver too */ 296 /* Mark the pci device driver too */
395 struct pci_dev *dev = PCI_DN(dn)->pcidev; 297 struct pci_dev *dev = of_node_to_eeh_dev(dn)->pdev;
396 298
397 PCI_DN(dn)->eeh_mode |= mode_flag; 299 of_node_to_eeh_dev(dn)->mode |= mode_flag;
398 300
399 if (dev && dev->driver) 301 if (dev && dev->driver)
400 dev->error_state = pci_channel_io_frozen; 302 dev->error_state = pci_channel_io_frozen;
@@ -404,92 +306,81 @@ static void __eeh_mark_slot(struct device_node *parent, int mode_flag)
404 } 306 }
405} 307}
406 308
407void eeh_mark_slot (struct device_node *dn, int mode_flag) 309/**
310 * eeh_mark_slot - Mark the indicated device and its children as failed
311 * @dn: parent device
312 * @mode_flag: failure flag
313 *
314 * Mark the indicated device and its child devices as failed.
315 * The device drivers are marked as failed as well.
316 */
317void eeh_mark_slot(struct device_node *dn, int mode_flag)
408{ 318{
409 struct pci_dev *dev; 319 struct pci_dev *dev;
410 dn = find_device_pe (dn); 320 dn = eeh_find_device_pe(dn);
411 321
412 /* Back up one, since config addrs might be shared */ 322 /* Back up one, since config addrs might be shared */
413 if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) 323 if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent))
414 dn = dn->parent; 324 dn = dn->parent;
415 325
416 PCI_DN(dn)->eeh_mode |= mode_flag; 326 of_node_to_eeh_dev(dn)->mode |= mode_flag;
417 327
418 /* Mark the pci device too */ 328 /* Mark the pci device too */
419 dev = PCI_DN(dn)->pcidev; 329 dev = of_node_to_eeh_dev(dn)->pdev;
420 if (dev) 330 if (dev)
421 dev->error_state = pci_channel_io_frozen; 331 dev->error_state = pci_channel_io_frozen;
422 332
423 __eeh_mark_slot(dn, mode_flag); 333 __eeh_mark_slot(dn, mode_flag);
424} 334}
425 335
336/**
337 * __eeh_clear_slot - Clear failure flag for the child devices
338 * @parent: parent device
339 * @mode_flag: flag to be cleared
340 *
341 * Clear failure flag for the child devices.
342 */
426static void __eeh_clear_slot(struct device_node *parent, int mode_flag) 343static void __eeh_clear_slot(struct device_node *parent, int mode_flag)
427{ 344{
428 struct device_node *dn; 345 struct device_node *dn;
429 346
430 for_each_child_of_node(parent, dn) { 347 for_each_child_of_node(parent, dn) {
431 if (PCI_DN(dn)) { 348 if (of_node_to_eeh_dev(dn)) {
432 PCI_DN(dn)->eeh_mode &= ~mode_flag; 349 of_node_to_eeh_dev(dn)->mode &= ~mode_flag;
433 PCI_DN(dn)->eeh_check_count = 0; 350 of_node_to_eeh_dev(dn)->check_count = 0;
434 __eeh_clear_slot(dn, mode_flag); 351 __eeh_clear_slot(dn, mode_flag);
435 } 352 }
436 } 353 }
437} 354}
438 355
439void eeh_clear_slot (struct device_node *dn, int mode_flag) 356/**
357 * eeh_clear_slot - Clear failure flag for the indicated device and its children
358 * @dn: parent device
359 * @mode_flag: flag to be cleared
360 *
361 * Clear failure flag for the indicated device and its children.
362 */
363void eeh_clear_slot(struct device_node *dn, int mode_flag)
440{ 364{
441 unsigned long flags; 365 unsigned long flags;
442 raw_spin_lock_irqsave(&confirm_error_lock, flags); 366 raw_spin_lock_irqsave(&confirm_error_lock, flags);
443 367
444 dn = find_device_pe (dn); 368 dn = eeh_find_device_pe(dn);
445 369
446 /* Back up one, since config addrs might be shared */ 370 /* Back up one, since config addrs might be shared */
447 if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) 371 if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent))
448 dn = dn->parent; 372 dn = dn->parent;
449 373
450 PCI_DN(dn)->eeh_mode &= ~mode_flag; 374 of_node_to_eeh_dev(dn)->mode &= ~mode_flag;
451 PCI_DN(dn)->eeh_check_count = 0; 375 of_node_to_eeh_dev(dn)->check_count = 0;
452 __eeh_clear_slot(dn, mode_flag); 376 __eeh_clear_slot(dn, mode_flag);
453 raw_spin_unlock_irqrestore(&confirm_error_lock, flags); 377 raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
454} 378}
455 379
456void __eeh_set_pe_freset(struct device_node *parent, unsigned int *freset)
457{
458 struct device_node *dn;
459
460 for_each_child_of_node(parent, dn) {
461 if (PCI_DN(dn)) {
462
463 struct pci_dev *dev = PCI_DN(dn)->pcidev;
464
465 if (dev && dev->driver)
466 *freset |= dev->needs_freset;
467
468 __eeh_set_pe_freset(dn, freset);
469 }
470 }
471}
472
473void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset)
474{
475 struct pci_dev *dev;
476 dn = find_device_pe(dn);
477
478 /* Back up one, since config addrs might be shared */
479 if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
480 dn = dn->parent;
481
482 dev = PCI_DN(dn)->pcidev;
483 if (dev)
484 *freset |= dev->needs_freset;
485
486 __eeh_set_pe_freset(dn, freset);
487}
488
489/** 380/**
490 * eeh_dn_check_failure - check if all 1's data is due to EEH slot freeze 381 * eeh_dn_check_failure - Check if all 1's data is due to EEH slot freeze
491 * @dn device node 382 * @dn: device node
492 * @dev pci device, if known 383 * @dev: pci device, if known
493 * 384 *
494 * Check for an EEH failure for the given device node. Call this 385 * Check for an EEH failure for the given device node. Call this
495 * routine if the result of a read was all 0xff's and you want to 386 * routine if the result of a read was all 0xff's and you want to
@@ -504,35 +395,34 @@ void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset)
504int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) 395int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
505{ 396{
506 int ret; 397 int ret;
507 int rets[3];
508 unsigned long flags; 398 unsigned long flags;
509 struct pci_dn *pdn; 399 struct eeh_dev *edev;
510 int rc = 0; 400 int rc = 0;
511 const char *location; 401 const char *location;
512 402
513 total_mmio_ffs++; 403 eeh_stats.total_mmio_ffs++;
514 404
515 if (!eeh_subsystem_enabled) 405 if (!eeh_subsystem_enabled)
516 return 0; 406 return 0;
517 407
518 if (!dn) { 408 if (!dn) {
519 no_dn++; 409 eeh_stats.no_dn++;
520 return 0; 410 return 0;
521 } 411 }
522 dn = find_device_pe(dn); 412 dn = eeh_find_device_pe(dn);
523 pdn = PCI_DN(dn); 413 edev = of_node_to_eeh_dev(dn);
524 414
525 /* Access to IO BARs might get this far and still not want checking. */ 415 /* Access to IO BARs might get this far and still not want checking. */
526 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) || 416 if (!(edev->mode & EEH_MODE_SUPPORTED) ||
527 pdn->eeh_mode & EEH_MODE_NOCHECK) { 417 edev->mode & EEH_MODE_NOCHECK) {
528 ignored_check++; 418 eeh_stats.ignored_check++;
529 pr_debug("EEH: Ignored check (%x) for %s %s\n", 419 pr_debug("EEH: Ignored check (%x) for %s %s\n",
530 pdn->eeh_mode, eeh_pci_name(dev), dn->full_name); 420 edev->mode, eeh_pci_name(dev), dn->full_name);
531 return 0; 421 return 0;
532 } 422 }
533 423
534 if (!pdn->eeh_config_addr && !pdn->eeh_pe_config_addr) { 424 if (!edev->config_addr && !edev->pe_config_addr) {
535 no_cfg_addr++; 425 eeh_stats.no_cfg_addr++;
536 return 0; 426 return 0;
537 } 427 }
538 428
@@ -544,15 +434,15 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
544 */ 434 */
545 raw_spin_lock_irqsave(&confirm_error_lock, flags); 435 raw_spin_lock_irqsave(&confirm_error_lock, flags);
546 rc = 1; 436 rc = 1;
547 if (pdn->eeh_mode & EEH_MODE_ISOLATED) { 437 if (edev->mode & EEH_MODE_ISOLATED) {
548 pdn->eeh_check_count ++; 438 edev->check_count++;
549 if (pdn->eeh_check_count % EEH_MAX_FAILS == 0) { 439 if (edev->check_count % EEH_MAX_FAILS == 0) {
550 location = of_get_property(dn, "ibm,loc-code", NULL); 440 location = of_get_property(dn, "ibm,loc-code", NULL);
551 printk (KERN_ERR "EEH: %d reads ignored for recovering device at " 441 printk(KERN_ERR "EEH: %d reads ignored for recovering device at "
552 "location=%s driver=%s pci addr=%s\n", 442 "location=%s driver=%s pci addr=%s\n",
553 pdn->eeh_check_count, location, 443 edev->check_count, location,
554 eeh_driver_name(dev), eeh_pci_name(dev)); 444 eeh_driver_name(dev), eeh_pci_name(dev));
555 printk (KERN_ERR "EEH: Might be infinite loop in %s driver\n", 445 printk(KERN_ERR "EEH: Might be infinite loop in %s driver\n",
556 eeh_driver_name(dev)); 446 eeh_driver_name(dev));
557 dump_stack(); 447 dump_stack();
558 } 448 }
@@ -566,58 +456,39 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
566 * function zero of a multi-function device. 456 * function zero of a multi-function device.
567 * In any case they must share a common PHB. 457 * In any case they must share a common PHB.
568 */ 458 */
569 ret = read_slot_reset_state(pdn, rets); 459 ret = eeh_ops->get_state(dn, NULL);
570
571 /* If the call to firmware failed, punt */
572 if (ret != 0) {
573 printk(KERN_WARNING "EEH: read_slot_reset_state() failed; rc=%d dn=%s\n",
574 ret, dn->full_name);
575 false_positives++;
576 pdn->eeh_false_positives ++;
577 rc = 0;
578 goto dn_unlock;
579 }
580 460
581 /* Note that config-io to empty slots may fail; 461 /* Note that config-io to empty slots may fail;
582 * they are empty when they don't have children. */ 462 * they are empty when they don't have children.
583 if ((rets[0] == 5) && (rets[2] == 0) && (dn->child == NULL)) { 463 * We will punt with the following conditions: Failure to get
584 false_positives++; 464 * PE's state, EEH not support and Permanently unavailable
585 pdn->eeh_false_positives ++; 465 * state, PE is in good state.
586 rc = 0; 466 */
587 goto dn_unlock; 467 if ((ret < 0) ||
588 } 468 (ret == EEH_STATE_NOT_SUPPORT) ||
589 469 (ret & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) ==
590 /* If EEH is not supported on this device, punt. */ 470 (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) {
591 if (rets[1] != 1) { 471 eeh_stats.false_positives++;
592 printk(KERN_WARNING "EEH: event on unsupported device, rc=%d dn=%s\n", 472 edev->false_positives ++;
593 ret, dn->full_name);
594 false_positives++;
595 pdn->eeh_false_positives ++;
596 rc = 0;
597 goto dn_unlock;
598 }
599
600 /* If not the kind of error we know about, punt. */
601 if (rets[0] != 1 && rets[0] != 2 && rets[0] != 4 && rets[0] != 5) {
602 false_positives++;
603 pdn->eeh_false_positives ++;
604 rc = 0; 473 rc = 0;
605 goto dn_unlock; 474 goto dn_unlock;
606 } 475 }
607 476
608 slot_resets++; 477 eeh_stats.slot_resets++;
609 478
610 /* Avoid repeated reports of this failure, including problems 479 /* Avoid repeated reports of this failure, including problems
611 * with other functions on this device, and functions under 480 * with other functions on this device, and functions under
612 * bridges. */ 481 * bridges.
613 eeh_mark_slot (dn, EEH_MODE_ISOLATED); 482 */
483 eeh_mark_slot(dn, EEH_MODE_ISOLATED);
614 raw_spin_unlock_irqrestore(&confirm_error_lock, flags); 484 raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
615 485
616 eeh_send_failure_event (dn, dev); 486 eeh_send_failure_event(edev);
617 487
618 /* Most EEH events are due to device driver bugs. Having 488 /* Most EEH events are due to device driver bugs. Having
619 * a stack trace will help the device-driver authors figure 489 * a stack trace will help the device-driver authors figure
620 * out what happened. So print that out. */ 490 * out what happened. So print that out.
491 */
621 dump_stack(); 492 dump_stack();
622 return 1; 493 return 1;
623 494
@@ -629,9 +500,9 @@ dn_unlock:
629EXPORT_SYMBOL_GPL(eeh_dn_check_failure); 500EXPORT_SYMBOL_GPL(eeh_dn_check_failure);
630 501
631/** 502/**
632 * eeh_check_failure - check if all 1's data is due to EEH slot freeze 503 * eeh_check_failure - Check if all 1's data is due to EEH slot freeze
633 * @token i/o token, should be address in the form 0xA.... 504 * @token: I/O token, should be address in the form 0xA....
634 * @val value, should be all 1's (XXX why do we need this arg??) 505 * @val: value, should be all 1's (XXX why do we need this arg??)
635 * 506 *
636 * Check for an EEH failure at the given token address. Call this 507 * Check for an EEH failure at the given token address. Call this
637 * routine if the result of a read was all 0xff's and you want to 508 * routine if the result of a read was all 0xff's and you want to
@@ -648,14 +519,14 @@ unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned lon
648 519
649 /* Finding the phys addr + pci device; this is pretty quick. */ 520 /* Finding the phys addr + pci device; this is pretty quick. */
650 addr = eeh_token_to_phys((unsigned long __force) token); 521 addr = eeh_token_to_phys((unsigned long __force) token);
651 dev = pci_get_device_by_addr(addr); 522 dev = pci_addr_cache_get_device(addr);
652 if (!dev) { 523 if (!dev) {
653 no_device++; 524 eeh_stats.no_device++;
654 return val; 525 return val;
655 } 526 }
656 527
657 dn = pci_device_to_OF_node(dev); 528 dn = pci_device_to_OF_node(dev);
658 eeh_dn_check_failure (dn, dev); 529 eeh_dn_check_failure(dn, dev);
659 530
660 pci_dev_put(dev); 531 pci_dev_put(dev);
661 return val; 532 return val;
@@ -663,115 +534,54 @@ unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned lon
663 534
664EXPORT_SYMBOL(eeh_check_failure); 535EXPORT_SYMBOL(eeh_check_failure);
665 536
666/* ------------------------------------------------------------- */
667/* The code below deals with error recovery */
668 537
669/** 538/**
670 * rtas_pci_enable - enable MMIO or DMA transfers for this slot 539 * eeh_pci_enable - Enable MMIO or DMA transfers for this slot
671 * @pdn pci device node 540 * @edev: pci device node
541 *
542 * This routine should be called to reenable frozen MMIO or DMA
543 * so that it would work correctly again. It's useful while doing
544 * recovery or log collection on the indicated device.
672 */ 545 */
673 546int eeh_pci_enable(struct eeh_dev *edev, int function)
674int
675rtas_pci_enable(struct pci_dn *pdn, int function)
676{ 547{
677 int config_addr;
678 int rc; 548 int rc;
549 struct device_node *dn = eeh_dev_to_of_node(edev);
679 550
680 /* Use PE configuration address, if present */ 551 rc = eeh_ops->set_option(dn, function);
681 config_addr = pdn->eeh_config_addr;
682 if (pdn->eeh_pe_config_addr)
683 config_addr = pdn->eeh_pe_config_addr;
684
685 rc = rtas_call(ibm_set_eeh_option, 4, 1, NULL,
686 config_addr,
687 BUID_HI(pdn->phb->buid),
688 BUID_LO(pdn->phb->buid),
689 function);
690
691 if (rc) 552 if (rc)
692 printk(KERN_WARNING "EEH: Unexpected state change %d, err=%d dn=%s\n", 553 printk(KERN_WARNING "EEH: Unexpected state change %d, err=%d dn=%s\n",
693 function, rc, pdn->node->full_name); 554 function, rc, dn->full_name);
694 555
695 rc = eeh_wait_for_slot_status (pdn, PCI_BUS_RESET_WAIT_MSEC); 556 rc = eeh_ops->wait_state(dn, PCI_BUS_RESET_WAIT_MSEC);
696 if ((rc == 4) && (function == EEH_THAW_MMIO)) 557 if (rc > 0 && (rc & EEH_STATE_MMIO_ENABLED) &&
558 (function == EEH_OPT_THAW_MMIO))
697 return 0; 559 return 0;
698 560
699 return rc; 561 return rc;
700} 562}
701 563
702/** 564/**
703 * rtas_pci_slot_reset - raises/lowers the pci #RST line
704 * @pdn pci device node
705 * @state: 1/0 to raise/lower the #RST
706 *
707 * Clear the EEH-frozen condition on a slot. This routine
708 * asserts the PCI #RST line if the 'state' argument is '1',
709 * and drops the #RST line if 'state is '0'. This routine is
710 * safe to call in an interrupt context.
711 *
712 */
713
714static void
715rtas_pci_slot_reset(struct pci_dn *pdn, int state)
716{
717 int config_addr;
718 int rc;
719
720 BUG_ON (pdn==NULL);
721
722 if (!pdn->phb) {
723 printk (KERN_WARNING "EEH: in slot reset, device node %s has no phb\n",
724 pdn->node->full_name);
725 return;
726 }
727
728 /* Use PE configuration address, if present */
729 config_addr = pdn->eeh_config_addr;
730 if (pdn->eeh_pe_config_addr)
731 config_addr = pdn->eeh_pe_config_addr;
732
733 rc = rtas_call(ibm_set_slot_reset, 4, 1, NULL,
734 config_addr,
735 BUID_HI(pdn->phb->buid),
736 BUID_LO(pdn->phb->buid),
737 state);
738
739 /* Fundamental-reset not supported on this PE, try hot-reset */
740 if (rc == -8 && state == 3) {
741 rc = rtas_call(ibm_set_slot_reset, 4, 1, NULL,
742 config_addr,
743 BUID_HI(pdn->phb->buid),
744 BUID_LO(pdn->phb->buid), 1);
745 if (rc)
746 printk(KERN_WARNING
747 "EEH: Unable to reset the failed slot,"
748 " #RST=%d dn=%s\n",
749 rc, pdn->node->full_name);
750 }
751}
752
753/**
754 * pcibios_set_pcie_slot_reset - Set PCI-E reset state 565 * pcibios_set_pcie_slot_reset - Set PCI-E reset state
755 * @dev: pci device struct 566 * @dev: pci device struct
756 * @state: reset state to enter 567 * @state: reset state to enter
757 * 568 *
758 * Return value: 569 * Return value:
759 * 0 if success 570 * 0 if success
760 **/ 571 */
761int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state) 572int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state)
762{ 573{
763 struct device_node *dn = pci_device_to_OF_node(dev); 574 struct device_node *dn = pci_device_to_OF_node(dev);
764 struct pci_dn *pdn = PCI_DN(dn);
765 575
766 switch (state) { 576 switch (state) {
767 case pcie_deassert_reset: 577 case pcie_deassert_reset:
768 rtas_pci_slot_reset(pdn, 0); 578 eeh_ops->reset(dn, EEH_RESET_DEACTIVATE);
769 break; 579 break;
770 case pcie_hot_reset: 580 case pcie_hot_reset:
771 rtas_pci_slot_reset(pdn, 1); 581 eeh_ops->reset(dn, EEH_RESET_HOT);
772 break; 582 break;
773 case pcie_warm_reset: 583 case pcie_warm_reset:
774 rtas_pci_slot_reset(pdn, 3); 584 eeh_ops->reset(dn, EEH_RESET_FUNDAMENTAL);
775 break; 585 break;
776 default: 586 default:
777 return -EINVAL; 587 return -EINVAL;
@@ -781,13 +591,66 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
781} 591}
782 592
783/** 593/**
784 * rtas_set_slot_reset -- assert the pci #RST line for 1/4 second 594 * __eeh_set_pe_freset - Check the required reset for child devices
785 * @pdn: pci device node to be reset. 595 * @parent: parent device
596 * @freset: return value
597 *
598 * Each device might have its preferred reset type: fundamental or
599 * hot reset. The routine is used to collect the information from
600 * the child devices so that they could be reset accordingly.
601 */
602void __eeh_set_pe_freset(struct device_node *parent, unsigned int *freset)
603{
604 struct device_node *dn;
605
606 for_each_child_of_node(parent, dn) {
607 if (of_node_to_eeh_dev(dn)) {
608 struct pci_dev *dev = of_node_to_eeh_dev(dn)->pdev;
609
610 if (dev && dev->driver)
611 *freset |= dev->needs_freset;
612
613 __eeh_set_pe_freset(dn, freset);
614 }
615 }
616}
617
618/**
619 * eeh_set_pe_freset - Check the required reset for the indicated device and its children
620 * @dn: parent device
621 * @freset: return value
622 *
623 * Each device might have its preferred reset type: fundamental or
624 * hot reset. The routine is used to collected the information for
625 * the indicated device and its children so that the bunch of the
626 * devices could be reset properly.
786 */ 627 */
628void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset)
629{
630 struct pci_dev *dev;
631 dn = eeh_find_device_pe(dn);
632
633 /* Back up one, since config addrs might be shared */
634 if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent))
635 dn = dn->parent;
636
637 dev = of_node_to_eeh_dev(dn)->pdev;
638 if (dev)
639 *freset |= dev->needs_freset;
787 640
788static void __rtas_set_slot_reset(struct pci_dn *pdn) 641 __eeh_set_pe_freset(dn, freset);
642}
643
644/**
645 * eeh_reset_pe_once - Assert the pci #RST line for 1/4 second
646 * @edev: pci device node to be reset.
647 *
648 * Assert the PCI #RST line for 1/4 second.
649 */
650static void eeh_reset_pe_once(struct eeh_dev *edev)
789{ 651{
790 unsigned int freset = 0; 652 unsigned int freset = 0;
653 struct device_node *dn = eeh_dev_to_of_node(edev);
791 654
792 /* Determine type of EEH reset required for 655 /* Determine type of EEH reset required for
793 * Partitionable Endpoint, a hot-reset (1) 656 * Partitionable Endpoint, a hot-reset (1)
@@ -795,58 +658,68 @@ static void __rtas_set_slot_reset(struct pci_dn *pdn)
795 * A fundamental reset required by any device under 658 * A fundamental reset required by any device under
796 * Partitionable Endpoint trumps hot-reset. 659 * Partitionable Endpoint trumps hot-reset.
797 */ 660 */
798 eeh_set_pe_freset(pdn->node, &freset); 661 eeh_set_pe_freset(dn, &freset);
799 662
800 if (freset) 663 if (freset)
801 rtas_pci_slot_reset(pdn, 3); 664 eeh_ops->reset(dn, EEH_RESET_FUNDAMENTAL);
802 else 665 else
803 rtas_pci_slot_reset(pdn, 1); 666 eeh_ops->reset(dn, EEH_RESET_HOT);
804 667
805 /* The PCI bus requires that the reset be held high for at least 668 /* The PCI bus requires that the reset be held high for at least
806 * a 100 milliseconds. We wait a bit longer 'just in case'. */ 669 * a 100 milliseconds. We wait a bit longer 'just in case'.
807 670 */
808#define PCI_BUS_RST_HOLD_TIME_MSEC 250 671#define PCI_BUS_RST_HOLD_TIME_MSEC 250
809 msleep (PCI_BUS_RST_HOLD_TIME_MSEC); 672 msleep(PCI_BUS_RST_HOLD_TIME_MSEC);
810 673
811 /* We might get hit with another EEH freeze as soon as the 674 /* We might get hit with another EEH freeze as soon as the
812 * pci slot reset line is dropped. Make sure we don't miss 675 * pci slot reset line is dropped. Make sure we don't miss
813 * these, and clear the flag now. */ 676 * these, and clear the flag now.
814 eeh_clear_slot (pdn->node, EEH_MODE_ISOLATED); 677 */
678 eeh_clear_slot(dn, EEH_MODE_ISOLATED);
815 679
816 rtas_pci_slot_reset (pdn, 0); 680 eeh_ops->reset(dn, EEH_RESET_DEACTIVATE);
817 681
818 /* After a PCI slot has been reset, the PCI Express spec requires 682 /* After a PCI slot has been reset, the PCI Express spec requires
819 * a 1.5 second idle time for the bus to stabilize, before starting 683 * a 1.5 second idle time for the bus to stabilize, before starting
820 * up traffic. */ 684 * up traffic.
685 */
821#define PCI_BUS_SETTLE_TIME_MSEC 1800 686#define PCI_BUS_SETTLE_TIME_MSEC 1800
822 msleep (PCI_BUS_SETTLE_TIME_MSEC); 687 msleep(PCI_BUS_SETTLE_TIME_MSEC);
823} 688}
824 689
825int rtas_set_slot_reset(struct pci_dn *pdn) 690/**
691 * eeh_reset_pe - Reset the indicated PE
692 * @edev: PCI device associated EEH device
693 *
694 * This routine should be called to reset indicated device, including
695 * PE. A PE might include multiple PCI devices and sometimes PCI bridges
696 * might be involved as well.
697 */
698int eeh_reset_pe(struct eeh_dev *edev)
826{ 699{
827 int i, rc; 700 int i, rc;
701 struct device_node *dn = eeh_dev_to_of_node(edev);
828 702
829 /* Take three shots at resetting the bus */ 703 /* Take three shots at resetting the bus */
830 for (i=0; i<3; i++) { 704 for (i=0; i<3; i++) {
831 __rtas_set_slot_reset(pdn); 705 eeh_reset_pe_once(edev);
832 706
833 rc = eeh_wait_for_slot_status(pdn, PCI_BUS_RESET_WAIT_MSEC); 707 rc = eeh_ops->wait_state(dn, PCI_BUS_RESET_WAIT_MSEC);
834 if (rc == 0) 708 if (rc == (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE))
835 return 0; 709 return 0;
836 710
837 if (rc < 0) { 711 if (rc < 0) {
838 printk(KERN_ERR "EEH: unrecoverable slot failure %s\n", 712 printk(KERN_ERR "EEH: unrecoverable slot failure %s\n",
839 pdn->node->full_name); 713 dn->full_name);
840 return -1; 714 return -1;
841 } 715 }
842 printk(KERN_ERR "EEH: bus reset %d failed on slot %s, rc=%d\n", 716 printk(KERN_ERR "EEH: bus reset %d failed on slot %s, rc=%d\n",
843 i+1, pdn->node->full_name, rc); 717 i+1, dn->full_name, rc);
844 } 718 }
845 719
846 return -1; 720 return -1;
847} 721}
848 722
849/* ------------------------------------------------------- */
850/** Save and restore of PCI BARs 723/** Save and restore of PCI BARs
851 * 724 *
852 * Although firmware will set up BARs during boot, it doesn't 725 * Although firmware will set up BARs during boot, it doesn't
@@ -856,181 +729,122 @@ int rtas_set_slot_reset(struct pci_dn *pdn)
856 */ 729 */
857 730
858/** 731/**
859 * __restore_bars - Restore the Base Address Registers 732 * eeh_restore_one_device_bars - Restore the Base Address Registers for one device
860 * @pdn: pci device node 733 * @edev: PCI device associated EEH device
861 * 734 *
862 * Loads the PCI configuration space base address registers, 735 * Loads the PCI configuration space base address registers,
863 * the expansion ROM base address, the latency timer, and etc. 736 * the expansion ROM base address, the latency timer, and etc.
864 * from the saved values in the device node. 737 * from the saved values in the device node.
865 */ 738 */
866static inline void __restore_bars (struct pci_dn *pdn) 739static inline void eeh_restore_one_device_bars(struct eeh_dev *edev)
867{ 740{
868 int i; 741 int i;
869 u32 cmd; 742 u32 cmd;
743 struct device_node *dn = eeh_dev_to_of_node(edev);
744
745 if (!edev->phb)
746 return;
870 747
871 if (NULL==pdn->phb) return;
872 for (i=4; i<10; i++) { 748 for (i=4; i<10; i++) {
873 rtas_write_config(pdn, i*4, 4, pdn->config_space[i]); 749 eeh_ops->write_config(dn, i*4, 4, edev->config_space[i]);
874 } 750 }
875 751
876 /* 12 == Expansion ROM Address */ 752 /* 12 == Expansion ROM Address */
877 rtas_write_config(pdn, 12*4, 4, pdn->config_space[12]); 753 eeh_ops->write_config(dn, 12*4, 4, edev->config_space[12]);
878 754
879#define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF)) 755#define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF))
880#define SAVED_BYTE(OFF) (((u8 *)(pdn->config_space))[BYTE_SWAP(OFF)]) 756#define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)])
881 757
882 rtas_write_config (pdn, PCI_CACHE_LINE_SIZE, 1, 758 eeh_ops->write_config(dn, PCI_CACHE_LINE_SIZE, 1,
883 SAVED_BYTE(PCI_CACHE_LINE_SIZE)); 759 SAVED_BYTE(PCI_CACHE_LINE_SIZE));
884 760
885 rtas_write_config (pdn, PCI_LATENCY_TIMER, 1, 761 eeh_ops->write_config(dn, PCI_LATENCY_TIMER, 1,
886 SAVED_BYTE(PCI_LATENCY_TIMER)); 762 SAVED_BYTE(PCI_LATENCY_TIMER));
887 763
888 /* max latency, min grant, interrupt pin and line */ 764 /* max latency, min grant, interrupt pin and line */
889 rtas_write_config(pdn, 15*4, 4, pdn->config_space[15]); 765 eeh_ops->write_config(dn, 15*4, 4, edev->config_space[15]);
890 766
891 /* Restore PERR & SERR bits, some devices require it, 767 /* Restore PERR & SERR bits, some devices require it,
892 don't touch the other command bits */ 768 * don't touch the other command bits
893 rtas_read_config(pdn, PCI_COMMAND, 4, &cmd); 769 */
894 if (pdn->config_space[1] & PCI_COMMAND_PARITY) 770 eeh_ops->read_config(dn, PCI_COMMAND, 4, &cmd);
771 if (edev->config_space[1] & PCI_COMMAND_PARITY)
895 cmd |= PCI_COMMAND_PARITY; 772 cmd |= PCI_COMMAND_PARITY;
896 else 773 else
897 cmd &= ~PCI_COMMAND_PARITY; 774 cmd &= ~PCI_COMMAND_PARITY;
898 if (pdn->config_space[1] & PCI_COMMAND_SERR) 775 if (edev->config_space[1] & PCI_COMMAND_SERR)
899 cmd |= PCI_COMMAND_SERR; 776 cmd |= PCI_COMMAND_SERR;
900 else 777 else
901 cmd &= ~PCI_COMMAND_SERR; 778 cmd &= ~PCI_COMMAND_SERR;
902 rtas_write_config(pdn, PCI_COMMAND, 4, cmd); 779 eeh_ops->write_config(dn, PCI_COMMAND, 4, cmd);
903} 780}
904 781
905/** 782/**
906 * eeh_restore_bars - restore the PCI config space info 783 * eeh_restore_bars - Restore the PCI config space info
784 * @edev: EEH device
907 * 785 *
908 * This routine performs a recursive walk to the children 786 * This routine performs a recursive walk to the children
909 * of this device as well. 787 * of this device as well.
910 */ 788 */
911void eeh_restore_bars(struct pci_dn *pdn) 789void eeh_restore_bars(struct eeh_dev *edev)
912{ 790{
913 struct device_node *dn; 791 struct device_node *dn;
914 if (!pdn) 792 if (!edev)
915 return; 793 return;
916 794
917 if ((pdn->eeh_mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(pdn->class_code)) 795 if ((edev->mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(edev->class_code))
918 __restore_bars (pdn); 796 eeh_restore_one_device_bars(edev);
919 797
920 for_each_child_of_node(pdn->node, dn) 798 for_each_child_of_node(eeh_dev_to_of_node(edev), dn)
921 eeh_restore_bars (PCI_DN(dn)); 799 eeh_restore_bars(of_node_to_eeh_dev(dn));
922} 800}
923 801
924/** 802/**
925 * eeh_save_bars - save device bars 803 * eeh_save_bars - Save device bars
804 * @edev: PCI device associated EEH device
926 * 805 *
927 * Save the values of the device bars. Unlike the restore 806 * Save the values of the device bars. Unlike the restore
928 * routine, this routine is *not* recursive. This is because 807 * routine, this routine is *not* recursive. This is because
929 * PCI devices are added individually; but, for the restore, 808 * PCI devices are added individually; but, for the restore,
930 * an entire slot is reset at a time. 809 * an entire slot is reset at a time.
931 */ 810 */
932static void eeh_save_bars(struct pci_dn *pdn) 811static void eeh_save_bars(struct eeh_dev *edev)
933{ 812{
934 int i; 813 int i;
814 struct device_node *dn;
935 815
936 if (!pdn ) 816 if (!edev)
937 return; 817 return;
818 dn = eeh_dev_to_of_node(edev);
938 819
939 for (i = 0; i < 16; i++) 820 for (i = 0; i < 16; i++)
940 rtas_read_config(pdn, i * 4, 4, &pdn->config_space[i]); 821 eeh_ops->read_config(dn, i * 4, 4, &edev->config_space[i]);
941}
942
943void
944rtas_configure_bridge(struct pci_dn *pdn)
945{
946 int config_addr;
947 int rc;
948 int token;
949
950 /* Use PE configuration address, if present */
951 config_addr = pdn->eeh_config_addr;
952 if (pdn->eeh_pe_config_addr)
953 config_addr = pdn->eeh_pe_config_addr;
954
955 /* Use new configure-pe function, if supported */
956 if (ibm_configure_pe != RTAS_UNKNOWN_SERVICE)
957 token = ibm_configure_pe;
958 else
959 token = ibm_configure_bridge;
960
961 rc = rtas_call(token, 3, 1, NULL,
962 config_addr,
963 BUID_HI(pdn->phb->buid),
964 BUID_LO(pdn->phb->buid));
965 if (rc) {
966 printk (KERN_WARNING "EEH: Unable to configure device bridge (%d) for %s\n",
967 rc, pdn->node->full_name);
968 }
969} 822}
970 823
971/* ------------------------------------------------------------- */ 824/**
972/* The code below deals with enabling EEH for devices during the 825 * eeh_early_enable - Early enable EEH on the indicated device
973 * early boot sequence. EEH must be enabled before any PCI probing 826 * @dn: device node
974 * can be done. 827 * @data: BUID
828 *
829 * Enable EEH functionality on the specified PCI device. The function
830 * is expected to be called before real PCI probing is done. However,
831 * the PHBs have been initialized at this point.
975 */ 832 */
976 833static void *eeh_early_enable(struct device_node *dn, void *data)
977#define EEH_ENABLE 1
978
979struct eeh_early_enable_info {
980 unsigned int buid_hi;
981 unsigned int buid_lo;
982};
983
984static int get_pe_addr (int config_addr,
985 struct eeh_early_enable_info *info)
986{ 834{
987 unsigned int rets[3];
988 int ret;
989
990 /* Use latest config-addr token on power6 */
991 if (ibm_get_config_addr_info2 != RTAS_UNKNOWN_SERVICE) {
992 /* Make sure we have a PE in hand */
993 ret = rtas_call (ibm_get_config_addr_info2, 4, 2, rets,
994 config_addr, info->buid_hi, info->buid_lo, 1);
995 if (ret || (rets[0]==0))
996 return 0;
997
998 ret = rtas_call (ibm_get_config_addr_info2, 4, 2, rets,
999 config_addr, info->buid_hi, info->buid_lo, 0);
1000 if (ret)
1001 return 0;
1002 return rets[0];
1003 }
1004
1005 /* Use older config-addr token on power5 */
1006 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) {
1007 ret = rtas_call (ibm_get_config_addr_info, 4, 2, rets,
1008 config_addr, info->buid_hi, info->buid_lo, 0);
1009 if (ret)
1010 return 0;
1011 return rets[0];
1012 }
1013 return 0;
1014}
1015
1016/* Enable eeh for the given device node. */
1017static void *early_enable_eeh(struct device_node *dn, void *data)
1018{
1019 unsigned int rets[3];
1020 struct eeh_early_enable_info *info = data;
1021 int ret; 835 int ret;
1022 const u32 *class_code = of_get_property(dn, "class-code", NULL); 836 const u32 *class_code = of_get_property(dn, "class-code", NULL);
1023 const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL); 837 const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL);
1024 const u32 *device_id = of_get_property(dn, "device-id", NULL); 838 const u32 *device_id = of_get_property(dn, "device-id", NULL);
1025 const u32 *regs; 839 const u32 *regs;
1026 int enable; 840 int enable;
1027 struct pci_dn *pdn = PCI_DN(dn); 841 struct eeh_dev *edev = of_node_to_eeh_dev(dn);
1028 842
1029 pdn->class_code = 0; 843 edev->class_code = 0;
1030 pdn->eeh_mode = 0; 844 edev->mode = 0;
1031 pdn->eeh_check_count = 0; 845 edev->check_count = 0;
1032 pdn->eeh_freeze_count = 0; 846 edev->freeze_count = 0;
1033 pdn->eeh_false_positives = 0; 847 edev->false_positives = 0;
1034 848
1035 if (!of_device_is_available(dn)) 849 if (!of_device_is_available(dn))
1036 return NULL; 850 return NULL;
@@ -1041,54 +855,56 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
1041 855
1042 /* There is nothing to check on PCI to ISA bridges */ 856 /* There is nothing to check on PCI to ISA bridges */
1043 if (dn->type && !strcmp(dn->type, "isa")) { 857 if (dn->type && !strcmp(dn->type, "isa")) {
1044 pdn->eeh_mode |= EEH_MODE_NOCHECK; 858 edev->mode |= EEH_MODE_NOCHECK;
1045 return NULL; 859 return NULL;
1046 } 860 }
1047 pdn->class_code = *class_code; 861 edev->class_code = *class_code;
1048 862
1049 /* Ok... see if this device supports EEH. Some do, some don't, 863 /* Ok... see if this device supports EEH. Some do, some don't,
1050 * and the only way to find out is to check each and every one. */ 864 * and the only way to find out is to check each and every one.
865 */
1051 regs = of_get_property(dn, "reg", NULL); 866 regs = of_get_property(dn, "reg", NULL);
1052 if (regs) { 867 if (regs) {
1053 /* First register entry is addr (00BBSS00) */ 868 /* First register entry is addr (00BBSS00) */
1054 /* Try to enable eeh */ 869 /* Try to enable eeh */
1055 ret = rtas_call(ibm_set_eeh_option, 4, 1, NULL, 870 ret = eeh_ops->set_option(dn, EEH_OPT_ENABLE);
1056 regs[0], info->buid_hi, info->buid_lo,
1057 EEH_ENABLE);
1058 871
1059 enable = 0; 872 enable = 0;
1060 if (ret == 0) { 873 if (ret == 0) {
1061 pdn->eeh_config_addr = regs[0]; 874 edev->config_addr = regs[0];
1062 875
1063 /* If the newer, better, ibm,get-config-addr-info is supported, 876 /* If the newer, better, ibm,get-config-addr-info is supported,
1064 * then use that instead. */ 877 * then use that instead.
1065 pdn->eeh_pe_config_addr = get_pe_addr(pdn->eeh_config_addr, info); 878 */
879 edev->pe_config_addr = eeh_ops->get_pe_addr(dn);
1066 880
1067 /* Some older systems (Power4) allow the 881 /* Some older systems (Power4) allow the
1068 * ibm,set-eeh-option call to succeed even on nodes 882 * ibm,set-eeh-option call to succeed even on nodes
1069 * where EEH is not supported. Verify support 883 * where EEH is not supported. Verify support
1070 * explicitly. */ 884 * explicitly.
1071 ret = read_slot_reset_state(pdn, rets); 885 */
1072 if ((ret == 0) && (rets[1] == 1)) 886 ret = eeh_ops->get_state(dn, NULL);
887 if (ret > 0 && ret != EEH_STATE_NOT_SUPPORT)
1073 enable = 1; 888 enable = 1;
1074 } 889 }
1075 890
1076 if (enable) { 891 if (enable) {
1077 eeh_subsystem_enabled = 1; 892 eeh_subsystem_enabled = 1;
1078 pdn->eeh_mode |= EEH_MODE_SUPPORTED; 893 edev->mode |= EEH_MODE_SUPPORTED;
1079 894
1080 pr_debug("EEH: %s: eeh enabled, config=%x pe_config=%x\n", 895 pr_debug("EEH: %s: eeh enabled, config=%x pe_config=%x\n",
1081 dn->full_name, pdn->eeh_config_addr, 896 dn->full_name, edev->config_addr,
1082 pdn->eeh_pe_config_addr); 897 edev->pe_config_addr);
1083 } else { 898 } else {
1084 899
1085 /* This device doesn't support EEH, but it may have an 900 /* This device doesn't support EEH, but it may have an
1086 * EEH parent, in which case we mark it as supported. */ 901 * EEH parent, in which case we mark it as supported.
1087 if (dn->parent && PCI_DN(dn->parent) 902 */
1088 && (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) { 903 if (dn->parent && of_node_to_eeh_dev(dn->parent) &&
904 (of_node_to_eeh_dev(dn->parent)->mode & EEH_MODE_SUPPORTED)) {
1089 /* Parent supports EEH. */ 905 /* Parent supports EEH. */
1090 pdn->eeh_mode |= EEH_MODE_SUPPORTED; 906 edev->mode |= EEH_MODE_SUPPORTED;
1091 pdn->eeh_config_addr = PCI_DN(dn->parent)->eeh_config_addr; 907 edev->config_addr = of_node_to_eeh_dev(dn->parent)->config_addr;
1092 return NULL; 908 return NULL;
1093 } 909 }
1094 } 910 }
@@ -1097,11 +913,63 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
1097 dn->full_name); 913 dn->full_name);
1098 } 914 }
1099 915
1100 eeh_save_bars(pdn); 916 eeh_save_bars(edev);
1101 return NULL; 917 return NULL;
1102} 918}
1103 919
1104/* 920/**
921 * eeh_ops_register - Register platform dependent EEH operations
922 * @ops: platform dependent EEH operations
923 *
924 * Register the platform dependent EEH operation callback
925 * functions. The platform should call this function before
926 * any other EEH operations.
927 */
928int __init eeh_ops_register(struct eeh_ops *ops)
929{
930 if (!ops->name) {
931 pr_warning("%s: Invalid EEH ops name for %p\n",
932 __func__, ops);
933 return -EINVAL;
934 }
935
936 if (eeh_ops && eeh_ops != ops) {
937 pr_warning("%s: EEH ops of platform %s already existing (%s)\n",
938 __func__, eeh_ops->name, ops->name);
939 return -EEXIST;
940 }
941
942 eeh_ops = ops;
943
944 return 0;
945}
946
947/**
948 * eeh_ops_unregister - Unreigster platform dependent EEH operations
949 * @name: name of EEH platform operations
950 *
951 * Unregister the platform dependent EEH operation callback
952 * functions.
953 */
954int __exit eeh_ops_unregister(const char *name)
955{
956 if (!name || !strlen(name)) {
957 pr_warning("%s: Invalid EEH ops name\n",
958 __func__);
959 return -EINVAL;
960 }
961
962 if (eeh_ops && !strcmp(eeh_ops->name, name)) {
963 eeh_ops = NULL;
964 return 0;
965 }
966
967 return -EEXIST;
968}
969
970/**
971 * eeh_init - EEH initialization
972 *
1105 * Initialize EEH by trying to enable it for all of the adapters in the system. 973 * Initialize EEH by trying to enable it for all of the adapters in the system.
1106 * As a side effect we can determine here if eeh is supported at all. 974 * As a side effect we can determine here if eeh is supported at all.
1107 * Note that we leave EEH on so failed config cycles won't cause a machine 975 * Note that we leave EEH on so failed config cycles won't cause a machine
@@ -1117,50 +985,35 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
1117void __init eeh_init(void) 985void __init eeh_init(void)
1118{ 986{
1119 struct device_node *phb, *np; 987 struct device_node *phb, *np;
1120 struct eeh_early_enable_info info; 988 int ret;
989
990 /* call platform initialization function */
991 if (!eeh_ops) {
992 pr_warning("%s: Platform EEH operation not found\n",
993 __func__);
994 return;
995 } else if ((ret = eeh_ops->init())) {
996 pr_warning("%s: Failed to call platform init function (%d)\n",
997 __func__, ret);
998 return;
999 }
1121 1000
1122 raw_spin_lock_init(&confirm_error_lock); 1001 raw_spin_lock_init(&confirm_error_lock);
1123 spin_lock_init(&slot_errbuf_lock);
1124 1002
1125 np = of_find_node_by_path("/rtas"); 1003 np = of_find_node_by_path("/rtas");
1126 if (np == NULL) 1004 if (np == NULL)
1127 return; 1005 return;
1128 1006
1129 ibm_set_eeh_option = rtas_token("ibm,set-eeh-option");
1130 ibm_set_slot_reset = rtas_token("ibm,set-slot-reset");
1131 ibm_read_slot_reset_state2 = rtas_token("ibm,read-slot-reset-state2");
1132 ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state");
1133 ibm_slot_error_detail = rtas_token("ibm,slot-error-detail");
1134 ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info");
1135 ibm_get_config_addr_info2 = rtas_token("ibm,get-config-addr-info2");
1136 ibm_configure_bridge = rtas_token ("ibm,configure-bridge");
1137 ibm_configure_pe = rtas_token("ibm,configure-pe");
1138
1139 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE)
1140 return;
1141
1142 eeh_error_buf_size = rtas_token("rtas-error-log-max");
1143 if (eeh_error_buf_size == RTAS_UNKNOWN_SERVICE) {
1144 eeh_error_buf_size = 1024;
1145 }
1146 if (eeh_error_buf_size > RTAS_ERROR_LOG_MAX) {
1147 printk(KERN_WARNING "EEH: rtas-error-log-max is bigger than allocated "
1148 "buffer ! (%d vs %d)", eeh_error_buf_size, RTAS_ERROR_LOG_MAX);
1149 eeh_error_buf_size = RTAS_ERROR_LOG_MAX;
1150 }
1151
1152 /* Enable EEH for all adapters. Note that eeh requires buid's */ 1007 /* Enable EEH for all adapters. Note that eeh requires buid's */
1153 for (phb = of_find_node_by_name(NULL, "pci"); phb; 1008 for (phb = of_find_node_by_name(NULL, "pci"); phb;
1154 phb = of_find_node_by_name(phb, "pci")) { 1009 phb = of_find_node_by_name(phb, "pci")) {
1155 unsigned long buid; 1010 unsigned long buid;
1156 1011
1157 buid = get_phb_buid(phb); 1012 buid = get_phb_buid(phb);
1158 if (buid == 0 || PCI_DN(phb) == NULL) 1013 if (buid == 0 || !of_node_to_eeh_dev(phb))
1159 continue; 1014 continue;
1160 1015
1161 info.buid_lo = BUID_LO(buid); 1016 traverse_pci_devices(phb, eeh_early_enable, NULL);
1162 info.buid_hi = BUID_HI(buid);
1163 traverse_pci_devices(phb, early_enable_eeh, &info);
1164 } 1017 }
1165 1018
1166 if (eeh_subsystem_enabled) 1019 if (eeh_subsystem_enabled)
@@ -1170,7 +1023,7 @@ void __init eeh_init(void)
1170} 1023}
1171 1024
1172/** 1025/**
1173 * eeh_add_device_early - enable EEH for the indicated device_node 1026 * eeh_add_device_early - Enable EEH for the indicated device_node
1174 * @dn: device node for which to set up EEH 1027 * @dn: device node for which to set up EEH
1175 * 1028 *
1176 * This routine must be used to perform EEH initialization for PCI 1029 * This routine must be used to perform EEH initialization for PCI
@@ -1184,21 +1037,26 @@ void __init eeh_init(void)
1184static void eeh_add_device_early(struct device_node *dn) 1037static void eeh_add_device_early(struct device_node *dn)
1185{ 1038{
1186 struct pci_controller *phb; 1039 struct pci_controller *phb;
1187 struct eeh_early_enable_info info;
1188 1040
1189 if (!dn || !PCI_DN(dn)) 1041 if (!dn || !of_node_to_eeh_dev(dn))
1190 return; 1042 return;
1191 phb = PCI_DN(dn)->phb; 1043 phb = of_node_to_eeh_dev(dn)->phb;
1192 1044
1193 /* USB Bus children of PCI devices will not have BUID's */ 1045 /* USB Bus children of PCI devices will not have BUID's */
1194 if (NULL == phb || 0 == phb->buid) 1046 if (NULL == phb || 0 == phb->buid)
1195 return; 1047 return;
1196 1048
1197 info.buid_hi = BUID_HI(phb->buid); 1049 eeh_early_enable(dn, NULL);
1198 info.buid_lo = BUID_LO(phb->buid);
1199 early_enable_eeh(dn, &info);
1200} 1050}
1201 1051
1052/**
1053 * eeh_add_device_tree_early - Enable EEH for the indicated device
1054 * @dn: device node
1055 *
1056 * This routine must be used to perform EEH initialization for the
1057 * indicated PCI device that was added after system boot (e.g.
1058 * hotplug, dlpar).
1059 */
1202void eeh_add_device_tree_early(struct device_node *dn) 1060void eeh_add_device_tree_early(struct device_node *dn)
1203{ 1061{
1204 struct device_node *sib; 1062 struct device_node *sib;
@@ -1210,7 +1068,7 @@ void eeh_add_device_tree_early(struct device_node *dn)
1210EXPORT_SYMBOL_GPL(eeh_add_device_tree_early); 1068EXPORT_SYMBOL_GPL(eeh_add_device_tree_early);
1211 1069
1212/** 1070/**
1213 * eeh_add_device_late - perform EEH initialization for the indicated pci device 1071 * eeh_add_device_late - Perform EEH initialization for the indicated pci device
1214 * @dev: pci device for which to set up EEH 1072 * @dev: pci device for which to set up EEH
1215 * 1073 *
1216 * This routine must be used to complete EEH initialization for PCI 1074 * This routine must be used to complete EEH initialization for PCI
@@ -1219,7 +1077,7 @@ EXPORT_SYMBOL_GPL(eeh_add_device_tree_early);
1219static void eeh_add_device_late(struct pci_dev *dev) 1077static void eeh_add_device_late(struct pci_dev *dev)
1220{ 1078{
1221 struct device_node *dn; 1079 struct device_node *dn;
1222 struct pci_dn *pdn; 1080 struct eeh_dev *edev;
1223 1081
1224 if (!dev || !eeh_subsystem_enabled) 1082 if (!dev || !eeh_subsystem_enabled)
1225 return; 1083 return;
@@ -1227,20 +1085,29 @@ static void eeh_add_device_late(struct pci_dev *dev)
1227 pr_debug("EEH: Adding device %s\n", pci_name(dev)); 1085 pr_debug("EEH: Adding device %s\n", pci_name(dev));
1228 1086
1229 dn = pci_device_to_OF_node(dev); 1087 dn = pci_device_to_OF_node(dev);
1230 pdn = PCI_DN(dn); 1088 edev = pci_dev_to_eeh_dev(dev);
1231 if (pdn->pcidev == dev) { 1089 if (edev->pdev == dev) {
1232 pr_debug("EEH: Already referenced !\n"); 1090 pr_debug("EEH: Already referenced !\n");
1233 return; 1091 return;
1234 } 1092 }
1235 WARN_ON(pdn->pcidev); 1093 WARN_ON(edev->pdev);
1236 1094
1237 pci_dev_get (dev); 1095 pci_dev_get(dev);
1238 pdn->pcidev = dev; 1096 edev->pdev = dev;
1097 dev->dev.archdata.edev = edev;
1239 1098
1240 pci_addr_cache_insert_device(dev); 1099 pci_addr_cache_insert_device(dev);
1241 eeh_sysfs_add_device(dev); 1100 eeh_sysfs_add_device(dev);
1242} 1101}
1243 1102
1103/**
1104 * eeh_add_device_tree_late - Perform EEH initialization for the indicated PCI bus
1105 * @bus: PCI bus
1106 *
1107 * This routine must be used to perform EEH initialization for PCI
1108 * devices which are attached to the indicated PCI bus. The PCI bus
1109 * is added after system boot through hotplug or dlpar.
1110 */
1244void eeh_add_device_tree_late(struct pci_bus *bus) 1111void eeh_add_device_tree_late(struct pci_bus *bus)
1245{ 1112{
1246 struct pci_dev *dev; 1113 struct pci_dev *dev;
@@ -1257,7 +1124,7 @@ void eeh_add_device_tree_late(struct pci_bus *bus)
1257EXPORT_SYMBOL_GPL(eeh_add_device_tree_late); 1124EXPORT_SYMBOL_GPL(eeh_add_device_tree_late);
1258 1125
1259/** 1126/**
1260 * eeh_remove_device - undo EEH setup for the indicated pci device 1127 * eeh_remove_device - Undo EEH setup for the indicated pci device
1261 * @dev: pci device to be removed 1128 * @dev: pci device to be removed
1262 * 1129 *
1263 * This routine should be called when a device is removed from 1130 * This routine should be called when a device is removed from
@@ -1268,25 +1135,35 @@ EXPORT_SYMBOL_GPL(eeh_add_device_tree_late);
1268 */ 1135 */
1269static void eeh_remove_device(struct pci_dev *dev) 1136static void eeh_remove_device(struct pci_dev *dev)
1270{ 1137{
1271 struct device_node *dn; 1138 struct eeh_dev *edev;
1139
1272 if (!dev || !eeh_subsystem_enabled) 1140 if (!dev || !eeh_subsystem_enabled)
1273 return; 1141 return;
1142 edev = pci_dev_to_eeh_dev(dev);
1274 1143
1275 /* Unregister the device with the EEH/PCI address search system */ 1144 /* Unregister the device with the EEH/PCI address search system */
1276 pr_debug("EEH: Removing device %s\n", pci_name(dev)); 1145 pr_debug("EEH: Removing device %s\n", pci_name(dev));
1277 1146
1278 dn = pci_device_to_OF_node(dev); 1147 if (!edev || !edev->pdev) {
1279 if (PCI_DN(dn)->pcidev == NULL) {
1280 pr_debug("EEH: Not referenced !\n"); 1148 pr_debug("EEH: Not referenced !\n");
1281 return; 1149 return;
1282 } 1150 }
1283 PCI_DN(dn)->pcidev = NULL; 1151 edev->pdev = NULL;
1284 pci_dev_put (dev); 1152 dev->dev.archdata.edev = NULL;
1153 pci_dev_put(dev);
1285 1154
1286 pci_addr_cache_remove_device(dev); 1155 pci_addr_cache_remove_device(dev);
1287 eeh_sysfs_remove_device(dev); 1156 eeh_sysfs_remove_device(dev);
1288} 1157}
1289 1158
1159/**
1160 * eeh_remove_bus_device - Undo EEH setup for the indicated PCI device
1161 * @dev: PCI device
1162 *
1163 * This routine must be called when a device is removed from the
1164 * running system through hotplug or dlpar. The corresponding
1165 * PCI address cache will be removed.
1166 */
1290void eeh_remove_bus_device(struct pci_dev *dev) 1167void eeh_remove_bus_device(struct pci_dev *dev)
1291{ 1168{
1292 struct pci_bus *bus = dev->subordinate; 1169 struct pci_bus *bus = dev->subordinate;
@@ -1305,21 +1182,24 @@ static int proc_eeh_show(struct seq_file *m, void *v)
1305{ 1182{
1306 if (0 == eeh_subsystem_enabled) { 1183 if (0 == eeh_subsystem_enabled) {
1307 seq_printf(m, "EEH Subsystem is globally disabled\n"); 1184 seq_printf(m, "EEH Subsystem is globally disabled\n");
1308 seq_printf(m, "eeh_total_mmio_ffs=%ld\n", total_mmio_ffs); 1185 seq_printf(m, "eeh_total_mmio_ffs=%llu\n", eeh_stats.total_mmio_ffs);
1309 } else { 1186 } else {
1310 seq_printf(m, "EEH Subsystem is enabled\n"); 1187 seq_printf(m, "EEH Subsystem is enabled\n");
1311 seq_printf(m, 1188 seq_printf(m,
1312 "no device=%ld\n" 1189 "no device=%llu\n"
1313 "no device node=%ld\n" 1190 "no device node=%llu\n"
1314 "no config address=%ld\n" 1191 "no config address=%llu\n"
1315 "check not wanted=%ld\n" 1192 "check not wanted=%llu\n"
1316 "eeh_total_mmio_ffs=%ld\n" 1193 "eeh_total_mmio_ffs=%llu\n"
1317 "eeh_false_positives=%ld\n" 1194 "eeh_false_positives=%llu\n"
1318 "eeh_slot_resets=%ld\n", 1195 "eeh_slot_resets=%llu\n",
1319 no_device, no_dn, no_cfg_addr, 1196 eeh_stats.no_device,
1320 ignored_check, total_mmio_ffs, 1197 eeh_stats.no_dn,
1321 false_positives, 1198 eeh_stats.no_cfg_addr,
1322 slot_resets); 1199 eeh_stats.ignored_check,
1200 eeh_stats.total_mmio_ffs,
1201 eeh_stats.false_positives,
1202 eeh_stats.slot_resets);
1323 } 1203 }
1324 1204
1325 return 0; 1205 return 0;
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index fc5ae767989..e5ae1c687c6 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * eeh_cache.c
3 * PCI address cache; allows the lookup of PCI devices based on I/O address 2 * PCI address cache; allows the lookup of PCI devices based on I/O address
4 * 3 *
5 * Copyright IBM Corporation 2004 4 * Copyright IBM Corporation 2004
@@ -47,8 +46,7 @@
47 * than any hash algo I could think of for this problem, even 46 * than any hash algo I could think of for this problem, even
48 * with the penalty of slow pointer chases for d-cache misses). 47 * with the penalty of slow pointer chases for d-cache misses).
49 */ 48 */
50struct pci_io_addr_range 49struct pci_io_addr_range {
51{
52 struct rb_node rb_node; 50 struct rb_node rb_node;
53 unsigned long addr_lo; 51 unsigned long addr_lo;
54 unsigned long addr_hi; 52 unsigned long addr_hi;
@@ -56,13 +54,12 @@ struct pci_io_addr_range
56 unsigned int flags; 54 unsigned int flags;
57}; 55};
58 56
59static struct pci_io_addr_cache 57static struct pci_io_addr_cache {
60{
61 struct rb_root rb_root; 58 struct rb_root rb_root;
62 spinlock_t piar_lock; 59 spinlock_t piar_lock;
63} pci_io_addr_cache_root; 60} pci_io_addr_cache_root;
64 61
65static inline struct pci_dev *__pci_get_device_by_addr(unsigned long addr) 62static inline struct pci_dev *__pci_addr_cache_get_device(unsigned long addr)
66{ 63{
67 struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node; 64 struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node;
68 65
@@ -86,7 +83,7 @@ static inline struct pci_dev *__pci_get_device_by_addr(unsigned long addr)
86} 83}
87 84
88/** 85/**
89 * pci_get_device_by_addr - Get device, given only address 86 * pci_addr_cache_get_device - Get device, given only address
90 * @addr: mmio (PIO) phys address or i/o port number 87 * @addr: mmio (PIO) phys address or i/o port number
91 * 88 *
92 * Given an mmio phys address, or a port number, find a pci device 89 * Given an mmio phys address, or a port number, find a pci device
@@ -95,13 +92,13 @@ static inline struct pci_dev *__pci_get_device_by_addr(unsigned long addr)
95 * from zero (that is, they do *not* have pci_io_addr added in). 92 * from zero (that is, they do *not* have pci_io_addr added in).
96 * It is safe to call this function within an interrupt. 93 * It is safe to call this function within an interrupt.
97 */ 94 */
98struct pci_dev *pci_get_device_by_addr(unsigned long addr) 95struct pci_dev *pci_addr_cache_get_device(unsigned long addr)
99{ 96{
100 struct pci_dev *dev; 97 struct pci_dev *dev;
101 unsigned long flags; 98 unsigned long flags;
102 99
103 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 100 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
104 dev = __pci_get_device_by_addr(addr); 101 dev = __pci_addr_cache_get_device(addr);
105 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 102 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
106 return dev; 103 return dev;
107} 104}
@@ -166,7 +163,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
166 163
167#ifdef DEBUG 164#ifdef DEBUG
168 printk(KERN_DEBUG "PIAR: insert range=[%lx:%lx] dev=%s\n", 165 printk(KERN_DEBUG "PIAR: insert range=[%lx:%lx] dev=%s\n",
169 alo, ahi, pci_name (dev)); 166 alo, ahi, pci_name(dev));
170#endif 167#endif
171 168
172 rb_link_node(&piar->rb_node, parent, p); 169 rb_link_node(&piar->rb_node, parent, p);
@@ -178,7 +175,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
178static void __pci_addr_cache_insert_device(struct pci_dev *dev) 175static void __pci_addr_cache_insert_device(struct pci_dev *dev)
179{ 176{
180 struct device_node *dn; 177 struct device_node *dn;
181 struct pci_dn *pdn; 178 struct eeh_dev *edev;
182 int i; 179 int i;
183 180
184 dn = pci_device_to_OF_node(dev); 181 dn = pci_device_to_OF_node(dev);
@@ -187,13 +184,19 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev)
187 return; 184 return;
188 } 185 }
189 186
187 edev = of_node_to_eeh_dev(dn);
188 if (!edev) {
189 pr_warning("PCI: no EEH dev found for dn=%s\n",
190 dn->full_name);
191 return;
192 }
193
190 /* Skip any devices for which EEH is not enabled. */ 194 /* Skip any devices for which EEH is not enabled. */
191 pdn = PCI_DN(dn); 195 if (!(edev->mode & EEH_MODE_SUPPORTED) ||
192 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) || 196 edev->mode & EEH_MODE_NOCHECK) {
193 pdn->eeh_mode & EEH_MODE_NOCHECK) {
194#ifdef DEBUG 197#ifdef DEBUG
195 printk(KERN_INFO "PCI: skip building address cache for=%s - %s\n", 198 pr_info("PCI: skip building address cache for=%s - %s\n",
196 pci_name(dev), pdn->node->full_name); 199 pci_name(dev), dn->full_name);
197#endif 200#endif
198 return; 201 return;
199 } 202 }
@@ -284,6 +287,7 @@ void pci_addr_cache_remove_device(struct pci_dev *dev)
284void __init pci_addr_cache_build(void) 287void __init pci_addr_cache_build(void)
285{ 288{
286 struct device_node *dn; 289 struct device_node *dn;
290 struct eeh_dev *edev;
287 struct pci_dev *dev = NULL; 291 struct pci_dev *dev = NULL;
288 292
289 spin_lock_init(&pci_io_addr_cache_root.piar_lock); 293 spin_lock_init(&pci_io_addr_cache_root.piar_lock);
@@ -294,8 +298,14 @@ void __init pci_addr_cache_build(void)
294 dn = pci_device_to_OF_node(dev); 298 dn = pci_device_to_OF_node(dev);
295 if (!dn) 299 if (!dn)
296 continue; 300 continue;
301
302 edev = of_node_to_eeh_dev(dn);
303 if (!edev)
304 continue;
305
297 pci_dev_get(dev); /* matching put is in eeh_remove_device() */ 306 pci_dev_get(dev); /* matching put is in eeh_remove_device() */
298 PCI_DN(dn)->pcidev = dev; 307 dev->dev.archdata.edev = edev;
308 edev->pdev = dev;
299 309
300 eeh_sysfs_add_device(dev); 310 eeh_sysfs_add_device(dev);
301 } 311 }
diff --git a/arch/powerpc/platforms/pseries/eeh_dev.c b/arch/powerpc/platforms/pseries/eeh_dev.c
new file mode 100644
index 00000000000..f3aed7dcae9
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/eeh_dev.c
@@ -0,0 +1,102 @@
1/*
2 * The file intends to implement dynamic creation of EEH device, which will
3 * be bound with OF node and PCI device simutaneously. The EEH devices would
4 * be foundamental information for EEH core components to work proerly. Besides,
5 * We have to support multiple situations where dynamic creation of EEH device
6 * is required:
7 *
8 * 1) Before PCI emunation starts, we need create EEH devices according to the
9 * PCI sensitive OF nodes.
10 * 2) When PCI emunation is done, we need do the binding between PCI device and
11 * the associated EEH device.
12 * 3) DR (Dynamic Reconfiguration) would create PCI sensitive OF node. EEH device
13 * will be created while PCI sensitive OF node is detected from DR.
14 * 4) PCI hotplug needs redoing the binding between PCI device and EEH device. If
15 * PHB is newly inserted, we also need create EEH devices accordingly.
16 *
17 * Copyright Benjamin Herrenschmidt & Gavin Shan, IBM Corporation 2012.
18 *
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 */
33
34#include <linux/export.h>
35#include <linux/gfp.h>
36#include <linux/init.h>
37#include <linux/kernel.h>
38#include <linux/pci.h>
39#include <linux/string.h>
40
41#include <asm/pci-bridge.h>
42#include <asm/ppc-pci.h>
43
44/**
45 * eeh_dev_init - Create EEH device according to OF node
46 * @dn: device node
47 * @data: PHB
48 *
49 * It will create EEH device according to the given OF node. The function
50 * might be called by PCI emunation, DR, PHB hotplug.
51 */
52void * __devinit eeh_dev_init(struct device_node *dn, void *data)
53{
54 struct pci_controller *phb = data;
55 struct eeh_dev *edev;
56
57 /* Allocate EEH device */
58 edev = zalloc_maybe_bootmem(sizeof(*edev), GFP_KERNEL);
59 if (!edev) {
60 pr_warning("%s: out of memory\n", __func__);
61 return NULL;
62 }
63
64 /* Associate EEH device with OF node */
65 dn->edev = edev;
66 edev->dn = dn;
67 edev->phb = phb;
68
69 return NULL;
70}
71
72/**
73 * eeh_dev_phb_init_dynamic - Create EEH devices for devices included in PHB
74 * @phb: PHB
75 *
76 * Scan the PHB OF node and its child association, then create the
77 * EEH devices accordingly
78 */
79void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb)
80{
81 struct device_node *dn = phb->dn;
82
83 /* EEH device for PHB */
84 eeh_dev_init(dn, phb);
85
86 /* EEH devices for children OF nodes */
87 traverse_pci_devices(dn, eeh_dev_init, phb);
88}
89
90/**
91 * eeh_dev_phb_init - Create EEH devices for devices included in existing PHBs
92 *
93 * Scan all the existing PHBs and create EEH devices for their OF
94 * nodes and their children OF nodes
95 */
96void __init eeh_dev_phb_init(void)
97{
98 struct pci_controller *phb, *tmp;
99
100 list_for_each_entry_safe(phb, tmp, &hose_list, list_node)
101 eeh_dev_phb_init_dynamic(phb);
102}
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 1b6cb10589e..baf92cd9dfa 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -33,8 +33,14 @@
33#include <asm/prom.h> 33#include <asm/prom.h>
34#include <asm/rtas.h> 34#include <asm/rtas.h>
35 35
36 36/**
37static inline const char * pcid_name (struct pci_dev *pdev) 37 * eeh_pcid_name - Retrieve name of PCI device driver
38 * @pdev: PCI device
39 *
40 * This routine is used to retrieve the name of PCI device driver
41 * if that's valid.
42 */
43static inline const char *eeh_pcid_name(struct pci_dev *pdev)
38{ 44{
39 if (pdev && pdev->dev.driver) 45 if (pdev && pdev->dev.driver)
40 return pdev->dev.driver->name; 46 return pdev->dev.driver->name;
@@ -64,48 +70,59 @@ static void print_device_node_tree(struct pci_dn *pdn, int dent)
64#endif 70#endif
65 71
66/** 72/**
67 * eeh_disable_irq - disable interrupt for the recovering device 73 * eeh_disable_irq - Disable interrupt for the recovering device
74 * @dev: PCI device
75 *
76 * This routine must be called when reporting temporary or permanent
77 * error to the particular PCI device to disable interrupt of that
78 * device. If the device has enabled MSI or MSI-X interrupt, we needn't
79 * do real work because EEH should freeze DMA transfers for those PCI
80 * devices encountering EEH errors, which includes MSI or MSI-X.
68 */ 81 */
69static void eeh_disable_irq(struct pci_dev *dev) 82static void eeh_disable_irq(struct pci_dev *dev)
70{ 83{
71 struct device_node *dn = pci_device_to_OF_node(dev); 84 struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
72 85
73 /* Don't disable MSI and MSI-X interrupts. They are 86 /* Don't disable MSI and MSI-X interrupts. They are
74 * effectively disabled by the DMA Stopped state 87 * effectively disabled by the DMA Stopped state
75 * when an EEH error occurs. 88 * when an EEH error occurs.
76 */ 89 */
77 if (dev->msi_enabled || dev->msix_enabled) 90 if (dev->msi_enabled || dev->msix_enabled)
78 return; 91 return;
79 92
80 if (!irq_has_action(dev->irq)) 93 if (!irq_has_action(dev->irq))
81 return; 94 return;
82 95
83 PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED; 96 edev->mode |= EEH_MODE_IRQ_DISABLED;
84 disable_irq_nosync(dev->irq); 97 disable_irq_nosync(dev->irq);
85} 98}
86 99
87/** 100/**
88 * eeh_enable_irq - enable interrupt for the recovering device 101 * eeh_enable_irq - Enable interrupt for the recovering device
102 * @dev: PCI device
103 *
104 * This routine must be called to enable interrupt while failed
105 * device could be resumed.
89 */ 106 */
90static void eeh_enable_irq(struct pci_dev *dev) 107static void eeh_enable_irq(struct pci_dev *dev)
91{ 108{
92 struct device_node *dn = pci_device_to_OF_node(dev); 109 struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
93 110
94 if ((PCI_DN(dn)->eeh_mode) & EEH_MODE_IRQ_DISABLED) { 111 if ((edev->mode) & EEH_MODE_IRQ_DISABLED) {
95 PCI_DN(dn)->eeh_mode &= ~EEH_MODE_IRQ_DISABLED; 112 edev->mode &= ~EEH_MODE_IRQ_DISABLED;
96 enable_irq(dev->irq); 113 enable_irq(dev->irq);
97 } 114 }
98} 115}
99 116
100/* ------------------------------------------------------- */
101/** 117/**
102 * eeh_report_error - report pci error to each device driver 118 * eeh_report_error - Report pci error to each device driver
119 * @dev: PCI device
120 * @userdata: return value
103 * 121 *
104 * Report an EEH error to each device driver, collect up and 122 * Report an EEH error to each device driver, collect up and
105 * merge the device driver responses. Cumulative response 123 * merge the device driver responses. Cumulative response
106 * passed back in "userdata". 124 * passed back in "userdata".
107 */ 125 */
108
109static int eeh_report_error(struct pci_dev *dev, void *userdata) 126static int eeh_report_error(struct pci_dev *dev, void *userdata)
110{ 127{
111 enum pci_ers_result rc, *res = userdata; 128 enum pci_ers_result rc, *res = userdata;
@@ -122,7 +139,7 @@ static int eeh_report_error(struct pci_dev *dev, void *userdata)
122 !driver->err_handler->error_detected) 139 !driver->err_handler->error_detected)
123 return 0; 140 return 0;
124 141
125 rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen); 142 rc = driver->err_handler->error_detected(dev, pci_channel_io_frozen);
126 143
127 /* A driver that needs a reset trumps all others */ 144 /* A driver that needs a reset trumps all others */
128 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 145 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
@@ -132,13 +149,14 @@ static int eeh_report_error(struct pci_dev *dev, void *userdata)
132} 149}
133 150
134/** 151/**
135 * eeh_report_mmio_enabled - tell drivers that MMIO has been enabled 152 * eeh_report_mmio_enabled - Tell drivers that MMIO has been enabled
153 * @dev: PCI device
154 * @userdata: return value
136 * 155 *
137 * Tells each device driver that IO ports, MMIO and config space I/O 156 * Tells each device driver that IO ports, MMIO and config space I/O
138 * are now enabled. Collects up and merges the device driver responses. 157 * are now enabled. Collects up and merges the device driver responses.
139 * Cumulative response passed back in "userdata". 158 * Cumulative response passed back in "userdata".
140 */ 159 */
141
142static int eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata) 160static int eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata)
143{ 161{
144 enum pci_ers_result rc, *res = userdata; 162 enum pci_ers_result rc, *res = userdata;
@@ -149,7 +167,7 @@ static int eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata)
149 !driver->err_handler->mmio_enabled) 167 !driver->err_handler->mmio_enabled)
150 return 0; 168 return 0;
151 169
152 rc = driver->err_handler->mmio_enabled (dev); 170 rc = driver->err_handler->mmio_enabled(dev);
153 171
154 /* A driver that needs a reset trumps all others */ 172 /* A driver that needs a reset trumps all others */
155 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 173 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
@@ -159,9 +177,15 @@ static int eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata)
159} 177}
160 178
161/** 179/**
162 * eeh_report_reset - tell device that slot has been reset 180 * eeh_report_reset - Tell device that slot has been reset
181 * @dev: PCI device
182 * @userdata: return value
183 *
184 * This routine must be called while EEH tries to reset particular
185 * PCI device so that the associated PCI device driver could take
186 * some actions, usually to save data the driver needs so that the
187 * driver can work again while the device is recovered.
163 */ 188 */
164
165static int eeh_report_reset(struct pci_dev *dev, void *userdata) 189static int eeh_report_reset(struct pci_dev *dev, void *userdata)
166{ 190{
167 enum pci_ers_result rc, *res = userdata; 191 enum pci_ers_result rc, *res = userdata;
@@ -188,9 +212,14 @@ static int eeh_report_reset(struct pci_dev *dev, void *userdata)
188} 212}
189 213
190/** 214/**
191 * eeh_report_resume - tell device to resume normal operations 215 * eeh_report_resume - Tell device to resume normal operations
216 * @dev: PCI device
217 * @userdata: return value
218 *
219 * This routine must be called to notify the device driver that it
220 * could resume so that the device driver can do some initialization
221 * to make the recovered device work again.
192 */ 222 */
193
194static int eeh_report_resume(struct pci_dev *dev, void *userdata) 223static int eeh_report_resume(struct pci_dev *dev, void *userdata)
195{ 224{
196 struct pci_driver *driver = dev->driver; 225 struct pci_driver *driver = dev->driver;
@@ -212,12 +241,13 @@ static int eeh_report_resume(struct pci_dev *dev, void *userdata)
212} 241}
213 242
214/** 243/**
215 * eeh_report_failure - tell device driver that device is dead. 244 * eeh_report_failure - Tell device driver that device is dead.
245 * @dev: PCI device
246 * @userdata: return value
216 * 247 *
217 * This informs the device driver that the device is permanently 248 * This informs the device driver that the device is permanently
218 * dead, and that no further recovery attempts will be made on it. 249 * dead, and that no further recovery attempts will be made on it.
219 */ 250 */
220
221static int eeh_report_failure(struct pci_dev *dev, void *userdata) 251static int eeh_report_failure(struct pci_dev *dev, void *userdata)
222{ 252{
223 struct pci_driver *driver = dev->driver; 253 struct pci_driver *driver = dev->driver;
@@ -238,65 +268,46 @@ static int eeh_report_failure(struct pci_dev *dev, void *userdata)
238 return 0; 268 return 0;
239} 269}
240 270
241/* ------------------------------------------------------- */
242/** 271/**
243 * handle_eeh_events -- reset a PCI device after hard lockup. 272 * eeh_reset_device - Perform actual reset of a pci slot
244 * 273 * @edev: PE associated EEH device
245 * pSeries systems will isolate a PCI slot if the PCI-Host 274 * @bus: PCI bus corresponding to the isolcated slot
246 * bridge detects address or data parity errors, DMA's
247 * occurring to wild addresses (which usually happen due to
248 * bugs in device drivers or in PCI adapter firmware).
249 * Slot isolations also occur if #SERR, #PERR or other misc
250 * PCI-related errors are detected.
251 * 275 *
252 * Recovery process consists of unplugging the device driver 276 * This routine must be called to do reset on the indicated PE.
253 * (which generated hotplug events to userspace), then issuing 277 * During the reset, udev might be invoked because those affected
254 * a PCI #RST to the device, then reconfiguring the PCI config 278 * PCI devices will be removed and then added.
255 * space for all bridges & devices under this slot, and then
256 * finally restarting the device drivers (which cause a second
257 * set of hotplug events to go out to userspace).
258 */ 279 */
259 280static int eeh_reset_device(struct eeh_dev *edev, struct pci_bus *bus)
260/**
261 * eeh_reset_device() -- perform actual reset of a pci slot
262 * @bus: pointer to the pci bus structure corresponding
263 * to the isolated slot. A non-null value will
264 * cause all devices under the bus to be removed
265 * and then re-added.
266 * @pe_dn: pointer to a "Partionable Endpoint" device node.
267 * This is the top-level structure on which pci
268 * bus resets can be performed.
269 */
270
271static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
272{ 281{
273 struct device_node *dn; 282 struct device_node *dn;
274 int cnt, rc; 283 int cnt, rc;
275 284
276 /* pcibios will clear the counter; save the value */ 285 /* pcibios will clear the counter; save the value */
277 cnt = pe_dn->eeh_freeze_count; 286 cnt = edev->freeze_count;
278 287
279 if (bus) 288 if (bus)
280 pcibios_remove_pci_devices(bus); 289 pcibios_remove_pci_devices(bus);
281 290
282 /* Reset the pci controller. (Asserts RST#; resets config space). 291 /* Reset the pci controller. (Asserts RST#; resets config space).
283 * Reconfigure bridges and devices. Don't try to bring the system 292 * Reconfigure bridges and devices. Don't try to bring the system
284 * up if the reset failed for some reason. */ 293 * up if the reset failed for some reason.
285 rc = rtas_set_slot_reset(pe_dn); 294 */
295 rc = eeh_reset_pe(edev);
286 if (rc) 296 if (rc)
287 return rc; 297 return rc;
288 298
289 /* Walk over all functions on this device. */ 299 /* Walk over all functions on this device. */
290 dn = pe_dn->node; 300 dn = eeh_dev_to_of_node(edev);
291 if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) 301 if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent))
292 dn = dn->parent->child; 302 dn = dn->parent->child;
293 303
294 while (dn) { 304 while (dn) {
295 struct pci_dn *ppe = PCI_DN(dn); 305 struct eeh_dev *pedev = of_node_to_eeh_dev(dn);
306
296 /* On Power4, always true because eeh_pe_config_addr=0 */ 307 /* On Power4, always true because eeh_pe_config_addr=0 */
297 if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) { 308 if (edev->pe_config_addr == pedev->pe_config_addr) {
298 rtas_configure_bridge(ppe); 309 eeh_ops->configure_bridge(dn);
299 eeh_restore_bars(ppe); 310 eeh_restore_bars(pedev);
300 } 311 }
301 dn = dn->sibling; 312 dn = dn->sibling;
302 } 313 }
@@ -308,10 +319,10 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
308 * potentially weird things happen. 319 * potentially weird things happen.
309 */ 320 */
310 if (bus) { 321 if (bus) {
311 ssleep (5); 322 ssleep(5);
312 pcibios_add_pci_devices(bus); 323 pcibios_add_pci_devices(bus);
313 } 324 }
314 pe_dn->eeh_freeze_count = cnt; 325 edev->freeze_count = cnt;
315 326
316 return 0; 327 return 0;
317} 328}
@@ -321,23 +332,39 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
321 */ 332 */
322#define MAX_WAIT_FOR_RECOVERY 150 333#define MAX_WAIT_FOR_RECOVERY 150
323 334
324struct pci_dn * handle_eeh_events (struct eeh_event *event) 335/**
336 * eeh_handle_event - Reset a PCI device after hard lockup.
337 * @event: EEH event
338 *
339 * While PHB detects address or data parity errors on particular PCI
340 * slot, the associated PE will be frozen. Besides, DMA's occurring
341 * to wild addresses (which usually happen due to bugs in device
342 * drivers or in PCI adapter firmware) can cause EEH error. #SERR,
343 * #PERR or other misc PCI-related errors also can trigger EEH errors.
344 *
345 * Recovery process consists of unplugging the device driver (which
346 * generated hotplug events to userspace), then issuing a PCI #RST to
347 * the device, then reconfiguring the PCI config space for all bridges
348 * & devices under this slot, and then finally restarting the device
349 * drivers (which cause a second set of hotplug events to go out to
350 * userspace).
351 */
352struct eeh_dev *handle_eeh_events(struct eeh_event *event)
325{ 353{
326 struct device_node *frozen_dn; 354 struct device_node *frozen_dn;
327 struct pci_dn *frozen_pdn; 355 struct eeh_dev *frozen_edev;
328 struct pci_bus *frozen_bus; 356 struct pci_bus *frozen_bus;
329 int rc = 0; 357 int rc = 0;
330 enum pci_ers_result result = PCI_ERS_RESULT_NONE; 358 enum pci_ers_result result = PCI_ERS_RESULT_NONE;
331 const char *location, *pci_str, *drv_str, *bus_pci_str, *bus_drv_str; 359 const char *location, *pci_str, *drv_str, *bus_pci_str, *bus_drv_str;
332 360
333 frozen_dn = find_device_pe(event->dn); 361 frozen_dn = eeh_find_device_pe(eeh_dev_to_of_node(event->edev));
334 if (!frozen_dn) { 362 if (!frozen_dn) {
335 363 location = of_get_property(eeh_dev_to_of_node(event->edev), "ibm,loc-code", NULL);
336 location = of_get_property(event->dn, "ibm,loc-code", NULL);
337 location = location ? location : "unknown"; 364 location = location ? location : "unknown";
338 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint " 365 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint "
339 "for location=%s pci addr=%s\n", 366 "for location=%s pci addr=%s\n",
340 location, eeh_pci_name(event->dev)); 367 location, eeh_pci_name(eeh_dev_to_pci_dev(event->edev)));
341 return NULL; 368 return NULL;
342 } 369 }
343 370
@@ -350,9 +377,10 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
350 * which was always an EADS pci bridge. In the new style, 377 * which was always an EADS pci bridge. In the new style,
351 * there might not be any EADS bridges, and even when there are, 378 * there might not be any EADS bridges, and even when there are,
352 * the firmware marks them as "EEH incapable". So another 379 * the firmware marks them as "EEH incapable". So another
353 * two-step is needed to find the pci bus.. */ 380 * two-step is needed to find the pci bus..
381 */
354 if (!frozen_bus) 382 if (!frozen_bus)
355 frozen_bus = pcibios_find_pci_bus (frozen_dn->parent); 383 frozen_bus = pcibios_find_pci_bus(frozen_dn->parent);
356 384
357 if (!frozen_bus) { 385 if (!frozen_bus) {
358 printk(KERN_ERR "EEH: Cannot find PCI bus " 386 printk(KERN_ERR "EEH: Cannot find PCI bus "
@@ -361,22 +389,21 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
361 return NULL; 389 return NULL;
362 } 390 }
363 391
364 frozen_pdn = PCI_DN(frozen_dn); 392 frozen_edev = of_node_to_eeh_dev(frozen_dn);
365 frozen_pdn->eeh_freeze_count++; 393 frozen_edev->freeze_count++;
394 pci_str = eeh_pci_name(eeh_dev_to_pci_dev(event->edev));
395 drv_str = eeh_pcid_name(eeh_dev_to_pci_dev(event->edev));
366 396
367 pci_str = eeh_pci_name(event->dev); 397 if (frozen_edev->freeze_count > EEH_MAX_ALLOWED_FREEZES)
368 drv_str = pcid_name(event->dev);
369
370 if (frozen_pdn->eeh_freeze_count > EEH_MAX_ALLOWED_FREEZES)
371 goto excess_failures; 398 goto excess_failures;
372 399
373 printk(KERN_WARNING 400 printk(KERN_WARNING
374 "EEH: This PCI device has failed %d times in the last hour:\n", 401 "EEH: This PCI device has failed %d times in the last hour:\n",
375 frozen_pdn->eeh_freeze_count); 402 frozen_edev->freeze_count);
376 403
377 if (frozen_pdn->pcidev) { 404 if (frozen_edev->pdev) {
378 bus_pci_str = pci_name(frozen_pdn->pcidev); 405 bus_pci_str = pci_name(frozen_edev->pdev);
379 bus_drv_str = pcid_name(frozen_pdn->pcidev); 406 bus_drv_str = eeh_pcid_name(frozen_edev->pdev);
380 printk(KERN_WARNING 407 printk(KERN_WARNING
381 "EEH: Bus location=%s driver=%s pci addr=%s\n", 408 "EEH: Bus location=%s driver=%s pci addr=%s\n",
382 location, bus_drv_str, bus_pci_str); 409 location, bus_drv_str, bus_pci_str);
@@ -395,9 +422,10 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
395 pci_walk_bus(frozen_bus, eeh_report_error, &result); 422 pci_walk_bus(frozen_bus, eeh_report_error, &result);
396 423
397 /* Get the current PCI slot state. This can take a long time, 424 /* Get the current PCI slot state. This can take a long time,
398 * sometimes over 3 seconds for certain systems. */ 425 * sometimes over 3 seconds for certain systems.
399 rc = eeh_wait_for_slot_status (frozen_pdn, MAX_WAIT_FOR_RECOVERY*1000); 426 */
400 if (rc < 0) { 427 rc = eeh_ops->wait_state(eeh_dev_to_of_node(frozen_edev), MAX_WAIT_FOR_RECOVERY*1000);
428 if (rc < 0 || rc == EEH_STATE_NOT_SUPPORT) {
401 printk(KERN_WARNING "EEH: Permanent failure\n"); 429 printk(KERN_WARNING "EEH: Permanent failure\n");
402 goto hard_fail; 430 goto hard_fail;
403 } 431 }
@@ -406,14 +434,14 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
406 * don't post the error log until after all dev drivers 434 * don't post the error log until after all dev drivers
407 * have been informed. 435 * have been informed.
408 */ 436 */
409 eeh_slot_error_detail(frozen_pdn, EEH_LOG_TEMP_FAILURE); 437 eeh_slot_error_detail(frozen_edev, EEH_LOG_TEMP);
410 438
411 /* If all device drivers were EEH-unaware, then shut 439 /* If all device drivers were EEH-unaware, then shut
412 * down all of the device drivers, and hope they 440 * down all of the device drivers, and hope they
413 * go down willingly, without panicing the system. 441 * go down willingly, without panicing the system.
414 */ 442 */
415 if (result == PCI_ERS_RESULT_NONE) { 443 if (result == PCI_ERS_RESULT_NONE) {
416 rc = eeh_reset_device(frozen_pdn, frozen_bus); 444 rc = eeh_reset_device(frozen_edev, frozen_bus);
417 if (rc) { 445 if (rc) {
418 printk(KERN_WARNING "EEH: Unable to reset, rc=%d\n", rc); 446 printk(KERN_WARNING "EEH: Unable to reset, rc=%d\n", rc);
419 goto hard_fail; 447 goto hard_fail;
@@ -422,7 +450,7 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
422 450
423 /* If all devices reported they can proceed, then re-enable MMIO */ 451 /* If all devices reported they can proceed, then re-enable MMIO */
424 if (result == PCI_ERS_RESULT_CAN_RECOVER) { 452 if (result == PCI_ERS_RESULT_CAN_RECOVER) {
425 rc = rtas_pci_enable(frozen_pdn, EEH_THAW_MMIO); 453 rc = eeh_pci_enable(frozen_edev, EEH_OPT_THAW_MMIO);
426 454
427 if (rc < 0) 455 if (rc < 0)
428 goto hard_fail; 456 goto hard_fail;
@@ -436,7 +464,7 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
436 464
437 /* If all devices reported they can proceed, then re-enable DMA */ 465 /* If all devices reported they can proceed, then re-enable DMA */
438 if (result == PCI_ERS_RESULT_CAN_RECOVER) { 466 if (result == PCI_ERS_RESULT_CAN_RECOVER) {
439 rc = rtas_pci_enable(frozen_pdn, EEH_THAW_DMA); 467 rc = eeh_pci_enable(frozen_edev, EEH_OPT_THAW_DMA);
440 468
441 if (rc < 0) 469 if (rc < 0)
442 goto hard_fail; 470 goto hard_fail;
@@ -454,7 +482,7 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
454 482
455 /* If any device called out for a reset, then reset the slot */ 483 /* If any device called out for a reset, then reset the slot */
456 if (result == PCI_ERS_RESULT_NEED_RESET) { 484 if (result == PCI_ERS_RESULT_NEED_RESET) {
457 rc = eeh_reset_device(frozen_pdn, NULL); 485 rc = eeh_reset_device(frozen_edev, NULL);
458 if (rc) { 486 if (rc) {
459 printk(KERN_WARNING "EEH: Cannot reset, rc=%d\n", rc); 487 printk(KERN_WARNING "EEH: Cannot reset, rc=%d\n", rc);
460 goto hard_fail; 488 goto hard_fail;
@@ -473,7 +501,7 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
473 /* Tell all device drivers that they can resume operations */ 501 /* Tell all device drivers that they can resume operations */
474 pci_walk_bus(frozen_bus, eeh_report_resume, NULL); 502 pci_walk_bus(frozen_bus, eeh_report_resume, NULL);
475 503
476 return frozen_pdn; 504 return frozen_edev;
477 505
478excess_failures: 506excess_failures:
479 /* 507 /*
@@ -486,7 +514,7 @@ excess_failures:
486 "has failed %d times in the last hour " 514 "has failed %d times in the last hour "
487 "and has been permanently disabled.\n" 515 "and has been permanently disabled.\n"
488 "Please try reseating this device or replacing it.\n", 516 "Please try reseating this device or replacing it.\n",
489 location, drv_str, pci_str, frozen_pdn->eeh_freeze_count); 517 location, drv_str, pci_str, frozen_edev->freeze_count);
490 goto perm_error; 518 goto perm_error;
491 519
492hard_fail: 520hard_fail:
@@ -497,7 +525,7 @@ hard_fail:
497 location, drv_str, pci_str); 525 location, drv_str, pci_str);
498 526
499perm_error: 527perm_error:
500 eeh_slot_error_detail(frozen_pdn, EEH_LOG_PERM_FAILURE); 528 eeh_slot_error_detail(frozen_edev, EEH_LOG_PERM);
501 529
502 /* Notify all devices that they're about to go down. */ 530 /* Notify all devices that they're about to go down. */
503 pci_walk_bus(frozen_bus, eeh_report_failure, NULL); 531 pci_walk_bus(frozen_bus, eeh_report_failure, NULL);
@@ -508,4 +536,3 @@ perm_error:
508 return NULL; 536 return NULL;
509} 537}
510 538
511/* ---------- end of file ---------- */
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c
index d2383cfb6df..4a475256585 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * eeh_event.c
3 *
4 * This program is free software; you can redistribute it and/or modify 2 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 3 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or 4 * the Free Software Foundation; either version 2 of the License, or
@@ -46,7 +44,7 @@ DECLARE_WORK(eeh_event_wq, eeh_thread_launcher);
46DEFINE_MUTEX(eeh_event_mutex); 44DEFINE_MUTEX(eeh_event_mutex);
47 45
48/** 46/**
49 * eeh_event_handler - dispatch EEH events. 47 * eeh_event_handler - Dispatch EEH events.
50 * @dummy - unused 48 * @dummy - unused
51 * 49 *
52 * The detection of a frozen slot can occur inside an interrupt, 50 * The detection of a frozen slot can occur inside an interrupt,
@@ -58,10 +56,10 @@ DEFINE_MUTEX(eeh_event_mutex);
58static int eeh_event_handler(void * dummy) 56static int eeh_event_handler(void * dummy)
59{ 57{
60 unsigned long flags; 58 unsigned long flags;
61 struct eeh_event *event; 59 struct eeh_event *event;
62 struct pci_dn *pdn; 60 struct eeh_dev *edev;
63 61
64 daemonize ("eehd"); 62 daemonize("eehd");
65 set_current_state(TASK_INTERRUPTIBLE); 63 set_current_state(TASK_INTERRUPTIBLE);
66 64
67 spin_lock_irqsave(&eeh_eventlist_lock, flags); 65 spin_lock_irqsave(&eeh_eventlist_lock, flags);
@@ -79,31 +77,37 @@ static int eeh_event_handler(void * dummy)
79 77
80 /* Serialize processing of EEH events */ 78 /* Serialize processing of EEH events */
81 mutex_lock(&eeh_event_mutex); 79 mutex_lock(&eeh_event_mutex);
82 eeh_mark_slot(event->dn, EEH_MODE_RECOVERING); 80 edev = event->edev;
81 eeh_mark_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING);
83 82
84 printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n", 83 printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n",
85 eeh_pci_name(event->dev)); 84 eeh_pci_name(edev->pdev));
85
86 edev = handle_eeh_events(event);
86 87
87 pdn = handle_eeh_events(event); 88 eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING);
89 pci_dev_put(edev->pdev);
88 90
89 eeh_clear_slot(event->dn, EEH_MODE_RECOVERING);
90 pci_dev_put(event->dev);
91 kfree(event); 91 kfree(event);
92 mutex_unlock(&eeh_event_mutex); 92 mutex_unlock(&eeh_event_mutex);
93 93
94 /* If there are no new errors after an hour, clear the counter. */ 94 /* If there are no new errors after an hour, clear the counter. */
95 if (pdn && pdn->eeh_freeze_count>0) { 95 if (edev && edev->freeze_count>0) {
96 msleep_interruptible (3600*1000); 96 msleep_interruptible(3600*1000);
97 if (pdn->eeh_freeze_count>0) 97 if (edev->freeze_count>0)
98 pdn->eeh_freeze_count--; 98 edev->freeze_count--;
99
99 } 100 }
100 101
101 return 0; 102 return 0;
102} 103}
103 104
104/** 105/**
105 * eeh_thread_launcher 106 * eeh_thread_launcher - Start kernel thread to handle EEH events
106 * @dummy - unused 107 * @dummy - unused
108 *
109 * This routine is called to start the kernel thread for processing
110 * EEH event.
107 */ 111 */
108static void eeh_thread_launcher(struct work_struct *dummy) 112static void eeh_thread_launcher(struct work_struct *dummy)
109{ 113{
@@ -112,18 +116,18 @@ static void eeh_thread_launcher(struct work_struct *dummy)
112} 116}
113 117
114/** 118/**
115 * eeh_send_failure_event - generate a PCI error event 119 * eeh_send_failure_event - Generate a PCI error event
116 * @dev pci device 120 * @edev: EEH device
117 * 121 *
118 * This routine can be called within an interrupt context; 122 * This routine can be called within an interrupt context;
119 * the actual event will be delivered in a normal context 123 * the actual event will be delivered in a normal context
120 * (from a workqueue). 124 * (from a workqueue).
121 */ 125 */
122int eeh_send_failure_event (struct device_node *dn, 126int eeh_send_failure_event(struct eeh_dev *edev)
123 struct pci_dev *dev)
124{ 127{
125 unsigned long flags; 128 unsigned long flags;
126 struct eeh_event *event; 129 struct eeh_event *event;
130 struct device_node *dn = eeh_dev_to_of_node(edev);
127 const char *location; 131 const char *location;
128 132
129 if (!mem_init_done) { 133 if (!mem_init_done) {
@@ -135,15 +139,14 @@ int eeh_send_failure_event (struct device_node *dn,
135 } 139 }
136 event = kmalloc(sizeof(*event), GFP_ATOMIC); 140 event = kmalloc(sizeof(*event), GFP_ATOMIC);
137 if (event == NULL) { 141 if (event == NULL) {
138 printk (KERN_ERR "EEH: out of memory, event not handled\n"); 142 printk(KERN_ERR "EEH: out of memory, event not handled\n");
139 return 1; 143 return 1;
140 } 144 }
141 145
142 if (dev) 146 if (edev->pdev)
143 pci_dev_get(dev); 147 pci_dev_get(edev->pdev);
144 148
145 event->dn = dn; 149 event->edev = edev;
146 event->dev = dev;
147 150
148 /* We may or may not be called in an interrupt context */ 151 /* We may or may not be called in an interrupt context */
149 spin_lock_irqsave(&eeh_eventlist_lock, flags); 152 spin_lock_irqsave(&eeh_eventlist_lock, flags);
@@ -154,5 +157,3 @@ int eeh_send_failure_event (struct device_node *dn,
154 157
155 return 0; 158 return 0;
156} 159}
157
158/********************** END OF FILE ******************************/
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
new file mode 100644
index 00000000000..8752f79a6af
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -0,0 +1,565 @@
1/*
2 * The file intends to implement the platform dependent EEH operations on pseries.
3 * Actually, the pseries platform is built based on RTAS heavily. That means the
4 * pseries platform dependent EEH operations will be built on RTAS calls. The functions
5 * are devired from arch/powerpc/platforms/pseries/eeh.c and necessary cleanup has
6 * been done.
7 *
8 * Copyright Benjamin Herrenschmidt & Gavin Shan, IBM Corporation 2011.
9 * Copyright IBM Corporation 2001, 2005, 2006
10 * Copyright Dave Engebretsen & Todd Inglett 2001
11 * Copyright Linas Vepstas 2005, 2006
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
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 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 */
27
28#include <linux/atomic.h>
29#include <linux/delay.h>
30#include <linux/export.h>
31#include <linux/init.h>
32#include <linux/list.h>
33#include <linux/of.h>
34#include <linux/pci.h>
35#include <linux/proc_fs.h>
36#include <linux/rbtree.h>
37#include <linux/sched.h>
38#include <linux/seq_file.h>
39#include <linux/spinlock.h>
40
41#include <asm/eeh.h>
42#include <asm/eeh_event.h>
43#include <asm/io.h>
44#include <asm/machdep.h>
45#include <asm/ppc-pci.h>
46#include <asm/rtas.h>
47
48/* RTAS tokens */
49static int ibm_set_eeh_option;
50static int ibm_set_slot_reset;
51static int ibm_read_slot_reset_state;
52static int ibm_read_slot_reset_state2;
53static int ibm_slot_error_detail;
54static int ibm_get_config_addr_info;
55static int ibm_get_config_addr_info2;
56static int ibm_configure_bridge;
57static int ibm_configure_pe;
58
59/*
60 * Buffer for reporting slot-error-detail rtas calls. Its here
61 * in BSS, and not dynamically alloced, so that it ends up in
62 * RMO where RTAS can access it.
63 */
64static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX];
65static DEFINE_SPINLOCK(slot_errbuf_lock);
66static int eeh_error_buf_size;
67
68/**
69 * pseries_eeh_init - EEH platform dependent initialization
70 *
71 * EEH platform dependent initialization on pseries.
72 */
73static int pseries_eeh_init(void)
74{
75 /* figure out EEH RTAS function call tokens */
76 ibm_set_eeh_option = rtas_token("ibm,set-eeh-option");
77 ibm_set_slot_reset = rtas_token("ibm,set-slot-reset");
78 ibm_read_slot_reset_state2 = rtas_token("ibm,read-slot-reset-state2");
79 ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state");
80 ibm_slot_error_detail = rtas_token("ibm,slot-error-detail");
81 ibm_get_config_addr_info2 = rtas_token("ibm,get-config-addr-info2");
82 ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info");
83 ibm_configure_pe = rtas_token("ibm,configure-pe");
84 ibm_configure_bridge = rtas_token ("ibm,configure-bridge");
85
86 /* necessary sanity check */
87 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) {
88 pr_warning("%s: RTAS service <ibm,set-eeh-option> invalid\n",
89 __func__);
90 return -EINVAL;
91 } else if (ibm_set_slot_reset == RTAS_UNKNOWN_SERVICE) {
92 pr_warning("%s: RTAS service <ibm, set-slot-reset> invalid\n",
93 __func__);
94 return -EINVAL;
95 } else if (ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE &&
96 ibm_read_slot_reset_state == RTAS_UNKNOWN_SERVICE) {
97 pr_warning("%s: RTAS service <ibm,read-slot-reset-state2> and "
98 "<ibm,read-slot-reset-state> invalid\n",
99 __func__);
100 return -EINVAL;
101 } else if (ibm_slot_error_detail == RTAS_UNKNOWN_SERVICE) {
102 pr_warning("%s: RTAS service <ibm,slot-error-detail> invalid\n",
103 __func__);
104 return -EINVAL;
105 } else if (ibm_get_config_addr_info2 == RTAS_UNKNOWN_SERVICE &&
106 ibm_get_config_addr_info == RTAS_UNKNOWN_SERVICE) {
107 pr_warning("%s: RTAS service <ibm,get-config-addr-info2> and "
108 "<ibm,get-config-addr-info> invalid\n",
109 __func__);
110 return -EINVAL;
111 } else if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE &&
112 ibm_configure_bridge == RTAS_UNKNOWN_SERVICE) {
113 pr_warning("%s: RTAS service <ibm,configure-pe> and "
114 "<ibm,configure-bridge> invalid\n",
115 __func__);
116 return -EINVAL;
117 }
118
119 /* Initialize error log lock and size */
120 spin_lock_init(&slot_errbuf_lock);
121 eeh_error_buf_size = rtas_token("rtas-error-log-max");
122 if (eeh_error_buf_size == RTAS_UNKNOWN_SERVICE) {
123 pr_warning("%s: unknown EEH error log size\n",
124 __func__);
125 eeh_error_buf_size = 1024;
126 } else if (eeh_error_buf_size > RTAS_ERROR_LOG_MAX) {
127 pr_warning("%s: EEH error log size %d exceeds the maximal %d\n",
128 __func__, eeh_error_buf_size, RTAS_ERROR_LOG_MAX);
129 eeh_error_buf_size = RTAS_ERROR_LOG_MAX;
130 }
131
132 return 0;
133}
134
135/**
136 * pseries_eeh_set_option - Initialize EEH or MMIO/DMA reenable
137 * @dn: device node
138 * @option: operation to be issued
139 *
140 * The function is used to control the EEH functionality globally.
141 * Currently, following options are support according to PAPR:
142 * Enable EEH, Disable EEH, Enable MMIO and Enable DMA
143 */
144static int pseries_eeh_set_option(struct device_node *dn, int option)
145{
146 int ret = 0;
147 struct eeh_dev *edev;
148 const u32 *reg;
149 int config_addr;
150
151 edev = of_node_to_eeh_dev(dn);
152
153 /*
154 * When we're enabling or disabling EEH functioality on
155 * the particular PE, the PE config address is possibly
156 * unavailable. Therefore, we have to figure it out from
157 * the FDT node.
158 */
159 switch (option) {
160 case EEH_OPT_DISABLE:
161 case EEH_OPT_ENABLE:
162 reg = of_get_property(dn, "reg", NULL);
163 config_addr = reg[0];
164 break;
165
166 case EEH_OPT_THAW_MMIO:
167 case EEH_OPT_THAW_DMA:
168 config_addr = edev->config_addr;
169 if (edev->pe_config_addr)
170 config_addr = edev->pe_config_addr;
171 break;
172
173 default:
174 pr_err("%s: Invalid option %d\n",
175 __func__, option);
176 return -EINVAL;
177 }
178
179 ret = rtas_call(ibm_set_eeh_option, 4, 1, NULL,
180 config_addr, BUID_HI(edev->phb->buid),
181 BUID_LO(edev->phb->buid), option);
182
183 return ret;
184}
185
186/**
187 * pseries_eeh_get_pe_addr - Retrieve PE address
188 * @dn: device node
189 *
190 * Retrieve the assocated PE address. Actually, there're 2 RTAS
191 * function calls dedicated for the purpose. We need implement
192 * it through the new function and then the old one. Besides,
193 * you should make sure the config address is figured out from
194 * FDT node before calling the function.
195 *
196 * It's notable that zero'ed return value means invalid PE config
197 * address.
198 */
199static int pseries_eeh_get_pe_addr(struct device_node *dn)
200{
201 struct eeh_dev *edev;
202 int ret = 0;
203 int rets[3];
204
205 edev = of_node_to_eeh_dev(dn);
206
207 if (ibm_get_config_addr_info2 != RTAS_UNKNOWN_SERVICE) {
208 /*
209 * First of all, we need to make sure there has one PE
210 * associated with the device. Otherwise, PE address is
211 * meaningless.
212 */
213 ret = rtas_call(ibm_get_config_addr_info2, 4, 2, rets,
214 edev->config_addr, BUID_HI(edev->phb->buid),
215 BUID_LO(edev->phb->buid), 1);
216 if (ret || (rets[0] == 0))
217 return 0;
218
219 /* Retrieve the associated PE config address */
220 ret = rtas_call(ibm_get_config_addr_info2, 4, 2, rets,
221 edev->config_addr, BUID_HI(edev->phb->buid),
222 BUID_LO(edev->phb->buid), 0);
223 if (ret) {
224 pr_warning("%s: Failed to get PE address for %s\n",
225 __func__, dn->full_name);
226 return 0;
227 }
228
229 return rets[0];
230 }
231
232 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) {
233 ret = rtas_call(ibm_get_config_addr_info, 4, 2, rets,
234 edev->config_addr, BUID_HI(edev->phb->buid),
235 BUID_LO(edev->phb->buid), 0);
236 if (ret) {
237 pr_warning("%s: Failed to get PE address for %s\n",
238 __func__, dn->full_name);
239 return 0;
240 }
241
242 return rets[0];
243 }
244
245 return ret;
246}
247
248/**
249 * pseries_eeh_get_state - Retrieve PE state
250 * @dn: PE associated device node
251 * @state: return value
252 *
253 * Retrieve the state of the specified PE. On RTAS compliant
254 * pseries platform, there already has one dedicated RTAS function
255 * for the purpose. It's notable that the associated PE config address
256 * might be ready when calling the function. Therefore, endeavour to
257 * use the PE config address if possible. Further more, there're 2
258 * RTAS calls for the purpose, we need to try the new one and back
259 * to the old one if the new one couldn't work properly.
260 */
261static int pseries_eeh_get_state(struct device_node *dn, int *state)
262{
263 struct eeh_dev *edev;
264 int config_addr;
265 int ret;
266 int rets[4];
267 int result;
268
269 /* Figure out PE config address if possible */
270 edev = of_node_to_eeh_dev(dn);
271 config_addr = edev->config_addr;
272 if (edev->pe_config_addr)
273 config_addr = edev->pe_config_addr;
274
275 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) {
276 ret = rtas_call(ibm_read_slot_reset_state2, 3, 4, rets,
277 config_addr, BUID_HI(edev->phb->buid),
278 BUID_LO(edev->phb->buid));
279 } else if (ibm_read_slot_reset_state != RTAS_UNKNOWN_SERVICE) {
280 /* Fake PE unavailable info */
281 rets[2] = 0;
282 ret = rtas_call(ibm_read_slot_reset_state, 3, 3, rets,
283 config_addr, BUID_HI(edev->phb->buid),
284 BUID_LO(edev->phb->buid));
285 } else {
286 return EEH_STATE_NOT_SUPPORT;
287 }
288
289 if (ret)
290 return ret;
291
292 /* Parse the result out */
293 result = 0;
294 if (rets[1]) {
295 switch(rets[0]) {
296 case 0:
297 result &= ~EEH_STATE_RESET_ACTIVE;
298 result |= EEH_STATE_MMIO_ACTIVE;
299 result |= EEH_STATE_DMA_ACTIVE;
300 break;
301 case 1:
302 result |= EEH_STATE_RESET_ACTIVE;
303 result |= EEH_STATE_MMIO_ACTIVE;
304 result |= EEH_STATE_DMA_ACTIVE;
305 break;
306 case 2:
307 result &= ~EEH_STATE_RESET_ACTIVE;
308 result &= ~EEH_STATE_MMIO_ACTIVE;
309 result &= ~EEH_STATE_DMA_ACTIVE;
310 break;
311 case 4:
312 result &= ~EEH_STATE_RESET_ACTIVE;
313 result &= ~EEH_STATE_MMIO_ACTIVE;
314 result &= ~EEH_STATE_DMA_ACTIVE;
315 result |= EEH_STATE_MMIO_ENABLED;
316 break;
317 case 5:
318 if (rets[2]) {
319 if (state) *state = rets[2];
320 result = EEH_STATE_UNAVAILABLE;
321 } else {
322 result = EEH_STATE_NOT_SUPPORT;
323 }
324 default:
325 result = EEH_STATE_NOT_SUPPORT;
326 }
327 } else {
328 result = EEH_STATE_NOT_SUPPORT;
329 }
330
331 return result;
332}
333
334/**
335 * pseries_eeh_reset - Reset the specified PE
336 * @dn: PE associated device node
337 * @option: reset option
338 *
339 * Reset the specified PE
340 */
341static int pseries_eeh_reset(struct device_node *dn, int option)
342{
343 struct eeh_dev *edev;
344 int config_addr;
345 int ret;
346
347 /* Figure out PE address */
348 edev = of_node_to_eeh_dev(dn);
349 config_addr = edev->config_addr;
350 if (edev->pe_config_addr)
351 config_addr = edev->pe_config_addr;
352
353 /* Reset PE through RTAS call */
354 ret = rtas_call(ibm_set_slot_reset, 4, 1, NULL,
355 config_addr, BUID_HI(edev->phb->buid),
356 BUID_LO(edev->phb->buid), option);
357
358 /* If fundamental-reset not supported, try hot-reset */
359 if (option == EEH_RESET_FUNDAMENTAL &&
360 ret == -8) {
361 ret = rtas_call(ibm_set_slot_reset, 4, 1, NULL,
362 config_addr, BUID_HI(edev->phb->buid),
363 BUID_LO(edev->phb->buid), EEH_RESET_HOT);
364 }
365
366 return ret;
367}
368
369/**
370 * pseries_eeh_wait_state - Wait for PE state
371 * @dn: PE associated device node
372 * @max_wait: maximal period in microsecond
373 *
374 * Wait for the state of associated PE. It might take some time
375 * to retrieve the PE's state.
376 */
377static int pseries_eeh_wait_state(struct device_node *dn, int max_wait)
378{
379 int ret;
380 int mwait;
381
382 /*
383 * According to PAPR, the state of PE might be temporarily
384 * unavailable. Under the circumstance, we have to wait
385 * for indicated time determined by firmware. The maximal
386 * wait time is 5 minutes, which is acquired from the original
387 * EEH implementation. Also, the original implementation
388 * also defined the minimal wait time as 1 second.
389 */
390#define EEH_STATE_MIN_WAIT_TIME (1000)
391#define EEH_STATE_MAX_WAIT_TIME (300 * 1000)
392
393 while (1) {
394 ret = pseries_eeh_get_state(dn, &mwait);
395
396 /*
397 * If the PE's state is temporarily unavailable,
398 * we have to wait for the specified time. Otherwise,
399 * the PE's state will be returned immediately.
400 */
401 if (ret != EEH_STATE_UNAVAILABLE)
402 return ret;
403
404 if (max_wait <= 0) {
405 pr_warning("%s: Timeout when getting PE's state (%d)\n",
406 __func__, max_wait);
407 return EEH_STATE_NOT_SUPPORT;
408 }
409
410 if (mwait <= 0) {
411 pr_warning("%s: Firmware returned bad wait value %d\n",
412 __func__, mwait);
413 mwait = EEH_STATE_MIN_WAIT_TIME;
414 } else if (mwait > EEH_STATE_MAX_WAIT_TIME) {
415 pr_warning("%s: Firmware returned too long wait value %d\n",
416 __func__, mwait);
417 mwait = EEH_STATE_MAX_WAIT_TIME;
418 }
419
420 max_wait -= mwait;
421 msleep(mwait);
422 }
423
424 return EEH_STATE_NOT_SUPPORT;
425}
426
427/**
428 * pseries_eeh_get_log - Retrieve error log
429 * @dn: device node
430 * @severity: temporary or permanent error log
431 * @drv_log: driver log to be combined with retrieved error log
432 * @len: length of driver log
433 *
434 * Retrieve the temporary or permanent error from the PE.
435 * Actually, the error will be retrieved through the dedicated
436 * RTAS call.
437 */
438static int pseries_eeh_get_log(struct device_node *dn, int severity, char *drv_log, unsigned long len)
439{
440 struct eeh_dev *edev;
441 int config_addr;
442 unsigned long flags;
443 int ret;
444
445 edev = of_node_to_eeh_dev(dn);
446 spin_lock_irqsave(&slot_errbuf_lock, flags);
447 memset(slot_errbuf, 0, eeh_error_buf_size);
448
449 /* Figure out the PE address */
450 config_addr = edev->config_addr;
451 if (edev->pe_config_addr)
452 config_addr = edev->pe_config_addr;
453
454 ret = rtas_call(ibm_slot_error_detail, 8, 1, NULL, config_addr,
455 BUID_HI(edev->phb->buid), BUID_LO(edev->phb->buid),
456 virt_to_phys(drv_log), len,
457 virt_to_phys(slot_errbuf), eeh_error_buf_size,
458 severity);
459 if (!ret)
460 log_error(slot_errbuf, ERR_TYPE_RTAS_LOG, 0);
461 spin_unlock_irqrestore(&slot_errbuf_lock, flags);
462
463 return ret;
464}
465
466/**
467 * pseries_eeh_configure_bridge - Configure PCI bridges in the indicated PE
468 * @dn: PE associated device node
469 *
470 * The function will be called to reconfigure the bridges included
471 * in the specified PE so that the mulfunctional PE would be recovered
472 * again.
473 */
474static int pseries_eeh_configure_bridge(struct device_node *dn)
475{
476 struct eeh_dev *edev;
477 int config_addr;
478 int ret;
479
480 /* Figure out the PE address */
481 edev = of_node_to_eeh_dev(dn);
482 config_addr = edev->config_addr;
483 if (edev->pe_config_addr)
484 config_addr = edev->pe_config_addr;
485
486 /* Use new configure-pe function, if supported */
487 if (ibm_configure_pe != RTAS_UNKNOWN_SERVICE) {
488 ret = rtas_call(ibm_configure_pe, 3, 1, NULL,
489 config_addr, BUID_HI(edev->phb->buid),
490 BUID_LO(edev->phb->buid));
491 } else if (ibm_configure_bridge != RTAS_UNKNOWN_SERVICE) {
492 ret = rtas_call(ibm_configure_bridge, 3, 1, NULL,
493 config_addr, BUID_HI(edev->phb->buid),
494 BUID_LO(edev->phb->buid));
495 } else {
496 return -EFAULT;
497 }
498
499 if (ret)
500 pr_warning("%s: Unable to configure bridge %d for %s\n",
501 __func__, ret, dn->full_name);
502
503 return ret;
504}
505
506/**
507 * pseries_eeh_read_config - Read PCI config space
508 * @dn: device node
509 * @where: PCI address
510 * @size: size to read
511 * @val: return value
512 *
513 * Read config space from the speicifed device
514 */
515static int pseries_eeh_read_config(struct device_node *dn, int where, int size, u32 *val)
516{
517 struct pci_dn *pdn;
518
519 pdn = PCI_DN(dn);
520
521 return rtas_read_config(pdn, where, size, val);
522}
523
524/**
525 * pseries_eeh_write_config - Write PCI config space
526 * @dn: device node
527 * @where: PCI address
528 * @size: size to write
529 * @val: value to be written
530 *
531 * Write config space to the specified device
532 */
533static int pseries_eeh_write_config(struct device_node *dn, int where, int size, u32 val)
534{
535 struct pci_dn *pdn;
536
537 pdn = PCI_DN(dn);
538
539 return rtas_write_config(pdn, where, size, val);
540}
541
542static struct eeh_ops pseries_eeh_ops = {
543 .name = "pseries",
544 .init = pseries_eeh_init,
545 .set_option = pseries_eeh_set_option,
546 .get_pe_addr = pseries_eeh_get_pe_addr,
547 .get_state = pseries_eeh_get_state,
548 .reset = pseries_eeh_reset,
549 .wait_state = pseries_eeh_wait_state,
550 .get_log = pseries_eeh_get_log,
551 .configure_bridge = pseries_eeh_configure_bridge,
552 .read_config = pseries_eeh_read_config,
553 .write_config = pseries_eeh_write_config
554};
555
556/**
557 * eeh_pseries_init - Register platform dependent EEH operations
558 *
559 * EEH initialization on pseries platform. This function should be
560 * called before any EEH related functions.
561 */
562int __init eeh_pseries_init(void)
563{
564 return eeh_ops_register(&pseries_eeh_ops);
565}
diff --git a/arch/powerpc/platforms/pseries/eeh_sysfs.c b/arch/powerpc/platforms/pseries/eeh_sysfs.c
index eb744ee234d..243b3510d70 100644
--- a/arch/powerpc/platforms/pseries/eeh_sysfs.c
+++ b/arch/powerpc/platforms/pseries/eeh_sysfs.c
@@ -28,7 +28,7 @@
28#include <asm/pci-bridge.h> 28#include <asm/pci-bridge.h>
29 29
30/** 30/**
31 * EEH_SHOW_ATTR -- create sysfs entry for eeh statistic 31 * EEH_SHOW_ATTR -- Create sysfs entry for eeh statistic
32 * @_name: name of file in sysfs directory 32 * @_name: name of file in sysfs directory
33 * @_memb: name of member in struct pci_dn to access 33 * @_memb: name of member in struct pci_dn to access
34 * @_format: printf format for display 34 * @_format: printf format for display
@@ -41,24 +41,21 @@ static ssize_t eeh_show_##_name(struct device *dev, \
41 struct device_attribute *attr, char *buf) \ 41 struct device_attribute *attr, char *buf) \
42{ \ 42{ \
43 struct pci_dev *pdev = to_pci_dev(dev); \ 43 struct pci_dev *pdev = to_pci_dev(dev); \
44 struct device_node *dn = pci_device_to_OF_node(pdev); \ 44 struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev); \
45 struct pci_dn *pdn; \
46 \ 45 \
47 if (!dn || PCI_DN(dn) == NULL) \ 46 if (!edev) \
48 return 0; \ 47 return 0; \
49 \ 48 \
50 pdn = PCI_DN(dn); \ 49 return sprintf(buf, _format "\n", edev->_memb); \
51 return sprintf(buf, _format "\n", pdn->_memb); \
52} \ 50} \
53static DEVICE_ATTR(_name, S_IRUGO, eeh_show_##_name, NULL); 51static DEVICE_ATTR(_name, S_IRUGO, eeh_show_##_name, NULL);
54 52
55 53EEH_SHOW_ATTR(eeh_mode, mode, "0x%x");
56EEH_SHOW_ATTR(eeh_mode, eeh_mode, "0x%x"); 54EEH_SHOW_ATTR(eeh_config_addr, config_addr, "0x%x");
57EEH_SHOW_ATTR(eeh_config_addr, eeh_config_addr, "0x%x"); 55EEH_SHOW_ATTR(eeh_pe_config_addr, pe_config_addr, "0x%x");
58EEH_SHOW_ATTR(eeh_pe_config_addr, eeh_pe_config_addr, "0x%x"); 56EEH_SHOW_ATTR(eeh_check_count, check_count, "%d" );
59EEH_SHOW_ATTR(eeh_check_count, eeh_check_count, "%d"); 57EEH_SHOW_ATTR(eeh_freeze_count, freeze_count, "%d" );
60EEH_SHOW_ATTR(eeh_freeze_count, eeh_freeze_count, "%d"); 58EEH_SHOW_ATTR(eeh_false_positives, false_positives, "%d" );
61EEH_SHOW_ATTR(eeh_false_positives, eeh_false_positives, "%d");
62 59
63void eeh_sysfs_add_device(struct pci_dev *pdev) 60void eeh_sysfs_add_device(struct pci_dev *pdev)
64{ 61{
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 7bc73af6c7b..5f3ef876ded 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -41,6 +41,7 @@
41#include <asm/udbg.h> 41#include <asm/udbg.h>
42#include <asm/smp.h> 42#include <asm/smp.h>
43#include <asm/trace.h> 43#include <asm/trace.h>
44#include <asm/firmware.h>
44 45
45#include "plpar_wrappers.h" 46#include "plpar_wrappers.h"
46#include "pseries.h" 47#include "pseries.h"
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 38d24e7e7bb..109fdb75578 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -217,7 +217,7 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total)
217 if (!dn) 217 if (!dn)
218 return NULL; 218 return NULL;
219 219
220 dn = find_device_pe(dn); 220 dn = eeh_find_device_pe(dn);
221 if (!dn) 221 if (!dn)
222 return NULL; 222 return NULL;
223 223
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 55d4ec1bd1a..8b7bafa489c 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -84,7 +84,7 @@ void pcibios_remove_pci_devices(struct pci_bus *bus)
84 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { 84 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
85 pr_debug(" * Removing %s...\n", pci_name(dev)); 85 pr_debug(" * Removing %s...\n", pci_name(dev));
86 eeh_remove_bus_device(dev); 86 eeh_remove_bus_device(dev);
87 pci_remove_bus_device(dev); 87 pci_stop_and_remove_bus_device(dev);
88 } 88 }
89} 89}
90EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices); 90EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices);
@@ -147,6 +147,9 @@ struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn)
147 147
148 pci_devs_phb_init_dynamic(phb); 148 pci_devs_phb_init_dynamic(phb);
149 149
150 /* Create EEH devices for the PHB */
151 eeh_dev_phb_init_dynamic(phb);
152
150 if (dn->child) 153 if (dn->child)
151 eeh_add_device_tree_early(dn); 154 eeh_add_device_tree_early(dn);
152 155
diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c
deleted file mode 100644
index 6e7742da007..00000000000
--- a/arch/powerpc/platforms/pseries/phyp_dump.c
+++ /dev/null
@@ -1,513 +0,0 @@
1/*
2 * Hypervisor-assisted dump
3 *
4 * Linas Vepstas, Manish Ahuja 2008
5 * Copyright 2008 IBM Corp.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 */
13
14#include <linux/gfp.h>
15#include <linux/init.h>
16#include <linux/kobject.h>
17#include <linux/mm.h>
18#include <linux/of.h>
19#include <linux/pfn.h>
20#include <linux/swap.h>
21#include <linux/sysfs.h>
22
23#include <asm/page.h>
24#include <asm/phyp_dump.h>
25#include <asm/machdep.h>
26#include <asm/prom.h>
27#include <asm/rtas.h>
28
29/* Variables, used to communicate data between early boot and late boot */
30static struct phyp_dump phyp_dump_vars;
31struct phyp_dump *phyp_dump_info = &phyp_dump_vars;
32
33static int ibm_configure_kernel_dump;
34/* ------------------------------------------------- */
35/* RTAS interfaces to declare the dump regions */
36
37struct dump_section {
38 u32 dump_flags;
39 u16 source_type;
40 u16 error_flags;
41 u64 source_address;
42 u64 source_length;
43 u64 length_copied;
44 u64 destination_address;
45};
46
47struct phyp_dump_header {
48 u32 version;
49 u16 num_of_sections;
50 u16 status;
51
52 u32 first_offset_section;
53 u32 dump_disk_section;
54 u64 block_num_dd;
55 u64 num_of_blocks_dd;
56 u32 offset_dd;
57 u32 maxtime_to_auto;
58 /* No dump disk path string used */
59
60 struct dump_section cpu_data;
61 struct dump_section hpte_data;
62 struct dump_section kernel_data;
63};
64
65/* The dump header *must be* in low memory, so .bss it */
66static struct phyp_dump_header phdr;
67
68#define NUM_DUMP_SECTIONS 3
69#define DUMP_HEADER_VERSION 0x1
70#define DUMP_REQUEST_FLAG 0x1
71#define DUMP_SOURCE_CPU 0x0001
72#define DUMP_SOURCE_HPTE 0x0002
73#define DUMP_SOURCE_RMO 0x0011
74#define DUMP_ERROR_FLAG 0x2000
75#define DUMP_TRIGGERED 0x4000
76#define DUMP_PERFORMED 0x8000
77
78
79/**
80 * init_dump_header() - initialize the header declaring a dump
81 * Returns: length of dump save area.
82 *
83 * When the hypervisor saves crashed state, it needs to put
84 * it somewhere. The dump header tells the hypervisor where
85 * the data can be saved.
86 */
87static unsigned long init_dump_header(struct phyp_dump_header *ph)
88{
89 unsigned long addr_offset = 0;
90
91 /* Set up the dump header */
92 ph->version = DUMP_HEADER_VERSION;
93 ph->num_of_sections = NUM_DUMP_SECTIONS;
94 ph->status = 0;
95
96 ph->first_offset_section =
97 (u32)offsetof(struct phyp_dump_header, cpu_data);
98 ph->dump_disk_section = 0;
99 ph->block_num_dd = 0;
100 ph->num_of_blocks_dd = 0;
101 ph->offset_dd = 0;
102
103 ph->maxtime_to_auto = 0; /* disabled */
104
105 /* The first two sections are mandatory */
106 ph->cpu_data.dump_flags = DUMP_REQUEST_FLAG;
107 ph->cpu_data.source_type = DUMP_SOURCE_CPU;
108 ph->cpu_data.source_address = 0;
109 ph->cpu_data.source_length = phyp_dump_info->cpu_state_size;
110 ph->cpu_data.destination_address = addr_offset;
111 addr_offset += phyp_dump_info->cpu_state_size;
112
113 ph->hpte_data.dump_flags = DUMP_REQUEST_FLAG;
114 ph->hpte_data.source_type = DUMP_SOURCE_HPTE;
115 ph->hpte_data.source_address = 0;
116 ph->hpte_data.source_length = phyp_dump_info->hpte_region_size;
117 ph->hpte_data.destination_address = addr_offset;
118 addr_offset += phyp_dump_info->hpte_region_size;
119
120 /* This section describes the low kernel region */
121 ph->kernel_data.dump_flags = DUMP_REQUEST_FLAG;
122 ph->kernel_data.source_type = DUMP_SOURCE_RMO;
123 ph->kernel_data.source_address = PHYP_DUMP_RMR_START;
124 ph->kernel_data.source_length = PHYP_DUMP_RMR_END;
125 ph->kernel_data.destination_address = addr_offset;
126 addr_offset += ph->kernel_data.source_length;
127
128 return addr_offset;
129}
130
131static void print_dump_header(const struct phyp_dump_header *ph)
132{
133#ifdef DEBUG
134 if (ph == NULL)
135 return;
136
137 printk(KERN_INFO "dump header:\n");
138 /* setup some ph->sections required */
139 printk(KERN_INFO "version = %d\n", ph->version);
140 printk(KERN_INFO "Sections = %d\n", ph->num_of_sections);
141 printk(KERN_INFO "Status = 0x%x\n", ph->status);
142
143 /* No ph->disk, so all should be set to 0 */
144 printk(KERN_INFO "Offset to first section 0x%x\n",
145 ph->first_offset_section);
146 printk(KERN_INFO "dump disk sections should be zero\n");
147 printk(KERN_INFO "dump disk section = %d\n", ph->dump_disk_section);
148 printk(KERN_INFO "block num = %lld\n", ph->block_num_dd);
149 printk(KERN_INFO "number of blocks = %lld\n", ph->num_of_blocks_dd);
150 printk(KERN_INFO "dump disk offset = %d\n", ph->offset_dd);
151 printk(KERN_INFO "Max auto time= %d\n", ph->maxtime_to_auto);
152
153 /*set cpu state and hpte states as well scratch pad area */
154 printk(KERN_INFO " CPU AREA\n");
155 printk(KERN_INFO "cpu dump_flags =%d\n", ph->cpu_data.dump_flags);
156 printk(KERN_INFO "cpu source_type =%d\n", ph->cpu_data.source_type);
157 printk(KERN_INFO "cpu error_flags =%d\n", ph->cpu_data.error_flags);
158 printk(KERN_INFO "cpu source_address =%llx\n",
159 ph->cpu_data.source_address);
160 printk(KERN_INFO "cpu source_length =%llx\n",
161 ph->cpu_data.source_length);
162 printk(KERN_INFO "cpu length_copied =%llx\n",
163 ph->cpu_data.length_copied);
164
165 printk(KERN_INFO " HPTE AREA\n");
166 printk(KERN_INFO "HPTE dump_flags =%d\n", ph->hpte_data.dump_flags);
167 printk(KERN_INFO "HPTE source_type =%d\n", ph->hpte_data.source_type);
168 printk(KERN_INFO "HPTE error_flags =%d\n", ph->hpte_data.error_flags);
169 printk(KERN_INFO "HPTE source_address =%llx\n",
170 ph->hpte_data.source_address);
171 printk(KERN_INFO "HPTE source_length =%llx\n",
172 ph->hpte_data.source_length);
173 printk(KERN_INFO "HPTE length_copied =%llx\n",
174 ph->hpte_data.length_copied);
175
176 printk(KERN_INFO " SRSD AREA\n");
177 printk(KERN_INFO "SRSD dump_flags =%d\n", ph->kernel_data.dump_flags);
178 printk(KERN_INFO "SRSD source_type =%d\n", ph->kernel_data.source_type);
179 printk(KERN_INFO "SRSD error_flags =%d\n", ph->kernel_data.error_flags);
180 printk(KERN_INFO "SRSD source_address =%llx\n",
181 ph->kernel_data.source_address);
182 printk(KERN_INFO "SRSD source_length =%llx\n",
183 ph->kernel_data.source_length);
184 printk(KERN_INFO "SRSD length_copied =%llx\n",
185 ph->kernel_data.length_copied);
186#endif
187}
188
189static ssize_t show_phyp_dump_active(struct kobject *kobj,
190 struct kobj_attribute *attr, char *buf)
191{
192
193 /* create filesystem entry so kdump is phyp-dump aware */
194 return sprintf(buf, "%lx\n", phyp_dump_info->phyp_dump_at_boot);
195}
196
197static struct kobj_attribute pdl = __ATTR(phyp_dump_active, 0600,
198 show_phyp_dump_active,
199 NULL);
200
201static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr)
202{
203 int rc;
204
205 /* Add addr value if not initialized before */
206 if (ph->cpu_data.destination_address == 0) {
207 ph->cpu_data.destination_address += addr;
208 ph->hpte_data.destination_address += addr;
209 ph->kernel_data.destination_address += addr;
210 }
211
212 /* ToDo Invalidate kdump and free memory range. */
213
214 do {
215 rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL,
216 1, ph, sizeof(struct phyp_dump_header));
217 } while (rtas_busy_delay(rc));
218
219 if (rc) {
220 printk(KERN_ERR "phyp-dump: unexpected error (%d) on "
221 "register\n", rc);
222 print_dump_header(ph);
223 return;
224 }
225
226 rc = sysfs_create_file(kernel_kobj, &pdl.attr);
227 if (rc)
228 printk(KERN_ERR "phyp-dump: unable to create sysfs"
229 " file (%d)\n", rc);
230}
231
232static
233void invalidate_last_dump(struct phyp_dump_header *ph, unsigned long addr)
234{
235 int rc;
236
237 /* Add addr value if not initialized before */
238 if (ph->cpu_data.destination_address == 0) {
239 ph->cpu_data.destination_address += addr;
240 ph->hpte_data.destination_address += addr;
241 ph->kernel_data.destination_address += addr;
242 }
243
244 do {
245 rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL,
246 2, ph, sizeof(struct phyp_dump_header));
247 } while (rtas_busy_delay(rc));
248
249 if (rc) {
250 printk(KERN_ERR "phyp-dump: unexpected error (%d) "
251 "on invalidate\n", rc);
252 print_dump_header(ph);
253 }
254}
255
256/* ------------------------------------------------- */
257/**
258 * release_memory_range -- release memory previously memblock_reserved
259 * @start_pfn: starting physical frame number
260 * @nr_pages: number of pages to free.
261 *
262 * This routine will release memory that had been previously
263 * memblock_reserved in early boot. The released memory becomes
264 * available for genreal use.
265 */
266static void release_memory_range(unsigned long start_pfn,
267 unsigned long nr_pages)
268{
269 struct page *rpage;
270 unsigned long end_pfn;
271 long i;
272
273 end_pfn = start_pfn + nr_pages;
274
275 for (i = start_pfn; i <= end_pfn; i++) {
276 rpage = pfn_to_page(i);
277 if (PageReserved(rpage)) {
278 ClearPageReserved(rpage);
279 init_page_count(rpage);
280 __free_page(rpage);
281 totalram_pages++;
282 }
283 }
284}
285
286/**
287 * track_freed_range -- Counts the range being freed.
288 * Once the counter goes to zero, it re-registers dump for
289 * future use.
290 */
291static void
292track_freed_range(unsigned long addr, unsigned long length)
293{
294 static unsigned long scratch_area_size, reserved_area_size;
295
296 if (addr < phyp_dump_info->init_reserve_start)
297 return;
298
299 if ((addr >= phyp_dump_info->init_reserve_start) &&
300 (addr <= phyp_dump_info->init_reserve_start +
301 phyp_dump_info->init_reserve_size))
302 reserved_area_size += length;
303
304 if ((addr >= phyp_dump_info->reserved_scratch_addr) &&
305 (addr <= phyp_dump_info->reserved_scratch_addr +
306 phyp_dump_info->reserved_scratch_size))
307 scratch_area_size += length;
308
309 if ((reserved_area_size == phyp_dump_info->init_reserve_size) &&
310 (scratch_area_size == phyp_dump_info->reserved_scratch_size)) {
311
312 invalidate_last_dump(&phdr,
313 phyp_dump_info->reserved_scratch_addr);
314 register_dump_area(&phdr,
315 phyp_dump_info->reserved_scratch_addr);
316 }
317}
318
319/* ------------------------------------------------- */
320/**
321 * sysfs_release_region -- sysfs interface to release memory range.
322 *
323 * Usage:
324 * "echo <start addr> <length> > /sys/kernel/release_region"
325 *
326 * Example:
327 * "echo 0x40000000 0x10000000 > /sys/kernel/release_region"
328 *
329 * will release 256MB starting at 1GB.
330 */
331static ssize_t store_release_region(struct kobject *kobj,
332 struct kobj_attribute *attr,
333 const char *buf, size_t count)
334{
335 unsigned long start_addr, length, end_addr;
336 unsigned long start_pfn, nr_pages;
337 ssize_t ret;
338
339 ret = sscanf(buf, "%lx %lx", &start_addr, &length);
340 if (ret != 2)
341 return -EINVAL;
342
343 track_freed_range(start_addr, length);
344
345 /* Range-check - don't free any reserved memory that
346 * wasn't reserved for phyp-dump */
347 if (start_addr < phyp_dump_info->init_reserve_start)
348 start_addr = phyp_dump_info->init_reserve_start;
349
350 end_addr = phyp_dump_info->init_reserve_start +
351 phyp_dump_info->init_reserve_size;
352 if (start_addr+length > end_addr)
353 length = end_addr - start_addr;
354
355 /* Release the region of memory assed in by user */
356 start_pfn = PFN_DOWN(start_addr);
357 nr_pages = PFN_DOWN(length);
358 release_memory_range(start_pfn, nr_pages);
359
360 return count;
361}
362
363static ssize_t show_release_region(struct kobject *kobj,
364 struct kobj_attribute *attr, char *buf)
365{
366 u64 second_addr_range;
367
368 /* total reserved size - start of scratch area */
369 second_addr_range = phyp_dump_info->init_reserve_size -
370 phyp_dump_info->reserved_scratch_size;
371 return sprintf(buf, "CPU:0x%llx-0x%llx: HPTE:0x%llx-0x%llx:"
372 " DUMP:0x%llx-0x%llx, 0x%lx-0x%llx:\n",
373 phdr.cpu_data.destination_address,
374 phdr.cpu_data.length_copied,
375 phdr.hpte_data.destination_address,
376 phdr.hpte_data.length_copied,
377 phdr.kernel_data.destination_address,
378 phdr.kernel_data.length_copied,
379 phyp_dump_info->init_reserve_start,
380 second_addr_range);
381}
382
383static struct kobj_attribute rr = __ATTR(release_region, 0600,
384 show_release_region,
385 store_release_region);
386
387static int __init phyp_dump_setup(void)
388{
389 struct device_node *rtas;
390 const struct phyp_dump_header *dump_header = NULL;
391 unsigned long dump_area_start;
392 unsigned long dump_area_length;
393 int header_len = 0;
394 int rc;
395
396 /* If no memory was reserved in early boot, there is nothing to do */
397 if (phyp_dump_info->init_reserve_size == 0)
398 return 0;
399
400 /* Return if phyp dump not supported */
401 if (!phyp_dump_info->phyp_dump_configured)
402 return -ENOSYS;
403
404 /* Is there dump data waiting for us? If there isn't,
405 * then register a new dump area, and release all of
406 * the rest of the reserved ram.
407 *
408 * The /rtas/ibm,kernel-dump rtas node is present only
409 * if there is dump data waiting for us.
410 */
411 rtas = of_find_node_by_path("/rtas");
412 if (rtas) {
413 dump_header = of_get_property(rtas, "ibm,kernel-dump",
414 &header_len);
415 of_node_put(rtas);
416 }
417
418 ibm_configure_kernel_dump = rtas_token("ibm,configure-kernel-dump");
419
420 print_dump_header(dump_header);
421 dump_area_length = init_dump_header(&phdr);
422 /* align down */
423 dump_area_start = phyp_dump_info->init_reserve_start & PAGE_MASK;
424
425 if (dump_header == NULL) {
426 register_dump_area(&phdr, dump_area_start);
427 return 0;
428 }
429
430 /* re-register the dump area, if old dump was invalid */
431 if ((dump_header) && (dump_header->status & DUMP_ERROR_FLAG)) {
432 invalidate_last_dump(&phdr, dump_area_start);
433 register_dump_area(&phdr, dump_area_start);
434 return 0;
435 }
436
437 if (dump_header) {
438 phyp_dump_info->reserved_scratch_addr =
439 dump_header->cpu_data.destination_address;
440 phyp_dump_info->reserved_scratch_size =
441 dump_header->cpu_data.source_length +
442 dump_header->hpte_data.source_length +
443 dump_header->kernel_data.source_length;
444 }
445
446 /* Should we create a dump_subsys, analogous to s390/ipl.c ? */
447 rc = sysfs_create_file(kernel_kobj, &rr.attr);
448 if (rc)
449 printk(KERN_ERR "phyp-dump: unable to create sysfs file (%d)\n",
450 rc);
451
452 /* ToDo: re-register the dump area, for next time. */
453 return 0;
454}
455machine_subsys_initcall(pseries, phyp_dump_setup);
456
457int __init early_init_dt_scan_phyp_dump(unsigned long node,
458 const char *uname, int depth, void *data)
459{
460 const unsigned int *sizes;
461
462 phyp_dump_info->phyp_dump_configured = 0;
463 phyp_dump_info->phyp_dump_is_active = 0;
464
465 if (depth != 1 || strcmp(uname, "rtas") != 0)
466 return 0;
467
468 if (of_get_flat_dt_prop(node, "ibm,configure-kernel-dump", NULL))
469 phyp_dump_info->phyp_dump_configured++;
470
471 if (of_get_flat_dt_prop(node, "ibm,dump-kernel", NULL))
472 phyp_dump_info->phyp_dump_is_active++;
473
474 sizes = of_get_flat_dt_prop(node, "ibm,configure-kernel-dump-sizes",
475 NULL);
476 if (!sizes)
477 return 0;
478
479 if (sizes[0] == 1)
480 phyp_dump_info->cpu_state_size = *((unsigned long *)&sizes[1]);
481
482 if (sizes[3] == 2)
483 phyp_dump_info->hpte_region_size =
484 *((unsigned long *)&sizes[4]);
485 return 1;
486}
487
488/* Look for phyp_dump= cmdline option */
489static int __init early_phyp_dump_enabled(char *p)
490{
491 phyp_dump_info->phyp_dump_at_boot = 1;
492
493 if (!p)
494 return 0;
495
496 if (strncmp(p, "1", 1) == 0)
497 phyp_dump_info->phyp_dump_at_boot = 1;
498 else if (strncmp(p, "0", 1) == 0)
499 phyp_dump_info->phyp_dump_at_boot = 0;
500
501 return 0;
502}
503early_param("phyp_dump", early_phyp_dump_enabled);
504
505/* Look for phyp_dump_reserve_size= cmdline option */
506static int __init early_phyp_dump_reserve_size(char *p)
507{
508 if (p)
509 phyp_dump_info->reserve_bootvar = memparse(p, &p);
510
511 return 0;
512}
513early_param("phyp_dump_reserve_size", early_phyp_dump_reserve_size);
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
index 085fd3f45ad..a12e95af693 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/arch/powerpc/platforms/pseries/processor_idle.c
@@ -96,6 +96,20 @@ out:
96 return index; 96 return index;
97} 97}
98 98
99static void check_and_cede_processor(void)
100{
101 /*
102 * Interrupts are soft-disabled at this point,
103 * but not hard disabled. So an interrupt might have
104 * occurred before entering NAP, and would be potentially
105 * lost (edge events, decrementer events, etc...) unless
106 * we first hard disable then check.
107 */
108 hard_irq_disable();
109 if (get_paca()->irq_happened == 0)
110 cede_processor();
111}
112
99static int dedicated_cede_loop(struct cpuidle_device *dev, 113static int dedicated_cede_loop(struct cpuidle_device *dev,
100 struct cpuidle_driver *drv, 114 struct cpuidle_driver *drv,
101 int index) 115 int index)
@@ -108,7 +122,7 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
108 122
109 ppc64_runlatch_off(); 123 ppc64_runlatch_off();
110 HMT_medium(); 124 HMT_medium();
111 cede_processor(); 125 check_and_cede_processor();
112 126
113 get_lppaca()->donate_dedicated_cpu = 0; 127 get_lppaca()->donate_dedicated_cpu = 0;
114 dev->last_residency = 128 dev->last_residency =
@@ -132,7 +146,7 @@ static int shared_cede_loop(struct cpuidle_device *dev,
132 * processor. When returning here, external interrupts 146 * processor. When returning here, external interrupts
133 * are enabled. 147 * are enabled.
134 */ 148 */
135 cede_processor(); 149 check_and_cede_processor();
136 150
137 dev->last_residency = 151 dev->last_residency =
138 (int)idle_loop_epilog(in_purr, kt_before); 152 (int)idle_loop_epilog(in_purr, kt_before);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index f79f1278dfc..51ecac920dd 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -190,9 +190,8 @@ static void __init pseries_mpic_init_IRQ(void)
190 BUG_ON(openpic_addr == 0); 190 BUG_ON(openpic_addr == 0);
191 191
192 /* Setup the openpic driver */ 192 /* Setup the openpic driver */
193 mpic = mpic_alloc(pSeries_mpic_node, openpic_addr, 0, 193 mpic = mpic_alloc(pSeries_mpic_node, openpic_addr,
194 16, 250, /* isu size, irq count */ 194 MPIC_NO_RESET, 16, 0, " MPIC ");
195 " MPIC ");
196 BUG_ON(mpic == NULL); 195 BUG_ON(mpic == NULL);
197 196
198 /* Add ISUs */ 197 /* Add ISUs */
@@ -261,8 +260,12 @@ static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long act
261 switch (action) { 260 switch (action) {
262 case PSERIES_RECONFIG_ADD: 261 case PSERIES_RECONFIG_ADD:
263 pci = np->parent->data; 262 pci = np->parent->data;
264 if (pci) 263 if (pci) {
265 update_dn_pci_info(np, pci->phb); 264 update_dn_pci_info(np, pci->phb);
265
266 /* Create EEH device for the OF node */
267 eeh_dev_init(np, pci->phb);
268 }
266 break; 269 break;
267 default: 270 default:
268 err = NOTIFY_DONE; 271 err = NOTIFY_DONE;
@@ -380,8 +383,12 @@ static void __init pSeries_setup_arch(void)
380 383
381 fwnmi_init(); 384 fwnmi_init();
382 385
386 /* By default, only probe PCI (can be overriden by rtas_pci) */
387 pci_add_flags(PCI_PROBE_ONLY);
388
383 /* Find and initialize PCI host bridges */ 389 /* Find and initialize PCI host bridges */
384 init_pci_config_tokens(); 390 init_pci_config_tokens();
391 eeh_pseries_init();
385 find_and_init_phbs(); 392 find_and_init_phbs();
386 pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb); 393 pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
387 eeh_init(); 394 eeh_init();
diff --git a/arch/powerpc/platforms/wsp/wsp_pci.c b/arch/powerpc/platforms/wsp/wsp_pci.c
index d24b3acf858..763014cd1e6 100644
--- a/arch/powerpc/platforms/wsp/wsp_pci.c
+++ b/arch/powerpc/platforms/wsp/wsp_pci.c
@@ -682,7 +682,6 @@ static int __init wsp_setup_one_phb(struct device_node *np)
682 /* XXX Force re-assigning of everything for now */ 682 /* XXX Force re-assigning of everything for now */
683 pci_add_flags(PCI_REASSIGN_ALL_BUS | PCI_REASSIGN_ALL_RSRC | 683 pci_add_flags(PCI_REASSIGN_ALL_BUS | PCI_REASSIGN_ALL_RSRC |
684 PCI_ENABLE_PROC_DOMAINS); 684 PCI_ENABLE_PROC_DOMAINS);
685 pci_probe_only = 0;
686 685
687 /* Calculate how the TCE space is divided */ 686 /* Calculate how the TCE space is divided */
688 phb->dma32_base = 0; 687 phb->dma32_base = 0;
diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
index 7b4df37ac38..a84fecf63c4 100644
--- a/arch/powerpc/sysdev/Kconfig
+++ b/arch/powerpc/sysdev/Kconfig
@@ -29,3 +29,7 @@ config SCOM_DEBUGFS
29 bool "Expose SCOM controllers via debugfs" 29 bool "Expose SCOM controllers via debugfs"
30 depends on PPC_SCOM 30 depends on PPC_SCOM
31 default n 31 default n
32
33config GE_FPGA
34 bool
35 default n
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 5e37b471786..1bd7ecb2462 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -4,6 +4,8 @@ ccflags-$(CONFIG_PPC64) := -mno-minimal-toc
4 4
5mpic-msi-obj-$(CONFIG_PCI_MSI) += mpic_msi.o mpic_u3msi.o mpic_pasemi_msi.o 5mpic-msi-obj-$(CONFIG_PCI_MSI) += mpic_msi.o mpic_u3msi.o mpic_pasemi_msi.o
6obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y) 6obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y)
7mpic-msgr-obj-$(CONFIG_MPIC_MSGR) += mpic_msgr.o
8obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y) $(mpic-msgr-obj-y)
7obj-$(CONFIG_PPC_EPAPR_HV_PIC) += ehv_pic.o 9obj-$(CONFIG_PPC_EPAPR_HV_PIC) += ehv_pic.o
8fsl-msi-obj-$(CONFIG_PCI_MSI) += fsl_msi.o 10fsl-msi-obj-$(CONFIG_PCI_MSI) += fsl_msi.o
9obj-$(CONFIG_PPC_MSI_BITMAP) += msi_bitmap.o 11obj-$(CONFIG_PPC_MSI_BITMAP) += msi_bitmap.o
@@ -65,3 +67,5 @@ obj-$(CONFIG_PPC_SCOM) += scom.o
65subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror 67subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
66 68
67obj-$(CONFIG_PPC_XICS) += xics/ 69obj-$(CONFIG_PPC_XICS) += xics/
70
71obj-$(CONFIG_GE_FPGA) += ge/
diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
index 11641589917..37a69097e02 100644
--- a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -24,6 +24,7 @@
24 */ 24 */
25 25
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/export.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
28#include <linux/err.h> 29#include <linux/err.h>
29#include <linux/of_platform.h> 30#include <linux/of_platform.h>
diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
index 5f88797dce7..cedabd0f4bf 100644
--- a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
+++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/module.h>
24#include <linux/of_platform.h> 25#include <linux/of_platform.h>
25#include <asm/io.h> 26#include <asm/io.h>
26 27
@@ -200,6 +201,9 @@ static struct of_device_id mpc85xx_l2ctlr_of_match[] = {
200 { 201 {
201 .compatible = "fsl,p1022-l2-cache-controller", 202 .compatible = "fsl,p1022-l2-cache-controller",
202 }, 203 },
204 {
205 .compatible = "fsl,mpc8548-l2-cache-controller",
206 },
203 {}, 207 {},
204}; 208};
205 209
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 0c01debe963..6e097de00e0 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -410,6 +410,7 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev)
410 410
411 msi->msi_regs = ioremap(res.start, resource_size(&res)); 411 msi->msi_regs = ioremap(res.start, resource_size(&res));
412 if (!msi->msi_regs) { 412 if (!msi->msi_regs) {
413 err = -ENOMEM;
413 dev_err(&dev->dev, "could not map node %s\n", 414 dev_err(&dev->dev, "could not map node %s\n",
414 dev->dev.of_node->full_name); 415 dev->dev.of_node->full_name);
415 goto error_out; 416 goto error_out;
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index a4c4f4a932d..5b6f556094d 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -66,8 +66,8 @@
66 " li %0,%3\n" \ 66 " li %0,%3\n" \
67 " b 2b\n" \ 67 " b 2b\n" \
68 ".section __ex_table,\"a\"\n" \ 68 ".section __ex_table,\"a\"\n" \
69 " .align 2\n" \ 69 PPC_LONG_ALIGN "\n" \
70 " .long 1b,3b\n" \ 70 PPC_LONG "1b,3b\n" \
71 ".text" \ 71 ".text" \
72 : "=r" (err), "=r" (x) \ 72 : "=r" (err), "=r" (x) \
73 : "b" (addr), "i" (-EFAULT), "0" (err)) 73 : "b" (addr), "i" (-EFAULT), "0" (err))
diff --git a/arch/powerpc/sysdev/fsl_rmu.c b/arch/powerpc/sysdev/fsl_rmu.c
index 15485789e9d..14bd5221f28 100644
--- a/arch/powerpc/sysdev/fsl_rmu.c
+++ b/arch/powerpc/sysdev/fsl_rmu.c
@@ -100,14 +100,8 @@
100#define DOORBELL_DSR_TE 0x00000080 100#define DOORBELL_DSR_TE 0x00000080
101#define DOORBELL_DSR_QFI 0x00000010 101#define DOORBELL_DSR_QFI 0x00000010
102#define DOORBELL_DSR_DIQI 0x00000001 102#define DOORBELL_DSR_DIQI 0x00000001
103#define DOORBELL_TID_OFFSET 0x02
104#define DOORBELL_SID_OFFSET 0x04
105#define DOORBELL_INFO_OFFSET 0x06
106 103
107#define DOORBELL_MESSAGE_SIZE 0x08 104#define DOORBELL_MESSAGE_SIZE 0x08
108#define DBELL_SID(x) (*(u16 *)(x + DOORBELL_SID_OFFSET))
109#define DBELL_TID(x) (*(u16 *)(x + DOORBELL_TID_OFFSET))
110#define DBELL_INF(x) (*(u16 *)(x + DOORBELL_INFO_OFFSET))
111 105
112struct rio_msg_regs { 106struct rio_msg_regs {
113 u32 omr; 107 u32 omr;
@@ -193,6 +187,13 @@ struct fsl_rmu {
193 int rxirq; 187 int rxirq;
194}; 188};
195 189
190struct rio_dbell_msg {
191 u16 pad1;
192 u16 tid;
193 u16 sid;
194 u16 info;
195};
196
196/** 197/**
197 * fsl_rio_tx_handler - MPC85xx outbound message interrupt handler 198 * fsl_rio_tx_handler - MPC85xx outbound message interrupt handler
198 * @irq: Linux interrupt number 199 * @irq: Linux interrupt number
@@ -311,8 +312,8 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)
311 312
312 /* XXX Need to check/dispatch until queue empty */ 313 /* XXX Need to check/dispatch until queue empty */
313 if (dsr & DOORBELL_DSR_DIQI) { 314 if (dsr & DOORBELL_DSR_DIQI) {
314 u32 dmsg = 315 struct rio_dbell_msg *dmsg =
315 (u32) fsl_dbell->dbell_ring.virt + 316 fsl_dbell->dbell_ring.virt +
316 (in_be32(&fsl_dbell->dbell_regs->dqdpar) & 0xfff); 317 (in_be32(&fsl_dbell->dbell_regs->dqdpar) & 0xfff);
317 struct rio_dbell *dbell; 318 struct rio_dbell *dbell;
318 int found = 0; 319 int found = 0;
@@ -320,25 +321,25 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)
320 pr_debug 321 pr_debug
321 ("RIO: processing doorbell," 322 ("RIO: processing doorbell,"
322 " sid %2.2x tid %2.2x info %4.4x\n", 323 " sid %2.2x tid %2.2x info %4.4x\n",
323 DBELL_SID(dmsg), DBELL_TID(dmsg), DBELL_INF(dmsg)); 324 dmsg->sid, dmsg->tid, dmsg->info);
324 325
325 for (i = 0; i < MAX_PORT_NUM; i++) { 326 for (i = 0; i < MAX_PORT_NUM; i++) {
326 if (fsl_dbell->mport[i]) { 327 if (fsl_dbell->mport[i]) {
327 list_for_each_entry(dbell, 328 list_for_each_entry(dbell,
328 &fsl_dbell->mport[i]->dbells, node) { 329 &fsl_dbell->mport[i]->dbells, node) {
329 if ((dbell->res->start 330 if ((dbell->res->start
330 <= DBELL_INF(dmsg)) 331 <= dmsg->info)
331 && (dbell->res->end 332 && (dbell->res->end
332 >= DBELL_INF(dmsg))) { 333 >= dmsg->info)) {
333 found = 1; 334 found = 1;
334 break; 335 break;
335 } 336 }
336 } 337 }
337 if (found && dbell->dinb) { 338 if (found && dbell->dinb) {
338 dbell->dinb(fsl_dbell->mport[i], 339 dbell->dinb(fsl_dbell->mport[i],
339 dbell->dev_id, DBELL_SID(dmsg), 340 dbell->dev_id, dmsg->sid,
340 DBELL_TID(dmsg), 341 dmsg->tid,
341 DBELL_INF(dmsg)); 342 dmsg->info);
342 break; 343 break;
343 } 344 }
344 } 345 }
@@ -348,8 +349,8 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)
348 pr_debug 349 pr_debug
349 ("RIO: spurious doorbell," 350 ("RIO: spurious doorbell,"
350 " sid %2.2x tid %2.2x info %4.4x\n", 351 " sid %2.2x tid %2.2x info %4.4x\n",
351 DBELL_SID(dmsg), DBELL_TID(dmsg), 352 dmsg->sid, dmsg->tid,
352 DBELL_INF(dmsg)); 353 dmsg->info);
353 } 354 }
354 setbits32(&fsl_dbell->dbell_regs->dmr, DOORBELL_DMR_DI); 355 setbits32(&fsl_dbell->dbell_regs->dmr, DOORBELL_DMR_DI);
355 out_be32(&fsl_dbell->dbell_regs->dsr, DOORBELL_DSR_DIQI); 356 out_be32(&fsl_dbell->dbell_regs->dsr, DOORBELL_DSR_DIQI);
@@ -657,7 +658,7 @@ fsl_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox,
657 int ret = 0; 658 int ret = 0;
658 659
659 pr_debug("RIO: fsl_add_outb_message(): destid %4.4x mbox %d buffer " \ 660 pr_debug("RIO: fsl_add_outb_message(): destid %4.4x mbox %d buffer " \
660 "%8.8x len %8.8x\n", rdev->destid, mbox, (int)buffer, len); 661 "%p len %8.8zx\n", rdev->destid, mbox, buffer, len);
661 if ((len < 8) || (len > RIO_MAX_MSG_SIZE)) { 662 if ((len < 8) || (len > RIO_MAX_MSG_SIZE)) {
662 ret = -EINVAL; 663 ret = -EINVAL;
663 goto out; 664 goto out;
@@ -972,7 +973,8 @@ out:
972void *fsl_get_inb_message(struct rio_mport *mport, int mbox) 973void *fsl_get_inb_message(struct rio_mport *mport, int mbox)
973{ 974{
974 struct fsl_rmu *rmu = GET_RMM_HANDLE(mport); 975 struct fsl_rmu *rmu = GET_RMM_HANDLE(mport);
975 u32 phys_buf, virt_buf; 976 u32 phys_buf;
977 void *virt_buf;
976 void *buf = NULL; 978 void *buf = NULL;
977 int buf_idx; 979 int buf_idx;
978 980
@@ -982,7 +984,7 @@ void *fsl_get_inb_message(struct rio_mport *mport, int mbox)
982 if (phys_buf == in_be32(&rmu->msg_regs->ifqepar)) 984 if (phys_buf == in_be32(&rmu->msg_regs->ifqepar))
983 goto out2; 985 goto out2;
984 986
985 virt_buf = (u32) rmu->msg_rx_ring.virt + (phys_buf 987 virt_buf = rmu->msg_rx_ring.virt + (phys_buf
986 - rmu->msg_rx_ring.phys); 988 - rmu->msg_rx_ring.phys);
987 buf_idx = (phys_buf - rmu->msg_rx_ring.phys) / RIO_MAX_MSG_SIZE; 989 buf_idx = (phys_buf - rmu->msg_rx_ring.phys) / RIO_MAX_MSG_SIZE;
988 buf = rmu->msg_rx_ring.virt_buffer[buf_idx]; 990 buf = rmu->msg_rx_ring.virt_buffer[buf_idx];
@@ -994,7 +996,7 @@ void *fsl_get_inb_message(struct rio_mport *mport, int mbox)
994 } 996 }
995 997
996 /* Copy max message size, caller is expected to allocate that big */ 998 /* Copy max message size, caller is expected to allocate that big */
997 memcpy(buf, (void *)virt_buf, RIO_MAX_MSG_SIZE); 999 memcpy(buf, virt_buf, RIO_MAX_MSG_SIZE);
998 1000
999 /* Clear the available buffer */ 1001 /* Clear the available buffer */
1000 rmu->msg_rx_ring.virt_buffer[buf_idx] = NULL; 1002 rmu->msg_rx_ring.virt_buffer[buf_idx] = NULL;
diff --git a/arch/powerpc/sysdev/ge/Makefile b/arch/powerpc/sysdev/ge/Makefile
new file mode 100644
index 00000000000..8731ffcb79b
--- /dev/null
+++ b/arch/powerpc/sysdev/ge/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_GE_FPGA) += ge_pic.o
diff --git a/arch/powerpc/platforms/86xx/gef_pic.c b/arch/powerpc/sysdev/ge/ge_pic.c
index af3fd697de8..2bcb78bb3a1 100644
--- a/arch/powerpc/platforms/86xx/gef_pic.c
+++ b/arch/powerpc/sysdev/ge/ge_pic.c
@@ -22,7 +22,7 @@
22#include <asm/prom.h> 22#include <asm/prom.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24 24
25#include "gef_pic.h" 25#include "ge_pic.h"
26 26
27#define DEBUG 27#define DEBUG
28#undef DEBUG 28#undef DEBUG
diff --git a/arch/powerpc/platforms/86xx/gef_pic.h b/arch/powerpc/sysdev/ge/ge_pic.h
index 6149916da3f..6149916da3f 100644
--- a/arch/powerpc/platforms/86xx/gef_pic.h
+++ b/arch/powerpc/sysdev/ge/ge_pic.h
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index c83a512fa17..9ac71ebd2c4 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -873,7 +873,7 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type)
873 DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n", 873 DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n",
874 mpic, d->irq, src, flow_type); 874 mpic, d->irq, src, flow_type);
875 875
876 if (src >= mpic->irq_count) 876 if (src >= mpic->num_sources)
877 return -EINVAL; 877 return -EINVAL;
878 878
879 if (flow_type == IRQ_TYPE_NONE) 879 if (flow_type == IRQ_TYPE_NONE)
@@ -909,7 +909,7 @@ void mpic_set_vector(unsigned int virq, unsigned int vector)
909 DBG("mpic: set_vector(mpic:@%p,virq:%d,src:%d,vector:0x%x)\n", 909 DBG("mpic: set_vector(mpic:@%p,virq:%d,src:%d,vector:0x%x)\n",
910 mpic, virq, src, vector); 910 mpic, virq, src, vector);
911 911
912 if (src >= mpic->irq_count) 912 if (src >= mpic->num_sources)
913 return; 913 return;
914 914
915 vecpri = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)); 915 vecpri = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI));
@@ -926,7 +926,7 @@ void mpic_set_destination(unsigned int virq, unsigned int cpuid)
926 DBG("mpic: set_destination(mpic:@%p,virq:%d,src:%d,cpuid:0x%x)\n", 926 DBG("mpic: set_destination(mpic:@%p,virq:%d,src:%d,cpuid:0x%x)\n",
927 mpic, virq, src, cpuid); 927 mpic, virq, src, cpuid);
928 928
929 if (src >= mpic->irq_count) 929 if (src >= mpic->num_sources)
930 return; 930 return;
931 931
932 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid); 932 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
@@ -1006,7 +1006,7 @@ static int mpic_host_map(struct irq_domain *h, unsigned int virq,
1006 return 0; 1006 return 0;
1007 } 1007 }
1008 1008
1009 if (hw >= mpic->irq_count) 1009 if (hw >= mpic->num_sources)
1010 return -EINVAL; 1010 return -EINVAL;
1011 1011
1012 mpic_msi_reserve_hwirq(mpic, hw); 1012 mpic_msi_reserve_hwirq(mpic, hw);
@@ -1149,6 +1149,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1149 u32 greg_feature; 1149 u32 greg_feature;
1150 const char *vers; 1150 const char *vers;
1151 const u32 *psrc; 1151 const u32 *psrc;
1152 u32 last_irq;
1152 1153
1153 /* Default MPIC search parameters */ 1154 /* Default MPIC search parameters */
1154 static const struct of_device_id __initconst mpic_device_id[] = { 1155 static const struct of_device_id __initconst mpic_device_id[] = {
@@ -1182,6 +1183,16 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1182 } 1183 }
1183 } 1184 }
1184 1185
1186 /* Read extra device-tree properties into the flags variable */
1187 if (of_get_property(node, "big-endian", NULL))
1188 flags |= MPIC_BIG_ENDIAN;
1189 if (of_get_property(node, "pic-no-reset", NULL))
1190 flags |= MPIC_NO_RESET;
1191 if (of_get_property(node, "single-cpu-affinity", NULL))
1192 flags |= MPIC_SINGLE_DEST_CPU;
1193 if (of_device_is_compatible(node, "fsl,mpic"))
1194 flags |= MPIC_FSL;
1195
1185 mpic = kzalloc(sizeof(struct mpic), GFP_KERNEL); 1196 mpic = kzalloc(sizeof(struct mpic), GFP_KERNEL);
1186 if (mpic == NULL) 1197 if (mpic == NULL)
1187 goto err_of_node_put; 1198 goto err_of_node_put;
@@ -1189,15 +1200,16 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1189 mpic->name = name; 1200 mpic->name = name;
1190 mpic->node = node; 1201 mpic->node = node;
1191 mpic->paddr = phys_addr; 1202 mpic->paddr = phys_addr;
1203 mpic->flags = flags;
1192 1204
1193 mpic->hc_irq = mpic_irq_chip; 1205 mpic->hc_irq = mpic_irq_chip;
1194 mpic->hc_irq.name = name; 1206 mpic->hc_irq.name = name;
1195 if (!(flags & MPIC_SECONDARY)) 1207 if (!(mpic->flags & MPIC_SECONDARY))
1196 mpic->hc_irq.irq_set_affinity = mpic_set_affinity; 1208 mpic->hc_irq.irq_set_affinity = mpic_set_affinity;
1197#ifdef CONFIG_MPIC_U3_HT_IRQS 1209#ifdef CONFIG_MPIC_U3_HT_IRQS
1198 mpic->hc_ht_irq = mpic_irq_ht_chip; 1210 mpic->hc_ht_irq = mpic_irq_ht_chip;
1199 mpic->hc_ht_irq.name = name; 1211 mpic->hc_ht_irq.name = name;
1200 if (!(flags & MPIC_SECONDARY)) 1212 if (!(mpic->flags & MPIC_SECONDARY))
1201 mpic->hc_ht_irq.irq_set_affinity = mpic_set_affinity; 1213 mpic->hc_ht_irq.irq_set_affinity = mpic_set_affinity;
1202#endif /* CONFIG_MPIC_U3_HT_IRQS */ 1214#endif /* CONFIG_MPIC_U3_HT_IRQS */
1203 1215
@@ -1209,12 +1221,9 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1209 mpic->hc_tm = mpic_tm_chip; 1221 mpic->hc_tm = mpic_tm_chip;
1210 mpic->hc_tm.name = name; 1222 mpic->hc_tm.name = name;
1211 1223
1212 mpic->flags = flags;
1213 mpic->isu_size = isu_size;
1214 mpic->irq_count = irq_count;
1215 mpic->num_sources = 0; /* so far */ 1224 mpic->num_sources = 0; /* so far */
1216 1225
1217 if (flags & MPIC_LARGE_VECTORS) 1226 if (mpic->flags & MPIC_LARGE_VECTORS)
1218 intvec_top = 2047; 1227 intvec_top = 2047;
1219 else 1228 else
1220 intvec_top = 255; 1229 intvec_top = 255;
@@ -1233,12 +1242,6 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1233 mpic->ipi_vecs[3] = intvec_top - 1; 1242 mpic->ipi_vecs[3] = intvec_top - 1;
1234 mpic->spurious_vec = intvec_top; 1243 mpic->spurious_vec = intvec_top;
1235 1244
1236 /* Check for "big-endian" in device-tree */
1237 if (of_get_property(mpic->node, "big-endian", NULL) != NULL)
1238 mpic->flags |= MPIC_BIG_ENDIAN;
1239 if (of_device_is_compatible(mpic->node, "fsl,mpic"))
1240 mpic->flags |= MPIC_FSL;
1241
1242 /* Look for protected sources */ 1245 /* Look for protected sources */
1243 psrc = of_get_property(mpic->node, "protected-sources", &psize); 1246 psrc = of_get_property(mpic->node, "protected-sources", &psize);
1244 if (psrc) { 1247 if (psrc) {
@@ -1254,11 +1257,11 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1254 } 1257 }
1255 1258
1256#ifdef CONFIG_MPIC_WEIRD 1259#ifdef CONFIG_MPIC_WEIRD
1257 mpic->hw_set = mpic_infos[MPIC_GET_REGSET(flags)]; 1260 mpic->hw_set = mpic_infos[MPIC_GET_REGSET(mpic->flags)];
1258#endif 1261#endif
1259 1262
1260 /* default register type */ 1263 /* default register type */
1261 if (flags & MPIC_BIG_ENDIAN) 1264 if (mpic->flags & MPIC_BIG_ENDIAN)
1262 mpic->reg_type = mpic_access_mmio_be; 1265 mpic->reg_type = mpic_access_mmio_be;
1263 else 1266 else
1264 mpic->reg_type = mpic_access_mmio_le; 1267 mpic->reg_type = mpic_access_mmio_le;
@@ -1268,10 +1271,10 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1268 * only if the kernel includes DCR support. 1271 * only if the kernel includes DCR support.
1269 */ 1272 */
1270#ifdef CONFIG_PPC_DCR 1273#ifdef CONFIG_PPC_DCR
1271 if (flags & MPIC_USES_DCR) 1274 if (mpic->flags & MPIC_USES_DCR)
1272 mpic->reg_type = mpic_access_dcr; 1275 mpic->reg_type = mpic_access_dcr;
1273#else 1276#else
1274 BUG_ON(flags & MPIC_USES_DCR); 1277 BUG_ON(mpic->flags & MPIC_USES_DCR);
1275#endif 1278#endif
1276 1279
1277 /* Map the global registers */ 1280 /* Map the global registers */
@@ -1283,10 +1286,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1283 /* When using a device-node, reset requests are only honored if the MPIC 1286 /* When using a device-node, reset requests are only honored if the MPIC
1284 * is allowed to reset. 1287 * is allowed to reset.
1285 */ 1288 */
1286 if (of_get_property(mpic->node, "pic-no-reset", NULL)) 1289 if (!(mpic->flags & MPIC_NO_RESET)) {
1287 mpic->flags |= MPIC_NO_RESET;
1288
1289 if ((flags & MPIC_WANTS_RESET) && !(mpic->flags & MPIC_NO_RESET)) {
1290 printk(KERN_DEBUG "mpic: Resetting\n"); 1290 printk(KERN_DEBUG "mpic: Resetting\n");
1291 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), 1291 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0),
1292 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) 1292 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0))
@@ -1297,31 +1297,17 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1297 } 1297 }
1298 1298
1299 /* CoreInt */ 1299 /* CoreInt */
1300 if (flags & MPIC_ENABLE_COREINT) 1300 if (mpic->flags & MPIC_ENABLE_COREINT)
1301 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), 1301 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0),
1302 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) 1302 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0))
1303 | MPIC_GREG_GCONF_COREINT); 1303 | MPIC_GREG_GCONF_COREINT);
1304 1304
1305 if (flags & MPIC_ENABLE_MCK) 1305 if (mpic->flags & MPIC_ENABLE_MCK)
1306 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), 1306 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0),
1307 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) 1307 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0))
1308 | MPIC_GREG_GCONF_MCK); 1308 | MPIC_GREG_GCONF_MCK);
1309 1309
1310 /* 1310 /*
1311 * Read feature register. For non-ISU MPICs, num sources as well. On
1312 * ISU MPICs, sources are counted as ISUs are added
1313 */
1314 greg_feature = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0));
1315 if (isu_size == 0) {
1316 if (flags & MPIC_BROKEN_FRR_NIRQS)
1317 mpic->num_sources = mpic->irq_count;
1318 else
1319 mpic->num_sources =
1320 ((greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK)
1321 >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT) + 1;
1322 }
1323
1324 /*
1325 * The MPIC driver will crash if there are more cores than we 1311 * The MPIC driver will crash if there are more cores than we
1326 * can initialize, so we may as well catch that problem here. 1312 * can initialize, so we may as well catch that problem here.
1327 */ 1313 */
@@ -1336,17 +1322,41 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1336 0x1000); 1322 0x1000);
1337 } 1323 }
1338 1324
1325 /*
1326 * Read feature register. For non-ISU MPICs, num sources as well. On
1327 * ISU MPICs, sources are counted as ISUs are added
1328 */
1329 greg_feature = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0));
1330
1331 /*
1332 * By default, the last source number comes from the MPIC, but the
1333 * device-tree and board support code can override it on buggy hw.
1334 * If we get passed an isu_size (multi-isu MPIC) then we use that
1335 * as a default instead of the value read from the HW.
1336 */
1337 last_irq = (greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK)
1338 >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT;
1339 if (isu_size)
1340 last_irq = isu_size * MPIC_MAX_ISU - 1;
1341 of_property_read_u32(mpic->node, "last-interrupt-source", &last_irq);
1342 if (irq_count)
1343 last_irq = irq_count - 1;
1344
1339 /* Initialize main ISU if none provided */ 1345 /* Initialize main ISU if none provided */
1340 if (mpic->isu_size == 0) { 1346 if (!isu_size) {
1341 mpic->isu_size = mpic->num_sources; 1347 isu_size = last_irq + 1;
1348 mpic->num_sources = isu_size;
1342 mpic_map(mpic, mpic->paddr, &mpic->isus[0], 1349 mpic_map(mpic, mpic->paddr, &mpic->isus[0],
1343 MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size); 1350 MPIC_INFO(IRQ_BASE),
1351 MPIC_INFO(IRQ_STRIDE) * isu_size);
1344 } 1352 }
1353
1354 mpic->isu_size = isu_size;
1345 mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1); 1355 mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
1346 mpic->isu_mask = (1 << mpic->isu_shift) - 1; 1356 mpic->isu_mask = (1 << mpic->isu_shift) - 1;
1347 1357
1348 mpic->irqhost = irq_domain_add_linear(mpic->node, 1358 mpic->irqhost = irq_domain_add_linear(mpic->node,
1349 isu_size ? isu_size : mpic->num_sources, 1359 last_irq + 1,
1350 &mpic_host_ops, mpic); 1360 &mpic_host_ops, mpic);
1351 1361
1352 /* 1362 /*
@@ -1380,7 +1390,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1380 mpic->next = mpics; 1390 mpic->next = mpics;
1381 mpics = mpic; 1391 mpics = mpic;
1382 1392
1383 if (!(flags & MPIC_SECONDARY)) { 1393 if (!(mpic->flags & MPIC_SECONDARY)) {
1384 mpic_primary = mpic; 1394 mpic_primary = mpic;
1385 irq_set_default_host(mpic->irqhost); 1395 irq_set_default_host(mpic->irqhost);
1386 } 1396 }
@@ -1447,10 +1457,6 @@ void __init mpic_init(struct mpic *mpic)
1447 (mpic->ipi_vecs[0] + i)); 1457 (mpic->ipi_vecs[0] + i));
1448 } 1458 }
1449 1459
1450 /* Initialize interrupt sources */
1451 if (mpic->irq_count == 0)
1452 mpic->irq_count = mpic->num_sources;
1453
1454 /* Do the HT PIC fixups on U3 broken mpic */ 1460 /* Do the HT PIC fixups on U3 broken mpic */
1455 DBG("MPIC flags: %x\n", mpic->flags); 1461 DBG("MPIC flags: %x\n", mpic->flags);
1456 if ((mpic->flags & MPIC_U3_HT_IRQS) && !(mpic->flags & MPIC_SECONDARY)) { 1462 if ((mpic->flags & MPIC_U3_HT_IRQS) && !(mpic->flags & MPIC_SECONDARY)) {
diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
new file mode 100644
index 00000000000..6e7fa386e76
--- /dev/null
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -0,0 +1,282 @@
1/*
2 * Copyright 2011-2012, Meador Inge, Mentor Graphics Corporation.
3 *
4 * Some ideas based on un-pushed work done by Vivek Mahajan, Jason Jin, and
5 * Mingkai Hu from Freescale Semiconductor, Inc.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2 of the
10 * License.
11 *
12 */
13
14#include <linux/list.h>
15#include <linux/of_platform.h>
16#include <linux/errno.h>
17#include <asm/prom.h>
18#include <asm/hw_irq.h>
19#include <asm/ppc-pci.h>
20#include <asm/mpic_msgr.h>
21
22#define MPIC_MSGR_REGISTERS_PER_BLOCK 4
23#define MPIC_MSGR_STRIDE 0x10
24#define MPIC_MSGR_MER_OFFSET 0x100
25#define MSGR_INUSE 0
26#define MSGR_FREE 1
27
28static struct mpic_msgr **mpic_msgrs;
29static unsigned int mpic_msgr_count;
30
31static inline void _mpic_msgr_mer_write(struct mpic_msgr *msgr, u32 value)
32{
33 out_be32(msgr->mer, value);
34}
35
36static inline u32 _mpic_msgr_mer_read(struct mpic_msgr *msgr)
37{
38 return in_be32(msgr->mer);
39}
40
41static inline void _mpic_msgr_disable(struct mpic_msgr *msgr)
42{
43 u32 mer = _mpic_msgr_mer_read(msgr);
44
45 _mpic_msgr_mer_write(msgr, mer & ~(1 << msgr->num));
46}
47
48struct mpic_msgr *mpic_msgr_get(unsigned int reg_num)
49{
50 unsigned long flags;
51 struct mpic_msgr *msgr;
52
53 /* Assume busy until proven otherwise. */
54 msgr = ERR_PTR(-EBUSY);
55
56 if (reg_num >= mpic_msgr_count)
57 return ERR_PTR(-ENODEV);
58
59 raw_spin_lock_irqsave(&msgr->lock, flags);
60 if (mpic_msgrs[reg_num]->in_use == MSGR_FREE) {
61 msgr = mpic_msgrs[reg_num];
62 msgr->in_use = MSGR_INUSE;
63 }
64 raw_spin_unlock_irqrestore(&msgr->lock, flags);
65
66 return msgr;
67}
68EXPORT_SYMBOL_GPL(mpic_msgr_get);
69
70void mpic_msgr_put(struct mpic_msgr *msgr)
71{
72 unsigned long flags;
73
74 raw_spin_lock_irqsave(&msgr->lock, flags);
75 msgr->in_use = MSGR_FREE;
76 _mpic_msgr_disable(msgr);
77 raw_spin_unlock_irqrestore(&msgr->lock, flags);
78}
79EXPORT_SYMBOL_GPL(mpic_msgr_put);
80
81void mpic_msgr_enable(struct mpic_msgr *msgr)
82{
83 unsigned long flags;
84 u32 mer;
85
86 raw_spin_lock_irqsave(&msgr->lock, flags);
87 mer = _mpic_msgr_mer_read(msgr);
88 _mpic_msgr_mer_write(msgr, mer | (1 << msgr->num));
89 raw_spin_unlock_irqrestore(&msgr->lock, flags);
90}
91EXPORT_SYMBOL_GPL(mpic_msgr_enable);
92
93void mpic_msgr_disable(struct mpic_msgr *msgr)
94{
95 unsigned long flags;
96
97 raw_spin_lock_irqsave(&msgr->lock, flags);
98 _mpic_msgr_disable(msgr);
99 raw_spin_unlock_irqrestore(&msgr->lock, flags);
100}
101EXPORT_SYMBOL_GPL(mpic_msgr_disable);
102
103/* The following three functions are used to compute the order and number of
104 * the message register blocks. They are clearly very inefficent. However,
105 * they are called *only* a few times during device initialization.
106 */
107static unsigned int mpic_msgr_number_of_blocks(void)
108{
109 unsigned int count;
110 struct device_node *aliases;
111
112 count = 0;
113 aliases = of_find_node_by_name(NULL, "aliases");
114
115 if (aliases) {
116 char buf[32];
117
118 for (;;) {
119 snprintf(buf, sizeof(buf), "mpic-msgr-block%d", count);
120 if (!of_find_property(aliases, buf, NULL))
121 break;
122
123 count += 1;
124 }
125 }
126
127 return count;
128}
129
130static unsigned int mpic_msgr_number_of_registers(void)
131{
132 return mpic_msgr_number_of_blocks() * MPIC_MSGR_REGISTERS_PER_BLOCK;
133}
134
135static int mpic_msgr_block_number(struct device_node *node)
136{
137 struct device_node *aliases;
138 unsigned int index, number_of_blocks;
139 char buf[64];
140
141 number_of_blocks = mpic_msgr_number_of_blocks();
142 aliases = of_find_node_by_name(NULL, "aliases");
143 if (!aliases)
144 return -1;
145
146 for (index = 0; index < number_of_blocks; ++index) {
147 struct property *prop;
148
149 snprintf(buf, sizeof(buf), "mpic-msgr-block%d", index);
150 prop = of_find_property(aliases, buf, NULL);
151 if (node == of_find_node_by_path(prop->value))
152 break;
153 }
154
155 return index == number_of_blocks ? -1 : index;
156}
157
158/* The probe function for a single message register block.
159 */
160static __devinit int mpic_msgr_probe(struct platform_device *dev)
161{
162 void __iomem *msgr_block_addr;
163 int block_number;
164 struct resource rsrc;
165 unsigned int i;
166 unsigned int irq_index;
167 struct device_node *np = dev->dev.of_node;
168 unsigned int receive_mask;
169 const unsigned int *prop;
170
171 if (!np) {
172 dev_err(&dev->dev, "Device OF-Node is NULL");
173 return -EFAULT;
174 }
175
176 /* Allocate the message register array upon the first device
177 * registered.
178 */
179 if (!mpic_msgrs) {
180 mpic_msgr_count = mpic_msgr_number_of_registers();
181 dev_info(&dev->dev, "Found %d message registers\n",
182 mpic_msgr_count);
183
184 mpic_msgrs = kzalloc(sizeof(struct mpic_msgr) * mpic_msgr_count,
185 GFP_KERNEL);
186 if (!mpic_msgrs) {
187 dev_err(&dev->dev,
188 "No memory for message register blocks\n");
189 return -ENOMEM;
190 }
191 }
192 dev_info(&dev->dev, "Of-device full name %s\n", np->full_name);
193
194 /* IO map the message register block. */
195 of_address_to_resource(np, 0, &rsrc);
196 msgr_block_addr = ioremap(rsrc.start, rsrc.end - rsrc.start);
197 if (!msgr_block_addr) {
198 dev_err(&dev->dev, "Failed to iomap MPIC message registers");
199 return -EFAULT;
200 }
201
202 /* Ensure the block has a defined order. */
203 block_number = mpic_msgr_block_number(np);
204 if (block_number < 0) {
205 dev_err(&dev->dev,
206 "Failed to find message register block alias\n");
207 return -ENODEV;
208 }
209 dev_info(&dev->dev, "Setting up message register block %d\n",
210 block_number);
211
212 /* Grab the receive mask which specifies what registers can receive
213 * interrupts.
214 */
215 prop = of_get_property(np, "mpic-msgr-receive-mask", NULL);
216 receive_mask = (prop) ? *prop : 0xF;
217
218 /* Build up the appropriate message register data structures. */
219 for (i = 0, irq_index = 0; i < MPIC_MSGR_REGISTERS_PER_BLOCK; ++i) {
220 struct mpic_msgr *msgr;
221 unsigned int reg_number;
222
223 msgr = kzalloc(sizeof(struct mpic_msgr), GFP_KERNEL);
224 if (!msgr) {
225 dev_err(&dev->dev, "No memory for message register\n");
226 return -ENOMEM;
227 }
228
229 reg_number = block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i;
230 msgr->base = msgr_block_addr + i * MPIC_MSGR_STRIDE;
231 msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET;
232 msgr->in_use = MSGR_FREE;
233 msgr->num = i;
234 raw_spin_lock_init(&msgr->lock);
235
236 if (receive_mask & (1 << i)) {
237 struct resource irq;
238
239 if (of_irq_to_resource(np, irq_index, &irq) == NO_IRQ) {
240 dev_err(&dev->dev,
241 "Missing interrupt specifier");
242 kfree(msgr);
243 return -EFAULT;
244 }
245 msgr->irq = irq.start;
246 irq_index += 1;
247 } else {
248 msgr->irq = NO_IRQ;
249 }
250
251 mpic_msgrs[reg_number] = msgr;
252 mpic_msgr_disable(msgr);
253 dev_info(&dev->dev, "Register %d initialized: irq %d\n",
254 reg_number, msgr->irq);
255
256 }
257
258 return 0;
259}
260
261static const struct of_device_id mpic_msgr_ids[] = {
262 {
263 .compatible = "fsl,mpic-v3.1-msgr",
264 .data = NULL,
265 },
266 {}
267};
268
269static struct platform_driver mpic_msgr_driver = {
270 .driver = {
271 .name = "mpic-msgr",
272 .owner = THIS_MODULE,
273 .of_match_table = mpic_msgr_ids,
274 },
275 .probe = mpic_msgr_probe,
276};
277
278static __init int mpic_msgr_init(void)
279{
280 return platform_driver_register(&mpic_msgr_driver);
281}
282subsys_initcall(mpic_msgr_init);
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index 0622aa91b18..bbf342c8831 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -54,7 +54,7 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
54 for (i = 100; i < 105; i++) 54 for (i = 100; i < 105; i++)
55 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i); 55 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
56 56
57 for (i = 124; i < mpic->irq_count; i++) 57 for (i = 124; i < mpic->num_sources; i++)
58 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i); 58 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
59 59
60 60
@@ -83,7 +83,7 @@ int mpic_msi_init_allocator(struct mpic *mpic)
83{ 83{
84 int rc; 84 int rc;
85 85
86 rc = msi_bitmap_alloc(&mpic->msi_bitmap, mpic->irq_count, 86 rc = msi_bitmap_alloc(&mpic->msi_bitmap, mpic->num_sources,
87 mpic->irqhost->of_node); 87 mpic->irqhost->of_node);
88 if (rc) 88 if (rc)
89 return rc; 89 return rc;
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index 4f05f754234..56e8b3c3c89 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -1050,6 +1050,74 @@ static struct ppc4xx_pciex_hwops ppc460ex_pcie_hwops __initdata =
1050 .check_link = ppc4xx_pciex_check_link_sdr, 1050 .check_link = ppc4xx_pciex_check_link_sdr,
1051}; 1051};
1052 1052
1053static int __init apm821xx_pciex_core_init(struct device_node *np)
1054{
1055 /* Return the number of pcie port */
1056 return 1;
1057}
1058
1059static int apm821xx_pciex_init_port_hw(struct ppc4xx_pciex_port *port)
1060{
1061 u32 val;
1062
1063 /*
1064 * Do a software reset on PCIe ports.
1065 * This code is to fix the issue that pci drivers doesn't re-assign
1066 * bus number for PCIE devices after Uboot
1067 * scanned and configured all the buses (eg. PCIE NIC IntelPro/1000
1068 * PT quad port, SAS LSI 1064E)
1069 */
1070
1071 mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x0);
1072 mdelay(10);
1073
1074 if (port->endpoint)
1075 val = PTYPE_LEGACY_ENDPOINT << 20;
1076 else
1077 val = PTYPE_ROOT_PORT << 20;
1078
1079 val |= LNKW_X1 << 12;
1080
1081 mtdcri(SDR0, port->sdr_base + PESDRn_DLPSET, val);
1082 mtdcri(SDR0, port->sdr_base + PESDRn_UTLSET1, 0x00000000);
1083 mtdcri(SDR0, port->sdr_base + PESDRn_UTLSET2, 0x01010000);
1084
1085 mtdcri(SDR0, PESDR0_460EX_L0CDRCTL, 0x00003230);
1086 mtdcri(SDR0, PESDR0_460EX_L0DRV, 0x00000130);
1087 mtdcri(SDR0, PESDR0_460EX_L0CLK, 0x00000006);
1088
1089 mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x10000000);
1090 mdelay(50);
1091 mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x30000000);
1092
1093 mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET,
1094 mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET) |
1095 (PESDRx_RCSSET_RSTGU | PESDRx_RCSSET_RSTPYN));
1096
1097 /* Poll for PHY reset */
1098 val = PESDR0_460EX_RSTSTA - port->sdr_base;
1099 if (ppc4xx_pciex_wait_on_sdr(port, val, 0x1, 1, 100)) {
1100 printk(KERN_WARNING "%s: PCIE: Can't reset PHY\n", __func__);
1101 return -EBUSY;
1102 } else {
1103 mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET,
1104 (mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET) &
1105 ~(PESDRx_RCSSET_RSTGU | PESDRx_RCSSET_RSTDL)) |
1106 PESDRx_RCSSET_RSTPYN);
1107
1108 port->has_ibpre = 1;
1109 return 0;
1110 }
1111}
1112
1113static struct ppc4xx_pciex_hwops apm821xx_pcie_hwops __initdata = {
1114 .want_sdr = true,
1115 .core_init = apm821xx_pciex_core_init,
1116 .port_init_hw = apm821xx_pciex_init_port_hw,
1117 .setup_utl = ppc460ex_pciex_init_utl,
1118 .check_link = ppc4xx_pciex_check_link_sdr,
1119};
1120
1053static int __init ppc460sx_pciex_core_init(struct device_node *np) 1121static int __init ppc460sx_pciex_core_init(struct device_node *np)
1054{ 1122{
1055 /* HSS drive amplitude */ 1123 /* HSS drive amplitude */
@@ -1362,6 +1430,8 @@ static int __init ppc4xx_pciex_check_core_init(struct device_node *np)
1362 ppc4xx_pciex_hwops = &ppc460ex_pcie_hwops; 1430 ppc4xx_pciex_hwops = &ppc460ex_pcie_hwops;
1363 if (of_device_is_compatible(np, "ibm,plb-pciex-460sx")) 1431 if (of_device_is_compatible(np, "ibm,plb-pciex-460sx"))
1364 ppc4xx_pciex_hwops = &ppc460sx_pcie_hwops; 1432 ppc4xx_pciex_hwops = &ppc460sx_pcie_hwops;
1433 if (of_device_is_compatible(np, "ibm,plb-pciex-apm821xx"))
1434 ppc4xx_pciex_hwops = &apm821xx_pcie_hwops;
1365#endif /* CONFIG_44x */ 1435#endif /* CONFIG_44x */
1366#ifdef CONFIG_40x 1436#ifdef CONFIG_40x
1367 if (of_device_is_compatible(np, "ibm,plb-pciex-405ex")) 1437 if (of_device_is_compatible(np, "ibm,plb-pciex-405ex"))
diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c
index af3780e52e7..6845e91ba04 100644
--- a/arch/powerpc/xmon/ppc-opc.c
+++ b/arch/powerpc/xmon/ppc-opc.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/stddef.h> 23#include <linux/stddef.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/bug.h>
25#include "nonstdio.h" 26#include "nonstdio.h"
26#include "ppc.h" 27#include "ppc.h"
27 28
diff --git a/arch/powerpc/xmon/spu-opc.c b/arch/powerpc/xmon/spu-opc.c
index 530df3d6d7b..7d37597c4bc 100644
--- a/arch/powerpc/xmon/spu-opc.c
+++ b/arch/powerpc/xmon/spu-opc.c
@@ -19,6 +19,7 @@
19 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 19 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/bug.h>
22#include "spu.h" 23#include "spu.h"
23 24
24/* This file holds the Spu opcode table */ 25/* This file holds the Spu opcode table */
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index cb95eea74d3..68a9cbbab45 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -39,7 +39,6 @@
39#include <asm/irq_regs.h> 39#include <asm/irq_regs.h>
40#include <asm/spu.h> 40#include <asm/spu.h>
41#include <asm/spu_priv1.h> 41#include <asm/spu_priv1.h>
42#include <asm/firmware.h>
43#include <asm/setjmp.h> 42#include <asm/setjmp.h>
44#include <asm/reg.h> 43#include <asm/reg.h>
45 44
@@ -1437,7 +1436,8 @@ static void excprint(struct pt_regs *fp)
1437 1436
1438 printf(" current = 0x%lx\n", current); 1437 printf(" current = 0x%lx\n", current);
1439#ifdef CONFIG_PPC64 1438#ifdef CONFIG_PPC64
1440 printf(" paca = 0x%lx\n", get_paca()); 1439 printf(" paca = 0x%lx\t softe: %d\t irq_happened: 0x%02x\n",
1440 local_paca, local_paca->soft_enabled, local_paca->irq_happened);
1441#endif 1441#endif
1442 if (current) { 1442 if (current) {
1443 printf(" pid = %ld, comm = %s\n", 1443 printf(" pid = %ld, comm = %s\n",
@@ -1634,25 +1634,6 @@ static void super_regs(void)
1634 mfspr(SPRN_DEC), mfspr(SPRN_SPRG2)); 1634 mfspr(SPRN_DEC), mfspr(SPRN_SPRG2));
1635 printf("sp = "REG" sprg3= "REG"\n", sp, mfspr(SPRN_SPRG3)); 1635 printf("sp = "REG" sprg3= "REG"\n", sp, mfspr(SPRN_SPRG3));
1636 printf("toc = "REG" dar = "REG"\n", toc, mfspr(SPRN_DAR)); 1636 printf("toc = "REG" dar = "REG"\n", toc, mfspr(SPRN_DAR));
1637#ifdef CONFIG_PPC_ISERIES
1638 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
1639 struct paca_struct *ptrPaca;
1640 struct lppaca *ptrLpPaca;
1641
1642 /* Dump out relevant Paca data areas. */
1643 printf("Paca: \n");
1644 ptrPaca = get_paca();
1645
1646 printf(" Local Processor Control Area (LpPaca): \n");
1647 ptrLpPaca = ptrPaca->lppaca_ptr;
1648 printf(" Saved Srr0=%.16lx Saved Srr1=%.16lx \n",
1649 ptrLpPaca->saved_srr0, ptrLpPaca->saved_srr1);
1650 printf(" Saved Gpr3=%.16lx Saved Gpr4=%.16lx \n",
1651 ptrLpPaca->saved_gpr3, ptrLpPaca->saved_gpr4);
1652 printf(" Saved Gpr5=%.16lx \n",
1653 ptrLpPaca->gpr5_dword.saved_gpr5);
1654 }
1655#endif
1656 1637
1657 return; 1638 return;
1658 } 1639 }
@@ -2644,7 +2625,7 @@ static void dump_slb(void)
2644static void dump_stab(void) 2625static void dump_stab(void)
2645{ 2626{
2646 int i; 2627 int i;
2647 unsigned long *tmp = (unsigned long *)get_paca()->stab_addr; 2628 unsigned long *tmp = (unsigned long *)local_paca->stab_addr;
2648 2629
2649 printf("Segment table contents of cpu %x\n", smp_processor_id()); 2630 printf("Segment table contents of cpu %x\n", smp_processor_id());
2650 2631
@@ -2855,10 +2836,6 @@ static void dump_tlb_book3e(void)
2855 2836
2856static void xmon_init(int enable) 2837static void xmon_init(int enable)
2857{ 2838{
2858#ifdef CONFIG_PPC_ISERIES
2859 if (firmware_has_feature(FW_FEATURE_ISERIES))
2860 return;
2861#endif
2862 if (enable) { 2839 if (enable) {
2863 __debugger = xmon; 2840 __debugger = xmon;
2864 __debugger_ipi = xmon_ipi; 2841 __debugger_ipi = xmon_ipi;
@@ -2895,10 +2872,6 @@ static struct sysrq_key_op sysrq_xmon_op = {
2895 2872
2896static int __init setup_xmon_sysrq(void) 2873static int __init setup_xmon_sysrq(void)
2897{ 2874{
2898#ifdef CONFIG_PPC_ISERIES
2899 if (firmware_has_feature(FW_FEATURE_ISERIES))
2900 return 0;
2901#endif
2902 register_sysrq_key('x', &sysrq_xmon_op); 2875 register_sysrq_key('x', &sysrq_xmon_op);
2903 return 0; 2876 return 0;
2904} 2877}
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 8a2a887478c..6a2cb560e96 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -293,11 +293,9 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
293 return -ENOMEM; 293 return -ENOMEM;
294 root_inode->i_op = &simple_dir_inode_operations; 294 root_inode->i_op = &simple_dir_inode_operations;
295 root_inode->i_fop = &simple_dir_operations; 295 root_inode->i_fop = &simple_dir_operations;
296 sb->s_root = root_dentry = d_alloc_root(root_inode); 296 sb->s_root = root_dentry = d_make_root(root_inode);
297 if (!root_dentry) { 297 if (!root_dentry)
298 iput(root_inode);
299 return -ENOMEM; 298 return -ENOMEM;
300 }
301 if (MACHINE_IS_VM) 299 if (MACHINE_IS_VM)
302 rc = hypfs_vm_create_files(sb, root_dentry); 300 rc = hypfs_vm_create_files(sb, root_dentry);
303 else 301 else
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index c23c3900c30..24ef186a1c4 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -170,24 +170,17 @@ struct s390_idle_data {
170 unsigned int sequence; 170 unsigned int sequence;
171 unsigned long long idle_count; 171 unsigned long long idle_count;
172 unsigned long long idle_enter; 172 unsigned long long idle_enter;
173 unsigned long long idle_exit;
173 unsigned long long idle_time; 174 unsigned long long idle_time;
174 int nohz_delay; 175 int nohz_delay;
175}; 176};
176 177
177DECLARE_PER_CPU(struct s390_idle_data, s390_idle); 178DECLARE_PER_CPU(struct s390_idle_data, s390_idle);
178 179
179void vtime_start_cpu(__u64 int_clock, __u64 enter_timer);
180cputime64_t s390_get_idle_time(int cpu); 180cputime64_t s390_get_idle_time(int cpu);
181 181
182#define arch_idle_time(cpu) s390_get_idle_time(cpu) 182#define arch_idle_time(cpu) s390_get_idle_time(cpu)
183 183
184static inline void s390_idle_check(struct pt_regs *regs, __u64 int_clock,
185 __u64 enter_timer)
186{
187 if (regs->psw.mask & PSW_MASK_WAIT)
188 vtime_start_cpu(int_clock, enter_timer);
189}
190
191static inline int s390_nohz_delay(int cpu) 184static inline int s390_nohz_delay(int cpu)
192{ 185{
193 return __get_cpu_var(s390_idle).nohz_delay != 0; 186 return __get_cpu_var(s390_idle).nohz_delay != 0;
diff --git a/arch/s390/include/asm/debug.h b/arch/s390/include/asm/debug.h
index 9d88db1f55d..8a8245ed14d 100644
--- a/arch/s390/include/asm/debug.h
+++ b/arch/s390/include/asm/debug.h
@@ -131,6 +131,7 @@ void debug_unregister(debug_info_t* id);
131 131
132void debug_set_level(debug_info_t* id, int new_level); 132void debug_set_level(debug_info_t* id, int new_level);
133 133
134void debug_set_critical(void);
134void debug_stop_all(void); 135void debug_stop_all(void);
135 136
136static inline debug_entry_t* 137static inline debug_entry_t*
diff --git a/arch/s390/include/asm/hardirq.h b/arch/s390/include/asm/hardirq.h
index e4155d3eb2c..510ba9ef424 100644
--- a/arch/s390/include/asm/hardirq.h
+++ b/arch/s390/include/asm/hardirq.h
@@ -18,6 +18,7 @@
18 18
19#define __ARCH_IRQ_STAT 19#define __ARCH_IRQ_STAT
20#define __ARCH_HAS_DO_SOFTIRQ 20#define __ARCH_HAS_DO_SOFTIRQ
21#define __ARCH_IRQ_EXIT_IRQS_DISABLED
21 22
22#define HARDIRQ_BITS 8 23#define HARDIRQ_BITS 8
23 24
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
index 6940abfbe1d..2bd6cb897b9 100644
--- a/arch/s390/include/asm/ipl.h
+++ b/arch/s390/include/asm/ipl.h
@@ -169,5 +169,6 @@ enum diag308_rc {
169extern int diag308(unsigned long subcode, void *addr); 169extern int diag308(unsigned long subcode, void *addr);
170extern void diag308_reset(void); 170extern void diag308_reset(void);
171extern void store_status(void); 171extern void store_status(void);
172extern void lgr_info_log(void);
172 173
173#endif /* _ASM_S390_IPL_H */ 174#endif /* _ASM_S390_IPL_H */
diff --git a/arch/s390/include/asm/irq.h b/arch/s390/include/asm/irq.h
index ba6d85f88d5..acee1806f61 100644
--- a/arch/s390/include/asm/irq.h
+++ b/arch/s390/include/asm/irq.h
@@ -34,7 +34,12 @@ enum interruption_class {
34 NR_IRQS, 34 NR_IRQS,
35}; 35};
36 36
37typedef void (*ext_int_handler_t)(unsigned int, unsigned int, unsigned long); 37struct ext_code {
38 unsigned short subcode;
39 unsigned short code;
40};
41
42typedef void (*ext_int_handler_t)(struct ext_code, unsigned int, unsigned long);
38 43
39int register_external_interrupt(u16 code, ext_int_handler_t handler); 44int register_external_interrupt(u16 code, ext_int_handler_t handler);
40int unregister_external_interrupt(u16 code, ext_int_handler_t handler); 45int unregister_external_interrupt(u16 code, ext_int_handler_t handler);
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
index 707f2306725..47853debb3b 100644
--- a/arch/s390/include/asm/lowcore.h
+++ b/arch/s390/include/asm/lowcore.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright IBM Corp. 1999,2010 2 * Copyright IBM Corp. 1999,2012
3 * Author(s): Hartmut Penner <hp@de.ibm.com>, 3 * Author(s): Hartmut Penner <hp@de.ibm.com>,
4 * Martin Schwidefsky <schwidefsky@de.ibm.com>, 4 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
5 * Denis Joseph Barrow, 5 * Denis Joseph Barrow,
@@ -12,14 +12,6 @@
12#include <asm/ptrace.h> 12#include <asm/ptrace.h>
13#include <asm/cpu.h> 13#include <asm/cpu.h>
14 14
15void restart_int_handler(void);
16void ext_int_handler(void);
17void system_call(void);
18void pgm_check_handler(void);
19void mcck_int_handler(void);
20void io_int_handler(void);
21void psw_restart_int_handler(void);
22
23#ifdef CONFIG_32BIT 15#ifdef CONFIG_32BIT
24 16
25#define LC_ORDER 0 17#define LC_ORDER 0
@@ -56,7 +48,7 @@ struct _lowcore {
56 psw_t mcck_new_psw; /* 0x0070 */ 48 psw_t mcck_new_psw; /* 0x0070 */
57 psw_t io_new_psw; /* 0x0078 */ 49 psw_t io_new_psw; /* 0x0078 */
58 __u32 ext_params; /* 0x0080 */ 50 __u32 ext_params; /* 0x0080 */
59 __u16 cpu_addr; /* 0x0084 */ 51 __u16 ext_cpu_addr; /* 0x0084 */
60 __u16 ext_int_code; /* 0x0086 */ 52 __u16 ext_int_code; /* 0x0086 */
61 __u16 svc_ilc; /* 0x0088 */ 53 __u16 svc_ilc; /* 0x0088 */
62 __u16 svc_code; /* 0x008a */ 54 __u16 svc_code; /* 0x008a */
@@ -117,32 +109,37 @@ struct _lowcore {
117 __u64 steal_timer; /* 0x0288 */ 109 __u64 steal_timer; /* 0x0288 */
118 __u64 last_update_timer; /* 0x0290 */ 110 __u64 last_update_timer; /* 0x0290 */
119 __u64 last_update_clock; /* 0x0298 */ 111 __u64 last_update_clock; /* 0x0298 */
112 __u64 int_clock; /* 0x02a0 */
113 __u64 mcck_clock; /* 0x02a8 */
114 __u64 clock_comparator; /* 0x02b0 */
120 115
121 /* Current process. */ 116 /* Current process. */
122 __u32 current_task; /* 0x02a0 */ 117 __u32 current_task; /* 0x02b8 */
123 __u32 thread_info; /* 0x02a4 */ 118 __u32 thread_info; /* 0x02bc */
124 __u32 kernel_stack; /* 0x02a8 */ 119 __u32 kernel_stack; /* 0x02c0 */
120
121 /* Interrupt, panic and restart stack. */
122 __u32 async_stack; /* 0x02c4 */
123 __u32 panic_stack; /* 0x02c8 */
124 __u32 restart_stack; /* 0x02cc */
125 125
126 /* Interrupt and panic stack. */ 126 /* Restart function and parameter. */
127 __u32 async_stack; /* 0x02ac */ 127 __u32 restart_fn; /* 0x02d0 */
128 __u32 panic_stack; /* 0x02b0 */ 128 __u32 restart_data; /* 0x02d4 */
129 __u32 restart_source; /* 0x02d8 */
129 130
130 /* Address space pointer. */ 131 /* Address space pointer. */
131 __u32 kernel_asce; /* 0x02b4 */ 132 __u32 kernel_asce; /* 0x02dc */
132 __u32 user_asce; /* 0x02b8 */ 133 __u32 user_asce; /* 0x02e0 */
133 __u32 current_pid; /* 0x02bc */ 134 __u32 current_pid; /* 0x02e4 */
134 135
135 /* SMP info area */ 136 /* SMP info area */
136 __u32 cpu_nr; /* 0x02c0 */ 137 __u32 cpu_nr; /* 0x02e8 */
137 __u32 softirq_pending; /* 0x02c4 */ 138 __u32 softirq_pending; /* 0x02ec */
138 __u32 percpu_offset; /* 0x02c8 */ 139 __u32 percpu_offset; /* 0x02f0 */
139 __u32 ext_call_fast; /* 0x02cc */ 140 __u32 machine_flags; /* 0x02f4 */
140 __u64 int_clock; /* 0x02d0 */ 141 __u32 ftrace_func; /* 0x02f8 */
141 __u64 mcck_clock; /* 0x02d8 */ 142 __u8 pad_0x02fc[0x0300-0x02fc]; /* 0x02fc */
142 __u64 clock_comparator; /* 0x02e0 */
143 __u32 machine_flags; /* 0x02e8 */
144 __u32 ftrace_func; /* 0x02ec */
145 __u8 pad_0x02f8[0x0300-0x02f0]; /* 0x02f0 */
146 143
147 /* Interrupt response block */ 144 /* Interrupt response block */
148 __u8 irb[64]; /* 0x0300 */ 145 __u8 irb[64]; /* 0x0300 */
@@ -157,7 +154,9 @@ struct _lowcore {
157 __u32 ipib; /* 0x0e00 */ 154 __u32 ipib; /* 0x0e00 */
158 __u32 ipib_checksum; /* 0x0e04 */ 155 __u32 ipib_checksum; /* 0x0e04 */
159 __u32 vmcore_info; /* 0x0e08 */ 156 __u32 vmcore_info; /* 0x0e08 */
160 __u8 pad_0x0e0c[0x0f00-0x0e0c]; /* 0x0e0c */ 157 __u8 pad_0x0e0c[0x0e18-0x0e0c]; /* 0x0e0c */
158 __u32 os_info; /* 0x0e18 */
159 __u8 pad_0x0e1c[0x0f00-0x0e1c]; /* 0x0e1c */
161 160
162 /* Extended facility list */ 161 /* Extended facility list */
163 __u64 stfle_fac_list[32]; /* 0x0f00 */ 162 __u64 stfle_fac_list[32]; /* 0x0f00 */
@@ -189,7 +188,7 @@ struct _lowcore {
189 __u32 ipl_parmblock_ptr; /* 0x0014 */ 188 __u32 ipl_parmblock_ptr; /* 0x0014 */
190 __u8 pad_0x0018[0x0080-0x0018]; /* 0x0018 */ 189 __u8 pad_0x0018[0x0080-0x0018]; /* 0x0018 */
191 __u32 ext_params; /* 0x0080 */ 190 __u32 ext_params; /* 0x0080 */
192 __u16 cpu_addr; /* 0x0084 */ 191 __u16 ext_cpu_addr; /* 0x0084 */
193 __u16 ext_int_code; /* 0x0086 */ 192 __u16 ext_int_code; /* 0x0086 */
194 __u16 svc_ilc; /* 0x0088 */ 193 __u16 svc_ilc; /* 0x0088 */
195 __u16 svc_code; /* 0x008a */ 194 __u16 svc_code; /* 0x008a */
@@ -254,34 +253,39 @@ struct _lowcore {
254 __u64 steal_timer; /* 0x02e0 */ 253 __u64 steal_timer; /* 0x02e0 */
255 __u64 last_update_timer; /* 0x02e8 */ 254 __u64 last_update_timer; /* 0x02e8 */
256 __u64 last_update_clock; /* 0x02f0 */ 255 __u64 last_update_clock; /* 0x02f0 */
256 __u64 int_clock; /* 0x02f8 */
257 __u64 mcck_clock; /* 0x0300 */
258 __u64 clock_comparator; /* 0x0308 */
257 259
258 /* Current process. */ 260 /* Current process. */
259 __u64 current_task; /* 0x02f8 */ 261 __u64 current_task; /* 0x0310 */
260 __u64 thread_info; /* 0x0300 */ 262 __u64 thread_info; /* 0x0318 */
261 __u64 kernel_stack; /* 0x0308 */ 263 __u64 kernel_stack; /* 0x0320 */
264
265 /* Interrupt, panic and restart stack. */
266 __u64 async_stack; /* 0x0328 */
267 __u64 panic_stack; /* 0x0330 */
268 __u64 restart_stack; /* 0x0338 */
262 269
263 /* Interrupt and panic stack. */ 270 /* Restart function and parameter. */
264 __u64 async_stack; /* 0x0310 */ 271 __u64 restart_fn; /* 0x0340 */
265 __u64 panic_stack; /* 0x0318 */ 272 __u64 restart_data; /* 0x0348 */
273 __u64 restart_source; /* 0x0350 */
266 274
267 /* Address space pointer. */ 275 /* Address space pointer. */
268 __u64 kernel_asce; /* 0x0320 */ 276 __u64 kernel_asce; /* 0x0358 */
269 __u64 user_asce; /* 0x0328 */ 277 __u64 user_asce; /* 0x0360 */
270 __u64 current_pid; /* 0x0330 */ 278 __u64 current_pid; /* 0x0368 */
271 279
272 /* SMP info area */ 280 /* SMP info area */
273 __u32 cpu_nr; /* 0x0338 */ 281 __u32 cpu_nr; /* 0x0370 */
274 __u32 softirq_pending; /* 0x033c */ 282 __u32 softirq_pending; /* 0x0374 */
275 __u64 percpu_offset; /* 0x0340 */ 283 __u64 percpu_offset; /* 0x0378 */
276 __u64 ext_call_fast; /* 0x0348 */ 284 __u64 vdso_per_cpu_data; /* 0x0380 */
277 __u64 int_clock; /* 0x0350 */ 285 __u64 machine_flags; /* 0x0388 */
278 __u64 mcck_clock; /* 0x0358 */ 286 __u64 ftrace_func; /* 0x0390 */
279 __u64 clock_comparator; /* 0x0360 */ 287 __u64 gmap; /* 0x0398 */
280 __u64 vdso_per_cpu_data; /* 0x0368 */ 288 __u8 pad_0x03a0[0x0400-0x03a0]; /* 0x03a0 */
281 __u64 machine_flags; /* 0x0370 */
282 __u64 ftrace_func; /* 0x0378 */
283 __u64 gmap; /* 0x0380 */
284 __u8 pad_0x0388[0x0400-0x0388]; /* 0x0388 */
285 289
286 /* Interrupt response block. */ 290 /* Interrupt response block. */
287 __u8 irb[64]; /* 0x0400 */ 291 __u8 irb[64]; /* 0x0400 */
@@ -298,8 +302,15 @@ struct _lowcore {
298 */ 302 */
299 __u64 ipib; /* 0x0e00 */ 303 __u64 ipib; /* 0x0e00 */
300 __u32 ipib_checksum; /* 0x0e08 */ 304 __u32 ipib_checksum; /* 0x0e08 */
301 __u64 vmcore_info; /* 0x0e0c */ 305 /*
302 __u8 pad_0x0e14[0x0f00-0x0e14]; /* 0x0e14 */ 306 * Because the vmcore_info pointer is not 8 byte aligned it never
307 * should not be accessed directly. For accessing the pointer, first
308 * copy it to a local pointer variable.
309 */
310 __u8 vmcore_info[8]; /* 0x0e0c */
311 __u8 pad_0x0e14[0x0e18-0x0e14]; /* 0x0e14 */
312 __u64 os_info; /* 0x0e18 */
313 __u8 pad_0x0e20[0x0f00-0x0e20]; /* 0x0e20 */
303 314
304 /* Extended facility list */ 315 /* Extended facility list */
305 __u64 stfle_fac_list[32]; /* 0x0f00 */ 316 __u64 stfle_fac_list[32]; /* 0x0f00 */
diff --git a/arch/s390/include/asm/os_info.h b/arch/s390/include/asm/os_info.h
new file mode 100644
index 00000000000..d07518af09e
--- /dev/null
+++ b/arch/s390/include/asm/os_info.h
@@ -0,0 +1,50 @@
1/*
2 * OS info memory interface
3 *
4 * Copyright IBM Corp. 2012
5 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
6 */
7#ifndef _ASM_S390_OS_INFO_H
8#define _ASM_S390_OS_INFO_H
9
10#define OS_INFO_VERSION_MAJOR 1
11#define OS_INFO_VERSION_MINOR 1
12#define OS_INFO_MAGIC 0x4f53494e464f535aULL /* OSINFOSZ */
13
14#define OS_INFO_VMCOREINFO 0
15#define OS_INFO_REIPL_BLOCK 1
16#define OS_INFO_INIT_FN 2
17
18struct os_info_entry {
19 u64 addr;
20 u64 size;
21 u32 csum;
22} __packed;
23
24struct os_info {
25 u64 magic;
26 u32 csum;
27 u16 version_major;
28 u16 version_minor;
29 u64 crashkernel_addr;
30 u64 crashkernel_size;
31 struct os_info_entry entry[3];
32 u8 reserved[4004];
33} __packed;
34
35void os_info_init(void);
36void os_info_entry_add(int nr, void *ptr, u64 len);
37void os_info_crashkernel_add(unsigned long base, unsigned long size);
38u32 os_info_csum(struct os_info *os_info);
39
40#ifdef CONFIG_CRASH_DUMP
41void *os_info_old_entry(int nr, unsigned long *size);
42int copy_from_oldmem(void *dest, void *src, size_t count);
43#else
44static inline void *os_info_old_entry(int nr, unsigned long *size)
45{
46 return NULL;
47}
48#endif
49
50#endif /* _ASM_S390_OS_INFO_H */
diff --git a/arch/s390/include/asm/sigp.h b/arch/s390/include/asm/sigp.h
deleted file mode 100644
index 7040b8567cd..00000000000
--- a/arch/s390/include/asm/sigp.h
+++ /dev/null
@@ -1,132 +0,0 @@
1/*
2 * Routines and structures for signalling other processors.
3 *
4 * Copyright IBM Corp. 1999,2010
5 * Author(s): Denis Joseph Barrow,
6 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
7 * Heiko Carstens <heiko.carstens@de.ibm.com>,
8 */
9
10#ifndef __ASM_SIGP_H
11#define __ASM_SIGP_H
12
13#include <asm/system.h>
14
15/* Get real cpu address from logical cpu number. */
16extern unsigned short __cpu_logical_map[];
17
18static inline int cpu_logical_map(int cpu)
19{
20#ifdef CONFIG_SMP
21 return __cpu_logical_map[cpu];
22#else
23 return stap();
24#endif
25}
26
27enum {
28 sigp_sense = 1,
29 sigp_external_call = 2,
30 sigp_emergency_signal = 3,
31 sigp_start = 4,
32 sigp_stop = 5,
33 sigp_restart = 6,
34 sigp_stop_and_store_status = 9,
35 sigp_initial_cpu_reset = 11,
36 sigp_cpu_reset = 12,
37 sigp_set_prefix = 13,
38 sigp_store_status_at_address = 14,
39 sigp_store_extended_status_at_address = 15,
40 sigp_set_architecture = 18,
41 sigp_conditional_emergency_signal = 19,
42 sigp_sense_running = 21,
43};
44
45enum {
46 sigp_order_code_accepted = 0,
47 sigp_status_stored = 1,
48 sigp_busy = 2,
49 sigp_not_operational = 3,
50};
51
52/*
53 * Definitions for external call.
54 */
55enum {
56 ec_schedule = 0,
57 ec_call_function,
58 ec_call_function_single,
59 ec_stop_cpu,
60};
61
62/*
63 * Signal processor.
64 */
65static inline int raw_sigp(u16 cpu, int order)
66{
67 register unsigned long reg1 asm ("1") = 0;
68 int ccode;
69
70 asm volatile(
71 " sigp %1,%2,0(%3)\n"
72 " ipm %0\n"
73 " srl %0,28\n"
74 : "=d" (ccode)
75 : "d" (reg1), "d" (cpu),
76 "a" (order) : "cc" , "memory");
77 return ccode;
78}
79
80/*
81 * Signal processor with parameter.
82 */
83static inline int raw_sigp_p(u32 parameter, u16 cpu, int order)
84{
85 register unsigned int reg1 asm ("1") = parameter;
86 int ccode;
87
88 asm volatile(
89 " sigp %1,%2,0(%3)\n"
90 " ipm %0\n"
91 " srl %0,28\n"
92 : "=d" (ccode)
93 : "d" (reg1), "d" (cpu),
94 "a" (order) : "cc" , "memory");
95 return ccode;
96}
97
98/*
99 * Signal processor with parameter and return status.
100 */
101static inline int raw_sigp_ps(u32 *status, u32 parm, u16 cpu, int order)
102{
103 register unsigned int reg1 asm ("1") = parm;
104 int ccode;
105
106 asm volatile(
107 " sigp %1,%2,0(%3)\n"
108 " ipm %0\n"
109 " srl %0,28\n"
110 : "=d" (ccode), "+d" (reg1)
111 : "d" (cpu), "a" (order)
112 : "cc" , "memory");
113 *status = reg1;
114 return ccode;
115}
116
117static inline int sigp(int cpu, int order)
118{
119 return raw_sigp(cpu_logical_map(cpu), order);
120}
121
122static inline int sigp_p(u32 parameter, int cpu, int order)
123{
124 return raw_sigp_p(parameter, cpu_logical_map(cpu), order);
125}
126
127static inline int sigp_ps(u32 *status, u32 parm, int cpu, int order)
128{
129 return raw_sigp_ps(status, parm, cpu_logical_map(cpu), order);
130}
131
132#endif /* __ASM_SIGP_H */
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h
index c32e9123b40..797f7872968 100644
--- a/arch/s390/include/asm/smp.h
+++ b/arch/s390/include/asm/smp.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright IBM Corp. 1999,2009 2 * Copyright IBM Corp. 1999,2012
3 * Author(s): Denis Joseph Barrow, 3 * Author(s): Denis Joseph Barrow,
4 * Martin Schwidefsky <schwidefsky@de.ibm.com>, 4 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
5 * Heiko Carstens <heiko.carstens@de.ibm.com>, 5 * Heiko Carstens <heiko.carstens@de.ibm.com>,
@@ -10,71 +10,52 @@
10#ifdef CONFIG_SMP 10#ifdef CONFIG_SMP
11 11
12#include <asm/system.h> 12#include <asm/system.h>
13#include <asm/sigp.h>
14
15extern void machine_restart_smp(char *);
16extern void machine_halt_smp(void);
17extern void machine_power_off_smp(void);
18 13
19#define raw_smp_processor_id() (S390_lowcore.cpu_nr) 14#define raw_smp_processor_id() (S390_lowcore.cpu_nr)
20 15
21extern int __cpu_disable (void);
22extern void __cpu_die (unsigned int cpu);
23extern int __cpu_up (unsigned int cpu);
24
25extern struct mutex smp_cpu_state_mutex; 16extern struct mutex smp_cpu_state_mutex;
17extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
18
19extern int __cpu_up(unsigned int cpu);
26 20
27extern void arch_send_call_function_single_ipi(int cpu); 21extern void arch_send_call_function_single_ipi(int cpu);
28extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 22extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
29 23
30extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1]; 24extern void smp_call_online_cpu(void (*func)(void *), void *);
31 25extern void smp_call_ipl_cpu(void (*func)(void *), void *);
32extern void smp_switch_to_ipl_cpu(void (*func)(void *), void *);
33extern void smp_switch_to_cpu(void (*)(void *), void *, unsigned long sp,
34 int from, int to);
35extern void smp_restart_with_online_cpu(void);
36extern void smp_restart_cpu(void);
37 26
38/* 27extern int smp_find_processor_id(u16 address);
39 * returns 1 if (virtual) cpu is scheduled 28extern int smp_store_status(int cpu);
40 * returns 0 otherwise 29extern int smp_vcpu_scheduled(int cpu);
41 */ 30extern void smp_yield_cpu(int cpu);
42static inline int smp_vcpu_scheduled(int cpu) 31extern void smp_yield(void);
43{ 32extern void smp_stop_cpu(void);
44 u32 status;
45
46 switch (sigp_ps(&status, 0, cpu, sigp_sense_running)) {
47 case sigp_status_stored:
48 /* Check for running status */
49 if (status & 0x400)
50 return 0;
51 break;
52 case sigp_not_operational:
53 return 0;
54 default:
55 break;
56 }
57 return 1;
58}
59 33
60#else /* CONFIG_SMP */ 34#else /* CONFIG_SMP */
61 35
62static inline void smp_switch_to_ipl_cpu(void (*func)(void *), void *data) 36static inline void smp_call_ipl_cpu(void (*func)(void *), void *data)
63{ 37{
64 func(data); 38 func(data);
65} 39}
66 40
67static inline void smp_restart_with_online_cpu(void) 41static inline void smp_call_online_cpu(void (*func)(void *), void *data)
68{ 42{
43 func(data);
69} 44}
70 45
71#define smp_vcpu_scheduled (1) 46static inline int smp_find_processor_id(int address) { return 0; }
47static inline int smp_vcpu_scheduled(int cpu) { return 1; }
48static inline void smp_yield_cpu(int cpu) { }
49static inline void smp_yield(void) { }
50static inline void smp_stop_cpu(void) { }
72 51
73#endif /* CONFIG_SMP */ 52#endif /* CONFIG_SMP */
74 53
75#ifdef CONFIG_HOTPLUG_CPU 54#ifdef CONFIG_HOTPLUG_CPU
76extern int smp_rescan_cpus(void); 55extern int smp_rescan_cpus(void);
77extern void __noreturn cpu_die(void); 56extern void __noreturn cpu_die(void);
57extern void __cpu_die(unsigned int cpu);
58extern int __cpu_disable(void);
78#else 59#else
79static inline int smp_rescan_cpus(void) { return 0; } 60static inline int smp_rescan_cpus(void) { return 0; }
80static inline void cpu_die(void) { } 61static inline void cpu_die(void) { }
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h
index d73cc6b6000..2e0bb7f0f9b 100644
--- a/arch/s390/include/asm/system.h
+++ b/arch/s390/include/asm/system.h
@@ -7,8 +7,10 @@
7#ifndef __ASM_SYSTEM_H 7#ifndef __ASM_SYSTEM_H
8#define __ASM_SYSTEM_H 8#define __ASM_SYSTEM_H
9 9
10#include <linux/preempt.h>
10#include <linux/kernel.h> 11#include <linux/kernel.h>
11#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/string.h>
12#include <asm/types.h> 14#include <asm/types.h>
13#include <asm/ptrace.h> 15#include <asm/ptrace.h>
14#include <asm/setup.h> 16#include <asm/setup.h>
@@ -248,6 +250,38 @@ static inline int test_facility(unsigned long nr)
248 return (*ptr & (0x80 >> (nr & 7))) != 0; 250 return (*ptr & (0x80 >> (nr & 7))) != 0;
249} 251}
250 252
253/**
254 * stfle - Store facility list extended
255 * @stfle_fac_list: array where facility list can be stored
256 * @size: size of passed in array in double words
257 */
258static inline void stfle(u64 *stfle_fac_list, int size)
259{
260 unsigned long nr;
261
262 preempt_disable();
263 S390_lowcore.stfl_fac_list = 0;
264 asm volatile(
265 " .insn s,0xb2b10000,0(0)\n" /* stfl */
266 "0:\n"
267 EX_TABLE(0b, 0b)
268 : "=m" (S390_lowcore.stfl_fac_list));
269 nr = 4; /* bytes stored by stfl */
270 memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
271 if (S390_lowcore.stfl_fac_list & 0x01000000) {
272 /* More facility bits available with stfle */
273 register unsigned long reg0 asm("0") = size - 1;
274
275 asm volatile(".insn s,0xb2b00000,0(%1)" /* stfle */
276 : "+d" (reg0)
277 : "a" (stfle_fac_list)
278 : "memory", "cc");
279 nr = (reg0 + 1) * 8; /* # bytes stored by stfle */
280 }
281 memset((char *) stfle_fac_list + nr, 0, size * 8 - nr);
282 preempt_enable();
283}
284
251static inline unsigned short stap(void) 285static inline unsigned short stap(void)
252{ 286{
253 unsigned short cpu_address; 287 unsigned short cpu_address;
diff --git a/arch/s390/include/asm/timer.h b/arch/s390/include/asm/timer.h
index 814243cafdf..e63069ba39e 100644
--- a/arch/s390/include/asm/timer.h
+++ b/arch/s390/include/asm/timer.h
@@ -33,8 +33,8 @@ struct vtimer_queue {
33 spinlock_t lock; 33 spinlock_t lock;
34 __u64 timer; /* last programmed timer */ 34 __u64 timer; /* last programmed timer */
35 __u64 elapsed; /* elapsed time of timer expire values */ 35 __u64 elapsed; /* elapsed time of timer expire values */
36 __u64 idle; /* temp var for idle */ 36 __u64 idle_enter; /* cpu timer on idle enter */
37 int do_spt; /* =1: reprogram cpu timer in idle */ 37 __u64 idle_exit; /* cpu timer on idle exit */
38}; 38};
39 39
40extern void init_virt_timer(struct vtimer_list *timer); 40extern void init_virt_timer(struct vtimer_list *timer);
diff --git a/arch/s390/include/asm/vdso.h b/arch/s390/include/asm/vdso.h
index 533f35751ae..c4a11cfad3c 100644
--- a/arch/s390/include/asm/vdso.h
+++ b/arch/s390/include/asm/vdso.h
@@ -40,8 +40,8 @@ struct vdso_per_cpu_data {
40extern struct vdso_data *vdso_data; 40extern struct vdso_data *vdso_data;
41 41
42#ifdef CONFIG_64BIT 42#ifdef CONFIG_64BIT
43int vdso_alloc_per_cpu(int cpu, struct _lowcore *lowcore); 43int vdso_alloc_per_cpu(struct _lowcore *lowcore);
44void vdso_free_per_cpu(int cpu, struct _lowcore *lowcore); 44void vdso_free_per_cpu(struct _lowcore *lowcore);
45#endif 45#endif
46 46
47#endif /* __ASSEMBLY__ */ 47#endif /* __ASSEMBLY__ */
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 7d9ec924e7e..16b0b433f1f 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 26 sysinfo.o jump_label.o lgr.o os_info.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)
@@ -34,8 +34,6 @@ extra-y += $(if $(CONFIG_64BIT),head64.o,head31.o)
34obj-$(CONFIG_MODULES) += s390_ksyms.o module.o 34obj-$(CONFIG_MODULES) += s390_ksyms.o module.o
35obj-$(CONFIG_SMP) += smp.o 35obj-$(CONFIG_SMP) += smp.o
36obj-$(CONFIG_SCHED_BOOK) += topology.o 36obj-$(CONFIG_SCHED_BOOK) += topology.o
37obj-$(CONFIG_SMP) += $(if $(CONFIG_64BIT),switch_cpu64.o, \
38 switch_cpu.o)
39obj-$(CONFIG_HIBERNATION) += suspend.o swsusp_asm64.o 37obj-$(CONFIG_HIBERNATION) += suspend.o swsusp_asm64.o
40obj-$(CONFIG_AUDIT) += audit.o 38obj-$(CONFIG_AUDIT) += audit.o
41compat-obj-$(CONFIG_AUDIT) += compat_audit.o 39compat-obj-$(CONFIG_AUDIT) += compat_audit.o
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 6e6a72e66d6..ed8c913db79 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -8,9 +8,11 @@
8 8
9#include <linux/kbuild.h> 9#include <linux/kbuild.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <asm/cputime.h>
12#include <asm/timer.h>
11#include <asm/vdso.h> 13#include <asm/vdso.h>
12#include <asm/sigp.h>
13#include <asm/pgtable.h> 14#include <asm/pgtable.h>
15#include <asm/system.h>
14 16
15/* 17/*
16 * Make sure that the compiler is new enough. We want a compiler that 18 * Make sure that the compiler is new enough. We want a compiler that
@@ -70,15 +72,15 @@ int main(void)
70 DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC); 72 DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC);
71 DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); 73 DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
72 BLANK(); 74 BLANK();
73 /* constants for SIGP */ 75 /* idle data offsets */
74 DEFINE(__SIGP_STOP, sigp_stop); 76 DEFINE(__IDLE_ENTER, offsetof(struct s390_idle_data, idle_enter));
75 DEFINE(__SIGP_RESTART, sigp_restart); 77 DEFINE(__IDLE_EXIT, offsetof(struct s390_idle_data, idle_exit));
76 DEFINE(__SIGP_SENSE, sigp_sense); 78 /* vtimer queue offsets */
77 DEFINE(__SIGP_INITIAL_CPU_RESET, sigp_initial_cpu_reset); 79 DEFINE(__VQ_IDLE_ENTER, offsetof(struct vtimer_queue, idle_enter));
78 BLANK(); 80 DEFINE(__VQ_IDLE_EXIT, offsetof(struct vtimer_queue, idle_exit));
79 /* lowcore offsets */ 81 /* lowcore offsets */
80 DEFINE(__LC_EXT_PARAMS, offsetof(struct _lowcore, ext_params)); 82 DEFINE(__LC_EXT_PARAMS, offsetof(struct _lowcore, ext_params));
81 DEFINE(__LC_CPU_ADDRESS, offsetof(struct _lowcore, cpu_addr)); 83 DEFINE(__LC_EXT_CPU_ADDR, offsetof(struct _lowcore, ext_cpu_addr));
82 DEFINE(__LC_EXT_INT_CODE, offsetof(struct _lowcore, ext_int_code)); 84 DEFINE(__LC_EXT_INT_CODE, offsetof(struct _lowcore, ext_int_code));
83 DEFINE(__LC_SVC_ILC, offsetof(struct _lowcore, svc_ilc)); 85 DEFINE(__LC_SVC_ILC, offsetof(struct _lowcore, svc_ilc));
84 DEFINE(__LC_SVC_INT_CODE, offsetof(struct _lowcore, svc_code)); 86 DEFINE(__LC_SVC_INT_CODE, offsetof(struct _lowcore, svc_code));
@@ -95,20 +97,19 @@ int main(void)
95 DEFINE(__LC_IO_INT_WORD, offsetof(struct _lowcore, io_int_word)); 97 DEFINE(__LC_IO_INT_WORD, offsetof(struct _lowcore, io_int_word));
96 DEFINE(__LC_STFL_FAC_LIST, offsetof(struct _lowcore, stfl_fac_list)); 98 DEFINE(__LC_STFL_FAC_LIST, offsetof(struct _lowcore, stfl_fac_list));
97 DEFINE(__LC_MCCK_CODE, offsetof(struct _lowcore, mcck_interruption_code)); 99 DEFINE(__LC_MCCK_CODE, offsetof(struct _lowcore, mcck_interruption_code));
98 DEFINE(__LC_DUMP_REIPL, offsetof(struct _lowcore, ipib));
99 BLANK();
100 DEFINE(__LC_RST_NEW_PSW, offsetof(struct _lowcore, restart_psw));
101 DEFINE(__LC_RST_OLD_PSW, offsetof(struct _lowcore, restart_old_psw)); 100 DEFINE(__LC_RST_OLD_PSW, offsetof(struct _lowcore, restart_old_psw));
102 DEFINE(__LC_EXT_OLD_PSW, offsetof(struct _lowcore, external_old_psw)); 101 DEFINE(__LC_EXT_OLD_PSW, offsetof(struct _lowcore, external_old_psw));
103 DEFINE(__LC_SVC_OLD_PSW, offsetof(struct _lowcore, svc_old_psw)); 102 DEFINE(__LC_SVC_OLD_PSW, offsetof(struct _lowcore, svc_old_psw));
104 DEFINE(__LC_PGM_OLD_PSW, offsetof(struct _lowcore, program_old_psw)); 103 DEFINE(__LC_PGM_OLD_PSW, offsetof(struct _lowcore, program_old_psw));
105 DEFINE(__LC_MCK_OLD_PSW, offsetof(struct _lowcore, mcck_old_psw)); 104 DEFINE(__LC_MCK_OLD_PSW, offsetof(struct _lowcore, mcck_old_psw));
106 DEFINE(__LC_IO_OLD_PSW, offsetof(struct _lowcore, io_old_psw)); 105 DEFINE(__LC_IO_OLD_PSW, offsetof(struct _lowcore, io_old_psw));
106 DEFINE(__LC_RST_NEW_PSW, offsetof(struct _lowcore, restart_psw));
107 DEFINE(__LC_EXT_NEW_PSW, offsetof(struct _lowcore, external_new_psw)); 107 DEFINE(__LC_EXT_NEW_PSW, offsetof(struct _lowcore, external_new_psw));
108 DEFINE(__LC_SVC_NEW_PSW, offsetof(struct _lowcore, svc_new_psw)); 108 DEFINE(__LC_SVC_NEW_PSW, offsetof(struct _lowcore, svc_new_psw));
109 DEFINE(__LC_PGM_NEW_PSW, offsetof(struct _lowcore, program_new_psw)); 109 DEFINE(__LC_PGM_NEW_PSW, offsetof(struct _lowcore, program_new_psw));
110 DEFINE(__LC_MCK_NEW_PSW, offsetof(struct _lowcore, mcck_new_psw)); 110 DEFINE(__LC_MCK_NEW_PSW, offsetof(struct _lowcore, mcck_new_psw));
111 DEFINE(__LC_IO_NEW_PSW, offsetof(struct _lowcore, io_new_psw)); 111 DEFINE(__LC_IO_NEW_PSW, offsetof(struct _lowcore, io_new_psw));
112 BLANK();
112 DEFINE(__LC_SAVE_AREA_SYNC, offsetof(struct _lowcore, save_area_sync)); 113 DEFINE(__LC_SAVE_AREA_SYNC, offsetof(struct _lowcore, save_area_sync));
113 DEFINE(__LC_SAVE_AREA_ASYNC, offsetof(struct _lowcore, save_area_async)); 114 DEFINE(__LC_SAVE_AREA_ASYNC, offsetof(struct _lowcore, save_area_async));
114 DEFINE(__LC_SAVE_AREA_RESTART, offsetof(struct _lowcore, save_area_restart)); 115 DEFINE(__LC_SAVE_AREA_RESTART, offsetof(struct _lowcore, save_area_restart));
@@ -129,12 +130,16 @@ int main(void)
129 DEFINE(__LC_KERNEL_STACK, offsetof(struct _lowcore, kernel_stack)); 130 DEFINE(__LC_KERNEL_STACK, offsetof(struct _lowcore, kernel_stack));
130 DEFINE(__LC_ASYNC_STACK, offsetof(struct _lowcore, async_stack)); 131 DEFINE(__LC_ASYNC_STACK, offsetof(struct _lowcore, async_stack));
131 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack)); 132 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack));
133 DEFINE(__LC_RESTART_STACK, offsetof(struct _lowcore, restart_stack));
134 DEFINE(__LC_RESTART_FN, offsetof(struct _lowcore, restart_fn));
132 DEFINE(__LC_USER_ASCE, offsetof(struct _lowcore, user_asce)); 135 DEFINE(__LC_USER_ASCE, offsetof(struct _lowcore, user_asce));
133 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock)); 136 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock));
134 DEFINE(__LC_MCCK_CLOCK, offsetof(struct _lowcore, mcck_clock)); 137 DEFINE(__LC_MCCK_CLOCK, offsetof(struct _lowcore, mcck_clock));
135 DEFINE(__LC_MACHINE_FLAGS, offsetof(struct _lowcore, machine_flags)); 138 DEFINE(__LC_MACHINE_FLAGS, offsetof(struct _lowcore, machine_flags));
136 DEFINE(__LC_FTRACE_FUNC, offsetof(struct _lowcore, ftrace_func)); 139 DEFINE(__LC_FTRACE_FUNC, offsetof(struct _lowcore, ftrace_func));
137 DEFINE(__LC_IRB, offsetof(struct _lowcore, irb)); 140 DEFINE(__LC_IRB, offsetof(struct _lowcore, irb));
141 DEFINE(__LC_DUMP_REIPL, offsetof(struct _lowcore, ipib));
142 BLANK();
138 DEFINE(__LC_CPU_TIMER_SAVE_AREA, offsetof(struct _lowcore, cpu_timer_save_area)); 143 DEFINE(__LC_CPU_TIMER_SAVE_AREA, offsetof(struct _lowcore, cpu_timer_save_area));
139 DEFINE(__LC_CLOCK_COMP_SAVE_AREA, offsetof(struct _lowcore, clock_comp_save_area)); 144 DEFINE(__LC_CLOCK_COMP_SAVE_AREA, offsetof(struct _lowcore, clock_comp_save_area));
140 DEFINE(__LC_PSW_SAVE_AREA, offsetof(struct _lowcore, psw_save_area)); 145 DEFINE(__LC_PSW_SAVE_AREA, offsetof(struct _lowcore, psw_save_area));
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 6fe78c2f95d..53a82c8d50e 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -581,7 +581,6 @@ give_sigsegv:
581int handle_signal32(unsigned long sig, struct k_sigaction *ka, 581int handle_signal32(unsigned long sig, struct k_sigaction *ka,
582 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) 582 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
583{ 583{
584 sigset_t blocked;
585 int ret; 584 int ret;
586 585
587 /* Set up the stack frame */ 586 /* Set up the stack frame */
@@ -591,10 +590,7 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
591 ret = setup_frame32(sig, ka, oldset, regs); 590 ret = setup_frame32(sig, ka, oldset, regs);
592 if (ret) 591 if (ret)
593 return ret; 592 return ret;
594 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask); 593 block_sigmask(ka, sig);
595 if (!(ka->sa.sa_flags & SA_NODEFER))
596 sigaddset(&blocked, sig);
597 set_current_blocked(&blocked);
598 return 0; 594 return 0;
599} 595}
600 596
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index c383ce440d9..cc1172b2687 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -14,6 +14,7 @@
14#include <linux/bootmem.h> 14#include <linux/bootmem.h>
15#include <linux/elf.h> 15#include <linux/elf.h>
16#include <asm/ipl.h> 16#include <asm/ipl.h>
17#include <asm/os_info.h>
17 18
18#define PTR_ADD(x, y) (((char *) (x)) + ((unsigned long) (y))) 19#define PTR_ADD(x, y) (((char *) (x)) + ((unsigned long) (y)))
19#define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y))) 20#define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y)))
@@ -51,7 +52,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
51/* 52/*
52 * Copy memory from old kernel 53 * Copy memory from old kernel
53 */ 54 */
54static int copy_from_oldmem(void *dest, void *src, size_t count) 55int copy_from_oldmem(void *dest, void *src, size_t count)
55{ 56{
56 unsigned long copied = 0; 57 unsigned long copied = 0;
57 int rc; 58 int rc;
@@ -224,28 +225,44 @@ static void *nt_prpsinfo(void *ptr)
224} 225}
225 226
226/* 227/*
227 * Initialize vmcoreinfo note (new kernel) 228 * Get vmcoreinfo using lowcore->vmcore_info (new kernel)
228 */ 229 */
229static void *nt_vmcoreinfo(void *ptr) 230static void *get_vmcoreinfo_old(unsigned long *size)
230{ 231{
231 char nt_name[11], *vmcoreinfo; 232 char nt_name[11], *vmcoreinfo;
232 Elf64_Nhdr note; 233 Elf64_Nhdr note;
233 void *addr; 234 void *addr;
234 235
235 if (copy_from_oldmem(&addr, &S390_lowcore.vmcore_info, sizeof(addr))) 236 if (copy_from_oldmem(&addr, &S390_lowcore.vmcore_info, sizeof(addr)))
236 return ptr; 237 return NULL;
237 memset(nt_name, 0, sizeof(nt_name)); 238 memset(nt_name, 0, sizeof(nt_name));
238 if (copy_from_oldmem(&note, addr, sizeof(note))) 239 if (copy_from_oldmem(&note, addr, sizeof(note)))
239 return ptr; 240 return NULL;
240 if (copy_from_oldmem(nt_name, addr + sizeof(note), sizeof(nt_name) - 1)) 241 if (copy_from_oldmem(nt_name, addr + sizeof(note), sizeof(nt_name) - 1))
241 return ptr; 242 return NULL;
242 if (strcmp(nt_name, "VMCOREINFO") != 0) 243 if (strcmp(nt_name, "VMCOREINFO") != 0)
243 return ptr; 244 return NULL;
244 vmcoreinfo = kzalloc_panic(note.n_descsz + 1); 245 vmcoreinfo = kzalloc_panic(note.n_descsz);
245 if (copy_from_oldmem(vmcoreinfo, addr + 24, note.n_descsz)) 246 if (copy_from_oldmem(vmcoreinfo, addr + 24, note.n_descsz))
247 return NULL;
248 *size = note.n_descsz;
249 return vmcoreinfo;
250}
251
252/*
253 * Initialize vmcoreinfo note (new kernel)
254 */
255static void *nt_vmcoreinfo(void *ptr)
256{
257 unsigned long size;
258 void *vmcoreinfo;
259
260 vmcoreinfo = os_info_old_entry(OS_INFO_VMCOREINFO, &size);
261 if (!vmcoreinfo)
262 vmcoreinfo = get_vmcoreinfo_old(&size);
263 if (!vmcoreinfo)
246 return ptr; 264 return ptr;
247 vmcoreinfo[note.n_descsz + 1] = 0; 265 return nt_init(ptr, 0, vmcoreinfo, size, "VMCOREINFO");
248 return nt_init(ptr, 0, vmcoreinfo, note.n_descsz, "VMCOREINFO");
249} 266}
250 267
251/* 268/*
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 6848828b962..19e5e9eba54 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -2,8 +2,8 @@
2 * arch/s390/kernel/debug.c 2 * arch/s390/kernel/debug.c
3 * S/390 debug facility 3 * S/390 debug facility
4 * 4 *
5 * Copyright (C) 1999, 2000 IBM Deutschland Entwicklung GmbH, 5 * Copyright IBM Corp. 1999, 2012
6 * IBM Corporation 6 *
7 * Author(s): Michael Holzheu (holzheu@de.ibm.com), 7 * Author(s): Michael Holzheu (holzheu@de.ibm.com),
8 * Holger Smolinski (Holger.Smolinski@de.ibm.com) 8 * Holger Smolinski (Holger.Smolinski@de.ibm.com)
9 * 9 *
@@ -167,6 +167,7 @@ static debug_info_t *debug_area_last = NULL;
167static DEFINE_MUTEX(debug_mutex); 167static DEFINE_MUTEX(debug_mutex);
168 168
169static int initialized; 169static int initialized;
170static int debug_critical;
170 171
171static const struct file_operations debug_file_ops = { 172static const struct file_operations debug_file_ops = {
172 .owner = THIS_MODULE, 173 .owner = THIS_MODULE,
@@ -932,6 +933,11 @@ debug_stop_all(void)
932} 933}
933 934
934 935
936void debug_set_critical(void)
937{
938 debug_critical = 1;
939}
940
935/* 941/*
936 * debug_event_common: 942 * debug_event_common:
937 * - write debug entry with given size 943 * - write debug entry with given size
@@ -945,7 +951,11 @@ debug_event_common(debug_info_t * id, int level, const void *buf, int len)
945 951
946 if (!debug_active || !id->areas) 952 if (!debug_active || !id->areas)
947 return NULL; 953 return NULL;
948 spin_lock_irqsave(&id->lock, flags); 954 if (debug_critical) {
955 if (!spin_trylock_irqsave(&id->lock, flags))
956 return NULL;
957 } else
958 spin_lock_irqsave(&id->lock, flags);
949 active = get_active_entry(id); 959 active = get_active_entry(id);
950 memset(DEBUG_DATA(active), 0, id->buf_size); 960 memset(DEBUG_DATA(active), 0, id->buf_size);
951 memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size)); 961 memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size));
@@ -968,7 +978,11 @@ debug_entry_t
968 978
969 if (!debug_active || !id->areas) 979 if (!debug_active || !id->areas)
970 return NULL; 980 return NULL;
971 spin_lock_irqsave(&id->lock, flags); 981 if (debug_critical) {
982 if (!spin_trylock_irqsave(&id->lock, flags))
983 return NULL;
984 } else
985 spin_lock_irqsave(&id->lock, flags);
972 active = get_active_entry(id); 986 active = get_active_entry(id);
973 memset(DEBUG_DATA(active), 0, id->buf_size); 987 memset(DEBUG_DATA(active), 0, id->buf_size);
974 memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size)); 988 memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size));
@@ -1013,7 +1027,11 @@ debug_sprintf_event(debug_info_t* id, int level,char *string,...)
1013 return NULL; 1027 return NULL;
1014 numargs=debug_count_numargs(string); 1028 numargs=debug_count_numargs(string);
1015 1029
1016 spin_lock_irqsave(&id->lock, flags); 1030 if (debug_critical) {
1031 if (!spin_trylock_irqsave(&id->lock, flags))
1032 return NULL;
1033 } else
1034 spin_lock_irqsave(&id->lock, flags);
1017 active = get_active_entry(id); 1035 active = get_active_entry(id);
1018 curr_event=(debug_sprintf_entry_t *) DEBUG_DATA(active); 1036 curr_event=(debug_sprintf_entry_t *) DEBUG_DATA(active);
1019 va_start(ap,string); 1037 va_start(ap,string);
@@ -1047,7 +1065,11 @@ debug_sprintf_exception(debug_info_t* id, int level,char *string,...)
1047 1065
1048 numargs=debug_count_numargs(string); 1066 numargs=debug_count_numargs(string);
1049 1067
1050 spin_lock_irqsave(&id->lock, flags); 1068 if (debug_critical) {
1069 if (!spin_trylock_irqsave(&id->lock, flags))
1070 return NULL;
1071 } else
1072 spin_lock_irqsave(&id->lock, flags);
1051 active = get_active_entry(id); 1073 active = get_active_entry(id);
1052 curr_event=(debug_sprintf_entry_t *)DEBUG_DATA(active); 1074 curr_event=(debug_sprintf_entry_t *)DEBUG_DATA(active);
1053 va_start(ap,string); 1075 va_start(ap,string);
@@ -1428,10 +1450,10 @@ debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view,
1428 rc += sprintf(out_buf + rc, "| "); 1450 rc += sprintf(out_buf + rc, "| ");
1429 for (i = 0; i < id->buf_size; i++) { 1451 for (i = 0; i < id->buf_size; i++) {
1430 unsigned char c = in_buf[i]; 1452 unsigned char c = in_buf[i];
1431 if (!isprint(c)) 1453 if (isascii(c) && isprint(c))
1432 rc += sprintf(out_buf + rc, ".");
1433 else
1434 rc += sprintf(out_buf + rc, "%c", c); 1454 rc += sprintf(out_buf + rc, "%c", c);
1455 else
1456 rc += sprintf(out_buf + rc, ".");
1435 } 1457 }
1436 rc += sprintf(out_buf + rc, "\n"); 1458 rc += sprintf(out_buf + rc, "\n");
1437 return rc; 1459 return rc;
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 52098d6dfaa..578eb4e6d15 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -29,6 +29,7 @@
29#include <asm/sysinfo.h> 29#include <asm/sysinfo.h>
30#include <asm/cpcmd.h> 30#include <asm/cpcmd.h>
31#include <asm/sclp.h> 31#include <asm/sclp.h>
32#include <asm/system.h>
32#include "entry.h" 33#include "entry.h"
33 34
34/* 35/*
@@ -262,25 +263,8 @@ static noinline __init void setup_lowcore_early(void)
262 263
263static noinline __init void setup_facility_list(void) 264static noinline __init void setup_facility_list(void)
264{ 265{
265 unsigned long nr; 266 stfle(S390_lowcore.stfle_fac_list,
266 267 ARRAY_SIZE(S390_lowcore.stfle_fac_list));
267 S390_lowcore.stfl_fac_list = 0;
268 asm volatile(
269 " .insn s,0xb2b10000,0(0)\n" /* stfl */
270 "0:\n"
271 EX_TABLE(0b,0b) : "=m" (S390_lowcore.stfl_fac_list));
272 memcpy(&S390_lowcore.stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
273 nr = 4; /* # bytes stored by stfl */
274 if (test_facility(7)) {
275 /* More facility bits available with stfle */
276 register unsigned long reg0 asm("0") = MAX_FACILITY_BIT/64 - 1;
277 asm volatile(".insn s,0xb2b00000,%0" /* stfle */
278 : "=m" (S390_lowcore.stfle_fac_list), "+d" (reg0)
279 : : "cc");
280 nr = (reg0 + 1) * 8; /* # bytes stored by stfle */
281 }
282 memset((char *) S390_lowcore.stfle_fac_list + nr, 0,
283 MAX_FACILITY_BIT/8 - nr);
284} 268}
285 269
286static noinline __init void setup_hpage(void) 270static noinline __init void setup_hpage(void)
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 3705700ed37..74ee563fe62 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -2,7 +2,7 @@
2 * arch/s390/kernel/entry.S 2 * arch/s390/kernel/entry.S
3 * S390 low-level entry points. 3 * S390 low-level entry points.
4 * 4 *
5 * Copyright (C) IBM Corp. 1999,2006 5 * Copyright (C) IBM Corp. 1999,2012
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Hartmut Penner (hp@de.ibm.com), 7 * Hartmut Penner (hp@de.ibm.com),
8 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 8 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
@@ -105,14 +105,14 @@ STACK_SIZE = 1 << STACK_SHIFT
105 105
106 .macro ADD64 high,low,timer 106 .macro ADD64 high,low,timer
107 al \high,\timer 107 al \high,\timer
108 al \low,\timer+4 108 al \low,4+\timer
109 brc 12,.+8 109 brc 12,.+8
110 ahi \high,1 110 ahi \high,1
111 .endm 111 .endm
112 112
113 .macro SUB64 high,low,timer 113 .macro SUB64 high,low,timer
114 sl \high,\timer 114 sl \high,\timer
115 sl \low,\timer+4 115 sl \low,4+\timer
116 brc 3,.+8 116 brc 3,.+8
117 ahi \high,-1 117 ahi \high,-1
118 .endm 118 .endm
@@ -471,7 +471,6 @@ io_tif:
471 jnz io_work # there is work to do (signals etc.) 471 jnz io_work # there is work to do (signals etc.)
472io_restore: 472io_restore:
473 mvc __LC_RETURN_PSW(8),__PT_PSW(%r11) 473 mvc __LC_RETURN_PSW(8),__PT_PSW(%r11)
474 ni __LC_RETURN_PSW+1,0xfd # clean wait state bit
475 stpt __LC_EXIT_TIMER 474 stpt __LC_EXIT_TIMER
476 lm %r0,%r15,__PT_R0(%r11) 475 lm %r0,%r15,__PT_R0(%r11)
477 lpsw __LC_RETURN_PSW 476 lpsw __LC_RETURN_PSW
@@ -606,12 +605,32 @@ ext_skip:
606 stm %r8,%r9,__PT_PSW(%r11) 605 stm %r8,%r9,__PT_PSW(%r11)
607 TRACE_IRQS_OFF 606 TRACE_IRQS_OFF
608 lr %r2,%r11 # pass pointer to pt_regs 607 lr %r2,%r11 # pass pointer to pt_regs
609 l %r3,__LC_CPU_ADDRESS # get cpu address + interruption code 608 l %r3,__LC_EXT_CPU_ADDR # get cpu address + interruption code
610 l %r4,__LC_EXT_PARAMS # get external parameters 609 l %r4,__LC_EXT_PARAMS # get external parameters
611 l %r1,BASED(.Ldo_extint) 610 l %r1,BASED(.Ldo_extint)
612 basr %r14,%r1 # call do_extint 611 basr %r14,%r1 # call do_extint
613 j io_return 612 j io_return
614 613
614/*
615 * Load idle PSW. The second "half" of this function is in cleanup_idle.
616 */
617ENTRY(psw_idle)
618 st %r4,__SF_EMPTY(%r15)
619 basr %r1,0
620 la %r1,psw_idle_lpsw+4-.(%r1)
621 st %r1,__SF_EMPTY+4(%r15)
622 oi __SF_EMPTY+4(%r15),0x80
623 la %r1,.Lvtimer_max-psw_idle_lpsw-4(%r1)
624 stck __IDLE_ENTER(%r2)
625 ltr %r5,%r5
626 stpt __VQ_IDLE_ENTER(%r3)
627 jz psw_idle_lpsw
628 spt 0(%r1)
629psw_idle_lpsw:
630 lpsw __SF_EMPTY(%r15)
631 br %r14
632psw_idle_end:
633
615__critical_end: 634__critical_end:
616 635
617/* 636/*
@@ -673,7 +692,6 @@ mcck_skip:
673 TRACE_IRQS_ON 692 TRACE_IRQS_ON
674mcck_return: 693mcck_return:
675 mvc __LC_RETURN_MCCK_PSW(8),__PT_PSW(%r11) # move return PSW 694 mvc __LC_RETURN_MCCK_PSW(8),__PT_PSW(%r11) # move return PSW
676 ni __LC_RETURN_MCCK_PSW+1,0xfd # clear wait state bit
677 tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ? 695 tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ?
678 jno 0f 696 jno 0f
679 lm %r0,%r15,__PT_R0(%r11) 697 lm %r0,%r15,__PT_R0(%r11)
@@ -691,77 +709,30 @@ mcck_panic:
6910: ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) 7090: ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
692 j mcck_skip 710 j mcck_skip
693 711
694/*
695 * Restart interruption handler, kick starter for additional CPUs
696 */
697#ifdef CONFIG_SMP
698 __CPUINIT
699ENTRY(restart_int_handler)
700 basr %r1,0
701restart_base:
702 spt restart_vtime-restart_base(%r1)
703 stck __LC_LAST_UPDATE_CLOCK
704 mvc __LC_LAST_UPDATE_TIMER(8),restart_vtime-restart_base(%r1)
705 mvc __LC_EXIT_TIMER(8),restart_vtime-restart_base(%r1)
706 l %r15,__LC_GPREGS_SAVE_AREA+60 # load ksp
707 lctl %c0,%c15,__LC_CREGS_SAVE_AREA # get new ctl regs
708 lam %a0,%a15,__LC_AREGS_SAVE_AREA
709 lm %r6,%r15,__SF_GPRS(%r15)# load registers from clone
710 l %r1,__LC_THREAD_INFO
711 mvc __LC_USER_TIMER(8),__TI_user_timer(%r1)
712 mvc __LC_SYSTEM_TIMER(8),__TI_system_timer(%r1)
713 xc __LC_STEAL_TIMER(8),__LC_STEAL_TIMER
714 ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off
715 basr %r14,0
716 l %r14,restart_addr-.(%r14)
717 basr %r14,%r14 # call start_secondary
718restart_addr:
719 .long start_secondary
720 .align 8
721restart_vtime:
722 .long 0x7fffffff,0xffffffff
723 .previous
724#else
725/*
726 * If we do not run with SMP enabled, let the new CPU crash ...
727 */
728ENTRY(restart_int_handler)
729 basr %r1,0
730restart_base:
731 lpsw restart_crash-restart_base(%r1)
732 .align 8
733restart_crash:
734 .long 0x000a0000,0x00000000
735restart_go:
736#endif
737
738# 712#
739# PSW restart interrupt handler 713# PSW restart interrupt handler
740# 714#
741ENTRY(psw_restart_int_handler) 715ENTRY(restart_int_handler)
742 st %r15,__LC_SAVE_AREA_RESTART 716 st %r15,__LC_SAVE_AREA_RESTART
743 basr %r15,0 717 l %r15,__LC_RESTART_STACK
7440: l %r15,.Lrestart_stack-0b(%r15) # load restart stack
745 l %r15,0(%r15)
746 ahi %r15,-__PT_SIZE # create pt_regs on stack 718 ahi %r15,-__PT_SIZE # create pt_regs on stack
719 xc 0(__PT_SIZE,%r15),0(%r15)
747 stm %r0,%r14,__PT_R0(%r15) 720 stm %r0,%r14,__PT_R0(%r15)
748 mvc __PT_R15(4,%r15),__LC_SAVE_AREA_RESTART 721 mvc __PT_R15(4,%r15),__LC_SAVE_AREA_RESTART
749 mvc __PT_PSW(8,%r15),__LC_RST_OLD_PSW # store restart old psw 722 mvc __PT_PSW(8,%r15),__LC_RST_OLD_PSW # store restart old psw
750 ahi %r15,-STACK_FRAME_OVERHEAD 723 ahi %r15,-STACK_FRAME_OVERHEAD # create stack frame on stack
751 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) 724 xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15)
752 basr %r14,0 725 lm %r1,%r3,__LC_RESTART_FN # load fn, parm & source cpu
7531: l %r14,.Ldo_restart-1b(%r14) 726 ltr %r3,%r3 # test source cpu address
754 basr %r14,%r14 727 jm 1f # negative -> skip source stop
755 basr %r14,0 # load disabled wait PSW if 7280: sigp %r4,%r3,1 # sigp sense to source cpu
7562: lpsw restart_psw_crash-2b(%r14) # do_restart returns 729 brc 10,0b # wait for status stored
757 .align 4 7301: basr %r14,%r1 # call function
758.Ldo_restart: 731 stap __SF_EMPTY(%r15) # store cpu address
759 .long do_restart 732 lh %r3,__SF_EMPTY(%r15)
760.Lrestart_stack: 7332: sigp %r4,%r3,5 # sigp stop to current cpu
761 .long restart_stack 734 brc 2,2b
762 .align 8 7353: j 3b
763restart_psw_crash:
764 .long 0x000a0000,0x00000000 + restart_psw_crash
765 736
766 .section .kprobes.text, "ax" 737 .section .kprobes.text, "ax"
767 738
@@ -795,6 +766,8 @@ cleanup_table:
795 .long io_tif + 0x80000000 766 .long io_tif + 0x80000000
796 .long io_restore + 0x80000000 767 .long io_restore + 0x80000000
797 .long io_done + 0x80000000 768 .long io_done + 0x80000000
769 .long psw_idle + 0x80000000
770 .long psw_idle_end + 0x80000000
798 771
799cleanup_critical: 772cleanup_critical:
800 cl %r9,BASED(cleanup_table) # system_call 773 cl %r9,BASED(cleanup_table) # system_call
@@ -813,6 +786,10 @@ cleanup_critical:
813 jl cleanup_io_tif 786 jl cleanup_io_tif
814 cl %r9,BASED(cleanup_table+28) # io_done 787 cl %r9,BASED(cleanup_table+28) # io_done
815 jl cleanup_io_restore 788 jl cleanup_io_restore
789 cl %r9,BASED(cleanup_table+32) # psw_idle
790 jl 0f
791 cl %r9,BASED(cleanup_table+36) # psw_idle_end
792 jl cleanup_idle
8160: br %r14 7930: br %r14
817 794
818cleanup_system_call: 795cleanup_system_call:
@@ -896,7 +873,6 @@ cleanup_io_restore:
896 jhe 0f 873 jhe 0f
897 l %r9,12(%r11) # get saved r11 pointer to pt_regs 874 l %r9,12(%r11) # get saved r11 pointer to pt_regs
898 mvc __LC_RETURN_PSW(8),__PT_PSW(%r9) 875 mvc __LC_RETURN_PSW(8),__PT_PSW(%r9)
899 ni __LC_RETURN_PSW+1,0xfd # clear wait state bit
900 mvc 0(32,%r11),__PT_R8(%r9) 876 mvc 0(32,%r11),__PT_R8(%r9)
901 lm %r0,%r7,__PT_R0(%r9) 877 lm %r0,%r7,__PT_R0(%r9)
9020: lm %r8,%r9,__LC_RETURN_PSW 8780: lm %r8,%r9,__LC_RETURN_PSW
@@ -904,11 +880,52 @@ cleanup_io_restore:
904cleanup_io_restore_insn: 880cleanup_io_restore_insn:
905 .long io_done - 4 + 0x80000000 881 .long io_done - 4 + 0x80000000
906 882
883cleanup_idle:
884 # copy interrupt clock & cpu timer
885 mvc __IDLE_EXIT(8,%r2),__LC_INT_CLOCK
886 mvc __VQ_IDLE_EXIT(8,%r3),__LC_ASYNC_ENTER_TIMER
887 chi %r11,__LC_SAVE_AREA_ASYNC
888 je 0f
889 mvc __IDLE_EXIT(8,%r2),__LC_MCCK_CLOCK
890 mvc __VQ_IDLE_EXIT(8,%r3),__LC_MCCK_ENTER_TIMER
8910: # check if stck has been executed
892 cl %r9,BASED(cleanup_idle_insn)
893 jhe 1f
894 mvc __IDLE_ENTER(8,%r2),__IDLE_EXIT(%r2)
895 mvc __VQ_IDLE_ENTER(8,%r3),__VQ_IDLE_EXIT(%r3)
896 j 2f
8971: # check if the cpu timer has been reprogrammed
898 ltr %r5,%r5
899 jz 2f
900 spt __VQ_IDLE_ENTER(%r3)
9012: # account system time going idle
902 lm %r9,%r10,__LC_STEAL_TIMER
903 ADD64 %r9,%r10,__IDLE_ENTER(%r2)
904 SUB64 %r9,%r10,__LC_LAST_UPDATE_CLOCK
905 stm %r9,%r10,__LC_STEAL_TIMER
906 mvc __LC_LAST_UPDATE_CLOCK(8),__IDLE_EXIT(%r2)
907 lm %r9,%r10,__LC_SYSTEM_TIMER
908 ADD64 %r9,%r10,__LC_LAST_UPDATE_TIMER
909 SUB64 %r9,%r10,__VQ_IDLE_ENTER(%r3)
910 stm %r9,%r10,__LC_SYSTEM_TIMER
911 mvc __LC_LAST_UPDATE_TIMER(8),__VQ_IDLE_EXIT(%r3)
912 # prepare return psw
913 n %r8,BASED(cleanup_idle_wait) # clear wait state bit
914 l %r9,24(%r11) # return from psw_idle
915 br %r14
916cleanup_idle_insn:
917 .long psw_idle_lpsw + 0x80000000
918cleanup_idle_wait:
919 .long 0xfffdffff
920
907/* 921/*
908 * Integer constants 922 * Integer constants
909 */ 923 */
910 .align 4 924 .align 4
911.Lnr_syscalls: .long NR_syscalls 925.Lnr_syscalls:
926 .long NR_syscalls
927.Lvtimer_max:
928 .quad 0x7fffffffffffffff
912 929
913/* 930/*
914 * Symbol constants 931 * Symbol constants
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index bf538aaf407..6cdddac93a2 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -4,11 +4,22 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/signal.h> 5#include <linux/signal.h>
6#include <asm/ptrace.h> 6#include <asm/ptrace.h>
7 7#include <asm/cputime.h>
8#include <asm/timer.h>
8 9
9extern void (*pgm_check_table[128])(struct pt_regs *); 10extern void (*pgm_check_table[128])(struct pt_regs *);
10extern void *restart_stack; 11extern void *restart_stack;
11 12
13void system_call(void);
14void pgm_check_handler(void);
15void ext_int_handler(void);
16void io_int_handler(void);
17void mcck_int_handler(void);
18void restart_int_handler(void);
19void restart_call_handler(void);
20void psw_idle(struct s390_idle_data *, struct vtimer_queue *,
21 unsigned long, int);
22
12asmlinkage long do_syscall_trace_enter(struct pt_regs *regs); 23asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
13asmlinkage void do_syscall_trace_exit(struct pt_regs *regs); 24asmlinkage void do_syscall_trace_exit(struct pt_regs *regs);
14 25
@@ -24,9 +35,9 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
24 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs); 35 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs);
25void do_notify_resume(struct pt_regs *regs); 36void do_notify_resume(struct pt_regs *regs);
26 37
27void do_extint(struct pt_regs *regs, unsigned int, unsigned int, unsigned long); 38struct ext_code;
39void do_extint(struct pt_regs *regs, struct ext_code, unsigned int, unsigned long);
28void do_restart(void); 40void do_restart(void);
29int __cpuinit start_secondary(void *cpuvoid);
30void __init startup_init(void); 41void __init startup_init(void);
31void die(struct pt_regs *regs, const char *str); 42void die(struct pt_regs *regs, const char *str);
32 43
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 412a7b8783d..4e1c292fa7e 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -2,7 +2,7 @@
2 * arch/s390/kernel/entry64.S 2 * arch/s390/kernel/entry64.S
3 * S390 low-level entry points. 3 * S390 low-level entry points.
4 * 4 *
5 * Copyright (C) IBM Corp. 1999,2010 5 * Copyright (C) IBM Corp. 1999,2012
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Hartmut Penner (hp@de.ibm.com), 7 * Hartmut Penner (hp@de.ibm.com),
8 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 8 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
@@ -489,7 +489,6 @@ io_restore:
489 lg %r14,__LC_VDSO_PER_CPU 489 lg %r14,__LC_VDSO_PER_CPU
490 lmg %r0,%r10,__PT_R0(%r11) 490 lmg %r0,%r10,__PT_R0(%r11)
491 mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) 491 mvc __LC_RETURN_PSW(16),__PT_PSW(%r11)
492 ni __LC_RETURN_PSW+1,0xfd # clear wait state bit
493 stpt __LC_EXIT_TIMER 492 stpt __LC_EXIT_TIMER
494 mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER 493 mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER
495 lmg %r11,%r15,__PT_R11(%r11) 494 lmg %r11,%r15,__PT_R11(%r11)
@@ -625,12 +624,30 @@ ext_skip:
625 TRACE_IRQS_OFF 624 TRACE_IRQS_OFF
626 lghi %r1,4096 625 lghi %r1,4096
627 lgr %r2,%r11 # pass pointer to pt_regs 626 lgr %r2,%r11 # pass pointer to pt_regs
628 llgf %r3,__LC_CPU_ADDRESS # get cpu address + interruption code 627 llgf %r3,__LC_EXT_CPU_ADDR # get cpu address + interruption code
629 llgf %r4,__LC_EXT_PARAMS # get external parameter 628 llgf %r4,__LC_EXT_PARAMS # get external parameter
630 lg %r5,__LC_EXT_PARAMS2-4096(%r1) # get 64 bit external parameter 629 lg %r5,__LC_EXT_PARAMS2-4096(%r1) # get 64 bit external parameter
631 brasl %r14,do_extint 630 brasl %r14,do_extint
632 j io_return 631 j io_return
633 632
633/*
634 * Load idle PSW. The second "half" of this function is in cleanup_idle.
635 */
636ENTRY(psw_idle)
637 stg %r4,__SF_EMPTY(%r15)
638 larl %r1,psw_idle_lpsw+4
639 stg %r1,__SF_EMPTY+8(%r15)
640 larl %r1,.Lvtimer_max
641 stck __IDLE_ENTER(%r2)
642 ltr %r5,%r5
643 stpt __VQ_IDLE_ENTER(%r3)
644 jz psw_idle_lpsw
645 spt 0(%r1)
646psw_idle_lpsw:
647 lpswe __SF_EMPTY(%r15)
648 br %r14
649psw_idle_end:
650
634__critical_end: 651__critical_end:
635 652
636/* 653/*
@@ -696,7 +713,6 @@ mcck_return:
696 lg %r14,__LC_VDSO_PER_CPU 713 lg %r14,__LC_VDSO_PER_CPU
697 lmg %r0,%r10,__PT_R0(%r11) 714 lmg %r0,%r10,__PT_R0(%r11)
698 mvc __LC_RETURN_MCCK_PSW(16),__PT_PSW(%r11) # move return PSW 715 mvc __LC_RETURN_MCCK_PSW(16),__PT_PSW(%r11) # move return PSW
699 ni __LC_RETURN_MCCK_PSW+1,0xfd # clear wait state bit
700 tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ? 716 tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ?
701 jno 0f 717 jno 0f
702 stpt __LC_EXIT_TIMER 718 stpt __LC_EXIT_TIMER
@@ -713,68 +729,30 @@ mcck_panic:
7130: aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) 7290: aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
714 j mcck_skip 730 j mcck_skip
715 731
716/*
717 * Restart interruption handler, kick starter for additional CPUs
718 */
719#ifdef CONFIG_SMP
720 __CPUINIT
721ENTRY(restart_int_handler)
722 basr %r1,0
723restart_base:
724 spt restart_vtime-restart_base(%r1)
725 stck __LC_LAST_UPDATE_CLOCK
726 mvc __LC_LAST_UPDATE_TIMER(8),restart_vtime-restart_base(%r1)
727 mvc __LC_EXIT_TIMER(8),restart_vtime-restart_base(%r1)
728 lghi %r10,__LC_GPREGS_SAVE_AREA
729 lg %r15,120(%r10) # load ksp
730 lghi %r10,__LC_CREGS_SAVE_AREA
731 lctlg %c0,%c15,0(%r10) # get new ctl regs
732 lghi %r10,__LC_AREGS_SAVE_AREA
733 lam %a0,%a15,0(%r10)
734 lmg %r6,%r15,__SF_GPRS(%r15)# load registers from clone
735 lg %r1,__LC_THREAD_INFO
736 mvc __LC_USER_TIMER(8),__TI_user_timer(%r1)
737 mvc __LC_SYSTEM_TIMER(8),__TI_system_timer(%r1)
738 xc __LC_STEAL_TIMER(8),__LC_STEAL_TIMER
739 ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off
740 brasl %r14,start_secondary
741 .align 8
742restart_vtime:
743 .long 0x7fffffff,0xffffffff
744 .previous
745#else
746/*
747 * If we do not run with SMP enabled, let the new CPU crash ...
748 */
749ENTRY(restart_int_handler)
750 basr %r1,0
751restart_base:
752 lpswe restart_crash-restart_base(%r1)
753 .align 8
754restart_crash:
755 .long 0x000a0000,0x00000000,0x00000000,0x00000000
756restart_go:
757#endif
758
759# 732#
760# PSW restart interrupt handler 733# PSW restart interrupt handler
761# 734#
762ENTRY(psw_restart_int_handler) 735ENTRY(restart_int_handler)
763 stg %r15,__LC_SAVE_AREA_RESTART 736 stg %r15,__LC_SAVE_AREA_RESTART
764 larl %r15,restart_stack # load restart stack 737 lg %r15,__LC_RESTART_STACK
765 lg %r15,0(%r15)
766 aghi %r15,-__PT_SIZE # create pt_regs on stack 738 aghi %r15,-__PT_SIZE # create pt_regs on stack
739 xc 0(__PT_SIZE,%r15),0(%r15)
767 stmg %r0,%r14,__PT_R0(%r15) 740 stmg %r0,%r14,__PT_R0(%r15)
768 mvc __PT_R15(8,%r15),__LC_SAVE_AREA_RESTART 741 mvc __PT_R15(8,%r15),__LC_SAVE_AREA_RESTART
769 mvc __PT_PSW(16,%r15),__LC_RST_OLD_PSW # store restart old psw 742 mvc __PT_PSW(16,%r15),__LC_RST_OLD_PSW # store restart old psw
770 aghi %r15,-STACK_FRAME_OVERHEAD 743 aghi %r15,-STACK_FRAME_OVERHEAD # create stack frame on stack
771 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 744 xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15)
772 brasl %r14,do_restart 745 lmg %r1,%r3,__LC_RESTART_FN # load fn, parm & source cpu
773 larl %r14,restart_psw_crash # load disabled wait PSW if 746 ltgr %r3,%r3 # test source cpu address
774 lpswe 0(%r14) # do_restart returns 747 jm 1f # negative -> skip source stop
775 .align 8 7480: sigp %r4,%r3,1 # sigp sense to source cpu
776restart_psw_crash: 749 brc 10,0b # wait for status stored
777 .quad 0x0002000080000000,0x0000000000000000 + restart_psw_crash 7501: basr %r14,%r1 # call function
751 stap __SF_EMPTY(%r15) # store cpu address
752 llgh %r3,__SF_EMPTY(%r15)
7532: sigp %r4,%r3,5 # sigp stop to current cpu
754 brc 2,2b
7553: j 3b
778 756
779 .section .kprobes.text, "ax" 757 .section .kprobes.text, "ax"
780 758
@@ -808,6 +786,8 @@ cleanup_table:
808 .quad io_tif 786 .quad io_tif
809 .quad io_restore 787 .quad io_restore
810 .quad io_done 788 .quad io_done
789 .quad psw_idle
790 .quad psw_idle_end
811 791
812cleanup_critical: 792cleanup_critical:
813 clg %r9,BASED(cleanup_table) # system_call 793 clg %r9,BASED(cleanup_table) # system_call
@@ -826,6 +806,10 @@ cleanup_critical:
826 jl cleanup_io_tif 806 jl cleanup_io_tif
827 clg %r9,BASED(cleanup_table+56) # io_done 807 clg %r9,BASED(cleanup_table+56) # io_done
828 jl cleanup_io_restore 808 jl cleanup_io_restore
809 clg %r9,BASED(cleanup_table+64) # psw_idle
810 jl 0f
811 clg %r9,BASED(cleanup_table+72) # psw_idle_end
812 jl cleanup_idle
8290: br %r14 8130: br %r14
830 814
831 815
@@ -915,7 +899,6 @@ cleanup_io_restore:
915 je 0f 899 je 0f
916 lg %r9,24(%r11) # get saved r11 pointer to pt_regs 900 lg %r9,24(%r11) # get saved r11 pointer to pt_regs
917 mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) 901 mvc __LC_RETURN_PSW(16),__PT_PSW(%r9)
918 ni __LC_RETURN_PSW+1,0xfd # clear wait state bit
919 mvc 0(64,%r11),__PT_R8(%r9) 902 mvc 0(64,%r11),__PT_R8(%r9)
920 lmg %r0,%r7,__PT_R0(%r9) 903 lmg %r0,%r7,__PT_R0(%r9)
9210: lmg %r8,%r9,__LC_RETURN_PSW 9040: lmg %r8,%r9,__LC_RETURN_PSW
@@ -923,6 +906,42 @@ cleanup_io_restore:
923cleanup_io_restore_insn: 906cleanup_io_restore_insn:
924 .quad io_done - 4 907 .quad io_done - 4
925 908
909cleanup_idle:
910 # copy interrupt clock & cpu timer
911 mvc __IDLE_EXIT(8,%r2),__LC_INT_CLOCK
912 mvc __VQ_IDLE_EXIT(8,%r3),__LC_ASYNC_ENTER_TIMER
913 cghi %r11,__LC_SAVE_AREA_ASYNC
914 je 0f
915 mvc __IDLE_EXIT(8,%r2),__LC_MCCK_CLOCK
916 mvc __VQ_IDLE_EXIT(8,%r3),__LC_MCCK_ENTER_TIMER
9170: # check if stck & stpt have been executed
918 clg %r9,BASED(cleanup_idle_insn)
919 jhe 1f
920 mvc __IDLE_ENTER(8,%r2),__IDLE_EXIT(%r2)
921 mvc __VQ_IDLE_ENTER(8,%r3),__VQ_IDLE_EXIT(%r3)
922 j 2f
9231: # check if the cpu timer has been reprogrammed
924 ltr %r5,%r5
925 jz 2f
926 spt __VQ_IDLE_ENTER(%r3)
9272: # account system time going idle
928 lg %r9,__LC_STEAL_TIMER
929 alg %r9,__IDLE_ENTER(%r2)
930 slg %r9,__LC_LAST_UPDATE_CLOCK
931 stg %r9,__LC_STEAL_TIMER
932 mvc __LC_LAST_UPDATE_CLOCK(8),__IDLE_EXIT(%r2)
933 lg %r9,__LC_SYSTEM_TIMER
934 alg %r9,__LC_LAST_UPDATE_TIMER
935 slg %r9,__VQ_IDLE_ENTER(%r3)
936 stg %r9,__LC_SYSTEM_TIMER
937 mvc __LC_LAST_UPDATE_TIMER(8),__VQ_IDLE_EXIT(%r3)
938 # prepare return psw
939 nihh %r8,0xfffd # clear wait state bit
940 lg %r9,48(%r11) # return from psw_idle
941 br %r14
942cleanup_idle_insn:
943 .quad psw_idle_lpsw
944
926/* 945/*
927 * Integer constants 946 * Integer constants
928 */ 947 */
@@ -931,6 +950,8 @@ cleanup_io_restore_insn:
931 .quad __critical_start 950 .quad __critical_start
932.Lcritical_length: 951.Lcritical_length:
933 .quad __critical_end - __critical_start 952 .quad __critical_end - __critical_start
953.Lvtimer_max:
954 .quad 0x7fffffffffffffff
934 955
935 956
936#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) 957#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE)
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index affa8e68124..8342e65a140 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -2,7 +2,7 @@
2 * arch/s390/kernel/ipl.c 2 * arch/s390/kernel/ipl.c
3 * ipl/reipl/dump support for Linux on s390. 3 * ipl/reipl/dump support for Linux on s390.
4 * 4 *
5 * Copyright IBM Corp. 2005,2007 5 * Copyright IBM Corp. 2005,2012
6 * Author(s): Michael Holzheu <holzheu@de.ibm.com> 6 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
7 * Heiko Carstens <heiko.carstens@de.ibm.com> 7 * Heiko Carstens <heiko.carstens@de.ibm.com>
8 * Volker Sameske <sameske@de.ibm.com> 8 * Volker Sameske <sameske@de.ibm.com>
@@ -17,6 +17,7 @@
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/gfp.h> 18#include <linux/gfp.h>
19#include <linux/crash_dump.h> 19#include <linux/crash_dump.h>
20#include <linux/debug_locks.h>
20#include <asm/ipl.h> 21#include <asm/ipl.h>
21#include <asm/smp.h> 22#include <asm/smp.h>
22#include <asm/setup.h> 23#include <asm/setup.h>
@@ -25,8 +26,9 @@
25#include <asm/ebcdic.h> 26#include <asm/ebcdic.h>
26#include <asm/reset.h> 27#include <asm/reset.h>
27#include <asm/sclp.h> 28#include <asm/sclp.h>
28#include <asm/sigp.h>
29#include <asm/checksum.h> 29#include <asm/checksum.h>
30#include <asm/debug.h>
31#include <asm/os_info.h>
30#include "entry.h" 32#include "entry.h"
31 33
32#define IPL_PARM_BLOCK_VERSION 0 34#define IPL_PARM_BLOCK_VERSION 0
@@ -571,7 +573,7 @@ static void __ipl_run(void *unused)
571 573
572static void ipl_run(struct shutdown_trigger *trigger) 574static void ipl_run(struct shutdown_trigger *trigger)
573{ 575{
574 smp_switch_to_ipl_cpu(__ipl_run, NULL); 576 smp_call_ipl_cpu(__ipl_run, NULL);
575} 577}
576 578
577static int __init ipl_init(void) 579static int __init ipl_init(void)
@@ -950,6 +952,13 @@ static struct attribute_group reipl_nss_attr_group = {
950 .attrs = reipl_nss_attrs, 952 .attrs = reipl_nss_attrs,
951}; 953};
952 954
955static void set_reipl_block_actual(struct ipl_parameter_block *reipl_block)
956{
957 reipl_block_actual = reipl_block;
958 os_info_entry_add(OS_INFO_REIPL_BLOCK, reipl_block_actual,
959 reipl_block->hdr.len);
960}
961
953/* reipl type */ 962/* reipl type */
954 963
955static int reipl_set_type(enum ipl_type type) 964static int reipl_set_type(enum ipl_type type)
@@ -965,7 +974,7 @@ static int reipl_set_type(enum ipl_type type)
965 reipl_method = REIPL_METHOD_CCW_VM; 974 reipl_method = REIPL_METHOD_CCW_VM;
966 else 975 else
967 reipl_method = REIPL_METHOD_CCW_CIO; 976 reipl_method = REIPL_METHOD_CCW_CIO;
968 reipl_block_actual = reipl_block_ccw; 977 set_reipl_block_actual(reipl_block_ccw);
969 break; 978 break;
970 case IPL_TYPE_FCP: 979 case IPL_TYPE_FCP:
971 if (diag308_set_works) 980 if (diag308_set_works)
@@ -974,7 +983,7 @@ static int reipl_set_type(enum ipl_type type)
974 reipl_method = REIPL_METHOD_FCP_RO_VM; 983 reipl_method = REIPL_METHOD_FCP_RO_VM;
975 else 984 else
976 reipl_method = REIPL_METHOD_FCP_RO_DIAG; 985 reipl_method = REIPL_METHOD_FCP_RO_DIAG;
977 reipl_block_actual = reipl_block_fcp; 986 set_reipl_block_actual(reipl_block_fcp);
978 break; 987 break;
979 case IPL_TYPE_FCP_DUMP: 988 case IPL_TYPE_FCP_DUMP:
980 reipl_method = REIPL_METHOD_FCP_DUMP; 989 reipl_method = REIPL_METHOD_FCP_DUMP;
@@ -984,7 +993,7 @@ static int reipl_set_type(enum ipl_type type)
984 reipl_method = REIPL_METHOD_NSS_DIAG; 993 reipl_method = REIPL_METHOD_NSS_DIAG;
985 else 994 else
986 reipl_method = REIPL_METHOD_NSS; 995 reipl_method = REIPL_METHOD_NSS;
987 reipl_block_actual = reipl_block_nss; 996 set_reipl_block_actual(reipl_block_nss);
988 break; 997 break;
989 case IPL_TYPE_UNKNOWN: 998 case IPL_TYPE_UNKNOWN:
990 reipl_method = REIPL_METHOD_DEFAULT; 999 reipl_method = REIPL_METHOD_DEFAULT;
@@ -1101,7 +1110,7 @@ static void __reipl_run(void *unused)
1101 1110
1102static void reipl_run(struct shutdown_trigger *trigger) 1111static void reipl_run(struct shutdown_trigger *trigger)
1103{ 1112{
1104 smp_switch_to_ipl_cpu(__reipl_run, NULL); 1113 smp_call_ipl_cpu(__reipl_run, NULL);
1105} 1114}
1106 1115
1107static void reipl_block_ccw_init(struct ipl_parameter_block *ipb) 1116static void reipl_block_ccw_init(struct ipl_parameter_block *ipb)
@@ -1256,6 +1265,29 @@ static int __init reipl_fcp_init(void)
1256 return 0; 1265 return 0;
1257} 1266}
1258 1267
1268static int __init reipl_type_init(void)
1269{
1270 enum ipl_type reipl_type = ipl_info.type;
1271 struct ipl_parameter_block *reipl_block;
1272 unsigned long size;
1273
1274 reipl_block = os_info_old_entry(OS_INFO_REIPL_BLOCK, &size);
1275 if (!reipl_block)
1276 goto out;
1277 /*
1278 * If we have an OS info reipl block, this will be used
1279 */
1280 if (reipl_block->hdr.pbt == DIAG308_IPL_TYPE_FCP) {
1281 memcpy(reipl_block_fcp, reipl_block, size);
1282 reipl_type = IPL_TYPE_FCP;
1283 } else if (reipl_block->hdr.pbt == DIAG308_IPL_TYPE_CCW) {
1284 memcpy(reipl_block_ccw, reipl_block, size);
1285 reipl_type = IPL_TYPE_CCW;
1286 }
1287out:
1288 return reipl_set_type(reipl_type);
1289}
1290
1259static int __init reipl_init(void) 1291static int __init reipl_init(void)
1260{ 1292{
1261 int rc; 1293 int rc;
@@ -1277,10 +1309,7 @@ static int __init reipl_init(void)
1277 rc = reipl_nss_init(); 1309 rc = reipl_nss_init();
1278 if (rc) 1310 if (rc)
1279 return rc; 1311 return rc;
1280 rc = reipl_set_type(ipl_info.type); 1312 return reipl_type_init();
1281 if (rc)
1282 return rc;
1283 return 0;
1284} 1313}
1285 1314
1286static struct shutdown_action __refdata reipl_action = { 1315static struct shutdown_action __refdata reipl_action = {
@@ -1421,7 +1450,7 @@ static void dump_run(struct shutdown_trigger *trigger)
1421 if (dump_method == DUMP_METHOD_NONE) 1450 if (dump_method == DUMP_METHOD_NONE)
1422 return; 1451 return;
1423 smp_send_stop(); 1452 smp_send_stop();
1424 smp_switch_to_ipl_cpu(__dump_run, NULL); 1453 smp_call_ipl_cpu(__dump_run, NULL);
1425} 1454}
1426 1455
1427static int __init dump_ccw_init(void) 1456static int __init dump_ccw_init(void)
@@ -1499,30 +1528,12 @@ static struct shutdown_action __refdata dump_action = {
1499 1528
1500static void dump_reipl_run(struct shutdown_trigger *trigger) 1529static void dump_reipl_run(struct shutdown_trigger *trigger)
1501{ 1530{
1502 preempt_disable(); 1531 u32 csum;
1503 /* 1532
1504 * Bypass dynamic address translation (DAT) when storing IPL parameter 1533 csum = csum_partial(reipl_block_actual, reipl_block_actual->hdr.len, 0);
1505 * information block address and checksum into the prefix area 1534 copy_to_absolute_zero(&S390_lowcore.ipib_checksum, &csum, sizeof(csum));
1506 * (corresponding to absolute addresses 0-8191). 1535 copy_to_absolute_zero(&S390_lowcore.ipib, &reipl_block_actual,
1507 * When enhanced DAT applies and the STE format control in one, 1536 sizeof(reipl_block_actual));
1508 * the absolute address is formed without prefixing. In this case a
1509 * normal store (stg/st) into the prefix area would no more match to
1510 * absolute addresses 0-8191.
1511 */
1512#ifdef CONFIG_64BIT
1513 asm volatile("sturg %0,%1"
1514 :: "a" ((unsigned long) reipl_block_actual),
1515 "a" (&lowcore_ptr[smp_processor_id()]->ipib));
1516#else
1517 asm volatile("stura %0,%1"
1518 :: "a" ((unsigned long) reipl_block_actual),
1519 "a" (&lowcore_ptr[smp_processor_id()]->ipib));
1520#endif
1521 asm volatile("stura %0,%1"
1522 :: "a" (csum_partial(reipl_block_actual,
1523 reipl_block_actual->hdr.len, 0)),
1524 "a" (&lowcore_ptr[smp_processor_id()]->ipib_checksum));
1525 preempt_enable();
1526 dump_run(trigger); 1537 dump_run(trigger);
1527} 1538}
1528 1539
@@ -1623,9 +1634,7 @@ static void stop_run(struct shutdown_trigger *trigger)
1623 if (strcmp(trigger->name, ON_PANIC_STR) == 0 || 1634 if (strcmp(trigger->name, ON_PANIC_STR) == 0 ||
1624 strcmp(trigger->name, ON_RESTART_STR) == 0) 1635 strcmp(trigger->name, ON_RESTART_STR) == 0)
1625 disabled_wait((unsigned long) __builtin_return_address(0)); 1636 disabled_wait((unsigned long) __builtin_return_address(0));
1626 while (sigp(smp_processor_id(), sigp_stop) == sigp_busy) 1637 smp_stop_cpu();
1627 cpu_relax();
1628 for (;;);
1629} 1638}
1630 1639
1631static struct shutdown_action stop_action = {SHUTDOWN_ACTION_STOP_STR, 1640static struct shutdown_action stop_action = {SHUTDOWN_ACTION_STOP_STR,
@@ -1713,6 +1722,7 @@ static struct kobj_attribute on_panic_attr =
1713 1722
1714static void do_panic(void) 1723static void do_panic(void)
1715{ 1724{
1725 lgr_info_log();
1716 on_panic_trigger.action->fn(&on_panic_trigger); 1726 on_panic_trigger.action->fn(&on_panic_trigger);
1717 stop_run(&on_panic_trigger); 1727 stop_run(&on_panic_trigger);
1718} 1728}
@@ -1738,9 +1748,8 @@ static ssize_t on_restart_store(struct kobject *kobj,
1738static struct kobj_attribute on_restart_attr = 1748static struct kobj_attribute on_restart_attr =
1739 __ATTR(on_restart, 0644, on_restart_show, on_restart_store); 1749 __ATTR(on_restart, 0644, on_restart_show, on_restart_store);
1740 1750
1741void do_restart(void) 1751static void __do_restart(void *ignore)
1742{ 1752{
1743 smp_restart_with_online_cpu();
1744 smp_send_stop(); 1753 smp_send_stop();
1745#ifdef CONFIG_CRASH_DUMP 1754#ifdef CONFIG_CRASH_DUMP
1746 crash_kexec(NULL); 1755 crash_kexec(NULL);
@@ -1749,6 +1758,14 @@ void do_restart(void)
1749 stop_run(&on_restart_trigger); 1758 stop_run(&on_restart_trigger);
1750} 1759}
1751 1760
1761void do_restart(void)
1762{
1763 tracing_off();
1764 debug_locks_off();
1765 lgr_info_log();
1766 smp_call_online_cpu(__do_restart, NULL);
1767}
1768
1752/* on halt */ 1769/* on halt */
1753 1770
1754static struct shutdown_trigger on_halt_trigger = {ON_HALT_STR, &stop_action}; 1771static struct shutdown_trigger on_halt_trigger = {ON_HALT_STR, &stop_action};
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index e30b2dfa8ba..2429ecd6887 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -202,31 +202,27 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler)
202} 202}
203EXPORT_SYMBOL(unregister_external_interrupt); 203EXPORT_SYMBOL(unregister_external_interrupt);
204 204
205void __irq_entry do_extint(struct pt_regs *regs, unsigned int ext_int_code, 205void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code,
206 unsigned int param32, unsigned long param64) 206 unsigned int param32, unsigned long param64)
207{ 207{
208 struct pt_regs *old_regs; 208 struct pt_regs *old_regs;
209 unsigned short code;
210 struct ext_int_info *p; 209 struct ext_int_info *p;
211 int index; 210 int index;
212 211
213 code = (unsigned short) ext_int_code;
214 old_regs = set_irq_regs(regs); 212 old_regs = set_irq_regs(regs);
215 s390_idle_check(regs, S390_lowcore.int_clock,
216 S390_lowcore.async_enter_timer);
217 irq_enter(); 213 irq_enter();
218 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) 214 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator)
219 /* Serve timer interrupts first. */ 215 /* Serve timer interrupts first. */
220 clock_comparator_work(); 216 clock_comparator_work();
221 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; 217 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
222 if (code != 0x1004) 218 if (ext_code.code != 0x1004)
223 __get_cpu_var(s390_idle).nohz_delay = 1; 219 __get_cpu_var(s390_idle).nohz_delay = 1;
224 220
225 index = ext_hash(code); 221 index = ext_hash(ext_code.code);
226 rcu_read_lock(); 222 rcu_read_lock();
227 list_for_each_entry_rcu(p, &ext_int_hash[index], entry) 223 list_for_each_entry_rcu(p, &ext_int_hash[index], entry)
228 if (likely(p->code == code)) 224 if (likely(p->code == ext_code.code))
229 p->handler(ext_int_code, param32, param64); 225 p->handler(ext_code, param32, param64);
230 rcu_read_unlock(); 226 rcu_read_unlock();
231 irq_exit(); 227 irq_exit();
232 set_irq_regs(old_regs); 228 set_irq_regs(old_regs);
diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c
new file mode 100644
index 00000000000..8431b92ca3a
--- /dev/null
+++ b/arch/s390/kernel/lgr.c
@@ -0,0 +1,200 @@
1/*
2 * Linux Guest Relocation (LGR) detection
3 *
4 * Copyright IBM Corp. 2012
5 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
6 */
7
8#include <linux/module.h>
9#include <linux/timer.h>
10#include <linux/slab.h>
11#include <asm/sysinfo.h>
12#include <asm/ebcdic.h>
13#include <asm/system.h>
14#include <asm/debug.h>
15#include <asm/ipl.h>
16
17#define LGR_TIMER_INTERVAL_SECS (30 * 60)
18#define VM_LEVEL_MAX 2 /* Maximum is 8, but we only record two levels */
19
20/*
21 * LGR info: Contains stfle and stsi data
22 */
23struct lgr_info {
24 /* Bit field with facility information: 4 DWORDs are stored */
25 u64 stfle_fac_list[4];
26 /* Level of system (1 = CEC, 2 = LPAR, 3 = z/VM */
27 u32 level;
28 /* Level 1: CEC info (stsi 1.1.1) */
29 char manufacturer[16];
30 char type[4];
31 char sequence[16];
32 char plant[4];
33 char model[16];
34 /* Level 2: LPAR info (stsi 2.2.2) */
35 u16 lpar_number;
36 char name[8];
37 /* Level 3: VM info (stsi 3.2.2) */
38 u8 vm_count;
39 struct {
40 char name[8];
41 char cpi[16];
42 } vm[VM_LEVEL_MAX];
43} __packed __aligned(8);
44
45/*
46 * LGR globals
47 */
48static void *lgr_page;
49static struct lgr_info lgr_info_last;
50static struct lgr_info lgr_info_cur;
51static struct debug_info *lgr_dbf;
52
53/*
54 * Return number of valid stsi levels
55 */
56static inline int stsi_0(void)
57{
58 int rc = stsi(NULL, 0, 0, 0);
59
60 return rc == -ENOSYS ? rc : (((unsigned int) rc) >> 28);
61}
62
63/*
64 * Copy buffer and then convert it to ASCII
65 */
66static void cpascii(char *dst, char *src, int size)
67{
68 memcpy(dst, src, size);
69 EBCASC(dst, size);
70}
71
72/*
73 * Fill LGR info with 1.1.1 stsi data
74 */
75static void lgr_stsi_1_1_1(struct lgr_info *lgr_info)
76{
77 struct sysinfo_1_1_1 *si = lgr_page;
78
79 if (stsi(si, 1, 1, 1) == -ENOSYS)
80 return;
81 cpascii(lgr_info->manufacturer, si->manufacturer,
82 sizeof(si->manufacturer));
83 cpascii(lgr_info->type, si->type, sizeof(si->type));
84 cpascii(lgr_info->model, si->model, sizeof(si->model));
85 cpascii(lgr_info->sequence, si->sequence, sizeof(si->sequence));
86 cpascii(lgr_info->plant, si->plant, sizeof(si->plant));
87}
88
89/*
90 * Fill LGR info with 2.2.2 stsi data
91 */
92static void lgr_stsi_2_2_2(struct lgr_info *lgr_info)
93{
94 struct sysinfo_2_2_2 *si = lgr_page;
95
96 if (stsi(si, 2, 2, 2) == -ENOSYS)
97 return;
98 cpascii(lgr_info->name, si->name, sizeof(si->name));
99 memcpy(&lgr_info->lpar_number, &si->lpar_number,
100 sizeof(lgr_info->lpar_number));
101}
102
103/*
104 * Fill LGR info with 3.2.2 stsi data
105 */
106static void lgr_stsi_3_2_2(struct lgr_info *lgr_info)
107{
108 struct sysinfo_3_2_2 *si = lgr_page;
109 int i;
110
111 if (stsi(si, 3, 2, 2) == -ENOSYS)
112 return;
113 for (i = 0; i < min_t(u8, si->count, VM_LEVEL_MAX); i++) {
114 cpascii(lgr_info->vm[i].name, si->vm[i].name,
115 sizeof(si->vm[i].name));
116 cpascii(lgr_info->vm[i].cpi, si->vm[i].cpi,
117 sizeof(si->vm[i].cpi));
118 }
119 lgr_info->vm_count = si->count;
120}
121
122/*
123 * Fill LGR info with current data
124 */
125static void lgr_info_get(struct lgr_info *lgr_info)
126{
127 memset(lgr_info, 0, sizeof(*lgr_info));
128 stfle(lgr_info->stfle_fac_list, ARRAY_SIZE(lgr_info->stfle_fac_list));
129 lgr_info->level = stsi_0();
130 if (lgr_info->level == -ENOSYS)
131 return;
132 if (lgr_info->level >= 1)
133 lgr_stsi_1_1_1(lgr_info);
134 if (lgr_info->level >= 2)
135 lgr_stsi_2_2_2(lgr_info);
136 if (lgr_info->level >= 3)
137 lgr_stsi_3_2_2(lgr_info);
138}
139
140/*
141 * Check if LGR info has changed and if yes log new LGR info to s390dbf
142 */
143void lgr_info_log(void)
144{
145 static DEFINE_SPINLOCK(lgr_info_lock);
146 unsigned long flags;
147
148 if (!spin_trylock_irqsave(&lgr_info_lock, flags))
149 return;
150 lgr_info_get(&lgr_info_cur);
151 if (memcmp(&lgr_info_last, &lgr_info_cur, sizeof(lgr_info_cur)) != 0) {
152 debug_event(lgr_dbf, 1, &lgr_info_cur, sizeof(lgr_info_cur));
153 lgr_info_last = lgr_info_cur;
154 }
155 spin_unlock_irqrestore(&lgr_info_lock, flags);
156}
157EXPORT_SYMBOL_GPL(lgr_info_log);
158
159static void lgr_timer_set(void);
160
161/*
162 * LGR timer callback
163 */
164static void lgr_timer_fn(unsigned long ignored)
165{
166 lgr_info_log();
167 lgr_timer_set();
168}
169
170static struct timer_list lgr_timer =
171 TIMER_DEFERRED_INITIALIZER(lgr_timer_fn, 0, 0);
172
173/*
174 * Setup next LGR timer
175 */
176static void lgr_timer_set(void)
177{
178 mod_timer(&lgr_timer, jiffies + LGR_TIMER_INTERVAL_SECS * HZ);
179}
180
181/*
182 * Initialize LGR: Add s390dbf, write initial lgr_info and setup timer
183 */
184static int __init lgr_init(void)
185{
186 lgr_page = (void *) __get_free_pages(GFP_KERNEL, 0);
187 if (!lgr_page)
188 return -ENOMEM;
189 lgr_dbf = debug_register("lgr", 1, 1, sizeof(struct lgr_info));
190 if (!lgr_dbf) {
191 free_page((unsigned long) lgr_page);
192 return -ENOMEM;
193 }
194 debug_register_view(lgr_dbf, &debug_hex_ascii_view);
195 lgr_info_get(&lgr_info_last);
196 debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last));
197 lgr_timer_set();
198 return 0;
199}
200module_init(lgr_init);
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 47b168fb29c..0f8cdf1268d 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -14,6 +14,7 @@
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/reboot.h> 15#include <linux/reboot.h>
16#include <linux/ftrace.h> 16#include <linux/ftrace.h>
17#include <linux/debug_locks.h>
17#include <asm/cio.h> 18#include <asm/cio.h>
18#include <asm/setup.h> 19#include <asm/setup.h>
19#include <asm/pgtable.h> 20#include <asm/pgtable.h>
@@ -49,50 +50,21 @@ static void add_elf_notes(int cpu)
49} 50}
50 51
51/* 52/*
52 * Store status of next available physical CPU
53 */
54static int store_status_next(int start_cpu, int this_cpu)
55{
56 struct save_area *sa = (void *) 4608 + store_prefix();
57 int cpu, rc;
58
59 for (cpu = start_cpu; cpu < 65536; cpu++) {
60 if (cpu == this_cpu)
61 continue;
62 do {
63 rc = raw_sigp(cpu, sigp_stop_and_store_status);
64 } while (rc == sigp_busy);
65 if (rc != sigp_order_code_accepted)
66 continue;
67 if (sa->pref_reg)
68 return cpu;
69 }
70 return -1;
71}
72
73/*
74 * Initialize CPU ELF notes 53 * Initialize CPU ELF notes
75 */ 54 */
76void setup_regs(void) 55void setup_regs(void)
77{ 56{
78 unsigned long sa = S390_lowcore.prefixreg_save_area + SAVE_AREA_BASE; 57 unsigned long sa = S390_lowcore.prefixreg_save_area + SAVE_AREA_BASE;
79 int cpu, this_cpu, phys_cpu = 0, first = 1; 58 int cpu, this_cpu;
80 59
81 this_cpu = stap(); 60 this_cpu = smp_find_processor_id(stap());
82 61 add_elf_notes(this_cpu);
83 if (!S390_lowcore.prefixreg_save_area)
84 first = 0;
85 for_each_online_cpu(cpu) { 62 for_each_online_cpu(cpu) {
86 if (first) { 63 if (cpu == this_cpu)
87 add_elf_notes(cpu); 64 continue;
88 first = 0; 65 if (smp_store_status(cpu))
89 continue; 66 continue;
90 }
91 phys_cpu = store_status_next(phys_cpu, this_cpu);
92 if (phys_cpu == -1)
93 break;
94 add_elf_notes(cpu); 67 add_elf_notes(cpu);
95 phys_cpu++;
96 } 68 }
97 /* Copy dump CPU store status info to absolute zero */ 69 /* Copy dump CPU store status info to absolute zero */
98 memcpy((void *) SAVE_AREA_BASE, (void *) sa, sizeof(struct save_area)); 70 memcpy((void *) SAVE_AREA_BASE, (void *) sa, sizeof(struct save_area));
@@ -238,10 +210,14 @@ static void __machine_kexec(void *data)
238 struct kimage *image = data; 210 struct kimage *image = data;
239 211
240 pfault_fini(); 212 pfault_fini();
241 if (image->type == KEXEC_TYPE_CRASH) 213 tracing_off();
214 debug_locks_off();
215 if (image->type == KEXEC_TYPE_CRASH) {
216 lgr_info_log();
242 s390_reset_system(__do_machine_kdump, data); 217 s390_reset_system(__do_machine_kdump, data);
243 else 218 } else {
244 s390_reset_system(__do_machine_kexec, data); 219 s390_reset_system(__do_machine_kexec, data);
220 }
245 disabled_wait((unsigned long) __builtin_return_address(0)); 221 disabled_wait((unsigned long) __builtin_return_address(0));
246} 222}
247 223
@@ -255,5 +231,5 @@ void machine_kexec(struct kimage *image)
255 return; 231 return;
256 tracer_disable(); 232 tracer_disable();
257 smp_send_stop(); 233 smp_send_stop();
258 smp_switch_to_ipl_cpu(__machine_kexec, image); 234 smp_call_ipl_cpu(__machine_kexec, image);
259} 235}
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
index 0fd2e863e11..8c372ca6135 100644
--- a/arch/s390/kernel/nmi.c
+++ b/arch/s390/kernel/nmi.c
@@ -254,8 +254,6 @@ void notrace s390_do_machine_check(struct pt_regs *regs)
254 int umode; 254 int umode;
255 255
256 nmi_enter(); 256 nmi_enter();
257 s390_idle_check(regs, S390_lowcore.mcck_clock,
258 S390_lowcore.mcck_enter_timer);
259 kstat_cpu(smp_processor_id()).irqs[NMI_NMI]++; 257 kstat_cpu(smp_processor_id()).irqs[NMI_NMI]++;
260 mci = (struct mci *) &S390_lowcore.mcck_interruption_code; 258 mci = (struct mci *) &S390_lowcore.mcck_interruption_code;
261 mcck = &__get_cpu_var(cpu_mcck); 259 mcck = &__get_cpu_var(cpu_mcck);
diff --git a/arch/s390/kernel/os_info.c b/arch/s390/kernel/os_info.c
new file mode 100644
index 00000000000..bbe522672e0
--- /dev/null
+++ b/arch/s390/kernel/os_info.c
@@ -0,0 +1,169 @@
1/*
2 * OS info memory interface
3 *
4 * Copyright IBM Corp. 2012
5 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
6 */
7
8#define KMSG_COMPONENT "os_info"
9#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
10
11#include <linux/crash_dump.h>
12#include <linux/kernel.h>
13#include <asm/checksum.h>
14#include <asm/lowcore.h>
15#include <asm/system.h>
16#include <asm/os_info.h>
17
18/*
19 * OS info structure has to be page aligned
20 */
21static struct os_info os_info __page_aligned_data;
22
23/*
24 * Compute checksum over OS info structure
25 */
26u32 os_info_csum(struct os_info *os_info)
27{
28 int size = sizeof(*os_info) - offsetof(struct os_info, version_major);
29 return csum_partial(&os_info->version_major, size, 0);
30}
31
32/*
33 * Add crashkernel info to OS info and update checksum
34 */
35void os_info_crashkernel_add(unsigned long base, unsigned long size)
36{
37 os_info.crashkernel_addr = (u64)(unsigned long)base;
38 os_info.crashkernel_size = (u64)(unsigned long)size;
39 os_info.csum = os_info_csum(&os_info);
40}
41
42/*
43 * Add OS info entry and update checksum
44 */
45void os_info_entry_add(int nr, void *ptr, u64 size)
46{
47 os_info.entry[nr].addr = (u64)(unsigned long)ptr;
48 os_info.entry[nr].size = size;
49 os_info.entry[nr].csum = csum_partial(ptr, size, 0);
50 os_info.csum = os_info_csum(&os_info);
51}
52
53/*
54 * Initialize OS info struture and set lowcore pointer
55 */
56void __init os_info_init(void)
57{
58 void *ptr = &os_info;
59
60 os_info.version_major = OS_INFO_VERSION_MAJOR;
61 os_info.version_minor = OS_INFO_VERSION_MINOR;
62 os_info.magic = OS_INFO_MAGIC;
63 os_info.csum = os_info_csum(&os_info);
64 copy_to_absolute_zero(&S390_lowcore.os_info, &ptr, sizeof(ptr));
65}
66
67#ifdef CONFIG_CRASH_DUMP
68
69static struct os_info *os_info_old;
70
71/*
72 * Allocate and copy OS info entry from oldmem
73 */
74static void os_info_old_alloc(int nr, int align)
75{
76 unsigned long addr, size = 0;
77 char *buf, *buf_align, *msg;
78 u32 csum;
79
80 addr = os_info_old->entry[nr].addr;
81 if (!addr) {
82 msg = "not available";
83 goto fail;
84 }
85 size = os_info_old->entry[nr].size;
86 buf = kmalloc(size + align - 1, GFP_KERNEL);
87 if (!buf) {
88 msg = "alloc failed";
89 goto fail;
90 }
91 buf_align = PTR_ALIGN(buf, align);
92 if (copy_from_oldmem(buf_align, (void *) addr, size)) {
93 msg = "copy failed";
94 goto fail_free;
95 }
96 csum = csum_partial(buf_align, size, 0);
97 if (csum != os_info_old->entry[nr].csum) {
98 msg = "checksum failed";
99 goto fail_free;
100 }
101 os_info_old->entry[nr].addr = (u64)(unsigned long)buf_align;
102 msg = "copied";
103 goto out;
104fail_free:
105 kfree(buf);
106fail:
107 os_info_old->entry[nr].addr = 0;
108out:
109 pr_info("entry %i: %s (addr=0x%lx size=%lu)\n",
110 nr, msg, addr, size);
111}
112
113/*
114 * Initialize os info and os info entries from oldmem
115 */
116static void os_info_old_init(void)
117{
118 static int os_info_init;
119 unsigned long addr;
120
121 if (os_info_init)
122 return;
123 if (!OLDMEM_BASE)
124 goto fail;
125 if (copy_from_oldmem(&addr, &S390_lowcore.os_info, sizeof(addr)))
126 goto fail;
127 if (addr == 0 || addr % PAGE_SIZE)
128 goto fail;
129 os_info_old = kzalloc(sizeof(*os_info_old), GFP_KERNEL);
130 if (!os_info_old)
131 goto fail;
132 if (copy_from_oldmem(os_info_old, (void *) addr, sizeof(*os_info_old)))
133 goto fail_free;
134 if (os_info_old->magic != OS_INFO_MAGIC)
135 goto fail_free;
136 if (os_info_old->csum != os_info_csum(os_info_old))
137 goto fail_free;
138 if (os_info_old->version_major > OS_INFO_VERSION_MAJOR)
139 goto fail_free;
140 os_info_old_alloc(OS_INFO_VMCOREINFO, 1);
141 os_info_old_alloc(OS_INFO_REIPL_BLOCK, 1);
142 os_info_old_alloc(OS_INFO_INIT_FN, PAGE_SIZE);
143 pr_info("crashkernel: addr=0x%lx size=%lu\n",
144 (unsigned long) os_info_old->crashkernel_addr,
145 (unsigned long) os_info_old->crashkernel_size);
146 os_info_init = 1;
147 return;
148fail_free:
149 kfree(os_info_old);
150fail:
151 os_info_init = 1;
152 os_info_old = NULL;
153}
154
155/*
156 * Return pointer to os infor entry and its size
157 */
158void *os_info_old_entry(int nr, unsigned long *size)
159{
160 os_info_old_init();
161
162 if (!os_info_old)
163 return NULL;
164 if (!os_info_old->entry[nr].addr)
165 return NULL;
166 *size = (unsigned long) os_info_old->entry[nr].size;
167 return (void *)(unsigned long)os_info_old->entry[nr].addr;
168}
169#endif
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 7618085b416..3732e4c09cb 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -77,13 +77,8 @@ static void default_idle(void)
77 local_irq_enable(); 77 local_irq_enable();
78 return; 78 return;
79 } 79 }
80 trace_hardirqs_on(); 80 /* Halt the cpu and keep track of cpu time accounting. */
81 /* Don't trace preempt off for idle. */
82 stop_critical_timings();
83 /* Stop virtual timer and halt the cpu. */
84 vtime_stop_cpu(); 81 vtime_stop_cpu();
85 /* Reenable preemption tracer. */
86 start_critical_timings();
87} 82}
88 83
89void cpu_idle(void) 84void cpu_idle(void)
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 3b2efc81f34..38e751278bf 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -2,7 +2,7 @@
2 * arch/s390/kernel/setup.c 2 * arch/s390/kernel/setup.c
3 * 3 *
4 * S390 version 4 * S390 version
5 * Copyright (C) IBM Corp. 1999,2010 5 * Copyright (C) IBM Corp. 1999,2012
6 * Author(s): Hartmut Penner (hp@de.ibm.com), 6 * Author(s): Hartmut Penner (hp@de.ibm.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com) 7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 * 8 *
@@ -62,6 +62,8 @@
62#include <asm/ebcdic.h> 62#include <asm/ebcdic.h>
63#include <asm/kvm_virtio.h> 63#include <asm/kvm_virtio.h>
64#include <asm/diag.h> 64#include <asm/diag.h>
65#include <asm/os_info.h>
66#include "entry.h"
65 67
66long psw_kernel_bits = PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_ASC_PRIMARY | 68long psw_kernel_bits = PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_ASC_PRIMARY |
67 PSW_MASK_EA | PSW_MASK_BA; 69 PSW_MASK_EA | PSW_MASK_BA;
@@ -351,8 +353,9 @@ static void setup_addressing_mode(void)
351 } 353 }
352} 354}
353 355
354static void __init 356void *restart_stack __attribute__((__section__(".data")));
355setup_lowcore(void) 357
358static void __init setup_lowcore(void)
356{ 359{
357 struct _lowcore *lc; 360 struct _lowcore *lc;
358 361
@@ -363,7 +366,7 @@ setup_lowcore(void)
363 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0); 366 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0);
364 lc->restart_psw.mask = psw_kernel_bits; 367 lc->restart_psw.mask = psw_kernel_bits;
365 lc->restart_psw.addr = 368 lc->restart_psw.addr =
366 PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; 369 PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
367 lc->external_new_psw.mask = psw_kernel_bits | 370 lc->external_new_psw.mask = psw_kernel_bits |
368 PSW_MASK_DAT | PSW_MASK_MCHECK; 371 PSW_MASK_DAT | PSW_MASK_MCHECK;
369 lc->external_new_psw.addr = 372 lc->external_new_psw.addr =
@@ -412,6 +415,24 @@ setup_lowcore(void)
412 lc->last_update_timer = S390_lowcore.last_update_timer; 415 lc->last_update_timer = S390_lowcore.last_update_timer;
413 lc->last_update_clock = S390_lowcore.last_update_clock; 416 lc->last_update_clock = S390_lowcore.last_update_clock;
414 lc->ftrace_func = S390_lowcore.ftrace_func; 417 lc->ftrace_func = S390_lowcore.ftrace_func;
418
419 restart_stack = __alloc_bootmem(ASYNC_SIZE, ASYNC_SIZE, 0);
420 restart_stack += ASYNC_SIZE;
421
422 /*
423 * Set up PSW restart to call ipl.c:do_restart(). Copy the relevant
424 * restart data to the absolute zero lowcore. This is necesary if
425 * PSW restart is done on an offline CPU that has lowcore zero.
426 */
427 lc->restart_stack = (unsigned long) restart_stack;
428 lc->restart_fn = (unsigned long) do_restart;
429 lc->restart_data = 0;
430 lc->restart_source = -1UL;
431 memcpy(&S390_lowcore.restart_stack, &lc->restart_stack,
432 4*sizeof(unsigned long));
433 copy_to_absolute_zero(&S390_lowcore.restart_psw,
434 &lc->restart_psw, sizeof(psw_t));
435
415 set_prefix((u32)(unsigned long) lc); 436 set_prefix((u32)(unsigned long) lc);
416 lowcore_ptr[0] = lc; 437 lowcore_ptr[0] = lc;
417} 438}
@@ -572,27 +593,6 @@ static void __init setup_memory_end(void)
572 } 593 }
573} 594}
574 595
575void *restart_stack __attribute__((__section__(".data")));
576
577/*
578 * Setup new PSW and allocate stack for PSW restart interrupt
579 */
580static void __init setup_restart_psw(void)
581{
582 psw_t psw;
583
584 restart_stack = __alloc_bootmem(ASYNC_SIZE, ASYNC_SIZE, 0);
585 restart_stack += ASYNC_SIZE;
586
587 /*
588 * Setup restart PSW for absolute zero lowcore. This is necesary
589 * if PSW restart is done on an offline CPU that has lowcore zero
590 */
591 psw.mask = PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA;
592 psw.addr = PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler;
593 copy_to_absolute_zero(&S390_lowcore.restart_psw, &psw, sizeof(psw));
594}
595
596static void __init setup_vmcoreinfo(void) 596static void __init setup_vmcoreinfo(void)
597{ 597{
598#ifdef CONFIG_KEXEC 598#ifdef CONFIG_KEXEC
@@ -747,7 +747,7 @@ static void __init reserve_crashkernel(void)
747{ 747{
748#ifdef CONFIG_CRASH_DUMP 748#ifdef CONFIG_CRASH_DUMP
749 unsigned long long crash_base, crash_size; 749 unsigned long long crash_base, crash_size;
750 char *msg; 750 char *msg = NULL;
751 int rc; 751 int rc;
752 752
753 rc = parse_crashkernel(boot_command_line, memory_end, &crash_size, 753 rc = parse_crashkernel(boot_command_line, memory_end, &crash_size,
@@ -779,11 +779,11 @@ static void __init reserve_crashkernel(void)
779 pr_info("Reserving %lluMB of memory at %lluMB " 779 pr_info("Reserving %lluMB of memory at %lluMB "
780 "for crashkernel (System RAM: %luMB)\n", 780 "for crashkernel (System RAM: %luMB)\n",
781 crash_size >> 20, crash_base >> 20, memory_end >> 20); 781 crash_size >> 20, crash_base >> 20, memory_end >> 20);
782 os_info_crashkernel_add(crash_base, crash_size);
782#endif 783#endif
783} 784}
784 785
785static void __init 786static void __init setup_memory(void)
786setup_memory(void)
787{ 787{
788 unsigned long bootmap_size; 788 unsigned long bootmap_size;
789 unsigned long start_pfn, end_pfn; 789 unsigned long start_pfn, end_pfn;
@@ -1014,8 +1014,7 @@ static void __init setup_hwcaps(void)
1014 * was printed. 1014 * was printed.
1015 */ 1015 */
1016 1016
1017void __init 1017void __init setup_arch(char **cmdline_p)
1018setup_arch(char **cmdline_p)
1019{ 1018{
1020 /* 1019 /*
1021 * print what head.S has found out about the machine 1020 * print what head.S has found out about the machine
@@ -1060,6 +1059,7 @@ setup_arch(char **cmdline_p)
1060 1059
1061 parse_early_param(); 1060 parse_early_param();
1062 1061
1062 os_info_init();
1063 setup_ipl(); 1063 setup_ipl();
1064 setup_memory_end(); 1064 setup_memory_end();
1065 setup_addressing_mode(); 1065 setup_addressing_mode();
@@ -1068,7 +1068,6 @@ setup_arch(char **cmdline_p)
1068 setup_memory(); 1068 setup_memory();
1069 setup_resources(); 1069 setup_resources();
1070 setup_vmcoreinfo(); 1070 setup_vmcoreinfo();
1071 setup_restart_psw();
1072 setup_lowcore(); 1071 setup_lowcore();
1073 1072
1074 cpu_init(); 1073 cpu_init();
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 2d421d90fad..f29f5ef400e 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -384,7 +384,6 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka,
384 siginfo_t *info, sigset_t *oldset, 384 siginfo_t *info, sigset_t *oldset,
385 struct pt_regs *regs) 385 struct pt_regs *regs)
386{ 386{
387 sigset_t blocked;
388 int ret; 387 int ret;
389 388
390 /* Set up the stack frame */ 389 /* Set up the stack frame */
@@ -394,10 +393,7 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka,
394 ret = setup_frame(sig, ka, oldset, regs); 393 ret = setup_frame(sig, ka, oldset, regs);
395 if (ret) 394 if (ret)
396 return ret; 395 return ret;
397 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask); 396 block_sigmask(ka, sig);
398 if (!(ka->sa.sa_flags & SA_NODEFER))
399 sigaddset(&blocked, sig);
400 set_current_blocked(&blocked);
401 return 0; 397 return 0;
402} 398}
403 399
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index b0e28c47ab8..a8bf9994b08 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -1,23 +1,18 @@
1/* 1/*
2 * arch/s390/kernel/smp.c 2 * SMP related functions
3 * 3 *
4 * Copyright IBM Corp. 1999, 2009 4 * Copyright IBM Corp. 1999,2012
5 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 5 * Author(s): Denis Joseph Barrow,
6 * Martin Schwidefsky (schwidefsky@de.ibm.com) 6 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
7 * Heiko Carstens (heiko.carstens@de.ibm.com) 7 * Heiko Carstens <heiko.carstens@de.ibm.com>,
8 * 8 *
9 * based on other smp stuff by 9 * based on other smp stuff by
10 * (c) 1995 Alan Cox, CymruNET Ltd <alan@cymru.net> 10 * (c) 1995 Alan Cox, CymruNET Ltd <alan@cymru.net>
11 * (c) 1998 Ingo Molnar 11 * (c) 1998 Ingo Molnar
12 * 12 *
13 * We work with logical cpu numbering everywhere we can. The only 13 * The code outside of smp.c uses logical cpu numbers, only smp.c does
14 * functions using the real cpu address (got from STAP) are the sigp 14 * the translation of logical to physical cpu ids. All new code that
15 * functions. For all other functions we use the identity mapping. 15 * operates on physical cpu numbers needs to go into smp.c.
16 * That means that cpu_number_map[i] == i for every cpu. cpu_number_map is
17 * used e.g. to find the idle task belonging to a logical cpu. Every array
18 * in the kernel is sorted by the logical cpu number and not by the physical
19 * one which is causing all the confusion with __cpu_logical_map and
20 * cpu_number_map in other architectures.
21 */ 16 */
22 17
23#define KMSG_COMPONENT "cpu" 18#define KMSG_COMPONENT "cpu"
@@ -31,198 +26,433 @@
31#include <linux/spinlock.h> 26#include <linux/spinlock.h>
32#include <linux/kernel_stat.h> 27#include <linux/kernel_stat.h>
33#include <linux/delay.h> 28#include <linux/delay.h>
34#include <linux/cache.h>
35#include <linux/interrupt.h> 29#include <linux/interrupt.h>
36#include <linux/irqflags.h> 30#include <linux/irqflags.h>
37#include <linux/cpu.h> 31#include <linux/cpu.h>
38#include <linux/timex.h>
39#include <linux/bootmem.h>
40#include <linux/slab.h> 32#include <linux/slab.h>
41#include <linux/crash_dump.h> 33#include <linux/crash_dump.h>
42#include <asm/asm-offsets.h> 34#include <asm/asm-offsets.h>
43#include <asm/ipl.h> 35#include <asm/ipl.h>
44#include <asm/setup.h> 36#include <asm/setup.h>
45#include <asm/sigp.h>
46#include <asm/pgalloc.h>
47#include <asm/irq.h> 37#include <asm/irq.h>
48#include <asm/cpcmd.h>
49#include <asm/tlbflush.h> 38#include <asm/tlbflush.h>
50#include <asm/timer.h> 39#include <asm/timer.h>
51#include <asm/lowcore.h> 40#include <asm/lowcore.h>
52#include <asm/sclp.h> 41#include <asm/sclp.h>
53#include <asm/cputime.h>
54#include <asm/vdso.h> 42#include <asm/vdso.h>
55#include <asm/cpu.h> 43#include <asm/debug.h>
44#include <asm/os_info.h>
56#include "entry.h" 45#include "entry.h"
57 46
58/* logical cpu to cpu address */ 47enum {
59unsigned short __cpu_logical_map[NR_CPUS]; 48 sigp_sense = 1,
49 sigp_external_call = 2,
50 sigp_emergency_signal = 3,
51 sigp_start = 4,
52 sigp_stop = 5,
53 sigp_restart = 6,
54 sigp_stop_and_store_status = 9,
55 sigp_initial_cpu_reset = 11,
56 sigp_cpu_reset = 12,
57 sigp_set_prefix = 13,
58 sigp_store_status_at_address = 14,
59 sigp_store_extended_status_at_address = 15,
60 sigp_set_architecture = 18,
61 sigp_conditional_emergency_signal = 19,
62 sigp_sense_running = 21,
63};
60 64
61static struct task_struct *current_set[NR_CPUS]; 65enum {
66 sigp_order_code_accepted = 0,
67 sigp_status_stored = 1,
68 sigp_busy = 2,
69 sigp_not_operational = 3,
70};
62 71
63static u8 smp_cpu_type; 72enum {
64static int smp_use_sigp_detection; 73 ec_schedule = 0,
74 ec_call_function,
75 ec_call_function_single,
76 ec_stop_cpu,
77};
65 78
66enum s390_cpu_state { 79enum {
67 CPU_STATE_STANDBY, 80 CPU_STATE_STANDBY,
68 CPU_STATE_CONFIGURED, 81 CPU_STATE_CONFIGURED,
69}; 82};
70 83
84struct pcpu {
85 struct cpu cpu;
86 struct task_struct *idle; /* idle process for the cpu */
87 struct _lowcore *lowcore; /* lowcore page(s) for the cpu */
88 unsigned long async_stack; /* async stack for the cpu */
89 unsigned long panic_stack; /* panic stack for the cpu */
90 unsigned long ec_mask; /* bit mask for ec_xxx functions */
91 int state; /* physical cpu state */
92 u32 status; /* last status received via sigp */
93 u16 address; /* physical cpu address */
94};
95
96static u8 boot_cpu_type;
97static u16 boot_cpu_address;
98static struct pcpu pcpu_devices[NR_CPUS];
99
71DEFINE_MUTEX(smp_cpu_state_mutex); 100DEFINE_MUTEX(smp_cpu_state_mutex);
72static int smp_cpu_state[NR_CPUS];
73 101
74static DEFINE_PER_CPU(struct cpu, cpu_devices); 102/*
103 * Signal processor helper functions.
104 */
105static inline int __pcpu_sigp(u16 addr, u8 order, u32 parm, u32 *status)
106{
107 register unsigned int reg1 asm ("1") = parm;
108 int cc;
75 109
76static void smp_ext_bitcall(int, int); 110 asm volatile(
111 " sigp %1,%2,0(%3)\n"
112 " ipm %0\n"
113 " srl %0,28\n"
114 : "=d" (cc), "+d" (reg1) : "d" (addr), "a" (order) : "cc");
115 if (status && cc == 1)
116 *status = reg1;
117 return cc;
118}
77 119
78static int raw_cpu_stopped(int cpu) 120static inline int __pcpu_sigp_relax(u16 addr, u8 order, u32 parm, u32 *status)
79{ 121{
80 u32 status; 122 int cc;
81 123
82 switch (raw_sigp_ps(&status, 0, cpu, sigp_sense)) { 124 while (1) {
83 case sigp_status_stored: 125 cc = __pcpu_sigp(addr, order, parm, status);
84 /* Check for stopped and check stop state */ 126 if (cc != sigp_busy)
85 if (status & 0x50) 127 return cc;
86 return 1; 128 cpu_relax();
87 break;
88 default:
89 break;
90 } 129 }
91 return 0;
92} 130}
93 131
94static inline int cpu_stopped(int cpu) 132static int pcpu_sigp_retry(struct pcpu *pcpu, u8 order, u32 parm)
133{
134 int cc, retry;
135
136 for (retry = 0; ; retry++) {
137 cc = __pcpu_sigp(pcpu->address, order, parm, &pcpu->status);
138 if (cc != sigp_busy)
139 break;
140 if (retry >= 3)
141 udelay(10);
142 }
143 return cc;
144}
145
146static inline int pcpu_stopped(struct pcpu *pcpu)
147{
148 if (__pcpu_sigp(pcpu->address, sigp_sense,
149 0, &pcpu->status) != sigp_status_stored)
150 return 0;
151 /* Check for stopped and check stop state */
152 return !!(pcpu->status & 0x50);
153}
154
155static inline int pcpu_running(struct pcpu *pcpu)
95{ 156{
96 return raw_cpu_stopped(cpu_logical_map(cpu)); 157 if (__pcpu_sigp(pcpu->address, sigp_sense_running,
158 0, &pcpu->status) != sigp_status_stored)
159 return 1;
160 /* Check for running status */
161 return !(pcpu->status & 0x400);
97} 162}
98 163
99/* 164/*
100 * Ensure that PSW restart is done on an online CPU 165 * Find struct pcpu by cpu address.
101 */ 166 */
102void smp_restart_with_online_cpu(void) 167static struct pcpu *pcpu_find_address(const struct cpumask *mask, int address)
103{ 168{
104 int cpu; 169 int cpu;
105 170
106 for_each_online_cpu(cpu) { 171 for_each_cpu(cpu, mask)
107 if (stap() == __cpu_logical_map[cpu]) { 172 if (pcpu_devices[cpu].address == address)
108 /* We are online: Enable DAT again and return */ 173 return pcpu_devices + cpu;
109 __load_psw_mask(psw_kernel_bits | PSW_MASK_DAT); 174 return NULL;
110 return; 175}
111 } 176
177static void pcpu_ec_call(struct pcpu *pcpu, int ec_bit)
178{
179 int order;
180
181 set_bit(ec_bit, &pcpu->ec_mask);
182 order = pcpu_running(pcpu) ?
183 sigp_external_call : sigp_emergency_signal;
184 pcpu_sigp_retry(pcpu, order, 0);
185}
186
187static int __cpuinit pcpu_alloc_lowcore(struct pcpu *pcpu, int cpu)
188{
189 struct _lowcore *lc;
190
191 if (pcpu != &pcpu_devices[0]) {
192 pcpu->lowcore = (struct _lowcore *)
193 __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER);
194 pcpu->async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
195 pcpu->panic_stack = __get_free_page(GFP_KERNEL);
196 if (!pcpu->lowcore || !pcpu->panic_stack || !pcpu->async_stack)
197 goto out;
112 } 198 }
113 /* We are not online: Do PSW restart on an online CPU */ 199 lc = pcpu->lowcore;
114 while (sigp(cpu, sigp_restart) == sigp_busy) 200 memcpy(lc, &S390_lowcore, 512);
115 cpu_relax(); 201 memset((char *) lc + 512, 0, sizeof(*lc) - 512);
116 /* And stop ourself */ 202 lc->async_stack = pcpu->async_stack + ASYNC_SIZE;
117 while (raw_sigp(stap(), sigp_stop) == sigp_busy) 203 lc->panic_stack = pcpu->panic_stack + PAGE_SIZE;
118 cpu_relax(); 204 lc->cpu_nr = cpu;
119 for (;;); 205#ifndef CONFIG_64BIT
206 if (MACHINE_HAS_IEEE) {
207 lc->extended_save_area_addr = get_zeroed_page(GFP_KERNEL);
208 if (!lc->extended_save_area_addr)
209 goto out;
210 }
211#else
212 if (vdso_alloc_per_cpu(lc))
213 goto out;
214#endif
215 lowcore_ptr[cpu] = lc;
216 pcpu_sigp_retry(pcpu, sigp_set_prefix, (u32)(unsigned long) lc);
217 return 0;
218out:
219 if (pcpu != &pcpu_devices[0]) {
220 free_page(pcpu->panic_stack);
221 free_pages(pcpu->async_stack, ASYNC_ORDER);
222 free_pages((unsigned long) pcpu->lowcore, LC_ORDER);
223 }
224 return -ENOMEM;
120} 225}
121 226
122void smp_switch_to_ipl_cpu(void (*func)(void *), void *data) 227static void pcpu_free_lowcore(struct pcpu *pcpu)
123{ 228{
124 struct _lowcore *lc, *current_lc; 229 pcpu_sigp_retry(pcpu, sigp_set_prefix, 0);
125 struct stack_frame *sf; 230 lowcore_ptr[pcpu - pcpu_devices] = NULL;
126 struct pt_regs *regs; 231#ifndef CONFIG_64BIT
127 unsigned long sp; 232 if (MACHINE_HAS_IEEE) {
128 233 struct _lowcore *lc = pcpu->lowcore;
129 if (smp_processor_id() == 0) 234
130 func(data); 235 free_page((unsigned long) lc->extended_save_area_addr);
131 __load_psw_mask(PSW_DEFAULT_KEY | PSW_MASK_BASE | 236 lc->extended_save_area_addr = 0;
132 PSW_MASK_EA | PSW_MASK_BA); 237 }
133 /* Disable lowcore protection */ 238#else
134 __ctl_clear_bit(0, 28); 239 vdso_free_per_cpu(pcpu->lowcore);
135 current_lc = lowcore_ptr[smp_processor_id()]; 240#endif
136 lc = lowcore_ptr[0]; 241 if (pcpu != &pcpu_devices[0]) {
137 if (!lc) 242 free_page(pcpu->panic_stack);
138 lc = current_lc; 243 free_pages(pcpu->async_stack, ASYNC_ORDER);
139 lc->restart_psw.mask = 244 free_pages((unsigned long) pcpu->lowcore, LC_ORDER);
140 PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA; 245 }
141 lc->restart_psw.addr = PSW_ADDR_AMODE | (unsigned long) smp_restart_cpu; 246}
142 if (!cpu_online(0)) 247
143 smp_switch_to_cpu(func, data, 0, stap(), __cpu_logical_map[0]); 248static void pcpu_prepare_secondary(struct pcpu *pcpu, int cpu)
144 while (sigp(0, sigp_stop_and_store_status) == sigp_busy) 249{
145 cpu_relax(); 250 struct _lowcore *lc = pcpu->lowcore;
146 sp = lc->panic_stack; 251
147 sp -= sizeof(struct pt_regs); 252 atomic_inc(&init_mm.context.attach_count);
148 regs = (struct pt_regs *) sp; 253 lc->cpu_nr = cpu;
149 memcpy(&regs->gprs, &current_lc->gpregs_save_area, sizeof(regs->gprs)); 254 lc->percpu_offset = __per_cpu_offset[cpu];
150 regs->psw = current_lc->psw_save_area; 255 lc->kernel_asce = S390_lowcore.kernel_asce;
151 sp -= STACK_FRAME_OVERHEAD; 256 lc->machine_flags = S390_lowcore.machine_flags;
152 sf = (struct stack_frame *) sp; 257 lc->ftrace_func = S390_lowcore.ftrace_func;
153 sf->back_chain = 0; 258 lc->user_timer = lc->system_timer = lc->steal_timer = 0;
154 smp_switch_to_cpu(func, data, sp, stap(), __cpu_logical_map[0]); 259 __ctl_store(lc->cregs_save_area, 0, 15);
260 save_access_regs((unsigned int *) lc->access_regs_save_area);
261 memcpy(lc->stfle_fac_list, S390_lowcore.stfle_fac_list,
262 MAX_FACILITY_BIT/8);
263}
264
265static void pcpu_attach_task(struct pcpu *pcpu, struct task_struct *tsk)
266{
267 struct _lowcore *lc = pcpu->lowcore;
268 struct thread_info *ti = task_thread_info(tsk);
269
270 lc->kernel_stack = (unsigned long) task_stack_page(tsk) + THREAD_SIZE;
271 lc->thread_info = (unsigned long) task_thread_info(tsk);
272 lc->current_task = (unsigned long) tsk;
273 lc->user_timer = ti->user_timer;
274 lc->system_timer = ti->system_timer;
275 lc->steal_timer = 0;
276}
277
278static void pcpu_start_fn(struct pcpu *pcpu, void (*func)(void *), void *data)
279{
280 struct _lowcore *lc = pcpu->lowcore;
281
282 lc->restart_stack = lc->kernel_stack;
283 lc->restart_fn = (unsigned long) func;
284 lc->restart_data = (unsigned long) data;
285 lc->restart_source = -1UL;
286 pcpu_sigp_retry(pcpu, sigp_restart, 0);
287}
288
289/*
290 * Call function via PSW restart on pcpu and stop the current cpu.
291 */
292static void pcpu_delegate(struct pcpu *pcpu, void (*func)(void *),
293 void *data, unsigned long stack)
294{
295 struct _lowcore *lc = pcpu->lowcore;
296 unsigned short this_cpu;
297
298 __load_psw_mask(psw_kernel_bits);
299 this_cpu = stap();
300 if (pcpu->address == this_cpu)
301 func(data); /* should not return */
302 /* Stop target cpu (if func returns this stops the current cpu). */
303 pcpu_sigp_retry(pcpu, sigp_stop, 0);
304 /* Restart func on the target cpu and stop the current cpu. */
305 lc->restart_stack = stack;
306 lc->restart_fn = (unsigned long) func;
307 lc->restart_data = (unsigned long) data;
308 lc->restart_source = (unsigned long) this_cpu;
309 asm volatile(
310 "0: sigp 0,%0,6 # sigp restart to target cpu\n"
311 " brc 2,0b # busy, try again\n"
312 "1: sigp 0,%1,5 # sigp stop to current cpu\n"
313 " brc 2,1b # busy, try again\n"
314 : : "d" (pcpu->address), "d" (this_cpu) : "0", "1", "cc");
315 for (;;) ;
316}
317
318/*
319 * Call function on an online CPU.
320 */
321void smp_call_online_cpu(void (*func)(void *), void *data)
322{
323 struct pcpu *pcpu;
324
325 /* Use the current cpu if it is online. */
326 pcpu = pcpu_find_address(cpu_online_mask, stap());
327 if (!pcpu)
328 /* Use the first online cpu. */
329 pcpu = pcpu_devices + cpumask_first(cpu_online_mask);
330 pcpu_delegate(pcpu, func, data, (unsigned long) restart_stack);
331}
332
333/*
334 * Call function on the ipl CPU.
335 */
336void smp_call_ipl_cpu(void (*func)(void *), void *data)
337{
338 pcpu_delegate(&pcpu_devices[0], func, data,
339 pcpu_devices->panic_stack + PAGE_SIZE);
340}
341
342int smp_find_processor_id(u16 address)
343{
344 int cpu;
345
346 for_each_present_cpu(cpu)
347 if (pcpu_devices[cpu].address == address)
348 return cpu;
349 return -1;
350}
351
352int smp_vcpu_scheduled(int cpu)
353{
354 return pcpu_running(pcpu_devices + cpu);
355}
356
357void smp_yield(void)
358{
359 if (MACHINE_HAS_DIAG44)
360 asm volatile("diag 0,0,0x44");
155} 361}
156 362
157static void smp_stop_cpu(void) 363void smp_yield_cpu(int cpu)
158{ 364{
159 while (sigp(smp_processor_id(), sigp_stop) == sigp_busy) 365 if (MACHINE_HAS_DIAG9C)
366 asm volatile("diag %0,0,0x9c"
367 : : "d" (pcpu_devices[cpu].address));
368 else if (MACHINE_HAS_DIAG44)
369 asm volatile("diag 0,0,0x44");
370}
371
372/*
373 * Send cpus emergency shutdown signal. This gives the cpus the
374 * opportunity to complete outstanding interrupts.
375 */
376void smp_emergency_stop(cpumask_t *cpumask)
377{
378 u64 end;
379 int cpu;
380
381 end = get_clock() + (1000000UL << 12);
382 for_each_cpu(cpu, cpumask) {
383 struct pcpu *pcpu = pcpu_devices + cpu;
384 set_bit(ec_stop_cpu, &pcpu->ec_mask);
385 while (__pcpu_sigp(pcpu->address, sigp_emergency_signal,
386 0, NULL) == sigp_busy &&
387 get_clock() < end)
388 cpu_relax();
389 }
390 while (get_clock() < end) {
391 for_each_cpu(cpu, cpumask)
392 if (pcpu_stopped(pcpu_devices + cpu))
393 cpumask_clear_cpu(cpu, cpumask);
394 if (cpumask_empty(cpumask))
395 break;
160 cpu_relax(); 396 cpu_relax();
397 }
161} 398}
162 399
400/*
401 * Stop all cpus but the current one.
402 */
163void smp_send_stop(void) 403void smp_send_stop(void)
164{ 404{
165 cpumask_t cpumask; 405 cpumask_t cpumask;
166 int cpu; 406 int cpu;
167 u64 end;
168 407
169 /* Disable all interrupts/machine checks */ 408 /* Disable all interrupts/machine checks */
170 __load_psw_mask(psw_kernel_bits | PSW_MASK_DAT); 409 __load_psw_mask(psw_kernel_bits | PSW_MASK_DAT);
171 trace_hardirqs_off(); 410 trace_hardirqs_off();
172 411
412 debug_set_critical();
173 cpumask_copy(&cpumask, cpu_online_mask); 413 cpumask_copy(&cpumask, cpu_online_mask);
174 cpumask_clear_cpu(smp_processor_id(), &cpumask); 414 cpumask_clear_cpu(smp_processor_id(), &cpumask);
175 415
176 if (oops_in_progress) { 416 if (oops_in_progress)
177 /* 417 smp_emergency_stop(&cpumask);
178 * Give the other cpus the opportunity to complete
179 * outstanding interrupts before stopping them.
180 */
181 end = get_clock() + (1000000UL << 12);
182 for_each_cpu(cpu, &cpumask) {
183 set_bit(ec_stop_cpu, (unsigned long *)
184 &lowcore_ptr[cpu]->ext_call_fast);
185 while (sigp(cpu, sigp_emergency_signal) == sigp_busy &&
186 get_clock() < end)
187 cpu_relax();
188 }
189 while (get_clock() < end) {
190 for_each_cpu(cpu, &cpumask)
191 if (cpu_stopped(cpu))
192 cpumask_clear_cpu(cpu, &cpumask);
193 if (cpumask_empty(&cpumask))
194 break;
195 cpu_relax();
196 }
197 }
198 418
199 /* stop all processors */ 419 /* stop all processors */
200 for_each_cpu(cpu, &cpumask) { 420 for_each_cpu(cpu, &cpumask) {
201 while (sigp(cpu, sigp_stop) == sigp_busy) 421 struct pcpu *pcpu = pcpu_devices + cpu;
202 cpu_relax(); 422 pcpu_sigp_retry(pcpu, sigp_stop, 0);
203 while (!cpu_stopped(cpu)) 423 while (!pcpu_stopped(pcpu))
204 cpu_relax(); 424 cpu_relax();
205 } 425 }
206} 426}
207 427
208/* 428/*
429 * Stop the current cpu.
430 */
431void smp_stop_cpu(void)
432{
433 pcpu_sigp_retry(pcpu_devices + smp_processor_id(), sigp_stop, 0);
434 for (;;) ;
435}
436
437/*
209 * This is the main routine where commands issued by other 438 * This is the main routine where commands issued by other
210 * cpus are handled. 439 * cpus are handled.
211 */ 440 */
212 441static void do_ext_call_interrupt(struct ext_code ext_code,
213static void do_ext_call_interrupt(unsigned int ext_int_code,
214 unsigned int param32, unsigned long param64) 442 unsigned int param32, unsigned long param64)
215{ 443{
216 unsigned long bits; 444 unsigned long bits;
445 int cpu;
217 446
218 if ((ext_int_code & 0xffff) == 0x1202) 447 cpu = smp_processor_id();
219 kstat_cpu(smp_processor_id()).irqs[EXTINT_EXC]++; 448 if (ext_code.code == 0x1202)
449 kstat_cpu(cpu).irqs[EXTINT_EXC]++;
220 else 450 else
221 kstat_cpu(smp_processor_id()).irqs[EXTINT_EMS]++; 451 kstat_cpu(cpu).irqs[EXTINT_EMS]++;
222 /* 452 /*
223 * handle bit signal external calls 453 * handle bit signal external calls
224 */ 454 */
225 bits = xchg(&S390_lowcore.ext_call_fast, 0); 455 bits = xchg(&pcpu_devices[cpu].ec_mask, 0);
226 456
227 if (test_bit(ec_stop_cpu, &bits)) 457 if (test_bit(ec_stop_cpu, &bits))
228 smp_stop_cpu(); 458 smp_stop_cpu();
@@ -238,38 +468,17 @@ static void do_ext_call_interrupt(unsigned int ext_int_code,
238 468
239} 469}
240 470
241/*
242 * Send an external call sigp to another cpu and return without waiting
243 * for its completion.
244 */
245static void smp_ext_bitcall(int cpu, int sig)
246{
247 int order;
248
249 /*
250 * Set signaling bit in lowcore of target cpu and kick it
251 */
252 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast);
253 while (1) {
254 order = smp_vcpu_scheduled(cpu) ?
255 sigp_external_call : sigp_emergency_signal;
256 if (sigp(cpu, order) != sigp_busy)
257 break;
258 udelay(10);
259 }
260}
261
262void arch_send_call_function_ipi_mask(const struct cpumask *mask) 471void arch_send_call_function_ipi_mask(const struct cpumask *mask)
263{ 472{
264 int cpu; 473 int cpu;
265 474
266 for_each_cpu(cpu, mask) 475 for_each_cpu(cpu, mask)
267 smp_ext_bitcall(cpu, ec_call_function); 476 pcpu_ec_call(pcpu_devices + cpu, ec_call_function);
268} 477}
269 478
270void arch_send_call_function_single_ipi(int cpu) 479void arch_send_call_function_single_ipi(int cpu)
271{ 480{
272 smp_ext_bitcall(cpu, ec_call_function_single); 481 pcpu_ec_call(pcpu_devices + cpu, ec_call_function_single);
273} 482}
274 483
275#ifndef CONFIG_64BIT 484#ifndef CONFIG_64BIT
@@ -295,15 +504,16 @@ EXPORT_SYMBOL(smp_ptlb_all);
295 */ 504 */
296void smp_send_reschedule(int cpu) 505void smp_send_reschedule(int cpu)
297{ 506{
298 smp_ext_bitcall(cpu, ec_schedule); 507 pcpu_ec_call(pcpu_devices + cpu, ec_schedule);
299} 508}
300 509
301/* 510/*
302 * parameter area for the set/clear control bit callbacks 511 * parameter area for the set/clear control bit callbacks
303 */ 512 */
304struct ec_creg_mask_parms { 513struct ec_creg_mask_parms {
305 unsigned long orvals[16]; 514 unsigned long orval;
306 unsigned long andvals[16]; 515 unsigned long andval;
516 int cr;
307}; 517};
308 518
309/* 519/*
@@ -313,11 +523,9 @@ static void smp_ctl_bit_callback(void *info)
313{ 523{
314 struct ec_creg_mask_parms *pp = info; 524 struct ec_creg_mask_parms *pp = info;
315 unsigned long cregs[16]; 525 unsigned long cregs[16];
316 int i;
317 526
318 __ctl_store(cregs, 0, 15); 527 __ctl_store(cregs, 0, 15);
319 for (i = 0; i <= 15; i++) 528 cregs[pp->cr] = (cregs[pp->cr] & pp->andval) | pp->orval;
320 cregs[i] = (cregs[i] & pp->andvals[i]) | pp->orvals[i];
321 __ctl_load(cregs, 0, 15); 529 __ctl_load(cregs, 0, 15);
322} 530}
323 531
@@ -326,11 +534,8 @@ static void smp_ctl_bit_callback(void *info)
326 */ 534 */
327void smp_ctl_set_bit(int cr, int bit) 535void smp_ctl_set_bit(int cr, int bit)
328{ 536{
329 struct ec_creg_mask_parms parms; 537 struct ec_creg_mask_parms parms = { 1UL << bit, -1UL, cr };
330 538
331 memset(&parms.orvals, 0, sizeof(parms.orvals));
332 memset(&parms.andvals, 0xff, sizeof(parms.andvals));
333 parms.orvals[cr] = 1UL << bit;
334 on_each_cpu(smp_ctl_bit_callback, &parms, 1); 539 on_each_cpu(smp_ctl_bit_callback, &parms, 1);
335} 540}
336EXPORT_SYMBOL(smp_ctl_set_bit); 541EXPORT_SYMBOL(smp_ctl_set_bit);
@@ -340,220 +545,178 @@ EXPORT_SYMBOL(smp_ctl_set_bit);
340 */ 545 */
341void smp_ctl_clear_bit(int cr, int bit) 546void smp_ctl_clear_bit(int cr, int bit)
342{ 547{
343 struct ec_creg_mask_parms parms; 548 struct ec_creg_mask_parms parms = { 0, ~(1UL << bit), cr };
344 549
345 memset(&parms.orvals, 0, sizeof(parms.orvals));
346 memset(&parms.andvals, 0xff, sizeof(parms.andvals));
347 parms.andvals[cr] = ~(1UL << bit);
348 on_each_cpu(smp_ctl_bit_callback, &parms, 1); 550 on_each_cpu(smp_ctl_bit_callback, &parms, 1);
349} 551}
350EXPORT_SYMBOL(smp_ctl_clear_bit); 552EXPORT_SYMBOL(smp_ctl_clear_bit);
351 553
352#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_CRASH_DUMP) 554#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_CRASH_DUMP)
353 555
354static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu) 556struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
557EXPORT_SYMBOL_GPL(zfcpdump_save_areas);
558
559static void __init smp_get_save_area(int cpu, u16 address)
355{ 560{
356 if (ipl_info.type != IPL_TYPE_FCP_DUMP && !OLDMEM_BASE) 561 void *lc = pcpu_devices[0].lowcore;
357 return; 562 struct save_area *save_area;
563
358 if (is_kdump_kernel()) 564 if (is_kdump_kernel())
359 return; 565 return;
566 if (!OLDMEM_BASE && (address == boot_cpu_address ||
567 ipl_info.type != IPL_TYPE_FCP_DUMP))
568 return;
360 if (cpu >= NR_CPUS) { 569 if (cpu >= NR_CPUS) {
361 pr_warning("CPU %i exceeds the maximum %i and is excluded from " 570 pr_warning("CPU %i exceeds the maximum %i and is excluded "
362 "the dump\n", cpu, NR_CPUS - 1); 571 "from the dump\n", cpu, NR_CPUS - 1);
363 return; 572 return;
364 } 573 }
365 zfcpdump_save_areas[cpu] = kmalloc(sizeof(struct save_area), GFP_KERNEL); 574 save_area = kmalloc(sizeof(struct save_area), GFP_KERNEL);
366 while (raw_sigp(phy_cpu, sigp_stop_and_store_status) == sigp_busy) 575 if (!save_area)
367 cpu_relax(); 576 panic("could not allocate memory for save area\n");
368 memcpy_real(zfcpdump_save_areas[cpu], 577 zfcpdump_save_areas[cpu] = save_area;
369 (void *)(unsigned long) store_prefix() + SAVE_AREA_BASE, 578#ifdef CONFIG_CRASH_DUMP
370 sizeof(struct save_area)); 579 if (address == boot_cpu_address) {
580 /* Copy the registers of the boot cpu. */
581 copy_oldmem_page(1, (void *) save_area, sizeof(*save_area),
582 SAVE_AREA_BASE - PAGE_SIZE, 0);
583 return;
584 }
585#endif
586 /* Get the registers of a non-boot cpu. */
587 __pcpu_sigp_relax(address, sigp_stop_and_store_status, 0, NULL);
588 memcpy_real(save_area, lc + SAVE_AREA_BASE, sizeof(*save_area));
371} 589}
372 590
373struct save_area *zfcpdump_save_areas[NR_CPUS + 1]; 591int smp_store_status(int cpu)
374EXPORT_SYMBOL_GPL(zfcpdump_save_areas);
375
376#else
377
378static inline void smp_get_save_area(unsigned int cpu, unsigned int phy_cpu) { }
379
380#endif /* CONFIG_ZFCPDUMP */
381
382static int cpu_known(int cpu_id)
383{ 592{
384 int cpu; 593 struct pcpu *pcpu;
385 594
386 for_each_present_cpu(cpu) { 595 pcpu = pcpu_devices + cpu;
387 if (__cpu_logical_map[cpu] == cpu_id) 596 if (__pcpu_sigp_relax(pcpu->address, sigp_stop_and_store_status,
388 return 1; 597 0, NULL) != sigp_order_code_accepted)
389 } 598 return -EIO;
390 return 0; 599 return 0;
391} 600}
392 601
393static int smp_rescan_cpus_sigp(cpumask_t avail) 602#else /* CONFIG_ZFCPDUMP || CONFIG_CRASH_DUMP */
394{
395 int cpu_id, logical_cpu;
396 603
397 logical_cpu = cpumask_first(&avail); 604static inline void smp_get_save_area(int cpu, u16 address) { }
398 if (logical_cpu >= nr_cpu_ids)
399 return 0;
400 for (cpu_id = 0; cpu_id <= MAX_CPU_ADDRESS; cpu_id++) {
401 if (cpu_known(cpu_id))
402 continue;
403 __cpu_logical_map[logical_cpu] = cpu_id;
404 cpu_set_polarization(logical_cpu, POLARIZATION_UNKNOWN);
405 if (!cpu_stopped(logical_cpu))
406 continue;
407 set_cpu_present(logical_cpu, true);
408 smp_cpu_state[logical_cpu] = CPU_STATE_CONFIGURED;
409 logical_cpu = cpumask_next(logical_cpu, &avail);
410 if (logical_cpu >= nr_cpu_ids)
411 break;
412 }
413 return 0;
414}
415 605
416static int smp_rescan_cpus_sclp(cpumask_t avail) 606#endif /* CONFIG_ZFCPDUMP || CONFIG_CRASH_DUMP */
607
608static struct sclp_cpu_info *smp_get_cpu_info(void)
417{ 609{
610 static int use_sigp_detection;
418 struct sclp_cpu_info *info; 611 struct sclp_cpu_info *info;
419 int cpu_id, logical_cpu, cpu; 612 int address;
420 int rc; 613
421 614 info = kzalloc(sizeof(*info), GFP_KERNEL);
422 logical_cpu = cpumask_first(&avail); 615 if (info && (use_sigp_detection || sclp_get_cpu_info(info))) {
423 if (logical_cpu >= nr_cpu_ids) 616 use_sigp_detection = 1;
424 return 0; 617 for (address = 0; address <= MAX_CPU_ADDRESS; address++) {
425 info = kmalloc(sizeof(*info), GFP_KERNEL); 618 if (__pcpu_sigp_relax(address, sigp_sense, 0, NULL) ==
426 if (!info) 619 sigp_not_operational)
427 return -ENOMEM; 620 continue;
428 rc = sclp_get_cpu_info(info); 621 info->cpu[info->configured].address = address;
429 if (rc) 622 info->configured++;
430 goto out; 623 }
431 for (cpu = 0; cpu < info->combined; cpu++) { 624 info->combined = info->configured;
432 if (info->has_cpu_type && info->cpu[cpu].type != smp_cpu_type)
433 continue;
434 cpu_id = info->cpu[cpu].address;
435 if (cpu_known(cpu_id))
436 continue;
437 __cpu_logical_map[logical_cpu] = cpu_id;
438 cpu_set_polarization(logical_cpu, POLARIZATION_UNKNOWN);
439 set_cpu_present(logical_cpu, true);
440 if (cpu >= info->configured)
441 smp_cpu_state[logical_cpu] = CPU_STATE_STANDBY;
442 else
443 smp_cpu_state[logical_cpu] = CPU_STATE_CONFIGURED;
444 logical_cpu = cpumask_next(logical_cpu, &avail);
445 if (logical_cpu >= nr_cpu_ids)
446 break;
447 } 625 }
448out: 626 return info;
449 kfree(info);
450 return rc;
451} 627}
452 628
453static int __smp_rescan_cpus(void) 629static int __devinit smp_add_present_cpu(int cpu);
630
631static int __devinit __smp_rescan_cpus(struct sclp_cpu_info *info,
632 int sysfs_add)
454{ 633{
634 struct pcpu *pcpu;
455 cpumask_t avail; 635 cpumask_t avail;
636 int cpu, nr, i;
456 637
638 nr = 0;
457 cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask); 639 cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask);
458 if (smp_use_sigp_detection) 640 cpu = cpumask_first(&avail);
459 return smp_rescan_cpus_sigp(avail); 641 for (i = 0; (i < info->combined) && (cpu < nr_cpu_ids); i++) {
460 else 642 if (info->has_cpu_type && info->cpu[i].type != boot_cpu_type)
461 return smp_rescan_cpus_sclp(avail); 643 continue;
644 if (pcpu_find_address(cpu_present_mask, info->cpu[i].address))
645 continue;
646 pcpu = pcpu_devices + cpu;
647 pcpu->address = info->cpu[i].address;
648 pcpu->state = (cpu >= info->configured) ?
649 CPU_STATE_STANDBY : CPU_STATE_CONFIGURED;
650 cpu_set_polarization(cpu, POLARIZATION_UNKNOWN);
651 set_cpu_present(cpu, true);
652 if (sysfs_add && smp_add_present_cpu(cpu) != 0)
653 set_cpu_present(cpu, false);
654 else
655 nr++;
656 cpu = cpumask_next(cpu, &avail);
657 }
658 return nr;
462} 659}
463 660
464static void __init smp_detect_cpus(void) 661static void __init smp_detect_cpus(void)
465{ 662{
466 unsigned int cpu, c_cpus, s_cpus; 663 unsigned int cpu, c_cpus, s_cpus;
467 struct sclp_cpu_info *info; 664 struct sclp_cpu_info *info;
468 u16 boot_cpu_addr, cpu_addr;
469 665
470 c_cpus = 1; 666 info = smp_get_cpu_info();
471 s_cpus = 0;
472 boot_cpu_addr = __cpu_logical_map[0];
473 info = kmalloc(sizeof(*info), GFP_KERNEL);
474 if (!info) 667 if (!info)
475 panic("smp_detect_cpus failed to allocate memory\n"); 668 panic("smp_detect_cpus failed to allocate memory\n");
476#ifdef CONFIG_CRASH_DUMP
477 if (OLDMEM_BASE && !is_kdump_kernel()) {
478 struct save_area *save_area;
479
480 save_area = kmalloc(sizeof(*save_area), GFP_KERNEL);
481 if (!save_area)
482 panic("could not allocate memory for save area\n");
483 copy_oldmem_page(1, (void *) save_area, sizeof(*save_area),
484 0x200, 0);
485 zfcpdump_save_areas[0] = save_area;
486 }
487#endif
488 /* Use sigp detection algorithm if sclp doesn't work. */
489 if (sclp_get_cpu_info(info)) {
490 smp_use_sigp_detection = 1;
491 for (cpu = 0; cpu <= MAX_CPU_ADDRESS; cpu++) {
492 if (cpu == boot_cpu_addr)
493 continue;
494 if (!raw_cpu_stopped(cpu))
495 continue;
496 smp_get_save_area(c_cpus, cpu);
497 c_cpus++;
498 }
499 goto out;
500 }
501
502 if (info->has_cpu_type) { 669 if (info->has_cpu_type) {
503 for (cpu = 0; cpu < info->combined; cpu++) { 670 for (cpu = 0; cpu < info->combined; cpu++) {
504 if (info->cpu[cpu].address == boot_cpu_addr) { 671 if (info->cpu[cpu].address != boot_cpu_address)
505 smp_cpu_type = info->cpu[cpu].type; 672 continue;
506 break; 673 /* The boot cpu dictates the cpu type. */
507 } 674 boot_cpu_type = info->cpu[cpu].type;
675 break;
508 } 676 }
509 } 677 }
510 678 c_cpus = s_cpus = 0;
511 for (cpu = 0; cpu < info->combined; cpu++) { 679 for (cpu = 0; cpu < info->combined; cpu++) {
512 if (info->has_cpu_type && info->cpu[cpu].type != smp_cpu_type) 680 if (info->has_cpu_type && info->cpu[cpu].type != boot_cpu_type)
513 continue; 681 continue;
514 cpu_addr = info->cpu[cpu].address; 682 if (cpu < info->configured) {
515 if (cpu_addr == boot_cpu_addr) 683 smp_get_save_area(c_cpus, info->cpu[cpu].address);
516 continue; 684 c_cpus++;
517 if (!raw_cpu_stopped(cpu_addr)) { 685 } else
518 s_cpus++; 686 s_cpus++;
519 continue;
520 }
521 smp_get_save_area(c_cpus, cpu_addr);
522 c_cpus++;
523 } 687 }
524out:
525 kfree(info);
526 pr_info("%d configured CPUs, %d standby CPUs\n", c_cpus, s_cpus); 688 pr_info("%d configured CPUs, %d standby CPUs\n", c_cpus, s_cpus);
527 get_online_cpus(); 689 get_online_cpus();
528 __smp_rescan_cpus(); 690 __smp_rescan_cpus(info, 0);
529 put_online_cpus(); 691 put_online_cpus();
692 kfree(info);
530} 693}
531 694
532/* 695/*
533 * Activate a secondary processor. 696 * Activate a secondary processor.
534 */ 697 */
535int __cpuinit start_secondary(void *cpuvoid) 698static void __cpuinit smp_start_secondary(void *cpuvoid)
536{ 699{
700 S390_lowcore.last_update_clock = get_clock();
701 S390_lowcore.restart_stack = (unsigned long) restart_stack;
702 S390_lowcore.restart_fn = (unsigned long) do_restart;
703 S390_lowcore.restart_data = 0;
704 S390_lowcore.restart_source = -1UL;
705 restore_access_regs(S390_lowcore.access_regs_save_area);
706 __ctl_load(S390_lowcore.cregs_save_area, 0, 15);
707 __load_psw_mask(psw_kernel_bits | PSW_MASK_DAT);
537 cpu_init(); 708 cpu_init();
538 preempt_disable(); 709 preempt_disable();
539 init_cpu_timer(); 710 init_cpu_timer();
540 init_cpu_vtimer(); 711 init_cpu_vtimer();
541 pfault_init(); 712 pfault_init();
542
543 notify_cpu_starting(smp_processor_id()); 713 notify_cpu_starting(smp_processor_id());
544 ipi_call_lock(); 714 ipi_call_lock();
545 set_cpu_online(smp_processor_id(), true); 715 set_cpu_online(smp_processor_id(), true);
546 ipi_call_unlock(); 716 ipi_call_unlock();
547 __ctl_clear_bit(0, 28); /* Disable lowcore protection */
548 S390_lowcore.restart_psw.mask =
549 PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA;
550 S390_lowcore.restart_psw.addr =
551 PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler;
552 __ctl_set_bit(0, 28); /* Enable lowcore protection */
553 local_irq_enable(); 717 local_irq_enable();
554 /* cpu_idle will call schedule for us */ 718 /* cpu_idle will call schedule for us */
555 cpu_idle(); 719 cpu_idle();
556 return 0;
557} 720}
558 721
559struct create_idle { 722struct create_idle {
@@ -572,82 +735,20 @@ static void __cpuinit smp_fork_idle(struct work_struct *work)
572 complete(&c_idle->done); 735 complete(&c_idle->done);
573} 736}
574 737
575static int __cpuinit smp_alloc_lowcore(int cpu)
576{
577 unsigned long async_stack, panic_stack;
578 struct _lowcore *lowcore;
579
580 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER);
581 if (!lowcore)
582 return -ENOMEM;
583 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
584 panic_stack = __get_free_page(GFP_KERNEL);
585 if (!panic_stack || !async_stack)
586 goto out;
587 memcpy(lowcore, &S390_lowcore, 512);
588 memset((char *)lowcore + 512, 0, sizeof(*lowcore) - 512);
589 lowcore->async_stack = async_stack + ASYNC_SIZE;
590 lowcore->panic_stack = panic_stack + PAGE_SIZE;
591 lowcore->restart_psw.mask =
592 PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA;
593 lowcore->restart_psw.addr =
594 PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
595 if (user_mode != HOME_SPACE_MODE)
596 lowcore->restart_psw.mask |= PSW_ASC_HOME;
597#ifndef CONFIG_64BIT
598 if (MACHINE_HAS_IEEE) {
599 unsigned long save_area;
600
601 save_area = get_zeroed_page(GFP_KERNEL);
602 if (!save_area)
603 goto out;
604 lowcore->extended_save_area_addr = (u32) save_area;
605 }
606#else
607 if (vdso_alloc_per_cpu(cpu, lowcore))
608 goto out;
609#endif
610 lowcore_ptr[cpu] = lowcore;
611 return 0;
612
613out:
614 free_page(panic_stack);
615 free_pages(async_stack, ASYNC_ORDER);
616 free_pages((unsigned long) lowcore, LC_ORDER);
617 return -ENOMEM;
618}
619
620static void smp_free_lowcore(int cpu)
621{
622 struct _lowcore *lowcore;
623
624 lowcore = lowcore_ptr[cpu];
625#ifndef CONFIG_64BIT
626 if (MACHINE_HAS_IEEE)
627 free_page((unsigned long) lowcore->extended_save_area_addr);
628#else
629 vdso_free_per_cpu(cpu, lowcore);
630#endif
631 free_page(lowcore->panic_stack - PAGE_SIZE);
632 free_pages(lowcore->async_stack - ASYNC_SIZE, ASYNC_ORDER);
633 free_pages((unsigned long) lowcore, LC_ORDER);
634 lowcore_ptr[cpu] = NULL;
635}
636
637/* Upping and downing of CPUs */ 738/* Upping and downing of CPUs */
638int __cpuinit __cpu_up(unsigned int cpu) 739int __cpuinit __cpu_up(unsigned int cpu)
639{ 740{
640 struct _lowcore *cpu_lowcore;
641 struct create_idle c_idle; 741 struct create_idle c_idle;
642 struct task_struct *idle; 742 struct pcpu *pcpu;
643 struct stack_frame *sf; 743 int rc;
644 u32 lowcore;
645 int ccode;
646 744
647 if (smp_cpu_state[cpu] != CPU_STATE_CONFIGURED) 745 pcpu = pcpu_devices + cpu;
746 if (pcpu->state != CPU_STATE_CONFIGURED)
747 return -EIO;
748 if (pcpu_sigp_retry(pcpu, sigp_initial_cpu_reset, 0) !=
749 sigp_order_code_accepted)
648 return -EIO; 750 return -EIO;
649 idle = current_set[cpu]; 751 if (!pcpu->idle) {
650 if (!idle) {
651 c_idle.done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done); 752 c_idle.done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done);
652 INIT_WORK_ONSTACK(&c_idle.work, smp_fork_idle); 753 INIT_WORK_ONSTACK(&c_idle.work, smp_fork_idle);
653 c_idle.cpu = cpu; 754 c_idle.cpu = cpu;
@@ -655,68 +756,28 @@ int __cpuinit __cpu_up(unsigned int cpu)
655 wait_for_completion(&c_idle.done); 756 wait_for_completion(&c_idle.done);
656 if (IS_ERR(c_idle.idle)) 757 if (IS_ERR(c_idle.idle))
657 return PTR_ERR(c_idle.idle); 758 return PTR_ERR(c_idle.idle);
658 idle = c_idle.idle; 759 pcpu->idle = c_idle.idle;
659 current_set[cpu] = c_idle.idle;
660 } 760 }
661 init_idle(idle, cpu); 761 init_idle(pcpu->idle, cpu);
662 if (smp_alloc_lowcore(cpu)) 762 rc = pcpu_alloc_lowcore(pcpu, cpu);
663 return -ENOMEM; 763 if (rc)
664 do { 764 return rc;
665 ccode = sigp(cpu, sigp_initial_cpu_reset); 765 pcpu_prepare_secondary(pcpu, cpu);
666 if (ccode == sigp_busy) 766 pcpu_attach_task(pcpu, pcpu->idle);
667 udelay(10); 767 pcpu_start_fn(pcpu, smp_start_secondary, NULL);
668 if (ccode == sigp_not_operational)
669 goto err_out;
670 } while (ccode == sigp_busy);
671
672 lowcore = (u32)(unsigned long)lowcore_ptr[cpu];
673 while (sigp_p(lowcore, cpu, sigp_set_prefix) == sigp_busy)
674 udelay(10);
675
676 cpu_lowcore = lowcore_ptr[cpu];
677 cpu_lowcore->kernel_stack = (unsigned long)
678 task_stack_page(idle) + THREAD_SIZE;
679 cpu_lowcore->thread_info = (unsigned long) task_thread_info(idle);
680 sf = (struct stack_frame *) (cpu_lowcore->kernel_stack
681 - sizeof(struct pt_regs)
682 - sizeof(struct stack_frame));
683 memset(sf, 0, sizeof(struct stack_frame));
684 sf->gprs[9] = (unsigned long) sf;
685 cpu_lowcore->gpregs_save_area[15] = (unsigned long) sf;
686 __ctl_store(cpu_lowcore->cregs_save_area, 0, 15);
687 atomic_inc(&init_mm.context.attach_count);
688 asm volatile(
689 " stam 0,15,0(%0)"
690 : : "a" (&cpu_lowcore->access_regs_save_area) : "memory");
691 cpu_lowcore->percpu_offset = __per_cpu_offset[cpu];
692 cpu_lowcore->current_task = (unsigned long) idle;
693 cpu_lowcore->cpu_nr = cpu;
694 cpu_lowcore->kernel_asce = S390_lowcore.kernel_asce;
695 cpu_lowcore->machine_flags = S390_lowcore.machine_flags;
696 cpu_lowcore->ftrace_func = S390_lowcore.ftrace_func;
697 memcpy(cpu_lowcore->stfle_fac_list, S390_lowcore.stfle_fac_list,
698 MAX_FACILITY_BIT/8);
699 eieio();
700
701 while (sigp(cpu, sigp_restart) == sigp_busy)
702 udelay(10);
703
704 while (!cpu_online(cpu)) 768 while (!cpu_online(cpu))
705 cpu_relax(); 769 cpu_relax();
706 return 0; 770 return 0;
707
708err_out:
709 smp_free_lowcore(cpu);
710 return -EIO;
711} 771}
712 772
713static int __init setup_possible_cpus(char *s) 773static int __init setup_possible_cpus(char *s)
714{ 774{
715 int pcpus, cpu; 775 int max, cpu;
716 776
717 pcpus = simple_strtoul(s, NULL, 0); 777 if (kstrtoint(s, 0, &max) < 0)
778 return 0;
718 init_cpu_possible(cpumask_of(0)); 779 init_cpu_possible(cpumask_of(0));
719 for (cpu = 1; cpu < pcpus && cpu < nr_cpu_ids; cpu++) 780 for (cpu = 1; cpu < max && cpu < nr_cpu_ids; cpu++)
720 set_cpu_possible(cpu, true); 781 set_cpu_possible(cpu, true);
721 return 0; 782 return 0;
722} 783}
@@ -726,113 +787,79 @@ early_param("possible_cpus", setup_possible_cpus);
726 787
727int __cpu_disable(void) 788int __cpu_disable(void)
728{ 789{
729 struct ec_creg_mask_parms cr_parms; 790 unsigned long cregs[16];
730 int cpu = smp_processor_id();
731
732 set_cpu_online(cpu, false);
733 791
734 /* Disable pfault pseudo page faults on this cpu. */ 792 set_cpu_online(smp_processor_id(), false);
793 /* Disable pseudo page faults on this cpu. */
735 pfault_fini(); 794 pfault_fini();
736 795 /* Disable interrupt sources via control register. */
737 memset(&cr_parms.orvals, 0, sizeof(cr_parms.orvals)); 796 __ctl_store(cregs, 0, 15);
738 memset(&cr_parms.andvals, 0xff, sizeof(cr_parms.andvals)); 797 cregs[0] &= ~0x0000ee70UL; /* disable all external interrupts */
739 798 cregs[6] &= ~0xff000000UL; /* disable all I/O interrupts */
740 /* disable all external interrupts */ 799 cregs[14] &= ~0x1f000000UL; /* disable most machine checks */
741 cr_parms.orvals[0] = 0; 800 __ctl_load(cregs, 0, 15);
742 cr_parms.andvals[0] = ~(1 << 15 | 1 << 14 | 1 << 13 | 1 << 11 |
743 1 << 10 | 1 << 9 | 1 << 6 | 1 << 5 |
744 1 << 4);
745 /* disable all I/O interrupts */
746 cr_parms.orvals[6] = 0;
747 cr_parms.andvals[6] = ~(1 << 31 | 1 << 30 | 1 << 29 | 1 << 28 |
748 1 << 27 | 1 << 26 | 1 << 25 | 1 << 24);
749 /* disable most machine checks */
750 cr_parms.orvals[14] = 0;
751 cr_parms.andvals[14] = ~(1 << 28 | 1 << 27 | 1 << 26 |
752 1 << 25 | 1 << 24);
753
754 smp_ctl_bit_callback(&cr_parms);
755
756 return 0; 801 return 0;
757} 802}
758 803
759void __cpu_die(unsigned int cpu) 804void __cpu_die(unsigned int cpu)
760{ 805{
806 struct pcpu *pcpu;
807
761 /* Wait until target cpu is down */ 808 /* Wait until target cpu is down */
762 while (!cpu_stopped(cpu)) 809 pcpu = pcpu_devices + cpu;
810 while (!pcpu_stopped(pcpu))
763 cpu_relax(); 811 cpu_relax();
764 while (sigp_p(0, cpu, sigp_set_prefix) == sigp_busy) 812 pcpu_free_lowcore(pcpu);
765 udelay(10);
766 smp_free_lowcore(cpu);
767 atomic_dec(&init_mm.context.attach_count); 813 atomic_dec(&init_mm.context.attach_count);
768} 814}
769 815
770void __noreturn cpu_die(void) 816void __noreturn cpu_die(void)
771{ 817{
772 idle_task_exit(); 818 idle_task_exit();
773 while (sigp(smp_processor_id(), sigp_stop) == sigp_busy) 819 pcpu_sigp_retry(pcpu_devices + smp_processor_id(), sigp_stop, 0);
774 cpu_relax(); 820 for (;;) ;
775 for (;;);
776} 821}
777 822
778#endif /* CONFIG_HOTPLUG_CPU */ 823#endif /* CONFIG_HOTPLUG_CPU */
779 824
780void __init smp_prepare_cpus(unsigned int max_cpus) 825static void smp_call_os_info_init_fn(void)
781{ 826{
782#ifndef CONFIG_64BIT 827 int (*init_fn)(void);
783 unsigned long save_area = 0; 828 unsigned long size;
784#endif
785 unsigned long async_stack, panic_stack;
786 struct _lowcore *lowcore;
787 829
788 smp_detect_cpus(); 830 init_fn = os_info_old_entry(OS_INFO_INIT_FN, &size);
831 if (!init_fn)
832 return;
833 init_fn();
834}
789 835
836void __init smp_prepare_cpus(unsigned int max_cpus)
837{
790 /* request the 0x1201 emergency signal external interrupt */ 838 /* request the 0x1201 emergency signal external interrupt */
791 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) 839 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0)
792 panic("Couldn't request external interrupt 0x1201"); 840 panic("Couldn't request external interrupt 0x1201");
793 /* request the 0x1202 external call external interrupt */ 841 /* request the 0x1202 external call external interrupt */
794 if (register_external_interrupt(0x1202, do_ext_call_interrupt) != 0) 842 if (register_external_interrupt(0x1202, do_ext_call_interrupt) != 0)
795 panic("Couldn't request external interrupt 0x1202"); 843 panic("Couldn't request external interrupt 0x1202");
796 844 smp_call_os_info_init_fn();
797 /* Reallocate current lowcore, but keep its contents. */ 845 smp_detect_cpus();
798 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER);
799 panic_stack = __get_free_page(GFP_KERNEL);
800 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
801 BUG_ON(!lowcore || !panic_stack || !async_stack);
802#ifndef CONFIG_64BIT
803 if (MACHINE_HAS_IEEE)
804 save_area = get_zeroed_page(GFP_KERNEL);
805#endif
806 local_irq_disable();
807 local_mcck_disable();
808 lowcore_ptr[smp_processor_id()] = lowcore;
809 *lowcore = S390_lowcore;
810 lowcore->panic_stack = panic_stack + PAGE_SIZE;
811 lowcore->async_stack = async_stack + ASYNC_SIZE;
812#ifndef CONFIG_64BIT
813 if (MACHINE_HAS_IEEE)
814 lowcore->extended_save_area_addr = (u32) save_area;
815#endif
816 set_prefix((u32)(unsigned long) lowcore);
817 local_mcck_enable();
818 local_irq_enable();
819#ifdef CONFIG_64BIT
820 if (vdso_alloc_per_cpu(smp_processor_id(), &S390_lowcore))
821 BUG();
822#endif
823} 846}
824 847
825void __init smp_prepare_boot_cpu(void) 848void __init smp_prepare_boot_cpu(void)
826{ 849{
827 BUG_ON(smp_processor_id() != 0); 850 struct pcpu *pcpu = pcpu_devices;
828 851
829 current_thread_info()->cpu = 0; 852 boot_cpu_address = stap();
830 set_cpu_present(0, true); 853 pcpu->idle = current;
831 set_cpu_online(0, true); 854 pcpu->state = CPU_STATE_CONFIGURED;
855 pcpu->address = boot_cpu_address;
856 pcpu->lowcore = (struct _lowcore *)(unsigned long) store_prefix();
857 pcpu->async_stack = S390_lowcore.async_stack - ASYNC_SIZE;
858 pcpu->panic_stack = S390_lowcore.panic_stack - PAGE_SIZE;
832 S390_lowcore.percpu_offset = __per_cpu_offset[0]; 859 S390_lowcore.percpu_offset = __per_cpu_offset[0];
833 current_set[0] = current;
834 smp_cpu_state[0] = CPU_STATE_CONFIGURED;
835 cpu_set_polarization(0, POLARIZATION_UNKNOWN); 860 cpu_set_polarization(0, POLARIZATION_UNKNOWN);
861 set_cpu_present(0, true);
862 set_cpu_online(0, true);
836} 863}
837 864
838void __init smp_cpus_done(unsigned int max_cpus) 865void __init smp_cpus_done(unsigned int max_cpus)
@@ -842,7 +869,6 @@ void __init smp_cpus_done(unsigned int max_cpus)
842void __init smp_setup_processor_id(void) 869void __init smp_setup_processor_id(void)
843{ 870{
844 S390_lowcore.cpu_nr = 0; 871 S390_lowcore.cpu_nr = 0;
845 __cpu_logical_map[0] = stap();
846} 872}
847 873
848/* 874/*
@@ -858,56 +884,57 @@ int setup_profiling_timer(unsigned int multiplier)
858 884
859#ifdef CONFIG_HOTPLUG_CPU 885#ifdef CONFIG_HOTPLUG_CPU
860static ssize_t cpu_configure_show(struct device *dev, 886static ssize_t cpu_configure_show(struct device *dev,
861 struct device_attribute *attr, char *buf) 887 struct device_attribute *attr, char *buf)
862{ 888{
863 ssize_t count; 889 ssize_t count;
864 890
865 mutex_lock(&smp_cpu_state_mutex); 891 mutex_lock(&smp_cpu_state_mutex);
866 count = sprintf(buf, "%d\n", smp_cpu_state[dev->id]); 892 count = sprintf(buf, "%d\n", pcpu_devices[dev->id].state);
867 mutex_unlock(&smp_cpu_state_mutex); 893 mutex_unlock(&smp_cpu_state_mutex);
868 return count; 894 return count;
869} 895}
870 896
871static ssize_t cpu_configure_store(struct device *dev, 897static ssize_t cpu_configure_store(struct device *dev,
872 struct device_attribute *attr, 898 struct device_attribute *attr,
873 const char *buf, size_t count) 899 const char *buf, size_t count)
874{ 900{
875 int cpu = dev->id; 901 struct pcpu *pcpu;
876 int val, rc; 902 int cpu, val, rc;
877 char delim; 903 char delim;
878 904
879 if (sscanf(buf, "%d %c", &val, &delim) != 1) 905 if (sscanf(buf, "%d %c", &val, &delim) != 1)
880 return -EINVAL; 906 return -EINVAL;
881 if (val != 0 && val != 1) 907 if (val != 0 && val != 1)
882 return -EINVAL; 908 return -EINVAL;
883
884 get_online_cpus(); 909 get_online_cpus();
885 mutex_lock(&smp_cpu_state_mutex); 910 mutex_lock(&smp_cpu_state_mutex);
886 rc = -EBUSY; 911 rc = -EBUSY;
887 /* disallow configuration changes of online cpus and cpu 0 */ 912 /* disallow configuration changes of online cpus and cpu 0 */
913 cpu = dev->id;
888 if (cpu_online(cpu) || cpu == 0) 914 if (cpu_online(cpu) || cpu == 0)
889 goto out; 915 goto out;
916 pcpu = pcpu_devices + cpu;
890 rc = 0; 917 rc = 0;
891 switch (val) { 918 switch (val) {
892 case 0: 919 case 0:
893 if (smp_cpu_state[cpu] == CPU_STATE_CONFIGURED) { 920 if (pcpu->state != CPU_STATE_CONFIGURED)
894 rc = sclp_cpu_deconfigure(__cpu_logical_map[cpu]); 921 break;
895 if (!rc) { 922 rc = sclp_cpu_deconfigure(pcpu->address);
896 smp_cpu_state[cpu] = CPU_STATE_STANDBY; 923 if (rc)
897 cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); 924 break;
898 topology_expect_change(); 925 pcpu->state = CPU_STATE_STANDBY;
899 } 926 cpu_set_polarization(cpu, POLARIZATION_UNKNOWN);
900 } 927 topology_expect_change();
901 break; 928 break;
902 case 1: 929 case 1:
903 if (smp_cpu_state[cpu] == CPU_STATE_STANDBY) { 930 if (pcpu->state != CPU_STATE_STANDBY)
904 rc = sclp_cpu_configure(__cpu_logical_map[cpu]); 931 break;
905 if (!rc) { 932 rc = sclp_cpu_configure(pcpu->address);
906 smp_cpu_state[cpu] = CPU_STATE_CONFIGURED; 933 if (rc)
907 cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); 934 break;
908 topology_expect_change(); 935 pcpu->state = CPU_STATE_CONFIGURED;
909 } 936 cpu_set_polarization(cpu, POLARIZATION_UNKNOWN);
910 } 937 topology_expect_change();
911 break; 938 break;
912 default: 939 default:
913 break; 940 break;
@@ -923,7 +950,7 @@ static DEVICE_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
923static ssize_t show_cpu_address(struct device *dev, 950static ssize_t show_cpu_address(struct device *dev,
924 struct device_attribute *attr, char *buf) 951 struct device_attribute *attr, char *buf)
925{ 952{
926 return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); 953 return sprintf(buf, "%d\n", pcpu_devices[dev->id].address);
927} 954}
928static DEVICE_ATTR(address, 0444, show_cpu_address, NULL); 955static DEVICE_ATTR(address, 0444, show_cpu_address, NULL);
929 956
@@ -955,22 +982,16 @@ static DEVICE_ATTR(capability, 0444, show_capability, NULL);
955static ssize_t show_idle_count(struct device *dev, 982static ssize_t show_idle_count(struct device *dev,
956 struct device_attribute *attr, char *buf) 983 struct device_attribute *attr, char *buf)
957{ 984{
958 struct s390_idle_data *idle; 985 struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);
959 unsigned long long idle_count; 986 unsigned long long idle_count;
960 unsigned int sequence; 987 unsigned int sequence;
961 988
962 idle = &per_cpu(s390_idle, dev->id); 989 do {
963repeat: 990 sequence = ACCESS_ONCE(idle->sequence);
964 sequence = idle->sequence; 991 idle_count = ACCESS_ONCE(idle->idle_count);
965 smp_rmb(); 992 if (ACCESS_ONCE(idle->idle_enter))
966 if (sequence & 1) 993 idle_count++;
967 goto repeat; 994 } while ((sequence & 1) || (idle->sequence != sequence));
968 idle_count = idle->idle_count;
969 if (idle->idle_enter)
970 idle_count++;
971 smp_rmb();
972 if (idle->sequence != sequence)
973 goto repeat;
974 return sprintf(buf, "%llu\n", idle_count); 995 return sprintf(buf, "%llu\n", idle_count);
975} 996}
976static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL); 997static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL);
@@ -978,24 +999,18 @@ static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL);
978static ssize_t show_idle_time(struct device *dev, 999static ssize_t show_idle_time(struct device *dev,
979 struct device_attribute *attr, char *buf) 1000 struct device_attribute *attr, char *buf)
980{ 1001{
981 struct s390_idle_data *idle; 1002 struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);
982 unsigned long long now, idle_time, idle_enter; 1003 unsigned long long now, idle_time, idle_enter, idle_exit;
983 unsigned int sequence; 1004 unsigned int sequence;
984 1005
985 idle = &per_cpu(s390_idle, dev->id); 1006 do {
986 now = get_clock(); 1007 now = get_clock();
987repeat: 1008 sequence = ACCESS_ONCE(idle->sequence);
988 sequence = idle->sequence; 1009 idle_time = ACCESS_ONCE(idle->idle_time);
989 smp_rmb(); 1010 idle_enter = ACCESS_ONCE(idle->idle_enter);
990 if (sequence & 1) 1011 idle_exit = ACCESS_ONCE(idle->idle_exit);
991 goto repeat; 1012 } while ((sequence & 1) || (idle->sequence != sequence));
992 idle_time = idle->idle_time; 1013 idle_time += idle_enter ? ((idle_exit ? : now) - idle_enter) : 0;
993 idle_enter = idle->idle_enter;
994 if (idle_enter != 0ULL && idle_enter < now)
995 idle_time += now - idle_enter;
996 smp_rmb();
997 if (idle->sequence != sequence)
998 goto repeat;
999 return sprintf(buf, "%llu\n", idle_time >> 12); 1014 return sprintf(buf, "%llu\n", idle_time >> 12);
1000} 1015}
1001static DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL); 1016static DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL);
@@ -1015,7 +1030,7 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self,
1015 unsigned long action, void *hcpu) 1030 unsigned long action, void *hcpu)
1016{ 1031{
1017 unsigned int cpu = (unsigned int)(long)hcpu; 1032 unsigned int cpu = (unsigned int)(long)hcpu;
1018 struct cpu *c = &per_cpu(cpu_devices, cpu); 1033 struct cpu *c = &pcpu_devices[cpu].cpu;
1019 struct device *s = &c->dev; 1034 struct device *s = &c->dev;
1020 struct s390_idle_data *idle; 1035 struct s390_idle_data *idle;
1021 int err = 0; 1036 int err = 0;
@@ -1041,7 +1056,7 @@ static struct notifier_block __cpuinitdata smp_cpu_nb = {
1041 1056
1042static int __devinit smp_add_present_cpu(int cpu) 1057static int __devinit smp_add_present_cpu(int cpu)
1043{ 1058{
1044 struct cpu *c = &per_cpu(cpu_devices, cpu); 1059 struct cpu *c = &pcpu_devices[cpu].cpu;
1045 struct device *s = &c->dev; 1060 struct device *s = &c->dev;
1046 int rc; 1061 int rc;
1047 1062
@@ -1079,29 +1094,21 @@ out:
1079 1094
1080int __ref smp_rescan_cpus(void) 1095int __ref smp_rescan_cpus(void)
1081{ 1096{
1082 cpumask_t newcpus; 1097 struct sclp_cpu_info *info;
1083 int cpu; 1098 int nr;
1084 int rc;
1085 1099
1100 info = smp_get_cpu_info();
1101 if (!info)
1102 return -ENOMEM;
1086 get_online_cpus(); 1103 get_online_cpus();
1087 mutex_lock(&smp_cpu_state_mutex); 1104 mutex_lock(&smp_cpu_state_mutex);
1088 cpumask_copy(&newcpus, cpu_present_mask); 1105 nr = __smp_rescan_cpus(info, 1);
1089 rc = __smp_rescan_cpus();
1090 if (rc)
1091 goto out;
1092 cpumask_andnot(&newcpus, cpu_present_mask, &newcpus);
1093 for_each_cpu(cpu, &newcpus) {
1094 rc = smp_add_present_cpu(cpu);
1095 if (rc)
1096 set_cpu_present(cpu, false);
1097 }
1098 rc = 0;
1099out:
1100 mutex_unlock(&smp_cpu_state_mutex); 1106 mutex_unlock(&smp_cpu_state_mutex);
1101 put_online_cpus(); 1107 put_online_cpus();
1102 if (!cpumask_empty(&newcpus)) 1108 kfree(info);
1109 if (nr)
1103 topology_schedule_update(); 1110 topology_schedule_update();
1104 return rc; 1111 return 0;
1105} 1112}
1106 1113
1107static ssize_t __ref rescan_store(struct device *dev, 1114static ssize_t __ref rescan_store(struct device *dev,
diff --git a/arch/s390/kernel/switch_cpu.S b/arch/s390/kernel/switch_cpu.S
deleted file mode 100644
index bfe070bc765..00000000000
--- a/arch/s390/kernel/switch_cpu.S
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * 31-bit switch cpu code
3 *
4 * Copyright IBM Corp. 2009
5 *
6 */
7
8#include <linux/linkage.h>
9#include <asm/asm-offsets.h>
10#include <asm/ptrace.h>
11
12# smp_switch_to_cpu switches to destination cpu and executes the passed function
13# Parameter: %r2 - function to call
14# %r3 - function parameter
15# %r4 - stack poiner
16# %r5 - current cpu
17# %r6 - destination cpu
18
19 .section .text
20ENTRY(smp_switch_to_cpu)
21 stm %r6,%r15,__SF_GPRS(%r15)
22 lr %r1,%r15
23 ahi %r15,-STACK_FRAME_OVERHEAD
24 st %r1,__SF_BACKCHAIN(%r15)
25 basr %r13,0
260: la %r1,.gprregs_addr-0b(%r13)
27 l %r1,0(%r1)
28 stm %r0,%r15,0(%r1)
291: sigp %r0,%r6,__SIGP_RESTART /* start destination CPU */
30 brc 2,1b /* busy, try again */
312: sigp %r0,%r5,__SIGP_STOP /* stop current CPU */
32 brc 2,2b /* busy, try again */
333: j 3b
34
35ENTRY(smp_restart_cpu)
36 basr %r13,0
370: la %r1,.gprregs_addr-0b(%r13)
38 l %r1,0(%r1)
39 lm %r0,%r15,0(%r1)
401: sigp %r0,%r5,__SIGP_SENSE /* Wait for calling CPU */
41 brc 10,1b /* busy, accepted (status 0), running */
42 tmll %r0,0x40 /* Test if calling CPU is stopped */
43 jz 1b
44 ltr %r4,%r4 /* New stack ? */
45 jz 1f
46 lr %r15,%r4
471: lr %r14,%r2 /* r14: Function to call */
48 lr %r2,%r3 /* r2 : Parameter for function*/
49 basr %r14,%r14 /* Call function */
50
51.gprregs_addr:
52 .long .gprregs
53
54 .section .data,"aw",@progbits
55.gprregs:
56 .rept 16
57 .long 0
58 .endr
diff --git a/arch/s390/kernel/switch_cpu64.S b/arch/s390/kernel/switch_cpu64.S
deleted file mode 100644
index fcc42d799e4..00000000000
--- a/arch/s390/kernel/switch_cpu64.S
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * 64-bit switch cpu code
3 *
4 * Copyright IBM Corp. 2009
5 *
6 */
7
8#include <linux/linkage.h>
9#include <asm/asm-offsets.h>
10#include <asm/ptrace.h>
11
12# smp_switch_to_cpu switches to destination cpu and executes the passed function
13# Parameter: %r2 - function to call
14# %r3 - function parameter
15# %r4 - stack poiner
16# %r5 - current cpu
17# %r6 - destination cpu
18
19 .section .text
20ENTRY(smp_switch_to_cpu)
21 stmg %r6,%r15,__SF_GPRS(%r15)
22 lgr %r1,%r15
23 aghi %r15,-STACK_FRAME_OVERHEAD
24 stg %r1,__SF_BACKCHAIN(%r15)
25 larl %r1,.gprregs
26 stmg %r0,%r15,0(%r1)
271: sigp %r0,%r6,__SIGP_RESTART /* start destination CPU */
28 brc 2,1b /* busy, try again */
292: sigp %r0,%r5,__SIGP_STOP /* stop current CPU */
30 brc 2,2b /* busy, try again */
313: j 3b
32
33ENTRY(smp_restart_cpu)
34 larl %r1,.gprregs
35 lmg %r0,%r15,0(%r1)
361: sigp %r0,%r5,__SIGP_SENSE /* Wait for calling CPU */
37 brc 10,1b /* busy, accepted (status 0), running */
38 tmll %r0,0x40 /* Test if calling CPU is stopped */
39 jz 1b
40 ltgr %r4,%r4 /* New stack ? */
41 jz 1f
42 lgr %r15,%r4
431: lgr %r14,%r2 /* r14: Function to call */
44 lgr %r2,%r3 /* r2 : Parameter for function*/
45 basr %r14,%r14 /* Call function */
46
47 .section .data,"aw",@progbits
48.gprregs:
49 .rept 16
50 .quad 0
51 .endr
diff --git a/arch/s390/kernel/swsusp_asm64.S b/arch/s390/kernel/swsusp_asm64.S
index acb78cdee89..dd70ef04605 100644
--- a/arch/s390/kernel/swsusp_asm64.S
+++ b/arch/s390/kernel/swsusp_asm64.S
@@ -42,7 +42,7 @@ ENTRY(swsusp_arch_suspend)
42 lghi %r1,0x1000 42 lghi %r1,0x1000
43 43
44 /* Save CPU address */ 44 /* Save CPU address */
45 stap __LC_CPU_ADDRESS(%r0) 45 stap __LC_EXT_CPU_ADDR(%r0)
46 46
47 /* Store registers */ 47 /* Store registers */
48 mvc 0x318(4,%r1),__SF_EMPTY(%r15) /* move prefix to lowcore */ 48 mvc 0x318(4,%r1),__SF_EMPTY(%r15) /* move prefix to lowcore */
@@ -173,15 +173,15 @@ pgm_check_entry:
173 larl %r1,.Lresume_cpu /* Resume CPU address: r2 */ 173 larl %r1,.Lresume_cpu /* Resume CPU address: r2 */
174 stap 0(%r1) 174 stap 0(%r1)
175 llgh %r2,0(%r1) 175 llgh %r2,0(%r1)
176 llgh %r1,__LC_CPU_ADDRESS(%r0) /* Suspend CPU address: r1 */ 176 llgh %r1,__LC_EXT_CPU_ADDR(%r0) /* Suspend CPU address: r1 */
177 cgr %r1,%r2 177 cgr %r1,%r2
178 je restore_registers /* r1 = r2 -> nothing to do */ 178 je restore_registers /* r1 = r2 -> nothing to do */
179 larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */ 179 larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */
180 mvc __LC_RST_NEW_PSW(16,%r0),0(%r4) 180 mvc __LC_RST_NEW_PSW(16,%r0),0(%r4)
1813: 1813:
182 sigp %r9,%r1,__SIGP_INITIAL_CPU_RESET 182 sigp %r9,%r1,11 /* sigp initial cpu reset */
183 brc 8,4f /* accepted */ 183 brc 8,4f /* accepted */
184 brc 2,3b /* busy, try again */ 184 brc 2,3b /* busy, try again */
185 185
186 /* Suspend CPU not available -> panic */ 186 /* Suspend CPU not available -> panic */
187 larl %r15,init_thread_union 187 larl %r15,init_thread_union
@@ -196,10 +196,10 @@ pgm_check_entry:
196 lpsw 0(%r3) 196 lpsw 0(%r3)
1974: 1974:
198 /* Switch to suspend CPU */ 198 /* Switch to suspend CPU */
199 sigp %r9,%r1,__SIGP_RESTART /* start suspend CPU */ 199 sigp %r9,%r1,6 /* sigp restart to suspend CPU */
200 brc 2,4b /* busy, try again */ 200 brc 2,4b /* busy, try again */
2015: 2015:
202 sigp %r9,%r2,__SIGP_STOP /* stop resume (current) CPU */ 202 sigp %r9,%r2,5 /* sigp stop to current resume CPU */
203 brc 2,5b /* busy, try again */ 203 brc 2,5b /* busy, try again */
2046: j 6b 2046: j 6b
205 205
@@ -207,7 +207,7 @@ restart_suspend:
207 larl %r1,.Lresume_cpu 207 larl %r1,.Lresume_cpu
208 llgh %r2,0(%r1) 208 llgh %r2,0(%r1)
2097: 2097:
210 sigp %r9,%r2,__SIGP_SENSE /* Wait for resume CPU */ 210 sigp %r9,%r2,1 /* sigp sense, wait for resume CPU */
211 brc 8,7b /* accepted, status 0, still running */ 211 brc 8,7b /* accepted, status 0, still running */
212 brc 2,7b /* busy, try again */ 212 brc 2,7b /* busy, try again */
213 tmll %r9,0x40 /* Test if resume CPU is stopped */ 213 tmll %r9,0x40 /* Test if resume CPU is stopped */
@@ -257,6 +257,9 @@ restore_registers:
257 lghi %r2,0 257 lghi %r2,0
258 brasl %r14,arch_set_page_states 258 brasl %r14,arch_set_page_states
259 259
260 /* Log potential guest relocation */
261 brasl %r14,lgr_info_log
262
260 /* Reinitialize the channel subsystem */ 263 /* Reinitialize the channel subsystem */
261 brasl %r14,channel_subsystem_reinit 264 brasl %r14,channel_subsystem_reinit
262 265
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 14da278febb..d4e1cb1dbcd 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -165,7 +165,7 @@ void init_cpu_timer(void)
165 __ctl_set_bit(0, 4); 165 __ctl_set_bit(0, 4);
166} 166}
167 167
168static void clock_comparator_interrupt(unsigned int ext_int_code, 168static void clock_comparator_interrupt(struct ext_code ext_code,
169 unsigned int param32, 169 unsigned int param32,
170 unsigned long param64) 170 unsigned long param64)
171{ 171{
@@ -177,7 +177,7 @@ static void clock_comparator_interrupt(unsigned int ext_int_code,
177static void etr_timing_alert(struct etr_irq_parm *); 177static void etr_timing_alert(struct etr_irq_parm *);
178static void stp_timing_alert(struct stp_irq_parm *); 178static void stp_timing_alert(struct stp_irq_parm *);
179 179
180static void timing_alert_interrupt(unsigned int ext_int_code, 180static void timing_alert_interrupt(struct ext_code ext_code,
181 unsigned int param32, unsigned long param64) 181 unsigned int param32, unsigned long param64)
182{ 182{
183 kstat_cpu(smp_processor_id()).irqs[EXTINT_TLA]++; 183 kstat_cpu(smp_processor_id()).irqs[EXTINT_TLA]++;
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 7370a41948c..4f8dc942257 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -79,12 +79,12 @@ static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu,
79 cpu < TOPOLOGY_CPU_BITS; 79 cpu < TOPOLOGY_CPU_BITS;
80 cpu = find_next_bit(&tl_cpu->mask[0], TOPOLOGY_CPU_BITS, cpu + 1)) 80 cpu = find_next_bit(&tl_cpu->mask[0], TOPOLOGY_CPU_BITS, cpu + 1))
81 { 81 {
82 unsigned int rcpu, lcpu; 82 unsigned int rcpu;
83 int lcpu;
83 84
84 rcpu = TOPOLOGY_CPU_BITS - 1 - cpu + tl_cpu->origin; 85 rcpu = TOPOLOGY_CPU_BITS - 1 - cpu + tl_cpu->origin;
85 for_each_present_cpu(lcpu) { 86 lcpu = smp_find_processor_id(rcpu);
86 if (cpu_logical_map(lcpu) != rcpu) 87 if (lcpu >= 0) {
87 continue;
88 cpumask_set_cpu(lcpu, &book->mask); 88 cpumask_set_cpu(lcpu, &book->mask);
89 cpu_book_id[lcpu] = book->id; 89 cpu_book_id[lcpu] = book->id;
90 cpumask_set_cpu(lcpu, &core->mask); 90 cpumask_set_cpu(lcpu, &core->mask);
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 5ce3750b181..cd6ebe12c48 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -41,6 +41,7 @@
41#include <asm/cpcmd.h> 41#include <asm/cpcmd.h>
42#include <asm/lowcore.h> 42#include <asm/lowcore.h>
43#include <asm/debug.h> 43#include <asm/debug.h>
44#include <asm/ipl.h>
44#include "entry.h" 45#include "entry.h"
45 46
46void (*pgm_check_table[128])(struct pt_regs *regs); 47void (*pgm_check_table[128])(struct pt_regs *regs);
@@ -144,8 +145,8 @@ void show_stack(struct task_struct *task, unsigned long *sp)
144 for (i = 0; i < kstack_depth_to_print; i++) { 145 for (i = 0; i < kstack_depth_to_print; i++) {
145 if (((addr_t) stack & (THREAD_SIZE-1)) == 0) 146 if (((addr_t) stack & (THREAD_SIZE-1)) == 0)
146 break; 147 break;
147 if (i && ((i * sizeof (long) % 32) == 0)) 148 if ((i * sizeof(long) % 32) == 0)
148 printk("\n "); 149 printk("%s ", i == 0 ? "" : "\n");
149 printk(LONG, *stack++); 150 printk(LONG, *stack++);
150 } 151 }
151 printk("\n"); 152 printk("\n");
@@ -239,6 +240,7 @@ void die(struct pt_regs *regs, const char *str)
239 static int die_counter; 240 static int die_counter;
240 241
241 oops_enter(); 242 oops_enter();
243 lgr_info_log();
242 debug_stop_all(); 244 debug_stop_all();
243 console_verbose(); 245 console_verbose();
244 spin_lock_irq(&die_lock); 246 spin_lock_irq(&die_lock);
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
index d73630b4fe1..9c80138206b 100644
--- a/arch/s390/kernel/vdso.c
+++ b/arch/s390/kernel/vdso.c
@@ -89,18 +89,11 @@ static void vdso_init_data(struct vdso_data *vd)
89 89
90#ifdef CONFIG_64BIT 90#ifdef CONFIG_64BIT
91/* 91/*
92 * Setup per cpu vdso data page.
93 */
94static void vdso_init_per_cpu_data(int cpu, struct vdso_per_cpu_data *vpcd)
95{
96}
97
98/*
99 * Allocate/free per cpu vdso data. 92 * Allocate/free per cpu vdso data.
100 */ 93 */
101#define SEGMENT_ORDER 2 94#define SEGMENT_ORDER 2
102 95
103int vdso_alloc_per_cpu(int cpu, struct _lowcore *lowcore) 96int vdso_alloc_per_cpu(struct _lowcore *lowcore)
104{ 97{
105 unsigned long segment_table, page_table, page_frame; 98 unsigned long segment_table, page_table, page_frame;
106 u32 *psal, *aste; 99 u32 *psal, *aste;
@@ -139,7 +132,6 @@ int vdso_alloc_per_cpu(int cpu, struct _lowcore *lowcore)
139 aste[4] = (u32)(addr_t) psal; 132 aste[4] = (u32)(addr_t) psal;
140 lowcore->vdso_per_cpu_data = page_frame; 133 lowcore->vdso_per_cpu_data = page_frame;
141 134
142 vdso_init_per_cpu_data(cpu, (struct vdso_per_cpu_data *) page_frame);
143 return 0; 135 return 0;
144 136
145out: 137out:
@@ -149,7 +141,7 @@ out:
149 return -ENOMEM; 141 return -ENOMEM;
150} 142}
151 143
152void vdso_free_per_cpu(int cpu, struct _lowcore *lowcore) 144void vdso_free_per_cpu(struct _lowcore *lowcore)
153{ 145{
154 unsigned long segment_table, page_table, page_frame; 146 unsigned long segment_table, page_table, page_frame;
155 u32 *psal, *aste; 147 u32 *psal, *aste;
@@ -168,19 +160,15 @@ void vdso_free_per_cpu(int cpu, struct _lowcore *lowcore)
168 free_pages(segment_table, SEGMENT_ORDER); 160 free_pages(segment_table, SEGMENT_ORDER);
169} 161}
170 162
171static void __vdso_init_cr5(void *dummy) 163static void vdso_init_cr5(void)
172{ 164{
173 unsigned long cr5; 165 unsigned long cr5;
174 166
167 if (user_mode == HOME_SPACE_MODE || !vdso_enabled)
168 return;
175 cr5 = offsetof(struct _lowcore, paste); 169 cr5 = offsetof(struct _lowcore, paste);
176 __ctl_load(cr5, 5, 5); 170 __ctl_load(cr5, 5, 5);
177} 171}
178
179static void vdso_init_cr5(void)
180{
181 if (user_mode != HOME_SPACE_MODE && vdso_enabled)
182 on_each_cpu(__vdso_init_cr5, NULL, 1);
183}
184#endif /* CONFIG_64BIT */ 172#endif /* CONFIG_64BIT */
185 173
186/* 174/*
@@ -253,17 +241,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
253 * on the "data" page of the vDSO or you'll stop getting kernel 241 * on the "data" page of the vDSO or you'll stop getting kernel
254 * updates and your nice userland gettimeofday will be totally dead. 242 * updates and your nice userland gettimeofday will be totally dead.
255 * It's fine to use that for setting breakpoints in the vDSO code 243 * It's fine to use that for setting breakpoints in the vDSO code
256 * pages though 244 * pages though.
257 *
258 * Make sure the vDSO gets into every core dump.
259 * Dumping its contents makes post-mortem fully interpretable later
260 * without matching up the same kernel and hardware config to see
261 * what PC values meant.
262 */ 245 */
263 rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT, 246 rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
264 VM_READ|VM_EXEC| 247 VM_READ|VM_EXEC|
265 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| 248 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
266 VM_ALWAYSDUMP,
267 vdso_pagelist); 249 vdso_pagelist);
268 if (rc) 250 if (rc)
269 current->mm->context.vdso_base = 0; 251 current->mm->context.vdso_base = 0;
@@ -322,10 +304,8 @@ static int __init vdso_init(void)
322 } 304 }
323 vdso64_pagelist[vdso64_pages - 1] = virt_to_page(vdso_data); 305 vdso64_pagelist[vdso64_pages - 1] = virt_to_page(vdso_data);
324 vdso64_pagelist[vdso64_pages] = NULL; 306 vdso64_pagelist[vdso64_pages] = NULL;
325#ifndef CONFIG_SMP 307 if (vdso_alloc_per_cpu(&S390_lowcore))
326 if (vdso_alloc_per_cpu(0, &S390_lowcore))
327 BUG(); 308 BUG();
328#endif
329 vdso_init_cr5(); 309 vdso_init_cr5();
330#endif /* CONFIG_64BIT */ 310#endif /* CONFIG_64BIT */
331 311
@@ -335,7 +315,7 @@ static int __init vdso_init(void)
335 315
336 return 0; 316 return 0;
337} 317}
338arch_initcall(vdso_init); 318early_initcall(vdso_init);
339 319
340int in_gate_area_no_mm(unsigned long addr) 320int in_gate_area_no_mm(unsigned long addr)
341{ 321{
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index bb48977f546..39ebff50694 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -26,6 +26,7 @@
26#include <asm/irq_regs.h> 26#include <asm/irq_regs.h>
27#include <asm/cputime.h> 27#include <asm/cputime.h>
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include "entry.h"
29 30
30static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer); 31static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
31 32
@@ -123,153 +124,53 @@ void account_system_vtime(struct task_struct *tsk)
123} 124}
124EXPORT_SYMBOL_GPL(account_system_vtime); 125EXPORT_SYMBOL_GPL(account_system_vtime);
125 126
126void __kprobes vtime_start_cpu(__u64 int_clock, __u64 enter_timer) 127void __kprobes vtime_stop_cpu(void)
127{ 128{
128 struct s390_idle_data *idle = &__get_cpu_var(s390_idle); 129 struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
129 struct vtimer_queue *vq = &__get_cpu_var(virt_cpu_timer); 130 struct vtimer_queue *vq = &__get_cpu_var(virt_cpu_timer);
130 __u64 idle_time, expires; 131 unsigned long long idle_time;
132 unsigned long psw_mask;
131 133
132 if (idle->idle_enter == 0ULL) 134 trace_hardirqs_on();
133 return; 135 /* Don't trace preempt off for idle. */
136 stop_critical_timings();
134 137
135 /* Account time spent with enabled wait psw loaded as idle time. */ 138 /* Wait for external, I/O or machine check interrupt. */
136 idle_time = int_clock - idle->idle_enter; 139 psw_mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_DAT |
137 account_idle_time(idle_time); 140 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
138 S390_lowcore.steal_timer += 141 idle->nohz_delay = 0;
139 idle->idle_enter - S390_lowcore.last_update_clock;
140 S390_lowcore.last_update_clock = int_clock;
141
142 /* Account system time spent going idle. */
143 S390_lowcore.system_timer += S390_lowcore.last_update_timer - vq->idle;
144 S390_lowcore.last_update_timer = enter_timer;
145
146 /* Restart vtime CPU timer */
147 if (vq->do_spt) {
148 /* Program old expire value but first save progress. */
149 expires = vq->idle - enter_timer;
150 expires += get_vtimer();
151 set_vtimer(expires);
152 } else {
153 /* Don't account the CPU timer delta while the cpu was idle. */
154 vq->elapsed -= vq->idle - enter_timer;
155 }
156 142
143 /* Call the assembler magic in entry.S */
144 psw_idle(idle, vq, psw_mask, !list_empty(&vq->list));
145
146 /* Reenable preemption tracer. */
147 start_critical_timings();
148
149 /* Account time spent with enabled wait psw loaded as idle time. */
157 idle->sequence++; 150 idle->sequence++;
158 smp_wmb(); 151 smp_wmb();
152 idle_time = idle->idle_exit - idle->idle_enter;
159 idle->idle_time += idle_time; 153 idle->idle_time += idle_time;
160 idle->idle_enter = 0ULL; 154 idle->idle_enter = idle->idle_exit = 0ULL;
161 idle->idle_count++; 155 idle->idle_count++;
156 account_idle_time(idle_time);
162 smp_wmb(); 157 smp_wmb();
163 idle->sequence++; 158 idle->sequence++;
164} 159}
165 160
166void __kprobes vtime_stop_cpu(void)
167{
168 struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
169 struct vtimer_queue *vq = &__get_cpu_var(virt_cpu_timer);
170 psw_t psw;
171
172 /* Wait for external, I/O or machine check interrupt. */
173 psw.mask = psw_kernel_bits | PSW_MASK_WAIT |
174 PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
175
176 idle->nohz_delay = 0;
177
178 /* Check if the CPU timer needs to be reprogrammed. */
179 if (vq->do_spt) {
180 __u64 vmax = VTIMER_MAX_SLICE;
181 /*
182 * The inline assembly is equivalent to
183 * vq->idle = get_cpu_timer();
184 * set_cpu_timer(VTIMER_MAX_SLICE);
185 * idle->idle_enter = get_clock();
186 * __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT |
187 * PSW_MASK_DAT | PSW_MASK_IO |
188 * PSW_MASK_EXT | PSW_MASK_MCHECK);
189 * The difference is that the inline assembly makes sure that
190 * the last three instruction are stpt, stck and lpsw in that
191 * order. This is done to increase the precision.
192 */
193 asm volatile(
194#ifndef CONFIG_64BIT
195 " basr 1,0\n"
196 "0: ahi 1,1f-0b\n"
197 " st 1,4(%2)\n"
198#else /* CONFIG_64BIT */
199 " larl 1,1f\n"
200 " stg 1,8(%2)\n"
201#endif /* CONFIG_64BIT */
202 " stpt 0(%4)\n"
203 " spt 0(%5)\n"
204 " stck 0(%3)\n"
205#ifndef CONFIG_64BIT
206 " lpsw 0(%2)\n"
207#else /* CONFIG_64BIT */
208 " lpswe 0(%2)\n"
209#endif /* CONFIG_64BIT */
210 "1:"
211 : "=m" (idle->idle_enter), "=m" (vq->idle)
212 : "a" (&psw), "a" (&idle->idle_enter),
213 "a" (&vq->idle), "a" (&vmax), "m" (vmax), "m" (psw)
214 : "memory", "cc", "1");
215 } else {
216 /*
217 * The inline assembly is equivalent to
218 * vq->idle = get_cpu_timer();
219 * idle->idle_enter = get_clock();
220 * __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT |
221 * PSW_MASK_DAT | PSW_MASK_IO |
222 * PSW_MASK_EXT | PSW_MASK_MCHECK);
223 * The difference is that the inline assembly makes sure that
224 * the last three instruction are stpt, stck and lpsw in that
225 * order. This is done to increase the precision.
226 */
227 asm volatile(
228#ifndef CONFIG_64BIT
229 " basr 1,0\n"
230 "0: ahi 1,1f-0b\n"
231 " st 1,4(%2)\n"
232#else /* CONFIG_64BIT */
233 " larl 1,1f\n"
234 " stg 1,8(%2)\n"
235#endif /* CONFIG_64BIT */
236 " stpt 0(%4)\n"
237 " stck 0(%3)\n"
238#ifndef CONFIG_64BIT
239 " lpsw 0(%2)\n"
240#else /* CONFIG_64BIT */
241 " lpswe 0(%2)\n"
242#endif /* CONFIG_64BIT */
243 "1:"
244 : "=m" (idle->idle_enter), "=m" (vq->idle)
245 : "a" (&psw), "a" (&idle->idle_enter),
246 "a" (&vq->idle), "m" (psw)
247 : "memory", "cc", "1");
248 }
249}
250
251cputime64_t s390_get_idle_time(int cpu) 161cputime64_t s390_get_idle_time(int cpu)
252{ 162{
253 struct s390_idle_data *idle; 163 struct s390_idle_data *idle = &per_cpu(s390_idle, cpu);
254 unsigned long long now, idle_time, idle_enter; 164 unsigned long long now, idle_enter, idle_exit;
255 unsigned int sequence; 165 unsigned int sequence;
256 166
257 idle = &per_cpu(s390_idle, cpu); 167 do {
258 168 now = get_clock();
259 now = get_clock(); 169 sequence = ACCESS_ONCE(idle->sequence);
260repeat: 170 idle_enter = ACCESS_ONCE(idle->idle_enter);
261 sequence = idle->sequence; 171 idle_exit = ACCESS_ONCE(idle->idle_exit);
262 smp_rmb(); 172 } while ((sequence & 1) || (idle->sequence != sequence));
263 if (sequence & 1) 173 return idle_enter ? ((idle_exit ? : now) - idle_enter) : 0;
264 goto repeat;
265 idle_time = 0;
266 idle_enter = idle->idle_enter;
267 if (idle_enter != 0ULL && idle_enter < now)
268 idle_time = now - idle_enter;
269 smp_rmb();
270 if (idle->sequence != sequence)
271 goto repeat;
272 return idle_time;
273} 174}
274 175
275/* 176/*
@@ -319,7 +220,7 @@ static void do_callbacks(struct list_head *cb_list)
319/* 220/*
320 * Handler for the virtual CPU timer. 221 * Handler for the virtual CPU timer.
321 */ 222 */
322static void do_cpu_timer_interrupt(unsigned int ext_int_code, 223static void do_cpu_timer_interrupt(struct ext_code ext_code,
323 unsigned int param32, unsigned long param64) 224 unsigned int param32, unsigned long param64)
324{ 225{
325 struct vtimer_queue *vq; 226 struct vtimer_queue *vq;
@@ -346,7 +247,6 @@ static void do_cpu_timer_interrupt(unsigned int ext_int_code,
346 } 247 }
347 spin_unlock(&vq->lock); 248 spin_unlock(&vq->lock);
348 249
349 vq->do_spt = list_empty(&cb_list);
350 do_callbacks(&cb_list); 250 do_callbacks(&cb_list);
351 251
352 /* next event is first in list */ 252 /* next event is first in list */
@@ -355,8 +255,7 @@ static void do_cpu_timer_interrupt(unsigned int ext_int_code,
355 if (!list_empty(&vq->list)) { 255 if (!list_empty(&vq->list)) {
356 event = list_first_entry(&vq->list, struct vtimer_list, entry); 256 event = list_first_entry(&vq->list, struct vtimer_list, entry);
357 next = event->expires; 257 next = event->expires;
358 } else 258 }
359 vq->do_spt = 0;
360 spin_unlock(&vq->lock); 259 spin_unlock(&vq->lock);
361 /* 260 /*
362 * To improve precision add the time spent by the 261 * To improve precision add the time spent by the
@@ -570,6 +469,9 @@ void init_cpu_vtimer(void)
570 469
571 /* enable cpu timer interrupts */ 470 /* enable cpu timer interrupts */
572 __ctl_set_bit(0,10); 471 __ctl_set_bit(0,10);
472
473 /* set initial cpu timer */
474 set_vtimer(0x7fffffffffffffffULL);
573} 475}
574 476
575static int __cpuinit s390_nohz_notify(struct notifier_block *self, 477static int __cpuinit s390_nohz_notify(struct notifier_block *self,
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 278ee009ce6..f0647ce6da2 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -134,7 +134,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
134 if (rc == -EFAULT) 134 if (rc == -EFAULT)
135 exception = 1; 135 exception = 1;
136 136
137 rc = put_guest_u16(vcpu, __LC_CPU_ADDRESS, inti->emerg.code); 137 rc = put_guest_u16(vcpu, __LC_EXT_CPU_ADDR, inti->emerg.code);
138 if (rc == -EFAULT) 138 if (rc == -EFAULT)
139 exception = 1; 139 exception = 1;
140 140
@@ -156,7 +156,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
156 if (rc == -EFAULT) 156 if (rc == -EFAULT)
157 exception = 1; 157 exception = 1;
158 158
159 rc = put_guest_u16(vcpu, __LC_CPU_ADDRESS, inti->extcall.code); 159 rc = put_guest_u16(vcpu, __LC_EXT_CPU_ADDR, inti->extcall.code);
160 if (rc == -EFAULT) 160 if (rc == -EFAULT)
161 exception = 1; 161 exception = 1;
162 162
@@ -202,7 +202,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
202 if (rc == -EFAULT) 202 if (rc == -EFAULT)
203 exception = 1; 203 exception = 1;
204 204
205 rc = put_guest_u16(vcpu, __LC_CPU_ADDRESS, 0x0d00); 205 rc = put_guest_u16(vcpu, __LC_EXT_CPU_ADDR, 0x0d00);
206 if (rc == -EFAULT) 206 if (rc == -EFAULT)
207 exception = 1; 207 exception = 1;
208 208
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c
index db92f044024..9f1f71e8577 100644
--- a/arch/s390/lib/delay.c
+++ b/arch/s390/lib/delay.c
@@ -13,6 +13,7 @@
13#include <linux/irqflags.h> 13#include <linux/irqflags.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <asm/div64.h> 15#include <asm/div64.h>
16#include <asm/timer.h>
16 17
17void __delay(unsigned long loops) 18void __delay(unsigned long loops)
18{ 19{
@@ -28,36 +29,33 @@ void __delay(unsigned long loops)
28 29
29static void __udelay_disabled(unsigned long long usecs) 30static void __udelay_disabled(unsigned long long usecs)
30{ 31{
31 unsigned long mask, cr0, cr0_saved; 32 unsigned long cr0, cr6, new;
32 u64 clock_saved; 33 u64 clock_saved, end;
33 u64 end;
34 34
35 mask = psw_kernel_bits | PSW_MASK_DAT | PSW_MASK_WAIT |
36 PSW_MASK_EXT | PSW_MASK_MCHECK;
37 end = get_clock() + (usecs << 12); 35 end = get_clock() + (usecs << 12);
38 clock_saved = local_tick_disable(); 36 clock_saved = local_tick_disable();
39 __ctl_store(cr0_saved, 0, 0); 37 __ctl_store(cr0, 0, 0);
40 cr0 = (cr0_saved & 0xffff00e0) | 0x00000800; 38 __ctl_store(cr6, 6, 6);
41 __ctl_load(cr0 , 0, 0); 39 new = (cr0 & 0xffff00e0) | 0x00000800;
40 __ctl_load(new , 0, 0);
41 new = 0;
42 __ctl_load(new, 6, 6);
42 lockdep_off(); 43 lockdep_off();
43 do { 44 do {
44 set_clock_comparator(end); 45 set_clock_comparator(end);
45 trace_hardirqs_on(); 46 vtime_stop_cpu();
46 __load_psw_mask(mask);
47 local_irq_disable(); 47 local_irq_disable();
48 } while (get_clock() < end); 48 } while (get_clock() < end);
49 lockdep_on(); 49 lockdep_on();
50 __ctl_load(cr0_saved, 0, 0); 50 __ctl_load(cr0, 0, 0);
51 __ctl_load(cr6, 6, 6);
51 local_tick_enable(clock_saved); 52 local_tick_enable(clock_saved);
52} 53}
53 54
54static void __udelay_enabled(unsigned long long usecs) 55static void __udelay_enabled(unsigned long long usecs)
55{ 56{
56 unsigned long mask; 57 u64 clock_saved, end;
57 u64 clock_saved;
58 u64 end;
59 58
60 mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO;
61 end = get_clock() + (usecs << 12); 59 end = get_clock() + (usecs << 12);
62 do { 60 do {
63 clock_saved = 0; 61 clock_saved = 0;
@@ -65,8 +63,7 @@ static void __udelay_enabled(unsigned long long usecs)
65 clock_saved = local_tick_disable(); 63 clock_saved = local_tick_disable();
66 set_clock_comparator(end); 64 set_clock_comparator(end);
67 } 65 }
68 trace_hardirqs_on(); 66 vtime_stop_cpu();
69 __load_psw_mask(mask);
70 local_irq_disable(); 67 local_irq_disable();
71 if (clock_saved) 68 if (clock_saved)
72 local_tick_enable(clock_saved); 69 local_tick_enable(clock_saved);
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index 91754ffb920..093eb694d9c 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -10,6 +10,7 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/smp.h>
13#include <asm/io.h> 14#include <asm/io.h>
14 15
15int spin_retry = 1000; 16int spin_retry = 1000;
@@ -24,21 +25,6 @@ static int __init spin_retry_setup(char *str)
24} 25}
25__setup("spin_retry=", spin_retry_setup); 26__setup("spin_retry=", spin_retry_setup);
26 27
27static inline void _raw_yield(void)
28{
29 if (MACHINE_HAS_DIAG44)
30 asm volatile("diag 0,0,0x44");
31}
32
33static inline void _raw_yield_cpu(int cpu)
34{
35 if (MACHINE_HAS_DIAG9C)
36 asm volatile("diag %0,0,0x9c"
37 : : "d" (cpu_logical_map(cpu)));
38 else
39 _raw_yield();
40}
41
42void arch_spin_lock_wait(arch_spinlock_t *lp) 28void arch_spin_lock_wait(arch_spinlock_t *lp)
43{ 29{
44 int count = spin_retry; 30 int count = spin_retry;
@@ -60,7 +46,7 @@ void arch_spin_lock_wait(arch_spinlock_t *lp)
60 } 46 }
61 owner = lp->owner_cpu; 47 owner = lp->owner_cpu;
62 if (owner) 48 if (owner)
63 _raw_yield_cpu(~owner); 49 smp_yield_cpu(~owner);
64 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) 50 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
65 return; 51 return;
66 } 52 }
@@ -91,7 +77,7 @@ void arch_spin_lock_wait_flags(arch_spinlock_t *lp, unsigned long flags)
91 } 77 }
92 owner = lp->owner_cpu; 78 owner = lp->owner_cpu;
93 if (owner) 79 if (owner)
94 _raw_yield_cpu(~owner); 80 smp_yield_cpu(~owner);
95 local_irq_disable(); 81 local_irq_disable();
96 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) 82 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
97 return; 83 return;
@@ -121,7 +107,7 @@ void arch_spin_relax(arch_spinlock_t *lock)
121 if (cpu != 0) { 107 if (cpu != 0) {
122 if (MACHINE_IS_VM || MACHINE_IS_KVM || 108 if (MACHINE_IS_VM || MACHINE_IS_KVM ||
123 !smp_vcpu_scheduled(~cpu)) 109 !smp_vcpu_scheduled(~cpu))
124 _raw_yield_cpu(~cpu); 110 smp_yield_cpu(~cpu);
125 } 111 }
126} 112}
127EXPORT_SYMBOL(arch_spin_relax); 113EXPORT_SYMBOL(arch_spin_relax);
@@ -133,7 +119,7 @@ void _raw_read_lock_wait(arch_rwlock_t *rw)
133 119
134 while (1) { 120 while (1) {
135 if (count-- <= 0) { 121 if (count-- <= 0) {
136 _raw_yield(); 122 smp_yield();
137 count = spin_retry; 123 count = spin_retry;
138 } 124 }
139 if (!arch_read_can_lock(rw)) 125 if (!arch_read_can_lock(rw))
@@ -153,7 +139,7 @@ void _raw_read_lock_wait_flags(arch_rwlock_t *rw, unsigned long flags)
153 local_irq_restore(flags); 139 local_irq_restore(flags);
154 while (1) { 140 while (1) {
155 if (count-- <= 0) { 141 if (count-- <= 0) {
156 _raw_yield(); 142 smp_yield();
157 count = spin_retry; 143 count = spin_retry;
158 } 144 }
159 if (!arch_read_can_lock(rw)) 145 if (!arch_read_can_lock(rw))
@@ -188,7 +174,7 @@ void _raw_write_lock_wait(arch_rwlock_t *rw)
188 174
189 while (1) { 175 while (1) {
190 if (count-- <= 0) { 176 if (count-- <= 0) {
191 _raw_yield(); 177 smp_yield();
192 count = spin_retry; 178 count = spin_retry;
193 } 179 }
194 if (!arch_write_can_lock(rw)) 180 if (!arch_write_can_lock(rw))
@@ -206,7 +192,7 @@ void _raw_write_lock_wait_flags(arch_rwlock_t *rw, unsigned long flags)
206 local_irq_restore(flags); 192 local_irq_restore(flags);
207 while (1) { 193 while (1) {
208 if (count-- <= 0) { 194 if (count-- <= 0) {
209 _raw_yield(); 195 smp_yield();
210 count = spin_retry; 196 count = spin_retry;
211 } 197 }
212 if (!arch_write_can_lock(rw)) 198 if (!arch_write_can_lock(rw))
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index e8fcd928dc7..b17c42df61c 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -532,7 +532,7 @@ void pfault_fini(void)
532static DEFINE_SPINLOCK(pfault_lock); 532static DEFINE_SPINLOCK(pfault_lock);
533static LIST_HEAD(pfault_list); 533static LIST_HEAD(pfault_list);
534 534
535static void pfault_interrupt(unsigned int ext_int_code, 535static void pfault_interrupt(struct ext_code ext_code,
536 unsigned int param32, unsigned long param64) 536 unsigned int param32, unsigned long param64)
537{ 537{
538 struct task_struct *tsk; 538 struct task_struct *tsk;
@@ -545,7 +545,7 @@ static void pfault_interrupt(unsigned int ext_int_code,
545 * in the 'cpu address' field associated with the 545 * in the 'cpu address' field associated with the
546 * external interrupt. 546 * external interrupt.
547 */ 547 */
548 subcode = ext_int_code >> 16; 548 subcode = ext_code.subcode;
549 if ((subcode & 0xff00) != __SUBCODE_MASK) 549 if ((subcode & 0xff00) != __SUBCODE_MASK)
550 return; 550 return;
551 kstat_cpu(smp_processor_id()).irqs[EXTINT_PFL]++; 551 kstat_cpu(smp_processor_id()).irqs[EXTINT_PFL]++;
diff --git a/arch/s390/oprofile/hwsampler.c b/arch/s390/oprofile/hwsampler.c
index 9daee91e6c3..12bea05a0fc 100644
--- a/arch/s390/oprofile/hwsampler.c
+++ b/arch/s390/oprofile/hwsampler.c
@@ -233,8 +233,8 @@ static inline unsigned long *trailer_entry_ptr(unsigned long v)
233} 233}
234 234
235/* prototypes for external interrupt handler and worker */ 235/* prototypes for external interrupt handler and worker */
236static void hws_ext_handler(unsigned int ext_int_code, 236static void hws_ext_handler(struct ext_code ext_code,
237 unsigned int param32, unsigned long param64); 237 unsigned int param32, unsigned long param64);
238 238
239static void worker(struct work_struct *work); 239static void worker(struct work_struct *work);
240 240
@@ -673,7 +673,7 @@ int hwsampler_activate(unsigned int cpu)
673 return rc; 673 return rc;
674} 674}
675 675
676static void hws_ext_handler(unsigned int ext_int_code, 676static void hws_ext_handler(struct ext_code ext_code,
677 unsigned int param32, unsigned long param64) 677 unsigned int param32, unsigned long param64)
678{ 678{
679 struct hws_cpu_buffer *cb; 679 struct hws_cpu_buffer *cb;
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index ebd0f818a25..8cf02e34333 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -157,7 +157,7 @@ static struct platform_device nand_flash_device = {
157#define PORT_DRVCRA 0xA405018A 157#define PORT_DRVCRA 0xA405018A
158#define PORT_DRVCRB 0xA405018C 158#define PORT_DRVCRB 0xA405018C
159 159
160static int ap320_wvga_set_brightness(void *board_data, int brightness) 160static int ap320_wvga_set_brightness(int brightness)
161{ 161{
162 if (brightness) { 162 if (brightness) {
163 gpio_set_value(GPIO_PTS3, 0); 163 gpio_set_value(GPIO_PTS3, 0);
@@ -170,12 +170,12 @@ static int ap320_wvga_set_brightness(void *board_data, int brightness)
170 return 0; 170 return 0;
171} 171}
172 172
173static int ap320_wvga_get_brightness(void *board_data) 173static int ap320_wvga_get_brightness(void)
174{ 174{
175 return gpio_get_value(GPIO_PTS3); 175 return gpio_get_value(GPIO_PTS3);
176} 176}
177 177
178static void ap320_wvga_power_on(void *board_data, struct fb_info *info) 178static void ap320_wvga_power_on(void)
179{ 179{
180 msleep(100); 180 msleep(100);
181 181
@@ -183,7 +183,7 @@ static void ap320_wvga_power_on(void *board_data, struct fb_info *info)
183 __raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG); 183 __raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG);
184} 184}
185 185
186static void ap320_wvga_power_off(void *board_data) 186static void ap320_wvga_power_off(void)
187{ 187{
188 /* ASD AP-320/325 LCD OFF */ 188 /* ASD AP-320/325 LCD OFF */
189 __raw_writew(0, FPGA_LCDREG); 189 __raw_writew(0, FPGA_LCDREG);
@@ -211,21 +211,19 @@ static struct sh_mobile_lcdc_info lcdc_info = {
211 .fourcc = V4L2_PIX_FMT_RGB565, 211 .fourcc = V4L2_PIX_FMT_RGB565,
212 .interface_type = RGB18, 212 .interface_type = RGB18,
213 .clock_divider = 1, 213 .clock_divider = 1,
214 .lcd_cfg = ap325rxa_lcdc_modes, 214 .lcd_modes = ap325rxa_lcdc_modes,
215 .num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes), 215 .num_modes = ARRAY_SIZE(ap325rxa_lcdc_modes),
216 .lcd_size_cfg = { /* 7.0 inch */ 216 .panel_cfg = {
217 .width = 152, 217 .width = 152, /* 7.0 inch */
218 .height = 91, 218 .height = 91,
219 },
220 .board_cfg = {
221 .display_on = ap320_wvga_power_on, 219 .display_on = ap320_wvga_power_on,
222 .display_off = ap320_wvga_power_off, 220 .display_off = ap320_wvga_power_off,
223 .set_brightness = ap320_wvga_set_brightness,
224 .get_brightness = ap320_wvga_get_brightness,
225 }, 221 },
226 .bl_info = { 222 .bl_info = {
227 .name = "sh_mobile_lcdc_bl", 223 .name = "sh_mobile_lcdc_bl",
228 .max_brightness = 1, 224 .max_brightness = 1,
225 .set_brightness = ap320_wvga_set_brightness,
226 .get_brightness = ap320_wvga_get_brightness,
229 }, 227 },
230 } 228 }
231}; 229};
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index cde7c0085ce..e5ac12b2ce6 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -310,14 +310,14 @@ static const struct fb_videomode ecovec_dvi_modes[] = {
310 }, 310 },
311}; 311};
312 312
313static int ecovec24_set_brightness(void *board_data, int brightness) 313static int ecovec24_set_brightness(int brightness)
314{ 314{
315 gpio_set_value(GPIO_PTR1, brightness); 315 gpio_set_value(GPIO_PTR1, brightness);
316 316
317 return 0; 317 return 0;
318} 318}
319 319
320static int ecovec24_get_brightness(void *board_data) 320static int ecovec24_get_brightness(void)
321{ 321{
322 return gpio_get_value(GPIO_PTR1); 322 return gpio_get_value(GPIO_PTR1);
323} 323}
@@ -327,17 +327,15 @@ static struct sh_mobile_lcdc_info lcdc_info = {
327 .interface_type = RGB18, 327 .interface_type = RGB18,
328 .chan = LCDC_CHAN_MAINLCD, 328 .chan = LCDC_CHAN_MAINLCD,
329 .fourcc = V4L2_PIX_FMT_RGB565, 329 .fourcc = V4L2_PIX_FMT_RGB565,
330 .lcd_size_cfg = { /* 7.0 inch */ 330 .panel_cfg = { /* 7.0 inch */
331 .width = 152, 331 .width = 152,
332 .height = 91, 332 .height = 91,
333 }, 333 },
334 .board_cfg = {
335 .set_brightness = ecovec24_set_brightness,
336 .get_brightness = ecovec24_get_brightness,
337 },
338 .bl_info = { 334 .bl_info = {
339 .name = "sh_mobile_lcdc_bl", 335 .name = "sh_mobile_lcdc_bl",
340 .max_brightness = 1, 336 .max_brightness = 1,
337 .set_brightness = ecovec24_set_brightness,
338 .get_brightness = ecovec24_get_brightness,
341 }, 339 },
342 } 340 }
343}; 341};
@@ -769,7 +767,9 @@ static struct platform_device camera_devices[] = {
769 767
770/* FSI */ 768/* FSI */
771static struct sh_fsi_platform_info fsi_info = { 769static struct sh_fsi_platform_info fsi_info = {
772 .portb_flags = SH_FSI_BRS_INV, 770 .port_b = {
771 .flags = SH_FSI_BRS_INV,
772 },
773}; 773};
774 774
775static struct resource fsi_resources[] = { 775static struct resource fsi_resources[] = {
@@ -1116,8 +1116,8 @@ static int __init arch_setup(void)
1116 /* DVI */ 1116 /* DVI */
1117 lcdc_info.clock_source = LCDC_CLK_EXTERNAL; 1117 lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
1118 lcdc_info.ch[0].clock_divider = 1; 1118 lcdc_info.ch[0].clock_divider = 1;
1119 lcdc_info.ch[0].lcd_cfg = ecovec_dvi_modes; 1119 lcdc_info.ch[0].lcd_modes = ecovec_dvi_modes;
1120 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_dvi_modes); 1120 lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_dvi_modes);
1121 1121
1122 gpio_set_value(GPIO_PTA2, 1); 1122 gpio_set_value(GPIO_PTA2, 1);
1123 gpio_set_value(GPIO_PTU1, 1); 1123 gpio_set_value(GPIO_PTU1, 1);
@@ -1125,8 +1125,8 @@ static int __init arch_setup(void)
1125 /* Panel */ 1125 /* Panel */
1126 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL; 1126 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
1127 lcdc_info.ch[0].clock_divider = 2; 1127 lcdc_info.ch[0].clock_divider = 2;
1128 lcdc_info.ch[0].lcd_cfg = ecovec_lcd_modes; 1128 lcdc_info.ch[0].lcd_modes = ecovec_lcd_modes;
1129 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_lcd_modes); 1129 lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_lcd_modes);
1130 1130
1131 gpio_set_value(GPIO_PTR1, 1); 1131 gpio_set_value(GPIO_PTR1, 1);
1132 1132
diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c
index 74b8db1b74a..4a52590fe3d 100644
--- a/arch/sh/boards/mach-highlander/setup.c
+++ b/arch/sh/boards/mach-highlander/setup.c
@@ -322,7 +322,7 @@ static void ivdr_clk_disable(struct clk *clk)
322 __raw_writew(__raw_readw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL); 322 __raw_writew(__raw_readw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL);
323} 323}
324 324
325static struct clk_ops ivdr_clk_ops = { 325static struct sh_clk_ops ivdr_clk_ops = {
326 .enable = ivdr_clk_enable, 326 .enable = ivdr_clk_enable,
327 .disable = ivdr_clk_disable, 327 .disable = ivdr_clk_disable,
328}; 328};
diff --git a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
index 25e145fb708..c148b36ecb6 100644
--- a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
+++ b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
@@ -251,8 +251,7 @@ static void display_on(void *sohandle,
251 write_memory_start(sohandle, so); 251 write_memory_start(sohandle, so);
252} 252}
253 253
254int kfr2r09_lcd_setup(void *board_data, void *sohandle, 254int kfr2r09_lcd_setup(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
255 struct sh_mobile_lcdc_sys_bus_ops *so)
256{ 255{
257 /* power on */ 256 /* power on */
258 gpio_set_value(GPIO_PTF4, 0); /* PROTECT/ -> L */ 257 gpio_set_value(GPIO_PTF4, 0); /* PROTECT/ -> L */
@@ -273,8 +272,7 @@ int kfr2r09_lcd_setup(void *board_data, void *sohandle,
273 return 0; 272 return 0;
274} 273}
275 274
276void kfr2r09_lcd_start(void *board_data, void *sohandle, 275void kfr2r09_lcd_start(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
277 struct sh_mobile_lcdc_sys_bus_ops *so)
278{ 276{
279 write_memory_start(sohandle, so); 277 write_memory_start(sohandle, so);
280} 278}
@@ -327,12 +325,12 @@ static int kfr2r09_lcd_backlight(int on)
327 return 0; 325 return 0;
328} 326}
329 327
330void kfr2r09_lcd_on(void *board_data, struct fb_info *info) 328void kfr2r09_lcd_on(void)
331{ 329{
332 kfr2r09_lcd_backlight(1); 330 kfr2r09_lcd_backlight(1);
333} 331}
334 332
335void kfr2r09_lcd_off(void *board_data) 333void kfr2r09_lcd_off(void)
336{ 334{
337 kfr2r09_lcd_backlight(0); 335 kfr2r09_lcd_backlight(0);
338} 336}
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index 5b382e1afae..d04a55d3b87 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -148,13 +148,11 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
148 .interface_type = SYS18, 148 .interface_type = SYS18,
149 .clock_divider = 6, 149 .clock_divider = 6,
150 .flags = LCDC_FLAGS_DWPOL, 150 .flags = LCDC_FLAGS_DWPOL,
151 .lcd_cfg = kfr2r09_lcdc_modes, 151 .lcd_modes = kfr2r09_lcdc_modes,
152 .num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes), 152 .num_modes = ARRAY_SIZE(kfr2r09_lcdc_modes),
153 .lcd_size_cfg = { 153 .panel_cfg = {
154 .width = 35, 154 .width = 35,
155 .height = 58, 155 .height = 58,
156 },
157 .board_cfg = {
158 .setup_sys = kfr2r09_lcd_setup, 156 .setup_sys = kfr2r09_lcd_setup,
159 .start_transfer = kfr2r09_lcd_start, 157 .start_transfer = kfr2r09_lcd_start,
160 .display_on = kfr2r09_lcd_on, 158 .display_on = kfr2r09_lcd_on,
diff --git a/arch/sh/boards/mach-migor/lcd_qvga.c b/arch/sh/boards/mach-migor/lcd_qvga.c
index de9014a8a93..8bccd345b69 100644
--- a/arch/sh/boards/mach-migor/lcd_qvga.c
+++ b/arch/sh/boards/mach-migor/lcd_qvga.c
@@ -113,8 +113,7 @@ static const unsigned short magic3_data[] = {
113 0x0010, 0x16B0, 0x0011, 0x0111, 0x0007, 0x0061, 113 0x0010, 0x16B0, 0x0011, 0x0111, 0x0007, 0x0061,
114}; 114};
115 115
116int migor_lcd_qvga_setup(void *board_data, void *sohandle, 116int migor_lcd_qvga_setup(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
117 struct sh_mobile_lcdc_sys_bus_ops *so)
118{ 117{
119 unsigned long xres = 320; 118 unsigned long xres = 320;
120 unsigned long yres = 240; 119 unsigned long yres = 240;
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index d37ba272052..ff6f69c6906 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -246,9 +246,9 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
246 .fourcc = V4L2_PIX_FMT_RGB565, 246 .fourcc = V4L2_PIX_FMT_RGB565,
247 .interface_type = RGB16, 247 .interface_type = RGB16,
248 .clock_divider = 2, 248 .clock_divider = 2,
249 .lcd_cfg = migor_lcd_modes, 249 .lcd_modes = migor_lcd_modes,
250 .num_cfg = ARRAY_SIZE(migor_lcd_modes), 250 .num_modes = ARRAY_SIZE(migor_lcd_modes),
251 .lcd_size_cfg = { /* 7.0 inch */ 251 .panel_cfg = { /* 7.0 inch */
252 .width = 152, 252 .width = 152,
253 .height = 91, 253 .height = 91,
254 }, 254 },
@@ -260,13 +260,11 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
260 .fourcc = V4L2_PIX_FMT_RGB565, 260 .fourcc = V4L2_PIX_FMT_RGB565,
261 .interface_type = SYS16A, 261 .interface_type = SYS16A,
262 .clock_divider = 10, 262 .clock_divider = 10,
263 .lcd_cfg = migor_lcd_modes, 263 .lcd_modes = migor_lcd_modes,
264 .num_cfg = ARRAY_SIZE(migor_lcd_modes), 264 .num_modes = ARRAY_SIZE(migor_lcd_modes),
265 .lcd_size_cfg = { /* 2.4 inch */ 265 .panel_cfg = {
266 .width = 49, 266 .width = 49, /* 2.4 inch */
267 .height = 37, 267 .height = 37,
268 },
269 .board_cfg = {
270 .setup_sys = migor_lcd_qvga_setup, 268 .setup_sys = migor_lcd_qvga_setup,
271 }, 269 },
272 .sys_bus_cfg = { 270 .sys_bus_cfg = {
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c
index 486d1ac3694..27a2314f50a 100644
--- a/arch/sh/boards/mach-sdk7786/setup.c
+++ b/arch/sh/boards/mach-sdk7786/setup.c
@@ -167,7 +167,7 @@ static void sdk7786_pcie_clk_disable(struct clk *clk)
167 fpga_write_reg(fpga_read_reg(PCIECR) & ~PCIECR_CLKEN, PCIECR); 167 fpga_write_reg(fpga_read_reg(PCIECR) & ~PCIECR_CLKEN, PCIECR);
168} 168}
169 169
170static struct clk_ops sdk7786_pcie_clk_ops = { 170static struct sh_clk_ops sdk7786_pcie_clk_ops = {
171 .enable = sdk7786_pcie_clk_enable, 171 .enable = sdk7786_pcie_clk_enable,
172 .disable = sdk7786_pcie_clk_disable, 172 .disable = sdk7786_pcie_clk_disable,
173}; 173};
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 2b07fc01695..c540b16547c 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -182,12 +182,10 @@ static struct sh_mobile_lcdc_info lcdc_info = {
182 .chan = LCDC_CHAN_MAINLCD, 182 .chan = LCDC_CHAN_MAINLCD,
183 .fourcc = V4L2_PIX_FMT_RGB565, 183 .fourcc = V4L2_PIX_FMT_RGB565,
184 .clock_divider = 1, 184 .clock_divider = 1,
185 .lcd_size_cfg = { /* 7.0 inch */ 185 .panel_cfg = { /* 7.0 inch */
186 .width = 152, 186 .width = 152,
187 .height = 91, 187 .height = 91,
188 }, 188 },
189 .board_cfg = {
190 },
191 } 189 }
192}; 190};
193 191
@@ -278,7 +276,9 @@ static struct platform_device ceu1_device = {
278/* FSI */ 276/* FSI */
279/* change J20, J21, J22 pin to 1-2 connection to use slave mode */ 277/* change J20, J21, J22 pin to 1-2 connection to use slave mode */
280static struct sh_fsi_platform_info fsi_info = { 278static struct sh_fsi_platform_info fsi_info = {
281 .porta_flags = SH_FSI_BRS_INV, 279 .port_a = {
280 .flags = SH_FSI_BRS_INV,
281 },
282}; 282};
283 283
284static struct resource fsi_resources[] = { 284static struct resource fsi_resources[] = {
@@ -888,12 +888,12 @@ static int __init devices_setup(void)
888 888
889 if (sw & SW41_B) { 889 if (sw & SW41_B) {
890 /* 720p */ 890 /* 720p */
891 lcdc_info.ch[0].lcd_cfg = lcdc_720p_modes; 891 lcdc_info.ch[0].lcd_modes = lcdc_720p_modes;
892 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_720p_modes); 892 lcdc_info.ch[0].num_modes = ARRAY_SIZE(lcdc_720p_modes);
893 } else { 893 } else {
894 /* VGA */ 894 /* VGA */
895 lcdc_info.ch[0].lcd_cfg = lcdc_vga_modes; 895 lcdc_info.ch[0].lcd_modes = lcdc_vga_modes;
896 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_vga_modes); 896 lcdc_info.ch[0].num_modes = ARRAY_SIZE(lcdc_vga_modes);
897 } 897 }
898 898
899 if (sw & SW41_A) { 899 if (sw & SW41_A) {
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 1e7b0e2e764..9d10a3cb879 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -37,11 +37,20 @@ static void __devinit pcibios_scanbus(struct pci_channel *hose)
37 static int next_busno; 37 static int next_busno;
38 static int need_domain_info; 38 static int need_domain_info;
39 LIST_HEAD(resources); 39 LIST_HEAD(resources);
40 struct resource *res;
41 resource_size_t offset;
40 int i; 42 int i;
41 struct pci_bus *bus; 43 struct pci_bus *bus;
42 44
43 for (i = 0; i < hose->nr_resources; i++) 45 for (i = 0; i < hose->nr_resources; i++) {
44 pci_add_resource(&resources, hose->resources + i); 46 res = hose->resources + i;
47 offset = 0;
48 if (res->flags & IORESOURCE_IO)
49 offset = hose->io_offset;
50 else if (res->flags & IORESOURCE_MEM)
51 offset = hose->mem_offset;
52 pci_add_resource_offset(&resources, res, offset);
53 }
45 54
46 bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose, 55 bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
47 &resources); 56 &resources);
@@ -143,42 +152,12 @@ static int __init pcibios_init(void)
143} 152}
144subsys_initcall(pcibios_init); 153subsys_initcall(pcibios_init);
145 154
146static void pcibios_fixup_device_resources(struct pci_dev *dev,
147 struct pci_bus *bus)
148{
149 /* Update device resources. */
150 struct pci_channel *hose = bus->sysdata;
151 unsigned long offset = 0;
152 int i;
153
154 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
155 if (!dev->resource[i].start)
156 continue;
157 if (dev->resource[i].flags & IORESOURCE_IO)
158 offset = hose->io_offset;
159 else if (dev->resource[i].flags & IORESOURCE_MEM)
160 offset = hose->mem_offset;
161
162 dev->resource[i].start += offset;
163 dev->resource[i].end += offset;
164 }
165}
166
167/* 155/*
168 * Called after each bus is probed, but before its children 156 * Called after each bus is probed, but before its children
169 * are examined. 157 * are examined.
170 */ 158 */
171void __devinit pcibios_fixup_bus(struct pci_bus *bus) 159void __devinit pcibios_fixup_bus(struct pci_bus *bus)
172{ 160{
173 struct pci_dev *dev;
174 struct list_head *ln;
175
176 for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
177 dev = pci_dev_b(ln);
178
179 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
180 pcibios_fixup_device_resources(dev, bus);
181 }
182} 161}
183 162
184/* 163/*
@@ -208,36 +187,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
208 return start; 187 return start;
209} 188}
210 189
211void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
212 struct resource *res)
213{
214 struct pci_channel *hose = dev->sysdata;
215 unsigned long offset = 0;
216
217 if (res->flags & IORESOURCE_IO)
218 offset = hose->io_offset;
219 else if (res->flags & IORESOURCE_MEM)
220 offset = hose->mem_offset;
221
222 region->start = res->start - offset;
223 region->end = res->end - offset;
224}
225
226void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
227 struct pci_bus_region *region)
228{
229 struct pci_channel *hose = dev->sysdata;
230 unsigned long offset = 0;
231
232 if (res->flags & IORESOURCE_IO)
233 offset = hose->io_offset;
234 else if (res->flags & IORESOURCE_MEM)
235 offset = hose->mem_offset;
236
237 res->start = region->start + offset;
238 res->end = region->end + offset;
239}
240
241int pcibios_enable_device(struct pci_dev *dev, int mask) 190int pcibios_enable_device(struct pci_dev *dev, int mask)
242{ 191{
243 return pci_enable_resources(dev, mask); 192 return pci_enable_resources(dev, mask);
@@ -381,8 +330,6 @@ EXPORT_SYMBOL(pci_iounmap);
381#endif /* CONFIG_GENERIC_IOMAP */ 330#endif /* CONFIG_GENERIC_IOMAP */
382 331
383#ifdef CONFIG_HOTPLUG 332#ifdef CONFIG_HOTPLUG
384EXPORT_SYMBOL(pcibios_resource_to_bus);
385EXPORT_SYMBOL(pcibios_bus_to_resource);
386EXPORT_SYMBOL(PCIBIOS_MIN_IO); 333EXPORT_SYMBOL(PCIBIOS_MIN_IO);
387EXPORT_SYMBOL(PCIBIOS_MIN_MEM); 334EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
388#endif 335#endif
diff --git a/arch/sh/include/asm/clock.h b/arch/sh/include/asm/clock.h
index 803d4c7f09d..0390a07e7e3 100644
--- a/arch/sh/include/asm/clock.h
+++ b/arch/sh/include/asm/clock.h
@@ -4,7 +4,7 @@
4#include <linux/sh_clk.h> 4#include <linux/sh_clk.h>
5 5
6/* Should be defined by processor-specific code */ 6/* Should be defined by processor-specific code */
7void __deprecated arch_init_clk_ops(struct clk_ops **, int type); 7void __deprecated arch_init_clk_ops(struct sh_clk_ops **, int type);
8int __init arch_clk_init(void); 8int __init arch_clk_init(void);
9 9
10/* arch/sh/kernel/cpu/clock-cpg.c */ 10/* arch/sh/kernel/cpu/clock-cpg.c */
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index cb21e2399dc..bff96c2e7d2 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -114,12 +114,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
114/* Board-specific fixup routines. */ 114/* Board-specific fixup routines. */
115int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin); 115int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
116 116
117extern void pcibios_resource_to_bus(struct pci_dev *dev,
118 struct pci_bus_region *region, struct resource *res);
119
120extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
121 struct pci_bus_region *region);
122
123#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index 117#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
124 118
125static inline int pci_proc_domain(struct pci_bus *bus) 119static inline int pci_proc_domain(struct pci_bus *bus)
diff --git a/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h b/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
index 07e635b0e04..ba3d93d333f 100644
--- a/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
+++ b/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
@@ -4,21 +4,21 @@
4#include <video/sh_mobile_lcdc.h> 4#include <video/sh_mobile_lcdc.h>
5 5
6#if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE) 6#if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE)
7void kfr2r09_lcd_on(void *board_data, struct fb_info *info); 7void kfr2r09_lcd_on(void);
8void kfr2r09_lcd_off(void *board_data); 8void kfr2r09_lcd_off(void);
9int kfr2r09_lcd_setup(void *board_data, void *sys_ops_handle, 9int kfr2r09_lcd_setup(void *sys_ops_handle,
10 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 10 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
11void kfr2r09_lcd_start(void *board_data, void *sys_ops_handle, 11void kfr2r09_lcd_start(void *sys_ops_handle,
12 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 12 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
13#else 13#else
14static void kfr2r09_lcd_on(void *board_data) {} 14static void kfr2r09_lcd_on(void) {}
15static void kfr2r09_lcd_off(void *board_data) {} 15static void kfr2r09_lcd_off(void) {}
16static int kfr2r09_lcd_setup(void *board_data, void *sys_ops_handle, 16static int kfr2r09_lcd_setup(void *sys_ops_handle,
17 struct sh_mobile_lcdc_sys_bus_ops *sys_ops) 17 struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
18{ 18{
19 return -ENODEV; 19 return -ENODEV;
20} 20}
21static void kfr2r09_lcd_start(void *board_data, void *sys_ops_handle, 21static void kfr2r09_lcd_start(void *sys_ops_handle,
22 struct sh_mobile_lcdc_sys_bus_ops *sys_ops) 22 struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
23{ 23{
24} 24}
diff --git a/arch/sh/include/mach-migor/mach/migor.h b/arch/sh/include/mach-migor/mach/migor.h
index 42fccf93412..7de7bb74c29 100644
--- a/arch/sh/include/mach-migor/mach/migor.h
+++ b/arch/sh/include/mach-migor/mach/migor.h
@@ -9,7 +9,7 @@
9 9
10#include <video/sh_mobile_lcdc.h> 10#include <video/sh_mobile_lcdc.h>
11 11
12int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle, 12int migor_lcd_qvga_setup(void *sys_ops_handle,
13 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 13 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
14 14
15#endif /* __ASM_SH_MIGOR_H */ 15#endif /* __ASM_SH_MIGOR_H */
diff --git a/arch/sh/kernel/cpu/sh2/clock-sh7619.c b/arch/sh/kernel/cpu/sh2/clock-sh7619.c
index 5b7f12e58a8..e80252ae5bc 100644
--- a/arch/sh/kernel/cpu/sh2/clock-sh7619.c
+++ b/arch/sh/kernel/cpu/sh2/clock-sh7619.c
@@ -28,7 +28,7 @@ static void master_clk_init(struct clk *clk)
28 clk->rate *= pll2_mult * pll1rate[(__raw_readw(FREQCR) >> 8) & 7]; 28 clk->rate *= pll2_mult * pll1rate[(__raw_readw(FREQCR) >> 8) & 7];
29} 29}
30 30
31static struct clk_ops sh7619_master_clk_ops = { 31static struct sh_clk_ops sh7619_master_clk_ops = {
32 .init = master_clk_init, 32 .init = master_clk_init,
33}; 33};
34 34
@@ -38,7 +38,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
38 return clk->parent->rate / pfc_divisors[idx]; 38 return clk->parent->rate / pfc_divisors[idx];
39} 39}
40 40
41static struct clk_ops sh7619_module_clk_ops = { 41static struct sh_clk_ops sh7619_module_clk_ops = {
42 .recalc = module_clk_recalc, 42 .recalc = module_clk_recalc,
43}; 43};
44 44
@@ -47,22 +47,22 @@ static unsigned long bus_clk_recalc(struct clk *clk)
47 return clk->parent->rate / pll1rate[(__raw_readw(FREQCR) >> 8) & 7]; 47 return clk->parent->rate / pll1rate[(__raw_readw(FREQCR) >> 8) & 7];
48} 48}
49 49
50static struct clk_ops sh7619_bus_clk_ops = { 50static struct sh_clk_ops sh7619_bus_clk_ops = {
51 .recalc = bus_clk_recalc, 51 .recalc = bus_clk_recalc,
52}; 52};
53 53
54static struct clk_ops sh7619_cpu_clk_ops = { 54static struct sh_clk_ops sh7619_cpu_clk_ops = {
55 .recalc = followparent_recalc, 55 .recalc = followparent_recalc,
56}; 56};
57 57
58static struct clk_ops *sh7619_clk_ops[] = { 58static struct sh_clk_ops *sh7619_clk_ops[] = {
59 &sh7619_master_clk_ops, 59 &sh7619_master_clk_ops,
60 &sh7619_module_clk_ops, 60 &sh7619_module_clk_ops,
61 &sh7619_bus_clk_ops, 61 &sh7619_bus_clk_ops,
62 &sh7619_cpu_clk_ops, 62 &sh7619_cpu_clk_ops,
63}; 63};
64 64
65void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 65void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
66{ 66{
67 if (test_mode_pin(MODE_PIN2 | MODE_PIN0) || 67 if (test_mode_pin(MODE_PIN2 | MODE_PIN0) ||
68 test_mode_pin(MODE_PIN2 | MODE_PIN1)) 68 test_mode_pin(MODE_PIN2 | MODE_PIN1))
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7201.c b/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
index 1174e2d96c0..532a36c7232 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
@@ -30,7 +30,7 @@ static void master_clk_init(struct clk *clk)
30 pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007]; 30 pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007];
31} 31}
32 32
33static struct clk_ops sh7201_master_clk_ops = { 33static struct sh_clk_ops sh7201_master_clk_ops = {
34 .init = master_clk_init, 34 .init = master_clk_init,
35}; 35};
36 36
@@ -40,7 +40,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
40 return clk->parent->rate / pfc_divisors[idx]; 40 return clk->parent->rate / pfc_divisors[idx];
41} 41}
42 42
43static struct clk_ops sh7201_module_clk_ops = { 43static struct sh_clk_ops sh7201_module_clk_ops = {
44 .recalc = module_clk_recalc, 44 .recalc = module_clk_recalc,
45}; 45};
46 46
@@ -50,7 +50,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
50 return clk->parent->rate / pfc_divisors[idx]; 50 return clk->parent->rate / pfc_divisors[idx];
51} 51}
52 52
53static struct clk_ops sh7201_bus_clk_ops = { 53static struct sh_clk_ops sh7201_bus_clk_ops = {
54 .recalc = bus_clk_recalc, 54 .recalc = bus_clk_recalc,
55}; 55};
56 56
@@ -60,18 +60,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
60 return clk->parent->rate / ifc_divisors[idx]; 60 return clk->parent->rate / ifc_divisors[idx];
61} 61}
62 62
63static struct clk_ops sh7201_cpu_clk_ops = { 63static struct sh_clk_ops sh7201_cpu_clk_ops = {
64 .recalc = cpu_clk_recalc, 64 .recalc = cpu_clk_recalc,
65}; 65};
66 66
67static struct clk_ops *sh7201_clk_ops[] = { 67static struct sh_clk_ops *sh7201_clk_ops[] = {
68 &sh7201_master_clk_ops, 68 &sh7201_master_clk_ops,
69 &sh7201_module_clk_ops, 69 &sh7201_module_clk_ops,
70 &sh7201_bus_clk_ops, 70 &sh7201_bus_clk_ops,
71 &sh7201_cpu_clk_ops, 71 &sh7201_cpu_clk_ops,
72}; 72};
73 73
74void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 74void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
75{ 75{
76 if (test_mode_pin(MODE_PIN1 | MODE_PIN0)) 76 if (test_mode_pin(MODE_PIN1 | MODE_PIN0))
77 pll2_mult = 1; 77 pll2_mult = 1;
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7203.c b/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
index 95a008e8b73..529f719b6e3 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
@@ -32,7 +32,7 @@ static void master_clk_init(struct clk *clk)
32 clk->rate *= pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0003] * pll2_mult; 32 clk->rate *= pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0003] * pll2_mult;
33} 33}
34 34
35static struct clk_ops sh7203_master_clk_ops = { 35static struct sh_clk_ops sh7203_master_clk_ops = {
36 .init = master_clk_init, 36 .init = master_clk_init,
37}; 37};
38 38
@@ -42,7 +42,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
42 return clk->parent->rate / pfc_divisors[idx]; 42 return clk->parent->rate / pfc_divisors[idx];
43} 43}
44 44
45static struct clk_ops sh7203_module_clk_ops = { 45static struct sh_clk_ops sh7203_module_clk_ops = {
46 .recalc = module_clk_recalc, 46 .recalc = module_clk_recalc,
47}; 47};
48 48
@@ -52,22 +52,22 @@ static unsigned long bus_clk_recalc(struct clk *clk)
52 return clk->parent->rate / pfc_divisors[idx-2]; 52 return clk->parent->rate / pfc_divisors[idx-2];
53} 53}
54 54
55static struct clk_ops sh7203_bus_clk_ops = { 55static struct sh_clk_ops sh7203_bus_clk_ops = {
56 .recalc = bus_clk_recalc, 56 .recalc = bus_clk_recalc,
57}; 57};
58 58
59static struct clk_ops sh7203_cpu_clk_ops = { 59static struct sh_clk_ops sh7203_cpu_clk_ops = {
60 .recalc = followparent_recalc, 60 .recalc = followparent_recalc,
61}; 61};
62 62
63static struct clk_ops *sh7203_clk_ops[] = { 63static struct sh_clk_ops *sh7203_clk_ops[] = {
64 &sh7203_master_clk_ops, 64 &sh7203_master_clk_ops,
65 &sh7203_module_clk_ops, 65 &sh7203_module_clk_ops,
66 &sh7203_bus_clk_ops, 66 &sh7203_bus_clk_ops,
67 &sh7203_cpu_clk_ops, 67 &sh7203_cpu_clk_ops,
68}; 68};
69 69
70void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 70void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
71{ 71{
72 if (test_mode_pin(MODE_PIN1)) 72 if (test_mode_pin(MODE_PIN1))
73 pll2_mult = 4; 73 pll2_mult = 4;
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7206.c b/arch/sh/kernel/cpu/sh2a/clock-sh7206.c
index 3c314d7cd6e..17778983467 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7206.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7206.c
@@ -29,7 +29,7 @@ static void master_clk_init(struct clk *clk)
29 clk->rate *= pll2_mult * pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007]; 29 clk->rate *= pll2_mult * pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007];
30} 30}
31 31
32static struct clk_ops sh7206_master_clk_ops = { 32static struct sh_clk_ops sh7206_master_clk_ops = {
33 .init = master_clk_init, 33 .init = master_clk_init,
34}; 34};
35 35
@@ -39,7 +39,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
39 return clk->parent->rate / pfc_divisors[idx]; 39 return clk->parent->rate / pfc_divisors[idx];
40} 40}
41 41
42static struct clk_ops sh7206_module_clk_ops = { 42static struct sh_clk_ops sh7206_module_clk_ops = {
43 .recalc = module_clk_recalc, 43 .recalc = module_clk_recalc,
44}; 44};
45 45
@@ -48,7 +48,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
48 return clk->parent->rate / pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007]; 48 return clk->parent->rate / pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007];
49} 49}
50 50
51static struct clk_ops sh7206_bus_clk_ops = { 51static struct sh_clk_ops sh7206_bus_clk_ops = {
52 .recalc = bus_clk_recalc, 52 .recalc = bus_clk_recalc,
53}; 53};
54 54
@@ -58,18 +58,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
58 return clk->parent->rate / ifc_divisors[idx]; 58 return clk->parent->rate / ifc_divisors[idx];
59} 59}
60 60
61static struct clk_ops sh7206_cpu_clk_ops = { 61static struct sh_clk_ops sh7206_cpu_clk_ops = {
62 .recalc = cpu_clk_recalc, 62 .recalc = cpu_clk_recalc,
63}; 63};
64 64
65static struct clk_ops *sh7206_clk_ops[] = { 65static struct sh_clk_ops *sh7206_clk_ops[] = {
66 &sh7206_master_clk_ops, 66 &sh7206_master_clk_ops,
67 &sh7206_module_clk_ops, 67 &sh7206_module_clk_ops,
68 &sh7206_bus_clk_ops, 68 &sh7206_bus_clk_ops,
69 &sh7206_cpu_clk_ops, 69 &sh7206_cpu_clk_ops,
70}; 70};
71 71
72void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 72void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
73{ 73{
74 if (test_mode_pin(MODE_PIN2 | MODE_PIN1 | MODE_PIN0)) 74 if (test_mode_pin(MODE_PIN2 | MODE_PIN1 | MODE_PIN0))
75 pll2_mult = 1; 75 pll2_mult = 1;
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh3.c b/arch/sh/kernel/cpu/sh3/clock-sh3.c
index b78384afac0..90faa44ca94 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh3.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh3.c
@@ -34,7 +34,7 @@ static void master_clk_init(struct clk *clk)
34 clk->rate *= pfc_divisors[idx]; 34 clk->rate *= pfc_divisors[idx];
35} 35}
36 36
37static struct clk_ops sh3_master_clk_ops = { 37static struct sh_clk_ops sh3_master_clk_ops = {
38 .init = master_clk_init, 38 .init = master_clk_init,
39}; 39};
40 40
@@ -46,7 +46,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
46 return clk->parent->rate / pfc_divisors[idx]; 46 return clk->parent->rate / pfc_divisors[idx];
47} 47}
48 48
49static struct clk_ops sh3_module_clk_ops = { 49static struct sh_clk_ops sh3_module_clk_ops = {
50 .recalc = module_clk_recalc, 50 .recalc = module_clk_recalc,
51}; 51};
52 52
@@ -58,7 +58,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
58 return clk->parent->rate / stc_multipliers[idx]; 58 return clk->parent->rate / stc_multipliers[idx];
59} 59}
60 60
61static struct clk_ops sh3_bus_clk_ops = { 61static struct sh_clk_ops sh3_bus_clk_ops = {
62 .recalc = bus_clk_recalc, 62 .recalc = bus_clk_recalc,
63}; 63};
64 64
@@ -70,18 +70,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
70 return clk->parent->rate / ifc_divisors[idx]; 70 return clk->parent->rate / ifc_divisors[idx];
71} 71}
72 72
73static struct clk_ops sh3_cpu_clk_ops = { 73static struct sh_clk_ops sh3_cpu_clk_ops = {
74 .recalc = cpu_clk_recalc, 74 .recalc = cpu_clk_recalc,
75}; 75};
76 76
77static struct clk_ops *sh3_clk_ops[] = { 77static struct sh_clk_ops *sh3_clk_ops[] = {
78 &sh3_master_clk_ops, 78 &sh3_master_clk_ops,
79 &sh3_module_clk_ops, 79 &sh3_module_clk_ops,
80 &sh3_bus_clk_ops, 80 &sh3_bus_clk_ops,
81 &sh3_cpu_clk_ops, 81 &sh3_cpu_clk_ops,
82}; 82};
83 83
84void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 84void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
85{ 85{
86 if (idx < ARRAY_SIZE(sh3_clk_ops)) 86 if (idx < ARRAY_SIZE(sh3_clk_ops))
87 *ops = sh3_clk_ops[idx]; 87 *ops = sh3_clk_ops[idx];
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7705.c b/arch/sh/kernel/cpu/sh3/clock-sh7705.c
index 0ecea1451c6..a8da4a9986b 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7705.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7705.c
@@ -35,7 +35,7 @@ static void master_clk_init(struct clk *clk)
35 clk->rate *= pfc_divisors[__raw_readw(FRQCR) & 0x0003]; 35 clk->rate *= pfc_divisors[__raw_readw(FRQCR) & 0x0003];
36} 36}
37 37
38static struct clk_ops sh7705_master_clk_ops = { 38static struct sh_clk_ops sh7705_master_clk_ops = {
39 .init = master_clk_init, 39 .init = master_clk_init,
40}; 40};
41 41
@@ -45,7 +45,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
45 return clk->parent->rate / pfc_divisors[idx]; 45 return clk->parent->rate / pfc_divisors[idx];
46} 46}
47 47
48static struct clk_ops sh7705_module_clk_ops = { 48static struct sh_clk_ops sh7705_module_clk_ops = {
49 .recalc = module_clk_recalc, 49 .recalc = module_clk_recalc,
50}; 50};
51 51
@@ -55,7 +55,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
55 return clk->parent->rate / stc_multipliers[idx]; 55 return clk->parent->rate / stc_multipliers[idx];
56} 56}
57 57
58static struct clk_ops sh7705_bus_clk_ops = { 58static struct sh_clk_ops sh7705_bus_clk_ops = {
59 .recalc = bus_clk_recalc, 59 .recalc = bus_clk_recalc,
60}; 60};
61 61
@@ -65,18 +65,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
65 return clk->parent->rate / ifc_divisors[idx]; 65 return clk->parent->rate / ifc_divisors[idx];
66} 66}
67 67
68static struct clk_ops sh7705_cpu_clk_ops = { 68static struct sh_clk_ops sh7705_cpu_clk_ops = {
69 .recalc = cpu_clk_recalc, 69 .recalc = cpu_clk_recalc,
70}; 70};
71 71
72static struct clk_ops *sh7705_clk_ops[] = { 72static struct sh_clk_ops *sh7705_clk_ops[] = {
73 &sh7705_master_clk_ops, 73 &sh7705_master_clk_ops,
74 &sh7705_module_clk_ops, 74 &sh7705_module_clk_ops,
75 &sh7705_bus_clk_ops, 75 &sh7705_bus_clk_ops,
76 &sh7705_cpu_clk_ops, 76 &sh7705_cpu_clk_ops,
77}; 77};
78 78
79void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 79void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
80{ 80{
81 if (idx < ARRAY_SIZE(sh7705_clk_ops)) 81 if (idx < ARRAY_SIZE(sh7705_clk_ops))
82 *ops = sh7705_clk_ops[idx]; 82 *ops = sh7705_clk_ops[idx];
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7706.c b/arch/sh/kernel/cpu/sh3/clock-sh7706.c
index 6f9ff8b57dd..a4088e5b220 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7706.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7706.c
@@ -30,7 +30,7 @@ static void master_clk_init(struct clk *clk)
30 clk->rate *= pfc_divisors[idx]; 30 clk->rate *= pfc_divisors[idx];
31} 31}
32 32
33static struct clk_ops sh7706_master_clk_ops = { 33static struct sh_clk_ops sh7706_master_clk_ops = {
34 .init = master_clk_init, 34 .init = master_clk_init,
35}; 35};
36 36
@@ -42,7 +42,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
42 return clk->parent->rate / pfc_divisors[idx]; 42 return clk->parent->rate / pfc_divisors[idx];
43} 43}
44 44
45static struct clk_ops sh7706_module_clk_ops = { 45static struct sh_clk_ops sh7706_module_clk_ops = {
46 .recalc = module_clk_recalc, 46 .recalc = module_clk_recalc,
47}; 47};
48 48
@@ -54,7 +54,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
54 return clk->parent->rate / stc_multipliers[idx]; 54 return clk->parent->rate / stc_multipliers[idx];
55} 55}
56 56
57static struct clk_ops sh7706_bus_clk_ops = { 57static struct sh_clk_ops sh7706_bus_clk_ops = {
58 .recalc = bus_clk_recalc, 58 .recalc = bus_clk_recalc,
59}; 59};
60 60
@@ -66,18 +66,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
66 return clk->parent->rate / ifc_divisors[idx]; 66 return clk->parent->rate / ifc_divisors[idx];
67} 67}
68 68
69static struct clk_ops sh7706_cpu_clk_ops = { 69static struct sh_clk_ops sh7706_cpu_clk_ops = {
70 .recalc = cpu_clk_recalc, 70 .recalc = cpu_clk_recalc,
71}; 71};
72 72
73static struct clk_ops *sh7706_clk_ops[] = { 73static struct sh_clk_ops *sh7706_clk_ops[] = {
74 &sh7706_master_clk_ops, 74 &sh7706_master_clk_ops,
75 &sh7706_module_clk_ops, 75 &sh7706_module_clk_ops,
76 &sh7706_bus_clk_ops, 76 &sh7706_bus_clk_ops,
77 &sh7706_cpu_clk_ops, 77 &sh7706_cpu_clk_ops,
78}; 78};
79 79
80void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 80void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
81{ 81{
82 if (idx < ARRAY_SIZE(sh7706_clk_ops)) 82 if (idx < ARRAY_SIZE(sh7706_clk_ops))
83 *ops = sh7706_clk_ops[idx]; 83 *ops = sh7706_clk_ops[idx];
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7709.c b/arch/sh/kernel/cpu/sh3/clock-sh7709.c
index f302ba09e68..54a6d4bcc0d 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7709.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7709.c
@@ -30,7 +30,7 @@ static void master_clk_init(struct clk *clk)
30 clk->rate *= pfc_divisors[idx]; 30 clk->rate *= pfc_divisors[idx];
31} 31}
32 32
33static struct clk_ops sh7709_master_clk_ops = { 33static struct sh_clk_ops sh7709_master_clk_ops = {
34 .init = master_clk_init, 34 .init = master_clk_init,
35}; 35};
36 36
@@ -42,7 +42,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
42 return clk->parent->rate / pfc_divisors[idx]; 42 return clk->parent->rate / pfc_divisors[idx];
43} 43}
44 44
45static struct clk_ops sh7709_module_clk_ops = { 45static struct sh_clk_ops sh7709_module_clk_ops = {
46 .recalc = module_clk_recalc, 46 .recalc = module_clk_recalc,
47}; 47};
48 48
@@ -55,7 +55,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
55 return clk->parent->rate * stc_multipliers[idx]; 55 return clk->parent->rate * stc_multipliers[idx];
56} 56}
57 57
58static struct clk_ops sh7709_bus_clk_ops = { 58static struct sh_clk_ops sh7709_bus_clk_ops = {
59 .recalc = bus_clk_recalc, 59 .recalc = bus_clk_recalc,
60}; 60};
61 61
@@ -67,18 +67,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
67 return clk->parent->rate / ifc_divisors[idx]; 67 return clk->parent->rate / ifc_divisors[idx];
68} 68}
69 69
70static struct clk_ops sh7709_cpu_clk_ops = { 70static struct sh_clk_ops sh7709_cpu_clk_ops = {
71 .recalc = cpu_clk_recalc, 71 .recalc = cpu_clk_recalc,
72}; 72};
73 73
74static struct clk_ops *sh7709_clk_ops[] = { 74static struct sh_clk_ops *sh7709_clk_ops[] = {
75 &sh7709_master_clk_ops, 75 &sh7709_master_clk_ops,
76 &sh7709_module_clk_ops, 76 &sh7709_module_clk_ops,
77 &sh7709_bus_clk_ops, 77 &sh7709_bus_clk_ops,
78 &sh7709_cpu_clk_ops, 78 &sh7709_cpu_clk_ops,
79}; 79};
80 80
81void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 81void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
82{ 82{
83 if (idx < ARRAY_SIZE(sh7709_clk_ops)) 83 if (idx < ARRAY_SIZE(sh7709_clk_ops))
84 *ops = sh7709_clk_ops[idx]; 84 *ops = sh7709_clk_ops[idx];
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7710.c b/arch/sh/kernel/cpu/sh3/clock-sh7710.c
index 29a87d8946a..ce601b2e397 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7710.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7710.c
@@ -29,7 +29,7 @@ static void master_clk_init(struct clk *clk)
29 clk->rate *= md_table[__raw_readw(FRQCR) & 0x0007]; 29 clk->rate *= md_table[__raw_readw(FRQCR) & 0x0007];
30} 30}
31 31
32static struct clk_ops sh7710_master_clk_ops = { 32static struct sh_clk_ops sh7710_master_clk_ops = {
33 .init = master_clk_init, 33 .init = master_clk_init,
34}; 34};
35 35
@@ -39,7 +39,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
39 return clk->parent->rate / md_table[idx]; 39 return clk->parent->rate / md_table[idx];
40} 40}
41 41
42static struct clk_ops sh7710_module_clk_ops = { 42static struct sh_clk_ops sh7710_module_clk_ops = {
43 .recalc = module_clk_recalc, 43 .recalc = module_clk_recalc,
44}; 44};
45 45
@@ -49,7 +49,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
49 return clk->parent->rate / md_table[idx]; 49 return clk->parent->rate / md_table[idx];
50} 50}
51 51
52static struct clk_ops sh7710_bus_clk_ops = { 52static struct sh_clk_ops sh7710_bus_clk_ops = {
53 .recalc = bus_clk_recalc, 53 .recalc = bus_clk_recalc,
54}; 54};
55 55
@@ -59,18 +59,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
59 return clk->parent->rate / md_table[idx]; 59 return clk->parent->rate / md_table[idx];
60} 60}
61 61
62static struct clk_ops sh7710_cpu_clk_ops = { 62static struct sh_clk_ops sh7710_cpu_clk_ops = {
63 .recalc = cpu_clk_recalc, 63 .recalc = cpu_clk_recalc,
64}; 64};
65 65
66static struct clk_ops *sh7710_clk_ops[] = { 66static struct sh_clk_ops *sh7710_clk_ops[] = {
67 &sh7710_master_clk_ops, 67 &sh7710_master_clk_ops,
68 &sh7710_module_clk_ops, 68 &sh7710_module_clk_ops,
69 &sh7710_bus_clk_ops, 69 &sh7710_bus_clk_ops,
70 &sh7710_cpu_clk_ops, 70 &sh7710_cpu_clk_ops,
71}; 71};
72 72
73void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 73void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
74{ 74{
75 if (idx < ARRAY_SIZE(sh7710_clk_ops)) 75 if (idx < ARRAY_SIZE(sh7710_clk_ops))
76 *ops = sh7710_clk_ops[idx]; 76 *ops = sh7710_clk_ops[idx];
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7712.c b/arch/sh/kernel/cpu/sh3/clock-sh7712.c
index b0d0c520399..21438a9a1ae 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7712.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7712.c
@@ -29,7 +29,7 @@ static void master_clk_init(struct clk *clk)
29 clk->rate *= multipliers[idx]; 29 clk->rate *= multipliers[idx];
30} 30}
31 31
32static struct clk_ops sh7712_master_clk_ops = { 32static struct sh_clk_ops sh7712_master_clk_ops = {
33 .init = master_clk_init, 33 .init = master_clk_init,
34}; 34};
35 35
@@ -41,7 +41,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
41 return clk->parent->rate / divisors[idx]; 41 return clk->parent->rate / divisors[idx];
42} 42}
43 43
44static struct clk_ops sh7712_module_clk_ops = { 44static struct sh_clk_ops sh7712_module_clk_ops = {
45 .recalc = module_clk_recalc, 45 .recalc = module_clk_recalc,
46}; 46};
47 47
@@ -53,17 +53,17 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
53 return clk->parent->rate / divisors[idx]; 53 return clk->parent->rate / divisors[idx];
54} 54}
55 55
56static struct clk_ops sh7712_cpu_clk_ops = { 56static struct sh_clk_ops sh7712_cpu_clk_ops = {
57 .recalc = cpu_clk_recalc, 57 .recalc = cpu_clk_recalc,
58}; 58};
59 59
60static struct clk_ops *sh7712_clk_ops[] = { 60static struct sh_clk_ops *sh7712_clk_ops[] = {
61 &sh7712_master_clk_ops, 61 &sh7712_master_clk_ops,
62 &sh7712_module_clk_ops, 62 &sh7712_module_clk_ops,
63 &sh7712_cpu_clk_ops, 63 &sh7712_cpu_clk_ops,
64}; 64};
65 65
66void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 66void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
67{ 67{
68 if (idx < ARRAY_SIZE(sh7712_clk_ops)) 68 if (idx < ARRAY_SIZE(sh7712_clk_ops))
69 *ops = sh7712_clk_ops[idx]; 69 *ops = sh7712_clk_ops[idx];
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
index f4e262adb39..4b5bab5f875 100644
--- a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
+++ b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
@@ -41,7 +41,7 @@ static inline int frqcr3_lookup(struct clk *clk, unsigned long rate)
41 return 5; 41 return 5;
42} 42}
43 43
44static struct clk_ops sh4202_emi_clk_ops = { 44static struct sh_clk_ops sh4202_emi_clk_ops = {
45 .recalc = emi_clk_recalc, 45 .recalc = emi_clk_recalc,
46}; 46};
47 47
@@ -56,7 +56,7 @@ static unsigned long femi_clk_recalc(struct clk *clk)
56 return clk->parent->rate / frqcr3_divisors[idx]; 56 return clk->parent->rate / frqcr3_divisors[idx];
57} 57}
58 58
59static struct clk_ops sh4202_femi_clk_ops = { 59static struct sh_clk_ops sh4202_femi_clk_ops = {
60 .recalc = femi_clk_recalc, 60 .recalc = femi_clk_recalc,
61}; 61};
62 62
@@ -130,7 +130,7 @@ static int shoc_clk_set_rate(struct clk *clk, unsigned long rate)
130 return 0; 130 return 0;
131} 131}
132 132
133static struct clk_ops sh4202_shoc_clk_ops = { 133static struct sh_clk_ops sh4202_shoc_clk_ops = {
134 .init = shoc_clk_init, 134 .init = shoc_clk_init,
135 .recalc = shoc_clk_recalc, 135 .recalc = shoc_clk_recalc,
136 .set_rate = shoc_clk_set_rate, 136 .set_rate = shoc_clk_set_rate,
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4.c b/arch/sh/kernel/cpu/sh4/clock-sh4.c
index 5add75c1f53..99e5ec8b483 100644
--- a/arch/sh/kernel/cpu/sh4/clock-sh4.c
+++ b/arch/sh/kernel/cpu/sh4/clock-sh4.c
@@ -31,7 +31,7 @@ static void master_clk_init(struct clk *clk)
31 clk->rate *= pfc_divisors[__raw_readw(FRQCR) & 0x0007]; 31 clk->rate *= pfc_divisors[__raw_readw(FRQCR) & 0x0007];
32} 32}
33 33
34static struct clk_ops sh4_master_clk_ops = { 34static struct sh_clk_ops sh4_master_clk_ops = {
35 .init = master_clk_init, 35 .init = master_clk_init,
36}; 36};
37 37
@@ -41,7 +41,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
41 return clk->parent->rate / pfc_divisors[idx]; 41 return clk->parent->rate / pfc_divisors[idx];
42} 42}
43 43
44static struct clk_ops sh4_module_clk_ops = { 44static struct sh_clk_ops sh4_module_clk_ops = {
45 .recalc = module_clk_recalc, 45 .recalc = module_clk_recalc,
46}; 46};
47 47
@@ -51,7 +51,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
51 return clk->parent->rate / bfc_divisors[idx]; 51 return clk->parent->rate / bfc_divisors[idx];
52} 52}
53 53
54static struct clk_ops sh4_bus_clk_ops = { 54static struct sh_clk_ops sh4_bus_clk_ops = {
55 .recalc = bus_clk_recalc, 55 .recalc = bus_clk_recalc,
56}; 56};
57 57
@@ -61,18 +61,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
61 return clk->parent->rate / ifc_divisors[idx]; 61 return clk->parent->rate / ifc_divisors[idx];
62} 62}
63 63
64static struct clk_ops sh4_cpu_clk_ops = { 64static struct sh_clk_ops sh4_cpu_clk_ops = {
65 .recalc = cpu_clk_recalc, 65 .recalc = cpu_clk_recalc,
66}; 66};
67 67
68static struct clk_ops *sh4_clk_ops[] = { 68static struct sh_clk_ops *sh4_clk_ops[] = {
69 &sh4_master_clk_ops, 69 &sh4_master_clk_ops,
70 &sh4_module_clk_ops, 70 &sh4_module_clk_ops,
71 &sh4_bus_clk_ops, 71 &sh4_bus_clk_ops,
72 &sh4_cpu_clk_ops, 72 &sh4_cpu_clk_ops,
73}; 73};
74 74
75void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 75void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
76{ 76{
77 if (idx < ARRAY_SIZE(sh4_clk_ops)) 77 if (idx < ARRAY_SIZE(sh4_clk_ops))
78 *ops = sh4_clk_ops[idx]; 78 *ops = sh4_clk_ops[idx];
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
index 70e45bdaadc..ea01a72f1b9 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
@@ -61,7 +61,7 @@ static unsigned long dll_recalc(struct clk *clk)
61 return clk->parent->rate * mult; 61 return clk->parent->rate * mult;
62} 62}
63 63
64static struct clk_ops dll_clk_ops = { 64static struct sh_clk_ops dll_clk_ops = {
65 .recalc = dll_recalc, 65 .recalc = dll_recalc,
66}; 66};
67 67
@@ -81,7 +81,7 @@ static unsigned long pll_recalc(struct clk *clk)
81 return clk->parent->rate * mult; 81 return clk->parent->rate * mult;
82} 82}
83 83
84static struct clk_ops pll_clk_ops = { 84static struct sh_clk_ops pll_clk_ops = {
85 .recalc = pll_recalc, 85 .recalc = pll_recalc,
86}; 86};
87 87
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
index 3c3165000c5..7ac07b4f75d 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
@@ -61,7 +61,7 @@ static unsigned long dll_recalc(struct clk *clk)
61 return clk->parent->rate * mult; 61 return clk->parent->rate * mult;
62} 62}
63 63
64static struct clk_ops dll_clk_ops = { 64static struct sh_clk_ops dll_clk_ops = {
65 .recalc = dll_recalc, 65 .recalc = dll_recalc,
66}; 66};
67 67
@@ -84,7 +84,7 @@ static unsigned long pll_recalc(struct clk *clk)
84 return (clk->parent->rate * mult) / div; 84 return (clk->parent->rate * mult) / div;
85} 85}
86 86
87static struct clk_ops pll_clk_ops = { 87static struct sh_clk_ops pll_clk_ops = {
88 .recalc = pll_recalc, 88 .recalc = pll_recalc,
89}; 89};
90 90
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index 212c72ef959..8e1f97010c0 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -64,7 +64,7 @@ static unsigned long dll_recalc(struct clk *clk)
64 return clk->parent->rate * mult; 64 return clk->parent->rate * mult;
65} 65}
66 66
67static struct clk_ops dll_clk_ops = { 67static struct sh_clk_ops dll_clk_ops = {
68 .recalc = dll_recalc, 68 .recalc = dll_recalc,
69}; 69};
70 70
@@ -87,7 +87,7 @@ static unsigned long pll_recalc(struct clk *clk)
87 return (clk->parent->rate * mult) / div; 87 return (clk->parent->rate * mult) / div;
88} 88}
89 89
90static struct clk_ops pll_clk_ops = { 90static struct sh_clk_ops pll_clk_ops = {
91 .recalc = pll_recalc, 91 .recalc = pll_recalc,
92}; 92};
93 93
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
index 2f8c9179da4..35f75cf0c7e 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
@@ -65,7 +65,7 @@ static unsigned long dll_recalc(struct clk *clk)
65 return clk->parent->rate * mult; 65 return clk->parent->rate * mult;
66} 66}
67 67
68static struct clk_ops dll_clk_ops = { 68static struct sh_clk_ops dll_clk_ops = {
69 .recalc = dll_recalc, 69 .recalc = dll_recalc,
70}; 70};
71 71
@@ -88,7 +88,7 @@ static unsigned long pll_recalc(struct clk *clk)
88 return (clk->parent->rate * mult) / div; 88 return (clk->parent->rate * mult) / div;
89} 89}
90 90
91static struct clk_ops pll_clk_ops = { 91static struct sh_clk_ops pll_clk_ops = {
92 .recalc = pll_recalc, 92 .recalc = pll_recalc,
93}; 93};
94 94
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index 70bd96646f4..2a87901673f 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -70,7 +70,7 @@ static unsigned long fll_recalc(struct clk *clk)
70 return (clk->parent->rate * mult) / div; 70 return (clk->parent->rate * mult) / div;
71} 71}
72 72
73static struct clk_ops fll_clk_ops = { 73static struct sh_clk_ops fll_clk_ops = {
74 .recalc = fll_recalc, 74 .recalc = fll_recalc,
75}; 75};
76 76
@@ -90,7 +90,7 @@ static unsigned long pll_recalc(struct clk *clk)
90 return clk->parent->rate * mult; 90 return clk->parent->rate * mult;
91} 91}
92 92
93static struct clk_ops pll_clk_ops = { 93static struct sh_clk_ops pll_clk_ops = {
94 .recalc = pll_recalc, 94 .recalc = pll_recalc,
95}; 95};
96 96
@@ -105,7 +105,7 @@ static unsigned long div3_recalc(struct clk *clk)
105 return clk->parent->rate / 3; 105 return clk->parent->rate / 3;
106} 106}
107 107
108static struct clk_ops div3_clk_ops = { 108static struct sh_clk_ops div3_clk_ops = {
109 .recalc = div3_recalc, 109 .recalc = div3_recalc,
110}; 110};
111 111
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
index 0bd21c82151..5853989586e 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
@@ -33,7 +33,7 @@ static unsigned long pll_recalc(struct clk *clk)
33 return clk->parent->rate * multiplier; 33 return clk->parent->rate * multiplier;
34} 34}
35 35
36static struct clk_ops pll_clk_ops = { 36static struct sh_clk_ops pll_clk_ops = {
37 .recalc = pll_recalc, 37 .recalc = pll_recalc,
38}; 38};
39 39
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
index 2d4c7fd79c0..7707e35aea4 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
@@ -27,7 +27,7 @@ static void master_clk_init(struct clk *clk)
27 clk->rate *= p0fc_divisors[(__raw_readl(FRQCR) >> 4) & 0x07]; 27 clk->rate *= p0fc_divisors[(__raw_readl(FRQCR) >> 4) & 0x07];
28} 28}
29 29
30static struct clk_ops sh7763_master_clk_ops = { 30static struct sh_clk_ops sh7763_master_clk_ops = {
31 .init = master_clk_init, 31 .init = master_clk_init,
32}; 32};
33 33
@@ -37,7 +37,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
37 return clk->parent->rate / p0fc_divisors[idx]; 37 return clk->parent->rate / p0fc_divisors[idx];
38} 38}
39 39
40static struct clk_ops sh7763_module_clk_ops = { 40static struct sh_clk_ops sh7763_module_clk_ops = {
41 .recalc = module_clk_recalc, 41 .recalc = module_clk_recalc,
42}; 42};
43 43
@@ -47,22 +47,22 @@ static unsigned long bus_clk_recalc(struct clk *clk)
47 return clk->parent->rate / bfc_divisors[idx]; 47 return clk->parent->rate / bfc_divisors[idx];
48} 48}
49 49
50static struct clk_ops sh7763_bus_clk_ops = { 50static struct sh_clk_ops sh7763_bus_clk_ops = {
51 .recalc = bus_clk_recalc, 51 .recalc = bus_clk_recalc,
52}; 52};
53 53
54static struct clk_ops sh7763_cpu_clk_ops = { 54static struct sh_clk_ops sh7763_cpu_clk_ops = {
55 .recalc = followparent_recalc, 55 .recalc = followparent_recalc,
56}; 56};
57 57
58static struct clk_ops *sh7763_clk_ops[] = { 58static struct sh_clk_ops *sh7763_clk_ops[] = {
59 &sh7763_master_clk_ops, 59 &sh7763_master_clk_ops,
60 &sh7763_module_clk_ops, 60 &sh7763_module_clk_ops,
61 &sh7763_bus_clk_ops, 61 &sh7763_bus_clk_ops,
62 &sh7763_cpu_clk_ops, 62 &sh7763_cpu_clk_ops,
63}; 63};
64 64
65void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 65void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
66{ 66{
67 if (idx < ARRAY_SIZE(sh7763_clk_ops)) 67 if (idx < ARRAY_SIZE(sh7763_clk_ops))
68 *ops = sh7763_clk_ops[idx]; 68 *ops = sh7763_clk_ops[idx];
@@ -74,7 +74,7 @@ static unsigned long shyway_clk_recalc(struct clk *clk)
74 return clk->parent->rate / cfc_divisors[idx]; 74 return clk->parent->rate / cfc_divisors[idx];
75} 75}
76 76
77static struct clk_ops sh7763_shyway_clk_ops = { 77static struct sh_clk_ops sh7763_shyway_clk_ops = {
78 .recalc = shyway_clk_recalc, 78 .recalc = shyway_clk_recalc,
79}; 79};
80 80
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7770.c b/arch/sh/kernel/cpu/sh4a/clock-sh7770.c
index 9e3354365d4..5d36f334bb0 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7770.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7770.c
@@ -24,7 +24,7 @@ static void master_clk_init(struct clk *clk)
24 clk->rate *= pfc_divisors[(__raw_readl(FRQCR) >> 28) & 0x000f]; 24 clk->rate *= pfc_divisors[(__raw_readl(FRQCR) >> 28) & 0x000f];
25} 25}
26 26
27static struct clk_ops sh7770_master_clk_ops = { 27static struct sh_clk_ops sh7770_master_clk_ops = {
28 .init = master_clk_init, 28 .init = master_clk_init,
29}; 29};
30 30
@@ -34,7 +34,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
34 return clk->parent->rate / pfc_divisors[idx]; 34 return clk->parent->rate / pfc_divisors[idx];
35} 35}
36 36
37static struct clk_ops sh7770_module_clk_ops = { 37static struct sh_clk_ops sh7770_module_clk_ops = {
38 .recalc = module_clk_recalc, 38 .recalc = module_clk_recalc,
39}; 39};
40 40
@@ -44,7 +44,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
44 return clk->parent->rate / bfc_divisors[idx]; 44 return clk->parent->rate / bfc_divisors[idx];
45} 45}
46 46
47static struct clk_ops sh7770_bus_clk_ops = { 47static struct sh_clk_ops sh7770_bus_clk_ops = {
48 .recalc = bus_clk_recalc, 48 .recalc = bus_clk_recalc,
49}; 49};
50 50
@@ -54,18 +54,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
54 return clk->parent->rate / ifc_divisors[idx]; 54 return clk->parent->rate / ifc_divisors[idx];
55} 55}
56 56
57static struct clk_ops sh7770_cpu_clk_ops = { 57static struct sh_clk_ops sh7770_cpu_clk_ops = {
58 .recalc = cpu_clk_recalc, 58 .recalc = cpu_clk_recalc,
59}; 59};
60 60
61static struct clk_ops *sh7770_clk_ops[] = { 61static struct sh_clk_ops *sh7770_clk_ops[] = {
62 &sh7770_master_clk_ops, 62 &sh7770_master_clk_ops,
63 &sh7770_module_clk_ops, 63 &sh7770_module_clk_ops,
64 &sh7770_bus_clk_ops, 64 &sh7770_bus_clk_ops,
65 &sh7770_cpu_clk_ops, 65 &sh7770_cpu_clk_ops,
66}; 66};
67 67
68void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 68void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
69{ 69{
70 if (idx < ARRAY_SIZE(sh7770_clk_ops)) 70 if (idx < ARRAY_SIZE(sh7770_clk_ops))
71 *ops = sh7770_clk_ops[idx]; 71 *ops = sh7770_clk_ops[idx];
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7780.c b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
index 3b53348fe2f..793dae42a2f 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
@@ -27,7 +27,7 @@ static void master_clk_init(struct clk *clk)
27 clk->rate *= pfc_divisors[__raw_readl(FRQCR) & 0x0003]; 27 clk->rate *= pfc_divisors[__raw_readl(FRQCR) & 0x0003];
28} 28}
29 29
30static struct clk_ops sh7780_master_clk_ops = { 30static struct sh_clk_ops sh7780_master_clk_ops = {
31 .init = master_clk_init, 31 .init = master_clk_init,
32}; 32};
33 33
@@ -37,7 +37,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
37 return clk->parent->rate / pfc_divisors[idx]; 37 return clk->parent->rate / pfc_divisors[idx];
38} 38}
39 39
40static struct clk_ops sh7780_module_clk_ops = { 40static struct sh_clk_ops sh7780_module_clk_ops = {
41 .recalc = module_clk_recalc, 41 .recalc = module_clk_recalc,
42}; 42};
43 43
@@ -47,7 +47,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
47 return clk->parent->rate / bfc_divisors[idx]; 47 return clk->parent->rate / bfc_divisors[idx];
48} 48}
49 49
50static struct clk_ops sh7780_bus_clk_ops = { 50static struct sh_clk_ops sh7780_bus_clk_ops = {
51 .recalc = bus_clk_recalc, 51 .recalc = bus_clk_recalc,
52}; 52};
53 53
@@ -57,18 +57,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
57 return clk->parent->rate / ifc_divisors[idx]; 57 return clk->parent->rate / ifc_divisors[idx];
58} 58}
59 59
60static struct clk_ops sh7780_cpu_clk_ops = { 60static struct sh_clk_ops sh7780_cpu_clk_ops = {
61 .recalc = cpu_clk_recalc, 61 .recalc = cpu_clk_recalc,
62}; 62};
63 63
64static struct clk_ops *sh7780_clk_ops[] = { 64static struct sh_clk_ops *sh7780_clk_ops[] = {
65 &sh7780_master_clk_ops, 65 &sh7780_master_clk_ops,
66 &sh7780_module_clk_ops, 66 &sh7780_module_clk_ops,
67 &sh7780_bus_clk_ops, 67 &sh7780_bus_clk_ops,
68 &sh7780_cpu_clk_ops, 68 &sh7780_cpu_clk_ops,
69}; 69};
70 70
71void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 71void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
72{ 72{
73 if (idx < ARRAY_SIZE(sh7780_clk_ops)) 73 if (idx < ARRAY_SIZE(sh7780_clk_ops))
74 *ops = sh7780_clk_ops[idx]; 74 *ops = sh7780_clk_ops[idx];
@@ -80,7 +80,7 @@ static unsigned long shyway_clk_recalc(struct clk *clk)
80 return clk->parent->rate / cfc_divisors[idx]; 80 return clk->parent->rate / cfc_divisors[idx];
81} 81}
82 82
83static struct clk_ops sh7780_shyway_clk_ops = { 83static struct sh_clk_ops sh7780_shyway_clk_ops = {
84 .recalc = shyway_clk_recalc, 84 .recalc = shyway_clk_recalc,
85}; 85};
86 86
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
index 2b314439d35..ab1c58f2d10 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
@@ -36,7 +36,7 @@ static unsigned long pll_recalc(struct clk *clk)
36 return clk->parent->rate * multiplier; 36 return clk->parent->rate * multiplier;
37} 37}
38 38
39static struct clk_ops pll_clk_ops = { 39static struct sh_clk_ops pll_clk_ops = {
40 .recalc = pll_recalc, 40 .recalc = pll_recalc,
41}; 41};
42 42
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
index f6c0c3d5599..491709483e1 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
@@ -38,7 +38,7 @@ static unsigned long pll_recalc(struct clk *clk)
38 return clk->parent->rate * multiplier; 38 return clk->parent->rate * multiplier;
39} 39}
40 40
41static struct clk_ops pll_clk_ops = { 41static struct sh_clk_ops pll_clk_ops = {
42 .recalc = pll_recalc, 42 .recalc = pll_recalc,
43}; 43};
44 44
diff --git a/arch/sh/kernel/cpu/sh4a/clock-shx3.c b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
index bf2d00b8b90..0f11b392bf4 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
@@ -32,7 +32,7 @@ static unsigned long pll_recalc(struct clk *clk)
32 return clk->parent->rate * 72; 32 return clk->parent->rate * 72;
33} 33}
34 34
35static struct clk_ops pll_clk_ops = { 35static struct sh_clk_ops pll_clk_ops = {
36 .recalc = pll_recalc, 36 .recalc = pll_recalc,
37}; 37};
38 38
diff --git a/arch/sh/kernel/cpu/sh5/clock-sh5.c b/arch/sh/kernel/cpu/sh5/clock-sh5.c
index 9cfc19b8dbe..c48b93d4c08 100644
--- a/arch/sh/kernel/cpu/sh5/clock-sh5.c
+++ b/arch/sh/kernel/cpu/sh5/clock-sh5.c
@@ -28,7 +28,7 @@ static void master_clk_init(struct clk *clk)
28 clk->rate *= ifc_table[idx]; 28 clk->rate *= ifc_table[idx];
29} 29}
30 30
31static struct clk_ops sh5_master_clk_ops = { 31static struct sh_clk_ops sh5_master_clk_ops = {
32 .init = master_clk_init, 32 .init = master_clk_init,
33}; 33};
34 34
@@ -38,7 +38,7 @@ static unsigned long module_clk_recalc(struct clk *clk)
38 return clk->parent->rate / ifc_table[idx]; 38 return clk->parent->rate / ifc_table[idx];
39} 39}
40 40
41static struct clk_ops sh5_module_clk_ops = { 41static struct sh_clk_ops sh5_module_clk_ops = {
42 .recalc = module_clk_recalc, 42 .recalc = module_clk_recalc,
43}; 43};
44 44
@@ -48,7 +48,7 @@ static unsigned long bus_clk_recalc(struct clk *clk)
48 return clk->parent->rate / ifc_table[idx]; 48 return clk->parent->rate / ifc_table[idx];
49} 49}
50 50
51static struct clk_ops sh5_bus_clk_ops = { 51static struct sh_clk_ops sh5_bus_clk_ops = {
52 .recalc = bus_clk_recalc, 52 .recalc = bus_clk_recalc,
53}; 53};
54 54
@@ -58,18 +58,18 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
58 return clk->parent->rate / ifc_table[idx]; 58 return clk->parent->rate / ifc_table[idx];
59} 59}
60 60
61static struct clk_ops sh5_cpu_clk_ops = { 61static struct sh_clk_ops sh5_cpu_clk_ops = {
62 .recalc = cpu_clk_recalc, 62 .recalc = cpu_clk_recalc,
63}; 63};
64 64
65static struct clk_ops *sh5_clk_ops[] = { 65static struct sh_clk_ops *sh5_clk_ops[] = {
66 &sh5_master_clk_ops, 66 &sh5_master_clk_ops,
67 &sh5_module_clk_ops, 67 &sh5_module_clk_ops,
68 &sh5_bus_clk_ops, 68 &sh5_bus_clk_ops,
69 &sh5_cpu_clk_ops, 69 &sh5_cpu_clk_ops,
70}; 70};
71 71
72void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 72void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
73{ 73{
74 cprc_base = (unsigned long)ioremap_nocache(CPRC_BASE, 1024); 74 cprc_base = (unsigned long)ioremap_nocache(CPRC_BASE, 1024);
75 BUG_ON(!cprc_base); 75 BUG_ON(!cprc_base);
diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c
index 1d6d51a1ce7..5ca579720a0 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -73,8 +73,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
73 73
74 ret = install_special_mapping(mm, addr, PAGE_SIZE, 74 ret = install_special_mapping(mm, addr, PAGE_SIZE,
75 VM_READ | VM_EXEC | 75 VM_READ | VM_EXEC |
76 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC | 76 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
77 VM_ALWAYSDUMP,
78 syscall_pages); 77 syscall_pages);
79 if (unlikely(ret)) 78 if (unlikely(ret))
80 goto up_fail; 79 goto up_fail;
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index ca5580e4d81..1666de84d47 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -29,6 +29,7 @@ config SPARC
29 select GENERIC_IRQ_SHOW 29 select GENERIC_IRQ_SHOW
30 select USE_GENERIC_SMP_HELPERS if SMP 30 select USE_GENERIC_SMP_HELPERS if SMP
31 select GENERIC_PCI_IOMAP 31 select GENERIC_PCI_IOMAP
32 select HAVE_NMI_WATCHDOG if SPARC64
32 33
33config SPARC32 34config SPARC32
34 def_bool !64BIT 35 def_bool !64BIT
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h
index 16dcae6d56e..abf6afe82ca 100644
--- a/arch/sparc/include/asm/irq_64.h
+++ b/arch/sparc/include/asm/irq_64.h
@@ -95,7 +95,6 @@ void arch_trigger_all_cpu_backtrace(void);
95extern void *hardirq_stack[NR_CPUS]; 95extern void *hardirq_stack[NR_CPUS];
96extern void *softirq_stack[NR_CPUS]; 96extern void *softirq_stack[NR_CPUS];
97#define __ARCH_HAS_DO_SOFTIRQ 97#define __ARCH_HAS_DO_SOFTIRQ
98#define ARCH_HAS_NMI_WATCHDOG
99 98
100#define NO_IRQ 0xffffffff 99#define NO_IRQ 0xffffffff
101 100
diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h
index 6de7f7bf956..dc503297481 100644
--- a/arch/sparc/include/asm/pci_32.h
+++ b/arch/sparc/include/asm/pci_32.h
@@ -52,14 +52,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
52 * 64Kbytes by the Host controller. 52 * 64Kbytes by the Host controller.
53 */ 53 */
54 54
55extern void
56pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
57 struct resource *res);
58
59extern void
60pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
61 struct pci_bus_region *region);
62
63static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 55static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
64{ 56{
65 return PCI_IRQ_NONE; 57 return PCI_IRQ_NONE;
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h
index 755a4bb6bcd..1633b718d3b 100644
--- a/arch/sparc/include/asm/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
@@ -73,14 +73,6 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
73 enum pci_mmap_state mmap_state, 73 enum pci_mmap_state mmap_state,
74 int write_combine); 74 int write_combine);
75 75
76extern void
77pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
78 struct resource *res);
79
80extern void
81pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
82 struct pci_bus_region *region);
83
84static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 76static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
85{ 77{
86 return PCI_IRQ_NONE; 78 return PCI_IRQ_NONE;
diff --git a/arch/sparc/include/asm/vga.h b/arch/sparc/include/asm/vga.h
index c69d5b2ba19..ec0e9967d93 100644
--- a/arch/sparc/include/asm/vga.h
+++ b/arch/sparc/include/asm/vga.h
@@ -7,6 +7,7 @@
7#ifndef _LINUX_ASM_VGA_H_ 7#ifndef _LINUX_ASM_VGA_H_
8#define _LINUX_ASM_VGA_H_ 8#define _LINUX_ASM_VGA_H_
9 9
10#include <linux/bug.h>
10#include <asm/types.h> 11#include <asm/types.h>
11 12
12#define VT_BUF_HAVE_RW 13#define VT_BUF_HAVE_RW
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index c7bec25fdb1..aba6b958b2a 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -15,14 +15,19 @@
15 15
16/* The LEON architecture does not rely on a BIOS or bootloader to setup 16/* The LEON architecture does not rely on a BIOS or bootloader to setup
17 * PCI for us. The Linux generic routines are used to setup resources, 17 * PCI for us. The Linux generic routines are used to setup resources,
18 * reset values of confuration-space registers settings ae preseved. 18 * reset values of configuration-space register settings are preserved.
19 *
20 * PCI Memory and Prefetchable Memory is direct-mapped. However I/O Space is
21 * accessed through a Window which is translated to low 64KB in PCI space, the
22 * first 4KB is not used so 60KB is available.
19 */ 23 */
20void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info) 24void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
21{ 25{
22 LIST_HEAD(resources); 26 LIST_HEAD(resources);
23 struct pci_bus *root_bus; 27 struct pci_bus *root_bus;
24 28
25 pci_add_resource(&resources, &info->io_space); 29 pci_add_resource_offset(&resources, &info->io_space,
30 info->io_space.start - 0x1000);
26 pci_add_resource(&resources, &info->mem_space); 31 pci_add_resource(&resources, &info->mem_space);
27 32
28 root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info, 33 root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info,
@@ -38,44 +43,6 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
38 } 43 }
39} 44}
40 45
41/* PCI Memory and Prefetchable Memory is direct-mapped. However I/O Space is
42 * accessed through a Window which is translated to low 64KB in PCI space, the
43 * first 4KB is not used so 60KB is available.
44 *
45 * This function is used by generic code to translate resource addresses into
46 * PCI addresses.
47 */
48void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
49 struct resource *res)
50{
51 struct leon_pci_info *info = dev->bus->sysdata;
52
53 region->start = res->start;
54 region->end = res->end;
55
56 if (res->flags & IORESOURCE_IO) {
57 region->start -= (info->io_space.start - 0x1000);
58 region->end -= (info->io_space.start - 0x1000);
59 }
60}
61EXPORT_SYMBOL(pcibios_resource_to_bus);
62
63/* see pcibios_resource_to_bus() comment */
64void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
65 struct pci_bus_region *region)
66{
67 struct leon_pci_info *info = dev->bus->sysdata;
68
69 res->start = region->start;
70 res->end = region->end;
71
72 if (res->flags & IORESOURCE_IO) {
73 res->start += (info->io_space.start - 0x1000);
74 res->end += (info->io_space.start - 0x1000);
75 }
76}
77EXPORT_SYMBOL(pcibios_bus_to_resource);
78
79void __devinit pcibios_fixup_bus(struct pci_bus *pbus) 46void __devinit pcibios_fixup_bus(struct pci_bus *pbus)
80{ 47{
81 struct leon_pci_info *info = pbus->sysdata; 48 struct leon_pci_info *info = pbus->sysdata;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index bb8bc2e519a..fdaf2181167 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -375,13 +375,6 @@ static void __devinit apb_calc_first_last(u8 map, u32 *first_p, u32 *last_p)
375 *last_p = last; 375 *last_p = last;
376} 376}
377 377
378static void pci_resource_adjust(struct resource *res,
379 struct resource *root)
380{
381 res->start += root->start;
382 res->end += root->start;
383}
384
385/* For PCI bus devices which lack a 'ranges' property we interrogate 378/* For PCI bus devices which lack a 'ranges' property we interrogate
386 * the config space values to set the resources, just like the generic 379 * the config space values to set the resources, just like the generic
387 * Linux PCI probing code does. 380 * Linux PCI probing code does.
@@ -390,7 +383,8 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
390 struct pci_bus *bus, 383 struct pci_bus *bus,
391 struct pci_pbm_info *pbm) 384 struct pci_pbm_info *pbm)
392{ 385{
393 struct resource *res; 386 struct pci_bus_region region;
387 struct resource *res, res2;
394 u8 io_base_lo, io_limit_lo; 388 u8 io_base_lo, io_limit_lo;
395 u16 mem_base_lo, mem_limit_lo; 389 u16 mem_base_lo, mem_limit_lo;
396 unsigned long base, limit; 390 unsigned long base, limit;
@@ -412,11 +406,14 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
412 res = bus->resource[0]; 406 res = bus->resource[0];
413 if (base <= limit) { 407 if (base <= limit) {
414 res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; 408 res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO;
409 res2.flags = res->flags;
410 region.start = base;
411 region.end = limit + 0xfff;
412 pcibios_bus_to_resource(dev, &res2, &region);
415 if (!res->start) 413 if (!res->start)
416 res->start = base; 414 res->start = res2.start;
417 if (!res->end) 415 if (!res->end)
418 res->end = limit + 0xfff; 416 res->end = res2.end;
419 pci_resource_adjust(res, &pbm->io_space);
420 } 417 }
421 418
422 pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo); 419 pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo);
@@ -428,9 +425,9 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
428 if (base <= limit) { 425 if (base <= limit) {
429 res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | 426 res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) |
430 IORESOURCE_MEM); 427 IORESOURCE_MEM);
431 res->start = base; 428 region.start = base;
432 res->end = limit + 0xfffff; 429 region.end = limit + 0xfffff;
433 pci_resource_adjust(res, &pbm->mem_space); 430 pcibios_bus_to_resource(dev, res, &region);
434 } 431 }
435 432
436 pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); 433 pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo);
@@ -459,9 +456,9 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
459 if (base <= limit) { 456 if (base <= limit) {
460 res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | 457 res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) |
461 IORESOURCE_MEM | IORESOURCE_PREFETCH); 458 IORESOURCE_MEM | IORESOURCE_PREFETCH);
462 res->start = base; 459 region.start = base;
463 res->end = limit + 0xfffff; 460 region.end = limit + 0xfffff;
464 pci_resource_adjust(res, &pbm->mem_space); 461 pcibios_bus_to_resource(dev, res, &region);
465 } 462 }
466} 463}
467 464
@@ -472,6 +469,7 @@ static void __devinit apb_fake_ranges(struct pci_dev *dev,
472 struct pci_bus *bus, 469 struct pci_bus *bus,
473 struct pci_pbm_info *pbm) 470 struct pci_pbm_info *pbm)
474{ 471{
472 struct pci_bus_region region;
475 struct resource *res; 473 struct resource *res;
476 u32 first, last; 474 u32 first, last;
477 u8 map; 475 u8 map;
@@ -479,18 +477,18 @@ static void __devinit apb_fake_ranges(struct pci_dev *dev,
479 pci_read_config_byte(dev, APB_IO_ADDRESS_MAP, &map); 477 pci_read_config_byte(dev, APB_IO_ADDRESS_MAP, &map);
480 apb_calc_first_last(map, &first, &last); 478 apb_calc_first_last(map, &first, &last);
481 res = bus->resource[0]; 479 res = bus->resource[0];
482 res->start = (first << 21);
483 res->end = (last << 21) + ((1 << 21) - 1);
484 res->flags = IORESOURCE_IO; 480 res->flags = IORESOURCE_IO;
485 pci_resource_adjust(res, &pbm->io_space); 481 region.start = (first << 21);
482 region.end = (last << 21) + ((1 << 21) - 1);
483 pcibios_bus_to_resource(dev, res, &region);
486 484
487 pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map); 485 pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map);
488 apb_calc_first_last(map, &first, &last); 486 apb_calc_first_last(map, &first, &last);
489 res = bus->resource[1]; 487 res = bus->resource[1];
490 res->start = (first << 21);
491 res->end = (last << 21) + ((1 << 21) - 1);
492 res->flags = IORESOURCE_MEM; 488 res->flags = IORESOURCE_MEM;
493 pci_resource_adjust(res, &pbm->mem_space); 489 region.start = (first << 21);
490 region.end = (last << 21) + ((1 << 21) - 1);
491 pcibios_bus_to_resource(dev, res, &region);
494} 492}
495 493
496static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, 494static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm,
@@ -506,6 +504,7 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
506 struct pci_bus *bus; 504 struct pci_bus *bus;
507 const u32 *busrange, *ranges; 505 const u32 *busrange, *ranges;
508 int len, i, simba; 506 int len, i, simba;
507 struct pci_bus_region region;
509 struct resource *res; 508 struct resource *res;
510 unsigned int flags; 509 unsigned int flags;
511 u64 size; 510 u64 size;
@@ -556,8 +555,6 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
556 } 555 }
557 i = 1; 556 i = 1;
558 for (; len >= 32; len -= 32, ranges += 8) { 557 for (; len >= 32; len -= 32, ranges += 8) {
559 struct resource *root;
560
561 flags = pci_parse_of_flags(ranges[0]); 558 flags = pci_parse_of_flags(ranges[0]);
562 size = GET_64BIT(ranges, 6); 559 size = GET_64BIT(ranges, 6);
563 if (flags == 0 || size == 0) 560 if (flags == 0 || size == 0)
@@ -569,7 +566,6 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
569 " for bridge %s\n", node->full_name); 566 " for bridge %s\n", node->full_name);
570 continue; 567 continue;
571 } 568 }
572 root = &pbm->io_space;
573 } else { 569 } else {
574 if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) { 570 if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) {
575 printk(KERN_ERR "PCI: too many memory ranges" 571 printk(KERN_ERR "PCI: too many memory ranges"
@@ -578,18 +574,12 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
578 } 574 }
579 res = bus->resource[i]; 575 res = bus->resource[i];
580 ++i; 576 ++i;
581 root = &pbm->mem_space;
582 } 577 }
583 578
584 res->start = GET_64BIT(ranges, 1);
585 res->end = res->start + size - 1;
586 res->flags = flags; 579 res->flags = flags;
587 580 region.start = GET_64BIT(ranges, 1);
588 /* Another way to implement this would be to add an of_device 581 region.end = region.start + size - 1;
589 * layer routine that can calculate a resource for a given 582 pcibios_bus_to_resource(dev, res, &region);
590 * range property value in a PCI device.
591 */
592 pci_resource_adjust(res, root);
593 } 583 }
594after_ranges: 584after_ranges:
595 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 585 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
@@ -691,8 +681,10 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
691 681
692 printk("PCI: Scanning PBM %s\n", node->full_name); 682 printk("PCI: Scanning PBM %s\n", node->full_name);
693 683
694 pci_add_resource(&resources, &pbm->io_space); 684 pci_add_resource_offset(&resources, &pbm->io_space,
695 pci_add_resource(&resources, &pbm->mem_space); 685 pbm->io_space.start);
686 pci_add_resource_offset(&resources, &pbm->mem_space,
687 pbm->mem_space.start);
696 bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops, 688 bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
697 pbm, &resources); 689 pbm, &resources);
698 if (!bus) { 690 if (!bus) {
@@ -755,46 +747,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
755 return 0; 747 return 0;
756} 748}
757 749
758void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region,
759 struct resource *res)
760{
761 struct pci_pbm_info *pbm = pdev->bus->sysdata;
762 struct resource zero_res, *root;
763
764 zero_res.start = 0;
765 zero_res.end = 0;
766 zero_res.flags = res->flags;
767
768 if (res->flags & IORESOURCE_IO)
769 root = &pbm->io_space;
770 else
771 root = &pbm->mem_space;
772
773 pci_resource_adjust(&zero_res, root);
774
775 region->start = res->start - zero_res.start;
776 region->end = res->end - zero_res.start;
777}
778EXPORT_SYMBOL(pcibios_resource_to_bus);
779
780void pcibios_bus_to_resource(struct pci_dev *pdev, struct resource *res,
781 struct pci_bus_region *region)
782{
783 struct pci_pbm_info *pbm = pdev->bus->sysdata;
784 struct resource *root;
785
786 res->start = region->start;
787 res->end = region->end;
788
789 if (res->flags & IORESOURCE_IO)
790 root = &pbm->io_space;
791 else
792 root = &pbm->mem_space;
793
794 pci_resource_adjust(res, root);
795}
796EXPORT_SYMBOL(pcibios_bus_to_resource);
797
798char * __devinit pcibios_setup(char *str) 750char * __devinit pcibios_setup(char *str)
799{ 751{
800 return str; 752 return str;
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index 023b8860dc9..c8f5b50db89 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -776,7 +776,6 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka,
776 siginfo_t *info, 776 siginfo_t *info,
777 sigset_t *oldset, struct pt_regs *regs) 777 sigset_t *oldset, struct pt_regs *regs)
778{ 778{
779 sigset_t blocked;
780 int err; 779 int err;
781 780
782 if (ka->sa.sa_flags & SA_SIGINFO) 781 if (ka->sa.sa_flags & SA_SIGINFO)
@@ -787,11 +786,7 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka,
787 if (err) 786 if (err)
788 return err; 787 return err;
789 788
790 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask); 789 block_sigmask(ka, signr);
791 if (!(ka->sa.sa_flags & SA_NOMASK))
792 sigaddset(&blocked, signr);
793 set_current_blocked(&blocked);
794
795 tracehook_signal_handler(signr, info, ka, regs, 0); 790 tracehook_signal_handler(signr, info, ka, regs, 0);
796 791
797 return 0; 792 return 0;
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index d54c6e53aba..7bb71b6fbd2 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -465,7 +465,6 @@ static inline int
465handle_signal(unsigned long signr, struct k_sigaction *ka, 465handle_signal(unsigned long signr, struct k_sigaction *ka,
466 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) 466 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
467{ 467{
468 sigset_t blocked;
469 int err; 468 int err;
470 469
471 if (ka->sa.sa_flags & SA_SIGINFO) 470 if (ka->sa.sa_flags & SA_SIGINFO)
@@ -476,11 +475,7 @@ handle_signal(unsigned long signr, struct k_sigaction *ka,
476 if (err) 475 if (err)
477 return err; 476 return err;
478 477
479 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask); 478 block_sigmask(ka, signr);
480 if (!(ka->sa.sa_flags & SA_NOMASK))
481 sigaddset(&blocked, signr);
482 set_current_blocked(&blocked);
483
484 tracehook_signal_handler(signr, info, ka, regs, 0); 479 tracehook_signal_handler(signr, info, ka, regs, 0);
485 480
486 return 0; 481 return 0;
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index f0836cd0e2f..d8a67e60be8 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -479,18 +479,14 @@ static inline int handle_signal(unsigned long signr, struct k_sigaction *ka,
479 siginfo_t *info, 479 siginfo_t *info,
480 sigset_t *oldset, struct pt_regs *regs) 480 sigset_t *oldset, struct pt_regs *regs)
481{ 481{
482 sigset_t blocked;
483 int err; 482 int err;
484 483
485 err = setup_rt_frame(ka, regs, signr, oldset, 484 err = setup_rt_frame(ka, regs, signr, oldset,
486 (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); 485 (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL);
487 if (err) 486 if (err)
488 return err; 487 return err;
489 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
490 if (!(ka->sa.sa_flags & SA_NOMASK))
491 sigaddset(&blocked, signr);
492 set_current_blocked(&blocked);
493 488
489 block_sigmask(ka, signr);
494 tracehook_signal_handler(signr, info, ka, regs, 0); 490 tracehook_signal_handler(signr, info, ka, regs, 0);
495 491
496 return 0; 492 return 0;
diff --git a/arch/tile/mm/elf.c b/arch/tile/mm/elf.c
index 55e58e93bfc..1a00fb64fc8 100644
--- a/arch/tile/mm/elf.c
+++ b/arch/tile/mm/elf.c
@@ -117,17 +117,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
117 117
118 /* 118 /*
119 * MAYWRITE to allow gdb to COW and set breakpoints 119 * MAYWRITE to allow gdb to COW and set breakpoints
120 *
121 * Make sure the vDSO gets into every core dump. Dumping its
122 * contents makes post-mortem fully interpretable later
123 * without matching up the same kernel and hardware config to
124 * see what PC values meant.
125 */ 120 */
126 vdso_base = VDSO_BASE; 121 vdso_base = VDSO_BASE;
127 retval = install_special_mapping(mm, vdso_base, PAGE_SIZE, 122 retval = install_special_mapping(mm, vdso_base, PAGE_SIZE,
128 VM_READ|VM_EXEC| 123 VM_READ|VM_EXEC|
129 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| 124 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
130 VM_ALWAYSDUMP,
131 vdso_pages); 125 vdso_pages);
132 126
133#ifndef __tilegx__ 127#ifndef __tilegx__
diff --git a/arch/um/include/asm/mmu.h b/arch/um/include/asm/mmu.h
index 30509b9f37f..53e8b498ebb 100644
--- a/arch/um/include/asm/mmu.h
+++ b/arch/um/include/asm/mmu.h
@@ -12,7 +12,7 @@
12typedef struct mm_context { 12typedef struct mm_context {
13 struct mm_id id; 13 struct mm_id id;
14 struct uml_arch_mm_context arch; 14 struct uml_arch_mm_context arch;
15 struct page **stub_pages; 15 struct page *stub_pages[2];
16} mm_context_t; 16} mm_context_t;
17 17
18extern void __switch_mm(struct mm_id * mm_idp); 18extern void __switch_mm(struct mm_id * mm_idp);
diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h
index 591b3d8d761..aa4a743dc4a 100644
--- a/arch/um/include/asm/mmu_context.h
+++ b/arch/um/include/asm/mmu_context.h
@@ -9,7 +9,7 @@
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <asm/mmu.h> 10#include <asm/mmu.h>
11 11
12extern void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm); 12extern void uml_setup_stubs(struct mm_struct *mm);
13extern void arch_exit_mmap(struct mm_struct *mm); 13extern void arch_exit_mmap(struct mm_struct *mm);
14 14
15#define deactivate_mm(tsk,mm) do { } while (0) 15#define deactivate_mm(tsk,mm) do { } while (0)
@@ -23,7 +23,9 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
23 * when the new ->mm is used for the first time. 23 * when the new ->mm is used for the first time.
24 */ 24 */
25 __switch_mm(&new->context.id); 25 __switch_mm(&new->context.id);
26 arch_dup_mmap(old, new); 26 down_write(&new->mmap_sem);
27 uml_setup_stubs(new);
28 up_write(&new->mmap_sem);
27} 29}
28 30
29static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 31static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
@@ -39,6 +41,11 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
39 } 41 }
40} 42}
41 43
44static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
45{
46 uml_setup_stubs(mm);
47}
48
42static inline void enter_lazy_tlb(struct mm_struct *mm, 49static inline void enter_lazy_tlb(struct mm_struct *mm,
43 struct task_struct *tsk) 50 struct task_struct *tsk)
44{ 51{
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c
index e8b889d3bce..fb12f4c5e64 100644
--- a/arch/um/kernel/signal.c
+++ b/arch/um/kernel/signal.c
@@ -65,21 +65,10 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr,
65#endif 65#endif
66 err = setup_signal_stack_si(sp, signr, ka, regs, info, oldset); 66 err = setup_signal_stack_si(sp, signr, ka, regs, info, oldset);
67 67
68 if (err) { 68 if (err)
69 spin_lock_irq(&current->sighand->siglock);
70 current->blocked = *oldset;
71 recalc_sigpending();
72 spin_unlock_irq(&current->sighand->siglock);
73 force_sigsegv(signr, current); 69 force_sigsegv(signr, current);
74 } else { 70 else
75 spin_lock_irq(&current->sighand->siglock); 71 block_sigmask(ka, signr);
76 sigorsets(&current->blocked, &current->blocked,
77 &ka->sa.sa_mask);
78 if (!(ka->sa.sa_flags & SA_NODEFER))
79 sigaddset(&current->blocked, signr);
80 recalc_sigpending();
81 spin_unlock_irq(&current->sighand->siglock);
82 }
83 72
84 return err; 73 return err;
85} 74}
@@ -162,12 +151,11 @@ int do_signal(void)
162 */ 151 */
163long sys_sigsuspend(int history0, int history1, old_sigset_t mask) 152long sys_sigsuspend(int history0, int history1, old_sigset_t mask)
164{ 153{
154 sigset_t blocked;
155
165 mask &= _BLOCKABLE; 156 mask &= _BLOCKABLE;
166 spin_lock_irq(&current->sighand->siglock); 157 siginitset(&blocked, mask);
167 current->saved_sigmask = current->blocked; 158 set_current_blocked(&blocked);
168 siginitset(&current->blocked, mask);
169 recalc_sigpending();
170 spin_unlock_irq(&current->sighand->siglock);
171 159
172 current->state = TASK_INTERRUPTIBLE; 160 current->state = TASK_INTERRUPTIBLE;
173 schedule(); 161 schedule();
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 1aee587e9c5..4947b319f53 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -92,8 +92,6 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm)
92 goto out_free; 92 goto out_free;
93 } 93 }
94 94
95 to_mm->stub_pages = NULL;
96
97 return 0; 95 return 0;
98 96
99 out_free: 97 out_free:
@@ -103,7 +101,7 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm)
103 return ret; 101 return ret;
104} 102}
105 103
106void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) 104void uml_setup_stubs(struct mm_struct *mm)
107{ 105{
108 struct page **pages; 106 struct page **pages;
109 int err, ret; 107 int err, ret;
@@ -120,29 +118,20 @@ void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
120 if (ret) 118 if (ret)
121 goto out; 119 goto out;
122 120
123 pages = kmalloc(2 * sizeof(struct page *), GFP_KERNEL); 121 mm->context.stub_pages[0] = virt_to_page(&__syscall_stub_start);
124 if (pages == NULL) { 122 mm->context.stub_pages[1] = virt_to_page(mm->context.id.stack);
125 printk(KERN_ERR "arch_dup_mmap failed to allocate 2 page "
126 "pointers\n");
127 goto out;
128 }
129
130 pages[0] = virt_to_page(&__syscall_stub_start);
131 pages[1] = virt_to_page(mm->context.id.stack);
132 mm->context.stub_pages = pages;
133 123
134 /* dup_mmap already holds mmap_sem */ 124 /* dup_mmap already holds mmap_sem */
135 err = install_special_mapping(mm, STUB_START, STUB_END - STUB_START, 125 err = install_special_mapping(mm, STUB_START, STUB_END - STUB_START,
136 VM_READ | VM_MAYREAD | VM_EXEC | 126 VM_READ | VM_MAYREAD | VM_EXEC |
137 VM_MAYEXEC | VM_DONTCOPY, pages); 127 VM_MAYEXEC | VM_DONTCOPY,
128 mm->context.stub_pages);
138 if (err) { 129 if (err) {
139 printk(KERN_ERR "install_special_mapping returned %d\n", err); 130 printk(KERN_ERR "install_special_mapping returned %d\n", err);
140 goto out_free; 131 goto out;
141 } 132 }
142 return; 133 return;
143 134
144out_free:
145 kfree(pages);
146out: 135out:
147 force_sigsegv(SIGSEGV, current); 136 force_sigsegv(SIGSEGV, current);
148} 137}
@@ -151,8 +140,6 @@ void arch_exit_mmap(struct mm_struct *mm)
151{ 140{
152 pte_t *pte; 141 pte_t *pte;
153 142
154 if (mm->context.stub_pages != NULL)
155 kfree(mm->context.stub_pages);
156 pte = virt_to_pte(mm, STUB_CODE); 143 pte = virt_to_pte(mm, STUB_CODE);
157 if (pte != NULL) 144 if (pte != NULL)
158 pte_clear(mm, STUB_CODE, pte); 145 pte_clear(mm, STUB_CODE, pte);
diff --git a/arch/unicore32/include/asm/pci.h b/arch/unicore32/include/asm/pci.h
index dd3867727c3..f5e108f4a15 100644
--- a/arch/unicore32/include/asm/pci.h
+++ b/arch/unicore32/include/asm/pci.h
@@ -14,6 +14,7 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16#include <asm-generic/pci-dma-compat.h> 16#include <asm-generic/pci-dma-compat.h>
17#include <asm-generic/pci-bridge.h>
17#include <asm-generic/pci.h> 18#include <asm-generic/pci.h>
18#include <mach/hardware.h> /* for PCIBIOS_MIN_* */ 19#include <mach/hardware.h> /* for PCIBIOS_MIN_* */
19 20
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index a8f07fe10ca..2fc2b1ba825 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -21,7 +21,6 @@
21#include <linux/io.h> 21#include <linux/io.h>
22 22
23static int debug_pci; 23static int debug_pci;
24static int use_firmware;
25 24
26#define CONFIG_CMD(bus, devfn, where) \ 25#define CONFIG_CMD(bus, devfn, where) \
27 (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) 26 (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
@@ -276,7 +275,7 @@ static int __init pci_common_init(void)
276 275
277 pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq); 276 pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
278 277
279 if (!use_firmware) { 278 if (!pci_has_flag(PCI_PROBE_ONLY)) {
280 /* 279 /*
281 * Size the bridge windows. 280 * Size the bridge windows.
282 */ 281 */
@@ -303,7 +302,7 @@ char * __devinit pcibios_setup(char *str)
303 debug_pci = 1; 302 debug_pci = 1;
304 return NULL; 303 return NULL;
305 } else if (!strcmp(str, "firmware")) { 304 } else if (!strcmp(str, "firmware")) {
306 use_firmware = 1; 305 pci_add_flags(PCI_PROBE_ONLY);
307 return NULL; 306 return NULL;
308 } 307 }
309 return str; 308 return str;
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index 52edc2b6287..432b4291f37 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -381,7 +381,7 @@ int vectors_user_mapping(void)
381 return install_special_mapping(mm, 0xffff0000, PAGE_SIZE, 381 return install_special_mapping(mm, 0xffff0000, PAGE_SIZE,
382 VM_READ | VM_EXEC | 382 VM_READ | VM_EXEC |
383 VM_MAYREAD | VM_MAYEXEC | 383 VM_MAYREAD | VM_MAYEXEC |
384 VM_ALWAYSDUMP | VM_RESERVED, 384 VM_RESERVED,
385 NULL); 385 NULL);
386} 386}
387 387
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6c29256a71a..90195235596 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -422,27 +422,6 @@ if X86_WANT_INTEL_MID
422config X86_INTEL_MID 422config X86_INTEL_MID
423 bool 423 bool
424 424
425config X86_MRST
426 bool "Moorestown MID platform"
427 depends on PCI
428 depends on PCI_GOANY
429 depends on X86_IO_APIC
430 select X86_INTEL_MID
431 select SFI
432 select DW_APB_TIMER
433 select APB_TIMER
434 select I2C
435 select SPI
436 select INTEL_SCU_IPC
437 select X86_PLATFORM_DEVICES
438 ---help---
439 Moorestown is Intel's Low Power Intel Architecture (LPIA) based Moblin
440 Internet Device(MID) platform. Moorestown consists of two chips:
441 Lincroft (CPU core, graphics, and memory controller) and Langwell IOH.
442 Unlike standard x86 PCs, Moorestown does not have many legacy devices
443 nor standard legacy replacement devices/features. e.g. Moorestown does
444 not contain i8259, i8254, HPET, legacy BIOS, most of the io ports.
445
446config X86_MDFLD 425config X86_MDFLD
447 bool "Medfield MID platform" 426 bool "Medfield MID platform"
448 depends on PCI 427 depends on PCI
@@ -456,6 +435,7 @@ config X86_MDFLD
456 select SPI 435 select SPI
457 select INTEL_SCU_IPC 436 select INTEL_SCU_IPC
458 select X86_PLATFORM_DEVICES 437 select X86_PLATFORM_DEVICES
438 select MFD_INTEL_MSIC
459 ---help--- 439 ---help---
460 Medfield is Intel's Low Power Intel Architecture (LPIA) based Moblin 440 Medfield is Intel's Low Power Intel Architecture (LPIA) based Moblin
461 Internet Device(MID) platform. 441 Internet Device(MID) platform.
@@ -2139,6 +2119,12 @@ config ALIX
2139 2119
2140 Note: You have to set alix.force=1 for boards with Award BIOS. 2120 Note: You have to set alix.force=1 for boards with Award BIOS.
2141 2121
2122config NET5501
2123 bool "Soekris Engineering net5501 System Support (LEDS, GPIO, etc)"
2124 select GPIOLIB
2125 ---help---
2126 This option enables system support for the Soekris Engineering net5501.
2127
2142endif # X86_32 2128endif # X86_32
2143 2129
2144config AMD_NB 2130config AMD_NB
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 3c57033e221..706e12e9984 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -303,7 +303,6 @@ config X86_GENERIC
303config X86_INTERNODE_CACHE_SHIFT 303config X86_INTERNODE_CACHE_SHIFT
304 int 304 int
305 default "12" if X86_VSMP 305 default "12" if X86_VSMP
306 default "7" if NUMA
307 default X86_L1_CACHE_SHIFT 306 default X86_L1_CACHE_SHIFT
308 307
309config X86_CMPXCHG 308config X86_CMPXCHG
@@ -441,7 +440,7 @@ config CPU_SUP_INTEL
441config CPU_SUP_CYRIX_32 440config CPU_SUP_CYRIX_32
442 default y 441 default y
443 bool "Support Cyrix processors" if PROCESSOR_SELECT 442 bool "Support Cyrix processors" if PROCESSOR_SELECT
444 depends on !64BIT 443 depends on M386 || M486 || M586 || M586TSC || M586MMX || (EXPERT && !64BIT)
445 ---help--- 444 ---help---
446 This enables detection, tunings and quirks for Cyrix processors 445 This enables detection, tunings and quirks for Cyrix processors
447 446
@@ -495,7 +494,7 @@ config CPU_SUP_TRANSMETA_32
495config CPU_SUP_UMC_32 494config CPU_SUP_UMC_32
496 default y 495 default y
497 bool "Support UMC processors" if PROCESSOR_SELECT 496 bool "Support UMC processors" if PROCESSOR_SELECT
498 depends on !64BIT 497 depends on M386 || M486 || (EXPERT && !64BIT)
499 ---help--- 498 ---help---
500 This enables detection, tunings and quirks for UMC processors 499 This enables detection, tunings and quirks for UMC processors
501 500
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 95365a82b6a..5a747dd884d 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -37,7 +37,8 @@ setup-y += video-bios.o
37targets += $(setup-y) 37targets += $(setup-y)
38hostprogs-y := mkcpustr tools/build 38hostprogs-y := mkcpustr tools/build
39 39
40HOST_EXTRACFLAGS += $(LINUXINCLUDE) 40HOST_EXTRACFLAGS += -I$(srctree)/tools/include $(LINUXINCLUDE) \
41 -D__EXPORTED_HEADERS__
41 42
42$(obj)/cpu.o: $(obj)/cpustr.h 43$(obj)/cpu.o: $(obj)/cpustr.h
43 44
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index c7093bd9f2d..18997e5a105 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -67,7 +67,7 @@ static inline void outl(u32 v, u16 port)
67{ 67{
68 asm volatile("outl %0,%1" : : "a" (v), "dN" (port)); 68 asm volatile("outl %0,%1" : : "a" (v), "dN" (port));
69} 69}
70static inline u32 inl(u32 port) 70static inline u32 inl(u16 port)
71{ 71{
72 u32 v; 72 u32 v;
73 asm volatile("inl %1,%0" : "=a" (v) : "dN" (port)); 73 asm volatile("inl %1,%0" : "=a" (v) : "dN" (port));
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index b123b9a8f5b..fd55a2ff3ad 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -22,6 +22,7 @@ LDFLAGS := -m elf_$(UTS_MACHINE)
22LDFLAGS_vmlinux := -T 22LDFLAGS_vmlinux := -T
23 23
24hostprogs-y := mkpiggy 24hostprogs-y := mkpiggy
25HOST_EXTRACFLAGS += -I$(srctree)/tools/include
25 26
26VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ 27VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
27 $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \ 28 $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index fec216f4fbc..0cdfc0d2315 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -539,7 +539,7 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
539 struct initrd *initrd; 539 struct initrd *initrd;
540 efi_file_handle_t *h; 540 efi_file_handle_t *h;
541 efi_file_info_t *info; 541 efi_file_info_t *info;
542 efi_char16_t filename[256]; 542 efi_char16_t filename_16[256];
543 unsigned long info_sz; 543 unsigned long info_sz;
544 efi_guid_t info_guid = EFI_FILE_INFO_ID; 544 efi_guid_t info_guid = EFI_FILE_INFO_ID;
545 efi_char16_t *p; 545 efi_char16_t *p;
@@ -552,14 +552,14 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
552 str += 7; 552 str += 7;
553 553
554 initrd = &initrds[i]; 554 initrd = &initrds[i];
555 p = filename; 555 p = filename_16;
556 556
557 /* Skip any leading slashes */ 557 /* Skip any leading slashes */
558 while (*str == '/' || *str == '\\') 558 while (*str == '/' || *str == '\\')
559 str++; 559 str++;
560 560
561 while (*str && *str != ' ' && *str != '\n') { 561 while (*str && *str != ' ' && *str != '\n') {
562 if (p >= filename + sizeof(filename)) 562 if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16))
563 break; 563 break;
564 564
565 *p++ = *str++; 565 *p++ = *str++;
@@ -583,7 +583,7 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
583 goto free_initrds; 583 goto free_initrds;
584 } 584 }
585 585
586 status = efi_call_phys5(fh->open, fh, &h, filename, 586 status = efi_call_phys5(fh->open, fh, &h, filename_16,
587 EFI_FILE_MODE_READ, (u64)0); 587 EFI_FILE_MODE_READ, (u64)0);
588 if (status != EFI_SUCCESS) 588 if (status != EFI_SUCCESS)
589 goto close_handles; 589 goto close_handles;
diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
index 46a82388243..958a641483d 100644
--- a/arch/x86/boot/compressed/mkpiggy.c
+++ b/arch/x86/boot/compressed/mkpiggy.c
@@ -29,14 +29,7 @@
29#include <stdio.h> 29#include <stdio.h>
30#include <string.h> 30#include <string.h>
31#include <inttypes.h> 31#include <inttypes.h>
32 32#include <tools/le_byteshift.h>
33static uint32_t getle32(const void *p)
34{
35 const uint8_t *cp = p;
36
37 return (uint32_t)cp[0] + ((uint32_t)cp[1] << 8) +
38 ((uint32_t)cp[2] << 16) + ((uint32_t)cp[3] << 24);
39}
40 33
41int main(int argc, char *argv[]) 34int main(int argc, char *argv[])
42{ 35{
@@ -69,7 +62,7 @@ int main(int argc, char *argv[])
69 } 62 }
70 63
71 ilen = ftell(f); 64 ilen = ftell(f);
72 olen = getle32(&olen); 65 olen = get_unaligned_le32(&olen);
73 fclose(f); 66 fclose(f);
74 67
75 /* 68 /*
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c
index 89bbf4e4d05..d3c0b027766 100644
--- a/arch/x86/boot/compressed/relocs.c
+++ b/arch/x86/boot/compressed/relocs.c
@@ -10,6 +10,7 @@
10#define USE_BSD 10#define USE_BSD
11#include <endian.h> 11#include <endian.h>
12#include <regex.h> 12#include <regex.h>
13#include <tools/le_byteshift.h>
13 14
14static void die(char *fmt, ...); 15static void die(char *fmt, ...);
15 16
@@ -605,10 +606,7 @@ static void emit_relocs(int as_text)
605 fwrite("\0\0\0\0", 4, 1, stdout); 606 fwrite("\0\0\0\0", 4, 1, stdout);
606 /* Now print each relocation */ 607 /* Now print each relocation */
607 for (i = 0; i < reloc_count; i++) { 608 for (i = 0; i < reloc_count; i++) {
608 buf[0] = (relocs[i] >> 0) & 0xff; 609 put_unaligned_le32(relocs[i], buf);
609 buf[1] = (relocs[i] >> 8) & 0xff;
610 buf[2] = (relocs[i] >> 16) & 0xff;
611 buf[3] = (relocs[i] >> 24) & 0xff;
612 fwrite(buf, 4, 1, stdout); 610 fwrite(buf, 4, 1, stdout);
613 } 611 }
614 } 612 }
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
index 4e9bd6bcafa..ed549767a23 100644
--- a/arch/x86/boot/tools/build.c
+++ b/arch/x86/boot/tools/build.c
@@ -29,18 +29,18 @@
29#include <stdarg.h> 29#include <stdarg.h>
30#include <sys/types.h> 30#include <sys/types.h>
31#include <sys/stat.h> 31#include <sys/stat.h>
32#include <sys/sysmacros.h>
33#include <unistd.h> 32#include <unistd.h>
34#include <fcntl.h> 33#include <fcntl.h>
35#include <sys/mman.h> 34#include <sys/mman.h>
36#include <asm/boot.h> 35#include <tools/le_byteshift.h>
37 36
38typedef unsigned char u8; 37typedef unsigned char u8;
39typedef unsigned short u16; 38typedef unsigned short u16;
40typedef unsigned long u32; 39typedef unsigned int u32;
41 40
42#define DEFAULT_MAJOR_ROOT 0 41#define DEFAULT_MAJOR_ROOT 0
43#define DEFAULT_MINOR_ROOT 0 42#define DEFAULT_MINOR_ROOT 0
43#define DEFAULT_ROOT_DEV (DEFAULT_MAJOR_ROOT << 8 | DEFAULT_MINOR_ROOT)
44 44
45/* Minimal number of setup sectors */ 45/* Minimal number of setup sectors */
46#define SETUP_SECT_MIN 5 46#define SETUP_SECT_MIN 5
@@ -159,7 +159,7 @@ int main(int argc, char ** argv)
159 die("read-error on `setup'"); 159 die("read-error on `setup'");
160 if (c < 1024) 160 if (c < 1024)
161 die("The setup must be at least 1024 bytes"); 161 die("The setup must be at least 1024 bytes");
162 if (buf[510] != 0x55 || buf[511] != 0xaa) 162 if (get_unaligned_le16(&buf[510]) != 0xAA55)
163 die("Boot block hasn't got boot flag (0xAA55)"); 163 die("Boot block hasn't got boot flag (0xAA55)");
164 fclose(file); 164 fclose(file);
165 165
@@ -171,8 +171,7 @@ int main(int argc, char ** argv)
171 memset(buf+c, 0, i-c); 171 memset(buf+c, 0, i-c);
172 172
173 /* Set the default root device */ 173 /* Set the default root device */
174 buf[508] = DEFAULT_MINOR_ROOT; 174 put_unaligned_le16(DEFAULT_ROOT_DEV, &buf[508]);
175 buf[509] = DEFAULT_MAJOR_ROOT;
176 175
177 fprintf(stderr, "Setup is %d bytes (padded to %d bytes).\n", c, i); 176 fprintf(stderr, "Setup is %d bytes (padded to %d bytes).\n", c, i);
178 177
@@ -192,44 +191,42 @@ int main(int argc, char ** argv)
192 191
193 /* Patch the setup code with the appropriate size parameters */ 192 /* Patch the setup code with the appropriate size parameters */
194 buf[0x1f1] = setup_sectors-1; 193 buf[0x1f1] = setup_sectors-1;
195 buf[0x1f4] = sys_size; 194 put_unaligned_le32(sys_size, &buf[0x1f4]);
196 buf[0x1f5] = sys_size >> 8;
197 buf[0x1f6] = sys_size >> 16;
198 buf[0x1f7] = sys_size >> 24;
199 195
200#ifdef CONFIG_EFI_STUB 196#ifdef CONFIG_EFI_STUB
201 file_sz = sz + i + ((sys_size * 16) - sz); 197 file_sz = sz + i + ((sys_size * 16) - sz);
202 198
203 pe_header = *(unsigned int *)&buf[0x3c]; 199 pe_header = get_unaligned_le32(&buf[0x3c]);
204 200
205 /* Size of code */ 201 /* Size of code */
206 *(unsigned int *)&buf[pe_header + 0x1c] = file_sz; 202 put_unaligned_le32(file_sz, &buf[pe_header + 0x1c]);
207 203
208 /* Size of image */ 204 /* Size of image */
209 *(unsigned int *)&buf[pe_header + 0x50] = file_sz; 205 put_unaligned_le32(file_sz, &buf[pe_header + 0x50]);
210 206
211#ifdef CONFIG_X86_32 207#ifdef CONFIG_X86_32
212 /* Address of entry point */ 208 /* Address of entry point */
213 *(unsigned int *)&buf[pe_header + 0x28] = i; 209 put_unaligned_le32(i, &buf[pe_header + 0x28]);
214 210
215 /* .text size */ 211 /* .text size */
216 *(unsigned int *)&buf[pe_header + 0xb0] = file_sz; 212 put_unaligned_le32(file_sz, &buf[pe_header + 0xb0]);
217 213
218 /* .text size of initialised data */ 214 /* .text size of initialised data */
219 *(unsigned int *)&buf[pe_header + 0xb8] = file_sz; 215 put_unaligned_le32(file_sz, &buf[pe_header + 0xb8]);
220#else 216#else
221 /* 217 /*
222 * Address of entry point. startup_32 is at the beginning and 218 * Address of entry point. startup_32 is at the beginning and
223 * the 64-bit entry point (startup_64) is always 512 bytes 219 * the 64-bit entry point (startup_64) is always 512 bytes
224 * after. 220 * after.
225 */ 221 */
226 *(unsigned int *)&buf[pe_header + 0x28] = i + 512; 222 put_unaligned_le32(i + 512, &buf[pe_header + 0x28]);
227 223
228 /* .text size */ 224 /* .text size */
229 *(unsigned int *)&buf[pe_header + 0xc0] = file_sz; 225 put_unaligned_le32(file_sz, &buf[pe_header + 0xc0]);
230 226
231 /* .text size of initialised data */ 227 /* .text size of initialised data */
232 *(unsigned int *)&buf[pe_header + 0xc8] = file_sz; 228 put_unaligned_le32(file_sz, &buf[pe_header + 0xc8]);
229
233#endif /* CONFIG_X86_32 */ 230#endif /* CONFIG_X86_32 */
234#endif /* CONFIG_EFI_STUB */ 231#endif /* CONFIG_EFI_STUB */
235 232
@@ -250,8 +247,9 @@ int main(int argc, char ** argv)
250 } 247 }
251 248
252 /* Write the CRC */ 249 /* Write the CRC */
253 fprintf(stderr, "CRC %lx\n", crc); 250 fprintf(stderr, "CRC %x\n", crc);
254 if (fwrite(&crc, 1, 4, stdout) != 4) 251 put_unaligned_le32(crc, buf);
252 if (fwrite(buf, 1, 4, stdout) != 4)
255 die("Writing CRC failed"); 253 die("Writing CRC failed");
256 254
257 close(fd); 255 close(fd);
diff --git a/arch/x86/crypto/camellia_glue.c b/arch/x86/crypto/camellia_glue.c
index 1ca36a93fd2..3306dc0b139 100644
--- a/arch/x86/crypto/camellia_glue.c
+++ b/arch/x86/crypto/camellia_glue.c
@@ -1925,7 +1925,7 @@ static int force;
1925module_param(force, int, 0); 1925module_param(force, int, 0);
1926MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist"); 1926MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist");
1927 1927
1928int __init init(void) 1928static int __init init(void)
1929{ 1929{
1930 if (!force && is_blacklisted_cpu()) { 1930 if (!force && is_blacklisted_cpu()) {
1931 printk(KERN_INFO 1931 printk(KERN_INFO
@@ -1938,7 +1938,7 @@ int __init init(void)
1938 return crypto_register_algs(camellia_algs, ARRAY_SIZE(camellia_algs)); 1938 return crypto_register_algs(camellia_algs, ARRAY_SIZE(camellia_algs));
1939} 1939}
1940 1940
1941void __exit fini(void) 1941static void __exit fini(void)
1942{ 1942{
1943 crypto_unregister_algs(camellia_algs, ARRAY_SIZE(camellia_algs)); 1943 crypto_unregister_algs(camellia_algs, ARRAY_SIZE(camellia_algs));
1944} 1944}
diff --git a/arch/x86/crypto/twofish_glue_3way.c b/arch/x86/crypto/twofish_glue_3way.c
index 408fc0c5814..922ab24cce3 100644
--- a/arch/x86/crypto/twofish_glue_3way.c
+++ b/arch/x86/crypto/twofish_glue_3way.c
@@ -668,7 +668,7 @@ static int force;
668module_param(force, int, 0); 668module_param(force, int, 0);
669MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist"); 669MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist");
670 670
671int __init init(void) 671static int __init init(void)
672{ 672{
673 if (!force && is_blacklisted_cpu()) { 673 if (!force && is_blacklisted_cpu()) {
674 printk(KERN_INFO 674 printk(KERN_INFO
@@ -681,7 +681,7 @@ int __init init(void)
681 return crypto_register_algs(tf_algs, ARRAY_SIZE(tf_algs)); 681 return crypto_register_algs(tf_algs, ARRAY_SIZE(tf_algs));
682} 682}
683 683
684void __exit fini(void) 684static void __exit fini(void)
685{ 685{
686 crypto_unregister_algs(tf_algs, ARRAY_SIZE(tf_algs)); 686 crypto_unregister_algs(tf_algs, ARRAY_SIZE(tf_algs));
687} 687}
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index 39e49091f64..4c2e59a420b 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -323,7 +323,6 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
323 } 323 }
324 324
325 install_exec_creds(bprm); 325 install_exec_creds(bprm);
326 current->flags &= ~PF_FORKNOEXEC;
327 326
328 if (N_MAGIC(ex) == OMAGIC) { 327 if (N_MAGIC(ex) == OMAGIC) {
329 unsigned long text_addr, map_size; 328 unsigned long text_addr, map_size;
@@ -519,7 +518,8 @@ out:
519 518
520static int __init init_aout_binfmt(void) 519static int __init init_aout_binfmt(void)
521{ 520{
522 return register_binfmt(&aout_format); 521 register_binfmt(&aout_format);
522 return 0;
523} 523}
524 524
525static void __exit exit_aout_binfmt(void) 525static void __exit exit_aout_binfmt(void)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 65577698cab..5563ba1cf51 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -24,6 +24,7 @@
24#include <asm/ucontext.h> 24#include <asm/ucontext.h>
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/i387.h> 26#include <asm/i387.h>
27#include <asm/fpu-internal.h>
27#include <asm/ptrace.h> 28#include <asm/ptrace.h>
28#include <asm/ia32_unistd.h> 29#include <asm/ia32_unistd.h>
29#include <asm/user32.h> 30#include <asm/user32.h>
diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
index 37ad100a221..49331bedc15 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -145,6 +145,12 @@ static inline int alternatives_text_reserved(void *start, void *end)
145 */ 145 */
146#define ASM_OUTPUT2(a...) a 146#define ASM_OUTPUT2(a...) a
147 147
148/*
149 * use this macro if you need clobbers but no inputs in
150 * alternative_{input,io,call}()
151 */
152#define ASM_NO_INPUT_CLOBBER(clbr...) "i" (0) : clbr
153
148struct paravirt_patch_site; 154struct paravirt_patch_site;
149#ifdef CONFIG_PARAVIRT 155#ifdef CONFIG_PARAVIRT
150void apply_paravirt(struct paravirt_patch_site *start, 156void apply_paravirt(struct paravirt_patch_site *start,
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 3ab9bdd87e7..a9371c91718 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -288,6 +288,7 @@ struct apic {
288 288
289 int (*probe)(void); 289 int (*probe)(void);
290 int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); 290 int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
291 int (*apic_id_valid)(int apicid);
291 int (*apic_id_registered)(void); 292 int (*apic_id_registered)(void);
292 293
293 u32 irq_delivery_mode; 294 u32 irq_delivery_mode;
@@ -532,6 +533,11 @@ static inline unsigned int read_apic_id(void)
532 return apic->get_apic_id(reg); 533 return apic->get_apic_id(reg);
533} 534}
534 535
536static inline int default_apic_id_valid(int apicid)
537{
538 return x2apic_mode || (apicid < 255);
539}
540
535extern void default_setup_apic_routing(void); 541extern void default_setup_apic_routing(void);
536 542
537extern struct apic apic_noop; 543extern struct apic apic_noop;
diff --git a/arch/x86/include/asm/atomic64_32.h b/arch/x86/include/asm/atomic64_32.h
index fa13f0ec287..198119910da 100644
--- a/arch/x86/include/asm/atomic64_32.h
+++ b/arch/x86/include/asm/atomic64_32.h
@@ -14,13 +14,52 @@ typedef struct {
14 14
15#define ATOMIC64_INIT(val) { (val) } 15#define ATOMIC64_INIT(val) { (val) }
16 16
17#define __ATOMIC64_DECL(sym) void atomic64_##sym(atomic64_t *, ...)
18#ifndef ATOMIC64_EXPORT
19#define ATOMIC64_DECL_ONE __ATOMIC64_DECL
20#else
21#define ATOMIC64_DECL_ONE(sym) __ATOMIC64_DECL(sym); \
22 ATOMIC64_EXPORT(atomic64_##sym)
23#endif
24
17#ifdef CONFIG_X86_CMPXCHG64 25#ifdef CONFIG_X86_CMPXCHG64
18#define ATOMIC64_ALTERNATIVE_(f, g) "call atomic64_" #g "_cx8" 26#define __alternative_atomic64(f, g, out, in...) \
27 asm volatile("call %P[func]" \
28 : out : [func] "i" (atomic64_##g##_cx8), ## in)
29
30#define ATOMIC64_DECL(sym) ATOMIC64_DECL_ONE(sym##_cx8)
19#else 31#else
20#define ATOMIC64_ALTERNATIVE_(f, g) ALTERNATIVE("call atomic64_" #f "_386", "call atomic64_" #g "_cx8", X86_FEATURE_CX8) 32#define __alternative_atomic64(f, g, out, in...) \
33 alternative_call(atomic64_##f##_386, atomic64_##g##_cx8, \
34 X86_FEATURE_CX8, ASM_OUTPUT2(out), ## in)
35
36#define ATOMIC64_DECL(sym) ATOMIC64_DECL_ONE(sym##_cx8); \
37 ATOMIC64_DECL_ONE(sym##_386)
38
39ATOMIC64_DECL_ONE(add_386);
40ATOMIC64_DECL_ONE(sub_386);
41ATOMIC64_DECL_ONE(inc_386);
42ATOMIC64_DECL_ONE(dec_386);
21#endif 43#endif
22 44
23#define ATOMIC64_ALTERNATIVE(f) ATOMIC64_ALTERNATIVE_(f, f) 45#define alternative_atomic64(f, out, in...) \
46 __alternative_atomic64(f, f, ASM_OUTPUT2(out), ## in)
47
48ATOMIC64_DECL(read);
49ATOMIC64_DECL(set);
50ATOMIC64_DECL(xchg);
51ATOMIC64_DECL(add_return);
52ATOMIC64_DECL(sub_return);
53ATOMIC64_DECL(inc_return);
54ATOMIC64_DECL(dec_return);
55ATOMIC64_DECL(dec_if_positive);
56ATOMIC64_DECL(inc_not_zero);
57ATOMIC64_DECL(add_unless);
58
59#undef ATOMIC64_DECL
60#undef ATOMIC64_DECL_ONE
61#undef __ATOMIC64_DECL
62#undef ATOMIC64_EXPORT
24 63
25/** 64/**
26 * atomic64_cmpxchg - cmpxchg atomic64 variable 65 * atomic64_cmpxchg - cmpxchg atomic64 variable
@@ -50,11 +89,9 @@ static inline long long atomic64_xchg(atomic64_t *v, long long n)
50 long long o; 89 long long o;
51 unsigned high = (unsigned)(n >> 32); 90 unsigned high = (unsigned)(n >> 32);
52 unsigned low = (unsigned)n; 91 unsigned low = (unsigned)n;
53 asm volatile(ATOMIC64_ALTERNATIVE(xchg) 92 alternative_atomic64(xchg, "=&A" (o),
54 : "=A" (o), "+b" (low), "+c" (high) 93 "S" (v), "b" (low), "c" (high)
55 : "S" (v) 94 : "memory");
56 : "memory"
57 );
58 return o; 95 return o;
59} 96}
60 97
@@ -69,11 +106,9 @@ static inline void atomic64_set(atomic64_t *v, long long i)
69{ 106{
70 unsigned high = (unsigned)(i >> 32); 107 unsigned high = (unsigned)(i >> 32);
71 unsigned low = (unsigned)i; 108 unsigned low = (unsigned)i;
72 asm volatile(ATOMIC64_ALTERNATIVE(set) 109 alternative_atomic64(set, /* no output */,
73 : "+b" (low), "+c" (high) 110 "S" (v), "b" (low), "c" (high)
74 : "S" (v) 111 : "eax", "edx", "memory");
75 : "eax", "edx", "memory"
76 );
77} 112}
78 113
79/** 114/**
@@ -85,10 +120,7 @@ static inline void atomic64_set(atomic64_t *v, long long i)
85static inline long long atomic64_read(const atomic64_t *v) 120static inline long long atomic64_read(const atomic64_t *v)
86{ 121{
87 long long r; 122 long long r;
88 asm volatile(ATOMIC64_ALTERNATIVE(read) 123 alternative_atomic64(read, "=&A" (r), "c" (v) : "memory");
89 : "=A" (r), "+c" (v)
90 : : "memory"
91 );
92 return r; 124 return r;
93 } 125 }
94 126
@@ -101,10 +133,9 @@ static inline long long atomic64_read(const atomic64_t *v)
101 */ 133 */
102static inline long long atomic64_add_return(long long i, atomic64_t *v) 134static inline long long atomic64_add_return(long long i, atomic64_t *v)
103{ 135{
104 asm volatile(ATOMIC64_ALTERNATIVE(add_return) 136 alternative_atomic64(add_return,
105 : "+A" (i), "+c" (v) 137 ASM_OUTPUT2("+A" (i), "+c" (v)),
106 : : "memory" 138 ASM_NO_INPUT_CLOBBER("memory"));
107 );
108 return i; 139 return i;
109} 140}
110 141
@@ -113,32 +144,25 @@ static inline long long atomic64_add_return(long long i, atomic64_t *v)
113 */ 144 */
114static inline long long atomic64_sub_return(long long i, atomic64_t *v) 145static inline long long atomic64_sub_return(long long i, atomic64_t *v)
115{ 146{
116 asm volatile(ATOMIC64_ALTERNATIVE(sub_return) 147 alternative_atomic64(sub_return,
117 : "+A" (i), "+c" (v) 148 ASM_OUTPUT2("+A" (i), "+c" (v)),
118 : : "memory" 149 ASM_NO_INPUT_CLOBBER("memory"));
119 );
120 return i; 150 return i;
121} 151}
122 152
123static inline long long atomic64_inc_return(atomic64_t *v) 153static inline long long atomic64_inc_return(atomic64_t *v)
124{ 154{
125 long long a; 155 long long a;
126 asm volatile(ATOMIC64_ALTERNATIVE(inc_return) 156 alternative_atomic64(inc_return, "=&A" (a),
127 : "=A" (a) 157 "S" (v) : "memory", "ecx");
128 : "S" (v)
129 : "memory", "ecx"
130 );
131 return a; 158 return a;
132} 159}
133 160
134static inline long long atomic64_dec_return(atomic64_t *v) 161static inline long long atomic64_dec_return(atomic64_t *v)
135{ 162{
136 long long a; 163 long long a;
137 asm volatile(ATOMIC64_ALTERNATIVE(dec_return) 164 alternative_atomic64(dec_return, "=&A" (a),
138 : "=A" (a) 165 "S" (v) : "memory", "ecx");
139 : "S" (v)
140 : "memory", "ecx"
141 );
142 return a; 166 return a;
143} 167}
144 168
@@ -151,10 +175,9 @@ static inline long long atomic64_dec_return(atomic64_t *v)
151 */ 175 */
152static inline long long atomic64_add(long long i, atomic64_t *v) 176static inline long long atomic64_add(long long i, atomic64_t *v)
153{ 177{
154 asm volatile(ATOMIC64_ALTERNATIVE_(add, add_return) 178 __alternative_atomic64(add, add_return,
155 : "+A" (i), "+c" (v) 179 ASM_OUTPUT2("+A" (i), "+c" (v)),
156 : : "memory" 180 ASM_NO_INPUT_CLOBBER("memory"));
157 );
158 return i; 181 return i;
159} 182}
160 183
@@ -167,10 +190,9 @@ static inline long long atomic64_add(long long i, atomic64_t *v)
167 */ 190 */
168static inline long long atomic64_sub(long long i, atomic64_t *v) 191static inline long long atomic64_sub(long long i, atomic64_t *v)
169{ 192{
170 asm volatile(ATOMIC64_ALTERNATIVE_(sub, sub_return) 193 __alternative_atomic64(sub, sub_return,
171 : "+A" (i), "+c" (v) 194 ASM_OUTPUT2("+A" (i), "+c" (v)),
172 : : "memory" 195 ASM_NO_INPUT_CLOBBER("memory"));
173 );
174 return i; 196 return i;
175} 197}
176 198
@@ -196,10 +218,8 @@ static inline int atomic64_sub_and_test(long long i, atomic64_t *v)
196 */ 218 */
197static inline void atomic64_inc(atomic64_t *v) 219static inline void atomic64_inc(atomic64_t *v)
198{ 220{
199 asm volatile(ATOMIC64_ALTERNATIVE_(inc, inc_return) 221 __alternative_atomic64(inc, inc_return, /* no output */,
200 : : "S" (v) 222 "S" (v) : "memory", "eax", "ecx", "edx");
201 : "memory", "eax", "ecx", "edx"
202 );
203} 223}
204 224
205/** 225/**
@@ -210,10 +230,8 @@ static inline void atomic64_inc(atomic64_t *v)
210 */ 230 */
211static inline void atomic64_dec(atomic64_t *v) 231static inline void atomic64_dec(atomic64_t *v)
212{ 232{
213 asm volatile(ATOMIC64_ALTERNATIVE_(dec, dec_return) 233 __alternative_atomic64(dec, dec_return, /* no output */,
214 : : "S" (v) 234 "S" (v) : "memory", "eax", "ecx", "edx");
215 : "memory", "eax", "ecx", "edx"
216 );
217} 235}
218 236
219/** 237/**
@@ -263,15 +281,15 @@ static inline int atomic64_add_negative(long long i, atomic64_t *v)
263 * @u: ...unless v is equal to u. 281 * @u: ...unless v is equal to u.
264 * 282 *
265 * Atomically adds @a to @v, so long as it was not @u. 283 * Atomically adds @a to @v, so long as it was not @u.
266 * Returns the old value of @v. 284 * Returns non-zero if the add was done, zero otherwise.
267 */ 285 */
268static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u) 286static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u)
269{ 287{
270 unsigned low = (unsigned)u; 288 unsigned low = (unsigned)u;
271 unsigned high = (unsigned)(u >> 32); 289 unsigned high = (unsigned)(u >> 32);
272 asm volatile(ATOMIC64_ALTERNATIVE(add_unless) "\n\t" 290 alternative_atomic64(add_unless,
273 : "+A" (a), "+c" (v), "+S" (low), "+D" (high) 291 ASM_OUTPUT2("+A" (a), "+c" (low), "+D" (high)),
274 : : "memory"); 292 "S" (v) : "memory");
275 return (int)a; 293 return (int)a;
276} 294}
277 295
@@ -279,26 +297,20 @@ static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u)
279static inline int atomic64_inc_not_zero(atomic64_t *v) 297static inline int atomic64_inc_not_zero(atomic64_t *v)
280{ 298{
281 int r; 299 int r;
282 asm volatile(ATOMIC64_ALTERNATIVE(inc_not_zero) 300 alternative_atomic64(inc_not_zero, "=&a" (r),
283 : "=a" (r) 301 "S" (v) : "ecx", "edx", "memory");
284 : "S" (v)
285 : "ecx", "edx", "memory"
286 );
287 return r; 302 return r;
288} 303}
289 304
290static inline long long atomic64_dec_if_positive(atomic64_t *v) 305static inline long long atomic64_dec_if_positive(atomic64_t *v)
291{ 306{
292 long long r; 307 long long r;
293 asm volatile(ATOMIC64_ALTERNATIVE(dec_if_positive) 308 alternative_atomic64(dec_if_positive, "=&A" (r),
294 : "=A" (r) 309 "S" (v) : "ecx", "memory");
295 : "S" (v)
296 : "ecx", "memory"
297 );
298 return r; 310 return r;
299} 311}
300 312
301#undef ATOMIC64_ALTERNATIVE 313#undef alternative_atomic64
302#undef ATOMIC64_ALTERNATIVE_ 314#undef __alternative_atomic64
303 315
304#endif /* _ASM_X86_ATOMIC64_32_H */ 316#endif /* _ASM_X86_ATOMIC64_32_H */
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index dcb839eebc7..340ee49961a 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -200,10 +200,13 @@
200/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */ 200/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */
201#define X86_FEATURE_FSGSBASE (9*32+ 0) /* {RD/WR}{FS/GS}BASE instructions*/ 201#define X86_FEATURE_FSGSBASE (9*32+ 0) /* {RD/WR}{FS/GS}BASE instructions*/
202#define X86_FEATURE_BMI1 (9*32+ 3) /* 1st group bit manipulation extensions */ 202#define X86_FEATURE_BMI1 (9*32+ 3) /* 1st group bit manipulation extensions */
203#define X86_FEATURE_HLE (9*32+ 4) /* Hardware Lock Elision */
203#define X86_FEATURE_AVX2 (9*32+ 5) /* AVX2 instructions */ 204#define X86_FEATURE_AVX2 (9*32+ 5) /* AVX2 instructions */
204#define X86_FEATURE_SMEP (9*32+ 7) /* Supervisor Mode Execution Protection */ 205#define X86_FEATURE_SMEP (9*32+ 7) /* Supervisor Mode Execution Protection */
205#define X86_FEATURE_BMI2 (9*32+ 8) /* 2nd group bit manipulation extensions */ 206#define X86_FEATURE_BMI2 (9*32+ 8) /* 2nd group bit manipulation extensions */
206#define X86_FEATURE_ERMS (9*32+ 9) /* Enhanced REP MOVSB/STOSB */ 207#define X86_FEATURE_ERMS (9*32+ 9) /* Enhanced REP MOVSB/STOSB */
208#define X86_FEATURE_INVPCID (9*32+10) /* Invalidate Processor Context ID */
209#define X86_FEATURE_RTM (9*32+11) /* Restricted Transactional Memory */
207 210
208#if defined(__KERNEL__) && !defined(__ASSEMBLY__) 211#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
209 212
diff --git a/arch/x86/include/asm/debugreg.h b/arch/x86/include/asm/debugreg.h
index b903d5ea394..2d91580bf22 100644
--- a/arch/x86/include/asm/debugreg.h
+++ b/arch/x86/include/asm/debugreg.h
@@ -78,8 +78,75 @@
78 */ 78 */
79#ifdef __KERNEL__ 79#ifdef __KERNEL__
80 80
81#include <linux/bug.h>
82
81DECLARE_PER_CPU(unsigned long, cpu_dr7); 83DECLARE_PER_CPU(unsigned long, cpu_dr7);
82 84
85#ifndef CONFIG_PARAVIRT
86/*
87 * These special macros can be used to get or set a debugging register
88 */
89#define get_debugreg(var, register) \
90 (var) = native_get_debugreg(register)
91#define set_debugreg(value, register) \
92 native_set_debugreg(register, value)
93#endif
94
95static inline unsigned long native_get_debugreg(int regno)
96{
97 unsigned long val = 0; /* Damn you, gcc! */
98
99 switch (regno) {
100 case 0:
101 asm("mov %%db0, %0" :"=r" (val));
102 break;
103 case 1:
104 asm("mov %%db1, %0" :"=r" (val));
105 break;
106 case 2:
107 asm("mov %%db2, %0" :"=r" (val));
108 break;
109 case 3:
110 asm("mov %%db3, %0" :"=r" (val));
111 break;
112 case 6:
113 asm("mov %%db6, %0" :"=r" (val));
114 break;
115 case 7:
116 asm("mov %%db7, %0" :"=r" (val));
117 break;
118 default:
119 BUG();
120 }
121 return val;
122}
123
124static inline void native_set_debugreg(int regno, unsigned long value)
125{
126 switch (regno) {
127 case 0:
128 asm("mov %0, %%db0" ::"r" (value));
129 break;
130 case 1:
131 asm("mov %0, %%db1" ::"r" (value));
132 break;
133 case 2:
134 asm("mov %0, %%db2" ::"r" (value));
135 break;
136 case 3:
137 asm("mov %0, %%db3" ::"r" (value));
138 break;
139 case 6:
140 asm("mov %0, %%db6" ::"r" (value));
141 break;
142 case 7:
143 asm("mov %0, %%db7" ::"r" (value));
144 break;
145 default:
146 BUG();
147 }
148}
149
83static inline void hw_breakpoint_disable(void) 150static inline void hw_breakpoint_disable(void)
84{ 151{
85 /* Zero the control register for HW Breakpoint */ 152 /* Zero the control register for HW Breakpoint */
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 844f735fd63..c9dcc181d4d 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -95,7 +95,7 @@ extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
95 95
96extern int add_efi_memmap; 96extern int add_efi_memmap;
97extern void efi_set_executable(efi_memory_desc_t *md, bool executable); 97extern void efi_set_executable(efi_memory_desc_t *md, bool executable);
98extern void efi_memblock_x86_reserve_range(void); 98extern int efi_memblock_x86_reserve_range(void);
99extern void efi_call_phys_prelog(void); 99extern void efi_call_phys_prelog(void);
100extern void efi_call_phys_epilog(void); 100extern void efi_call_phys_epilog(void);
101 101
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
new file mode 100644
index 00000000000..4fa88154e4d
--- /dev/null
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -0,0 +1,520 @@
1/*
2 * Copyright (C) 1994 Linus Torvalds
3 *
4 * Pentium III FXSR, SSE support
5 * General FPU state handling cleanups
6 * Gareth Hughes <gareth@valinux.com>, May 2000
7 * x86-64 work by Andi Kleen 2002
8 */
9
10#ifndef _FPU_INTERNAL_H
11#define _FPU_INTERNAL_H
12
13#include <linux/kernel_stat.h>
14#include <linux/regset.h>
15#include <linux/slab.h>
16#include <asm/asm.h>
17#include <asm/cpufeature.h>
18#include <asm/processor.h>
19#include <asm/sigcontext.h>
20#include <asm/user.h>
21#include <asm/uaccess.h>
22#include <asm/xsave.h>
23
24extern unsigned int sig_xstate_size;
25extern void fpu_init(void);
26
27DECLARE_PER_CPU(struct task_struct *, fpu_owner_task);
28
29extern user_regset_active_fn fpregs_active, xfpregs_active;
30extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get,
31 xstateregs_get;
32extern user_regset_set_fn fpregs_set, xfpregs_set, fpregs_soft_set,
33 xstateregs_set;
34
35
36/*
37 * xstateregs_active == fpregs_active. Please refer to the comment
38 * at the definition of fpregs_active.
39 */
40#define xstateregs_active fpregs_active
41
42extern struct _fpx_sw_bytes fx_sw_reserved;
43#ifdef CONFIG_IA32_EMULATION
44extern unsigned int sig_xstate_ia32_size;
45extern struct _fpx_sw_bytes fx_sw_reserved_ia32;
46struct _fpstate_ia32;
47struct _xstate_ia32;
48extern int save_i387_xstate_ia32(void __user *buf);
49extern int restore_i387_xstate_ia32(void __user *buf);
50#endif
51
52#ifdef CONFIG_MATH_EMULATION
53extern void finit_soft_fpu(struct i387_soft_struct *soft);
54#else
55static inline void finit_soft_fpu(struct i387_soft_struct *soft) {}
56#endif
57
58#define X87_FSW_ES (1 << 7) /* Exception Summary */
59
60static __always_inline __pure bool use_xsaveopt(void)
61{
62 return static_cpu_has(X86_FEATURE_XSAVEOPT);
63}
64
65static __always_inline __pure bool use_xsave(void)
66{
67 return static_cpu_has(X86_FEATURE_XSAVE);
68}
69
70static __always_inline __pure bool use_fxsr(void)
71{
72 return static_cpu_has(X86_FEATURE_FXSR);
73}
74
75extern void __sanitize_i387_state(struct task_struct *);
76
77static inline void sanitize_i387_state(struct task_struct *tsk)
78{
79 if (!use_xsaveopt())
80 return;
81 __sanitize_i387_state(tsk);
82}
83
84#ifdef CONFIG_X86_64
85static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
86{
87 int err;
88
89 /* See comment in fxsave() below. */
90#ifdef CONFIG_AS_FXSAVEQ
91 asm volatile("1: fxrstorq %[fx]\n\t"
92 "2:\n"
93 ".section .fixup,\"ax\"\n"
94 "3: movl $-1,%[err]\n"
95 " jmp 2b\n"
96 ".previous\n"
97 _ASM_EXTABLE(1b, 3b)
98 : [err] "=r" (err)
99 : [fx] "m" (*fx), "0" (0));
100#else
101 asm volatile("1: rex64/fxrstor (%[fx])\n\t"
102 "2:\n"
103 ".section .fixup,\"ax\"\n"
104 "3: movl $-1,%[err]\n"
105 " jmp 2b\n"
106 ".previous\n"
107 _ASM_EXTABLE(1b, 3b)
108 : [err] "=r" (err)
109 : [fx] "R" (fx), "m" (*fx), "0" (0));
110#endif
111 return err;
112}
113
114static inline int fxsave_user(struct i387_fxsave_struct __user *fx)
115{
116 int err;
117
118 /*
119 * Clear the bytes not touched by the fxsave and reserved
120 * for the SW usage.
121 */
122 err = __clear_user(&fx->sw_reserved,
123 sizeof(struct _fpx_sw_bytes));
124 if (unlikely(err))
125 return -EFAULT;
126
127 /* See comment in fxsave() below. */
128#ifdef CONFIG_AS_FXSAVEQ
129 asm volatile("1: fxsaveq %[fx]\n\t"
130 "2:\n"
131 ".section .fixup,\"ax\"\n"
132 "3: movl $-1,%[err]\n"
133 " jmp 2b\n"
134 ".previous\n"
135 _ASM_EXTABLE(1b, 3b)
136 : [err] "=r" (err), [fx] "=m" (*fx)
137 : "0" (0));
138#else
139 asm volatile("1: rex64/fxsave (%[fx])\n\t"
140 "2:\n"
141 ".section .fixup,\"ax\"\n"
142 "3: movl $-1,%[err]\n"
143 " jmp 2b\n"
144 ".previous\n"
145 _ASM_EXTABLE(1b, 3b)
146 : [err] "=r" (err), "=m" (*fx)
147 : [fx] "R" (fx), "0" (0));
148#endif
149 if (unlikely(err) &&
150 __clear_user(fx, sizeof(struct i387_fxsave_struct)))
151 err = -EFAULT;
152 /* No need to clear here because the caller clears USED_MATH */
153 return err;
154}
155
156static inline void fpu_fxsave(struct fpu *fpu)
157{
158 /* Using "rex64; fxsave %0" is broken because, if the memory operand
159 uses any extended registers for addressing, a second REX prefix
160 will be generated (to the assembler, rex64 followed by semicolon
161 is a separate instruction), and hence the 64-bitness is lost. */
162
163#ifdef CONFIG_AS_FXSAVEQ
164 /* Using "fxsaveq %0" would be the ideal choice, but is only supported
165 starting with gas 2.16. */
166 __asm__ __volatile__("fxsaveq %0"
167 : "=m" (fpu->state->fxsave));
168#else
169 /* Using, as a workaround, the properly prefixed form below isn't
170 accepted by any binutils version so far released, complaining that
171 the same type of prefix is used twice if an extended register is
172 needed for addressing (fix submitted to mainline 2005-11-21).
173 asm volatile("rex64/fxsave %0"
174 : "=m" (fpu->state->fxsave));
175 This, however, we can work around by forcing the compiler to select
176 an addressing mode that doesn't require extended registers. */
177 asm volatile("rex64/fxsave (%[fx])"
178 : "=m" (fpu->state->fxsave)
179 : [fx] "R" (&fpu->state->fxsave));
180#endif
181}
182
183#else /* CONFIG_X86_32 */
184
185/* perform fxrstor iff the processor has extended states, otherwise frstor */
186static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
187{
188 /*
189 * The "nop" is needed to make the instructions the same
190 * length.
191 */
192 alternative_input(
193 "nop ; frstor %1",
194 "fxrstor %1",
195 X86_FEATURE_FXSR,
196 "m" (*fx));
197
198 return 0;
199}
200
201static inline void fpu_fxsave(struct fpu *fpu)
202{
203 asm volatile("fxsave %[fx]"
204 : [fx] "=m" (fpu->state->fxsave));
205}
206
207#endif /* CONFIG_X86_64 */
208
209/*
210 * These must be called with preempt disabled. Returns
211 * 'true' if the FPU state is still intact.
212 */
213static inline int fpu_save_init(struct fpu *fpu)
214{
215 if (use_xsave()) {
216 fpu_xsave(fpu);
217
218 /*
219 * xsave header may indicate the init state of the FP.
220 */
221 if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
222 return 1;
223 } else if (use_fxsr()) {
224 fpu_fxsave(fpu);
225 } else {
226 asm volatile("fnsave %[fx]; fwait"
227 : [fx] "=m" (fpu->state->fsave));
228 return 0;
229 }
230
231 /*
232 * If exceptions are pending, we need to clear them so
233 * that we don't randomly get exceptions later.
234 *
235 * FIXME! Is this perhaps only true for the old-style
236 * irq13 case? Maybe we could leave the x87 state
237 * intact otherwise?
238 */
239 if (unlikely(fpu->state->fxsave.swd & X87_FSW_ES)) {
240 asm volatile("fnclex");
241 return 0;
242 }
243 return 1;
244}
245
246static inline int __save_init_fpu(struct task_struct *tsk)
247{
248 return fpu_save_init(&tsk->thread.fpu);
249}
250
251static inline int fpu_fxrstor_checking(struct fpu *fpu)
252{
253 return fxrstor_checking(&fpu->state->fxsave);
254}
255
256static inline int fpu_restore_checking(struct fpu *fpu)
257{
258 if (use_xsave())
259 return fpu_xrstor_checking(fpu);
260 else
261 return fpu_fxrstor_checking(fpu);
262}
263
264static inline int restore_fpu_checking(struct task_struct *tsk)
265{
266 /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
267 is pending. Clear the x87 state here by setting it to fixed
268 values. "m" is a random variable that should be in L1 */
269 alternative_input(
270 ASM_NOP8 ASM_NOP2,
271 "emms\n\t" /* clear stack tags */
272 "fildl %P[addr]", /* set F?P to defined value */
273 X86_FEATURE_FXSAVE_LEAK,
274 [addr] "m" (tsk->thread.fpu.has_fpu));
275
276 return fpu_restore_checking(&tsk->thread.fpu);
277}
278
279/*
280 * Software FPU state helpers. Careful: these need to
281 * be preemption protection *and* they need to be
282 * properly paired with the CR0.TS changes!
283 */
284static inline int __thread_has_fpu(struct task_struct *tsk)
285{
286 return tsk->thread.fpu.has_fpu;
287}
288
289/* Must be paired with an 'stts' after! */
290static inline void __thread_clear_has_fpu(struct task_struct *tsk)
291{
292 tsk->thread.fpu.has_fpu = 0;
293 percpu_write(fpu_owner_task, NULL);
294}
295
296/* Must be paired with a 'clts' before! */
297static inline void __thread_set_has_fpu(struct task_struct *tsk)
298{
299 tsk->thread.fpu.has_fpu = 1;
300 percpu_write(fpu_owner_task, tsk);
301}
302
303/*
304 * Encapsulate the CR0.TS handling together with the
305 * software flag.
306 *
307 * These generally need preemption protection to work,
308 * do try to avoid using these on their own.
309 */
310static inline void __thread_fpu_end(struct task_struct *tsk)
311{
312 __thread_clear_has_fpu(tsk);
313 stts();
314}
315
316static inline void __thread_fpu_begin(struct task_struct *tsk)
317{
318 clts();
319 __thread_set_has_fpu(tsk);
320}
321
322/*
323 * FPU state switching for scheduling.
324 *
325 * This is a two-stage process:
326 *
327 * - switch_fpu_prepare() saves the old state and
328 * sets the new state of the CR0.TS bit. This is
329 * done within the context of the old process.
330 *
331 * - switch_fpu_finish() restores the new state as
332 * necessary.
333 */
334typedef struct { int preload; } fpu_switch_t;
335
336/*
337 * FIXME! We could do a totally lazy restore, but we need to
338 * add a per-cpu "this was the task that last touched the FPU
339 * on this CPU" variable, and the task needs to have a "I last
340 * touched the FPU on this CPU" and check them.
341 *
342 * We don't do that yet, so "fpu_lazy_restore()" always returns
343 * false, but some day..
344 */
345static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu)
346{
347 return new == percpu_read_stable(fpu_owner_task) &&
348 cpu == new->thread.fpu.last_cpu;
349}
350
351static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct task_struct *new, int cpu)
352{
353 fpu_switch_t fpu;
354
355 fpu.preload = tsk_used_math(new) && new->fpu_counter > 5;
356 if (__thread_has_fpu(old)) {
357 if (!__save_init_fpu(old))
358 cpu = ~0;
359 old->thread.fpu.last_cpu = cpu;
360 old->thread.fpu.has_fpu = 0; /* But leave fpu_owner_task! */
361
362 /* Don't change CR0.TS if we just switch! */
363 if (fpu.preload) {
364 new->fpu_counter++;
365 __thread_set_has_fpu(new);
366 prefetch(new->thread.fpu.state);
367 } else
368 stts();
369 } else {
370 old->fpu_counter = 0;
371 old->thread.fpu.last_cpu = ~0;
372 if (fpu.preload) {
373 new->fpu_counter++;
374 if (fpu_lazy_restore(new, cpu))
375 fpu.preload = 0;
376 else
377 prefetch(new->thread.fpu.state);
378 __thread_fpu_begin(new);
379 }
380 }
381 return fpu;
382}
383
384/*
385 * By the time this gets called, we've already cleared CR0.TS and
386 * given the process the FPU if we are going to preload the FPU
387 * state - all we need to do is to conditionally restore the register
388 * state itself.
389 */
390static inline void switch_fpu_finish(struct task_struct *new, fpu_switch_t fpu)
391{
392 if (fpu.preload) {
393 if (unlikely(restore_fpu_checking(new)))
394 __thread_fpu_end(new);
395 }
396}
397
398/*
399 * Signal frame handlers...
400 */
401extern int save_i387_xstate(void __user *buf);
402extern int restore_i387_xstate(void __user *buf);
403
404static inline void __clear_fpu(struct task_struct *tsk)
405{
406 if (__thread_has_fpu(tsk)) {
407 /* Ignore delayed exceptions from user space */
408 asm volatile("1: fwait\n"
409 "2:\n"
410 _ASM_EXTABLE(1b, 2b));
411 __thread_fpu_end(tsk);
412 }
413}
414
415/*
416 * The actual user_fpu_begin/end() functions
417 * need to be preemption-safe.
418 *
419 * NOTE! user_fpu_end() must be used only after you
420 * have saved the FP state, and user_fpu_begin() must
421 * be used only immediately before restoring it.
422 * These functions do not do any save/restore on
423 * their own.
424 */
425static inline void user_fpu_end(void)
426{
427 preempt_disable();
428 __thread_fpu_end(current);
429 preempt_enable();
430}
431
432static inline void user_fpu_begin(void)
433{
434 preempt_disable();
435 if (!user_has_fpu())
436 __thread_fpu_begin(current);
437 preempt_enable();
438}
439
440/*
441 * These disable preemption on their own and are safe
442 */
443static inline void save_init_fpu(struct task_struct *tsk)
444{
445 WARN_ON_ONCE(!__thread_has_fpu(tsk));
446 preempt_disable();
447 __save_init_fpu(tsk);
448 __thread_fpu_end(tsk);
449 preempt_enable();
450}
451
452static inline void clear_fpu(struct task_struct *tsk)
453{
454 preempt_disable();
455 __clear_fpu(tsk);
456 preempt_enable();
457}
458
459/*
460 * i387 state interaction
461 */
462static inline unsigned short get_fpu_cwd(struct task_struct *tsk)
463{
464 if (cpu_has_fxsr) {
465 return tsk->thread.fpu.state->fxsave.cwd;
466 } else {
467 return (unsigned short)tsk->thread.fpu.state->fsave.cwd;
468 }
469}
470
471static inline unsigned short get_fpu_swd(struct task_struct *tsk)
472{
473 if (cpu_has_fxsr) {
474 return tsk->thread.fpu.state->fxsave.swd;
475 } else {
476 return (unsigned short)tsk->thread.fpu.state->fsave.swd;
477 }
478}
479
480static inline unsigned short get_fpu_mxcsr(struct task_struct *tsk)
481{
482 if (cpu_has_xmm) {
483 return tsk->thread.fpu.state->fxsave.mxcsr;
484 } else {
485 return MXCSR_DEFAULT;
486 }
487}
488
489static bool fpu_allocated(struct fpu *fpu)
490{
491 return fpu->state != NULL;
492}
493
494static inline int fpu_alloc(struct fpu *fpu)
495{
496 if (fpu_allocated(fpu))
497 return 0;
498 fpu->state = kmem_cache_alloc(task_xstate_cachep, GFP_KERNEL);
499 if (!fpu->state)
500 return -ENOMEM;
501 WARN_ON((unsigned long)fpu->state & 15);
502 return 0;
503}
504
505static inline void fpu_free(struct fpu *fpu)
506{
507 if (fpu->state) {
508 kmem_cache_free(task_xstate_cachep, fpu->state);
509 fpu->state = NULL;
510 }
511}
512
513static inline void fpu_copy(struct fpu *dst, struct fpu *src)
514{
515 memcpy(dst->state, src->state, xstate_size);
516}
517
518extern void fpu_finit(struct fpu *fpu);
519
520#endif
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
index 247904945d3..7ce0798b1b2 100644
--- a/arch/x86/include/asm/i387.h
+++ b/arch/x86/include/asm/i387.h
@@ -13,476 +13,19 @@
13#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
14 14
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/kernel_stat.h>
17#include <linux/regset.h>
18#include <linux/hardirq.h> 16#include <linux/hardirq.h>
19#include <linux/slab.h> 17#include <asm/system.h>
20#include <asm/asm.h> 18
21#include <asm/cpufeature.h> 19struct pt_regs;
22#include <asm/processor.h> 20struct user_i387_struct;
23#include <asm/sigcontext.h>
24#include <asm/user.h>
25#include <asm/uaccess.h>
26#include <asm/xsave.h>
27 21
28extern unsigned int sig_xstate_size;
29extern void fpu_init(void);
30extern void mxcsr_feature_mask_init(void);
31extern int init_fpu(struct task_struct *child); 22extern int init_fpu(struct task_struct *child);
32extern void math_state_restore(void);
33extern int dump_fpu(struct pt_regs *, struct user_i387_struct *); 23extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);
24extern void math_state_restore(void);
34 25
35DECLARE_PER_CPU(struct task_struct *, fpu_owner_task); 26extern bool irq_fpu_usable(void);
36 27extern void kernel_fpu_begin(void);
37extern user_regset_active_fn fpregs_active, xfpregs_active; 28extern void kernel_fpu_end(void);
38extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get,
39 xstateregs_get;
40extern user_regset_set_fn fpregs_set, xfpregs_set, fpregs_soft_set,
41 xstateregs_set;
42
43/*
44 * xstateregs_active == fpregs_active. Please refer to the comment
45 * at the definition of fpregs_active.
46 */
47#define xstateregs_active fpregs_active
48
49extern struct _fpx_sw_bytes fx_sw_reserved;
50#ifdef CONFIG_IA32_EMULATION
51extern unsigned int sig_xstate_ia32_size;
52extern struct _fpx_sw_bytes fx_sw_reserved_ia32;
53struct _fpstate_ia32;
54struct _xstate_ia32;
55extern int save_i387_xstate_ia32(void __user *buf);
56extern int restore_i387_xstate_ia32(void __user *buf);
57#endif
58
59#ifdef CONFIG_MATH_EMULATION
60extern void finit_soft_fpu(struct i387_soft_struct *soft);
61#else
62static inline void finit_soft_fpu(struct i387_soft_struct *soft) {}
63#endif
64
65#define X87_FSW_ES (1 << 7) /* Exception Summary */
66
67static __always_inline __pure bool use_xsaveopt(void)
68{
69 return static_cpu_has(X86_FEATURE_XSAVEOPT);
70}
71
72static __always_inline __pure bool use_xsave(void)
73{
74 return static_cpu_has(X86_FEATURE_XSAVE);
75}
76
77static __always_inline __pure bool use_fxsr(void)
78{
79 return static_cpu_has(X86_FEATURE_FXSR);
80}
81
82extern void __sanitize_i387_state(struct task_struct *);
83
84static inline void sanitize_i387_state(struct task_struct *tsk)
85{
86 if (!use_xsaveopt())
87 return;
88 __sanitize_i387_state(tsk);
89}
90
91#ifdef CONFIG_X86_64
92static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
93{
94 int err;
95
96 /* See comment in fxsave() below. */
97#ifdef CONFIG_AS_FXSAVEQ
98 asm volatile("1: fxrstorq %[fx]\n\t"
99 "2:\n"
100 ".section .fixup,\"ax\"\n"
101 "3: movl $-1,%[err]\n"
102 " jmp 2b\n"
103 ".previous\n"
104 _ASM_EXTABLE(1b, 3b)
105 : [err] "=r" (err)
106 : [fx] "m" (*fx), "0" (0));
107#else
108 asm volatile("1: rex64/fxrstor (%[fx])\n\t"
109 "2:\n"
110 ".section .fixup,\"ax\"\n"
111 "3: movl $-1,%[err]\n"
112 " jmp 2b\n"
113 ".previous\n"
114 _ASM_EXTABLE(1b, 3b)
115 : [err] "=r" (err)
116 : [fx] "R" (fx), "m" (*fx), "0" (0));
117#endif
118 return err;
119}
120
121static inline int fxsave_user(struct i387_fxsave_struct __user *fx)
122{
123 int err;
124
125 /*
126 * Clear the bytes not touched by the fxsave and reserved
127 * for the SW usage.
128 */
129 err = __clear_user(&fx->sw_reserved,
130 sizeof(struct _fpx_sw_bytes));
131 if (unlikely(err))
132 return -EFAULT;
133
134 /* See comment in fxsave() below. */
135#ifdef CONFIG_AS_FXSAVEQ
136 asm volatile("1: fxsaveq %[fx]\n\t"
137 "2:\n"
138 ".section .fixup,\"ax\"\n"
139 "3: movl $-1,%[err]\n"
140 " jmp 2b\n"
141 ".previous\n"
142 _ASM_EXTABLE(1b, 3b)
143 : [err] "=r" (err), [fx] "=m" (*fx)
144 : "0" (0));
145#else
146 asm volatile("1: rex64/fxsave (%[fx])\n\t"
147 "2:\n"
148 ".section .fixup,\"ax\"\n"
149 "3: movl $-1,%[err]\n"
150 " jmp 2b\n"
151 ".previous\n"
152 _ASM_EXTABLE(1b, 3b)
153 : [err] "=r" (err), "=m" (*fx)
154 : [fx] "R" (fx), "0" (0));
155#endif
156 if (unlikely(err) &&
157 __clear_user(fx, sizeof(struct i387_fxsave_struct)))
158 err = -EFAULT;
159 /* No need to clear here because the caller clears USED_MATH */
160 return err;
161}
162
163static inline void fpu_fxsave(struct fpu *fpu)
164{
165 /* Using "rex64; fxsave %0" is broken because, if the memory operand
166 uses any extended registers for addressing, a second REX prefix
167 will be generated (to the assembler, rex64 followed by semicolon
168 is a separate instruction), and hence the 64-bitness is lost. */
169
170#ifdef CONFIG_AS_FXSAVEQ
171 /* Using "fxsaveq %0" would be the ideal choice, but is only supported
172 starting with gas 2.16. */
173 __asm__ __volatile__("fxsaveq %0"
174 : "=m" (fpu->state->fxsave));
175#else
176 /* Using, as a workaround, the properly prefixed form below isn't
177 accepted by any binutils version so far released, complaining that
178 the same type of prefix is used twice if an extended register is
179 needed for addressing (fix submitted to mainline 2005-11-21).
180 asm volatile("rex64/fxsave %0"
181 : "=m" (fpu->state->fxsave));
182 This, however, we can work around by forcing the compiler to select
183 an addressing mode that doesn't require extended registers. */
184 asm volatile("rex64/fxsave (%[fx])"
185 : "=m" (fpu->state->fxsave)
186 : [fx] "R" (&fpu->state->fxsave));
187#endif
188}
189
190#else /* CONFIG_X86_32 */
191
192/* perform fxrstor iff the processor has extended states, otherwise frstor */
193static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
194{
195 /*
196 * The "nop" is needed to make the instructions the same
197 * length.
198 */
199 alternative_input(
200 "nop ; frstor %1",
201 "fxrstor %1",
202 X86_FEATURE_FXSR,
203 "m" (*fx));
204
205 return 0;
206}
207
208static inline void fpu_fxsave(struct fpu *fpu)
209{
210 asm volatile("fxsave %[fx]"
211 : [fx] "=m" (fpu->state->fxsave));
212}
213
214#endif /* CONFIG_X86_64 */
215
216/*
217 * These must be called with preempt disabled. Returns
218 * 'true' if the FPU state is still intact.
219 */
220static inline int fpu_save_init(struct fpu *fpu)
221{
222 if (use_xsave()) {
223 fpu_xsave(fpu);
224
225 /*
226 * xsave header may indicate the init state of the FP.
227 */
228 if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
229 return 1;
230 } else if (use_fxsr()) {
231 fpu_fxsave(fpu);
232 } else {
233 asm volatile("fnsave %[fx]; fwait"
234 : [fx] "=m" (fpu->state->fsave));
235 return 0;
236 }
237
238 /*
239 * If exceptions are pending, we need to clear them so
240 * that we don't randomly get exceptions later.
241 *
242 * FIXME! Is this perhaps only true for the old-style
243 * irq13 case? Maybe we could leave the x87 state
244 * intact otherwise?
245 */
246 if (unlikely(fpu->state->fxsave.swd & X87_FSW_ES)) {
247 asm volatile("fnclex");
248 return 0;
249 }
250 return 1;
251}
252
253static inline int __save_init_fpu(struct task_struct *tsk)
254{
255 return fpu_save_init(&tsk->thread.fpu);
256}
257
258static inline int fpu_fxrstor_checking(struct fpu *fpu)
259{
260 return fxrstor_checking(&fpu->state->fxsave);
261}
262
263static inline int fpu_restore_checking(struct fpu *fpu)
264{
265 if (use_xsave())
266 return fpu_xrstor_checking(fpu);
267 else
268 return fpu_fxrstor_checking(fpu);
269}
270
271static inline int restore_fpu_checking(struct task_struct *tsk)
272{
273 /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
274 is pending. Clear the x87 state here by setting it to fixed
275 values. "m" is a random variable that should be in L1 */
276 alternative_input(
277 ASM_NOP8 ASM_NOP2,
278 "emms\n\t" /* clear stack tags */
279 "fildl %P[addr]", /* set F?P to defined value */
280 X86_FEATURE_FXSAVE_LEAK,
281 [addr] "m" (tsk->thread.fpu.has_fpu));
282
283 return fpu_restore_checking(&tsk->thread.fpu);
284}
285
286/*
287 * Software FPU state helpers. Careful: these need to
288 * be preemption protection *and* they need to be
289 * properly paired with the CR0.TS changes!
290 */
291static inline int __thread_has_fpu(struct task_struct *tsk)
292{
293 return tsk->thread.fpu.has_fpu;
294}
295
296/* Must be paired with an 'stts' after! */
297static inline void __thread_clear_has_fpu(struct task_struct *tsk)
298{
299 tsk->thread.fpu.has_fpu = 0;
300 percpu_write(fpu_owner_task, NULL);
301}
302
303/* Must be paired with a 'clts' before! */
304static inline void __thread_set_has_fpu(struct task_struct *tsk)
305{
306 tsk->thread.fpu.has_fpu = 1;
307 percpu_write(fpu_owner_task, tsk);
308}
309
310/*
311 * Encapsulate the CR0.TS handling together with the
312 * software flag.
313 *
314 * These generally need preemption protection to work,
315 * do try to avoid using these on their own.
316 */
317static inline void __thread_fpu_end(struct task_struct *tsk)
318{
319 __thread_clear_has_fpu(tsk);
320 stts();
321}
322
323static inline void __thread_fpu_begin(struct task_struct *tsk)
324{
325 clts();
326 __thread_set_has_fpu(tsk);
327}
328
329/*
330 * FPU state switching for scheduling.
331 *
332 * This is a two-stage process:
333 *
334 * - switch_fpu_prepare() saves the old state and
335 * sets the new state of the CR0.TS bit. This is
336 * done within the context of the old process.
337 *
338 * - switch_fpu_finish() restores the new state as
339 * necessary.
340 */
341typedef struct { int preload; } fpu_switch_t;
342
343/*
344 * FIXME! We could do a totally lazy restore, but we need to
345 * add a per-cpu "this was the task that last touched the FPU
346 * on this CPU" variable, and the task needs to have a "I last
347 * touched the FPU on this CPU" and check them.
348 *
349 * We don't do that yet, so "fpu_lazy_restore()" always returns
350 * false, but some day..
351 */
352static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu)
353{
354 return new == percpu_read_stable(fpu_owner_task) &&
355 cpu == new->thread.fpu.last_cpu;
356}
357
358static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct task_struct *new, int cpu)
359{
360 fpu_switch_t fpu;
361
362 fpu.preload = tsk_used_math(new) && new->fpu_counter > 5;
363 if (__thread_has_fpu(old)) {
364 if (!__save_init_fpu(old))
365 cpu = ~0;
366 old->thread.fpu.last_cpu = cpu;
367 old->thread.fpu.has_fpu = 0; /* But leave fpu_owner_task! */
368
369 /* Don't change CR0.TS if we just switch! */
370 if (fpu.preload) {
371 new->fpu_counter++;
372 __thread_set_has_fpu(new);
373 prefetch(new->thread.fpu.state);
374 } else
375 stts();
376 } else {
377 old->fpu_counter = 0;
378 old->thread.fpu.last_cpu = ~0;
379 if (fpu.preload) {
380 new->fpu_counter++;
381 if (fpu_lazy_restore(new, cpu))
382 fpu.preload = 0;
383 else
384 prefetch(new->thread.fpu.state);
385 __thread_fpu_begin(new);
386 }
387 }
388 return fpu;
389}
390
391/*
392 * By the time this gets called, we've already cleared CR0.TS and
393 * given the process the FPU if we are going to preload the FPU
394 * state - all we need to do is to conditionally restore the register
395 * state itself.
396 */
397static inline void switch_fpu_finish(struct task_struct *new, fpu_switch_t fpu)
398{
399 if (fpu.preload) {
400 if (unlikely(restore_fpu_checking(new)))
401 __thread_fpu_end(new);
402 }
403}
404
405/*
406 * Signal frame handlers...
407 */
408extern int save_i387_xstate(void __user *buf);
409extern int restore_i387_xstate(void __user *buf);
410
411static inline void __clear_fpu(struct task_struct *tsk)
412{
413 if (__thread_has_fpu(tsk)) {
414 /* Ignore delayed exceptions from user space */
415 asm volatile("1: fwait\n"
416 "2:\n"
417 _ASM_EXTABLE(1b, 2b));
418 __thread_fpu_end(tsk);
419 }
420}
421
422/*
423 * Were we in an interrupt that interrupted kernel mode?
424 *
425 * We can do a kernel_fpu_begin/end() pair *ONLY* if that
426 * pair does nothing at all: the thread must not have fpu (so
427 * that we don't try to save the FPU state), and TS must
428 * be set (so that the clts/stts pair does nothing that is
429 * visible in the interrupted kernel thread).
430 */
431static inline bool interrupted_kernel_fpu_idle(void)
432{
433 return !__thread_has_fpu(current) &&
434 (read_cr0() & X86_CR0_TS);
435}
436
437/*
438 * Were we in user mode (or vm86 mode) when we were
439 * interrupted?
440 *
441 * Doing kernel_fpu_begin/end() is ok if we are running
442 * in an interrupt context from user mode - we'll just
443 * save the FPU state as required.
444 */
445static inline bool interrupted_user_mode(void)
446{
447 struct pt_regs *regs = get_irq_regs();
448 return regs && user_mode_vm(regs);
449}
450
451/*
452 * Can we use the FPU in kernel mode with the
453 * whole "kernel_fpu_begin/end()" sequence?
454 *
455 * It's always ok in process context (ie "not interrupt")
456 * but it is sometimes ok even from an irq.
457 */
458static inline bool irq_fpu_usable(void)
459{
460 return !in_interrupt() ||
461 interrupted_user_mode() ||
462 interrupted_kernel_fpu_idle();
463}
464
465static inline void kernel_fpu_begin(void)
466{
467 struct task_struct *me = current;
468
469 WARN_ON_ONCE(!irq_fpu_usable());
470 preempt_disable();
471 if (__thread_has_fpu(me)) {
472 __save_init_fpu(me);
473 __thread_clear_has_fpu(me);
474 /* We do 'stts()' in kernel_fpu_end() */
475 } else {
476 percpu_write(fpu_owner_task, NULL);
477 clts();
478 }
479}
480
481static inline void kernel_fpu_end(void)
482{
483 stts();
484 preempt_enable();
485}
486 29
487/* 30/*
488 * Some instructions like VIA's padlock instructions generate a spurious 31 * Some instructions like VIA's padlock instructions generate a spurious
@@ -524,126 +67,13 @@ static inline void irq_ts_restore(int TS_state)
524 * we can just assume we have FPU access - typically 67 * we can just assume we have FPU access - typically
525 * to save the FP state - we'll just take a #NM 68 * to save the FP state - we'll just take a #NM
526 * fault and get the FPU access back. 69 * fault and get the FPU access back.
527 *
528 * The actual user_fpu_begin/end() functions
529 * need to be preemption-safe, though.
530 *
531 * NOTE! user_fpu_end() must be used only after you
532 * have saved the FP state, and user_fpu_begin() must
533 * be used only immediately before restoring it.
534 * These functions do not do any save/restore on
535 * their own.
536 */ 70 */
537static inline int user_has_fpu(void) 71static inline int user_has_fpu(void)
538{ 72{
539 return __thread_has_fpu(current); 73 return current->thread.fpu.has_fpu;
540}
541
542static inline void user_fpu_end(void)
543{
544 preempt_disable();
545 __thread_fpu_end(current);
546 preempt_enable();
547}
548
549static inline void user_fpu_begin(void)
550{
551 preempt_disable();
552 if (!user_has_fpu())
553 __thread_fpu_begin(current);
554 preempt_enable();
555}
556
557/*
558 * These disable preemption on their own and are safe
559 */
560static inline void save_init_fpu(struct task_struct *tsk)
561{
562 WARN_ON_ONCE(!__thread_has_fpu(tsk));
563 preempt_disable();
564 __save_init_fpu(tsk);
565 __thread_fpu_end(tsk);
566 preempt_enable();
567}
568
569static inline void unlazy_fpu(struct task_struct *tsk)
570{
571 preempt_disable();
572 if (__thread_has_fpu(tsk)) {
573 __save_init_fpu(tsk);
574 __thread_fpu_end(tsk);
575 } else
576 tsk->fpu_counter = 0;
577 preempt_enable();
578}
579
580static inline void clear_fpu(struct task_struct *tsk)
581{
582 preempt_disable();
583 __clear_fpu(tsk);
584 preempt_enable();
585}
586
587/*
588 * i387 state interaction
589 */
590static inline unsigned short get_fpu_cwd(struct task_struct *tsk)
591{
592 if (cpu_has_fxsr) {
593 return tsk->thread.fpu.state->fxsave.cwd;
594 } else {
595 return (unsigned short)tsk->thread.fpu.state->fsave.cwd;
596 }
597}
598
599static inline unsigned short get_fpu_swd(struct task_struct *tsk)
600{
601 if (cpu_has_fxsr) {
602 return tsk->thread.fpu.state->fxsave.swd;
603 } else {
604 return (unsigned short)tsk->thread.fpu.state->fsave.swd;
605 }
606}
607
608static inline unsigned short get_fpu_mxcsr(struct task_struct *tsk)
609{
610 if (cpu_has_xmm) {
611 return tsk->thread.fpu.state->fxsave.mxcsr;
612 } else {
613 return MXCSR_DEFAULT;
614 }
615}
616
617static bool fpu_allocated(struct fpu *fpu)
618{
619 return fpu->state != NULL;
620}
621
622static inline int fpu_alloc(struct fpu *fpu)
623{
624 if (fpu_allocated(fpu))
625 return 0;
626 fpu->state = kmem_cache_alloc(task_xstate_cachep, GFP_KERNEL);
627 if (!fpu->state)
628 return -ENOMEM;
629 WARN_ON((unsigned long)fpu->state & 15);
630 return 0;
631}
632
633static inline void fpu_free(struct fpu *fpu)
634{
635 if (fpu->state) {
636 kmem_cache_free(task_xstate_cachep, fpu->state);
637 fpu->state = NULL;
638 }
639}
640
641static inline void fpu_copy(struct fpu *dst, struct fpu *src)
642{
643 memcpy(dst->state, src->state, xstate_size);
644} 74}
645 75
646extern void fpu_finit(struct fpu *fpu); 76extern void unlazy_fpu(struct task_struct *tsk);
647 77
648#endif /* __ASSEMBLY__ */ 78#endif /* __ASSEMBLY__ */
649 79
diff --git a/arch/x86/include/asm/kgdb.h b/arch/x86/include/asm/kgdb.h
index 77e95f54570..332f98c9111 100644
--- a/arch/x86/include/asm/kgdb.h
+++ b/arch/x86/include/asm/kgdb.h
@@ -64,11 +64,15 @@ enum regnames {
64 GDB_PS, /* 17 */ 64 GDB_PS, /* 17 */
65 GDB_CS, /* 18 */ 65 GDB_CS, /* 18 */
66 GDB_SS, /* 19 */ 66 GDB_SS, /* 19 */
67 GDB_DS, /* 20 */
68 GDB_ES, /* 21 */
69 GDB_FS, /* 22 */
70 GDB_GS, /* 23 */
67}; 71};
68#define GDB_ORIG_AX 57 72#define GDB_ORIG_AX 57
69#define DBG_MAX_REG_NUM 20 73#define DBG_MAX_REG_NUM 24
70/* 17 64 bit regs and 3 32 bit regs */ 74/* 17 64 bit regs and 5 32 bit regs */
71#define NUMREGBYTES ((17 * 8) + (3 * 4)) 75#define NUMREGBYTES ((17 * 8) + (5 * 4))
72#endif /* ! CONFIG_X86_32 */ 76#endif /* ! CONFIG_X86_32 */
73 77
74static inline void arch_kgdb_breakpoint(void) 78static inline void arch_kgdb_breakpoint(void)
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 6aefb14cbbc..441520e4174 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -151,7 +151,7 @@ static inline void enable_p5_mce(void) {}
151 151
152void mce_setup(struct mce *m); 152void mce_setup(struct mce *m);
153void mce_log(struct mce *m); 153void mce_log(struct mce *m);
154extern struct device *mce_device[CONFIG_NR_CPUS]; 154DECLARE_PER_CPU(struct device *, mce_device);
155 155
156/* 156/*
157 * Maximum banks number. 157 * Maximum banks number.
diff --git a/arch/x86/include/asm/mrst.h b/arch/x86/include/asm/mrst.h
index 0a0a9546043..fc18bf3ce7c 100644
--- a/arch/x86/include/asm/mrst.h
+++ b/arch/x86/include/asm/mrst.h
@@ -26,8 +26,8 @@ extern struct sfi_rtc_table_entry sfi_mrtc_array[];
26 * identified via MSRs. 26 * identified via MSRs.
27 */ 27 */
28enum mrst_cpu_type { 28enum mrst_cpu_type {
29 MRST_CPU_CHIP_LINCROFT = 1, 29 /* 1 was Moorestown */
30 MRST_CPU_CHIP_PENWELL, 30 MRST_CPU_CHIP_PENWELL = 2,
31}; 31};
32 32
33extern enum mrst_cpu_type __mrst_cpu_chip; 33extern enum mrst_cpu_type __mrst_cpu_chip;
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index c0180fd372d..aa0f9130836 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -10,6 +10,7 @@
10#include <asm/paravirt_types.h> 10#include <asm/paravirt_types.h>
11 11
12#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
13#include <linux/bug.h>
13#include <linux/types.h> 14#include <linux/types.h>
14#include <linux/cpumask.h> 15#include <linux/cpumask.h>
15 16
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 58545c97d07..5533b30cac0 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -162,6 +162,7 @@ extern void early_cpu_init(void);
162extern void identify_boot_cpu(void); 162extern void identify_boot_cpu(void);
163extern void identify_secondary_cpu(struct cpuinfo_x86 *); 163extern void identify_secondary_cpu(struct cpuinfo_x86 *);
164extern void print_cpu_info(struct cpuinfo_x86 *); 164extern void print_cpu_info(struct cpuinfo_x86 *);
165void print_cpu_msr(struct cpuinfo_x86 *);
165extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c); 166extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
166extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); 167extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
167extern unsigned short num_cache_leaves; 168extern unsigned short num_cache_leaves;
@@ -474,61 +475,6 @@ struct thread_struct {
474 unsigned io_bitmap_max; 475 unsigned io_bitmap_max;
475}; 476};
476 477
477static inline unsigned long native_get_debugreg(int regno)
478{
479 unsigned long val = 0; /* Damn you, gcc! */
480
481 switch (regno) {
482 case 0:
483 asm("mov %%db0, %0" :"=r" (val));
484 break;
485 case 1:
486 asm("mov %%db1, %0" :"=r" (val));
487 break;
488 case 2:
489 asm("mov %%db2, %0" :"=r" (val));
490 break;
491 case 3:
492 asm("mov %%db3, %0" :"=r" (val));
493 break;
494 case 6:
495 asm("mov %%db6, %0" :"=r" (val));
496 break;
497 case 7:
498 asm("mov %%db7, %0" :"=r" (val));
499 break;
500 default:
501 BUG();
502 }
503 return val;
504}
505
506static inline void native_set_debugreg(int regno, unsigned long value)
507{
508 switch (regno) {
509 case 0:
510 asm("mov %0, %%db0" ::"r" (value));
511 break;
512 case 1:
513 asm("mov %0, %%db1" ::"r" (value));
514 break;
515 case 2:
516 asm("mov %0, %%db2" ::"r" (value));
517 break;
518 case 3:
519 asm("mov %0, %%db3" ::"r" (value));
520 break;
521 case 6:
522 asm("mov %0, %%db6" ::"r" (value));
523 break;
524 case 7:
525 asm("mov %0, %%db7" ::"r" (value));
526 break;
527 default:
528 BUG();
529 }
530}
531
532/* 478/*
533 * Set IOPL bits in EFLAGS from given mask 479 * Set IOPL bits in EFLAGS from given mask
534 */ 480 */
@@ -574,14 +520,6 @@ static inline void native_swapgs(void)
574#define __cpuid native_cpuid 520#define __cpuid native_cpuid
575#define paravirt_enabled() 0 521#define paravirt_enabled() 0
576 522
577/*
578 * These special macros can be used to get or set a debugging register
579 */
580#define get_debugreg(var, register) \
581 (var) = native_get_debugreg(register)
582#define set_debugreg(value, register) \
583 native_set_debugreg(register, value)
584
585static inline void load_sp0(struct tss_struct *tss, 523static inline void load_sp0(struct tss_struct *tss,
586 struct thread_struct *thread) 524 struct thread_struct *thread)
587{ 525{
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index a82c2bf504b..76bfa2cf301 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -88,14 +88,14 @@ static inline int __ticket_spin_is_locked(arch_spinlock_t *lock)
88{ 88{
89 struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets); 89 struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
90 90
91 return !!(tmp.tail ^ tmp.head); 91 return tmp.tail != tmp.head;
92} 92}
93 93
94static inline int __ticket_spin_is_contended(arch_spinlock_t *lock) 94static inline int __ticket_spin_is_contended(arch_spinlock_t *lock)
95{ 95{
96 struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets); 96 struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
97 97
98 return ((tmp.tail - tmp.head) & TICKET_MASK) > 1; 98 return (__ticket_t)(tmp.tail - tmp.head) > 1;
99} 99}
100 100
101#ifndef CONFIG_PARAVIRT_SPINLOCKS 101#ifndef CONFIG_PARAVIRT_SPINLOCKS
diff --git a/arch/x86/include/asm/spinlock_types.h b/arch/x86/include/asm/spinlock_types.h
index 8ebd5df7451..ad0ad07fc00 100644
--- a/arch/x86/include/asm/spinlock_types.h
+++ b/arch/x86/include/asm/spinlock_types.h
@@ -16,7 +16,6 @@ typedef u32 __ticketpair_t;
16#endif 16#endif
17 17
18#define TICKET_SHIFT (sizeof(__ticket_t) * 8) 18#define TICKET_SHIFT (sizeof(__ticket_t) * 8)
19#define TICKET_MASK ((__ticket_t)((1 << TICKET_SHIFT) - 1))
20 19
21typedef struct arch_spinlock { 20typedef struct arch_spinlock {
22 union { 21 union {
diff --git a/arch/x86/include/asm/xen/interface.h b/arch/x86/include/asm/xen/interface.h
index a1f2db5f117..cbf0c9d50b9 100644
--- a/arch/x86/include/asm/xen/interface.h
+++ b/arch/x86/include/asm/xen/interface.h
@@ -56,6 +56,7 @@ DEFINE_GUEST_HANDLE(int);
56DEFINE_GUEST_HANDLE(long); 56DEFINE_GUEST_HANDLE(long);
57DEFINE_GUEST_HANDLE(void); 57DEFINE_GUEST_HANDLE(void);
58DEFINE_GUEST_HANDLE(uint64_t); 58DEFINE_GUEST_HANDLE(uint64_t);
59DEFINE_GUEST_HANDLE(uint32_t);
59#endif 60#endif
60 61
61#ifndef HYPERVISOR_VIRT_START 62#ifndef HYPERVISOR_VIRT_START
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index ce664f33ea8..406ed77216d 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -593,7 +593,7 @@ void __init acpi_set_irq_model_ioapic(void)
593#ifdef CONFIG_ACPI_HOTPLUG_CPU 593#ifdef CONFIG_ACPI_HOTPLUG_CPU
594#include <acpi/processor.h> 594#include <acpi/processor.h>
595 595
596static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) 596static void __cpuinitdata acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
597{ 597{
598#ifdef CONFIG_ACPI_NUMA 598#ifdef CONFIG_ACPI_NUMA
599 int nid; 599 int nid;
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 8c3cdded6f2..359b6899a36 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -180,6 +180,7 @@ static struct apic apic_flat = {
180 .name = "flat", 180 .name = "flat",
181 .probe = flat_probe, 181 .probe = flat_probe,
182 .acpi_madt_oem_check = flat_acpi_madt_oem_check, 182 .acpi_madt_oem_check = flat_acpi_madt_oem_check,
183 .apic_id_valid = default_apic_id_valid,
183 .apic_id_registered = flat_apic_id_registered, 184 .apic_id_registered = flat_apic_id_registered,
184 185
185 .irq_delivery_mode = dest_LowestPrio, 186 .irq_delivery_mode = dest_LowestPrio,
@@ -337,6 +338,7 @@ static struct apic apic_physflat = {
337 .name = "physical flat", 338 .name = "physical flat",
338 .probe = physflat_probe, 339 .probe = physflat_probe,
339 .acpi_madt_oem_check = physflat_acpi_madt_oem_check, 340 .acpi_madt_oem_check = physflat_acpi_madt_oem_check,
341 .apic_id_valid = default_apic_id_valid,
340 .apic_id_registered = flat_apic_id_registered, 342 .apic_id_registered = flat_apic_id_registered,
341 343
342 .irq_delivery_mode = dest_Fixed, 344 .irq_delivery_mode = dest_Fixed,
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c
index 775b82bc655..634ae6cdd5c 100644
--- a/arch/x86/kernel/apic/apic_noop.c
+++ b/arch/x86/kernel/apic/apic_noop.c
@@ -124,6 +124,7 @@ struct apic apic_noop = {
124 .probe = noop_probe, 124 .probe = noop_probe,
125 .acpi_madt_oem_check = NULL, 125 .acpi_madt_oem_check = NULL,
126 126
127 .apic_id_valid = default_apic_id_valid,
127 .apic_id_registered = noop_apic_id_registered, 128 .apic_id_registered = noop_apic_id_registered,
128 129
129 .irq_delivery_mode = dest_LowestPrio, 130 .irq_delivery_mode = dest_LowestPrio,
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index 09d3d8c1cd9..d9ea5f331ac 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -56,6 +56,12 @@ static unsigned int read_xapic_id(void)
56 return get_apic_id(apic_read(APIC_ID)); 56 return get_apic_id(apic_read(APIC_ID));
57} 57}
58 58
59static int numachip_apic_id_valid(int apicid)
60{
61 /* Trust what bootloader passes in MADT */
62 return 1;
63}
64
59static int numachip_apic_id_registered(void) 65static int numachip_apic_id_registered(void)
60{ 66{
61 return physid_isset(read_xapic_id(), phys_cpu_present_map); 67 return physid_isset(read_xapic_id(), phys_cpu_present_map);
@@ -223,10 +229,11 @@ static int __init numachip_system_init(void)
223} 229}
224early_initcall(numachip_system_init); 230early_initcall(numachip_system_init);
225 231
226static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) 232static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
227{ 233{
228 if (!strncmp(oem_id, "NUMASC", 6)) { 234 if (!strncmp(oem_id, "NUMASC", 6)) {
229 numachip_system = 1; 235 numachip_system = 1;
236 setup_force_cpu_cap(X86_FEATURE_X2APIC);
230 return 1; 237 return 1;
231 } 238 }
232 239
@@ -238,6 +245,7 @@ static struct apic apic_numachip __refconst = {
238 .name = "NumaConnect system", 245 .name = "NumaConnect system",
239 .probe = numachip_probe, 246 .probe = numachip_probe,
240 .acpi_madt_oem_check = numachip_acpi_madt_oem_check, 247 .acpi_madt_oem_check = numachip_acpi_madt_oem_check,
248 .apic_id_valid = numachip_apic_id_valid,
241 .apic_id_registered = numachip_apic_id_registered, 249 .apic_id_registered = numachip_apic_id_registered,
242 250
243 .irq_delivery_mode = dest_Fixed, 251 .irq_delivery_mode = dest_Fixed,
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c
index 521bead0113..0cdec7065af 100644
--- a/arch/x86/kernel/apic/bigsmp_32.c
+++ b/arch/x86/kernel/apic/bigsmp_32.c
@@ -198,6 +198,7 @@ static struct apic apic_bigsmp = {
198 .name = "bigsmp", 198 .name = "bigsmp",
199 .probe = probe_bigsmp, 199 .probe = probe_bigsmp,
200 .acpi_madt_oem_check = NULL, 200 .acpi_madt_oem_check = NULL,
201 .apic_id_valid = default_apic_id_valid,
201 .apic_id_registered = bigsmp_apic_id_registered, 202 .apic_id_registered = bigsmp_apic_id_registered,
202 203
203 .irq_delivery_mode = dest_Fixed, 204 .irq_delivery_mode = dest_Fixed,
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c
index 5d513bc47b6..e42d1d3b913 100644
--- a/arch/x86/kernel/apic/es7000_32.c
+++ b/arch/x86/kernel/apic/es7000_32.c
@@ -625,6 +625,7 @@ static struct apic __refdata apic_es7000_cluster = {
625 .name = "es7000", 625 .name = "es7000",
626 .probe = probe_es7000, 626 .probe = probe_es7000,
627 .acpi_madt_oem_check = es7000_acpi_madt_oem_check_cluster, 627 .acpi_madt_oem_check = es7000_acpi_madt_oem_check_cluster,
628 .apic_id_valid = default_apic_id_valid,
628 .apic_id_registered = es7000_apic_id_registered, 629 .apic_id_registered = es7000_apic_id_registered,
629 630
630 .irq_delivery_mode = dest_LowestPrio, 631 .irq_delivery_mode = dest_LowestPrio,
@@ -690,6 +691,7 @@ static struct apic __refdata apic_es7000 = {
690 .name = "es7000", 691 .name = "es7000",
691 .probe = probe_es7000, 692 .probe = probe_es7000,
692 .acpi_madt_oem_check = es7000_acpi_madt_oem_check, 693 .acpi_madt_oem_check = es7000_acpi_madt_oem_check,
694 .apic_id_valid = default_apic_id_valid,
693 .apic_id_registered = es7000_apic_id_registered, 695 .apic_id_registered = es7000_apic_id_registered,
694 696
695 .irq_delivery_mode = dest_Fixed, 697 .irq_delivery_mode = dest_Fixed,
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index fb072754bc1..6d10a66fc5a 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3967,18 +3967,36 @@ int mp_find_ioapic_pin(int ioapic, u32 gsi)
3967static __init int bad_ioapic(unsigned long address) 3967static __init int bad_ioapic(unsigned long address)
3968{ 3968{
3969 if (nr_ioapics >= MAX_IO_APICS) { 3969 if (nr_ioapics >= MAX_IO_APICS) {
3970 printk(KERN_WARNING "WARNING: Max # of I/O APICs (%d) exceeded " 3970 pr_warn("WARNING: Max # of I/O APICs (%d) exceeded (found %d), skipping\n",
3971 "(found %d), skipping\n", MAX_IO_APICS, nr_ioapics); 3971 MAX_IO_APICS, nr_ioapics);
3972 return 1; 3972 return 1;
3973 } 3973 }
3974 if (!address) { 3974 if (!address) {
3975 printk(KERN_WARNING "WARNING: Bogus (zero) I/O APIC address" 3975 pr_warn("WARNING: Bogus (zero) I/O APIC address found in table, skipping!\n");
3976 " found in table, skipping!\n");
3977 return 1; 3976 return 1;
3978 } 3977 }
3979 return 0; 3978 return 0;
3980} 3979}
3981 3980
3981static __init int bad_ioapic_register(int idx)
3982{
3983 union IO_APIC_reg_00 reg_00;
3984 union IO_APIC_reg_01 reg_01;
3985 union IO_APIC_reg_02 reg_02;
3986
3987 reg_00.raw = io_apic_read(idx, 0);
3988 reg_01.raw = io_apic_read(idx, 1);
3989 reg_02.raw = io_apic_read(idx, 2);
3990
3991 if (reg_00.raw == -1 && reg_01.raw == -1 && reg_02.raw == -1) {
3992 pr_warn("I/O APIC 0x%x registers return all ones, skipping!\n",
3993 mpc_ioapic_addr(idx));
3994 return 1;
3995 }
3996
3997 return 0;
3998}
3999
3982void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) 4000void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
3983{ 4001{
3984 int idx = 0; 4002 int idx = 0;
@@ -3995,6 +4013,12 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
3995 ioapics[idx].mp_config.apicaddr = address; 4013 ioapics[idx].mp_config.apicaddr = address;
3996 4014
3997 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); 4015 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
4016
4017 if (bad_ioapic_register(idx)) {
4018 clear_fixmap(FIX_IO_APIC_BASE_0 + idx);
4019 return;
4020 }
4021
3998 ioapics[idx].mp_config.apicid = io_apic_unique_id(id); 4022 ioapics[idx].mp_config.apicid = io_apic_unique_id(id);
3999 ioapics[idx].mp_config.apicver = io_apic_get_version(idx); 4023 ioapics[idx].mp_config.apicver = io_apic_get_version(idx);
4000 4024
@@ -4015,10 +4039,10 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
4015 if (gsi_cfg->gsi_end >= gsi_top) 4039 if (gsi_cfg->gsi_end >= gsi_top)
4016 gsi_top = gsi_cfg->gsi_end + 1; 4040 gsi_top = gsi_cfg->gsi_end + 1;
4017 4041
4018 printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " 4042 pr_info("IOAPIC[%d]: apic_id %d, version %d, address 0x%x, GSI %d-%d\n",
4019 "GSI %d-%d\n", idx, mpc_ioapic_id(idx), 4043 idx, mpc_ioapic_id(idx),
4020 mpc_ioapic_ver(idx), mpc_ioapic_addr(idx), 4044 mpc_ioapic_ver(idx), mpc_ioapic_addr(idx),
4021 gsi_cfg->gsi_base, gsi_cfg->gsi_end); 4045 gsi_cfg->gsi_base, gsi_cfg->gsi_end);
4022 4046
4023 nr_ioapics++; 4047 nr_ioapics++;
4024} 4048}
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c
index c4a61ca1349..00d2422ca7c 100644
--- a/arch/x86/kernel/apic/numaq_32.c
+++ b/arch/x86/kernel/apic/numaq_32.c
@@ -478,6 +478,7 @@ static struct apic __refdata apic_numaq = {
478 .name = "NUMAQ", 478 .name = "NUMAQ",
479 .probe = probe_numaq, 479 .probe = probe_numaq,
480 .acpi_madt_oem_check = NULL, 480 .acpi_madt_oem_check = NULL,
481 .apic_id_valid = default_apic_id_valid,
481 .apic_id_registered = numaq_apic_id_registered, 482 .apic_id_registered = numaq_apic_id_registered,
482 483
483 .irq_delivery_mode = dest_LowestPrio, 484 .irq_delivery_mode = dest_LowestPrio,
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index 0787bb3412f..ff2c1b9aac4 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -92,6 +92,7 @@ static struct apic apic_default = {
92 .name = "default", 92 .name = "default",
93 .probe = probe_default, 93 .probe = probe_default,
94 .acpi_madt_oem_check = NULL, 94 .acpi_madt_oem_check = NULL,
95 .apic_id_valid = default_apic_id_valid,
95 .apic_id_registered = default_apic_id_registered, 96 .apic_id_registered = default_apic_id_registered,
96 97
97 .irq_delivery_mode = dest_LowestPrio, 98 .irq_delivery_mode = dest_LowestPrio,
diff --git a/arch/x86/kernel/apic/summit_32.c b/arch/x86/kernel/apic/summit_32.c
index 19114423c58..fea000b27f0 100644
--- a/arch/x86/kernel/apic/summit_32.c
+++ b/arch/x86/kernel/apic/summit_32.c
@@ -496,6 +496,7 @@ static struct apic apic_summit = {
496 .name = "summit", 496 .name = "summit",
497 .probe = probe_summit, 497 .probe = probe_summit,
498 .acpi_madt_oem_check = summit_acpi_madt_oem_check, 498 .acpi_madt_oem_check = summit_acpi_madt_oem_check,
499 .apic_id_valid = default_apic_id_valid,
499 .apic_id_registered = summit_apic_id_registered, 500 .apic_id_registered = summit_apic_id_registered,
500 501
501 .irq_delivery_mode = dest_LowestPrio, 502 .irq_delivery_mode = dest_LowestPrio,
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index 50079587582..9193713060a 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -213,6 +213,7 @@ static struct apic apic_x2apic_cluster = {
213 .name = "cluster x2apic", 213 .name = "cluster x2apic",
214 .probe = x2apic_cluster_probe, 214 .probe = x2apic_cluster_probe,
215 .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, 215 .acpi_madt_oem_check = x2apic_acpi_madt_oem_check,
216 .apic_id_valid = default_apic_id_valid,
216 .apic_id_registered = x2apic_apic_id_registered, 217 .apic_id_registered = x2apic_apic_id_registered,
217 218
218 .irq_delivery_mode = dest_LowestPrio, 219 .irq_delivery_mode = dest_LowestPrio,
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c
index f5373dfde21..bcd1db6eaca 100644
--- a/arch/x86/kernel/apic/x2apic_phys.c
+++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -119,6 +119,7 @@ static struct apic apic_x2apic_phys = {
119 .name = "physical x2apic", 119 .name = "physical x2apic",
120 .probe = x2apic_phys_probe, 120 .probe = x2apic_phys_probe,
121 .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, 121 .acpi_madt_oem_check = x2apic_acpi_madt_oem_check,
122 .apic_id_valid = default_apic_id_valid,
122 .apic_id_registered = x2apic_apic_id_registered, 123 .apic_id_registered = x2apic_apic_id_registered,
123 124
124 .irq_delivery_mode = dest_Fixed, 125 .irq_delivery_mode = dest_Fixed,
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 79b05b88aa1..fc477142585 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -351,6 +351,7 @@ static struct apic __refdata apic_x2apic_uv_x = {
351 .name = "UV large system", 351 .name = "UV large system",
352 .probe = uv_probe, 352 .probe = uv_probe,
353 .acpi_madt_oem_check = uv_acpi_madt_oem_check, 353 .acpi_madt_oem_check = uv_acpi_madt_oem_check,
354 .apic_id_valid = default_apic_id_valid,
354 .apic_id_registered = uv_apic_id_registered, 355 .apic_id_registered = uv_apic_id_registered,
355 356
356 .irq_delivery_mode = dest_Fixed, 357 .irq_delivery_mode = dest_Fixed,
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index c0f7d68d318..e49477444ff 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -18,6 +18,7 @@
18#include <asm/archrandom.h> 18#include <asm/archrandom.h>
19#include <asm/hypervisor.h> 19#include <asm/hypervisor.h>
20#include <asm/processor.h> 20#include <asm/processor.h>
21#include <asm/debugreg.h>
21#include <asm/sections.h> 22#include <asm/sections.h>
22#include <linux/topology.h> 23#include <linux/topology.h>
23#include <linux/cpumask.h> 24#include <linux/cpumask.h>
@@ -28,6 +29,7 @@
28#include <asm/apic.h> 29#include <asm/apic.h>
29#include <asm/desc.h> 30#include <asm/desc.h>
30#include <asm/i387.h> 31#include <asm/i387.h>
32#include <asm/fpu-internal.h>
31#include <asm/mtrr.h> 33#include <asm/mtrr.h>
32#include <linux/numa.h> 34#include <linux/numa.h>
33#include <asm/asm.h> 35#include <asm/asm.h>
@@ -933,7 +935,7 @@ static const struct msr_range msr_range_array[] __cpuinitconst = {
933 { 0xc0011000, 0xc001103b}, 935 { 0xc0011000, 0xc001103b},
934}; 936};
935 937
936static void __cpuinit print_cpu_msr(void) 938static void __cpuinit __print_cpu_msr(void)
937{ 939{
938 unsigned index_min, index_max; 940 unsigned index_min, index_max;
939 unsigned index; 941 unsigned index;
@@ -997,13 +999,13 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
997 else 999 else
998 printk(KERN_CONT "\n"); 1000 printk(KERN_CONT "\n");
999 1001
1000#ifdef CONFIG_SMP 1002 __print_cpu_msr();
1003}
1004
1005void __cpuinit print_cpu_msr(struct cpuinfo_x86 *c)
1006{
1001 if (c->cpu_index < show_msr) 1007 if (c->cpu_index < show_msr)
1002 print_cpu_msr(); 1008 __print_cpu_msr();
1003#else
1004 if (show_msr)
1005 print_cpu_msr();
1006#endif
1007} 1009}
1008 1010
1009static __init int setup_disablecpuid(char *arg) 1011static __init int setup_disablecpuid(char *arg)
@@ -1045,7 +1047,6 @@ DEFINE_PER_CPU(char *, irq_stack_ptr) =
1045DEFINE_PER_CPU(unsigned int, irq_count) = -1; 1047DEFINE_PER_CPU(unsigned int, irq_count) = -1;
1046 1048
1047DEFINE_PER_CPU(struct task_struct *, fpu_owner_task); 1049DEFINE_PER_CPU(struct task_struct *, fpu_owner_task);
1048EXPORT_PER_CPU_SYMBOL(fpu_owner_task);
1049 1050
1050/* 1051/*
1051 * Special IST stacks which the CPU switches to when it calls 1052 * Special IST stacks which the CPU switches to when it calls
@@ -1115,7 +1116,6 @@ void debug_stack_reset(void)
1115DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; 1116DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task;
1116EXPORT_PER_CPU_SYMBOL(current_task); 1117EXPORT_PER_CPU_SYMBOL(current_task);
1117DEFINE_PER_CPU(struct task_struct *, fpu_owner_task); 1118DEFINE_PER_CPU(struct task_struct *, fpu_owner_task);
1118EXPORT_PER_CPU_SYMBOL(fpu_owner_task);
1119 1119
1120#ifdef CONFIG_CC_STACKPROTECTOR 1120#ifdef CONFIG_CC_STACKPROTECTOR
1121DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary); 1121DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);
diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c
index 7395d5f4272..0c82091b165 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
@@ -54,7 +54,14 @@ static struct severity {
54#define MASK(x, y) .mask = x, .result = y 54#define MASK(x, y) .mask = x, .result = y
55#define MCI_UC_S (MCI_STATUS_UC|MCI_STATUS_S) 55#define MCI_UC_S (MCI_STATUS_UC|MCI_STATUS_S)
56#define MCI_UC_SAR (MCI_STATUS_UC|MCI_STATUS_S|MCI_STATUS_AR) 56#define MCI_UC_SAR (MCI_STATUS_UC|MCI_STATUS_S|MCI_STATUS_AR)
57#define MCI_ADDR (MCI_STATUS_ADDRV|MCI_STATUS_MISCV)
57#define MCACOD 0xffff 58#define MCACOD 0xffff
59/* Architecturally defined codes from SDM Vol. 3B Chapter 15 */
60#define MCACOD_SCRUB 0x00C0 /* 0xC0-0xCF Memory Scrubbing */
61#define MCACOD_SCRUBMSK 0xfff0
62#define MCACOD_L3WB 0x017A /* L3 Explicit Writeback */
63#define MCACOD_DATA 0x0134 /* Data Load */
64#define MCACOD_INSTR 0x0150 /* Instruction Fetch */
58 65
59 MCESEV( 66 MCESEV(
60 NO, "Invalid", 67 NO, "Invalid",
@@ -102,11 +109,24 @@ static struct severity {
102 SER, BITCLR(MCI_STATUS_S) 109 SER, BITCLR(MCI_STATUS_S)
103 ), 110 ),
104 111
105 /* AR add known MCACODs here */
106 MCESEV( 112 MCESEV(
107 PANIC, "Action required with lost events", 113 PANIC, "Action required with lost events",
108 SER, BITSET(MCI_STATUS_OVER|MCI_UC_SAR) 114 SER, BITSET(MCI_STATUS_OVER|MCI_UC_SAR)
109 ), 115 ),
116
117 /* known AR MCACODs: */
118#ifdef CONFIG_MEMORY_FAILURE
119 MCESEV(
120 KEEP, "HT thread notices Action required: data load error",
121 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_DATA),
122 MCGMASK(MCG_STATUS_EIPV, 0)
123 ),
124 MCESEV(
125 AR, "Action required: data load error",
126 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_DATA),
127 USER
128 ),
129#endif
110 MCESEV( 130 MCESEV(
111 PANIC, "Action required: unknown MCACOD", 131 PANIC, "Action required: unknown MCACOD",
112 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_SAR) 132 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_SAR)
@@ -115,11 +135,11 @@ static struct severity {
115 /* known AO MCACODs: */ 135 /* known AO MCACODs: */
116 MCESEV( 136 MCESEV(
117 AO, "Action optional: memory scrubbing error", 137 AO, "Action optional: memory scrubbing error",
118 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|0xfff0, MCI_UC_S|0x00c0) 138 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCACOD_SCRUBMSK, MCI_UC_S|MCACOD_SCRUB)
119 ), 139 ),
120 MCESEV( 140 MCESEV(
121 AO, "Action optional: last level cache writeback error", 141 AO, "Action optional: last level cache writeback error",
122 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCACOD, MCI_UC_S|0x017a) 142 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCACOD, MCI_UC_S|MCACOD_L3WB)
123 ), 143 ),
124 MCESEV( 144 MCESEV(
125 SOME, "Action optional: unknown MCACOD", 145 SOME, "Action optional: unknown MCACOD",
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 5a11ae2e9e9..d086a09c087 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -191,7 +191,7 @@ static void drain_mcelog_buffer(void)
191{ 191{
192 unsigned int next, i, prev = 0; 192 unsigned int next, i, prev = 0;
193 193
194 next = rcu_dereference_check_mce(mcelog.next); 194 next = ACCESS_ONCE(mcelog.next);
195 195
196 do { 196 do {
197 struct mce *m; 197 struct mce *m;
@@ -540,6 +540,27 @@ static void mce_report_event(struct pt_regs *regs)
540 irq_work_queue(&__get_cpu_var(mce_irq_work)); 540 irq_work_queue(&__get_cpu_var(mce_irq_work));
541} 541}
542 542
543/*
544 * Read ADDR and MISC registers.
545 */
546static void mce_read_aux(struct mce *m, int i)
547{
548 if (m->status & MCI_STATUS_MISCV)
549 m->misc = mce_rdmsrl(MSR_IA32_MCx_MISC(i));
550 if (m->status & MCI_STATUS_ADDRV) {
551 m->addr = mce_rdmsrl(MSR_IA32_MCx_ADDR(i));
552
553 /*
554 * Mask the reported address by the reported granularity.
555 */
556 if (mce_ser && (m->status & MCI_STATUS_MISCV)) {
557 u8 shift = MCI_MISC_ADDR_LSB(m->misc);
558 m->addr >>= shift;
559 m->addr <<= shift;
560 }
561 }
562}
563
543DEFINE_PER_CPU(unsigned, mce_poll_count); 564DEFINE_PER_CPU(unsigned, mce_poll_count);
544 565
545/* 566/*
@@ -590,10 +611,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
590 (m.status & (mce_ser ? MCI_STATUS_S : MCI_STATUS_UC))) 611 (m.status & (mce_ser ? MCI_STATUS_S : MCI_STATUS_UC)))
591 continue; 612 continue;
592 613
593 if (m.status & MCI_STATUS_MISCV) 614 mce_read_aux(&m, i);
594 m.misc = mce_rdmsrl(MSR_IA32_MCx_MISC(i));
595 if (m.status & MCI_STATUS_ADDRV)
596 m.addr = mce_rdmsrl(MSR_IA32_MCx_ADDR(i));
597 615
598 if (!(flags & MCP_TIMESTAMP)) 616 if (!(flags & MCP_TIMESTAMP))
599 m.tsc = 0; 617 m.tsc = 0;
@@ -917,6 +935,49 @@ static void mce_clear_state(unsigned long *toclear)
917} 935}
918 936
919/* 937/*
938 * Need to save faulting physical address associated with a process
939 * in the machine check handler some place where we can grab it back
940 * later in mce_notify_process()
941 */
942#define MCE_INFO_MAX 16
943
944struct mce_info {
945 atomic_t inuse;
946 struct task_struct *t;
947 __u64 paddr;
948} mce_info[MCE_INFO_MAX];
949
950static void mce_save_info(__u64 addr)
951{
952 struct mce_info *mi;
953
954 for (mi = mce_info; mi < &mce_info[MCE_INFO_MAX]; mi++) {
955 if (atomic_cmpxchg(&mi->inuse, 0, 1) == 0) {
956 mi->t = current;
957 mi->paddr = addr;
958 return;
959 }
960 }
961
962 mce_panic("Too many concurrent recoverable errors", NULL, NULL);
963}
964
965static struct mce_info *mce_find_info(void)
966{
967 struct mce_info *mi;
968
969 for (mi = mce_info; mi < &mce_info[MCE_INFO_MAX]; mi++)
970 if (atomic_read(&mi->inuse) && mi->t == current)
971 return mi;
972 return NULL;
973}
974
975static void mce_clear_info(struct mce_info *mi)
976{
977 atomic_set(&mi->inuse, 0);
978}
979
980/*
920 * The actual machine check handler. This only handles real 981 * The actual machine check handler. This only handles real
921 * exceptions when something got corrupted coming in through int 18. 982 * exceptions when something got corrupted coming in through int 18.
922 * 983 *
@@ -969,7 +1030,9 @@ void do_machine_check(struct pt_regs *regs, long error_code)
969 barrier(); 1030 barrier();
970 1031
971 /* 1032 /*
972 * When no restart IP must always kill or panic. 1033 * When no restart IP might need to kill or panic.
1034 * Assume the worst for now, but if we find the
1035 * severity is MCE_AR_SEVERITY we have other options.
973 */ 1036 */
974 if (!(m.mcgstatus & MCG_STATUS_RIPV)) 1037 if (!(m.mcgstatus & MCG_STATUS_RIPV))
975 kill_it = 1; 1038 kill_it = 1;
@@ -1023,16 +1086,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1023 continue; 1086 continue;
1024 } 1087 }
1025 1088
1026 /* 1089 mce_read_aux(&m, i);
1027 * Kill on action required.
1028 */
1029 if (severity == MCE_AR_SEVERITY)
1030 kill_it = 1;
1031
1032 if (m.status & MCI_STATUS_MISCV)
1033 m.misc = mce_rdmsrl(MSR_IA32_MCx_MISC(i));
1034 if (m.status & MCI_STATUS_ADDRV)
1035 m.addr = mce_rdmsrl(MSR_IA32_MCx_ADDR(i));
1036 1090
1037 /* 1091 /*
1038 * Action optional error. Queue address for later processing. 1092 * Action optional error. Queue address for later processing.
@@ -1052,6 +1106,9 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1052 } 1106 }
1053 } 1107 }
1054 1108
1109 /* mce_clear_state will clear *final, save locally for use later */
1110 m = *final;
1111
1055 if (!no_way_out) 1112 if (!no_way_out)
1056 mce_clear_state(toclear); 1113 mce_clear_state(toclear);
1057 1114
@@ -1063,27 +1120,22 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1063 no_way_out = worst >= MCE_PANIC_SEVERITY; 1120 no_way_out = worst >= MCE_PANIC_SEVERITY;
1064 1121
1065 /* 1122 /*
1066 * If we have decided that we just CAN'T continue, and the user 1123 * At insane "tolerant" levels we take no action. Otherwise
1067 * has not set tolerant to an insane level, give up and die. 1124 * we only die if we have no other choice. For less serious
1068 * 1125 * issues we try to recover, or limit damage to the current
1069 * This is mainly used in the case when the system doesn't 1126 * process.
1070 * support MCE broadcasting or it has been disabled.
1071 */
1072 if (no_way_out && tolerant < 3)
1073 mce_panic("Fatal machine check on current CPU", final, msg);
1074
1075 /*
1076 * If the error seems to be unrecoverable, something should be
1077 * done. Try to kill as little as possible. If we can kill just
1078 * one task, do that. If the user has set the tolerance very
1079 * high, don't try to do anything at all.
1080 */ 1127 */
1081 1128 if (tolerant < 3) {
1082 if (kill_it && tolerant < 3) 1129 if (no_way_out)
1083 force_sig(SIGBUS, current); 1130 mce_panic("Fatal machine check on current CPU", &m, msg);
1084 1131 if (worst == MCE_AR_SEVERITY) {
1085 /* notify userspace ASAP */ 1132 /* schedule action before return to userland */
1086 set_thread_flag(TIF_MCE_NOTIFY); 1133 mce_save_info(m.addr);
1134 set_thread_flag(TIF_MCE_NOTIFY);
1135 } else if (kill_it) {
1136 force_sig(SIGBUS, current);
1137 }
1138 }
1087 1139
1088 if (worst > 0) 1140 if (worst > 0)
1089 mce_report_event(regs); 1141 mce_report_event(regs);
@@ -1094,34 +1146,57 @@ out:
1094} 1146}
1095EXPORT_SYMBOL_GPL(do_machine_check); 1147EXPORT_SYMBOL_GPL(do_machine_check);
1096 1148
1097/* dummy to break dependency. actual code is in mm/memory-failure.c */ 1149#ifndef CONFIG_MEMORY_FAILURE
1098void __attribute__((weak)) memory_failure(unsigned long pfn, int vector) 1150int memory_failure(unsigned long pfn, int vector, int flags)
1099{ 1151{
1100 printk(KERN_ERR "Action optional memory failure at %lx ignored\n", pfn); 1152 /* mce_severity() should not hand us an ACTION_REQUIRED error */
1153 BUG_ON(flags & MF_ACTION_REQUIRED);
1154 printk(KERN_ERR "Uncorrected memory error in page 0x%lx ignored\n"
1155 "Rebuild kernel with CONFIG_MEMORY_FAILURE=y for smarter handling\n", pfn);
1156
1157 return 0;
1101} 1158}
1159#endif
1102 1160
1103/* 1161/*
1104 * Called after mce notification in process context. This code 1162 * Called in process context that interrupted by MCE and marked with
1105 * is allowed to sleep. Call the high level VM handler to process 1163 * TIF_MCE_NOTIFY, just before returning to erroneous userland.
1106 * any corrupted pages. 1164 * This code is allowed to sleep.
1107 * Assume that the work queue code only calls this one at a time 1165 * Attempt possible recovery such as calling the high level VM handler to
1108 * per CPU. 1166 * process any corrupted pages, and kill/signal current process if required.
1109 * Note we don't disable preemption, so this code might run on the wrong 1167 * Action required errors are handled here.
1110 * CPU. In this case the event is picked up by the scheduled work queue.
1111 * This is merely a fast path to expedite processing in some common
1112 * cases.
1113 */ 1168 */
1114void mce_notify_process(void) 1169void mce_notify_process(void)
1115{ 1170{
1116 unsigned long pfn; 1171 unsigned long pfn;
1117 mce_notify_irq(); 1172 struct mce_info *mi = mce_find_info();
1118 while (mce_ring_get(&pfn)) 1173
1119 memory_failure(pfn, MCE_VECTOR); 1174 if (!mi)
1175 mce_panic("Lost physical address for unconsumed uncorrectable error", NULL, NULL);
1176 pfn = mi->paddr >> PAGE_SHIFT;
1177
1178 clear_thread_flag(TIF_MCE_NOTIFY);
1179
1180 pr_err("Uncorrected hardware memory error in user-access at %llx",
1181 mi->paddr);
1182 if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0) {
1183 pr_err("Memory error not recovered");
1184 force_sig(SIGBUS, current);
1185 }
1186 mce_clear_info(mi);
1120} 1187}
1121 1188
1189/*
1190 * Action optional processing happens here (picking up
1191 * from the list of faulting pages that do_machine_check()
1192 * placed into the "ring").
1193 */
1122static void mce_process_work(struct work_struct *dummy) 1194static void mce_process_work(struct work_struct *dummy)
1123{ 1195{
1124 mce_notify_process(); 1196 unsigned long pfn;
1197
1198 while (mce_ring_get(&pfn))
1199 memory_failure(pfn, MCE_VECTOR, 0);
1125} 1200}
1126 1201
1127#ifdef CONFIG_X86_MCE_INTEL 1202#ifdef CONFIG_X86_MCE_INTEL
@@ -1211,8 +1286,6 @@ int mce_notify_irq(void)
1211 /* Not more than two messages every minute */ 1286 /* Not more than two messages every minute */
1212 static DEFINE_RATELIMIT_STATE(ratelimit, 60*HZ, 2); 1287 static DEFINE_RATELIMIT_STATE(ratelimit, 60*HZ, 2);
1213 1288
1214 clear_thread_flag(TIF_MCE_NOTIFY);
1215
1216 if (test_and_clear_bit(0, &mce_need_notify)) { 1289 if (test_and_clear_bit(0, &mce_need_notify)) {
1217 /* wake processes polling /dev/mcelog */ 1290 /* wake processes polling /dev/mcelog */
1218 wake_up_interruptible(&mce_chrdev_wait); 1291 wake_up_interruptible(&mce_chrdev_wait);
@@ -1541,6 +1614,12 @@ static int __mce_read_apei(char __user **ubuf, size_t usize)
1541 /* Error or no more MCE record */ 1614 /* Error or no more MCE record */
1542 if (rc <= 0) { 1615 if (rc <= 0) {
1543 mce_apei_read_done = 1; 1616 mce_apei_read_done = 1;
1617 /*
1618 * When ERST is disabled, mce_chrdev_read() should return
1619 * "no record" instead of "no device."
1620 */
1621 if (rc == -ENODEV)
1622 return 0;
1544 return rc; 1623 return rc;
1545 } 1624 }
1546 rc = -EFAULT; 1625 rc = -EFAULT;
@@ -1859,7 +1938,7 @@ static struct bus_type mce_subsys = {
1859 .dev_name = "machinecheck", 1938 .dev_name = "machinecheck",
1860}; 1939};
1861 1940
1862struct device *mce_device[CONFIG_NR_CPUS]; 1941DEFINE_PER_CPU(struct device *, mce_device);
1863 1942
1864__cpuinitdata 1943__cpuinitdata
1865void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu); 1944void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
@@ -2038,7 +2117,7 @@ static __cpuinit int mce_device_create(unsigned int cpu)
2038 goto error2; 2117 goto error2;
2039 } 2118 }
2040 cpumask_set_cpu(cpu, mce_device_initialized); 2119 cpumask_set_cpu(cpu, mce_device_initialized);
2041 mce_device[cpu] = dev; 2120 per_cpu(mce_device, cpu) = dev;
2042 2121
2043 return 0; 2122 return 0;
2044error2: 2123error2:
@@ -2055,7 +2134,7 @@ error:
2055 2134
2056static __cpuinit void mce_device_remove(unsigned int cpu) 2135static __cpuinit void mce_device_remove(unsigned int cpu)
2057{ 2136{
2058 struct device *dev = mce_device[cpu]; 2137 struct device *dev = per_cpu(mce_device, cpu);
2059 int i; 2138 int i;
2060 2139
2061 if (!cpumask_test_cpu(cpu, mce_device_initialized)) 2140 if (!cpumask_test_cpu(cpu, mce_device_initialized))
@@ -2069,7 +2148,7 @@ static __cpuinit void mce_device_remove(unsigned int cpu)
2069 2148
2070 device_unregister(dev); 2149 device_unregister(dev);
2071 cpumask_clear_cpu(cpu, mce_device_initialized); 2150 cpumask_clear_cpu(cpu, mce_device_initialized);
2072 mce_device[cpu] = NULL; 2151 per_cpu(mce_device, cpu) = NULL;
2073} 2152}
2074 2153
2075/* Make sure there are no machine checks on offlined CPUs. */ 2154/* Make sure there are no machine checks on offlined CPUs. */
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index e4eeaaf58a4..99b57179f91 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -523,7 +523,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
523{ 523{
524 int i, err = 0; 524 int i, err = 0;
525 struct threshold_bank *b = NULL; 525 struct threshold_bank *b = NULL;
526 struct device *dev = mce_device[cpu]; 526 struct device *dev = per_cpu(mce_device, cpu);
527 char name[32]; 527 char name[32];
528 528
529 sprintf(name, "threshold_bank%i", bank); 529 sprintf(name, "threshold_bank%i", bank);
@@ -587,7 +587,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
587 if (i == cpu) 587 if (i == cpu)
588 continue; 588 continue;
589 589
590 dev = mce_device[i]; 590 dev = per_cpu(mce_device, i);
591 if (dev) 591 if (dev)
592 err = sysfs_create_link(&dev->kobj,b->kobj, name); 592 err = sysfs_create_link(&dev->kobj,b->kobj, name);
593 if (err) 593 if (err)
@@ -667,7 +667,8 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
667#ifdef CONFIG_SMP 667#ifdef CONFIG_SMP
668 /* sibling symlink */ 668 /* sibling symlink */
669 if (shared_bank[bank] && b->blocks->cpu != cpu) { 669 if (shared_bank[bank] && b->blocks->cpu != cpu) {
670 sysfs_remove_link(&mce_device[cpu]->kobj, name); 670 dev = per_cpu(mce_device, cpu);
671 sysfs_remove_link(&dev->kobj, name);
671 per_cpu(threshold_banks, cpu)[bank] = NULL; 672 per_cpu(threshold_banks, cpu)[bank] = NULL;
672 673
673 return; 674 return;
@@ -679,7 +680,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
679 if (i == cpu) 680 if (i == cpu)
680 continue; 681 continue;
681 682
682 dev = mce_device[i]; 683 dev = per_cpu(mce_device, i);
683 if (dev) 684 if (dev)
684 sysfs_remove_link(&dev->kobj, name); 685 sysfs_remove_link(&dev->kobj, name);
685 per_cpu(threshold_banks, i)[bank] = NULL; 686 per_cpu(threshold_banks, i)[bank] = NULL;
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 0a18d16cb58..fa2900c0e39 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -643,14 +643,14 @@ static bool __perf_sched_find_counter(struct perf_sched *sched)
643 /* Prefer fixed purpose counters */ 643 /* Prefer fixed purpose counters */
644 if (x86_pmu.num_counters_fixed) { 644 if (x86_pmu.num_counters_fixed) {
645 idx = X86_PMC_IDX_FIXED; 645 idx = X86_PMC_IDX_FIXED;
646 for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_MAX) { 646 for_each_set_bit_from(idx, c->idxmsk, X86_PMC_IDX_MAX) {
647 if (!__test_and_set_bit(idx, sched->state.used)) 647 if (!__test_and_set_bit(idx, sched->state.used))
648 goto done; 648 goto done;
649 } 649 }
650 } 650 }
651 /* Grab the first unused counter starting with idx */ 651 /* Grab the first unused counter starting with idx */
652 idx = sched->state.counter; 652 idx = sched->state.counter;
653 for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_FIXED) { 653 for_each_set_bit_from(idx, c->idxmsk, X86_PMC_IDX_FIXED) {
654 if (!__test_and_set_bit(idx, sched->state.used)) 654 if (!__test_and_set_bit(idx, sched->state.used))
655 goto done; 655 goto done;
656 } 656 }
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index c99f9ed013d..88ec9129271 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -87,7 +87,7 @@ void show_registers(struct pt_regs *regs)
87 int i; 87 int i;
88 88
89 print_modules(); 89 print_modules();
90 __show_regs(regs, 0); 90 __show_regs(regs, !user_mode_vm(regs));
91 91
92 printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)\n", 92 printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)\n",
93 TASK_COMM_LEN, current->comm, task_pid_nr(current), 93 TASK_COMM_LEN, current->comm, task_pid_nr(current),
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 79d97e68f04..7b784f4ef1e 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -98,12 +98,6 @@
98#endif 98#endif
99.endm 99.endm
100 100
101#ifdef CONFIG_VM86
102#define resume_userspace_sig check_userspace
103#else
104#define resume_userspace_sig resume_userspace
105#endif
106
107/* 101/*
108 * User gs save/restore 102 * User gs save/restore
109 * 103 *
@@ -327,10 +321,19 @@ ret_from_exception:
327 preempt_stop(CLBR_ANY) 321 preempt_stop(CLBR_ANY)
328ret_from_intr: 322ret_from_intr:
329 GET_THREAD_INFO(%ebp) 323 GET_THREAD_INFO(%ebp)
330check_userspace: 324resume_userspace_sig:
325#ifdef CONFIG_VM86
331 movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS 326 movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS
332 movb PT_CS(%esp), %al 327 movb PT_CS(%esp), %al
333 andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax 328 andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
329#else
330 /*
331 * We can be coming here from a syscall done in the kernel space,
332 * e.g. a failed kernel_execve().
333 */
334 movl PT_CS(%esp), %eax
335 andl $SEGMENT_RPL_MASK, %eax
336#endif
334 cmpl $USER_RPL, %eax 337 cmpl $USER_RPL, %eax
335 jb resume_kernel # not returning to v8086 or userspace 338 jb resume_kernel # not returning to v8086 or userspace
336 339
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 1333d985177..734ebd1d3ca 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -320,7 +320,7 @@ ENDPROC(native_usergs_sysret64)
320 movq %rsp, %rsi 320 movq %rsp, %rsi
321 321
322 leaq -RBP(%rsp),%rdi /* arg1 for handler */ 322 leaq -RBP(%rsp),%rdi /* arg1 for handler */
323 testl $3, CS(%rdi) 323 testl $3, CS-RBP(%rsi)
324 je 1f 324 je 1f
325 SWAPGS 325 SWAPGS
326 /* 326 /*
@@ -330,11 +330,10 @@ ENDPROC(native_usergs_sysret64)
330 * moving irq_enter into assembly, which would be too much work) 330 * moving irq_enter into assembly, which would be too much work)
331 */ 331 */
3321: incl PER_CPU_VAR(irq_count) 3321: incl PER_CPU_VAR(irq_count)
333 jne 2f 333 cmovzq PER_CPU_VAR(irq_stack_ptr),%rsp
334 mov PER_CPU_VAR(irq_stack_ptr),%rsp
335 CFI_DEF_CFA_REGISTER rsi 334 CFI_DEF_CFA_REGISTER rsi
336 335
3372: /* Store previous stack value */ 336 /* Store previous stack value */
338 pushq %rsi 337 pushq %rsi
339 CFI_ESCAPE 0x0f /* DW_CFA_def_cfa_expression */, 6, \ 338 CFI_ESCAPE 0x0f /* DW_CFA_def_cfa_expression */, 6, \
340 0x77 /* DW_OP_breg7 */, 0, \ 339 0x77 /* DW_OP_breg7 */, 0, \
@@ -813,7 +812,7 @@ ret_from_intr:
813 812
814 /* Restore saved previous stack */ 813 /* Restore saved previous stack */
815 popq %rsi 814 popq %rsi
816 CFI_DEF_CFA_REGISTER rsi 815 CFI_DEF_CFA rsi,SS+8-RBP /* reg/off reset after def_cfa_expr */
817 leaq ARGOFFSET-RBP(%rsi), %rsp 816 leaq ARGOFFSET-RBP(%rsi), %rsp
818 CFI_DEF_CFA_REGISTER rsp 817 CFI_DEF_CFA_REGISTER rsp
819 CFI_ADJUST_CFA_OFFSET RBP-ARGOFFSET 818 CFI_ADJUST_CFA_OFFSET RBP-ARGOFFSET
@@ -1530,6 +1529,7 @@ ENTRY(nmi)
1530 1529
1531 /* Use %rdx as out temp variable throughout */ 1530 /* Use %rdx as out temp variable throughout */
1532 pushq_cfi %rdx 1531 pushq_cfi %rdx
1532 CFI_REL_OFFSET rdx, 0
1533 1533
1534 /* 1534 /*
1535 * If %cs was not the kernel segment, then the NMI triggered in user 1535 * If %cs was not the kernel segment, then the NMI triggered in user
@@ -1554,6 +1554,7 @@ ENTRY(nmi)
1554 */ 1554 */
1555 lea 6*8(%rsp), %rdx 1555 lea 6*8(%rsp), %rdx
1556 test_in_nmi rdx, 4*8(%rsp), nested_nmi, first_nmi 1556 test_in_nmi rdx, 4*8(%rsp), nested_nmi, first_nmi
1557 CFI_REMEMBER_STATE
1557 1558
1558nested_nmi: 1559nested_nmi:
1559 /* 1560 /*
@@ -1585,10 +1586,12 @@ nested_nmi:
1585 1586
1586nested_nmi_out: 1587nested_nmi_out:
1587 popq_cfi %rdx 1588 popq_cfi %rdx
1589 CFI_RESTORE rdx
1588 1590
1589 /* No need to check faults here */ 1591 /* No need to check faults here */
1590 INTERRUPT_RETURN 1592 INTERRUPT_RETURN
1591 1593
1594 CFI_RESTORE_STATE
1592first_nmi: 1595first_nmi:
1593 /* 1596 /*
1594 * Because nested NMIs will use the pushed location that we 1597 * Because nested NMIs will use the pushed location that we
@@ -1620,10 +1623,15 @@ first_nmi:
1620 * | pt_regs | 1623 * | pt_regs |
1621 * +-------------------------+ 1624 * +-------------------------+
1622 * 1625 *
1623 * The saved RIP is used to fix up the copied RIP that a nested 1626 * The saved stack frame is used to fix up the copied stack frame
1624 * NMI may zero out. The original stack frame and the temp storage 1627 * that a nested NMI may change to make the interrupted NMI iret jump
1628 * to the repeat_nmi. The original stack frame and the temp storage
1625 * is also used by nested NMIs and can not be trusted on exit. 1629 * is also used by nested NMIs and can not be trusted on exit.
1626 */ 1630 */
1631 /* Do not pop rdx, nested NMIs will corrupt that part of the stack */
1632 movq (%rsp), %rdx
1633 CFI_RESTORE rdx
1634
1627 /* Set the NMI executing variable on the stack. */ 1635 /* Set the NMI executing variable on the stack. */
1628 pushq_cfi $1 1636 pushq_cfi $1
1629 1637
@@ -1631,22 +1639,39 @@ first_nmi:
1631 .rept 5 1639 .rept 5
1632 pushq_cfi 6*8(%rsp) 1640 pushq_cfi 6*8(%rsp)
1633 .endr 1641 .endr
1642 CFI_DEF_CFA_OFFSET SS+8-RIP
1643
1644 /* Everything up to here is safe from nested NMIs */
1645
1646 /*
1647 * If there was a nested NMI, the first NMI's iret will return
1648 * here. But NMIs are still enabled and we can take another
1649 * nested NMI. The nested NMI checks the interrupted RIP to see
1650 * if it is between repeat_nmi and end_repeat_nmi, and if so
1651 * it will just return, as we are about to repeat an NMI anyway.
1652 * This makes it safe to copy to the stack frame that a nested
1653 * NMI will update.
1654 */
1655repeat_nmi:
1656 /*
1657 * Update the stack variable to say we are still in NMI (the update
1658 * is benign for the non-repeat case, where 1 was pushed just above
1659 * to this very stack slot).
1660 */
1661 movq $1, 5*8(%rsp)
1634 1662
1635 /* Make another copy, this one may be modified by nested NMIs */ 1663 /* Make another copy, this one may be modified by nested NMIs */
1636 .rept 5 1664 .rept 5
1637 pushq_cfi 4*8(%rsp) 1665 pushq_cfi 4*8(%rsp)
1638 .endr 1666 .endr
1639 1667 CFI_DEF_CFA_OFFSET SS+8-RIP
1640 /* Do not pop rdx, nested NMIs will corrupt it */ 1668end_repeat_nmi:
1641 movq 11*8(%rsp), %rdx
1642 1669
1643 /* 1670 /*
1644 * Everything below this point can be preempted by a nested 1671 * Everything below this point can be preempted by a nested
1645 * NMI if the first NMI took an exception. Repeated NMIs 1672 * NMI if the first NMI took an exception and reset our iret stack
1646 * caused by an exception and nested NMI will start here, and 1673 * so that we repeat another NMI.
1647 * can still be preempted by another NMI.
1648 */ 1674 */
1649restart_nmi:
1650 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ 1675 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
1651 subq $ORIG_RAX-R15, %rsp 1676 subq $ORIG_RAX-R15, %rsp
1652 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 1677 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
@@ -1675,26 +1700,6 @@ nmi_restore:
1675 CFI_ENDPROC 1700 CFI_ENDPROC
1676END(nmi) 1701END(nmi)
1677 1702
1678 /*
1679 * If an NMI hit an iret because of an exception or breakpoint,
1680 * it can lose its NMI context, and a nested NMI may come in.
1681 * In that case, the nested NMI will change the preempted NMI's
1682 * stack to jump to here when it does the final iret.
1683 */
1684repeat_nmi:
1685 INTR_FRAME
1686 /* Update the stack variable to say we are still in NMI */
1687 movq $1, 5*8(%rsp)
1688
1689 /* copy the saved stack back to copy stack */
1690 .rept 5
1691 pushq_cfi 4*8(%rsp)
1692 .endr
1693
1694 jmp restart_nmi
1695 CFI_ENDPROC
1696end_repeat_nmi:
1697
1698ENTRY(ignore_sysret) 1703ENTRY(ignore_sysret)
1699 CFI_STARTPROC 1704 CFI_STARTPROC
1700 mov $-ENOSYS,%eax 1705 mov $-ENOSYS,%eax
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 739d8598f78..7734bcbb5a3 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -16,6 +16,7 @@
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <asm/ptrace.h> 17#include <asm/ptrace.h>
18#include <asm/i387.h> 18#include <asm/i387.h>
19#include <asm/fpu-internal.h>
19#include <asm/user.h> 20#include <asm/user.h>
20 21
21#ifdef CONFIG_X86_64 22#ifdef CONFIG_X86_64
@@ -32,6 +33,86 @@
32# define user32_fxsr_struct user_fxsr_struct 33# define user32_fxsr_struct user_fxsr_struct
33#endif 34#endif
34 35
36/*
37 * Were we in an interrupt that interrupted kernel mode?
38 *
39 * We can do a kernel_fpu_begin/end() pair *ONLY* if that
40 * pair does nothing at all: the thread must not have fpu (so
41 * that we don't try to save the FPU state), and TS must
42 * be set (so that the clts/stts pair does nothing that is
43 * visible in the interrupted kernel thread).
44 */
45static inline bool interrupted_kernel_fpu_idle(void)
46{
47 return !__thread_has_fpu(current) &&
48 (read_cr0() & X86_CR0_TS);
49}
50
51/*
52 * Were we in user mode (or vm86 mode) when we were
53 * interrupted?
54 *
55 * Doing kernel_fpu_begin/end() is ok if we are running
56 * in an interrupt context from user mode - we'll just
57 * save the FPU state as required.
58 */
59static inline bool interrupted_user_mode(void)
60{
61 struct pt_regs *regs = get_irq_regs();
62 return regs && user_mode_vm(regs);
63}
64
65/*
66 * Can we use the FPU in kernel mode with the
67 * whole "kernel_fpu_begin/end()" sequence?
68 *
69 * It's always ok in process context (ie "not interrupt")
70 * but it is sometimes ok even from an irq.
71 */
72bool irq_fpu_usable(void)
73{
74 return !in_interrupt() ||
75 interrupted_user_mode() ||
76 interrupted_kernel_fpu_idle();
77}
78EXPORT_SYMBOL(irq_fpu_usable);
79
80void kernel_fpu_begin(void)
81{
82 struct task_struct *me = current;
83
84 WARN_ON_ONCE(!irq_fpu_usable());
85 preempt_disable();
86 if (__thread_has_fpu(me)) {
87 __save_init_fpu(me);
88 __thread_clear_has_fpu(me);
89 /* We do 'stts()' in kernel_fpu_end() */
90 } else {
91 percpu_write(fpu_owner_task, NULL);
92 clts();
93 }
94}
95EXPORT_SYMBOL(kernel_fpu_begin);
96
97void kernel_fpu_end(void)
98{
99 stts();
100 preempt_enable();
101}
102EXPORT_SYMBOL(kernel_fpu_end);
103
104void unlazy_fpu(struct task_struct *tsk)
105{
106 preempt_disable();
107 if (__thread_has_fpu(tsk)) {
108 __save_init_fpu(tsk);
109 __thread_fpu_end(tsk);
110 } else
111 tsk->fpu_counter = 0;
112 preempt_enable();
113}
114EXPORT_SYMBOL(unlazy_fpu);
115
35#ifdef CONFIG_MATH_EMULATION 116#ifdef CONFIG_MATH_EMULATION
36# define HAVE_HWFP (boot_cpu_data.hard_math) 117# define HAVE_HWFP (boot_cpu_data.hard_math)
37#else 118#else
@@ -44,7 +125,7 @@ EXPORT_SYMBOL_GPL(xstate_size);
44unsigned int sig_xstate_ia32_size = sizeof(struct _fpstate_ia32); 125unsigned int sig_xstate_ia32_size = sizeof(struct _fpstate_ia32);
45static struct i387_fxsave_struct fx_scratch __cpuinitdata; 126static struct i387_fxsave_struct fx_scratch __cpuinitdata;
46 127
47void __cpuinit mxcsr_feature_mask_init(void) 128static void __cpuinit mxcsr_feature_mask_init(void)
48{ 129{
49 unsigned long mask = 0; 130 unsigned long mask = 0;
50 131
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index 313fb5cddbc..43e2b1cff0a 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -306,10 +306,10 @@ void __init native_init_IRQ(void)
306 * us. (some of these will be overridden and become 306 * us. (some of these will be overridden and become
307 * 'special' SMP interrupts) 307 * 'special' SMP interrupts)
308 */ 308 */
309 for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) { 309 i = FIRST_EXTERNAL_VECTOR;
310 for_each_clear_bit_from(i, used_vectors, NR_VECTORS) {
310 /* IA32_SYSCALL_VECTOR could be used in trap_init already. */ 311 /* IA32_SYSCALL_VECTOR could be used in trap_init already. */
311 if (!test_bit(i, used_vectors)) 312 set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]);
312 set_intr_gate(i, interrupt[i-FIRST_EXTERNAL_VECTOR]);
313 } 313 }
314 314
315 if (!acpi_ioapic && !of_ioapic) 315 if (!acpi_ioapic && !of_ioapic)
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index faba5771aca..fdc37b3d0ce 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -67,8 +67,6 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
67 { "ss", 4, offsetof(struct pt_regs, ss) }, 67 { "ss", 4, offsetof(struct pt_regs, ss) },
68 { "ds", 4, offsetof(struct pt_regs, ds) }, 68 { "ds", 4, offsetof(struct pt_regs, ds) },
69 { "es", 4, offsetof(struct pt_regs, es) }, 69 { "es", 4, offsetof(struct pt_regs, es) },
70 { "fs", 4, -1 },
71 { "gs", 4, -1 },
72#else 70#else
73 { "ax", 8, offsetof(struct pt_regs, ax) }, 71 { "ax", 8, offsetof(struct pt_regs, ax) },
74 { "bx", 8, offsetof(struct pt_regs, bx) }, 72 { "bx", 8, offsetof(struct pt_regs, bx) },
@@ -90,7 +88,11 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
90 { "flags", 4, offsetof(struct pt_regs, flags) }, 88 { "flags", 4, offsetof(struct pt_regs, flags) },
91 { "cs", 4, offsetof(struct pt_regs, cs) }, 89 { "cs", 4, offsetof(struct pt_regs, cs) },
92 { "ss", 4, offsetof(struct pt_regs, ss) }, 90 { "ss", 4, offsetof(struct pt_regs, ss) },
91 { "ds", 4, -1 },
92 { "es", 4, -1 },
93#endif 93#endif
94 { "fs", 4, -1 },
95 { "gs", 4, -1 },
94}; 96};
95 97
96int dbg_set_reg(int regno, void *mem, struct pt_regs *regs) 98int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
diff --git a/arch/x86/kernel/nmi_selftest.c b/arch/x86/kernel/nmi_selftest.c
index 0d01a8ea4e1..2c39dcd510f 100644
--- a/arch/x86/kernel/nmi_selftest.c
+++ b/arch/x86/kernel/nmi_selftest.c
@@ -12,6 +12,7 @@
12#include <linux/smp.h> 12#include <linux/smp.h>
13#include <linux/cpumask.h> 13#include <linux/cpumask.h>
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/init.h>
15 16
16#include <asm/apic.h> 17#include <asm/apic.h>
17#include <asm/nmi.h> 18#include <asm/nmi.h>
@@ -20,35 +21,35 @@
20#define FAILURE 1 21#define FAILURE 1
21#define TIMEOUT 2 22#define TIMEOUT 2
22 23
23static int nmi_fail; 24static int __initdata nmi_fail;
24 25
25/* check to see if NMI IPIs work on this machine */ 26/* check to see if NMI IPIs work on this machine */
26static DECLARE_BITMAP(nmi_ipi_mask, NR_CPUS) __read_mostly; 27static DECLARE_BITMAP(nmi_ipi_mask, NR_CPUS) __initdata;
27 28
28static int testcase_total; 29static int __initdata testcase_total;
29static int testcase_successes; 30static int __initdata testcase_successes;
30static int expected_testcase_failures; 31static int __initdata expected_testcase_failures;
31static int unexpected_testcase_failures; 32static int __initdata unexpected_testcase_failures;
32static int unexpected_testcase_unknowns; 33static int __initdata unexpected_testcase_unknowns;
33 34
34static int nmi_unk_cb(unsigned int val, struct pt_regs *regs) 35static int __init nmi_unk_cb(unsigned int val, struct pt_regs *regs)
35{ 36{
36 unexpected_testcase_unknowns++; 37 unexpected_testcase_unknowns++;
37 return NMI_HANDLED; 38 return NMI_HANDLED;
38} 39}
39 40
40static void init_nmi_testsuite(void) 41static void __init init_nmi_testsuite(void)
41{ 42{
42 /* trap all the unknown NMIs we may generate */ 43 /* trap all the unknown NMIs we may generate */
43 register_nmi_handler(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk"); 44 register_nmi_handler(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk");
44} 45}
45 46
46static void cleanup_nmi_testsuite(void) 47static void __init cleanup_nmi_testsuite(void)
47{ 48{
48 unregister_nmi_handler(NMI_UNKNOWN, "nmi_selftest_unk"); 49 unregister_nmi_handler(NMI_UNKNOWN, "nmi_selftest_unk");
49} 50}
50 51
51static int test_nmi_ipi_callback(unsigned int val, struct pt_regs *regs) 52static int __init test_nmi_ipi_callback(unsigned int val, struct pt_regs *regs)
52{ 53{
53 int cpu = raw_smp_processor_id(); 54 int cpu = raw_smp_processor_id();
54 55
@@ -58,7 +59,7 @@ static int test_nmi_ipi_callback(unsigned int val, struct pt_regs *regs)
58 return NMI_DONE; 59 return NMI_DONE;
59} 60}
60 61
61static void test_nmi_ipi(struct cpumask *mask) 62static void __init test_nmi_ipi(struct cpumask *mask)
62{ 63{
63 unsigned long timeout; 64 unsigned long timeout;
64 65
@@ -86,7 +87,7 @@ static void test_nmi_ipi(struct cpumask *mask)
86 return; 87 return;
87} 88}
88 89
89static void remote_ipi(void) 90static void __init remote_ipi(void)
90{ 91{
91 cpumask_copy(to_cpumask(nmi_ipi_mask), cpu_online_mask); 92 cpumask_copy(to_cpumask(nmi_ipi_mask), cpu_online_mask);
92 cpumask_clear_cpu(smp_processor_id(), to_cpumask(nmi_ipi_mask)); 93 cpumask_clear_cpu(smp_processor_id(), to_cpumask(nmi_ipi_mask));
@@ -94,19 +95,19 @@ static void remote_ipi(void)
94 test_nmi_ipi(to_cpumask(nmi_ipi_mask)); 95 test_nmi_ipi(to_cpumask(nmi_ipi_mask));
95} 96}
96 97
97static void local_ipi(void) 98static void __init local_ipi(void)
98{ 99{
99 cpumask_clear(to_cpumask(nmi_ipi_mask)); 100 cpumask_clear(to_cpumask(nmi_ipi_mask));
100 cpumask_set_cpu(smp_processor_id(), to_cpumask(nmi_ipi_mask)); 101 cpumask_set_cpu(smp_processor_id(), to_cpumask(nmi_ipi_mask));
101 test_nmi_ipi(to_cpumask(nmi_ipi_mask)); 102 test_nmi_ipi(to_cpumask(nmi_ipi_mask));
102} 103}
103 104
104static void reset_nmi(void) 105static void __init reset_nmi(void)
105{ 106{
106 nmi_fail = 0; 107 nmi_fail = 0;
107} 108}
108 109
109static void dotest(void (*testcase_fn)(void), int expected) 110static void __init dotest(void (*testcase_fn)(void), int expected)
110{ 111{
111 testcase_fn(); 112 testcase_fn();
112 /* 113 /*
@@ -131,12 +132,12 @@ static void dotest(void (*testcase_fn)(void), int expected)
131 reset_nmi(); 132 reset_nmi();
132} 133}
133 134
134static inline void print_testname(const char *testname) 135static inline void __init print_testname(const char *testname)
135{ 136{
136 printk("%12s:", testname); 137 printk("%12s:", testname);
137} 138}
138 139
139void nmi_selftest(void) 140void __init nmi_selftest(void)
140{ 141{
141 init_nmi_testsuite(); 142 init_nmi_testsuite();
142 143
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index ada2f99388d..9c57c02e54f 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -26,6 +26,7 @@
26 26
27#include <asm/bug.h> 27#include <asm/bug.h>
28#include <asm/paravirt.h> 28#include <asm/paravirt.h>
29#include <asm/debugreg.h>
29#include <asm/desc.h> 30#include <asm/desc.h>
30#include <asm/setup.h> 31#include <asm/setup.h>
31#include <asm/pgtable.h> 32#include <asm/pgtable.h>
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 1c4d769e21e..28e5e06fcba 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -262,10 +262,11 @@ rootfs_initcall(pci_iommu_init);
262 262
263static __devinit void via_no_dac(struct pci_dev *dev) 263static __devinit void via_no_dac(struct pci_dev *dev)
264{ 264{
265 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) { 265 if (forbid_dac == 0) {
266 dev_info(&dev->dev, "disabling DAC on VIA PCI bridge\n"); 266 dev_info(&dev->dev, "disabling DAC on VIA PCI bridge\n");
267 forbid_dac = 1; 267 forbid_dac = 1;
268 } 268 }
269} 269}
270DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac); 270DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID,
271 PCI_CLASS_BRIDGE_PCI, 8, via_no_dac);
271#endif 272#endif
diff --git a/arch/x86/kernel/probe_roms.c b/arch/x86/kernel/probe_roms.c
index 34e06e84ce3..0bc72e2069e 100644
--- a/arch/x86/kernel/probe_roms.c
+++ b/arch/x86/kernel/probe_roms.c
@@ -12,6 +12,7 @@
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/export.h> 13#include <linux/export.h>
14 14
15#include <asm/probe_roms.h>
15#include <asm/pci-direct.h> 16#include <asm/pci-direct.h>
16#include <asm/e820.h> 17#include <asm/e820.h>
17#include <asm/mmzone.h> 18#include <asm/mmzone.h>
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 44eefde9210..14baf78d5a1 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -21,6 +21,7 @@
21#include <asm/idle.h> 21#include <asm/idle.h>
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <asm/i387.h> 23#include <asm/i387.h>
24#include <asm/fpu-internal.h>
24#include <asm/debugreg.h> 25#include <asm/debugreg.h>
25 26
26struct kmem_cache *task_xstate_cachep; 27struct kmem_cache *task_xstate_cachep;
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 49888fefe79..9d7d4842bfa 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -45,6 +45,7 @@
45#include <asm/ldt.h> 45#include <asm/ldt.h>
46#include <asm/processor.h> 46#include <asm/processor.h>
47#include <asm/i387.h> 47#include <asm/i387.h>
48#include <asm/fpu-internal.h>
48#include <asm/desc.h> 49#include <asm/desc.h>
49#ifdef CONFIG_MATH_EMULATION 50#ifdef CONFIG_MATH_EMULATION
50#include <asm/math_emu.h> 51#include <asm/math_emu.h>
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index e34257c70c2..292da13fc5a 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -43,6 +43,7 @@
43#include <asm/system.h> 43#include <asm/system.h>
44#include <asm/processor.h> 44#include <asm/processor.h>
45#include <asm/i387.h> 45#include <asm/i387.h>
46#include <asm/fpu-internal.h>
46#include <asm/mmu_context.h> 47#include <asm/mmu_context.h>
47#include <asm/prctl.h> 48#include <asm/prctl.h>
48#include <asm/desc.h> 49#include <asm/desc.h>
@@ -340,6 +341,7 @@ start_thread_common(struct pt_regs *regs, unsigned long new_ip,
340 loadsegment(es, _ds); 341 loadsegment(es, _ds);
341 loadsegment(ds, _ds); 342 loadsegment(ds, _ds);
342 load_gs_index(0); 343 load_gs_index(0);
344 current->thread.usersp = new_sp;
343 regs->ip = new_ip; 345 regs->ip = new_ip;
344 regs->sp = new_sp; 346 regs->sp = new_sp;
345 percpu_write(old_rsp, new_sp); 347 percpu_write(old_rsp, new_sp);
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 50267386b76..78f05e438be 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -27,6 +27,7 @@
27#include <asm/system.h> 27#include <asm/system.h>
28#include <asm/processor.h> 28#include <asm/processor.h>
29#include <asm/i387.h> 29#include <asm/i387.h>
30#include <asm/fpu-internal.h>
30#include <asm/debugreg.h> 31#include <asm/debugreg.h>
31#include <asm/ldt.h> 32#include <asm/ldt.h>
32#include <asm/desc.h> 33#include <asm/desc.h>
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d7d5099fe87..88638883176 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -749,10 +749,16 @@ void __init setup_arch(char **cmdline_p)
749#endif 749#endif
750#ifdef CONFIG_EFI 750#ifdef CONFIG_EFI
751 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 751 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
752 EFI_LOADER_SIGNATURE, 4)) { 752 "EL32", 4)) {
753 efi_enabled = 1; 753 efi_enabled = 1;
754 efi_memblock_x86_reserve_range(); 754 efi_64bit = false;
755 } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
756 "EL64", 4)) {
757 efi_enabled = 1;
758 efi_64bit = true;
755 } 759 }
760 if (efi_enabled && efi_memblock_x86_reserve_range())
761 efi_enabled = 0;
756#endif 762#endif
757 763
758 x86_init.oem.arch_setup(); 764 x86_init.oem.arch_setup();
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 46a01bdc27e..25edcfc9ba5 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -24,6 +24,7 @@
24#include <asm/processor.h> 24#include <asm/processor.h>
25#include <asm/ucontext.h> 25#include <asm/ucontext.h>
26#include <asm/i387.h> 26#include <asm/i387.h>
27#include <asm/fpu-internal.h>
27#include <asm/vdso.h> 28#include <asm/vdso.h>
28#include <asm/mce.h> 29#include <asm/mce.h>
29 30
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 58f78165d30..e578a79a309 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -727,8 +727,6 @@ do_rest:
727 * the targeted processor. 727 * the targeted processor.
728 */ 728 */
729 729
730 printk(KERN_DEBUG "smpboot cpu %d: start_ip = %lx\n", cpu, start_ip);
731
732 atomic_set(&init_deasserted, 0); 730 atomic_set(&init_deasserted, 0);
733 731
734 if (get_uv_system_type() != UV_NON_UNIQUE_APIC) { 732 if (get_uv_system_type() != UV_NON_UNIQUE_APIC) {
@@ -778,9 +776,10 @@ do_rest:
778 schedule(); 776 schedule();
779 } 777 }
780 778
781 if (cpumask_test_cpu(cpu, cpu_callin_mask)) 779 if (cpumask_test_cpu(cpu, cpu_callin_mask)) {
780 print_cpu_msr(&cpu_data(cpu));
782 pr_debug("CPU%d: has booted.\n", cpu); 781 pr_debug("CPU%d: has booted.\n", cpu);
783 else { 782 } else {
784 boot_error = 1; 783 boot_error = 1;
785 if (*(volatile u32 *)TRAMPOLINE_SYM(trampoline_status) 784 if (*(volatile u32 *)TRAMPOLINE_SYM(trampoline_status)
786 == 0xA5A5A5A5) 785 == 0xA5A5A5A5)
@@ -834,7 +833,7 @@ int __cpuinit native_cpu_up(unsigned int cpu)
834 833
835 if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid || 834 if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid ||
836 !physid_isset(apicid, phys_cpu_present_map) || 835 !physid_isset(apicid, phys_cpu_present_map) ||
837 (!x2apic_mode && apicid >= 255)) { 836 !apic->apic_id_valid(apicid)) {
838 printk(KERN_ERR "%s: bad cpu %d\n", __func__, cpu); 837 printk(KERN_ERR "%s: bad cpu %d\n", __func__, cpu);
839 return -EINVAL; 838 return -EINVAL;
840 } 839 }
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index 051489082d5..ef59642ff1b 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -195,7 +195,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
195{ 195{
196 struct vm_area_struct *vma; 196 struct vm_area_struct *vma;
197 struct mm_struct *mm = current->mm; 197 struct mm_struct *mm = current->mm;
198 unsigned long addr = addr0; 198 unsigned long addr = addr0, start_addr;
199 199
200 /* requested length too big for entire address space */ 200 /* requested length too big for entire address space */
201 if (len > TASK_SIZE) 201 if (len > TASK_SIZE)
@@ -223,25 +223,14 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
223 mm->free_area_cache = mm->mmap_base; 223 mm->free_area_cache = mm->mmap_base;
224 } 224 }
225 225
226try_again:
226 /* either no address requested or can't fit in requested address hole */ 227 /* either no address requested or can't fit in requested address hole */
227 addr = mm->free_area_cache; 228 start_addr = addr = mm->free_area_cache;
228
229 /* make sure it can fit in the remaining address space */
230 if (addr > len) {
231 unsigned long tmp_addr = align_addr(addr - len, filp,
232 ALIGN_TOPDOWN);
233
234 vma = find_vma(mm, tmp_addr);
235 if (!vma || tmp_addr + len <= vma->vm_start)
236 /* remember the address as a hint for next time */
237 return mm->free_area_cache = tmp_addr;
238 }
239
240 if (mm->mmap_base < len)
241 goto bottomup;
242 229
243 addr = mm->mmap_base-len; 230 if (addr < len)
231 goto fail;
244 232
233 addr -= len;
245 do { 234 do {
246 addr = align_addr(addr, filp, ALIGN_TOPDOWN); 235 addr = align_addr(addr, filp, ALIGN_TOPDOWN);
247 236
@@ -263,6 +252,17 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
263 addr = vma->vm_start-len; 252 addr = vma->vm_start-len;
264 } while (len < vma->vm_start); 253 } while (len < vma->vm_start);
265 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
266bottomup: 266bottomup:
267 /* 267 /*
268 * A failed mmap() very likely causes application failure, 268 * A failed mmap() very likely causes application failure,
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 4bbe04d9674..ec61d4c1b93 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -54,6 +54,7 @@
54#include <asm/traps.h> 54#include <asm/traps.h>
55#include <asm/desc.h> 55#include <asm/desc.h>
56#include <asm/i387.h> 56#include <asm/i387.h>
57#include <asm/fpu-internal.h>
57#include <asm/mce.h> 58#include <asm/mce.h>
58 59
59#include <asm/mach_traps.h> 60#include <asm/mach_traps.h>
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index b466cab5ba1..328cb37bb82 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -172,6 +172,7 @@ static void mark_screen_rdonly(struct mm_struct *mm)
172 spinlock_t *ptl; 172 spinlock_t *ptl;
173 int i; 173 int i;
174 174
175 down_write(&mm->mmap_sem);
175 pgd = pgd_offset(mm, 0xA0000); 176 pgd = pgd_offset(mm, 0xA0000);
176 if (pgd_none_or_clear_bad(pgd)) 177 if (pgd_none_or_clear_bad(pgd))
177 goto out; 178 goto out;
@@ -190,6 +191,7 @@ static void mark_screen_rdonly(struct mm_struct *mm)
190 } 191 }
191 pte_unmap_unlock(pte, ptl); 192 pte_unmap_unlock(pte, ptl);
192out: 193out:
194 up_write(&mm->mmap_sem);
193 flush_tlb(); 195 flush_tlb();
194} 196}
195 197
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 71109111411..e62728e30b0 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -6,6 +6,7 @@
6#include <linux/bootmem.h> 6#include <linux/bootmem.h>
7#include <linux/compat.h> 7#include <linux/compat.h>
8#include <asm/i387.h> 8#include <asm/i387.h>
9#include <asm/fpu-internal.h>
9#ifdef CONFIG_IA32_EMULATION 10#ifdef CONFIG_IA32_EMULATION
10#include <asm/sigcontext32.h> 11#include <asm/sigcontext32.h>
11#endif 12#endif
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 3b4c8d8ad90..246490f643b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1457,7 +1457,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
1457#ifdef CONFIG_X86_64 1457#ifdef CONFIG_X86_64
1458 wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); 1458 wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base);
1459#endif 1459#endif
1460 if (__thread_has_fpu(current)) 1460 if (user_has_fpu())
1461 clts(); 1461 clts();
1462 load_gdt(&__get_cpu_var(host_gdt)); 1462 load_gdt(&__get_cpu_var(host_gdt));
1463} 1463}
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index bb4fd2636bc..54696b5f844 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -57,6 +57,7 @@
57#include <asm/mtrr.h> 57#include <asm/mtrr.h>
58#include <asm/mce.h> 58#include <asm/mce.h>
59#include <asm/i387.h> 59#include <asm/i387.h>
60#include <asm/fpu-internal.h> /* Ugh! */
60#include <asm/xcr.h> 61#include <asm/xcr.h>
61#include <asm/pvclock.h> 62#include <asm/pvclock.h>
62#include <asm/div64.h> 63#include <asm/div64.h>
diff --git a/arch/x86/lib/atomic64_32.c b/arch/x86/lib/atomic64_32.c
index 042f6826bf5..a0b4a350daa 100644
--- a/arch/x86/lib/atomic64_32.c
+++ b/arch/x86/lib/atomic64_32.c
@@ -1,59 +1,4 @@
1#include <linux/compiler.h> 1#define ATOMIC64_EXPORT EXPORT_SYMBOL
2#include <linux/module.h>
3#include <linux/types.h>
4 2
5#include <asm/processor.h> 3#include <linux/export.h>
6#include <asm/cmpxchg.h>
7#include <linux/atomic.h> 4#include <linux/atomic.h>
8
9long long atomic64_read_cx8(long long, const atomic64_t *v);
10EXPORT_SYMBOL(atomic64_read_cx8);
11long long atomic64_set_cx8(long long, const atomic64_t *v);
12EXPORT_SYMBOL(atomic64_set_cx8);
13long long atomic64_xchg_cx8(long long, unsigned high);
14EXPORT_SYMBOL(atomic64_xchg_cx8);
15long long atomic64_add_return_cx8(long long a, atomic64_t *v);
16EXPORT_SYMBOL(atomic64_add_return_cx8);
17long long atomic64_sub_return_cx8(long long a, atomic64_t *v);
18EXPORT_SYMBOL(atomic64_sub_return_cx8);
19long long atomic64_inc_return_cx8(long long a, atomic64_t *v);
20EXPORT_SYMBOL(atomic64_inc_return_cx8);
21long long atomic64_dec_return_cx8(long long a, atomic64_t *v);
22EXPORT_SYMBOL(atomic64_dec_return_cx8);
23long long atomic64_dec_if_positive_cx8(atomic64_t *v);
24EXPORT_SYMBOL(atomic64_dec_if_positive_cx8);
25int atomic64_inc_not_zero_cx8(atomic64_t *v);
26EXPORT_SYMBOL(atomic64_inc_not_zero_cx8);
27int atomic64_add_unless_cx8(atomic64_t *v, long long a, long long u);
28EXPORT_SYMBOL(atomic64_add_unless_cx8);
29
30#ifndef CONFIG_X86_CMPXCHG64
31long long atomic64_read_386(long long, const atomic64_t *v);
32EXPORT_SYMBOL(atomic64_read_386);
33long long atomic64_set_386(long long, const atomic64_t *v);
34EXPORT_SYMBOL(atomic64_set_386);
35long long atomic64_xchg_386(long long, unsigned high);
36EXPORT_SYMBOL(atomic64_xchg_386);
37long long atomic64_add_return_386(long long a, atomic64_t *v);
38EXPORT_SYMBOL(atomic64_add_return_386);
39long long atomic64_sub_return_386(long long a, atomic64_t *v);
40EXPORT_SYMBOL(atomic64_sub_return_386);
41long long atomic64_inc_return_386(long long a, atomic64_t *v);
42EXPORT_SYMBOL(atomic64_inc_return_386);
43long long atomic64_dec_return_386(long long a, atomic64_t *v);
44EXPORT_SYMBOL(atomic64_dec_return_386);
45long long atomic64_add_386(long long a, atomic64_t *v);
46EXPORT_SYMBOL(atomic64_add_386);
47long long atomic64_sub_386(long long a, atomic64_t *v);
48EXPORT_SYMBOL(atomic64_sub_386);
49long long atomic64_inc_386(long long a, atomic64_t *v);
50EXPORT_SYMBOL(atomic64_inc_386);
51long long atomic64_dec_386(long long a, atomic64_t *v);
52EXPORT_SYMBOL(atomic64_dec_386);
53long long atomic64_dec_if_positive_386(atomic64_t *v);
54EXPORT_SYMBOL(atomic64_dec_if_positive_386);
55int atomic64_inc_not_zero_386(atomic64_t *v);
56EXPORT_SYMBOL(atomic64_inc_not_zero_386);
57int atomic64_add_unless_386(atomic64_t *v, long long a, long long u);
58EXPORT_SYMBOL(atomic64_add_unless_386);
59#endif
diff --git a/arch/x86/lib/atomic64_386_32.S b/arch/x86/lib/atomic64_386_32.S
index e8e7e0d06f4..00933d5e992 100644
--- a/arch/x86/lib/atomic64_386_32.S
+++ b/arch/x86/lib/atomic64_386_32.S
@@ -137,13 +137,13 @@ BEGIN(dec_return)
137RET_ENDP 137RET_ENDP
138#undef v 138#undef v
139 139
140#define v %ecx 140#define v %esi
141BEGIN(add_unless) 141BEGIN(add_unless)
142 addl %eax, %esi 142 addl %eax, %ecx
143 adcl %edx, %edi 143 adcl %edx, %edi
144 addl (v), %eax 144 addl (v), %eax
145 adcl 4(v), %edx 145 adcl 4(v), %edx
146 cmpl %eax, %esi 146 cmpl %eax, %ecx
147 je 3f 147 je 3f
1481: 1481:
149 movl %eax, (v) 149 movl %eax, (v)
diff --git a/arch/x86/lib/atomic64_cx8_32.S b/arch/x86/lib/atomic64_cx8_32.S
index 391a083674b..f5cc9eb1d51 100644
--- a/arch/x86/lib/atomic64_cx8_32.S
+++ b/arch/x86/lib/atomic64_cx8_32.S
@@ -55,8 +55,6 @@ ENDPROC(atomic64_set_cx8)
55ENTRY(atomic64_xchg_cx8) 55ENTRY(atomic64_xchg_cx8)
56 CFI_STARTPROC 56 CFI_STARTPROC
57 57
58 movl %ebx, %eax
59 movl %ecx, %edx
601: 581:
61 LOCK_PREFIX 59 LOCK_PREFIX
62 cmpxchg8b (%esi) 60 cmpxchg8b (%esi)
@@ -78,7 +76,7 @@ ENTRY(atomic64_\func\()_return_cx8)
78 movl %edx, %edi 76 movl %edx, %edi
79 movl %ecx, %ebp 77 movl %ecx, %ebp
80 78
81 read64 %ebp 79 read64 %ecx
821: 801:
83 movl %eax, %ebx 81 movl %eax, %ebx
84 movl %edx, %ecx 82 movl %edx, %ecx
@@ -159,23 +157,22 @@ ENTRY(atomic64_add_unless_cx8)
159 SAVE ebx 157 SAVE ebx
160/* these just push these two parameters on the stack */ 158/* these just push these two parameters on the stack */
161 SAVE edi 159 SAVE edi
162 SAVE esi 160 SAVE ecx
163 161
164 movl %ecx, %ebp 162 movl %eax, %ebp
165 movl %eax, %esi
166 movl %edx, %edi 163 movl %edx, %edi
167 164
168 read64 %ebp 165 read64 %esi
1691: 1661:
170 cmpl %eax, 0(%esp) 167 cmpl %eax, 0(%esp)
171 je 4f 168 je 4f
1722: 1692:
173 movl %eax, %ebx 170 movl %eax, %ebx
174 movl %edx, %ecx 171 movl %edx, %ecx
175 addl %esi, %ebx 172 addl %ebp, %ebx
176 adcl %edi, %ecx 173 adcl %edi, %ecx
177 LOCK_PREFIX 174 LOCK_PREFIX
178 cmpxchg8b (%ebp) 175 cmpxchg8b (%esi)
179 jne 1b 176 jne 1b
180 177
181 movl $1, %eax 178 movl $1, %eax
@@ -199,13 +196,13 @@ ENTRY(atomic64_inc_not_zero_cx8)
199 196
200 read64 %esi 197 read64 %esi
2011: 1981:
202 testl %eax, %eax 199 movl %eax, %ecx
203 je 4f 200 orl %edx, %ecx
2042: 201 jz 3f
205 movl %eax, %ebx 202 movl %eax, %ebx
206 movl %edx, %ecx 203 xorl %ecx, %ecx
207 addl $1, %ebx 204 addl $1, %ebx
208 adcl $0, %ecx 205 adcl %edx, %ecx
209 LOCK_PREFIX 206 LOCK_PREFIX
210 cmpxchg8b (%esi) 207 cmpxchg8b (%esi)
211 jne 1b 208 jne 1b
@@ -214,9 +211,5 @@ ENTRY(atomic64_inc_not_zero_cx8)
2143: 2113:
215 RESTORE ebx 212 RESTORE ebx
216 ret 213 ret
2174:
218 testl %edx, %edx
219 jne 2b
220 jmp 3b
221 CFI_ENDPROC 214 CFI_ENDPROC
222ENDPROC(atomic64_inc_not_zero_cx8) 215ENDPROC(atomic64_inc_not_zero_cx8)
diff --git a/arch/x86/lib/copy_page_64.S b/arch/x86/lib/copy_page_64.S
index 01c805ba535..6b34d04d096 100644
--- a/arch/x86/lib/copy_page_64.S
+++ b/arch/x86/lib/copy_page_64.S
@@ -20,14 +20,12 @@ ENDPROC(copy_page_c)
20 20
21ENTRY(copy_page) 21ENTRY(copy_page)
22 CFI_STARTPROC 22 CFI_STARTPROC
23 subq $3*8,%rsp 23 subq $2*8,%rsp
24 CFI_ADJUST_CFA_OFFSET 3*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 movq %r13,2*8(%rsp)
30 CFI_REL_OFFSET r13, 2*8
31 29
32 movl $(4096/64)-5,%ecx 30 movl $(4096/64)-5,%ecx
33 .p2align 4 31 .p2align 4
@@ -91,10 +89,8 @@ ENTRY(copy_page)
91 CFI_RESTORE rbx 89 CFI_RESTORE rbx
92 movq 1*8(%rsp),%r12 90 movq 1*8(%rsp),%r12
93 CFI_RESTORE r12 91 CFI_RESTORE r12
94 movq 2*8(%rsp),%r13 92 addq $2*8,%rsp
95 CFI_RESTORE r13 93 CFI_ADJUST_CFA_OFFSET -2*8
96 addq $3*8,%rsp
97 CFI_ADJUST_CFA_OFFSET -3*8
98 ret 94 ret
99.Lcopy_page_end: 95.Lcopy_page_end:
100 CFI_ENDPROC 96 CFI_ENDPROC
diff --git a/arch/x86/lib/memcpy_64.S b/arch/x86/lib/memcpy_64.S
index efbf2a0ecde..1c273be7c97 100644
--- a/arch/x86/lib/memcpy_64.S
+++ b/arch/x86/lib/memcpy_64.S
@@ -27,9 +27,8 @@
27 .section .altinstr_replacement, "ax", @progbits 27 .section .altinstr_replacement, "ax", @progbits
28.Lmemcpy_c: 28.Lmemcpy_c:
29 movq %rdi, %rax 29 movq %rdi, %rax
30 30 movq %rdx, %rcx
31 movl %edx, %ecx 31 shrq $3, %rcx
32 shrl $3, %ecx
33 andl $7, %edx 32 andl $7, %edx
34 rep movsq 33 rep movsq
35 movl %edx, %ecx 34 movl %edx, %ecx
@@ -48,8 +47,7 @@
48 .section .altinstr_replacement, "ax", @progbits 47 .section .altinstr_replacement, "ax", @progbits
49.Lmemcpy_c_e: 48.Lmemcpy_c_e:
50 movq %rdi, %rax 49 movq %rdi, %rax
51 50 movq %rdx, %rcx
52 movl %edx, %ecx
53 rep movsb 51 rep movsb
54 ret 52 ret
55.Lmemcpy_e_e: 53.Lmemcpy_e_e:
@@ -60,10 +58,7 @@ ENTRY(memcpy)
60 CFI_STARTPROC 58 CFI_STARTPROC
61 movq %rdi, %rax 59 movq %rdi, %rax
62 60
63 /* 61 cmpq $0x20, %rdx
64 * Use 32bit CMP here to avoid long NOP padding.
65 */
66 cmp $0x20, %edx
67 jb .Lhandle_tail 62 jb .Lhandle_tail
68 63
69 /* 64 /*
@@ -72,7 +67,7 @@ ENTRY(memcpy)
72 */ 67 */
73 cmp %dil, %sil 68 cmp %dil, %sil
74 jl .Lcopy_backward 69 jl .Lcopy_backward
75 subl $0x20, %edx 70 subq $0x20, %rdx
76.Lcopy_forward_loop: 71.Lcopy_forward_loop:
77 subq $0x20, %rdx 72 subq $0x20, %rdx
78 73
@@ -91,7 +86,7 @@ ENTRY(memcpy)
91 movq %r11, 3*8(%rdi) 86 movq %r11, 3*8(%rdi)
92 leaq 4*8(%rdi), %rdi 87 leaq 4*8(%rdi), %rdi
93 jae .Lcopy_forward_loop 88 jae .Lcopy_forward_loop
94 addq $0x20, %rdx 89 addl $0x20, %edx
95 jmp .Lhandle_tail 90 jmp .Lhandle_tail
96 91
97.Lcopy_backward: 92.Lcopy_backward:
@@ -123,11 +118,11 @@ ENTRY(memcpy)
123 /* 118 /*
124 * Calculate copy position to head. 119 * Calculate copy position to head.
125 */ 120 */
126 addq $0x20, %rdx 121 addl $0x20, %edx
127 subq %rdx, %rsi 122 subq %rdx, %rsi
128 subq %rdx, %rdi 123 subq %rdx, %rdi
129.Lhandle_tail: 124.Lhandle_tail:
130 cmpq $16, %rdx 125 cmpl $16, %edx
131 jb .Lless_16bytes 126 jb .Lless_16bytes
132 127
133 /* 128 /*
@@ -144,7 +139,7 @@ ENTRY(memcpy)
144 retq 139 retq
145 .p2align 4 140 .p2align 4
146.Lless_16bytes: 141.Lless_16bytes:
147 cmpq $8, %rdx 142 cmpl $8, %edx
148 jb .Lless_8bytes 143 jb .Lless_8bytes
149 /* 144 /*
150 * Move data from 8 bytes to 15 bytes. 145 * Move data from 8 bytes to 15 bytes.
@@ -156,7 +151,7 @@ ENTRY(memcpy)
156 retq 151 retq
157 .p2align 4 152 .p2align 4
158.Lless_8bytes: 153.Lless_8bytes:
159 cmpq $4, %rdx 154 cmpl $4, %edx
160 jb .Lless_3bytes 155 jb .Lless_3bytes
161 156
162 /* 157 /*
@@ -169,18 +164,19 @@ ENTRY(memcpy)
169 retq 164 retq
170 .p2align 4 165 .p2align 4
171.Lless_3bytes: 166.Lless_3bytes:
172 cmpl $0, %edx 167 subl $1, %edx
173 je .Lend 168 jb .Lend
174 /* 169 /*
175 * Move data from 1 bytes to 3 bytes. 170 * Move data from 1 bytes to 3 bytes.
176 */ 171 */
177.Lloop_1: 172 movzbl (%rsi), %ecx
178 movb (%rsi), %r8b 173 jz .Lstore_1byte
179 movb %r8b, (%rdi) 174 movzbq 1(%rsi), %r8
180 incq %rdi 175 movzbq (%rsi, %rdx), %r9
181 incq %rsi 176 movb %r8b, 1(%rdi)
182 decl %edx 177 movb %r9b, (%rdi, %rdx)
183 jnz .Lloop_1 178.Lstore_1byte:
179 movb %cl, (%rdi)
184 180
185.Lend: 181.Lend:
186 retq 182 retq
diff --git a/arch/x86/lib/memset_64.S b/arch/x86/lib/memset_64.S
index 79bd454b78a..2dcb3808cbd 100644
--- a/arch/x86/lib/memset_64.S
+++ b/arch/x86/lib/memset_64.S
@@ -19,16 +19,15 @@
19 .section .altinstr_replacement, "ax", @progbits 19 .section .altinstr_replacement, "ax", @progbits
20.Lmemset_c: 20.Lmemset_c:
21 movq %rdi,%r9 21 movq %rdi,%r9
22 movl %edx,%r8d 22 movq %rdx,%rcx
23 andl $7,%r8d 23 andl $7,%edx
24 movl %edx,%ecx 24 shrq $3,%rcx
25 shrl $3,%ecx
26 /* expand byte value */ 25 /* expand byte value */
27 movzbl %sil,%esi 26 movzbl %sil,%esi
28 movabs $0x0101010101010101,%rax 27 movabs $0x0101010101010101,%rax
29 mulq %rsi /* with rax, clobbers rdx */ 28 imulq %rsi,%rax
30 rep stosq 29 rep stosq
31 movl %r8d,%ecx 30 movl %edx,%ecx
32 rep stosb 31 rep stosb
33 movq %r9,%rax 32 movq %r9,%rax
34 ret 33 ret
@@ -50,7 +49,7 @@
50.Lmemset_c_e: 49.Lmemset_c_e:
51 movq %rdi,%r9 50 movq %rdi,%r9
52 movb %sil,%al 51 movb %sil,%al
53 movl %edx,%ecx 52 movq %rdx,%rcx
54 rep stosb 53 rep stosb
55 movq %r9,%rax 54 movq %r9,%rax
56 ret 55 ret
@@ -61,12 +60,11 @@ ENTRY(memset)
61ENTRY(__memset) 60ENTRY(__memset)
62 CFI_STARTPROC 61 CFI_STARTPROC
63 movq %rdi,%r10 62 movq %rdi,%r10
64 movq %rdx,%r11
65 63
66 /* expand byte value */ 64 /* expand byte value */
67 movzbl %sil,%ecx 65 movzbl %sil,%ecx
68 movabs $0x0101010101010101,%rax 66 movabs $0x0101010101010101,%rax
69 mul %rcx /* with rax, clobbers rdx */ 67 imulq %rcx,%rax
70 68
71 /* align dst */ 69 /* align dst */
72 movl %edi,%r9d 70 movl %edi,%r9d
@@ -75,13 +73,13 @@ ENTRY(__memset)
75 CFI_REMEMBER_STATE 73 CFI_REMEMBER_STATE
76.Lafter_bad_alignment: 74.Lafter_bad_alignment:
77 75
78 movl %r11d,%ecx 76 movq %rdx,%rcx
79 shrl $6,%ecx 77 shrq $6,%rcx
80 jz .Lhandle_tail 78 jz .Lhandle_tail
81 79
82 .p2align 4 80 .p2align 4
83.Lloop_64: 81.Lloop_64:
84 decl %ecx 82 decq %rcx
85 movq %rax,(%rdi) 83 movq %rax,(%rdi)
86 movq %rax,8(%rdi) 84 movq %rax,8(%rdi)
87 movq %rax,16(%rdi) 85 movq %rax,16(%rdi)
@@ -97,7 +95,7 @@ ENTRY(__memset)
97 to predict jump tables. */ 95 to predict jump tables. */
98 .p2align 4 96 .p2align 4
99.Lhandle_tail: 97.Lhandle_tail:
100 movl %r11d,%ecx 98 movl %edx,%ecx
101 andl $63&(~7),%ecx 99 andl $63&(~7),%ecx
102 jz .Lhandle_7 100 jz .Lhandle_7
103 shrl $3,%ecx 101 shrl $3,%ecx
@@ -109,12 +107,11 @@ ENTRY(__memset)
109 jnz .Lloop_8 107 jnz .Lloop_8
110 108
111.Lhandle_7: 109.Lhandle_7:
112 movl %r11d,%ecx 110 andl $7,%edx
113 andl $7,%ecx
114 jz .Lende 111 jz .Lende
115 .p2align 4 112 .p2align 4
116.Lloop_1: 113.Lloop_1:
117 decl %ecx 114 decl %edx
118 movb %al,(%rdi) 115 movb %al,(%rdi)
119 leaq 1(%rdi),%rdi 116 leaq 1(%rdi),%rdi
120 jnz .Lloop_1 117 jnz .Lloop_1
@@ -125,13 +122,13 @@ ENTRY(__memset)
125 122
126 CFI_RESTORE_STATE 123 CFI_RESTORE_STATE
127.Lbad_alignment: 124.Lbad_alignment:
128 cmpq $7,%r11 125 cmpq $7,%rdx
129 jbe .Lhandle_7 126 jbe .Lhandle_7
130 movq %rax,(%rdi) /* unaligned store */ 127 movq %rax,(%rdi) /* unaligned store */
131 movq $8,%r8 128 movq $8,%r8
132 subq %r9,%r8 129 subq %r9,%r8
133 addq %r8,%rdi 130 addq %r8,%rdi
134 subq %r8,%r11 131 subq %r8,%rdx
135 jmp .Lafter_bad_alignment 132 jmp .Lafter_bad_alignment
136.Lfinal: 133.Lfinal:
137 CFI_ENDPROC 134 CFI_ENDPROC
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
index 8ecbb4bba4b..f6679a7fb8c 100644
--- a/arch/x86/mm/hugetlbpage.c
+++ b/arch/x86/mm/hugetlbpage.c
@@ -308,10 +308,11 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
308{ 308{
309 struct hstate *h = hstate_file(file); 309 struct hstate *h = hstate_file(file);
310 struct mm_struct *mm = current->mm; 310 struct mm_struct *mm = current->mm;
311 struct vm_area_struct *vma, *prev_vma; 311 struct vm_area_struct *vma;
312 unsigned long base = mm->mmap_base, addr = addr0; 312 unsigned long base = mm->mmap_base;
313 unsigned long addr = addr0;
313 unsigned long largest_hole = mm->cached_hole_size; 314 unsigned long largest_hole = mm->cached_hole_size;
314 int first_time = 1; 315 unsigned long start_addr;
315 316
316 /* don't allow allocations above current base */ 317 /* don't allow allocations above current base */
317 if (mm->free_area_cache > base) 318 if (mm->free_area_cache > base)
@@ -322,6 +323,8 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
322 mm->free_area_cache = base; 323 mm->free_area_cache = base;
323 } 324 }
324try_again: 325try_again:
326 start_addr = mm->free_area_cache;
327
325 /* make sure it can fit in the remaining address space */ 328 /* make sure it can fit in the remaining address space */
326 if (mm->free_area_cache < len) 329 if (mm->free_area_cache < len)
327 goto fail; 330 goto fail;
@@ -337,22 +340,14 @@ try_again:
337 if (!vma) 340 if (!vma)
338 return addr; 341 return addr;
339 342
340 /* 343 if (addr + len <= vma->vm_start) {
341 * new region fits between prev_vma->vm_end and
342 * vma->vm_start, use it:
343 */
344 prev_vma = vma->vm_prev;
345 if (addr + len <= vma->vm_start &&
346 (!prev_vma || (addr >= prev_vma->vm_end))) {
347 /* remember the address as a hint for next time */ 344 /* remember the address as a hint for next time */
348 mm->cached_hole_size = largest_hole; 345 mm->cached_hole_size = largest_hole;
349 return (mm->free_area_cache = addr); 346 return (mm->free_area_cache = addr);
350 } else { 347 } else if (mm->free_area_cache == vma->vm_end) {
351 /* pull free_area_cache down to the first hole */ 348 /* pull free_area_cache down to the first hole */
352 if (mm->free_area_cache == vma->vm_end) { 349 mm->free_area_cache = vma->vm_start;
353 mm->free_area_cache = vma->vm_start; 350 mm->cached_hole_size = largest_hole;
354 mm->cached_hole_size = largest_hole;
355 }
356 } 351 }
357 352
358 /* remember the largest hole we saw so far */ 353 /* remember the largest hole we saw so far */
@@ -368,10 +363,9 @@ fail:
368 * if hint left us with no space for the requested 363 * if hint left us with no space for the requested
369 * mapping then try again: 364 * mapping then try again:
370 */ 365 */
371 if (first_time) { 366 if (start_addr != base) {
372 mm->free_area_cache = base; 367 mm->free_area_cache = base;
373 largest_hole = 0; 368 largest_hole = 0;
374 first_time = 0;
375 goto try_again; 369 goto try_again;
376 } 370 }
377 /* 371 /*
diff --git a/arch/x86/mm/kmemcheck/selftest.c b/arch/x86/mm/kmemcheck/selftest.c
index 036efbea8b2..aef7140c006 100644
--- a/arch/x86/mm/kmemcheck/selftest.c
+++ b/arch/x86/mm/kmemcheck/selftest.c
@@ -1,3 +1,4 @@
1#include <linux/bug.h>
1#include <linux/kernel.h> 2#include <linux/kernel.h>
2 3
3#include "opcode.h" 4#include "opcode.h"
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
index 46db56845f1..53489ff6bf8 100644
--- a/arch/x86/mm/numa_emulation.c
+++ b/arch/x86/mm/numa_emulation.c
@@ -28,7 +28,7 @@ static int __init emu_find_memblk_by_nid(int nid, const struct numa_meminfo *mi)
28 return -ENOENT; 28 return -ENOENT;
29} 29}
30 30
31static u64 mem_hole_size(u64 start, u64 end) 31static u64 __init mem_hole_size(u64 start, u64 end)
32{ 32{
33 unsigned long start_pfn = PFN_UP(start); 33 unsigned long start_pfn = PFN_UP(start);
34 unsigned long end_pfn = PFN_DOWN(end); 34 unsigned long end_pfn = PFN_DOWN(end);
@@ -60,7 +60,7 @@ static int __init emu_setup_memblk(struct numa_meminfo *ei,
60 eb->nid = nid; 60 eb->nid = nid;
61 61
62 if (emu_nid_to_phys[nid] == NUMA_NO_NODE) 62 if (emu_nid_to_phys[nid] == NUMA_NO_NODE)
63 emu_nid_to_phys[nid] = pb->nid; 63 emu_nid_to_phys[nid] = nid;
64 64
65 pb->start += size; 65 pb->start += size;
66 if (pb->start >= pb->end) { 66 if (pb->start >= pb->end) {
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 49a5cb55429..ed2835e148b 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -416,7 +416,12 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
416 kfree(sd); 416 kfree(sd);
417 } else { 417 } else {
418 get_current_resources(device, busnum, domain, &resources); 418 get_current_resources(device, busnum, domain, &resources);
419 if (list_empty(&resources)) 419
420 /*
421 * _CRS with no apertures is normal, so only fall back to
422 * defaults or native bridge info if we're ignoring _CRS.
423 */
424 if (!pci_use_crs)
420 x86_pci_root_bus_resources(busnum, &resources); 425 x86_pci_root_bus_resources(busnum, &resources);
421 bus = pci_create_root_bus(NULL, busnum, &pci_root_ops, sd, 426 bus = pci_create_root_bus(NULL, busnum, &pci_root_ops, sd,
422 &resources); 427 &resources);
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 6dd89555fbf..d0e6e403b4f 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -164,11 +164,11 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_
164 */ 164 */
165static void __devinit pci_fixup_transparent_bridge(struct pci_dev *dev) 165static void __devinit pci_fixup_transparent_bridge(struct pci_dev *dev)
166{ 166{
167 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && 167 if ((dev->device & 0xff00) == 0x2400)
168 (dev->device & 0xff00) == 0x2400)
169 dev->transparent = 1; 168 dev->transparent = 1;
170} 169}
171DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_fixup_transparent_bridge); 170DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
171 PCI_CLASS_BRIDGE_PCI, 8, pci_fixup_transparent_bridge);
172 172
173/* 173/*
174 * Fixup for C1 Halt Disconnect problem on nForce2 systems. 174 * Fixup for C1 Halt Disconnect problem on nForce2 systems.
@@ -322,9 +322,6 @@ static void __devinit pci_fixup_video(struct pci_dev *pdev)
322 struct pci_bus *bus; 322 struct pci_bus *bus;
323 u16 config; 323 u16 config;
324 324
325 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
326 return;
327
328 /* Is VGA routed to us? */ 325 /* Is VGA routed to us? */
329 bus = pdev->bus; 326 bus = pdev->bus;
330 while (bus) { 327 while (bus) {
@@ -353,7 +350,8 @@ static void __devinit pci_fixup_video(struct pci_dev *pdev)
353 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 350 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
354 } 351 }
355} 352}
356DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video); 353DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
354 PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
357 355
358 356
359static const struct dmi_system_id __devinitconst msi_k8t_dmi_table[] = { 357static const struct dmi_system_id __devinitconst msi_k8t_dmi_table[] = {
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 91821a1a0c3..831971e731f 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -39,6 +39,87 @@
39#include <asm/io_apic.h> 39#include <asm/io_apic.h>
40 40
41 41
42/*
43 * This list of dynamic mappings is for temporarily maintaining
44 * original BIOS BAR addresses for possible reinstatement.
45 */
46struct pcibios_fwaddrmap {
47 struct list_head list;
48 struct pci_dev *dev;
49 resource_size_t fw_addr[DEVICE_COUNT_RESOURCE];
50};
51
52static LIST_HEAD(pcibios_fwaddrmappings);
53static DEFINE_SPINLOCK(pcibios_fwaddrmap_lock);
54
55/* Must be called with 'pcibios_fwaddrmap_lock' lock held. */
56static struct pcibios_fwaddrmap *pcibios_fwaddrmap_lookup(struct pci_dev *dev)
57{
58 struct pcibios_fwaddrmap *map;
59
60 WARN_ON(!spin_is_locked(&pcibios_fwaddrmap_lock));
61
62 list_for_each_entry(map, &pcibios_fwaddrmappings, list)
63 if (map->dev == dev)
64 return map;
65
66 return NULL;
67}
68
69static void
70pcibios_save_fw_addr(struct pci_dev *dev, int idx, resource_size_t fw_addr)
71{
72 unsigned long flags;
73 struct pcibios_fwaddrmap *map;
74
75 spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags);
76 map = pcibios_fwaddrmap_lookup(dev);
77 if (!map) {
78 spin_unlock_irqrestore(&pcibios_fwaddrmap_lock, flags);
79 map = kzalloc(sizeof(*map), GFP_KERNEL);
80 if (!map)
81 return;
82
83 map->dev = pci_dev_get(dev);
84 map->fw_addr[idx] = fw_addr;
85 INIT_LIST_HEAD(&map->list);
86
87 spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags);
88 list_add_tail(&map->list, &pcibios_fwaddrmappings);
89 } else
90 map->fw_addr[idx] = fw_addr;
91 spin_unlock_irqrestore(&pcibios_fwaddrmap_lock, flags);
92}
93
94resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx)
95{
96 unsigned long flags;
97 struct pcibios_fwaddrmap *map;
98 resource_size_t fw_addr = 0;
99
100 spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags);
101 map = pcibios_fwaddrmap_lookup(dev);
102 if (map)
103 fw_addr = map->fw_addr[idx];
104 spin_unlock_irqrestore(&pcibios_fwaddrmap_lock, flags);
105
106 return fw_addr;
107}
108
109static void pcibios_fw_addr_list_del(void)
110{
111 unsigned long flags;
112 struct pcibios_fwaddrmap *entry, *next;
113
114 spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags);
115 list_for_each_entry_safe(entry, next, &pcibios_fwaddrmappings, list) {
116 list_del(&entry->list);
117 pci_dev_put(entry->dev);
118 kfree(entry);
119 }
120 spin_unlock_irqrestore(&pcibios_fwaddrmap_lock, flags);
121}
122
42static int 123static int
43skip_isa_ioresource_align(struct pci_dev *dev) { 124skip_isa_ioresource_align(struct pci_dev *dev) {
44 125
@@ -182,7 +263,8 @@ static void __init pcibios_allocate_resources(int pass)
182 idx, r, disabled, pass); 263 idx, r, disabled, pass);
183 if (pci_claim_resource(dev, idx) < 0) { 264 if (pci_claim_resource(dev, idx) < 0) {
184 /* We'll assign a new address later */ 265 /* We'll assign a new address later */
185 dev->fw_addr[idx] = r->start; 266 pcibios_save_fw_addr(dev,
267 idx, r->start);
186 r->end -= r->start; 268 r->end -= r->start;
187 r->start = 0; 269 r->start = 0;
188 } 270 }
@@ -228,6 +310,7 @@ static int __init pcibios_assign_resources(void)
228 } 310 }
229 311
230 pci_assign_unassigned_resources(); 312 pci_assign_unassigned_resources();
313 pcibios_fw_addr_list_del();
231 314
232 return 0; 315 return 0;
233} 316}
diff --git a/arch/x86/pci/mrst.c b/arch/x86/pci/mrst.c
index cb29191cee5..140942f66b3 100644
--- a/arch/x86/pci/mrst.c
+++ b/arch/x86/pci/mrst.c
@@ -43,6 +43,8 @@
43#define PCI_FIXED_BAR_4_SIZE 0x14 43#define PCI_FIXED_BAR_4_SIZE 0x14
44#define PCI_FIXED_BAR_5_SIZE 0x1c 44#define PCI_FIXED_BAR_5_SIZE 0x1c
45 45
46static int pci_soc_mode = 0;
47
46/** 48/**
47 * fixed_bar_cap - return the offset of the fixed BAR cap if found 49 * fixed_bar_cap - return the offset of the fixed BAR cap if found
48 * @bus: PCI bus 50 * @bus: PCI bus
@@ -148,7 +150,9 @@ static bool type1_access_ok(unsigned int bus, unsigned int devfn, int reg)
148 */ 150 */
149 if (reg >= 0x100 || reg == PCI_STATUS || reg == PCI_HEADER_TYPE) 151 if (reg >= 0x100 || reg == PCI_STATUS || reg == PCI_HEADER_TYPE)
150 return 0; 152 return 0;
151 if (bus == 0 && (devfn == PCI_DEVFN(2, 0) || devfn == PCI_DEVFN(0, 0))) 153 if (bus == 0 && (devfn == PCI_DEVFN(2, 0)
154 || devfn == PCI_DEVFN(0, 0)
155 || devfn == PCI_DEVFN(3, 0)))
152 return 1; 156 return 1;
153 return 0; /* langwell on others */ 157 return 0; /* langwell on others */
154} 158}
@@ -231,14 +235,43 @@ struct pci_ops pci_mrst_ops = {
231 */ 235 */
232int __init pci_mrst_init(void) 236int __init pci_mrst_init(void)
233{ 237{
234 printk(KERN_INFO "Moorestown platform detected, using MRST PCI ops\n"); 238 printk(KERN_INFO "Intel MID platform detected, using MID PCI ops\n");
235 pci_mmcfg_late_init(); 239 pci_mmcfg_late_init();
236 pcibios_enable_irq = mrst_pci_irq_enable; 240 pcibios_enable_irq = mrst_pci_irq_enable;
237 pci_root_ops = pci_mrst_ops; 241 pci_root_ops = pci_mrst_ops;
242 pci_soc_mode = 1;
238 /* Continue with standard init */ 243 /* Continue with standard init */
239 return 1; 244 return 1;
240} 245}
241 246
247/* Langwell devices are not true pci devices, they are not subject to 10 ms
248 * d3 to d0 delay required by pci spec.
249 */
250static void __devinit pci_d3delay_fixup(struct pci_dev *dev)
251{
252 /* PCI fixups are effectively decided compile time. If we have a dual
253 SoC/non-SoC kernel we don't want to mangle d3 on non SoC devices */
254 if (!pci_soc_mode)
255 return;
256 /* true pci devices in lincroft should allow type 1 access, the rest
257 * are langwell fake pci devices.
258 */
259 if (type1_access_ok(dev->bus->number, dev->devfn, PCI_DEVICE_ID))
260 return;
261 dev->d3_delay = 0;
262}
263DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_d3delay_fixup);
264
265static void __devinit mrst_power_off_unused_dev(struct pci_dev *dev)
266{
267 pci_set_power_state(dev, PCI_D3cold);
268}
269DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0801, mrst_power_off_unused_dev);
270DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0809, mrst_power_off_unused_dev);
271DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x080C, mrst_power_off_unused_dev);
272DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0812, mrst_power_off_unused_dev);
273DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0815, mrst_power_off_unused_dev);
274
242/* 275/*
243 * Langwell devices reside at fixed offsets, don't try to move them. 276 * Langwell devices reside at fixed offsets, don't try to move them.
244 */ 277 */
@@ -248,6 +281,9 @@ static void __devinit pci_fixed_bar_fixup(struct pci_dev *dev)
248 u32 size; 281 u32 size;
249 int i; 282 int i;
250 283
284 if (!pci_soc_mode)
285 return;
286
251 /* Must have extended configuration space */ 287 /* Must have extended configuration space */
252 if (dev->cfg_size < PCIE_CAP_OFFSET + 4) 288 if (dev->cfg_size < PCIE_CAP_OFFSET + 4)
253 return; 289 return;
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index d99346ea8fd..7415aa92791 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -324,6 +324,32 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
324out: 324out:
325 return ret; 325 return ret;
326} 326}
327
328static void xen_initdom_restore_msi_irqs(struct pci_dev *dev, int irq)
329{
330 int ret = 0;
331
332 if (pci_seg_supported) {
333 struct physdev_pci_device restore_ext;
334
335 restore_ext.seg = pci_domain_nr(dev->bus);
336 restore_ext.bus = dev->bus->number;
337 restore_ext.devfn = dev->devfn;
338 ret = HYPERVISOR_physdev_op(PHYSDEVOP_restore_msi_ext,
339 &restore_ext);
340 if (ret == -ENOSYS)
341 pci_seg_supported = false;
342 WARN(ret && ret != -ENOSYS, "restore_msi_ext -> %d\n", ret);
343 }
344 if (!pci_seg_supported) {
345 struct physdev_restore_msi restore;
346
347 restore.bus = dev->bus->number;
348 restore.devfn = dev->devfn;
349 ret = HYPERVISOR_physdev_op(PHYSDEVOP_restore_msi, &restore);
350 WARN(ret && ret != -ENOSYS, "restore_msi -> %d\n", ret);
351 }
352}
327#endif 353#endif
328 354
329static void xen_teardown_msi_irqs(struct pci_dev *dev) 355static void xen_teardown_msi_irqs(struct pci_dev *dev)
@@ -446,6 +472,7 @@ int __init pci_xen_initial_domain(void)
446#ifdef CONFIG_PCI_MSI 472#ifdef CONFIG_PCI_MSI
447 x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs; 473 x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs;
448 x86_msi.teardown_msi_irq = xen_teardown_msi_irq; 474 x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
475 x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs;
449#endif 476#endif
450 xen_setup_acpi_sci(); 477 xen_setup_acpi_sci();
451 __acpi_register_gsi = acpi_register_gsi_xen; 478 __acpi_register_gsi = acpi_register_gsi_xen;
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 4cf9bd0a165..92660edaa1e 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -26,6 +26,8 @@
26 * Skip non-WB memory and ignore empty memory ranges. 26 * Skip non-WB memory and ignore empty memory ranges.
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
29#include <linux/kernel.h> 31#include <linux/kernel.h>
30#include <linux/init.h> 32#include <linux/init.h>
31#include <linux/efi.h> 33#include <linux/efi.h>
@@ -47,7 +49,6 @@
47#include <asm/x86_init.h> 49#include <asm/x86_init.h>
48 50
49#define EFI_DEBUG 1 51#define EFI_DEBUG 1
50#define PFX "EFI: "
51 52
52int efi_enabled; 53int efi_enabled;
53EXPORT_SYMBOL(efi_enabled); 54EXPORT_SYMBOL(efi_enabled);
@@ -67,6 +68,9 @@ EXPORT_SYMBOL(efi);
67 68
68struct efi_memory_map memmap; 69struct efi_memory_map memmap;
69 70
71bool efi_64bit;
72static bool efi_native;
73
70static struct efi efi_phys __initdata; 74static struct efi efi_phys __initdata;
71static efi_system_table_t efi_systab __initdata; 75static efi_system_table_t efi_systab __initdata;
72 76
@@ -254,7 +258,7 @@ int efi_set_rtc_mmss(unsigned long nowtime)
254 258
255 status = efi.get_time(&eft, &cap); 259 status = efi.get_time(&eft, &cap);
256 if (status != EFI_SUCCESS) { 260 if (status != EFI_SUCCESS) {
257 printk(KERN_ERR "Oops: efitime: can't read time!\n"); 261 pr_err("Oops: efitime: can't read time!\n");
258 return -1; 262 return -1;
259 } 263 }
260 264
@@ -268,7 +272,7 @@ int efi_set_rtc_mmss(unsigned long nowtime)
268 272
269 status = efi.set_time(&eft); 273 status = efi.set_time(&eft);
270 if (status != EFI_SUCCESS) { 274 if (status != EFI_SUCCESS) {
271 printk(KERN_ERR "Oops: efitime: can't write time!\n"); 275 pr_err("Oops: efitime: can't write time!\n");
272 return -1; 276 return -1;
273 } 277 }
274 return 0; 278 return 0;
@@ -282,7 +286,7 @@ unsigned long efi_get_time(void)
282 286
283 status = efi.get_time(&eft, &cap); 287 status = efi.get_time(&eft, &cap);
284 if (status != EFI_SUCCESS) 288 if (status != EFI_SUCCESS)
285 printk(KERN_ERR "Oops: efitime: can't read time!\n"); 289 pr_err("Oops: efitime: can't read time!\n");
286 290
287 return mktime(eft.year, eft.month, eft.day, eft.hour, 291 return mktime(eft.year, eft.month, eft.day, eft.hour,
288 eft.minute, eft.second); 292 eft.minute, eft.second);
@@ -338,11 +342,16 @@ static void __init do_add_efi_memmap(void)
338 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 342 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
339} 343}
340 344
341void __init efi_memblock_x86_reserve_range(void) 345int __init efi_memblock_x86_reserve_range(void)
342{ 346{
343 unsigned long pmap; 347 unsigned long pmap;
344 348
345#ifdef CONFIG_X86_32 349#ifdef CONFIG_X86_32
350 /* Can't handle data above 4GB at this time */
351 if (boot_params.efi_info.efi_memmap_hi) {
352 pr_err("Memory map is above 4GB, disabling EFI.\n");
353 return -EINVAL;
354 }
346 pmap = boot_params.efi_info.efi_memmap; 355 pmap = boot_params.efi_info.efi_memmap;
347#else 356#else
348 pmap = (boot_params.efi_info.efi_memmap | 357 pmap = (boot_params.efi_info.efi_memmap |
@@ -354,6 +363,8 @@ void __init efi_memblock_x86_reserve_range(void)
354 memmap.desc_version = boot_params.efi_info.efi_memdesc_version; 363 memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
355 memmap.desc_size = boot_params.efi_info.efi_memdesc_size; 364 memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
356 memblock_reserve(pmap, memmap.nr_map * memmap.desc_size); 365 memblock_reserve(pmap, memmap.nr_map * memmap.desc_size);
366
367 return 0;
357} 368}
358 369
359#if EFI_DEBUG 370#if EFI_DEBUG
@@ -367,7 +378,7 @@ static void __init print_efi_memmap(void)
367 p < memmap.map_end; 378 p < memmap.map_end;
368 p += memmap.desc_size, i++) { 379 p += memmap.desc_size, i++) {
369 md = p; 380 md = p;
370 printk(KERN_INFO PFX "mem%02u: type=%u, attr=0x%llx, " 381 pr_info("mem%02u: type=%u, attr=0x%llx, "
371 "range=[0x%016llx-0x%016llx) (%lluMB)\n", 382 "range=[0x%016llx-0x%016llx) (%lluMB)\n",
372 i, md->type, md->attribute, md->phys_addr, 383 i, md->type, md->attribute, md->phys_addr,
373 md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT), 384 md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
@@ -400,7 +411,7 @@ void __init efi_reserve_boot_services(void)
400 memblock_is_region_reserved(start, size)) { 411 memblock_is_region_reserved(start, size)) {
401 /* Could not reserve, skip it */ 412 /* Could not reserve, skip it */
402 md->num_pages = 0; 413 md->num_pages = 0;
403 memblock_dbg(PFX "Could not reserve boot range " 414 memblock_dbg("Could not reserve boot range "
404 "[0x%010llx-0x%010llx]\n", 415 "[0x%010llx-0x%010llx]\n",
405 start, start+size-1); 416 start, start+size-1);
406 } else 417 } else
@@ -429,103 +440,172 @@ static void __init efi_free_boot_services(void)
429 } 440 }
430} 441}
431 442
432void __init efi_init(void) 443static int __init efi_systab_init(void *phys)
433{ 444{
434 efi_config_table_t *config_tables; 445 if (efi_64bit) {
435 efi_runtime_services_t *runtime; 446 efi_system_table_64_t *systab64;
436 efi_char16_t *c16; 447 u64 tmp = 0;
437 char vendor[100] = "unknown"; 448
438 int i = 0; 449 systab64 = early_ioremap((unsigned long)phys,
439 void *tmp; 450 sizeof(*systab64));
451 if (systab64 == NULL) {
452 pr_err("Couldn't map the system table!\n");
453 return -ENOMEM;
454 }
440 455
456 efi_systab.hdr = systab64->hdr;
457 efi_systab.fw_vendor = systab64->fw_vendor;
458 tmp |= systab64->fw_vendor;
459 efi_systab.fw_revision = systab64->fw_revision;
460 efi_systab.con_in_handle = systab64->con_in_handle;
461 tmp |= systab64->con_in_handle;
462 efi_systab.con_in = systab64->con_in;
463 tmp |= systab64->con_in;
464 efi_systab.con_out_handle = systab64->con_out_handle;
465 tmp |= systab64->con_out_handle;
466 efi_systab.con_out = systab64->con_out;
467 tmp |= systab64->con_out;
468 efi_systab.stderr_handle = systab64->stderr_handle;
469 tmp |= systab64->stderr_handle;
470 efi_systab.stderr = systab64->stderr;
471 tmp |= systab64->stderr;
472 efi_systab.runtime = (void *)(unsigned long)systab64->runtime;
473 tmp |= systab64->runtime;
474 efi_systab.boottime = (void *)(unsigned long)systab64->boottime;
475 tmp |= systab64->boottime;
476 efi_systab.nr_tables = systab64->nr_tables;
477 efi_systab.tables = systab64->tables;
478 tmp |= systab64->tables;
479
480 early_iounmap(systab64, sizeof(*systab64));
441#ifdef CONFIG_X86_32 481#ifdef CONFIG_X86_32
442 efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab; 482 if (tmp >> 32) {
443#else 483 pr_err("EFI data located above 4GB, disabling EFI.\n");
444 efi_phys.systab = (efi_system_table_t *) 484 return -EINVAL;
445 (boot_params.efi_info.efi_systab | 485 }
446 ((__u64)boot_params.efi_info.efi_systab_hi<<32));
447#endif 486#endif
487 } else {
488 efi_system_table_32_t *systab32;
489
490 systab32 = early_ioremap((unsigned long)phys,
491 sizeof(*systab32));
492 if (systab32 == NULL) {
493 pr_err("Couldn't map the system table!\n");
494 return -ENOMEM;
495 }
496
497 efi_systab.hdr = systab32->hdr;
498 efi_systab.fw_vendor = systab32->fw_vendor;
499 efi_systab.fw_revision = systab32->fw_revision;
500 efi_systab.con_in_handle = systab32->con_in_handle;
501 efi_systab.con_in = systab32->con_in;
502 efi_systab.con_out_handle = systab32->con_out_handle;
503 efi_systab.con_out = systab32->con_out;
504 efi_systab.stderr_handle = systab32->stderr_handle;
505 efi_systab.stderr = systab32->stderr;
506 efi_systab.runtime = (void *)(unsigned long)systab32->runtime;
507 efi_systab.boottime = (void *)(unsigned long)systab32->boottime;
508 efi_systab.nr_tables = systab32->nr_tables;
509 efi_systab.tables = systab32->tables;
510
511 early_iounmap(systab32, sizeof(*systab32));
512 }
448 513
449 efi.systab = early_ioremap((unsigned long)efi_phys.systab,
450 sizeof(efi_system_table_t));
451 if (efi.systab == NULL)
452 printk(KERN_ERR "Couldn't map the EFI system table!\n");
453 memcpy(&efi_systab, efi.systab, sizeof(efi_system_table_t));
454 early_iounmap(efi.systab, sizeof(efi_system_table_t));
455 efi.systab = &efi_systab; 514 efi.systab = &efi_systab;
456 515
457 /* 516 /*
458 * Verify the EFI Table 517 * Verify the EFI Table
459 */ 518 */
460 if (efi.systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) 519 if (efi.systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) {
461 printk(KERN_ERR "EFI system table signature incorrect!\n"); 520 pr_err("System table signature incorrect!\n");
521 return -EINVAL;
522 }
462 if ((efi.systab->hdr.revision >> 16) == 0) 523 if ((efi.systab->hdr.revision >> 16) == 0)
463 printk(KERN_ERR "Warning: EFI system table version " 524 pr_err("Warning: System table version "
464 "%d.%02d, expected 1.00 or greater!\n", 525 "%d.%02d, expected 1.00 or greater!\n",
465 efi.systab->hdr.revision >> 16, 526 efi.systab->hdr.revision >> 16,
466 efi.systab->hdr.revision & 0xffff); 527 efi.systab->hdr.revision & 0xffff);
467 528
468 /* 529 return 0;
469 * Show what we know for posterity 530}
470 */
471 c16 = tmp = early_ioremap(efi.systab->fw_vendor, 2);
472 if (c16) {
473 for (i = 0; i < sizeof(vendor) - 1 && *c16; ++i)
474 vendor[i] = *c16++;
475 vendor[i] = '\0';
476 } else
477 printk(KERN_ERR PFX "Could not map the firmware vendor!\n");
478 early_iounmap(tmp, 2);
479 531
480 printk(KERN_INFO "EFI v%u.%.02u by %s\n", 532static int __init efi_config_init(u64 tables, int nr_tables)
481 efi.systab->hdr.revision >> 16, 533{
482 efi.systab->hdr.revision & 0xffff, vendor); 534 void *config_tables, *tablep;
535 int i, sz;
536
537 if (efi_64bit)
538 sz = sizeof(efi_config_table_64_t);
539 else
540 sz = sizeof(efi_config_table_32_t);
483 541
484 /* 542 /*
485 * Let's see what config tables the firmware passed to us. 543 * Let's see what config tables the firmware passed to us.
486 */ 544 */
487 config_tables = early_ioremap( 545 config_tables = early_ioremap(tables, nr_tables * sz);
488 efi.systab->tables, 546 if (config_tables == NULL) {
489 efi.systab->nr_tables * sizeof(efi_config_table_t)); 547 pr_err("Could not map Configuration table!\n");
490 if (config_tables == NULL) 548 return -ENOMEM;
491 printk(KERN_ERR "Could not map EFI Configuration Table!\n"); 549 }
492 550
493 printk(KERN_INFO); 551 tablep = config_tables;
552 pr_info("");
494 for (i = 0; i < efi.systab->nr_tables; i++) { 553 for (i = 0; i < efi.systab->nr_tables; i++) {
495 if (!efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID)) { 554 efi_guid_t guid;
496 efi.mps = config_tables[i].table; 555 unsigned long table;
497 printk(" MPS=0x%lx ", config_tables[i].table); 556
498 } else if (!efi_guidcmp(config_tables[i].guid, 557 if (efi_64bit) {
499 ACPI_20_TABLE_GUID)) { 558 u64 table64;
500 efi.acpi20 = config_tables[i].table; 559 guid = ((efi_config_table_64_t *)tablep)->guid;
501 printk(" ACPI 2.0=0x%lx ", config_tables[i].table); 560 table64 = ((efi_config_table_64_t *)tablep)->table;
502 } else if (!efi_guidcmp(config_tables[i].guid, 561 table = table64;
503 ACPI_TABLE_GUID)) { 562#ifdef CONFIG_X86_32
504 efi.acpi = config_tables[i].table; 563 if (table64 >> 32) {
505 printk(" ACPI=0x%lx ", config_tables[i].table); 564 pr_cont("\n");
506 } else if (!efi_guidcmp(config_tables[i].guid, 565 pr_err("Table located above 4GB, disabling EFI.\n");
507 SMBIOS_TABLE_GUID)) { 566 early_iounmap(config_tables,
508 efi.smbios = config_tables[i].table; 567 efi.systab->nr_tables * sz);
509 printk(" SMBIOS=0x%lx ", config_tables[i].table); 568 return -EINVAL;
569 }
570#endif
571 } else {
572 guid = ((efi_config_table_32_t *)tablep)->guid;
573 table = ((efi_config_table_32_t *)tablep)->table;
574 }
575 if (!efi_guidcmp(guid, MPS_TABLE_GUID)) {
576 efi.mps = table;
577 pr_cont(" MPS=0x%lx ", table);
578 } else if (!efi_guidcmp(guid, ACPI_20_TABLE_GUID)) {
579 efi.acpi20 = table;
580 pr_cont(" ACPI 2.0=0x%lx ", table);
581 } else if (!efi_guidcmp(guid, ACPI_TABLE_GUID)) {
582 efi.acpi = table;
583 pr_cont(" ACPI=0x%lx ", table);
584 } else if (!efi_guidcmp(guid, SMBIOS_TABLE_GUID)) {
585 efi.smbios = table;
586 pr_cont(" SMBIOS=0x%lx ", table);
510#ifdef CONFIG_X86_UV 587#ifdef CONFIG_X86_UV
511 } else if (!efi_guidcmp(config_tables[i].guid, 588 } else if (!efi_guidcmp(guid, UV_SYSTEM_TABLE_GUID)) {
512 UV_SYSTEM_TABLE_GUID)) { 589 efi.uv_systab = table;
513 efi.uv_systab = config_tables[i].table; 590 pr_cont(" UVsystab=0x%lx ", table);
514 printk(" UVsystab=0x%lx ", config_tables[i].table);
515#endif 591#endif
516 } else if (!efi_guidcmp(config_tables[i].guid, 592 } else if (!efi_guidcmp(guid, HCDP_TABLE_GUID)) {
517 HCDP_TABLE_GUID)) { 593 efi.hcdp = table;
518 efi.hcdp = config_tables[i].table; 594 pr_cont(" HCDP=0x%lx ", table);
519 printk(" HCDP=0x%lx ", config_tables[i].table); 595 } else if (!efi_guidcmp(guid, UGA_IO_PROTOCOL_GUID)) {
520 } else if (!efi_guidcmp(config_tables[i].guid, 596 efi.uga = table;
521 UGA_IO_PROTOCOL_GUID)) { 597 pr_cont(" UGA=0x%lx ", table);
522 efi.uga = config_tables[i].table;
523 printk(" UGA=0x%lx ", config_tables[i].table);
524 } 598 }
599 tablep += sz;
525 } 600 }
526 printk("\n"); 601 pr_cont("\n");
527 early_iounmap(config_tables, 602 early_iounmap(config_tables, efi.systab->nr_tables * sz);
528 efi.systab->nr_tables * sizeof(efi_config_table_t)); 603 return 0;
604}
605
606static int __init efi_runtime_init(void)
607{
608 efi_runtime_services_t *runtime;
529 609
530 /* 610 /*
531 * Check out the runtime services table. We need to map 611 * Check out the runtime services table. We need to map
@@ -535,43 +615,116 @@ void __init efi_init(void)
535 */ 615 */
536 runtime = early_ioremap((unsigned long)efi.systab->runtime, 616 runtime = early_ioremap((unsigned long)efi.systab->runtime,
537 sizeof(efi_runtime_services_t)); 617 sizeof(efi_runtime_services_t));
538 if (runtime != NULL) { 618 if (!runtime) {
539 /* 619 pr_err("Could not map the runtime service table!\n");
540 * We will only need *early* access to the following 620 return -ENOMEM;
541 * two EFI runtime services before set_virtual_address_map 621 }
542 * is invoked. 622 /*
543 */ 623 * We will only need *early* access to the following
544 efi_phys.get_time = (efi_get_time_t *)runtime->get_time; 624 * two EFI runtime services before set_virtual_address_map
545 efi_phys.set_virtual_address_map = 625 * is invoked.
546 (efi_set_virtual_address_map_t *) 626 */
547 runtime->set_virtual_address_map; 627 efi_phys.get_time = (efi_get_time_t *)runtime->get_time;
548 /* 628 efi_phys.set_virtual_address_map =
549 * Make efi_get_time can be called before entering 629 (efi_set_virtual_address_map_t *)
550 * virtual mode. 630 runtime->set_virtual_address_map;
551 */ 631 /*
552 efi.get_time = phys_efi_get_time; 632 * Make efi_get_time can be called before entering
553 } else 633 * virtual mode.
554 printk(KERN_ERR "Could not map the EFI runtime service " 634 */
555 "table!\n"); 635 efi.get_time = phys_efi_get_time;
556 early_iounmap(runtime, sizeof(efi_runtime_services_t)); 636 early_iounmap(runtime, sizeof(efi_runtime_services_t));
557 637
638 return 0;
639}
640
641static int __init efi_memmap_init(void)
642{
558 /* Map the EFI memory map */ 643 /* Map the EFI memory map */
559 memmap.map = early_ioremap((unsigned long)memmap.phys_map, 644 memmap.map = early_ioremap((unsigned long)memmap.phys_map,
560 memmap.nr_map * memmap.desc_size); 645 memmap.nr_map * memmap.desc_size);
561 if (memmap.map == NULL) 646 if (memmap.map == NULL) {
562 printk(KERN_ERR "Could not map the EFI memory map!\n"); 647 pr_err("Could not map the memory map!\n");
648 return -ENOMEM;
649 }
563 memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size); 650 memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
564 651
565 if (memmap.desc_size != sizeof(efi_memory_desc_t))
566 printk(KERN_WARNING
567 "Kernel-defined memdesc doesn't match the one from EFI!\n");
568
569 if (add_efi_memmap) 652 if (add_efi_memmap)
570 do_add_efi_memmap(); 653 do_add_efi_memmap();
571 654
655 return 0;
656}
657
658void __init efi_init(void)
659{
660 efi_char16_t *c16;
661 char vendor[100] = "unknown";
662 int i = 0;
663 void *tmp;
664
665#ifdef CONFIG_X86_32
666 if (boot_params.efi_info.efi_systab_hi ||
667 boot_params.efi_info.efi_memmap_hi) {
668 pr_info("Table located above 4GB, disabling EFI.\n");
669 efi_enabled = 0;
670 return;
671 }
672 efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab;
673 efi_native = !efi_64bit;
674#else
675 efi_phys.systab = (efi_system_table_t *)
676 (boot_params.efi_info.efi_systab |
677 ((__u64)boot_params.efi_info.efi_systab_hi<<32));
678 efi_native = efi_64bit;
679#endif
680
681 if (efi_systab_init(efi_phys.systab)) {
682 efi_enabled = 0;
683 return;
684 }
685
686 /*
687 * Show what we know for posterity
688 */
689 c16 = tmp = early_ioremap(efi.systab->fw_vendor, 2);
690 if (c16) {
691 for (i = 0; i < sizeof(vendor) - 1 && *c16; ++i)
692 vendor[i] = *c16++;
693 vendor[i] = '\0';
694 } else
695 pr_err("Could not map the firmware vendor!\n");
696 early_iounmap(tmp, 2);
697
698 pr_info("EFI v%u.%.02u by %s\n",
699 efi.systab->hdr.revision >> 16,
700 efi.systab->hdr.revision & 0xffff, vendor);
701
702 if (efi_config_init(efi.systab->tables, efi.systab->nr_tables)) {
703 efi_enabled = 0;
704 return;
705 }
706
707 /*
708 * Note: We currently don't support runtime services on an EFI
709 * that doesn't match the kernel 32/64-bit mode.
710 */
711
712 if (!efi_native)
713 pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
714 else if (efi_runtime_init()) {
715 efi_enabled = 0;
716 return;
717 }
718
719 if (efi_memmap_init()) {
720 efi_enabled = 0;
721 return;
722 }
572#ifdef CONFIG_X86_32 723#ifdef CONFIG_X86_32
573 x86_platform.get_wallclock = efi_get_time; 724 if (efi_native) {
574 x86_platform.set_wallclock = efi_set_rtc_mmss; 725 x86_platform.get_wallclock = efi_get_time;
726 x86_platform.set_wallclock = efi_set_rtc_mmss;
727 }
575#endif 728#endif
576 729
577#if EFI_DEBUG 730#if EFI_DEBUG
@@ -629,6 +782,14 @@ void __init efi_enter_virtual_mode(void)
629 782
630 efi.systab = NULL; 783 efi.systab = NULL;
631 784
785 /*
786 * We don't do virtual mode, since we don't do runtime services, on
787 * non-native EFI
788 */
789
790 if (!efi_native)
791 goto out;
792
632 /* Merge contiguous regions of the same type and attribute */ 793 /* Merge contiguous regions of the same type and attribute */
633 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 794 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
634 u64 prev_size; 795 u64 prev_size;
@@ -677,7 +838,7 @@ void __init efi_enter_virtual_mode(void)
677 md->virt_addr = (u64) (unsigned long) va; 838 md->virt_addr = (u64) (unsigned long) va;
678 839
679 if (!va) { 840 if (!va) {
680 printk(KERN_ERR PFX "ioremap of 0x%llX failed!\n", 841 pr_err("ioremap of 0x%llX failed!\n",
681 (unsigned long long)md->phys_addr); 842 (unsigned long long)md->phys_addr);
682 continue; 843 continue;
683 } 844 }
@@ -711,8 +872,8 @@ void __init efi_enter_virtual_mode(void)
711 (efi_memory_desc_t *)__pa(new_memmap)); 872 (efi_memory_desc_t *)__pa(new_memmap));
712 873
713 if (status != EFI_SUCCESS) { 874 if (status != EFI_SUCCESS) {
714 printk(KERN_ALERT "Unable to switch EFI into virtual mode " 875 pr_alert("Unable to switch EFI into virtual mode "
715 "(status=%lx)!\n", status); 876 "(status=%lx)!\n", status);
716 panic("EFI call to SetVirtualAddressMap() failed!"); 877 panic("EFI call to SetVirtualAddressMap() failed!");
717 } 878 }
718 879
@@ -744,6 +905,8 @@ void __init efi_enter_virtual_mode(void)
744 efi.query_capsule_caps = virt_efi_query_capsule_caps; 905 efi.query_capsule_caps = virt_efi_query_capsule_caps;
745 if (__supported_pte_mask & _PAGE_NX) 906 if (__supported_pte_mask & _PAGE_NX)
746 runtime_code_page_mkexec(); 907 runtime_code_page_mkexec();
908
909out:
747 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); 910 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
748 memmap.map = NULL; 911 memmap.map = NULL;
749 kfree(new_memmap); 912 kfree(new_memmap);
diff --git a/arch/x86/platform/geode/Makefile b/arch/x86/platform/geode/Makefile
index 07c9cd05021..246b788847f 100644
--- a/arch/x86/platform/geode/Makefile
+++ b/arch/x86/platform/geode/Makefile
@@ -1 +1,2 @@
1obj-$(CONFIG_ALIX) += alix.o 1obj-$(CONFIG_ALIX) += alix.o
2obj-$(CONFIG_NET5501) += net5501.o
diff --git a/arch/x86/platform/geode/alix.c b/arch/x86/platform/geode/alix.c
index dc5f1d32ace..90e23e7679a 100644
--- a/arch/x86/platform/geode/alix.c
+++ b/arch/x86/platform/geode/alix.c
@@ -6,6 +6,7 @@
6 * 6 *
7 * Copyright (C) 2008 Constantin Baranov <const@mimas.ru> 7 * Copyright (C) 2008 Constantin Baranov <const@mimas.ru>
8 * Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com> 8 * Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com>
9 * and Philip Prindeville <philipp@redfish-solutions.com>
9 * 10 *
10 * TODO: There are large similarities with leds-net5501.c 11 * TODO: There are large similarities with leds-net5501.c
11 * by Alessandro Zummo <a.zummo@towertech.it> 12 * by Alessandro Zummo <a.zummo@towertech.it>
@@ -24,14 +25,47 @@
24#include <linux/leds.h> 25#include <linux/leds.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/input.h>
29#include <linux/gpio_keys.h>
30#include <linux/dmi.h>
27 31
28#include <asm/geode.h> 32#include <asm/geode.h>
29 33
34#define BIOS_SIGNATURE_TINYBIOS 0xf0000
35#define BIOS_SIGNATURE_COREBOOT 0x500
36#define BIOS_REGION_SIZE 0x10000
37
30static bool force = 0; 38static bool force = 0;
31module_param(force, bool, 0444); 39module_param(force, bool, 0444);
32/* FIXME: Award bios is not automatically detected as Alix platform */ 40/* FIXME: Award bios is not automatically detected as Alix platform */
33MODULE_PARM_DESC(force, "Force detection as ALIX.2/ALIX.3 platform"); 41MODULE_PARM_DESC(force, "Force detection as ALIX.2/ALIX.3 platform");
34 42
43static struct gpio_keys_button alix_gpio_buttons[] = {
44 {
45 .code = KEY_RESTART,
46 .gpio = 24,
47 .active_low = 1,
48 .desc = "Reset button",
49 .type = EV_KEY,
50 .wakeup = 0,
51 .debounce_interval = 100,
52 .can_disable = 0,
53 }
54};
55static struct gpio_keys_platform_data alix_buttons_data = {
56 .buttons = alix_gpio_buttons,
57 .nbuttons = ARRAY_SIZE(alix_gpio_buttons),
58 .poll_interval = 20,
59};
60
61static struct platform_device alix_buttons_dev = {
62 .name = "gpio-keys-polled",
63 .id = 1,
64 .dev = {
65 .platform_data = &alix_buttons_data,
66 }
67};
68
35static struct gpio_led alix_leds[] = { 69static struct gpio_led alix_leds[] = {
36 { 70 {
37 .name = "alix:1", 71 .name = "alix:1",
@@ -64,17 +98,22 @@ static struct platform_device alix_leds_dev = {
64 .dev.platform_data = &alix_leds_data, 98 .dev.platform_data = &alix_leds_data,
65}; 99};
66 100
101static struct __initdata platform_device *alix_devs[] = {
102 &alix_buttons_dev,
103 &alix_leds_dev,
104};
105
67static void __init register_alix(void) 106static void __init register_alix(void)
68{ 107{
69 /* Setup LED control through leds-gpio driver */ 108 /* Setup LED control through leds-gpio driver */
70 platform_device_register(&alix_leds_dev); 109 platform_add_devices(alix_devs, ARRAY_SIZE(alix_devs));
71} 110}
72 111
73static int __init alix_present(unsigned long bios_phys, 112static bool __init alix_present(unsigned long bios_phys,
74 const char *alix_sig, 113 const char *alix_sig,
75 size_t alix_sig_len) 114 size_t alix_sig_len)
76{ 115{
77 const size_t bios_len = 0x00010000; 116 const size_t bios_len = BIOS_REGION_SIZE;
78 const char *bios_virt; 117 const char *bios_virt;
79 const char *scan_end; 118 const char *scan_end;
80 const char *p; 119 const char *p;
@@ -84,7 +123,7 @@ static int __init alix_present(unsigned long bios_phys,
84 printk(KERN_NOTICE "%s: forced to skip BIOS test, " 123 printk(KERN_NOTICE "%s: forced to skip BIOS test, "
85 "assume system is ALIX.2/ALIX.3\n", 124 "assume system is ALIX.2/ALIX.3\n",
86 KBUILD_MODNAME); 125 KBUILD_MODNAME);
87 return 1; 126 return true;
88 } 127 }
89 128
90 bios_virt = phys_to_virt(bios_phys); 129 bios_virt = phys_to_virt(bios_phys);
@@ -109,15 +148,33 @@ static int __init alix_present(unsigned long bios_phys,
109 *a = '\0'; 148 *a = '\0';
110 149
111 tail = p + alix_sig_len; 150 tail = p + alix_sig_len;
112 if ((tail[0] == '2' || tail[0] == '3')) { 151 if ((tail[0] == '2' || tail[0] == '3' || tail[0] == '6')) {
113 printk(KERN_INFO 152 printk(KERN_INFO
114 "%s: system is recognized as \"%s\"\n", 153 "%s: system is recognized as \"%s\"\n",
115 KBUILD_MODNAME, name); 154 KBUILD_MODNAME, name);
116 return 1; 155 return true;
117 } 156 }
118 } 157 }
119 158
120 return 0; 159 return false;
160}
161
162static bool __init alix_present_dmi(void)
163{
164 const char *vendor, *product;
165
166 vendor = dmi_get_system_info(DMI_SYS_VENDOR);
167 if (!vendor || strcmp(vendor, "PC Engines"))
168 return false;
169
170 product = dmi_get_system_info(DMI_PRODUCT_NAME);
171 if (!product || (strcmp(product, "ALIX.2D") && strcmp(product, "ALIX.6")))
172 return false;
173
174 printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n",
175 KBUILD_MODNAME, vendor, product);
176
177 return true;
121} 178}
122 179
123static int __init alix_init(void) 180static int __init alix_init(void)
@@ -128,8 +185,9 @@ static int __init alix_init(void)
128 if (!is_geode()) 185 if (!is_geode())
129 return 0; 186 return 0;
130 187
131 if (alix_present(0xf0000, tinybios_sig, sizeof(tinybios_sig) - 1) || 188 if (alix_present(BIOS_SIGNATURE_TINYBIOS, tinybios_sig, sizeof(tinybios_sig) - 1) ||
132 alix_present(0x500, coreboot_sig, sizeof(coreboot_sig) - 1)) 189 alix_present(BIOS_SIGNATURE_COREBOOT, coreboot_sig, sizeof(coreboot_sig) - 1) ||
190 alix_present_dmi())
133 register_alix(); 191 register_alix();
134 192
135 return 0; 193 return 0;
diff --git a/arch/x86/platform/geode/net5501.c b/arch/x86/platform/geode/net5501.c
new file mode 100644
index 00000000000..66d377e334f
--- /dev/null
+++ b/arch/x86/platform/geode/net5501.c
@@ -0,0 +1,154 @@
1/*
2 * System Specific setup for Soekris net5501
3 * At the moment this means setup of GPIO control of LEDs and buttons
4 * on net5501 boards.
5 *
6 *
7 * Copyright (C) 2008-2009 Tower Technologies
8 * Written by Alessandro Zummo <a.zummo@towertech.it>
9 *
10 * Copyright (C) 2008 Constantin Baranov <const@mimas.ru>
11 * Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com>
12 * and Philip Prindeville <philipp@redfish-solutions.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
16 * as published by the Free Software Foundation.
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/io.h>
22#include <linux/string.h>
23#include <linux/module.h>
24#include <linux/leds.h>
25#include <linux/platform_device.h>
26#include <linux/gpio.h>
27#include <linux/input.h>
28#include <linux/gpio_keys.h>
29
30#include <asm/geode.h>
31
32#define BIOS_REGION_BASE 0xffff0000
33#define BIOS_REGION_SIZE 0x00010000
34
35static struct gpio_keys_button net5501_gpio_buttons[] = {
36 {
37 .code = KEY_RESTART,
38 .gpio = 24,
39 .active_low = 1,
40 .desc = "Reset button",
41 .type = EV_KEY,
42 .wakeup = 0,
43 .debounce_interval = 100,
44 .can_disable = 0,
45 }
46};
47static struct gpio_keys_platform_data net5501_buttons_data = {
48 .buttons = net5501_gpio_buttons,
49 .nbuttons = ARRAY_SIZE(net5501_gpio_buttons),
50 .poll_interval = 20,
51};
52
53static struct platform_device net5501_buttons_dev = {
54 .name = "gpio-keys-polled",
55 .id = 1,
56 .dev = {
57 .platform_data = &net5501_buttons_data,
58 }
59};
60
61static struct gpio_led net5501_leds[] = {
62 {
63 .name = "net5501:1",
64 .gpio = 6,
65 .default_trigger = "default-on",
66 .active_low = 1,
67 },
68};
69
70static struct gpio_led_platform_data net5501_leds_data = {
71 .num_leds = ARRAY_SIZE(net5501_leds),
72 .leds = net5501_leds,
73};
74
75static struct platform_device net5501_leds_dev = {
76 .name = "leds-gpio",
77 .id = -1,
78 .dev.platform_data = &net5501_leds_data,
79};
80
81static struct __initdata platform_device *net5501_devs[] = {
82 &net5501_buttons_dev,
83 &net5501_leds_dev,
84};
85
86static void __init register_net5501(void)
87{
88 /* Setup LED control through leds-gpio driver */
89 platform_add_devices(net5501_devs, ARRAY_SIZE(net5501_devs));
90}
91
92struct net5501_board {
93 u16 offset;
94 u16 len;
95 char *sig;
96};
97
98static struct net5501_board __initdata boards[] = {
99 { 0xb7b, 7, "net5501" }, /* net5501 v1.33/1.33c */
100 { 0xb1f, 7, "net5501" }, /* net5501 v1.32i */
101};
102
103static bool __init net5501_present(void)
104{
105 int i;
106 unsigned char *rombase, *bios;
107 bool found = false;
108
109 rombase = ioremap(BIOS_REGION_BASE, BIOS_REGION_SIZE - 1);
110 if (!rombase) {
111 printk(KERN_ERR "%s: failed to get rombase\n", KBUILD_MODNAME);
112 return found;
113 }
114
115 bios = rombase + 0x20; /* null terminated */
116
117 if (memcmp(bios, "comBIOS", 7))
118 goto unmap;
119
120 for (i = 0; i < ARRAY_SIZE(boards); i++) {
121 unsigned char *model = rombase + boards[i].offset;
122
123 if (!memcmp(model, boards[i].sig, boards[i].len)) {
124 printk(KERN_INFO "%s: system is recognized as \"%s\"\n",
125 KBUILD_MODNAME, model);
126
127 found = true;
128 break;
129 }
130 }
131
132unmap:
133 iounmap(rombase);
134 return found;
135}
136
137static int __init net5501_init(void)
138{
139 if (!is_geode())
140 return 0;
141
142 if (!net5501_present())
143 return 0;
144
145 register_net5501();
146
147 return 0;
148}
149
150module_init(net5501_init);
151
152MODULE_AUTHOR("Philip Prindeville <philipp@redfish-solutions.com>");
153MODULE_DESCRIPTION("Soekris net5501 System Setup");
154MODULE_LICENSE("GPL");
diff --git a/arch/x86/platform/mrst/Makefile b/arch/x86/platform/mrst/Makefile
index 7baed5135e0..af1da7e623f 100644
--- a/arch/x86/platform/mrst/Makefile
+++ b/arch/x86/platform/mrst/Makefile
@@ -1,4 +1,3 @@
1obj-$(CONFIG_X86_INTEL_MID) += mrst.o 1obj-$(CONFIG_X86_INTEL_MID) += mrst.o
2obj-$(CONFIG_X86_INTEL_MID) += vrtc.o 2obj-$(CONFIG_X86_INTEL_MID) += vrtc.o
3obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_mrst.o 3obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_mrst.o
4obj-$(CONFIG_X86_MRST) += pmu.o
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index 475e2cd0f3c..e0a37233c0a 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -28,6 +28,8 @@
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/notifier.h> 29#include <linux/notifier.h>
30#include <linux/mfd/intel_msic.h> 30#include <linux/mfd/intel_msic.h>
31#include <linux/gpio.h>
32#include <linux/i2c/tc35876x.h>
31 33
32#include <asm/setup.h> 34#include <asm/setup.h>
33#include <asm/mpspec_def.h> 35#include <asm/mpspec_def.h>
@@ -78,16 +80,11 @@ int sfi_mrtc_num;
78 80
79static void mrst_power_off(void) 81static void mrst_power_off(void)
80{ 82{
81 if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT)
82 intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 1);
83} 83}
84 84
85static void mrst_reboot(void) 85static void mrst_reboot(void)
86{ 86{
87 if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) 87 intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0);
88 intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 0);
89 else
90 intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0);
91} 88}
92 89
93/* parse all the mtimer info to a static mtimer array */ 90/* parse all the mtimer info to a static mtimer array */
@@ -200,34 +197,28 @@ int __init sfi_parse_mrtc(struct sfi_table_header *table)
200 197
201static unsigned long __init mrst_calibrate_tsc(void) 198static unsigned long __init mrst_calibrate_tsc(void)
202{ 199{
203 unsigned long flags, fast_calibrate; 200 unsigned long fast_calibrate;
204 if (__mrst_cpu_chip == MRST_CPU_CHIP_PENWELL) { 201 u32 lo, hi, ratio, fsb;
205 u32 lo, hi, ratio, fsb; 202
206 203 rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
207 rdmsr(MSR_IA32_PERF_STATUS, lo, hi); 204 pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi);
208 pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi); 205 ratio = (hi >> 8) & 0x1f;
209 ratio = (hi >> 8) & 0x1f; 206 pr_debug("ratio is %d\n", ratio);
210 pr_debug("ratio is %d\n", ratio); 207 if (!ratio) {
211 if (!ratio) { 208 pr_err("read a zero ratio, should be incorrect!\n");
212 pr_err("read a zero ratio, should be incorrect!\n"); 209 pr_err("force tsc ratio to 16 ...\n");
213 pr_err("force tsc ratio to 16 ...\n"); 210 ratio = 16;
214 ratio = 16;
215 }
216 rdmsr(MSR_FSB_FREQ, lo, hi);
217 if ((lo & 0x7) == 0x7)
218 fsb = PENWELL_FSB_FREQ_83SKU;
219 else
220 fsb = PENWELL_FSB_FREQ_100SKU;
221 fast_calibrate = ratio * fsb;
222 pr_debug("read penwell tsc %lu khz\n", fast_calibrate);
223 lapic_timer_frequency = fsb * 1000 / HZ;
224 /* mark tsc clocksource as reliable */
225 set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE);
226 } else {
227 local_irq_save(flags);
228 fast_calibrate = apbt_quick_calibrate();
229 local_irq_restore(flags);
230 } 211 }
212 rdmsr(MSR_FSB_FREQ, lo, hi);
213 if ((lo & 0x7) == 0x7)
214 fsb = PENWELL_FSB_FREQ_83SKU;
215 else
216 fsb = PENWELL_FSB_FREQ_100SKU;
217 fast_calibrate = ratio * fsb;
218 pr_debug("read penwell tsc %lu khz\n", fast_calibrate);
219 lapic_timer_frequency = fsb * 1000 / HZ;
220 /* mark tsc clocksource as reliable */
221 set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE);
231 222
232 if (fast_calibrate) 223 if (fast_calibrate)
233 return fast_calibrate; 224 return fast_calibrate;
@@ -261,16 +252,11 @@ static void __cpuinit mrst_arch_setup(void)
261{ 252{
262 if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27) 253 if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27)
263 __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL; 254 __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL;
264 else if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x26)
265 __mrst_cpu_chip = MRST_CPU_CHIP_LINCROFT;
266 else { 255 else {
267 pr_err("Unknown Moorestown CPU (%d:%d), default to Lincroft\n", 256 pr_err("Unknown Intel MID CPU (%d:%d), default to Penwell\n",
268 boot_cpu_data.x86, boot_cpu_data.x86_model); 257 boot_cpu_data.x86, boot_cpu_data.x86_model);
269 __mrst_cpu_chip = MRST_CPU_CHIP_LINCROFT; 258 __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL;
270 } 259 }
271 pr_debug("Moorestown CPU %s identified\n",
272 (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) ?
273 "Lincroft" : "Penwell");
274} 260}
275 261
276/* MID systems don't have i8042 controller */ 262/* MID systems don't have i8042 controller */
@@ -686,6 +672,24 @@ static void *msic_ocd_platform_data(void *info)
686 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_OCD); 672 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_OCD);
687} 673}
688 674
675static void *msic_thermal_platform_data(void *info)
676{
677 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_THERMAL);
678}
679
680/* tc35876x DSI-LVDS bridge chip and panel platform data */
681static void *tc35876x_platform_data(void *data)
682{
683 static struct tc35876x_platform_data pdata;
684
685 /* gpio pins set to -1 will not be used by the driver */
686 pdata.gpio_bridge_reset = get_gpio_by_name("LCMB_RXEN");
687 pdata.gpio_panel_bl_en = get_gpio_by_name("6S6P_BL_EN");
688 pdata.gpio_panel_vadd = get_gpio_by_name("EN_VREG_LCD_V3P3");
689
690 return &pdata;
691}
692
689static const struct devs_id __initconst device_ids[] = { 693static const struct devs_id __initconst device_ids[] = {
690 {"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data}, 694 {"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data},
691 {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, 695 {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data},
@@ -698,6 +702,7 @@ static const struct devs_id __initconst device_ids[] = {
698 {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, 702 {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data},
699 {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, 703 {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data},
700 {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data}, 704 {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data},
705 {"i2c_disp_brig", SFI_DEV_TYPE_I2C, 0, &tc35876x_platform_data},
701 706
702 /* MSIC subdevices */ 707 /* MSIC subdevices */
703 {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data}, 708 {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data},
@@ -705,6 +710,7 @@ static const struct devs_id __initconst device_ids[] = {
705 {"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data}, 710 {"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data},
706 {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data}, 711 {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data},
707 {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data}, 712 {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data},
713 {"msic_thermal", SFI_DEV_TYPE_IPC, 1, &msic_thermal_platform_data},
708 714
709 {}, 715 {},
710}; 716};
diff --git a/arch/x86/platform/mrst/pmu.c b/arch/x86/platform/mrst/pmu.c
deleted file mode 100644
index c0ac06da57a..00000000000
--- a/arch/x86/platform/mrst/pmu.c
+++ /dev/null
@@ -1,817 +0,0 @@
1/*
2 * mrst/pmu.c - driver for MRST Power Management Unit
3 *
4 * Copyright (c) 2011, Intel Corporation.
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 along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#include <linux/cpuidle.h>
21#include <linux/debugfs.h>
22#include <linux/delay.h>
23#include <linux/interrupt.h>
24#include <linux/module.h>
25#include <linux/pci.h>
26#include <linux/seq_file.h>
27#include <linux/sfi.h>
28#include <asm/intel_scu_ipc.h>
29#include "pmu.h"
30
31#define IPCMSG_FW_REVISION 0xF4
32
33struct mrst_device {
34 u16 pci_dev_num; /* DEBUG only */
35 u16 lss;
36 u16 latest_request;
37 unsigned int pci_state_counts[PCI_D3cold + 1]; /* DEBUG only */
38};
39
40/*
41 * comlete list of MRST PCI devices
42 */
43static struct mrst_device mrst_devs[] = {
44/* 0 */ { 0x0800, LSS_SPI0 }, /* Moorestown SPI Ctrl 0 */
45/* 1 */ { 0x0801, LSS_SPI1 }, /* Moorestown SPI Ctrl 1 */
46/* 2 */ { 0x0802, LSS_I2C0 }, /* Moorestown I2C 0 */
47/* 3 */ { 0x0803, LSS_I2C1 }, /* Moorestown I2C 1 */
48/* 4 */ { 0x0804, LSS_I2C2 }, /* Moorestown I2C 2 */
49/* 5 */ { 0x0805, LSS_KBD }, /* Moorestown Keyboard Ctrl */
50/* 6 */ { 0x0806, LSS_USB_HC }, /* Moorestown USB Ctrl */
51/* 7 */ { 0x0807, LSS_SD_HC0 }, /* Moorestown SD Host Ctrl 0 */
52/* 8 */ { 0x0808, LSS_SD_HC1 }, /* Moorestown SD Host Ctrl 1 */
53/* 9 */ { 0x0809, LSS_NAND }, /* Moorestown NAND Ctrl */
54/* 10 */ { 0x080a, LSS_AUDIO }, /* Moorestown Audio Ctrl */
55/* 11 */ { 0x080b, LSS_IMAGING }, /* Moorestown ISP */
56/* 12 */ { 0x080c, LSS_SECURITY }, /* Moorestown Security Controller */
57/* 13 */ { 0x080d, LSS_DISPLAY }, /* Moorestown External Displays */
58/* 14 */ { 0x080e, 0 }, /* Moorestown SCU IPC */
59/* 15 */ { 0x080f, LSS_GPIO }, /* Moorestown GPIO Controller */
60/* 16 */ { 0x0810, 0 }, /* Moorestown Power Management Unit */
61/* 17 */ { 0x0811, LSS_USB_OTG }, /* Moorestown OTG Ctrl */
62/* 18 */ { 0x0812, LSS_SPI2 }, /* Moorestown SPI Ctrl 2 */
63/* 19 */ { 0x0813, 0 }, /* Moorestown SC DMA */
64/* 20 */ { 0x0814, LSS_AUDIO_LPE }, /* Moorestown LPE DMA */
65/* 21 */ { 0x0815, LSS_AUDIO_SSP }, /* Moorestown SSP0 */
66
67/* 22 */ { 0x084F, LSS_SD_HC2 }, /* Moorestown SD Host Ctrl 2 */
68
69/* 23 */ { 0x4102, 0 }, /* Lincroft */
70/* 24 */ { 0x4110, 0 }, /* Lincroft */
71};
72
73/* n.b. We ignore PCI-id 0x815 in LSS9 b/c Linux has no driver for it */
74static u16 mrst_lss9_pci_ids[] = {0x080a, 0x0814, 0};
75static u16 mrst_lss10_pci_ids[] = {0x0800, 0x0801, 0x0802, 0x0803,
76 0x0804, 0x0805, 0x080f, 0};
77
78/* handle concurrent SMP invokations of pmu_pci_set_power_state() */
79static spinlock_t mrst_pmu_power_state_lock;
80
81static unsigned int wake_counters[MRST_NUM_LSS]; /* DEBUG only */
82static unsigned int pmu_irq_stats[INT_INVALID + 1]; /* DEBUG only */
83
84static int graphics_is_off;
85static int lss_s0i3_enabled;
86static bool mrst_pmu_s0i3_enable;
87
88/* debug counters */
89static u32 pmu_wait_ready_calls;
90static u32 pmu_wait_ready_udelays;
91static u32 pmu_wait_ready_udelays_max;
92static u32 pmu_wait_done_calls;
93static u32 pmu_wait_done_udelays;
94static u32 pmu_wait_done_udelays_max;
95static u32 pmu_set_power_state_entry;
96static u32 pmu_set_power_state_send_cmd;
97
98static struct mrst_device *pci_id_2_mrst_dev(u16 pci_dev_num)
99{
100 int index = 0;
101
102 if ((pci_dev_num >= 0x0800) && (pci_dev_num <= 0x815))
103 index = pci_dev_num - 0x800;
104 else if (pci_dev_num == 0x084F)
105 index = 22;
106 else if (pci_dev_num == 0x4102)
107 index = 23;
108 else if (pci_dev_num == 0x4110)
109 index = 24;
110
111 if (pci_dev_num != mrst_devs[index].pci_dev_num) {
112 WARN_ONCE(1, FW_BUG "Unknown PCI device 0x%04X\n", pci_dev_num);
113 return 0;
114 }
115
116 return &mrst_devs[index];
117}
118
119/**
120 * mrst_pmu_validate_cstates
121 * @dev: cpuidle_device
122 *
123 * Certain states are not appropriate for governor to pick in some cases.
124 * This function will be called as cpuidle_device's prepare callback and
125 * thus tells governor to ignore such states when selecting the next state
126 * to enter.
127 */
128
129#define IDLE_STATE4_IS_C6 4
130#define IDLE_STATE5_IS_S0I3 5
131
132int mrst_pmu_invalid_cstates(void)
133{
134 int cpu = smp_processor_id();
135
136 /*
137 * Demote to C4 if the PMU is busy.
138 * Since LSS changes leave the busy bit clear...
139 * busy means either the PMU is waiting for an ACK-C6 that
140 * isn't coming due to an MWAIT that returned immediately;
141 * or we returned from S0i3 successfully, and the PMU
142 * is not done sending us interrupts.
143 */
144 if (pmu_read_busy_status())
145 return 1 << IDLE_STATE4_IS_C6 | 1 << IDLE_STATE5_IS_S0I3;
146
147 /*
148 * Disallow S0i3 if: PMU is not initialized, or CPU1 is active,
149 * or if device LSS is insufficient, or the GPU is active,
150 * or if it has been explicitly disabled.
151 */
152 if (!pmu_reg || !cpumask_equal(cpu_online_mask, cpumask_of(cpu)) ||
153 !lss_s0i3_enabled || !graphics_is_off || !mrst_pmu_s0i3_enable)
154 return 1 << IDLE_STATE5_IS_S0I3;
155 else
156 return 0;
157}
158
159/*
160 * pmu_update_wake_counters(): read PM_WKS, update wake_counters[]
161 * DEBUG only.
162 */
163static void pmu_update_wake_counters(void)
164{
165 int lss;
166 u32 wake_status;
167
168 wake_status = pmu_read_wks();
169
170 for (lss = 0; lss < MRST_NUM_LSS; ++lss) {
171 if (wake_status & (1 << lss))
172 wake_counters[lss]++;
173 }
174}
175
176int mrst_pmu_s0i3_entry(void)
177{
178 int status;
179
180 /* Clear any possible error conditions */
181 pmu_write_ics(0x300);
182
183 /* set wake control to current D-states */
184 pmu_write_wssc(S0I3_SSS_TARGET);
185
186 status = mrst_s0i3_entry(PM_S0I3_COMMAND, &pmu_reg->pm_cmd);
187 pmu_update_wake_counters();
188 return status;
189}
190
191/* poll for maximum of 5ms for busy bit to clear */
192static int pmu_wait_ready(void)
193{
194 int udelays;
195
196 pmu_wait_ready_calls++;
197
198 for (udelays = 0; udelays < 500; ++udelays) {
199 if (udelays > pmu_wait_ready_udelays_max)
200 pmu_wait_ready_udelays_max = udelays;
201
202 if (pmu_read_busy_status() == 0)
203 return 0;
204
205 udelay(10);
206 pmu_wait_ready_udelays++;
207 }
208
209 /*
210 * if this fires, observe
211 * /sys/kernel/debug/mrst_pmu_wait_ready_calls
212 * /sys/kernel/debug/mrst_pmu_wait_ready_udelays
213 */
214 WARN_ONCE(1, "SCU not ready for 5ms");
215 return -EBUSY;
216}
217/* poll for maximum of 50ms us for busy bit to clear */
218static int pmu_wait_done(void)
219{
220 int udelays;
221
222 pmu_wait_done_calls++;
223
224 for (udelays = 0; udelays < 500; ++udelays) {
225 if (udelays > pmu_wait_done_udelays_max)
226 pmu_wait_done_udelays_max = udelays;
227
228 if (pmu_read_busy_status() == 0)
229 return 0;
230
231 udelay(100);
232 pmu_wait_done_udelays++;
233 }
234
235 /*
236 * if this fires, observe
237 * /sys/kernel/debug/mrst_pmu_wait_done_calls
238 * /sys/kernel/debug/mrst_pmu_wait_done_udelays
239 */
240 WARN_ONCE(1, "SCU not done for 50ms");
241 return -EBUSY;
242}
243
244u32 mrst_pmu_msi_is_disabled(void)
245{
246 return pmu_msi_is_disabled();
247}
248
249void mrst_pmu_enable_msi(void)
250{
251 pmu_msi_enable();
252}
253
254/**
255 * pmu_irq - pmu driver interrupt handler
256 * Context: interrupt context
257 */
258static irqreturn_t pmu_irq(int irq, void *dummy)
259{
260 union pmu_pm_ics pmu_ics;
261
262 pmu_ics.value = pmu_read_ics();
263
264 if (!pmu_ics.bits.pending)
265 return IRQ_NONE;
266
267 switch (pmu_ics.bits.cause) {
268 case INT_SPURIOUS:
269 case INT_CMD_DONE:
270 case INT_CMD_ERR:
271 case INT_WAKE_RX:
272 case INT_SS_ERROR:
273 case INT_S0IX_MISS:
274 case INT_NO_ACKC6:
275 pmu_irq_stats[pmu_ics.bits.cause]++;
276 break;
277 default:
278 pmu_irq_stats[INT_INVALID]++;
279 }
280
281 pmu_write_ics(pmu_ics.value); /* Clear pending interrupt */
282
283 return IRQ_HANDLED;
284}
285
286/*
287 * Translate PCI power management to MRST LSS D-states
288 */
289static int pci_2_mrst_state(int lss, pci_power_t pci_state)
290{
291 switch (pci_state) {
292 case PCI_D0:
293 if (SSMSK(D0i1, lss) & D0I1_ACG_SSS_TARGET)
294 return D0i1;
295 else
296 return D0;
297 case PCI_D1:
298 return D0i1;
299 case PCI_D2:
300 return D0i2;
301 case PCI_D3hot:
302 case PCI_D3cold:
303 return D0i3;
304 default:
305 WARN(1, "pci_state %d\n", pci_state);
306 return 0;
307 }
308}
309
310static int pmu_issue_command(u32 pm_ssc)
311{
312 union pmu_pm_set_cfg_cmd_t command;
313
314 if (pmu_read_busy_status()) {
315 pr_debug("pmu is busy, Operation not permitted\n");
316 return -1;
317 }
318
319 /*
320 * enable interrupts in PMU so that interrupts are
321 * propagated when ioc bit for a particular set
322 * command is set
323 */
324
325 pmu_irq_enable();
326
327 /* Configure the sub systems for pmu2 */
328
329 pmu_write_ssc(pm_ssc);
330
331 /*
332 * Send the set config command for pmu its configured
333 * for mode CM_IMMEDIATE & hence with No Trigger
334 */
335
336 command.pmu2_params.d_param.cfg_mode = CM_IMMEDIATE;
337 command.pmu2_params.d_param.cfg_delay = 0;
338 command.pmu2_params.d_param.rsvd = 0;
339
340 /* construct the command to send SET_CFG to particular PMU */
341 command.pmu2_params.d_param.cmd = SET_CFG_CMD;
342 command.pmu2_params.d_param.ioc = 0;
343 command.pmu2_params.d_param.mode_id = 0;
344 command.pmu2_params.d_param.sys_state = SYS_STATE_S0I0;
345
346 /* write the value of PM_CMD into particular PMU */
347 pr_debug("pmu command being written %x\n",
348 command.pmu_pm_set_cfg_cmd_value);
349
350 pmu_write_cmd(command.pmu_pm_set_cfg_cmd_value);
351
352 return 0;
353}
354
355static u16 pmu_min_lss_pci_req(u16 *ids, u16 pci_state)
356{
357 u16 existing_request;
358 int i;
359
360 for (i = 0; ids[i]; ++i) {
361 struct mrst_device *mrst_dev;
362
363 mrst_dev = pci_id_2_mrst_dev(ids[i]);
364 if (unlikely(!mrst_dev))
365 continue;
366
367 existing_request = mrst_dev->latest_request;
368 if (existing_request < pci_state)
369 pci_state = existing_request;
370 }
371 return pci_state;
372}
373
374/**
375 * pmu_pci_set_power_state - Callback function is used by all the PCI devices
376 * for a platform specific device power on/shutdown.
377 */
378
379int pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t pci_state)
380{
381 u32 old_sss, new_sss;
382 int status = 0;
383 struct mrst_device *mrst_dev;
384
385 pmu_set_power_state_entry++;
386
387 BUG_ON(pdev->vendor != PCI_VENDOR_ID_INTEL);
388 BUG_ON(pci_state < PCI_D0 || pci_state > PCI_D3cold);
389
390 mrst_dev = pci_id_2_mrst_dev(pdev->device);
391 if (unlikely(!mrst_dev))
392 return -ENODEV;
393
394 mrst_dev->pci_state_counts[pci_state]++; /* count invocations */
395
396 /* PMU driver calls self as part of PCI initialization, ignore */
397 if (pdev->device == PCI_DEV_ID_MRST_PMU)
398 return 0;
399
400 BUG_ON(!pmu_reg); /* SW bug if called before initialized */
401
402 spin_lock(&mrst_pmu_power_state_lock);
403
404 if (pdev->d3_delay) {
405 dev_dbg(&pdev->dev, "d3_delay %d, should be 0\n",
406 pdev->d3_delay);
407 pdev->d3_delay = 0;
408 }
409 /*
410 * If Lincroft graphics, simply remember state
411 */
412 if ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY
413 && !((pdev->class & PCI_SUB_CLASS_MASK) >> 8)) {
414 if (pci_state == PCI_D0)
415 graphics_is_off = 0;
416 else
417 graphics_is_off = 1;
418 goto ret;
419 }
420
421 if (!mrst_dev->lss)
422 goto ret; /* device with no LSS */
423
424 if (mrst_dev->latest_request == pci_state)
425 goto ret; /* no change */
426
427 mrst_dev->latest_request = pci_state; /* record latest request */
428
429 /*
430 * LSS9 and LSS10 contain multiple PCI devices.
431 * Use the lowest numbered (highest power) state in the LSS
432 */
433 if (mrst_dev->lss == 9)
434 pci_state = pmu_min_lss_pci_req(mrst_lss9_pci_ids, pci_state);
435 else if (mrst_dev->lss == 10)
436 pci_state = pmu_min_lss_pci_req(mrst_lss10_pci_ids, pci_state);
437
438 status = pmu_wait_ready();
439 if (status)
440 goto ret;
441
442 old_sss = pmu_read_sss();
443 new_sss = old_sss & ~SSMSK(3, mrst_dev->lss);
444 new_sss |= SSMSK(pci_2_mrst_state(mrst_dev->lss, pci_state),
445 mrst_dev->lss);
446
447 if (new_sss == old_sss)
448 goto ret; /* nothing to do */
449
450 pmu_set_power_state_send_cmd++;
451
452 status = pmu_issue_command(new_sss);
453
454 if (unlikely(status != 0)) {
455 dev_err(&pdev->dev, "Failed to Issue a PM command\n");
456 goto ret;
457 }
458
459 if (pmu_wait_done())
460 goto ret;
461
462 lss_s0i3_enabled =
463 ((pmu_read_sss() & S0I3_SSS_TARGET) == S0I3_SSS_TARGET);
464ret:
465 spin_unlock(&mrst_pmu_power_state_lock);
466 return status;
467}
468
469#ifdef CONFIG_DEBUG_FS
470static char *d0ix_names[] = {"D0", "D0i1", "D0i2", "D0i3"};
471
472static inline const char *d0ix_name(int state)
473{
474 return d0ix_names[(int) state];
475}
476
477static int debug_mrst_pmu_show(struct seq_file *s, void *unused)
478{
479 struct pci_dev *pdev = NULL;
480 u32 cur_pmsss;
481 int lss;
482
483 seq_printf(s, "0x%08X D0I1_ACG_SSS_TARGET\n", D0I1_ACG_SSS_TARGET);
484
485 cur_pmsss = pmu_read_sss();
486
487 seq_printf(s, "0x%08X S0I3_SSS_TARGET\n", S0I3_SSS_TARGET);
488
489 seq_printf(s, "0x%08X Current SSS ", cur_pmsss);
490 seq_printf(s, lss_s0i3_enabled ? "\n" : "[BLOCKS s0i3]\n");
491
492 if (cpumask_equal(cpu_online_mask, cpumask_of(0)))
493 seq_printf(s, "cpu0 is only cpu online\n");
494 else
495 seq_printf(s, "cpu0 is NOT only cpu online [BLOCKS S0i3]\n");
496
497 seq_printf(s, "GFX: %s\n", graphics_is_off ? "" : "[BLOCKS s0i3]");
498
499
500 for_each_pci_dev(pdev) {
501 int pos;
502 u16 pmcsr;
503 struct mrst_device *mrst_dev;
504 int i;
505
506 mrst_dev = pci_id_2_mrst_dev(pdev->device);
507
508 seq_printf(s, "%s %04x/%04X %-16.16s ",
509 dev_name(&pdev->dev),
510 pdev->vendor, pdev->device,
511 dev_driver_string(&pdev->dev));
512
513 if (unlikely (!mrst_dev)) {
514 seq_printf(s, " UNKNOWN\n");
515 continue;
516 }
517
518 if (mrst_dev->lss)
519 seq_printf(s, "LSS %2d %-4s ", mrst_dev->lss,
520 d0ix_name(((cur_pmsss >>
521 (mrst_dev->lss * 2)) & 0x3)));
522 else
523 seq_printf(s, " ");
524
525 /* PCI PM config space setting */
526 pos = pci_find_capability(pdev, PCI_CAP_ID_PM);
527 if (pos != 0) {
528 pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr);
529 seq_printf(s, "PCI-%-4s",
530 pci_power_name(pmcsr & PCI_PM_CTRL_STATE_MASK));
531 } else {
532 seq_printf(s, " ");
533 }
534
535 seq_printf(s, " %s ", pci_power_name(mrst_dev->latest_request));
536 for (i = 0; i <= PCI_D3cold; ++i)
537 seq_printf(s, "%d ", mrst_dev->pci_state_counts[i]);
538
539 if (mrst_dev->lss) {
540 unsigned int lssmask;
541
542 lssmask = SSMSK(D0i3, mrst_dev->lss);
543
544 if ((lssmask & S0I3_SSS_TARGET) &&
545 ((lssmask & cur_pmsss) !=
546 (lssmask & S0I3_SSS_TARGET)))
547 seq_printf(s , "[BLOCKS s0i3]");
548 }
549
550 seq_printf(s, "\n");
551 }
552 seq_printf(s, "Wake Counters:\n");
553 for (lss = 0; lss < MRST_NUM_LSS; ++lss)
554 seq_printf(s, "LSS%d %d\n", lss, wake_counters[lss]);
555
556 seq_printf(s, "Interrupt Counters:\n");
557 seq_printf(s,
558 "INT_SPURIOUS \t%8u\n" "INT_CMD_DONE \t%8u\n"
559 "INT_CMD_ERR \t%8u\n" "INT_WAKE_RX \t%8u\n"
560 "INT_SS_ERROR \t%8u\n" "INT_S0IX_MISS\t%8u\n"
561 "INT_NO_ACKC6 \t%8u\n" "INT_INVALID \t%8u\n",
562 pmu_irq_stats[INT_SPURIOUS], pmu_irq_stats[INT_CMD_DONE],
563 pmu_irq_stats[INT_CMD_ERR], pmu_irq_stats[INT_WAKE_RX],
564 pmu_irq_stats[INT_SS_ERROR], pmu_irq_stats[INT_S0IX_MISS],
565 pmu_irq_stats[INT_NO_ACKC6], pmu_irq_stats[INT_INVALID]);
566
567 seq_printf(s, "mrst_pmu_wait_ready_calls %8d\n",
568 pmu_wait_ready_calls);
569 seq_printf(s, "mrst_pmu_wait_ready_udelays %8d\n",
570 pmu_wait_ready_udelays);
571 seq_printf(s, "mrst_pmu_wait_ready_udelays_max %8d\n",
572 pmu_wait_ready_udelays_max);
573 seq_printf(s, "mrst_pmu_wait_done_calls %8d\n",
574 pmu_wait_done_calls);
575 seq_printf(s, "mrst_pmu_wait_done_udelays %8d\n",
576 pmu_wait_done_udelays);
577 seq_printf(s, "mrst_pmu_wait_done_udelays_max %8d\n",
578 pmu_wait_done_udelays_max);
579 seq_printf(s, "mrst_pmu_set_power_state_entry %8d\n",
580 pmu_set_power_state_entry);
581 seq_printf(s, "mrst_pmu_set_power_state_send_cmd %8d\n",
582 pmu_set_power_state_send_cmd);
583 seq_printf(s, "SCU busy: %d\n", pmu_read_busy_status());
584
585 return 0;
586}
587
588static int debug_mrst_pmu_open(struct inode *inode, struct file *file)
589{
590 return single_open(file, debug_mrst_pmu_show, NULL);
591}
592
593static const struct file_operations devices_state_operations = {
594 .open = debug_mrst_pmu_open,
595 .read = seq_read,
596 .llseek = seq_lseek,
597 .release = single_release,
598};
599#endif /* DEBUG_FS */
600
601/*
602 * Validate SCU PCI shim PCI vendor capability byte
603 * against LSS hard-coded in mrst_devs[] above.
604 * DEBUG only.
605 */
606static void pmu_scu_firmware_debug(void)
607{
608 struct pci_dev *pdev = NULL;
609
610 for_each_pci_dev(pdev) {
611 struct mrst_device *mrst_dev;
612 u8 pci_config_lss;
613 int pos;
614
615 mrst_dev = pci_id_2_mrst_dev(pdev->device);
616 if (unlikely(!mrst_dev)) {
617 printk(KERN_ERR FW_BUG "pmu: Unknown "
618 "PCI device 0x%04X\n", pdev->device);
619 continue;
620 }
621
622 if (mrst_dev->lss == 0)
623 continue; /* no LSS in our table */
624
625 pos = pci_find_capability(pdev, PCI_CAP_ID_VNDR);
626 if (!pos != 0) {
627 printk(KERN_ERR FW_BUG "pmu: 0x%04X "
628 "missing PCI Vendor Capability\n",
629 pdev->device);
630 continue;
631 }
632 pci_read_config_byte(pdev, pos + 4, &pci_config_lss);
633 if (!(pci_config_lss & PCI_VENDOR_CAP_LOG_SS_MASK)) {
634 printk(KERN_ERR FW_BUG "pmu: 0x%04X "
635 "invalid PCI Vendor Capability 0x%x "
636 " expected LSS 0x%X\n",
637 pdev->device, pci_config_lss, mrst_dev->lss);
638 continue;
639 }
640 pci_config_lss &= PCI_VENDOR_CAP_LOG_ID_MASK;
641
642 if (mrst_dev->lss == pci_config_lss)
643 continue;
644
645 printk(KERN_ERR FW_BUG "pmu: 0x%04X LSS = %d, expected %d\n",
646 pdev->device, pci_config_lss, mrst_dev->lss);
647 }
648}
649
650/**
651 * pmu_probe
652 */
653static int __devinit pmu_probe(struct pci_dev *pdev,
654 const struct pci_device_id *pci_id)
655{
656 int ret;
657 struct mrst_pmu_reg *pmu;
658
659 /* Init the device */
660 ret = pci_enable_device(pdev);
661 if (ret) {
662 dev_err(&pdev->dev, "Unable to Enable PCI device\n");
663 return ret;
664 }
665
666 ret = pci_request_regions(pdev, MRST_PMU_DRV_NAME);
667 if (ret < 0) {
668 dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n");
669 goto out_err1;
670 }
671
672 /* Map the memory of PMU reg base */
673 pmu = pci_iomap(pdev, 0, 0);
674 if (!pmu) {
675 dev_err(&pdev->dev, "Unable to map the PMU address space\n");
676 ret = -ENOMEM;
677 goto out_err2;
678 }
679
680#ifdef CONFIG_DEBUG_FS
681 /* /sys/kernel/debug/mrst_pmu */
682 (void) debugfs_create_file("mrst_pmu", S_IFREG | S_IRUGO,
683 NULL, NULL, &devices_state_operations);
684#endif
685 pmu_reg = pmu; /* success */
686
687 if (request_irq(pdev->irq, pmu_irq, 0, MRST_PMU_DRV_NAME, NULL)) {
688 dev_err(&pdev->dev, "Registering isr has failed\n");
689 ret = -1;
690 goto out_err3;
691 }
692
693 pmu_scu_firmware_debug();
694
695 pmu_write_wkc(S0I3_WAKE_SOURCES); /* Enable S0i3 wakeup sources */
696
697 pmu_wait_ready();
698
699 pmu_write_ssc(D0I1_ACG_SSS_TARGET); /* Enable Auto-Clock_Gating */
700 pmu_write_cmd(0x201);
701
702 spin_lock_init(&mrst_pmu_power_state_lock);
703
704 /* Enable the hardware interrupt */
705 pmu_irq_enable();
706 return 0;
707
708out_err3:
709 free_irq(pdev->irq, NULL);
710 pci_iounmap(pdev, pmu_reg);
711 pmu_reg = NULL;
712out_err2:
713 pci_release_region(pdev, 0);
714out_err1:
715 pci_disable_device(pdev);
716 return ret;
717}
718
719static void __devexit pmu_remove(struct pci_dev *pdev)
720{
721 dev_err(&pdev->dev, "Mid PM pmu_remove called\n");
722
723 /* Freeing up the irq */
724 free_irq(pdev->irq, NULL);
725
726 pci_iounmap(pdev, pmu_reg);
727 pmu_reg = NULL;
728
729 /* disable the current PCI device */
730 pci_release_region(pdev, 0);
731 pci_disable_device(pdev);
732}
733
734static DEFINE_PCI_DEVICE_TABLE(pmu_pci_ids) = {
735 { PCI_VDEVICE(INTEL, PCI_DEV_ID_MRST_PMU), 0 },
736 { }
737};
738
739MODULE_DEVICE_TABLE(pci, pmu_pci_ids);
740
741static struct pci_driver driver = {
742 .name = MRST_PMU_DRV_NAME,
743 .id_table = pmu_pci_ids,
744 .probe = pmu_probe,
745 .remove = __devexit_p(pmu_remove),
746};
747
748/**
749 * pmu_pci_register - register the PMU driver as PCI device
750 */
751static int __init pmu_pci_register(void)
752{
753 return pci_register_driver(&driver);
754}
755
756/* Register and probe via fs_initcall() to preceed device_initcall() */
757fs_initcall(pmu_pci_register);
758
759static void __exit mid_pci_cleanup(void)
760{
761 pci_unregister_driver(&driver);
762}
763
764static int ia_major;
765static int ia_minor;
766
767static int pmu_sfi_parse_oem(struct sfi_table_header *table)
768{
769 struct sfi_table_simple *sb;
770
771 sb = (struct sfi_table_simple *)table;
772 ia_major = (sb->pentry[1] >> 0) & 0xFFFF;
773 ia_minor = (sb->pentry[1] >> 16) & 0xFFFF;
774 printk(KERN_INFO "mrst_pmu: IA FW version v%x.%x\n",
775 ia_major, ia_minor);
776
777 return 0;
778}
779
780static int __init scu_fw_check(void)
781{
782 int ret;
783 u32 fw_version;
784
785 if (!pmu_reg)
786 return 0; /* this driver didn't probe-out */
787
788 sfi_table_parse("OEMB", NULL, NULL, pmu_sfi_parse_oem);
789
790 if (ia_major < 0x6005 || ia_minor < 0x1525) {
791 WARN(1, "mrst_pmu: IA FW version too old\n");
792 return -1;
793 }
794
795 ret = intel_scu_ipc_command(IPCMSG_FW_REVISION, 0, NULL, 0,
796 &fw_version, 1);
797
798 if (ret) {
799 WARN(1, "mrst_pmu: IPC FW version? %d\n", ret);
800 } else {
801 int scu_major = (fw_version >> 8) & 0xFF;
802 int scu_minor = (fw_version >> 0) & 0xFF;
803
804 printk(KERN_INFO "mrst_pmu: firmware v%x\n", fw_version);
805
806 if ((scu_major >= 0xC0) && (scu_minor >= 0x49)) {
807 printk(KERN_INFO "mrst_pmu: enabling S0i3\n");
808 mrst_pmu_s0i3_enable = true;
809 } else {
810 WARN(1, "mrst_pmu: S0i3 disabled, old firmware %X.%X",
811 scu_major, scu_minor);
812 }
813 }
814 return 0;
815}
816late_initcall(scu_fw_check);
817module_exit(mid_pci_cleanup);
diff --git a/arch/x86/platform/mrst/pmu.h b/arch/x86/platform/mrst/pmu.h
deleted file mode 100644
index bfbfe64b167..00000000000
--- a/arch/x86/platform/mrst/pmu.h
+++ /dev/null
@@ -1,234 +0,0 @@
1/*
2 * mrst/pmu.h - private definitions for MRST Power Management Unit mrst/pmu.c
3 *
4 * Copyright (c) 2011, Intel Corporation.
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 along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#ifndef _MRST_PMU_H_
21#define _MRST_PMU_H_
22
23#define PCI_DEV_ID_MRST_PMU 0x0810
24#define MRST_PMU_DRV_NAME "mrst_pmu"
25#define PCI_SUB_CLASS_MASK 0xFF00
26
27#define PCI_VENDOR_CAP_LOG_ID_MASK 0x7F
28#define PCI_VENDOR_CAP_LOG_SS_MASK 0x80
29
30#define SUB_SYS_ALL_D0I1 0x01155555
31#define S0I3_WAKE_SOURCES 0x00001FFF
32
33#define PM_S0I3_COMMAND \
34 ((0 << 31) | /* Reserved */ \
35 (0 << 30) | /* Core must be idle */ \
36 (0xc2 << 22) | /* ACK C6 trigger */ \
37 (3 << 19) | /* Trigger on DMI message */ \
38 (3 << 16) | /* Enter S0i3 */ \
39 (0 << 13) | /* Numeric mode ID (sw) */ \
40 (3 << 9) | /* Trigger mode */ \
41 (0 << 8) | /* Do not interrupt */ \
42 (1 << 0)) /* Set configuration */
43
44#define LSS_DMI 0
45#define LSS_SD_HC0 1
46#define LSS_SD_HC1 2
47#define LSS_NAND 3
48#define LSS_IMAGING 4
49#define LSS_SECURITY 5
50#define LSS_DISPLAY 6
51#define LSS_USB_HC 7
52#define LSS_USB_OTG 8
53#define LSS_AUDIO 9
54#define LSS_AUDIO_LPE 9
55#define LSS_AUDIO_SSP 9
56#define LSS_I2C0 10
57#define LSS_I2C1 10
58#define LSS_I2C2 10
59#define LSS_KBD 10
60#define LSS_SPI0 10
61#define LSS_SPI1 10
62#define LSS_SPI2 10
63#define LSS_GPIO 10
64#define LSS_SRAM 11 /* used by SCU, do not touch */
65#define LSS_SD_HC2 12
66/* LSS hardware bits 15,14,13 are hardwired to 0, thus unusable */
67#define MRST_NUM_LSS 13
68
69#define MIN(a, b) (((a) < (b)) ? (a) : (b))
70
71#define SSMSK(mask, lss) ((mask) << ((lss) * 2))
72#define D0 0
73#define D0i1 1
74#define D0i2 2
75#define D0i3 3
76
77#define S0I3_SSS_TARGET ( \
78 SSMSK(D0i1, LSS_DMI) | \
79 SSMSK(D0i3, LSS_SD_HC0) | \
80 SSMSK(D0i3, LSS_SD_HC1) | \
81 SSMSK(D0i3, LSS_NAND) | \
82 SSMSK(D0i3, LSS_SD_HC2) | \
83 SSMSK(D0i3, LSS_IMAGING) | \
84 SSMSK(D0i3, LSS_SECURITY) | \
85 SSMSK(D0i3, LSS_DISPLAY) | \
86 SSMSK(D0i3, LSS_USB_HC) | \
87 SSMSK(D0i3, LSS_USB_OTG) | \
88 SSMSK(D0i3, LSS_AUDIO) | \
89 SSMSK(D0i1, LSS_I2C0))
90
91/*
92 * D0i1 on Langwell is Autonomous Clock Gating (ACG).
93 * Enable ACG on every LSS except camera and audio
94 */
95#define D0I1_ACG_SSS_TARGET \
96 (SUB_SYS_ALL_D0I1 & ~SSMSK(D0i1, LSS_IMAGING) & ~SSMSK(D0i1, LSS_AUDIO))
97
98enum cm_mode {
99 CM_NOP, /* ignore the config mode value */
100 CM_IMMEDIATE,
101 CM_DELAY,
102 CM_TRIGGER,
103 CM_INVALID
104};
105
106enum sys_state {
107 SYS_STATE_S0I0,
108 SYS_STATE_S0I1,
109 SYS_STATE_S0I2,
110 SYS_STATE_S0I3,
111 SYS_STATE_S3,
112 SYS_STATE_S5
113};
114
115#define SET_CFG_CMD 1
116
117enum int_status {
118 INT_SPURIOUS = 0,
119 INT_CMD_DONE = 1,
120 INT_CMD_ERR = 2,
121 INT_WAKE_RX = 3,
122 INT_SS_ERROR = 4,
123 INT_S0IX_MISS = 5,
124 INT_NO_ACKC6 = 6,
125 INT_INVALID = 7,
126};
127
128/* PMU register interface */
129static struct mrst_pmu_reg {
130 u32 pm_sts; /* 0x00 */
131 u32 pm_cmd; /* 0x04 */
132 u32 pm_ics; /* 0x08 */
133 u32 _resv1; /* 0x0C */
134 u32 pm_wkc[2]; /* 0x10 */
135 u32 pm_wks[2]; /* 0x18 */
136 u32 pm_ssc[4]; /* 0x20 */
137 u32 pm_sss[4]; /* 0x30 */
138 u32 pm_wssc[4]; /* 0x40 */
139 u32 pm_c3c4; /* 0x50 */
140 u32 pm_c5c6; /* 0x54 */
141 u32 pm_msi_disable; /* 0x58 */
142} *pmu_reg;
143
144static inline u32 pmu_read_sts(void) { return readl(&pmu_reg->pm_sts); }
145static inline u32 pmu_read_ics(void) { return readl(&pmu_reg->pm_ics); }
146static inline u32 pmu_read_wks(void) { return readl(&pmu_reg->pm_wks[0]); }
147static inline u32 pmu_read_sss(void) { return readl(&pmu_reg->pm_sss[0]); }
148
149static inline void pmu_write_cmd(u32 arg) { writel(arg, &pmu_reg->pm_cmd); }
150static inline void pmu_write_ics(u32 arg) { writel(arg, &pmu_reg->pm_ics); }
151static inline void pmu_write_wkc(u32 arg) { writel(arg, &pmu_reg->pm_wkc[0]); }
152static inline void pmu_write_ssc(u32 arg) { writel(arg, &pmu_reg->pm_ssc[0]); }
153static inline void pmu_write_wssc(u32 arg)
154 { writel(arg, &pmu_reg->pm_wssc[0]); }
155
156static inline void pmu_msi_enable(void) { writel(0, &pmu_reg->pm_msi_disable); }
157static inline u32 pmu_msi_is_disabled(void)
158 { return readl(&pmu_reg->pm_msi_disable); }
159
160union pmu_pm_ics {
161 struct {
162 u32 cause:8;
163 u32 enable:1;
164 u32 pending:1;
165 u32 reserved:22;
166 } bits;
167 u32 value;
168};
169
170static inline void pmu_irq_enable(void)
171{
172 union pmu_pm_ics pmu_ics;
173
174 pmu_ics.value = pmu_read_ics();
175 pmu_ics.bits.enable = 1;
176 pmu_write_ics(pmu_ics.value);
177}
178
179union pmu_pm_status {
180 struct {
181 u32 pmu_rev:8;
182 u32 pmu_busy:1;
183 u32 mode_id:4;
184 u32 Reserved:19;
185 } pmu_status_parts;
186 u32 pmu_status_value;
187};
188
189static inline int pmu_read_busy_status(void)
190{
191 union pmu_pm_status result;
192
193 result.pmu_status_value = pmu_read_sts();
194
195 return result.pmu_status_parts.pmu_busy;
196}
197
198/* pmu set config parameters */
199struct cfg_delay_param_t {
200 u32 cmd:8;
201 u32 ioc:1;
202 u32 cfg_mode:4;
203 u32 mode_id:3;
204 u32 sys_state:3;
205 u32 cfg_delay:8;
206 u32 rsvd:5;
207};
208
209struct cfg_trig_param_t {
210 u32 cmd:8;
211 u32 ioc:1;
212 u32 cfg_mode:4;
213 u32 mode_id:3;
214 u32 sys_state:3;
215 u32 cfg_trig_type:3;
216 u32 cfg_trig_val:8;
217 u32 cmbi:1;
218 u32 rsvd1:1;
219};
220
221union pmu_pm_set_cfg_cmd_t {
222 union {
223 struct cfg_delay_param_t d_param;
224 struct cfg_trig_param_t t_param;
225 } pmu2_params;
226 u32 pmu_pm_set_cfg_cmd_value;
227};
228
229#ifdef FUTURE_PATCH
230extern int mrst_s0i3_entry(u32 regval, u32 *regaddr);
231#else
232static inline int mrst_s0i3_entry(u32 regval, u32 *regaddr) { return -1; }
233#endif
234#endif
diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
index 2b235b77d9a..23e5b9d7977 100644
--- a/arch/x86/platform/olpc/olpc-xo15-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
@@ -23,7 +23,66 @@
23#define XO15_SCI_CLASS DRV_NAME 23#define XO15_SCI_CLASS DRV_NAME
24#define XO15_SCI_DEVICE_NAME "OLPC XO-1.5 SCI" 24#define XO15_SCI_DEVICE_NAME "OLPC XO-1.5 SCI"
25 25
26static unsigned long xo15_sci_gpe; 26static unsigned long xo15_sci_gpe;
27static bool lid_wake_on_close;
28
29/*
30 * The normal ACPI LID wakeup behavior is wake-on-open, but not
31 * wake-on-close. This is implemented as standard by the XO-1.5 DSDT.
32 *
33 * We provide here a sysfs attribute that will additionally enable
34 * wake-on-close behavior. This is useful (e.g.) when we oportunistically
35 * suspend with the display running; if the lid is then closed, we want to
36 * wake up to turn the display off.
37 *
38 * This is controlled through a custom method in the XO-1.5 DSDT.
39 */
40static int set_lid_wake_behavior(bool wake_on_close)
41{
42 struct acpi_object_list arg_list;
43 union acpi_object arg;
44 acpi_status status;
45
46 arg_list.count = 1;
47 arg_list.pointer = &arg;
48 arg.type = ACPI_TYPE_INTEGER;
49 arg.integer.value = wake_on_close;
50
51 status = acpi_evaluate_object(NULL, "\\_SB.PCI0.LID.LIDW", &arg_list, NULL);
52 if (ACPI_FAILURE(status)) {
53 pr_warning(PFX "failed to set lid behavior\n");
54 return 1;
55 }
56
57 lid_wake_on_close = wake_on_close;
58
59 return 0;
60}
61
62static ssize_t
63lid_wake_on_close_show(struct kobject *s, struct kobj_attribute *attr, char *buf)
64{
65 return sprintf(buf, "%u\n", lid_wake_on_close);
66}
67
68static ssize_t lid_wake_on_close_store(struct kobject *s,
69 struct kobj_attribute *attr,
70 const char *buf, size_t n)
71{
72 unsigned int val;
73
74 if (sscanf(buf, "%u", &val) != 1)
75 return -EINVAL;
76
77 set_lid_wake_behavior(!!val);
78
79 return n;
80}
81
82static struct kobj_attribute lid_wake_on_close_attr =
83 __ATTR(lid_wake_on_close, 0644,
84 lid_wake_on_close_show,
85 lid_wake_on_close_store);
27 86
28static void battery_status_changed(void) 87static void battery_status_changed(void)
29{ 88{
@@ -91,6 +150,7 @@ static int xo15_sci_add(struct acpi_device *device)
91{ 150{
92 unsigned long long tmp; 151 unsigned long long tmp;
93 acpi_status status; 152 acpi_status status;
153 int r;
94 154
95 if (!device) 155 if (!device)
96 return -EINVAL; 156 return -EINVAL;
@@ -112,6 +172,10 @@ static int xo15_sci_add(struct acpi_device *device)
112 172
113 dev_info(&device->dev, "Initialized, GPE = 0x%lx\n", xo15_sci_gpe); 173 dev_info(&device->dev, "Initialized, GPE = 0x%lx\n", xo15_sci_gpe);
114 174
175 r = sysfs_create_file(&device->dev.kobj, &lid_wake_on_close_attr.attr);
176 if (r)
177 goto err_sysfs;
178
115 /* Flush queue, and enable all SCI events */ 179 /* Flush queue, and enable all SCI events */
116 process_sci_queue(); 180 process_sci_queue();
117 olpc_ec_mask_write(EC_SCI_SRC_ALL); 181 olpc_ec_mask_write(EC_SCI_SRC_ALL);
@@ -123,6 +187,11 @@ static int xo15_sci_add(struct acpi_device *device)
123 device_init_wakeup(&device->dev, true); 187 device_init_wakeup(&device->dev, true);
124 188
125 return 0; 189 return 0;
190
191err_sysfs:
192 acpi_remove_gpe_handler(NULL, xo15_sci_gpe, xo15_sci_gpe_handler);
193 cancel_work_sync(&sci_work);
194 return r;
126} 195}
127 196
128static int xo15_sci_remove(struct acpi_device *device, int type) 197static int xo15_sci_remove(struct acpi_device *device, int type)
@@ -130,6 +199,7 @@ static int xo15_sci_remove(struct acpi_device *device, int type)
130 acpi_disable_gpe(NULL, xo15_sci_gpe); 199 acpi_disable_gpe(NULL, xo15_sci_gpe);
131 acpi_remove_gpe_handler(NULL, xo15_sci_gpe, xo15_sci_gpe_handler); 200 acpi_remove_gpe_handler(NULL, xo15_sci_gpe, xo15_sci_gpe_handler);
132 cancel_work_sync(&sci_work); 201 cancel_work_sync(&sci_work);
202 sysfs_remove_file(&device->dev.kobj, &lid_wake_on_close_attr.attr);
133 return 0; 203 return 0;
134} 204}
135 205
diff --git a/arch/x86/platform/uv/uv_time.c b/arch/x86/platform/uv/uv_time.c
index 9f29a01ee1b..5032e0d19b8 100644
--- a/arch/x86/platform/uv/uv_time.c
+++ b/arch/x86/platform/uv/uv_time.c
@@ -37,7 +37,7 @@ static void uv_rtc_timer_setup(enum clock_event_mode,
37 37
38static struct clocksource clocksource_uv = { 38static struct clocksource clocksource_uv = {
39 .name = RTC_NAME, 39 .name = RTC_NAME,
40 .rating = 400, 40 .rating = 299,
41 .read = uv_read_rtc, 41 .read = uv_read_rtc,
42 .mask = (cycle_t)UVH_RTC_REAL_TIME_CLOCK_MASK, 42 .mask = (cycle_t)UVH_RTC_REAL_TIME_CLOCK_MASK,
43 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 43 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
@@ -379,10 +379,6 @@ static __init int uv_rtc_setup_clock(void)
379 if (!is_uv_system()) 379 if (!is_uv_system())
380 return -ENODEV; 380 return -ENODEV;
381 381
382 /* If single blade, prefer tsc */
383 if (uv_num_possible_blades() == 1)
384 clocksource_uv.rating = 250;
385
386 rc = clocksource_register_hz(&clocksource_uv, sn_rtc_cycles_per_second); 382 rc = clocksource_register_hz(&clocksource_uv, sn_rtc_cycles_per_second);
387 if (rc) 383 if (rc)
388 printk(KERN_INFO "UV RTC clocksource failed rc %d\n", rc); 384 printk(KERN_INFO "UV RTC clocksource failed rc %d\n", rc);
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
index f10c0afa1cb..4889655ba78 100644
--- a/arch/x86/power/cpu.c
+++ b/arch/x86/power/cpu.c
@@ -20,6 +20,7 @@
20#include <asm/xcr.h> 20#include <asm/xcr.h>
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 24
24#ifdef CONFIG_X86_32 25#ifdef CONFIG_X86_32
25static struct saved_context saved_context; 26static struct saved_context saved_context;
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index ce98e287c06..e7e67cc3c14 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -288,7 +288,7 @@
288279 i386 mq_timedsend sys_mq_timedsend compat_sys_mq_timedsend 288279 i386 mq_timedsend sys_mq_timedsend compat_sys_mq_timedsend
289280 i386 mq_timedreceive sys_mq_timedreceive compat_sys_mq_timedreceive 289280 i386 mq_timedreceive sys_mq_timedreceive compat_sys_mq_timedreceive
290281 i386 mq_notify sys_mq_notify compat_sys_mq_notify 290281 i386 mq_notify sys_mq_notify compat_sys_mq_notify
291282 i386 mq_getsetaddr sys_mq_getsetattr compat_sys_mq_getsetattr 291282 i386 mq_getsetattr sys_mq_getsetattr compat_sys_mq_getsetattr
292283 i386 kexec_load sys_kexec_load compat_sys_kexec_load 292283 i386 kexec_load sys_kexec_load compat_sys_kexec_load
293284 i386 waitid sys_waitid compat_sys_waitid 293284 i386 waitid sys_waitid compat_sys_waitid
294# 285 sys_setaltroot 294# 285 sys_setaltroot
diff --git a/arch/x86/um/mem_32.c b/arch/x86/um/mem_32.c
index 639900a6fde..f40281e5d6a 100644
--- a/arch/x86/um/mem_32.c
+++ b/arch/x86/um/mem_32.c
@@ -23,14 +23,6 @@ static int __init gate_vma_init(void)
23 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; 23 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
24 gate_vma.vm_page_prot = __P101; 24 gate_vma.vm_page_prot = __P101;
25 25
26 /*
27 * Make sure the vDSO gets into every core dump.
28 * Dumping its contents makes post-mortem fully interpretable later
29 * without matching up the same kernel and hardware config to see
30 * what PC values meant.
31 */
32 gate_vma.vm_flags |= VM_ALWAYSDUMP;
33
34 return 0; 26 return 0;
35} 27}
36__initcall(gate_vma_init); 28__initcall(gate_vma_init);
diff --git a/arch/x86/um/vdso/vma.c b/arch/x86/um/vdso/vma.c
index 91f4ec9a0a5..af91901babb 100644
--- a/arch/x86/um/vdso/vma.c
+++ b/arch/x86/um/vdso/vma.c
@@ -64,8 +64,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
64 64
65 err = install_special_mapping(mm, um_vdso_addr, PAGE_SIZE, 65 err = install_special_mapping(mm, um_vdso_addr, PAGE_SIZE,
66 VM_READ|VM_EXEC| 66 VM_READ|VM_EXEC|
67 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| 67 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
68 VM_ALWAYSDUMP,
69 vdsop); 68 vdsop);
70 69
71 up_write(&mm->mmap_sem); 70 up_write(&mm->mmap_sem);
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 468d591dde3..a944020fa85 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -250,13 +250,7 @@ static int __init gate_vma_init(void)
250 gate_vma.vm_end = FIXADDR_USER_END; 250 gate_vma.vm_end = FIXADDR_USER_END;
251 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; 251 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
252 gate_vma.vm_page_prot = __P101; 252 gate_vma.vm_page_prot = __P101;
253 /* 253
254 * Make sure the vDSO gets into every core dump.
255 * Dumping its contents makes post-mortem fully interpretable later
256 * without matching up the same kernel and hardware config to see
257 * what PC values meant.
258 */
259 gate_vma.vm_flags |= VM_ALWAYSDUMP;
260 return 0; 254 return 0;
261} 255}
262 256
@@ -343,17 +337,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
343 if (compat_uses_vma || !compat) { 337 if (compat_uses_vma || !compat) {
344 /* 338 /*
345 * MAYWRITE to allow gdb to COW and set breakpoints 339 * MAYWRITE to allow gdb to COW and set breakpoints
346 *
347 * Make sure the vDSO gets into every core dump.
348 * Dumping its contents makes post-mortem fully
349 * interpretable later without matching up the same
350 * kernel and hardware config to see what PC values
351 * meant.
352 */ 340 */
353 ret = install_special_mapping(mm, addr, PAGE_SIZE, 341 ret = install_special_mapping(mm, addr, PAGE_SIZE,
354 VM_READ|VM_EXEC| 342 VM_READ|VM_EXEC|
355 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| 343 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
356 VM_ALWAYSDUMP,
357 vdso32_pages); 344 vdso32_pages);
358 345
359 if (ret) 346 if (ret)
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 153407c35b7..17e18279649 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -124,8 +124,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
124 124
125 ret = install_special_mapping(mm, addr, vdso_size, 125 ret = install_special_mapping(mm, addr, vdso_size,
126 VM_READ|VM_EXEC| 126 VM_READ|VM_EXEC|
127 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| 127 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
128 VM_ALWAYSDUMP,
129 vdso_pages); 128 vdso_pages);
130 if (ret) { 129 if (ret) {
131 current->mm->context.vdso = NULL; 130 current->mm->context.vdso = NULL;
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 4172af8ceeb..b132ade26f7 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -62,6 +62,15 @@
62#include <asm/reboot.h> 62#include <asm/reboot.h>
63#include <asm/stackprotector.h> 63#include <asm/stackprotector.h>
64#include <asm/hypervisor.h> 64#include <asm/hypervisor.h>
65#include <asm/mwait.h>
66
67#ifdef CONFIG_ACPI
68#include <linux/acpi.h>
69#include <asm/acpi.h>
70#include <acpi/pdc_intel.h>
71#include <acpi/processor.h>
72#include <xen/interface/platform.h>
73#endif
65 74
66#include "xen-ops.h" 75#include "xen-ops.h"
67#include "mmu.h" 76#include "mmu.h"
@@ -200,13 +209,17 @@ static void __init xen_banner(void)
200static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0; 209static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0;
201static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; 210static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0;
202 211
212static __read_mostly unsigned int cpuid_leaf1_ecx_set_mask;
213static __read_mostly unsigned int cpuid_leaf5_ecx_val;
214static __read_mostly unsigned int cpuid_leaf5_edx_val;
215
203static void xen_cpuid(unsigned int *ax, unsigned int *bx, 216static void xen_cpuid(unsigned int *ax, unsigned int *bx,
204 unsigned int *cx, unsigned int *dx) 217 unsigned int *cx, unsigned int *dx)
205{ 218{
206 unsigned maskebx = ~0; 219 unsigned maskebx = ~0;
207 unsigned maskecx = ~0; 220 unsigned maskecx = ~0;
208 unsigned maskedx = ~0; 221 unsigned maskedx = ~0;
209 222 unsigned setecx = 0;
210 /* 223 /*
211 * Mask out inconvenient features, to try and disable as many 224 * Mask out inconvenient features, to try and disable as many
212 * unsupported kernel subsystems as possible. 225 * unsupported kernel subsystems as possible.
@@ -214,9 +227,18 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
214 switch (*ax) { 227 switch (*ax) {
215 case 1: 228 case 1:
216 maskecx = cpuid_leaf1_ecx_mask; 229 maskecx = cpuid_leaf1_ecx_mask;
230 setecx = cpuid_leaf1_ecx_set_mask;
217 maskedx = cpuid_leaf1_edx_mask; 231 maskedx = cpuid_leaf1_edx_mask;
218 break; 232 break;
219 233
234 case CPUID_MWAIT_LEAF:
235 /* Synthesize the values.. */
236 *ax = 0;
237 *bx = 0;
238 *cx = cpuid_leaf5_ecx_val;
239 *dx = cpuid_leaf5_edx_val;
240 return;
241
220 case 0xb: 242 case 0xb:
221 /* Suppress extended topology stuff */ 243 /* Suppress extended topology stuff */
222 maskebx = 0; 244 maskebx = 0;
@@ -232,9 +254,75 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
232 254
233 *bx &= maskebx; 255 *bx &= maskebx;
234 *cx &= maskecx; 256 *cx &= maskecx;
257 *cx |= setecx;
235 *dx &= maskedx; 258 *dx &= maskedx;
259
236} 260}
237 261
262static bool __init xen_check_mwait(void)
263{
264#ifdef CONFIG_ACPI
265 struct xen_platform_op op = {
266 .cmd = XENPF_set_processor_pminfo,
267 .u.set_pminfo.id = -1,
268 .u.set_pminfo.type = XEN_PM_PDC,
269 };
270 uint32_t buf[3];
271 unsigned int ax, bx, cx, dx;
272 unsigned int mwait_mask;
273
274 /* We need to determine whether it is OK to expose the MWAIT
275 * capability to the kernel to harvest deeper than C3 states from ACPI
276 * _CST using the processor_harvest_xen.c module. For this to work, we
277 * need to gather the MWAIT_LEAF values (which the cstate.c code
278 * checks against). The hypervisor won't expose the MWAIT flag because
279 * it would break backwards compatibility; so we will find out directly
280 * from the hardware and hypercall.
281 */
282 if (!xen_initial_domain())
283 return false;
284
285 ax = 1;
286 cx = 0;
287
288 native_cpuid(&ax, &bx, &cx, &dx);
289
290 mwait_mask = (1 << (X86_FEATURE_EST % 32)) |
291 (1 << (X86_FEATURE_MWAIT % 32));
292
293 if ((cx & mwait_mask) != mwait_mask)
294 return false;
295
296 /* We need to emulate the MWAIT_LEAF and for that we need both
297 * ecx and edx. The hypercall provides only partial information.
298 */
299
300 ax = CPUID_MWAIT_LEAF;
301 bx = 0;
302 cx = 0;
303 dx = 0;
304
305 native_cpuid(&ax, &bx, &cx, &dx);
306
307 /* Ask the Hypervisor whether to clear ACPI_PDC_C_C2C3_FFH. If so,
308 * don't expose MWAIT_LEAF and let ACPI pick the IOPORT version of C3.
309 */
310 buf[0] = ACPI_PDC_REVISION_ID;
311 buf[1] = 1;
312 buf[2] = (ACPI_PDC_C_CAPABILITY_SMP | ACPI_PDC_EST_CAPABILITY_SWSMP);
313
314 set_xen_guest_handle(op.u.set_pminfo.pdc, buf);
315
316 if ((HYPERVISOR_dom0_op(&op) == 0) &&
317 (buf[2] & (ACPI_PDC_C_C1_FFH | ACPI_PDC_C_C2C3_FFH))) {
318 cpuid_leaf5_ecx_val = cx;
319 cpuid_leaf5_edx_val = dx;
320 }
321 return true;
322#else
323 return false;
324#endif
325}
238static void __init xen_init_cpuid_mask(void) 326static void __init xen_init_cpuid_mask(void)
239{ 327{
240 unsigned int ax, bx, cx, dx; 328 unsigned int ax, bx, cx, dx;
@@ -261,6 +349,9 @@ static void __init xen_init_cpuid_mask(void)
261 /* Xen will set CR4.OSXSAVE if supported and not disabled by force */ 349 /* Xen will set CR4.OSXSAVE if supported and not disabled by force */
262 if ((cx & xsave_mask) != xsave_mask) 350 if ((cx & xsave_mask) != xsave_mask)
263 cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */ 351 cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */
352
353 if (xen_check_mwait())
354 cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32));
264} 355}
265 356
266static void xen_set_debugreg(int reg, unsigned long val) 357static void xen_set_debugreg(int reg, unsigned long val)
@@ -777,11 +868,11 @@ static DEFINE_PER_CPU(unsigned long, xen_cr0_value);
777 868
778static unsigned long xen_read_cr0(void) 869static unsigned long xen_read_cr0(void)
779{ 870{
780 unsigned long cr0 = percpu_read(xen_cr0_value); 871 unsigned long cr0 = this_cpu_read(xen_cr0_value);
781 872
782 if (unlikely(cr0 == 0)) { 873 if (unlikely(cr0 == 0)) {
783 cr0 = native_read_cr0(); 874 cr0 = native_read_cr0();
784 percpu_write(xen_cr0_value, cr0); 875 this_cpu_write(xen_cr0_value, cr0);
785 } 876 }
786 877
787 return cr0; 878 return cr0;
@@ -791,7 +882,7 @@ static void xen_write_cr0(unsigned long cr0)
791{ 882{
792 struct multicall_space mcs; 883 struct multicall_space mcs;
793 884
794 percpu_write(xen_cr0_value, cr0); 885 this_cpu_write(xen_cr0_value, cr0);
795 886
796 /* Only pay attention to cr0.TS; everything else is 887 /* Only pay attention to cr0.TS; everything else is
797 ignored. */ 888 ignored. */
diff --git a/arch/x86/xen/irq.c b/arch/x86/xen/irq.c
index 8bbb465b6f0..15733765797 100644
--- a/arch/x86/xen/irq.c
+++ b/arch/x86/xen/irq.c
@@ -26,7 +26,7 @@ static unsigned long xen_save_fl(void)
26 struct vcpu_info *vcpu; 26 struct vcpu_info *vcpu;
27 unsigned long flags; 27 unsigned long flags;
28 28
29 vcpu = percpu_read(xen_vcpu); 29 vcpu = this_cpu_read(xen_vcpu);
30 30
31 /* flag has opposite sense of mask */ 31 /* flag has opposite sense of mask */
32 flags = !vcpu->evtchn_upcall_mask; 32 flags = !vcpu->evtchn_upcall_mask;
@@ -50,7 +50,7 @@ static void xen_restore_fl(unsigned long flags)
50 make sure we're don't switch CPUs between getting the vcpu 50 make sure we're don't switch CPUs between getting the vcpu
51 pointer and updating the mask. */ 51 pointer and updating the mask. */
52 preempt_disable(); 52 preempt_disable();
53 vcpu = percpu_read(xen_vcpu); 53 vcpu = this_cpu_read(xen_vcpu);
54 vcpu->evtchn_upcall_mask = flags; 54 vcpu->evtchn_upcall_mask = flags;
55 preempt_enable_no_resched(); 55 preempt_enable_no_resched();
56 56
@@ -72,7 +72,7 @@ static void xen_irq_disable(void)
72 make sure we're don't switch CPUs between getting the vcpu 72 make sure we're don't switch CPUs between getting the vcpu
73 pointer and updating the mask. */ 73 pointer and updating the mask. */
74 preempt_disable(); 74 preempt_disable();
75 percpu_read(xen_vcpu)->evtchn_upcall_mask = 1; 75 this_cpu_read(xen_vcpu)->evtchn_upcall_mask = 1;
76 preempt_enable_no_resched(); 76 preempt_enable_no_resched();
77} 77}
78PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable); 78PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable);
@@ -86,7 +86,7 @@ static void xen_irq_enable(void)
86 the caller is confused and is trying to re-enable interrupts 86 the caller is confused and is trying to re-enable interrupts
87 on an indeterminate processor. */ 87 on an indeterminate processor. */
88 88
89 vcpu = percpu_read(xen_vcpu); 89 vcpu = this_cpu_read(xen_vcpu);
90 vcpu->evtchn_upcall_mask = 0; 90 vcpu->evtchn_upcall_mask = 0;
91 91
92 /* Doesn't matter if we get preempted here, because any 92 /* Doesn't matter if we get preempted here, because any
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 95c1cf60c66..988828b479e 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1071,14 +1071,14 @@ static void drop_other_mm_ref(void *info)
1071 struct mm_struct *mm = info; 1071 struct mm_struct *mm = info;
1072 struct mm_struct *active_mm; 1072 struct mm_struct *active_mm;
1073 1073
1074 active_mm = percpu_read(cpu_tlbstate.active_mm); 1074 active_mm = this_cpu_read(cpu_tlbstate.active_mm);
1075 1075
1076 if (active_mm == mm && percpu_read(cpu_tlbstate.state) != TLBSTATE_OK) 1076 if (active_mm == mm && this_cpu_read(cpu_tlbstate.state) != TLBSTATE_OK)
1077 leave_mm(smp_processor_id()); 1077 leave_mm(smp_processor_id());
1078 1078
1079 /* If this cpu still has a stale cr3 reference, then make sure 1079 /* If this cpu still has a stale cr3 reference, then make sure
1080 it has been flushed. */ 1080 it has been flushed. */
1081 if (percpu_read(xen_current_cr3) == __pa(mm->pgd)) 1081 if (this_cpu_read(xen_current_cr3) == __pa(mm->pgd))
1082 load_cr3(swapper_pg_dir); 1082 load_cr3(swapper_pg_dir);
1083} 1083}
1084 1084
@@ -1185,17 +1185,17 @@ static void __init xen_pagetable_setup_done(pgd_t *base)
1185 1185
1186static void xen_write_cr2(unsigned long cr2) 1186static void xen_write_cr2(unsigned long cr2)
1187{ 1187{
1188 percpu_read(xen_vcpu)->arch.cr2 = cr2; 1188 this_cpu_read(xen_vcpu)->arch.cr2 = cr2;
1189} 1189}
1190 1190
1191static unsigned long xen_read_cr2(void) 1191static unsigned long xen_read_cr2(void)
1192{ 1192{
1193 return percpu_read(xen_vcpu)->arch.cr2; 1193 return this_cpu_read(xen_vcpu)->arch.cr2;
1194} 1194}
1195 1195
1196unsigned long xen_read_cr2_direct(void) 1196unsigned long xen_read_cr2_direct(void)
1197{ 1197{
1198 return percpu_read(xen_vcpu_info.arch.cr2); 1198 return this_cpu_read(xen_vcpu_info.arch.cr2);
1199} 1199}
1200 1200
1201static void xen_flush_tlb(void) 1201static void xen_flush_tlb(void)
@@ -1278,12 +1278,12 @@ static void xen_flush_tlb_others(const struct cpumask *cpus,
1278 1278
1279static unsigned long xen_read_cr3(void) 1279static unsigned long xen_read_cr3(void)
1280{ 1280{
1281 return percpu_read(xen_cr3); 1281 return this_cpu_read(xen_cr3);
1282} 1282}
1283 1283
1284static void set_current_cr3(void *v) 1284static void set_current_cr3(void *v)
1285{ 1285{
1286 percpu_write(xen_current_cr3, (unsigned long)v); 1286 this_cpu_write(xen_current_cr3, (unsigned long)v);
1287} 1287}
1288 1288
1289static void __xen_write_cr3(bool kernel, unsigned long cr3) 1289static void __xen_write_cr3(bool kernel, unsigned long cr3)
@@ -1306,7 +1306,7 @@ static void __xen_write_cr3(bool kernel, unsigned long cr3)
1306 xen_extend_mmuext_op(&op); 1306 xen_extend_mmuext_op(&op);
1307 1307
1308 if (kernel) { 1308 if (kernel) {
1309 percpu_write(xen_cr3, cr3); 1309 this_cpu_write(xen_cr3, cr3);
1310 1310
1311 /* Update xen_current_cr3 once the batch has actually 1311 /* Update xen_current_cr3 once the batch has actually
1312 been submitted. */ 1312 been submitted. */
@@ -1322,7 +1322,7 @@ static void xen_write_cr3(unsigned long cr3)
1322 1322
1323 /* Update while interrupts are disabled, so its atomic with 1323 /* Update while interrupts are disabled, so its atomic with
1324 respect to ipis */ 1324 respect to ipis */
1325 percpu_write(xen_cr3, cr3); 1325 this_cpu_write(xen_cr3, cr3);
1326 1326
1327 __xen_write_cr3(true, cr3); 1327 __xen_write_cr3(true, cr3);
1328 1328
diff --git a/arch/x86/xen/multicalls.h b/arch/x86/xen/multicalls.h
index dee79b78a90..9c2e74f9096 100644
--- a/arch/x86/xen/multicalls.h
+++ b/arch/x86/xen/multicalls.h
@@ -47,7 +47,7 @@ static inline void xen_mc_issue(unsigned mode)
47 xen_mc_flush(); 47 xen_mc_flush();
48 48
49 /* restore flags saved in xen_mc_batch */ 49 /* restore flags saved in xen_mc_batch */
50 local_irq_restore(percpu_read(xen_mc_irq_flags)); 50 local_irq_restore(this_cpu_read(xen_mc_irq_flags));
51} 51}
52 52
53/* Set up a callback to be called when the current batch is flushed */ 53/* Set up a callback to be called when the current batch is flushed */
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index e03c6369217..1ba8dff2675 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -10,6 +10,7 @@
10#include <linux/pm.h> 10#include <linux/pm.h>
11#include <linux/memblock.h> 11#include <linux/memblock.h>
12#include <linux/cpuidle.h> 12#include <linux/cpuidle.h>
13#include <linux/cpufreq.h>
13 14
14#include <asm/elf.h> 15#include <asm/elf.h>
15#include <asm/vdso.h> 16#include <asm/vdso.h>
@@ -420,7 +421,7 @@ void __init xen_arch_setup(void)
420 boot_cpu_data.hlt_works_ok = 1; 421 boot_cpu_data.hlt_works_ok = 1;
421#endif 422#endif
422 disable_cpuidle(); 423 disable_cpuidle();
423 boot_option_idle_override = IDLE_HALT; 424 disable_cpufreq();
424 WARN_ON(set_pm_idle_to_default()); 425 WARN_ON(set_pm_idle_to_default());
425 fiddle_vdso(); 426 fiddle_vdso();
426} 427}
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 501d4e0244b..02900e8ce26 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -75,8 +75,14 @@ static void __cpuinit cpu_bringup(void)
75 75
76 xen_setup_cpu_clockevents(); 76 xen_setup_cpu_clockevents();
77 77
78 notify_cpu_starting(cpu);
79
80 ipi_call_lock();
78 set_cpu_online(cpu, true); 81 set_cpu_online(cpu, true);
79 percpu_write(cpu_state, CPU_ONLINE); 82 ipi_call_unlock();
83
84 this_cpu_write(cpu_state, CPU_ONLINE);
85
80 wmb(); 86 wmb();
81 87
82 /* We can take interrupts now: we're officially "up". */ 88 /* We can take interrupts now: we're officially "up". */
diff --git a/arch/xtensa/include/asm/mman.h b/arch/xtensa/include/asm/mman.h
index 30789010733..25bc6c1309c 100644
--- a/arch/xtensa/include/asm/mman.h
+++ b/arch/xtensa/include/asm/mman.h
@@ -86,6 +86,10 @@
86#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ 86#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
87#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ 87#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
88 88
89#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
90 overrides the coredump filter bits */
91#define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */
92
89/* compatibility flags */ 93/* compatibility flags */
90#define MAP_FILE 0 94#define MAP_FILE 0
91 95
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index 61045c192e8..eb30e356f5b 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -153,7 +153,7 @@ static void __init pci_controller_apertures(struct pci_controller *pci_ctrl,
153 } 153 }
154 res->start += io_offset; 154 res->start += io_offset;
155 res->end += io_offset; 155 res->end += io_offset;
156 pci_add_resource(resources, res); 156 pci_add_resource_offset(resources, res, io_offset);
157 157
158 for (i = 0; i < 3; i++) { 158 for (i = 0; i < 3; i++) {
159 res = &pci_ctrl->mem_resources[i]; 159 res = &pci_ctrl->mem_resources[i];
@@ -200,24 +200,9 @@ subsys_initcall(pcibios_init);
200 200
201void __init pcibios_fixup_bus(struct pci_bus *bus) 201void __init pcibios_fixup_bus(struct pci_bus *bus)
202{ 202{
203 struct pci_controller *pci_ctrl = bus->sysdata;
204 struct resource *res;
205 unsigned long io_offset;
206 int i;
207
208 io_offset = (unsigned long)pci_ctrl->io_space.base;
209 if (bus->parent) { 203 if (bus->parent) {
210 /* This is a subordinate bridge */ 204 /* This is a subordinate bridge */
211 pci_read_bridge_bases(bus); 205 pci_read_bridge_bases(bus);
212
213 for (i = 0; i < 4; i++) {
214 if ((res = bus->resource[i]) == NULL || !res->flags)
215 continue;
216 if (io_offset && (res->flags & IORESOURCE_IO)) {
217 res->start += io_offset;
218 res->end += io_offset;
219 }
220 }
221 } 206 }
222} 207}
223 208
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c
index f2220b5bdce..b69b000349f 100644
--- a/arch/xtensa/kernel/signal.c
+++ b/arch/xtensa/kernel/signal.c
@@ -260,10 +260,7 @@ asmlinkage long xtensa_rt_sigreturn(long a0, long a1, long a2, long a3,
260 goto badframe; 260 goto badframe;
261 261
262 sigdelsetmask(&set, ~_BLOCKABLE); 262 sigdelsetmask(&set, ~_BLOCKABLE);
263 spin_lock_irq(&current->sighand->siglock); 263 set_current_blocked(&set);
264 current->blocked = set;
265 recalc_sigpending();
266 spin_unlock_irq(&current->sighand->siglock);
267 264
268 if (restore_sigcontext(regs, frame)) 265 if (restore_sigcontext(regs, frame))
269 goto badframe; 266 goto badframe;
@@ -336,8 +333,8 @@ gen_return_code(unsigned char *codemem)
336} 333}
337 334
338 335
339static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 336static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
340 sigset_t *set, struct pt_regs *regs) 337 sigset_t *set, struct pt_regs *regs)
341{ 338{
342 struct rt_sigframe *frame; 339 struct rt_sigframe *frame;
343 int err = 0; 340 int err = 0;
@@ -422,12 +419,11 @@ static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
422 current->comm, current->pid, signal, frame, regs->pc); 419 current->comm, current->pid, signal, frame, regs->pc);
423#endif 420#endif
424 421
425 return; 422 return 0;
426 423
427give_sigsegv: 424give_sigsegv:
428 if (sig == SIGSEGV) 425 force_sigsegv(sig, current);
429 ka->sa.sa_handler = SIG_DFL; 426 return -EFAULT;
430 force_sig(SIGSEGV, current);
431} 427}
432 428
433/* 429/*
@@ -449,11 +445,8 @@ asmlinkage long xtensa_rt_sigsuspend(sigset_t __user *unewset,
449 return -EFAULT; 445 return -EFAULT;
450 446
451 sigdelsetmask(&newset, ~_BLOCKABLE); 447 sigdelsetmask(&newset, ~_BLOCKABLE);
452 spin_lock_irq(&current->sighand->siglock);
453 saveset = current->blocked; 448 saveset = current->blocked;
454 current->blocked = newset; 449 set_current_blocked(&newset);
455 recalc_sigpending();
456 spin_unlock_irq(&current->sighand->siglock);
457 450
458 regs->areg[2] = -EINTR; 451 regs->areg[2] = -EINTR;
459 while (1) { 452 while (1) {
@@ -536,17 +529,11 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
536 529
537 /* Whee! Actually deliver the signal. */ 530 /* Whee! Actually deliver the signal. */
538 /* Set up the stack frame */ 531 /* Set up the stack frame */
539 setup_frame(signr, &ka, &info, oldset, regs); 532 ret = setup_frame(signr, &ka, &info, oldset, regs);
540 533 if (ret)
541 if (ka.sa.sa_flags & SA_ONESHOT) 534 return ret;
542 ka.sa.sa_handler = SIG_DFL;
543 535
544 spin_lock_irq(&current->sighand->siglock); 536 block_sigmask(&ka, signr);
545 sigorsets(&current->blocked, &current->blocked, &ka.sa.sa_mask);
546 if (!(ka.sa.sa_flags & SA_NODEFER))
547 sigaddset(&current->blocked, signr);
548 recalc_sigpending();
549 spin_unlock_irq(&current->sighand->siglock);
550 if (current->ptrace & PT_SINGLESTEP) 537 if (current->ptrace & PT_SINGLESTEP)
551 task_pt_regs(current)->icountlevel = 1; 538 task_pt_regs(current)->icountlevel = 1;
552 539