aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig62
-rw-r--r--arch/arm/Makefile10
-rw-r--r--arch/arm/boot/compressed/decompress.c3
-rw-r--r--arch/arm/boot/dts/Makefile9
-rw-r--r--arch/arm/boot/dts/armada-370-xp.dtsi5
-rw-r--r--arch/arm/boot/dts/armada-370.dtsi44
-rw-r--r--arch/arm/boot/dts/armada-xp-db.dts4
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78230.dtsi57
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78260.dtsi70
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78460.dtsi70
-rw-r--r--arch/arm/boot/dts/dove-cm-a510.dts38
-rw-r--r--arch/arm/boot/dts/dove-cubox.dts42
-rw-r--r--arch/arm/boot/dts/dove-dove-db.dts38
-rw-r--r--arch/arm/boot/dts/dove.dtsi143
-rw-r--r--arch/arm/boot/dts/imx6q.dtsi9
-rw-r--r--arch/arm/boot/dts/integrator.dtsi76
-rw-r--r--arch/arm/boot/dts/integratorap.dts68
-rw-r--r--arch/arm/boot/dts/integratorcp.dts110
-rw-r--r--arch/arm/boot/dts/kirkwood-dnskw.dtsi10
-rw-r--r--arch/arm/boot/dts/kirkwood-dockstar.dts57
-rw-r--r--arch/arm/boot/dts/kirkwood-iconnect.dts50
-rw-r--r--arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts105
-rw-r--r--arch/arm/boot/dts/kirkwood-km_kirkwood.dts29
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi12
-rw-r--r--arch/arm/boot/dts/pxa910-dkb.dts137
-rw-r--r--arch/arm/boot/dts/pxa910.dtsi4
-rw-r--r--arch/arm/boot/dts/xenvm-4.2.dts68
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig4
-rw-r--r--arch/arm/configs/kirkwood_defconfig38
-rw-r--r--arch/arm/configs/lpc32xx_defconfig7
-rw-r--r--arch/arm/configs/marzen_defconfig15
-rw-r--r--arch/arm/configs/mvebu_defconfig2
-rw-r--r--arch/arm/configs/mxs_defconfig36
-rw-r--r--arch/arm/configs/s3c6400_defconfig3
-rw-r--r--arch/arm/configs/tegra_defconfig51
-rw-r--r--arch/arm/include/asm/Kbuild17
-rw-r--r--arch/arm/include/asm/arch_timer.h8
-rw-r--r--arch/arm/include/asm/current.h15
-rw-r--r--arch/arm/include/asm/delay.h9
-rw-r--r--arch/arm/include/asm/exec.h6
-rw-r--r--arch/arm/include/asm/glue-cache.h16
-rw-r--r--arch/arm/include/asm/hardirq.h2
-rw-r--r--arch/arm/include/asm/hardware/linkup-l1110.h48
-rw-r--r--arch/arm/include/asm/hypervisor.h6
-rw-r--r--arch/arm/include/asm/io.h67
-rw-r--r--arch/arm/include/asm/ipcbuf.h1
-rw-r--r--arch/arm/include/asm/msgbuf.h31
-rw-r--r--arch/arm/include/asm/mutex.h9
-rw-r--r--arch/arm/include/asm/opcodes-virt.h29
-rw-r--r--arch/arm/include/asm/opcodes.h181
-rw-r--r--arch/arm/include/asm/param.h31
-rw-r--r--arch/arm/include/asm/parport.h18
-rw-r--r--arch/arm/include/asm/segment.h11
-rw-r--r--arch/arm/include/asm/sembuf.h25
-rw-r--r--arch/arm/include/asm/serial.h19
-rw-r--r--arch/arm/include/asm/shmbuf.h42
-rw-r--r--arch/arm/include/asm/socket.h72
-rw-r--r--arch/arm/include/asm/sockios.h13
-rw-r--r--arch/arm/include/asm/sync_bitops.h27
-rw-r--r--arch/arm/include/asm/syscall.h5
-rw-r--r--arch/arm/include/asm/termbits.h198
-rw-r--r--arch/arm/include/asm/termios.h92
-rw-r--r--arch/arm/include/asm/thread_info.h6
-rw-r--r--arch/arm/include/asm/timex.h6
-rw-r--r--arch/arm/include/asm/types.h16
-rw-r--r--arch/arm/include/asm/unaligned.h19
-rw-r--r--arch/arm/include/asm/unistd.h8
-rw-r--r--arch/arm/include/asm/xen/events.h18
-rw-r--r--arch/arm/include/asm/xen/hypercall.h69
-rw-r--r--arch/arm/include/asm/xen/hypervisor.h19
-rw-r--r--arch/arm/include/asm/xen/interface.h73
-rw-r--r--arch/arm/include/asm/xen/page.h82
-rw-r--r--arch/arm/kernel/Makefile5
-rw-r--r--arch/arm/kernel/arch_timer.c383
-rw-r--r--arch/arm/kernel/asm-offsets.c2
-rw-r--r--arch/arm/kernel/atags.h14
-rw-r--r--arch/arm/kernel/atags_compat.c (renamed from arch/arm/kernel/compat.c)4
-rw-r--r--arch/arm/kernel/atags_parse.c238
-rw-r--r--arch/arm/kernel/atags_proc.c (renamed from arch/arm/kernel/atags.c)0
-rw-r--r--arch/arm/kernel/compat.h11
-rw-r--r--arch/arm/kernel/entry-common.S9
-rw-r--r--arch/arm/kernel/machine_kexec.c29
-rw-r--r--arch/arm/kernel/ptrace.c19
-rw-r--r--arch/arm/kernel/sched_clock.c8
-rw-r--r--arch/arm/kernel/setup.c236
-rw-r--r--arch/arm/kernel/smp.c13
-rw-r--r--arch/arm/lib/delay.c35
-rw-r--r--arch/arm/mach-at91/clock.c2
-rw-r--r--arch/arm/mach-davinci/board-tnetv107x-evm.c6
-rw-r--r--arch/arm/mach-davinci/da830.c48
-rw-r--r--arch/arm/mach-davinci/da850.c6
-rw-r--r--arch/arm/mach-dove/Kconfig7
-rw-r--r--arch/arm/mach-dove/Makefile4
-rw-r--r--arch/arm/mach-dove/common.c157
-rw-r--r--arch/arm/mach-dove/common.h4
-rw-r--r--arch/arm/mach-dove/include/mach/bridge-regs.h16
-rw-r--r--arch/arm/mach-dove/include/mach/dove.h126
-rw-r--r--arch/arm/mach-dove/include/mach/pm.h54
-rw-r--r--arch/arm/mach-dove/irq.c10
-rw-r--r--arch/arm/mach-dove/pcie.c6
-rw-r--r--arch/arm/mach-exynos/platsmp.c2
-rw-r--r--arch/arm/mach-imx/Kconfig2
-rw-r--r--arch/arm/mach-imx/clk-imx27.c4
-rw-r--r--arch/arm/mach-imx/devices-imx27.h4
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c49
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c47
-rw-r--r--arch/arm/mach-integrator/common.h3
-rw-r--r--arch/arm/mach-integrator/core.c17
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c276
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c325
-rw-r--r--arch/arm/mach-kirkwood/Kconfig21
-rw-r--r--arch/arm/mach-kirkwood/Makefile3
-rw-r--r--arch/arm/mach-kirkwood/addr-map.c3
-rw-r--r--arch/arm/mach-kirkwood/board-dnskw.c35
-rw-r--r--arch/arm/mach-kirkwood/board-dockstar.c61
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c14
-rw-r--r--arch/arm/mach-kirkwood/board-iconnect.c48
-rw-r--r--arch/arm/mach-kirkwood/board-iomega_ix2_200.c57
-rw-r--r--arch/arm/mach-kirkwood/board-km_kirkwood.c57
-rw-r--r--arch/arm/mach-kirkwood/common.c8
-rw-r--r--arch/arm/mach-kirkwood/common.h18
-rw-r--r--arch/arm/mach-kirkwood/include/mach/bridge-regs.h20
-rw-r--r--arch/arm/mach-kirkwood/include/mach/kirkwood.h112
-rw-r--r--arch/arm/mach-kirkwood/irq.c9
-rw-r--r--arch/arm/mach-kirkwood/pcie.c12
-rw-r--r--arch/arm/mach-kirkwood/ts41x-setup.c3
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c4
-rw-r--r--arch/arm/mach-mv78xx0/addr-map.c6
-rw-r--r--arch/arm/mach-mv78xx0/common.c4
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/bridge-regs.h12
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/mv78xx0.h86
-rw-r--r--arch/arm/mach-mv78xx0/irq.c9
-rw-r--r--arch/arm/mach-mv78xx0/pcie.c12
-rw-r--r--arch/arm/mach-mvebu/Kconfig20
-rw-r--r--arch/arm/mach-mvebu/Makefile5
-rw-r--r--arch/arm/mach-mvebu/addr-map.c134
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.c2
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.h2
-rw-r--r--arch/arm/mach-mvebu/include/mach/gpio.h1
-rw-r--r--arch/arm/mach-omap1/devices.c28
-rw-r--r--arch/arm/mach-omap1/timer.c2
-rw-r--r--arch/arm/mach-omap2/Makefile1
-rw-r--r--arch/arm/mach-omap2/board-apollon.c4
-rw-r--r--arch/arm/mach-omap2/board-h4.c6
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c2
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c30
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_apll.c2
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c10
-rw-r--r--arch/arm/mach-omap2/clkt34xx_dpll3m2.c20
-rw-r--r--arch/arm/mach-omap2/clkt_clksel.c86
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c26
-rw-r--r--arch/arm/mach-omap2/clock.c9
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c24
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c23
-rw-r--r--arch/arm/mach-omap2/clock33xx_data.c1
-rw-r--r--arch/arm/mach-omap2/clock3xxx.c8
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c37
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c21
-rw-r--r--arch/arm/mach-omap2/clockdomain.c17
-rw-r--r--arch/arm/mach-omap2/clockdomain.h20
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c49
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c11
-rw-r--r--arch/arm/mach-omap2/clockdomains3xxx_data.c7
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c3
-rw-r--r--arch/arm/mach-omap2/cm-regbits-33xx.h158
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h2
-rw-r--r--arch/arm/mach-omap2/cm-regbits-44xx.h411
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.c2
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.h1
-rw-r--r--arch/arm/mach-omap2/control.h1
-rw-r--r--arch/arm/mach-omap2/devices.c39
-rw-r--r--arch/arm/mach-omap2/display.c10
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c48
-rw-r--r--arch/arm/mach-omap2/gpmc.c194
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c138
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c19
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c19
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c17
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c110
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c280
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c243
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.h6
-rw-r--r--arch/arm/mach-omap2/pm.c5
-rw-r--r--arch/arm/mach-omap2/pmu.c95
-rw-r--r--arch/arm/mach-omap2/powerdomain44xx.c61
-rw-r--r--arch/arm/mach-omap2/prcm-common.h2
-rw-r--r--arch/arm/mach-omap2/usb-host.c31
-rw-r--r--arch/arm/mach-orion5x/addr-map.c3
-rw-r--r--arch/arm/mach-orion5x/common.c4
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c2
-rw-r--r--arch/arm/mach-orion5x/include/mach/bridge-regs.h20
-rw-r--r--arch/arm/mach-orion5x/include/mach/orion5x.h56
-rw-r--r--arch/arm/mach-orion5x/irq.c5
-rw-r--r--arch/arm/mach-orion5x/pci.c6
-rw-r--r--arch/arm/mach-sa1100/include/mach/SA-1111.h5
-rw-r--r--arch/arm/mach-sa1100/include/mach/lart.h13
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c2
-rw-r--r--arch/arm/mach-tegra/include/mach/smmu.h63
-rw-r--r--arch/arm/mach-u300/i2c.c2
-rw-r--r--arch/arm/mach-vexpress/v2m.c1
-rw-r--r--arch/arm/mm/alignment.c6
-rw-r--r--arch/arm/mm/cache-l2x0.c8
-rw-r--r--arch/arm/mm/cache-v7.S3
-rw-r--r--arch/arm/mm/init.c2
-rw-r--r--arch/arm/mm/ioremap.c1
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig6
-rw-r--r--arch/arm/plat-mxc/devices/Makefile1
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx27-coda.c37
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h8
-rw-r--r--arch/arm/plat-omap/clock.c27
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h5
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h1
-rw-r--r--arch/arm/plat-omap/include/plat/iommu.h15
-rw-r--r--arch/arm/plat-omap/include/plat/omap_device.h4
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h26
-rw-r--r--arch/arm/plat-omap/include/plat/usb.h7
-rw-r--r--arch/arm/plat-omap/omap_device.c59
-rw-r--r--arch/arm/plat-orion/Makefile10
-rw-r--r--arch/arm/plat-orion/addr-map.c11
-rw-r--r--arch/arm/plat-orion/common.c12
-rw-r--r--arch/arm/plat-orion/include/plat/addr-map.h4
-rw-r--r--arch/arm/plat-orion/include/plat/common.h8
-rw-r--r--arch/arm/plat-orion/include/plat/mpp.h2
-rw-r--r--arch/arm/plat-orion/include/plat/time.h4
-rw-r--r--arch/arm/plat-orion/mpp.c6
-rw-r--r--arch/arm/plat-orion/time.c8
-rw-r--r--arch/arm/plat-versatile/fpga-irq.c72
-rw-r--r--arch/arm/plat-versatile/include/plat/fpga-irq.h2
-rw-r--r--arch/arm/xen/Makefile1
-rw-r--r--arch/arm/xen/enlighten.c168
-rw-r--r--arch/arm/xen/grant-table.c53
-rw-r--r--arch/arm/xen/hypercall.S106
-rw-r--r--arch/arm64/include/asm/compat.h60
-rw-r--r--arch/arm64/include/asm/hwcap.h4
-rw-r--r--arch/arm64/include/asm/stat.h4
-rw-r--r--arch/arm64/include/asm/unistd.h8
-rw-r--r--arch/arm64/include/asm/unistd32.h4
-rw-r--r--arch/arm64/kernel/signal32.c53
-rw-r--r--arch/avr32/include/asm/elf.h3
-rw-r--r--arch/blackfin/include/asm/elf.h3
-rw-r--r--arch/c6x/Makefile2
-rw-r--r--arch/c6x/include/asm/Kbuild1
-rw-r--r--arch/c6x/include/asm/elf.h3
-rw-r--r--arch/c6x/include/asm/signal.h17
-rw-r--r--arch/c6x/include/asm/unistd.h4
-rw-r--r--arch/cris/include/asm/elf.h3
-rw-r--r--arch/frv/include/asm/elf.h3
-rw-r--r--arch/frv/kernel/pm.c19
-rw-r--r--arch/frv/kernel/setup.c2
-rw-r--r--arch/frv/mb93090-mb00/pci-irq.c2
-rw-r--r--arch/h8300/include/asm/elf.h3
-rw-r--r--arch/h8300/kernel/sys_h8300.c1
-rw-r--r--arch/h8300/kernel/timer/itu.c2
-rw-r--r--arch/h8300/kernel/timer/timer16.c2
-rw-r--r--arch/h8300/kernel/timer/timer8.c2
-rw-r--r--arch/h8300/kernel/timer/tpu.c2
-rw-r--r--arch/h8300/platform/h8300h/irq.c4
-rw-r--r--arch/h8300/platform/h8s/irq.c4
-rw-r--r--arch/hexagon/include/asm/elf.h3
-rw-r--r--arch/hexagon/include/asm/unistd.h5
-rw-r--r--arch/ia64/include/asm/xen/interface.h1
-rw-r--r--arch/ia64/xen/irq_xen.c2
-rw-r--r--arch/ia64/xen/irq_xen.h2
-rw-r--r--arch/m32r/include/asm/elf.h3
-rw-r--r--arch/m68k/include/asm/cacheflush_no.h19
-rw-r--r--arch/m68k/include/asm/elf.h3
-rw-r--r--arch/m68k/include/asm/m5206sim.h98
-rw-r--r--arch/m68k/include/asm/m523xsim.h24
-rw-r--r--arch/m68k/include/asm/m5249sim.h98
-rw-r--r--arch/m68k/include/asm/m525xsim.h70
-rw-r--r--arch/m68k/include/asm/m5272sim.h99
-rw-r--r--arch/m68k/include/asm/m527xsim.h84
-rw-r--r--arch/m68k/include/asm/m528xsim.h51
-rw-r--r--arch/m68k/include/asm/m5307sim.h136
-rw-r--r--arch/m68k/include/asm/m532xsim.h1189
-rw-r--r--arch/m68k/include/asm/m5407sim.h110
-rw-r--r--arch/m68k/include/asm/m54xxgpt.h40
-rw-r--r--arch/m68k/include/asm/m54xxsim.h27
-rw-r--r--arch/m68k/include/asm/mcfslt.h7
-rw-r--r--arch/m68k/include/asm/nettel.h9
-rw-r--r--arch/m68k/platform/68VZ328/Makefile8
-rw-r--r--arch/m68k/platform/coldfire/device.c4
-rw-r--r--arch/m68k/platform/coldfire/head.S2
-rw-r--r--arch/m68k/platform/coldfire/intc-5249.c10
-rw-r--r--arch/m68k/platform/coldfire/intc-5272.c20
-rw-r--r--arch/m68k/platform/coldfire/intc.c28
-rw-r--r--arch/m68k/platform/coldfire/m523x.c8
-rw-r--r--arch/m68k/platform/coldfire/m5249.c10
-rw-r--r--arch/m68k/platform/coldfire/m525x.c4
-rw-r--r--arch/m68k/platform/coldfire/m5272.c19
-rw-r--r--arch/m68k/platform/coldfire/m527x.c24
-rw-r--r--arch/m68k/platform/coldfire/m528x.c6
-rw-r--r--arch/m68k/platform/coldfire/m532x.c221
-rw-r--r--arch/m68k/platform/coldfire/m54xx.c16
-rw-r--r--arch/m68k/platform/coldfire/nettel.c4
-rw-r--r--arch/m68k/platform/coldfire/pci.c4
-rw-r--r--arch/m68k/platform/coldfire/reset.c2
-rw-r--r--arch/m68k/platform/coldfire/sltimers.c4
-rw-r--r--arch/m68k/platform/coldfire/timers.c4
-rw-r--r--arch/microblaze/Kconfig7
-rw-r--r--arch/microblaze/include/asm/clinkage.h1
-rw-r--r--arch/microblaze/include/asm/elf.h3
-rw-r--r--arch/microblaze/include/asm/io.h94
-rw-r--r--arch/microblaze/include/asm/page.h9
-rw-r--r--arch/microblaze/include/asm/pci.h2
-rw-r--r--arch/microblaze/include/asm/pgtable.h6
-rw-r--r--arch/microblaze/kernel/head.S14
-rw-r--r--arch/microblaze/kernel/hw_exception_handler.S61
-rw-r--r--arch/microblaze/kernel/reset.c21
-rw-r--r--arch/microblaze/kernel/setup.c15
-rw-r--r--arch/microblaze/kernel/signal.c8
-rw-r--r--arch/microblaze/kernel/timer.c24
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c2
-rw-r--r--arch/mips/include/asm/compat-signal.h62
-rw-r--r--arch/mips/include/asm/compat.h69
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/pci/pci-octeon.c2
-rw-r--r--arch/mn10300/Makefile2
-rw-r--r--arch/mn10300/include/asm/elf.h3
-rw-r--r--arch/openrisc/include/asm/elf.h3
-rw-r--r--arch/openrisc/include/asm/unistd.h5
-rw-r--r--arch/parisc/Kconfig1
-rw-r--r--arch/parisc/include/asm/compat.h59
-rw-r--r--arch/parisc/kernel/signal32.h52
-rw-r--r--arch/powerpc/Kconfig17
-rw-r--r--arch/powerpc/boot/Makefile1
-rw-r--r--arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi58
-rw-r--r--arch/powerpc/boot/dts/fsl/e500v2_power_isa.dtsi52
-rw-r--r--arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi59
-rw-r--r--arch/powerpc/boot/dts/fsl/mpc8536si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/mpc8544si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/mpc8568si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/mpc8569si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/mpc8572si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p1010si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p1020si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p1021si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p1023si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p2020si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p2041si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p3041si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p4080si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p5040si-post.dtsi320
-rw-r--r--arch/powerpc/boot/dts/fsl/p5040si-pre.dtsi114
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-sec5.2-0.dtsi118
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds.dtsi4
-rw-r--r--arch/powerpc/boot/dts/mpc8540ads.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8541cds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dtsi39
-rw-r--r--arch/powerpc/boot/dts/mpc8555cds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8560ads.dts2
-rw-r--r--arch/powerpc/boot/dts/o2d.dts47
-rw-r--r--arch/powerpc/boot/dts/o2d.dtsi139
-rw-r--r--arch/powerpc/boot/dts/o2d300.dts52
-rw-r--r--arch/powerpc/boot/dts/o2dnt2.dts48
-rw-r--r--arch/powerpc/boot/dts/o2i.dts33
-rw-r--r--arch/powerpc/boot/dts/o2mnt.dts33
-rw-r--r--arch/powerpc/boot/dts/o3dnt.dts48
-rw-r--r--arch/powerpc/boot/dts/p1020rdb_camp_core0.dts63
-rw-r--r--arch/powerpc/boot/dts/p1020rdb_camp_core1.dts141
-rw-r--r--arch/powerpc/boot/dts/p1022ds.dtsi4
-rw-r--r--arch/powerpc/boot/dts/p1022rdk.dts188
-rw-r--r--arch/powerpc/boot/dts/p2020rdb_camp_core0.dts67
-rw-r--r--arch/powerpc/boot/dts/p2020rdb_camp_core1.dts125
-rw-r--r--arch/powerpc/boot/dts/p2041rdb.dts4
-rw-r--r--arch/powerpc/boot/dts/p3041ds.dts4
-rw-r--r--arch/powerpc/boot/dts/p4080ds.dts4
-rw-r--r--arch/powerpc/boot/dts/p5020ds.dts4
-rw-r--r--arch/powerpc/boot/dts/p5040ds.dts207
-rw-r--r--arch/powerpc/configs/85xx/p1023rds_defconfig6
-rw-r--r--arch/powerpc/configs/corenet32_smp_defconfig1
-rw-r--r--arch/powerpc/configs/corenet64_smp_defconfig1
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig1
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig1
-rw-r--r--arch/powerpc/configs/ppc64_defconfig1
-rw-r--r--arch/powerpc/configs/pseries_defconfig1
-rw-r--r--arch/powerpc/include/asm/abs_addr.h56
-rw-r--r--arch/powerpc/include/asm/bitops.h10
-rw-r--r--arch/powerpc/include/asm/cacheflush.h2
-rw-r--r--arch/powerpc/include/asm/compat.h60
-rw-r--r--arch/powerpc/include/asm/debug.h2
-rw-r--r--arch/powerpc/include/asm/eeh.h141
-rw-r--r--arch/powerpc/include/asm/eeh_event.h6
-rw-r--r--arch/powerpc/include/asm/exception-64e.h6
-rw-r--r--arch/powerpc/include/asm/fsl_guts.h2
-rw-r--r--arch/powerpc/include/asm/fsl_ifc.h14
-rw-r--r--arch/powerpc/include/asm/hvcall.h5
-rw-r--r--arch/powerpc/include/asm/hw_breakpoint.h9
-rw-r--r--arch/powerpc/include/asm/kprobes.h15
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h2
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_asm.h1
-rw-r--r--arch/powerpc/include/asm/machdep.h9
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h169
-rw-r--r--arch/powerpc/include/asm/mmu.h9
-rw-r--r--arch/powerpc/include/asm/mpc52xx.h2
-rw-r--r--arch/powerpc/include/asm/mpic.h19
-rw-r--r--arch/powerpc/include/asm/paca.h3
-rw-r--r--arch/powerpc/include/asm/page_64.h10
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h11
-rw-r--r--arch/powerpc/include/asm/perf_event_server.h1
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64-4k.h4
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64-64k.h2
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h19
-rw-r--r--arch/powerpc/include/asm/pgtable.h10
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h3
-rw-r--r--arch/powerpc/include/asm/ppc-pci.h20
-rw-r--r--arch/powerpc/include/asm/probes.h42
-rw-r--r--arch/powerpc/include/asm/processor.h6
-rw-r--r--arch/powerpc/include/asm/pte-hash64-64k.h18
-rw-r--r--arch/powerpc/include/asm/reg.h54
-rw-r--r--arch/powerpc/include/asm/setup.h2
-rw-r--r--arch/powerpc/include/asm/siginfo.h1
-rw-r--r--arch/powerpc/include/asm/smp.h2
-rw-r--r--arch/powerpc/include/asm/sparsemem.h4
-rw-r--r--arch/powerpc/include/asm/swiotlb.h6
-rw-r--r--arch/powerpc/include/asm/thread_info.h7
-rw-r--r--arch/powerpc/include/asm/tlbflush.h7
-rw-r--r--arch/powerpc/include/asm/uaccess.h11
-rw-r--r--arch/powerpc/include/asm/uprobes.h54
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/asm-offsets.c2
-rw-r--r--arch/powerpc/kernel/cpu_setup_fsl_booke.S74
-rw-r--r--arch/powerpc/kernel/cputable.c4
-rw-r--r--arch/powerpc/kernel/dma-swiotlb.c22
-rw-r--r--arch/powerpc/kernel/dma.c3
-rw-r--r--arch/powerpc/kernel/entry_32.S47
-rw-r--r--arch/powerpc/kernel/entry_64.S35
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S212
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S127
-rw-r--r--arch/powerpc/kernel/fadump.c3
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S46
-rw-r--r--arch/powerpc/kernel/hw_breakpoint.c25
-rw-r--r--arch/powerpc/kernel/ibmebus.c1
-rw-r--r--arch/powerpc/kernel/iommu.c5
-rw-r--r--arch/powerpc/kernel/irq.c8
-rw-r--r--arch/powerpc/kernel/machine_kexec.c14
-rw-r--r--arch/powerpc/kernel/paca.c1
-rw-r--r--arch/powerpc/kernel/pci-common.c16
-rw-r--r--arch/powerpc/kernel/ppc32.h51
-rw-r--r--arch/powerpc/kernel/process.c16
-rw-r--r--arch/powerpc/kernel/prom.c4
-rw-r--r--arch/powerpc/kernel/prom_init.c2
-rw-r--r--arch/powerpc/kernel/ptrace.c3
-rw-r--r--arch/powerpc/kernel/rtas_flash.c7
-rw-r--r--arch/powerpc/kernel/rtas_pci.c5
-rw-r--r--arch/powerpc/kernel/setup_64.c2
-rw-r--r--arch/powerpc/kernel/signal.c8
-rw-r--r--arch/powerpc/kernel/smp.c14
-rw-r--r--arch/powerpc/kernel/time.c8
-rw-r--r--arch/powerpc/kernel/traps.c1
-rw-r--r--arch/powerpc/kernel/uprobes.c184
-rw-r--r--arch/powerpc/kernel/vdso.c4
-rw-r--r--arch/powerpc/kernel/vio.c1
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu_host.c8
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_host.c17
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S2
-rw-r--r--arch/powerpc/kvm/trace.h14
-rw-r--r--arch/powerpc/lib/memcpy_power7.S4
-rw-r--r--arch/powerpc/lib/sstep.c36
-rw-r--r--arch/powerpc/mm/fault.c1
-rw-r--r--arch/powerpc/mm/hash_low_64.S97
-rw-r--r--arch/powerpc/mm/hash_native_64.c192
-rw-r--r--arch/powerpc/mm/hash_utils_64.c48
-rw-r--r--arch/powerpc/mm/hugetlbpage-hash64.c15
-rw-r--r--arch/powerpc/mm/init_64.c1
-rw-r--r--arch/powerpc/mm/mem.c5
-rw-r--r--arch/powerpc/mm/mmu_context_hash64.c10
-rw-r--r--arch/powerpc/mm/pgtable_64.c13
-rw-r--r--arch/powerpc/mm/slb_low.S62
-rw-r--r--arch/powerpc/mm/slice.c112
-rw-r--r--arch/powerpc/mm/stab.c3
-rw-r--r--arch/powerpc/mm/subpage-prot.c6
-rw-r--r--arch/powerpc/mm/tlb_hash64.c11
-rw-r--r--arch/powerpc/mm/tlb_low_64e.S18
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c116
-rw-r--r--arch/powerpc/perf/core-book3s.c46
-rw-r--r--arch/powerpc/perf/power7-pmu.c3
-rw-r--r--arch/powerpc/platforms/40x/ppc40x_simple.c2
-rw-r--r--arch/powerpc/platforms/44x/currituck.c10
-rw-r--r--arch/powerpc/platforms/512x/Kconfig1
-rw-r--r--arch/powerpc/platforms/512x/clock.c6
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_generic.c2
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c6
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c2
-rw-r--r--arch/powerpc/platforms/52xx/media5200.c2
-rw-r--r--arch/powerpc/platforms/52xx/mpc5200_simple.c1
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c35
-rw-r--r--arch/powerpc/platforms/83xx/mpc837x_rdb.c2
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig21
-rw-r--r--arch/powerpc/platforms/85xx/Makefile2
-rw-r--r--arch/powerpc/platforms/85xx/common.c10
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.c38
-rw-r--r--arch/powerpc/platforms/85xx/ge_imp3a.c62
-rw-r--r--arch/powerpc/platforms/85xx/mpc8536_ds.c36
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c11
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c44
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c15
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c40
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_rdb.c30
-rw-r--r--arch/powerpc/platforms/85xx/p1010rdb.c14
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c36
-rw-r--r--arch/powerpc/platforms/85xx/p1022_rdk.c167
-rw-r--r--arch/powerpc/platforms/85xx/p1023_rds.c9
-rw-r--r--arch/powerpc/platforms/85xx/p2041_rdb.c2
-rw-r--r--arch/powerpc/platforms/85xx/p3041_ds.c2
-rw-r--r--arch/powerpc/platforms/85xx/p4080_ds.c2
-rw-r--r--arch/powerpc/platforms/85xx/p5020_ds.c2
-rw-r--r--arch/powerpc/platforms/85xx/p5040_ds.c89
-rw-r--r--arch/powerpc/platforms/85xx/qemu_e500.c5
-rw-r--r--arch/powerpc/platforms/85xx/sbc8548.c21
-rw-r--r--arch/powerpc/platforms/85xx/smp.c220
-rw-r--r--arch/powerpc/platforms/85xx/socrates.c11
-rw-r--r--arch/powerpc/platforms/85xx/stx_gp3.c13
-rw-r--r--arch/powerpc/platforms/85xx/tqm85xx.c23
-rw-r--r--arch/powerpc/platforms/85xx/xes_mpc85xx.c56
-rw-r--r--arch/powerpc/platforms/86xx/gef_ppc9a.c12
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc310.c13
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc610.c12
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c21
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c42
-rw-r--r--arch/powerpc/platforms/86xx/sbc8641d.c14
-rw-r--r--arch/powerpc/platforms/cell/beat.c4
-rw-r--r--arch/powerpc/platforms/cell/beat.h2
-rw-r--r--arch/powerpc/platforms/cell/beat_htab.c45
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c6
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c695
-rw-r--r--arch/powerpc/platforms/powernv/pci-p5ioc2.c1
-rw-r--r--arch/powerpc/platforms/powernv/pci.c7
-rw-r--r--arch/powerpc/platforms/powernv/pci.h21
-rw-r--r--arch/powerpc/platforms/ps3/htab.c22
-rw-r--r--arch/powerpc/platforms/ps3/setup.c10
-rw-r--r--arch/powerpc/platforms/pseries/Makefile5
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c543
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c59
-rw-r--r--arch/powerpc/platforms/pseries/eeh_dev.c14
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c310
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c54
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pe.c652
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pseries.c247
-rw-r--r--arch/powerpc/platforms/pseries/eeh_sysfs.c9
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c12
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c77
-rw-r--r--arch/powerpc/platforms/pseries/msi.c26
-rw-r--r--arch/powerpc/platforms/pseries/pci.c2
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c32
-rw-r--r--arch/powerpc/platforms/pseries/setup.c22
-rw-r--r--arch/powerpc/sysdev/Makefile2
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c19
-rw-r--r--arch/powerpc/sysdev/fsl_85xx_l2ctlr.c10
-rw-r--r--arch/powerpc/sysdev/fsl_ifc.c20
-rw-r--r--arch/powerpc/sysdev/fsl_mpic_err.c149
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c157
-rw-r--r--arch/powerpc/sysdev/fsl_pci.h20
-rw-r--r--arch/powerpc/sysdev/mpic.c102
-rw-r--r--arch/powerpc/sysdev/mpic.h22
-rw-r--r--arch/powerpc/xmon/xmon.c111
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/include/asm/compat.h75
-rw-r--r--arch/s390/kernel/compat_linux.h68
-rw-r--r--arch/score/Kconfig1
-rw-r--r--arch/score/include/asm/elf.h2
-rw-r--r--arch/score/include/asm/unistd.h5
-rw-r--r--arch/score/kernel/sys_score.c1
-rw-r--r--arch/sh/include/asm/elf.h3
-rw-r--r--arch/sh/include/asm/io.h2
-rw-r--r--arch/sh/kernel/ioport.c2
-rw-r--r--arch/sparc/include/asm/compat.h61
-rw-r--r--arch/sparc/include/asm/elf_32.h3
-rw-r--r--arch/sparc/include/asm/siginfo.h1
-rw-r--r--arch/sparc/kernel/signal32.c52
-rw-r--r--arch/tile/include/asm/compat.h62
-rw-r--r--arch/tile/include/asm/elf.h4
-rw-r--r--arch/tile/include/asm/unistd.h5
-rw-r--r--arch/tile/kernel/compat_signal.c57
-rw-r--r--arch/unicore32/Kconfig1
-rw-r--r--arch/unicore32/include/asm/unistd.h4
-rw-r--r--arch/x86/Makefile4
-rw-r--r--arch/x86/include/asm/apic.h2
-rw-r--r--arch/x86/include/asm/compat.h74
-rw-r--r--arch/x86/include/asm/ia32.h67
-rw-r--r--arch/x86/include/asm/xen/interface.h1
-rw-r--r--arch/x86/kernel/apic/apic_numachip.c4
-rw-r--r--arch/x86/kernel/rtc.c2
-rw-r--r--arch/x86/lguest/Kconfig1
-rw-r--r--arch/x86/xen/enlighten.c1
-rw-r--r--arch/x86/xen/irq.c1
-rw-r--r--arch/x86/xen/xen-ops.h1
-rw-r--r--arch/xtensa/include/asm/elf.h3
593 files changed, 14303 insertions, 7803 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7bab17ed2972..6d2f7f5c0036 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -16,6 +16,7 @@ config ARM
16 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 16 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
17 select HAVE_ARCH_KGDB 17 select HAVE_ARCH_KGDB
18 select HAVE_ARCH_TRACEHOOK 18 select HAVE_ARCH_TRACEHOOK
19 select HAVE_SYSCALL_TRACEPOINTS
19 select HAVE_KPROBES if !XIP_KERNEL 20 select HAVE_KPROBES if !XIP_KERNEL
20 select HAVE_KRETPROBES if (HAVE_KPROBES) 21 select HAVE_KRETPROBES if (HAVE_KPROBES)
21 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) 22 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
@@ -529,10 +530,11 @@ config ARCH_IXP4XX
529config ARCH_DOVE 530config ARCH_DOVE
530 bool "Marvell Dove" 531 bool "Marvell Dove"
531 select CPU_V7 532 select CPU_V7
532 select PCI
533 select ARCH_REQUIRE_GPIOLIB 533 select ARCH_REQUIRE_GPIOLIB
534 select GENERIC_CLOCKEVENTS 534 select GENERIC_CLOCKEVENTS
535 select PLAT_ORION 535 select MIGHT_HAVE_PCI
536 select PLAT_ORION_LEGACY
537 select USB_ARCH_HAS_EHCI
536 help 538 help
537 Support for the Marvell Dove SoC 88AP510 539 Support for the Marvell Dove SoC 88AP510
538 540
@@ -542,7 +544,7 @@ config ARCH_KIRKWOOD
542 select PCI 544 select PCI
543 select ARCH_REQUIRE_GPIOLIB 545 select ARCH_REQUIRE_GPIOLIB
544 select GENERIC_CLOCKEVENTS 546 select GENERIC_CLOCKEVENTS
545 select PLAT_ORION 547 select PLAT_ORION_LEGACY
546 help 548 help
547 Support for the following Marvell Kirkwood series SoCs: 549 Support for the following Marvell Kirkwood series SoCs:
548 88F6180, 88F6192 and 88F6281. 550 88F6180, 88F6192 and 88F6281.
@@ -568,7 +570,7 @@ config ARCH_MV78XX0
568 select PCI 570 select PCI
569 select ARCH_REQUIRE_GPIOLIB 571 select ARCH_REQUIRE_GPIOLIB
570 select GENERIC_CLOCKEVENTS 572 select GENERIC_CLOCKEVENTS
571 select PLAT_ORION 573 select PLAT_ORION_LEGACY
572 help 574 help
573 Support for the following Marvell MV78xx0 series SoCs: 575 Support for the following Marvell MV78xx0 series SoCs:
574 MV781x0, MV782x0. 576 MV781x0, MV782x0.
@@ -580,7 +582,7 @@ config ARCH_ORION5X
580 select PCI 582 select PCI
581 select ARCH_REQUIRE_GPIOLIB 583 select ARCH_REQUIRE_GPIOLIB
582 select GENERIC_CLOCKEVENTS 584 select GENERIC_CLOCKEVENTS
583 select PLAT_ORION 585 select PLAT_ORION_LEGACY
584 help 586 help
585 Support for the following Marvell Orion 5x series SoCs: 587 Support for the following Marvell Orion 5x series SoCs:
586 Orion-1 (5181), Orion-VoIP (5181L), Orion-NAS (5182), 588 Orion-1 (5181), Orion-VoIP (5181L), Orion-NAS (5182),
@@ -1138,6 +1140,10 @@ config PLAT_ORION
1138 select IRQ_DOMAIN 1140 select IRQ_DOMAIN
1139 select COMMON_CLK 1141 select COMMON_CLK
1140 1142
1143config PLAT_ORION_LEGACY
1144 bool
1145 select PLAT_ORION
1146
1141config PLAT_PXA 1147config PLAT_PXA
1142 bool 1148 bool
1143 1149
@@ -1397,6 +1403,16 @@ config PL310_ERRATA_769419
1397 on systems with an outer cache, the store buffer is drained 1403 on systems with an outer cache, the store buffer is drained
1398 explicitly. 1404 explicitly.
1399 1405
1406config ARM_ERRATA_775420
1407 bool "ARM errata: A data cache maintenance operation which aborts, might lead to deadlock"
1408 depends on CPU_V7
1409 help
1410 This option enables the workaround for the 775420 Cortex-A9 (r2p2,
1411 r2p6,r2p8,r2p10,r3p0) erratum. In case a date cache maintenance
1412 operation aborts with MMU exception, it might cause the processor
1413 to deadlock. This workaround puts DSB before executing ISB if
1414 an abort may occur on cache maintenance.
1415
1400endmenu 1416endmenu
1401 1417
1402source "arch/arm/common/Kconfig" 1418source "arch/arm/common/Kconfig"
@@ -1781,8 +1797,8 @@ config ALIGNMENT_TRAP
1781 configuration it is safe to say N, otherwise say Y. 1797 configuration it is safe to say N, otherwise say Y.
1782 1798
1783config UACCESS_WITH_MEMCPY 1799config UACCESS_WITH_MEMCPY
1784 bool "Use kernel mem{cpy,set}() for {copy_to,clear}_user() (EXPERIMENTAL)" 1800 bool "Use kernel mem{cpy,set}() for {copy_to,clear}_user()"
1785 depends on MMU && EXPERIMENTAL 1801 depends on MMU
1786 default y if CPU_FEROCEON 1802 default y if CPU_FEROCEON
1787 help 1803 help
1788 Implement faster copy_to_user and clear_user methods for CPU 1804 Implement faster copy_to_user and clear_user methods for CPU
@@ -1823,11 +1839,15 @@ config CC_STACKPROTECTOR
1823 neutralized via a kernel panic. 1839 neutralized via a kernel panic.
1824 This feature requires gcc version 4.2 or above. 1840 This feature requires gcc version 4.2 or above.
1825 1841
1826config DEPRECATED_PARAM_STRUCT 1842config XEN_DOM0
1827 bool "Provide old way to pass kernel parameters" 1843 def_bool y
1844 depends on XEN
1845
1846config XEN
1847 bool "Xen guest support on ARM (EXPERIMENTAL)"
1848 depends on EXPERIMENTAL && ARM && OF
1828 help 1849 help
1829 This was deprecated in 2001 and announced to live on for 5 years. 1850 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM.
1830 Some old boot loaders still use this way.
1831 1851
1832endmenu 1852endmenu
1833 1853
@@ -1841,6 +1861,23 @@ config USE_OF
1841 help 1861 help
1842 Include support for flattened device tree machine descriptions. 1862 Include support for flattened device tree machine descriptions.
1843 1863
1864config ATAGS
1865 bool "Support for the traditional ATAGS boot data passing" if USE_OF
1866 default y
1867 help
1868 This is the traditional way of passing data to the kernel at boot
1869 time. If you are solely relying on the flattened device tree (or
1870 the ARM_ATAG_DTB_COMPAT option) then you may unselect this option
1871 to remove ATAGS support from your kernel binary. If unsure,
1872 leave this to y.
1873
1874config DEPRECATED_PARAM_STRUCT
1875 bool "Provide old way to pass kernel parameters"
1876 depends on ATAGS
1877 help
1878 This was deprecated in 2001 and announced to live on for 5 years.
1879 Some old boot loaders still use this way.
1880
1844# Compressed boot loader in ROM. Yes, we really want to ask about 1881# Compressed boot loader in ROM. Yes, we really want to ask about
1845# TEXT and BSS so we preserve their values in the config files. 1882# TEXT and BSS so we preserve their values in the config files.
1846config ZBOOT_ROM_TEXT 1883config ZBOOT_ROM_TEXT
@@ -1967,6 +2004,7 @@ config CMDLINE
1967choice 2004choice
1968 prompt "Kernel command line type" if CMDLINE != "" 2005 prompt "Kernel command line type" if CMDLINE != ""
1969 default CMDLINE_FROM_BOOTLOADER 2006 default CMDLINE_FROM_BOOTLOADER
2007 depends on ATAGS
1970 2008
1971config CMDLINE_FROM_BOOTLOADER 2009config CMDLINE_FROM_BOOTLOADER
1972 bool "Use bootloader kernel arguments if available" 2010 bool "Use bootloader kernel arguments if available"
@@ -2036,7 +2074,7 @@ config KEXEC
2036 2074
2037config ATAGS_PROC 2075config ATAGS_PROC
2038 bool "Export atags in procfs" 2076 bool "Export atags in procfs"
2039 depends on KEXEC 2077 depends on ATAGS && KEXEC
2040 default y 2078 default y
2041 help 2079 help
2042 Should the atags used to boot the kernel be exported in an "atags" 2080 Should the atags used to boot the kernel be exported in an "atags"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index b86e57ef146b..f023e3acdfbd 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -250,6 +250,7 @@ endif
250core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ 250core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/
251core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) 251core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ)
252core-$(CONFIG_VFP) += arch/arm/vfp/ 252core-$(CONFIG_VFP) += arch/arm/vfp/
253core-$(CONFIG_XEN) += arch/arm/xen/
253 254
254# If we have a machine-specific directory, then include it in the build. 255# If we have a machine-specific directory, then include it in the build.
255core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ 256core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
@@ -268,7 +269,12 @@ else
268KBUILD_IMAGE := zImage 269KBUILD_IMAGE := zImage
269endif 270endif
270 271
271all: $(KBUILD_IMAGE) 272# Build the DT binary blobs if we have OF configured
273ifeq ($(CONFIG_USE_OF),y)
274KBUILD_DTBS := dtbs
275endif
276
277all: $(KBUILD_IMAGE) $(KBUILD_DTBS)
272 278
273boot := arch/arm/boot 279boot := arch/arm/boot
274 280
@@ -306,7 +312,7 @@ define archhelp
306 echo ' uImage - U-Boot wrapped zImage' 312 echo ' uImage - U-Boot wrapped zImage'
307 echo ' bootpImage - Combined zImage and initial RAM disk' 313 echo ' bootpImage - Combined zImage and initial RAM disk'
308 echo ' (supply initrd image via make variable INITRD=<path>)' 314 echo ' (supply initrd image via make variable INITRD=<path>)'
309 echo ' dtbs - Build device tree blobs for enabled boards' 315 echo '* dtbs - Build device tree blobs for enabled boards'
310 echo ' install - Install uncompressed kernel' 316 echo ' install - Install uncompressed kernel'
311 echo ' zinstall - Install compressed kernel' 317 echo ' zinstall - Install compressed kernel'
312 echo ' uinstall - Install U-Boot wrapped compressed kernel' 318 echo ' uinstall - Install U-Boot wrapped compressed kernel'
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
index f41b38cafce8..9deb56a702ce 100644
--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -32,6 +32,9 @@ extern void error(char *);
32# define Tracecv(c,x) 32# define Tracecv(c,x)
33#endif 33#endif
34 34
35/* Not needed, but used in some headers pulled in by decompressors */
36extern char * strstr(const char * s1, const char *s2);
37
35#ifdef CONFIG_KERNEL_GZIP 38#ifdef CONFIG_KERNEL_GZIP
36#include "../../../../lib/decompress_inflate.c" 39#include "../../../../lib/decompress_inflate.c"
37#endif 40#endif
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 43c084c2cd66..29f541f0e653 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -17,6 +17,9 @@ dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb \
17 usb_a9263.dtb \ 17 usb_a9263.dtb \
18 usb_a9g20.dtb 18 usb_a9g20.dtb
19dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 19dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
20dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
21 dove-cubox.dtb \
22 dove-dove-db.dtb
20dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ 23dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
21 exynos4210-smdkv310.dtb \ 24 exynos4210-smdkv310.dtb \
22 exynos4210-trats.dtb \ 25 exynos4210-trats.dtb \
@@ -33,10 +36,13 @@ dtb-$(CONFIG_SOC_IMX6Q) += imx6q-arm2.dtb \
33dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb 36dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
34dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \ 37dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
35 kirkwood-dns325.dtb \ 38 kirkwood-dns325.dtb \
39 kirkwood-dockstar.dtb \
36 kirkwood-dreamplug.dtb \ 40 kirkwood-dreamplug.dtb \
37 kirkwood-goflexnet.dtb \ 41 kirkwood-goflexnet.dtb \
38 kirkwood-ib62x0.dtb \ 42 kirkwood-ib62x0.dtb \
39 kirkwood-iconnect.dtb \ 43 kirkwood-iconnect.dtb \
44 kirkwood-iomega_ix2_200.dtb \
45 kirkwood-km_kirkwood.dtb \
40 kirkwood-lschlv2.dtb \ 46 kirkwood-lschlv2.dtb \
41 kirkwood-lsxhl.dtb \ 47 kirkwood-lsxhl.dtb \
42 kirkwood-ts219-6281.dtb \ 48 kirkwood-ts219-6281.dtb \
@@ -96,6 +102,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
96dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ 102dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \
97 vexpress-v2p-ca9.dtb \ 103 vexpress-v2p-ca9.dtb \
98 vexpress-v2p-ca15-tc1.dtb \ 104 vexpress-v2p-ca15-tc1.dtb \
99 vexpress-v2p-ca15_a7.dtb 105 vexpress-v2p-ca15_a7.dtb \
106 xenvm-4.2.dtb
100 107
101endif 108endif
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index 6b6b932a5a7d..16cc82cdaa81 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -63,6 +63,11 @@
63 reg = <0xd0020300 0x30>; 63 reg = <0xd0020300 0x30>;
64 interrupts = <37>, <38>, <39>, <40>; 64 interrupts = <37>, <38>, <39>, <40>;
65 }; 65 };
66
67 addr-decoding@d0020000 {
68 compatible = "marvell,armada-addr-decoding-controller";
69 reg = <0xd0020000 0x258>;
70 };
66 }; 71 };
67}; 72};
68 73
diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index 3228ccc83332..2069151afe01 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -21,6 +21,12 @@
21 model = "Marvell Armada 370 family SoC"; 21 model = "Marvell Armada 370 family SoC";
22 compatible = "marvell,armada370", "marvell,armada-370-xp"; 22 compatible = "marvell,armada370", "marvell,armada-370-xp";
23 23
24 aliases {
25 gpio0 = &gpio0;
26 gpio1 = &gpio1;
27 gpio2 = &gpio2;
28 };
29
24 mpic: interrupt-controller@d0020000 { 30 mpic: interrupt-controller@d0020000 {
25 reg = <0xd0020a00 0x1d0>, 31 reg = <0xd0020a00 0x1d0>,
26 <0xd0021870 0x58>; 32 <0xd0021870 0x58>;
@@ -31,5 +37,43 @@
31 compatible = "marvell,armada-370-xp-system-controller"; 37 compatible = "marvell,armada-370-xp-system-controller";
32 reg = <0xd0018200 0x100>; 38 reg = <0xd0018200 0x100>;
33 }; 39 };
40
41 pinctrl {
42 compatible = "marvell,mv88f6710-pinctrl";
43 reg = <0xd0018000 0x38>;
44 };
45
46 gpio0: gpio@d0018100 {
47 compatible = "marvell,orion-gpio";
48 reg = <0xd0018100 0x40>;
49 ngpios = <32>;
50 gpio-controller;
51 #gpio-cells = <2>;
52 interrupt-controller;
53 #interrupts-cells = <2>;
54 interrupts = <82>, <83>, <84>, <85>;
55 };
56
57 gpio1: gpio@d0018140 {
58 compatible = "marvell,orion-gpio";
59 reg = <0xd0018140 0x40>;
60 ngpios = <32>;
61 gpio-controller;
62 #gpio-cells = <2>;
63 interrupt-controller;
64 #interrupts-cells = <2>;
65 interrupts = <87>, <88>, <89>, <90>;
66 };
67
68 gpio2: gpio@d0018180 {
69 compatible = "marvell,orion-gpio";
70 reg = <0xd0018180 0x40>;
71 ngpios = <2>;
72 gpio-controller;
73 #gpio-cells = <2>;
74 interrupt-controller;
75 #interrupts-cells = <2>;
76 interrupts = <91>;
77 };
34 }; 78 };
35}; 79};
diff --git a/arch/arm/boot/dts/armada-xp-db.dts b/arch/arm/boot/dts/armada-xp-db.dts
index f97040d4258d..b1fc728515e9 100644
--- a/arch/arm/boot/dts/armada-xp-db.dts
+++ b/arch/arm/boot/dts/armada-xp-db.dts
@@ -14,11 +14,11 @@
14 */ 14 */
15 15
16/dts-v1/; 16/dts-v1/;
17/include/ "armada-xp.dtsi" 17/include/ "armada-xp-mv78460.dtsi"
18 18
19/ { 19/ {
20 model = "Marvell Armada XP Evaluation Board"; 20 model = "Marvell Armada XP Evaluation Board";
21 compatible = "marvell,axp-db", "marvell,armadaxp", "marvell,armada-370-xp"; 21 compatible = "marvell,axp-db", "marvell,armadaxp-mv78460", "marvell,armadaxp", "marvell,armada-370-xp";
22 22
23 chosen { 23 chosen {
24 bootargs = "console=ttyS0,115200 earlyprintk"; 24 bootargs = "console=ttyS0,115200 earlyprintk";
diff --git a/arch/arm/boot/dts/armada-xp-mv78230.dtsi b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
new file mode 100644
index 000000000000..ea355192be6f
--- /dev/null
+++ b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
@@ -0,0 +1,57 @@
1/*
2 * Device Tree Include file for Marvell Armada XP family SoC
3 *
4 * Copyright (C) 2012 Marvell
5 *
6 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 *
12 * Contains definitions specific to the Armada XP MV78230 SoC that are not
13 * common to all Armada XP SoCs.
14 */
15
16/include/ "armada-xp.dtsi"
17
18/ {
19 model = "Marvell Armada XP MV78230 SoC";
20 compatible = "marvell,armadaxp-mv78230", "marvell,armadaxp", "marvell,armada-370-xp";
21
22 aliases {
23 gpio0 = &gpio0;
24 gpio1 = &gpio1;
25 };
26
27 soc {
28 pinctrl {
29 compatible = "marvell,mv78230-pinctrl";
30 reg = <0xd0018000 0x38>;
31 };
32
33 gpio0: gpio@d0018100 {
34 compatible = "marvell,armadaxp-gpio";
35 reg = <0xd0018100 0x40>,
36 <0xd0018800 0x30>;
37 ngpios = <32>;
38 gpio-controller;
39 #gpio-cells = <2>;
40 interrupt-controller;
41 #interrupts-cells = <2>;
42 interrupts = <16>, <17>, <18>, <19>;
43 };
44
45 gpio1: gpio@d0018140 {
46 compatible = "marvell,armadaxp-gpio";
47 reg = <0xd0018140 0x40>,
48 <0xd0018840 0x30>;
49 ngpios = <17>;
50 gpio-controller;
51 #gpio-cells = <2>;
52 interrupt-controller;
53 #interrupts-cells = <2>;
54 interrupts = <20>, <21>, <22>;
55 };
56 };
57};
diff --git a/arch/arm/boot/dts/armada-xp-mv78260.dtsi b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
new file mode 100644
index 000000000000..2057863f3dfa
--- /dev/null
+++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
@@ -0,0 +1,70 @@
1/*
2 * Device Tree Include file for Marvell Armada XP family SoC
3 *
4 * Copyright (C) 2012 Marvell
5 *
6 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 *
12 * Contains definitions specific to the Armada XP MV78260 SoC that are not
13 * common to all Armada XP SoCs.
14 */
15
16/include/ "armada-xp.dtsi"
17
18/ {
19 model = "Marvell Armada XP MV78260 SoC";
20 compatible = "marvell,armadaxp-mv78260", "marvell,armadaxp", "marvell,armada-370-xp";
21
22 aliases {
23 gpio0 = &gpio0;
24 gpio1 = &gpio1;
25 gpio2 = &gpio2;
26 };
27
28 soc {
29 pinctrl {
30 compatible = "marvell,mv78260-pinctrl";
31 reg = <0xd0018000 0x38>;
32 };
33
34 gpio0: gpio@d0018100 {
35 compatible = "marvell,armadaxp-gpio";
36 reg = <0xd0018100 0x40>,
37 <0xd0018800 0x30>;
38 ngpios = <32>;
39 gpio-controller;
40 #gpio-cells = <2>;
41 interrupt-controller;
42 #interrupts-cells = <2>;
43 interrupts = <16>, <17>, <18>, <19>;
44 };
45
46 gpio1: gpio@d0018140 {
47 compatible = "marvell,armadaxp-gpio";
48 reg = <0xd0018140 0x40>,
49 <0xd0018840 0x30>;
50 ngpios = <32>;
51 gpio-controller;
52 #gpio-cells = <2>;
53 interrupt-controller;
54 #interrupts-cells = <2>;
55 interrupts = <20>, <21>, <22>, <23>;
56 };
57
58 gpio2: gpio@d0018180 {
59 compatible = "marvell,armadaxp-gpio";
60 reg = <0xd0018180 0x40>,
61 <0xd0018870 0x30>;
62 ngpios = <3>;
63 gpio-controller;
64 #gpio-cells = <2>;
65 interrupt-controller;
66 #interrupts-cells = <2>;
67 interrupts = <24>;
68 };
69 };
70};
diff --git a/arch/arm/boot/dts/armada-xp-mv78460.dtsi b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
new file mode 100644
index 000000000000..ffac98373792
--- /dev/null
+++ b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
@@ -0,0 +1,70 @@
1/*
2 * Device Tree Include file for Marvell Armada XP family SoC
3 *
4 * Copyright (C) 2012 Marvell
5 *
6 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 *
12 * Contains definitions specific to the Armada XP MV78460 SoC that are not
13 * common to all Armada XP SoCs.
14 */
15
16/include/ "armada-xp.dtsi"
17
18/ {
19 model = "Marvell Armada XP MV78460 SoC";
20 compatible = "marvell,armadaxp-mv78460", "marvell,armadaxp", "marvell,armada-370-xp";
21
22 aliases {
23 gpio0 = &gpio0;
24 gpio1 = &gpio1;
25 gpio2 = &gpio2;
26 };
27
28 soc {
29 pinctrl {
30 compatible = "marvell,mv78460-pinctrl";
31 reg = <0xd0018000 0x38>;
32 };
33
34 gpio0: gpio@d0018100 {
35 compatible = "marvell,armadaxp-gpio";
36 reg = <0xd0018100 0x40>,
37 <0xd0018800 0x30>;
38 ngpios = <32>;
39 gpio-controller;
40 #gpio-cells = <2>;
41 interrupt-controller;
42 #interrupts-cells = <2>;
43 interrupts = <16>, <17>, <18>, <19>;
44 };
45
46 gpio1: gpio@d0018140 {
47 compatible = "marvell,armadaxp-gpio";
48 reg = <0xd0018140 0x40>,
49 <0xd0018840 0x30>;
50 ngpios = <32>;
51 gpio-controller;
52 #gpio-cells = <2>;
53 interrupt-controller;
54 #interrupts-cells = <2>;
55 interrupts = <20>, <21>, <22>, <23>;
56 };
57
58 gpio2: gpio@d0018180 {
59 compatible = "marvell,armadaxp-gpio";
60 reg = <0xd0018180 0x40>,
61 <0xd0018870 0x30>;
62 ngpios = <3>;
63 gpio-controller;
64 #gpio-cells = <2>;
65 interrupt-controller;
66 #interrupts-cells = <2>;
67 interrupts = <24>;
68 };
69 };
70 };
diff --git a/arch/arm/boot/dts/dove-cm-a510.dts b/arch/arm/boot/dts/dove-cm-a510.dts
new file mode 100644
index 000000000000..61a8062e56de
--- /dev/null
+++ b/arch/arm/boot/dts/dove-cm-a510.dts
@@ -0,0 +1,38 @@
1/dts-v1/;
2
3/include/ "dove.dtsi"
4
5/ {
6 model = "Compulab CM-A510";
7 compatible = "compulab,cm-a510", "marvell,dove";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x40000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 };
17};
18
19&uart0 { status = "okay"; };
20&uart1 { status = "okay"; };
21&sdio0 { status = "okay"; };
22&sdio1 { status = "okay"; };
23&sata0 { status = "okay"; };
24
25&spi0 {
26 status = "okay";
27
28 /* spi0.0: 4M Flash Winbond W25Q32BV */
29 spi-flash@0 {
30 compatible = "st,w25q32";
31 spi-max-frequency = <20000000>;
32 reg = <0>;
33 };
34};
35
36&i2c0 {
37 status = "okay";
38};
diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
new file mode 100644
index 000000000000..0adbd5a38095
--- /dev/null
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -0,0 +1,42 @@
1/dts-v1/;
2
3/include/ "dove.dtsi"
4
5/ {
6 model = "SolidRun CuBox";
7 compatible = "solidrun,cubox", "marvell,dove";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x40000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 };
17
18 leds {
19 compatible = "gpio-leds";
20 power {
21 label = "Power";
22 gpios = <&gpio0 18 1>;
23 linux,default-trigger = "default-on";
24 };
25 };
26};
27
28&uart0 { status = "okay"; };
29&sdio0 { status = "okay"; };
30&sata0 { status = "okay"; };
31&i2c0 { status = "okay"; };
32
33&spi0 {
34 status = "okay";
35
36 /* spi0.0: 4M Flash Winbond W25Q32BV */
37 spi-flash@0 {
38 compatible = "st,w25q32";
39 spi-max-frequency = <20000000>;
40 reg = <0>;
41 };
42};
diff --git a/arch/arm/boot/dts/dove-dove-db.dts b/arch/arm/boot/dts/dove-dove-db.dts
new file mode 100644
index 000000000000..e5a920beab45
--- /dev/null
+++ b/arch/arm/boot/dts/dove-dove-db.dts
@@ -0,0 +1,38 @@
1/dts-v1/;
2
3/include/ "dove.dtsi"
4
5/ {
6 model = "Marvell DB-MV88AP510-BP Development Board";
7 compatible = "marvell,dove-db", "marvell,dove";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x40000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 };
17};
18
19&uart0 { status = "okay"; };
20&uart1 { status = "okay"; };
21&sdio0 { status = "okay"; };
22&sdio1 { status = "okay"; };
23&sata0 { status = "okay"; };
24
25&spi0 {
26 status = "okay";
27
28 /* spi0.0: 4M Flash ST-M25P32-VMF6P */
29 spi-flash@0 {
30 compatible = "st,m25p32";
31 spi-max-frequency = <20000000>;
32 reg = <0>;
33 };
34};
35
36&i2c0 {
37 status = "okay";
38};
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
new file mode 100644
index 000000000000..96fb824b5e6e
--- /dev/null
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -0,0 +1,143 @@
1/include/ "skeleton.dtsi"
2
3/ {
4 compatible = "marvell,dove";
5 model = "Marvell Armada 88AP510 SoC";
6
7 interrupt-parent = <&intc>;
8
9 intc: interrupt-controller {
10 compatible = "marvell,orion-intc";
11 interrupt-controller;
12 #interrupt-cells = <1>;
13 reg = <0xf1020204 0x04>,
14 <0xf1020214 0x04>;
15 };
16
17 mbus@f1000000 {
18 compatible = "simple-bus";
19 ranges = <0 0xf1000000 0x4000000>;
20 #address-cells = <1>;
21 #size-cells = <1>;
22
23 uart0: serial@12000 {
24 compatible = "ns16550a";
25 reg = <0x12000 0x100>;
26 reg-shift = <2>;
27 interrupts = <7>;
28 clock-frequency = <166666667>;
29 status = "disabled";
30 };
31
32 uart1: serial@12100 {
33 compatible = "ns16550a";
34 reg = <0x12100 0x100>;
35 reg-shift = <2>;
36 interrupts = <8>;
37 clock-frequency = <166666667>;
38 status = "disabled";
39 };
40
41 uart2: serial@12200 {
42 compatible = "ns16550a";
43 reg = <0x12000 0x100>;
44 reg-shift = <2>;
45 interrupts = <9>;
46 clock-frequency = <166666667>;
47 status = "disabled";
48 };
49
50 uart3: serial@12300 {
51 compatible = "ns16550a";
52 reg = <0x12100 0x100>;
53 reg-shift = <2>;
54 interrupts = <10>;
55 clock-frequency = <166666667>;
56 status = "disabled";
57 };
58
59 wdt: wdt@20300 {
60 compatible = "marvell,orion-wdt";
61 reg = <0x20300 0x28>;
62 };
63
64 gpio0: gpio@d0400 {
65 compatible = "marvell,orion-gpio";
66 #gpio-cells = <2>;
67 gpio-controller;
68 reg = <0xd0400 0x20>;
69 ngpio = <32>;
70 interrupts = <12>, <13>, <14>, <60>;
71 };
72
73 gpio1: gpio@d0420 {
74 compatible = "marvell,orion-gpio";
75 #gpio-cells = <2>;
76 gpio-controller;
77 reg = <0xd0420 0x20>;
78 ngpio = <32>;
79 interrupts = <61>;
80 };
81
82 gpio2: gpio@e8400 {
83 compatible = "marvell,orion-gpio";
84 #gpio-cells = <2>;
85 gpio-controller;
86 reg = <0xe8400 0x0c>;
87 ngpio = <8>;
88 };
89
90 spi0: spi@10600 {
91 compatible = "marvell,orion-spi";
92 #address-cells = <1>;
93 #size-cells = <0>;
94 cell-index = <0>;
95 interrupts = <6>;
96 reg = <0x10600 0x28>;
97 status = "disabled";
98 };
99
100 spi1: spi@14600 {
101 compatible = "marvell,orion-spi";
102 #address-cells = <1>;
103 #size-cells = <0>;
104 cell-index = <1>;
105 interrupts = <5>;
106 reg = <0x14600 0x28>;
107 status = "disabled";
108 };
109
110 i2c0: i2c@11000 {
111 compatible = "marvell,mv64xxx-i2c";
112 reg = <0x11000 0x20>;
113 #address-cells = <1>;
114 #size-cells = <0>;
115 interrupts = <11>;
116 clock-frequency = <400000>;
117 timeout-ms = <1000>;
118 status = "disabled";
119 };
120
121 sdio0: sdio@92000 {
122 compatible = "marvell,dove-sdhci";
123 reg = <0x92000 0x100>;
124 interrupts = <35>, <37>;
125 status = "disabled";
126 };
127
128 sdio1: sdio@90000 {
129 compatible = "marvell,dove-sdhci";
130 reg = <0x90000 0x100>;
131 interrupts = <36>, <38>;
132 status = "disabled";
133 };
134
135 sata0: sata@a0000 {
136 compatible = "marvell,orion-sata";
137 reg = <0xa0000 0x2400>;
138 interrupts = <62>;
139 nr-ports = <1>;
140 status = "disabled";
141 };
142 };
143};
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index 35e5895ba3df..f3990b04fecf 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -400,8 +400,8 @@
400 #clock-cells = <1>; 400 #clock-cells = <1>;
401 }; 401 };
402 402
403 anatop@020c8000 { 403 anatop: anatop@020c8000 {
404 compatible = "fsl,imx6q-anatop"; 404 compatible = "fsl,imx6q-anatop", "syscon", "simple-bus";
405 reg = <0x020c8000 0x1000>; 405 reg = <0x020c8000 0x1000>;
406 interrupts = <0 49 0x04 0 54 0x04 0 127 0x04>; 406 interrupts = <0 49 0x04 0 54 0x04 0 127 0x04>;
407 407
@@ -531,6 +531,11 @@
531 interrupts = <0 89 0x04 0 90 0x04>; 531 interrupts = <0 89 0x04 0 90 0x04>;
532 }; 532 };
533 533
534 gpr: iomuxc-gpr@020e0000 {
535 compatible = "fsl,imx6q-iomuxc-gpr", "syscon";
536 reg = <0x020e0000 0x38>;
537 };
538
534 iomuxc@020e0000 { 539 iomuxc@020e0000 {
535 compatible = "fsl,imx6q-iomuxc"; 540 compatible = "fsl,imx6q-iomuxc";
536 reg = <0x020e0000 0x4000>; 541 reg = <0x020e0000 0x4000>;
diff --git a/arch/arm/boot/dts/integrator.dtsi b/arch/arm/boot/dts/integrator.dtsi
new file mode 100644
index 000000000000..813b91d7bea2
--- /dev/null
+++ b/arch/arm/boot/dts/integrator.dtsi
@@ -0,0 +1,76 @@
1/*
2 * SoC core Device Tree for the ARM Integrator platforms
3 */
4
5/include/ "skeleton.dtsi"
6
7/ {
8 timer@13000000 {
9 reg = <0x13000000 0x100>;
10 interrupt-parent = <&pic>;
11 interrupts = <5>;
12 };
13
14 timer@13000100 {
15 reg = <0x13000100 0x100>;
16 interrupt-parent = <&pic>;
17 interrupts = <6>;
18 };
19
20 timer@13000200 {
21 reg = <0x13000200 0x100>;
22 interrupt-parent = <&pic>;
23 interrupts = <7>;
24 };
25
26 pic@14000000 {
27 compatible = "arm,versatile-fpga-irq";
28 #interrupt-cells = <1>;
29 interrupt-controller;
30 reg = <0x14000000 0x100>;
31 clear-mask = <0xffffffff>;
32 };
33
34 flash@24000000 {
35 compatible = "cfi-flash";
36 reg = <0x24000000 0x02000000>;
37 };
38
39 fpga {
40 compatible = "arm,amba-bus", "simple-bus";
41 #address-cells = <1>;
42 #size-cells = <1>;
43 ranges;
44 interrupt-parent = <&pic>;
45
46 /*
47 * These PrimeCells are in the same locations and using the
48 * same interrupts in all Integrators, however the silicon
49 * version deployed is different.
50 */
51 rtc@15000000 {
52 reg = <0x15000000 0x1000>;
53 interrupts = <8>;
54 };
55
56 uart@16000000 {
57 reg = <0x16000000 0x1000>;
58 interrupts = <1>;
59 };
60
61 uart@17000000 {
62 reg = <0x17000000 0x1000>;
63 interrupts = <2>;
64 };
65
66 kmi@18000000 {
67 reg = <0x18000000 0x1000>;
68 interrupts = <3>;
69 };
70
71 kmi@19000000 {
72 reg = <0x19000000 0x1000>;
73 interrupts = <4>;
74 };
75 };
76};
diff --git a/arch/arm/boot/dts/integratorap.dts b/arch/arm/boot/dts/integratorap.dts
new file mode 100644
index 000000000000..61767757b50a
--- /dev/null
+++ b/arch/arm/boot/dts/integratorap.dts
@@ -0,0 +1,68 @@
1/*
2 * Device Tree for the ARM Integrator/AP platform
3 */
4
5/dts-v1/;
6/include/ "integrator.dtsi"
7
8/ {
9 model = "ARM Integrator/AP";
10 compatible = "arm,integrator-ap";
11
12 aliases {
13 arm,timer-primary = &timer2;
14 arm,timer-secondary = &timer1;
15 };
16
17 chosen {
18 bootargs = "root=/dev/ram0 console=ttyAM0,38400n8 earlyprintk";
19 };
20
21 timer0: timer@13000000 {
22 compatible = "arm,integrator-timer";
23 };
24
25 timer1: timer@13000100 {
26 compatible = "arm,integrator-timer";
27 };
28
29 timer2: timer@13000200 {
30 compatible = "arm,integrator-timer";
31 };
32
33 pic: pic@14000000 {
34 valid-mask = <0x003fffff>;
35 };
36
37 fpga {
38 /*
39 * The Integator/AP predates the idea to have magic numbers
40 * identifying the PrimeCell in hardware, thus we have to
41 * supply these from the device tree.
42 */
43 rtc: rtc@15000000 {
44 compatible = "arm,pl030", "arm,primecell";
45 arm,primecell-periphid = <0x00041030>;
46 };
47
48 uart0: uart@16000000 {
49 compatible = "arm,pl010", "arm,primecell";
50 arm,primecell-periphid = <0x00041010>;
51 };
52
53 uart1: uart@17000000 {
54 compatible = "arm,pl010", "arm,primecell";
55 arm,primecell-periphid = <0x00041010>;
56 };
57
58 kmi0: kmi@18000000 {
59 compatible = "arm,pl050", "arm,primecell";
60 arm,primecell-periphid = <0x00041050>;
61 };
62
63 kmi1: kmi@19000000 {
64 compatible = "arm,pl050", "arm,primecell";
65 arm,primecell-periphid = <0x00041050>;
66 };
67 };
68};
diff --git a/arch/arm/boot/dts/integratorcp.dts b/arch/arm/boot/dts/integratorcp.dts
new file mode 100644
index 000000000000..2dd5e4e48481
--- /dev/null
+++ b/arch/arm/boot/dts/integratorcp.dts
@@ -0,0 +1,110 @@
1/*
2 * Device Tree for the ARM Integrator/CP platform
3 */
4
5/dts-v1/;
6/include/ "integrator.dtsi"
7
8/ {
9 model = "ARM Integrator/CP";
10 compatible = "arm,integrator-cp";
11
12 aliases {
13 arm,timer-primary = &timer2;
14 arm,timer-secondary = &timer1;
15 };
16
17 chosen {
18 bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk";
19 };
20
21 timer0: timer@13000000 {
22 compatible = "arm,sp804", "arm,primecell";
23 };
24
25 timer1: timer@13000100 {
26 compatible = "arm,sp804", "arm,primecell";
27 };
28
29 timer2: timer@13000200 {
30 compatible = "arm,sp804", "arm,primecell";
31 };
32
33 pic: pic@14000000 {
34 valid-mask = <0x1fc003ff>;
35 };
36
37 cic: cic@10000040 {
38 compatible = "arm,versatile-fpga-irq";
39 #interrupt-cells = <1>;
40 interrupt-controller;
41 reg = <0x10000040 0x100>;
42 clear-mask = <0xffffffff>;
43 valid-mask = <0x00000007>;
44 };
45
46 sic: sic@ca000000 {
47 compatible = "arm,versatile-fpga-irq";
48 #interrupt-cells = <1>;
49 interrupt-controller;
50 reg = <0xca000000 0x100>;
51 clear-mask = <0x00000fff>;
52 valid-mask = <0x00000fff>;
53 };
54
55 ethernet@c8000000 {
56 compatible = "smsc,lan91c111";
57 reg = <0xc8000000 0x10>;
58 interrupt-parent = <&pic>;
59 interrupts = <27>;
60 };
61
62 fpga {
63 /*
64 * These PrimeCells are at the same location and using
65 * the same interrupts in all Integrators, but in the CP
66 * slightly newer versions are deployed.
67 */
68 rtc@15000000 {
69 compatible = "arm,pl031", "arm,primecell";
70 };
71
72 uart@16000000 {
73 compatible = "arm,pl011", "arm,primecell";
74 };
75
76 uart@17000000 {
77 compatible = "arm,pl011", "arm,primecell";
78 };
79
80 kmi@18000000 {
81 compatible = "arm,pl050", "arm,primecell";
82 };
83
84 kmi@19000000 {
85 compatible = "arm,pl050", "arm,primecell";
86 };
87
88 /*
89 * These PrimeCells are only available on the Integrator/CP
90 */
91 mmc@1c000000 {
92 compatible = "arm,pl180", "arm,primecell";
93 reg = <0x1c000000 0x1000>;
94 interrupts = <23 24>;
95 max-frequency = <515633>;
96 };
97
98 aaci@1d000000 {
99 compatible = "arm,pl041", "arm,primecell";
100 reg = <0x1d000000 0x1000>;
101 interrupts = <25>;
102 };
103
104 clcd@c0000000 {
105 compatible = "arm,pl110", "arm,primecell";
106 reg = <0xC0000000 0x1000>;
107 interrupts = <22>;
108 };
109 };
110};
diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
index 7408655f91b5..9b32d0272825 100644
--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
+++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
@@ -25,6 +25,16 @@
25 }; 25 };
26 }; 26 };
27 27
28 gpio_fan {
29 /* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
30 compatible = "gpio-fan";
31 gpios = <&gpio1 14 1
32 &gpio1 13 1>;
33 gpio-fan,speed-map = <0 0
34 3000 1
35 6000 2>;
36 };
37
28 ocp@f1000000 { 38 ocp@f1000000 {
29 sata@80000 { 39 sata@80000 {
30 status = "okay"; 40 status = "okay";
diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts
new file mode 100644
index 000000000000..08a582414b88
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
@@ -0,0 +1,57 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "Seagate FreeAgent Dockstar";
7 compatible = "seagate,dockstar", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x8000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk root=/dev/sda1 rootdelay=10";
16 };
17
18 ocp@f1000000 {
19 serial@12000 {
20 clock-frequency = <200000000>;
21 status = "ok";
22 };
23
24 nand@3000000 {
25 status = "okay";
26
27 partition@0 {
28 label = "u-boot";
29 reg = <0x0000000 0x100000>;
30 read-only;
31 };
32
33 partition@100000 {
34 label = "uImage";
35 reg = <0x0100000 0x400000>;
36 };
37
38 partition@500000 {
39 label = "data";
40 reg = <0x0500000 0xfb00000>;
41 };
42 };
43 };
44 gpio-leds {
45 compatible = "gpio-leds";
46
47 health {
48 label = "status:green:health";
49 gpios = <&gpio1 14 1>;
50 linux,default-trigger = "default-on";
51 };
52 fault {
53 label = "status:orange:fault";
54 gpios = <&gpio1 15 1>;
55 };
56 };
57};
diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
index f8ca6fa88192..d97cd9d4753e 100644
--- a/arch/arm/boot/dts/kirkwood-iconnect.dts
+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
@@ -12,7 +12,7 @@
12 }; 12 };
13 13
14 chosen { 14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk mtdparts=orion_nand:0xc0000@0x0(uboot),0x20000@0xa0000(env),0x300000@0x100000(zImage),0x300000@0x540000(initrd),0x1f400000@0x980000(boot)"; 15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 linux,initrd-start = <0x4500040>; 16 linux,initrd-start = <0x4500040>;
17 linux,initrd-end = <0x4800000>; 17 linux,initrd-end = <0x4800000>;
18 }; 18 };
@@ -30,7 +30,37 @@
30 clock-frequency = <200000000>; 30 clock-frequency = <200000000>;
31 status = "ok"; 31 status = "ok";
32 }; 32 };
33
34 nand@3000000 {
35 status = "okay";
36
37 partition@0 {
38 label = "uboot";
39 reg = <0x0000000 0xc0000>;
40 };
41
42 partition@a0000 {
43 label = "env";
44 reg = <0xa0000 0x20000>;
45 };
46
47 partition@100000 {
48 label = "zImage";
49 reg = <0x100000 0x300000>;
50 };
51
52 partition@540000 {
53 label = "initrd";
54 reg = <0x540000 0x300000>;
55 };
56
57 partition@980000 {
58 label = "boot";
59 reg = <0x980000 0x1f400000>;
60 };
61 };
33 }; 62 };
63
34 gpio-leds { 64 gpio-leds {
35 compatible = "gpio-leds"; 65 compatible = "gpio-leds";
36 66
@@ -69,4 +99,22 @@
69 gpios = <&gpio1 16 0>; 99 gpios = <&gpio1 16 0>;
70 }; 100 };
71 }; 101 };
102
103 gpio_keys {
104 compatible = "gpio-keys";
105 #address-cells = <1>;
106 #size-cells = <0>;
107 button@1 {
108 label = "OTB Button";
109 linux,code = <133>;
110 gpios = <&gpio1 3 1>;
111 debounce-interval = <100>;
112 };
113 button@2 {
114 label = "Reset";
115 linux,code = <0x198>;
116 gpios = <&gpio0 12 1>;
117 debounce-interval = <100>;
118 };
119 };
72}; 120};
diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
new file mode 100644
index 000000000000..865aeec40a26
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
@@ -0,0 +1,105 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "Iomega StorCenter ix2-200";
7 compatible = "iom,ix2-200", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x10000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 };
17
18 ocp@f1000000 {
19 i2c@11000 {
20 status = "okay";
21
22 lm63: lm63@4c {
23 compatible = "national,lm63";
24 reg = <0x4c>;
25 };
26 };
27
28 serial@12000 {
29 clock-frequency = <200000000>;
30 status = "ok";
31 };
32
33 nand@3000000 {
34 status = "okay";
35
36 partition@0 {
37 label = "u-boot";
38 reg = <0x0000000 0x100000>;
39 read-only;
40 };
41
42 partition@a0000 {
43 label = "env";
44 reg = <0xa0000 0x20000>;
45 read-only;
46 };
47
48 partition@100000 {
49 label = "uImage";
50 reg = <0x100000 0x300000>;
51 };
52
53 partition@400000 {
54 label = "uInitrd";
55 reg = <0x540000 0x1000000>;
56 };
57 };
58 sata@80000 {
59 status = "okay";
60 nr-ports = <2>;
61 };
62
63 };
64 gpio-leds {
65 compatible = "gpio-leds";
66
67 power_led {
68 label = "status:white:power_led";
69 gpios = <&gpio0 16 0>;
70 linux,default-trigger = "default-on";
71 };
72 health_led1 {
73 label = "status:red:health_led";
74 gpios = <&gpio1 5 0>;
75 };
76 health_led2 {
77 label = "status:white:health_led";
78 gpios = <&gpio1 4 0>;
79 };
80 backup_led {
81 label = "status:blue:backup_led";
82 gpios = <&gpio0 15 0>;
83 };
84 };
85 gpio-keys {
86 compatible = "gpio-keys";
87 #address-cells = <1>;
88 #size-cells = <0>;
89 Power {
90 label = "Power Button";
91 linux,code = <116>;
92 gpios = <&gpio0 14 1>;
93 };
94 Reset {
95 label = "Reset Button";
96 linux,code = <0x198>;
97 gpios = <&gpio0 12 1>;
98 };
99 OTB {
100 label = "OTB Button";
101 linux,code = <133>;
102 gpios = <&gpio1 3 1>;
103 };
104 };
105};
diff --git a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
new file mode 100644
index 000000000000..75bdb93fed26
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
@@ -0,0 +1,29 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "Keymile Kirkwood Reference Design";
7 compatible = "keymile,km_kirkwood", "marvell,kirkwood-98DX4122", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x08000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 };
17
18 ocp@f1000000 {
19 serial@12000 {
20 clock-frequency = <200000000>;
21 status = "ok";
22 };
23
24 nand@3000000 {
25 status = "ok";
26 chip-delay = <25>;
27 };
28 };
29};
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index cef9616f330a..4e5b8154a5be 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -14,7 +14,8 @@
14 14
15 ocp@f1000000 { 15 ocp@f1000000 {
16 compatible = "simple-bus"; 16 compatible = "simple-bus";
17 ranges = <0 0xf1000000 0x4000000>; 17 ranges = <0x00000000 0xf1000000 0x4000000
18 0xf5000000 0xf5000000 0x0000400>;
18 #address-cells = <1>; 19 #address-cells = <1>;
19 #size-cells = <1>; 20 #size-cells = <1>;
20 21
@@ -105,5 +106,14 @@
105 clock-frequency = <100000>; 106 clock-frequency = <100000>;
106 status = "disabled"; 107 status = "disabled";
107 }; 108 };
109
110 crypto@30000 {
111 compatible = "marvell,orion-crypto";
112 reg = <0x30000 0x10000>,
113 <0xf5000000 0x800>;
114 reg-names = "regs", "sram";
115 interrupts = <22>;
116 status = "okay";
117 };
108 }; 118 };
109}; 119};
diff --git a/arch/arm/boot/dts/pxa910-dkb.dts b/arch/arm/boot/dts/pxa910-dkb.dts
index e92be5a474e7..595492aa5053 100644
--- a/arch/arm/boot/dts/pxa910-dkb.dts
+++ b/arch/arm/boot/dts/pxa910-dkb.dts
@@ -29,6 +29,143 @@
29 }; 29 };
30 twsi1: i2c@d4011000 { 30 twsi1: i2c@d4011000 {
31 status = "okay"; 31 status = "okay";
32
33 pmic: 88pm860x@34 {
34 compatible = "marvell,88pm860x";
35 reg = <0x34>;
36 interrupts = <4>;
37 interrupt-parent = <&intc>;
38 interrupt-controller;
39 #interrupt-cells = <1>;
40
41 marvell,88pm860x-irq-read-clr;
42 marvell,88pm860x-slave-addr = <0x11>;
43
44 regulators {
45 BUCK1 {
46 regulator-min-microvolt = <1000000>;
47 regulator-max-microvolt = <1500000>;
48 regulator-boot-on;
49 regulator-always-on;
50 };
51 BUCK2 {
52 regulator-min-microvolt = <1000000>;
53 regulator-max-microvolt = <1500000>;
54 regulator-boot-on;
55 regulator-always-on;
56 };
57 BUCK3 {
58 regulator-min-microvolt = <1000000>;
59 regulator-max-microvolt = <3000000>;
60 regulator-boot-on;
61 regulator-always-on;
62 };
63 LDO1 {
64 regulator-min-microvolt = <1200000>;
65 regulator-max-microvolt = <2800000>;
66 regulator-boot-on;
67 regulator-always-on;
68 };
69 LDO2 {
70 regulator-min-microvolt = <1800000>;
71 regulator-max-microvolt = <3300000>;
72 regulator-boot-on;
73 regulator-always-on;
74 };
75 LDO3 {
76 regulator-min-microvolt = <1800000>;
77 regulator-max-microvolt = <3300000>;
78 regulator-boot-on;
79 regulator-always-on;
80 };
81 LDO4 {
82 regulator-min-microvolt = <1800000>;
83 regulator-max-microvolt = <3300000>;
84 regulator-always-on;
85 };
86 LDO5 {
87 regulator-min-microvolt = <2900000>;
88 regulator-max-microvolt = <3300000>;
89 regulator-boot-on;
90 regulator-always-on;
91 };
92 LDO6 {
93 regulator-min-microvolt = <1800000>;
94 regulator-max-microvolt = <3300000>;
95 regulator-boot-on;
96 regulator-always-on;
97 };
98 LDO7 {
99 regulator-min-microvolt = <1800000>;
100 regulator-max-microvolt = <2900000>;
101 regulator-boot-on;
102 regulator-always-on;
103 };
104 LDO8 {
105 regulator-min-microvolt = <1800000>;
106 regulator-max-microvolt = <2900000>;
107 regulator-boot-on;
108 regulator-always-on;
109 };
110 LDO9 {
111 regulator-min-microvolt = <1800000>;
112 regulator-max-microvolt = <3300000>;
113 regulator-boot-on;
114 regulator-always-on;
115 };
116 LDO10 {
117 regulator-min-microvolt = <1200000>;
118 regulator-max-microvolt = <3300000>;
119 regulator-boot-on;
120 regulator-always-on;
121 };
122 LDO12 {
123 regulator-min-microvolt = <1200000>;
124 regulator-max-microvolt = <3300000>;
125 regulator-always-on;
126 };
127 LDO13 {
128 regulator-min-microvolt = <1200000>;
129 regulator-max-microvolt = <3300000>;
130 regulator-always-on;
131 };
132 LDO14 {
133 regulator-min-microvolt = <1800000>;
134 regulator-max-microvolt = <3300000>;
135 regulator-always-on;
136 };
137 };
138 rtc {
139 marvell,88pm860x-vrtc = <1>;
140 };
141 touch {
142 marvell,88pm860x-gpadc-prebias = <1>;
143 marvell,88pm860x-gpadc-slot-cycle = <1>;
144 marvell,88pm860x-tsi-prebias = <6>;
145 marvell,88pm860x-pen-prebias = <16>;
146 marvell,88pm860x-pen-prechg = <2>;
147 marvell,88pm860x-resistor-X = <300>;
148 };
149 backlights {
150 backlight-0 {
151 marvell,88pm860x-iset = <4>;
152 marvell,88pm860x-pwm = <3>;
153 };
154 backlight-2 {
155 };
156 };
157 leds {
158 led0-red {
159 marvell,88pm860x-iset = <12>;
160 };
161 led0-green {
162 marvell,88pm860x-iset = <12>;
163 };
164 led0-blue {
165 marvell,88pm860x-iset = <12>;
166 };
167 };
168 };
32 }; 169 };
33 rtc: rtc@d4010000 { 170 rtc: rtc@d4010000 {
34 status = "okay"; 171 status = "okay";
diff --git a/arch/arm/boot/dts/pxa910.dtsi b/arch/arm/boot/dts/pxa910.dtsi
index a3be44d86bcd..825aaca33034 100644
--- a/arch/arm/boot/dts/pxa910.dtsi
+++ b/arch/arm/boot/dts/pxa910.dtsi
@@ -120,6 +120,8 @@
120 120
121 twsi1: i2c@d4011000 { 121 twsi1: i2c@d4011000 {
122 compatible = "mrvl,mmp-twsi"; 122 compatible = "mrvl,mmp-twsi";
123 #address-cells = <1>;
124 #size-cells = <0>;
123 reg = <0xd4011000 0x1000>; 125 reg = <0xd4011000 0x1000>;
124 interrupts = <7>; 126 interrupts = <7>;
125 mrvl,i2c-fast-mode; 127 mrvl,i2c-fast-mode;
@@ -128,6 +130,8 @@
128 130
129 twsi2: i2c@d4037000 { 131 twsi2: i2c@d4037000 {
130 compatible = "mrvl,mmp-twsi"; 132 compatible = "mrvl,mmp-twsi";
133 #address-cells = <1>;
134 #size-cells = <0>;
131 reg = <0xd4037000 0x1000>; 135 reg = <0xd4037000 0x1000>;
132 interrupts = <54>; 136 interrupts = <54>;
133 status = "disabled"; 137 status = "disabled";
diff --git a/arch/arm/boot/dts/xenvm-4.2.dts b/arch/arm/boot/dts/xenvm-4.2.dts
new file mode 100644
index 000000000000..ec3f9528e180
--- /dev/null
+++ b/arch/arm/boot/dts/xenvm-4.2.dts
@@ -0,0 +1,68 @@
1/*
2 * Xen Virtual Machine for unprivileged guests
3 *
4 * Based on ARM Ltd. Versatile Express CoreTile Express (single CPU)
5 * Cortex-A15 MPCore (V2P-CA15)
6 *
7 */
8
9/dts-v1/;
10
11/ {
12 model = "XENVM-4.2";
13 compatible = "xen,xenvm-4.2", "xen,xenvm";
14 interrupt-parent = <&gic>;
15 #address-cells = <2>;
16 #size-cells = <2>;
17
18 chosen {
19 /* this field is going to be adjusted by the hypervisor */
20 bootargs = "console=hvc0 root=/dev/xvda";
21 };
22
23 cpus {
24 #address-cells = <1>;
25 #size-cells = <0>;
26
27 cpu@0 {
28 device_type = "cpu";
29 compatible = "arm,cortex-a15";
30 reg = <0>;
31 };
32 };
33
34 memory@80000000 {
35 device_type = "memory";
36 /* this field is going to be adjusted by the hypervisor */
37 reg = <0 0x80000000 0 0x08000000>;
38 };
39
40 gic: interrupt-controller@2c001000 {
41 compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
42 #interrupt-cells = <3>;
43 #address-cells = <0>;
44 interrupt-controller;
45 reg = <0 0x2c001000 0 0x1000>,
46 <0 0x2c002000 0 0x100>;
47 };
48
49 timer {
50 compatible = "arm,armv7-timer";
51 interrupts = <1 13 0xf08>,
52 <1 14 0xf08>,
53 <1 11 0xf08>,
54 <1 10 0xf08>;
55 };
56
57 hypervisor {
58 compatible = "xen,xen-4.2", "xen,xen";
59 /* this field is going to be adjusted by the hypervisor */
60 reg = <0 0xb0000000 0 0x20000>;
61 /* this field is going to be adjusted by the hypervisor */
62 interrupts = <1 15 0xf08>;
63 };
64
65 motherboard {
66 arm,v2m-memory-map = "rs1";
67 };
68};
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 565132d02105..66aa7a6db884 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -40,7 +40,6 @@ CONFIG_VMSPLIT_2G=y
40CONFIG_PREEMPT_VOLUNTARY=y 40CONFIG_PREEMPT_VOLUNTARY=y
41CONFIG_AEABI=y 41CONFIG_AEABI=y
42# CONFIG_OABI_COMPAT is not set 42# CONFIG_OABI_COMPAT is not set
43CONFIG_DEFAULT_MMAP_MIN_ADDR=32768
44CONFIG_CMDLINE="noinitrd console=ttymxc0,115200" 43CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
45CONFIG_VFP=y 44CONFIG_VFP=y
46CONFIG_NEON=y 45CONFIG_NEON=y
@@ -177,6 +176,9 @@ CONFIG_SND_SOC_IMX_MC13783=y
177CONFIG_USB=y 176CONFIG_USB=y
178CONFIG_USB_EHCI_HCD=y 177CONFIG_USB_EHCI_HCD=y
179CONFIG_USB_EHCI_MXC=y 178CONFIG_USB_EHCI_MXC=y
179CONFIG_USB_CHIPIDEA=y
180CONFIG_USB_CHIPIDEA_HOST=y
181CONFIG_USB_MXS_PHY=y
180CONFIG_USB_STORAGE=y 182CONFIG_USB_STORAGE=y
181CONFIG_MMC=y 183CONFIG_MMC=y
182CONFIG_MMC_SDHCI=y 184CONFIG_MMC_SDHCI=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index aeb3af541fed..74eee0c78f28 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -1,5 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y
3CONFIG_LOG_BUF_SHIFT=19 5CONFIG_LOG_BUF_SHIFT=19
4CONFIG_PROFILING=y 6CONFIG_PROFILING=y
5CONFIG_OPROFILE=y 7CONFIG_OPROFILE=y
@@ -15,9 +17,19 @@ CONFIG_MACH_MV88F6281GTW_GE=y
15CONFIG_MACH_SHEEVAPLUG=y 17CONFIG_MACH_SHEEVAPLUG=y
16CONFIG_MACH_ESATA_SHEEVAPLUG=y 18CONFIG_MACH_ESATA_SHEEVAPLUG=y
17CONFIG_MACH_GURUPLUG=y 19CONFIG_MACH_GURUPLUG=y
18CONFIG_MACH_DOCKSTAR=y 20CONFIG_MACH_DREAMPLUG_DT=y
21CONFIG_MACH_ICONNECT_DT=y
22CONFIG_MACH_DLINK_KIRKWOOD_DT=y
23CONFIG_MACH_IB62X0_DT=y
24CONFIG_MACH_TS219_DT=y
25CONFIG_MACH_DOCKSTAR_DT=y
26CONFIG_MACH_GOFLEXNET_DT=y
27CONFIG_MACH_LSXL_DT=y
28CONFIG_MACH_IOMEGA_IX2_200_DT=y
29CONFIG_MACH_KM_KIRKWOOD_DT=y
19CONFIG_MACH_TS219=y 30CONFIG_MACH_TS219=y
20CONFIG_MACH_TS41X=y 31CONFIG_MACH_TS41X=y
32CONFIG_MACH_DOCKSTAR=y
21CONFIG_MACH_OPENRD_BASE=y 33CONFIG_MACH_OPENRD_BASE=y
22CONFIG_MACH_OPENRD_CLIENT=y 34CONFIG_MACH_OPENRD_CLIENT=y
23CONFIG_MACH_OPENRD_ULTIMATE=y 35CONFIG_MACH_OPENRD_ULTIMATE=y
@@ -29,8 +41,6 @@ CONFIG_MACH_NET2BIG_V2=y
29CONFIG_MACH_NET5BIG_V2=y 41CONFIG_MACH_NET5BIG_V2=y
30CONFIG_MACH_T5325=y 42CONFIG_MACH_T5325=y
31# CONFIG_CPU_FEROCEON_OLD_ID is not set 43# CONFIG_CPU_FEROCEON_OLD_ID is not set
32CONFIG_NO_HZ=y
33CONFIG_HIGH_RES_TIMERS=y
34CONFIG_PREEMPT=y 44CONFIG_PREEMPT=y
35CONFIG_AEABI=y 45CONFIG_AEABI=y
36# CONFIG_OABI_COMPAT is not set 46# CONFIG_OABI_COMPAT is not set
@@ -47,13 +57,11 @@ CONFIG_IP_PNP_DHCP=y
47CONFIG_IP_PNP_BOOTP=y 57CONFIG_IP_PNP_BOOTP=y
48# CONFIG_IPV6 is not set 58# CONFIG_IPV6 is not set
49CONFIG_NET_DSA=y 59CONFIG_NET_DSA=y
50CONFIG_NET_DSA_MV88E6123_61_65=y
51CONFIG_NET_PKTGEN=m 60CONFIG_NET_PKTGEN=m
52CONFIG_CFG80211=y 61CONFIG_CFG80211=y
53CONFIG_MAC80211=y 62CONFIG_MAC80211=y
54CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 63CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
55CONFIG_MTD=y 64CONFIG_MTD=y
56CONFIG_MTD_PARTITIONS=y
57CONFIG_MTD_CMDLINE_PARTS=y 65CONFIG_MTD_CMDLINE_PARTS=y
58CONFIG_MTD_CHAR=y 66CONFIG_MTD_CHAR=y
59CONFIG_MTD_BLOCK=y 67CONFIG_MTD_BLOCK=y
@@ -69,7 +77,6 @@ CONFIG_MTD_M25P80=y
69CONFIG_MTD_NAND=y 77CONFIG_MTD_NAND=y
70CONFIG_MTD_NAND_ORION=y 78CONFIG_MTD_NAND_ORION=y
71CONFIG_BLK_DEV_LOOP=y 79CONFIG_BLK_DEV_LOOP=y
72# CONFIG_MISC_DEVICES is not set
73# CONFIG_SCSI_PROC_FS is not set 80# CONFIG_SCSI_PROC_FS is not set
74CONFIG_BLK_DEV_SD=y 81CONFIG_BLK_DEV_SD=y
75CONFIG_BLK_DEV_SR=m 82CONFIG_BLK_DEV_SR=m
@@ -78,22 +85,21 @@ CONFIG_ATA=y
78CONFIG_SATA_AHCI=y 85CONFIG_SATA_AHCI=y
79CONFIG_SATA_MV=y 86CONFIG_SATA_MV=y
80CONFIG_NETDEVICES=y 87CONFIG_NETDEVICES=y
81CONFIG_MARVELL_PHY=y
82CONFIG_NET_ETHERNET=y
83CONFIG_MII=y 88CONFIG_MII=y
84CONFIG_NET_PCI=y 89CONFIG_NET_DSA_MV88E6123_61_65=y
85CONFIG_MV643XX_ETH=y 90CONFIG_MV643XX_ETH=y
86# CONFIG_NETDEV_10000 is not set 91CONFIG_MARVELL_PHY=y
87CONFIG_LIBERTAS=y 92CONFIG_LIBERTAS=y
88CONFIG_LIBERTAS_SDIO=y 93CONFIG_LIBERTAS_SDIO=y
89CONFIG_INPUT_EVDEV=y 94CONFIG_INPUT_EVDEV=y
90CONFIG_KEYBOARD_GPIO=y 95CONFIG_KEYBOARD_GPIO=y
91# CONFIG_INPUT_MOUSE is not set 96# CONFIG_INPUT_MOUSE is not set
97CONFIG_LEGACY_PTY_COUNT=16
92# CONFIG_DEVKMEM is not set 98# CONFIG_DEVKMEM is not set
93CONFIG_SERIAL_8250=y 99CONFIG_SERIAL_8250=y
94CONFIG_SERIAL_8250_CONSOLE=y 100CONFIG_SERIAL_8250_CONSOLE=y
95CONFIG_SERIAL_8250_RUNTIME_UARTS=2 101CONFIG_SERIAL_8250_RUNTIME_UARTS=2
96CONFIG_LEGACY_PTY_COUNT=16 102CONFIG_SERIAL_OF_PLATFORM=y
97# CONFIG_HW_RANDOM is not set 103# CONFIG_HW_RANDOM is not set
98CONFIG_I2C=y 104CONFIG_I2C=y
99# CONFIG_I2C_COMPAT is not set 105# CONFIG_I2C_COMPAT is not set
@@ -103,7 +109,8 @@ CONFIG_SPI=y
103CONFIG_SPI_ORION=y 109CONFIG_SPI_ORION=y
104CONFIG_GPIO_SYSFS=y 110CONFIG_GPIO_SYSFS=y
105# CONFIG_HWMON is not set 111# CONFIG_HWMON is not set
106# CONFIG_VGA_CONSOLE is not set 112CONFIG_WATCHDOG=y
113CONFIG_ORION_WATCHDOG=y
107CONFIG_HID_DRAGONRISE=y 114CONFIG_HID_DRAGONRISE=y
108CONFIG_HID_GYRATION=y 115CONFIG_HID_GYRATION=y
109CONFIG_HID_TWINHAN=y 116CONFIG_HID_TWINHAN=y
@@ -119,10 +126,8 @@ CONFIG_HID_TOPSEED=y
119CONFIG_HID_THRUSTMASTER=y 126CONFIG_HID_THRUSTMASTER=y
120CONFIG_HID_ZEROPLUS=y 127CONFIG_HID_ZEROPLUS=y
121CONFIG_USB=y 128CONFIG_USB=y
122CONFIG_USB_DEVICEFS=y
123CONFIG_USB_EHCI_HCD=y 129CONFIG_USB_EHCI_HCD=y
124CONFIG_USB_EHCI_ROOT_HUB_TT=y 130CONFIG_USB_EHCI_ROOT_HUB_TT=y
125CONFIG_USB_EHCI_TT_NEWSCHED=y
126CONFIG_USB_PRINTER=m 131CONFIG_USB_PRINTER=m
127CONFIG_USB_STORAGE=y 132CONFIG_USB_STORAGE=y
128CONFIG_USB_STORAGE_DATAFAB=y 133CONFIG_USB_STORAGE_DATAFAB=y
@@ -148,7 +153,6 @@ CONFIG_MV_XOR=y
148CONFIG_EXT2_FS=y 153CONFIG_EXT2_FS=y
149CONFIG_EXT3_FS=y 154CONFIG_EXT3_FS=y
150# CONFIG_EXT3_FS_XATTR is not set 155# CONFIG_EXT3_FS_XATTR is not set
151CONFIG_INOTIFY=y
152CONFIG_ISO9660_FS=m 156CONFIG_ISO9660_FS=m
153CONFIG_JOLIET=y 157CONFIG_JOLIET=y
154CONFIG_UDF_FS=m 158CONFIG_UDF_FS=m
@@ -158,7 +162,6 @@ CONFIG_TMPFS=y
158CONFIG_JFFS2_FS=y 162CONFIG_JFFS2_FS=y
159CONFIG_CRAMFS=y 163CONFIG_CRAMFS=y
160CONFIG_NFS_FS=y 164CONFIG_NFS_FS=y
161CONFIG_NFS_V3=y
162CONFIG_ROOT_NFS=y 165CONFIG_ROOT_NFS=y
163CONFIG_NLS_CODEPAGE_437=y 166CONFIG_NLS_CODEPAGE_437=y
164CONFIG_NLS_CODEPAGE_850=y 167CONFIG_NLS_CODEPAGE_850=y
@@ -171,11 +174,8 @@ CONFIG_DEBUG_KERNEL=y
171# CONFIG_SCHED_DEBUG is not set 174# CONFIG_SCHED_DEBUG is not set
172# CONFIG_DEBUG_PREEMPT is not set 175# CONFIG_DEBUG_PREEMPT is not set
173CONFIG_DEBUG_INFO=y 176CONFIG_DEBUG_INFO=y
174# CONFIG_RCU_CPU_STALL_DETECTOR is not set
175CONFIG_SYSCTL_SYSCALL_CHECK=y
176# CONFIG_FTRACE is not set 177# CONFIG_FTRACE is not set
177CONFIG_DEBUG_USER=y 178CONFIG_DEBUG_USER=y
178CONFIG_DEBUG_ERRORS=y
179CONFIG_DEBUG_LL=y 179CONFIG_DEBUG_LL=y
180CONFIG_CRYPTO_CBC=m 180CONFIG_CRYPTO_CBC=m
181CONFIG_CRYPTO_PCBC=m 181CONFIG_CRYPTO_PCBC=m
diff --git a/arch/arm/configs/lpc32xx_defconfig b/arch/arm/configs/lpc32xx_defconfig
index e42a0e3d4c3a..92386b20bd09 100644
--- a/arch/arm/configs/lpc32xx_defconfig
+++ b/arch/arm/configs/lpc32xx_defconfig
@@ -133,7 +133,6 @@ CONFIG_SND_DEBUG_VERBOSE=y
133# CONFIG_SND_ARM is not set 133# CONFIG_SND_ARM is not set
134# CONFIG_SND_SPI is not set 134# CONFIG_SND_SPI is not set
135CONFIG_SND_SOC=y 135CONFIG_SND_SOC=y
136# CONFIG_HID_SUPPORT is not set
137CONFIG_USB=y 136CONFIG_USB=y
138CONFIG_USB_OHCI_HCD=y 137CONFIG_USB_OHCI_HCD=y
139CONFIG_USB_STORAGE=y 138CONFIG_USB_STORAGE=y
@@ -149,6 +148,7 @@ CONFIG_LEDS_CLASS=y
149CONFIG_LEDS_PCA9532=y 148CONFIG_LEDS_PCA9532=y
150CONFIG_LEDS_PCA9532_GPIO=y 149CONFIG_LEDS_PCA9532_GPIO=y
151CONFIG_LEDS_GPIO=y 150CONFIG_LEDS_GPIO=y
151CONFIG_LEDS_PWM=y
152CONFIG_LEDS_TRIGGERS=y 152CONFIG_LEDS_TRIGGERS=y
153CONFIG_LEDS_TRIGGER_TIMER=y 153CONFIG_LEDS_TRIGGER_TIMER=y
154CONFIG_LEDS_TRIGGER_HEARTBEAT=y 154CONFIG_LEDS_TRIGGER_HEARTBEAT=y
@@ -161,10 +161,13 @@ CONFIG_RTC_DRV_DS1374=y
161CONFIG_RTC_DRV_PCF8563=y 161CONFIG_RTC_DRV_PCF8563=y
162CONFIG_RTC_DRV_LPC32XX=y 162CONFIG_RTC_DRV_LPC32XX=y
163CONFIG_DMADEVICES=y 163CONFIG_DMADEVICES=y
164CONFIG_AMBA_PL08X=y
164CONFIG_STAGING=y 165CONFIG_STAGING=y
165CONFIG_LPC32XX_ADC=y 166CONFIG_LPC32XX_ADC=y
166CONFIG_MAX517=y
167CONFIG_IIO=y 167CONFIG_IIO=y
168CONFIG_MAX517=y
169CONFIG_PWM=y
170CONFIG_PWM_LPC32XX=y
168CONFIG_EXT2_FS=y 171CONFIG_EXT2_FS=y
169CONFIG_AUTOFS4_FS=y 172CONFIG_AUTOFS4_FS=y
170CONFIG_MSDOS_FS=y 173CONFIG_MSDOS_FS=y
diff --git a/arch/arm/configs/marzen_defconfig b/arch/arm/configs/marzen_defconfig
index f513acedc10a..53382b6c8bb4 100644
--- a/arch/arm/configs/marzen_defconfig
+++ b/arch/arm/configs/marzen_defconfig
@@ -1,13 +1,14 @@
1# CONFIG_ARM_PATCH_PHYS_VIRT is not set 1# CONFIG_ARM_PATCH_PHYS_VIRT is not set
2CONFIG_EXPERIMENTAL=y 2CONFIG_EXPERIMENTAL=y
3CONFIG_KERNEL_LZMA=y 3CONFIG_KERNEL_LZMA=y
4CONFIG_NO_HZ=y
4CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=16 7CONFIG_LOG_BUF_SHIFT=16
7CONFIG_SYSCTL_SYSCALL=y 8CONFIG_SYSCTL_SYSCALL=y
8CONFIG_EMBEDDED=y 9CONFIG_EMBEDDED=y
9CONFIG_SLAB=y 10CONFIG_SLAB=y
10# CONFIG_BLOCK is not set 11# CONFIG_IOSCHED_CFQ is not set
11CONFIG_ARCH_SHMOBILE=y 12CONFIG_ARCH_SHMOBILE=y
12CONFIG_ARCH_R8A7779=y 13CONFIG_ARCH_R8A7779=y
13CONFIG_MACH_MARZEN=y 14CONFIG_MACH_MARZEN=y
@@ -21,7 +22,6 @@ CONFIG_ARM_ERRATA_458693=y
21CONFIG_ARM_ERRATA_460075=y 22CONFIG_ARM_ERRATA_460075=y
22CONFIG_ARM_ERRATA_743622=y 23CONFIG_ARM_ERRATA_743622=y
23CONFIG_ARM_ERRATA_754322=y 24CONFIG_ARM_ERRATA_754322=y
24CONFIG_NO_HZ=y
25CONFIG_SMP=y 25CONFIG_SMP=y
26# CONFIG_ARM_CPU_TOPOLOGY is not set 26# CONFIG_ARM_CPU_TOPOLOGY is not set
27CONFIG_AEABI=y 27CONFIG_AEABI=y
@@ -29,13 +29,16 @@ CONFIG_AEABI=y
29CONFIG_HIGHMEM=y 29CONFIG_HIGHMEM=y
30CONFIG_ZBOOT_ROM_TEXT=0x0 30CONFIG_ZBOOT_ROM_TEXT=0x0
31CONFIG_ZBOOT_ROM_BSS=0x0 31CONFIG_ZBOOT_ROM_BSS=0x0
32CONFIG_CMDLINE="console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel" 32CONFIG_CMDLINE="console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on"
33CONFIG_CMDLINE_FORCE=y 33CONFIG_CMDLINE_FORCE=y
34CONFIG_KEXEC=y 34CONFIG_KEXEC=y
35# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 35# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
36CONFIG_PM_RUNTIME=y 36CONFIG_PM_RUNTIME=y
37CONFIG_NET=y 37CONFIG_NET=y
38CONFIG_UNIX=y
38CONFIG_INET=y 39CONFIG_INET=y
40CONFIG_IP_PNP=y
41CONFIG_IP_PNP_DHCP=y
39# CONFIG_IPV6 is not set 42# CONFIG_IPV6 is not set
40# CONFIG_WIRELESS is not set 43# CONFIG_WIRELESS is not set
41CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 44CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
@@ -71,16 +74,18 @@ CONFIG_GPIO_SYSFS=y
71CONFIG_THERMAL=y 74CONFIG_THERMAL=y
72CONFIG_RCAR_THERMAL=y 75CONFIG_RCAR_THERMAL=y
73CONFIG_SSB=y 76CONFIG_SSB=y
74# CONFIG_HID_SUPPORT is not set
75# CONFIG_USB_SUPPORT is not set 77# CONFIG_USB_SUPPORT is not set
78CONFIG_MMC=y
79CONFIG_MMC_SDHI=y
76CONFIG_UIO=y 80CONFIG_UIO=y
77CONFIG_UIO_PDRV_GENIRQ=y 81CONFIG_UIO_PDRV_GENIRQ=y
78# CONFIG_IOMMU_SUPPORT is not set 82# CONFIG_IOMMU_SUPPORT is not set
79# CONFIG_FILE_LOCKING is not set
80# CONFIG_DNOTIFY is not set 83# CONFIG_DNOTIFY is not set
81# CONFIG_INOTIFY_USER is not set 84# CONFIG_INOTIFY_USER is not set
82CONFIG_TMPFS=y 85CONFIG_TMPFS=y
83# CONFIG_MISC_FILESYSTEMS is not set 86# CONFIG_MISC_FILESYSTEMS is not set
87CONFIG_NFS_FS=y
88CONFIG_ROOT_NFS=y
84CONFIG_MAGIC_SYSRQ=y 89CONFIG_MAGIC_SYSRQ=y
85CONFIG_DEBUG_INFO=y 90CONFIG_DEBUG_INFO=y
86CONFIG_DEBUG_INFO_REDUCED=y 91CONFIG_DEBUG_INFO_REDUCED=y
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index 2e86b31c33cf..7bcf850eddcd 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -21,6 +21,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
21CONFIG_SERIAL_8250=y 21CONFIG_SERIAL_8250=y
22CONFIG_SERIAL_8250_CONSOLE=y 22CONFIG_SERIAL_8250_CONSOLE=y
23CONFIG_SERIAL_OF_PLATFORM=y 23CONFIG_SERIAL_OF_PLATFORM=y
24CONFIG_GPIOLIB=y
25CONFIG_GPIO_SYSFS=y
24CONFIG_EXT2_FS=y 26CONFIG_EXT2_FS=y
25CONFIG_EXT3_FS=y 27CONFIG_EXT3_FS=y
26# CONFIG_EXT3_FS_XATTR is not set 28# CONFIG_EXT3_FS_XATTR is not set
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index 36d60dda310c..048aaca60814 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -53,6 +53,9 @@ CONFIG_DEVTMPFS=y
53# CONFIG_FIRMWARE_IN_KERNEL is not set 53# CONFIG_FIRMWARE_IN_KERNEL is not set
54# CONFIG_BLK_DEV is not set 54# CONFIG_BLK_DEV is not set
55CONFIG_MTD=y 55CONFIG_MTD=y
56CONFIG_MTD_CHAR=y
57CONFIG_MTD_DATAFLASH=y
58CONFIG_MTD_M25P80
56CONFIG_MTD_NAND=y 59CONFIG_MTD_NAND=y
57CONFIG_MTD_NAND_GPMI_NAND=y 60CONFIG_MTD_NAND_GPMI_NAND=y
58CONFIG_NETDEVICES=y 61CONFIG_NETDEVICES=y
@@ -82,13 +85,13 @@ CONFIG_I2C_CHARDEV=y
82CONFIG_I2C_MXS=y 85CONFIG_I2C_MXS=y
83CONFIG_SPI=y 86CONFIG_SPI=y
84CONFIG_SPI_GPIO=m 87CONFIG_SPI_GPIO=m
88CONFIG_SPI_MXS=y
85CONFIG_DEBUG_GPIO=y 89CONFIG_DEBUG_GPIO=y
86CONFIG_GPIO_SYSFS=y 90CONFIG_GPIO_SYSFS=y
87# CONFIG_HWMON is not set 91# CONFIG_HWMON is not set
88# CONFIG_MFD_SUPPORT is not set 92# CONFIG_MFD_SUPPORT is not set
89CONFIG_DISPLAY_SUPPORT=m 93CONFIG_DISPLAY_SUPPORT=m
90# CONFIG_HID_SUPPORT is not set 94# CONFIG_HID_SUPPORT is not set
91# CONFIG_USB_SUPPORT is not set
92CONFIG_SOUND=y 95CONFIG_SOUND=y
93CONFIG_SND=y 96CONFIG_SND=y
94CONFIG_SND_TIMER=y 97CONFIG_SND_TIMER=y
@@ -103,14 +106,45 @@ CONFIG_SND_SOC_I2C_AND_SPI=y
103CONFIG_SND_SOC_SGTL5000=y 106CONFIG_SND_SOC_SGTL5000=y
104CONFIG_REGULATOR=y 107CONFIG_REGULATOR=y
105CONFIG_REGULATOR_FIXED_VOLTAGE=y 108CONFIG_REGULATOR_FIXED_VOLTAGE=y
109CONFIG_FB=y
110CONFIG_FB_MXS=y
111CONFIG_BACKLIGHT_LCD_SUPPORT=y
112CONFIG_LCD_CLASS_DEVICE=y
113CONFIG_BACKLIGHT_CLASS_DEVICE=y
114CONFIG_BACKLIGHT_PWM=y
115CONFIG_FRAMEBUFFER_CONSOLE=y
116CONFIG_FONTS=y
117CONFIG_LOGO=y
118CONFIG_USB=y
119CONFIG_USB_CHIPIDEA=y
120CONFIG_USB_CHIPIDEA_HOST=y
121CONFIG_USB_STORAGE=y
122CONFIG_USB_MXS_PHY=y
123CONFIG_SCSI=y
124CONFIG_BLK_DEV_SD=y
106CONFIG_MMC=y 125CONFIG_MMC=y
107CONFIG_MMC_MXS=y 126CONFIG_MMC_MXS=y
127CONFIG_NEW_LEDS=y
128CONFIG_LEDS_CLASS=y
129CONFIG_LEDS_GPIO=y
130CONFIG_LEDS_TRIGGERS=y
131CONFIG_LEDS_TRIGGER_TIMER=y
132CONFIG_LEDS_TRIGGER_ONESHOT=y
133CONFIG_LEDS_TRIGGER_HEARTBEAT=y
134CONFIG_LEDS_TRIGGER_BACKLIGHT=y
135CONFIG_LEDS_TRIGGER_GPIO=y
108CONFIG_RTC_CLASS=y 136CONFIG_RTC_CLASS=y
109CONFIG_RTC_DRV_DS1307=m 137CONFIG_RTC_DRV_DS1307=m
110CONFIG_RTC_DRV_STMP=y 138CONFIG_RTC_DRV_STMP=y
111CONFIG_DMADEVICES=y 139CONFIG_DMADEVICES=y
112CONFIG_MXS_DMA=y 140CONFIG_MXS_DMA=y
141CONFIG_STAGING=y
142CONFIG_MXS_LRADC=y
143CONFIG_IIO_SYSFS_TRIGGER=y
113CONFIG_COMMON_CLK_DEBUG=y 144CONFIG_COMMON_CLK_DEBUG=y
145CONFIG_IIO=y
146CONFIG_PWM=y
147CONFIG_PWM_MXS=y
114CONFIG_EXT3_FS=y 148CONFIG_EXT3_FS=y
115# CONFIG_DNOTIFY is not set 149# CONFIG_DNOTIFY is not set
116CONFIG_FSCACHE=m 150CONFIG_FSCACHE=m
diff --git a/arch/arm/configs/s3c6400_defconfig b/arch/arm/configs/s3c6400_defconfig
index ba6a515086b5..3a186d653dac 100644
--- a/arch/arm/configs/s3c6400_defconfig
+++ b/arch/arm/configs/s3c6400_defconfig
@@ -9,11 +9,14 @@ CONFIG_ARCH_S3C64XX=y
9CONFIG_S3C_BOOT_ERROR_RESET=y 9CONFIG_S3C_BOOT_ERROR_RESET=y
10CONFIG_MACH_SMDK6400=y 10CONFIG_MACH_SMDK6400=y
11CONFIG_MACH_ANW6410=y 11CONFIG_MACH_ANW6410=y
12CONFIG_MACH_MINI6410=y
13CONFIG_MACH_REAL6410=y
12CONFIG_MACH_SMDK6410=y 14CONFIG_MACH_SMDK6410=y
13CONFIG_MACH_NCP=y 15CONFIG_MACH_NCP=y
14CONFIG_MACH_HMT=y 16CONFIG_MACH_HMT=y
15CONFIG_MACH_SMARTQ5=y 17CONFIG_MACH_SMARTQ5=y
16CONFIG_MACH_SMARTQ7=y 18CONFIG_MACH_SMARTQ7=y
19CONFIG_MACH_WLF_CRAGG_6410=y
17CONFIG_CPU_32v6K=y 20CONFIG_CPU_32v6K=y
18CONFIG_AEABI=y 21CONFIG_AEABI=y
19CONFIG_CMDLINE="console=ttySAC0,115200 root=/dev/ram init=/linuxrc initrd=0x51000000,6M ramdisk_size=6144" 22CONFIG_CMDLINE="console=ttySAC0,115200 root=/dev/ram init=/linuxrc initrd=0x51000000,6M ramdisk_size=6144"
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index 0d6bb738c6de..e2184f6c20b3 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -24,11 +24,11 @@ CONFIG_EFI_PARTITION=y
24# CONFIG_IOSCHED_DEADLINE is not set 24# CONFIG_IOSCHED_DEADLINE is not set
25# CONFIG_IOSCHED_CFQ is not set 25# CONFIG_IOSCHED_CFQ is not set
26CONFIG_ARCH_TEGRA=y 26CONFIG_ARCH_TEGRA=y
27CONFIG_GPIO_PCA953X=y
27CONFIG_ARCH_TEGRA_2x_SOC=y 28CONFIG_ARCH_TEGRA_2x_SOC=y
28CONFIG_ARCH_TEGRA_3x_SOC=y 29CONFIG_ARCH_TEGRA_3x_SOC=y
29CONFIG_MACH_HARMONY=y 30CONFIG_TEGRA_PCI=y
30CONFIG_MACH_PAZ00=y 31CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA=y
31CONFIG_MACH_TRIMSLICE=y
32CONFIG_TEGRA_EMC_SCALING_ENABLE=y 32CONFIG_TEGRA_EMC_SCALING_ENABLE=y
33CONFIG_SMP=y 33CONFIG_SMP=y
34CONFIG_PREEMPT=y 34CONFIG_PREEMPT=y
@@ -67,7 +67,18 @@ CONFIG_INET6_IPCOMP=y
67CONFIG_IPV6_MIP6=y 67CONFIG_IPV6_MIP6=y
68CONFIG_IPV6_TUNNEL=y 68CONFIG_IPV6_TUNNEL=y
69CONFIG_IPV6_MULTIPLE_TABLES=y 69CONFIG_IPV6_MULTIPLE_TABLES=y
70# CONFIG_WIRELESS is not set 70CONFIG_BT=y
71CONFIG_BT_RFCOMM=y
72CONFIG_BT_BNEP=y
73CONFIG_BT_HIDP=y
74CONFIG_BT_HCIBTUSB=m
75CONFIG_CFG80211=y
76CONFIG_MAC80211=y
77CONFIG_RFKILL=y
78CONFIG_RFKILL_INPUT=y
79CONFIG_RFKILL_GPIO=y
80CONFIG_DEVTMPFS=y
81CONFIG_DEVTMPFS_MOUNT=y
71# CONFIG_FIRMWARE_IN_KERNEL is not set 82# CONFIG_FIRMWARE_IN_KERNEL is not set
72CONFIG_PROC_DEVICETREE=y 83CONFIG_PROC_DEVICETREE=y
73CONFIG_BLK_DEV_LOOP=y 84CONFIG_BLK_DEV_LOOP=y
@@ -87,7 +98,8 @@ CONFIG_USB_PEGASUS=y
87CONFIG_USB_USBNET=y 98CONFIG_USB_USBNET=y
88CONFIG_USB_NET_SMSC75XX=y 99CONFIG_USB_NET_SMSC75XX=y
89CONFIG_USB_NET_SMSC95XX=y 100CONFIG_USB_NET_SMSC95XX=y
90# CONFIG_WLAN is not set 101CONFIG_RT2X00=y
102CONFIG_RT2800USB=m
91CONFIG_INPUT_EVDEV=y 103CONFIG_INPUT_EVDEV=y
92CONFIG_INPUT_MISC=y 104CONFIG_INPUT_MISC=y
93CONFIG_INPUT_MPU3050=y 105CONFIG_INPUT_MPU3050=y
@@ -105,25 +117,31 @@ CONFIG_I2C_MUX_PINCTRL=y
105CONFIG_I2C_TEGRA=y 117CONFIG_I2C_TEGRA=y
106CONFIG_SPI=y 118CONFIG_SPI=y
107CONFIG_SPI_TEGRA=y 119CONFIG_SPI_TEGRA=y
108CONFIG_GPIO_TPS65910=y 120CONFIG_GPIO_PCA953X_IRQ=y
109CONFIG_GPIO_TPS6586X=y 121CONFIG_GPIO_TPS6586X=y
122CONFIG_GPIO_TPS65910=y
110CONFIG_POWER_SUPPLY=y 123CONFIG_POWER_SUPPLY=y
111CONFIG_BATTERY_SBS=y 124CONFIG_BATTERY_SBS=y
112CONFIG_SENSORS_LM90=y 125CONFIG_SENSORS_LM90=y
113CONFIG_MFD_TPS6586X=y 126CONFIG_MFD_TPS6586X=y
114CONFIG_MFD_TPS65910=y 127CONFIG_MFD_TPS65910=y
128CONFIG_MFD_MAX8907=y
115CONFIG_REGULATOR=y 129CONFIG_REGULATOR=y
116CONFIG_REGULATOR_FIXED_VOLTAGE=y 130CONFIG_REGULATOR_FIXED_VOLTAGE=y
117CONFIG_REGULATOR_VIRTUAL_CONSUMER=y 131CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
118CONFIG_REGULATOR_GPIO=y 132CONFIG_REGULATOR_GPIO=y
133CONFIG_REGULATOR_MAX8907=y
119CONFIG_REGULATOR_TPS62360=y 134CONFIG_REGULATOR_TPS62360=y
120CONFIG_REGULATOR_TPS6586X=y 135CONFIG_REGULATOR_TPS6586X=y
121CONFIG_REGULATOR_TPS65910=y 136CONFIG_REGULATOR_TPS65910=y
137CONFIG_MEDIA_SUPPORT=y
138CONFIG_MEDIA_CAMERA_SUPPORT=y
139CONFIG_MEDIA_USB_SUPPORT=y
140CONFIG_USB_VIDEO_CLASS=m
122CONFIG_SOUND=y 141CONFIG_SOUND=y
123CONFIG_SND=y 142CONFIG_SND=y
124# CONFIG_SND_SUPPORT_OLD_API is not set 143# CONFIG_SND_SUPPORT_OLD_API is not set
125# CONFIG_SND_DRIVERS is not set 144# CONFIG_SND_DRIVERS is not set
126# CONFIG_SND_PCI is not set
127# CONFIG_SND_ARM is not set 145# CONFIG_SND_ARM is not set
128# CONFIG_SND_SPI is not set 146# CONFIG_SND_SPI is not set
129# CONFIG_SND_USB is not set 147# CONFIG_SND_USB is not set
@@ -136,13 +154,25 @@ CONFIG_SND_SOC_TEGRA_ALC5632=y
136CONFIG_USB=y 154CONFIG_USB=y
137CONFIG_USB_EHCI_HCD=y 155CONFIG_USB_EHCI_HCD=y
138CONFIG_USB_EHCI_TEGRA=y 156CONFIG_USB_EHCI_TEGRA=y
157CONFIG_USB_ACM=y
158CONFIG_USB_WDM=y
139CONFIG_USB_STORAGE=y 159CONFIG_USB_STORAGE=y
140CONFIG_MMC=y 160CONFIG_MMC=y
141CONFIG_MMC_BLOCK_MINORS=16 161CONFIG_MMC_BLOCK_MINORS=16
142CONFIG_MMC_SDHCI=y 162CONFIG_MMC_SDHCI=y
143CONFIG_MMC_SDHCI_PLTFM=y 163CONFIG_MMC_SDHCI_PLTFM=y
144CONFIG_MMC_SDHCI_TEGRA=y 164CONFIG_MMC_SDHCI_TEGRA=y
165CONFIG_NEW_LEDS=y
166CONFIG_LEDS_CLASS=y
167CONFIG_LEDS_GPIO=y
168CONFIG_LEDS_TRIGGERS=y
169CONFIG_LEDS_TRIGGER_GPIO=y
145CONFIG_RTC_CLASS=y 170CONFIG_RTC_CLASS=y
171CONFIG_RTC_INTF_SYSFS=y
172CONFIG_RTC_INTF_PROC=y
173CONFIG_RTC_INTF_DEV=y
174CONFIG_RTC_DRV_MAX8907=y
175CONFIG_RTC_DRV_TPS65910=y
146CONFIG_RTC_DRV_EM3027=y 176CONFIG_RTC_DRV_EM3027=y
147CONFIG_RTC_DRV_TEGRA=y 177CONFIG_RTC_DRV_TEGRA=y
148CONFIG_DMADEVICES=y 178CONFIG_DMADEVICES=y
@@ -154,10 +184,14 @@ CONFIG_SENSORS_AK8975=y
154CONFIG_MFD_NVEC=y 184CONFIG_MFD_NVEC=y
155CONFIG_KEYBOARD_NVEC=y 185CONFIG_KEYBOARD_NVEC=y
156CONFIG_SERIO_NVEC_PS2=y 186CONFIG_SERIO_NVEC_PS2=y
187CONFIG_NVEC_POWER=y
188CONFIG_NVEC_PAZ00=y
157CONFIG_TEGRA_IOMMU_GART=y 189CONFIG_TEGRA_IOMMU_GART=y
158CONFIG_TEGRA_IOMMU_SMMU=y 190CONFIG_TEGRA_IOMMU_SMMU=y
159CONFIG_MEMORY=y 191CONFIG_MEMORY=y
160CONFIG_IIO=y 192CONFIG_IIO=y
193CONFIG_PWM=y
194CONFIG_PWM_TEGRA=y
161CONFIG_EXT2_FS=y 195CONFIG_EXT2_FS=y
162CONFIG_EXT2_FS_XATTR=y 196CONFIG_EXT2_FS_XATTR=y
163CONFIG_EXT2_FS_POSIX_ACL=y 197CONFIG_EXT2_FS_POSIX_ACL=y
@@ -170,6 +204,7 @@ CONFIG_EXT4_FS=y
170# CONFIG_DNOTIFY is not set 204# CONFIG_DNOTIFY is not set
171CONFIG_VFAT_FS=y 205CONFIG_VFAT_FS=y
172CONFIG_TMPFS=y 206CONFIG_TMPFS=y
207CONFIG_TMPFS_POSIX_ACL=y
173CONFIG_NFS_FS=y 208CONFIG_NFS_FS=y
174CONFIG_ROOT_NFS=y 209CONFIG_ROOT_NFS=y
175CONFIG_NLS_CODEPAGE_437=y 210CONFIG_NLS_CODEPAGE_437=y
@@ -188,8 +223,6 @@ CONFIG_DEBUG_VM=y
188CONFIG_DEBUG_SG=y 223CONFIG_DEBUG_SG=y
189CONFIG_DEBUG_LL=y 224CONFIG_DEBUG_LL=y
190CONFIG_EARLY_PRINTK=y 225CONFIG_EARLY_PRINTK=y
191CONFIG_CRYPTO_ECB=y
192CONFIG_CRYPTO_ARC4=y
193CONFIG_CRYPTO_TWOFISH=y 226CONFIG_CRYPTO_TWOFISH=y
194# CONFIG_CRYPTO_ANSI_CPRNG is not set 227# CONFIG_CRYPTO_ANSI_CPRNG is not set
195CONFIG_CRYPTO_DEV_TEGRA_AES=y 228CONFIG_CRYPTO_DEV_TEGRA_AES=y
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 960abceb8e14..8a7196ca5106 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -5,16 +5,33 @@ header-y += hwcap.h
5generic-y += auxvec.h 5generic-y += auxvec.h
6generic-y += bitsperlong.h 6generic-y += bitsperlong.h
7generic-y += cputime.h 7generic-y += cputime.h
8generic-y += current.h
8generic-y += emergency-restart.h 9generic-y += emergency-restart.h
9generic-y += errno.h 10generic-y += errno.h
11generic-y += exec.h
10generic-y += ioctl.h 12generic-y += ioctl.h
13generic-y += ipcbuf.h
11generic-y += irq_regs.h 14generic-y += irq_regs.h
12generic-y += kdebug.h 15generic-y += kdebug.h
13generic-y += local.h 16generic-y += local.h
14generic-y += local64.h 17generic-y += local64.h
18generic-y += msgbuf.h
19generic-y += param.h
20generic-y += parport.h
15generic-y += percpu.h 21generic-y += percpu.h
16generic-y += poll.h 22generic-y += poll.h
17generic-y += resource.h 23generic-y += resource.h
18generic-y += sections.h 24generic-y += sections.h
25generic-y += segment.h
26generic-y += sembuf.h
27generic-y += serial.h
28generic-y += shmbuf.h
19generic-y += siginfo.h 29generic-y += siginfo.h
20generic-y += sizes.h 30generic-y += sizes.h
31generic-y += socket.h
32generic-y += sockios.h
33generic-y += termbits.h
34generic-y += termios.h
35generic-y += timex.h
36generic-y += types.h
37generic-y += unaligned.h
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 62e75475e57e..d40229d9a1c9 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -2,11 +2,12 @@
2#define __ASMARM_ARCH_TIMER_H 2#define __ASMARM_ARCH_TIMER_H
3 3
4#include <asm/errno.h> 4#include <asm/errno.h>
5#include <linux/clocksource.h>
5 6
6#ifdef CONFIG_ARM_ARCH_TIMER 7#ifdef CONFIG_ARM_ARCH_TIMER
7#define ARCH_HAS_READ_CURRENT_TIMER
8int arch_timer_of_register(void); 8int arch_timer_of_register(void);
9int arch_timer_sched_clock_init(void); 9int arch_timer_sched_clock_init(void);
10struct timecounter *arch_timer_get_timecounter(void);
10#else 11#else
11static inline int arch_timer_of_register(void) 12static inline int arch_timer_of_register(void)
12{ 13{
@@ -17,6 +18,11 @@ static inline int arch_timer_sched_clock_init(void)
17{ 18{
18 return -ENXIO; 19 return -ENXIO;
19} 20}
21
22static inline struct timecounter *arch_timer_get_timecounter(void)
23{
24 return NULL;
25}
20#endif 26#endif
21 27
22#endif 28#endif
diff --git a/arch/arm/include/asm/current.h b/arch/arm/include/asm/current.h
deleted file mode 100644
index 75d21e2a3ff7..000000000000
--- a/arch/arm/include/asm/current.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASMARM_CURRENT_H
2#define _ASMARM_CURRENT_H
3
4#include <linux/thread_info.h>
5
6static inline struct task_struct *get_current(void) __attribute_const__;
7
8static inline struct task_struct *get_current(void)
9{
10 return current_thread_info()->task;
11}
12
13#define current (get_current())
14
15#endif /* _ASMARM_CURRENT_H */
diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h
index dc6145120de3..ab98fdd083bd 100644
--- a/arch/arm/include/asm/delay.h
+++ b/arch/arm/include/asm/delay.h
@@ -15,6 +15,11 @@
15 15
16#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
17 17
18struct delay_timer {
19 unsigned long (*read_current_timer)(void);
20 unsigned long freq;
21};
22
18extern struct arm_delay_ops { 23extern struct arm_delay_ops {
19 void (*delay)(unsigned long); 24 void (*delay)(unsigned long);
20 void (*const_udelay)(unsigned long); 25 void (*const_udelay)(unsigned long);
@@ -56,6 +61,10 @@ extern void __loop_delay(unsigned long loops);
56extern void __loop_udelay(unsigned long usecs); 61extern void __loop_udelay(unsigned long usecs);
57extern void __loop_const_udelay(unsigned long); 62extern void __loop_const_udelay(unsigned long);
58 63
64/* Delay-loop timer registration. */
65#define ARCH_HAS_READ_CURRENT_TIMER
66extern void register_current_timer_delay(const struct delay_timer *timer);
67
59#endif /* __ASSEMBLY__ */ 68#endif /* __ASSEMBLY__ */
60 69
61#endif /* defined(_ARM_DELAY_H) */ 70#endif /* defined(_ARM_DELAY_H) */
diff --git a/arch/arm/include/asm/exec.h b/arch/arm/include/asm/exec.h
deleted file mode 100644
index 7c4fbef72b3a..000000000000
--- a/arch/arm/include/asm/exec.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_ARM_EXEC_H
2#define __ASM_ARM_EXEC_H
3
4#define arch_align_stack(x) (x)
5
6#endif /* __ASM_ARM_EXEC_H */
diff --git a/arch/arm/include/asm/glue-cache.h b/arch/arm/include/asm/glue-cache.h
index 7e30874377e6..4f8d2c0dc441 100644
--- a/arch/arm/include/asm/glue-cache.h
+++ b/arch/arm/include/asm/glue-cache.h
@@ -110,19 +110,19 @@
110#endif 110#endif
111 111
112#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) 112#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
113//# ifdef _CACHE 113# ifdef _CACHE
114# define MULTI_CACHE 1 114# define MULTI_CACHE 1
115//# else 115# else
116//# define _CACHE v6 116# define _CACHE v6
117//# endif 117# endif
118#endif 118#endif
119 119
120#if defined(CONFIG_CPU_V7) 120#if defined(CONFIG_CPU_V7)
121//# ifdef _CACHE 121# ifdef _CACHE
122# define MULTI_CACHE 1 122# define MULTI_CACHE 1
123//# else 123# else
124//# define _CACHE v7 124# define _CACHE v7
125//# endif 125# endif
126#endif 126#endif
127 127
128#if !defined(_CACHE) && !defined(MULTI_CACHE) 128#if !defined(_CACHE) && !defined(MULTI_CACHE)
diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h
index 436e60b2cf7a..2740c2a2df63 100644
--- a/arch/arm/include/asm/hardirq.h
+++ b/arch/arm/include/asm/hardirq.h
@@ -5,7 +5,7 @@
5#include <linux/threads.h> 5#include <linux/threads.h>
6#include <asm/irq.h> 6#include <asm/irq.h>
7 7
8#define NR_IPI 5 8#define NR_IPI 6
9 9
10typedef struct { 10typedef struct {
11 unsigned int __softirq_pending; 11 unsigned int __softirq_pending;
diff --git a/arch/arm/include/asm/hardware/linkup-l1110.h b/arch/arm/include/asm/hardware/linkup-l1110.h
deleted file mode 100644
index 7ec91168a576..000000000000
--- a/arch/arm/include/asm/hardware/linkup-l1110.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2*
3* Definitions for H3600 Handheld Computer
4*
5* Copyright 2001 Compaq Computer Corporation.
6*
7* Use consistent with the GNU GPL is permitted,
8* provided that this copyright notice is
9* preserved in its entirety in all copies and derived works.
10*
11* COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
12* AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
13* FITNESS FOR ANY PARTICULAR PURPOSE.
14*
15* Author: Jamey Hicks.
16*
17*/
18
19/* LinkUp Systems PCCard/CompactFlash Interface for SA-1100 */
20
21/* PC Card Status Register */
22#define LINKUP_PRS_S1 (1 << 0) /* voltage control bits S1-S4 */
23#define LINKUP_PRS_S2 (1 << 1)
24#define LINKUP_PRS_S3 (1 << 2)
25#define LINKUP_PRS_S4 (1 << 3)
26#define LINKUP_PRS_BVD1 (1 << 4)
27#define LINKUP_PRS_BVD2 (1 << 5)
28#define LINKUP_PRS_VS1 (1 << 6)
29#define LINKUP_PRS_VS2 (1 << 7)
30#define LINKUP_PRS_RDY (1 << 8)
31#define LINKUP_PRS_CD1 (1 << 9)
32#define LINKUP_PRS_CD2 (1 << 10)
33
34/* PC Card Command Register */
35#define LINKUP_PRC_S1 (1 << 0)
36#define LINKUP_PRC_S2 (1 << 1)
37#define LINKUP_PRC_S3 (1 << 2)
38#define LINKUP_PRC_S4 (1 << 3)
39#define LINKUP_PRC_RESET (1 << 4)
40#define LINKUP_PRC_APOE (1 << 5) /* Auto Power Off Enable: clears S1-S4 when either nCD goes high */
41#define LINKUP_PRC_CFE (1 << 6) /* CompactFlash mode Enable: addresses A[10:0] only, A[25:11] high */
42#define LINKUP_PRC_SOE (1 << 7) /* signal output driver enable */
43#define LINKUP_PRC_SSP (1 << 8) /* sock select polarity: 0 for socket 0, 1 for socket 1 */
44#define LINKUP_PRC_MBZ (1 << 15) /* must be zero */
45
46struct linkup_l1110 {
47 volatile short prc;
48};
diff --git a/arch/arm/include/asm/hypervisor.h b/arch/arm/include/asm/hypervisor.h
new file mode 100644
index 000000000000..b90d9e523d6f
--- /dev/null
+++ b/arch/arm/include/asm/hypervisor.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_ARM_HYPERVISOR_H
2#define _ASM_ARM_HYPERVISOR_H
3
4#include <asm/xen/hypervisor.h>
5
6#endif
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 8f4db67533e5..35c1ed89b936 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -47,13 +47,68 @@ extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen);
47extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen); 47extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
48extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); 48extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
49 49
50#define __raw_writeb(v,a) ((void)(__chk_io_ptr(a), *(volatile unsigned char __force *)(a) = (v))) 50#if __LINUX_ARM_ARCH__ < 6
51#define __raw_writew(v,a) ((void)(__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v))) 51/*
52#define __raw_writel(v,a) ((void)(__chk_io_ptr(a), *(volatile unsigned int __force *)(a) = (v))) 52 * Half-word accesses are problematic with RiscPC due to limitations of
53 * the bus. Rather than special-case the machine, just let the compiler
54 * generate the access for CPUs prior to ARMv6.
55 */
56#define __raw_readw(a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a))
57#define __raw_writew(v,a) ((void)(__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v)))
58#else
59/*
60 * When running under a hypervisor, we want to avoid I/O accesses with
61 * writeback addressing modes as these incur a significant performance
62 * overhead (the address generation must be emulated in software).
63 */
64static inline void __raw_writew(u16 val, volatile void __iomem *addr)
65{
66 asm volatile("strh %1, %0"
67 : "+Qo" (*(volatile u16 __force *)addr)
68 : "r" (val));
69}
70
71static inline u16 __raw_readw(const volatile void __iomem *addr)
72{
73 u16 val;
74 asm volatile("ldrh %1, %0"
75 : "+Qo" (*(volatile u16 __force *)addr),
76 "=r" (val));
77 return val;
78}
79#endif
53 80
54#define __raw_readb(a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a)) 81static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
55#define __raw_readw(a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a)) 82{
56#define __raw_readl(a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a)) 83 asm volatile("strb %1, %0"
84 : "+Qo" (*(volatile u8 __force *)addr)
85 : "r" (val));
86}
87
88static inline void __raw_writel(u32 val, volatile void __iomem *addr)
89{
90 asm volatile("str %1, %0"
91 : "+Qo" (*(volatile u32 __force *)addr)
92 : "r" (val));
93}
94
95static inline u8 __raw_readb(const volatile void __iomem *addr)
96{
97 u8 val;
98 asm volatile("ldrb %1, %0"
99 : "+Qo" (*(volatile u8 __force *)addr),
100 "=r" (val));
101 return val;
102}
103
104static inline u32 __raw_readl(const volatile void __iomem *addr)
105{
106 u32 val;
107 asm volatile("ldr %1, %0"
108 : "+Qo" (*(volatile u32 __force *)addr),
109 "=r" (val));
110 return val;
111}
57 112
58/* 113/*
59 * Architecture ioremap implementation. 114 * Architecture ioremap implementation.
diff --git a/arch/arm/include/asm/ipcbuf.h b/arch/arm/include/asm/ipcbuf.h
deleted file mode 100644
index 84c7e51cb6d0..000000000000
--- a/arch/arm/include/asm/ipcbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipcbuf.h>
diff --git a/arch/arm/include/asm/msgbuf.h b/arch/arm/include/asm/msgbuf.h
deleted file mode 100644
index 33b35b946eaa..000000000000
--- a/arch/arm/include/asm/msgbuf.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _ASMARM_MSGBUF_H
2#define _ASMARM_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* _ASMARM_MSGBUF_H */
diff --git a/arch/arm/include/asm/mutex.h b/arch/arm/include/asm/mutex.h
index b1479fd04a95..87c044910fe0 100644
--- a/arch/arm/include/asm/mutex.h
+++ b/arch/arm/include/asm/mutex.h
@@ -9,8 +9,13 @@
9#define _ASM_MUTEX_H 9#define _ASM_MUTEX_H
10/* 10/*
11 * On pre-ARMv6 hardware this results in a swp-based implementation, 11 * On pre-ARMv6 hardware this results in a swp-based implementation,
12 * which is the most efficient. For ARMv6+, we emit a pair of exclusive 12 * which is the most efficient. For ARMv6+, we have exclusive memory
13 * accesses instead. 13 * accessors and use atomic_dec to avoid the extra xchg operations
14 * on the locking slowpaths.
14 */ 15 */
16#if __LINUX_ARM_ARCH__ < 6
15#include <asm-generic/mutex-xchg.h> 17#include <asm-generic/mutex-xchg.h>
18#else
19#include <asm-generic/mutex-dec.h>
16#endif 20#endif
21#endif /* _ASM_MUTEX_H */
diff --git a/arch/arm/include/asm/opcodes-virt.h b/arch/arm/include/asm/opcodes-virt.h
new file mode 100644
index 000000000000..b85665a96f8e
--- /dev/null
+++ b/arch/arm/include/asm/opcodes-virt.h
@@ -0,0 +1,29 @@
1/*
2 * opcodes-virt.h: Opcode definitions for the ARM virtualization extensions
3 * Copyright (C) 2012 Linaro Limited
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * 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 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#ifndef __ASM_ARM_OPCODES_VIRT_H
20#define __ASM_ARM_OPCODES_VIRT_H
21
22#include <asm/opcodes.h>
23
24#define __HVC(imm16) __inst_arm_thumb32( \
25 0xE1400070 | (((imm16) & 0xFFF0) << 4) | ((imm16) & 0x000F), \
26 0xF7E08000 | (((imm16) & 0xF000) << 4) | ((imm16) & 0x0FFF) \
27)
28
29#endif /* ! __ASM_ARM_OPCODES_VIRT_H */
diff --git a/arch/arm/include/asm/opcodes.h b/arch/arm/include/asm/opcodes.h
index 19c48deda70f..74e211a6fb24 100644
--- a/arch/arm/include/asm/opcodes.h
+++ b/arch/arm/include/asm/opcodes.h
@@ -19,6 +19,33 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr);
19 19
20 20
21/* 21/*
22 * Assembler opcode byteswap helpers.
23 * These are only intended for use by this header: don't use them directly,
24 * because they will be suboptimal in most cases.
25 */
26#define ___asm_opcode_swab32(x) ( \
27 (((x) << 24) & 0xFF000000) \
28 | (((x) << 8) & 0x00FF0000) \
29 | (((x) >> 8) & 0x0000FF00) \
30 | (((x) >> 24) & 0x000000FF) \
31)
32#define ___asm_opcode_swab16(x) ( \
33 (((x) << 8) & 0xFF00) \
34 | (((x) >> 8) & 0x00FF) \
35)
36#define ___asm_opcode_swahb32(x) ( \
37 (((x) << 8) & 0xFF00FF00) \
38 | (((x) >> 8) & 0x00FF00FF) \
39)
40#define ___asm_opcode_swahw32(x) ( \
41 (((x) << 16) & 0xFFFF0000) \
42 | (((x) >> 16) & 0x0000FFFF) \
43)
44#define ___asm_opcode_identity32(x) ((x) & 0xFFFFFFFF)
45#define ___asm_opcode_identity16(x) ((x) & 0xFFFF)
46
47
48/*
22 * Opcode byteswap helpers 49 * Opcode byteswap helpers
23 * 50 *
24 * These macros help with converting instructions between a canonical integer 51 * These macros help with converting instructions between a canonical integer
@@ -41,39 +68,163 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr);
41 * Note that values in the range 0x0000E800..0xE7FFFFFF intentionally do not 68 * Note that values in the range 0x0000E800..0xE7FFFFFF intentionally do not
42 * represent any valid Thumb-2 instruction. For this range, 69 * represent any valid Thumb-2 instruction. For this range,
43 * __opcode_is_thumb32() and __opcode_is_thumb16() will both be false. 70 * __opcode_is_thumb32() and __opcode_is_thumb16() will both be false.
71 *
72 * The ___asm variants are intended only for use by this header, in situations
73 * involving inline assembler. For .S files, the normal __opcode_*() macros
74 * should do the right thing.
44 */ 75 */
76#ifdef __ASSEMBLY__
45 77
46#ifndef __ASSEMBLY__ 78#define ___opcode_swab32(x) ___asm_opcode_swab32(x)
79#define ___opcode_swab16(x) ___asm_opcode_swab16(x)
80#define ___opcode_swahb32(x) ___asm_opcode_swahb32(x)
81#define ___opcode_swahw32(x) ___asm_opcode_swahw32(x)
82#define ___opcode_identity32(x) ___asm_opcode_identity32(x)
83#define ___opcode_identity16(x) ___asm_opcode_identity16(x)
84
85#else /* ! __ASSEMBLY__ */
47 86
48#include <linux/types.h> 87#include <linux/types.h>
49#include <linux/swab.h> 88#include <linux/swab.h>
50 89
90#define ___opcode_swab32(x) swab32(x)
91#define ___opcode_swab16(x) swab16(x)
92#define ___opcode_swahb32(x) swahb32(x)
93#define ___opcode_swahw32(x) swahw32(x)
94#define ___opcode_identity32(x) ((u32)(x))
95#define ___opcode_identity16(x) ((u16)(x))
96
97#endif /* ! __ASSEMBLY__ */
98
99
51#ifdef CONFIG_CPU_ENDIAN_BE8 100#ifdef CONFIG_CPU_ENDIAN_BE8
52#define __opcode_to_mem_arm(x) swab32(x) 101
53#define __opcode_to_mem_thumb16(x) swab16(x) 102#define __opcode_to_mem_arm(x) ___opcode_swab32(x)
54#define __opcode_to_mem_thumb32(x) swahb32(x) 103#define __opcode_to_mem_thumb16(x) ___opcode_swab16(x)
55#else 104#define __opcode_to_mem_thumb32(x) ___opcode_swahb32(x)
56#define __opcode_to_mem_arm(x) ((u32)(x)) 105#define ___asm_opcode_to_mem_arm(x) ___asm_opcode_swab32(x)
57#define __opcode_to_mem_thumb16(x) ((u16)(x)) 106#define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_swab16(x)
58#define __opcode_to_mem_thumb32(x) swahw32(x) 107#define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahb32(x)
108
109#else /* ! CONFIG_CPU_ENDIAN_BE8 */
110
111#define __opcode_to_mem_arm(x) ___opcode_identity32(x)
112#define __opcode_to_mem_thumb16(x) ___opcode_identity16(x)
113#define ___asm_opcode_to_mem_arm(x) ___asm_opcode_identity32(x)
114#define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_identity16(x)
115#ifndef CONFIG_CPU_ENDIAN_BE32
116/*
117 * On BE32 systems, using 32-bit accesses to store Thumb instructions will not
118 * work in all cases, due to alignment constraints. For now, a correct
119 * version is not provided for BE32.
120 */
121#define __opcode_to_mem_thumb32(x) ___opcode_swahw32(x)
122#define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahw32(x)
59#endif 123#endif
60 124
125#endif /* ! CONFIG_CPU_ENDIAN_BE8 */
126
61#define __mem_to_opcode_arm(x) __opcode_to_mem_arm(x) 127#define __mem_to_opcode_arm(x) __opcode_to_mem_arm(x)
62#define __mem_to_opcode_thumb16(x) __opcode_to_mem_thumb16(x) 128#define __mem_to_opcode_thumb16(x) __opcode_to_mem_thumb16(x)
129#ifndef CONFIG_CPU_ENDIAN_BE32
63#define __mem_to_opcode_thumb32(x) __opcode_to_mem_thumb32(x) 130#define __mem_to_opcode_thumb32(x) __opcode_to_mem_thumb32(x)
131#endif
64 132
65/* Operations specific to Thumb opcodes */ 133/* Operations specific to Thumb opcodes */
66 134
67/* Instruction size checks: */ 135/* Instruction size checks: */
68#define __opcode_is_thumb32(x) ((u32)(x) >= 0xE8000000UL) 136#define __opcode_is_thumb32(x) ( \
69#define __opcode_is_thumb16(x) ((u32)(x) < 0xE800UL) 137 ((x) & 0xF8000000) == 0xE8000000 \
138 || ((x) & 0xF0000000) == 0xF0000000 \
139)
140#define __opcode_is_thumb16(x) ( \
141 ((x) & 0xFFFF0000) == 0 \
142 && !(((x) & 0xF800) == 0xE800 || ((x) & 0xF000) == 0xF000) \
143)
70 144
71/* Operations to construct or split 32-bit Thumb instructions: */ 145/* Operations to construct or split 32-bit Thumb instructions: */
72#define __opcode_thumb32_first(x) ((u16)((x) >> 16)) 146#define __opcode_thumb32_first(x) (___opcode_identity16((x) >> 16))
73#define __opcode_thumb32_second(x) ((u16)(x)) 147#define __opcode_thumb32_second(x) (___opcode_identity16(x))
74#define __opcode_thumb32_compose(first, second) \ 148#define __opcode_thumb32_compose(first, second) ( \
75 (((u32)(u16)(first) << 16) | (u32)(u16)(second)) 149 (___opcode_identity32(___opcode_identity16(first)) << 16) \
150 | ___opcode_identity32(___opcode_identity16(second)) \
151)
152#define ___asm_opcode_thumb32_first(x) (___asm_opcode_identity16((x) >> 16))
153#define ___asm_opcode_thumb32_second(x) (___asm_opcode_identity16(x))
154#define ___asm_opcode_thumb32_compose(first, second) ( \
155 (___asm_opcode_identity32(___asm_opcode_identity16(first)) << 16) \
156 | ___asm_opcode_identity32(___asm_opcode_identity16(second)) \
157)
76 158
77#endif /* __ASSEMBLY__ */ 159/*
160 * Opcode injection helpers
161 *
162 * In rare cases it is necessary to assemble an opcode which the
163 * assembler does not support directly, or which would normally be
164 * rejected because of the CFLAGS or AFLAGS used to build the affected
165 * file.
166 *
167 * Before using these macros, consider carefully whether it is feasible
168 * instead to change the build flags for your file, or whether it really
169 * makes sense to support old assembler versions when building that
170 * particular kernel feature.
171 *
172 * The macros defined here should only be used where there is no viable
173 * alternative.
174 *
175 *
176 * __inst_arm(x): emit the specified ARM opcode
177 * __inst_thumb16(x): emit the specified 16-bit Thumb opcode
178 * __inst_thumb32(x): emit the specified 32-bit Thumb opcode
179 *
180 * __inst_arm_thumb16(arm, thumb): emit either the specified arm or
181 * 16-bit Thumb opcode, depending on whether an ARM or Thumb-2
182 * kernel is being built
183 *
184 * __inst_arm_thumb32(arm, thumb): emit either the specified arm or
185 * 32-bit Thumb opcode, depending on whether an ARM or Thumb-2
186 * kernel is being built
187 *
188 *
189 * Note that using these macros directly is poor practice. Instead, you
190 * should use them to define human-readable wrapper macros to encode the
191 * instructions that you care about. In code which might run on ARMv7 or
192 * above, you can usually use the __inst_arm_thumb{16,32} macros to
193 * specify the ARM and Thumb alternatives at the same time. This ensures
194 * that the correct opcode gets emitted depending on the instruction set
195 * used for the kernel build.
196 *
197 * Look at opcodes-virt.h for an example of how to use these macros.
198 */
199#include <linux/stringify.h>
200
201#define __inst_arm(x) ___inst_arm(___asm_opcode_to_mem_arm(x))
202#define __inst_thumb32(x) ___inst_thumb32( \
203 ___asm_opcode_to_mem_thumb16(___asm_opcode_thumb32_first(x)), \
204 ___asm_opcode_to_mem_thumb16(___asm_opcode_thumb32_second(x)) \
205)
206#define __inst_thumb16(x) ___inst_thumb16(___asm_opcode_to_mem_thumb16(x))
207
208#ifdef CONFIG_THUMB2_KERNEL
209#define __inst_arm_thumb16(arm_opcode, thumb_opcode) \
210 __inst_thumb16(thumb_opcode)
211#define __inst_arm_thumb32(arm_opcode, thumb_opcode) \
212 __inst_thumb32(thumb_opcode)
213#else
214#define __inst_arm_thumb16(arm_opcode, thumb_opcode) __inst_arm(arm_opcode)
215#define __inst_arm_thumb32(arm_opcode, thumb_opcode) __inst_arm(arm_opcode)
216#endif
217
218/* Helpers for the helpers. Don't use these directly. */
219#ifdef __ASSEMBLY__
220#define ___inst_arm(x) .long x
221#define ___inst_thumb16(x) .short x
222#define ___inst_thumb32(first, second) .short first, second
223#else
224#define ___inst_arm(x) ".long " __stringify(x) "\n\t"
225#define ___inst_thumb16(x) ".short " __stringify(x) "\n\t"
226#define ___inst_thumb32(first, second) \
227 ".short " __stringify(first) ", " __stringify(second) "\n\t"
228#endif
78 229
79#endif /* __ASM_ARM_OPCODES_H */ 230#endif /* __ASM_ARM_OPCODES_H */
diff --git a/arch/arm/include/asm/param.h b/arch/arm/include/asm/param.h
deleted file mode 100644
index 8b24bf94c06b..000000000000
--- a/arch/arm/include/asm/param.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * arch/arm/include/asm/param.h
3 *
4 * Copyright (C) 1995-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 */
10#ifndef __ASM_PARAM_H
11#define __ASM_PARAM_H
12
13#ifdef __KERNEL__
14# define HZ CONFIG_HZ /* Internal kernel timer frequency */
15# define USER_HZ 100 /* User interfaces are in "ticks" */
16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
17#else
18# define HZ 100
19#endif
20
21#define EXEC_PAGESIZE 4096
22
23#ifndef NOGROUP
24#define NOGROUP (-1)
25#endif
26
27/* max length of hostname */
28#define MAXHOSTNAMELEN 64
29
30#endif
31
diff --git a/arch/arm/include/asm/parport.h b/arch/arm/include/asm/parport.h
deleted file mode 100644
index 26e94b09035a..000000000000
--- a/arch/arm/include/asm/parport.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * arch/arm/include/asm/parport.h: ARM-specific parport initialisation
3 *
4 * Copyright (C) 1999, 2000 Tim Waugh <tim@cyberelk.demon.co.uk>
5 *
6 * This file should only be included by drivers/parport/parport_pc.c.
7 */
8
9#ifndef __ASMARM_PARPORT_H
10#define __ASMARM_PARPORT_H
11
12static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma);
13static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
14{
15 return parport_pc_find_isa_ports (autoirq, autodma);
16}
17
18#endif /* !(_ASMARM_PARPORT_H) */
diff --git a/arch/arm/include/asm/segment.h b/arch/arm/include/asm/segment.h
deleted file mode 100644
index 9e24c21f6304..000000000000
--- a/arch/arm/include/asm/segment.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef __ASM_ARM_SEGMENT_H
2#define __ASM_ARM_SEGMENT_H
3
4#define __KERNEL_CS 0x0
5#define __KERNEL_DS 0x0
6
7#define __USER_CS 0x1
8#define __USER_DS 0x1
9
10#endif /* __ASM_ARM_SEGMENT_H */
11
diff --git a/arch/arm/include/asm/sembuf.h b/arch/arm/include/asm/sembuf.h
deleted file mode 100644
index 1c0283954289..000000000000
--- a/arch/arm/include/asm/sembuf.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _ASMARM_SEMBUF_H
2#define _ASMARM_SEMBUF_H
3
4/*
5 * The semid64_ds structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* _ASMARM_SEMBUF_H */
diff --git a/arch/arm/include/asm/serial.h b/arch/arm/include/asm/serial.h
deleted file mode 100644
index ebb049091e26..000000000000
--- a/arch/arm/include/asm/serial.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/include/asm/serial.h
3 *
4 * Copyright (C) 1996 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 * Changelog:
11 * 15-10-1996 RMK Created
12 */
13
14#ifndef __ASM_SERIAL_H
15#define __ASM_SERIAL_H
16
17#define BASE_BAUD (1843200 / 16)
18
19#endif
diff --git a/arch/arm/include/asm/shmbuf.h b/arch/arm/include/asm/shmbuf.h
deleted file mode 100644
index 2e5c67ba1c97..000000000000
--- a/arch/arm/include/asm/shmbuf.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _ASMARM_SHMBUF_H
2#define _ASMARM_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* _ASMARM_SHMBUF_H */
diff --git a/arch/arm/include/asm/socket.h b/arch/arm/include/asm/socket.h
deleted file mode 100644
index 6433cadb6ed4..000000000000
--- a/arch/arm/include/asm/socket.h
+++ /dev/null
@@ -1,72 +0,0 @@
1#ifndef _ASMARM_SOCKET_H
2#define _ASMARM_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43
44#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29
46#define SCM_TIMESTAMP SO_TIMESTAMP
47
48#define SO_ACCEPTCONN 30
49
50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54
55#define SO_MARK 36
56
57#define SO_TIMESTAMPING 37
58#define SCM_TIMESTAMPING SO_TIMESTAMPING
59
60#define SO_PROTOCOL 38
61#define SO_DOMAIN 39
62
63#define SO_RXQ_OVFL 40
64
65#define SO_WIFI_STATUS 41
66#define SCM_WIFI_STATUS SO_WIFI_STATUS
67#define SO_PEEK_OFF 42
68
69/* Instruct lower device to use last 4-bytes of skb data as FCS */
70#define SO_NOFCS 43
71
72#endif /* _ASM_SOCKET_H */
diff --git a/arch/arm/include/asm/sockios.h b/arch/arm/include/asm/sockios.h
deleted file mode 100644
index a2588a2512df..000000000000
--- a/arch/arm/include/asm/sockios.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ARCH_ARM_SOCKIOS_H
2#define __ARCH_ARM_SOCKIOS_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif
diff --git a/arch/arm/include/asm/sync_bitops.h b/arch/arm/include/asm/sync_bitops.h
new file mode 100644
index 000000000000..63479eecbf76
--- /dev/null
+++ b/arch/arm/include/asm/sync_bitops.h
@@ -0,0 +1,27 @@
1#ifndef __ASM_SYNC_BITOPS_H__
2#define __ASM_SYNC_BITOPS_H__
3
4#include <asm/bitops.h>
5#include <asm/system.h>
6
7/* sync_bitops functions are equivalent to the SMP implementation of the
8 * original functions, independently from CONFIG_SMP being defined.
9 *
10 * We need them because _set_bit etc are not SMP safe if !CONFIG_SMP. But
11 * under Xen you might be communicating with a completely external entity
12 * who might be on another CPU (e.g. two uniprocessor guests communicating
13 * via event channels and grant tables). So we need a variant of the bit
14 * ops which are SMP safe even on a UP kernel.
15 */
16
17#define sync_set_bit(nr, p) _set_bit(nr, p)
18#define sync_clear_bit(nr, p) _clear_bit(nr, p)
19#define sync_change_bit(nr, p) _change_bit(nr, p)
20#define sync_test_and_set_bit(nr, p) _test_and_set_bit(nr, p)
21#define sync_test_and_clear_bit(nr, p) _test_and_clear_bit(nr, p)
22#define sync_test_and_change_bit(nr, p) _test_and_change_bit(nr, p)
23#define sync_test_bit(nr, addr) test_bit(nr, addr)
24#define sync_cmpxchg cmpxchg
25
26
27#endif
diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
index c334a23ddf75..9fdded6b1089 100644
--- a/arch/arm/include/asm/syscall.h
+++ b/arch/arm/include/asm/syscall.h
@@ -8,6 +8,11 @@
8#define _ASM_ARM_SYSCALL_H 8#define _ASM_ARM_SYSCALL_H
9 9
10#include <linux/err.h> 10#include <linux/err.h>
11#include <linux/sched.h>
12
13#include <asm/unistd.h>
14
15#define NR_syscalls (__NR_syscalls)
11 16
12extern const unsigned long sys_call_table[]; 17extern const unsigned long sys_call_table[];
13 18
diff --git a/arch/arm/include/asm/termbits.h b/arch/arm/include/asm/termbits.h
deleted file mode 100644
index 704135d28d1d..000000000000
--- a/arch/arm/include/asm/termbits.h
+++ /dev/null
@@ -1,198 +0,0 @@
1#ifndef __ASM_ARM_TERMBITS_H
2#define __ASM_ARM_TERMBITS_H
3
4typedef unsigned char cc_t;
5typedef unsigned int speed_t;
6typedef unsigned int tcflag_t;
7
8#define NCCS 19
9struct termios {
10 tcflag_t c_iflag; /* input mode flags */
11 tcflag_t c_oflag; /* output mode flags */
12 tcflag_t c_cflag; /* control mode flags */
13 tcflag_t c_lflag; /* local mode flags */
14 cc_t c_line; /* line discipline */
15 cc_t c_cc[NCCS]; /* control characters */
16};
17
18struct termios2 {
19 tcflag_t c_iflag; /* input mode flags */
20 tcflag_t c_oflag; /* output mode flags */
21 tcflag_t c_cflag; /* control mode flags */
22 tcflag_t c_lflag; /* local mode flags */
23 cc_t c_line; /* line discipline */
24 cc_t c_cc[NCCS]; /* control characters */
25 speed_t c_ispeed; /* input speed */
26 speed_t c_ospeed; /* output speed */
27};
28
29struct ktermios {
30 tcflag_t c_iflag; /* input mode flags */
31 tcflag_t c_oflag; /* output mode flags */
32 tcflag_t c_cflag; /* control mode flags */
33 tcflag_t c_lflag; /* local mode flags */
34 cc_t c_line; /* line discipline */
35 cc_t c_cc[NCCS]; /* control characters */
36 speed_t c_ispeed; /* input speed */
37 speed_t c_ospeed; /* output speed */
38};
39
40
41/* c_cc characters */
42#define VINTR 0
43#define VQUIT 1
44#define VERASE 2
45#define VKILL 3
46#define VEOF 4
47#define VTIME 5
48#define VMIN 6
49#define VSWTC 7
50#define VSTART 8
51#define VSTOP 9
52#define VSUSP 10
53#define VEOL 11
54#define VREPRINT 12
55#define VDISCARD 13
56#define VWERASE 14
57#define VLNEXT 15
58#define VEOL2 16
59
60/* c_iflag bits */
61#define IGNBRK 0000001
62#define BRKINT 0000002
63#define IGNPAR 0000004
64#define PARMRK 0000010
65#define INPCK 0000020
66#define ISTRIP 0000040
67#define INLCR 0000100
68#define IGNCR 0000200
69#define ICRNL 0000400
70#define IUCLC 0001000
71#define IXON 0002000
72#define IXANY 0004000
73#define IXOFF 0010000
74#define IMAXBEL 0020000
75#define IUTF8 0040000
76
77/* c_oflag bits */
78#define OPOST 0000001
79#define OLCUC 0000002
80#define ONLCR 0000004
81#define OCRNL 0000010
82#define ONOCR 0000020
83#define ONLRET 0000040
84#define OFILL 0000100
85#define OFDEL 0000200
86#define NLDLY 0000400
87#define NL0 0000000
88#define NL1 0000400
89#define CRDLY 0003000
90#define CR0 0000000
91#define CR1 0001000
92#define CR2 0002000
93#define CR3 0003000
94#define TABDLY 0014000
95#define TAB0 0000000
96#define TAB1 0004000
97#define TAB2 0010000
98#define TAB3 0014000
99#define XTABS 0014000
100#define BSDLY 0020000
101#define BS0 0000000
102#define BS1 0020000
103#define VTDLY 0040000
104#define VT0 0000000
105#define VT1 0040000
106#define FFDLY 0100000
107#define FF0 0000000
108#define FF1 0100000
109
110/* c_cflag bit meaning */
111#define CBAUD 0010017
112#define B0 0000000 /* hang up */
113#define B50 0000001
114#define B75 0000002
115#define B110 0000003
116#define B134 0000004
117#define B150 0000005
118#define B200 0000006
119#define B300 0000007
120#define B600 0000010
121#define B1200 0000011
122#define B1800 0000012
123#define B2400 0000013
124#define B4800 0000014
125#define B9600 0000015
126#define B19200 0000016
127#define B38400 0000017
128#define EXTA B19200
129#define EXTB B38400
130#define CSIZE 0000060
131#define CS5 0000000
132#define CS6 0000020
133#define CS7 0000040
134#define CS8 0000060
135#define CSTOPB 0000100
136#define CREAD 0000200
137#define PARENB 0000400
138#define PARODD 0001000
139#define HUPCL 0002000
140#define CLOCAL 0004000
141#define CBAUDEX 0010000
142#define BOTHER 0010000
143#define B57600 0010001
144#define B115200 0010002
145#define B230400 0010003
146#define B460800 0010004
147#define B500000 0010005
148#define B576000 0010006
149#define B921600 0010007
150#define B1000000 0010010
151#define B1152000 0010011
152#define B1500000 0010012
153#define B2000000 0010013
154#define B2500000 0010014
155#define B3000000 0010015
156#define B3500000 0010016
157#define B4000000 0010017
158#define CIBAUD 002003600000 /* input baud rate */
159#define CMSPAR 010000000000 /* mark or space (stick) parity */
160#define CRTSCTS 020000000000 /* flow control */
161
162#define IBSHIFT 16
163
164/* c_lflag bits */
165#define ISIG 0000001
166#define ICANON 0000002
167#define XCASE 0000004
168#define ECHO 0000010
169#define ECHOE 0000020
170#define ECHOK 0000040
171#define ECHONL 0000100
172#define NOFLSH 0000200
173#define TOSTOP 0000400
174#define ECHOCTL 0001000
175#define ECHOPRT 0002000
176#define ECHOKE 0004000
177#define FLUSHO 0010000
178#define PENDIN 0040000
179#define IEXTEN 0100000
180#define EXTPROC 0200000
181
182/* tcflow() and TCXONC use these */
183#define TCOOFF 0
184#define TCOON 1
185#define TCIOFF 2
186#define TCION 3
187
188/* tcflush() and TCFLSH use these */
189#define TCIFLUSH 0
190#define TCOFLUSH 1
191#define TCIOFLUSH 2
192
193/* tcsetattr uses these */
194#define TCSANOW 0
195#define TCSADRAIN 1
196#define TCSAFLUSH 2
197
198#endif /* __ASM_ARM_TERMBITS_H */
diff --git a/arch/arm/include/asm/termios.h b/arch/arm/include/asm/termios.h
deleted file mode 100644
index 293e3f1bc3f2..000000000000
--- a/arch/arm/include/asm/termios.h
+++ /dev/null
@@ -1,92 +0,0 @@
1#ifndef __ASM_ARM_TERMIOS_H
2#define __ASM_ARM_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24#ifdef __KERNEL__
25/* intr=^C quit=^| erase=del kill=^U
26 eof=^D vtime=\0 vmin=\1 sxtc=\0
27 start=^Q stop=^S susp=^Z eol=\0
28 reprint=^R discard=^U werase=^W lnext=^V
29 eol2=\0
30*/
31#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
32#endif
33
34/* modem lines */
35#define TIOCM_LE 0x001
36#define TIOCM_DTR 0x002
37#define TIOCM_RTS 0x004
38#define TIOCM_ST 0x008
39#define TIOCM_SR 0x010
40#define TIOCM_CTS 0x020
41#define TIOCM_CAR 0x040
42#define TIOCM_RNG 0x080
43#define TIOCM_DSR 0x100
44#define TIOCM_CD TIOCM_CAR
45#define TIOCM_RI TIOCM_RNG
46#define TIOCM_OUT1 0x2000
47#define TIOCM_OUT2 0x4000
48#define TIOCM_LOOP 0x8000
49
50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
51
52#ifdef __KERNEL__
53
54/*
55 * Translate a "termio" structure into a "termios". Ugh.
56 */
57#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
58 unsigned short __tmp; \
59 get_user(__tmp,&(termio)->x); \
60 *(unsigned short *) &(termios)->x = __tmp; \
61}
62
63#define user_termio_to_kernel_termios(termios, termio) \
64({ \
65 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
66 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
67 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
68 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
69 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
70})
71
72/*
73 * Translate a "termios" structure into a "termio". Ugh.
74 */
75#define kernel_termios_to_user_termio(termio, termios) \
76({ \
77 put_user((termios)->c_iflag, &(termio)->c_iflag); \
78 put_user((termios)->c_oflag, &(termio)->c_oflag); \
79 put_user((termios)->c_cflag, &(termio)->c_cflag); \
80 put_user((termios)->c_lflag, &(termio)->c_lflag); \
81 put_user((termios)->c_line, &(termio)->c_line); \
82 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
83})
84
85#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
86#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
87#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
88#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
89
90#endif /* __KERNEL__ */
91
92#endif /* __ASM_ARM_TERMIOS_H */
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index af7b0bda3355..f71cdab18b87 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -59,7 +59,9 @@ struct thread_info {
59 __u32 syscall; /* syscall number */ 59 __u32 syscall; /* syscall number */
60 __u8 used_cp[16]; /* thread used copro */ 60 __u8 used_cp[16]; /* thread used copro */
61 unsigned long tp_value; 61 unsigned long tp_value;
62#ifdef CONFIG_CRUNCH
62 struct crunch_state crunchstate; 63 struct crunch_state crunchstate;
64#endif
63 union fp_state fpstate __attribute__((aligned(8))); 65 union fp_state fpstate __attribute__((aligned(8)));
64 union vfp_state vfpstate; 66 union vfp_state vfpstate;
65#ifdef CONFIG_ARM_THUMBEE 67#ifdef CONFIG_ARM_THUMBEE
@@ -148,6 +150,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
148#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ 150#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
149#define TIF_SYSCALL_TRACE 8 151#define TIF_SYSCALL_TRACE 8
150#define TIF_SYSCALL_AUDIT 9 152#define TIF_SYSCALL_AUDIT 9
153#define TIF_SYSCALL_TRACEPOINT 10
151#define TIF_POLLING_NRFLAG 16 154#define TIF_POLLING_NRFLAG 16
152#define TIF_USING_IWMMXT 17 155#define TIF_USING_IWMMXT 17
153#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 156#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
@@ -160,12 +163,13 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
160#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 163#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
161#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 164#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
162#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 165#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
166#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
163#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 167#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
164#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) 168#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
165#define _TIF_SECCOMP (1 << TIF_SECCOMP) 169#define _TIF_SECCOMP (1 << TIF_SECCOMP)
166 170
167/* Checks for any syscall work in entry-common.S */ 171/* Checks for any syscall work in entry-common.S */
168#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT) 172#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT)
169 173
170/* 174/*
171 * Change these and you break ASM code in entry-common.S 175 * Change these and you break ASM code in entry-common.S
diff --git a/arch/arm/include/asm/timex.h b/arch/arm/include/asm/timex.h
index 963342acebb7..83f2aa83899c 100644
--- a/arch/arm/include/asm/timex.h
+++ b/arch/arm/include/asm/timex.h
@@ -12,7 +12,6 @@
12#ifndef _ASMARM_TIMEX_H 12#ifndef _ASMARM_TIMEX_H
13#define _ASMARM_TIMEX_H 13#define _ASMARM_TIMEX_H
14 14
15#include <asm/arch_timer.h>
16#ifdef CONFIG_ARCH_MULTIPLATFORM 15#ifdef CONFIG_ARCH_MULTIPLATFORM
17#define CLOCK_TICK_RATE 1000000 16#define CLOCK_TICK_RATE 1000000
18#else 17#else
@@ -20,11 +19,6 @@
20#endif 19#endif
21 20
22typedef unsigned long cycles_t; 21typedef unsigned long cycles_t;
23
24#ifdef ARCH_HAS_READ_CURRENT_TIMER
25#define get_cycles() ({ cycles_t c; read_current_timer(&c) ? 0 : c; }) 22#define get_cycles() ({ cycles_t c; read_current_timer(&c) ? 0 : c; })
26#else
27#define get_cycles() (0)
28#endif
29 23
30#endif 24#endif
diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
deleted file mode 100644
index 28beab917ffc..000000000000
--- a/arch/arm/include/asm/types.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __ASM_ARM_TYPES_H
2#define __ASM_ARM_TYPES_H
3
4#include <asm-generic/int-ll64.h>
5
6/*
7 * These aren't exported outside the kernel to avoid name space clashes
8 */
9#ifdef __KERNEL__
10
11#define BITS_PER_LONG 32
12
13#endif /* __KERNEL__ */
14
15#endif
16
diff --git a/arch/arm/include/asm/unaligned.h b/arch/arm/include/asm/unaligned.h
deleted file mode 100644
index 44593a894903..000000000000
--- a/arch/arm/include/asm/unaligned.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _ASM_ARM_UNALIGNED_H
2#define _ASM_ARM_UNALIGNED_H
3
4#include <linux/unaligned/le_byteshift.h>
5#include <linux/unaligned/be_byteshift.h>
6#include <linux/unaligned/generic.h>
7
8/*
9 * Select endianness
10 */
11#ifndef __ARMEB__
12#define get_unaligned __get_unaligned_le
13#define put_unaligned __put_unaligned_le
14#else
15#define get_unaligned __get_unaligned_be
16#define put_unaligned __put_unaligned_be
17#endif
18
19#endif /* _ASM_ARM_UNALIGNED_H */
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 2fde5fd1acce..d9ff5cc3a506 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -407,6 +407,14 @@
407 /* 378 for kcmp */ 407 /* 378 for kcmp */
408 408
409/* 409/*
410 * This may need to be greater than __NR_last_syscall+1 in order to
411 * account for the padding in the syscall table
412 */
413#ifdef __KERNEL__
414#define __NR_syscalls (380)
415#endif /* __KERNEL__ */
416
417/*
410 * The following SWIs are ARM private. 418 * The following SWIs are ARM private.
411 */ 419 */
412#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000) 420#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000)
diff --git a/arch/arm/include/asm/xen/events.h b/arch/arm/include/asm/xen/events.h
new file mode 100644
index 000000000000..94b4e9020b02
--- /dev/null
+++ b/arch/arm/include/asm/xen/events.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_ARM_XEN_EVENTS_H
2#define _ASM_ARM_XEN_EVENTS_H
3
4#include <asm/ptrace.h>
5
6enum ipi_vector {
7 XEN_PLACEHOLDER_VECTOR,
8
9 /* Xen IPIs go here */
10 XEN_NR_IPIS,
11};
12
13static inline int xen_irqs_disabled(struct pt_regs *regs)
14{
15 return raw_irqs_disabled_flags(regs->ARM_cpsr);
16}
17
18#endif /* _ASM_ARM_XEN_EVENTS_H */
diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h
new file mode 100644
index 000000000000..8a823253d775
--- /dev/null
+++ b/arch/arm/include/asm/xen/hypercall.h
@@ -0,0 +1,69 @@
1/******************************************************************************
2 * hypercall.h
3 *
4 * Linux-specific hypervisor handling.
5 *
6 * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef _ASM_ARM_XEN_HYPERCALL_H
34#define _ASM_ARM_XEN_HYPERCALL_H
35
36#include <xen/interface/xen.h>
37
38long privcmd_call(unsigned call, unsigned long a1,
39 unsigned long a2, unsigned long a3,
40 unsigned long a4, unsigned long a5);
41int HYPERVISOR_xen_version(int cmd, void *arg);
42int HYPERVISOR_console_io(int cmd, int count, char *str);
43int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
44int HYPERVISOR_sched_op(int cmd, void *arg);
45int HYPERVISOR_event_channel_op(int cmd, void *arg);
46unsigned long HYPERVISOR_hvm_op(int op, void *arg);
47int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
48int HYPERVISOR_physdev_op(int cmd, void *arg);
49
50static inline void
51MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
52 unsigned int new_val, unsigned long flags)
53{
54 BUG();
55}
56
57static inline void
58MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
59 int count, int *success_count, domid_t domid)
60{
61 BUG();
62}
63
64static inline int
65HYPERVISOR_multicall(void *call_list, int nr_calls)
66{
67 BUG();
68}
69#endif /* _ASM_ARM_XEN_HYPERCALL_H */
diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h
new file mode 100644
index 000000000000..d7ab99a0c9eb
--- /dev/null
+++ b/arch/arm/include/asm/xen/hypervisor.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_ARM_XEN_HYPERVISOR_H
2#define _ASM_ARM_XEN_HYPERVISOR_H
3
4extern struct shared_info *HYPERVISOR_shared_info;
5extern struct start_info *xen_start_info;
6
7/* Lazy mode for batching updates / context switch */
8enum paravirt_lazy_mode {
9 PARAVIRT_LAZY_NONE,
10 PARAVIRT_LAZY_MMU,
11 PARAVIRT_LAZY_CPU,
12};
13
14static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
15{
16 return PARAVIRT_LAZY_NONE;
17}
18
19#endif /* _ASM_ARM_XEN_HYPERVISOR_H */
diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h
new file mode 100644
index 000000000000..ae05e56dd17d
--- /dev/null
+++ b/arch/arm/include/asm/xen/interface.h
@@ -0,0 +1,73 @@
1/******************************************************************************
2 * Guest OS interface to ARM Xen.
3 *
4 * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
5 */
6
7#ifndef _ASM_ARM_XEN_INTERFACE_H
8#define _ASM_ARM_XEN_INTERFACE_H
9
10#include <linux/types.h>
11
12#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
13
14#define __DEFINE_GUEST_HANDLE(name, type) \
15 typedef struct { union { type *p; uint64_aligned_t q; }; } \
16 __guest_handle_ ## name
17
18#define DEFINE_GUEST_HANDLE_STRUCT(name) \
19 __DEFINE_GUEST_HANDLE(name, struct name)
20#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
21#define GUEST_HANDLE(name) __guest_handle_ ## name
22
23#define set_xen_guest_handle(hnd, val) \
24 do { \
25 if (sizeof(hnd) == 8) \
26 *(uint64_t *)&(hnd) = 0; \
27 (hnd).p = val; \
28 } while (0)
29
30#ifndef __ASSEMBLY__
31/* Explicitly size integers that represent pfns in the interface with
32 * Xen so that we can have one ABI that works for 32 and 64 bit guests. */
33typedef uint64_t xen_pfn_t;
34typedef uint64_t xen_ulong_t;
35/* Guest handles for primitive C types. */
36__DEFINE_GUEST_HANDLE(uchar, unsigned char);
37__DEFINE_GUEST_HANDLE(uint, unsigned int);
38__DEFINE_GUEST_HANDLE(ulong, unsigned long);
39DEFINE_GUEST_HANDLE(char);
40DEFINE_GUEST_HANDLE(int);
41DEFINE_GUEST_HANDLE(long);
42DEFINE_GUEST_HANDLE(void);
43DEFINE_GUEST_HANDLE(uint64_t);
44DEFINE_GUEST_HANDLE(uint32_t);
45DEFINE_GUEST_HANDLE(xen_pfn_t);
46
47/* Maximum number of virtual CPUs in multi-processor guests. */
48#define MAX_VIRT_CPUS 1
49
50struct arch_vcpu_info { };
51struct arch_shared_info { };
52
53/* TODO: Move pvclock definitions some place arch independent */
54struct pvclock_vcpu_time_info {
55 u32 version;
56 u32 pad0;
57 u64 tsc_timestamp;
58 u64 system_time;
59 u32 tsc_to_system_mul;
60 s8 tsc_shift;
61 u8 flags;
62 u8 pad[2];
63} __attribute__((__packed__)); /* 32 bytes */
64
65/* It is OK to have a 12 bytes struct with no padding because it is packed */
66struct pvclock_wall_clock {
67 u32 version;
68 u32 sec;
69 u32 nsec;
70} __attribute__((__packed__));
71#endif
72
73#endif /* _ASM_ARM_XEN_INTERFACE_H */
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
new file mode 100644
index 000000000000..174202318dff
--- /dev/null
+++ b/arch/arm/include/asm/xen/page.h
@@ -0,0 +1,82 @@
1#ifndef _ASM_ARM_XEN_PAGE_H
2#define _ASM_ARM_XEN_PAGE_H
3
4#include <asm/page.h>
5#include <asm/pgtable.h>
6
7#include <linux/pfn.h>
8#include <linux/types.h>
9
10#include <xen/interface/grant_table.h>
11
12#define pfn_to_mfn(pfn) (pfn)
13#define phys_to_machine_mapping_valid (1)
14#define mfn_to_pfn(mfn) (mfn)
15#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
16
17#define pte_mfn pte_pfn
18#define mfn_pte pfn_pte
19
20/* Xen machine address */
21typedef struct xmaddr {
22 phys_addr_t maddr;
23} xmaddr_t;
24
25/* Xen pseudo-physical address */
26typedef struct xpaddr {
27 phys_addr_t paddr;
28} xpaddr_t;
29
30#define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
31#define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
32
33static inline xmaddr_t phys_to_machine(xpaddr_t phys)
34{
35 unsigned offset = phys.paddr & ~PAGE_MASK;
36 return XMADDR(PFN_PHYS(pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset);
37}
38
39static inline xpaddr_t machine_to_phys(xmaddr_t machine)
40{
41 unsigned offset = machine.maddr & ~PAGE_MASK;
42 return XPADDR(PFN_PHYS(mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset);
43}
44/* VIRT <-> MACHINE conversion */
45#define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v))))
46#define virt_to_pfn(v) (PFN_DOWN(__pa(v)))
47#define virt_to_mfn(v) (pfn_to_mfn(virt_to_pfn(v)))
48#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
49
50static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr)
51{
52 /* TODO: assuming it is mapped in the kernel 1:1 */
53 return virt_to_machine(vaddr);
54}
55
56/* TODO: this shouldn't be here but it is because the frontend drivers
57 * are using it (its rolled in headers) even though we won't hit the code path.
58 * So for right now just punt with this.
59 */
60static inline pte_t *lookup_address(unsigned long address, unsigned int *level)
61{
62 BUG();
63 return NULL;
64}
65
66static inline int m2p_add_override(unsigned long mfn, struct page *page,
67 struct gnttab_map_grant_ref *kmap_op)
68{
69 return 0;
70}
71
72static inline int m2p_remove_override(struct page *page, bool clear_pte)
73{
74 return 0;
75}
76
77static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
78{
79 BUG();
80 return false;
81}
82#endif /* _ASM_ARM_XEN_PAGE_H */
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index d81f3a6d9ad8..5dfef9d97ed9 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -19,7 +19,9 @@ obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \
19 process.o ptrace.o return_address.o sched_clock.o \ 19 process.o ptrace.o return_address.o sched_clock.o \
20 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o 20 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o
21 21
22obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o 22obj-$(CONFIG_ATAGS) += atags_parse.o
23obj-$(CONFIG_ATAGS_PROC) += atags_proc.o
24obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o
23 25
24obj-$(CONFIG_OC_ETM) += etm.o 26obj-$(CONFIG_OC_ETM) += etm.o
25obj-$(CONFIG_CPU_IDLE) += cpuidle.o 27obj-$(CONFIG_CPU_IDLE) += cpuidle.o
@@ -51,7 +53,6 @@ test-kprobes-objs += kprobes-test-thumb.o
51else 53else
52test-kprobes-objs += kprobes-test-arm.o 54test-kprobes-objs += kprobes-test-arm.o
53endif 55endif
54obj-$(CONFIG_ATAGS_PROC) += atags.o
55obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o 56obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
56obj-$(CONFIG_ARM_THUMBEE) += thumbee.o 57obj-$(CONFIG_ARM_THUMBEE) += thumbee.o
57obj-$(CONFIG_KGDB) += kgdb.o 58obj-$(CONFIG_KGDB) += kgdb.o
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index cf258807160d..c8ef20747ee7 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -21,18 +21,28 @@
21#include <linux/io.h> 21#include <linux/io.h>
22 22
23#include <asm/cputype.h> 23#include <asm/cputype.h>
24#include <asm/delay.h>
24#include <asm/localtimer.h> 25#include <asm/localtimer.h>
25#include <asm/arch_timer.h> 26#include <asm/arch_timer.h>
26#include <asm/system_info.h> 27#include <asm/system_info.h>
27#include <asm/sched_clock.h> 28#include <asm/sched_clock.h>
28 29
29static unsigned long arch_timer_rate; 30static unsigned long arch_timer_rate;
30static int arch_timer_ppi; 31
31static int arch_timer_ppi2; 32enum ppi_nr {
33 PHYS_SECURE_PPI,
34 PHYS_NONSECURE_PPI,
35 VIRT_PPI,
36 HYP_PPI,
37 MAX_TIMER_PPI
38};
39
40static int arch_timer_ppi[MAX_TIMER_PPI];
32 41
33static struct clock_event_device __percpu **arch_timer_evt; 42static struct clock_event_device __percpu **arch_timer_evt;
43static struct delay_timer arch_delay_timer;
34 44
35extern void init_current_timer_delay(unsigned long freq); 45static bool arch_timer_use_virtual = true;
36 46
37/* 47/*
38 * Architected system timer support. 48 * Architected system timer support.
@@ -46,50 +56,104 @@ extern void init_current_timer_delay(unsigned long freq);
46#define ARCH_TIMER_REG_FREQ 1 56#define ARCH_TIMER_REG_FREQ 1
47#define ARCH_TIMER_REG_TVAL 2 57#define ARCH_TIMER_REG_TVAL 2
48 58
49static void arch_timer_reg_write(int reg, u32 val) 59#define ARCH_TIMER_PHYS_ACCESS 0
60#define ARCH_TIMER_VIRT_ACCESS 1
61
62/*
63 * These register accessors are marked inline so the compiler can
64 * nicely work out which register we want, and chuck away the rest of
65 * the code. At least it does so with a recent GCC (4.6.3).
66 */
67static inline void arch_timer_reg_write(const int access, const int reg, u32 val)
50{ 68{
51 switch (reg) { 69 if (access == ARCH_TIMER_PHYS_ACCESS) {
52 case ARCH_TIMER_REG_CTRL: 70 switch (reg) {
53 asm volatile("mcr p15, 0, %0, c14, c2, 1" : : "r" (val)); 71 case ARCH_TIMER_REG_CTRL:
54 break; 72 asm volatile("mcr p15, 0, %0, c14, c2, 1" : : "r" (val));
55 case ARCH_TIMER_REG_TVAL: 73 break;
56 asm volatile("mcr p15, 0, %0, c14, c2, 0" : : "r" (val)); 74 case ARCH_TIMER_REG_TVAL:
57 break; 75 asm volatile("mcr p15, 0, %0, c14, c2, 0" : : "r" (val));
76 break;
77 }
78 }
79
80 if (access == ARCH_TIMER_VIRT_ACCESS) {
81 switch (reg) {
82 case ARCH_TIMER_REG_CTRL:
83 asm volatile("mcr p15, 0, %0, c14, c3, 1" : : "r" (val));
84 break;
85 case ARCH_TIMER_REG_TVAL:
86 asm volatile("mcr p15, 0, %0, c14, c3, 0" : : "r" (val));
87 break;
88 }
58 } 89 }
59 90
60 isb(); 91 isb();
61} 92}
62 93
63static u32 arch_timer_reg_read(int reg) 94static inline u32 arch_timer_reg_read(const int access, const int reg)
64{ 95{
65 u32 val; 96 u32 val = 0;
97
98 if (access == ARCH_TIMER_PHYS_ACCESS) {
99 switch (reg) {
100 case ARCH_TIMER_REG_CTRL:
101 asm volatile("mrc p15, 0, %0, c14, c2, 1" : "=r" (val));
102 break;
103 case ARCH_TIMER_REG_TVAL:
104 asm volatile("mrc p15, 0, %0, c14, c2, 0" : "=r" (val));
105 break;
106 case ARCH_TIMER_REG_FREQ:
107 asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (val));
108 break;
109 }
110 }
66 111
67 switch (reg) { 112 if (access == ARCH_TIMER_VIRT_ACCESS) {
68 case ARCH_TIMER_REG_CTRL: 113 switch (reg) {
69 asm volatile("mrc p15, 0, %0, c14, c2, 1" : "=r" (val)); 114 case ARCH_TIMER_REG_CTRL:
70 break; 115 asm volatile("mrc p15, 0, %0, c14, c3, 1" : "=r" (val));
71 case ARCH_TIMER_REG_FREQ: 116 break;
72 asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (val)); 117 case ARCH_TIMER_REG_TVAL:
73 break; 118 asm volatile("mrc p15, 0, %0, c14, c3, 0" : "=r" (val));
74 case ARCH_TIMER_REG_TVAL: 119 break;
75 asm volatile("mrc p15, 0, %0, c14, c2, 0" : "=r" (val)); 120 }
76 break;
77 default:
78 BUG();
79 } 121 }
80 122
81 return val; 123 return val;
82} 124}
83 125
84static irqreturn_t arch_timer_handler(int irq, void *dev_id) 126static inline cycle_t arch_timer_counter_read(const int access)
85{ 127{
86 struct clock_event_device *evt = *(struct clock_event_device **)dev_id; 128 cycle_t cval = 0;
87 unsigned long ctrl; 129
130 if (access == ARCH_TIMER_PHYS_ACCESS)
131 asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (cval));
132
133 if (access == ARCH_TIMER_VIRT_ACCESS)
134 asm volatile("mrrc p15, 1, %Q0, %R0, c14" : "=r" (cval));
135
136 return cval;
137}
138
139static inline cycle_t arch_counter_get_cntpct(void)
140{
141 return arch_timer_counter_read(ARCH_TIMER_PHYS_ACCESS);
142}
88 143
89 ctrl = arch_timer_reg_read(ARCH_TIMER_REG_CTRL); 144static inline cycle_t arch_counter_get_cntvct(void)
145{
146 return arch_timer_counter_read(ARCH_TIMER_VIRT_ACCESS);
147}
148
149static irqreturn_t inline timer_handler(const int access,
150 struct clock_event_device *evt)
151{
152 unsigned long ctrl;
153 ctrl = arch_timer_reg_read(access, ARCH_TIMER_REG_CTRL);
90 if (ctrl & ARCH_TIMER_CTRL_IT_STAT) { 154 if (ctrl & ARCH_TIMER_CTRL_IT_STAT) {
91 ctrl |= ARCH_TIMER_CTRL_IT_MASK; 155 ctrl |= ARCH_TIMER_CTRL_IT_MASK;
92 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl); 156 arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl);
93 evt->event_handler(evt); 157 evt->event_handler(evt);
94 return IRQ_HANDLED; 158 return IRQ_HANDLED;
95 } 159 }
@@ -97,63 +161,100 @@ static irqreturn_t arch_timer_handler(int irq, void *dev_id)
97 return IRQ_NONE; 161 return IRQ_NONE;
98} 162}
99 163
100static void arch_timer_disable(void) 164static irqreturn_t arch_timer_handler_virt(int irq, void *dev_id)
101{ 165{
102 unsigned long ctrl; 166 struct clock_event_device *evt = *(struct clock_event_device **)dev_id;
103 167
104 ctrl = arch_timer_reg_read(ARCH_TIMER_REG_CTRL); 168 return timer_handler(ARCH_TIMER_VIRT_ACCESS, evt);
105 ctrl &= ~ARCH_TIMER_CTRL_ENABLE;
106 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl);
107} 169}
108 170
109static void arch_timer_set_mode(enum clock_event_mode mode, 171static irqreturn_t arch_timer_handler_phys(int irq, void *dev_id)
110 struct clock_event_device *clk)
111{ 172{
173 struct clock_event_device *evt = *(struct clock_event_device **)dev_id;
174
175 return timer_handler(ARCH_TIMER_PHYS_ACCESS, evt);
176}
177
178static inline void timer_set_mode(const int access, int mode)
179{
180 unsigned long ctrl;
112 switch (mode) { 181 switch (mode) {
113 case CLOCK_EVT_MODE_UNUSED: 182 case CLOCK_EVT_MODE_UNUSED:
114 case CLOCK_EVT_MODE_SHUTDOWN: 183 case CLOCK_EVT_MODE_SHUTDOWN:
115 arch_timer_disable(); 184 ctrl = arch_timer_reg_read(access, ARCH_TIMER_REG_CTRL);
185 ctrl &= ~ARCH_TIMER_CTRL_ENABLE;
186 arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl);
116 break; 187 break;
117 default: 188 default:
118 break; 189 break;
119 } 190 }
120} 191}
121 192
122static int arch_timer_set_next_event(unsigned long evt, 193static void arch_timer_set_mode_virt(enum clock_event_mode mode,
123 struct clock_event_device *unused) 194 struct clock_event_device *clk)
124{ 195{
125 unsigned long ctrl; 196 timer_set_mode(ARCH_TIMER_VIRT_ACCESS, mode);
197}
126 198
127 ctrl = arch_timer_reg_read(ARCH_TIMER_REG_CTRL); 199static void arch_timer_set_mode_phys(enum clock_event_mode mode,
200 struct clock_event_device *clk)
201{
202 timer_set_mode(ARCH_TIMER_PHYS_ACCESS, mode);
203}
204
205static inline void set_next_event(const int access, unsigned long evt)
206{
207 unsigned long ctrl;
208 ctrl = arch_timer_reg_read(access, ARCH_TIMER_REG_CTRL);
128 ctrl |= ARCH_TIMER_CTRL_ENABLE; 209 ctrl |= ARCH_TIMER_CTRL_ENABLE;
129 ctrl &= ~ARCH_TIMER_CTRL_IT_MASK; 210 ctrl &= ~ARCH_TIMER_CTRL_IT_MASK;
211 arch_timer_reg_write(access, ARCH_TIMER_REG_TVAL, evt);
212 arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl);
213}
130 214
131 arch_timer_reg_write(ARCH_TIMER_REG_TVAL, evt); 215static int arch_timer_set_next_event_virt(unsigned long evt,
132 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl); 216 struct clock_event_device *unused)
217{
218 set_next_event(ARCH_TIMER_VIRT_ACCESS, evt);
219 return 0;
220}
133 221
222static int arch_timer_set_next_event_phys(unsigned long evt,
223 struct clock_event_device *unused)
224{
225 set_next_event(ARCH_TIMER_PHYS_ACCESS, evt);
134 return 0; 226 return 0;
135} 227}
136 228
137static int __cpuinit arch_timer_setup(struct clock_event_device *clk) 229static int __cpuinit arch_timer_setup(struct clock_event_device *clk)
138{ 230{
139 /* Be safe... */
140 arch_timer_disable();
141
142 clk->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP; 231 clk->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP;
143 clk->name = "arch_sys_timer"; 232 clk->name = "arch_sys_timer";
144 clk->rating = 450; 233 clk->rating = 450;
145 clk->set_mode = arch_timer_set_mode; 234 if (arch_timer_use_virtual) {
146 clk->set_next_event = arch_timer_set_next_event; 235 clk->irq = arch_timer_ppi[VIRT_PPI];
147 clk->irq = arch_timer_ppi; 236 clk->set_mode = arch_timer_set_mode_virt;
237 clk->set_next_event = arch_timer_set_next_event_virt;
238 } else {
239 clk->irq = arch_timer_ppi[PHYS_SECURE_PPI];
240 clk->set_mode = arch_timer_set_mode_phys;
241 clk->set_next_event = arch_timer_set_next_event_phys;
242 }
243
244 clk->set_mode(CLOCK_EVT_MODE_SHUTDOWN, NULL);
148 245
149 clockevents_config_and_register(clk, arch_timer_rate, 246 clockevents_config_and_register(clk, arch_timer_rate,
150 0xf, 0x7fffffff); 247 0xf, 0x7fffffff);
151 248
152 *__this_cpu_ptr(arch_timer_evt) = clk; 249 *__this_cpu_ptr(arch_timer_evt) = clk;
153 250
154 enable_percpu_irq(clk->irq, 0); 251 if (arch_timer_use_virtual)
155 if (arch_timer_ppi2) 252 enable_percpu_irq(arch_timer_ppi[VIRT_PPI], 0);
156 enable_percpu_irq(arch_timer_ppi2, 0); 253 else {
254 enable_percpu_irq(arch_timer_ppi[PHYS_SECURE_PPI], 0);
255 if (arch_timer_ppi[PHYS_NONSECURE_PPI])
256 enable_percpu_irq(arch_timer_ppi[PHYS_NONSECURE_PPI], 0);
257 }
157 258
158 return 0; 259 return 0;
159} 260}
@@ -173,8 +274,8 @@ static int arch_timer_available(void)
173 return -ENXIO; 274 return -ENXIO;
174 275
175 if (arch_timer_rate == 0) { 276 if (arch_timer_rate == 0) {
176 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, 0); 277 freq = arch_timer_reg_read(ARCH_TIMER_PHYS_ACCESS,
177 freq = arch_timer_reg_read(ARCH_TIMER_REG_FREQ); 278 ARCH_TIMER_REG_FREQ);
178 279
179 /* Check the timer frequency. */ 280 /* Check the timer frequency. */
180 if (freq == 0) { 281 if (freq == 0) {
@@ -185,52 +286,57 @@ static int arch_timer_available(void)
185 arch_timer_rate = freq; 286 arch_timer_rate = freq;
186 } 287 }
187 288
188 pr_info_once("Architected local timer running at %lu.%02luMHz.\n", 289 pr_info_once("Architected local timer running at %lu.%02luMHz (%s).\n",
189 arch_timer_rate / 1000000, (arch_timer_rate / 10000) % 100); 290 arch_timer_rate / 1000000, (arch_timer_rate / 10000) % 100,
291 arch_timer_use_virtual ? "virt" : "phys");
190 return 0; 292 return 0;
191} 293}
192 294
193static inline cycle_t arch_counter_get_cntpct(void) 295static u32 notrace arch_counter_get_cntpct32(void)
194{ 296{
195 u32 cvall, cvalh; 297 cycle_t cnt = arch_counter_get_cntpct();
196
197 asm volatile("mrrc p15, 0, %0, %1, c14" : "=r" (cvall), "=r" (cvalh));
198 298
199 return ((cycle_t) cvalh << 32) | cvall; 299 /*
200} 300 * The sched_clock infrastructure only knows about counters
201 301 * with at most 32bits. Forget about the upper 24 bits for the
202static inline cycle_t arch_counter_get_cntvct(void) 302 * time being...
203{ 303 */
204 u32 cvall, cvalh; 304 return (u32)cnt;
205
206 asm volatile("mrrc p15, 1, %0, %1, c14" : "=r" (cvall), "=r" (cvalh));
207
208 return ((cycle_t) cvalh << 32) | cvall;
209} 305}
210 306
211static u32 notrace arch_counter_get_cntvct32(void) 307static u32 notrace arch_counter_get_cntvct32(void)
212{ 308{
213 cycle_t cntvct = arch_counter_get_cntvct(); 309 cycle_t cnt = arch_counter_get_cntvct();
214 310
215 /* 311 /*
216 * The sched_clock infrastructure only knows about counters 312 * The sched_clock infrastructure only knows about counters
217 * with at most 32bits. Forget about the upper 24 bits for the 313 * with at most 32bits. Forget about the upper 24 bits for the
218 * time being... 314 * time being...
219 */ 315 */
220 return (u32)(cntvct & (u32)~0); 316 return (u32)cnt;
221} 317}
222 318
223static cycle_t arch_counter_read(struct clocksource *cs) 319static cycle_t arch_counter_read(struct clocksource *cs)
224{ 320{
321 /*
322 * Always use the physical counter for the clocksource.
323 * CNTHCTL.PL1PCTEN must be set to 1.
324 */
225 return arch_counter_get_cntpct(); 325 return arch_counter_get_cntpct();
226} 326}
227 327
228int read_current_timer(unsigned long *timer_val) 328static unsigned long arch_timer_read_current_timer(void)
229{ 329{
230 if (!arch_timer_rate) 330 return arch_counter_get_cntpct();
231 return -ENXIO; 331}
232 *timer_val = arch_counter_get_cntpct(); 332
233 return 0; 333static cycle_t arch_counter_read_cc(const struct cyclecounter *cc)
334{
335 /*
336 * Always use the physical counter for the clocksource.
337 * CNTHCTL.PL1PCTEN must be set to 1.
338 */
339 return arch_counter_get_cntpct();
234} 340}
235 341
236static struct clocksource clocksource_counter = { 342static struct clocksource clocksource_counter = {
@@ -241,14 +347,32 @@ static struct clocksource clocksource_counter = {
241 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 347 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
242}; 348};
243 349
350static struct cyclecounter cyclecounter = {
351 .read = arch_counter_read_cc,
352 .mask = CLOCKSOURCE_MASK(56),
353};
354
355static struct timecounter timecounter;
356
357struct timecounter *arch_timer_get_timecounter(void)
358{
359 return &timecounter;
360}
361
244static void __cpuinit arch_timer_stop(struct clock_event_device *clk) 362static void __cpuinit arch_timer_stop(struct clock_event_device *clk)
245{ 363{
246 pr_debug("arch_timer_teardown disable IRQ%d cpu #%d\n", 364 pr_debug("arch_timer_teardown disable IRQ%d cpu #%d\n",
247 clk->irq, smp_processor_id()); 365 clk->irq, smp_processor_id());
248 disable_percpu_irq(clk->irq); 366
249 if (arch_timer_ppi2) 367 if (arch_timer_use_virtual)
250 disable_percpu_irq(arch_timer_ppi2); 368 disable_percpu_irq(arch_timer_ppi[VIRT_PPI]);
251 arch_timer_set_mode(CLOCK_EVT_MODE_UNUSED, clk); 369 else {
370 disable_percpu_irq(arch_timer_ppi[PHYS_SECURE_PPI]);
371 if (arch_timer_ppi[PHYS_NONSECURE_PPI])
372 disable_percpu_irq(arch_timer_ppi[PHYS_NONSECURE_PPI]);
373 }
374
375 clk->set_mode(CLOCK_EVT_MODE_UNUSED, clk);
252} 376}
253 377
254static struct local_timer_ops arch_timer_ops __cpuinitdata = { 378static struct local_timer_ops arch_timer_ops __cpuinitdata = {
@@ -261,36 +385,48 @@ static struct clock_event_device arch_timer_global_evt;
261static int __init arch_timer_register(void) 385static int __init arch_timer_register(void)
262{ 386{
263 int err; 387 int err;
388 int ppi;
264 389
265 err = arch_timer_available(); 390 err = arch_timer_available();
266 if (err) 391 if (err)
267 return err; 392 goto out;
268 393
269 arch_timer_evt = alloc_percpu(struct clock_event_device *); 394 arch_timer_evt = alloc_percpu(struct clock_event_device *);
270 if (!arch_timer_evt) 395 if (!arch_timer_evt) {
271 return -ENOMEM; 396 err = -ENOMEM;
397 goto out;
398 }
272 399
273 clocksource_register_hz(&clocksource_counter, arch_timer_rate); 400 clocksource_register_hz(&clocksource_counter, arch_timer_rate);
401 cyclecounter.mult = clocksource_counter.mult;
402 cyclecounter.shift = clocksource_counter.shift;
403 timecounter_init(&timecounter, &cyclecounter,
404 arch_counter_get_cntpct());
405
406 if (arch_timer_use_virtual) {
407 ppi = arch_timer_ppi[VIRT_PPI];
408 err = request_percpu_irq(ppi, arch_timer_handler_virt,
409 "arch_timer", arch_timer_evt);
410 } else {
411 ppi = arch_timer_ppi[PHYS_SECURE_PPI];
412 err = request_percpu_irq(ppi, arch_timer_handler_phys,
413 "arch_timer", arch_timer_evt);
414 if (!err && arch_timer_ppi[PHYS_NONSECURE_PPI]) {
415 ppi = arch_timer_ppi[PHYS_NONSECURE_PPI];
416 err = request_percpu_irq(ppi, arch_timer_handler_phys,
417 "arch_timer", arch_timer_evt);
418 if (err)
419 free_percpu_irq(arch_timer_ppi[PHYS_SECURE_PPI],
420 arch_timer_evt);
421 }
422 }
274 423
275 err = request_percpu_irq(arch_timer_ppi, arch_timer_handler,
276 "arch_timer", arch_timer_evt);
277 if (err) { 424 if (err) {
278 pr_err("arch_timer: can't register interrupt %d (%d)\n", 425 pr_err("arch_timer: can't register interrupt %d (%d)\n",
279 arch_timer_ppi, err); 426 ppi, err);
280 goto out_free; 427 goto out_free;
281 } 428 }
282 429
283 if (arch_timer_ppi2) {
284 err = request_percpu_irq(arch_timer_ppi2, arch_timer_handler,
285 "arch_timer", arch_timer_evt);
286 if (err) {
287 pr_err("arch_timer: can't register interrupt %d (%d)\n",
288 arch_timer_ppi2, err);
289 arch_timer_ppi2 = 0;
290 goto out_free_irq;
291 }
292 }
293
294 err = local_timer_register(&arch_timer_ops); 430 err = local_timer_register(&arch_timer_ops);
295 if (err) { 431 if (err) {
296 /* 432 /*
@@ -302,21 +438,29 @@ static int __init arch_timer_register(void)
302 arch_timer_global_evt.cpumask = cpumask_of(0); 438 arch_timer_global_evt.cpumask = cpumask_of(0);
303 err = arch_timer_setup(&arch_timer_global_evt); 439 err = arch_timer_setup(&arch_timer_global_evt);
304 } 440 }
305
306 if (err) 441 if (err)
307 goto out_free_irq; 442 goto out_free_irq;
308 443
309 init_current_timer_delay(arch_timer_rate); 444 /* Use the architected timer for the delay loop. */
445 arch_delay_timer.read_current_timer = &arch_timer_read_current_timer;
446 arch_delay_timer.freq = arch_timer_rate;
447 register_current_timer_delay(&arch_delay_timer);
310 return 0; 448 return 0;
311 449
312out_free_irq: 450out_free_irq:
313 free_percpu_irq(arch_timer_ppi, arch_timer_evt); 451 if (arch_timer_use_virtual)
314 if (arch_timer_ppi2) 452 free_percpu_irq(arch_timer_ppi[VIRT_PPI], arch_timer_evt);
315 free_percpu_irq(arch_timer_ppi2, arch_timer_evt); 453 else {
454 free_percpu_irq(arch_timer_ppi[PHYS_SECURE_PPI],
455 arch_timer_evt);
456 if (arch_timer_ppi[PHYS_NONSECURE_PPI])
457 free_percpu_irq(arch_timer_ppi[PHYS_NONSECURE_PPI],
458 arch_timer_evt);
459 }
316 460
317out_free: 461out_free:
318 free_percpu(arch_timer_evt); 462 free_percpu(arch_timer_evt);
319 463out:
320 return err; 464 return err;
321} 465}
322 466
@@ -329,6 +473,7 @@ int __init arch_timer_of_register(void)
329{ 473{
330 struct device_node *np; 474 struct device_node *np;
331 u32 freq; 475 u32 freq;
476 int i;
332 477
333 np = of_find_matching_node(NULL, arch_timer_of_match); 478 np = of_find_matching_node(NULL, arch_timer_of_match);
334 if (!np) { 479 if (!np) {
@@ -340,22 +485,40 @@ int __init arch_timer_of_register(void)
340 if (!of_property_read_u32(np, "clock-frequency", &freq)) 485 if (!of_property_read_u32(np, "clock-frequency", &freq))
341 arch_timer_rate = freq; 486 arch_timer_rate = freq;
342 487
343 arch_timer_ppi = irq_of_parse_and_map(np, 0); 488 for (i = PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++)
344 arch_timer_ppi2 = irq_of_parse_and_map(np, 1); 489 arch_timer_ppi[i] = irq_of_parse_and_map(np, i);
345 pr_info("arch_timer: found %s irqs %d %d\n", 490
346 np->name, arch_timer_ppi, arch_timer_ppi2); 491 /*
492 * If no interrupt provided for virtual timer, we'll have to
493 * stick to the physical timer. It'd better be accessible...
494 */
495 if (!arch_timer_ppi[VIRT_PPI]) {
496 arch_timer_use_virtual = false;
497
498 if (!arch_timer_ppi[PHYS_SECURE_PPI] ||
499 !arch_timer_ppi[PHYS_NONSECURE_PPI]) {
500 pr_warn("arch_timer: No interrupt available, giving up\n");
501 return -EINVAL;
502 }
503 }
347 504
348 return arch_timer_register(); 505 return arch_timer_register();
349} 506}
350 507
351int __init arch_timer_sched_clock_init(void) 508int __init arch_timer_sched_clock_init(void)
352{ 509{
510 u32 (*cnt32)(void);
353 int err; 511 int err;
354 512
355 err = arch_timer_available(); 513 err = arch_timer_available();
356 if (err) 514 if (err)
357 return err; 515 return err;
358 516
359 setup_sched_clock(arch_counter_get_cntvct32, 32, arch_timer_rate); 517 if (arch_timer_use_virtual)
518 cnt32 = arch_counter_get_cntvct32;
519 else
520 cnt32 = arch_counter_get_cntpct32;
521
522 setup_sched_clock(cnt32, 32, arch_timer_rate);
360 return 0; 523 return 0;
361} 524}
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 1429d8989fb9..c985b481192c 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -59,10 +59,12 @@ int main(void)
59 DEFINE(TI_USED_CP, offsetof(struct thread_info, used_cp)); 59 DEFINE(TI_USED_CP, offsetof(struct thread_info, used_cp));
60 DEFINE(TI_TP_VALUE, offsetof(struct thread_info, tp_value)); 60 DEFINE(TI_TP_VALUE, offsetof(struct thread_info, tp_value));
61 DEFINE(TI_FPSTATE, offsetof(struct thread_info, fpstate)); 61 DEFINE(TI_FPSTATE, offsetof(struct thread_info, fpstate));
62#ifdef CONFIG_VFP
62 DEFINE(TI_VFPSTATE, offsetof(struct thread_info, vfpstate)); 63 DEFINE(TI_VFPSTATE, offsetof(struct thread_info, vfpstate));
63#ifdef CONFIG_SMP 64#ifdef CONFIG_SMP
64 DEFINE(VFP_CPU, offsetof(union vfp_state, hard.cpu)); 65 DEFINE(VFP_CPU, offsetof(union vfp_state, hard.cpu));
65#endif 66#endif
67#endif
66#ifdef CONFIG_ARM_THUMBEE 68#ifdef CONFIG_ARM_THUMBEE
67 DEFINE(TI_THUMBEE_STATE, offsetof(struct thread_info, thumbee_state)); 69 DEFINE(TI_THUMBEE_STATE, offsetof(struct thread_info, thumbee_state));
68#endif 70#endif
diff --git a/arch/arm/kernel/atags.h b/arch/arm/kernel/atags.h
index e5f028d214a1..9edc9692332d 100644
--- a/arch/arm/kernel/atags.h
+++ b/arch/arm/kernel/atags.h
@@ -3,3 +3,17 @@ extern void save_atags(struct tag *tags);
3#else 3#else
4static inline void save_atags(struct tag *tags) { } 4static inline void save_atags(struct tag *tags) { }
5#endif 5#endif
6
7void convert_to_tag_list(struct tag *tags);
8
9#ifdef CONFIG_ATAGS
10struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr);
11#else
12static inline struct machine_desc *
13setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
14{
15 early_print("no ATAGS support: can't continue\n");
16 while (true);
17 unreachable();
18}
19#endif
diff --git a/arch/arm/kernel/compat.c b/arch/arm/kernel/atags_compat.c
index 925652318b8b..5236ad38f417 100644
--- a/arch/arm/kernel/compat.c
+++ b/arch/arm/kernel/atags_compat.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/kernel/compat.c 2 * linux/arch/arm/kernel/atags_compat.c
3 * 3 *
4 * Copyright (C) 2001 Russell King 4 * Copyright (C) 2001 Russell King
5 * 5 *
@@ -26,7 +26,7 @@
26 26
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28 28
29#include "compat.h" 29#include "atags.h"
30 30
31/* 31/*
32 * Usage: 32 * Usage:
diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c
new file mode 100644
index 000000000000..14512e6931d8
--- /dev/null
+++ b/arch/arm/kernel/atags_parse.c
@@ -0,0 +1,238 @@
1/*
2 * Tag parsing.
3 *
4 * Copyright (C) 1995-2001 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
11/*
12 * This is the traditional way of passing data to the kernel at boot time. Rather
13 * than passing a fixed inflexible structure to the kernel, we pass a list
14 * of variable-sized tags to the kernel. The first tag must be a ATAG_CORE
15 * tag for the list to be recognised (to distinguish the tagged list from
16 * a param_struct). The list is terminated with a zero-length tag (this tag
17 * is not parsed in any way).
18 */
19
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/fs.h>
23#include <linux/root_dev.h>
24#include <linux/screen_info.h>
25
26#include <asm/setup.h>
27#include <asm/system_info.h>
28#include <asm/page.h>
29#include <asm/mach/arch.h>
30
31#include "atags.h"
32
33static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
34
35#ifndef MEM_SIZE
36#define MEM_SIZE (16*1024*1024)
37#endif
38
39static struct {
40 struct tag_header hdr1;
41 struct tag_core core;
42 struct tag_header hdr2;
43 struct tag_mem32 mem;
44 struct tag_header hdr3;
45} default_tags __initdata = {
46 { tag_size(tag_core), ATAG_CORE },
47 { 1, PAGE_SIZE, 0xff },
48 { tag_size(tag_mem32), ATAG_MEM },
49 { MEM_SIZE },
50 { 0, ATAG_NONE }
51};
52
53static int __init parse_tag_core(const struct tag *tag)
54{
55 if (tag->hdr.size > 2) {
56 if ((tag->u.core.flags & 1) == 0)
57 root_mountflags &= ~MS_RDONLY;
58 ROOT_DEV = old_decode_dev(tag->u.core.rootdev);
59 }
60 return 0;
61}
62
63__tagtable(ATAG_CORE, parse_tag_core);
64
65static int __init parse_tag_mem32(const struct tag *tag)
66{
67 return arm_add_memory(tag->u.mem.start, tag->u.mem.size);
68}
69
70__tagtable(ATAG_MEM, parse_tag_mem32);
71
72#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
73static int __init parse_tag_videotext(const struct tag *tag)
74{
75 screen_info.orig_x = tag->u.videotext.x;
76 screen_info.orig_y = tag->u.videotext.y;
77 screen_info.orig_video_page = tag->u.videotext.video_page;
78 screen_info.orig_video_mode = tag->u.videotext.video_mode;
79 screen_info.orig_video_cols = tag->u.videotext.video_cols;
80 screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
81 screen_info.orig_video_lines = tag->u.videotext.video_lines;
82 screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
83 screen_info.orig_video_points = tag->u.videotext.video_points;
84 return 0;
85}
86
87__tagtable(ATAG_VIDEOTEXT, parse_tag_videotext);
88#endif
89
90#ifdef CONFIG_BLK_DEV_RAM
91static int __init parse_tag_ramdisk(const struct tag *tag)
92{
93 extern int rd_size, rd_image_start, rd_prompt, rd_doload;
94
95 rd_image_start = tag->u.ramdisk.start;
96 rd_doload = (tag->u.ramdisk.flags & 1) == 0;
97 rd_prompt = (tag->u.ramdisk.flags & 2) == 0;
98
99 if (tag->u.ramdisk.size)
100 rd_size = tag->u.ramdisk.size;
101
102 return 0;
103}
104
105__tagtable(ATAG_RAMDISK, parse_tag_ramdisk);
106#endif
107
108static int __init parse_tag_serialnr(const struct tag *tag)
109{
110 system_serial_low = tag->u.serialnr.low;
111 system_serial_high = tag->u.serialnr.high;
112 return 0;
113}
114
115__tagtable(ATAG_SERIAL, parse_tag_serialnr);
116
117static int __init parse_tag_revision(const struct tag *tag)
118{
119 system_rev = tag->u.revision.rev;
120 return 0;
121}
122
123__tagtable(ATAG_REVISION, parse_tag_revision);
124
125static int __init parse_tag_cmdline(const struct tag *tag)
126{
127#if defined(CONFIG_CMDLINE_EXTEND)
128 strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
129 strlcat(default_command_line, tag->u.cmdline.cmdline,
130 COMMAND_LINE_SIZE);
131#elif defined(CONFIG_CMDLINE_FORCE)
132 pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");
133#else
134 strlcpy(default_command_line, tag->u.cmdline.cmdline,
135 COMMAND_LINE_SIZE);
136#endif
137 return 0;
138}
139
140__tagtable(ATAG_CMDLINE, parse_tag_cmdline);
141
142/*
143 * Scan the tag table for this tag, and call its parse function.
144 * The tag table is built by the linker from all the __tagtable
145 * declarations.
146 */
147static int __init parse_tag(const struct tag *tag)
148{
149 extern struct tagtable __tagtable_begin, __tagtable_end;
150 struct tagtable *t;
151
152 for (t = &__tagtable_begin; t < &__tagtable_end; t++)
153 if (tag->hdr.tag == t->tag) {
154 t->parse(tag);
155 break;
156 }
157
158 return t < &__tagtable_end;
159}
160
161/*
162 * Parse all tags in the list, checking both the global and architecture
163 * specific tag tables.
164 */
165static void __init parse_tags(const struct tag *t)
166{
167 for (; t->hdr.size; t = tag_next(t))
168 if (!parse_tag(t))
169 printk(KERN_WARNING
170 "Ignoring unrecognised tag 0x%08x\n",
171 t->hdr.tag);
172}
173
174static void __init squash_mem_tags(struct tag *tag)
175{
176 for (; tag->hdr.size; tag = tag_next(tag))
177 if (tag->hdr.tag == ATAG_MEM)
178 tag->hdr.tag = ATAG_NONE;
179}
180
181struct machine_desc * __init setup_machine_tags(phys_addr_t __atags_pointer,
182 unsigned int machine_nr)
183{
184 struct tag *tags = (struct tag *)&default_tags;
185 struct machine_desc *mdesc = NULL, *p;
186 char *from = default_command_line;
187
188 default_tags.mem.start = PHYS_OFFSET;
189
190 /*
191 * locate machine in the list of supported machines.
192 */
193 for_each_machine_desc(p)
194 if (machine_nr == p->nr) {
195 printk("Machine: %s\n", p->name);
196 mdesc = p;
197 break;
198 }
199
200 if (!mdesc) {
201 early_print("\nError: unrecognized/unsupported machine ID"
202 " (r1 = 0x%08x).\n\n", machine_nr);
203 dump_machine_table(); /* does not return */
204 }
205
206 if (__atags_pointer)
207 tags = phys_to_virt(__atags_pointer);
208 else if (mdesc->atag_offset)
209 tags = (void *)(PAGE_OFFSET + mdesc->atag_offset);
210
211#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
212 /*
213 * If we have the old style parameters, convert them to
214 * a tag list.
215 */
216 if (tags->hdr.tag != ATAG_CORE)
217 convert_to_tag_list(tags);
218#endif
219 if (tags->hdr.tag != ATAG_CORE) {
220 early_print("Warning: Neither atags nor dtb found\n");
221 tags = (struct tag *)&default_tags;
222 }
223
224 if (mdesc->fixup)
225 mdesc->fixup(tags, &from, &meminfo);
226
227 if (tags->hdr.tag == ATAG_CORE) {
228 if (meminfo.nr_banks != 0)
229 squash_mem_tags(tags);
230 save_atags(tags);
231 parse_tags(tags);
232 }
233
234 /* parse_early_param needs a boot_command_line */
235 strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
236
237 return mdesc;
238}
diff --git a/arch/arm/kernel/atags.c b/arch/arm/kernel/atags_proc.c
index 42a1a1415fa6..42a1a1415fa6 100644
--- a/arch/arm/kernel/atags.c
+++ b/arch/arm/kernel/atags_proc.c
diff --git a/arch/arm/kernel/compat.h b/arch/arm/kernel/compat.h
deleted file mode 100644
index 39264ab1b9c6..000000000000
--- a/arch/arm/kernel/compat.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/*
2 * linux/arch/arm/kernel/compat.h
3 *
4 * Copyright (C) 2001 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
11extern void convert_to_tag_list(struct tag *tags);
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 978eac57e04a..f45987037bf1 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -94,6 +94,15 @@ ENDPROC(ret_from_fork)
94 .equ NR_syscalls,0 94 .equ NR_syscalls,0
95#define CALL(x) .equ NR_syscalls,NR_syscalls+1 95#define CALL(x) .equ NR_syscalls,NR_syscalls+1
96#include "calls.S" 96#include "calls.S"
97
98/*
99 * Ensure that the system call table is equal to __NR_syscalls,
100 * which is the value the rest of the system sees
101 */
102.ifne NR_syscalls - __NR_syscalls
103.error "__NR_syscalls is not equal to the size of the syscall table"
104.endif
105
97#undef CALL 106#undef CALL
98#define CALL(x) .long x 107#define CALL(x) .long x
99 108
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index dfcdb9f7c126..e29c3337ca81 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -8,7 +8,9 @@
8#include <linux/reboot.h> 8#include <linux/reboot.h>
9#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/irq.h> 10#include <linux/irq.h>
11#include <linux/memblock.h>
11#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13#include <linux/of_fdt.h>
12#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
13#include <asm/mmu_context.h> 15#include <asm/mmu_context.h>
14#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
@@ -32,6 +34,29 @@ static atomic_t waiting_for_crash_ipi;
32 34
33int machine_kexec_prepare(struct kimage *image) 35int machine_kexec_prepare(struct kimage *image)
34{ 36{
37 struct kexec_segment *current_segment;
38 __be32 header;
39 int i, err;
40
41 /*
42 * No segment at default ATAGs address. try to locate
43 * a dtb using magic.
44 */
45 for (i = 0; i < image->nr_segments; i++) {
46 current_segment = &image->segment[i];
47
48 err = memblock_is_region_memory(current_segment->mem,
49 current_segment->memsz);
50 if (err)
51 return - EINVAL;
52
53 err = get_user(header, (__be32*)current_segment->buf);
54 if (err)
55 return err;
56
57 if (be32_to_cpu(header) == OF_DT_HEADER)
58 kexec_boot_atags = current_segment->mem;
59 }
35 return 0; 60 return 0;
36} 61}
37 62
@@ -122,7 +147,9 @@ void machine_kexec(struct kimage *image)
122 kexec_start_address = image->start; 147 kexec_start_address = image->start;
123 kexec_indirection_page = page_list; 148 kexec_indirection_page = page_list;
124 kexec_mach_type = machine_arch_type; 149 kexec_mach_type = machine_arch_type;
125 kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET; 150 if (!kexec_boot_atags)
151 kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
152
126 153
127 /* copy our kernel relocation code to the control code page */ 154 /* copy our kernel relocation code to the control code page */
128 memcpy(reboot_code_buffer, 155 memcpy(reboot_code_buffer,
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 3e0fc5f7ed4b..739db3a1b2d2 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -30,6 +30,9 @@
30#include <asm/pgtable.h> 30#include <asm/pgtable.h>
31#include <asm/traps.h> 31#include <asm/traps.h>
32 32
33#define CREATE_TRACE_POINTS
34#include <trace/events/syscalls.h>
35
33#define REG_PC 15 36#define REG_PC 15
34#define REG_PSR 16 37#define REG_PSR 16
35/* 38/*
@@ -918,11 +921,11 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
918{ 921{
919 unsigned long ip; 922 unsigned long ip;
920 923
924 current_thread_info()->syscall = scno;
925
921 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 926 if (!test_thread_flag(TIF_SYSCALL_TRACE))
922 return scno; 927 return scno;
923 928
924 current_thread_info()->syscall = scno;
925
926 /* 929 /*
927 * IP is used to denote syscall entry/exit: 930 * IP is used to denote syscall entry/exit:
928 * IP = 0 -> entry, =1 -> exit 931 * IP = 0 -> entry, =1 -> exit
@@ -941,15 +944,19 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
941 944
942asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) 945asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
943{ 946{
944 int ret = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER); 947 scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER);
948 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
949 trace_sys_enter(regs, scno);
945 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1, 950 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1,
946 regs->ARM_r2, regs->ARM_r3); 951 regs->ARM_r2, regs->ARM_r3);
947 return ret; 952 return scno;
948} 953}
949 954
950asmlinkage int syscall_trace_exit(struct pt_regs *regs, int scno) 955asmlinkage int syscall_trace_exit(struct pt_regs *regs, int scno)
951{ 956{
952 int ret = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_EXIT); 957 scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_EXIT);
958 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
959 trace_sys_exit(regs, scno);
953 audit_syscall_exit(regs); 960 audit_syscall_exit(regs);
954 return ret; 961 return scno;
955} 962}
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index f4515393248d..e21bac20d90d 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -9,6 +9,7 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/jiffies.h> 10#include <linux/jiffies.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/moduleparam.h>
12#include <linux/sched.h> 13#include <linux/sched.h>
13#include <linux/syscore_ops.h> 14#include <linux/syscore_ops.h>
14#include <linux/timer.h> 15#include <linux/timer.h>
@@ -27,6 +28,9 @@ struct clock_data {
27 28
28static void sched_clock_poll(unsigned long wrap_ticks); 29static void sched_clock_poll(unsigned long wrap_ticks);
29static DEFINE_TIMER(sched_clock_timer, sched_clock_poll, 0, 0); 30static DEFINE_TIMER(sched_clock_timer, sched_clock_poll, 0, 0);
31static int irqtime = -1;
32
33core_param(irqtime, irqtime, int, 0400);
30 34
31static struct clock_data cd = { 35static struct clock_data cd = {
32 .mult = NSEC_PER_SEC / HZ, 36 .mult = NSEC_PER_SEC / HZ,
@@ -157,6 +161,10 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
157 */ 161 */
158 cd.epoch_ns = 0; 162 cd.epoch_ns = 0;
159 163
164 /* Enable IRQ time accounting if we have a fast enough sched_clock */
165 if (irqtime > 0 || (irqtime == -1 && rate >= 1000000))
166 enable_sched_clock_irqtime();
167
160 pr_debug("Registered %pF as sched_clock source\n", read); 168 pr_debug("Registered %pF as sched_clock source\n", read);
161} 169}
162 170
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 725f9f2a9541..febafa0f552d 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -21,11 +21,9 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kexec.h> 22#include <linux/kexec.h>
23#include <linux/of_fdt.h> 23#include <linux/of_fdt.h>
24#include <linux/root_dev.h>
25#include <linux/cpu.h> 24#include <linux/cpu.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27#include <linux/smp.h> 26#include <linux/smp.h>
28#include <linux/fs.h>
29#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
30#include <linux/memblock.h> 28#include <linux/memblock.h>
31#include <linux/bug.h> 29#include <linux/bug.h>
@@ -56,15 +54,9 @@
56#include <asm/unwind.h> 54#include <asm/unwind.h>
57#include <asm/memblock.h> 55#include <asm/memblock.h>
58 56
59#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
60#include "compat.h"
61#endif
62#include "atags.h" 57#include "atags.h"
63#include "tcm.h" 58#include "tcm.h"
64 59
65#ifndef MEM_SIZE
66#define MEM_SIZE (16*1024*1024)
67#endif
68 60
69#if defined(CONFIG_FPE_NWFPE) || defined(CONFIG_FPE_FASTFPE) 61#if defined(CONFIG_FPE_NWFPE) || defined(CONFIG_FPE_FASTFPE)
70char fpe_type[8]; 62char fpe_type[8];
@@ -145,7 +137,6 @@ static const char *machine_name;
145static char __initdata cmd_line[COMMAND_LINE_SIZE]; 137static char __initdata cmd_line[COMMAND_LINE_SIZE];
146struct machine_desc *machine_desc __initdata; 138struct machine_desc *machine_desc __initdata;
147 139
148static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
149static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; 140static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
150#define ENDIANNESS ((char)endian_test.l) 141#define ENDIANNESS ((char)endian_test.l)
151 142
@@ -583,21 +574,6 @@ static int __init early_mem(char *p)
583} 574}
584early_param("mem", early_mem); 575early_param("mem", early_mem);
585 576
586static void __init
587setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz)
588{
589#ifdef CONFIG_BLK_DEV_RAM
590 extern int rd_size, rd_image_start, rd_prompt, rd_doload;
591
592 rd_image_start = image_start;
593 rd_prompt = prompt;
594 rd_doload = doload;
595
596 if (rd_sz)
597 rd_size = rd_sz;
598#endif
599}
600
601static void __init request_standard_resources(struct machine_desc *mdesc) 577static void __init request_standard_resources(struct machine_desc *mdesc)
602{ 578{
603 struct memblock_region *region; 579 struct memblock_region *region;
@@ -643,35 +619,6 @@ static void __init request_standard_resources(struct machine_desc *mdesc)
643 request_resource(&ioport_resource, &lp2); 619 request_resource(&ioport_resource, &lp2);
644} 620}
645 621
646/*
647 * Tag parsing.
648 *
649 * This is the new way of passing data to the kernel at boot time. Rather
650 * than passing a fixed inflexible structure to the kernel, we pass a list
651 * of variable-sized tags to the kernel. The first tag must be a ATAG_CORE
652 * tag for the list to be recognised (to distinguish the tagged list from
653 * a param_struct). The list is terminated with a zero-length tag (this tag
654 * is not parsed in any way).
655 */
656static int __init parse_tag_core(const struct tag *tag)
657{
658 if (tag->hdr.size > 2) {
659 if ((tag->u.core.flags & 1) == 0)
660 root_mountflags &= ~MS_RDONLY;
661 ROOT_DEV = old_decode_dev(tag->u.core.rootdev);
662 }
663 return 0;
664}
665
666__tagtable(ATAG_CORE, parse_tag_core);
667
668static int __init parse_tag_mem32(const struct tag *tag)
669{
670 return arm_add_memory(tag->u.mem.start, tag->u.mem.size);
671}
672
673__tagtable(ATAG_MEM, parse_tag_mem32);
674
675#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) 622#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
676struct screen_info screen_info = { 623struct screen_info screen_info = {
677 .orig_video_lines = 30, 624 .orig_video_lines = 30,
@@ -681,117 +628,8 @@ struct screen_info screen_info = {
681 .orig_video_isVGA = 1, 628 .orig_video_isVGA = 1,
682 .orig_video_points = 8 629 .orig_video_points = 8
683}; 630};
684
685static int __init parse_tag_videotext(const struct tag *tag)
686{
687 screen_info.orig_x = tag->u.videotext.x;
688 screen_info.orig_y = tag->u.videotext.y;
689 screen_info.orig_video_page = tag->u.videotext.video_page;
690 screen_info.orig_video_mode = tag->u.videotext.video_mode;
691 screen_info.orig_video_cols = tag->u.videotext.video_cols;
692 screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
693 screen_info.orig_video_lines = tag->u.videotext.video_lines;
694 screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
695 screen_info.orig_video_points = tag->u.videotext.video_points;
696 return 0;
697}
698
699__tagtable(ATAG_VIDEOTEXT, parse_tag_videotext);
700#endif 631#endif
701 632
702static int __init parse_tag_ramdisk(const struct tag *tag)
703{
704 setup_ramdisk((tag->u.ramdisk.flags & 1) == 0,
705 (tag->u.ramdisk.flags & 2) == 0,
706 tag->u.ramdisk.start, tag->u.ramdisk.size);
707 return 0;
708}
709
710__tagtable(ATAG_RAMDISK, parse_tag_ramdisk);
711
712static int __init parse_tag_serialnr(const struct tag *tag)
713{
714 system_serial_low = tag->u.serialnr.low;
715 system_serial_high = tag->u.serialnr.high;
716 return 0;
717}
718
719__tagtable(ATAG_SERIAL, parse_tag_serialnr);
720
721static int __init parse_tag_revision(const struct tag *tag)
722{
723 system_rev = tag->u.revision.rev;
724 return 0;
725}
726
727__tagtable(ATAG_REVISION, parse_tag_revision);
728
729static int __init parse_tag_cmdline(const struct tag *tag)
730{
731#if defined(CONFIG_CMDLINE_EXTEND)
732 strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
733 strlcat(default_command_line, tag->u.cmdline.cmdline,
734 COMMAND_LINE_SIZE);
735#elif defined(CONFIG_CMDLINE_FORCE)
736 pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");
737#else
738 strlcpy(default_command_line, tag->u.cmdline.cmdline,
739 COMMAND_LINE_SIZE);
740#endif
741 return 0;
742}
743
744__tagtable(ATAG_CMDLINE, parse_tag_cmdline);
745
746/*
747 * Scan the tag table for this tag, and call its parse function.
748 * The tag table is built by the linker from all the __tagtable
749 * declarations.
750 */
751static int __init parse_tag(const struct tag *tag)
752{
753 extern struct tagtable __tagtable_begin, __tagtable_end;
754 struct tagtable *t;
755
756 for (t = &__tagtable_begin; t < &__tagtable_end; t++)
757 if (tag->hdr.tag == t->tag) {
758 t->parse(tag);
759 break;
760 }
761
762 return t < &__tagtable_end;
763}
764
765/*
766 * Parse all tags in the list, checking both the global and architecture
767 * specific tag tables.
768 */
769static void __init parse_tags(const struct tag *t)
770{
771 for (; t->hdr.size; t = tag_next(t))
772 if (!parse_tag(t))
773 printk(KERN_WARNING
774 "Ignoring unrecognised tag 0x%08x\n",
775 t->hdr.tag);
776}
777
778/*
779 * This holds our defaults.
780 */
781static struct init_tags {
782 struct tag_header hdr1;
783 struct tag_core core;
784 struct tag_header hdr2;
785 struct tag_mem32 mem;
786 struct tag_header hdr3;
787} init_tags __initdata = {
788 { tag_size(tag_core), ATAG_CORE },
789 { 1, PAGE_SIZE, 0xff },
790 { tag_size(tag_mem32), ATAG_MEM },
791 { MEM_SIZE },
792 { 0, ATAG_NONE }
793};
794
795static int __init customize_machine(void) 633static int __init customize_machine(void)
796{ 634{
797 /* customizes platform devices, or adds new ones */ 635 /* customizes platform devices, or adds new ones */
@@ -858,78 +696,6 @@ static void __init reserve_crashkernel(void)
858static inline void reserve_crashkernel(void) {} 696static inline void reserve_crashkernel(void) {}
859#endif /* CONFIG_KEXEC */ 697#endif /* CONFIG_KEXEC */
860 698
861static void __init squash_mem_tags(struct tag *tag)
862{
863 for (; tag->hdr.size; tag = tag_next(tag))
864 if (tag->hdr.tag == ATAG_MEM)
865 tag->hdr.tag = ATAG_NONE;
866}
867
868static struct machine_desc * __init setup_machine_tags(unsigned int nr)
869{
870 struct tag *tags = (struct tag *)&init_tags;
871 struct machine_desc *mdesc = NULL, *p;
872 char *from = default_command_line;
873
874 init_tags.mem.start = PHYS_OFFSET;
875
876 /*
877 * locate machine in the list of supported machines.
878 */
879 for_each_machine_desc(p)
880 if (nr == p->nr) {
881 printk("Machine: %s\n", p->name);
882 mdesc = p;
883 break;
884 }
885
886 if (!mdesc) {
887 early_print("\nError: unrecognized/unsupported machine ID"
888 " (r1 = 0x%08x).\n\n", nr);
889 dump_machine_table(); /* does not return */
890 }
891
892 if (__atags_pointer)
893 tags = phys_to_virt(__atags_pointer);
894 else if (mdesc->atag_offset)
895 tags = (void *)(PAGE_OFFSET + mdesc->atag_offset);
896
897#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
898 /*
899 * If we have the old style parameters, convert them to
900 * a tag list.
901 */
902 if (tags->hdr.tag != ATAG_CORE)
903 convert_to_tag_list(tags);
904#endif
905
906 if (tags->hdr.tag != ATAG_CORE) {
907#if defined(CONFIG_OF)
908 /*
909 * If CONFIG_OF is set, then assume this is a reasonably
910 * modern system that should pass boot parameters
911 */
912 early_print("Warning: Neither atags nor dtb found\n");
913#endif
914 tags = (struct tag *)&init_tags;
915 }
916
917 if (mdesc->fixup)
918 mdesc->fixup(tags, &from, &meminfo);
919
920 if (tags->hdr.tag == ATAG_CORE) {
921 if (meminfo.nr_banks != 0)
922 squash_mem_tags(tags);
923 save_atags(tags);
924 parse_tags(tags);
925 }
926
927 /* parse_early_param needs a boot_command_line */
928 strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
929
930 return mdesc;
931}
932
933static int __init meminfo_cmp(const void *_a, const void *_b) 699static int __init meminfo_cmp(const void *_a, const void *_b)
934{ 700{
935 const struct membank *a = _a, *b = _b; 701 const struct membank *a = _a, *b = _b;
@@ -944,7 +710,7 @@ void __init setup_arch(char **cmdline_p)
944 setup_processor(); 710 setup_processor();
945 mdesc = setup_machine_fdt(__atags_pointer); 711 mdesc = setup_machine_fdt(__atags_pointer);
946 if (!mdesc) 712 if (!mdesc)
947 mdesc = setup_machine_tags(machine_arch_type); 713 mdesc = setup_machine_tags(__atags_pointer, machine_arch_type);
948 machine_desc = mdesc; 714 machine_desc = mdesc;
949 machine_name = mdesc->name; 715 machine_name = mdesc->name;
950 716
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index dea7a925c7e2..d100eacdb798 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -59,7 +59,8 @@ struct secondary_data secondary_data;
59volatile int __cpuinitdata pen_release = -1; 59volatile int __cpuinitdata pen_release = -1;
60 60
61enum ipi_msg_type { 61enum ipi_msg_type {
62 IPI_TIMER = 2, 62 IPI_WAKEUP,
63 IPI_TIMER,
63 IPI_RESCHEDULE, 64 IPI_RESCHEDULE,
64 IPI_CALL_FUNC, 65 IPI_CALL_FUNC,
65 IPI_CALL_FUNC_SINGLE, 66 IPI_CALL_FUNC_SINGLE,
@@ -414,7 +415,8 @@ void arch_send_call_function_single_ipi(int cpu)
414} 415}
415 416
416static const char *ipi_types[NR_IPI] = { 417static const char *ipi_types[NR_IPI] = {
417#define S(x,s) [x - IPI_TIMER] = s 418#define S(x,s) [x] = s
419 S(IPI_WAKEUP, "CPU wakeup interrupts"),
418 S(IPI_TIMER, "Timer broadcast interrupts"), 420 S(IPI_TIMER, "Timer broadcast interrupts"),
419 S(IPI_RESCHEDULE, "Rescheduling interrupts"), 421 S(IPI_RESCHEDULE, "Rescheduling interrupts"),
420 S(IPI_CALL_FUNC, "Function call interrupts"), 422 S(IPI_CALL_FUNC, "Function call interrupts"),
@@ -567,10 +569,13 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
567 unsigned int cpu = smp_processor_id(); 569 unsigned int cpu = smp_processor_id();
568 struct pt_regs *old_regs = set_irq_regs(regs); 570 struct pt_regs *old_regs = set_irq_regs(regs);
569 571
570 if (ipinr >= IPI_TIMER && ipinr < IPI_TIMER + NR_IPI) 572 if (ipinr < NR_IPI)
571 __inc_irq_stat(cpu, ipi_irqs[ipinr - IPI_TIMER]); 573 __inc_irq_stat(cpu, ipi_irqs[ipinr]);
572 574
573 switch (ipinr) { 575 switch (ipinr) {
576 case IPI_WAKEUP:
577 break;
578
574 case IPI_TIMER: 579 case IPI_TIMER:
575 irq_enter(); 580 irq_enter();
576 ipi_timer(); 581 ipi_timer();
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
index 395d5fbb8fa2..9d0a30032d7f 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -34,7 +34,18 @@ struct arm_delay_ops arm_delay_ops = {
34 .udelay = __loop_udelay, 34 .udelay = __loop_udelay,
35}; 35};
36 36
37#ifdef ARCH_HAS_READ_CURRENT_TIMER 37static const struct delay_timer *delay_timer;
38static bool delay_calibrated;
39
40int read_current_timer(unsigned long *timer_val)
41{
42 if (!delay_timer)
43 return -ENXIO;
44
45 *timer_val = delay_timer->read_current_timer();
46 return 0;
47}
48
38static void __timer_delay(unsigned long cycles) 49static void __timer_delay(unsigned long cycles)
39{ 50{
40 cycles_t start = get_cycles(); 51 cycles_t start = get_cycles();
@@ -55,18 +66,24 @@ static void __timer_udelay(unsigned long usecs)
55 __timer_const_udelay(usecs * UDELAY_MULT); 66 __timer_const_udelay(usecs * UDELAY_MULT);
56} 67}
57 68
58void __init init_current_timer_delay(unsigned long freq) 69void __init register_current_timer_delay(const struct delay_timer *timer)
59{ 70{
60 pr_info("Switching to timer-based delay loop\n"); 71 if (!delay_calibrated) {
61 lpj_fine = freq / HZ; 72 pr_info("Switching to timer-based delay loop\n");
62 loops_per_jiffy = lpj_fine; 73 delay_timer = timer;
63 arm_delay_ops.delay = __timer_delay; 74 lpj_fine = timer->freq / HZ;
64 arm_delay_ops.const_udelay = __timer_const_udelay; 75 loops_per_jiffy = lpj_fine;
65 arm_delay_ops.udelay = __timer_udelay; 76 arm_delay_ops.delay = __timer_delay;
77 arm_delay_ops.const_udelay = __timer_const_udelay;
78 arm_delay_ops.udelay = __timer_udelay;
79 delay_calibrated = true;
80 } else {
81 pr_info("Ignoring duplicate/late registration of read_current_timer delay\n");
82 }
66} 83}
67 84
68unsigned long __cpuinit calibrate_delay_is_known(void) 85unsigned long __cpuinit calibrate_delay_is_known(void)
69{ 86{
87 delay_calibrated = true;
70 return lpj_fine; 88 return lpj_fine;
71} 89}
72#endif
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 188c82971ebd..33361505c0cd 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -625,7 +625,7 @@ fail:
625 return 0; 625 return 0;
626} 626}
627 627
628static struct clk *const standard_pmc_clocks[] __initdata = { 628static struct clk *const standard_pmc_clocks[] __initconst = {
629 /* four primary clocks */ 629 /* four primary clocks */
630 &clk32k, 630 &clk32k,
631 &main_clk, 631 &main_clk,
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
index ac4e003ad863..be3099733b1f 100644
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c
@@ -88,7 +88,7 @@ static struct davinci_mmc_config mmc_config = {
88 .version = MMC_CTLR_VERSION_1, 88 .version = MMC_CTLR_VERSION_1,
89}; 89};
90 90
91static const short sdio1_pins[] __initdata = { 91static const short sdio1_pins[] __initconst = {
92 TNETV107X_SDIO1_CLK_1, TNETV107X_SDIO1_CMD_1, 92 TNETV107X_SDIO1_CLK_1, TNETV107X_SDIO1_CMD_1,
93 TNETV107X_SDIO1_DATA0_1, TNETV107X_SDIO1_DATA1_1, 93 TNETV107X_SDIO1_DATA0_1, TNETV107X_SDIO1_DATA1_1,
94 TNETV107X_SDIO1_DATA2_1, TNETV107X_SDIO1_DATA3_1, 94 TNETV107X_SDIO1_DATA2_1, TNETV107X_SDIO1_DATA3_1,
@@ -96,12 +96,12 @@ static const short sdio1_pins[] __initdata = {
96 -1 96 -1
97}; 97};
98 98
99static const short uart1_pins[] __initdata = { 99static const short uart1_pins[] __initconst = {
100 TNETV107X_UART1_RD, TNETV107X_UART1_TD, 100 TNETV107X_UART1_RD, TNETV107X_UART1_TD,
101 -1 101 -1
102}; 102};
103 103
104static const short ssp_pins[] __initdata = { 104static const short ssp_pins[] __initconst = {
105 TNETV107X_SSP0_0, TNETV107X_SSP0_1, TNETV107X_SSP0_2, 105 TNETV107X_SSP0_0, TNETV107X_SSP0_1, TNETV107X_SSP0_2,
106 TNETV107X_SSP1_0, TNETV107X_SSP1_1, TNETV107X_SSP1_2, 106 TNETV107X_SSP1_0, TNETV107X_SSP1_1, TNETV107X_SSP1_2,
107 TNETV107X_SSP1_3, -1 107 TNETV107X_SSP1_3, -1
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index deee5c2da754..510648e0394b 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -838,7 +838,7 @@ static const struct mux_config da830_pins[] = {
838#endif 838#endif
839}; 839};
840 840
841const short da830_emif25_pins[] __initdata = { 841const short da830_emif25_pins[] __initconst = {
842 DA830_EMA_D_0, DA830_EMA_D_1, DA830_EMA_D_2, DA830_EMA_D_3, 842 DA830_EMA_D_0, DA830_EMA_D_1, DA830_EMA_D_2, DA830_EMA_D_3,
843 DA830_EMA_D_4, DA830_EMA_D_5, DA830_EMA_D_6, DA830_EMA_D_7, 843 DA830_EMA_D_4, DA830_EMA_D_5, DA830_EMA_D_6, DA830_EMA_D_7,
844 DA830_EMA_D_8, DA830_EMA_D_9, DA830_EMA_D_10, DA830_EMA_D_11, 844 DA830_EMA_D_8, DA830_EMA_D_9, DA830_EMA_D_10, DA830_EMA_D_11,
@@ -853,19 +853,19 @@ const short da830_emif25_pins[] __initdata = {
853 -1 853 -1
854}; 854};
855 855
856const short da830_spi0_pins[] __initdata = { 856const short da830_spi0_pins[] __initconst = {
857 DA830_SPI0_SOMI_0, DA830_SPI0_SIMO_0, DA830_SPI0_CLK, DA830_NSPI0_ENA, 857 DA830_SPI0_SOMI_0, DA830_SPI0_SIMO_0, DA830_SPI0_CLK, DA830_NSPI0_ENA,
858 DA830_NSPI0_SCS_0, 858 DA830_NSPI0_SCS_0,
859 -1 859 -1
860}; 860};
861 861
862const short da830_spi1_pins[] __initdata = { 862const short da830_spi1_pins[] __initconst = {
863 DA830_SPI1_SOMI_0, DA830_SPI1_SIMO_0, DA830_SPI1_CLK, DA830_NSPI1_ENA, 863 DA830_SPI1_SOMI_0, DA830_SPI1_SIMO_0, DA830_SPI1_CLK, DA830_NSPI1_ENA,
864 DA830_NSPI1_SCS_0, 864 DA830_NSPI1_SCS_0,
865 -1 865 -1
866}; 866};
867 867
868const short da830_mmc_sd_pins[] __initdata = { 868const short da830_mmc_sd_pins[] __initconst = {
869 DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2, 869 DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2,
870 DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5, 870 DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5,
871 DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK, 871 DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK,
@@ -873,32 +873,32 @@ const short da830_mmc_sd_pins[] __initdata = {
873 -1 873 -1
874}; 874};
875 875
876const short da830_uart0_pins[] __initdata = { 876const short da830_uart0_pins[] __initconst = {
877 DA830_NUART0_CTS, DA830_NUART0_RTS, DA830_UART0_RXD, DA830_UART0_TXD, 877 DA830_NUART0_CTS, DA830_NUART0_RTS, DA830_UART0_RXD, DA830_UART0_TXD,
878 -1 878 -1
879}; 879};
880 880
881const short da830_uart1_pins[] __initdata = { 881const short da830_uart1_pins[] __initconst = {
882 DA830_UART1_RXD, DA830_UART1_TXD, 882 DA830_UART1_RXD, DA830_UART1_TXD,
883 -1 883 -1
884}; 884};
885 885
886const short da830_uart2_pins[] __initdata = { 886const short da830_uart2_pins[] __initconst = {
887 DA830_UART2_RXD, DA830_UART2_TXD, 887 DA830_UART2_RXD, DA830_UART2_TXD,
888 -1 888 -1
889}; 889};
890 890
891const short da830_usb20_pins[] __initdata = { 891const short da830_usb20_pins[] __initconst = {
892 DA830_USB0_DRVVBUS, DA830_USB_REFCLKIN, 892 DA830_USB0_DRVVBUS, DA830_USB_REFCLKIN,
893 -1 893 -1
894}; 894};
895 895
896const short da830_usb11_pins[] __initdata = { 896const short da830_usb11_pins[] __initconst = {
897 DA830_USB_REFCLKIN, 897 DA830_USB_REFCLKIN,
898 -1 898 -1
899}; 899};
900 900
901const short da830_uhpi_pins[] __initdata = { 901const short da830_uhpi_pins[] __initconst = {
902 DA830_UHPI_HD_0, DA830_UHPI_HD_1, DA830_UHPI_HD_2, DA830_UHPI_HD_3, 902 DA830_UHPI_HD_0, DA830_UHPI_HD_1, DA830_UHPI_HD_2, DA830_UHPI_HD_3,
903 DA830_UHPI_HD_4, DA830_UHPI_HD_5, DA830_UHPI_HD_6, DA830_UHPI_HD_7, 903 DA830_UHPI_HD_4, DA830_UHPI_HD_5, DA830_UHPI_HD_6, DA830_UHPI_HD_7,
904 DA830_UHPI_HD_8, DA830_UHPI_HD_9, DA830_UHPI_HD_10, DA830_UHPI_HD_11, 904 DA830_UHPI_HD_8, DA830_UHPI_HD_9, DA830_UHPI_HD_10, DA830_UHPI_HD_11,
@@ -909,14 +909,14 @@ const short da830_uhpi_pins[] __initdata = {
909 -1 909 -1
910}; 910};
911 911
912const short da830_cpgmac_pins[] __initdata = { 912const short da830_cpgmac_pins[] __initconst = {
913 DA830_RMII_TXD_0, DA830_RMII_TXD_1, DA830_RMII_TXEN, DA830_RMII_CRS_DV, 913 DA830_RMII_TXD_0, DA830_RMII_TXD_1, DA830_RMII_TXEN, DA830_RMII_CRS_DV,
914 DA830_RMII_RXD_0, DA830_RMII_RXD_1, DA830_RMII_RXER, DA830_MDIO_CLK, 914 DA830_RMII_RXD_0, DA830_RMII_RXD_1, DA830_RMII_RXER, DA830_MDIO_CLK,
915 DA830_MDIO_D, 915 DA830_MDIO_D,
916 -1 916 -1
917}; 917};
918 918
919const short da830_emif3c_pins[] __initdata = { 919const short da830_emif3c_pins[] __initconst = {
920 DA830_EMB_SDCKE, DA830_EMB_CLK_GLUE, DA830_EMB_CLK, DA830_NEMB_CS_0, 920 DA830_EMB_SDCKE, DA830_EMB_CLK_GLUE, DA830_EMB_CLK, DA830_NEMB_CS_0,
921 DA830_NEMB_CAS, DA830_NEMB_RAS, DA830_NEMB_WE, DA830_EMB_BA_1, 921 DA830_NEMB_CAS, DA830_NEMB_RAS, DA830_NEMB_WE, DA830_EMB_BA_1,
922 DA830_EMB_BA_0, DA830_EMB_A_0, DA830_EMB_A_1, DA830_EMB_A_2, 922 DA830_EMB_BA_0, DA830_EMB_A_0, DA830_EMB_A_1, DA830_EMB_A_2,
@@ -935,7 +935,7 @@ const short da830_emif3c_pins[] __initdata = {
935 -1 935 -1
936}; 936};
937 937
938const short da830_mcasp0_pins[] __initdata = { 938const short da830_mcasp0_pins[] __initconst = {
939 DA830_AHCLKX0, DA830_ACLKX0, DA830_AFSX0, 939 DA830_AHCLKX0, DA830_ACLKX0, DA830_AFSX0,
940 DA830_AHCLKR0, DA830_ACLKR0, DA830_AFSR0, DA830_AMUTE0, 940 DA830_AHCLKR0, DA830_ACLKR0, DA830_AFSR0, DA830_AMUTE0,
941 DA830_AXR0_0, DA830_AXR0_1, DA830_AXR0_2, DA830_AXR0_3, 941 DA830_AXR0_0, DA830_AXR0_1, DA830_AXR0_2, DA830_AXR0_3,
@@ -945,7 +945,7 @@ const short da830_mcasp0_pins[] __initdata = {
945 -1 945 -1
946}; 946};
947 947
948const short da830_mcasp1_pins[] __initdata = { 948const short da830_mcasp1_pins[] __initconst = {
949 DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1, 949 DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1,
950 DA830_AHCLKR1, DA830_ACLKR1, DA830_AFSR1, DA830_AMUTE1, 950 DA830_AHCLKR1, DA830_ACLKR1, DA830_AFSR1, DA830_AMUTE1,
951 DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_3, 951 DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_3,
@@ -954,24 +954,24 @@ const short da830_mcasp1_pins[] __initdata = {
954 -1 954 -1
955}; 955};
956 956
957const short da830_mcasp2_pins[] __initdata = { 957const short da830_mcasp2_pins[] __initconst = {
958 DA830_AHCLKX2, DA830_ACLKX2, DA830_AFSX2, 958 DA830_AHCLKX2, DA830_ACLKX2, DA830_AFSX2,
959 DA830_AHCLKR2, DA830_ACLKR2, DA830_AFSR2, DA830_AMUTE2, 959 DA830_AHCLKR2, DA830_ACLKR2, DA830_AFSR2, DA830_AMUTE2,
960 DA830_AXR2_0, DA830_AXR2_1, DA830_AXR2_2, DA830_AXR2_3, 960 DA830_AXR2_0, DA830_AXR2_1, DA830_AXR2_2, DA830_AXR2_3,
961 -1 961 -1
962}; 962};
963 963
964const short da830_i2c0_pins[] __initdata = { 964const short da830_i2c0_pins[] __initconst = {
965 DA830_I2C0_SDA, DA830_I2C0_SCL, 965 DA830_I2C0_SDA, DA830_I2C0_SCL,
966 -1 966 -1
967}; 967};
968 968
969const short da830_i2c1_pins[] __initdata = { 969const short da830_i2c1_pins[] __initconst = {
970 DA830_I2C1_SCL, DA830_I2C1_SDA, 970 DA830_I2C1_SCL, DA830_I2C1_SDA,
971 -1 971 -1
972}; 972};
973 973
974const short da830_lcdcntl_pins[] __initdata = { 974const short da830_lcdcntl_pins[] __initconst = {
975 DA830_LCD_D_0, DA830_LCD_D_1, DA830_LCD_D_2, DA830_LCD_D_3, 975 DA830_LCD_D_0, DA830_LCD_D_1, DA830_LCD_D_2, DA830_LCD_D_3,
976 DA830_LCD_D_4, DA830_LCD_D_5, DA830_LCD_D_6, DA830_LCD_D_7, 976 DA830_LCD_D_4, DA830_LCD_D_5, DA830_LCD_D_6, DA830_LCD_D_7,
977 DA830_LCD_D_8, DA830_LCD_D_9, DA830_LCD_D_10, DA830_LCD_D_11, 977 DA830_LCD_D_8, DA830_LCD_D_9, DA830_LCD_D_10, DA830_LCD_D_11,
@@ -981,34 +981,34 @@ const short da830_lcdcntl_pins[] __initdata = {
981 -1 981 -1
982}; 982};
983 983
984const short da830_pwm_pins[] __initdata = { 984const short da830_pwm_pins[] __initconst = {
985 DA830_ECAP0_APWM0, DA830_ECAP1_APWM1, DA830_EPWM0B, DA830_EPWM0A, 985 DA830_ECAP0_APWM0, DA830_ECAP1_APWM1, DA830_EPWM0B, DA830_EPWM0A,
986 DA830_EPWMSYNCI, DA830_EPWMSYNC0, DA830_ECAP2_APWM2, DA830_EHRPWMGLUETZ, 986 DA830_EPWMSYNCI, DA830_EPWMSYNC0, DA830_ECAP2_APWM2, DA830_EHRPWMGLUETZ,
987 DA830_EPWM2B, DA830_EPWM2A, DA830_EPWM1B, DA830_EPWM1A, 987 DA830_EPWM2B, DA830_EPWM2A, DA830_EPWM1B, DA830_EPWM1A,
988 -1 988 -1
989}; 989};
990 990
991const short da830_ecap0_pins[] __initdata = { 991const short da830_ecap0_pins[] __initconst = {
992 DA830_ECAP0_APWM0, 992 DA830_ECAP0_APWM0,
993 -1 993 -1
994}; 994};
995 995
996const short da830_ecap1_pins[] __initdata = { 996const short da830_ecap1_pins[] __initconst = {
997 DA830_ECAP1_APWM1, 997 DA830_ECAP1_APWM1,
998 -1 998 -1
999}; 999};
1000 1000
1001const short da830_ecap2_pins[] __initdata = { 1001const short da830_ecap2_pins[] __initconst = {
1002 DA830_ECAP2_APWM2, 1002 DA830_ECAP2_APWM2,
1003 -1 1003 -1
1004}; 1004};
1005 1005
1006const short da830_eqep0_pins[] __initdata = { 1006const short da830_eqep0_pins[] __initconst = {
1007 DA830_EQEP0I, DA830_EQEP0S, DA830_EQEP0A, DA830_EQEP0B, 1007 DA830_EQEP0I, DA830_EQEP0S, DA830_EQEP0A, DA830_EQEP0B,
1008 -1 1008 -1
1009}; 1009};
1010 1010
1011const short da830_eqep1_pins[] __initdata = { 1011const short da830_eqep1_pins[] __initconst = {
1012 DA830_EQEP1I, DA830_EQEP1S, DA830_EQEP1A, DA830_EQEP1B, 1012 DA830_EQEP1I, DA830_EQEP1S, DA830_EQEP1A, DA830_EQEP1B,
1013 -1 1013 -1
1014}; 1014};
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index b44dc844e15e..6676dee7104e 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -576,17 +576,17 @@ static const struct mux_config da850_pins[] = {
576#endif 576#endif
577}; 577};
578 578
579const short da850_i2c0_pins[] __initdata = { 579const short da850_i2c0_pins[] __initconst = {
580 DA850_I2C0_SDA, DA850_I2C0_SCL, 580 DA850_I2C0_SDA, DA850_I2C0_SCL,
581 -1 581 -1
582}; 582};
583 583
584const short da850_i2c1_pins[] __initdata = { 584const short da850_i2c1_pins[] __initconst = {
585 DA850_I2C1_SCL, DA850_I2C1_SDA, 585 DA850_I2C1_SCL, DA850_I2C1_SDA,
586 -1 586 -1
587}; 587};
588 588
589const short da850_lcdcntl_pins[] __initdata = { 589const short da850_lcdcntl_pins[] __initconst = {
590 DA850_LCD_D_0, DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3, 590 DA850_LCD_D_0, DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3,
591 DA850_LCD_D_4, DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7, 591 DA850_LCD_D_4, DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7,
592 DA850_LCD_D_8, DA850_LCD_D_9, DA850_LCD_D_10, DA850_LCD_D_11, 592 DA850_LCD_D_8, DA850_LCD_D_9, DA850_LCD_D_10, DA850_LCD_D_11,
diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig
index dd937c526a45..00154e74ce6b 100644
--- a/arch/arm/mach-dove/Kconfig
+++ b/arch/arm/mach-dove/Kconfig
@@ -15,6 +15,13 @@ config MACH_CM_A510
15 Say 'Y' here if you want your kernel to support the 15 Say 'Y' here if you want your kernel to support the
16 CompuLab CM-A510 Board. 16 CompuLab CM-A510 Board.
17 17
18config MACH_DOVE_DT
19 bool "Marvell Dove Flattened Device Tree"
20 select USE_OF
21 help
22 Say 'Y' here if you want your kernel to support the
23 Marvell Dove using flattened device tree.
24
18endmenu 25endmenu
19 26
20endif 27endif
diff --git a/arch/arm/mach-dove/Makefile b/arch/arm/mach-dove/Makefile
index fa0f01856060..5e683baf96cf 100644
--- a/arch/arm/mach-dove/Makefile
+++ b/arch/arm/mach-dove/Makefile
@@ -1,4 +1,4 @@
1obj-y += common.o addr-map.o irq.o pcie.o mpp.o 1obj-y += common.o addr-map.o irq.o mpp.o
2 2obj-$(CONFIG_PCI) += pcie.o
3obj-$(CONFIG_MACH_DOVE_DB) += dove-db-setup.o 3obj-$(CONFIG_MACH_DOVE_DB) += dove-db-setup.o
4obj-$(CONFIG_MACH_CM_A510) += cm-a510.o 4obj-$(CONFIG_MACH_CM_A510) += cm-a510.o
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 950ad9533d19..b37bef1d5ffa 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -16,6 +16,8 @@
16#include <linux/clk-provider.h> 16#include <linux/clk-provider.h>
17#include <linux/ata_platform.h> 17#include <linux/ata_platform.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/of.h>
20#include <linux/of_platform.h>
19#include <asm/page.h> 21#include <asm/page.h>
20#include <asm/setup.h> 22#include <asm/setup.h>
21#include <asm/timex.h> 23#include <asm/timex.h>
@@ -24,6 +26,7 @@
24#include <asm/mach/time.h> 26#include <asm/mach/time.h>
25#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
26#include <mach/dove.h> 28#include <mach/dove.h>
29#include <mach/pm.h>
27#include <mach/bridge-regs.h> 30#include <mach/bridge-regs.h>
28#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
29#include <linux/irq.h> 32#include <linux/irq.h>
@@ -33,19 +36,17 @@
33#include <plat/addr-map.h> 36#include <plat/addr-map.h>
34#include "common.h" 37#include "common.h"
35 38
36static int get_tclk(void);
37
38/***************************************************************************** 39/*****************************************************************************
39 * I/O Address Mapping 40 * I/O Address Mapping
40 ****************************************************************************/ 41 ****************************************************************************/
41static struct map_desc dove_io_desc[] __initdata = { 42static struct map_desc dove_io_desc[] __initdata = {
42 { 43 {
43 .virtual = DOVE_SB_REGS_VIRT_BASE, 44 .virtual = (unsigned long) DOVE_SB_REGS_VIRT_BASE,
44 .pfn = __phys_to_pfn(DOVE_SB_REGS_PHYS_BASE), 45 .pfn = __phys_to_pfn(DOVE_SB_REGS_PHYS_BASE),
45 .length = DOVE_SB_REGS_SIZE, 46 .length = DOVE_SB_REGS_SIZE,
46 .type = MT_DEVICE, 47 .type = MT_DEVICE,
47 }, { 48 }, {
48 .virtual = DOVE_NB_REGS_VIRT_BASE, 49 .virtual = (unsigned long) DOVE_NB_REGS_VIRT_BASE,
49 .pfn = __phys_to_pfn(DOVE_NB_REGS_PHYS_BASE), 50 .pfn = __phys_to_pfn(DOVE_NB_REGS_PHYS_BASE),
50 .length = DOVE_NB_REGS_SIZE, 51 .length = DOVE_NB_REGS_SIZE,
51 .type = MT_DEVICE, 52 .type = MT_DEVICE,
@@ -60,14 +61,69 @@ void __init dove_map_io(void)
60/***************************************************************************** 61/*****************************************************************************
61 * CLK tree 62 * CLK tree
62 ****************************************************************************/ 63 ****************************************************************************/
64static int dove_tclk;
65
66static DEFINE_SPINLOCK(gating_lock);
63static struct clk *tclk; 67static struct clk *tclk;
64 68
65static void __init clk_init(void) 69static struct clk __init *dove_register_gate(const char *name,
70 const char *parent, u8 bit_idx)
66{ 71{
67 tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, 72 return clk_register_gate(NULL, name, parent, 0,
68 get_tclk()); 73 (void __iomem *)CLOCK_GATING_CONTROL,
74 bit_idx, 0, &gating_lock);
75}
76
77static void __init dove_clk_init(void)
78{
79 struct clk *usb0, *usb1, *sata, *pex0, *pex1, *sdio0, *sdio1;
80 struct clk *nand, *camera, *i2s0, *i2s1, *crypto, *ac97, *pdma;
81 struct clk *xor0, *xor1, *ge, *gephy;
69 82
70 orion_clkdev_init(tclk); 83 tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
84 dove_tclk);
85
86 usb0 = dove_register_gate("usb0", "tclk", CLOCK_GATING_BIT_USB0);
87 usb1 = dove_register_gate("usb1", "tclk", CLOCK_GATING_BIT_USB1);
88 sata = dove_register_gate("sata", "tclk", CLOCK_GATING_BIT_SATA);
89 pex0 = dove_register_gate("pex0", "tclk", CLOCK_GATING_BIT_PCIE0);
90 pex1 = dove_register_gate("pex1", "tclk", CLOCK_GATING_BIT_PCIE1);
91 sdio0 = dove_register_gate("sdio0", "tclk", CLOCK_GATING_BIT_SDIO0);
92 sdio1 = dove_register_gate("sdio1", "tclk", CLOCK_GATING_BIT_SDIO1);
93 nand = dove_register_gate("nand", "tclk", CLOCK_GATING_BIT_NAND);
94 camera = dove_register_gate("camera", "tclk", CLOCK_GATING_BIT_CAMERA);
95 i2s0 = dove_register_gate("i2s0", "tclk", CLOCK_GATING_BIT_I2S0);
96 i2s1 = dove_register_gate("i2s1", "tclk", CLOCK_GATING_BIT_I2S1);
97 crypto = dove_register_gate("crypto", "tclk", CLOCK_GATING_BIT_CRYPTO);
98 ac97 = dove_register_gate("ac97", "tclk", CLOCK_GATING_BIT_AC97);
99 pdma = dove_register_gate("pdma", "tclk", CLOCK_GATING_BIT_PDMA);
100 xor0 = dove_register_gate("xor0", "tclk", CLOCK_GATING_BIT_XOR0);
101 xor1 = dove_register_gate("xor1", "tclk", CLOCK_GATING_BIT_XOR1);
102 gephy = dove_register_gate("gephy", "tclk", CLOCK_GATING_BIT_GIGA_PHY);
103 ge = dove_register_gate("ge", "gephy", CLOCK_GATING_BIT_GBE);
104
105 orion_clkdev_add(NULL, "orion_spi.0", tclk);
106 orion_clkdev_add(NULL, "orion_spi.1", tclk);
107 orion_clkdev_add(NULL, "orion_wdt", tclk);
108 orion_clkdev_add(NULL, "mv64xxx_i2c.0", tclk);
109
110 orion_clkdev_add(NULL, "orion-ehci.0", usb0);
111 orion_clkdev_add(NULL, "orion-ehci.1", usb1);
112 orion_clkdev_add(NULL, "mv643xx_eth.0", ge);
113 orion_clkdev_add("0", "sata_mv.0", sata);
114 orion_clkdev_add("0", "pcie", pex0);
115 orion_clkdev_add("1", "pcie", pex1);
116 orion_clkdev_add(NULL, "sdhci-dove.0", sdio0);
117 orion_clkdev_add(NULL, "sdhci-dove.1", sdio1);
118 orion_clkdev_add(NULL, "orion_nand", nand);
119 orion_clkdev_add(NULL, "cafe1000-ccic.0", camera);
120 orion_clkdev_add(NULL, "kirkwood-i2s.0", i2s0);
121 orion_clkdev_add(NULL, "kirkwood-i2s.1", i2s1);
122 orion_clkdev_add(NULL, "mv_crypto", crypto);
123 orion_clkdev_add(NULL, "dove-ac97", ac97);
124 orion_clkdev_add(NULL, "dove-pdma", pdma);
125 orion_clkdev_add(NULL, "mv_xor_shared.0", xor0);
126 orion_clkdev_add(NULL, "mv_xor_shared.1", xor1);
71} 127}
72 128
73/***************************************************************************** 129/*****************************************************************************
@@ -178,16 +234,16 @@ void __init dove_init_early(void)
178 orion_time_set_base(TIMER_VIRT_BASE); 234 orion_time_set_base(TIMER_VIRT_BASE);
179} 235}
180 236
181static int get_tclk(void) 237static int __init dove_find_tclk(void)
182{ 238{
183 /* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
184 return 166666667; 239 return 166666667;
185} 240}
186 241
187static void __init dove_timer_init(void) 242static void __init dove_timer_init(void)
188{ 243{
244 dove_tclk = dove_find_tclk();
189 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR, 245 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
190 IRQ_DOVE_BRIDGE, get_tclk()); 246 IRQ_DOVE_BRIDGE, dove_tclk);
191} 247}
192 248
193struct sys_timer dove_timer = { 249struct sys_timer dove_timer = {
@@ -195,6 +251,15 @@ struct sys_timer dove_timer = {
195}; 251};
196 252
197/***************************************************************************** 253/*****************************************************************************
254 * Cryptographic Engines and Security Accelerator (CESA)
255 ****************************************************************************/
256void __init dove_crypto_init(void)
257{
258 orion_crypto_init(DOVE_CRYPT_PHYS_BASE, DOVE_CESA_PHYS_BASE,
259 DOVE_CESA_SIZE, IRQ_DOVE_CRYPTO);
260}
261
262/*****************************************************************************
198 * XOR 0 263 * XOR 0
199 ****************************************************************************/ 264 ****************************************************************************/
200void __init dove_xor0_init(void) 265void __init dove_xor0_init(void)
@@ -275,8 +340,8 @@ void __init dove_sdio1_init(void)
275 340
276void __init dove_init(void) 341void __init dove_init(void)
277{ 342{
278 printk(KERN_INFO "Dove 88AP510 SoC, "); 343 pr_info("Dove 88AP510 SoC, TCLK = %d MHz.\n",
279 printk(KERN_INFO "TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000); 344 (dove_tclk + 499999) / 1000000);
280 345
281#ifdef CONFIG_CACHE_TAUROS2 346#ifdef CONFIG_CACHE_TAUROS2
282 tauros2_init(0); 347 tauros2_init(0);
@@ -284,7 +349,7 @@ void __init dove_init(void)
284 dove_setup_cpu_mbus(); 349 dove_setup_cpu_mbus();
285 350
286 /* Setup root of clk tree */ 351 /* Setup root of clk tree */
287 clk_init(); 352 dove_clk_init();
288 353
289 /* internal devices that every board has */ 354 /* internal devices that every board has */
290 dove_rtc_init(); 355 dove_rtc_init();
@@ -307,3 +372,67 @@ void dove_restart(char mode, const char *cmd)
307 while (1) 372 while (1)
308 ; 373 ;
309} 374}
375
376#if defined(CONFIG_MACH_DOVE_DT)
377/*
378 * Auxdata required until real OF clock provider
379 */
380struct of_dev_auxdata dove_auxdata_lookup[] __initdata = {
381 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
382 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1014600, "orion_spi.1", NULL),
383 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
384 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
385 NULL),
386 OF_DEV_AUXDATA("marvell,orion-sata", 0xf10a0000, "sata_mv.0", NULL),
387 OF_DEV_AUXDATA("marvell,dove-sdhci", 0xf1092000, "sdhci-dove.0", NULL),
388 OF_DEV_AUXDATA("marvell,dove-sdhci", 0xf1090000, "sdhci-dove.1", NULL),
389 {},
390};
391
392static struct mv643xx_eth_platform_data dove_dt_ge00_data = {
393 .phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT,
394};
395
396static void __init dove_dt_init(void)
397{
398 pr_info("Dove 88AP510 SoC, TCLK = %d MHz.\n",
399 (dove_tclk + 499999) / 1000000);
400
401#ifdef CONFIG_CACHE_TAUROS2
402 tauros2_init();
403#endif
404 dove_setup_cpu_mbus();
405
406 /* Setup root of clk tree */
407 dove_clk_init();
408
409 /* Internal devices not ported to DT yet */
410 dove_rtc_init();
411 dove_xor0_init();
412 dove_xor1_init();
413
414 dove_ge00_init(&dove_dt_ge00_data);
415 dove_ehci0_init();
416 dove_ehci1_init();
417 dove_pcie_init(1, 1);
418 dove_crypto_init();
419
420 of_platform_populate(NULL, of_default_bus_match_table,
421 dove_auxdata_lookup, NULL);
422}
423
424static const char * const dove_dt_board_compat[] = {
425 "marvell,dove",
426 NULL
427};
428
429DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)")
430 .map_io = dove_map_io,
431 .init_early = dove_init_early,
432 .init_irq = orion_dt_init_irq,
433 .timer = &dove_timer,
434 .init_machine = dove_dt_init,
435 .restart = dove_restart,
436 .dt_compat = dove_dt_board_compat,
437MACHINE_END
438#endif
diff --git a/arch/arm/mach-dove/common.h b/arch/arm/mach-dove/common.h
index 6432a3ba864b..1a233404b735 100644
--- a/arch/arm/mach-dove/common.h
+++ b/arch/arm/mach-dove/common.h
@@ -26,7 +26,11 @@ void dove_init_irq(void);
26void dove_setup_cpu_mbus(void); 26void dove_setup_cpu_mbus(void);
27void dove_ge00_init(struct mv643xx_eth_platform_data *eth_data); 27void dove_ge00_init(struct mv643xx_eth_platform_data *eth_data);
28void dove_sata_init(struct mv_sata_platform_data *sata_data); 28void dove_sata_init(struct mv_sata_platform_data *sata_data);
29#ifdef CONFIG_PCI
29void dove_pcie_init(int init_port0, int init_port1); 30void dove_pcie_init(int init_port0, int init_port1);
31#else
32static inline void dove_pcie_init(int init_port0, int init_port1) { }
33#endif
30void dove_ehci0_init(void); 34void dove_ehci0_init(void);
31void dove_ehci1_init(void); 35void dove_ehci1_init(void);
32void dove_uart0_init(void); 36void dove_uart0_init(void);
diff --git a/arch/arm/mach-dove/include/mach/bridge-regs.h b/arch/arm/mach-dove/include/mach/bridge-regs.h
index f953bb54aa9d..99f259e8cf33 100644
--- a/arch/arm/mach-dove/include/mach/bridge-regs.h
+++ b/arch/arm/mach-dove/include/mach/bridge-regs.h
@@ -13,22 +13,22 @@
13 13
14#include <mach/dove.h> 14#include <mach/dove.h>
15 15
16#define CPU_CONFIG (BRIDGE_VIRT_BASE | 0x0000) 16#define CPU_CONFIG (BRIDGE_VIRT_BASE + 0x0000)
17 17
18#define CPU_CONTROL (BRIDGE_VIRT_BASE | 0x0104) 18#define CPU_CONTROL (BRIDGE_VIRT_BASE + 0x0104)
19#define CPU_CTRL_PCIE0_LINK 0x00000001 19#define CPU_CTRL_PCIE0_LINK 0x00000001
20#define CPU_RESET 0x00000002 20#define CPU_RESET 0x00000002
21#define CPU_CTRL_PCIE1_LINK 0x00000008 21#define CPU_CTRL_PCIE1_LINK 0x00000008
22 22
23#define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108) 23#define RSTOUTn_MASK (BRIDGE_VIRT_BASE + 0x0108)
24#define SOFT_RESET_OUT_EN 0x00000004 24#define SOFT_RESET_OUT_EN 0x00000004
25 25
26#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c) 26#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE + 0x010c)
27#define SOFT_RESET 0x00000001 27#define SOFT_RESET 0x00000001
28 28
29#define BRIDGE_INT_TIMER1_CLR (~0x0004) 29#define BRIDGE_INT_TIMER1_CLR (~0x0004)
30 30
31#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200) 31#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0200)
32#define IRQ_CAUSE_LOW_OFF 0x0000 32#define IRQ_CAUSE_LOW_OFF 0x0000
33#define IRQ_MASK_LOW_OFF 0x0004 33#define IRQ_MASK_LOW_OFF 0x0004
34#define FIQ_MASK_LOW_OFF 0x0008 34#define FIQ_MASK_LOW_OFF 0x0008
@@ -47,9 +47,9 @@
47#define ENDPOINT_MASK_HIGH (IRQ_VIRT_BASE + ENDPOINT_MASK_HIGH_OFF) 47#define ENDPOINT_MASK_HIGH (IRQ_VIRT_BASE + ENDPOINT_MASK_HIGH_OFF)
48#define PCIE_INTERRUPT_MASK (IRQ_VIRT_BASE + PCIE_INTERRUPT_MASK_OFF) 48#define PCIE_INTERRUPT_MASK (IRQ_VIRT_BASE + PCIE_INTERRUPT_MASK_OFF)
49 49
50#define POWER_MANAGEMENT (BRIDGE_VIRT_BASE | 0x011c) 50#define POWER_MANAGEMENT (BRIDGE_VIRT_BASE + 0x011c)
51 51
52#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300) 52#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0300)
53#define TIMER_PHYS_BASE (BRIDGE_PHYS_BASE | 0x0300) 53#define TIMER_PHYS_BASE (BRIDGE_PHYS_BASE + 0x0300)
54 54
55#endif 55#endif
diff --git a/arch/arm/mach-dove/include/mach/dove.h b/arch/arm/mach-dove/include/mach/dove.h
index c91e3004a47b..661725e3115a 100644
--- a/arch/arm/mach-dove/include/mach/dove.h
+++ b/arch/arm/mach-dove/include/mach/dove.h
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#define DOVE_CESA_PHYS_BASE 0xc8000000 27#define DOVE_CESA_PHYS_BASE 0xc8000000
28#define DOVE_CESA_VIRT_BASE 0xfdb00000 28#define DOVE_CESA_VIRT_BASE IOMEM(0xfdb00000)
29#define DOVE_CESA_SIZE SZ_1M 29#define DOVE_CESA_SIZE SZ_1M
30 30
31#define DOVE_PCIE0_MEM_PHYS_BASE 0xe0000000 31#define DOVE_PCIE0_MEM_PHYS_BASE 0xe0000000
@@ -38,15 +38,15 @@
38#define DOVE_BOOTROM_SIZE SZ_128M 38#define DOVE_BOOTROM_SIZE SZ_128M
39 39
40#define DOVE_SCRATCHPAD_PHYS_BASE 0xf0000000 40#define DOVE_SCRATCHPAD_PHYS_BASE 0xf0000000
41#define DOVE_SCRATCHPAD_VIRT_BASE 0xfdd00000 41#define DOVE_SCRATCHPAD_VIRT_BASE IOMEM(0xfdd00000)
42#define DOVE_SCRATCHPAD_SIZE SZ_1M 42#define DOVE_SCRATCHPAD_SIZE SZ_1M
43 43
44#define DOVE_SB_REGS_PHYS_BASE 0xf1000000 44#define DOVE_SB_REGS_PHYS_BASE 0xf1000000
45#define DOVE_SB_REGS_VIRT_BASE 0xfde00000 45#define DOVE_SB_REGS_VIRT_BASE IOMEM(0xfde00000)
46#define DOVE_SB_REGS_SIZE SZ_8M 46#define DOVE_SB_REGS_SIZE SZ_8M
47 47
48#define DOVE_NB_REGS_PHYS_BASE 0xf1800000 48#define DOVE_NB_REGS_PHYS_BASE 0xf1800000
49#define DOVE_NB_REGS_VIRT_BASE 0xfe600000 49#define DOVE_NB_REGS_VIRT_BASE IOMEM(0xfe600000)
50#define DOVE_NB_REGS_SIZE SZ_8M 50#define DOVE_NB_REGS_SIZE SZ_8M
51 51
52#define DOVE_PCIE0_IO_PHYS_BASE 0xf2000000 52#define DOVE_PCIE0_IO_PHYS_BASE 0xf2000000
@@ -62,75 +62,75 @@
62 */ 62 */
63 63
64/* SPI, I2C, UART */ 64/* SPI, I2C, UART */
65#define DOVE_I2C_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x11000) 65#define DOVE_I2C_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x11000)
66#define DOVE_UART0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x12000) 66#define DOVE_UART0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x12000)
67#define DOVE_UART0_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x12000) 67#define DOVE_UART0_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x12000)
68#define DOVE_UART1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x12100) 68#define DOVE_UART1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x12100)
69#define DOVE_UART1_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x12100) 69#define DOVE_UART1_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x12100)
70#define DOVE_UART2_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x12200) 70#define DOVE_UART2_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x12200)
71#define DOVE_UART2_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x12200) 71#define DOVE_UART2_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x12200)
72#define DOVE_UART3_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x12300) 72#define DOVE_UART3_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x12300)
73#define DOVE_UART3_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x12300) 73#define DOVE_UART3_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x12300)
74#define DOVE_SPI0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x10600) 74#define DOVE_SPI0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x10600)
75#define DOVE_SPI1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x14600) 75#define DOVE_SPI1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x14600)
76 76
77/* North-South Bridge */ 77/* North-South Bridge */
78#define BRIDGE_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x20000) 78#define BRIDGE_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x20000)
79#define BRIDGE_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x20000) 79#define BRIDGE_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x20000)
80 80
81/* Cryptographic Engine */ 81/* Cryptographic Engine */
82#define DOVE_CRYPT_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x30000) 82#define DOVE_CRYPT_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x30000)
83 83
84/* PCIe 0 */ 84/* PCIe 0 */
85#define DOVE_PCIE0_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x40000) 85#define DOVE_PCIE0_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x40000)
86 86
87/* USB */ 87/* USB */
88#define DOVE_USB0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x50000) 88#define DOVE_USB0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x50000)
89#define DOVE_USB1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x51000) 89#define DOVE_USB1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x51000)
90 90
91/* XOR 0 Engine */ 91/* XOR 0 Engine */
92#define DOVE_XOR0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x60800) 92#define DOVE_XOR0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x60800)
93#define DOVE_XOR0_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x60800) 93#define DOVE_XOR0_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x60800)
94#define DOVE_XOR0_HIGH_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x60A00) 94#define DOVE_XOR0_HIGH_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x60A00)
95#define DOVE_XOR0_HIGH_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x60A00) 95#define DOVE_XOR0_HIGH_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x60A00)
96 96
97/* XOR 1 Engine */ 97/* XOR 1 Engine */
98#define DOVE_XOR1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x60900) 98#define DOVE_XOR1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x60900)
99#define DOVE_XOR1_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x60900) 99#define DOVE_XOR1_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x60900)
100#define DOVE_XOR1_HIGH_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x60B00) 100#define DOVE_XOR1_HIGH_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x60B00)
101#define DOVE_XOR1_HIGH_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x60B00) 101#define DOVE_XOR1_HIGH_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x60B00)
102 102
103/* Gigabit Ethernet */ 103/* Gigabit Ethernet */
104#define DOVE_GE00_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x70000) 104#define DOVE_GE00_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x70000)
105 105
106/* PCIe 1 */ 106/* PCIe 1 */
107#define DOVE_PCIE1_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x80000) 107#define DOVE_PCIE1_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x80000)
108 108
109/* CAFE */ 109/* CAFE */
110#define DOVE_SDIO0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x92000) 110#define DOVE_SDIO0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x92000)
111#define DOVE_SDIO1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x90000) 111#define DOVE_SDIO1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x90000)
112#define DOVE_CAM_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x94000) 112#define DOVE_CAM_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x94000)
113#define DOVE_CAFE_WIN_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x98000) 113#define DOVE_CAFE_WIN_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x98000)
114 114
115/* SATA */ 115/* SATA */
116#define DOVE_SATA_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0xa0000) 116#define DOVE_SATA_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0xa0000)
117 117
118/* I2S/SPDIF */ 118/* I2S/SPDIF */
119#define DOVE_AUD0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0xb0000) 119#define DOVE_AUD0_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0xb0000)
120#define DOVE_AUD1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0xb4000) 120#define DOVE_AUD1_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0xb4000)
121 121
122/* NAND Flash Controller */ 122/* NAND Flash Controller */
123#define DOVE_NFC_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0xc0000) 123#define DOVE_NFC_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0xc0000)
124 124
125/* MPP, GPIO, Reset Sampling */ 125/* MPP, GPIO, Reset Sampling */
126#define DOVE_MPP_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xd0200) 126#define DOVE_MPP_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0200)
127#define DOVE_PMU_MPP_GENERAL_CTRL (DOVE_MPP_VIRT_BASE + 0x10) 127#define DOVE_PMU_MPP_GENERAL_CTRL (DOVE_MPP_VIRT_BASE + 0x10)
128#define DOVE_RESET_SAMPLE_LO (DOVE_MPP_VIRT_BASE | 0x014) 128#define DOVE_RESET_SAMPLE_LO (DOVE_MPP_VIRT_BASE + 0x014)
129#define DOVE_RESET_SAMPLE_HI (DOVE_MPP_VIRT_BASE | 0x018) 129#define DOVE_RESET_SAMPLE_HI (DOVE_MPP_VIRT_BASE + 0x018)
130#define DOVE_GPIO_LO_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xd0400) 130#define DOVE_GPIO_LO_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0400)
131#define DOVE_GPIO_HI_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xd0420) 131#define DOVE_GPIO_HI_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0420)
132#define DOVE_GPIO2_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xe8400) 132#define DOVE_GPIO2_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xe8400)
133#define DOVE_MPP_GENERAL_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xe803c) 133#define DOVE_MPP_GENERAL_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xe803c)
134#define DOVE_AU1_SPDIFO_GPIO_EN (1 << 1) 134#define DOVE_AU1_SPDIFO_GPIO_EN (1 << 1)
135#define DOVE_NAND_GPIO_EN (1 << 0) 135#define DOVE_NAND_GPIO_EN (1 << 0)
136#define DOVE_MPP_CTRL4_VIRT_BASE (DOVE_GPIO_LO_VIRT_BASE + 0x40) 136#define DOVE_MPP_CTRL4_VIRT_BASE (DOVE_GPIO_LO_VIRT_BASE + 0x40)
@@ -142,44 +142,44 @@
142#define DOVE_SD0_GPIO_SEL (1 << 0) 142#define DOVE_SD0_GPIO_SEL (1 << 0)
143 143
144/* Power Management */ 144/* Power Management */
145#define DOVE_PMU_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xd0000) 145#define DOVE_PMU_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0000)
146#define DOVE_PMU_SIG_CTRL (DOVE_PMU_VIRT_BASE + 0x802c) 146#define DOVE_PMU_SIG_CTRL (DOVE_PMU_VIRT_BASE + 0x802c)
147 147
148/* Real Time Clock */ 148/* Real Time Clock */
149#define DOVE_RTC_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0xd8500) 149#define DOVE_RTC_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0xd8500)
150 150
151/* AC97 */ 151/* AC97 */
152#define DOVE_AC97_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0xe0000) 152#define DOVE_AC97_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0xe0000)
153#define DOVE_AC97_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xe0000) 153#define DOVE_AC97_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xe0000)
154 154
155/* Peripheral DMA */ 155/* Peripheral DMA */
156#define DOVE_PDMA_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0xe4000) 156#define DOVE_PDMA_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0xe4000)
157#define DOVE_PDMA_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xe4000) 157#define DOVE_PDMA_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xe4000)
158 158
159#define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE | 0xe802C) 159#define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C)
160#define DOVE_TWSI_ENABLE_OPTION1 (1 << 7) 160#define DOVE_TWSI_ENABLE_OPTION1 (1 << 7)
161#define DOVE_GLOBAL_CONFIG_2 (DOVE_SB_REGS_VIRT_BASE | 0xe8030) 161#define DOVE_GLOBAL_CONFIG_2 (DOVE_SB_REGS_VIRT_BASE + 0xe8030)
162#define DOVE_TWSI_ENABLE_OPTION2 (1 << 20) 162#define DOVE_TWSI_ENABLE_OPTION2 (1 << 20)
163#define DOVE_TWSI_ENABLE_OPTION3 (1 << 21) 163#define DOVE_TWSI_ENABLE_OPTION3 (1 << 21)
164#define DOVE_TWSI_OPTION3_GPIO (1 << 22) 164#define DOVE_TWSI_OPTION3_GPIO (1 << 22)
165#define DOVE_SSP_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0xec000) 165#define DOVE_SSP_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0xec000)
166#define DOVE_SSP_CTRL_STATUS_1 (DOVE_SB_REGS_VIRT_BASE | 0xe8034) 166#define DOVE_SSP_CTRL_STATUS_1 (DOVE_SB_REGS_VIRT_BASE + 0xe8034)
167#define DOVE_SSP_ON_AU1 (1 << 0) 167#define DOVE_SSP_ON_AU1 (1 << 0)
168#define DOVE_SSP_CLOCK_ENABLE (1 << 1) 168#define DOVE_SSP_CLOCK_ENABLE (1 << 1)
169#define DOVE_SSP_BPB_CLOCK_SRC_SSP (1 << 11) 169#define DOVE_SSP_BPB_CLOCK_SRC_SSP (1 << 11)
170/* Memory Controller */ 170/* Memory Controller */
171#define DOVE_MC_VIRT_BASE (DOVE_NB_REGS_VIRT_BASE | 0x00000) 171#define DOVE_MC_VIRT_BASE (DOVE_NB_REGS_VIRT_BASE + 0x00000)
172 172
173/* LCD Controller */ 173/* LCD Controller */
174#define DOVE_LCD_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE | 0x10000) 174#define DOVE_LCD_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE + 0x10000)
175#define DOVE_LCD1_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE | 0x20000) 175#define DOVE_LCD1_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE + 0x20000)
176#define DOVE_LCD2_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE | 0x10000) 176#define DOVE_LCD2_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE + 0x10000)
177#define DOVE_LCD_DCON_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE | 0x30000) 177#define DOVE_LCD_DCON_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE + 0x30000)
178 178
179/* Graphic Engine */ 179/* Graphic Engine */
180#define DOVE_GPU_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE | 0x40000) 180#define DOVE_GPU_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE + 0x40000)
181 181
182/* Video Engine */ 182/* Video Engine */
183#define DOVE_VPU_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE | 0x400000) 183#define DOVE_VPU_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE + 0x400000)
184 184
185#endif 185#endif
diff --git a/arch/arm/mach-dove/include/mach/pm.h b/arch/arm/mach-dove/include/mach/pm.h
index 3ad9f946a9e8..7bcd0dfce4b1 100644
--- a/arch/arm/mach-dove/include/mach/pm.h
+++ b/arch/arm/mach-dove/include/mach/pm.h
@@ -13,24 +13,42 @@
13#include <mach/irqs.h> 13#include <mach/irqs.h>
14 14
15#define CLOCK_GATING_CONTROL (DOVE_PMU_VIRT_BASE + 0x38) 15#define CLOCK_GATING_CONTROL (DOVE_PMU_VIRT_BASE + 0x38)
16#define CLOCK_GATING_USB0_MASK (1 << 0) 16#define CLOCK_GATING_BIT_USB0 0
17#define CLOCK_GATING_USB1_MASK (1 << 1) 17#define CLOCK_GATING_BIT_USB1 1
18#define CLOCK_GATING_GBE_MASK (1 << 2) 18#define CLOCK_GATING_BIT_GBE 2
19#define CLOCK_GATING_SATA_MASK (1 << 3) 19#define CLOCK_GATING_BIT_SATA 3
20#define CLOCK_GATING_PCIE0_MASK (1 << 4) 20#define CLOCK_GATING_BIT_PCIE0 4
21#define CLOCK_GATING_PCIE1_MASK (1 << 5) 21#define CLOCK_GATING_BIT_PCIE1 5
22#define CLOCK_GATING_SDIO0_MASK (1 << 8) 22#define CLOCK_GATING_BIT_SDIO0 8
23#define CLOCK_GATING_SDIO1_MASK (1 << 9) 23#define CLOCK_GATING_BIT_SDIO1 9
24#define CLOCK_GATING_NAND_MASK (1 << 10) 24#define CLOCK_GATING_BIT_NAND 10
25#define CLOCK_GATING_CAMERA_MASK (1 << 11) 25#define CLOCK_GATING_BIT_CAMERA 11
26#define CLOCK_GATING_I2S0_MASK (1 << 12) 26#define CLOCK_GATING_BIT_I2S0 12
27#define CLOCK_GATING_I2S1_MASK (1 << 13) 27#define CLOCK_GATING_BIT_I2S1 13
28#define CLOCK_GATING_CRYPTO_MASK (1 << 15) 28#define CLOCK_GATING_BIT_CRYPTO 15
29#define CLOCK_GATING_AC97_MASK (1 << 21) 29#define CLOCK_GATING_BIT_AC97 21
30#define CLOCK_GATING_PDMA_MASK (1 << 22) 30#define CLOCK_GATING_BIT_PDMA 22
31#define CLOCK_GATING_XOR0_MASK (1 << 23) 31#define CLOCK_GATING_BIT_XOR0 23
32#define CLOCK_GATING_XOR1_MASK (1 << 24) 32#define CLOCK_GATING_BIT_XOR1 24
33#define CLOCK_GATING_GIGA_PHY_MASK (1 << 30) 33#define CLOCK_GATING_BIT_GIGA_PHY 30
34#define CLOCK_GATING_USB0_MASK (1 << CLOCK_GATING_BIT_USB0)
35#define CLOCK_GATING_USB1_MASK (1 << CLOCK_GATING_BIT_USB1)
36#define CLOCK_GATING_GBE_MASK (1 << CLOCK_GATING_BIT_GBE)
37#define CLOCK_GATING_SATA_MASK (1 << CLOCK_GATING_BIT_SATA)
38#define CLOCK_GATING_PCIE0_MASK (1 << CLOCK_GATING_BIT_PCIE0)
39#define CLOCK_GATING_PCIE1_MASK (1 << CLOCK_GATING_BIT_PCIE1)
40#define CLOCK_GATING_SDIO0_MASK (1 << CLOCK_GATING_BIT_SDIO0)
41#define CLOCK_GATING_SDIO1_MASK (1 << CLOCK_GATING_BIT_SDIO1)
42#define CLOCK_GATING_NAND_MASK (1 << CLOCK_GATING_BIT_NAND)
43#define CLOCK_GATING_CAMERA_MASK (1 << CLOCK_GATING_BIT_CAMERA)
44#define CLOCK_GATING_I2S0_MASK (1 << CLOCK_GATING_BIT_I2S0)
45#define CLOCK_GATING_I2S1_MASK (1 << CLOCK_GATING_BIT_I2S1)
46#define CLOCK_GATING_CRYPTO_MASK (1 << CLOCK_GATING_BIT_CRYPTO)
47#define CLOCK_GATING_AC97_MASK (1 << CLOCK_GATING_BIT_AC97)
48#define CLOCK_GATING_PDMA_MASK (1 << CLOCK_GATING_BIT_PDMA)
49#define CLOCK_GATING_XOR0_MASK (1 << CLOCK_GATING_BIT_XOR0)
50#define CLOCK_GATING_XOR1_MASK (1 << CLOCK_GATING_BIT_XOR1)
51#define CLOCK_GATING_GIGA_PHY_MASK (1 << CLOCK_GATING_BIT_GIGA_PHY)
34 52
35#define PMU_INTERRUPT_CAUSE (DOVE_PMU_VIRT_BASE + 0x50) 53#define PMU_INTERRUPT_CAUSE (DOVE_PMU_VIRT_BASE + 0x50)
36#define PMU_INTERRUPT_MASK (DOVE_PMU_VIRT_BASE + 0x54) 54#define PMU_INTERRUPT_MASK (DOVE_PMU_VIRT_BASE + 0x54)
diff --git a/arch/arm/mach-dove/irq.c b/arch/arm/mach-dove/irq.c
index 186357f3b4db..087711524e8a 100644
--- a/arch/arm/mach-dove/irq.c
+++ b/arch/arm/mach-dove/irq.c
@@ -100,19 +100,19 @@ void __init dove_init_irq(void)
100{ 100{
101 int i; 101 int i;
102 102
103 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); 103 orion_irq_init(0, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF);
104 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); 104 orion_irq_init(32, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF);
105 105
106 /* 106 /*
107 * Initialize gpiolib for GPIOs 0-71. 107 * Initialize gpiolib for GPIOs 0-71.
108 */ 108 */
109 orion_gpio_init(NULL, 0, 32, (void __iomem *)DOVE_GPIO_LO_VIRT_BASE, 0, 109 orion_gpio_init(NULL, 0, 32, DOVE_GPIO_LO_VIRT_BASE, 0,
110 IRQ_DOVE_GPIO_START, gpio0_irqs); 110 IRQ_DOVE_GPIO_START, gpio0_irqs);
111 111
112 orion_gpio_init(NULL, 32, 32, (void __iomem *)DOVE_GPIO_HI_VIRT_BASE, 0, 112 orion_gpio_init(NULL, 32, 32, DOVE_GPIO_HI_VIRT_BASE, 0,
113 IRQ_DOVE_GPIO_START + 32, gpio1_irqs); 113 IRQ_DOVE_GPIO_START + 32, gpio1_irqs);
114 114
115 orion_gpio_init(NULL, 64, 8, (void __iomem *)DOVE_GPIO2_VIRT_BASE, 0, 115 orion_gpio_init(NULL, 64, 8, DOVE_GPIO2_VIRT_BASE, 0,
116 IRQ_DOVE_GPIO_START + 64, gpio2_irqs); 116 IRQ_DOVE_GPIO_START + 64, gpio2_irqs);
117 117
118 /* 118 /*
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index 355332d502cb..bb15b26041cb 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -182,18 +182,18 @@ static struct hw_pci dove_pci __initdata = {
182 .map_irq = dove_pcie_map_irq, 182 .map_irq = dove_pcie_map_irq,
183}; 183};
184 184
185static void __init add_pcie_port(int index, unsigned long base) 185static void __init add_pcie_port(int index, void __iomem *base)
186{ 186{
187 printk(KERN_INFO "Dove PCIe port %d: ", index); 187 printk(KERN_INFO "Dove PCIe port %d: ", index);
188 188
189 if (orion_pcie_link_up((void __iomem *)base)) { 189 if (orion_pcie_link_up(base)) {
190 struct pcie_port *pp = &pcie_port[num_pcie_ports++]; 190 struct pcie_port *pp = &pcie_port[num_pcie_ports++];
191 191
192 printk(KERN_INFO "link up\n"); 192 printk(KERN_INFO "link up\n");
193 193
194 pp->index = index; 194 pp->index = index;
195 pp->root_bus_nr = -1; 195 pp->root_bus_nr = -1;
196 pp->base = (void __iomem *)base; 196 pp->base = base;
197 spin_lock_init(&pp->conf_lock); 197 spin_lock_init(&pp->conf_lock);
198 memset(&pp->res, 0, sizeof(pp->res)); 198 memset(&pp->res, 0, sizeof(pp->res));
199 } else { 199 } else {
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 8d57e4223bdb..f93d820ecab5 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -134,7 +134,7 @@ static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct
134 134
135 __raw_writel(virt_to_phys(exynos4_secondary_startup), 135 __raw_writel(virt_to_phys(exynos4_secondary_startup),
136 CPU1_BOOT_REG); 136 CPU1_BOOT_REG);
137 gic_raise_softirq(cpumask_of(cpu), 1); 137 gic_raise_softirq(cpumask_of(cpu), 0);
138 138
139 if (pen_release == -1) 139 if (pen_release == -1)
140 break; 140 break;
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 3a2042fb9712..32197c117afe 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -758,7 +758,7 @@ config SOC_IMX6Q
758 select HAVE_IMX_MMDC 758 select HAVE_IMX_MMDC
759 select HAVE_IMX_SRC 759 select HAVE_IMX_SRC
760 select HAVE_SMP 760 select HAVE_SMP
761 select MFD_ANATOP 761 select MFD_SYSCON
762 select PINCTRL 762 select PINCTRL
763 select PINCTRL_IMX6Q 763 select PINCTRL_IMX6Q
764 764
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index f69ca4680049..3b6b640eed24 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -239,8 +239,8 @@ int __init mx27_clocks_init(unsigned long fref)
239 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0"); 239 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0");
240 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); 240 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1");
241 clk_register_clkdev(clk[nfc_baud_gate], NULL, "mxc_nand.0"); 241 clk_register_clkdev(clk[nfc_baud_gate], NULL, "mxc_nand.0");
242 clk_register_clkdev(clk[vpu_baud_gate], "per", "imx-vpu"); 242 clk_register_clkdev(clk[vpu_baud_gate], "per", "coda-imx27.0");
243 clk_register_clkdev(clk[vpu_ahb_gate], "ahb", "imx-vpu"); 243 clk_register_clkdev(clk[vpu_ahb_gate], "ahb", "coda-imx27.0");
244 clk_register_clkdev(clk[dma_ahb_gate], "ahb", "imx-dma"); 244 clk_register_clkdev(clk[dma_ahb_gate], "ahb", "imx-dma");
245 clk_register_clkdev(clk[dma_ipg_gate], "ipg", "imx-dma"); 245 clk_register_clkdev(clk[dma_ipg_gate], "ipg", "imx-dma");
246 clk_register_clkdev(clk[fec_ipg_gate], "ipg", "imx27-fec.0"); 246 clk_register_clkdev(clk[fec_ipg_gate], "ipg", "imx27-fec.0");
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
index 436c5720fe6a..04822932cdd1 100644
--- a/arch/arm/mach-imx/devices-imx27.h
+++ b/arch/arm/mach-imx/devices-imx27.h
@@ -17,6 +17,10 @@ extern const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data;
17#define imx27_add_fsl_usb2_udc(pdata) \ 17#define imx27_add_fsl_usb2_udc(pdata) \
18 imx_add_fsl_usb2_udc(&imx27_fsl_usb2_udc_data, pdata) 18 imx_add_fsl_usb2_udc(&imx27_fsl_usb2_udc_data, pdata)
19 19
20extern const struct imx_imx27_coda_data imx27_coda_data;
21#define imx27_add_coda() \
22 imx_add_imx27_coda(&imx27_coda_data)
23
20extern const struct imx_imx2_wdt_data imx27_imx2_wdt_data; 24extern const struct imx_imx2_wdt_data imx27_imx2_wdt_data;
21#define imx27_add_imx2_wdt() \ 25#define imx27_add_imx2_wdt() \
22 imx_add_imx2_wdt(&imx27_imx2_wdt_data) 26 imx_add_imx2_wdt(&imx27_imx2_wdt_data)
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index f264ddddd47c..821d6aac411c 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -32,13 +32,13 @@
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/dma-mapping.h> 33#include <linux/dma-mapping.h>
34#include <linux/leds.h> 34#include <linux/leds.h>
35#include <linux/memblock.h>
36#include <media/soc_camera.h> 35#include <media/soc_camera.h>
37#include <sound/tlv320aic32x4.h> 36#include <sound/tlv320aic32x4.h>
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/time.h> 39#include <asm/mach/time.h>
41#include <asm/system_info.h> 40#include <asm/system_info.h>
41#include <asm/memblock.h>
42#include <mach/common.h> 42#include <mach/common.h>
43#include <mach/hardware.h> 43#include <mach/hardware.h>
44#include <mach/iomux-mx27.h> 44#include <mach/iomux-mx27.h>
@@ -233,10 +233,8 @@ static void __init visstrim_camera_init(void)
233static void __init visstrim_reserve(void) 233static void __init visstrim_reserve(void)
234{ 234{
235 /* reserve 4 MiB for mx2-camera */ 235 /* reserve 4 MiB for mx2-camera */
236 mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE, 236 mx2_camera_base = arm_memblock_steal(3 * MX2_CAMERA_BUF_SIZE,
237 MX2_CAMERA_BUF_SIZE); 237 MX2_CAMERA_BUF_SIZE);
238 memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
239 memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
240} 238}
241 239
242/* GPIOs used as events for applications */ 240/* GPIOs used as events for applications */
@@ -405,6 +403,47 @@ static const struct imx_ssi_platform_data visstrim_m10_ssi_pdata __initconst = {
405 .flags = IMX_SSI_DMA | IMX_SSI_SYN, 403 .flags = IMX_SSI_DMA | IMX_SSI_SYN,
406}; 404};
407 405
406/* coda */
407
408static void __init visstrim_coda_init(void)
409{
410 struct platform_device *pdev;
411 int dma;
412
413 pdev = imx27_add_coda();
414 dma = dma_declare_coherent_memory(&pdev->dev,
415 mx2_camera_base + MX2_CAMERA_BUF_SIZE,
416 mx2_camera_base + MX2_CAMERA_BUF_SIZE,
417 MX2_CAMERA_BUF_SIZE,
418 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
419 if (!(dma & DMA_MEMORY_MAP))
420 return;
421}
422
423/* DMA deinterlace */
424static struct platform_device visstrim_deinterlace = {
425 .name = "m2m-deinterlace",
426 .id = 0,
427};
428
429static void __init visstrim_deinterlace_init(void)
430{
431 int ret = -ENOMEM;
432 struct platform_device *pdev = &visstrim_deinterlace;
433 int dma;
434
435 ret = platform_device_register(pdev);
436
437 dma = dma_declare_coherent_memory(&pdev->dev,
438 mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE,
439 mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE,
440 MX2_CAMERA_BUF_SIZE,
441 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
442 if (!(dma & DMA_MEMORY_MAP))
443 return;
444}
445
446
408static void __init visstrim_m10_revision(void) 447static void __init visstrim_m10_revision(void)
409{ 448{
410 int exp_version = 0; 449 int exp_version = 0;
@@ -467,7 +506,9 @@ static void __init visstrim_m10_board_init(void)
467 platform_device_register_resndata(NULL, "soc-camera-pdrv", 0, NULL, 0, 506 platform_device_register_resndata(NULL, "soc-camera-pdrv", 0, NULL, 0,
468 &iclink_tvp5150, sizeof(iclink_tvp5150)); 507 &iclink_tvp5150, sizeof(iclink_tvp5150));
469 gpio_led_register_device(0, &visstrim_m10_led_data); 508 gpio_led_register_device(0, &visstrim_m10_led_data);
509 visstrim_deinterlace_init();
470 visstrim_camera_init(); 510 visstrim_camera_init();
511 visstrim_coda_init();
471} 512}
472 513
473static void __init visstrim_m10_timer_init(void) 514static void __init visstrim_m10_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 36979d3dfe34..47c91f7185d2 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -23,8 +23,9 @@
23#include <linux/of_irq.h> 23#include <linux/of_irq.h>
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/phy.h> 25#include <linux/phy.h>
26#include <linux/regmap.h>
26#include <linux/micrel_phy.h> 27#include <linux/micrel_phy.h>
27#include <linux/mfd/anatop.h> 28#include <linux/mfd/syscon.h>
28#include <asm/cpuidle.h> 29#include <asm/cpuidle.h>
29#include <asm/smp_twd.h> 30#include <asm/smp_twd.h>
30#include <asm/hardware/cache-l2x0.h> 31#include <asm/hardware/cache-l2x0.h>
@@ -118,20 +119,7 @@ static void __init imx6q_sabrelite_init(void)
118 119
119static void __init imx6q_usb_init(void) 120static void __init imx6q_usb_init(void)
120{ 121{
121 struct device_node *np; 122 struct regmap *anatop;
122 struct platform_device *pdev = NULL;
123 struct anatop *adata = NULL;
124
125 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop");
126 if (np)
127 pdev = of_find_device_by_node(np);
128 if (pdev)
129 adata = platform_get_drvdata(pdev);
130 if (!adata) {
131 if (np)
132 of_node_put(np);
133 return;
134 }
135 123
136#define HW_ANADIG_USB1_CHRG_DETECT 0x000001b0 124#define HW_ANADIG_USB1_CHRG_DETECT 0x000001b0
137#define HW_ANADIG_USB2_CHRG_DETECT 0x00000210 125#define HW_ANADIG_USB2_CHRG_DETECT 0x00000210
@@ -139,20 +127,21 @@ static void __init imx6q_usb_init(void)
139#define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x00100000 127#define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x00100000
140#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x00080000 128#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x00080000
141 129
142 /* 130 anatop = syscon_regmap_lookup_by_compatible("fsl,imx6q-anatop");
143 * The external charger detector needs to be disabled, 131 if (!IS_ERR(anatop)) {
144 * or the signal at DP will be poor 132 /*
145 */ 133 * The external charger detector needs to be disabled,
146 anatop_write_reg(adata, HW_ANADIG_USB1_CHRG_DETECT, 134 * or the signal at DP will be poor
147 BM_ANADIG_USB_CHRG_DETECT_EN_B 135 */
148 | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B, 136 regmap_write(anatop, HW_ANADIG_USB1_CHRG_DETECT,
149 ~0); 137 BM_ANADIG_USB_CHRG_DETECT_EN_B
150 anatop_write_reg(adata, HW_ANADIG_USB2_CHRG_DETECT, 138 | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B);
151 BM_ANADIG_USB_CHRG_DETECT_EN_B | 139 regmap_write(anatop, HW_ANADIG_USB2_CHRG_DETECT,
152 BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B, 140 BM_ANADIG_USB_CHRG_DETECT_EN_B |
153 ~0); 141 BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B);
154 142 } else {
155 of_node_put(np); 143 pr_warn("failed to find fsl,imx6q-anatop regmap\n");
144 }
156} 145}
157 146
158static void __init imx6q_init_machine(void) 147static void __init imx6q_init_machine(void)
diff --git a/arch/arm/mach-integrator/common.h b/arch/arm/mach-integrator/common.h
index 899561d8db28..c3ff21b5ea24 100644
--- a/arch/arm/mach-integrator/common.h
+++ b/arch/arm/mach-integrator/common.h
@@ -1,3 +1,6 @@
1#include <linux/amba/serial.h>
2extern struct amba_pl010_data integrator_uart_data;
1void integrator_init_early(void); 3void integrator_init_early(void);
4int integrator_init(bool is_cp);
2void integrator_reserve(void); 5void integrator_reserve(void);
3void integrator_restart(char, const char *); 6void integrator_restart(char, const char *);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index dad3cb74ed31..ea22a17246d7 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -32,7 +32,9 @@
32#include <asm/mach/time.h> 32#include <asm/mach/time.h>
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
34 34
35static struct amba_pl010_data integrator_uart_data; 35#include "common.h"
36
37#ifdef CONFIG_ATAGS
36 38
37#define INTEGRATOR_RTC_IRQ { IRQ_RTCINT } 39#define INTEGRATOR_RTC_IRQ { IRQ_RTCINT }
38#define INTEGRATOR_UART0_IRQ { IRQ_UARTINT0 } 40#define INTEGRATOR_UART0_IRQ { IRQ_UARTINT0 }
@@ -60,7 +62,7 @@ static struct amba_device *amba_devs[] __initdata = {
60 &kmi1_device, 62 &kmi1_device,
61}; 63};
62 64
63static int __init integrator_init(void) 65int __init integrator_init(bool is_cp)
64{ 66{
65 int i; 67 int i;
66 68
@@ -69,7 +71,7 @@ static int __init integrator_init(void)
69 * hard-code them. The Integator/CP and forward have proper cell IDs. 71 * hard-code them. The Integator/CP and forward have proper cell IDs.
70 * Else we leave them undefined to the bus driver can autoprobe them. 72 * Else we leave them undefined to the bus driver can autoprobe them.
71 */ 73 */
72 if (machine_is_integrator()) { 74 if (!is_cp) {
73 rtc_device.periphid = 0x00041030; 75 rtc_device.periphid = 0x00041030;
74 uart0_device.periphid = 0x00041010; 76 uart0_device.periphid = 0x00041010;
75 uart1_device.periphid = 0x00041010; 77 uart1_device.periphid = 0x00041010;
@@ -85,7 +87,7 @@ static int __init integrator_init(void)
85 return 0; 87 return 0;
86} 88}
87 89
88arch_initcall(integrator_init); 90#endif
89 91
90/* 92/*
91 * On the Integrator platform, the port RTS and DTR are provided by 93 * On the Integrator platform, the port RTS and DTR are provided by
@@ -100,11 +102,14 @@ arch_initcall(integrator_init);
100static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl) 102static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl)
101{ 103{
102 unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask; 104 unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
105 u32 phybase = dev->res.start;
103 106
104 if (dev == &uart0_device) { 107 if (phybase == INTEGRATOR_UART0_BASE) {
108 /* UART0 */
105 rts_mask = 1 << 4; 109 rts_mask = 1 << 4;
106 dtr_mask = 1 << 5; 110 dtr_mask = 1 << 5;
107 } else { 111 } else {
112 /* UART1 */
108 rts_mask = 1 << 6; 113 rts_mask = 1 << 6;
109 dtr_mask = 1 << 7; 114 dtr_mask = 1 << 7;
110 } 115 }
@@ -123,7 +128,7 @@ static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *bas
123 __raw_writel(ctrlc, SC_CTRLC); 128 __raw_writel(ctrlc, SC_CTRLC);
124} 129}
125 130
126static struct amba_pl010_data integrator_uart_data = { 131struct amba_pl010_data integrator_uart_data = {
127 .set_mctrl = integrator_uart_set_mctrl, 132 .set_mctrl = integrator_uart_set_mctrl,
128}; 133};
129 134
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 2215d96cd735..d5b5435a09ae 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -34,6 +34,9 @@
34#include <linux/mtd/physmap.h> 34#include <linux/mtd/physmap.h>
35#include <linux/clk.h> 35#include <linux/clk.h>
36#include <linux/platform_data/clk-integrator.h> 36#include <linux/platform_data/clk-integrator.h>
37#include <linux/of_irq.h>
38#include <linux/of_address.h>
39#include <linux/of_platform.h>
37#include <video/vga.h> 40#include <video/vga.h>
38 41
39#include <mach/hardware.h> 42#include <mach/hardware.h>
@@ -158,23 +161,6 @@ static void __init ap_map_io(void)
158 pci_map_io_early(__phys_to_pfn(PHYS_PCI_IO_BASE)); 161 pci_map_io_early(__phys_to_pfn(PHYS_PCI_IO_BASE));
159} 162}
160 163
161#define INTEGRATOR_SC_VALID_INT 0x003fffff
162
163static void __init ap_init_irq(void)
164{
165 /* Disable all interrupts initially. */
166 /* Do the core module ones */
167 writel(-1, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
168
169 /* do the header card stuff next */
170 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR);
171 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR);
172
173 fpga_irq_init(VA_IC_BASE, "SC", IRQ_PIC_START,
174 -1, INTEGRATOR_SC_VALID_INT, NULL);
175 integrator_clk_init(false);
176}
177
178#ifdef CONFIG_PM 164#ifdef CONFIG_PM
179static unsigned long ic_irq_enable; 165static unsigned long ic_irq_enable;
180 166
@@ -267,50 +253,6 @@ static struct physmap_flash_data ap_flash_data = {
267 .set_vpp = ap_flash_set_vpp, 253 .set_vpp = ap_flash_set_vpp,
268}; 254};
269 255
270static struct resource cfi_flash_resource = {
271 .start = INTEGRATOR_FLASH_BASE,
272 .end = INTEGRATOR_FLASH_BASE + INTEGRATOR_FLASH_SIZE - 1,
273 .flags = IORESOURCE_MEM,
274};
275
276static struct platform_device cfi_flash_device = {
277 .name = "physmap-flash",
278 .id = 0,
279 .dev = {
280 .platform_data = &ap_flash_data,
281 },
282 .num_resources = 1,
283 .resource = &cfi_flash_resource,
284};
285
286static void __init ap_init(void)
287{
288 unsigned long sc_dec;
289 int i;
290
291 platform_device_register(&cfi_flash_device);
292
293 sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
294 for (i = 0; i < 4; i++) {
295 struct lm_device *lmdev;
296
297 if ((sc_dec & (16 << i)) == 0)
298 continue;
299
300 lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
301 if (!lmdev)
302 continue;
303
304 lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
305 lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
306 lmdev->resource.flags = IORESOURCE_MEM;
307 lmdev->irq = IRQ_AP_EXPINT0 + i;
308 lmdev->id = i;
309
310 lm_device_register(lmdev);
311 }
312}
313
314/* 256/*
315 * Where is the timer (VA)? 257 * Where is the timer (VA)?
316 */ 258 */
@@ -325,9 +267,9 @@ static u32 notrace integrator_read_sched_clock(void)
325 return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE); 267 return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE);
326} 268}
327 269
328static void integrator_clocksource_init(unsigned long inrate) 270static void integrator_clocksource_init(unsigned long inrate,
271 void __iomem *base)
329{ 272{
330 void __iomem *base = (void __iomem *)TIMER2_VA_BASE;
331 u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC; 273 u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC;
332 unsigned long rate = inrate; 274 unsigned long rate = inrate;
333 275
@@ -344,7 +286,7 @@ static void integrator_clocksource_init(unsigned long inrate)
344 setup_sched_clock(integrator_read_sched_clock, 16, rate); 286 setup_sched_clock(integrator_read_sched_clock, 16, rate);
345} 287}
346 288
347static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE; 289static void __iomem * clkevt_base;
348 290
349/* 291/*
350 * IRQ handler for the timer 292 * IRQ handler for the timer
@@ -416,11 +358,13 @@ static struct irqaction integrator_timer_irq = {
416 .dev_id = &integrator_clockevent, 358 .dev_id = &integrator_clockevent,
417}; 359};
418 360
419static void integrator_clockevent_init(unsigned long inrate) 361static void integrator_clockevent_init(unsigned long inrate,
362 void __iomem *base, int irq)
420{ 363{
421 unsigned long rate = inrate; 364 unsigned long rate = inrate;
422 unsigned int ctrl = 0; 365 unsigned int ctrl = 0;
423 366
367 clkevt_base = base;
424 /* Calculate and program a divisor */ 368 /* Calculate and program a divisor */
425 if (rate > 0x100000 * HZ) { 369 if (rate > 0x100000 * HZ) {
426 rate /= 256; 370 rate /= 256;
@@ -432,7 +376,7 @@ static void integrator_clockevent_init(unsigned long inrate)
432 timer_reload = rate / HZ; 376 timer_reload = rate / HZ;
433 writel(ctrl, clkevt_base + TIMER_CTRL); 377 writel(ctrl, clkevt_base + TIMER_CTRL);
434 378
435 setup_irq(IRQ_TIMERINT1, &integrator_timer_irq); 379 setup_irq(irq, &integrator_timer_irq);
436 clockevents_config_and_register(&integrator_clockevent, 380 clockevents_config_and_register(&integrator_clockevent,
437 rate, 381 rate,
438 1, 382 1,
@@ -443,9 +387,153 @@ void __init ap_init_early(void)
443{ 387{
444} 388}
445 389
390#ifdef CONFIG_OF
391
392static void __init ap_init_timer_of(void)
393{
394 struct device_node *node;
395 const char *path;
396 void __iomem *base;
397 int err;
398 int irq;
399 struct clk *clk;
400 unsigned long rate;
401
402 clk = clk_get_sys("ap_timer", NULL);
403 BUG_ON(IS_ERR(clk));
404 clk_prepare_enable(clk);
405 rate = clk_get_rate(clk);
406
407 err = of_property_read_string(of_aliases,
408 "arm,timer-primary", &path);
409 if (WARN_ON(err))
410 return;
411 node = of_find_node_by_path(path);
412 base = of_iomap(node, 0);
413 if (WARN_ON(!base))
414 return;
415 writel(0, base + TIMER_CTRL);
416 integrator_clocksource_init(rate, base);
417
418 err = of_property_read_string(of_aliases,
419 "arm,timer-secondary", &path);
420 if (WARN_ON(err))
421 return;
422 node = of_find_node_by_path(path);
423 base = of_iomap(node, 0);
424 if (WARN_ON(!base))
425 return;
426 irq = irq_of_parse_and_map(node, 0);
427 writel(0, base + TIMER_CTRL);
428 integrator_clockevent_init(rate, base, irq);
429}
430
431static struct sys_timer ap_of_timer = {
432 .init = ap_init_timer_of,
433};
434
435static const struct of_device_id fpga_irq_of_match[] __initconst = {
436 { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, },
437 { /* Sentinel */ }
438};
439
440static void __init ap_init_irq_of(void)
441{
442 /* disable core module IRQs */
443 writel(0xffffffffU, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
444 of_irq_init(fpga_irq_of_match);
445 integrator_clk_init(false);
446}
447
448/* For the Device Tree, add in the UART callbacks as AUXDATA */
449static struct of_dev_auxdata ap_auxdata_lookup[] __initdata = {
450 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_RTC_BASE,
451 "rtc", NULL),
452 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART0_BASE,
453 "uart0", &integrator_uart_data),
454 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART1_BASE,
455 "uart1", &integrator_uart_data),
456 OF_DEV_AUXDATA("arm,primecell", KMI0_BASE,
457 "kmi0", NULL),
458 OF_DEV_AUXDATA("arm,primecell", KMI1_BASE,
459 "kmi1", NULL),
460 OF_DEV_AUXDATA("cfi-flash", INTEGRATOR_FLASH_BASE,
461 "physmap-flash", &ap_flash_data),
462 { /* sentinel */ },
463};
464
465static void __init ap_init_of(void)
466{
467 unsigned long sc_dec;
468 int i;
469
470 of_platform_populate(NULL, of_default_bus_match_table,
471 ap_auxdata_lookup, NULL);
472
473 sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
474 for (i = 0; i < 4; i++) {
475 struct lm_device *lmdev;
476
477 if ((sc_dec & (16 << i)) == 0)
478 continue;
479
480 lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
481 if (!lmdev)
482 continue;
483
484 lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
485 lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
486 lmdev->resource.flags = IORESOURCE_MEM;
487 lmdev->irq = IRQ_AP_EXPINT0 + i;
488 lmdev->id = i;
489
490 lm_device_register(lmdev);
491 }
492}
493
494static const char * ap_dt_board_compat[] = {
495 "arm,integrator-ap",
496 NULL,
497};
498
499DT_MACHINE_START(INTEGRATOR_AP_DT, "ARM Integrator/AP (Device Tree)")
500 .reserve = integrator_reserve,
501 .map_io = ap_map_io,
502 .nr_irqs = NR_IRQS_INTEGRATOR_AP,
503 .init_early = ap_init_early,
504 .init_irq = ap_init_irq_of,
505 .handle_irq = fpga_handle_irq,
506 .timer = &ap_of_timer,
507 .init_machine = ap_init_of,
508 .restart = integrator_restart,
509 .dt_compat = ap_dt_board_compat,
510MACHINE_END
511
512#endif
513
514#ifdef CONFIG_ATAGS
515
446/* 516/*
447 * Set up timer(s). 517 * This is where non-devicetree initialization code is collected and stashed
518 * for eventual deletion.
448 */ 519 */
520
521static struct resource cfi_flash_resource = {
522 .start = INTEGRATOR_FLASH_BASE,
523 .end = INTEGRATOR_FLASH_BASE + INTEGRATOR_FLASH_SIZE - 1,
524 .flags = IORESOURCE_MEM,
525};
526
527static struct platform_device cfi_flash_device = {
528 .name = "physmap-flash",
529 .id = 0,
530 .dev = {
531 .platform_data = &ap_flash_data,
532 },
533 .num_resources = 1,
534 .resource = &cfi_flash_resource,
535};
536
449static void __init ap_init_timer(void) 537static void __init ap_init_timer(void)
450{ 538{
451 struct clk *clk; 539 struct clk *clk;
@@ -460,14 +548,62 @@ static void __init ap_init_timer(void)
460 writel(0, TIMER1_VA_BASE + TIMER_CTRL); 548 writel(0, TIMER1_VA_BASE + TIMER_CTRL);
461 writel(0, TIMER2_VA_BASE + TIMER_CTRL); 549 writel(0, TIMER2_VA_BASE + TIMER_CTRL);
462 550
463 integrator_clocksource_init(rate); 551 integrator_clocksource_init(rate, (void __iomem *)TIMER2_VA_BASE);
464 integrator_clockevent_init(rate); 552 integrator_clockevent_init(rate, (void __iomem *)TIMER1_VA_BASE,
553 IRQ_TIMERINT1);
465} 554}
466 555
467static struct sys_timer ap_timer = { 556static struct sys_timer ap_timer = {
468 .init = ap_init_timer, 557 .init = ap_init_timer,
469}; 558};
470 559
560#define INTEGRATOR_SC_VALID_INT 0x003fffff
561
562static void __init ap_init_irq(void)
563{
564 /* Disable all interrupts initially. */
565 /* Do the core module ones */
566 writel(-1, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
567
568 /* do the header card stuff next */
569 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR);
570 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR);
571
572 fpga_irq_init(VA_IC_BASE, "SC", IRQ_PIC_START,
573 -1, INTEGRATOR_SC_VALID_INT, NULL);
574 integrator_clk_init(false);
575}
576
577static void __init ap_init(void)
578{
579 unsigned long sc_dec;
580 int i;
581
582 platform_device_register(&cfi_flash_device);
583
584 sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
585 for (i = 0; i < 4; i++) {
586 struct lm_device *lmdev;
587
588 if ((sc_dec & (16 << i)) == 0)
589 continue;
590
591 lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
592 if (!lmdev)
593 continue;
594
595 lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
596 lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
597 lmdev->resource.flags = IORESOURCE_MEM;
598 lmdev->irq = IRQ_AP_EXPINT0 + i;
599 lmdev->id = i;
600
601 lm_device_register(lmdev);
602 }
603
604 integrator_init(false);
605}
606
471MACHINE_START(INTEGRATOR, "ARM-Integrator") 607MACHINE_START(INTEGRATOR, "ARM-Integrator")
472 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 608 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
473 .atag_offset = 0x100, 609 .atag_offset = 0x100,
@@ -481,3 +617,5 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
481 .init_machine = ap_init, 617 .init_machine = ap_init,
482 .restart = integrator_restart, 618 .restart = integrator_restart,
483MACHINE_END 619MACHINE_END
620
621#endif
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 3df5fc369361..6870a1fbcd78 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -23,6 +23,9 @@
23#include <linux/gfp.h> 23#include <linux/gfp.h>
24#include <linux/mtd/physmap.h> 24#include <linux/mtd/physmap.h>
25#include <linux/platform_data/clk-integrator.h> 25#include <linux/platform_data/clk-integrator.h>
26#include <linux/of_irq.h>
27#include <linux/of_address.h>
28#include <linux/of_platform.h>
26 29
27#include <mach/hardware.h> 30#include <mach/hardware.h>
28#include <mach/platform.h> 31#include <mach/platform.h>
@@ -49,16 +52,9 @@
49#include "common.h" 52#include "common.h"
50 53
51#define INTCP_PA_FLASH_BASE 0x24000000 54#define INTCP_PA_FLASH_BASE 0x24000000
52#define INTCP_FLASH_SIZE SZ_32M
53 55
54#define INTCP_PA_CLCD_BASE 0xc0000000 56#define INTCP_PA_CLCD_BASE 0xc0000000
55 57
56#define INTCP_VA_CIC_BASE __io_address(INTEGRATOR_HDR_BASE + 0x40)
57#define INTCP_VA_PIC_BASE __io_address(INTEGRATOR_IC_BASE)
58#define INTCP_VA_SIC_BASE __io_address(INTEGRATOR_CP_SIC_BASE)
59
60#define INTCP_ETH_SIZE 0x10
61
62#define INTCP_VA_CTRL_BASE __io_address(INTEGRATOR_CP_CTL_BASE) 58#define INTCP_VA_CTRL_BASE __io_address(INTEGRATOR_CP_CTL_BASE)
63#define INTCP_FLASHPROG 0x04 59#define INTCP_FLASHPROG 0x04
64#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0) 60#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0)
@@ -143,37 +139,6 @@ static void __init intcp_map_io(void)
143 iotable_init(intcp_io_desc, ARRAY_SIZE(intcp_io_desc)); 139 iotable_init(intcp_io_desc, ARRAY_SIZE(intcp_io_desc));
144} 140}
145 141
146static void __init intcp_init_irq(void)
147{
148 u32 pic_mask, cic_mask, sic_mask;
149
150 /* These masks are for the HW IRQ registers */
151 pic_mask = ~((~0u) << (11 - IRQ_PIC_START));
152 pic_mask |= (~((~0u) << (29 - 22))) << 22;
153 cic_mask = ~((~0u) << (1 + IRQ_CIC_END - IRQ_CIC_START));
154 sic_mask = ~((~0u) << (1 + IRQ_SIC_END - IRQ_SIC_START));
155
156 /*
157 * Disable all interrupt sources
158 */
159 writel(0xffffffff, INTCP_VA_PIC_BASE + IRQ_ENABLE_CLEAR);
160 writel(0xffffffff, INTCP_VA_PIC_BASE + FIQ_ENABLE_CLEAR);
161 writel(0xffffffff, INTCP_VA_CIC_BASE + IRQ_ENABLE_CLEAR);
162 writel(0xffffffff, INTCP_VA_CIC_BASE + FIQ_ENABLE_CLEAR);
163 writel(sic_mask, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR);
164 writel(sic_mask, INTCP_VA_SIC_BASE + FIQ_ENABLE_CLEAR);
165
166 fpga_irq_init(INTCP_VA_PIC_BASE, "PIC", IRQ_PIC_START,
167 -1, pic_mask, NULL);
168
169 fpga_irq_init(INTCP_VA_CIC_BASE, "CIC", IRQ_CIC_START,
170 -1, cic_mask, NULL);
171
172 fpga_irq_init(INTCP_VA_SIC_BASE, "SIC", IRQ_SIC_START,
173 IRQ_CP_CPPLDINT, sic_mask, NULL);
174 integrator_clk_init(true);
175}
176
177/* 142/*
178 * Flash handling. 143 * Flash handling.
179 */ 144 */
@@ -216,47 +181,6 @@ static struct physmap_flash_data intcp_flash_data = {
216 .set_vpp = intcp_flash_set_vpp, 181 .set_vpp = intcp_flash_set_vpp,
217}; 182};
218 183
219static struct resource intcp_flash_resource = {
220 .start = INTCP_PA_FLASH_BASE,
221 .end = INTCP_PA_FLASH_BASE + INTCP_FLASH_SIZE - 1,
222 .flags = IORESOURCE_MEM,
223};
224
225static struct platform_device intcp_flash_device = {
226 .name = "physmap-flash",
227 .id = 0,
228 .dev = {
229 .platform_data = &intcp_flash_data,
230 },
231 .num_resources = 1,
232 .resource = &intcp_flash_resource,
233};
234
235static struct resource smc91x_resources[] = {
236 [0] = {
237 .start = INTEGRATOR_CP_ETH_BASE,
238 .end = INTEGRATOR_CP_ETH_BASE + INTCP_ETH_SIZE - 1,
239 .flags = IORESOURCE_MEM,
240 },
241 [1] = {
242 .start = IRQ_CP_ETHINT,
243 .end = IRQ_CP_ETHINT,
244 .flags = IORESOURCE_IRQ,
245 },
246};
247
248static struct platform_device smc91x_device = {
249 .name = "smc91x",
250 .id = 0,
251 .num_resources = ARRAY_SIZE(smc91x_resources),
252 .resource = smc91x_resources,
253};
254
255static struct platform_device *intcp_devs[] __initdata = {
256 &intcp_flash_device,
257 &smc91x_device,
258};
259
260/* 184/*
261 * It seems that the card insertion interrupt remains active after 185 * It seems that the card insertion interrupt remains active after
262 * we've acknowledged it. We therefore ignore the interrupt, and 186 * we've acknowledged it. We therefore ignore the interrupt, and
@@ -278,16 +202,6 @@ static struct mmci_platform_data mmc_data = {
278 .gpio_cd = -1, 202 .gpio_cd = -1,
279}; 203};
280 204
281#define INTEGRATOR_CP_MMC_IRQS { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 }
282#define INTEGRATOR_CP_AACI_IRQS { IRQ_CP_AACIINT }
283
284static AMBA_APB_DEVICE(mmc, "mmci", 0, INTEGRATOR_CP_MMC_BASE,
285 INTEGRATOR_CP_MMC_IRQS, &mmc_data);
286
287static AMBA_APB_DEVICE(aaci, "aaci", 0, INTEGRATOR_CP_AACI_BASE,
288 INTEGRATOR_CP_AACI_IRQS, NULL);
289
290
291/* 205/*
292 * CLCD support 206 * CLCD support
293 */ 207 */
@@ -338,15 +252,6 @@ static struct clcd_board clcd_data = {
338 .remove = versatile_clcd_remove_dma, 252 .remove = versatile_clcd_remove_dma,
339}; 253};
340 254
341static AMBA_AHB_DEVICE(clcd, "clcd", 0, INTCP_PA_CLCD_BASE,
342 { IRQ_CP_CLCDCINT }, &clcd_data);
343
344static struct amba_device *amba_devs[] __initdata = {
345 &mmc_device,
346 &aaci_device,
347 &clcd_device,
348};
349
350#define REFCOUNTER (__io_address(INTEGRATOR_HDR_BASE) + 0x28) 255#define REFCOUNTER (__io_address(INTEGRATOR_HDR_BASE) + 0x28)
351 256
352static void __init intcp_init_early(void) 257static void __init intcp_init_early(void)
@@ -356,16 +261,193 @@ static void __init intcp_init_early(void)
356#endif 261#endif
357} 262}
358 263
359static void __init intcp_init(void) 264static void __init intcp_timer_init_of(void)
360{ 265{
361 int i; 266 struct device_node *node;
267 const char *path;
268 void __iomem *base;
269 int err;
270 int irq;
271
272 err = of_property_read_string(of_aliases,
273 "arm,timer-primary", &path);
274 if (WARN_ON(err))
275 return;
276 node = of_find_node_by_path(path);
277 base = of_iomap(node, 0);
278 if (WARN_ON(!base))
279 return;
280 writel(0, base + TIMER_CTRL);
281 sp804_clocksource_init(base, node->name);
282
283 err = of_property_read_string(of_aliases,
284 "arm,timer-secondary", &path);
285 if (WARN_ON(err))
286 return;
287 node = of_find_node_by_path(path);
288 base = of_iomap(node, 0);
289 if (WARN_ON(!base))
290 return;
291 irq = irq_of_parse_and_map(node, 0);
292 writel(0, base + TIMER_CTRL);
293 sp804_clockevents_init(base, irq, node->name);
294}
362 295
363 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs)); 296static struct sys_timer cp_of_timer = {
297 .init = intcp_timer_init_of,
298};
364 299
365 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 300#ifdef CONFIG_OF
366 struct amba_device *d = amba_devs[i]; 301
367 amba_device_register(d, &iomem_resource); 302static const struct of_device_id fpga_irq_of_match[] __initconst = {
368 } 303 { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, },
304 { /* Sentinel */ }
305};
306
307static void __init intcp_init_irq_of(void)
308{
309 of_irq_init(fpga_irq_of_match);
310 integrator_clk_init(true);
311}
312
313/*
314 * For the Device Tree, add in the UART, MMC and CLCD specifics as AUXDATA
315 * and enforce the bus names since these are used for clock lookups.
316 */
317static struct of_dev_auxdata intcp_auxdata_lookup[] __initdata = {
318 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_RTC_BASE,
319 "rtc", NULL),
320 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART0_BASE,
321 "uart0", &integrator_uart_data),
322 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART1_BASE,
323 "uart1", &integrator_uart_data),
324 OF_DEV_AUXDATA("arm,primecell", KMI0_BASE,
325 "kmi0", NULL),
326 OF_DEV_AUXDATA("arm,primecell", KMI1_BASE,
327 "kmi1", NULL),
328 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_CP_MMC_BASE,
329 "mmci", &mmc_data),
330 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_CP_AACI_BASE,
331 "aaci", &mmc_data),
332 OF_DEV_AUXDATA("arm,primecell", INTCP_PA_CLCD_BASE,
333 "clcd", &clcd_data),
334 OF_DEV_AUXDATA("cfi-flash", INTCP_PA_FLASH_BASE,
335 "physmap-flash", &intcp_flash_data),
336 { /* sentinel */ },
337};
338
339static void __init intcp_init_of(void)
340{
341 of_platform_populate(NULL, of_default_bus_match_table,
342 intcp_auxdata_lookup, NULL);
343}
344
345static const char * intcp_dt_board_compat[] = {
346 "arm,integrator-cp",
347 NULL,
348};
349
350DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)")
351 .reserve = integrator_reserve,
352 .map_io = intcp_map_io,
353 .nr_irqs = NR_IRQS_INTEGRATOR_CP,
354 .init_early = intcp_init_early,
355 .init_irq = intcp_init_irq_of,
356 .handle_irq = fpga_handle_irq,
357 .timer = &cp_of_timer,
358 .init_machine = intcp_init_of,
359 .restart = integrator_restart,
360 .dt_compat = intcp_dt_board_compat,
361MACHINE_END
362
363#endif
364
365#ifdef CONFIG_ATAGS
366
367/*
368 * This is where non-devicetree initialization code is collected and stashed
369 * for eventual deletion.
370 */
371
372#define INTCP_FLASH_SIZE SZ_32M
373
374static struct resource intcp_flash_resource = {
375 .start = INTCP_PA_FLASH_BASE,
376 .end = INTCP_PA_FLASH_BASE + INTCP_FLASH_SIZE - 1,
377 .flags = IORESOURCE_MEM,
378};
379
380static struct platform_device intcp_flash_device = {
381 .name = "physmap-flash",
382 .id = 0,
383 .dev = {
384 .platform_data = &intcp_flash_data,
385 },
386 .num_resources = 1,
387 .resource = &intcp_flash_resource,
388};
389
390#define INTCP_ETH_SIZE 0x10
391
392static struct resource smc91x_resources[] = {
393 [0] = {
394 .start = INTEGRATOR_CP_ETH_BASE,
395 .end = INTEGRATOR_CP_ETH_BASE + INTCP_ETH_SIZE - 1,
396 .flags = IORESOURCE_MEM,
397 },
398 [1] = {
399 .start = IRQ_CP_ETHINT,
400 .end = IRQ_CP_ETHINT,
401 .flags = IORESOURCE_IRQ,
402 },
403};
404
405static struct platform_device smc91x_device = {
406 .name = "smc91x",
407 .id = 0,
408 .num_resources = ARRAY_SIZE(smc91x_resources),
409 .resource = smc91x_resources,
410};
411
412static struct platform_device *intcp_devs[] __initdata = {
413 &intcp_flash_device,
414 &smc91x_device,
415};
416
417#define INTCP_VA_CIC_BASE __io_address(INTEGRATOR_HDR_BASE + 0x40)
418#define INTCP_VA_PIC_BASE __io_address(INTEGRATOR_IC_BASE)
419#define INTCP_VA_SIC_BASE __io_address(INTEGRATOR_CP_SIC_BASE)
420
421static void __init intcp_init_irq(void)
422{
423 u32 pic_mask, cic_mask, sic_mask;
424
425 /* These masks are for the HW IRQ registers */
426 pic_mask = ~((~0u) << (11 - IRQ_PIC_START));
427 pic_mask |= (~((~0u) << (29 - 22))) << 22;
428 cic_mask = ~((~0u) << (1 + IRQ_CIC_END - IRQ_CIC_START));
429 sic_mask = ~((~0u) << (1 + IRQ_SIC_END - IRQ_SIC_START));
430
431 /*
432 * Disable all interrupt sources
433 */
434 writel(0xffffffff, INTCP_VA_PIC_BASE + IRQ_ENABLE_CLEAR);
435 writel(0xffffffff, INTCP_VA_PIC_BASE + FIQ_ENABLE_CLEAR);
436 writel(0xffffffff, INTCP_VA_CIC_BASE + IRQ_ENABLE_CLEAR);
437 writel(0xffffffff, INTCP_VA_CIC_BASE + FIQ_ENABLE_CLEAR);
438 writel(sic_mask, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR);
439 writel(sic_mask, INTCP_VA_SIC_BASE + FIQ_ENABLE_CLEAR);
440
441 fpga_irq_init(INTCP_VA_PIC_BASE, "PIC", IRQ_PIC_START,
442 -1, pic_mask, NULL);
443
444 fpga_irq_init(INTCP_VA_CIC_BASE, "CIC", IRQ_CIC_START,
445 -1, cic_mask, NULL);
446
447 fpga_irq_init(INTCP_VA_SIC_BASE, "SIC", IRQ_SIC_START,
448 IRQ_CP_CPPLDINT, sic_mask, NULL);
449
450 integrator_clk_init(true);
369} 451}
370 452
371#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE) 453#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE)
@@ -386,6 +468,37 @@ static struct sys_timer cp_timer = {
386 .init = intcp_timer_init, 468 .init = intcp_timer_init,
387}; 469};
388 470
471#define INTEGRATOR_CP_MMC_IRQS { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 }
472#define INTEGRATOR_CP_AACI_IRQS { IRQ_CP_AACIINT }
473
474static AMBA_APB_DEVICE(mmc, "mmci", 0, INTEGRATOR_CP_MMC_BASE,
475 INTEGRATOR_CP_MMC_IRQS, &mmc_data);
476
477static AMBA_APB_DEVICE(aaci, "aaci", 0, INTEGRATOR_CP_AACI_BASE,
478 INTEGRATOR_CP_AACI_IRQS, NULL);
479
480static AMBA_AHB_DEVICE(clcd, "clcd", 0, INTCP_PA_CLCD_BASE,
481 { IRQ_CP_CLCDCINT }, &clcd_data);
482
483static struct amba_device *amba_devs[] __initdata = {
484 &mmc_device,
485 &aaci_device,
486 &clcd_device,
487};
488
489static void __init intcp_init(void)
490{
491 int i;
492
493 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs));
494
495 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
496 struct amba_device *d = amba_devs[i];
497 amba_device_register(d, &iomem_resource);
498 }
499 integrator_init(true);
500}
501
389MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP") 502MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
390 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 503 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
391 .atag_offset = 0x100, 504 .atag_offset = 0x100,
@@ -399,3 +512,5 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
399 .init_machine = intcp_init, 512 .init_machine = intcp_init,
400 .restart = integrator_restart, 513 .restart = integrator_restart,
401MACHINE_END 514MACHINE_END
515
516#endif
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index ca5c15a4e626..50bca5032b7e 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -94,6 +94,13 @@ config MACH_TS219_DT
94 or MV6282. If you have the wrong one, the buttons will not 94 or MV6282. If you have the wrong one, the buttons will not
95 work. 95 work.
96 96
97config MACH_DOCKSTAR_DT
98 bool "Seagate FreeAgent Dockstar (Flattened Device Tree)"
99 select ARCH_KIRKWOOD_DT
100 help
101 Say 'Y' here if you want your kernel to support the
102 Seagate FreeAgent Dockstar (Flattened Device Tree).
103
97config MACH_GOFLEXNET_DT 104config MACH_GOFLEXNET_DT
98 bool "Seagate GoFlex Net (Flattened Device Tree)" 105 bool "Seagate GoFlex Net (Flattened Device Tree)"
99 select ARCH_KIRKWOOD_DT 106 select ARCH_KIRKWOOD_DT
@@ -109,6 +116,20 @@ config MACH_LSXL_DT
109 Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using 116 Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
110 Flattened Device Tree. 117 Flattened Device Tree.
111 118
119config MACH_IOMEGA_IX2_200_DT
120 bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
121 select ARCH_KIRKWOOD_DT
122 help
123 Say 'Y' here if you want your kernel to support the
124 Iomega StorCenter ix2-200 (Flattened Device Tree).
125
126config MACH_KM_KIRKWOOD_DT
127 bool "Keymile Kirkwood Reference Design (Flattened Device Tree)"
128 select ARCH_KIRKWOOD_DT
129 help
130 Say 'Y' here if you want your kernel to support the
131 Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
132
112config MACH_TS219 133config MACH_TS219
113 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" 134 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
114 help 135 help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 055c85a1cc46..294779f892d9 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -26,5 +26,8 @@ obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o 26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o 27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
28obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o 28obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
29obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o
29obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o 30obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o
30obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o 31obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o
32obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o
33obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o
diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c
index e9a7180863d9..8f0d162a1e1d 100644
--- a/arch/arm/mach-kirkwood/addr-map.c
+++ b/arch/arm/mach-kirkwood/addr-map.c
@@ -86,5 +86,6 @@ void __init kirkwood_setup_cpu_mbus(void)
86 /* 86 /*
87 * Setup MBUS dram target info. 87 * Setup MBUS dram target info.
88 */ 88 */
89 orion_setup_cpu_mbus_target(&addr_map_cfg, DDR_WINDOW_CPU_BASE); 89 orion_setup_cpu_mbus_target(&addr_map_cfg,
90 (void __iomem *) DDR_WINDOW_CPU_BASE);
90} 91}
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
index 4ab35065a144..43d16d6714b8 100644
--- a/arch/arm/mach-kirkwood/board-dnskw.c
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -14,18 +14,8 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/ata_platform.h>
18#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
19#include <linux/of.h>
20#include <linux/gpio.h> 18#include <linux/gpio.h>
21#include <linux/input.h>
22#include <linux/gpio-fan.h>
23#include <linux/leds.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <mach/kirkwood.h>
28#include <mach/bridge-regs.h>
29#include "common.h" 19#include "common.h"
30#include "mpp.h" 20#include "mpp.h"
31 21
@@ -67,29 +57,6 @@ static unsigned int dnskw_mpp_config[] __initdata = {
67 0 57 0
68}; 58};
69 59
70/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
71static struct gpio_fan_speed dnskw_fan_speed[] = {
72 { 0, 0 },
73 { 3000, 1 },
74 { 6000, 2 },
75};
76static unsigned dnskw_fan_pins[] = {46, 45};
77
78static struct gpio_fan_platform_data dnskw_fan_data = {
79 .num_ctrl = ARRAY_SIZE(dnskw_fan_pins),
80 .ctrl = dnskw_fan_pins,
81 .num_speed = ARRAY_SIZE(dnskw_fan_speed),
82 .speed = dnskw_fan_speed,
83};
84
85static struct platform_device dnskw_fan_device = {
86 .name = "gpio-fan",
87 .id = -1,
88 .dev = {
89 .platform_data = &dnskw_fan_data,
90 },
91};
92
93static void dnskw_power_off(void) 60static void dnskw_power_off(void)
94{ 61{
95 gpio_set_value(36, 1); 62 gpio_set_value(36, 1);
@@ -114,8 +81,6 @@ void __init dnskw_init(void)
114 kirkwood_ehci_init(); 81 kirkwood_ehci_init();
115 kirkwood_ge00_init(&dnskw_ge00_data); 82 kirkwood_ge00_init(&dnskw_ge00_data);
116 83
117 platform_device_register(&dnskw_fan_device);
118
119 /* Register power-off GPIO. */ 84 /* Register power-off GPIO. */
120 if (gpio_request(36, "dnskw:power:off") == 0 85 if (gpio_request(36, "dnskw:power:off") == 0
121 && gpio_direction_output(36, 0) == 0) 86 && gpio_direction_output(36, 0) == 0)
diff --git a/arch/arm/mach-kirkwood/board-dockstar.c b/arch/arm/mach-kirkwood/board-dockstar.c
new file mode 100644
index 000000000000..f2fbb023e679
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-dockstar.c
@@ -0,0 +1,61 @@
1/*
2 * arch/arm/mach-kirkwood/board-dockstar.c
3 *
4 * Seagate FreeAgent Dockstar Board Init for drivers not converted to
5 * flattened device tree yet.
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 *
11 * Copied and modified for Seagate GoFlex Net support by
12 * Joshua Coombs <josh.coombs@gmail.com> based on ArchLinux ARM's
13 * GoFlex kernel patches.
14 *
15 */
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/platform_device.h>
20#include <linux/ata_platform.h>
21#include <linux/mv643xx_eth.h>
22#include <linux/of.h>
23#include <linux/of_address.h>
24#include <linux/of_fdt.h>
25#include <linux/of_irq.h>
26#include <linux/of_platform.h>
27#include <linux/gpio.h>
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <mach/kirkwood.h>
32#include <mach/bridge-regs.h>
33#include <linux/platform_data/mmc-mvsdio.h>
34#include "common.h"
35#include "mpp.h"
36
37static struct mv643xx_eth_platform_data dockstar_ge00_data = {
38 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
39};
40
41static unsigned int dockstar_mpp_config[] __initdata = {
42 MPP29_GPIO, /* USB Power Enable */
43 MPP46_GPIO, /* LED green */
44 MPP47_GPIO, /* LED orange */
45 0
46};
47
48void __init dockstar_dt_init(void)
49{
50 /*
51 * Basic setup. Needs to be called early.
52 */
53 kirkwood_mpp_conf(dockstar_mpp_config);
54
55 if (gpio_request(29, "USB Power Enable") != 0 ||
56 gpio_direction_output(29, 1) != 0)
57 pr_err("can't setup GPIO 29 (USB Power Enable)\n");
58 kirkwood_ehci_init();
59
60 kirkwood_ge00_init(&dockstar_ge00_data);
61}
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index e4eb450de301..70c5a2882409 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -33,6 +33,7 @@ struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
33 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL), 33 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
34 OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL), 34 OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
35 OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL), 35 OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
36 OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1030000, "mv_crypto", NULL),
36 {}, 37 {},
37}; 38};
38 39
@@ -60,7 +61,6 @@ static void __init kirkwood_dt_init(void)
60 /* internal devices that every board has */ 61 /* internal devices that every board has */
61 kirkwood_xor0_init(); 62 kirkwood_xor0_init();
62 kirkwood_xor1_init(); 63 kirkwood_xor1_init();
63 kirkwood_crypto_init();
64 64
65#ifdef CONFIG_KEXEC 65#ifdef CONFIG_KEXEC
66 kexec_reinit = kirkwood_enable_pcie; 66 kexec_reinit = kirkwood_enable_pcie;
@@ -81,12 +81,21 @@ static void __init kirkwood_dt_init(void)
81 if (of_machine_is_compatible("qnap,ts219")) 81 if (of_machine_is_compatible("qnap,ts219"))
82 qnap_dt_ts219_init(); 82 qnap_dt_ts219_init();
83 83
84 if (of_machine_is_compatible("seagate,dockstar"))
85 dockstar_dt_init();
86
84 if (of_machine_is_compatible("seagate,goflexnet")) 87 if (of_machine_is_compatible("seagate,goflexnet"))
85 goflexnet_init(); 88 goflexnet_init();
86 89
87 if (of_machine_is_compatible("buffalo,lsxl")) 90 if (of_machine_is_compatible("buffalo,lsxl"))
88 lsxl_init(); 91 lsxl_init();
89 92
93 if (of_machine_is_compatible("iom,ix2-200"))
94 iomega_ix2_200_init();
95
96 if (of_machine_is_compatible("keymile,km_kirkwood"))
97 km_kirkwood_init();
98
90 of_platform_populate(NULL, kirkwood_dt_match_table, 99 of_platform_populate(NULL, kirkwood_dt_match_table,
91 kirkwood_auxdata_lookup, NULL); 100 kirkwood_auxdata_lookup, NULL);
92} 101}
@@ -98,8 +107,11 @@ static const char *kirkwood_dt_board_compat[] = {
98 "iom,iconnect", 107 "iom,iconnect",
99 "raidsonic,ib-nas62x0", 108 "raidsonic,ib-nas62x0",
100 "qnap,ts219", 109 "qnap,ts219",
110 "seagate,dockstar",
101 "seagate,goflexnet", 111 "seagate,goflexnet",
102 "buffalo,lsxl", 112 "buffalo,lsxl",
113 "iom,ix2-200",
114 "keymile,km_kirkwood",
103 NULL 115 NULL
104}; 116};
105 117
diff --git a/arch/arm/mach-kirkwood/board-iconnect.c b/arch/arm/mach-kirkwood/board-iconnect.c
index d7a9198ed300..d084b1e2943a 100644
--- a/arch/arm/mach-kirkwood/board-iconnect.c
+++ b/arch/arm/mach-kirkwood/board-iconnect.c
@@ -16,11 +16,8 @@
16#include <linux/of_fdt.h> 16#include <linux/of_fdt.h>
17#include <linux/of_irq.h> 17#include <linux/of_irq.h>
18#include <linux/of_platform.h> 18#include <linux/of_platform.h>
19#include <linux/mtd/partitions.h>
20#include <linux/mv643xx_eth.h> 19#include <linux/mv643xx_eth.h>
21#include <linux/gpio.h> 20#include <linux/gpio.h>
22#include <linux/input.h>
23#include <linux/gpio_keys.h>
24#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
25#include <mach/kirkwood.h> 22#include <mach/kirkwood.h>
26#include "common.h" 23#include "common.h"
@@ -44,57 +41,12 @@ static unsigned int iconnect_mpp_config[] __initdata = {
44 0 41 0
45}; 42};
46 43
47static struct mtd_partition iconnect_nand_parts[] = {
48 {
49 .name = "flash",
50 .offset = 0,
51 .size = MTDPART_SIZ_FULL,
52 },
53};
54
55/* yikes... theses are the original input buttons */
56/* but I'm not convinced by the sw event choices */
57static struct gpio_keys_button iconnect_buttons[] = {
58 {
59 .type = EV_SW,
60 .code = SW_LID,
61 .gpio = 12,
62 .desc = "Reset Button",
63 .active_low = 1,
64 .debounce_interval = 100,
65 }, {
66 .type = EV_SW,
67 .code = SW_TABLET_MODE,
68 .gpio = 35,
69 .desc = "OTB Button",
70 .active_low = 1,
71 .debounce_interval = 100,
72 },
73};
74
75static struct gpio_keys_platform_data iconnect_button_data = {
76 .buttons = iconnect_buttons,
77 .nbuttons = ARRAY_SIZE(iconnect_buttons),
78};
79
80static struct platform_device iconnect_button_device = {
81 .name = "gpio-keys",
82 .id = -1,
83 .num_resources = 0,
84 .dev = {
85 .platform_data = &iconnect_button_data,
86 },
87};
88
89void __init iconnect_init(void) 44void __init iconnect_init(void)
90{ 45{
91 kirkwood_mpp_conf(iconnect_mpp_config); 46 kirkwood_mpp_conf(iconnect_mpp_config);
92 kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
93 47
94 kirkwood_ehci_init(); 48 kirkwood_ehci_init();
95 kirkwood_ge00_init(&iconnect_ge00_data); 49 kirkwood_ge00_init(&iconnect_ge00_data);
96
97 platform_device_register(&iconnect_button_device);
98} 50}
99 51
100static int __init iconnect_pci_init(void) 52static int __init iconnect_pci_init(void)
diff --git a/arch/arm/mach-kirkwood/board-iomega_ix2_200.c b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
new file mode 100644
index 000000000000..158fb97d0397
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/mach-kirkwood/board-iomega_ix2_200.c
3 *
4 * Iomega StorCenter ix2-200
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/mv643xx_eth.h>
15#include <linux/ethtool.h>
16#include <mach/kirkwood.h>
17#include "common.h"
18#include "mpp.h"
19
20static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
21 .phy_addr = MV643XX_ETH_PHY_NONE,
22 .speed = SPEED_1000,
23 .duplex = DUPLEX_FULL,
24};
25
26static unsigned int iomega_ix2_200_mpp_config[] __initdata = {
27 MPP12_GPIO, /* Reset Button */
28 MPP14_GPIO, /* Power Button */
29 MPP15_GPIO, /* Backup LED (blue) */
30 MPP16_GPIO, /* Power LED (white) */
31 MPP35_GPIO, /* OTB Button */
32 MPP36_GPIO, /* Rebuild LED (white) */
33 MPP37_GPIO, /* Health LED (red) */
34 MPP38_GPIO, /* SATA LED brightness control 1 */
35 MPP39_GPIO, /* SATA LED brightness control 2 */
36 MPP40_GPIO, /* Backup LED brightness control 1 */
37 MPP41_GPIO, /* Backup LED brightness control 2 */
38 MPP42_GPIO, /* Power LED brightness control 1 */
39 MPP43_GPIO, /* Power LED brightness control 2 */
40 MPP44_GPIO, /* Health LED brightness control 1 */
41 MPP45_GPIO, /* Health LED brightness control 2 */
42 MPP46_GPIO, /* Rebuild LED brightness control 1 */
43 MPP47_GPIO, /* Rebuild LED brightness control 2 */
44 0
45};
46
47void __init iomega_ix2_200_init(void)
48{
49 /*
50 * Basic setup. Needs to be called early.
51 */
52 kirkwood_mpp_conf(iomega_ix2_200_mpp_config);
53
54 kirkwood_ehci_init();
55
56 kirkwood_ge01_init(&iomega_ix2_200_ge00_data);
57}
diff --git a/arch/arm/mach-kirkwood/board-km_kirkwood.c b/arch/arm/mach-kirkwood/board-km_kirkwood.c
new file mode 100644
index 000000000000..f7d32834b757
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-km_kirkwood.c
@@ -0,0 +1,57 @@
1/*
2 * Copyright 2012 2012 KEYMILE AG, CH-3097 Bern
3 * Valentin Longchamp <valentin.longchamp@keymile.com>
4 *
5 * arch/arm/mach-kirkwood/board-km_kirkwood.c
6 *
7 * Keymile km_kirkwood Reference Desing Init for drivers not converted to
8 * flattened device tree yet.
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#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/mv643xx_eth.h>
18#include <linux/clk.h>
19#include <linux/clk-private.h>
20#include "common.h"
21#include "mpp.h"
22
23static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = {
24 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
25};
26
27static unsigned int km_kirkwood_mpp_config[] __initdata = {
28 MPP8_GPIO, /* I2C SDA */
29 MPP9_GPIO, /* I2C SCL */
30 0
31};
32
33void __init km_kirkwood_init(void)
34{
35 struct clk *sata_clk;
36 /*
37 * Basic setup. Needs to be called early.
38 */
39 kirkwood_mpp_conf(km_kirkwood_mpp_config);
40
41 /*
42 * Our variant of kirkwood (integrated in the Bobcat) hangs on accessing
43 * SATA bits (14-15) of the Clock Gating Control Register. Since these
44 * devices are also not present in this variant, their clocks get
45 * disabled because unused when clk_disable_unused() gets called.
46 * That's why we change the flags to these clocks to CLK_IGNORE_UNUSED
47 */
48 sata_clk = clk_get_sys("sata_mv.0", "0");
49 if (!IS_ERR(sata_clk))
50 sata_clk->flags |= CLK_IGNORE_UNUSED;
51 sata_clk = clk_get_sys("sata_mv.0", "1");
52 if (!IS_ERR(sata_clk))
53 sata_clk->flags |= CLK_IGNORE_UNUSED;
54
55 kirkwood_ehci_init();
56 kirkwood_ge00_init(&km_kirkwood_ge00_data);
57}
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 5c38c94b79a2..3991077f58a2 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -42,7 +42,7 @@
42 ****************************************************************************/ 42 ****************************************************************************/
43static struct map_desc kirkwood_io_desc[] __initdata = { 43static struct map_desc kirkwood_io_desc[] __initdata = {
44 { 44 {
45 .virtual = KIRKWOOD_REGS_VIRT_BASE, 45 .virtual = (unsigned long) KIRKWOOD_REGS_VIRT_BASE,
46 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE), 46 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE),
47 .length = KIRKWOOD_REGS_SIZE, 47 .length = KIRKWOOD_REGS_SIZE,
48 .type = MT_DEVICE, 48 .type = MT_DEVICE,
@@ -205,8 +205,7 @@ static struct clk *tclk;
205 205
206static struct clk __init *kirkwood_register_gate(const char *name, u8 bit_idx) 206static struct clk __init *kirkwood_register_gate(const char *name, u8 bit_idx)
207{ 207{
208 return clk_register_gate(NULL, name, "tclk", 0, 208 return clk_register_gate(NULL, name, "tclk", 0, CLOCK_GATING_CTRL,
209 (void __iomem *)CLOCK_GATING_CTRL,
210 bit_idx, 0, &gating_lock); 209 bit_idx, 0, &gating_lock);
211} 210}
212 211
@@ -215,8 +214,7 @@ static struct clk __init *kirkwood_register_gate_fn(const char *name,
215 void (*fn_en)(void), 214 void (*fn_en)(void),
216 void (*fn_dis)(void)) 215 void (*fn_dis)(void))
217{ 216{
218 return clk_register_gate_fn(NULL, name, "tclk", 0, 217 return clk_register_gate_fn(NULL, name, "tclk", 0, CLOCK_GATING_CTRL,
219 (void __iomem *)CLOCK_GATING_CTRL,
220 bit_idx, 0, &gating_lock, fn_en, fn_dis); 218 bit_idx, 0, &gating_lock, fn_en, fn_dis);
221} 219}
222 220
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 304dd1abfdca..bcffd7ca1ca2 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -82,6 +82,12 @@ void ib62x0_init(void);
82static inline void ib62x0_init(void) {}; 82static inline void ib62x0_init(void) {};
83#endif 83#endif
84 84
85#ifdef CONFIG_MACH_DOCKSTAR_DT
86void dockstar_dt_init(void);
87#else
88static inline void dockstar_dt_init(void) {};
89#endif
90
85#ifdef CONFIG_MACH_GOFLEXNET_DT 91#ifdef CONFIG_MACH_GOFLEXNET_DT
86void goflexnet_init(void); 92void goflexnet_init(void);
87#else 93#else
@@ -94,6 +100,18 @@ void lsxl_init(void);
94static inline void lsxl_init(void) {}; 100static inline void lsxl_init(void) {};
95#endif 101#endif
96 102
103#ifdef CONFIG_MACH_IOMEGA_IX2_200_DT
104void iomega_ix2_200_init(void);
105#else
106static inline void iomega_ix2_200_init(void) {};
107#endif
108
109#ifdef CONFIG_MACH_KM_KIRKWOOD_DT
110void km_kirkwood_init(void);
111#else
112static inline void km_kirkwood_init(void) {};
113#endif
114
97/* early init functions not converted to fdt yet */ 115/* early init functions not converted to fdt yet */
98char *kirkwood_id(void); 116char *kirkwood_id(void);
99void kirkwood_l2_init(void); 117void kirkwood_l2_init(void);
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
index a115142f8690..5c82b7dce4e2 100644
--- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
+++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
@@ -13,37 +13,37 @@
13 13
14#include <mach/kirkwood.h> 14#include <mach/kirkwood.h>
15 15
16#define CPU_CONFIG (BRIDGE_VIRT_BASE | 0x0100) 16#define CPU_CONFIG (BRIDGE_VIRT_BASE + 0x0100)
17#define CPU_CONFIG_ERROR_PROP 0x00000004 17#define CPU_CONFIG_ERROR_PROP 0x00000004
18 18
19#define CPU_CONTROL (BRIDGE_VIRT_BASE | 0x0104) 19#define CPU_CONTROL (BRIDGE_VIRT_BASE + 0x0104)
20#define CPU_RESET 0x00000002 20#define CPU_RESET 0x00000002
21 21
22#define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108) 22#define RSTOUTn_MASK (BRIDGE_VIRT_BASE + 0x0108)
23#define WDT_RESET_OUT_EN 0x00000002 23#define WDT_RESET_OUT_EN 0x00000002
24#define SOFT_RESET_OUT_EN 0x00000004 24#define SOFT_RESET_OUT_EN 0x00000004
25 25
26#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c) 26#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE + 0x010c)
27#define SOFT_RESET 0x00000001 27#define SOFT_RESET 0x00000001
28 28
29#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110) 29#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE + 0x0110)
30#define WDT_INT_REQ 0x0008 30#define WDT_INT_REQ 0x0008
31 31
32#define BRIDGE_INT_TIMER1_CLR (~0x0004) 32#define BRIDGE_INT_TIMER1_CLR (~0x0004)
33 33
34#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200) 34#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0200)
35#define IRQ_CAUSE_LOW_OFF 0x0000 35#define IRQ_CAUSE_LOW_OFF 0x0000
36#define IRQ_MASK_LOW_OFF 0x0004 36#define IRQ_MASK_LOW_OFF 0x0004
37#define IRQ_CAUSE_HIGH_OFF 0x0010 37#define IRQ_CAUSE_HIGH_OFF 0x0010
38#define IRQ_MASK_HIGH_OFF 0x0014 38#define IRQ_MASK_HIGH_OFF 0x0014
39 39
40#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300) 40#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0300)
41#define TIMER_PHYS_BASE (BRIDGE_PHYS_BASE | 0x0300) 41#define TIMER_PHYS_BASE (BRIDGE_PHYS_BASE + 0x0300)
42 42
43#define L2_CONFIG_REG (BRIDGE_VIRT_BASE | 0x0128) 43#define L2_CONFIG_REG (BRIDGE_VIRT_BASE + 0x0128)
44#define L2_WRITETHROUGH 0x00000010 44#define L2_WRITETHROUGH 0x00000010
45 45
46#define CLOCK_GATING_CTRL (BRIDGE_VIRT_BASE | 0x11c) 46#define CLOCK_GATING_CTRL (BRIDGE_VIRT_BASE + 0x11c)
47#define CGC_BIT_GE0 (0) 47#define CGC_BIT_GE0 (0)
48#define CGC_BIT_PEX0 (2) 48#define CGC_BIT_PEX0 (2)
49#define CGC_BIT_USB0 (3) 49#define CGC_BIT_USB0 (3)
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
index af4f0000dcef..041653a04a9c 100644
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -45,7 +45,7 @@
45#define KIRKWOOD_PCIE_IO_SIZE SZ_64K 45#define KIRKWOOD_PCIE_IO_SIZE SZ_64K
46 46
47#define KIRKWOOD_REGS_PHYS_BASE 0xf1000000 47#define KIRKWOOD_REGS_PHYS_BASE 0xf1000000
48#define KIRKWOOD_REGS_VIRT_BASE 0xfed00000 48#define KIRKWOOD_REGS_VIRT_BASE IOMEM(0xfed00000)
49#define KIRKWOOD_REGS_SIZE SZ_1M 49#define KIRKWOOD_REGS_SIZE SZ_1M
50 50
51#define KIRKWOOD_PCIE_MEM_PHYS_BASE 0xe0000000 51#define KIRKWOOD_PCIE_MEM_PHYS_BASE 0xe0000000
@@ -59,61 +59,61 @@
59/* 59/*
60 * Register Map 60 * Register Map
61 */ 61 */
62#define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x00000) 62#define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x00000)
63#define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE | 0x1500) 63#define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE + 0x1500)
64#define DDR_OPERATION_BASE (DDR_VIRT_BASE | 0x1418) 64#define DDR_OPERATION_BASE (DDR_VIRT_BASE + 0x1418)
65 65
66#define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x10000) 66#define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x10000)
67#define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x10000) 67#define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x10000)
68#define SAMPLE_AT_RESET (DEV_BUS_VIRT_BASE | 0x0030) 68#define SAMPLE_AT_RESET (DEV_BUS_VIRT_BASE + 0x0030)
69#define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034) 69#define DEVICE_ID (DEV_BUS_VIRT_BASE + 0x0034)
70#define GPIO_LOW_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x0100) 70#define GPIO_LOW_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x0100)
71#define GPIO_HIGH_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x0140) 71#define GPIO_HIGH_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x0140)
72#define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300) 72#define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x0300)
73#define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600) 73#define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x0600)
74#define I2C_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1000) 74#define I2C_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x1000)
75#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000) 75#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x2000)
76#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000) 76#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x2000)
77#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100) 77#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x2100)
78#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2100) 78#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x2100)
79 79
80#define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x20000) 80#define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x20000)
81#define BRIDGE_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x20000) 81#define BRIDGE_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x20000)
82 82
83#define CRYPTO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x30000) 83#define CRYPTO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x30000)
84 84
85#define PCIE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x40000) 85#define PCIE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x40000)
86#define PCIE_LINK_CTRL (PCIE_VIRT_BASE | 0x70) 86#define PCIE_LINK_CTRL (PCIE_VIRT_BASE + 0x70)
87#define PCIE_STATUS (PCIE_VIRT_BASE | 0x1a04) 87#define PCIE_STATUS (PCIE_VIRT_BASE + 0x1a04)
88#define PCIE1_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x44000) 88#define PCIE1_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x44000)
89#define PCIE1_LINK_CTRL (PCIE1_VIRT_BASE | 0x70) 89#define PCIE1_LINK_CTRL (PCIE1_VIRT_BASE + 0x70)
90#define PCIE1_STATUS (PCIE1_VIRT_BASE | 0x1a04) 90#define PCIE1_STATUS (PCIE1_VIRT_BASE + 0x1a04)
91 91
92#define USB_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x50000) 92#define USB_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x50000)
93 93
94#define XOR0_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x60800) 94#define XOR0_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x60800)
95#define XOR0_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x60800) 95#define XOR0_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x60800)
96#define XOR1_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x60900) 96#define XOR1_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x60900)
97#define XOR1_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x60900) 97#define XOR1_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x60900)
98#define XOR0_HIGH_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x60A00) 98#define XOR0_HIGH_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x60A00)
99#define XOR0_HIGH_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x60A00) 99#define XOR0_HIGH_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x60A00)
100#define XOR1_HIGH_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x60B00) 100#define XOR1_HIGH_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x60B00)
101#define XOR1_HIGH_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x60B00) 101#define XOR1_HIGH_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x60B00)
102 102
103#define GE00_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x70000) 103#define GE00_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x70000)
104#define GE01_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x74000) 104#define GE01_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x74000)
105 105
106#define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000) 106#define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x80000)
107#define SATA_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x80000) 107#define SATA_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x80000)
108#define SATA0_IF_CTRL (SATA_VIRT_BASE | 0x2050) 108#define SATA0_IF_CTRL (SATA_VIRT_BASE + 0x2050)
109#define SATA0_PHY_MODE_2 (SATA_VIRT_BASE | 0x2330) 109#define SATA0_PHY_MODE_2 (SATA_VIRT_BASE + 0x2330)
110#define SATA1_IF_CTRL (SATA_VIRT_BASE | 0x4050) 110#define SATA1_IF_CTRL (SATA_VIRT_BASE + 0x4050)
111#define SATA1_PHY_MODE_2 (SATA_VIRT_BASE | 0x4330) 111#define SATA1_PHY_MODE_2 (SATA_VIRT_BASE + 0x4330)
112 112
113#define SDIO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x90000) 113#define SDIO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x90000)
114 114
115#define AUDIO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0xA0000) 115#define AUDIO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0xA0000)
116#define AUDIO_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0xA0000) 116#define AUDIO_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0xA0000)
117 117
118/* 118/*
119 * Supported devices and revisions. 119 * Supported devices and revisions.
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
index 20149a7fd280..884703535a0a 100644
--- a/arch/arm/mach-kirkwood/irq.c
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -10,6 +10,7 @@
10#include <linux/gpio.h> 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/io.h>
13#include <mach/bridge-regs.h> 14#include <mach/bridge-regs.h>
14#include <plat/orion-gpio.h> 15#include <plat/orion-gpio.h>
15#include <plat/irq.h> 16#include <plat/irq.h>
@@ -30,14 +31,14 @@ static int __initdata gpio1_irqs[4] = {
30 31
31void __init kirkwood_init_irq(void) 32void __init kirkwood_init_irq(void)
32{ 33{
33 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); 34 orion_irq_init(0, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF);
34 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); 35 orion_irq_init(32, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF);
35 36
36 /* 37 /*
37 * Initialize gpiolib for GPIOs 0-49. 38 * Initialize gpiolib for GPIOs 0-49.
38 */ 39 */
39 orion_gpio_init(NULL, 0, 32, (void __iomem *)GPIO_LOW_VIRT_BASE, 0, 40 orion_gpio_init(NULL, 0, 32, GPIO_LOW_VIRT_BASE, 0,
40 IRQ_KIRKWOOD_GPIO_START, gpio0_irqs); 41 IRQ_KIRKWOOD_GPIO_START, gpio0_irqs);
41 orion_gpio_init(NULL, 32, 18, (void __iomem *)GPIO_HIGH_VIRT_BASE, 0, 42 orion_gpio_init(NULL, 32, 18, GPIO_HIGH_VIRT_BASE, 0,
42 IRQ_KIRKWOOD_GPIO_START + 32, gpio1_irqs); 43 IRQ_KIRKWOOD_GPIO_START + 32, gpio1_irqs);
43} 44}
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index 532d8acb38f9..ec544918b12c 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -47,8 +47,8 @@ void kirkwood_enable_pcie(void)
47void kirkwood_pcie_id(u32 *dev, u32 *rev) 47void kirkwood_pcie_id(u32 *dev, u32 *rev)
48{ 48{
49 kirkwood_enable_pcie(); 49 kirkwood_enable_pcie();
50 *dev = orion_pcie_dev_id((void __iomem *)PCIE_VIRT_BASE); 50 *dev = orion_pcie_dev_id(PCIE_VIRT_BASE);
51 *rev = orion_pcie_rev((void __iomem *)PCIE_VIRT_BASE); 51 *rev = orion_pcie_rev(PCIE_VIRT_BASE);
52} 52}
53 53
54struct pcie_port { 54struct pcie_port {
@@ -133,7 +133,7 @@ static struct pci_ops pcie_ops = {
133 133
134static void __init pcie0_ioresources_init(struct pcie_port *pp) 134static void __init pcie0_ioresources_init(struct pcie_port *pp)
135{ 135{
136 pp->base = (void __iomem *)PCIE_VIRT_BASE; 136 pp->base = PCIE_VIRT_BASE;
137 pp->irq = IRQ_KIRKWOOD_PCIE; 137 pp->irq = IRQ_KIRKWOOD_PCIE;
138 138
139 /* 139 /*
@@ -147,7 +147,7 @@ static void __init pcie0_ioresources_init(struct pcie_port *pp)
147 147
148static void __init pcie1_ioresources_init(struct pcie_port *pp) 148static void __init pcie1_ioresources_init(struct pcie_port *pp)
149{ 149{
150 pp->base = (void __iomem *)PCIE1_VIRT_BASE; 150 pp->base = PCIE1_VIRT_BASE;
151 pp->irq = IRQ_KIRKWOOD_PCIE1; 151 pp->irq = IRQ_KIRKWOOD_PCIE1;
152 152
153 /* 153 /*
@@ -255,11 +255,11 @@ static struct hw_pci kirkwood_pci __initdata = {
255 .map_irq = kirkwood_pcie_map_irq, 255 .map_irq = kirkwood_pcie_map_irq,
256}; 256};
257 257
258static void __init add_pcie_port(int index, unsigned long base) 258static void __init add_pcie_port(int index, void __iomem *base)
259{ 259{
260 printk(KERN_INFO "Kirkwood PCIe port %d: ", index); 260 printk(KERN_INFO "Kirkwood PCIe port %d: ", index);
261 261
262 if (orion_pcie_link_up((void __iomem *)base)) { 262 if (orion_pcie_link_up(base)) {
263 printk(KERN_INFO "link up\n"); 263 printk(KERN_INFO "link up\n");
264 pcie_port_map[num_pcie_ports++] = index; 264 pcie_port_map[num_pcie_ports++] = index;
265 } else 265 } else
diff --git a/arch/arm/mach-kirkwood/ts41x-setup.c b/arch/arm/mach-kirkwood/ts41x-setup.c
index 5bbca2680442..367a9400f532 100644
--- a/arch/arm/mach-kirkwood/ts41x-setup.c
+++ b/arch/arm/mach-kirkwood/ts41x-setup.c
@@ -20,6 +20,7 @@
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/io.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
25#include <mach/kirkwood.h> 26#include <mach/kirkwood.h>
@@ -161,7 +162,7 @@ static int __init ts41x_pci_init(void)
161 * (Marvell 88sx7042/sata_mv) is known to stop working 162 * (Marvell 88sx7042/sata_mv) is known to stop working
162 * after a few minutes. 163 * after a few minutes.
163 */ 164 */
164 orion_pcie_reset((void __iomem *)PCIE_VIRT_BASE); 165 orion_pcie_reset(PCIE_VIRT_BASE);
165 166
166 kirkwood_pcie_id(&dev, &rev); 167 kirkwood_pcie_id(&dev, &rev);
167 if (dev == MV88F6282_DEV_ID) 168 if (dev == MV88F6282_DEV_ID)
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index a344a373928b..2448fcf09eb1 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -37,8 +37,8 @@
37#include "devices.h" 37#include "devices.h"
38#include "common.h" 38#include "common.h"
39 39
40static const resource_size_t qsd8x50_surf_smc91x_base __initdata = 0x70000300; 40static const resource_size_t qsd8x50_surf_smc91x_base __initconst = 0x70000300;
41static const unsigned qsd8x50_surf_smc91x_gpio __initdata = 156; 41static const unsigned qsd8x50_surf_smc91x_gpio __initconst = 156;
42 42
43/* Leave smc91x resources empty here, as we'll fill them in 43/* Leave smc91x resources empty here, as we'll fill them in
44 * at run-time: they vary from board to board, and the true 44 * at run-time: they vary from board to board, and the true
diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c
index 137e479d15a0..343c435b4176 100644
--- a/arch/arm/mach-mv78xx0/addr-map.c
+++ b/arch/arm/mach-mv78xx0/addr-map.c
@@ -48,7 +48,7 @@ static void __init __iomem *win_cfg_base(const struct orion_addr_map_cfg *cfg, i
48 * so we don't need to take that into account here. 48 * so we don't need to take that into account here.
49 */ 49 */
50 50
51 return (void __iomem *)((win < 8) ? WIN0_OFF(win) : WIN8_OFF(win)); 51 return (win < 8) ? WIN0_OFF(win) : WIN8_OFF(win);
52} 52}
53 53
54/* 54/*
@@ -72,10 +72,10 @@ void __init mv78xx0_setup_cpu_mbus(void)
72 */ 72 */
73 if (mv78xx0_core_index() == 0) 73 if (mv78xx0_core_index() == 0)
74 orion_setup_cpu_mbus_target(&addr_map_cfg, 74 orion_setup_cpu_mbus_target(&addr_map_cfg,
75 DDR_WINDOW_CPU0_BASE); 75 (void __iomem *) DDR_WINDOW_CPU0_BASE);
76 else 76 else
77 orion_setup_cpu_mbus_target(&addr_map_cfg, 77 orion_setup_cpu_mbus_target(&addr_map_cfg,
78 DDR_WINDOW_CPU1_BASE); 78 (void __iomem *) DDR_WINDOW_CPU1_BASE);
79} 79}
80 80
81void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size, 81void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size,
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index a6f3cd21e8c2..131cd4883f3d 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -130,12 +130,12 @@ static int get_tclk(void)
130 ****************************************************************************/ 130 ****************************************************************************/
131static struct map_desc mv78xx0_io_desc[] __initdata = { 131static struct map_desc mv78xx0_io_desc[] __initdata = {
132 { 132 {
133 .virtual = MV78XX0_CORE_REGS_VIRT_BASE, 133 .virtual = (unsigned long) MV78XX0_CORE_REGS_VIRT_BASE,
134 .pfn = 0, 134 .pfn = 0,
135 .length = MV78XX0_CORE_REGS_SIZE, 135 .length = MV78XX0_CORE_REGS_SIZE,
136 .type = MT_DEVICE, 136 .type = MT_DEVICE,
137 }, { 137 }, {
138 .virtual = MV78XX0_REGS_VIRT_BASE, 138 .virtual = (unsigned long) MV78XX0_REGS_VIRT_BASE,
139 .pfn = __phys_to_pfn(MV78XX0_REGS_PHYS_BASE), 139 .pfn = __phys_to_pfn(MV78XX0_REGS_PHYS_BASE),
140 .length = MV78XX0_REGS_SIZE, 140 .length = MV78XX0_REGS_SIZE,
141 .type = MT_DEVICE, 141 .type = MT_DEVICE,
diff --git a/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h b/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h
index eb187e0e059b..5f03484584d4 100644
--- a/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h
+++ b/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h
@@ -11,18 +11,18 @@
11 11
12#include <mach/mv78xx0.h> 12#include <mach/mv78xx0.h>
13 13
14#define CPU_CONTROL (BRIDGE_VIRT_BASE | 0x0104) 14#define CPU_CONTROL (BRIDGE_VIRT_BASE + 0x0104)
15#define L2_WRITETHROUGH 0x00020000 15#define L2_WRITETHROUGH 0x00020000
16 16
17#define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108) 17#define RSTOUTn_MASK (BRIDGE_VIRT_BASE + 0x0108)
18#define SOFT_RESET_OUT_EN 0x00000004 18#define SOFT_RESET_OUT_EN 0x00000004
19 19
20#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c) 20#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE + 0x010c)
21#define SOFT_RESET 0x00000001 21#define SOFT_RESET 0x00000001
22 22
23#define BRIDGE_INT_TIMER1_CLR (~0x0004) 23#define BRIDGE_INT_TIMER1_CLR (~0x0004)
24 24
25#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200) 25#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0200)
26#define IRQ_CAUSE_ERR_OFF 0x0000 26#define IRQ_CAUSE_ERR_OFF 0x0000
27#define IRQ_CAUSE_LOW_OFF 0x0004 27#define IRQ_CAUSE_LOW_OFF 0x0004
28#define IRQ_CAUSE_HIGH_OFF 0x0008 28#define IRQ_CAUSE_HIGH_OFF 0x0008
@@ -30,7 +30,7 @@
30#define IRQ_MASK_LOW_OFF 0x0010 30#define IRQ_MASK_LOW_OFF 0x0010
31#define IRQ_MASK_HIGH_OFF 0x0014 31#define IRQ_MASK_HIGH_OFF 0x0014
32 32
33#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300) 33#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0300)
34#define TIMER_PHYS_BASE (BRIDGE_PHYS_BASE | 0x0300) 34#define TIMER_PHYS_BASE (BRIDGE_PHYS_BASE + 0x0300)
35 35
36#endif 36#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
index bd03fed1128e..46200a183cf2 100644
--- a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
+++ b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
@@ -41,7 +41,7 @@
41 */ 41 */
42#define MV78XX0_CORE0_REGS_PHYS_BASE 0xf1020000 42#define MV78XX0_CORE0_REGS_PHYS_BASE 0xf1020000
43#define MV78XX0_CORE1_REGS_PHYS_BASE 0xf1024000 43#define MV78XX0_CORE1_REGS_PHYS_BASE 0xf1024000
44#define MV78XX0_CORE_REGS_VIRT_BASE 0xfe400000 44#define MV78XX0_CORE_REGS_VIRT_BASE IOMEM(0xfe400000)
45#define MV78XX0_CORE_REGS_PHYS_BASE 0xfe400000 45#define MV78XX0_CORE_REGS_PHYS_BASE 0xfe400000
46#define MV78XX0_CORE_REGS_SIZE SZ_16K 46#define MV78XX0_CORE_REGS_SIZE SZ_16K
47 47
@@ -49,7 +49,7 @@
49#define MV78XX0_PCIE_IO_SIZE SZ_1M 49#define MV78XX0_PCIE_IO_SIZE SZ_1M
50 50
51#define MV78XX0_REGS_PHYS_BASE 0xf1000000 51#define MV78XX0_REGS_PHYS_BASE 0xf1000000
52#define MV78XX0_REGS_VIRT_BASE 0xfd000000 52#define MV78XX0_REGS_VIRT_BASE IOMEM(0xfd000000)
53#define MV78XX0_REGS_SIZE SZ_1M 53#define MV78XX0_REGS_SIZE SZ_1M
54 54
55#define MV78XX0_PCIE_MEM_PHYS_BASE 0xc0000000 55#define MV78XX0_PCIE_MEM_PHYS_BASE 0xc0000000
@@ -64,47 +64,47 @@
64/* 64/*
65 * Register Map 65 * Register Map
66 */ 66 */
67#define DDR_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x00000) 67#define DDR_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x00000)
68#define DDR_WINDOW_CPU0_BASE (DDR_VIRT_BASE | 0x1500) 68#define DDR_WINDOW_CPU0_BASE (DDR_VIRT_BASE + 0x1500)
69#define DDR_WINDOW_CPU1_BASE (DDR_VIRT_BASE | 0x1570) 69#define DDR_WINDOW_CPU1_BASE (DDR_VIRT_BASE + 0x1570)
70 70
71#define DEV_BUS_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x10000) 71#define DEV_BUS_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x10000)
72#define DEV_BUS_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x10000) 72#define DEV_BUS_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x10000)
73#define SAMPLE_AT_RESET_LOW (DEV_BUS_VIRT_BASE | 0x0030) 73#define SAMPLE_AT_RESET_LOW (DEV_BUS_VIRT_BASE + 0x0030)
74#define SAMPLE_AT_RESET_HIGH (DEV_BUS_VIRT_BASE | 0x0034) 74#define SAMPLE_AT_RESET_HIGH (DEV_BUS_VIRT_BASE + 0x0034)
75#define GPIO_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x0100) 75#define GPIO_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x0100)
76#define I2C_0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1000) 76#define I2C_0_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x1000)
77#define I2C_1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1100) 77#define I2C_1_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x1100)
78#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000) 78#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x2000)
79#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000) 79#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x2000)
80#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100) 80#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x2100)
81#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2100) 81#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x2100)
82#define UART2_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2200) 82#define UART2_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x2200)
83#define UART2_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2200) 83#define UART2_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x2200)
84#define UART3_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2300) 84#define UART3_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x2300)
85#define UART3_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2300) 85#define UART3_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x2300)
86 86
87#define GE10_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x30000) 87#define GE10_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x30000)
88#define GE11_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x34000) 88#define GE11_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x34000)
89 89
90#define PCIE00_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x40000) 90#define PCIE00_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x40000)
91#define PCIE01_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x44000) 91#define PCIE01_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x44000)
92#define PCIE02_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x48000) 92#define PCIE02_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x48000)
93#define PCIE03_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x4c000) 93#define PCIE03_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x4c000)
94 94
95#define USB0_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x50000) 95#define USB0_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x50000)
96#define USB1_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x51000) 96#define USB1_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x51000)
97#define USB2_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x52000) 97#define USB2_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x52000)
98 98
99#define GE00_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x70000) 99#define GE00_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x70000)
100#define GE01_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x74000) 100#define GE01_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x74000)
101 101
102#define PCIE10_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x80000) 102#define PCIE10_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x80000)
103#define PCIE11_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x84000) 103#define PCIE11_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x84000)
104#define PCIE12_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x88000) 104#define PCIE12_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x88000)
105#define PCIE13_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x8c000) 105#define PCIE13_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x8c000)
106 106
107#define SATA_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0xa0000) 107#define SATA_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0xa0000)
108 108
109/* 109/*
110 * Supported devices and revisions. 110 * Supported devices and revisions.
diff --git a/arch/arm/mach-mv78xx0/irq.c b/arch/arm/mach-mv78xx0/irq.c
index 4d720f2aedba..32073444024b 100644
--- a/arch/arm/mach-mv78xx0/irq.c
+++ b/arch/arm/mach-mv78xx0/irq.c
@@ -10,6 +10,7 @@
10#include <linux/gpio.h> 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/io.h>
13#include <mach/bridge-regs.h> 14#include <mach/bridge-regs.h>
14#include <plat/orion-gpio.h> 15#include <plat/orion-gpio.h>
15#include <plat/irq.h> 16#include <plat/irq.h>
@@ -24,16 +25,16 @@ static int __initdata gpio0_irqs[4] = {
24 25
25void __init mv78xx0_init_irq(void) 26void __init mv78xx0_init_irq(void)
26{ 27{
27 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); 28 orion_irq_init(0, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF);
28 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); 29 orion_irq_init(32, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF);
29 orion_irq_init(64, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_ERR_OFF)); 30 orion_irq_init(64, IRQ_VIRT_BASE + IRQ_MASK_ERR_OFF);
30 31
31 /* 32 /*
32 * Initialize gpiolib for GPIOs 0-31. (The GPIO interrupt mask 33 * Initialize gpiolib for GPIOs 0-31. (The GPIO interrupt mask
33 * registers for core #1 are at an offset of 0x18 from those of 34 * registers for core #1 are at an offset of 0x18 from those of
34 * core #0.) 35 * core #0.)
35 */ 36 */
36 orion_gpio_init(NULL, 0, 32, (void __iomem *)GPIO_VIRT_BASE, 37 orion_gpio_init(NULL, 0, 32, GPIO_VIRT_BASE,
37 mv78xx0_core_index() ? 0x18 : 0, 38 mv78xx0_core_index() ? 0x18 : 0,
38 IRQ_MV78XX0_GPIO_START, gpio0_irqs); 39 IRQ_MV78XX0_GPIO_START, gpio0_irqs);
39} 40}
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
index 26a059b4f472..a9a154a646dd 100644
--- a/arch/arm/mach-mv78xx0/pcie.c
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -34,8 +34,8 @@ static struct resource pcie_io_space;
34 34
35void __init mv78xx0_pcie_id(u32 *dev, u32 *rev) 35void __init mv78xx0_pcie_id(u32 *dev, u32 *rev)
36{ 36{
37 *dev = orion_pcie_dev_id((void __iomem *)PCIE00_VIRT_BASE); 37 *dev = orion_pcie_dev_id(PCIE00_VIRT_BASE);
38 *rev = orion_pcie_rev((void __iomem *)PCIE00_VIRT_BASE); 38 *rev = orion_pcie_rev(PCIE00_VIRT_BASE);
39} 39}
40 40
41u32 pcie_port_size[8] = { 41u32 pcie_port_size[8] = {
@@ -223,11 +223,11 @@ static struct hw_pci mv78xx0_pci __initdata = {
223 .map_irq = mv78xx0_pcie_map_irq, 223 .map_irq = mv78xx0_pcie_map_irq,
224}; 224};
225 225
226static void __init add_pcie_port(int maj, int min, unsigned long base) 226static void __init add_pcie_port(int maj, int min, void __iomem *base)
227{ 227{
228 printk(KERN_INFO "MV78xx0 PCIe port %d.%d: ", maj, min); 228 printk(KERN_INFO "MV78xx0 PCIe port %d.%d: ", maj, min);
229 229
230 if (orion_pcie_link_up((void __iomem *)base)) { 230 if (orion_pcie_link_up(base)) {
231 struct pcie_port *pp = &pcie_port[num_pcie_ports++]; 231 struct pcie_port *pp = &pcie_port[num_pcie_ports++];
232 232
233 printk("link up\n"); 233 printk("link up\n");
@@ -235,7 +235,7 @@ static void __init add_pcie_port(int maj, int min, unsigned long base)
235 pp->maj = maj; 235 pp->maj = maj;
236 pp->min = min; 236 pp->min = min;
237 pp->root_bus_nr = -1; 237 pp->root_bus_nr = -1;
238 pp->base = (void __iomem *)base; 238 pp->base = base;
239 spin_lock_init(&pp->conf_lock); 239 spin_lock_init(&pp->conf_lock);
240 memset(&pp->res, 0, sizeof(pp->res)); 240 memset(&pp->res, 0, sizeof(pp->res));
241 } else { 241 } else {
@@ -249,7 +249,7 @@ void __init mv78xx0_pcie_init(int init_port0, int init_port1)
249 249
250 if (init_port0) { 250 if (init_port0) {
251 add_pcie_port(0, 0, PCIE00_VIRT_BASE); 251 add_pcie_port(0, 0, PCIE00_VIRT_BASE);
252 if (!orion_pcie_x4_mode((void __iomem *)PCIE00_VIRT_BASE)) { 252 if (!orion_pcie_x4_mode(PCIE00_VIRT_BASE)) {
253 add_pcie_port(0, 1, PCIE01_VIRT_BASE); 253 add_pcie_port(0, 1, PCIE01_VIRT_BASE);
254 add_pcie_port(0, 2, PCIE02_VIRT_BASE); 254 add_pcie_port(0, 2, PCIE02_VIRT_BASE);
255 add_pcie_port(0, 3, PCIE03_VIRT_BASE); 255 add_pcie_port(0, 3, PCIE03_VIRT_BASE);
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 7b270358536e..416d46ef7ebd 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -6,6 +6,8 @@ config ARCH_MVEBU
6 select GENERIC_IRQ_CHIP 6 select GENERIC_IRQ_CHIP
7 select IRQ_DOMAIN 7 select IRQ_DOMAIN
8 select MULTI_IRQ_HANDLER 8 select MULTI_IRQ_HANDLER
9 select PINCTRL
10 select PLAT_ORION
9 select SPARSE_IRQ 11 select SPARSE_IRQ
10 12
11if ARCH_MVEBU 13if ARCH_MVEBU
@@ -13,13 +15,25 @@ if ARCH_MVEBU
13menu "Marvell SOC with device tree" 15menu "Marvell SOC with device tree"
14 16
15config MACH_ARMADA_370_XP 17config MACH_ARMADA_370_XP
16 bool "Marvell Armada 370 and Aramada XP boards" 18 bool
17 select ARMADA_370_XP_TIMER 19 select ARMADA_370_XP_TIMER
18 select CPU_V7 20 select CPU_V7
21
22config MACH_ARMADA_370
23 bool "Marvell Armada 370 boards"
24 select MACH_ARMADA_370_XP
25 select PINCTRL_ARMADA_370
19 help 26 help
27 Say 'Y' here if you want your kernel to support boards based
28 on the Marvell Armada 370 SoC with device tree.
20 29
21 Say 'Y' here if you want your kernel to support boards based on 30config MACH_ARMADA_XP
22 Marvell Armada 370 or Armada XP with device tree. 31 bool "Marvell Armada XP boards"
32 select MACH_ARMADA_370_XP
33 select PINCTRL_ARMADA_XP
34 help
35 Say 'Y' here if you want your kernel to support boards based
36 on the Marvell Armada XP SoC with device tree.
23 37
24endmenu 38endmenu
25 39
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 6ea8998ab8f1..57f996b6aa0e 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -1,4 +1,5 @@
1ccflags-$(ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include 1ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
2 -I$(srctree)/arch/arm/plat-orion/include
2 3
3obj-y += system-controller.o 4obj-y += system-controller.o
4obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o irq-armada-370-xp.o 5obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o irq-armada-370-xp.o addr-map.o
diff --git a/arch/arm/mach-mvebu/addr-map.c b/arch/arm/mach-mvebu/addr-map.c
new file mode 100644
index 000000000000..fe454a4430be
--- /dev/null
+++ b/arch/arm/mach-mvebu/addr-map.c
@@ -0,0 +1,134 @@
1/*
2 * Address map functions for Marvell 370 / XP SoCs
3 *
4 * Copyright (C) 2012 Marvell
5 *
6 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/mbus.h>
16#include <linux/io.h>
17#include <linux/of.h>
18#include <linux/of_address.h>
19#include <plat/addr-map.h>
20
21/*
22 * Generic Address Decode Windows bit settings
23 */
24#define ARMADA_XP_TARGET_DEV_BUS 1
25#define ARMADA_XP_ATTR_DEV_BOOTROM 0x1D
26#define ARMADA_XP_TARGET_ETH1 3
27#define ARMADA_XP_TARGET_PCIE_0_2 4
28#define ARMADA_XP_TARGET_ETH0 7
29#define ARMADA_XP_TARGET_PCIE_1_3 8
30
31#define ARMADA_370_TARGET_DEV_BUS 1
32#define ARMADA_370_ATTR_DEV_BOOTROM 0x1D
33#define ARMADA_370_TARGET_PCIE_0 4
34#define ARMADA_370_TARGET_PCIE_1 8
35
36#define ARMADA_WINDOW_8_PLUS_OFFSET 0x90
37#define ARMADA_SDRAM_ADDR_DECODING_OFFSET 0x180
38
39static const struct __initdata orion_addr_map_info
40armada_xp_addr_map_info[] = {
41 /*
42 * Window for the BootROM, needed for SMP on Armada XP
43 */
44 { 0, 0xfff00000, SZ_1M, ARMADA_XP_TARGET_DEV_BUS,
45 ARMADA_XP_ATTR_DEV_BOOTROM, -1 },
46 /* End marker */
47 { -1, 0, 0, 0, 0, 0 },
48};
49
50static const struct __initdata orion_addr_map_info
51armada_370_addr_map_info[] = {
52 /* End marker */
53 { -1, 0, 0, 0, 0, 0 },
54};
55
56static struct of_device_id of_addr_decoding_controller_table[] = {
57 { .compatible = "marvell,armada-addr-decoding-controller" },
58 { /* end of list */ },
59};
60
61static void __iomem *
62armada_cfg_base(const struct orion_addr_map_cfg *cfg, int win)
63{
64 unsigned int offset;
65
66 /* The register layout is a bit annoying and the below code
67 * tries to cope with it.
68 * - At offset 0x0, there are the registers for the first 8
69 * windows, with 4 registers of 32 bits per window (ctrl,
70 * base, remap low, remap high)
71 * - Then at offset 0x80, there is a hole of 0x10 bytes for
72 * the internal registers base address and internal units
73 * sync barrier register.
74 * - Then at offset 0x90, there the registers for 12
75 * windows, with only 2 registers of 32 bits per window
76 * (ctrl, base).
77 */
78 if (win < 8)
79 offset = (win << 4);
80 else
81 offset = ARMADA_WINDOW_8_PLUS_OFFSET + (win << 3);
82
83 return cfg->bridge_virt_base + offset;
84}
85
86static struct __initdata orion_addr_map_cfg addr_map_cfg = {
87 .num_wins = 20,
88 .remappable_wins = 8,
89 .win_cfg_base = armada_cfg_base,
90};
91
92static int __init armada_setup_cpu_mbus(void)
93{
94 struct device_node *np;
95 void __iomem *mbus_unit_addr_decoding_base;
96 void __iomem *sdram_addr_decoding_base;
97
98 np = of_find_matching_node(NULL, of_addr_decoding_controller_table);
99 if (!np)
100 return -ENODEV;
101
102 mbus_unit_addr_decoding_base = of_iomap(np, 0);
103 BUG_ON(!mbus_unit_addr_decoding_base);
104
105 sdram_addr_decoding_base =
106 mbus_unit_addr_decoding_base +
107 ARMADA_SDRAM_ADDR_DECODING_OFFSET;
108
109 addr_map_cfg.bridge_virt_base = mbus_unit_addr_decoding_base;
110
111 /*
112 * Disable, clear and configure windows.
113 */
114 if (of_machine_is_compatible("marvell,armadaxp"))
115 orion_config_wins(&addr_map_cfg, armada_xp_addr_map_info);
116 else if (of_machine_is_compatible("marvell,armada370"))
117 orion_config_wins(&addr_map_cfg, armada_370_addr_map_info);
118 else {
119 pr_err("Unsupported SoC\n");
120 return -EINVAL;
121 }
122
123 /*
124 * Setup MBUS dram target info.
125 */
126 orion_setup_cpu_mbus_target(&addr_map_cfg,
127 sdram_addr_decoding_base);
128 return 0;
129}
130
131/* Using a early_initcall is needed so that this initialization gets
132 * done before the SMP initialization, which requires the BootROM to
133 * be remapped. */
134early_initcall(armada_setup_cpu_mbus);
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index b46418a8b352..49d791548ad6 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -25,7 +25,7 @@
25 25
26static struct map_desc armada_370_xp_io_desc[] __initdata = { 26static struct map_desc armada_370_xp_io_desc[] __initdata = {
27 { 27 {
28 .virtual = ARMADA_370_XP_REGS_VIRT_BASE, 28 .virtual = (unsigned long) ARMADA_370_XP_REGS_VIRT_BASE,
29 .pfn = __phys_to_pfn(ARMADA_370_XP_REGS_PHYS_BASE), 29 .pfn = __phys_to_pfn(ARMADA_370_XP_REGS_PHYS_BASE),
30 .length = ARMADA_370_XP_REGS_SIZE, 30 .length = ARMADA_370_XP_REGS_SIZE,
31 .type = MT_DEVICE, 31 .type = MT_DEVICE,
diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h
index 25f0ca8d7820..aac9bebc6b03 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.h
+++ b/arch/arm/mach-mvebu/armada-370-xp.h
@@ -16,7 +16,7 @@
16#define __MACH_ARMADA_370_XP_H 16#define __MACH_ARMADA_370_XP_H
17 17
18#define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000 18#define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000
19#define ARMADA_370_XP_REGS_VIRT_BASE 0xfeb00000 19#define ARMADA_370_XP_REGS_VIRT_BASE IOMEM(0xfeb00000)
20#define ARMADA_370_XP_REGS_SIZE SZ_1M 20#define ARMADA_370_XP_REGS_SIZE SZ_1M
21 21
22#endif /* __MACH_ARMADA_370_XP_H */ 22#endif /* __MACH_ARMADA_370_XP_H */
diff --git a/arch/arm/mach-mvebu/include/mach/gpio.h b/arch/arm/mach-mvebu/include/mach/gpio.h
new file mode 100644
index 000000000000..40a8c178f10d
--- /dev/null
+++ b/arch/arm/mach-mvebu/include/mach/gpio.h
@@ -0,0 +1 @@
/* empty */
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 0cc54dd553e3..726c02c9c0cd 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -357,6 +357,33 @@ static inline void omap_init_uwire(void) {}
357#endif 357#endif
358 358
359 359
360#define OMAP1_RNG_BASE 0xfffe5000
361
362static struct resource omap1_rng_resources[] = {
363 {
364 .start = OMAP1_RNG_BASE,
365 .end = OMAP1_RNG_BASE + 0x4f,
366 .flags = IORESOURCE_MEM,
367 },
368};
369
370static struct platform_device omap1_rng_device = {
371 .name = "omap_rng",
372 .id = -1,
373 .num_resources = ARRAY_SIZE(omap1_rng_resources),
374 .resource = omap1_rng_resources,
375};
376
377static void omap1_init_rng(void)
378{
379 if (!cpu_is_omap16xx())
380 return;
381
382 (void) platform_device_register(&omap1_rng_device);
383}
384
385/*-------------------------------------------------------------------------*/
386
360/* 387/*
361 * This gets called after board-specific INIT_MACHINE, and initializes most 388 * This gets called after board-specific INIT_MACHINE, and initializes most
362 * on-chip peripherals accessible on this board (except for few like USB): 389 * on-chip peripherals accessible on this board (except for few like USB):
@@ -395,6 +422,7 @@ static int __init omap1_init_devices(void)
395 omap_init_spi100k(); 422 omap_init_spi100k();
396 omap_init_sti(); 423 omap_init_sti();
397 omap_init_uwire(); 424 omap_init_uwire();
425 omap1_init_rng();
398 426
399 return 0; 427 return 0;
400} 428}
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
index aa81593db1af..cdeb9d3ef640 100644
--- a/arch/arm/mach-omap1/timer.c
+++ b/arch/arm/mach-omap1/timer.c
@@ -141,7 +141,7 @@ static int __init omap1_dm_timer_init(void)
141 141
142 pdata->set_timer_src = omap1_dm_timer_set_src; 142 pdata->set_timer_src = omap1_dm_timer_set_src;
143 pdata->timer_capability = OMAP_TIMER_ALWON | 143 pdata->timer_capability = OMAP_TIMER_ALWON |
144 OMAP_TIMER_NEEDS_RESET; 144 OMAP_TIMER_NEEDS_RESET | OMAP_TIMER_HAS_DSP_IRQ;
145 145
146 ret = platform_device_add_data(pdev, pdata, sizeof(*pdata)); 146 ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
147 if (ret) { 147 if (ret) {
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 7d6abda3b74e..fe40d9e488c9 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -179,6 +179,7 @@ obj-$(CONFIG_ARCH_OMAP4) += omap_hwmod_44xx_data.o
179 179
180# EMU peripherals 180# EMU peripherals
181obj-$(CONFIG_OMAP3_EMU) += emu.o 181obj-$(CONFIG_OMAP3_EMU) += emu.o
182obj-$(CONFIG_HW_PERF_EVENTS) += pmu.o
182 183
183obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o 184obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
184mailbox_mach-objs := mailbox.o 185mailbox_mach-objs := mailbox.o
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 3e2d76f05af4..cea3abace815 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -202,7 +202,7 @@ static inline void __init apollon_init_smc91x(void)
202 return; 202 return;
203 } 203 }
204 204
205 clk_enable(gpmc_fck); 205 clk_prepare_enable(gpmc_fck);
206 rate = clk_get_rate(gpmc_fck); 206 rate = clk_get_rate(gpmc_fck);
207 207
208 eth_cs = APOLLON_ETH_CS; 208 eth_cs = APOLLON_ETH_CS;
@@ -246,7 +246,7 @@ static inline void __init apollon_init_smc91x(void)
246 gpmc_cs_free(APOLLON_ETH_CS); 246 gpmc_cs_free(APOLLON_ETH_CS);
247 } 247 }
248out: 248out:
249 clk_disable(gpmc_fck); 249 clk_disable_unprepare(gpmc_fck);
250 clk_put(gpmc_fck); 250 clk_put(gpmc_fck);
251} 251}
252 252
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index f6c48dd764fe..8d04bf851af4 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -265,9 +265,9 @@ static inline void __init h4_init_debug(void)
265 return; 265 return;
266 } 266 }
267 267
268 clk_enable(gpmc_fck); 268 clk_prepare_enable(gpmc_fck);
269 rate = clk_get_rate(gpmc_fck); 269 rate = clk_get_rate(gpmc_fck);
270 clk_disable(gpmc_fck); 270 clk_disable_unprepare(gpmc_fck);
271 clk_put(gpmc_fck); 271 clk_put(gpmc_fck);
272 272
273 if (is_gpmc_muxed()) 273 if (is_gpmc_muxed())
@@ -311,7 +311,7 @@ static inline void __init h4_init_debug(void)
311 gpmc_cs_free(eth_cs); 311 gpmc_cs_free(eth_cs);
312 312
313out: 313out:
314 clk_disable(gpmc_fck); 314 clk_disable_unprepare(gpmc_fck);
315 clk_put(gpmc_fck); 315 clk_put(gpmc_fck);
316} 316}
317 317
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index e0dd70b9d917..2b012f9d6925 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -171,7 +171,7 @@ static void __init omap4_ehci_init(void)
171 return; 171 return;
172 } 172 }
173 clk_set_rate(phy_ref_clk, 19200000); 173 clk_set_rate(phy_ref_clk, 19200000);
174 clk_enable(phy_ref_clk); 174 clk_prepare_enable(phy_ref_clk);
175 175
176 /* disable the power to the usb hub prior to init and reset phy+hub */ 176 /* disable the power to the usb hub prior to init and reset phy+hub */
177 ret = gpio_request_array(panda_ehci_gpios, 177 ret = gpio_request_array(panda_ehci_gpios,
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 3945c5017085..ed85fb898c7f 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -33,6 +33,7 @@
33#include "common.h" 33#include "common.h"
34#include <plat/dma.h> 34#include <plat/dma.h>
35#include <plat/gpmc.h> 35#include <plat/gpmc.h>
36#include <plat/omap-pm.h>
36#include "gpmc-smc91x.h" 37#include "gpmc-smc91x.h"
37 38
38#include "board-rx51.h" 39#include "board-rx51.h"
@@ -46,6 +47,10 @@
46#include <../drivers/staging/iio/light/tsl2563.h> 47#include <../drivers/staging/iio/light/tsl2563.h>
47#include <linux/lis3lv02d.h> 48#include <linux/lis3lv02d.h>
48 49
50#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
51#include <media/ir-rx51.h>
52#endif
53
49#include "mux.h" 54#include "mux.h"
50#include "hsmmc.h" 55#include "hsmmc.h"
51#include "common-board-devices.h" 56#include "common-board-devices.h"
@@ -1217,6 +1222,30 @@ static void __init rx51_init_tsc2005(void)
1217 gpio_to_irq(RX51_TSC2005_IRQ_GPIO); 1222 gpio_to_irq(RX51_TSC2005_IRQ_GPIO);
1218} 1223}
1219 1224
1225#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
1226static struct lirc_rx51_platform_data rx51_lirc_data = {
1227 .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
1228 .pwm_timer = 9, /* Use GPT 9 for CIR */
1229};
1230
1231static struct platform_device rx51_lirc_device = {
1232 .name = "lirc_rx51",
1233 .id = -1,
1234 .dev = {
1235 .platform_data = &rx51_lirc_data,
1236 },
1237};
1238
1239static void __init rx51_init_lirc(void)
1240{
1241 platform_device_register(&rx51_lirc_device);
1242}
1243#else
1244static void __init rx51_init_lirc(void)
1245{
1246}
1247#endif
1248
1220void __init rx51_peripherals_init(void) 1249void __init rx51_peripherals_init(void)
1221{ 1250{
1222 rx51_i2c_init(); 1251 rx51_i2c_init();
@@ -1227,6 +1256,7 @@ void __init rx51_peripherals_init(void)
1227 rx51_init_wl1251(); 1256 rx51_init_wl1251();
1228 rx51_init_tsc2005(); 1257 rx51_init_tsc2005();
1229 rx51_init_si4713(); 1258 rx51_init_si4713();
1259 rx51_init_lirc();
1230 spi_register_board_info(rx51_peripherals_spi_board_info, 1260 spi_register_board_info(rx51_peripherals_spi_board_info,
1231 ARRAY_SIZE(rx51_peripherals_spi_board_info)); 1261 ARRAY_SIZE(rx51_peripherals_spi_board_info));
1232 1262
diff --git a/arch/arm/mach-omap2/clkt2xxx_apll.c b/arch/arm/mach-omap2/clkt2xxx_apll.c
index b19a1f7234ae..c2d15212d64d 100644
--- a/arch/arm/mach-omap2/clkt2xxx_apll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_apll.c
@@ -59,7 +59,7 @@ static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask)
59 omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN); 59 omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
60 60
61 omap2_cm_wait_idlest(cm_idlest_pll, status_mask, 61 omap2_cm_wait_idlest(cm_idlest_pll, status_mask,
62 OMAP24XX_CM_IDLEST_VAL, clk->name); 62 OMAP24XX_CM_IDLEST_VAL, __clk_get_name(clk));
63 63
64 /* 64 /*
65 * REVISIT: Should we return an error code if omap2_wait_clock_ready() 65 * REVISIT: Should we return an error code if omap2_wait_clock_ready()
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index cabcfdba5246..3524f0e7b6d5 100644
--- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
+++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
@@ -68,14 +68,15 @@ unsigned long omap2_table_mpu_recalc(struct clk *clk)
68long omap2_round_to_table_rate(struct clk *clk, unsigned long rate) 68long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
69{ 69{
70 const struct prcm_config *ptr; 70 const struct prcm_config *ptr;
71 long highest_rate; 71 long highest_rate, sys_clk_rate;
72 72
73 highest_rate = -EINVAL; 73 highest_rate = -EINVAL;
74 sys_clk_rate = __clk_get_rate(sclk);
74 75
75 for (ptr = rate_table; ptr->mpu_speed; ptr++) { 76 for (ptr = rate_table; ptr->mpu_speed; ptr++) {
76 if (!(ptr->flags & cpu_mask)) 77 if (!(ptr->flags & cpu_mask))
77 continue; 78 continue;
78 if (ptr->xtal_speed != sclk->rate) 79 if (ptr->xtal_speed != sys_clk_rate)
79 continue; 80 continue;
80 81
81 highest_rate = ptr->mpu_speed; 82 highest_rate = ptr->mpu_speed;
@@ -94,12 +95,15 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
94 const struct prcm_config *prcm; 95 const struct prcm_config *prcm;
95 unsigned long found_speed = 0; 96 unsigned long found_speed = 0;
96 unsigned long flags; 97 unsigned long flags;
98 long sys_clk_rate;
99
100 sys_clk_rate = __clk_get_rate(sclk);
97 101
98 for (prcm = rate_table; prcm->mpu_speed; prcm++) { 102 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
99 if (!(prcm->flags & cpu_mask)) 103 if (!(prcm->flags & cpu_mask))
100 continue; 104 continue;
101 105
102 if (prcm->xtal_speed != sclk->rate) 106 if (prcm->xtal_speed != sys_clk_rate)
103 continue; 107 continue;
104 108
105 if (prcm->mpu_speed <= rate) { 109 if (prcm->mpu_speed <= rate) {
diff --git a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
index 298887b5bf66..7c6da2f731dc 100644
--- a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
+++ b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
@@ -56,6 +56,7 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
56 struct omap_sdrc_params *sdrc_cs0; 56 struct omap_sdrc_params *sdrc_cs0;
57 struct omap_sdrc_params *sdrc_cs1; 57 struct omap_sdrc_params *sdrc_cs1;
58 int ret; 58 int ret;
59 unsigned long clkrate;
59 60
60 if (!clk || !rate) 61 if (!clk || !rate)
61 return -EINVAL; 62 return -EINVAL;
@@ -64,11 +65,12 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
64 if (validrate != rate) 65 if (validrate != rate)
65 return -EINVAL; 66 return -EINVAL;
66 67
67 sdrcrate = sdrc_ick_p->rate; 68 sdrcrate = __clk_get_rate(sdrc_ick_p);
68 if (rate > clk->rate) 69 clkrate = __clk_get_rate(clk);
69 sdrcrate <<= ((rate / clk->rate) >> 1); 70 if (rate > clkrate)
71 sdrcrate <<= ((rate / clkrate) >> 1);
70 else 72 else
71 sdrcrate >>= ((clk->rate / rate) >> 1); 73 sdrcrate >>= ((clkrate / rate) >> 1);
72 74
73 ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1); 75 ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
74 if (ret) 76 if (ret)
@@ -82,7 +84,7 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
82 /* 84 /*
83 * XXX This only needs to be done when the CPU frequency changes 85 * XXX This only needs to be done when the CPU frequency changes
84 */ 86 */
85 _mpurate = arm_fck_p->rate / CYCLES_PER_MHZ; 87 _mpurate = __clk_get_rate(arm_fck_p) / CYCLES_PER_MHZ;
86 c = (_mpurate << SDRC_MPURATE_SCALE) >> SDRC_MPURATE_BASE_SHIFT; 88 c = (_mpurate << SDRC_MPURATE_SCALE) >> SDRC_MPURATE_BASE_SHIFT;
87 c += 1; /* for safety */ 89 c += 1; /* for safety */
88 c *= SDRC_MPURATE_LOOPS; 90 c *= SDRC_MPURATE_LOOPS;
@@ -90,8 +92,8 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
90 if (c == 0) 92 if (c == 0)
91 c = 1; 93 c = 1;
92 94
93 pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate, 95 pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n",
94 validrate); 96 clkrate, validrate);
95 pr_debug("clock: SDRC CS0 timing params used: RFR %08x CTRLA %08x CTRLB %08x MR %08x\n", 97 pr_debug("clock: SDRC CS0 timing params used: RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
96 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, 98 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
97 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr); 99 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
@@ -102,14 +104,14 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
102 104
103 if (sdrc_cs1) 105 if (sdrc_cs1)
104 omap3_configure_core_dpll( 106 omap3_configure_core_dpll(
105 new_div, unlock_dll, c, rate > clk->rate, 107 new_div, unlock_dll, c, rate > clkrate,
106 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, 108 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
107 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr, 109 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
108 sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla, 110 sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
109 sdrc_cs1->actim_ctrlb, sdrc_cs1->mr); 111 sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
110 else 112 else
111 omap3_configure_core_dpll( 113 omap3_configure_core_dpll(
112 new_div, unlock_dll, c, rate > clk->rate, 114 new_div, unlock_dll, c, rate > clkrate,
113 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, 115 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
114 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr, 116 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
115 0, 0, 0, 0); 117 0, 0, 0, 0);
diff --git a/arch/arm/mach-omap2/clkt_clksel.c b/arch/arm/mach-omap2/clkt_clksel.c
index 19a980956d44..eaed3900a83c 100644
--- a/arch/arm/mach-omap2/clkt_clksel.c
+++ b/arch/arm/mach-omap2/clkt_clksel.c
@@ -72,7 +72,7 @@ static const struct clksel *_get_clksel_by_parent(struct clk *clk,
72 if (!clks->parent) { 72 if (!clks->parent) {
73 /* This indicates a data problem */ 73 /* This indicates a data problem */
74 WARN(1, "clock: %s: could not find parent clock %s in clksel array\n", 74 WARN(1, "clock: %s: could not find parent clock %s in clksel array\n",
75 clk->name, src_clk->name); 75 __clk_get_name(clk), __clk_get_name(src_clk));
76 return NULL; 76 return NULL;
77 } 77 }
78 78
@@ -127,7 +127,8 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
127 if (max_div == 0) { 127 if (max_div == 0) {
128 /* This indicates an error in the clksel data */ 128 /* This indicates an error in the clksel data */
129 WARN(1, "clock: %s: could not find divisor for parent %s\n", 129 WARN(1, "clock: %s: could not find divisor for parent %s\n",
130 clk->name, src_clk->parent->name); 130 __clk_get_name(clk),
131 __clk_get_name(__clk_get_parent(src_clk)));
131 return 0; 132 return 0;
132 } 133 }
133 134
@@ -176,8 +177,10 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val)
176{ 177{
177 const struct clksel *clks; 178 const struct clksel *clks;
178 const struct clksel_rate *clkr; 179 const struct clksel_rate *clkr;
180 struct clk *parent;
179 181
180 clks = _get_clksel_by_parent(clk, clk->parent); 182 parent = __clk_get_parent(clk);
183 clks = _get_clksel_by_parent(clk, parent);
181 if (!clks) 184 if (!clks)
182 return 0; 185 return 0;
183 186
@@ -191,8 +194,8 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val)
191 194
192 if (!clkr->div) { 195 if (!clkr->div) {
193 /* This indicates a data error */ 196 /* This indicates a data error */
194 WARN(1, "clock: %s: could not find fieldval %d parent %s\n", 197 WARN(1, "clock: %s: could not find fieldval %d for parent %s\n",
195 clk->name, field_val, clk->parent->name); 198 __clk_get_name(clk), field_val, __clk_get_name(parent));
196 return 0; 199 return 0;
197 } 200 }
198 201
@@ -213,11 +216,13 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
213{ 216{
214 const struct clksel *clks; 217 const struct clksel *clks;
215 const struct clksel_rate *clkr; 218 const struct clksel_rate *clkr;
219 struct clk *parent;
216 220
217 /* should never happen */ 221 /* should never happen */
218 WARN_ON(div == 0); 222 WARN_ON(div == 0);
219 223
220 clks = _get_clksel_by_parent(clk, clk->parent); 224 parent = __clk_get_parent(clk);
225 clks = _get_clksel_by_parent(clk, parent);
221 if (!clks) 226 if (!clks)
222 return ~0; 227 return ~0;
223 228
@@ -230,8 +235,8 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
230 } 235 }
231 236
232 if (!clkr->div) { 237 if (!clkr->div) {
233 pr_err("clock: %s: could not find divisor %d parent %s\n", 238 pr_err("clock: %s: could not find divisor %d for parent %s\n",
234 clk->name, div, clk->parent->name); 239 __clk_get_name(clk), div, __clk_get_name(parent));
235 return ~0; 240 return ~0;
236 } 241 }
237 242
@@ -281,16 +286,23 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
281 const struct clksel *clks; 286 const struct clksel *clks;
282 const struct clksel_rate *clkr; 287 const struct clksel_rate *clkr;
283 u32 last_div = 0; 288 u32 last_div = 0;
289 struct clk *parent;
290 unsigned long parent_rate;
291 const char *clk_name;
292
293 parent = __clk_get_parent(clk);
294 parent_rate = __clk_get_rate(parent);
295 clk_name = __clk_get_name(clk);
284 296
285 if (!clk->clksel || !clk->clksel_mask) 297 if (!clk->clksel || !clk->clksel_mask)
286 return ~0; 298 return ~0;
287 299
288 pr_debug("clock: clksel_round_rate_div: %s target_rate %ld\n", 300 pr_debug("clock: clksel_round_rate_div: %s target_rate %ld\n",
289 clk->name, target_rate); 301 clk_name, target_rate);
290 302
291 *new_div = 1; 303 *new_div = 1;
292 304
293 clks = _get_clksel_by_parent(clk, clk->parent); 305 clks = _get_clksel_by_parent(clk, parent);
294 if (!clks) 306 if (!clks)
295 return ~0; 307 return ~0;
296 308
@@ -300,29 +312,29 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
300 312
301 /* Sanity check */ 313 /* Sanity check */
302 if (clkr->div <= last_div) 314 if (clkr->div <= last_div)
303 pr_err("clock: %s: clksel_rate table not sorted", 315 pr_err("clock: %s: clksel_rate table not sorted\n",
304 clk->name); 316 clk_name);
305 317
306 last_div = clkr->div; 318 last_div = clkr->div;
307 319
308 test_rate = clk->parent->rate / clkr->div; 320 test_rate = parent_rate / clkr->div;
309 321
310 if (test_rate <= target_rate) 322 if (test_rate <= target_rate)
311 break; /* found it */ 323 break; /* found it */
312 } 324 }
313 325
314 if (!clkr->div) { 326 if (!clkr->div) {
315 pr_err("clock: %s: could not find divisor for target rate %ld parent %s\n", 327 pr_err("clock: %s: could not find divisor for target rate %ld for parent %s\n",
316 clk->name, target_rate, clk->parent->name); 328 clk_name, target_rate, __clk_get_name(parent));
317 return ~0; 329 return ~0;
318 } 330 }
319 331
320 *new_div = clkr->div; 332 *new_div = clkr->div;
321 333
322 pr_debug("clock: new_div = %d, new_rate = %ld\n", *new_div, 334 pr_debug("clock: new_div = %d, new_rate = %ld\n", *new_div,
323 (clk->parent->rate / clkr->div)); 335 (parent_rate / clkr->div));
324 336
325 return clk->parent->rate / clkr->div; 337 return parent_rate / clkr->div;
326} 338}
327 339
328/* 340/*
@@ -344,10 +356,15 @@ void omap2_init_clksel_parent(struct clk *clk)
344 const struct clksel *clks; 356 const struct clksel *clks;
345 const struct clksel_rate *clkr; 357 const struct clksel_rate *clkr;
346 u32 r, found = 0; 358 u32 r, found = 0;
359 struct clk *parent;
360 const char *clk_name;
347 361
348 if (!clk->clksel || !clk->clksel_mask) 362 if (!clk->clksel || !clk->clksel_mask)
349 return; 363 return;
350 364
365 parent = __clk_get_parent(clk);
366 clk_name = __clk_get_name(clk);
367
351 r = __raw_readl(clk->clksel_reg) & clk->clksel_mask; 368 r = __raw_readl(clk->clksel_reg) & clk->clksel_mask;
352 r >>= __ffs(clk->clksel_mask); 369 r >>= __ffs(clk->clksel_mask);
353 370
@@ -357,11 +374,13 @@ void omap2_init_clksel_parent(struct clk *clk)
357 continue; 374 continue;
358 375
359 if (clkr->val == r) { 376 if (clkr->val == r) {
360 if (clk->parent != clks->parent) { 377 if (parent != clks->parent) {
361 pr_debug("clock: %s: inited parent to %s (was %s)\n", 378 pr_debug("clock: %s: inited parent to %s (was %s)\n",
362 clk->name, clks->parent->name, 379 clk_name,
363 ((clk->parent) ? 380 __clk_get_name(clks->parent),
364 clk->parent->name : "NULL")); 381 ((parent) ?
382 __clk_get_name(parent) :
383 "NULL"));
365 clk_reparent(clk, clks->parent); 384 clk_reparent(clk, clks->parent);
366 }; 385 };
367 found = 1; 386 found = 1;
@@ -371,7 +390,7 @@ void omap2_init_clksel_parent(struct clk *clk)
371 390
372 /* This indicates a data error */ 391 /* This indicates a data error */
373 WARN(!found, "clock: %s: init parent: could not find regval %0x\n", 392 WARN(!found, "clock: %s: init parent: could not find regval %0x\n",
374 clk->name, r); 393 clk_name, r);
375 394
376 return; 395 return;
377} 396}
@@ -389,15 +408,17 @@ unsigned long omap2_clksel_recalc(struct clk *clk)
389{ 408{
390 unsigned long rate; 409 unsigned long rate;
391 u32 div = 0; 410 u32 div = 0;
411 struct clk *parent;
392 412
393 div = _read_divisor(clk); 413 div = _read_divisor(clk);
394 if (div == 0) 414 if (div == 0)
395 return clk->rate; 415 return __clk_get_rate(clk);
396 416
397 rate = clk->parent->rate / div; 417 parent = __clk_get_parent(clk);
418 rate = __clk_get_rate(parent) / div;
398 419
399 pr_debug("clock: %s: recalc'd rate is %ld (div %d)\n", clk->name, 420 pr_debug("clock: %s: recalc'd rate is %ld (div %d)\n",
400 rate, div); 421 __clk_get_name(clk), rate, div);
401 422
402 return rate; 423 return rate;
403} 424}
@@ -452,9 +473,10 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
452 473
453 _write_clksel_reg(clk, field_val); 474 _write_clksel_reg(clk, field_val);
454 475
455 clk->rate = clk->parent->rate / new_div; 476 clk->rate = __clk_get_rate(__clk_get_parent(clk)) / new_div;
456 477
457 pr_debug("clock: %s: set rate to %ld\n", clk->name, clk->rate); 478 pr_debug("clock: %s: set rate to %ld\n", __clk_get_name(clk),
479 __clk_get_rate(clk));
458 480
459 return 0; 481 return 0;
460} 482}
@@ -496,13 +518,15 @@ int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent)
496 clk_reparent(clk, new_parent); 518 clk_reparent(clk, new_parent);
497 519
498 /* CLKSEL clocks follow their parents' rates, divided by a divisor */ 520 /* CLKSEL clocks follow their parents' rates, divided by a divisor */
499 clk->rate = new_parent->rate; 521 clk->rate = __clk_get_rate(new_parent);
500 522
501 if (parent_div > 0) 523 if (parent_div > 0)
502 clk->rate /= parent_div; 524 __clk_get_rate(clk) /= parent_div;
503 525
504 pr_debug("clock: %s: set parent to %s (new rate %ld)\n", 526 pr_debug("clock: %s: set parent to %s (new rate %ld)\n",
505 clk->name, clk->parent->name, clk->rate); 527 __clk_get_name(clk),
528 __clk_get_name(__clk_get_parent(clk)),
529 __clk_get_rate(clk));
506 530
507 return 0; 531 return 0;
508} 532}
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 83b658bf385a..80411142f482 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -87,7 +87,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n)
87 dd = clk->dpll_data; 87 dd = clk->dpll_data;
88 88
89 /* DPLL divider must result in a valid jitter correction val */ 89 /* DPLL divider must result in a valid jitter correction val */
90 fint = clk->parent->rate / n; 90 fint = __clk_get_rate(__clk_get_parent(clk)) / n;
91 91
92 if (cpu_is_omap24xx()) { 92 if (cpu_is_omap24xx()) {
93 /* Should not be called for OMAP2, so warn if it is called */ 93 /* Should not be called for OMAP2, so warn if it is called */
@@ -252,16 +252,16 @@ u32 omap2_get_dpll_rate(struct clk *clk)
252 if (cpu_is_omap24xx()) { 252 if (cpu_is_omap24xx()) {
253 if (v == OMAP2XXX_EN_DPLL_LPBYPASS || 253 if (v == OMAP2XXX_EN_DPLL_LPBYPASS ||
254 v == OMAP2XXX_EN_DPLL_FRBYPASS) 254 v == OMAP2XXX_EN_DPLL_FRBYPASS)
255 return dd->clk_bypass->rate; 255 return __clk_get_rate(dd->clk_bypass);
256 } else if (cpu_is_omap34xx()) { 256 } else if (cpu_is_omap34xx()) {
257 if (v == OMAP3XXX_EN_DPLL_LPBYPASS || 257 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
258 v == OMAP3XXX_EN_DPLL_FRBYPASS) 258 v == OMAP3XXX_EN_DPLL_FRBYPASS)
259 return dd->clk_bypass->rate; 259 return __clk_get_rate(dd->clk_bypass);
260 } else if (soc_is_am33xx() || cpu_is_omap44xx()) { 260 } else if (soc_is_am33xx() || cpu_is_omap44xx()) {
261 if (v == OMAP4XXX_EN_DPLL_LPBYPASS || 261 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
262 v == OMAP4XXX_EN_DPLL_FRBYPASS || 262 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
263 v == OMAP4XXX_EN_DPLL_MNBYPASS) 263 v == OMAP4XXX_EN_DPLL_MNBYPASS)
264 return dd->clk_bypass->rate; 264 return __clk_get_rate(dd->clk_bypass);
265 } 265 }
266 266
267 v = __raw_readl(dd->mult_div1_reg); 267 v = __raw_readl(dd->mult_div1_reg);
@@ -270,7 +270,7 @@ u32 omap2_get_dpll_rate(struct clk *clk)
270 dpll_div = v & dd->div1_mask; 270 dpll_div = v & dd->div1_mask;
271 dpll_div >>= __ffs(dd->div1_mask); 271 dpll_div >>= __ffs(dd->div1_mask);
272 272
273 dpll_clk = (long long)dd->clk_ref->rate * dpll_mult; 273 dpll_clk = (long long) __clk_get_rate(dd->clk_ref) * dpll_mult;
274 do_div(dpll_clk, dpll_div + 1); 274 do_div(dpll_clk, dpll_div + 1);
275 275
276 return dpll_clk; 276 return dpll_clk;
@@ -296,16 +296,20 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
296 unsigned long scaled_rt_rp; 296 unsigned long scaled_rt_rp;
297 unsigned long new_rate = 0; 297 unsigned long new_rate = 0;
298 struct dpll_data *dd; 298 struct dpll_data *dd;
299 unsigned long ref_rate;
300 const char *clk_name;
299 301
300 if (!clk || !clk->dpll_data) 302 if (!clk || !clk->dpll_data)
301 return ~0; 303 return ~0;
302 304
303 dd = clk->dpll_data; 305 dd = clk->dpll_data;
304 306
307 ref_rate = __clk_get_rate(dd->clk_ref);
308 clk_name = __clk_get_name(clk);
305 pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n", 309 pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n",
306 clk->name, target_rate); 310 clk_name, target_rate);
307 311
308 scaled_rt_rp = target_rate / (dd->clk_ref->rate / DPLL_SCALE_FACTOR); 312 scaled_rt_rp = target_rate / (ref_rate / DPLL_SCALE_FACTOR);
309 scaled_max_m = dd->max_multiplier * DPLL_SCALE_FACTOR; 313 scaled_max_m = dd->max_multiplier * DPLL_SCALE_FACTOR;
310 314
311 dd->last_rounded_rate = 0; 315 dd->last_rounded_rate = 0;
@@ -332,14 +336,14 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
332 break; 336 break;
333 337
334 r = _dpll_test_mult(&m, n, &new_rate, target_rate, 338 r = _dpll_test_mult(&m, n, &new_rate, target_rate,
335 dd->clk_ref->rate); 339 ref_rate);
336 340
337 /* m can't be set low enough for this n - try with a larger n */ 341 /* m can't be set low enough for this n - try with a larger n */
338 if (r == DPLL_MULT_UNDERFLOW) 342 if (r == DPLL_MULT_UNDERFLOW)
339 continue; 343 continue;
340 344
341 pr_debug("clock: %s: m = %d: n = %d: new_rate = %ld\n", 345 pr_debug("clock: %s: m = %d: n = %d: new_rate = %ld\n",
342 clk->name, m, n, new_rate); 346 clk_name, m, n, new_rate);
343 347
344 if (target_rate == new_rate) { 348 if (target_rate == new_rate) {
345 dd->last_rounded_m = m; 349 dd->last_rounded_m = m;
@@ -350,8 +354,8 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
350 } 354 }
351 355
352 if (target_rate != new_rate) { 356 if (target_rate != new_rate) {
353 pr_debug("clock: %s: cannot round to rate %ld\n", clk->name, 357 pr_debug("clock: %s: cannot round to rate %ld\n",
354 target_rate); 358 clk_name, target_rate);
355 return ~0; 359 return ~0;
356 } 360 }
357 361
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index e97f98ffe8b2..961ac8f7e13d 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -78,7 +78,7 @@ static void _omap2_module_wait_ready(struct clk *clk)
78 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val); 78 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val);
79 79
80 omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), idlest_val, 80 omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), idlest_val,
81 clk->name); 81 __clk_get_name(clk));
82} 82}
83 83
84/* Public functions */ 84/* Public functions */
@@ -94,18 +94,21 @@ static void _omap2_module_wait_ready(struct clk *clk)
94void omap2_init_clk_clkdm(struct clk *clk) 94void omap2_init_clk_clkdm(struct clk *clk)
95{ 95{
96 struct clockdomain *clkdm; 96 struct clockdomain *clkdm;
97 const char *clk_name;
97 98
98 if (!clk->clkdm_name) 99 if (!clk->clkdm_name)
99 return; 100 return;
100 101
102 clk_name = __clk_get_name(clk);
103
101 clkdm = clkdm_lookup(clk->clkdm_name); 104 clkdm = clkdm_lookup(clk->clkdm_name);
102 if (clkdm) { 105 if (clkdm) {
103 pr_debug("clock: associated clk %s to clkdm %s\n", 106 pr_debug("clock: associated clk %s to clkdm %s\n",
104 clk->name, clk->clkdm_name); 107 clk_name, clk->clkdm_name);
105 clk->clkdm = clkdm; 108 clk->clkdm = clkdm;
106 } else { 109 } else {
107 pr_debug("clock: could not associate clk %s to clkdm %s\n", 110 pr_debug("clock: could not associate clk %s to clkdm %s\n",
108 clk->name, clk->clkdm_name); 111 clk_name, clk->clkdm_name);
109 } 112 }
110} 113}
111 114
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index 12c178dbc9f5..c3cde1a2b6de 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1804,6 +1804,7 @@ static struct omap_clk omap2420_clks[] = {
1804 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X), 1804 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X),
1805 /* DSS domain clocks */ 1805 /* DSS domain clocks */
1806 CLK("omapdss_dss", "ick", &dss_ick, CK_242X), 1806 CLK("omapdss_dss", "ick", &dss_ick, CK_242X),
1807 CLK(NULL, "dss_ick", &dss_ick, CK_242X),
1807 CLK(NULL, "dss1_fck", &dss1_fck, CK_242X), 1808 CLK(NULL, "dss1_fck", &dss1_fck, CK_242X),
1808 CLK(NULL, "dss2_fck", &dss2_fck, CK_242X), 1809 CLK(NULL, "dss2_fck", &dss2_fck, CK_242X),
1809 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_242X), 1810 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_242X),
@@ -1843,12 +1844,16 @@ static struct omap_clk omap2420_clks[] = {
1843 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X), 1844 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X),
1844 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X), 1845 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X),
1845 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X), 1846 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X),
1847 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_242X),
1846 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_242X), 1848 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_242X),
1847 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X), 1849 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X),
1850 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_242X),
1848 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_242X), 1851 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_242X),
1849 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X), 1852 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X),
1853 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_242X),
1850 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_242X), 1854 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_242X),
1851 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X), 1855 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X),
1856 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_242X),
1852 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_242X), 1857 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_242X),
1853 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X), 1858 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X),
1854 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X), 1859 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X),
@@ -1859,12 +1864,15 @@ static struct omap_clk omap2420_clks[] = {
1859 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X), 1864 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X),
1860 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X), 1865 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X),
1861 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X), 1866 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X),
1867 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_242X),
1862 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_242X), 1868 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_242X),
1863 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X), 1869 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X),
1864 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X), 1870 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X),
1865 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X), 1871 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X),
1866 CLK("omap24xxcam", "fck", &cam_fck, CK_242X), 1872 CLK("omap24xxcam", "fck", &cam_fck, CK_242X),
1873 CLK(NULL, "cam_fck", &cam_fck, CK_242X),
1867 CLK("omap24xxcam", "ick", &cam_ick, CK_242X), 1874 CLK("omap24xxcam", "ick", &cam_ick, CK_242X),
1875 CLK(NULL, "cam_ick", &cam_ick, CK_242X),
1868 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_242X), 1876 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_242X),
1869 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_242X), 1877 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_242X),
1870 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_242X), 1878 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_242X),
@@ -1873,16 +1881,22 @@ static struct omap_clk omap2420_clks[] = {
1873 CLK(NULL, "mspro_ick", &mspro_ick, CK_242X), 1881 CLK(NULL, "mspro_ick", &mspro_ick, CK_242X),
1874 CLK(NULL, "mspro_fck", &mspro_fck, CK_242X), 1882 CLK(NULL, "mspro_fck", &mspro_fck, CK_242X),
1875 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X), 1883 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X),
1884 CLK(NULL, "mmc_ick", &mmc_ick, CK_242X),
1876 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X), 1885 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X),
1886 CLK(NULL, "mmc_fck", &mmc_fck, CK_242X),
1877 CLK(NULL, "fac_ick", &fac_ick, CK_242X), 1887 CLK(NULL, "fac_ick", &fac_ick, CK_242X),
1878 CLK(NULL, "fac_fck", &fac_fck, CK_242X), 1888 CLK(NULL, "fac_fck", &fac_fck, CK_242X),
1879 CLK(NULL, "eac_ick", &eac_ick, CK_242X), 1889 CLK(NULL, "eac_ick", &eac_ick, CK_242X),
1880 CLK(NULL, "eac_fck", &eac_fck, CK_242X), 1890 CLK(NULL, "eac_fck", &eac_fck, CK_242X),
1881 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X), 1891 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X),
1892 CLK(NULL, "hdq_ick", &hdq_ick, CK_242X),
1882 CLK("omap_hdq.0", "fck", &hdq_fck, CK_242X), 1893 CLK("omap_hdq.0", "fck", &hdq_fck, CK_242X),
1894 CLK(NULL, "hdq_fck", &hdq_fck, CK_242X),
1883 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X), 1895 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X),
1896 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_242X),
1884 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_242X), 1897 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_242X),
1885 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X), 1898 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X),
1899 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_242X),
1886 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_242X), 1900 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_242X),
1887 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X), 1901 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X),
1888 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X), 1902 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X),
@@ -1892,14 +1906,18 @@ static struct omap_clk omap2420_clks[] = {
1892 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X), 1906 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
1893 CLK(NULL, "des_ick", &des_ick, CK_242X), 1907 CLK(NULL, "des_ick", &des_ick, CK_242X),
1894 CLK("omap-sham", "ick", &sha_ick, CK_242X), 1908 CLK("omap-sham", "ick", &sha_ick, CK_242X),
1909 CLK(NULL, "sha_ick", &sha_ick, CK_242X),
1895 CLK("omap_rng", "ick", &rng_ick, CK_242X), 1910 CLK("omap_rng", "ick", &rng_ick, CK_242X),
1911 CLK(NULL, "rng_ick", &rng_ick, CK_242X),
1896 CLK("omap-aes", "ick", &aes_ick, CK_242X), 1912 CLK("omap-aes", "ick", &aes_ick, CK_242X),
1913 CLK(NULL, "aes_ick", &aes_ick, CK_242X),
1897 CLK(NULL, "pka_ick", &pka_ick, CK_242X), 1914 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1898 CLK(NULL, "usb_fck", &usb_fck, CK_242X), 1915 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1899 CLK("musb-hdrc", "fck", &osc_ck, CK_242X), 1916 CLK("musb-hdrc", "fck", &osc_ck, CK_242X),
1900 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X), 1917 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_242X),
1901 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X), 1918 CLK(NULL, "timer_sys_ck", &sys_ck, CK_242X),
1902 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X), 1919 CLK(NULL, "timer_ext_ck", &alt_ck, CK_242X),
1920 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_242X),
1903}; 1921};
1904 1922
1905/* 1923/*
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index 7ea91398217a..22404fe435e7 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -1888,6 +1888,7 @@ static struct omap_clk omap2430_clks[] = {
1888 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X), 1888 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
1889 /* DSS domain clocks */ 1889 /* DSS domain clocks */
1890 CLK("omapdss_dss", "ick", &dss_ick, CK_243X), 1890 CLK("omapdss_dss", "ick", &dss_ick, CK_243X),
1891 CLK(NULL, "dss_ick", &dss_ick, CK_243X),
1891 CLK(NULL, "dss1_fck", &dss1_fck, CK_243X), 1892 CLK(NULL, "dss1_fck", &dss1_fck, CK_243X),
1892 CLK(NULL, "dss2_fck", &dss2_fck, CK_243X), 1893 CLK(NULL, "dss2_fck", &dss2_fck, CK_243X),
1893 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X), 1894 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X),
@@ -1927,20 +1928,28 @@ static struct omap_clk omap2430_clks[] = {
1927 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X), 1928 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X),
1928 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X), 1929 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X),
1929 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X), 1930 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X),
1931 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_243X),
1930 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_243X), 1932 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_243X),
1931 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X), 1933 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X),
1934 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_243X),
1932 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_243X), 1935 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_243X),
1933 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X), 1936 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
1937 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_243X),
1934 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_243X), 1938 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_243X),
1935 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X), 1939 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
1940 CLK(NULL, "mcbsp4_ick", &mcbsp4_ick, CK_243X),
1936 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_243X), 1941 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_243X),
1937 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X), 1942 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
1943 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_243X),
1938 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_243X), 1944 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_243X),
1939 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X), 1945 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X),
1946 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_243X),
1940 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_243X), 1947 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_243X),
1941 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X), 1948 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X),
1949 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_243X),
1942 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_243X), 1950 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_243X),
1943 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X), 1951 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
1952 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_243X),
1944 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_243X), 1953 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_243X),
1945 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X), 1954 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X),
1946 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X), 1955 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X),
@@ -1951,13 +1960,16 @@ static struct omap_clk omap2430_clks[] = {
1951 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X), 1960 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X),
1952 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X), 1961 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X),
1953 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X), 1962 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X),
1963 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_243X),
1954 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X), 1964 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X),
1955 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X), 1965 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X),
1956 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X), 1966 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X),
1957 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X), 1967 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X),
1958 CLK(NULL, "icr_ick", &icr_ick, CK_243X), 1968 CLK(NULL, "icr_ick", &icr_ick, CK_243X),
1959 CLK("omap24xxcam", "fck", &cam_fck, CK_243X), 1969 CLK("omap24xxcam", "fck", &cam_fck, CK_243X),
1970 CLK(NULL, "cam_fck", &cam_fck, CK_243X),
1960 CLK("omap24xxcam", "ick", &cam_ick, CK_243X), 1971 CLK("omap24xxcam", "ick", &cam_ick, CK_243X),
1972 CLK(NULL, "cam_ick", &cam_ick, CK_243X),
1961 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X), 1973 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X),
1962 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X), 1974 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X),
1963 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X), 1975 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X),
@@ -1966,10 +1978,14 @@ static struct omap_clk omap2430_clks[] = {
1966 CLK(NULL, "fac_ick", &fac_ick, CK_243X), 1978 CLK(NULL, "fac_ick", &fac_ick, CK_243X),
1967 CLK(NULL, "fac_fck", &fac_fck, CK_243X), 1979 CLK(NULL, "fac_fck", &fac_fck, CK_243X),
1968 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X), 1980 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X),
1981 CLK(NULL, "hdq_ick", &hdq_ick, CK_243X),
1969 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X), 1982 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X),
1983 CLK(NULL, "hdq_fck", &hdq_fck, CK_243X),
1970 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X), 1984 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X),
1985 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_243X),
1971 CLK(NULL, "i2chs1_fck", &i2chs1_fck, CK_243X), 1986 CLK(NULL, "i2chs1_fck", &i2chs1_fck, CK_243X),
1972 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X), 1987 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X),
1988 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_243X),
1973 CLK(NULL, "i2chs2_fck", &i2chs2_fck, CK_243X), 1989 CLK(NULL, "i2chs2_fck", &i2chs2_fck, CK_243X),
1974 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X), 1990 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X),
1975 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X), 1991 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X),
@@ -1978,22 +1994,29 @@ static struct omap_clk omap2430_clks[] = {
1978 CLK(NULL, "des_ick", &des_ick, CK_243X), 1994 CLK(NULL, "des_ick", &des_ick, CK_243X),
1979 CLK("omap-sham", "ick", &sha_ick, CK_243X), 1995 CLK("omap-sham", "ick", &sha_ick, CK_243X),
1980 CLK("omap_rng", "ick", &rng_ick, CK_243X), 1996 CLK("omap_rng", "ick", &rng_ick, CK_243X),
1997 CLK(NULL, "rng_ick", &rng_ick, CK_243X),
1981 CLK("omap-aes", "ick", &aes_ick, CK_243X), 1998 CLK("omap-aes", "ick", &aes_ick, CK_243X),
1982 CLK(NULL, "pka_ick", &pka_ick, CK_243X), 1999 CLK(NULL, "pka_ick", &pka_ick, CK_243X),
1983 CLK(NULL, "usb_fck", &usb_fck, CK_243X), 2000 CLK(NULL, "usb_fck", &usb_fck, CK_243X),
1984 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X), 2001 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X),
2002 CLK(NULL, "usbhs_ick", &usbhs_ick, CK_243X),
1985 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X), 2003 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X),
2004 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_243X),
1986 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_243X), 2005 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_243X),
1987 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X), 2006 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X),
2007 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_243X),
1988 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_243X), 2008 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_243X),
1989 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X), 2009 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
1990 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X), 2010 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
1991 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X), 2011 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
1992 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X), 2012 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
2013 CLK(NULL, "mmchsdb1_fck", &mmchsdb1_fck, CK_243X),
1993 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X), 2014 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
2015 CLK(NULL, "mmchsdb2_fck", &mmchsdb2_fck, CK_243X),
1994 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X), 2016 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X),
1995 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X), 2017 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X),
1996 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X), 2018 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X),
2019 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_243X),
1997}; 2020};
1998 2021
1999/* 2022/*
diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c
index 2026311a4ff6..b87b88c2638b 100644
--- a/arch/arm/mach-omap2/clock33xx_data.c
+++ b/arch/arm/mach-omap2/clock33xx_data.c
@@ -1013,6 +1013,7 @@ static struct omap_clk am33xx_clks[] = {
1013 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_AM33XX), 1013 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_AM33XX),
1014 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_AM33XX), 1014 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_AM33XX),
1015 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_AM33XX), 1015 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_AM33XX),
1016 CLK("cpu0", NULL, &dpll_mpu_ck, CK_AM33XX),
1016 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX), 1017 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX),
1017 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX), 1018 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX),
1018 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX), 1019 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX),
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c
index 15cdc6471737..83bb01427d40 100644
--- a/arch/arm/mach-omap2/clock3xxx.c
+++ b/arch/arm/mach-omap2/clock3xxx.c
@@ -63,15 +63,15 @@ void __init omap3_clk_lock_dpll5(void)
63 63
64 dpll5_clk = clk_get(NULL, "dpll5_ck"); 64 dpll5_clk = clk_get(NULL, "dpll5_ck");
65 clk_set_rate(dpll5_clk, DPLL5_FREQ_FOR_USBHOST); 65 clk_set_rate(dpll5_clk, DPLL5_FREQ_FOR_USBHOST);
66 clk_enable(dpll5_clk); 66 clk_prepare_enable(dpll5_clk);
67 67
68 /* Program dpll5_m2_clk divider for no division */ 68 /* Program dpll5_m2_clk divider for no division */
69 dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck"); 69 dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
70 clk_enable(dpll5_m2_clk); 70 clk_prepare_enable(dpll5_m2_clk);
71 clk_set_rate(dpll5_m2_clk, DPLL5_FREQ_FOR_USBHOST); 71 clk_set_rate(dpll5_m2_clk, DPLL5_FREQ_FOR_USBHOST);
72 72
73 clk_disable(dpll5_m2_clk); 73 clk_disable_unprepare(dpll5_m2_clk);
74 clk_disable(dpll5_clk); 74 clk_disable_unprepare(dpll5_clk);
75 return; 75 return;
76} 76}
77 77
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 700317a1bd16..1f42c9d5ecf3 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3215,7 +3215,6 @@ static struct clk dummy_apb_pclk = {
3215 * clkdev 3215 * clkdev
3216 */ 3216 */
3217 3217
3218/* XXX At some point we should rename this file to clock3xxx_data.c */
3219static struct omap_clk omap3xxx_clks[] = { 3218static struct omap_clk omap3xxx_clks[] = {
3220 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX), 3219 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX),
3221 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX), 3220 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX),
@@ -3243,11 +3242,13 @@ static struct omap_clk omap3xxx_clks[] = {
3243 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_3XXX), 3242 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_3XXX),
3244 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_3XXX), 3243 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_3XXX),
3245 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_3XXX), 3244 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_3XXX),
3245 CLK(NULL, "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3246 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX), 3246 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3247 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_3XXX), 3247 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_3XXX),
3248 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_3XXX), 3248 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_3XXX),
3249 CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck, CK_36XX), 3249 CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck, CK_36XX),
3250 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_3XXX), 3250 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_3XXX),
3251 CLK(NULL, "omap_96m_alwon_fck_3630", &omap_96m_alwon_fck_3630, CK_36XX),
3251 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_3XXX), 3252 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_3XXX),
3252 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_3XXX), 3253 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_3XXX),
3253 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_3XXX), 3254 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_3XXX),
@@ -3263,6 +3264,7 @@ static struct omap_clk omap3xxx_clks[] = {
3263 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_3XXX), 3264 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_3XXX),
3264 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_3XXX), 3265 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_3XXX),
3265 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_3XXX), 3266 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_3XXX),
3267 CLK(NULL, "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3266 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX), 3268 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3267 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3269 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3268 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3270 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
@@ -3272,6 +3274,7 @@ static struct omap_clk omap3xxx_clks[] = {
3272 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_3XXX), 3274 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_3XXX),
3273 CLK(NULL, "mpu_ck", &mpu_ck, CK_3XXX), 3275 CLK(NULL, "mpu_ck", &mpu_ck, CK_3XXX),
3274 CLK(NULL, "arm_fck", &arm_fck, CK_3XXX), 3276 CLK(NULL, "arm_fck", &arm_fck, CK_3XXX),
3277 CLK(NULL, "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3275 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX), 3278 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3276 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_34XX | CK_36XX), 3279 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_34XX | CK_36XX),
3277 CLK(NULL, "iva2_ck", &iva2_ck, CK_34XX | CK_36XX), 3280 CLK(NULL, "iva2_ck", &iva2_ck, CK_34XX | CK_36XX),
@@ -3295,6 +3298,7 @@ static struct omap_clk omap3xxx_clks[] = {
3295 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3298 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3296 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3299 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3297 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3300 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3301 CLK("usbhs_tll", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3298 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX), 3302 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
3299 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3303 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3300 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX), 3304 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX),
@@ -3315,6 +3319,7 @@ static struct omap_clk omap3xxx_clks[] = {
3315 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1), 3319 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
3316 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX), 3320 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX),
3317 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX), 3321 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX),
3322 CLK(NULL, "hdq_fck", &hdq_fck, CK_3XXX),
3318 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1), 3323 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1),
3319 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX), 3324 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3320 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1), 3325 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
@@ -3322,6 +3327,8 @@ static struct omap_clk omap3xxx_clks[] = {
3322 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_3XXX), 3327 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_3XXX),
3323 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1, CK_3430ES1), 3328 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3324 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX), 3329 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3330 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3331 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3325 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_3XXX), 3332 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_3XXX),
3326 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_3XXX), 3333 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_3XXX),
3327 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_34XX | CK_36XX), 3334 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_34XX | CK_36XX),
@@ -3329,28 +3336,42 @@ static struct omap_clk omap3xxx_clks[] = {
3329 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX), 3336 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX),
3330 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3337 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3331 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3338 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3339 CLK("usbhs_tll", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3332 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3340 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3341 CLK(NULL, "mmchs3_ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3333 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX), 3342 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX),
3334 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX), 3343 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX),
3335 CLK("omap-sham", "ick", &sha12_ick, CK_34XX | CK_36XX), 3344 CLK("omap-sham", "ick", &sha12_ick, CK_34XX | CK_36XX),
3336 CLK(NULL, "des2_ick", &des2_ick, CK_34XX | CK_36XX), 3345 CLK(NULL, "des2_ick", &des2_ick, CK_34XX | CK_36XX),
3337 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_3XXX), 3346 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_3XXX),
3338 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_3XXX), 3347 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_3XXX),
3348 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_3XXX),
3349 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_3XXX),
3339 CLK(NULL, "mspro_ick", &mspro_ick, CK_34XX | CK_36XX), 3350 CLK(NULL, "mspro_ick", &mspro_ick, CK_34XX | CK_36XX),
3340 CLK("omap_hdq.0", "ick", &hdq_ick, CK_3XXX), 3351 CLK("omap_hdq.0", "ick", &hdq_ick, CK_3XXX),
3352 CLK(NULL, "hdq_ick", &hdq_ick, CK_3XXX),
3341 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_3XXX), 3353 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_3XXX),
3342 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_3XXX), 3354 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_3XXX),
3343 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_3XXX), 3355 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_3XXX),
3344 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_3XXX), 3356 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_3XXX),
3357 CLK(NULL, "mcspi4_ick", &mcspi4_ick, CK_3XXX),
3358 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_3XXX),
3359 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_3XXX),
3360 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_3XXX),
3345 CLK("omap_i2c.3", "ick", &i2c3_ick, CK_3XXX), 3361 CLK("omap_i2c.3", "ick", &i2c3_ick, CK_3XXX),
3346 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_3XXX), 3362 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_3XXX),
3347 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_3XXX), 3363 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_3XXX),
3364 CLK(NULL, "i2c3_ick", &i2c3_ick, CK_3XXX),
3365 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_3XXX),
3366 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_3XXX),
3348 CLK(NULL, "uart2_ick", &uart2_ick, CK_3XXX), 3367 CLK(NULL, "uart2_ick", &uart2_ick, CK_3XXX),
3349 CLK(NULL, "uart1_ick", &uart1_ick, CK_3XXX), 3368 CLK(NULL, "uart1_ick", &uart1_ick, CK_3XXX),
3350 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_3XXX), 3369 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_3XXX),
3351 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_3XXX), 3370 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_3XXX),
3352 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_3XXX), 3371 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_3XXX),
3353 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_3XXX), 3372 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_3XXX),
3373 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_3XXX),
3374 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_3XXX),
3354 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1), 3375 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1),
3355 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_34XX | CK_36XX), 3376 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_34XX | CK_36XX),
3356 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_3XXX), 3377 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_3XXX),
@@ -3369,7 +3390,9 @@ static struct omap_clk omap3xxx_clks[] = {
3369 CLK(NULL, "dss_96m_fck", &dss_96m_fck, CK_3XXX), 3390 CLK(NULL, "dss_96m_fck", &dss_96m_fck, CK_3XXX),
3370 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck, CK_3XXX), 3391 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck, CK_3XXX),
3371 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1), 3392 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1),
3393 CLK(NULL, "dss_ick", &dss_ick_3430es1, CK_3430ES1),
3372 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3394 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3395 CLK(NULL, "dss_ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3373 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX), 3396 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX),
3374 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX), 3397 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX),
3375 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX), 3398 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX),
@@ -3385,6 +3408,8 @@ static struct omap_clk omap3xxx_clks[] = {
3385 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX), 3408 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX),
3386 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX), 3409 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3387 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX), 3410 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3411 CLK("usbhs_tll", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3412 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3388 CLK(NULL, "init_60m_fclk", &dummy_ck, CK_3XXX), 3413 CLK(NULL, "init_60m_fclk", &dummy_ck, CK_3XXX),
3389 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX), 3414 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX),
3390 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX), 3415 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
@@ -3394,6 +3419,7 @@ static struct omap_clk omap3xxx_clks[] = {
3394 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX), 3419 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX),
3395 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX), 3420 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX),
3396 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX), 3421 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX),
3422 CLK(NULL, "wdt2_ick", &wdt2_ick, CK_3XXX),
3397 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_3XXX), 3423 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_3XXX),
3398 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_3XXX), 3424 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_3XXX),
3399 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX), 3425 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
@@ -3439,9 +3465,13 @@ static struct omap_clk omap3xxx_clks[] = {
3439 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX), 3465 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX),
3440 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX), 3466 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX),
3441 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX), 3467 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX),
3468 CLK(NULL, "mcbsp4_ick", &mcbsp2_ick, CK_3XXX),
3469 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_3XXX),
3470 CLK(NULL, "mcbsp2_ick", &mcbsp4_ick, CK_3XXX),
3442 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_3XXX), 3471 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_3XXX),
3443 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_3XXX), 3472 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_3XXX),
3444 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_3XXX), 3473 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_3XXX),
3474 CLK(NULL, "emu_src_ck", &emu_src_ck, CK_3XXX),
3445 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX), 3475 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX),
3446 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX), 3476 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX),
3447 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX), 3477 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX),
@@ -3457,8 +3487,12 @@ static struct omap_clk omap3xxx_clks[] = {
3457 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX), 3487 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX),
3458 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX), 3488 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX),
3459 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX), 3489 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX),
3490 CLK(NULL, "emac_ick", &emac_ick, CK_AM35XX),
3491 CLK(NULL, "emac_fck", &emac_fck, CK_AM35XX),
3460 CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX), 3492 CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX),
3461 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX), 3493 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX),
3494 CLK(NULL, "vpfe_ick", &emac_ick, CK_AM35XX),
3495 CLK(NULL, "vpfe_fck", &emac_fck, CK_AM35XX),
3462 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX), 3496 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
3463 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX), 3497 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
3464 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx, CK_AM35XX), 3498 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx, CK_AM35XX),
@@ -3467,6 +3501,7 @@ static struct omap_clk omap3xxx_clks[] = {
3467 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX), 3501 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
3468 CLK(NULL, "timer_32k_ck", &omap_32k_fck, CK_3XXX), 3502 CLK(NULL, "timer_32k_ck", &omap_32k_fck, CK_3XXX),
3469 CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX), 3503 CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX),
3504 CLK(NULL, "cpufreq_ck", &dpll1_ck, CK_3XXX),
3470}; 3505};
3471 3506
3472 3507
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 500682c051c1..d661d138f270 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3156,6 +3156,7 @@ static struct omap_clk omap44xx_clks[] = {
3156 CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X), 3156 CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X),
3157 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X), 3157 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X),
3158 CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X), 3158 CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X),
3159 CLK(NULL, "dss_fck", &dss_fck, CK_443X),
3159 CLK("omapdss_dss", "ick", &dss_fck, CK_443X), 3160 CLK("omapdss_dss", "ick", &dss_fck, CK_443X),
3160 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X), 3161 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),
3161 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X), 3162 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),
@@ -3212,6 +3213,7 @@ static struct omap_clk omap44xx_clks[] = {
3212 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X), 3213 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X),
3213 CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X), 3214 CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X),
3214 CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X), 3215 CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X),
3216 CLK(NULL, "rng_ick", &rng_ick, CK_443X),
3215 CLK("omap_rng", "ick", &rng_ick, CK_443X), 3217 CLK("omap_rng", "ick", &rng_ick, CK_443X),
3216 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X), 3218 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X),
3217 CLK(NULL, "sl2if_ick", &sl2if_ick, CK_443X), 3219 CLK(NULL, "sl2if_ick", &sl2if_ick, CK_443X),
@@ -3243,6 +3245,7 @@ static struct omap_clk omap44xx_clks[] = {
3243 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X), 3245 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X),
3244 CLK(NULL, "uart4_fck", &uart4_fck, CK_443X), 3246 CLK(NULL, "uart4_fck", &uart4_fck, CK_443X),
3245 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X), 3247 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X),
3248 CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck, CK_443X),
3246 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X), 3249 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X),
3247 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X), 3250 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X),
3248 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X), 3251 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X),
@@ -3253,15 +3256,19 @@ static struct omap_clk omap44xx_clks[] = {
3253 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X), 3256 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X),
3254 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X), 3257 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X),
3255 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X), 3258 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X),
3259 CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck, CK_443X),
3256 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X), 3260 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X),
3257 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X), 3261 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X),
3258 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X), 3262 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X),
3263 CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick, CK_443X),
3259 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X), 3264 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X),
3260 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X), 3265 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X),
3261 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X), 3266 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X),
3262 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X), 3267 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X),
3263 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X), 3268 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X),
3269 CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick, CK_443X),
3264 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X), 3270 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
3271 CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
3265 CLK(NULL, "usim_ck", &usim_ck, CK_443X), 3272 CLK(NULL, "usim_ck", &usim_ck, CK_443X),
3266 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X), 3273 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
3267 CLK(NULL, "usim_fck", &usim_fck, CK_443X), 3274 CLK(NULL, "usim_fck", &usim_fck, CK_443X),
@@ -3312,8 +3319,10 @@ static struct omap_clk omap44xx_clks[] = {
3312 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X), 3319 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X),
3313 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X), 3320 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X),
3314 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X), 3321 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X),
3322 CLK("usbhs_tll", "usbtll_fck", &dummy_ck, CK_443X),
3315 CLK("omap_wdt", "ick", &dummy_ck, CK_443X), 3323 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
3316 CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X), 3324 CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X),
3325 /* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
3317 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X), 3326 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3318 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X), 3327 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3319 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X), 3328 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X),
@@ -3325,6 +3334,18 @@ static struct omap_clk omap44xx_clks[] = {
3325 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 3334 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3326 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 3335 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3327 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 3336 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3337 CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3338 CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3339 CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3340 CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3341 CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3342 CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3343 CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3344 CLK("49038000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3345 CLK("4903a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3346 CLK("4903c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3347 CLK("4903e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3348 CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X),
3328}; 3349};
3329 3350
3330int __init omap4xxx_clk_init(void) 3351int __init omap4xxx_clk_init(void)
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index a1555627ad97..cbb879139c51 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -899,6 +899,23 @@ bool clkdm_in_hwsup(struct clockdomain *clkdm)
899 return ret; 899 return ret;
900} 900}
901 901
902/**
903 * clkdm_missing_idle_reporting - can @clkdm enter autoidle even if in use?
904 * @clkdm: struct clockdomain *
905 *
906 * Returns true if clockdomain @clkdm has the
907 * CLKDM_MISSING_IDLE_REPORTING flag set, or false if not or @clkdm is
908 * null. More information is available in the documentation for the
909 * CLKDM_MISSING_IDLE_REPORTING macro.
910 */
911bool clkdm_missing_idle_reporting(struct clockdomain *clkdm)
912{
913 if (!clkdm)
914 return false;
915
916 return (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) ? true : false;
917}
918
902/* Clockdomain-to-clock/hwmod framework interface code */ 919/* Clockdomain-to-clock/hwmod framework interface code */
903 920
904static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm) 921static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm)
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 5601dc13785e..629576be7444 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -1,9 +1,7 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/clockdomain.h
3 *
4 * OMAP2/3 clockdomain framework functions 2 * OMAP2/3 clockdomain framework functions
5 * 3 *
6 * Copyright (C) 2008 Texas Instruments, Inc. 4 * Copyright (C) 2008, 2012 Texas Instruments, Inc.
7 * Copyright (C) 2008-2011 Nokia Corporation 5 * Copyright (C) 2008-2011 Nokia Corporation
8 * 6 *
9 * Paul Walmsley 7 * Paul Walmsley
@@ -34,6 +32,20 @@
34 * CLKDM_ACTIVE_WITH_MPU: The PRCM guarantees that this clockdomain is 32 * CLKDM_ACTIVE_WITH_MPU: The PRCM guarantees that this clockdomain is
35 * active whenever the MPU is active. True for interconnects and 33 * active whenever the MPU is active. True for interconnects and
36 * the WKUP clockdomains. 34 * the WKUP clockdomains.
35 * CLKDM_MISSING_IDLE_REPORTING: The idle status of the IP blocks and
36 * clocks inside this clockdomain are not taken into account by
37 * the PRCM when determining whether the clockdomain is idle.
38 * Without this flag, if the clockdomain is set to
39 * hardware-supervised idle mode, the PRCM may transition the
40 * enclosing powerdomain to a low power state, even when devices
41 * inside the clockdomain and powerdomain are in use. (An example
42 * of such a clockdomain is the EMU clockdomain on OMAP3/4.) If
43 * this flag is set, and the clockdomain does not support the
44 * force-sleep mode, then the HW_AUTO mode will be used to put the
45 * clockdomain to sleep. Similarly, if the clockdomain supports
46 * the force-wakeup mode, then it will be used whenever a clock or
47 * IP block inside the clockdomain is active, rather than the
48 * HW_AUTO mode.
37 */ 49 */
38#define CLKDM_CAN_FORCE_SLEEP (1 << 0) 50#define CLKDM_CAN_FORCE_SLEEP (1 << 0)
39#define CLKDM_CAN_FORCE_WAKEUP (1 << 1) 51#define CLKDM_CAN_FORCE_WAKEUP (1 << 1)
@@ -41,6 +53,7 @@
41#define CLKDM_CAN_DISABLE_AUTO (1 << 3) 53#define CLKDM_CAN_DISABLE_AUTO (1 << 3)
42#define CLKDM_NO_AUTODEPS (1 << 4) 54#define CLKDM_NO_AUTODEPS (1 << 4)
43#define CLKDM_ACTIVE_WITH_MPU (1 << 5) 55#define CLKDM_ACTIVE_WITH_MPU (1 << 5)
56#define CLKDM_MISSING_IDLE_REPORTING (1 << 6)
44 57
45#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO) 58#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)
46#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP) 59#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
@@ -187,6 +200,7 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
187void clkdm_allow_idle(struct clockdomain *clkdm); 200void clkdm_allow_idle(struct clockdomain *clkdm);
188void clkdm_deny_idle(struct clockdomain *clkdm); 201void clkdm_deny_idle(struct clockdomain *clkdm);
189bool clkdm_in_hwsup(struct clockdomain *clkdm); 202bool clkdm_in_hwsup(struct clockdomain *clkdm);
203bool clkdm_missing_idle_reporting(struct clockdomain *clkdm);
190 204
191int clkdm_wakeup(struct clockdomain *clkdm); 205int clkdm_wakeup(struct clockdomain *clkdm);
192int clkdm_sleep(struct clockdomain *clkdm); 206int clkdm_sleep(struct clockdomain *clkdm);
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
index f99e65cfb862..9a7792aec673 100644
--- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
@@ -162,6 +162,19 @@ static void _disable_hwsup(struct clockdomain *clkdm)
162 clkdm->clktrctrl_mask); 162 clkdm->clktrctrl_mask);
163} 163}
164 164
165static int omap3_clkdm_sleep(struct clockdomain *clkdm)
166{
167 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
168 clkdm->clktrctrl_mask);
169 return 0;
170}
171
172static int omap3_clkdm_wakeup(struct clockdomain *clkdm)
173{
174 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
175 clkdm->clktrctrl_mask);
176 return 0;
177}
165 178
166static int omap2_clkdm_clk_enable(struct clockdomain *clkdm) 179static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
167{ 180{
@@ -170,6 +183,17 @@ static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
170 if (!clkdm->clktrctrl_mask) 183 if (!clkdm->clktrctrl_mask)
171 return 0; 184 return 0;
172 185
186 /*
187 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
188 * more details on the unpleasant problem this is working
189 * around
190 */
191 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
192 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
193 _enable_hwsup(clkdm);
194 return 0;
195 }
196
173 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, 197 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
174 clkdm->clktrctrl_mask); 198 clkdm->clktrctrl_mask);
175 199
@@ -193,6 +217,17 @@ static int omap2_clkdm_clk_disable(struct clockdomain *clkdm)
193 if (!clkdm->clktrctrl_mask) 217 if (!clkdm->clktrctrl_mask)
194 return 0; 218 return 0;
195 219
220 /*
221 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
222 * more details on the unpleasant problem this is working
223 * around
224 */
225 if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
226 (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
227 omap3_clkdm_wakeup(clkdm);
228 return 0;
229 }
230
196 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, 231 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
197 clkdm->clktrctrl_mask); 232 clkdm->clktrctrl_mask);
198 233
@@ -209,20 +244,6 @@ static int omap2_clkdm_clk_disable(struct clockdomain *clkdm)
209 return 0; 244 return 0;
210} 245}
211 246
212static int omap3_clkdm_sleep(struct clockdomain *clkdm)
213{
214 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
215 clkdm->clktrctrl_mask);
216 return 0;
217}
218
219static int omap3_clkdm_wakeup(struct clockdomain *clkdm)
220{
221 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
222 clkdm->clktrctrl_mask);
223 return 0;
224}
225
226static void omap3_clkdm_allow_idle(struct clockdomain *clkdm) 247static void omap3_clkdm_allow_idle(struct clockdomain *clkdm)
227{ 248{
228 if (atomic_read(&clkdm->usecount) > 0) 249 if (atomic_read(&clkdm->usecount) > 0)
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
index 762f2cc542ce..6fc6155625bc 100644
--- a/arch/arm/mach-omap2/clockdomain44xx.c
+++ b/arch/arm/mach-omap2/clockdomain44xx.c
@@ -113,6 +113,17 @@ static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
113 if (!clkdm->prcm_partition) 113 if (!clkdm->prcm_partition)
114 return 0; 114 return 0;
115 115
116 /*
117 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
118 * more details on the unpleasant problem this is working
119 * around
120 */
121 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
122 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
123 omap4_clkdm_allow_idle(clkdm);
124 return 0;
125 }
126
116 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition, 127 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
117 clkdm->cm_inst, clkdm->clkdm_offs); 128 clkdm->cm_inst, clkdm->clkdm_offs);
118 129
diff --git a/arch/arm/mach-omap2/clockdomains3xxx_data.c b/arch/arm/mach-omap2/clockdomains3xxx_data.c
index 56089c49142a..933a35cd124a 100644
--- a/arch/arm/mach-omap2/clockdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains3xxx_data.c
@@ -387,14 +387,11 @@ static struct clockdomain per_am35x_clkdm = {
387 .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK, 387 .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
388}; 388};
389 389
390/*
391 * Disable hw supervised mode for emu_clkdm, because emu_pwrdm is
392 * switched of even if sdti is in use
393 */
394static struct clockdomain emu_clkdm = { 390static struct clockdomain emu_clkdm = {
395 .name = "emu_clkdm", 391 .name = "emu_clkdm",
396 .pwrdm = { .name = "emu_pwrdm" }, 392 .pwrdm = { .name = "emu_pwrdm" },
397 .flags = /* CLKDM_CAN_ENABLE_AUTO | */CLKDM_CAN_SWSUP, 393 .flags = (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_SWSUP |
394 CLKDM_MISSING_IDLE_REPORTING),
398 .clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK, 395 .clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK,
399}; 396};
400 397
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index 63d60a773d3b..b56d06b48782 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -390,7 +390,8 @@ static struct clockdomain emu_sys_44xx_clkdm = {
390 .prcm_partition = OMAP4430_PRM_PARTITION, 390 .prcm_partition = OMAP4430_PRM_PARTITION,
391 .cm_inst = OMAP4430_PRM_EMU_CM_INST, 391 .cm_inst = OMAP4430_PRM_EMU_CM_INST,
392 .clkdm_offs = OMAP4430_PRM_EMU_CM_EMU_CDOFFS, 392 .clkdm_offs = OMAP4430_PRM_EMU_CM_EMU_CDOFFS,
393 .flags = CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_FORCE_WAKEUP, 393 .flags = (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_FORCE_WAKEUP |
394 CLKDM_MISSING_IDLE_REPORTING),
394}; 395};
395 396
396static struct clockdomain l3_dma_44xx_clkdm = { 397static struct clockdomain l3_dma_44xx_clkdm = {
diff --git a/arch/arm/mach-omap2/cm-regbits-33xx.h b/arch/arm/mach-omap2/cm-regbits-33xx.h
index 532027ee3d8d..adf7bb79b18f 100644
--- a/arch/arm/mach-omap2/cm-regbits-33xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-33xx.h
@@ -25,263 +25,328 @@
25 * CM_AUTOIDLE_DPLL_MPU, CM_AUTOIDLE_DPLL_PER 25 * CM_AUTOIDLE_DPLL_MPU, CM_AUTOIDLE_DPLL_PER
26 */ 26 */
27#define AM33XX_AUTO_DPLL_MODE_SHIFT 0 27#define AM33XX_AUTO_DPLL_MODE_SHIFT 0
28#define AM33XX_AUTO_DPLL_MODE_WIDTH 3
28#define AM33XX_AUTO_DPLL_MODE_MASK (0x7 << 0) 29#define AM33XX_AUTO_DPLL_MODE_MASK (0x7 << 0)
29 30
30/* Used by CM_WKUP_CLKSTCTRL */ 31/* Used by CM_WKUP_CLKSTCTRL */
31#define AM33XX_CLKACTIVITY_ADC_FCLK_SHIFT 14 32#define AM33XX_CLKACTIVITY_ADC_FCLK_SHIFT 14
33#define AM33XX_CLKACTIVITY_ADC_FCLK_WIDTH 1
32#define AM33XX_CLKACTIVITY_ADC_FCLK_MASK (1 << 16) 34#define AM33XX_CLKACTIVITY_ADC_FCLK_MASK (1 << 16)
33 35
34/* Used by CM_PER_L4LS_CLKSTCTRL */ 36/* Used by CM_PER_L4LS_CLKSTCTRL */
35#define AM33XX_CLKACTIVITY_CAN_CLK_SHIFT 11 37#define AM33XX_CLKACTIVITY_CAN_CLK_SHIFT 11
38#define AM33XX_CLKACTIVITY_CAN_CLK_WIDTH 1
36#define AM33XX_CLKACTIVITY_CAN_CLK_MASK (1 << 11) 39#define AM33XX_CLKACTIVITY_CAN_CLK_MASK (1 << 11)
37 40
38/* Used by CM_PER_CLK_24MHZ_CLKSTCTRL */ 41/* Used by CM_PER_CLK_24MHZ_CLKSTCTRL */
39#define AM33XX_CLKACTIVITY_CLK_24MHZ_GCLK_SHIFT 4 42#define AM33XX_CLKACTIVITY_CLK_24MHZ_GCLK_SHIFT 4
43#define AM33XX_CLKACTIVITY_CLK_24MHZ_GCLK_WIDTH 1
40#define AM33XX_CLKACTIVITY_CLK_24MHZ_GCLK_MASK (1 << 4) 44#define AM33XX_CLKACTIVITY_CLK_24MHZ_GCLK_MASK (1 << 4)
41 45
42/* Used by CM_PER_CPSW_CLKSTCTRL */ 46/* Used by CM_PER_CPSW_CLKSTCTRL */
43#define AM33XX_CLKACTIVITY_CPSW_125MHZ_GCLK_SHIFT 4 47#define AM33XX_CLKACTIVITY_CPSW_125MHZ_GCLK_SHIFT 4
48#define AM33XX_CLKACTIVITY_CPSW_125MHZ_GCLK_WIDTH 1
44#define AM33XX_CLKACTIVITY_CPSW_125MHZ_GCLK_MASK (1 << 4) 49#define AM33XX_CLKACTIVITY_CPSW_125MHZ_GCLK_MASK (1 << 4)
45 50
46/* Used by CM_PER_L4HS_CLKSTCTRL */ 51/* Used by CM_PER_L4HS_CLKSTCTRL */
47#define AM33XX_CLKACTIVITY_CPSW_250MHZ_GCLK_SHIFT 4 52#define AM33XX_CLKACTIVITY_CPSW_250MHZ_GCLK_SHIFT 4
53#define AM33XX_CLKACTIVITY_CPSW_250MHZ_GCLK_WIDTH 1
48#define AM33XX_CLKACTIVITY_CPSW_250MHZ_GCLK_MASK (1 << 4) 54#define AM33XX_CLKACTIVITY_CPSW_250MHZ_GCLK_MASK (1 << 4)
49 55
50/* Used by CM_PER_L4HS_CLKSTCTRL */ 56/* Used by CM_PER_L4HS_CLKSTCTRL */
51#define AM33XX_CLKACTIVITY_CPSW_50MHZ_GCLK_SHIFT 5 57#define AM33XX_CLKACTIVITY_CPSW_50MHZ_GCLK_SHIFT 5
58#define AM33XX_CLKACTIVITY_CPSW_50MHZ_GCLK_WIDTH 1
52#define AM33XX_CLKACTIVITY_CPSW_50MHZ_GCLK_MASK (1 << 5) 59#define AM33XX_CLKACTIVITY_CPSW_50MHZ_GCLK_MASK (1 << 5)
53 60
54/* Used by CM_PER_L4HS_CLKSTCTRL */ 61/* Used by CM_PER_L4HS_CLKSTCTRL */
55#define AM33XX_CLKACTIVITY_CPSW_5MHZ_GCLK_SHIFT 6 62#define AM33XX_CLKACTIVITY_CPSW_5MHZ_GCLK_SHIFT 6
63#define AM33XX_CLKACTIVITY_CPSW_5MHZ_GCLK_WIDTH 1
56#define AM33XX_CLKACTIVITY_CPSW_5MHZ_GCLK_MASK (1 << 6) 64#define AM33XX_CLKACTIVITY_CPSW_5MHZ_GCLK_MASK (1 << 6)
57 65
58/* Used by CM_PER_L3_CLKSTCTRL */ 66/* Used by CM_PER_L3_CLKSTCTRL */
59#define AM33XX_CLKACTIVITY_CPTS_RFT_GCLK_SHIFT 6 67#define AM33XX_CLKACTIVITY_CPTS_RFT_GCLK_SHIFT 6
68#define AM33XX_CLKACTIVITY_CPTS_RFT_GCLK_WIDTH 1
60#define AM33XX_CLKACTIVITY_CPTS_RFT_GCLK_MASK (1 << 6) 69#define AM33XX_CLKACTIVITY_CPTS_RFT_GCLK_MASK (1 << 6)
61 70
62/* Used by CM_CEFUSE_CLKSTCTRL */ 71/* Used by CM_CEFUSE_CLKSTCTRL */
63#define AM33XX_CLKACTIVITY_CUST_EFUSE_SYS_CLK_SHIFT 9 72#define AM33XX_CLKACTIVITY_CUST_EFUSE_SYS_CLK_SHIFT 9
73#define AM33XX_CLKACTIVITY_CUST_EFUSE_SYS_CLK_WIDTH 1
64#define AM33XX_CLKACTIVITY_CUST_EFUSE_SYS_CLK_MASK (1 << 9) 74#define AM33XX_CLKACTIVITY_CUST_EFUSE_SYS_CLK_MASK (1 << 9)
65 75
66/* Used by CM_L3_AON_CLKSTCTRL */ 76/* Used by CM_L3_AON_CLKSTCTRL */
67#define AM33XX_CLKACTIVITY_DBGSYSCLK_SHIFT 2 77#define AM33XX_CLKACTIVITY_DBGSYSCLK_SHIFT 2
78#define AM33XX_CLKACTIVITY_DBGSYSCLK_WIDTH 1
68#define AM33XX_CLKACTIVITY_DBGSYSCLK_MASK (1 << 2) 79#define AM33XX_CLKACTIVITY_DBGSYSCLK_MASK (1 << 2)
69 80
70/* Used by CM_L3_AON_CLKSTCTRL */ 81/* Used by CM_L3_AON_CLKSTCTRL */
71#define AM33XX_CLKACTIVITY_DEBUG_CLKA_SHIFT 4 82#define AM33XX_CLKACTIVITY_DEBUG_CLKA_SHIFT 4
83#define AM33XX_CLKACTIVITY_DEBUG_CLKA_WIDTH 1
72#define AM33XX_CLKACTIVITY_DEBUG_CLKA_MASK (1 << 4) 84#define AM33XX_CLKACTIVITY_DEBUG_CLKA_MASK (1 << 4)
73 85
74/* Used by CM_PER_L3_CLKSTCTRL */ 86/* Used by CM_PER_L3_CLKSTCTRL */
75#define AM33XX_CLKACTIVITY_EMIF_GCLK_SHIFT 2 87#define AM33XX_CLKACTIVITY_EMIF_GCLK_SHIFT 2
88#define AM33XX_CLKACTIVITY_EMIF_GCLK_WIDTH 1
76#define AM33XX_CLKACTIVITY_EMIF_GCLK_MASK (1 << 2) 89#define AM33XX_CLKACTIVITY_EMIF_GCLK_MASK (1 << 2)
77 90
78/* Used by CM_GFX_L3_CLKSTCTRL */ 91/* Used by CM_GFX_L3_CLKSTCTRL */
79#define AM33XX_CLKACTIVITY_GFX_FCLK_SHIFT 9 92#define AM33XX_CLKACTIVITY_GFX_FCLK_SHIFT 9
93#define AM33XX_CLKACTIVITY_GFX_FCLK_WIDTH 1
80#define AM33XX_CLKACTIVITY_GFX_FCLK_MASK (1 << 9) 94#define AM33XX_CLKACTIVITY_GFX_FCLK_MASK (1 << 9)
81 95
82/* Used by CM_GFX_L3_CLKSTCTRL */ 96/* Used by CM_GFX_L3_CLKSTCTRL */
83#define AM33XX_CLKACTIVITY_GFX_L3_GCLK_SHIFT 8 97#define AM33XX_CLKACTIVITY_GFX_L3_GCLK_SHIFT 8
98#define AM33XX_CLKACTIVITY_GFX_L3_GCLK_WIDTH 1
84#define AM33XX_CLKACTIVITY_GFX_L3_GCLK_MASK (1 << 8) 99#define AM33XX_CLKACTIVITY_GFX_L3_GCLK_MASK (1 << 8)
85 100
86/* Used by CM_WKUP_CLKSTCTRL */ 101/* Used by CM_WKUP_CLKSTCTRL */
87#define AM33XX_CLKACTIVITY_GPIO0_GDBCLK_SHIFT 8 102#define AM33XX_CLKACTIVITY_GPIO0_GDBCLK_SHIFT 8
103#define AM33XX_CLKACTIVITY_GPIO0_GDBCLK_WIDTH 1
88#define AM33XX_CLKACTIVITY_GPIO0_GDBCLK_MASK (1 << 8) 104#define AM33XX_CLKACTIVITY_GPIO0_GDBCLK_MASK (1 << 8)
89 105
90/* Used by CM_PER_L4LS_CLKSTCTRL */ 106/* Used by CM_PER_L4LS_CLKSTCTRL */
91#define AM33XX_CLKACTIVITY_GPIO_1_GDBCLK_SHIFT 19 107#define AM33XX_CLKACTIVITY_GPIO_1_GDBCLK_SHIFT 19
108#define AM33XX_CLKACTIVITY_GPIO_1_GDBCLK_WIDTH 1
92#define AM33XX_CLKACTIVITY_GPIO_1_GDBCLK_MASK (1 << 19) 109#define AM33XX_CLKACTIVITY_GPIO_1_GDBCLK_MASK (1 << 19)
93 110
94/* Used by CM_PER_L4LS_CLKSTCTRL */ 111/* Used by CM_PER_L4LS_CLKSTCTRL */
95#define AM33XX_CLKACTIVITY_GPIO_2_GDBCLK_SHIFT 20 112#define AM33XX_CLKACTIVITY_GPIO_2_GDBCLK_SHIFT 20
113#define AM33XX_CLKACTIVITY_GPIO_2_GDBCLK_WIDTH 1
96#define AM33XX_CLKACTIVITY_GPIO_2_GDBCLK_MASK (1 << 20) 114#define AM33XX_CLKACTIVITY_GPIO_2_GDBCLK_MASK (1 << 20)
97 115
98/* Used by CM_PER_L4LS_CLKSTCTRL */ 116/* Used by CM_PER_L4LS_CLKSTCTRL */
99#define AM33XX_CLKACTIVITY_GPIO_3_GDBCLK_SHIFT 21 117#define AM33XX_CLKACTIVITY_GPIO_3_GDBCLK_SHIFT 21
118#define AM33XX_CLKACTIVITY_GPIO_3_GDBCLK_WIDTH 1
100#define AM33XX_CLKACTIVITY_GPIO_3_GDBCLK_MASK (1 << 21) 119#define AM33XX_CLKACTIVITY_GPIO_3_GDBCLK_MASK (1 << 21)
101 120
102/* Used by CM_PER_L4LS_CLKSTCTRL */ 121/* Used by CM_PER_L4LS_CLKSTCTRL */
103#define AM33XX_CLKACTIVITY_GPIO_4_GDBCLK_SHIFT 22 122#define AM33XX_CLKACTIVITY_GPIO_4_GDBCLK_SHIFT 22
123#define AM33XX_CLKACTIVITY_GPIO_4_GDBCLK_WIDTH 1
104#define AM33XX_CLKACTIVITY_GPIO_4_GDBCLK_MASK (1 << 22) 124#define AM33XX_CLKACTIVITY_GPIO_4_GDBCLK_MASK (1 << 22)
105 125
106/* Used by CM_PER_L4LS_CLKSTCTRL */ 126/* Used by CM_PER_L4LS_CLKSTCTRL */
107#define AM33XX_CLKACTIVITY_GPIO_5_GDBCLK_SHIFT 26 127#define AM33XX_CLKACTIVITY_GPIO_5_GDBCLK_SHIFT 26
128#define AM33XX_CLKACTIVITY_GPIO_5_GDBCLK_WIDTH 1
108#define AM33XX_CLKACTIVITY_GPIO_5_GDBCLK_MASK (1 << 26) 129#define AM33XX_CLKACTIVITY_GPIO_5_GDBCLK_MASK (1 << 26)
109 130
110/* Used by CM_PER_L4LS_CLKSTCTRL */ 131/* Used by CM_PER_L4LS_CLKSTCTRL */
111#define AM33XX_CLKACTIVITY_GPIO_6_GDBCLK_SHIFT 18 132#define AM33XX_CLKACTIVITY_GPIO_6_GDBCLK_SHIFT 18
133#define AM33XX_CLKACTIVITY_GPIO_6_GDBCLK_WIDTH 1
112#define AM33XX_CLKACTIVITY_GPIO_6_GDBCLK_MASK (1 << 18) 134#define AM33XX_CLKACTIVITY_GPIO_6_GDBCLK_MASK (1 << 18)
113 135
114/* Used by CM_WKUP_CLKSTCTRL */ 136/* Used by CM_WKUP_CLKSTCTRL */
115#define AM33XX_CLKACTIVITY_I2C0_GFCLK_SHIFT 11 137#define AM33XX_CLKACTIVITY_I2C0_GFCLK_SHIFT 11
138#define AM33XX_CLKACTIVITY_I2C0_GFCLK_WIDTH 1
116#define AM33XX_CLKACTIVITY_I2C0_GFCLK_MASK (1 << 11) 139#define AM33XX_CLKACTIVITY_I2C0_GFCLK_MASK (1 << 11)
117 140
118/* Used by CM_PER_L4LS_CLKSTCTRL */ 141/* Used by CM_PER_L4LS_CLKSTCTRL */
119#define AM33XX_CLKACTIVITY_I2C_FCLK_SHIFT 24 142#define AM33XX_CLKACTIVITY_I2C_FCLK_SHIFT 24
143#define AM33XX_CLKACTIVITY_I2C_FCLK_WIDTH 1
120#define AM33XX_CLKACTIVITY_I2C_FCLK_MASK (1 << 24) 144#define AM33XX_CLKACTIVITY_I2C_FCLK_MASK (1 << 24)
121 145
122/* Used by CM_PER_PRUSS_CLKSTCTRL */ 146/* Used by CM_PER_PRUSS_CLKSTCTRL */
123#define AM33XX_CLKACTIVITY_PRUSS_IEP_GCLK_SHIFT 5 147#define AM33XX_CLKACTIVITY_PRUSS_IEP_GCLK_SHIFT 5
148#define AM33XX_CLKACTIVITY_PRUSS_IEP_GCLK_WIDTH 1
124#define AM33XX_CLKACTIVITY_PRUSS_IEP_GCLK_MASK (1 << 5) 149#define AM33XX_CLKACTIVITY_PRUSS_IEP_GCLK_MASK (1 << 5)
125 150
126/* Used by CM_PER_PRUSS_CLKSTCTRL */ 151/* Used by CM_PER_PRUSS_CLKSTCTRL */
127#define AM33XX_CLKACTIVITY_PRUSS_OCP_GCLK_SHIFT 4 152#define AM33XX_CLKACTIVITY_PRUSS_OCP_GCLK_SHIFT 4
153#define AM33XX_CLKACTIVITY_PRUSS_OCP_GCLK_WIDTH 1
128#define AM33XX_CLKACTIVITY_PRUSS_OCP_GCLK_MASK (1 << 4) 154#define AM33XX_CLKACTIVITY_PRUSS_OCP_GCLK_MASK (1 << 4)
129 155
130/* Used by CM_PER_PRUSS_CLKSTCTRL */ 156/* Used by CM_PER_PRUSS_CLKSTCTRL */
131#define AM33XX_CLKACTIVITY_PRUSS_UART_GCLK_SHIFT 6 157#define AM33XX_CLKACTIVITY_PRUSS_UART_GCLK_SHIFT 6
158#define AM33XX_CLKACTIVITY_PRUSS_UART_GCLK_WIDTH 1
132#define AM33XX_CLKACTIVITY_PRUSS_UART_GCLK_MASK (1 << 6) 159#define AM33XX_CLKACTIVITY_PRUSS_UART_GCLK_MASK (1 << 6)
133 160
134/* Used by CM_PER_L3S_CLKSTCTRL */ 161/* Used by CM_PER_L3S_CLKSTCTRL */
135#define AM33XX_CLKACTIVITY_L3S_GCLK_SHIFT 3 162#define AM33XX_CLKACTIVITY_L3S_GCLK_SHIFT 3
163#define AM33XX_CLKACTIVITY_L3S_GCLK_WIDTH 1
136#define AM33XX_CLKACTIVITY_L3S_GCLK_MASK (1 << 3) 164#define AM33XX_CLKACTIVITY_L3S_GCLK_MASK (1 << 3)
137 165
138/* Used by CM_L3_AON_CLKSTCTRL */ 166/* Used by CM_L3_AON_CLKSTCTRL */
139#define AM33XX_CLKACTIVITY_L3_AON_GCLK_SHIFT 3 167#define AM33XX_CLKACTIVITY_L3_AON_GCLK_SHIFT 3
168#define AM33XX_CLKACTIVITY_L3_AON_GCLK_WIDTH 1
140#define AM33XX_CLKACTIVITY_L3_AON_GCLK_MASK (1 << 3) 169#define AM33XX_CLKACTIVITY_L3_AON_GCLK_MASK (1 << 3)
141 170
142/* Used by CM_PER_L3_CLKSTCTRL */ 171/* Used by CM_PER_L3_CLKSTCTRL */
143#define AM33XX_CLKACTIVITY_L3_GCLK_SHIFT 4 172#define AM33XX_CLKACTIVITY_L3_GCLK_SHIFT 4
173#define AM33XX_CLKACTIVITY_L3_GCLK_WIDTH 1
144#define AM33XX_CLKACTIVITY_L3_GCLK_MASK (1 << 4) 174#define AM33XX_CLKACTIVITY_L3_GCLK_MASK (1 << 4)
145 175
146/* Used by CM_PER_L4FW_CLKSTCTRL */ 176/* Used by CM_PER_L4FW_CLKSTCTRL */
147#define AM33XX_CLKACTIVITY_L4FW_GCLK_SHIFT 8 177#define AM33XX_CLKACTIVITY_L4FW_GCLK_SHIFT 8
178#define AM33XX_CLKACTIVITY_L4FW_GCLK_WIDTH 1
148#define AM33XX_CLKACTIVITY_L4FW_GCLK_MASK (1 << 8) 179#define AM33XX_CLKACTIVITY_L4FW_GCLK_MASK (1 << 8)
149 180
150/* Used by CM_PER_L4HS_CLKSTCTRL */ 181/* Used by CM_PER_L4HS_CLKSTCTRL */
151#define AM33XX_CLKACTIVITY_L4HS_GCLK_SHIFT 3 182#define AM33XX_CLKACTIVITY_L4HS_GCLK_SHIFT 3
183#define AM33XX_CLKACTIVITY_L4HS_GCLK_WIDTH 1
152#define AM33XX_CLKACTIVITY_L4HS_GCLK_MASK (1 << 3) 184#define AM33XX_CLKACTIVITY_L4HS_GCLK_MASK (1 << 3)
153 185
154/* Used by CM_PER_L4LS_CLKSTCTRL */ 186/* Used by CM_PER_L4LS_CLKSTCTRL */
155#define AM33XX_CLKACTIVITY_L4LS_GCLK_SHIFT 8 187#define AM33XX_CLKACTIVITY_L4LS_GCLK_SHIFT 8
188#define AM33XX_CLKACTIVITY_L4LS_GCLK_WIDTH 1
156#define AM33XX_CLKACTIVITY_L4LS_GCLK_MASK (1 << 8) 189#define AM33XX_CLKACTIVITY_L4LS_GCLK_MASK (1 << 8)
157 190
158/* Used by CM_GFX_L4LS_GFX_CLKSTCTRL__1 */ 191/* Used by CM_GFX_L4LS_GFX_CLKSTCTRL__1 */
159#define AM33XX_CLKACTIVITY_L4LS_GFX_GCLK_SHIFT 8 192#define AM33XX_CLKACTIVITY_L4LS_GFX_GCLK_SHIFT 8
193#define AM33XX_CLKACTIVITY_L4LS_GFX_GCLK_WIDTH 1
160#define AM33XX_CLKACTIVITY_L4LS_GFX_GCLK_MASK (1 << 8) 194#define AM33XX_CLKACTIVITY_L4LS_GFX_GCLK_MASK (1 << 8)
161 195
162/* Used by CM_CEFUSE_CLKSTCTRL */ 196/* Used by CM_CEFUSE_CLKSTCTRL */
163#define AM33XX_CLKACTIVITY_L4_CEFUSE_GICLK_SHIFT 8 197#define AM33XX_CLKACTIVITY_L4_CEFUSE_GICLK_SHIFT 8
198#define AM33XX_CLKACTIVITY_L4_CEFUSE_GICLK_WIDTH 1
164#define AM33XX_CLKACTIVITY_L4_CEFUSE_GICLK_MASK (1 << 8) 199#define AM33XX_CLKACTIVITY_L4_CEFUSE_GICLK_MASK (1 << 8)
165 200
166/* Used by CM_RTC_CLKSTCTRL */ 201/* Used by CM_RTC_CLKSTCTRL */
167#define AM33XX_CLKACTIVITY_L4_RTC_GCLK_SHIFT 8 202#define AM33XX_CLKACTIVITY_L4_RTC_GCLK_SHIFT 8
203#define AM33XX_CLKACTIVITY_L4_RTC_GCLK_WIDTH 1
168#define AM33XX_CLKACTIVITY_L4_RTC_GCLK_MASK (1 << 8) 204#define AM33XX_CLKACTIVITY_L4_RTC_GCLK_MASK (1 << 8)
169 205
170/* Used by CM_L4_WKUP_AON_CLKSTCTRL */ 206/* Used by CM_L4_WKUP_AON_CLKSTCTRL */
171#define AM33XX_CLKACTIVITY_L4_WKUP_AON_GCLK_SHIFT 2 207#define AM33XX_CLKACTIVITY_L4_WKUP_AON_GCLK_SHIFT 2
208#define AM33XX_CLKACTIVITY_L4_WKUP_AON_GCLK_WIDTH 1
172#define AM33XX_CLKACTIVITY_L4_WKUP_AON_GCLK_MASK (1 << 2) 209#define AM33XX_CLKACTIVITY_L4_WKUP_AON_GCLK_MASK (1 << 2)
173 210
174/* Used by CM_WKUP_CLKSTCTRL */ 211/* Used by CM_WKUP_CLKSTCTRL */
175#define AM33XX_CLKACTIVITY_L4_WKUP_GCLK_SHIFT 2 212#define AM33XX_CLKACTIVITY_L4_WKUP_GCLK_SHIFT 2
213#define AM33XX_CLKACTIVITY_L4_WKUP_GCLK_WIDTH 1
176#define AM33XX_CLKACTIVITY_L4_WKUP_GCLK_MASK (1 << 2) 214#define AM33XX_CLKACTIVITY_L4_WKUP_GCLK_MASK (1 << 2)
177 215
178/* Used by CM_PER_L4LS_CLKSTCTRL */ 216/* Used by CM_PER_L4LS_CLKSTCTRL */
179#define AM33XX_CLKACTIVITY_LCDC_GCLK_SHIFT 17 217#define AM33XX_CLKACTIVITY_LCDC_GCLK_SHIFT 17
218#define AM33XX_CLKACTIVITY_LCDC_GCLK_WIDTH 1
180#define AM33XX_CLKACTIVITY_LCDC_GCLK_MASK (1 << 17) 219#define AM33XX_CLKACTIVITY_LCDC_GCLK_MASK (1 << 17)
181 220
182/* Used by CM_PER_LCDC_CLKSTCTRL */ 221/* Used by CM_PER_LCDC_CLKSTCTRL */
183#define AM33XX_CLKACTIVITY_LCDC_L3_OCP_GCLK_SHIFT 4 222#define AM33XX_CLKACTIVITY_LCDC_L3_OCP_GCLK_SHIFT 4
223#define AM33XX_CLKACTIVITY_LCDC_L3_OCP_GCLK_WIDTH 1
184#define AM33XX_CLKACTIVITY_LCDC_L3_OCP_GCLK_MASK (1 << 4) 224#define AM33XX_CLKACTIVITY_LCDC_L3_OCP_GCLK_MASK (1 << 4)
185 225
186/* Used by CM_PER_LCDC_CLKSTCTRL */ 226/* Used by CM_PER_LCDC_CLKSTCTRL */
187#define AM33XX_CLKACTIVITY_LCDC_L4_OCP_GCLK_SHIFT 5 227#define AM33XX_CLKACTIVITY_LCDC_L4_OCP_GCLK_SHIFT 5
228#define AM33XX_CLKACTIVITY_LCDC_L4_OCP_GCLK_WIDTH 1
188#define AM33XX_CLKACTIVITY_LCDC_L4_OCP_GCLK_MASK (1 << 5) 229#define AM33XX_CLKACTIVITY_LCDC_L4_OCP_GCLK_MASK (1 << 5)
189 230
190/* Used by CM_PER_L3_CLKSTCTRL */ 231/* Used by CM_PER_L3_CLKSTCTRL */
191#define AM33XX_CLKACTIVITY_MCASP_GCLK_SHIFT 7 232#define AM33XX_CLKACTIVITY_MCASP_GCLK_SHIFT 7
233#define AM33XX_CLKACTIVITY_MCASP_GCLK_WIDTH 1
192#define AM33XX_CLKACTIVITY_MCASP_GCLK_MASK (1 << 7) 234#define AM33XX_CLKACTIVITY_MCASP_GCLK_MASK (1 << 7)
193 235
194/* Used by CM_PER_L3_CLKSTCTRL */ 236/* Used by CM_PER_L3_CLKSTCTRL */
195#define AM33XX_CLKACTIVITY_MMC_FCLK_SHIFT 3 237#define AM33XX_CLKACTIVITY_MMC_FCLK_SHIFT 3
238#define AM33XX_CLKACTIVITY_MMC_FCLK_WIDTH 1
196#define AM33XX_CLKACTIVITY_MMC_FCLK_MASK (1 << 3) 239#define AM33XX_CLKACTIVITY_MMC_FCLK_MASK (1 << 3)
197 240
198/* Used by CM_MPU_CLKSTCTRL */ 241/* Used by CM_MPU_CLKSTCTRL */
199#define AM33XX_CLKACTIVITY_MPU_CLK_SHIFT 2 242#define AM33XX_CLKACTIVITY_MPU_CLK_SHIFT 2
243#define AM33XX_CLKACTIVITY_MPU_CLK_WIDTH 1
200#define AM33XX_CLKACTIVITY_MPU_CLK_MASK (1 << 2) 244#define AM33XX_CLKACTIVITY_MPU_CLK_MASK (1 << 2)
201 245
202/* Used by CM_PER_OCPWP_L3_CLKSTCTRL */ 246/* Used by CM_PER_OCPWP_L3_CLKSTCTRL */
203#define AM33XX_CLKACTIVITY_OCPWP_L3_GCLK_SHIFT 4 247#define AM33XX_CLKACTIVITY_OCPWP_L3_GCLK_SHIFT 4
248#define AM33XX_CLKACTIVITY_OCPWP_L3_GCLK_WIDTH 1
204#define AM33XX_CLKACTIVITY_OCPWP_L3_GCLK_MASK (1 << 4) 249#define AM33XX_CLKACTIVITY_OCPWP_L3_GCLK_MASK (1 << 4)
205 250
206/* Used by CM_PER_OCPWP_L3_CLKSTCTRL */ 251/* Used by CM_PER_OCPWP_L3_CLKSTCTRL */
207#define AM33XX_CLKACTIVITY_OCPWP_L4_GCLK_SHIFT 5 252#define AM33XX_CLKACTIVITY_OCPWP_L4_GCLK_SHIFT 5
253#define AM33XX_CLKACTIVITY_OCPWP_L4_GCLK_WIDTH 1
208#define AM33XX_CLKACTIVITY_OCPWP_L4_GCLK_MASK (1 << 5) 254#define AM33XX_CLKACTIVITY_OCPWP_L4_GCLK_MASK (1 << 5)
209 255
210/* Used by CM_RTC_CLKSTCTRL */ 256/* Used by CM_RTC_CLKSTCTRL */
211#define AM33XX_CLKACTIVITY_RTC_32KCLK_SHIFT 9 257#define AM33XX_CLKACTIVITY_RTC_32KCLK_SHIFT 9
258#define AM33XX_CLKACTIVITY_RTC_32KCLK_WIDTH 1
212#define AM33XX_CLKACTIVITY_RTC_32KCLK_MASK (1 << 9) 259#define AM33XX_CLKACTIVITY_RTC_32KCLK_MASK (1 << 9)
213 260
214/* Used by CM_PER_L4LS_CLKSTCTRL */ 261/* Used by CM_PER_L4LS_CLKSTCTRL */
215#define AM33XX_CLKACTIVITY_SPI_GCLK_SHIFT 25 262#define AM33XX_CLKACTIVITY_SPI_GCLK_SHIFT 25
263#define AM33XX_CLKACTIVITY_SPI_GCLK_WIDTH 1
216#define AM33XX_CLKACTIVITY_SPI_GCLK_MASK (1 << 25) 264#define AM33XX_CLKACTIVITY_SPI_GCLK_MASK (1 << 25)
217 265
218/* Used by CM_WKUP_CLKSTCTRL */ 266/* Used by CM_WKUP_CLKSTCTRL */
219#define AM33XX_CLKACTIVITY_SR_SYSCLK_SHIFT 3 267#define AM33XX_CLKACTIVITY_SR_SYSCLK_SHIFT 3
268#define AM33XX_CLKACTIVITY_SR_SYSCLK_WIDTH 1
220#define AM33XX_CLKACTIVITY_SR_SYSCLK_MASK (1 << 3) 269#define AM33XX_CLKACTIVITY_SR_SYSCLK_MASK (1 << 3)
221 270
222/* Used by CM_WKUP_CLKSTCTRL */ 271/* Used by CM_WKUP_CLKSTCTRL */
223#define AM33XX_CLKACTIVITY_TIMER0_GCLK_SHIFT 10 272#define AM33XX_CLKACTIVITY_TIMER0_GCLK_SHIFT 10
273#define AM33XX_CLKACTIVITY_TIMER0_GCLK_WIDTH 1
224#define AM33XX_CLKACTIVITY_TIMER0_GCLK_MASK (1 << 10) 274#define AM33XX_CLKACTIVITY_TIMER0_GCLK_MASK (1 << 10)
225 275
226/* Used by CM_WKUP_CLKSTCTRL */ 276/* Used by CM_WKUP_CLKSTCTRL */
227#define AM33XX_CLKACTIVITY_TIMER1_GCLK_SHIFT 13 277#define AM33XX_CLKACTIVITY_TIMER1_GCLK_SHIFT 13
278#define AM33XX_CLKACTIVITY_TIMER1_GCLK_WIDTH 1
228#define AM33XX_CLKACTIVITY_TIMER1_GCLK_MASK (1 << 13) 279#define AM33XX_CLKACTIVITY_TIMER1_GCLK_MASK (1 << 13)
229 280
230/* Used by CM_PER_L4LS_CLKSTCTRL */ 281/* Used by CM_PER_L4LS_CLKSTCTRL */
231#define AM33XX_CLKACTIVITY_TIMER2_GCLK_SHIFT 14 282#define AM33XX_CLKACTIVITY_TIMER2_GCLK_SHIFT 14
283#define AM33XX_CLKACTIVITY_TIMER2_GCLK_WIDTH 1
232#define AM33XX_CLKACTIVITY_TIMER2_GCLK_MASK (1 << 14) 284#define AM33XX_CLKACTIVITY_TIMER2_GCLK_MASK (1 << 14)
233 285
234/* Used by CM_PER_L4LS_CLKSTCTRL */ 286/* Used by CM_PER_L4LS_CLKSTCTRL */
235#define AM33XX_CLKACTIVITY_TIMER3_GCLK_SHIFT 15 287#define AM33XX_CLKACTIVITY_TIMER3_GCLK_SHIFT 15
288#define AM33XX_CLKACTIVITY_TIMER3_GCLK_WIDTH 1
236#define AM33XX_CLKACTIVITY_TIMER3_GCLK_MASK (1 << 15) 289#define AM33XX_CLKACTIVITY_TIMER3_GCLK_MASK (1 << 15)
237 290
238/* Used by CM_PER_L4LS_CLKSTCTRL */ 291/* Used by CM_PER_L4LS_CLKSTCTRL */
239#define AM33XX_CLKACTIVITY_TIMER4_GCLK_SHIFT 16 292#define AM33XX_CLKACTIVITY_TIMER4_GCLK_SHIFT 16
293#define AM33XX_CLKACTIVITY_TIMER4_GCLK_WIDTH 1
240#define AM33XX_CLKACTIVITY_TIMER4_GCLK_MASK (1 << 16) 294#define AM33XX_CLKACTIVITY_TIMER4_GCLK_MASK (1 << 16)
241 295
242/* Used by CM_PER_L4LS_CLKSTCTRL */ 296/* Used by CM_PER_L4LS_CLKSTCTRL */
243#define AM33XX_CLKACTIVITY_TIMER5_GCLK_SHIFT 27 297#define AM33XX_CLKACTIVITY_TIMER5_GCLK_SHIFT 27
298#define AM33XX_CLKACTIVITY_TIMER5_GCLK_WIDTH 1
244#define AM33XX_CLKACTIVITY_TIMER5_GCLK_MASK (1 << 27) 299#define AM33XX_CLKACTIVITY_TIMER5_GCLK_MASK (1 << 27)
245 300
246/* Used by CM_PER_L4LS_CLKSTCTRL */ 301/* Used by CM_PER_L4LS_CLKSTCTRL */
247#define AM33XX_CLKACTIVITY_TIMER6_GCLK_SHIFT 28 302#define AM33XX_CLKACTIVITY_TIMER6_GCLK_SHIFT 28
303#define AM33XX_CLKACTIVITY_TIMER6_GCLK_WIDTH 1
248#define AM33XX_CLKACTIVITY_TIMER6_GCLK_MASK (1 << 28) 304#define AM33XX_CLKACTIVITY_TIMER6_GCLK_MASK (1 << 28)
249 305
250/* Used by CM_PER_L4LS_CLKSTCTRL */ 306/* Used by CM_PER_L4LS_CLKSTCTRL */
251#define AM33XX_CLKACTIVITY_TIMER7_GCLK_SHIFT 13 307#define AM33XX_CLKACTIVITY_TIMER7_GCLK_SHIFT 13
308#define AM33XX_CLKACTIVITY_TIMER7_GCLK_WIDTH 1
252#define AM33XX_CLKACTIVITY_TIMER7_GCLK_MASK (1 << 13) 309#define AM33XX_CLKACTIVITY_TIMER7_GCLK_MASK (1 << 13)
253 310
254/* Used by CM_WKUP_CLKSTCTRL */ 311/* Used by CM_WKUP_CLKSTCTRL */
255#define AM33XX_CLKACTIVITY_UART0_GFCLK_SHIFT 12 312#define AM33XX_CLKACTIVITY_UART0_GFCLK_SHIFT 12
313#define AM33XX_CLKACTIVITY_UART0_GFCLK_WIDTH 1
256#define AM33XX_CLKACTIVITY_UART0_GFCLK_MASK (1 << 12) 314#define AM33XX_CLKACTIVITY_UART0_GFCLK_MASK (1 << 12)
257 315
258/* Used by CM_PER_L4LS_CLKSTCTRL */ 316/* Used by CM_PER_L4LS_CLKSTCTRL */
259#define AM33XX_CLKACTIVITY_UART_GFCLK_SHIFT 10 317#define AM33XX_CLKACTIVITY_UART_GFCLK_SHIFT 10
318#define AM33XX_CLKACTIVITY_UART_GFCLK_WIDTH 1
260#define AM33XX_CLKACTIVITY_UART_GFCLK_MASK (1 << 10) 319#define AM33XX_CLKACTIVITY_UART_GFCLK_MASK (1 << 10)
261 320
262/* Used by CM_WKUP_CLKSTCTRL */ 321/* Used by CM_WKUP_CLKSTCTRL */
263#define AM33XX_CLKACTIVITY_WDT0_GCLK_SHIFT 9 322#define AM33XX_CLKACTIVITY_WDT0_GCLK_SHIFT 9
323#define AM33XX_CLKACTIVITY_WDT0_GCLK_WIDTH 1
264#define AM33XX_CLKACTIVITY_WDT0_GCLK_MASK (1 << 9) 324#define AM33XX_CLKACTIVITY_WDT0_GCLK_MASK (1 << 9)
265 325
266/* Used by CM_WKUP_CLKSTCTRL */ 326/* Used by CM_WKUP_CLKSTCTRL */
267#define AM33XX_CLKACTIVITY_WDT1_GCLK_SHIFT 4 327#define AM33XX_CLKACTIVITY_WDT1_GCLK_SHIFT 4
328#define AM33XX_CLKACTIVITY_WDT1_GCLK_WIDTH 1
268#define AM33XX_CLKACTIVITY_WDT1_GCLK_MASK (1 << 4) 329#define AM33XX_CLKACTIVITY_WDT1_GCLK_MASK (1 << 4)
269 330
270/* Used by CLKSEL_GFX_FCLK */ 331/* Used by CLKSEL_GFX_FCLK */
271#define AM33XX_CLKDIV_SEL_GFX_FCLK_SHIFT 0 332#define AM33XX_CLKDIV_SEL_GFX_FCLK_SHIFT 0
333#define AM33XX_CLKDIV_SEL_GFX_FCLK_WIDTH 1
272#define AM33XX_CLKDIV_SEL_GFX_FCLK_MASK (1 << 0) 334#define AM33XX_CLKDIV_SEL_GFX_FCLK_MASK (1 << 0)
273 335
274/* Used by CM_CLKOUT_CTRL */ 336/* Used by CM_CLKOUT_CTRL */
275#define AM33XX_CLKOUT2DIV_SHIFT 3 337#define AM33XX_CLKOUT2DIV_SHIFT 3
276#define AM33XX_CLKOUT2DIV_MASK (0x05 << 3) 338#define AM33XX_CLKOUT2DIV_WIDTH 3
339#define AM33XX_CLKOUT2DIV_MASK (0x7 << 3)
277 340
278/* Used by CM_CLKOUT_CTRL */ 341/* Used by CM_CLKOUT_CTRL */
279#define AM33XX_CLKOUT2EN_SHIFT 7 342#define AM33XX_CLKOUT2EN_SHIFT 7
343#define AM33XX_CLKOUT2EN_WIDTH 1
280#define AM33XX_CLKOUT2EN_MASK (1 << 7) 344#define AM33XX_CLKOUT2EN_MASK (1 << 7)
281 345
282/* Used by CM_CLKOUT_CTRL */ 346/* Used by CM_CLKOUT_CTRL */
283#define AM33XX_CLKOUT2SOURCE_SHIFT 0 347#define AM33XX_CLKOUT2SOURCE_SHIFT 0
284#define AM33XX_CLKOUT2SOURCE_MASK (0x02 << 0) 348#define AM33XX_CLKOUT2SOURCE_WIDTH 3
349#define AM33XX_CLKOUT2SOURCE_MASK (0x7 << 0)
285 350
286/* 351/*
287 * Used by CLKSEL_GPIO0_DBCLK, CLKSEL_LCDC_PIXEL_CLK, CLKSEL_TIMER2_CLK, 352 * Used by CLKSEL_GPIO0_DBCLK, CLKSEL_LCDC_PIXEL_CLK, CLKSEL_TIMER2_CLK,
@@ -289,6 +354,7 @@
289 * CLKSEL_TIMER7_CLK 354 * CLKSEL_TIMER7_CLK
290 */ 355 */
291#define AM33XX_CLKSEL_SHIFT 0 356#define AM33XX_CLKSEL_SHIFT 0
357#define AM33XX_CLKSEL_WIDTH 1
292#define AM33XX_CLKSEL_MASK (0x01 << 0) 358#define AM33XX_CLKSEL_MASK (0x01 << 0)
293 359
294/* 360/*
@@ -296,17 +362,21 @@
296 * CM_CPTS_RFT_CLKSEL 362 * CM_CPTS_RFT_CLKSEL
297 */ 363 */
298#define AM33XX_CLKSEL_0_0_SHIFT 0 364#define AM33XX_CLKSEL_0_0_SHIFT 0
365#define AM33XX_CLKSEL_0_0_WIDTH 1
299#define AM33XX_CLKSEL_0_0_MASK (1 << 0) 366#define AM33XX_CLKSEL_0_0_MASK (1 << 0)
300 367
301#define AM33XX_CLKSEL_0_1_SHIFT 0 368#define AM33XX_CLKSEL_0_1_SHIFT 0
369#define AM33XX_CLKSEL_0_1_WIDTH 2
302#define AM33XX_CLKSEL_0_1_MASK (3 << 0) 370#define AM33XX_CLKSEL_0_1_MASK (3 << 0)
303 371
304/* Renamed from CLKSEL Used by CLKSEL_TIMER1MS_CLK */ 372/* Renamed from CLKSEL Used by CLKSEL_TIMER1MS_CLK */
305#define AM33XX_CLKSEL_0_2_SHIFT 0 373#define AM33XX_CLKSEL_0_2_SHIFT 0
374#define AM33XX_CLKSEL_0_2_WIDTH 3
306#define AM33XX_CLKSEL_0_2_MASK (7 << 0) 375#define AM33XX_CLKSEL_0_2_MASK (7 << 0)
307 376
308/* Used by CLKSEL_GFX_FCLK */ 377/* Used by CLKSEL_GFX_FCLK */
309#define AM33XX_CLKSEL_GFX_FCLK_SHIFT 1 378#define AM33XX_CLKSEL_GFX_FCLK_SHIFT 1
379#define AM33XX_CLKSEL_GFX_FCLK_WIDTH 1
310#define AM33XX_CLKSEL_GFX_FCLK_MASK (1 << 1) 380#define AM33XX_CLKSEL_GFX_FCLK_MASK (1 << 1)
311 381
312/* 382/*
@@ -318,6 +388,7 @@
318 * CM_GFX_L3_CLKSTCTRL, CM_GFX_L4LS_GFX_CLKSTCTRL__1, CM_CEFUSE_CLKSTCTRL 388 * CM_GFX_L3_CLKSTCTRL, CM_GFX_L4LS_GFX_CLKSTCTRL__1, CM_CEFUSE_CLKSTCTRL
319 */ 389 */
320#define AM33XX_CLKTRCTRL_SHIFT 0 390#define AM33XX_CLKTRCTRL_SHIFT 0
391#define AM33XX_CLKTRCTRL_WIDTH 2
321#define AM33XX_CLKTRCTRL_MASK (0x3 << 0) 392#define AM33XX_CLKTRCTRL_MASK (0x3 << 0)
322 393
323/* 394/*
@@ -326,34 +397,42 @@
326 * CM_SSC_DELTAMSTEP_DPLL_PER 397 * CM_SSC_DELTAMSTEP_DPLL_PER
327 */ 398 */
328#define AM33XX_DELTAMSTEP_SHIFT 0 399#define AM33XX_DELTAMSTEP_SHIFT 0
329#define AM33XX_DELTAMSTEP_MASK (0x19 << 0) 400#define AM33XX_DELTAMSTEP_WIDTH 20
401#define AM33XX_DELTAMSTEP_MASK (0xfffff << 0)
330 402
331/* Used by CM_CLKSEL_DPLL_DDR, CM_CLKSEL_DPLL_DISP, CM_CLKSEL_DPLL_MPU */ 403/* Used by CM_CLKSEL_DPLL_DDR, CM_CLKSEL_DPLL_DISP, CM_CLKSEL_DPLL_MPU */
332#define AM33XX_DPLL_BYP_CLKSEL_SHIFT 23 404#define AM33XX_DPLL_BYP_CLKSEL_SHIFT 23
405#define AM33XX_DPLL_BYP_CLKSEL_WIDTH 1
333#define AM33XX_DPLL_BYP_CLKSEL_MASK (1 << 23) 406#define AM33XX_DPLL_BYP_CLKSEL_MASK (1 << 23)
334 407
335/* Used by CM_CLKDCOLDO_DPLL_PER */ 408/* Used by CM_CLKDCOLDO_DPLL_PER */
336#define AM33XX_DPLL_CLKDCOLDO_GATE_CTRL_SHIFT 8 409#define AM33XX_DPLL_CLKDCOLDO_GATE_CTRL_SHIFT 8
410#define AM33XX_DPLL_CLKDCOLDO_GATE_CTRL_WIDTH 1
337#define AM33XX_DPLL_CLKDCOLDO_GATE_CTRL_MASK (1 << 8) 411#define AM33XX_DPLL_CLKDCOLDO_GATE_CTRL_MASK (1 << 8)
338 412
339/* Used by CM_CLKDCOLDO_DPLL_PER */ 413/* Used by CM_CLKDCOLDO_DPLL_PER */
340#define AM33XX_DPLL_CLKDCOLDO_PWDN_SHIFT 12 414#define AM33XX_DPLL_CLKDCOLDO_PWDN_SHIFT 12
415#define AM33XX_DPLL_CLKDCOLDO_PWDN_WIDTH 1
341#define AM33XX_DPLL_CLKDCOLDO_PWDN_MASK (1 << 12) 416#define AM33XX_DPLL_CLKDCOLDO_PWDN_MASK (1 << 12)
342 417
343/* Used by CM_DIV_M2_DPLL_DDR, CM_DIV_M2_DPLL_DISP, CM_DIV_M2_DPLL_MPU */ 418/* Used by CM_DIV_M2_DPLL_DDR, CM_DIV_M2_DPLL_DISP, CM_DIV_M2_DPLL_MPU */
344#define AM33XX_DPLL_CLKOUT_DIV_SHIFT 0 419#define AM33XX_DPLL_CLKOUT_DIV_SHIFT 0
420#define AM33XX_DPLL_CLKOUT_DIV_WIDTH 5
345#define AM33XX_DPLL_CLKOUT_DIV_MASK (0x1f << 0) 421#define AM33XX_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
346 422
347/* Renamed from DPLL_CLKOUT_DIV Used by CM_DIV_M2_DPLL_PER */ 423/* Renamed from DPLL_CLKOUT_DIV Used by CM_DIV_M2_DPLL_PER */
348#define AM33XX_DPLL_CLKOUT_DIV_0_6_SHIFT 0 424#define AM33XX_DPLL_CLKOUT_DIV_0_6_SHIFT 0
349#define AM33XX_DPLL_CLKOUT_DIV_0_6_MASK (0x06 << 0) 425#define AM33XX_DPLL_CLKOUT_DIV_0_6_WIDTH 7
426#define AM33XX_DPLL_CLKOUT_DIV_0_6_MASK (0x7f << 0)
350 427
351/* Used by CM_DIV_M2_DPLL_DDR, CM_DIV_M2_DPLL_DISP, CM_DIV_M2_DPLL_MPU */ 428/* Used by CM_DIV_M2_DPLL_DDR, CM_DIV_M2_DPLL_DISP, CM_DIV_M2_DPLL_MPU */
352#define AM33XX_DPLL_CLKOUT_DIVCHACK_SHIFT 5 429#define AM33XX_DPLL_CLKOUT_DIVCHACK_SHIFT 5
430#define AM33XX_DPLL_CLKOUT_DIVCHACK_WIDTH 1
353#define AM33XX_DPLL_CLKOUT_DIVCHACK_MASK (1 << 5) 431#define AM33XX_DPLL_CLKOUT_DIVCHACK_MASK (1 << 5)
354 432
355/* Renamed from DPLL_CLKOUT_DIVCHACK Used by CM_DIV_M2_DPLL_PER */ 433/* Renamed from DPLL_CLKOUT_DIVCHACK Used by CM_DIV_M2_DPLL_PER */
356#define AM33XX_DPLL_CLKOUT_DIVCHACK_M2_PER_SHIFT 7 434#define AM33XX_DPLL_CLKOUT_DIVCHACK_M2_PER_SHIFT 7
435#define AM33XX_DPLL_CLKOUT_DIVCHACK_M2_PER_WIDTH 1
357#define AM33XX_DPLL_CLKOUT_DIVCHACK_M2_PER_MASK (1 << 7) 436#define AM33XX_DPLL_CLKOUT_DIVCHACK_M2_PER_MASK (1 << 7)
358 437
359/* 438/*
@@ -361,6 +440,7 @@
361 * CM_DIV_M2_DPLL_PER 440 * CM_DIV_M2_DPLL_PER
362 */ 441 */
363#define AM33XX_DPLL_CLKOUT_GATE_CTRL_SHIFT 8 442#define AM33XX_DPLL_CLKOUT_GATE_CTRL_SHIFT 8
443#define AM33XX_DPLL_CLKOUT_GATE_CTRL_WIDTH 1
364#define AM33XX_DPLL_CLKOUT_GATE_CTRL_MASK (1 << 8) 444#define AM33XX_DPLL_CLKOUT_GATE_CTRL_MASK (1 << 8)
365 445
366/* 446/*
@@ -368,19 +448,22 @@
368 * CM_CLKSEL_DPLL_MPU 448 * CM_CLKSEL_DPLL_MPU
369 */ 449 */
370#define AM33XX_DPLL_DIV_SHIFT 0 450#define AM33XX_DPLL_DIV_SHIFT 0
451#define AM33XX_DPLL_DIV_WIDTH 7
371#define AM33XX_DPLL_DIV_MASK (0x7f << 0) 452#define AM33XX_DPLL_DIV_MASK (0x7f << 0)
372 453
373#define AM33XX_DPLL_PER_DIV_MASK (0xff << 0) 454#define AM33XX_DPLL_PER_DIV_MASK (0xff << 0)
374 455
375/* Renamed from DPLL_DIV Used by CM_CLKSEL_DPLL_PERIPH */ 456/* Renamed from DPLL_DIV Used by CM_CLKSEL_DPLL_PERIPH */
376#define AM33XX_DPLL_DIV_0_7_SHIFT 0 457#define AM33XX_DPLL_DIV_0_7_SHIFT 0
377#define AM33XX_DPLL_DIV_0_7_MASK (0x07 << 0) 458#define AM33XX_DPLL_DIV_0_7_WIDTH 8
459#define AM33XX_DPLL_DIV_0_7_MASK (0xff << 0)
378 460
379/* 461/*
380 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP, 462 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP,
381 * CM_CLKMODE_DPLL_MPU 463 * CM_CLKMODE_DPLL_MPU
382 */ 464 */
383#define AM33XX_DPLL_DRIFTGUARD_EN_SHIFT 8 465#define AM33XX_DPLL_DRIFTGUARD_EN_SHIFT 8
466#define AM33XX_DPLL_DRIFTGUARD_EN_WIDTH 1
384#define AM33XX_DPLL_DRIFTGUARD_EN_MASK (1 << 8) 467#define AM33XX_DPLL_DRIFTGUARD_EN_MASK (1 << 8)
385 468
386/* 469/*
@@ -388,6 +471,7 @@
388 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER 471 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
389 */ 472 */
390#define AM33XX_DPLL_EN_SHIFT 0 473#define AM33XX_DPLL_EN_SHIFT 0
474#define AM33XX_DPLL_EN_WIDTH 3
391#define AM33XX_DPLL_EN_MASK (0x7 << 0) 475#define AM33XX_DPLL_EN_MASK (0x7 << 0)
392 476
393/* 477/*
@@ -395,6 +479,7 @@
395 * CM_CLKMODE_DPLL_MPU 479 * CM_CLKMODE_DPLL_MPU
396 */ 480 */
397#define AM33XX_DPLL_LPMODE_EN_SHIFT 10 481#define AM33XX_DPLL_LPMODE_EN_SHIFT 10
482#define AM33XX_DPLL_LPMODE_EN_WIDTH 1
398#define AM33XX_DPLL_LPMODE_EN_MASK (1 << 10) 483#define AM33XX_DPLL_LPMODE_EN_MASK (1 << 10)
399 484
400/* 485/*
@@ -402,10 +487,12 @@
402 * CM_CLKSEL_DPLL_MPU 487 * CM_CLKSEL_DPLL_MPU
403 */ 488 */
404#define AM33XX_DPLL_MULT_SHIFT 8 489#define AM33XX_DPLL_MULT_SHIFT 8
490#define AM33XX_DPLL_MULT_WIDTH 11
405#define AM33XX_DPLL_MULT_MASK (0x7ff << 8) 491#define AM33XX_DPLL_MULT_MASK (0x7ff << 8)
406 492
407/* Renamed from DPLL_MULT Used by CM_CLKSEL_DPLL_PERIPH */ 493/* Renamed from DPLL_MULT Used by CM_CLKSEL_DPLL_PERIPH */
408#define AM33XX_DPLL_MULT_PERIPH_SHIFT 8 494#define AM33XX_DPLL_MULT_PERIPH_SHIFT 8
495#define AM33XX_DPLL_MULT_PERIPH_WIDTH 12
409#define AM33XX_DPLL_MULT_PERIPH_MASK (0xfff << 8) 496#define AM33XX_DPLL_MULT_PERIPH_MASK (0xfff << 8)
410 497
411/* 498/*
@@ -413,17 +500,20 @@
413 * CM_CLKMODE_DPLL_MPU 500 * CM_CLKMODE_DPLL_MPU
414 */ 501 */
415#define AM33XX_DPLL_REGM4XEN_SHIFT 11 502#define AM33XX_DPLL_REGM4XEN_SHIFT 11
503#define AM33XX_DPLL_REGM4XEN_WIDTH 1
416#define AM33XX_DPLL_REGM4XEN_MASK (1 << 11) 504#define AM33XX_DPLL_REGM4XEN_MASK (1 << 11)
417 505
418/* Used by CM_CLKSEL_DPLL_PERIPH */ 506/* Used by CM_CLKSEL_DPLL_PERIPH */
419#define AM33XX_DPLL_SD_DIV_SHIFT 24 507#define AM33XX_DPLL_SD_DIV_SHIFT 24
420#define AM33XX_DPLL_SD_DIV_MASK (24, 31) 508#define AM33XX_DPLL_SD_DIV_WIDTH 8
509#define AM33XX_DPLL_SD_DIV_MASK (0xff << 24)
421 510
422/* 511/*
423 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP, 512 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP,
424 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER 513 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
425 */ 514 */
426#define AM33XX_DPLL_SSC_ACK_SHIFT 13 515#define AM33XX_DPLL_SSC_ACK_SHIFT 13
516#define AM33XX_DPLL_SSC_ACK_WIDTH 1
427#define AM33XX_DPLL_SSC_ACK_MASK (1 << 13) 517#define AM33XX_DPLL_SSC_ACK_MASK (1 << 13)
428 518
429/* 519/*
@@ -431,6 +521,7 @@
431 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER 521 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
432 */ 522 */
433#define AM33XX_DPLL_SSC_DOWNSPREAD_SHIFT 14 523#define AM33XX_DPLL_SSC_DOWNSPREAD_SHIFT 14
524#define AM33XX_DPLL_SSC_DOWNSPREAD_WIDTH 1
434#define AM33XX_DPLL_SSC_DOWNSPREAD_MASK (1 << 14) 525#define AM33XX_DPLL_SSC_DOWNSPREAD_MASK (1 << 14)
435 526
436/* 527/*
@@ -438,54 +529,67 @@
438 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER 529 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
439 */ 530 */
440#define AM33XX_DPLL_SSC_EN_SHIFT 12 531#define AM33XX_DPLL_SSC_EN_SHIFT 12
532#define AM33XX_DPLL_SSC_EN_WIDTH 1
441#define AM33XX_DPLL_SSC_EN_MASK (1 << 12) 533#define AM33XX_DPLL_SSC_EN_MASK (1 << 12)
442 534
443/* Used by CM_DIV_M4_DPLL_CORE */ 535/* Used by CM_DIV_M4_DPLL_CORE */
444#define AM33XX_HSDIVIDER_CLKOUT1_DIV_SHIFT 0 536#define AM33XX_HSDIVIDER_CLKOUT1_DIV_SHIFT 0
537#define AM33XX_HSDIVIDER_CLKOUT1_DIV_WIDTH 5
445#define AM33XX_HSDIVIDER_CLKOUT1_DIV_MASK (0x1f << 0) 538#define AM33XX_HSDIVIDER_CLKOUT1_DIV_MASK (0x1f << 0)
446 539
447/* Used by CM_DIV_M4_DPLL_CORE */ 540/* Used by CM_DIV_M4_DPLL_CORE */
448#define AM33XX_HSDIVIDER_CLKOUT1_DIVCHACK_SHIFT 5 541#define AM33XX_HSDIVIDER_CLKOUT1_DIVCHACK_SHIFT 5
542#define AM33XX_HSDIVIDER_CLKOUT1_DIVCHACK_WIDTH 1
449#define AM33XX_HSDIVIDER_CLKOUT1_DIVCHACK_MASK (1 << 5) 543#define AM33XX_HSDIVIDER_CLKOUT1_DIVCHACK_MASK (1 << 5)
450 544
451/* Used by CM_DIV_M4_DPLL_CORE */ 545/* Used by CM_DIV_M4_DPLL_CORE */
452#define AM33XX_HSDIVIDER_CLKOUT1_GATE_CTRL_SHIFT 8 546#define AM33XX_HSDIVIDER_CLKOUT1_GATE_CTRL_SHIFT 8
547#define AM33XX_HSDIVIDER_CLKOUT1_GATE_CTRL_WIDTH 1
453#define AM33XX_HSDIVIDER_CLKOUT1_GATE_CTRL_MASK (1 << 8) 548#define AM33XX_HSDIVIDER_CLKOUT1_GATE_CTRL_MASK (1 << 8)
454 549
455/* Used by CM_DIV_M4_DPLL_CORE */ 550/* Used by CM_DIV_M4_DPLL_CORE */
456#define AM33XX_HSDIVIDER_CLKOUT1_PWDN_SHIFT 12 551#define AM33XX_HSDIVIDER_CLKOUT1_PWDN_SHIFT 12
552#define AM33XX_HSDIVIDER_CLKOUT1_PWDN_WIDTH 1
457#define AM33XX_HSDIVIDER_CLKOUT1_PWDN_MASK (1 << 12) 553#define AM33XX_HSDIVIDER_CLKOUT1_PWDN_MASK (1 << 12)
458 554
459/* Used by CM_DIV_M5_DPLL_CORE */ 555/* Used by CM_DIV_M5_DPLL_CORE */
460#define AM33XX_HSDIVIDER_CLKOUT2_DIV_SHIFT 0 556#define AM33XX_HSDIVIDER_CLKOUT2_DIV_SHIFT 0
557#define AM33XX_HSDIVIDER_CLKOUT2_DIV_WIDTH 5
461#define AM33XX_HSDIVIDER_CLKOUT2_DIV_MASK (0x1f << 0) 558#define AM33XX_HSDIVIDER_CLKOUT2_DIV_MASK (0x1f << 0)
462 559
463/* Used by CM_DIV_M5_DPLL_CORE */ 560/* Used by CM_DIV_M5_DPLL_CORE */
464#define AM33XX_HSDIVIDER_CLKOUT2_DIVCHACK_SHIFT 5 561#define AM33XX_HSDIVIDER_CLKOUT2_DIVCHACK_SHIFT 5
562#define AM33XX_HSDIVIDER_CLKOUT2_DIVCHACK_WIDTH 1
465#define AM33XX_HSDIVIDER_CLKOUT2_DIVCHACK_MASK (1 << 5) 563#define AM33XX_HSDIVIDER_CLKOUT2_DIVCHACK_MASK (1 << 5)
466 564
467/* Used by CM_DIV_M5_DPLL_CORE */ 565/* Used by CM_DIV_M5_DPLL_CORE */
468#define AM33XX_HSDIVIDER_CLKOUT2_GATE_CTRL_SHIFT 8 566#define AM33XX_HSDIVIDER_CLKOUT2_GATE_CTRL_SHIFT 8
567#define AM33XX_HSDIVIDER_CLKOUT2_GATE_CTRL_WIDTH 1
469#define AM33XX_HSDIVIDER_CLKOUT2_GATE_CTRL_MASK (1 << 8) 568#define AM33XX_HSDIVIDER_CLKOUT2_GATE_CTRL_MASK (1 << 8)
470 569
471/* Used by CM_DIV_M5_DPLL_CORE */ 570/* Used by CM_DIV_M5_DPLL_CORE */
472#define AM33XX_HSDIVIDER_CLKOUT2_PWDN_SHIFT 12 571#define AM33XX_HSDIVIDER_CLKOUT2_PWDN_SHIFT 12
572#define AM33XX_HSDIVIDER_CLKOUT2_PWDN_WIDTH 1
473#define AM33XX_HSDIVIDER_CLKOUT2_PWDN_MASK (1 << 12) 573#define AM33XX_HSDIVIDER_CLKOUT2_PWDN_MASK (1 << 12)
474 574
475/* Used by CM_DIV_M6_DPLL_CORE */ 575/* Used by CM_DIV_M6_DPLL_CORE */
476#define AM33XX_HSDIVIDER_CLKOUT3_DIV_SHIFT 0 576#define AM33XX_HSDIVIDER_CLKOUT3_DIV_SHIFT 0
477#define AM33XX_HSDIVIDER_CLKOUT3_DIV_MASK (0x04 << 0) 577#define AM33XX_HSDIVIDER_CLKOUT3_DIV_WIDTH 5
578#define AM33XX_HSDIVIDER_CLKOUT3_DIV_MASK (0x1f << 0)
478 579
479/* Used by CM_DIV_M6_DPLL_CORE */ 580/* Used by CM_DIV_M6_DPLL_CORE */
480#define AM33XX_HSDIVIDER_CLKOUT3_DIVCHACK_SHIFT 5 581#define AM33XX_HSDIVIDER_CLKOUT3_DIVCHACK_SHIFT 5
582#define AM33XX_HSDIVIDER_CLKOUT3_DIVCHACK_WIDTH 1
481#define AM33XX_HSDIVIDER_CLKOUT3_DIVCHACK_MASK (1 << 5) 583#define AM33XX_HSDIVIDER_CLKOUT3_DIVCHACK_MASK (1 << 5)
482 584
483/* Used by CM_DIV_M6_DPLL_CORE */ 585/* Used by CM_DIV_M6_DPLL_CORE */
484#define AM33XX_HSDIVIDER_CLKOUT3_GATE_CTRL_SHIFT 8 586#define AM33XX_HSDIVIDER_CLKOUT3_GATE_CTRL_SHIFT 8
587#define AM33XX_HSDIVIDER_CLKOUT3_GATE_CTRL_WIDTH 1
485#define AM33XX_HSDIVIDER_CLKOUT3_GATE_CTRL_MASK (1 << 8) 588#define AM33XX_HSDIVIDER_CLKOUT3_GATE_CTRL_MASK (1 << 8)
486 589
487/* Used by CM_DIV_M6_DPLL_CORE */ 590/* Used by CM_DIV_M6_DPLL_CORE */
488#define AM33XX_HSDIVIDER_CLKOUT3_PWDN_SHIFT 12 591#define AM33XX_HSDIVIDER_CLKOUT3_PWDN_SHIFT 12
592#define AM33XX_HSDIVIDER_CLKOUT3_PWDN_WIDTH 1
489#define AM33XX_HSDIVIDER_CLKOUT3_PWDN_MASK (1 << 12) 593#define AM33XX_HSDIVIDER_CLKOUT3_PWDN_MASK (1 << 12)
490 594
491/* 595/*
@@ -522,11 +626,12 @@
522 * CM_GFX_MMUCFG_CLKCTRL, CM_GFX_MMUDATA_CLKCTRL, CM_CEFUSE_CEFUSE_CLKCTRL 626 * CM_GFX_MMUCFG_CLKCTRL, CM_GFX_MMUDATA_CLKCTRL, CM_CEFUSE_CEFUSE_CLKCTRL
523 */ 627 */
524#define AM33XX_IDLEST_SHIFT 16 628#define AM33XX_IDLEST_SHIFT 16
629#define AM33XX_IDLEST_WIDTH 2
525#define AM33XX_IDLEST_MASK (0x3 << 16) 630#define AM33XX_IDLEST_MASK (0x3 << 16)
526#define AM33XX_IDLEST_VAL 0x3
527 631
528/* Used by CM_MAC_CLKSEL */ 632/* Used by CM_MAC_CLKSEL */
529#define AM33XX_MII_CLK_SEL_SHIFT 2 633#define AM33XX_MII_CLK_SEL_SHIFT 2
634#define AM33XX_MII_CLK_SEL_WIDTH 1
530#define AM33XX_MII_CLK_SEL_MASK (1 << 2) 635#define AM33XX_MII_CLK_SEL_MASK (1 << 2)
531 636
532/* 637/*
@@ -535,7 +640,8 @@
535 * CM_SSC_MODFREQDIV_DPLL_PER 640 * CM_SSC_MODFREQDIV_DPLL_PER
536 */ 641 */
537#define AM33XX_MODFREQDIV_EXPONENT_SHIFT 8 642#define AM33XX_MODFREQDIV_EXPONENT_SHIFT 8
538#define AM33XX_MODFREQDIV_EXPONENT_MASK (0x10 << 8) 643#define AM33XX_MODFREQDIV_EXPONENT_WIDTH 3
644#define AM33XX_MODFREQDIV_EXPONENT_MASK (0x7 << 8)
539 645
540/* 646/*
541 * Used by CM_SSC_MODFREQDIV_DPLL_CORE, CM_SSC_MODFREQDIV_DPLL_DDR, 647 * Used by CM_SSC_MODFREQDIV_DPLL_CORE, CM_SSC_MODFREQDIV_DPLL_DDR,
@@ -543,7 +649,8 @@
543 * CM_SSC_MODFREQDIV_DPLL_PER 649 * CM_SSC_MODFREQDIV_DPLL_PER
544 */ 650 */
545#define AM33XX_MODFREQDIV_MANTISSA_SHIFT 0 651#define AM33XX_MODFREQDIV_MANTISSA_SHIFT 0
546#define AM33XX_MODFREQDIV_MANTISSA_MASK (0x06 << 0) 652#define AM33XX_MODFREQDIV_MANTISSA_WIDTH 7
653#define AM33XX_MODFREQDIV_MANTISSA_MASK (0x7f << 0)
547 654
548/* 655/*
549 * Used by CM_MPU_MPU_CLKCTRL, CM_RTC_RTC_CLKCTRL, CM_PER_AES0_CLKCTRL, 656 * Used by CM_MPU_MPU_CLKCTRL, CM_RTC_RTC_CLKCTRL, CM_PER_AES0_CLKCTRL,
@@ -580,42 +687,52 @@
580 * CM_CEFUSE_CEFUSE_CLKCTRL 687 * CM_CEFUSE_CEFUSE_CLKCTRL
581 */ 688 */
582#define AM33XX_MODULEMODE_SHIFT 0 689#define AM33XX_MODULEMODE_SHIFT 0
690#define AM33XX_MODULEMODE_WIDTH 2
583#define AM33XX_MODULEMODE_MASK (0x3 << 0) 691#define AM33XX_MODULEMODE_MASK (0x3 << 0)
584 692
585/* Used by CM_WKUP_DEBUGSS_CLKCTRL */ 693/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
586#define AM33XX_OPTCLK_DEBUG_CLKA_SHIFT 30 694#define AM33XX_OPTCLK_DEBUG_CLKA_SHIFT 30
695#define AM33XX_OPTCLK_DEBUG_CLKA_WIDTH 1
587#define AM33XX_OPTCLK_DEBUG_CLKA_MASK (1 << 30) 696#define AM33XX_OPTCLK_DEBUG_CLKA_MASK (1 << 30)
588 697
589/* Used by CM_WKUP_DEBUGSS_CLKCTRL */ 698/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
590#define AM33XX_OPTFCLKEN_DBGSYSCLK_SHIFT 19 699#define AM33XX_OPTFCLKEN_DBGSYSCLK_SHIFT 19
700#define AM33XX_OPTFCLKEN_DBGSYSCLK_WIDTH 1
591#define AM33XX_OPTFCLKEN_DBGSYSCLK_MASK (1 << 19) 701#define AM33XX_OPTFCLKEN_DBGSYSCLK_MASK (1 << 19)
592 702
593/* Used by CM_WKUP_GPIO0_CLKCTRL */ 703/* Used by CM_WKUP_GPIO0_CLKCTRL */
594#define AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT 18 704#define AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT 18
705#define AM33XX_OPTFCLKEN_GPIO0_GDBCLK_WIDTH 1
595#define AM33XX_OPTFCLKEN_GPIO0_GDBCLK_MASK (1 << 18) 706#define AM33XX_OPTFCLKEN_GPIO0_GDBCLK_MASK (1 << 18)
596 707
597/* Used by CM_PER_GPIO1_CLKCTRL */ 708/* Used by CM_PER_GPIO1_CLKCTRL */
598#define AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT 18 709#define AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT 18
710#define AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_WIDTH 1
599#define AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_MASK (1 << 18) 711#define AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_MASK (1 << 18)
600 712
601/* Used by CM_PER_GPIO2_CLKCTRL */ 713/* Used by CM_PER_GPIO2_CLKCTRL */
602#define AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT 18 714#define AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT 18
715#define AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_WIDTH 1
603#define AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_MASK (1 << 18) 716#define AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_MASK (1 << 18)
604 717
605/* Used by CM_PER_GPIO3_CLKCTRL */ 718/* Used by CM_PER_GPIO3_CLKCTRL */
606#define AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT 18 719#define AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT 18
720#define AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_WIDTH 1
607#define AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_MASK (1 << 18) 721#define AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_MASK (1 << 18)
608 722
609/* Used by CM_PER_GPIO4_CLKCTRL */ 723/* Used by CM_PER_GPIO4_CLKCTRL */
610#define AM33XX_OPTFCLKEN_GPIO_4_GDBCLK_SHIFT 18 724#define AM33XX_OPTFCLKEN_GPIO_4_GDBCLK_SHIFT 18
725#define AM33XX_OPTFCLKEN_GPIO_4_GDBCLK_WIDTH 1
611#define AM33XX_OPTFCLKEN_GPIO_4_GDBCLK_MASK (1 << 18) 726#define AM33XX_OPTFCLKEN_GPIO_4_GDBCLK_MASK (1 << 18)
612 727
613/* Used by CM_PER_GPIO5_CLKCTRL */ 728/* Used by CM_PER_GPIO5_CLKCTRL */
614#define AM33XX_OPTFCLKEN_GPIO_5_GDBCLK_SHIFT 18 729#define AM33XX_OPTFCLKEN_GPIO_5_GDBCLK_SHIFT 18
730#define AM33XX_OPTFCLKEN_GPIO_5_GDBCLK_WIDTH 1
615#define AM33XX_OPTFCLKEN_GPIO_5_GDBCLK_MASK (1 << 18) 731#define AM33XX_OPTFCLKEN_GPIO_5_GDBCLK_MASK (1 << 18)
616 732
617/* Used by CM_PER_GPIO6_CLKCTRL */ 733/* Used by CM_PER_GPIO6_CLKCTRL */
618#define AM33XX_OPTFCLKEN_GPIO_6_GDBCLK_SHIFT 18 734#define AM33XX_OPTFCLKEN_GPIO_6_GDBCLK_SHIFT 18
735#define AM33XX_OPTFCLKEN_GPIO_6_GDBCLK_WIDTH 1
619#define AM33XX_OPTFCLKEN_GPIO_6_GDBCLK_MASK (1 << 18) 736#define AM33XX_OPTFCLKEN_GPIO_6_GDBCLK_MASK (1 << 18)
620 737
621/* 738/*
@@ -627,25 +744,30 @@
627 * CM_WKUP_WKUP_M3_CLKCTRL, CM_GFX_BITBLT_CLKCTRL, CM_GFX_GFX_CLKCTRL 744 * CM_WKUP_WKUP_M3_CLKCTRL, CM_GFX_BITBLT_CLKCTRL, CM_GFX_GFX_CLKCTRL
628 */ 745 */
629#define AM33XX_STBYST_SHIFT 18 746#define AM33XX_STBYST_SHIFT 18
747#define AM33XX_STBYST_WIDTH 1
630#define AM33XX_STBYST_MASK (1 << 18) 748#define AM33XX_STBYST_MASK (1 << 18)
631 749
632/* Used by CM_WKUP_DEBUGSS_CLKCTRL */ 750/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
633#define AM33XX_STM_PMD_CLKDIVSEL_SHIFT 27 751#define AM33XX_STM_PMD_CLKDIVSEL_SHIFT 27
634#define AM33XX_STM_PMD_CLKDIVSEL_MASK (0x29 << 27) 752#define AM33XX_STM_PMD_CLKDIVSEL_WIDTH 3
753#define AM33XX_STM_PMD_CLKDIVSEL_MASK (0x7 << 27)
635 754
636/* Used by CM_WKUP_DEBUGSS_CLKCTRL */ 755/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
637#define AM33XX_STM_PMD_CLKSEL_SHIFT 22 756#define AM33XX_STM_PMD_CLKSEL_SHIFT 22
638#define AM33XX_STM_PMD_CLKSEL_MASK (0x23 << 22) 757#define AM33XX_STM_PMD_CLKSEL_WIDTH 2
758#define AM33XX_STM_PMD_CLKSEL_MASK (0x3 << 22)
639 759
640/* 760/*
641 * Used by CM_IDLEST_DPLL_CORE, CM_IDLEST_DPLL_DDR, CM_IDLEST_DPLL_DISP, 761 * Used by CM_IDLEST_DPLL_CORE, CM_IDLEST_DPLL_DDR, CM_IDLEST_DPLL_DISP,
642 * CM_IDLEST_DPLL_MPU, CM_IDLEST_DPLL_PER 762 * CM_IDLEST_DPLL_MPU, CM_IDLEST_DPLL_PER
643 */ 763 */
644#define AM33XX_ST_DPLL_CLK_SHIFT 0 764#define AM33XX_ST_DPLL_CLK_SHIFT 0
765#define AM33XX_ST_DPLL_CLK_WIDTH 1
645#define AM33XX_ST_DPLL_CLK_MASK (1 << 0) 766#define AM33XX_ST_DPLL_CLK_MASK (1 << 0)
646 767
647/* Used by CM_CLKDCOLDO_DPLL_PER */ 768/* Used by CM_CLKDCOLDO_DPLL_PER */
648#define AM33XX_ST_DPLL_CLKDCOLDO_SHIFT 8 769#define AM33XX_ST_DPLL_CLKDCOLDO_SHIFT 8
770#define AM33XX_ST_DPLL_CLKDCOLDO_WIDTH 1
649#define AM33XX_ST_DPLL_CLKDCOLDO_MASK (1 << 8) 771#define AM33XX_ST_DPLL_CLKDCOLDO_MASK (1 << 8)
650 772
651/* 773/*
@@ -653,18 +775,22 @@
653 * CM_DIV_M2_DPLL_PER 775 * CM_DIV_M2_DPLL_PER
654 */ 776 */
655#define AM33XX_ST_DPLL_CLKOUT_SHIFT 9 777#define AM33XX_ST_DPLL_CLKOUT_SHIFT 9
778#define AM33XX_ST_DPLL_CLKOUT_WIDTH 1
656#define AM33XX_ST_DPLL_CLKOUT_MASK (1 << 9) 779#define AM33XX_ST_DPLL_CLKOUT_MASK (1 << 9)
657 780
658/* Used by CM_DIV_M4_DPLL_CORE */ 781/* Used by CM_DIV_M4_DPLL_CORE */
659#define AM33XX_ST_HSDIVIDER_CLKOUT1_SHIFT 9 782#define AM33XX_ST_HSDIVIDER_CLKOUT1_SHIFT 9
783#define AM33XX_ST_HSDIVIDER_CLKOUT1_WIDTH 1
660#define AM33XX_ST_HSDIVIDER_CLKOUT1_MASK (1 << 9) 784#define AM33XX_ST_HSDIVIDER_CLKOUT1_MASK (1 << 9)
661 785
662/* Used by CM_DIV_M5_DPLL_CORE */ 786/* Used by CM_DIV_M5_DPLL_CORE */
663#define AM33XX_ST_HSDIVIDER_CLKOUT2_SHIFT 9 787#define AM33XX_ST_HSDIVIDER_CLKOUT2_SHIFT 9
788#define AM33XX_ST_HSDIVIDER_CLKOUT2_WIDTH 1
664#define AM33XX_ST_HSDIVIDER_CLKOUT2_MASK (1 << 9) 789#define AM33XX_ST_HSDIVIDER_CLKOUT2_MASK (1 << 9)
665 790
666/* Used by CM_DIV_M6_DPLL_CORE */ 791/* Used by CM_DIV_M6_DPLL_CORE */
667#define AM33XX_ST_HSDIVIDER_CLKOUT3_SHIFT 9 792#define AM33XX_ST_HSDIVIDER_CLKOUT3_SHIFT 9
793#define AM33XX_ST_HSDIVIDER_CLKOUT3_WIDTH 1
668#define AM33XX_ST_HSDIVIDER_CLKOUT3_MASK (1 << 9) 794#define AM33XX_ST_HSDIVIDER_CLKOUT3_MASK (1 << 9)
669 795
670/* 796/*
@@ -672,16 +798,20 @@
672 * CM_IDLEST_DPLL_MPU, CM_IDLEST_DPLL_PER 798 * CM_IDLEST_DPLL_MPU, CM_IDLEST_DPLL_PER
673 */ 799 */
674#define AM33XX_ST_MN_BYPASS_SHIFT 8 800#define AM33XX_ST_MN_BYPASS_SHIFT 8
801#define AM33XX_ST_MN_BYPASS_WIDTH 1
675#define AM33XX_ST_MN_BYPASS_MASK (1 << 8) 802#define AM33XX_ST_MN_BYPASS_MASK (1 << 8)
676 803
677/* Used by CM_WKUP_DEBUGSS_CLKCTRL */ 804/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
678#define AM33XX_TRC_PMD_CLKDIVSEL_SHIFT 24 805#define AM33XX_TRC_PMD_CLKDIVSEL_SHIFT 24
679#define AM33XX_TRC_PMD_CLKDIVSEL_MASK (0x26 << 24) 806#define AM33XX_TRC_PMD_CLKDIVSEL_WIDTH 3
807#define AM33XX_TRC_PMD_CLKDIVSEL_MASK (0x7 << 24)
680 808
681/* Used by CM_WKUP_DEBUGSS_CLKCTRL */ 809/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
682#define AM33XX_TRC_PMD_CLKSEL_SHIFT 20 810#define AM33XX_TRC_PMD_CLKSEL_SHIFT 20
683#define AM33XX_TRC_PMD_CLKSEL_MASK (0x21 << 20) 811#define AM33XX_TRC_PMD_CLKSEL_WIDTH 2
812#define AM33XX_TRC_PMD_CLKSEL_MASK (0x3 << 20)
684 813
685/* Used by CONTROL_SEC_CLK_CTRL */ 814/* Used by CONTROL_SEC_CLK_CTRL */
815#define AM33XX_TIMER0_CLKSEL_WIDTH 2
686#define AM33XX_TIMER0_CLKSEL_MASK (0x3 << 4) 816#define AM33XX_TIMER0_CLKSEL_MASK (0x3 << 4)
687#endif 817#endif
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index 975f6bda0e0b..59598ffd8783 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -218,6 +218,8 @@
218#define OMAP3430_ST_MAILBOXES_MASK (1 << 7) 218#define OMAP3430_ST_MAILBOXES_MASK (1 << 7)
219#define OMAP3430_ST_OMAPCTRL_SHIFT 6 219#define OMAP3430_ST_OMAPCTRL_SHIFT 6
220#define OMAP3430_ST_OMAPCTRL_MASK (1 << 6) 220#define OMAP3430_ST_OMAPCTRL_MASK (1 << 6)
221#define OMAP3430_ST_SAD2D_SHIFT 3
222#define OMAP3430_ST_SAD2D_MASK (1 << 3)
221#define OMAP3430_ST_SDMA_SHIFT 2 223#define OMAP3430_ST_SDMA_SHIFT 2
222#define OMAP3430_ST_SDMA_MASK (1 << 2) 224#define OMAP3430_ST_SDMA_MASK (1 << 2)
223#define OMAP3430_ST_SDRC_SHIFT 1 225#define OMAP3430_ST_SDRC_SHIFT 1
diff --git a/arch/arm/mach-omap2/cm-regbits-44xx.h b/arch/arm/mach-omap2/cm-regbits-44xx.h
index 65597a745638..4c6c2f7de65b 100644
--- a/arch/arm/mach-omap2/cm-regbits-44xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-44xx.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP44xx Clock Management register bits 2 * OMAP44xx Clock Management register bits
3 * 3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc. 4 * Copyright (C) 2009-2012 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation 5 * Copyright (C) 2009-2010 Nokia Corporation
6 * 6 *
7 * Paul Walmsley (paul@pwsan.com) 7 * Paul Walmsley (paul@pwsan.com)
@@ -24,6 +24,7 @@
24 24
25/* Used by CM_L3_1_DYNAMICDEP, CM_MPU_DYNAMICDEP, CM_TESLA_DYNAMICDEP */ 25/* Used by CM_L3_1_DYNAMICDEP, CM_MPU_DYNAMICDEP, CM_TESLA_DYNAMICDEP */
26#define OMAP4430_ABE_DYNDEP_SHIFT 3 26#define OMAP4430_ABE_DYNDEP_SHIFT 3
27#define OMAP4430_ABE_DYNDEP_WIDTH 0x1
27#define OMAP4430_ABE_DYNDEP_MASK (1 << 3) 28#define OMAP4430_ABE_DYNDEP_MASK (1 << 3)
28 29
29/* 30/*
@@ -31,14 +32,17 @@
31 * CM_MPU_STATICDEP, CM_SDMA_STATICDEP, CM_TESLA_STATICDEP 32 * CM_MPU_STATICDEP, CM_SDMA_STATICDEP, CM_TESLA_STATICDEP
32 */ 33 */
33#define OMAP4430_ABE_STATDEP_SHIFT 3 34#define OMAP4430_ABE_STATDEP_SHIFT 3
35#define OMAP4430_ABE_STATDEP_WIDTH 0x1
34#define OMAP4430_ABE_STATDEP_MASK (1 << 3) 36#define OMAP4430_ABE_STATDEP_MASK (1 << 3)
35 37
36/* Used by CM_L4CFG_DYNAMICDEP */ 38/* Used by CM_L4CFG_DYNAMICDEP */
37#define OMAP4430_ALWONCORE_DYNDEP_SHIFT 16 39#define OMAP4430_ALWONCORE_DYNDEP_SHIFT 16
40#define OMAP4430_ALWONCORE_DYNDEP_WIDTH 0x1
38#define OMAP4430_ALWONCORE_DYNDEP_MASK (1 << 16) 41#define OMAP4430_ALWONCORE_DYNDEP_MASK (1 << 16)
39 42
40/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP, CM_TESLA_STATICDEP */ 43/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP, CM_TESLA_STATICDEP */
41#define OMAP4430_ALWONCORE_STATDEP_SHIFT 16 44#define OMAP4430_ALWONCORE_STATDEP_SHIFT 16
45#define OMAP4430_ALWONCORE_STATDEP_WIDTH 0x1
42#define OMAP4430_ALWONCORE_STATDEP_MASK (1 << 16) 46#define OMAP4430_ALWONCORE_STATDEP_MASK (1 << 16)
43 47
44/* 48/*
@@ -47,294 +51,367 @@
47 * CM_AUTOIDLE_DPLL_PER, CM_AUTOIDLE_DPLL_UNIPRO, CM_AUTOIDLE_DPLL_USB 51 * CM_AUTOIDLE_DPLL_PER, CM_AUTOIDLE_DPLL_UNIPRO, CM_AUTOIDLE_DPLL_USB
48 */ 52 */
49#define OMAP4430_AUTO_DPLL_MODE_SHIFT 0 53#define OMAP4430_AUTO_DPLL_MODE_SHIFT 0
54#define OMAP4430_AUTO_DPLL_MODE_WIDTH 0x3
50#define OMAP4430_AUTO_DPLL_MODE_MASK (0x7 << 0) 55#define OMAP4430_AUTO_DPLL_MODE_MASK (0x7 << 0)
51 56
52/* Used by CM_L4CFG_DYNAMICDEP */ 57/* Used by CM_L4CFG_DYNAMICDEP */
53#define OMAP4430_CEFUSE_DYNDEP_SHIFT 17 58#define OMAP4430_CEFUSE_DYNDEP_SHIFT 17
59#define OMAP4430_CEFUSE_DYNDEP_WIDTH 0x1
54#define OMAP4430_CEFUSE_DYNDEP_MASK (1 << 17) 60#define OMAP4430_CEFUSE_DYNDEP_MASK (1 << 17)
55 61
56/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP, CM_TESLA_STATICDEP */ 62/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP, CM_TESLA_STATICDEP */
57#define OMAP4430_CEFUSE_STATDEP_SHIFT 17 63#define OMAP4430_CEFUSE_STATDEP_SHIFT 17
64#define OMAP4430_CEFUSE_STATDEP_WIDTH 0x1
58#define OMAP4430_CEFUSE_STATDEP_MASK (1 << 17) 65#define OMAP4430_CEFUSE_STATDEP_MASK (1 << 17)
59 66
60/* Used by CM1_ABE_CLKSTCTRL */ 67/* Used by CM1_ABE_CLKSTCTRL */
61#define OMAP4430_CLKACTIVITY_ABE_24M_GFCLK_SHIFT 13 68#define OMAP4430_CLKACTIVITY_ABE_24M_GFCLK_SHIFT 13
69#define OMAP4430_CLKACTIVITY_ABE_24M_GFCLK_WIDTH 0x1
62#define OMAP4430_CLKACTIVITY_ABE_24M_GFCLK_MASK (1 << 13) 70#define OMAP4430_CLKACTIVITY_ABE_24M_GFCLK_MASK (1 << 13)
63 71
64/* Used by CM1_ABE_CLKSTCTRL */ 72/* Used by CM1_ABE_CLKSTCTRL */
65#define OMAP4430_CLKACTIVITY_ABE_ALWON_32K_CLK_SHIFT 12 73#define OMAP4430_CLKACTIVITY_ABE_ALWON_32K_CLK_SHIFT 12
74#define OMAP4430_CLKACTIVITY_ABE_ALWON_32K_CLK_WIDTH 0x1
66#define OMAP4430_CLKACTIVITY_ABE_ALWON_32K_CLK_MASK (1 << 12) 75#define OMAP4430_CLKACTIVITY_ABE_ALWON_32K_CLK_MASK (1 << 12)
67 76
68/* Used by CM_WKUP_CLKSTCTRL */ 77/* Used by CM_WKUP_CLKSTCTRL */
69#define OMAP4430_CLKACTIVITY_ABE_LP_CLK_SHIFT 9 78#define OMAP4430_CLKACTIVITY_ABE_LP_CLK_SHIFT 9
79#define OMAP4430_CLKACTIVITY_ABE_LP_CLK_WIDTH 0x1
70#define OMAP4430_CLKACTIVITY_ABE_LP_CLK_MASK (1 << 9) 80#define OMAP4430_CLKACTIVITY_ABE_LP_CLK_MASK (1 << 9)
71 81
72/* Used by CM1_ABE_CLKSTCTRL */ 82/* Used by CM1_ABE_CLKSTCTRL */
73#define OMAP4430_CLKACTIVITY_ABE_SYSCLK_SHIFT 11 83#define OMAP4430_CLKACTIVITY_ABE_SYSCLK_SHIFT 11
84#define OMAP4430_CLKACTIVITY_ABE_SYSCLK_WIDTH 0x1
74#define OMAP4430_CLKACTIVITY_ABE_SYSCLK_MASK (1 << 11) 85#define OMAP4430_CLKACTIVITY_ABE_SYSCLK_MASK (1 << 11)
75 86
76/* Used by CM1_ABE_CLKSTCTRL */ 87/* Used by CM1_ABE_CLKSTCTRL */
77#define OMAP4430_CLKACTIVITY_ABE_X2_CLK_SHIFT 8 88#define OMAP4430_CLKACTIVITY_ABE_X2_CLK_SHIFT 8
89#define OMAP4430_CLKACTIVITY_ABE_X2_CLK_WIDTH 0x1
78#define OMAP4430_CLKACTIVITY_ABE_X2_CLK_MASK (1 << 8) 90#define OMAP4430_CLKACTIVITY_ABE_X2_CLK_MASK (1 << 8)
79 91
80/* Used by CM_MEMIF_CLKSTCTRL */ 92/* Used by CM_MEMIF_CLKSTCTRL */
81#define OMAP4430_CLKACTIVITY_ASYNC_DLL_CLK_SHIFT 11 93#define OMAP4430_CLKACTIVITY_ASYNC_DLL_CLK_SHIFT 11
94#define OMAP4430_CLKACTIVITY_ASYNC_DLL_CLK_WIDTH 0x1
82#define OMAP4430_CLKACTIVITY_ASYNC_DLL_CLK_MASK (1 << 11) 95#define OMAP4430_CLKACTIVITY_ASYNC_DLL_CLK_MASK (1 << 11)
83 96
84/* Used by CM_MEMIF_CLKSTCTRL */ 97/* Used by CM_MEMIF_CLKSTCTRL */
85#define OMAP4430_CLKACTIVITY_ASYNC_PHY1_CLK_SHIFT 12 98#define OMAP4430_CLKACTIVITY_ASYNC_PHY1_CLK_SHIFT 12
99#define OMAP4430_CLKACTIVITY_ASYNC_PHY1_CLK_WIDTH 0x1
86#define OMAP4430_CLKACTIVITY_ASYNC_PHY1_CLK_MASK (1 << 12) 100#define OMAP4430_CLKACTIVITY_ASYNC_PHY1_CLK_MASK (1 << 12)
87 101
88/* Used by CM_MEMIF_CLKSTCTRL */ 102/* Used by CM_MEMIF_CLKSTCTRL */
89#define OMAP4430_CLKACTIVITY_ASYNC_PHY2_CLK_SHIFT 13 103#define OMAP4430_CLKACTIVITY_ASYNC_PHY2_CLK_SHIFT 13
104#define OMAP4430_CLKACTIVITY_ASYNC_PHY2_CLK_WIDTH 0x1
90#define OMAP4430_CLKACTIVITY_ASYNC_PHY2_CLK_MASK (1 << 13) 105#define OMAP4430_CLKACTIVITY_ASYNC_PHY2_CLK_MASK (1 << 13)
91 106
92/* Used by CM_CAM_CLKSTCTRL */ 107/* Used by CM_CAM_CLKSTCTRL */
93#define OMAP4430_CLKACTIVITY_CAM_PHY_CTRL_GCLK_SHIFT 9 108#define OMAP4430_CLKACTIVITY_CAM_PHY_CTRL_GCLK_SHIFT 9
109#define OMAP4430_CLKACTIVITY_CAM_PHY_CTRL_GCLK_WIDTH 0x1
94#define OMAP4430_CLKACTIVITY_CAM_PHY_CTRL_GCLK_MASK (1 << 9) 110#define OMAP4430_CLKACTIVITY_CAM_PHY_CTRL_GCLK_MASK (1 << 9)
95 111
96/* Used by CM_ALWON_CLKSTCTRL */ 112/* Used by CM_ALWON_CLKSTCTRL */
97#define OMAP4430_CLKACTIVITY_CORE_ALWON_32K_GFCLK_SHIFT 12 113#define OMAP4430_CLKACTIVITY_CORE_ALWON_32K_GFCLK_SHIFT 12
114#define OMAP4430_CLKACTIVITY_CORE_ALWON_32K_GFCLK_WIDTH 0x1
98#define OMAP4430_CLKACTIVITY_CORE_ALWON_32K_GFCLK_MASK (1 << 12) 115#define OMAP4430_CLKACTIVITY_CORE_ALWON_32K_GFCLK_MASK (1 << 12)
99 116
100/* Used by CM_EMU_CLKSTCTRL */ 117/* Used by CM_EMU_CLKSTCTRL */
101#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_SHIFT 9 118#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_SHIFT 9
119#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_WIDTH 0x1
102#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_MASK (1 << 9) 120#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_MASK (1 << 9)
103 121
104/* Used by CM_L4CFG_CLKSTCTRL */ 122/* Used by CM_L4CFG_CLKSTCTRL */
105#define OMAP4460_CLKACTIVITY_CORE_TS_GFCLK_SHIFT 9 123#define OMAP4460_CLKACTIVITY_CORE_TS_GFCLK_SHIFT 9
124#define OMAP4460_CLKACTIVITY_CORE_TS_GFCLK_WIDTH 0x1
106#define OMAP4460_CLKACTIVITY_CORE_TS_GFCLK_MASK (1 << 9) 125#define OMAP4460_CLKACTIVITY_CORE_TS_GFCLK_MASK (1 << 9)
107 126
108/* Used by CM_CEFUSE_CLKSTCTRL */ 127/* Used by CM_CEFUSE_CLKSTCTRL */
109#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_SHIFT 9 128#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_SHIFT 9
129#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_WIDTH 0x1
110#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_MASK (1 << 9) 130#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_MASK (1 << 9)
111 131
112/* Used by CM_MEMIF_CLKSTCTRL */ 132/* Used by CM_MEMIF_CLKSTCTRL */
113#define OMAP4430_CLKACTIVITY_DLL_CLK_SHIFT 9 133#define OMAP4430_CLKACTIVITY_DLL_CLK_SHIFT 9
134#define OMAP4430_CLKACTIVITY_DLL_CLK_WIDTH 0x1
114#define OMAP4430_CLKACTIVITY_DLL_CLK_MASK (1 << 9) 135#define OMAP4430_CLKACTIVITY_DLL_CLK_MASK (1 << 9)
115 136
116/* Used by CM_L4PER_CLKSTCTRL */ 137/* Used by CM_L4PER_CLKSTCTRL */
117#define OMAP4430_CLKACTIVITY_DMT10_GFCLK_SHIFT 9 138#define OMAP4430_CLKACTIVITY_DMT10_GFCLK_SHIFT 9
139#define OMAP4430_CLKACTIVITY_DMT10_GFCLK_WIDTH 0x1
118#define OMAP4430_CLKACTIVITY_DMT10_GFCLK_MASK (1 << 9) 140#define OMAP4430_CLKACTIVITY_DMT10_GFCLK_MASK (1 << 9)
119 141
120/* Used by CM_L4PER_CLKSTCTRL */ 142/* Used by CM_L4PER_CLKSTCTRL */
121#define OMAP4430_CLKACTIVITY_DMT11_GFCLK_SHIFT 10 143#define OMAP4430_CLKACTIVITY_DMT11_GFCLK_SHIFT 10
144#define OMAP4430_CLKACTIVITY_DMT11_GFCLK_WIDTH 0x1
122#define OMAP4430_CLKACTIVITY_DMT11_GFCLK_MASK (1 << 10) 145#define OMAP4430_CLKACTIVITY_DMT11_GFCLK_MASK (1 << 10)
123 146
124/* Used by CM_L4PER_CLKSTCTRL */ 147/* Used by CM_L4PER_CLKSTCTRL */
125#define OMAP4430_CLKACTIVITY_DMT2_GFCLK_SHIFT 11 148#define OMAP4430_CLKACTIVITY_DMT2_GFCLK_SHIFT 11
149#define OMAP4430_CLKACTIVITY_DMT2_GFCLK_WIDTH 0x1
126#define OMAP4430_CLKACTIVITY_DMT2_GFCLK_MASK (1 << 11) 150#define OMAP4430_CLKACTIVITY_DMT2_GFCLK_MASK (1 << 11)
127 151
128/* Used by CM_L4PER_CLKSTCTRL */ 152/* Used by CM_L4PER_CLKSTCTRL */
129#define OMAP4430_CLKACTIVITY_DMT3_GFCLK_SHIFT 12 153#define OMAP4430_CLKACTIVITY_DMT3_GFCLK_SHIFT 12
154#define OMAP4430_CLKACTIVITY_DMT3_GFCLK_WIDTH 0x1
130#define OMAP4430_CLKACTIVITY_DMT3_GFCLK_MASK (1 << 12) 155#define OMAP4430_CLKACTIVITY_DMT3_GFCLK_MASK (1 << 12)
131 156
132/* Used by CM_L4PER_CLKSTCTRL */ 157/* Used by CM_L4PER_CLKSTCTRL */
133#define OMAP4430_CLKACTIVITY_DMT4_GFCLK_SHIFT 13 158#define OMAP4430_CLKACTIVITY_DMT4_GFCLK_SHIFT 13
159#define OMAP4430_CLKACTIVITY_DMT4_GFCLK_WIDTH 0x1
134#define OMAP4430_CLKACTIVITY_DMT4_GFCLK_MASK (1 << 13) 160#define OMAP4430_CLKACTIVITY_DMT4_GFCLK_MASK (1 << 13)
135 161
136/* Used by CM_L4PER_CLKSTCTRL */ 162/* Used by CM_L4PER_CLKSTCTRL */
137#define OMAP4430_CLKACTIVITY_DMT9_GFCLK_SHIFT 14 163#define OMAP4430_CLKACTIVITY_DMT9_GFCLK_SHIFT 14
164#define OMAP4430_CLKACTIVITY_DMT9_GFCLK_WIDTH 0x1
138#define OMAP4430_CLKACTIVITY_DMT9_GFCLK_MASK (1 << 14) 165#define OMAP4430_CLKACTIVITY_DMT9_GFCLK_MASK (1 << 14)
139 166
140/* Used by CM_DSS_CLKSTCTRL */ 167/* Used by CM_DSS_CLKSTCTRL */
141#define OMAP4430_CLKACTIVITY_DSS_ALWON_SYS_CLK_SHIFT 10 168#define OMAP4430_CLKACTIVITY_DSS_ALWON_SYS_CLK_SHIFT 10
169#define OMAP4430_CLKACTIVITY_DSS_ALWON_SYS_CLK_WIDTH 0x1
142#define OMAP4430_CLKACTIVITY_DSS_ALWON_SYS_CLK_MASK (1 << 10) 170#define OMAP4430_CLKACTIVITY_DSS_ALWON_SYS_CLK_MASK (1 << 10)
143 171
144/* Used by CM_DSS_CLKSTCTRL */ 172/* Used by CM_DSS_CLKSTCTRL */
145#define OMAP4430_CLKACTIVITY_DSS_FCLK_SHIFT 9 173#define OMAP4430_CLKACTIVITY_DSS_FCLK_SHIFT 9
174#define OMAP4430_CLKACTIVITY_DSS_FCLK_WIDTH 0x1
146#define OMAP4430_CLKACTIVITY_DSS_FCLK_MASK (1 << 9) 175#define OMAP4430_CLKACTIVITY_DSS_FCLK_MASK (1 << 9)
147 176
148/* Used by CM_DUCATI_CLKSTCTRL */ 177/* Used by CM_DUCATI_CLKSTCTRL */
149#define OMAP4430_CLKACTIVITY_DUCATI_GCLK_SHIFT 8 178#define OMAP4430_CLKACTIVITY_DUCATI_GCLK_SHIFT 8
179#define OMAP4430_CLKACTIVITY_DUCATI_GCLK_WIDTH 0x1
150#define OMAP4430_CLKACTIVITY_DUCATI_GCLK_MASK (1 << 8) 180#define OMAP4430_CLKACTIVITY_DUCATI_GCLK_MASK (1 << 8)
151 181
152/* Used by CM_EMU_CLKSTCTRL */ 182/* Used by CM_EMU_CLKSTCTRL */
153#define OMAP4430_CLKACTIVITY_EMU_SYS_CLK_SHIFT 8 183#define OMAP4430_CLKACTIVITY_EMU_SYS_CLK_SHIFT 8
184#define OMAP4430_CLKACTIVITY_EMU_SYS_CLK_WIDTH 0x1
154#define OMAP4430_CLKACTIVITY_EMU_SYS_CLK_MASK (1 << 8) 185#define OMAP4430_CLKACTIVITY_EMU_SYS_CLK_MASK (1 << 8)
155 186
156/* Used by CM_CAM_CLKSTCTRL */ 187/* Used by CM_CAM_CLKSTCTRL */
157#define OMAP4430_CLKACTIVITY_FDIF_GFCLK_SHIFT 10 188#define OMAP4430_CLKACTIVITY_FDIF_GFCLK_SHIFT 10
189#define OMAP4430_CLKACTIVITY_FDIF_GFCLK_WIDTH 0x1
158#define OMAP4430_CLKACTIVITY_FDIF_GFCLK_MASK (1 << 10) 190#define OMAP4430_CLKACTIVITY_FDIF_GFCLK_MASK (1 << 10)
159 191
160/* Used by CM_L4PER_CLKSTCTRL */ 192/* Used by CM_L4PER_CLKSTCTRL */
161#define OMAP4430_CLKACTIVITY_FUNC_12M_GFCLK_SHIFT 15 193#define OMAP4430_CLKACTIVITY_FUNC_12M_GFCLK_SHIFT 15
194#define OMAP4430_CLKACTIVITY_FUNC_12M_GFCLK_WIDTH 0x1
162#define OMAP4430_CLKACTIVITY_FUNC_12M_GFCLK_MASK (1 << 15) 195#define OMAP4430_CLKACTIVITY_FUNC_12M_GFCLK_MASK (1 << 15)
163 196
164/* Used by CM1_ABE_CLKSTCTRL */ 197/* Used by CM1_ABE_CLKSTCTRL */
165#define OMAP4430_CLKACTIVITY_FUNC_24M_GFCLK_SHIFT 10 198#define OMAP4430_CLKACTIVITY_FUNC_24M_GFCLK_SHIFT 10
199#define OMAP4430_CLKACTIVITY_FUNC_24M_GFCLK_WIDTH 0x1
166#define OMAP4430_CLKACTIVITY_FUNC_24M_GFCLK_MASK (1 << 10) 200#define OMAP4430_CLKACTIVITY_FUNC_24M_GFCLK_MASK (1 << 10)
167 201
168/* Used by CM_DSS_CLKSTCTRL */ 202/* Used by CM_DSS_CLKSTCTRL */
169#define OMAP4430_CLKACTIVITY_HDMI_PHY_48MHZ_GFCLK_SHIFT 11 203#define OMAP4430_CLKACTIVITY_HDMI_PHY_48MHZ_GFCLK_SHIFT 11
204#define OMAP4430_CLKACTIVITY_HDMI_PHY_48MHZ_GFCLK_WIDTH 0x1
170#define OMAP4430_CLKACTIVITY_HDMI_PHY_48MHZ_GFCLK_MASK (1 << 11) 205#define OMAP4430_CLKACTIVITY_HDMI_PHY_48MHZ_GFCLK_MASK (1 << 11)
171 206
172/* Used by CM_L3INIT_CLKSTCTRL */ 207/* Used by CM_L3INIT_CLKSTCTRL */
173#define OMAP4430_CLKACTIVITY_HSIC_P1_480M_GFCLK_SHIFT 20 208#define OMAP4430_CLKACTIVITY_HSIC_P1_480M_GFCLK_SHIFT 20
209#define OMAP4430_CLKACTIVITY_HSIC_P1_480M_GFCLK_WIDTH 0x1
174#define OMAP4430_CLKACTIVITY_HSIC_P1_480M_GFCLK_MASK (1 << 20) 210#define OMAP4430_CLKACTIVITY_HSIC_P1_480M_GFCLK_MASK (1 << 20)
175 211
176/* Used by CM_L3INIT_CLKSTCTRL */ 212/* Used by CM_L3INIT_CLKSTCTRL */
177#define OMAP4430_CLKACTIVITY_HSIC_P1_GFCLK_SHIFT 26 213#define OMAP4430_CLKACTIVITY_HSIC_P1_GFCLK_SHIFT 26
214#define OMAP4430_CLKACTIVITY_HSIC_P1_GFCLK_WIDTH 0x1
178#define OMAP4430_CLKACTIVITY_HSIC_P1_GFCLK_MASK (1 << 26) 215#define OMAP4430_CLKACTIVITY_HSIC_P1_GFCLK_MASK (1 << 26)
179 216
180/* Used by CM_L3INIT_CLKSTCTRL */ 217/* Used by CM_L3INIT_CLKSTCTRL */
181#define OMAP4430_CLKACTIVITY_HSIC_P2_480M_GFCLK_SHIFT 21 218#define OMAP4430_CLKACTIVITY_HSIC_P2_480M_GFCLK_SHIFT 21
219#define OMAP4430_CLKACTIVITY_HSIC_P2_480M_GFCLK_WIDTH 0x1
182#define OMAP4430_CLKACTIVITY_HSIC_P2_480M_GFCLK_MASK (1 << 21) 220#define OMAP4430_CLKACTIVITY_HSIC_P2_480M_GFCLK_MASK (1 << 21)
183 221
184/* Used by CM_L3INIT_CLKSTCTRL */ 222/* Used by CM_L3INIT_CLKSTCTRL */
185#define OMAP4430_CLKACTIVITY_HSIC_P2_GFCLK_SHIFT 27 223#define OMAP4430_CLKACTIVITY_HSIC_P2_GFCLK_SHIFT 27
224#define OMAP4430_CLKACTIVITY_HSIC_P2_GFCLK_WIDTH 0x1
186#define OMAP4430_CLKACTIVITY_HSIC_P2_GFCLK_MASK (1 << 27) 225#define OMAP4430_CLKACTIVITY_HSIC_P2_GFCLK_MASK (1 << 27)
187 226
188/* Used by CM_L3INIT_CLKSTCTRL */ 227/* Used by CM_L3INIT_CLKSTCTRL */
189#define OMAP4430_CLKACTIVITY_INIT_48MC_GFCLK_SHIFT 13 228#define OMAP4430_CLKACTIVITY_INIT_48MC_GFCLK_SHIFT 13
229#define OMAP4430_CLKACTIVITY_INIT_48MC_GFCLK_WIDTH 0x1
190#define OMAP4430_CLKACTIVITY_INIT_48MC_GFCLK_MASK (1 << 13) 230#define OMAP4430_CLKACTIVITY_INIT_48MC_GFCLK_MASK (1 << 13)
191 231
192/* Used by CM_L3INIT_CLKSTCTRL */ 232/* Used by CM_L3INIT_CLKSTCTRL */
193#define OMAP4430_CLKACTIVITY_INIT_48M_GFCLK_SHIFT 12 233#define OMAP4430_CLKACTIVITY_INIT_48M_GFCLK_SHIFT 12
234#define OMAP4430_CLKACTIVITY_INIT_48M_GFCLK_WIDTH 0x1
194#define OMAP4430_CLKACTIVITY_INIT_48M_GFCLK_MASK (1 << 12) 235#define OMAP4430_CLKACTIVITY_INIT_48M_GFCLK_MASK (1 << 12)
195 236
196/* Used by CM_L3INIT_CLKSTCTRL */ 237/* Used by CM_L3INIT_CLKSTCTRL */
197#define OMAP4430_CLKACTIVITY_INIT_60M_P1_GFCLK_SHIFT 28 238#define OMAP4430_CLKACTIVITY_INIT_60M_P1_GFCLK_SHIFT 28
239#define OMAP4430_CLKACTIVITY_INIT_60M_P1_GFCLK_WIDTH 0x1
198#define OMAP4430_CLKACTIVITY_INIT_60M_P1_GFCLK_MASK (1 << 28) 240#define OMAP4430_CLKACTIVITY_INIT_60M_P1_GFCLK_MASK (1 << 28)
199 241
200/* Used by CM_L3INIT_CLKSTCTRL */ 242/* Used by CM_L3INIT_CLKSTCTRL */
201#define OMAP4430_CLKACTIVITY_INIT_60M_P2_GFCLK_SHIFT 29 243#define OMAP4430_CLKACTIVITY_INIT_60M_P2_GFCLK_SHIFT 29
244#define OMAP4430_CLKACTIVITY_INIT_60M_P2_GFCLK_WIDTH 0x1
202#define OMAP4430_CLKACTIVITY_INIT_60M_P2_GFCLK_MASK (1 << 29) 245#define OMAP4430_CLKACTIVITY_INIT_60M_P2_GFCLK_MASK (1 << 29)
203 246
204/* Used by CM_L3INIT_CLKSTCTRL */ 247/* Used by CM_L3INIT_CLKSTCTRL */
205#define OMAP4430_CLKACTIVITY_INIT_96M_GFCLK_SHIFT 11 248#define OMAP4430_CLKACTIVITY_INIT_96M_GFCLK_SHIFT 11
249#define OMAP4430_CLKACTIVITY_INIT_96M_GFCLK_WIDTH 0x1
206#define OMAP4430_CLKACTIVITY_INIT_96M_GFCLK_MASK (1 << 11) 250#define OMAP4430_CLKACTIVITY_INIT_96M_GFCLK_MASK (1 << 11)
207 251
208/* Used by CM_L3INIT_CLKSTCTRL */ 252/* Used by CM_L3INIT_CLKSTCTRL */
209#define OMAP4430_CLKACTIVITY_INIT_HSI_GFCLK_SHIFT 16 253#define OMAP4430_CLKACTIVITY_INIT_HSI_GFCLK_SHIFT 16
254#define OMAP4430_CLKACTIVITY_INIT_HSI_GFCLK_WIDTH 0x1
210#define OMAP4430_CLKACTIVITY_INIT_HSI_GFCLK_MASK (1 << 16) 255#define OMAP4430_CLKACTIVITY_INIT_HSI_GFCLK_MASK (1 << 16)
211 256
212/* Used by CM_L3INIT_CLKSTCTRL */ 257/* Used by CM_L3INIT_CLKSTCTRL */
213#define OMAP4430_CLKACTIVITY_INIT_HSMMC1_GFCLK_SHIFT 17 258#define OMAP4430_CLKACTIVITY_INIT_HSMMC1_GFCLK_SHIFT 17
259#define OMAP4430_CLKACTIVITY_INIT_HSMMC1_GFCLK_WIDTH 0x1
214#define OMAP4430_CLKACTIVITY_INIT_HSMMC1_GFCLK_MASK (1 << 17) 260#define OMAP4430_CLKACTIVITY_INIT_HSMMC1_GFCLK_MASK (1 << 17)
215 261
216/* Used by CM_L3INIT_CLKSTCTRL */ 262/* Used by CM_L3INIT_CLKSTCTRL */
217#define OMAP4430_CLKACTIVITY_INIT_HSMMC2_GFCLK_SHIFT 18 263#define OMAP4430_CLKACTIVITY_INIT_HSMMC2_GFCLK_SHIFT 18
264#define OMAP4430_CLKACTIVITY_INIT_HSMMC2_GFCLK_WIDTH 0x1
218#define OMAP4430_CLKACTIVITY_INIT_HSMMC2_GFCLK_MASK (1 << 18) 265#define OMAP4430_CLKACTIVITY_INIT_HSMMC2_GFCLK_MASK (1 << 18)
219 266
220/* Used by CM_L3INIT_CLKSTCTRL */ 267/* Used by CM_L3INIT_CLKSTCTRL */
221#define OMAP4430_CLKACTIVITY_INIT_HSMMC6_GFCLK_SHIFT 19 268#define OMAP4430_CLKACTIVITY_INIT_HSMMC6_GFCLK_SHIFT 19
269#define OMAP4430_CLKACTIVITY_INIT_HSMMC6_GFCLK_WIDTH 0x1
222#define OMAP4430_CLKACTIVITY_INIT_HSMMC6_GFCLK_MASK (1 << 19) 270#define OMAP4430_CLKACTIVITY_INIT_HSMMC6_GFCLK_MASK (1 << 19)
223 271
224/* Used by CM_CAM_CLKSTCTRL */ 272/* Used by CM_CAM_CLKSTCTRL */
225#define OMAP4430_CLKACTIVITY_ISS_GCLK_SHIFT 8 273#define OMAP4430_CLKACTIVITY_ISS_GCLK_SHIFT 8
274#define OMAP4430_CLKACTIVITY_ISS_GCLK_WIDTH 0x1
226#define OMAP4430_CLKACTIVITY_ISS_GCLK_MASK (1 << 8) 275#define OMAP4430_CLKACTIVITY_ISS_GCLK_MASK (1 << 8)
227 276
228/* Used by CM_IVAHD_CLKSTCTRL */ 277/* Used by CM_IVAHD_CLKSTCTRL */
229#define OMAP4430_CLKACTIVITY_IVAHD_ROOT_CLK_SHIFT 8 278#define OMAP4430_CLKACTIVITY_IVAHD_ROOT_CLK_SHIFT 8
279#define OMAP4430_CLKACTIVITY_IVAHD_ROOT_CLK_WIDTH 0x1
230#define OMAP4430_CLKACTIVITY_IVAHD_ROOT_CLK_MASK (1 << 8) 280#define OMAP4430_CLKACTIVITY_IVAHD_ROOT_CLK_MASK (1 << 8)
231 281
232/* Used by CM_D2D_CLKSTCTRL */ 282/* Used by CM_D2D_CLKSTCTRL */
233#define OMAP4430_CLKACTIVITY_L3X2_D2D_GICLK_SHIFT 10 283#define OMAP4430_CLKACTIVITY_L3X2_D2D_GICLK_SHIFT 10
284#define OMAP4430_CLKACTIVITY_L3X2_D2D_GICLK_WIDTH 0x1
234#define OMAP4430_CLKACTIVITY_L3X2_D2D_GICLK_MASK (1 << 10) 285#define OMAP4430_CLKACTIVITY_L3X2_D2D_GICLK_MASK (1 << 10)
235 286
236/* Used by CM_L3_1_CLKSTCTRL */ 287/* Used by CM_L3_1_CLKSTCTRL */
237#define OMAP4430_CLKACTIVITY_L3_1_GICLK_SHIFT 8 288#define OMAP4430_CLKACTIVITY_L3_1_GICLK_SHIFT 8
289#define OMAP4430_CLKACTIVITY_L3_1_GICLK_WIDTH 0x1
238#define OMAP4430_CLKACTIVITY_L3_1_GICLK_MASK (1 << 8) 290#define OMAP4430_CLKACTIVITY_L3_1_GICLK_MASK (1 << 8)
239 291
240/* Used by CM_L3_2_CLKSTCTRL */ 292/* Used by CM_L3_2_CLKSTCTRL */
241#define OMAP4430_CLKACTIVITY_L3_2_GICLK_SHIFT 8 293#define OMAP4430_CLKACTIVITY_L3_2_GICLK_SHIFT 8
294#define OMAP4430_CLKACTIVITY_L3_2_GICLK_WIDTH 0x1
242#define OMAP4430_CLKACTIVITY_L3_2_GICLK_MASK (1 << 8) 295#define OMAP4430_CLKACTIVITY_L3_2_GICLK_MASK (1 << 8)
243 296
244/* Used by CM_D2D_CLKSTCTRL */ 297/* Used by CM_D2D_CLKSTCTRL */
245#define OMAP4430_CLKACTIVITY_L3_D2D_GICLK_SHIFT 8 298#define OMAP4430_CLKACTIVITY_L3_D2D_GICLK_SHIFT 8
299#define OMAP4430_CLKACTIVITY_L3_D2D_GICLK_WIDTH 0x1
246#define OMAP4430_CLKACTIVITY_L3_D2D_GICLK_MASK (1 << 8) 300#define OMAP4430_CLKACTIVITY_L3_D2D_GICLK_MASK (1 << 8)
247 301
248/* Used by CM_SDMA_CLKSTCTRL */ 302/* Used by CM_SDMA_CLKSTCTRL */
249#define OMAP4430_CLKACTIVITY_L3_DMA_GICLK_SHIFT 8 303#define OMAP4430_CLKACTIVITY_L3_DMA_GICLK_SHIFT 8
304#define OMAP4430_CLKACTIVITY_L3_DMA_GICLK_WIDTH 0x1
250#define OMAP4430_CLKACTIVITY_L3_DMA_GICLK_MASK (1 << 8) 305#define OMAP4430_CLKACTIVITY_L3_DMA_GICLK_MASK (1 << 8)
251 306
252/* Used by CM_DSS_CLKSTCTRL */ 307/* Used by CM_DSS_CLKSTCTRL */
253#define OMAP4430_CLKACTIVITY_L3_DSS_GICLK_SHIFT 8 308#define OMAP4430_CLKACTIVITY_L3_DSS_GICLK_SHIFT 8
309#define OMAP4430_CLKACTIVITY_L3_DSS_GICLK_WIDTH 0x1
254#define OMAP4430_CLKACTIVITY_L3_DSS_GICLK_MASK (1 << 8) 310#define OMAP4430_CLKACTIVITY_L3_DSS_GICLK_MASK (1 << 8)
255 311
256/* Used by CM_MEMIF_CLKSTCTRL */ 312/* Used by CM_MEMIF_CLKSTCTRL */
257#define OMAP4430_CLKACTIVITY_L3_EMIF_GICLK_SHIFT 8 313#define OMAP4430_CLKACTIVITY_L3_EMIF_GICLK_SHIFT 8
314#define OMAP4430_CLKACTIVITY_L3_EMIF_GICLK_WIDTH 0x1
258#define OMAP4430_CLKACTIVITY_L3_EMIF_GICLK_MASK (1 << 8) 315#define OMAP4430_CLKACTIVITY_L3_EMIF_GICLK_MASK (1 << 8)
259 316
260/* Used by CM_GFX_CLKSTCTRL */ 317/* Used by CM_GFX_CLKSTCTRL */
261#define OMAP4430_CLKACTIVITY_L3_GFX_GICLK_SHIFT 8 318#define OMAP4430_CLKACTIVITY_L3_GFX_GICLK_SHIFT 8
319#define OMAP4430_CLKACTIVITY_L3_GFX_GICLK_WIDTH 0x1
262#define OMAP4430_CLKACTIVITY_L3_GFX_GICLK_MASK (1 << 8) 320#define OMAP4430_CLKACTIVITY_L3_GFX_GICLK_MASK (1 << 8)
263 321
264/* Used by CM_L3INIT_CLKSTCTRL */ 322/* Used by CM_L3INIT_CLKSTCTRL */
265#define OMAP4430_CLKACTIVITY_L3_INIT_GICLK_SHIFT 8 323#define OMAP4430_CLKACTIVITY_L3_INIT_GICLK_SHIFT 8
324#define OMAP4430_CLKACTIVITY_L3_INIT_GICLK_WIDTH 0x1
266#define OMAP4430_CLKACTIVITY_L3_INIT_GICLK_MASK (1 << 8) 325#define OMAP4430_CLKACTIVITY_L3_INIT_GICLK_MASK (1 << 8)
267 326
268/* Used by CM_L3INSTR_CLKSTCTRL */ 327/* Used by CM_L3INSTR_CLKSTCTRL */
269#define OMAP4430_CLKACTIVITY_L3_INSTR_GICLK_SHIFT 8 328#define OMAP4430_CLKACTIVITY_L3_INSTR_GICLK_SHIFT 8
329#define OMAP4430_CLKACTIVITY_L3_INSTR_GICLK_WIDTH 0x1
270#define OMAP4430_CLKACTIVITY_L3_INSTR_GICLK_MASK (1 << 8) 330#define OMAP4430_CLKACTIVITY_L3_INSTR_GICLK_MASK (1 << 8)
271 331
272/* Used by CM_L4SEC_CLKSTCTRL */ 332/* Used by CM_L4SEC_CLKSTCTRL */
273#define OMAP4430_CLKACTIVITY_L3_SECURE_GICLK_SHIFT 8 333#define OMAP4430_CLKACTIVITY_L3_SECURE_GICLK_SHIFT 8
334#define OMAP4430_CLKACTIVITY_L3_SECURE_GICLK_WIDTH 0x1
274#define OMAP4430_CLKACTIVITY_L3_SECURE_GICLK_MASK (1 << 8) 335#define OMAP4430_CLKACTIVITY_L3_SECURE_GICLK_MASK (1 << 8)
275 336
276/* Used by CM_ALWON_CLKSTCTRL */ 337/* Used by CM_ALWON_CLKSTCTRL */
277#define OMAP4430_CLKACTIVITY_L4_AO_ICLK_SHIFT 8 338#define OMAP4430_CLKACTIVITY_L4_AO_ICLK_SHIFT 8
339#define OMAP4430_CLKACTIVITY_L4_AO_ICLK_WIDTH 0x1
278#define OMAP4430_CLKACTIVITY_L4_AO_ICLK_MASK (1 << 8) 340#define OMAP4430_CLKACTIVITY_L4_AO_ICLK_MASK (1 << 8)
279 341
280/* Used by CM_CEFUSE_CLKSTCTRL */ 342/* Used by CM_CEFUSE_CLKSTCTRL */
281#define OMAP4430_CLKACTIVITY_L4_CEFUSE_GICLK_SHIFT 8 343#define OMAP4430_CLKACTIVITY_L4_CEFUSE_GICLK_SHIFT 8
344#define OMAP4430_CLKACTIVITY_L4_CEFUSE_GICLK_WIDTH 0x1
282#define OMAP4430_CLKACTIVITY_L4_CEFUSE_GICLK_MASK (1 << 8) 345#define OMAP4430_CLKACTIVITY_L4_CEFUSE_GICLK_MASK (1 << 8)
283 346
284/* Used by CM_L4CFG_CLKSTCTRL */ 347/* Used by CM_L4CFG_CLKSTCTRL */
285#define OMAP4430_CLKACTIVITY_L4_CFG_GICLK_SHIFT 8 348#define OMAP4430_CLKACTIVITY_L4_CFG_GICLK_SHIFT 8
349#define OMAP4430_CLKACTIVITY_L4_CFG_GICLK_WIDTH 0x1
286#define OMAP4430_CLKACTIVITY_L4_CFG_GICLK_MASK (1 << 8) 350#define OMAP4430_CLKACTIVITY_L4_CFG_GICLK_MASK (1 << 8)
287 351
288/* Used by CM_D2D_CLKSTCTRL */ 352/* Used by CM_D2D_CLKSTCTRL */
289#define OMAP4430_CLKACTIVITY_L4_D2D_GICLK_SHIFT 9 353#define OMAP4430_CLKACTIVITY_L4_D2D_GICLK_SHIFT 9
354#define OMAP4430_CLKACTIVITY_L4_D2D_GICLK_WIDTH 0x1
290#define OMAP4430_CLKACTIVITY_L4_D2D_GICLK_MASK (1 << 9) 355#define OMAP4430_CLKACTIVITY_L4_D2D_GICLK_MASK (1 << 9)
291 356
292/* Used by CM_L3INIT_CLKSTCTRL */ 357/* Used by CM_L3INIT_CLKSTCTRL */
293#define OMAP4430_CLKACTIVITY_L4_INIT_GICLK_SHIFT 9 358#define OMAP4430_CLKACTIVITY_L4_INIT_GICLK_SHIFT 9
359#define OMAP4430_CLKACTIVITY_L4_INIT_GICLK_WIDTH 0x1
294#define OMAP4430_CLKACTIVITY_L4_INIT_GICLK_MASK (1 << 9) 360#define OMAP4430_CLKACTIVITY_L4_INIT_GICLK_MASK (1 << 9)
295 361
296/* Used by CM_L4PER_CLKSTCTRL */ 362/* Used by CM_L4PER_CLKSTCTRL */
297#define OMAP4430_CLKACTIVITY_L4_PER_GICLK_SHIFT 8 363#define OMAP4430_CLKACTIVITY_L4_PER_GICLK_SHIFT 8
364#define OMAP4430_CLKACTIVITY_L4_PER_GICLK_WIDTH 0x1
298#define OMAP4430_CLKACTIVITY_L4_PER_GICLK_MASK (1 << 8) 365#define OMAP4430_CLKACTIVITY_L4_PER_GICLK_MASK (1 << 8)
299 366
300/* Used by CM_L4SEC_CLKSTCTRL */ 367/* Used by CM_L4SEC_CLKSTCTRL */
301#define OMAP4430_CLKACTIVITY_L4_SECURE_GICLK_SHIFT 9 368#define OMAP4430_CLKACTIVITY_L4_SECURE_GICLK_SHIFT 9
369#define OMAP4430_CLKACTIVITY_L4_SECURE_GICLK_WIDTH 0x1
302#define OMAP4430_CLKACTIVITY_L4_SECURE_GICLK_MASK (1 << 9) 370#define OMAP4430_CLKACTIVITY_L4_SECURE_GICLK_MASK (1 << 9)
303 371
304/* Used by CM_WKUP_CLKSTCTRL */ 372/* Used by CM_WKUP_CLKSTCTRL */
305#define OMAP4430_CLKACTIVITY_L4_WKUP_GICLK_SHIFT 12 373#define OMAP4430_CLKACTIVITY_L4_WKUP_GICLK_SHIFT 12
374#define OMAP4430_CLKACTIVITY_L4_WKUP_GICLK_WIDTH 0x1
306#define OMAP4430_CLKACTIVITY_L4_WKUP_GICLK_MASK (1 << 12) 375#define OMAP4430_CLKACTIVITY_L4_WKUP_GICLK_MASK (1 << 12)
307 376
308/* Used by CM_MPU_CLKSTCTRL */ 377/* Used by CM_MPU_CLKSTCTRL */
309#define OMAP4430_CLKACTIVITY_MPU_DPLL_CLK_SHIFT 8 378#define OMAP4430_CLKACTIVITY_MPU_DPLL_CLK_SHIFT 8
379#define OMAP4430_CLKACTIVITY_MPU_DPLL_CLK_WIDTH 0x1
310#define OMAP4430_CLKACTIVITY_MPU_DPLL_CLK_MASK (1 << 8) 380#define OMAP4430_CLKACTIVITY_MPU_DPLL_CLK_MASK (1 << 8)
311 381
312/* Used by CM1_ABE_CLKSTCTRL */ 382/* Used by CM1_ABE_CLKSTCTRL */
313#define OMAP4430_CLKACTIVITY_OCP_ABE_GICLK_SHIFT 9 383#define OMAP4430_CLKACTIVITY_OCP_ABE_GICLK_SHIFT 9
384#define OMAP4430_CLKACTIVITY_OCP_ABE_GICLK_WIDTH 0x1
314#define OMAP4430_CLKACTIVITY_OCP_ABE_GICLK_MASK (1 << 9) 385#define OMAP4430_CLKACTIVITY_OCP_ABE_GICLK_MASK (1 << 9)
315 386
316/* Used by CM_L4PER_CLKSTCTRL */ 387/* Used by CM_L4PER_CLKSTCTRL */
317#define OMAP4430_CLKACTIVITY_PER_24MC_GFCLK_SHIFT 16 388#define OMAP4430_CLKACTIVITY_PER_24MC_GFCLK_SHIFT 16
389#define OMAP4430_CLKACTIVITY_PER_24MC_GFCLK_WIDTH 0x1
318#define OMAP4430_CLKACTIVITY_PER_24MC_GFCLK_MASK (1 << 16) 390#define OMAP4430_CLKACTIVITY_PER_24MC_GFCLK_MASK (1 << 16)
319 391
320/* Used by CM_L4PER_CLKSTCTRL */ 392/* Used by CM_L4PER_CLKSTCTRL */
321#define OMAP4430_CLKACTIVITY_PER_32K_GFCLK_SHIFT 17 393#define OMAP4430_CLKACTIVITY_PER_32K_GFCLK_SHIFT 17
394#define OMAP4430_CLKACTIVITY_PER_32K_GFCLK_WIDTH 0x1
322#define OMAP4430_CLKACTIVITY_PER_32K_GFCLK_MASK (1 << 17) 395#define OMAP4430_CLKACTIVITY_PER_32K_GFCLK_MASK (1 << 17)
323 396
324/* Used by CM_L4PER_CLKSTCTRL */ 397/* Used by CM_L4PER_CLKSTCTRL */
325#define OMAP4430_CLKACTIVITY_PER_48M_GFCLK_SHIFT 18 398#define OMAP4430_CLKACTIVITY_PER_48M_GFCLK_SHIFT 18
399#define OMAP4430_CLKACTIVITY_PER_48M_GFCLK_WIDTH 0x1
326#define OMAP4430_CLKACTIVITY_PER_48M_GFCLK_MASK (1 << 18) 400#define OMAP4430_CLKACTIVITY_PER_48M_GFCLK_MASK (1 << 18)
327 401
328/* Used by CM_L4PER_CLKSTCTRL */ 402/* Used by CM_L4PER_CLKSTCTRL */
329#define OMAP4430_CLKACTIVITY_PER_96M_GFCLK_SHIFT 19 403#define OMAP4430_CLKACTIVITY_PER_96M_GFCLK_SHIFT 19
404#define OMAP4430_CLKACTIVITY_PER_96M_GFCLK_WIDTH 0x1
330#define OMAP4430_CLKACTIVITY_PER_96M_GFCLK_MASK (1 << 19) 405#define OMAP4430_CLKACTIVITY_PER_96M_GFCLK_MASK (1 << 19)
331 406
332/* Used by CM_L4PER_CLKSTCTRL */ 407/* Used by CM_L4PER_CLKSTCTRL */
333#define OMAP4430_CLKACTIVITY_PER_ABE_24M_GFCLK_SHIFT 25 408#define OMAP4430_CLKACTIVITY_PER_ABE_24M_GFCLK_SHIFT 25
409#define OMAP4430_CLKACTIVITY_PER_ABE_24M_GFCLK_WIDTH 0x1
334#define OMAP4430_CLKACTIVITY_PER_ABE_24M_GFCLK_MASK (1 << 25) 410#define OMAP4430_CLKACTIVITY_PER_ABE_24M_GFCLK_MASK (1 << 25)
335 411
336/* Used by CM_L4PER_CLKSTCTRL */ 412/* Used by CM_L4PER_CLKSTCTRL */
337#define OMAP4430_CLKACTIVITY_PER_MCASP2_GFCLK_SHIFT 20 413#define OMAP4430_CLKACTIVITY_PER_MCASP2_GFCLK_SHIFT 20
414#define OMAP4430_CLKACTIVITY_PER_MCASP2_GFCLK_WIDTH 0x1
338#define OMAP4430_CLKACTIVITY_PER_MCASP2_GFCLK_MASK (1 << 20) 415#define OMAP4430_CLKACTIVITY_PER_MCASP2_GFCLK_MASK (1 << 20)
339 416
340/* Used by CM_L4PER_CLKSTCTRL */ 417/* Used by CM_L4PER_CLKSTCTRL */
@@ -343,94 +420,114 @@
343 420
344/* Used by CM_L4PER_CLKSTCTRL */ 421/* Used by CM_L4PER_CLKSTCTRL */
345#define OMAP4430_CLKACTIVITY_PER_MCBSP4_GFCLK_SHIFT 22 422#define OMAP4430_CLKACTIVITY_PER_MCBSP4_GFCLK_SHIFT 22
423#define OMAP4430_CLKACTIVITY_PER_MCBSP4_GFCLK_WIDTH 0x1
346#define OMAP4430_CLKACTIVITY_PER_MCBSP4_GFCLK_MASK (1 << 22) 424#define OMAP4430_CLKACTIVITY_PER_MCBSP4_GFCLK_MASK (1 << 22)
347 425
348/* Used by CM_L4PER_CLKSTCTRL */ 426/* Used by CM_L4PER_CLKSTCTRL */
349#define OMAP4430_CLKACTIVITY_PER_SYS_GFCLK_SHIFT 24 427#define OMAP4430_CLKACTIVITY_PER_SYS_GFCLK_SHIFT 24
428#define OMAP4430_CLKACTIVITY_PER_SYS_GFCLK_WIDTH 0x1
350#define OMAP4430_CLKACTIVITY_PER_SYS_GFCLK_MASK (1 << 24) 429#define OMAP4430_CLKACTIVITY_PER_SYS_GFCLK_MASK (1 << 24)
351 430
352/* Used by CM_MEMIF_CLKSTCTRL */ 431/* Used by CM_MEMIF_CLKSTCTRL */
353#define OMAP4430_CLKACTIVITY_PHY_ROOT_CLK_SHIFT 10 432#define OMAP4430_CLKACTIVITY_PHY_ROOT_CLK_SHIFT 10
433#define OMAP4430_CLKACTIVITY_PHY_ROOT_CLK_WIDTH 0x1
354#define OMAP4430_CLKACTIVITY_PHY_ROOT_CLK_MASK (1 << 10) 434#define OMAP4430_CLKACTIVITY_PHY_ROOT_CLK_MASK (1 << 10)
355 435
356/* Used by CM_GFX_CLKSTCTRL */ 436/* Used by CM_GFX_CLKSTCTRL */
357#define OMAP4430_CLKACTIVITY_SGX_GFCLK_SHIFT 9 437#define OMAP4430_CLKACTIVITY_SGX_GFCLK_SHIFT 9
438#define OMAP4430_CLKACTIVITY_SGX_GFCLK_WIDTH 0x1
358#define OMAP4430_CLKACTIVITY_SGX_GFCLK_MASK (1 << 9) 439#define OMAP4430_CLKACTIVITY_SGX_GFCLK_MASK (1 << 9)
359 440
360/* Used by CM_ALWON_CLKSTCTRL */ 441/* Used by CM_ALWON_CLKSTCTRL */
361#define OMAP4430_CLKACTIVITY_SR_CORE_SYSCLK_SHIFT 11 442#define OMAP4430_CLKACTIVITY_SR_CORE_SYSCLK_SHIFT 11
443#define OMAP4430_CLKACTIVITY_SR_CORE_SYSCLK_WIDTH 0x1
362#define OMAP4430_CLKACTIVITY_SR_CORE_SYSCLK_MASK (1 << 11) 444#define OMAP4430_CLKACTIVITY_SR_CORE_SYSCLK_MASK (1 << 11)
363 445
364/* Used by CM_ALWON_CLKSTCTRL */ 446/* Used by CM_ALWON_CLKSTCTRL */
365#define OMAP4430_CLKACTIVITY_SR_IVA_SYSCLK_SHIFT 10 447#define OMAP4430_CLKACTIVITY_SR_IVA_SYSCLK_SHIFT 10
448#define OMAP4430_CLKACTIVITY_SR_IVA_SYSCLK_WIDTH 0x1
366#define OMAP4430_CLKACTIVITY_SR_IVA_SYSCLK_MASK (1 << 10) 449#define OMAP4430_CLKACTIVITY_SR_IVA_SYSCLK_MASK (1 << 10)
367 450
368/* Used by CM_ALWON_CLKSTCTRL */ 451/* Used by CM_ALWON_CLKSTCTRL */
369#define OMAP4430_CLKACTIVITY_SR_MPU_SYSCLK_SHIFT 9 452#define OMAP4430_CLKACTIVITY_SR_MPU_SYSCLK_SHIFT 9
453#define OMAP4430_CLKACTIVITY_SR_MPU_SYSCLK_WIDTH 0x1
370#define OMAP4430_CLKACTIVITY_SR_MPU_SYSCLK_MASK (1 << 9) 454#define OMAP4430_CLKACTIVITY_SR_MPU_SYSCLK_MASK (1 << 9)
371 455
372/* Used by CM_WKUP_CLKSTCTRL */ 456/* Used by CM_WKUP_CLKSTCTRL */
373#define OMAP4430_CLKACTIVITY_SYS_CLK_SHIFT 8 457#define OMAP4430_CLKACTIVITY_SYS_CLK_SHIFT 8
458#define OMAP4430_CLKACTIVITY_SYS_CLK_WIDTH 0x1
374#define OMAP4430_CLKACTIVITY_SYS_CLK_MASK (1 << 8) 459#define OMAP4430_CLKACTIVITY_SYS_CLK_MASK (1 << 8)
375 460
376/* Used by CM_TESLA_CLKSTCTRL */ 461/* Used by CM_TESLA_CLKSTCTRL */
377#define OMAP4430_CLKACTIVITY_TESLA_ROOT_CLK_SHIFT 8 462#define OMAP4430_CLKACTIVITY_TESLA_ROOT_CLK_SHIFT 8
463#define OMAP4430_CLKACTIVITY_TESLA_ROOT_CLK_WIDTH 0x1
378#define OMAP4430_CLKACTIVITY_TESLA_ROOT_CLK_MASK (1 << 8) 464#define OMAP4430_CLKACTIVITY_TESLA_ROOT_CLK_MASK (1 << 8)
379 465
380/* Used by CM_L3INIT_CLKSTCTRL */ 466/* Used by CM_L3INIT_CLKSTCTRL */
381#define OMAP4430_CLKACTIVITY_TLL_CH0_GFCLK_SHIFT 22 467#define OMAP4430_CLKACTIVITY_TLL_CH0_GFCLK_SHIFT 22
468#define OMAP4430_CLKACTIVITY_TLL_CH0_GFCLK_WIDTH 0x1
382#define OMAP4430_CLKACTIVITY_TLL_CH0_GFCLK_MASK (1 << 22) 469#define OMAP4430_CLKACTIVITY_TLL_CH0_GFCLK_MASK (1 << 22)
383 470
384/* Used by CM_L3INIT_CLKSTCTRL */ 471/* Used by CM_L3INIT_CLKSTCTRL */
385#define OMAP4430_CLKACTIVITY_TLL_CH1_GFCLK_SHIFT 23 472#define OMAP4430_CLKACTIVITY_TLL_CH1_GFCLK_SHIFT 23
473#define OMAP4430_CLKACTIVITY_TLL_CH1_GFCLK_WIDTH 0x1
386#define OMAP4430_CLKACTIVITY_TLL_CH1_GFCLK_MASK (1 << 23) 474#define OMAP4430_CLKACTIVITY_TLL_CH1_GFCLK_MASK (1 << 23)
387 475
388/* Used by CM_L3INIT_CLKSTCTRL */ 476/* Used by CM_L3INIT_CLKSTCTRL */
389#define OMAP4430_CLKACTIVITY_TLL_CH2_GFCLK_SHIFT 24 477#define OMAP4430_CLKACTIVITY_TLL_CH2_GFCLK_SHIFT 24
478#define OMAP4430_CLKACTIVITY_TLL_CH2_GFCLK_WIDTH 0x1
390#define OMAP4430_CLKACTIVITY_TLL_CH2_GFCLK_MASK (1 << 24) 479#define OMAP4430_CLKACTIVITY_TLL_CH2_GFCLK_MASK (1 << 24)
391 480
392/* Used by CM_L3INIT_CLKSTCTRL */ 481/* Used by CM_L3INIT_CLKSTCTRL */
393#define OMAP4430_CLKACTIVITY_UNIPRO_DPLL_CLK_SHIFT 10 482#define OMAP4430_CLKACTIVITY_UNIPRO_DPLL_CLK_SHIFT 10
483#define OMAP4430_CLKACTIVITY_UNIPRO_DPLL_CLK_WIDTH 0x1
394#define OMAP4430_CLKACTIVITY_UNIPRO_DPLL_CLK_MASK (1 << 10) 484#define OMAP4430_CLKACTIVITY_UNIPRO_DPLL_CLK_MASK (1 << 10)
395 485
396/* Used by CM_L3INIT_CLKSTCTRL */ 486/* Used by CM_L3INIT_CLKSTCTRL */
397#define OMAP4430_CLKACTIVITY_USB_DPLL_CLK_SHIFT 14 487#define OMAP4430_CLKACTIVITY_USB_DPLL_CLK_SHIFT 14
488#define OMAP4430_CLKACTIVITY_USB_DPLL_CLK_WIDTH 0x1
398#define OMAP4430_CLKACTIVITY_USB_DPLL_CLK_MASK (1 << 14) 489#define OMAP4430_CLKACTIVITY_USB_DPLL_CLK_MASK (1 << 14)
399 490
400/* Used by CM_L3INIT_CLKSTCTRL */ 491/* Used by CM_L3INIT_CLKSTCTRL */
401#define OMAP4430_CLKACTIVITY_USB_DPLL_HS_CLK_SHIFT 15 492#define OMAP4430_CLKACTIVITY_USB_DPLL_HS_CLK_SHIFT 15
493#define OMAP4430_CLKACTIVITY_USB_DPLL_HS_CLK_WIDTH 0x1
402#define OMAP4430_CLKACTIVITY_USB_DPLL_HS_CLK_MASK (1 << 15) 494#define OMAP4430_CLKACTIVITY_USB_DPLL_HS_CLK_MASK (1 << 15)
403 495
404/* Used by CM_WKUP_CLKSTCTRL */ 496/* Used by CM_WKUP_CLKSTCTRL */
405#define OMAP4430_CLKACTIVITY_USIM_GFCLK_SHIFT 10 497#define OMAP4430_CLKACTIVITY_USIM_GFCLK_SHIFT 10
498#define OMAP4430_CLKACTIVITY_USIM_GFCLK_WIDTH 0x1
406#define OMAP4430_CLKACTIVITY_USIM_GFCLK_MASK (1 << 10) 499#define OMAP4430_CLKACTIVITY_USIM_GFCLK_MASK (1 << 10)
407 500
408/* Used by CM_L3INIT_CLKSTCTRL */ 501/* Used by CM_L3INIT_CLKSTCTRL */
409#define OMAP4430_CLKACTIVITY_UTMI_P3_GFCLK_SHIFT 30 502#define OMAP4430_CLKACTIVITY_UTMI_P3_GFCLK_SHIFT 30
503#define OMAP4430_CLKACTIVITY_UTMI_P3_GFCLK_WIDTH 0x1
410#define OMAP4430_CLKACTIVITY_UTMI_P3_GFCLK_MASK (1 << 30) 504#define OMAP4430_CLKACTIVITY_UTMI_P3_GFCLK_MASK (1 << 30)
411 505
412/* Used by CM_L3INIT_CLKSTCTRL */ 506/* Used by CM_L3INIT_CLKSTCTRL */
413#define OMAP4430_CLKACTIVITY_UTMI_ROOT_GFCLK_SHIFT 25 507#define OMAP4430_CLKACTIVITY_UTMI_ROOT_GFCLK_SHIFT 25
508#define OMAP4430_CLKACTIVITY_UTMI_ROOT_GFCLK_WIDTH 0x1
414#define OMAP4430_CLKACTIVITY_UTMI_ROOT_GFCLK_MASK (1 << 25) 509#define OMAP4430_CLKACTIVITY_UTMI_ROOT_GFCLK_MASK (1 << 25)
415 510
416/* Used by CM_WKUP_CLKSTCTRL */ 511/* Used by CM_WKUP_CLKSTCTRL */
417#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_SHIFT 11 512#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_SHIFT 11
513#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_WIDTH 0x1
418#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_MASK (1 << 11) 514#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_MASK (1 << 11)
419 515
420/* Used by CM_WKUP_CLKSTCTRL */ 516/* Used by CM_WKUP_CLKSTCTRL */
421#define OMAP4460_CLKACTIVITY_WKUP_TS_GFCLK_SHIFT 13 517#define OMAP4460_CLKACTIVITY_WKUP_TS_GFCLK_SHIFT 13
518#define OMAP4460_CLKACTIVITY_WKUP_TS_GFCLK_WIDTH 0x1
422#define OMAP4460_CLKACTIVITY_WKUP_TS_GFCLK_MASK (1 << 13) 519#define OMAP4460_CLKACTIVITY_WKUP_TS_GFCLK_MASK (1 << 13)
423 520
424/* 521/*
425 * Used by CM1_ABE_TIMER5_CLKCTRL, CM1_ABE_TIMER6_CLKCTRL, 522 * Used by CM1_ABE_TIMER5_CLKCTRL, CM1_ABE_TIMER6_CLKCTRL,
426 * CM1_ABE_TIMER7_CLKCTRL, CM1_ABE_TIMER8_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL, 523 * CM1_ABE_TIMER7_CLKCTRL, CM1_ABE_TIMER8_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL,
427 * CM_L3INIT_MMC2_CLKCTRL, CM_L3INIT_MMC6_CLKCTRL, CM_L4PER_DMTIMER10_CLKCTRL, 524 * CM_L3INIT_MMC2_CLKCTRL, CM_L4PER_DMTIMER10_CLKCTRL,
428 * CM_L4PER_DMTIMER11_CLKCTRL, CM_L4PER_DMTIMER2_CLKCTRL, 525 * CM_L4PER_DMTIMER11_CLKCTRL, CM_L4PER_DMTIMER2_CLKCTRL,
429 * CM_L4PER_DMTIMER3_CLKCTRL, CM_L4PER_DMTIMER4_CLKCTRL, 526 * CM_L4PER_DMTIMER3_CLKCTRL, CM_L4PER_DMTIMER4_CLKCTRL,
430 * CM_L4PER_DMTIMER9_CLKCTRL, CM_L4PER_MCASP2_CLKCTRL, CM_L4PER_MCASP3_CLKCTRL, 527 * CM_L4PER_DMTIMER9_CLKCTRL, CM_WKUP_TIMER1_CLKCTRL
431 * CM_WKUP_TIMER1_CLKCTRL
432 */ 528 */
433#define OMAP4430_CLKSEL_SHIFT 24 529#define OMAP4430_CLKSEL_SHIFT 24
530#define OMAP4430_CLKSEL_WIDTH 0x1
434#define OMAP4430_CLKSEL_MASK (1 << 24) 531#define OMAP4430_CLKSEL_MASK (1 << 24)
435 532
436/* 533/*
@@ -438,50 +535,62 @@
438 * CM_CLKSEL_DUCATI_ISS_ROOT, CM_CLKSEL_USB_60MHZ, CM_L4_WKUP_CLKSEL 535 * CM_CLKSEL_DUCATI_ISS_ROOT, CM_CLKSEL_USB_60MHZ, CM_L4_WKUP_CLKSEL
439 */ 536 */
440#define OMAP4430_CLKSEL_0_0_SHIFT 0 537#define OMAP4430_CLKSEL_0_0_SHIFT 0
538#define OMAP4430_CLKSEL_0_0_WIDTH 0x1
441#define OMAP4430_CLKSEL_0_0_MASK (1 << 0) 539#define OMAP4430_CLKSEL_0_0_MASK (1 << 0)
442 540
443/* Renamed from CLKSEL Used by CM_BYPCLK_DPLL_IVA, CM_BYPCLK_DPLL_MPU */ 541/* Renamed from CLKSEL Used by CM_BYPCLK_DPLL_IVA, CM_BYPCLK_DPLL_MPU */
444#define OMAP4430_CLKSEL_0_1_SHIFT 0 542#define OMAP4430_CLKSEL_0_1_SHIFT 0
543#define OMAP4430_CLKSEL_0_1_WIDTH 0x2
445#define OMAP4430_CLKSEL_0_1_MASK (0x3 << 0) 544#define OMAP4430_CLKSEL_0_1_MASK (0x3 << 0)
446 545
447/* Renamed from CLKSEL Used by CM_L3INIT_HSI_CLKCTRL */ 546/* Renamed from CLKSEL Used by CM_L3INIT_HSI_CLKCTRL */
448#define OMAP4430_CLKSEL_24_25_SHIFT 24 547#define OMAP4430_CLKSEL_24_25_SHIFT 24
548#define OMAP4430_CLKSEL_24_25_WIDTH 0x2
449#define OMAP4430_CLKSEL_24_25_MASK (0x3 << 24) 549#define OMAP4430_CLKSEL_24_25_MASK (0x3 << 24)
450 550
451/* Used by CM_L3INIT_USB_OTG_CLKCTRL */ 551/* Used by CM_L3INIT_USB_OTG_CLKCTRL */
452#define OMAP4430_CLKSEL_60M_SHIFT 24 552#define OMAP4430_CLKSEL_60M_SHIFT 24
553#define OMAP4430_CLKSEL_60M_WIDTH 0x1
453#define OMAP4430_CLKSEL_60M_MASK (1 << 24) 554#define OMAP4430_CLKSEL_60M_MASK (1 << 24)
454 555
455/* Used by CM_MPU_MPU_CLKCTRL */ 556/* Used by CM_MPU_MPU_CLKCTRL */
456#define OMAP4460_CLKSEL_ABE_DIV_MODE_SHIFT 25 557#define OMAP4460_CLKSEL_ABE_DIV_MODE_SHIFT 25
558#define OMAP4460_CLKSEL_ABE_DIV_MODE_WIDTH 0x1
457#define OMAP4460_CLKSEL_ABE_DIV_MODE_MASK (1 << 25) 559#define OMAP4460_CLKSEL_ABE_DIV_MODE_MASK (1 << 25)
458 560
459/* Used by CM1_ABE_AESS_CLKCTRL */ 561/* Used by CM1_ABE_AESS_CLKCTRL */
460#define OMAP4430_CLKSEL_AESS_FCLK_SHIFT 24 562#define OMAP4430_CLKSEL_AESS_FCLK_SHIFT 24
563#define OMAP4430_CLKSEL_AESS_FCLK_WIDTH 0x1
461#define OMAP4430_CLKSEL_AESS_FCLK_MASK (1 << 24) 564#define OMAP4430_CLKSEL_AESS_FCLK_MASK (1 << 24)
462 565
463/* Used by CM_CLKSEL_CORE */ 566/* Used by CM_CLKSEL_CORE */
464#define OMAP4430_CLKSEL_CORE_SHIFT 0 567#define OMAP4430_CLKSEL_CORE_SHIFT 0
568#define OMAP4430_CLKSEL_CORE_WIDTH 0x1
465#define OMAP4430_CLKSEL_CORE_MASK (1 << 0) 569#define OMAP4430_CLKSEL_CORE_MASK (1 << 0)
466 570
467/* Renamed from CLKSEL_CORE Used by CM_SHADOW_FREQ_CONFIG2 */ 571/* Renamed from CLKSEL_CORE Used by CM_SHADOW_FREQ_CONFIG2 */
468#define OMAP4430_CLKSEL_CORE_1_1_SHIFT 1 572#define OMAP4430_CLKSEL_CORE_1_1_SHIFT 1
573#define OMAP4430_CLKSEL_CORE_1_1_WIDTH 0x1
469#define OMAP4430_CLKSEL_CORE_1_1_MASK (1 << 1) 574#define OMAP4430_CLKSEL_CORE_1_1_MASK (1 << 1)
470 575
471/* Used by CM_WKUP_USIM_CLKCTRL */ 576/* Used by CM_WKUP_USIM_CLKCTRL */
472#define OMAP4430_CLKSEL_DIV_SHIFT 24 577#define OMAP4430_CLKSEL_DIV_SHIFT 24
578#define OMAP4430_CLKSEL_DIV_WIDTH 0x1
473#define OMAP4430_CLKSEL_DIV_MASK (1 << 24) 579#define OMAP4430_CLKSEL_DIV_MASK (1 << 24)
474 580
475/* Used by CM_MPU_MPU_CLKCTRL */ 581/* Used by CM_MPU_MPU_CLKCTRL */
476#define OMAP4460_CLKSEL_EMIF_DIV_MODE_SHIFT 24 582#define OMAP4460_CLKSEL_EMIF_DIV_MODE_SHIFT 24
583#define OMAP4460_CLKSEL_EMIF_DIV_MODE_WIDTH 0x1
477#define OMAP4460_CLKSEL_EMIF_DIV_MODE_MASK (1 << 24) 584#define OMAP4460_CLKSEL_EMIF_DIV_MODE_MASK (1 << 24)
478 585
479/* Used by CM_CAM_FDIF_CLKCTRL */ 586/* Used by CM_CAM_FDIF_CLKCTRL */
480#define OMAP4430_CLKSEL_FCLK_SHIFT 24 587#define OMAP4430_CLKSEL_FCLK_SHIFT 24
588#define OMAP4430_CLKSEL_FCLK_WIDTH 0x2
481#define OMAP4430_CLKSEL_FCLK_MASK (0x3 << 24) 589#define OMAP4430_CLKSEL_FCLK_MASK (0x3 << 24)
482 590
483/* Used by CM_L4PER_MCBSP4_CLKCTRL */ 591/* Used by CM_L4PER_MCBSP4_CLKCTRL */
484#define OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT 25 592#define OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT 25
593#define OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH 0x1
485#define OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK (1 << 25) 594#define OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK (1 << 25)
486 595
487/* 596/*
@@ -490,34 +599,42 @@
490 * CM1_ABE_MCBSP3_CLKCTRL 599 * CM1_ABE_MCBSP3_CLKCTRL
491 */ 600 */
492#define OMAP4430_CLKSEL_INTERNAL_SOURCE_CM1_ABE_DMIC_SHIFT 26 601#define OMAP4430_CLKSEL_INTERNAL_SOURCE_CM1_ABE_DMIC_SHIFT 26
602#define OMAP4430_CLKSEL_INTERNAL_SOURCE_CM1_ABE_DMIC_WIDTH 0x2
493#define OMAP4430_CLKSEL_INTERNAL_SOURCE_CM1_ABE_DMIC_MASK (0x3 << 26) 603#define OMAP4430_CLKSEL_INTERNAL_SOURCE_CM1_ABE_DMIC_MASK (0x3 << 26)
494 604
495/* Used by CM_CLKSEL_CORE */ 605/* Used by CM_CLKSEL_CORE */
496#define OMAP4430_CLKSEL_L3_SHIFT 4 606#define OMAP4430_CLKSEL_L3_SHIFT 4
607#define OMAP4430_CLKSEL_L3_WIDTH 0x1
497#define OMAP4430_CLKSEL_L3_MASK (1 << 4) 608#define OMAP4430_CLKSEL_L3_MASK (1 << 4)
498 609
499/* Renamed from CLKSEL_L3 Used by CM_SHADOW_FREQ_CONFIG2 */ 610/* Renamed from CLKSEL_L3 Used by CM_SHADOW_FREQ_CONFIG2 */
500#define OMAP4430_CLKSEL_L3_SHADOW_SHIFT 2 611#define OMAP4430_CLKSEL_L3_SHADOW_SHIFT 2
612#define OMAP4430_CLKSEL_L3_SHADOW_WIDTH 0x1
501#define OMAP4430_CLKSEL_L3_SHADOW_MASK (1 << 2) 613#define OMAP4430_CLKSEL_L3_SHADOW_MASK (1 << 2)
502 614
503/* Used by CM_CLKSEL_CORE */ 615/* Used by CM_CLKSEL_CORE */
504#define OMAP4430_CLKSEL_L4_SHIFT 8 616#define OMAP4430_CLKSEL_L4_SHIFT 8
617#define OMAP4430_CLKSEL_L4_WIDTH 0x1
505#define OMAP4430_CLKSEL_L4_MASK (1 << 8) 618#define OMAP4430_CLKSEL_L4_MASK (1 << 8)
506 619
507/* Used by CM_CLKSEL_ABE */ 620/* Used by CM_CLKSEL_ABE */
508#define OMAP4430_CLKSEL_OPP_SHIFT 0 621#define OMAP4430_CLKSEL_OPP_SHIFT 0
622#define OMAP4430_CLKSEL_OPP_WIDTH 0x2
509#define OMAP4430_CLKSEL_OPP_MASK (0x3 << 0) 623#define OMAP4430_CLKSEL_OPP_MASK (0x3 << 0)
510 624
511/* Used by CM_EMU_DEBUGSS_CLKCTRL */ 625/* Used by CM_EMU_DEBUGSS_CLKCTRL */
512#define OMAP4430_CLKSEL_PMD_STM_CLK_SHIFT 27 626#define OMAP4430_CLKSEL_PMD_STM_CLK_SHIFT 27
627#define OMAP4430_CLKSEL_PMD_STM_CLK_WIDTH 0x3
513#define OMAP4430_CLKSEL_PMD_STM_CLK_MASK (0x7 << 27) 628#define OMAP4430_CLKSEL_PMD_STM_CLK_MASK (0x7 << 27)
514 629
515/* Used by CM_EMU_DEBUGSS_CLKCTRL */ 630/* Used by CM_EMU_DEBUGSS_CLKCTRL */
516#define OMAP4430_CLKSEL_PMD_TRACE_CLK_SHIFT 24 631#define OMAP4430_CLKSEL_PMD_TRACE_CLK_SHIFT 24
632#define OMAP4430_CLKSEL_PMD_TRACE_CLK_WIDTH 0x3
517#define OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK (0x7 << 24) 633#define OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK (0x7 << 24)
518 634
519/* Used by CM_GFX_GFX_CLKCTRL */ 635/* Used by CM_GFX_GFX_CLKCTRL */
520#define OMAP4430_CLKSEL_SGX_FCLK_SHIFT 24 636#define OMAP4430_CLKSEL_SGX_FCLK_SHIFT 24
637#define OMAP4430_CLKSEL_SGX_FCLK_WIDTH 0x1
521#define OMAP4430_CLKSEL_SGX_FCLK_MASK (1 << 24) 638#define OMAP4430_CLKSEL_SGX_FCLK_MASK (1 << 24)
522 639
523/* 640/*
@@ -525,18 +642,22 @@
525 * CM1_ABE_MCBSP2_CLKCTRL, CM1_ABE_MCBSP3_CLKCTRL 642 * CM1_ABE_MCBSP2_CLKCTRL, CM1_ABE_MCBSP3_CLKCTRL
526 */ 643 */
527#define OMAP4430_CLKSEL_SOURCE_SHIFT 24 644#define OMAP4430_CLKSEL_SOURCE_SHIFT 24
645#define OMAP4430_CLKSEL_SOURCE_WIDTH 0x2
528#define OMAP4430_CLKSEL_SOURCE_MASK (0x3 << 24) 646#define OMAP4430_CLKSEL_SOURCE_MASK (0x3 << 24)
529 647
530/* Renamed from CLKSEL_SOURCE Used by CM_L4PER_MCBSP4_CLKCTRL */ 648/* Renamed from CLKSEL_SOURCE Used by CM_L4PER_MCBSP4_CLKCTRL */
531#define OMAP4430_CLKSEL_SOURCE_24_24_SHIFT 24 649#define OMAP4430_CLKSEL_SOURCE_24_24_SHIFT 24
650#define OMAP4430_CLKSEL_SOURCE_24_24_WIDTH 0x1
532#define OMAP4430_CLKSEL_SOURCE_24_24_MASK (1 << 24) 651#define OMAP4430_CLKSEL_SOURCE_24_24_MASK (1 << 24)
533 652
534/* Used by CM_L3INIT_USB_HOST_CLKCTRL */ 653/* Used by CM_L3INIT_USB_HOST_CLKCTRL */
535#define OMAP4430_CLKSEL_UTMI_P1_SHIFT 24 654#define OMAP4430_CLKSEL_UTMI_P1_SHIFT 24
655#define OMAP4430_CLKSEL_UTMI_P1_WIDTH 0x1
536#define OMAP4430_CLKSEL_UTMI_P1_MASK (1 << 24) 656#define OMAP4430_CLKSEL_UTMI_P1_MASK (1 << 24)
537 657
538/* Used by CM_L3INIT_USB_HOST_CLKCTRL */ 658/* Used by CM_L3INIT_USB_HOST_CLKCTRL */
539#define OMAP4430_CLKSEL_UTMI_P2_SHIFT 25 659#define OMAP4430_CLKSEL_UTMI_P2_SHIFT 25
660#define OMAP4430_CLKSEL_UTMI_P2_WIDTH 0x1
540#define OMAP4430_CLKSEL_UTMI_P2_MASK (1 << 25) 661#define OMAP4430_CLKSEL_UTMI_P2_MASK (1 << 25)
541 662
542/* 663/*
@@ -549,30 +670,37 @@
549 * CM_TESLA_CLKSTCTRL, CM_WKUP_CLKSTCTRL 670 * CM_TESLA_CLKSTCTRL, CM_WKUP_CLKSTCTRL
550 */ 671 */
551#define OMAP4430_CLKTRCTRL_SHIFT 0 672#define OMAP4430_CLKTRCTRL_SHIFT 0
673#define OMAP4430_CLKTRCTRL_WIDTH 0x2
552#define OMAP4430_CLKTRCTRL_MASK (0x3 << 0) 674#define OMAP4430_CLKTRCTRL_MASK (0x3 << 0)
553 675
554/* Used by CM_EMU_OVERRIDE_DPLL_CORE */ 676/* Used by CM_EMU_OVERRIDE_DPLL_CORE */
555#define OMAP4430_CORE_DPLL_EMU_DIV_SHIFT 0 677#define OMAP4430_CORE_DPLL_EMU_DIV_SHIFT 0
678#define OMAP4430_CORE_DPLL_EMU_DIV_WIDTH 0x7
556#define OMAP4430_CORE_DPLL_EMU_DIV_MASK (0x7f << 0) 679#define OMAP4430_CORE_DPLL_EMU_DIV_MASK (0x7f << 0)
557 680
558/* Used by CM_EMU_OVERRIDE_DPLL_CORE */ 681/* Used by CM_EMU_OVERRIDE_DPLL_CORE */
559#define OMAP4430_CORE_DPLL_EMU_MULT_SHIFT 8 682#define OMAP4430_CORE_DPLL_EMU_MULT_SHIFT 8
683#define OMAP4430_CORE_DPLL_EMU_MULT_WIDTH 0xb
560#define OMAP4430_CORE_DPLL_EMU_MULT_MASK (0x7ff << 8) 684#define OMAP4430_CORE_DPLL_EMU_MULT_MASK (0x7ff << 8)
561 685
562/* Used by REVISION_CM1, REVISION_CM2 */ 686/* Used by REVISION_CM1, REVISION_CM2 */
563#define OMAP4430_CUSTOM_SHIFT 6 687#define OMAP4430_CUSTOM_SHIFT 6
688#define OMAP4430_CUSTOM_WIDTH 0x2
564#define OMAP4430_CUSTOM_MASK (0x3 << 6) 689#define OMAP4430_CUSTOM_MASK (0x3 << 6)
565 690
566/* Used by CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP */ 691/* Used by CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP */
567#define OMAP4430_D2D_DYNDEP_SHIFT 18 692#define OMAP4430_D2D_DYNDEP_SHIFT 18
693#define OMAP4430_D2D_DYNDEP_WIDTH 0x1
568#define OMAP4430_D2D_DYNDEP_MASK (1 << 18) 694#define OMAP4430_D2D_DYNDEP_MASK (1 << 18)
569 695
570/* Used by CM_MPU_STATICDEP */ 696/* Used by CM_MPU_STATICDEP */
571#define OMAP4430_D2D_STATDEP_SHIFT 18 697#define OMAP4430_D2D_STATDEP_SHIFT 18
698#define OMAP4430_D2D_STATDEP_WIDTH 0x1
572#define OMAP4430_D2D_STATDEP_MASK (1 << 18) 699#define OMAP4430_D2D_STATDEP_MASK (1 << 18)
573 700
574/* Used by CM_CLKSEL_DPLL_MPU */ 701/* Used by CM_CLKSEL_DPLL_MPU */
575#define OMAP4460_DCC_COUNT_MAX_SHIFT 24 702#define OMAP4460_DCC_COUNT_MAX_SHIFT 24
703#define OMAP4460_DCC_COUNT_MAX_WIDTH 0x8
576#define OMAP4460_DCC_COUNT_MAX_MASK (0xff << 24) 704#define OMAP4460_DCC_COUNT_MAX_MASK (0xff << 24)
577 705
578/* Used by CM_CLKSEL_DPLL_MPU */ 706/* Used by CM_CLKSEL_DPLL_MPU */
@@ -586,22 +714,27 @@
586 * CM_SSC_DELTAMSTEP_DPLL_UNIPRO, CM_SSC_DELTAMSTEP_DPLL_USB 714 * CM_SSC_DELTAMSTEP_DPLL_UNIPRO, CM_SSC_DELTAMSTEP_DPLL_USB
587 */ 715 */
588#define OMAP4430_DELTAMSTEP_SHIFT 0 716#define OMAP4430_DELTAMSTEP_SHIFT 0
717#define OMAP4430_DELTAMSTEP_WIDTH 0x14
589#define OMAP4430_DELTAMSTEP_MASK (0xfffff << 0) 718#define OMAP4430_DELTAMSTEP_MASK (0xfffff << 0)
590 719
591/* Renamed from DELTAMSTEP Used by CM_SSC_DELTAMSTEP_DPLL_USB */ 720/* Renamed from DELTAMSTEP Used by CM_SSC_DELTAMSTEP_DPLL_USB */
592#define OMAP4460_DELTAMSTEP_0_20_SHIFT 0 721#define OMAP4460_DELTAMSTEP_0_20_SHIFT 0
722#define OMAP4460_DELTAMSTEP_0_20_WIDTH 0x15
593#define OMAP4460_DELTAMSTEP_0_20_MASK (0x1fffff << 0) 723#define OMAP4460_DELTAMSTEP_0_20_MASK (0x1fffff << 0)
594 724
595/* Used by CM_DLL_CTRL */ 725/* Used by CM_DLL_CTRL */
596#define OMAP4430_DLL_OVERRIDE_SHIFT 0 726#define OMAP4430_DLL_OVERRIDE_SHIFT 0
727#define OMAP4430_DLL_OVERRIDE_WIDTH 0x1
597#define OMAP4430_DLL_OVERRIDE_MASK (1 << 0) 728#define OMAP4430_DLL_OVERRIDE_MASK (1 << 0)
598 729
599/* Renamed from DLL_OVERRIDE Used by CM_SHADOW_FREQ_CONFIG1 */ 730/* Renamed from DLL_OVERRIDE Used by CM_SHADOW_FREQ_CONFIG1 */
600#define OMAP4430_DLL_OVERRIDE_2_2_SHIFT 2 731#define OMAP4430_DLL_OVERRIDE_2_2_SHIFT 2
732#define OMAP4430_DLL_OVERRIDE_2_2_WIDTH 0x1
601#define OMAP4430_DLL_OVERRIDE_2_2_MASK (1 << 2) 733#define OMAP4430_DLL_OVERRIDE_2_2_MASK (1 << 2)
602 734
603/* Used by CM_SHADOW_FREQ_CONFIG1 */ 735/* Used by CM_SHADOW_FREQ_CONFIG1 */
604#define OMAP4430_DLL_RESET_SHIFT 3 736#define OMAP4430_DLL_RESET_SHIFT 3
737#define OMAP4430_DLL_RESET_WIDTH 0x1
605#define OMAP4430_DLL_RESET_MASK (1 << 3) 738#define OMAP4430_DLL_RESET_MASK (1 << 3)
606 739
607/* 740/*
@@ -610,30 +743,37 @@
610 * CM_CLKSEL_DPLL_UNIPRO, CM_CLKSEL_DPLL_USB 743 * CM_CLKSEL_DPLL_UNIPRO, CM_CLKSEL_DPLL_USB
611 */ 744 */
612#define OMAP4430_DPLL_BYP_CLKSEL_SHIFT 23 745#define OMAP4430_DPLL_BYP_CLKSEL_SHIFT 23
746#define OMAP4430_DPLL_BYP_CLKSEL_WIDTH 0x1
613#define OMAP4430_DPLL_BYP_CLKSEL_MASK (1 << 23) 747#define OMAP4430_DPLL_BYP_CLKSEL_MASK (1 << 23)
614 748
615/* Used by CM_CLKDCOLDO_DPLL_USB */ 749/* Used by CM_CLKDCOLDO_DPLL_USB */
616#define OMAP4430_DPLL_CLKDCOLDO_GATE_CTRL_SHIFT 8 750#define OMAP4430_DPLL_CLKDCOLDO_GATE_CTRL_SHIFT 8
751#define OMAP4430_DPLL_CLKDCOLDO_GATE_CTRL_WIDTH 0x1
617#define OMAP4430_DPLL_CLKDCOLDO_GATE_CTRL_MASK (1 << 8) 752#define OMAP4430_DPLL_CLKDCOLDO_GATE_CTRL_MASK (1 << 8)
618 753
619/* Used by CM_CLKSEL_DPLL_CORE */ 754/* Used by CM_CLKSEL_DPLL_CORE */
620#define OMAP4430_DPLL_CLKOUTHIF_CLKSEL_SHIFT 20 755#define OMAP4430_DPLL_CLKOUTHIF_CLKSEL_SHIFT 20
756#define OMAP4430_DPLL_CLKOUTHIF_CLKSEL_WIDTH 0x1
621#define OMAP4430_DPLL_CLKOUTHIF_CLKSEL_MASK (1 << 20) 757#define OMAP4430_DPLL_CLKOUTHIF_CLKSEL_MASK (1 << 20)
622 758
623/* Used by CM_DIV_M3_DPLL_ABE, CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_PER */ 759/* Used by CM_DIV_M3_DPLL_ABE, CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_PER */
624#define OMAP4430_DPLL_CLKOUTHIF_DIV_SHIFT 0 760#define OMAP4430_DPLL_CLKOUTHIF_DIV_SHIFT 0
761#define OMAP4430_DPLL_CLKOUTHIF_DIV_WIDTH 0x5
625#define OMAP4430_DPLL_CLKOUTHIF_DIV_MASK (0x1f << 0) 762#define OMAP4430_DPLL_CLKOUTHIF_DIV_MASK (0x1f << 0)
626 763
627/* Used by CM_DIV_M3_DPLL_ABE, CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_PER */ 764/* Used by CM_DIV_M3_DPLL_ABE, CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_PER */
628#define OMAP4430_DPLL_CLKOUTHIF_DIVCHACK_SHIFT 5 765#define OMAP4430_DPLL_CLKOUTHIF_DIVCHACK_SHIFT 5
766#define OMAP4430_DPLL_CLKOUTHIF_DIVCHACK_WIDTH 0x1
629#define OMAP4430_DPLL_CLKOUTHIF_DIVCHACK_MASK (1 << 5) 767#define OMAP4430_DPLL_CLKOUTHIF_DIVCHACK_MASK (1 << 5)
630 768
631/* Used by CM_DIV_M3_DPLL_ABE, CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_PER */ 769/* Used by CM_DIV_M3_DPLL_ABE, CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_PER */
632#define OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT 8 770#define OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT 8
771#define OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_WIDTH 0x1
633#define OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_MASK (1 << 8) 772#define OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_MASK (1 << 8)
634 773
635/* Used by CM_DIV_M2_DPLL_ABE, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO */ 774/* Used by CM_DIV_M2_DPLL_ABE, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO */
636#define OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_SHIFT 10 775#define OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_SHIFT 10
776#define OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_WIDTH 0x1
637#define OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK (1 << 10) 777#define OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK (1 << 10)
638 778
639/* 779/*
@@ -641,10 +781,12 @@
641 * CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO 781 * CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO
642 */ 782 */
643#define OMAP4430_DPLL_CLKOUT_DIV_SHIFT 0 783#define OMAP4430_DPLL_CLKOUT_DIV_SHIFT 0
784#define OMAP4430_DPLL_CLKOUT_DIV_WIDTH 0x5
644#define OMAP4430_DPLL_CLKOUT_DIV_MASK (0x1f << 0) 785#define OMAP4430_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
645 786
646/* Renamed from DPLL_CLKOUT_DIV Used by CM_DIV_M2_DPLL_USB */ 787/* Renamed from DPLL_CLKOUT_DIV Used by CM_DIV_M2_DPLL_USB */
647#define OMAP4430_DPLL_CLKOUT_DIV_0_6_SHIFT 0 788#define OMAP4430_DPLL_CLKOUT_DIV_0_6_SHIFT 0
789#define OMAP4430_DPLL_CLKOUT_DIV_0_6_WIDTH 0x7
648#define OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK (0x7f << 0) 790#define OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK (0x7f << 0)
649 791
650/* 792/*
@@ -652,10 +794,12 @@
652 * CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO 794 * CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO
653 */ 795 */
654#define OMAP4430_DPLL_CLKOUT_DIVCHACK_SHIFT 5 796#define OMAP4430_DPLL_CLKOUT_DIVCHACK_SHIFT 5
797#define OMAP4430_DPLL_CLKOUT_DIVCHACK_WIDTH 0x1
655#define OMAP4430_DPLL_CLKOUT_DIVCHACK_MASK (1 << 5) 798#define OMAP4430_DPLL_CLKOUT_DIVCHACK_MASK (1 << 5)
656 799
657/* Renamed from DPLL_CLKOUT_DIVCHACK Used by CM_DIV_M2_DPLL_USB */ 800/* Renamed from DPLL_CLKOUT_DIVCHACK Used by CM_DIV_M2_DPLL_USB */
658#define OMAP4430_DPLL_CLKOUT_DIVCHACK_M2_USB_SHIFT 7 801#define OMAP4430_DPLL_CLKOUT_DIVCHACK_M2_USB_SHIFT 7
802#define OMAP4430_DPLL_CLKOUT_DIVCHACK_M2_USB_WIDTH 0x1
659#define OMAP4430_DPLL_CLKOUT_DIVCHACK_M2_USB_MASK (1 << 7) 803#define OMAP4430_DPLL_CLKOUT_DIVCHACK_M2_USB_MASK (1 << 7)
660 804
661/* 805/*
@@ -663,18 +807,22 @@
663 * CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_USB 807 * CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_USB
664 */ 808 */
665#define OMAP4430_DPLL_CLKOUT_GATE_CTRL_SHIFT 8 809#define OMAP4430_DPLL_CLKOUT_GATE_CTRL_SHIFT 8
810#define OMAP4430_DPLL_CLKOUT_GATE_CTRL_WIDTH 0x1
666#define OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK (1 << 8) 811#define OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK (1 << 8)
667 812
668/* Used by CM_SHADOW_FREQ_CONFIG1 */ 813/* Used by CM_SHADOW_FREQ_CONFIG1 */
669#define OMAP4430_DPLL_CORE_DPLL_EN_SHIFT 8 814#define OMAP4430_DPLL_CORE_DPLL_EN_SHIFT 8
815#define OMAP4430_DPLL_CORE_DPLL_EN_WIDTH 0x3
670#define OMAP4430_DPLL_CORE_DPLL_EN_MASK (0x7 << 8) 816#define OMAP4430_DPLL_CORE_DPLL_EN_MASK (0x7 << 8)
671 817
672/* Used by CM_SHADOW_FREQ_CONFIG1 */ 818/* Used by CM_SHADOW_FREQ_CONFIG1 */
673#define OMAP4430_DPLL_CORE_M2_DIV_SHIFT 11 819#define OMAP4430_DPLL_CORE_M2_DIV_SHIFT 11
820#define OMAP4430_DPLL_CORE_M2_DIV_WIDTH 0x5
674#define OMAP4430_DPLL_CORE_M2_DIV_MASK (0x1f << 11) 821#define OMAP4430_DPLL_CORE_M2_DIV_MASK (0x1f << 11)
675 822
676/* Used by CM_SHADOW_FREQ_CONFIG2 */ 823/* Used by CM_SHADOW_FREQ_CONFIG2 */
677#define OMAP4430_DPLL_CORE_M5_DIV_SHIFT 3 824#define OMAP4430_DPLL_CORE_M5_DIV_SHIFT 3
825#define OMAP4430_DPLL_CORE_M5_DIV_WIDTH 0x5
678#define OMAP4430_DPLL_CORE_M5_DIV_MASK (0x1f << 3) 826#define OMAP4430_DPLL_CORE_M5_DIV_MASK (0x1f << 3)
679 827
680/* 828/*
@@ -683,10 +831,12 @@
683 * CM_CLKSEL_DPLL_UNIPRO 831 * CM_CLKSEL_DPLL_UNIPRO
684 */ 832 */
685#define OMAP4430_DPLL_DIV_SHIFT 0 833#define OMAP4430_DPLL_DIV_SHIFT 0
834#define OMAP4430_DPLL_DIV_WIDTH 0x7
686#define OMAP4430_DPLL_DIV_MASK (0x7f << 0) 835#define OMAP4430_DPLL_DIV_MASK (0x7f << 0)
687 836
688/* Renamed from DPLL_DIV Used by CM_CLKSEL_DPLL_USB */ 837/* Renamed from DPLL_DIV Used by CM_CLKSEL_DPLL_USB */
689#define OMAP4430_DPLL_DIV_0_7_SHIFT 0 838#define OMAP4430_DPLL_DIV_0_7_SHIFT 0
839#define OMAP4430_DPLL_DIV_0_7_WIDTH 0x8
690#define OMAP4430_DPLL_DIV_0_7_MASK (0xff << 0) 840#define OMAP4430_DPLL_DIV_0_7_MASK (0xff << 0)
691 841
692/* 842/*
@@ -694,10 +844,12 @@
694 * CM_CLKMODE_DPLL_IVA, CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER 844 * CM_CLKMODE_DPLL_IVA, CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
695 */ 845 */
696#define OMAP4430_DPLL_DRIFTGUARD_EN_SHIFT 8 846#define OMAP4430_DPLL_DRIFTGUARD_EN_SHIFT 8
847#define OMAP4430_DPLL_DRIFTGUARD_EN_WIDTH 0x1
697#define OMAP4430_DPLL_DRIFTGUARD_EN_MASK (1 << 8) 848#define OMAP4430_DPLL_DRIFTGUARD_EN_MASK (1 << 8)
698 849
699/* Renamed from DPLL_DRIFTGUARD_EN Used by CM_CLKMODE_DPLL_UNIPRO */ 850/* Renamed from DPLL_DRIFTGUARD_EN Used by CM_CLKMODE_DPLL_UNIPRO */
700#define OMAP4430_DPLL_DRIFTGUARD_EN_3_3_SHIFT 3 851#define OMAP4430_DPLL_DRIFTGUARD_EN_3_3_SHIFT 3
852#define OMAP4430_DPLL_DRIFTGUARD_EN_3_3_WIDTH 0x1
701#define OMAP4430_DPLL_DRIFTGUARD_EN_3_3_MASK (1 << 3) 853#define OMAP4430_DPLL_DRIFTGUARD_EN_3_3_MASK (1 << 3)
702 854
703/* 855/*
@@ -706,6 +858,7 @@
706 * CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB 858 * CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB
707 */ 859 */
708#define OMAP4430_DPLL_EN_SHIFT 0 860#define OMAP4430_DPLL_EN_SHIFT 0
861#define OMAP4430_DPLL_EN_WIDTH 0x3
709#define OMAP4430_DPLL_EN_MASK (0x7 << 0) 862#define OMAP4430_DPLL_EN_MASK (0x7 << 0)
710 863
711/* 864/*
@@ -714,6 +867,7 @@
714 * CM_CLKMODE_DPLL_UNIPRO 867 * CM_CLKMODE_DPLL_UNIPRO
715 */ 868 */
716#define OMAP4430_DPLL_LPMODE_EN_SHIFT 10 869#define OMAP4430_DPLL_LPMODE_EN_SHIFT 10
870#define OMAP4430_DPLL_LPMODE_EN_WIDTH 0x1
717#define OMAP4430_DPLL_LPMODE_EN_MASK (1 << 10) 871#define OMAP4430_DPLL_LPMODE_EN_MASK (1 << 10)
718 872
719/* 873/*
@@ -722,10 +876,12 @@
722 * CM_CLKSEL_DPLL_UNIPRO 876 * CM_CLKSEL_DPLL_UNIPRO
723 */ 877 */
724#define OMAP4430_DPLL_MULT_SHIFT 8 878#define OMAP4430_DPLL_MULT_SHIFT 8
879#define OMAP4430_DPLL_MULT_WIDTH 0xb
725#define OMAP4430_DPLL_MULT_MASK (0x7ff << 8) 880#define OMAP4430_DPLL_MULT_MASK (0x7ff << 8)
726 881
727/* Renamed from DPLL_MULT Used by CM_CLKSEL_DPLL_USB */ 882/* Renamed from DPLL_MULT Used by CM_CLKSEL_DPLL_USB */
728#define OMAP4430_DPLL_MULT_USB_SHIFT 8 883#define OMAP4430_DPLL_MULT_USB_SHIFT 8
884#define OMAP4430_DPLL_MULT_USB_WIDTH 0xc
729#define OMAP4430_DPLL_MULT_USB_MASK (0xfff << 8) 885#define OMAP4430_DPLL_MULT_USB_MASK (0xfff << 8)
730 886
731/* 887/*
@@ -734,10 +890,12 @@
734 * CM_CLKMODE_DPLL_UNIPRO 890 * CM_CLKMODE_DPLL_UNIPRO
735 */ 891 */
736#define OMAP4430_DPLL_REGM4XEN_SHIFT 11 892#define OMAP4430_DPLL_REGM4XEN_SHIFT 11
893#define OMAP4430_DPLL_REGM4XEN_WIDTH 0x1
737#define OMAP4430_DPLL_REGM4XEN_MASK (1 << 11) 894#define OMAP4430_DPLL_REGM4XEN_MASK (1 << 11)
738 895
739/* Used by CM_CLKSEL_DPLL_USB */ 896/* Used by CM_CLKSEL_DPLL_USB */
740#define OMAP4430_DPLL_SD_DIV_SHIFT 24 897#define OMAP4430_DPLL_SD_DIV_SHIFT 24
898#define OMAP4430_DPLL_SD_DIV_WIDTH 0x8
741#define OMAP4430_DPLL_SD_DIV_MASK (0xff << 24) 899#define OMAP4430_DPLL_SD_DIV_MASK (0xff << 24)
742 900
743/* 901/*
@@ -746,6 +904,7 @@
746 * CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB 904 * CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB
747 */ 905 */
748#define OMAP4430_DPLL_SSC_ACK_SHIFT 13 906#define OMAP4430_DPLL_SSC_ACK_SHIFT 13
907#define OMAP4430_DPLL_SSC_ACK_WIDTH 0x1
749#define OMAP4430_DPLL_SSC_ACK_MASK (1 << 13) 908#define OMAP4430_DPLL_SSC_ACK_MASK (1 << 13)
750 909
751/* 910/*
@@ -754,6 +913,7 @@
754 * CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB 913 * CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB
755 */ 914 */
756#define OMAP4430_DPLL_SSC_DOWNSPREAD_SHIFT 14 915#define OMAP4430_DPLL_SSC_DOWNSPREAD_SHIFT 14
916#define OMAP4430_DPLL_SSC_DOWNSPREAD_WIDTH 0x1
757#define OMAP4430_DPLL_SSC_DOWNSPREAD_MASK (1 << 14) 917#define OMAP4430_DPLL_SSC_DOWNSPREAD_MASK (1 << 14)
758 918
759/* 919/*
@@ -762,42 +922,52 @@
762 * CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB 922 * CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB
763 */ 923 */
764#define OMAP4430_DPLL_SSC_EN_SHIFT 12 924#define OMAP4430_DPLL_SSC_EN_SHIFT 12
925#define OMAP4430_DPLL_SSC_EN_WIDTH 0x1
765#define OMAP4430_DPLL_SSC_EN_MASK (1 << 12) 926#define OMAP4430_DPLL_SSC_EN_MASK (1 << 12)
766 927
767/* Used by CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP, CM_L4PER_DYNAMICDEP */ 928/* Used by CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP, CM_L4PER_DYNAMICDEP */
768#define OMAP4430_DSS_DYNDEP_SHIFT 8 929#define OMAP4430_DSS_DYNDEP_SHIFT 8
930#define OMAP4430_DSS_DYNDEP_WIDTH 0x1
769#define OMAP4430_DSS_DYNDEP_MASK (1 << 8) 931#define OMAP4430_DSS_DYNDEP_MASK (1 << 8)
770 932
771/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP, CM_SDMA_STATICDEP */ 933/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP, CM_SDMA_STATICDEP */
772#define OMAP4430_DSS_STATDEP_SHIFT 8 934#define OMAP4430_DSS_STATDEP_SHIFT 8
935#define OMAP4430_DSS_STATDEP_WIDTH 0x1
773#define OMAP4430_DSS_STATDEP_MASK (1 << 8) 936#define OMAP4430_DSS_STATDEP_MASK (1 << 8)
774 937
775/* Used by CM_L3_2_DYNAMICDEP */ 938/* Used by CM_L3_2_DYNAMICDEP */
776#define OMAP4430_DUCATI_DYNDEP_SHIFT 0 939#define OMAP4430_DUCATI_DYNDEP_SHIFT 0
940#define OMAP4430_DUCATI_DYNDEP_WIDTH 0x1
777#define OMAP4430_DUCATI_DYNDEP_MASK (1 << 0) 941#define OMAP4430_DUCATI_DYNDEP_MASK (1 << 0)
778 942
779/* Used by CM_MPU_STATICDEP, CM_SDMA_STATICDEP */ 943/* Used by CM_MPU_STATICDEP, CM_SDMA_STATICDEP */
780#define OMAP4430_DUCATI_STATDEP_SHIFT 0 944#define OMAP4430_DUCATI_STATDEP_SHIFT 0
945#define OMAP4430_DUCATI_STATDEP_WIDTH 0x1
781#define OMAP4430_DUCATI_STATDEP_MASK (1 << 0) 946#define OMAP4430_DUCATI_STATDEP_MASK (1 << 0)
782 947
783/* Used by CM_SHADOW_FREQ_CONFIG1 */ 948/* Used by CM_SHADOW_FREQ_CONFIG1 */
784#define OMAP4430_FREQ_UPDATE_SHIFT 0 949#define OMAP4430_FREQ_UPDATE_SHIFT 0
950#define OMAP4430_FREQ_UPDATE_WIDTH 0x1
785#define OMAP4430_FREQ_UPDATE_MASK (1 << 0) 951#define OMAP4430_FREQ_UPDATE_MASK (1 << 0)
786 952
787/* Used by REVISION_CM1, REVISION_CM2 */ 953/* Used by REVISION_CM1, REVISION_CM2 */
788#define OMAP4430_FUNC_SHIFT 16 954#define OMAP4430_FUNC_SHIFT 16
955#define OMAP4430_FUNC_WIDTH 0xc
789#define OMAP4430_FUNC_MASK (0xfff << 16) 956#define OMAP4430_FUNC_MASK (0xfff << 16)
790 957
791/* Used by CM_L3_2_DYNAMICDEP */ 958/* Used by CM_L3_2_DYNAMICDEP */
792#define OMAP4430_GFX_DYNDEP_SHIFT 10 959#define OMAP4430_GFX_DYNDEP_SHIFT 10
960#define OMAP4430_GFX_DYNDEP_WIDTH 0x1
793#define OMAP4430_GFX_DYNDEP_MASK (1 << 10) 961#define OMAP4430_GFX_DYNDEP_MASK (1 << 10)
794 962
795/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP */ 963/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP */
796#define OMAP4430_GFX_STATDEP_SHIFT 10 964#define OMAP4430_GFX_STATDEP_SHIFT 10
965#define OMAP4430_GFX_STATDEP_WIDTH 0x1
797#define OMAP4430_GFX_STATDEP_MASK (1 << 10) 966#define OMAP4430_GFX_STATDEP_MASK (1 << 10)
798 967
799/* Used by CM_SHADOW_FREQ_CONFIG2 */ 968/* Used by CM_SHADOW_FREQ_CONFIG2 */
800#define OMAP4430_GPMC_FREQ_UPDATE_SHIFT 0 969#define OMAP4430_GPMC_FREQ_UPDATE_SHIFT 0
970#define OMAP4430_GPMC_FREQ_UPDATE_WIDTH 0x1
801#define OMAP4430_GPMC_FREQ_UPDATE_MASK (1 << 0) 971#define OMAP4430_GPMC_FREQ_UPDATE_MASK (1 << 0)
802 972
803/* 973/*
@@ -805,6 +975,7 @@
805 * CM_DIV_M4_DPLL_PER 975 * CM_DIV_M4_DPLL_PER
806 */ 976 */
807#define OMAP4430_HSDIVIDER_CLKOUT1_DIV_SHIFT 0 977#define OMAP4430_HSDIVIDER_CLKOUT1_DIV_SHIFT 0
978#define OMAP4430_HSDIVIDER_CLKOUT1_DIV_WIDTH 0x5
808#define OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK (0x1f << 0) 979#define OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK (0x1f << 0)
809 980
810/* 981/*
@@ -812,6 +983,7 @@
812 * CM_DIV_M4_DPLL_PER 983 * CM_DIV_M4_DPLL_PER
813 */ 984 */
814#define OMAP4430_HSDIVIDER_CLKOUT1_DIVCHACK_SHIFT 5 985#define OMAP4430_HSDIVIDER_CLKOUT1_DIVCHACK_SHIFT 5
986#define OMAP4430_HSDIVIDER_CLKOUT1_DIVCHACK_WIDTH 0x1
815#define OMAP4430_HSDIVIDER_CLKOUT1_DIVCHACK_MASK (1 << 5) 987#define OMAP4430_HSDIVIDER_CLKOUT1_DIVCHACK_MASK (1 << 5)
816 988
817/* 989/*
@@ -819,6 +991,7 @@
819 * CM_DIV_M4_DPLL_PER 991 * CM_DIV_M4_DPLL_PER
820 */ 992 */
821#define OMAP4430_HSDIVIDER_CLKOUT1_GATE_CTRL_SHIFT 8 993#define OMAP4430_HSDIVIDER_CLKOUT1_GATE_CTRL_SHIFT 8
994#define OMAP4430_HSDIVIDER_CLKOUT1_GATE_CTRL_WIDTH 0x1
822#define OMAP4430_HSDIVIDER_CLKOUT1_GATE_CTRL_MASK (1 << 8) 995#define OMAP4430_HSDIVIDER_CLKOUT1_GATE_CTRL_MASK (1 << 8)
823 996
824/* 997/*
@@ -826,6 +999,7 @@
826 * CM_DIV_M4_DPLL_PER 999 * CM_DIV_M4_DPLL_PER
827 */ 1000 */
828#define OMAP4430_HSDIVIDER_CLKOUT1_PWDN_SHIFT 12 1001#define OMAP4430_HSDIVIDER_CLKOUT1_PWDN_SHIFT 12
1002#define OMAP4430_HSDIVIDER_CLKOUT1_PWDN_WIDTH 0x1
829#define OMAP4430_HSDIVIDER_CLKOUT1_PWDN_MASK (1 << 12) 1003#define OMAP4430_HSDIVIDER_CLKOUT1_PWDN_MASK (1 << 12)
830 1004
831/* 1005/*
@@ -833,6 +1007,7 @@
833 * CM_DIV_M5_DPLL_PER 1007 * CM_DIV_M5_DPLL_PER
834 */ 1008 */
835#define OMAP4430_HSDIVIDER_CLKOUT2_DIV_SHIFT 0 1009#define OMAP4430_HSDIVIDER_CLKOUT2_DIV_SHIFT 0
1010#define OMAP4430_HSDIVIDER_CLKOUT2_DIV_WIDTH 0x5
836#define OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK (0x1f << 0) 1011#define OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK (0x1f << 0)
837 1012
838/* 1013/*
@@ -840,6 +1015,7 @@
840 * CM_DIV_M5_DPLL_PER 1015 * CM_DIV_M5_DPLL_PER
841 */ 1016 */
842#define OMAP4430_HSDIVIDER_CLKOUT2_DIVCHACK_SHIFT 5 1017#define OMAP4430_HSDIVIDER_CLKOUT2_DIVCHACK_SHIFT 5
1018#define OMAP4430_HSDIVIDER_CLKOUT2_DIVCHACK_WIDTH 0x1
843#define OMAP4430_HSDIVIDER_CLKOUT2_DIVCHACK_MASK (1 << 5) 1019#define OMAP4430_HSDIVIDER_CLKOUT2_DIVCHACK_MASK (1 << 5)
844 1020
845/* 1021/*
@@ -847,6 +1023,7 @@
847 * CM_DIV_M5_DPLL_PER 1023 * CM_DIV_M5_DPLL_PER
848 */ 1024 */
849#define OMAP4430_HSDIVIDER_CLKOUT2_GATE_CTRL_SHIFT 8 1025#define OMAP4430_HSDIVIDER_CLKOUT2_GATE_CTRL_SHIFT 8
1026#define OMAP4430_HSDIVIDER_CLKOUT2_GATE_CTRL_WIDTH 0x1
850#define OMAP4430_HSDIVIDER_CLKOUT2_GATE_CTRL_MASK (1 << 8) 1027#define OMAP4430_HSDIVIDER_CLKOUT2_GATE_CTRL_MASK (1 << 8)
851 1028
852/* 1029/*
@@ -854,38 +1031,47 @@
854 * CM_DIV_M5_DPLL_PER 1031 * CM_DIV_M5_DPLL_PER
855 */ 1032 */
856#define OMAP4430_HSDIVIDER_CLKOUT2_PWDN_SHIFT 12 1033#define OMAP4430_HSDIVIDER_CLKOUT2_PWDN_SHIFT 12
1034#define OMAP4430_HSDIVIDER_CLKOUT2_PWDN_WIDTH 0x1
857#define OMAP4430_HSDIVIDER_CLKOUT2_PWDN_MASK (1 << 12) 1035#define OMAP4430_HSDIVIDER_CLKOUT2_PWDN_MASK (1 << 12)
858 1036
859/* Used by CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY, CM_DIV_M6_DPLL_PER */ 1037/* Used by CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY, CM_DIV_M6_DPLL_PER */
860#define OMAP4430_HSDIVIDER_CLKOUT3_DIV_SHIFT 0 1038#define OMAP4430_HSDIVIDER_CLKOUT3_DIV_SHIFT 0
1039#define OMAP4430_HSDIVIDER_CLKOUT3_DIV_WIDTH 0x5
861#define OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK (0x1f << 0) 1040#define OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK (0x1f << 0)
862 1041
863/* Used by CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY, CM_DIV_M6_DPLL_PER */ 1042/* Used by CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY, CM_DIV_M6_DPLL_PER */
864#define OMAP4430_HSDIVIDER_CLKOUT3_DIVCHACK_SHIFT 5 1043#define OMAP4430_HSDIVIDER_CLKOUT3_DIVCHACK_SHIFT 5
1044#define OMAP4430_HSDIVIDER_CLKOUT3_DIVCHACK_WIDTH 0x1
865#define OMAP4430_HSDIVIDER_CLKOUT3_DIVCHACK_MASK (1 << 5) 1045#define OMAP4430_HSDIVIDER_CLKOUT3_DIVCHACK_MASK (1 << 5)
866 1046
867/* Used by CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY, CM_DIV_M6_DPLL_PER */ 1047/* Used by CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY, CM_DIV_M6_DPLL_PER */
868#define OMAP4430_HSDIVIDER_CLKOUT3_GATE_CTRL_SHIFT 8 1048#define OMAP4430_HSDIVIDER_CLKOUT3_GATE_CTRL_SHIFT 8
1049#define OMAP4430_HSDIVIDER_CLKOUT3_GATE_CTRL_WIDTH 0x1
869#define OMAP4430_HSDIVIDER_CLKOUT3_GATE_CTRL_MASK (1 << 8) 1050#define OMAP4430_HSDIVIDER_CLKOUT3_GATE_CTRL_MASK (1 << 8)
870 1051
871/* Used by CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY, CM_DIV_M6_DPLL_PER */ 1052/* Used by CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY, CM_DIV_M6_DPLL_PER */
872#define OMAP4430_HSDIVIDER_CLKOUT3_PWDN_SHIFT 12 1053#define OMAP4430_HSDIVIDER_CLKOUT3_PWDN_SHIFT 12
1054#define OMAP4430_HSDIVIDER_CLKOUT3_PWDN_WIDTH 0x1
873#define OMAP4430_HSDIVIDER_CLKOUT3_PWDN_MASK (1 << 12) 1055#define OMAP4430_HSDIVIDER_CLKOUT3_PWDN_MASK (1 << 12)
874 1056
875/* Used by CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_PER */ 1057/* Used by CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_PER */
876#define OMAP4430_HSDIVIDER_CLKOUT4_DIV_SHIFT 0 1058#define OMAP4430_HSDIVIDER_CLKOUT4_DIV_SHIFT 0
1059#define OMAP4430_HSDIVIDER_CLKOUT4_DIV_WIDTH 0x5
877#define OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK (0x1f << 0) 1060#define OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK (0x1f << 0)
878 1061
879/* Used by CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_PER */ 1062/* Used by CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_PER */
880#define OMAP4430_HSDIVIDER_CLKOUT4_DIVCHACK_SHIFT 5 1063#define OMAP4430_HSDIVIDER_CLKOUT4_DIVCHACK_SHIFT 5
1064#define OMAP4430_HSDIVIDER_CLKOUT4_DIVCHACK_WIDTH 0x1
881#define OMAP4430_HSDIVIDER_CLKOUT4_DIVCHACK_MASK (1 << 5) 1065#define OMAP4430_HSDIVIDER_CLKOUT4_DIVCHACK_MASK (1 << 5)
882 1066
883/* Used by CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_PER */ 1067/* Used by CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_PER */
884#define OMAP4430_HSDIVIDER_CLKOUT4_GATE_CTRL_SHIFT 8 1068#define OMAP4430_HSDIVIDER_CLKOUT4_GATE_CTRL_SHIFT 8
1069#define OMAP4430_HSDIVIDER_CLKOUT4_GATE_CTRL_WIDTH 0x1
885#define OMAP4430_HSDIVIDER_CLKOUT4_GATE_CTRL_MASK (1 << 8) 1070#define OMAP4430_HSDIVIDER_CLKOUT4_GATE_CTRL_MASK (1 << 8)
886 1071
887/* Used by CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_PER */ 1072/* Used by CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_PER */
888#define OMAP4430_HSDIVIDER_CLKOUT4_PWDN_SHIFT 12 1073#define OMAP4430_HSDIVIDER_CLKOUT4_PWDN_SHIFT 12
1074#define OMAP4430_HSDIVIDER_CLKOUT4_PWDN_WIDTH 0x1
889#define OMAP4430_HSDIVIDER_CLKOUT4_PWDN_MASK (1 << 12) 1075#define OMAP4430_HSDIVIDER_CLKOUT4_PWDN_MASK (1 << 12)
890 1076
891/* 1077/*
@@ -893,53 +1079,48 @@
893 * CM1_ABE_MCASP_CLKCTRL, CM1_ABE_MCBSP1_CLKCTRL, CM1_ABE_MCBSP2_CLKCTRL, 1079 * CM1_ABE_MCASP_CLKCTRL, CM1_ABE_MCBSP1_CLKCTRL, CM1_ABE_MCBSP2_CLKCTRL,
894 * CM1_ABE_MCBSP3_CLKCTRL, CM1_ABE_PDM_CLKCTRL, CM1_ABE_SLIMBUS_CLKCTRL, 1080 * CM1_ABE_MCBSP3_CLKCTRL, CM1_ABE_PDM_CLKCTRL, CM1_ABE_SLIMBUS_CLKCTRL,
895 * CM1_ABE_TIMER5_CLKCTRL, CM1_ABE_TIMER6_CLKCTRL, CM1_ABE_TIMER7_CLKCTRL, 1081 * CM1_ABE_TIMER5_CLKCTRL, CM1_ABE_TIMER6_CLKCTRL, CM1_ABE_TIMER7_CLKCTRL,
896 * CM1_ABE_TIMER8_CLKCTRL, CM1_ABE_WDT3_CLKCTRL, CM_ALWON_MDMINTC_CLKCTRL, 1082 * CM1_ABE_TIMER8_CLKCTRL, CM1_ABE_WDT3_CLKCTRL, CM_ALWON_SR_CORE_CLKCTRL,
897 * CM_ALWON_SR_CORE_CLKCTRL, CM_ALWON_SR_IVA_CLKCTRL, CM_ALWON_SR_MPU_CLKCTRL, 1083 * CM_ALWON_SR_IVA_CLKCTRL, CM_ALWON_SR_MPU_CLKCTRL, CM_CAM_FDIF_CLKCTRL,
898 * CM_CAM_FDIF_CLKCTRL, CM_CAM_ISS_CLKCTRL, CM_CEFUSE_CEFUSE_CLKCTRL, 1084 * CM_CAM_ISS_CLKCTRL, CM_CEFUSE_CEFUSE_CLKCTRL, CM_CM1_PROFILING_CLKCTRL,
899 * CM_CM1_PROFILING_CLKCTRL, CM_CM2_PROFILING_CLKCTRL, 1085 * CM_CM2_PROFILING_CLKCTRL, CM_D2D_MODEM_ICR_CLKCTRL, CM_D2D_SAD2D_CLKCTRL,
900 * CM_D2D_MODEM_ICR_CLKCTRL, CM_D2D_SAD2D_CLKCTRL, CM_D2D_SAD2D_FW_CLKCTRL, 1086 * CM_D2D_SAD2D_FW_CLKCTRL, CM_DSS_DSS_CLKCTRL, CM_DUCATI_DUCATI_CLKCTRL,
901 * CM_DSS_DEISS_CLKCTRL, CM_DSS_DSS_CLKCTRL, CM_DUCATI_DUCATI_CLKCTRL,
902 * CM_EMU_DEBUGSS_CLKCTRL, CM_GFX_GFX_CLKCTRL, CM_IVAHD_IVAHD_CLKCTRL, 1087 * CM_EMU_DEBUGSS_CLKCTRL, CM_GFX_GFX_CLKCTRL, CM_IVAHD_IVAHD_CLKCTRL,
903 * CM_IVAHD_SL2_CLKCTRL, CM_L3INIT_CCPTX_CLKCTRL, CM_L3INIT_EMAC_CLKCTRL, 1088 * CM_IVAHD_SL2_CLKCTRL, CM_L3INIT_HSI_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL,
904 * CM_L3INIT_HSI_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL, CM_L3INIT_MMC2_CLKCTRL, 1089 * CM_L3INIT_MMC2_CLKCTRL, CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
905 * CM_L3INIT_MMC6_CLKCTRL, CM_L3INIT_P1500_CLKCTRL, CM_L3INIT_PCIESS_CLKCTRL, 1090 * CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_FS_CLKCTRL,
906 * CM_L3INIT_SATA_CLKCTRL, CM_L3INIT_TPPSS_CLKCTRL, CM_L3INIT_UNIPRO1_CLKCTRL, 1091 * CM_L3INIT_USB_OTG_CLKCTRL, CM_L3INIT_USB_TLL_CLKCTRL,
907 * CM_L3INIT_USBPHYOCP2SCP_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL, 1092 * CM_L3INSTR_L3_3_CLKCTRL, CM_L3INSTR_L3_INSTR_CLKCTRL,
908 * CM_L3INIT_USB_HOST_FS_CLKCTRL, CM_L3INIT_USB_OTG_CLKCTRL, 1093 * CM_L3INSTR_OCP_WP1_CLKCTRL, CM_L3_1_L3_1_CLKCTRL, CM_L3_2_GPMC_CLKCTRL,
909 * CM_L3INIT_USB_TLL_CLKCTRL, CM_L3INIT_XHPI_CLKCTRL, CM_L3INSTR_L3_3_CLKCTRL, 1094 * CM_L3_2_L3_2_CLKCTRL, CM_L3_2_OCMC_RAM_CLKCTRL, CM_L4CFG_HW_SEM_CLKCTRL,
910 * CM_L3INSTR_L3_INSTR_CLKCTRL, CM_L3INSTR_OCP_WP1_CLKCTRL, 1095 * CM_L4CFG_L4_CFG_CLKCTRL, CM_L4CFG_MAILBOX_CLKCTRL, CM_L4CFG_SAR_ROM_CLKCTRL,
911 * CM_L3_1_L3_1_CLKCTRL, CM_L3_2_GPMC_CLKCTRL, CM_L3_2_L3_2_CLKCTRL,
912 * CM_L3_2_OCMC_RAM_CLKCTRL, CM_L4CFG_HW_SEM_CLKCTRL, CM_L4CFG_L4_CFG_CLKCTRL,
913 * CM_L4CFG_MAILBOX_CLKCTRL, CM_L4CFG_SAR_ROM_CLKCTRL, CM_L4PER_ADC_CLKCTRL,
914 * CM_L4PER_DMTIMER10_CLKCTRL, CM_L4PER_DMTIMER11_CLKCTRL, 1096 * CM_L4PER_DMTIMER10_CLKCTRL, CM_L4PER_DMTIMER11_CLKCTRL,
915 * CM_L4PER_DMTIMER2_CLKCTRL, CM_L4PER_DMTIMER3_CLKCTRL, 1097 * CM_L4PER_DMTIMER2_CLKCTRL, CM_L4PER_DMTIMER3_CLKCTRL,
916 * CM_L4PER_DMTIMER4_CLKCTRL, CM_L4PER_DMTIMER9_CLKCTRL, CM_L4PER_ELM_CLKCTRL, 1098 * CM_L4PER_DMTIMER4_CLKCTRL, CM_L4PER_DMTIMER9_CLKCTRL, CM_L4PER_ELM_CLKCTRL,
917 * CM_L4PER_GPIO2_CLKCTRL, CM_L4PER_GPIO3_CLKCTRL, CM_L4PER_GPIO4_CLKCTRL, 1099 * CM_L4PER_GPIO2_CLKCTRL, CM_L4PER_GPIO3_CLKCTRL, CM_L4PER_GPIO4_CLKCTRL,
918 * CM_L4PER_GPIO5_CLKCTRL, CM_L4PER_GPIO6_CLKCTRL, CM_L4PER_HDQ1W_CLKCTRL, 1100 * CM_L4PER_GPIO5_CLKCTRL, CM_L4PER_GPIO6_CLKCTRL, CM_L4PER_HDQ1W_CLKCTRL,
919 * CM_L4PER_HECC1_CLKCTRL, CM_L4PER_HECC2_CLKCTRL, CM_L4PER_I2C1_CLKCTRL, 1101 * CM_L4PER_I2C1_CLKCTRL, CM_L4PER_I2C2_CLKCTRL, CM_L4PER_I2C3_CLKCTRL,
920 * CM_L4PER_I2C2_CLKCTRL, CM_L4PER_I2C3_CLKCTRL, CM_L4PER_I2C4_CLKCTRL, 1102 * CM_L4PER_I2C4_CLKCTRL, CM_L4PER_I2C5_CLKCTRL, CM_L4PER_L4PER_CLKCTRL,
921 * CM_L4PER_I2C5_CLKCTRL, CM_L4PER_L4PER_CLKCTRL, CM_L4PER_MCASP2_CLKCTRL, 1103 * CM_L4PER_MCBSP4_CLKCTRL, CM_L4PER_MCSPI1_CLKCTRL, CM_L4PER_MCSPI2_CLKCTRL,
922 * CM_L4PER_MCASP3_CLKCTRL, CM_L4PER_MCBSP4_CLKCTRL, CM_L4PER_MCSPI1_CLKCTRL, 1104 * CM_L4PER_MCSPI3_CLKCTRL, CM_L4PER_MCSPI4_CLKCTRL, CM_L4PER_MMCSD3_CLKCTRL,
923 * CM_L4PER_MCSPI2_CLKCTRL, CM_L4PER_MCSPI3_CLKCTRL, CM_L4PER_MCSPI4_CLKCTRL, 1105 * CM_L4PER_MMCSD4_CLKCTRL, CM_L4PER_MMCSD5_CLKCTRL, CM_L4PER_SLIMBUS2_CLKCTRL,
924 * CM_L4PER_MGATE_CLKCTRL, CM_L4PER_MMCSD3_CLKCTRL, CM_L4PER_MMCSD4_CLKCTRL, 1106 * CM_L4PER_UART1_CLKCTRL, CM_L4PER_UART2_CLKCTRL, CM_L4PER_UART3_CLKCTRL,
925 * CM_L4PER_MMCSD5_CLKCTRL, CM_L4PER_MSPROHG_CLKCTRL, 1107 * CM_L4PER_UART4_CLKCTRL, CM_L4SEC_AES1_CLKCTRL, CM_L4SEC_AES2_CLKCTRL,
926 * CM_L4PER_SLIMBUS2_CLKCTRL, CM_L4PER_UART1_CLKCTRL, CM_L4PER_UART2_CLKCTRL, 1108 * CM_L4SEC_CRYPTODMA_CLKCTRL, CM_L4SEC_DES3DES_CLKCTRL,
927 * CM_L4PER_UART3_CLKCTRL, CM_L4PER_UART4_CLKCTRL, CM_L4SEC_AES1_CLKCTRL,
928 * CM_L4SEC_AES2_CLKCTRL, CM_L4SEC_CRYPTODMA_CLKCTRL, CM_L4SEC_DES3DES_CLKCTRL,
929 * CM_L4SEC_PKAEIP29_CLKCTRL, CM_L4SEC_RNG_CLKCTRL, CM_L4SEC_SHA2MD51_CLKCTRL, 1109 * CM_L4SEC_PKAEIP29_CLKCTRL, CM_L4SEC_RNG_CLKCTRL, CM_L4SEC_SHA2MD51_CLKCTRL,
930 * CM_MEMIF_DMM_CLKCTRL, CM_MEMIF_EMIF_1_CLKCTRL, CM_MEMIF_EMIF_2_CLKCTRL, 1110 * CM_MEMIF_DMM_CLKCTRL, CM_MEMIF_EMIF_1_CLKCTRL, CM_MEMIF_EMIF_2_CLKCTRL,
931 * CM_MEMIF_EMIF_FW_CLKCTRL, CM_MEMIF_EMIF_H1_CLKCTRL, 1111 * CM_MEMIF_EMIF_FW_CLKCTRL, CM_MPU_MPU_CLKCTRL, CM_SDMA_SDMA_CLKCTRL,
932 * CM_MEMIF_EMIF_H2_CLKCTRL, CM_MPU_MPU_CLKCTRL, CM_SDMA_SDMA_CLKCTRL,
933 * CM_TESLA_TESLA_CLKCTRL, CM_WKUP_GPIO1_CLKCTRL, CM_WKUP_KEYBOARD_CLKCTRL, 1112 * CM_TESLA_TESLA_CLKCTRL, CM_WKUP_GPIO1_CLKCTRL, CM_WKUP_KEYBOARD_CLKCTRL,
934 * CM_WKUP_L4WKUP_CLKCTRL, CM_WKUP_RTC_CLKCTRL, CM_WKUP_SARRAM_CLKCTRL, 1113 * CM_WKUP_L4WKUP_CLKCTRL, CM_WKUP_SARRAM_CLKCTRL, CM_WKUP_SYNCTIMER_CLKCTRL,
935 * CM_WKUP_SYNCTIMER_CLKCTRL, CM_WKUP_TIMER12_CLKCTRL, CM_WKUP_TIMER1_CLKCTRL, 1114 * CM_WKUP_TIMER12_CLKCTRL, CM_WKUP_TIMER1_CLKCTRL, CM_WKUP_USIM_CLKCTRL,
936 * CM_WKUP_USIM_CLKCTRL, CM_WKUP_WDT1_CLKCTRL, CM_WKUP_WDT2_CLKCTRL 1115 * CM_WKUP_WDT1_CLKCTRL, CM_WKUP_WDT2_CLKCTRL
937 */ 1116 */
938#define OMAP4430_IDLEST_SHIFT 16 1117#define OMAP4430_IDLEST_SHIFT 16
1118#define OMAP4430_IDLEST_WIDTH 0x2
939#define OMAP4430_IDLEST_MASK (0x3 << 16) 1119#define OMAP4430_IDLEST_MASK (0x3 << 16)
940 1120
941/* Used by CM_DUCATI_DYNAMICDEP, CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP */ 1121/* Used by CM_DUCATI_DYNAMICDEP, CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP */
942#define OMAP4430_ISS_DYNDEP_SHIFT 9 1122#define OMAP4430_ISS_DYNDEP_SHIFT 9
1123#define OMAP4430_ISS_DYNDEP_WIDTH 0x1
943#define OMAP4430_ISS_DYNDEP_MASK (1 << 9) 1124#define OMAP4430_ISS_DYNDEP_MASK (1 << 9)
944 1125
945/* 1126/*
@@ -947,10 +1128,12 @@
947 * CM_TESLA_STATICDEP 1128 * CM_TESLA_STATICDEP
948 */ 1129 */
949#define OMAP4430_ISS_STATDEP_SHIFT 9 1130#define OMAP4430_ISS_STATDEP_SHIFT 9
1131#define OMAP4430_ISS_STATDEP_WIDTH 0x1
950#define OMAP4430_ISS_STATDEP_MASK (1 << 9) 1132#define OMAP4430_ISS_STATDEP_MASK (1 << 9)
951 1133
952/* Used by CM_L3_2_DYNAMICDEP, CM_TESLA_DYNAMICDEP */ 1134/* Used by CM_L3_2_DYNAMICDEP, CM_TESLA_DYNAMICDEP */
953#define OMAP4430_IVAHD_DYNDEP_SHIFT 2 1135#define OMAP4430_IVAHD_DYNDEP_SHIFT 2
1136#define OMAP4430_IVAHD_DYNDEP_WIDTH 0x1
954#define OMAP4430_IVAHD_DYNDEP_MASK (1 << 2) 1137#define OMAP4430_IVAHD_DYNDEP_MASK (1 << 2)
955 1138
956/* 1139/*
@@ -959,10 +1142,12 @@
959 * CM_MPU_STATICDEP, CM_SDMA_STATICDEP, CM_TESLA_STATICDEP 1142 * CM_MPU_STATICDEP, CM_SDMA_STATICDEP, CM_TESLA_STATICDEP
960 */ 1143 */
961#define OMAP4430_IVAHD_STATDEP_SHIFT 2 1144#define OMAP4430_IVAHD_STATDEP_SHIFT 2
1145#define OMAP4430_IVAHD_STATDEP_WIDTH 0x1
962#define OMAP4430_IVAHD_STATDEP_MASK (1 << 2) 1146#define OMAP4430_IVAHD_STATDEP_MASK (1 << 2)
963 1147
964/* Used by CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP, CM_L4PER_DYNAMICDEP */ 1148/* Used by CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP, CM_L4PER_DYNAMICDEP */
965#define OMAP4430_L3INIT_DYNDEP_SHIFT 7 1149#define OMAP4430_L3INIT_DYNDEP_SHIFT 7
1150#define OMAP4430_L3INIT_DYNDEP_WIDTH 0x1
966#define OMAP4430_L3INIT_DYNDEP_MASK (1 << 7) 1151#define OMAP4430_L3INIT_DYNDEP_MASK (1 << 7)
967 1152
968/* 1153/*
@@ -970,6 +1155,7 @@
970 * CM_SDMA_STATICDEP, CM_TESLA_STATICDEP 1155 * CM_SDMA_STATICDEP, CM_TESLA_STATICDEP
971 */ 1156 */
972#define OMAP4430_L3INIT_STATDEP_SHIFT 7 1157#define OMAP4430_L3INIT_STATDEP_SHIFT 7
1158#define OMAP4430_L3INIT_STATDEP_WIDTH 0x1
973#define OMAP4430_L3INIT_STATDEP_MASK (1 << 7) 1159#define OMAP4430_L3INIT_STATDEP_MASK (1 << 7)
974 1160
975/* 1161/*
@@ -977,6 +1163,7 @@
977 * CM_L4CFG_DYNAMICDEP, CM_MPU_DYNAMICDEP, CM_TESLA_DYNAMICDEP 1163 * CM_L4CFG_DYNAMICDEP, CM_MPU_DYNAMICDEP, CM_TESLA_DYNAMICDEP
978 */ 1164 */
979#define OMAP4430_L3_1_DYNDEP_SHIFT 5 1165#define OMAP4430_L3_1_DYNDEP_SHIFT 5
1166#define OMAP4430_L3_1_DYNDEP_WIDTH 0x1
980#define OMAP4430_L3_1_DYNDEP_MASK (1 << 5) 1167#define OMAP4430_L3_1_DYNDEP_MASK (1 << 5)
981 1168
982/* 1169/*
@@ -986,6 +1173,7 @@
986 * CM_SDMA_STATICDEP, CM_TESLA_STATICDEP 1173 * CM_SDMA_STATICDEP, CM_TESLA_STATICDEP
987 */ 1174 */
988#define OMAP4430_L3_1_STATDEP_SHIFT 5 1175#define OMAP4430_L3_1_STATDEP_SHIFT 5
1176#define OMAP4430_L3_1_STATDEP_WIDTH 0x1
989#define OMAP4430_L3_1_STATDEP_MASK (1 << 5) 1177#define OMAP4430_L3_1_STATDEP_MASK (1 << 5)
990 1178
991/* 1179/*
@@ -995,6 +1183,7 @@
995 * CM_L4SEC_DYNAMICDEP, CM_SDMA_DYNAMICDEP 1183 * CM_L4SEC_DYNAMICDEP, CM_SDMA_DYNAMICDEP
996 */ 1184 */
997#define OMAP4430_L3_2_DYNDEP_SHIFT 6 1185#define OMAP4430_L3_2_DYNDEP_SHIFT 6
1186#define OMAP4430_L3_2_DYNDEP_WIDTH 0x1
998#define OMAP4430_L3_2_DYNDEP_MASK (1 << 6) 1187#define OMAP4430_L3_2_DYNDEP_MASK (1 << 6)
999 1188
1000/* 1189/*
@@ -1004,10 +1193,12 @@
1004 * CM_SDMA_STATICDEP, CM_TESLA_STATICDEP 1193 * CM_SDMA_STATICDEP, CM_TESLA_STATICDEP
1005 */ 1194 */
1006#define OMAP4430_L3_2_STATDEP_SHIFT 6 1195#define OMAP4430_L3_2_STATDEP_SHIFT 6
1196#define OMAP4430_L3_2_STATDEP_WIDTH 0x1
1007#define OMAP4430_L3_2_STATDEP_MASK (1 << 6) 1197#define OMAP4430_L3_2_STATDEP_MASK (1 << 6)
1008 1198
1009/* Used by CM_L3_1_DYNAMICDEP */ 1199/* Used by CM_L3_1_DYNAMICDEP */
1010#define OMAP4430_L4CFG_DYNDEP_SHIFT 12 1200#define OMAP4430_L4CFG_DYNDEP_SHIFT 12
1201#define OMAP4430_L4CFG_DYNDEP_WIDTH 0x1
1011#define OMAP4430_L4CFG_DYNDEP_MASK (1 << 12) 1202#define OMAP4430_L4CFG_DYNDEP_MASK (1 << 12)
1012 1203
1013/* 1204/*
@@ -1015,10 +1206,12 @@
1015 * CM_MPU_STATICDEP, CM_SDMA_STATICDEP, CM_TESLA_STATICDEP 1206 * CM_MPU_STATICDEP, CM_SDMA_STATICDEP, CM_TESLA_STATICDEP
1016 */ 1207 */
1017#define OMAP4430_L4CFG_STATDEP_SHIFT 12 1208#define OMAP4430_L4CFG_STATDEP_SHIFT 12
1209#define OMAP4430_L4CFG_STATDEP_WIDTH 0x1
1018#define OMAP4430_L4CFG_STATDEP_MASK (1 << 12) 1210#define OMAP4430_L4CFG_STATDEP_MASK (1 << 12)
1019 1211
1020/* Used by CM_L3_2_DYNAMICDEP */ 1212/* Used by CM_L3_2_DYNAMICDEP */
1021#define OMAP4430_L4PER_DYNDEP_SHIFT 13 1213#define OMAP4430_L4PER_DYNDEP_SHIFT 13
1214#define OMAP4430_L4PER_DYNDEP_WIDTH 0x1
1022#define OMAP4430_L4PER_DYNDEP_MASK (1 << 13) 1215#define OMAP4430_L4PER_DYNDEP_MASK (1 << 13)
1023 1216
1024/* 1217/*
@@ -1026,10 +1219,12 @@
1026 * CM_L4SEC_STATICDEP, CM_MPU_STATICDEP, CM_SDMA_STATICDEP, CM_TESLA_STATICDEP 1219 * CM_L4SEC_STATICDEP, CM_MPU_STATICDEP, CM_SDMA_STATICDEP, CM_TESLA_STATICDEP
1027 */ 1220 */
1028#define OMAP4430_L4PER_STATDEP_SHIFT 13 1221#define OMAP4430_L4PER_STATDEP_SHIFT 13
1222#define OMAP4430_L4PER_STATDEP_WIDTH 0x1
1029#define OMAP4430_L4PER_STATDEP_MASK (1 << 13) 1223#define OMAP4430_L4PER_STATDEP_MASK (1 << 13)
1030 1224
1031/* Used by CM_L3_2_DYNAMICDEP, CM_L4PER_DYNAMICDEP */ 1225/* Used by CM_L3_2_DYNAMICDEP, CM_L4PER_DYNAMICDEP */
1032#define OMAP4430_L4SEC_DYNDEP_SHIFT 14 1226#define OMAP4430_L4SEC_DYNDEP_SHIFT 14
1227#define OMAP4430_L4SEC_DYNDEP_WIDTH 0x1
1033#define OMAP4430_L4SEC_DYNDEP_MASK (1 << 14) 1228#define OMAP4430_L4SEC_DYNDEP_MASK (1 << 14)
1034 1229
1035/* 1230/*
@@ -1037,10 +1232,12 @@
1037 * CM_SDMA_STATICDEP 1232 * CM_SDMA_STATICDEP
1038 */ 1233 */
1039#define OMAP4430_L4SEC_STATDEP_SHIFT 14 1234#define OMAP4430_L4SEC_STATDEP_SHIFT 14
1235#define OMAP4430_L4SEC_STATDEP_WIDTH 0x1
1040#define OMAP4430_L4SEC_STATDEP_MASK (1 << 14) 1236#define OMAP4430_L4SEC_STATDEP_MASK (1 << 14)
1041 1237
1042/* Used by CM_L4CFG_DYNAMICDEP */ 1238/* Used by CM_L4CFG_DYNAMICDEP */
1043#define OMAP4430_L4WKUP_DYNDEP_SHIFT 15 1239#define OMAP4430_L4WKUP_DYNDEP_SHIFT 15
1240#define OMAP4430_L4WKUP_DYNDEP_WIDTH 0x1
1044#define OMAP4430_L4WKUP_DYNDEP_MASK (1 << 15) 1241#define OMAP4430_L4WKUP_DYNDEP_MASK (1 << 15)
1045 1242
1046/* 1243/*
@@ -1048,6 +1245,7 @@
1048 * CM_SDMA_STATICDEP, CM_TESLA_STATICDEP 1245 * CM_SDMA_STATICDEP, CM_TESLA_STATICDEP
1049 */ 1246 */
1050#define OMAP4430_L4WKUP_STATDEP_SHIFT 15 1247#define OMAP4430_L4WKUP_STATDEP_SHIFT 15
1248#define OMAP4430_L4WKUP_STATDEP_WIDTH 0x1
1051#define OMAP4430_L4WKUP_STATDEP_MASK (1 << 15) 1249#define OMAP4430_L4WKUP_STATDEP_MASK (1 << 15)
1052 1250
1053/* 1251/*
@@ -1055,6 +1253,7 @@
1055 * CM_MPU_DYNAMICDEP 1253 * CM_MPU_DYNAMICDEP
1056 */ 1254 */
1057#define OMAP4430_MEMIF_DYNDEP_SHIFT 4 1255#define OMAP4430_MEMIF_DYNDEP_SHIFT 4
1256#define OMAP4430_MEMIF_DYNDEP_WIDTH 0x1
1058#define OMAP4430_MEMIF_DYNDEP_MASK (1 << 4) 1257#define OMAP4430_MEMIF_DYNDEP_MASK (1 << 4)
1059 1258
1060/* 1259/*
@@ -1064,6 +1263,7 @@
1064 * CM_SDMA_STATICDEP, CM_TESLA_STATICDEP 1263 * CM_SDMA_STATICDEP, CM_TESLA_STATICDEP
1065 */ 1264 */
1066#define OMAP4430_MEMIF_STATDEP_SHIFT 4 1265#define OMAP4430_MEMIF_STATDEP_SHIFT 4
1266#define OMAP4430_MEMIF_STATDEP_WIDTH 0x1
1067#define OMAP4430_MEMIF_STATDEP_MASK (1 << 4) 1267#define OMAP4430_MEMIF_STATDEP_MASK (1 << 4)
1068 1268
1069/* 1269/*
@@ -1073,6 +1273,7 @@
1073 * CM_SSC_MODFREQDIV_DPLL_UNIPRO, CM_SSC_MODFREQDIV_DPLL_USB 1273 * CM_SSC_MODFREQDIV_DPLL_UNIPRO, CM_SSC_MODFREQDIV_DPLL_USB
1074 */ 1274 */
1075#define OMAP4430_MODFREQDIV_EXPONENT_SHIFT 8 1275#define OMAP4430_MODFREQDIV_EXPONENT_SHIFT 8
1276#define OMAP4430_MODFREQDIV_EXPONENT_WIDTH 0x3
1076#define OMAP4430_MODFREQDIV_EXPONENT_MASK (0x7 << 8) 1277#define OMAP4430_MODFREQDIV_EXPONENT_MASK (0x7 << 8)
1077 1278
1078/* 1279/*
@@ -1082,6 +1283,7 @@
1082 * CM_SSC_MODFREQDIV_DPLL_UNIPRO, CM_SSC_MODFREQDIV_DPLL_USB 1283 * CM_SSC_MODFREQDIV_DPLL_UNIPRO, CM_SSC_MODFREQDIV_DPLL_USB
1083 */ 1284 */
1084#define OMAP4430_MODFREQDIV_MANTISSA_SHIFT 0 1285#define OMAP4430_MODFREQDIV_MANTISSA_SHIFT 0
1286#define OMAP4430_MODFREQDIV_MANTISSA_WIDTH 0x7
1085#define OMAP4430_MODFREQDIV_MANTISSA_MASK (0x7f << 0) 1287#define OMAP4430_MODFREQDIV_MANTISSA_MASK (0x7f << 0)
1086 1288
1087/* 1289/*
@@ -1089,69 +1291,68 @@
1089 * CM1_ABE_MCASP_CLKCTRL, CM1_ABE_MCBSP1_CLKCTRL, CM1_ABE_MCBSP2_CLKCTRL, 1291 * CM1_ABE_MCASP_CLKCTRL, CM1_ABE_MCBSP1_CLKCTRL, CM1_ABE_MCBSP2_CLKCTRL,
1090 * CM1_ABE_MCBSP3_CLKCTRL, CM1_ABE_PDM_CLKCTRL, CM1_ABE_SLIMBUS_CLKCTRL, 1292 * CM1_ABE_MCBSP3_CLKCTRL, CM1_ABE_PDM_CLKCTRL, CM1_ABE_SLIMBUS_CLKCTRL,
1091 * CM1_ABE_TIMER5_CLKCTRL, CM1_ABE_TIMER6_CLKCTRL, CM1_ABE_TIMER7_CLKCTRL, 1293 * CM1_ABE_TIMER5_CLKCTRL, CM1_ABE_TIMER6_CLKCTRL, CM1_ABE_TIMER7_CLKCTRL,
1092 * CM1_ABE_TIMER8_CLKCTRL, CM1_ABE_WDT3_CLKCTRL, CM_ALWON_MDMINTC_CLKCTRL, 1294 * CM1_ABE_TIMER8_CLKCTRL, CM1_ABE_WDT3_CLKCTRL, CM_ALWON_SR_CORE_CLKCTRL,
1093 * CM_ALWON_SR_CORE_CLKCTRL, CM_ALWON_SR_IVA_CLKCTRL, CM_ALWON_SR_MPU_CLKCTRL, 1295 * CM_ALWON_SR_IVA_CLKCTRL, CM_ALWON_SR_MPU_CLKCTRL, CM_CAM_FDIF_CLKCTRL,
1094 * CM_CAM_FDIF_CLKCTRL, CM_CAM_ISS_CLKCTRL, CM_CEFUSE_CEFUSE_CLKCTRL, 1296 * CM_CAM_ISS_CLKCTRL, CM_CEFUSE_CEFUSE_CLKCTRL, CM_CM1_PROFILING_CLKCTRL,
1095 * CM_CM1_PROFILING_CLKCTRL, CM_CM2_PROFILING_CLKCTRL, 1297 * CM_CM2_PROFILING_CLKCTRL, CM_D2D_MODEM_ICR_CLKCTRL, CM_D2D_SAD2D_CLKCTRL,
1096 * CM_D2D_MODEM_ICR_CLKCTRL, CM_D2D_SAD2D_CLKCTRL, CM_D2D_SAD2D_FW_CLKCTRL, 1298 * CM_D2D_SAD2D_FW_CLKCTRL, CM_DSS_DSS_CLKCTRL, CM_DUCATI_DUCATI_CLKCTRL,
1097 * CM_DSS_DEISS_CLKCTRL, CM_DSS_DSS_CLKCTRL, CM_DUCATI_DUCATI_CLKCTRL,
1098 * CM_EMU_DEBUGSS_CLKCTRL, CM_GFX_GFX_CLKCTRL, CM_IVAHD_IVAHD_CLKCTRL, 1299 * CM_EMU_DEBUGSS_CLKCTRL, CM_GFX_GFX_CLKCTRL, CM_IVAHD_IVAHD_CLKCTRL,
1099 * CM_IVAHD_SL2_CLKCTRL, CM_L3INIT_CCPTX_CLKCTRL, CM_L3INIT_EMAC_CLKCTRL, 1300 * CM_IVAHD_SL2_CLKCTRL, CM_L3INIT_HSI_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL,
1100 * CM_L3INIT_HSI_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL, CM_L3INIT_MMC2_CLKCTRL, 1301 * CM_L3INIT_MMC2_CLKCTRL, CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
1101 * CM_L3INIT_MMC6_CLKCTRL, CM_L3INIT_P1500_CLKCTRL, CM_L3INIT_PCIESS_CLKCTRL, 1302 * CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_FS_CLKCTRL,
1102 * CM_L3INIT_SATA_CLKCTRL, CM_L3INIT_TPPSS_CLKCTRL, CM_L3INIT_UNIPRO1_CLKCTRL, 1303 * CM_L3INIT_USB_OTG_CLKCTRL, CM_L3INIT_USB_TLL_CLKCTRL,
1103 * CM_L3INIT_USBPHYOCP2SCP_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL, 1304 * CM_L3INSTR_L3_3_CLKCTRL, CM_L3INSTR_L3_INSTR_CLKCTRL,
1104 * CM_L3INIT_USB_HOST_FS_CLKCTRL, CM_L3INIT_USB_OTG_CLKCTRL, 1305 * CM_L3INSTR_OCP_WP1_CLKCTRL, CM_L3_1_L3_1_CLKCTRL, CM_L3_2_GPMC_CLKCTRL,
1105 * CM_L3INIT_USB_TLL_CLKCTRL, CM_L3INIT_XHPI_CLKCTRL, CM_L3INSTR_L3_3_CLKCTRL, 1306 * CM_L3_2_L3_2_CLKCTRL, CM_L3_2_OCMC_RAM_CLKCTRL, CM_L4CFG_HW_SEM_CLKCTRL,
1106 * CM_L3INSTR_L3_INSTR_CLKCTRL, CM_L3INSTR_OCP_WP1_CLKCTRL, 1307 * CM_L4CFG_L4_CFG_CLKCTRL, CM_L4CFG_MAILBOX_CLKCTRL, CM_L4CFG_SAR_ROM_CLKCTRL,
1107 * CM_L3_1_L3_1_CLKCTRL, CM_L3_2_GPMC_CLKCTRL, CM_L3_2_L3_2_CLKCTRL,
1108 * CM_L3_2_OCMC_RAM_CLKCTRL, CM_L4CFG_HW_SEM_CLKCTRL, CM_L4CFG_L4_CFG_CLKCTRL,
1109 * CM_L4CFG_MAILBOX_CLKCTRL, CM_L4CFG_SAR_ROM_CLKCTRL, CM_L4PER_ADC_CLKCTRL,
1110 * CM_L4PER_DMTIMER10_CLKCTRL, CM_L4PER_DMTIMER11_CLKCTRL, 1308 * CM_L4PER_DMTIMER10_CLKCTRL, CM_L4PER_DMTIMER11_CLKCTRL,
1111 * CM_L4PER_DMTIMER2_CLKCTRL, CM_L4PER_DMTIMER3_CLKCTRL, 1309 * CM_L4PER_DMTIMER2_CLKCTRL, CM_L4PER_DMTIMER3_CLKCTRL,
1112 * CM_L4PER_DMTIMER4_CLKCTRL, CM_L4PER_DMTIMER9_CLKCTRL, CM_L4PER_ELM_CLKCTRL, 1310 * CM_L4PER_DMTIMER4_CLKCTRL, CM_L4PER_DMTIMER9_CLKCTRL, CM_L4PER_ELM_CLKCTRL,
1113 * CM_L4PER_GPIO2_CLKCTRL, CM_L4PER_GPIO3_CLKCTRL, CM_L4PER_GPIO4_CLKCTRL, 1311 * CM_L4PER_GPIO2_CLKCTRL, CM_L4PER_GPIO3_CLKCTRL, CM_L4PER_GPIO4_CLKCTRL,
1114 * CM_L4PER_GPIO5_CLKCTRL, CM_L4PER_GPIO6_CLKCTRL, CM_L4PER_HDQ1W_CLKCTRL, 1312 * CM_L4PER_GPIO5_CLKCTRL, CM_L4PER_GPIO6_CLKCTRL, CM_L4PER_HDQ1W_CLKCTRL,
1115 * CM_L4PER_HECC1_CLKCTRL, CM_L4PER_HECC2_CLKCTRL, CM_L4PER_I2C1_CLKCTRL, 1313 * CM_L4PER_I2C1_CLKCTRL, CM_L4PER_I2C2_CLKCTRL, CM_L4PER_I2C3_CLKCTRL,
1116 * CM_L4PER_I2C2_CLKCTRL, CM_L4PER_I2C3_CLKCTRL, CM_L4PER_I2C4_CLKCTRL, 1314 * CM_L4PER_I2C4_CLKCTRL, CM_L4PER_I2C5_CLKCTRL, CM_L4PER_L4PER_CLKCTRL,
1117 * CM_L4PER_I2C5_CLKCTRL, CM_L4PER_L4PER_CLKCTRL, CM_L4PER_MCASP2_CLKCTRL, 1315 * CM_L4PER_MCBSP4_CLKCTRL, CM_L4PER_MCSPI1_CLKCTRL, CM_L4PER_MCSPI2_CLKCTRL,
1118 * CM_L4PER_MCASP3_CLKCTRL, CM_L4PER_MCBSP4_CLKCTRL, CM_L4PER_MCSPI1_CLKCTRL, 1316 * CM_L4PER_MCSPI3_CLKCTRL, CM_L4PER_MCSPI4_CLKCTRL, CM_L4PER_MMCSD3_CLKCTRL,
1119 * CM_L4PER_MCSPI2_CLKCTRL, CM_L4PER_MCSPI3_CLKCTRL, CM_L4PER_MCSPI4_CLKCTRL, 1317 * CM_L4PER_MMCSD4_CLKCTRL, CM_L4PER_MMCSD5_CLKCTRL, CM_L4PER_SLIMBUS2_CLKCTRL,
1120 * CM_L4PER_MGATE_CLKCTRL, CM_L4PER_MMCSD3_CLKCTRL, CM_L4PER_MMCSD4_CLKCTRL, 1318 * CM_L4PER_UART1_CLKCTRL, CM_L4PER_UART2_CLKCTRL, CM_L4PER_UART3_CLKCTRL,
1121 * CM_L4PER_MMCSD5_CLKCTRL, CM_L4PER_MSPROHG_CLKCTRL, 1319 * CM_L4PER_UART4_CLKCTRL, CM_L4SEC_AES1_CLKCTRL, CM_L4SEC_AES2_CLKCTRL,
1122 * CM_L4PER_SLIMBUS2_CLKCTRL, CM_L4PER_UART1_CLKCTRL, CM_L4PER_UART2_CLKCTRL, 1320 * CM_L4SEC_CRYPTODMA_CLKCTRL, CM_L4SEC_DES3DES_CLKCTRL,
1123 * CM_L4PER_UART3_CLKCTRL, CM_L4PER_UART4_CLKCTRL, CM_L4SEC_AES1_CLKCTRL,
1124 * CM_L4SEC_AES2_CLKCTRL, CM_L4SEC_CRYPTODMA_CLKCTRL, CM_L4SEC_DES3DES_CLKCTRL,
1125 * CM_L4SEC_PKAEIP29_CLKCTRL, CM_L4SEC_RNG_CLKCTRL, CM_L4SEC_SHA2MD51_CLKCTRL, 1321 * CM_L4SEC_PKAEIP29_CLKCTRL, CM_L4SEC_RNG_CLKCTRL, CM_L4SEC_SHA2MD51_CLKCTRL,
1126 * CM_MEMIF_DMM_CLKCTRL, CM_MEMIF_EMIF_1_CLKCTRL, CM_MEMIF_EMIF_2_CLKCTRL, 1322 * CM_MEMIF_DMM_CLKCTRL, CM_MEMIF_EMIF_1_CLKCTRL, CM_MEMIF_EMIF_2_CLKCTRL,
1127 * CM_MEMIF_EMIF_FW_CLKCTRL, CM_MEMIF_EMIF_H1_CLKCTRL, 1323 * CM_MEMIF_EMIF_FW_CLKCTRL, CM_MPU_MPU_CLKCTRL, CM_SDMA_SDMA_CLKCTRL,
1128 * CM_MEMIF_EMIF_H2_CLKCTRL, CM_MPU_MPU_CLKCTRL, CM_SDMA_SDMA_CLKCTRL,
1129 * CM_TESLA_TESLA_CLKCTRL, CM_WKUP_GPIO1_CLKCTRL, CM_WKUP_KEYBOARD_CLKCTRL, 1324 * CM_TESLA_TESLA_CLKCTRL, CM_WKUP_GPIO1_CLKCTRL, CM_WKUP_KEYBOARD_CLKCTRL,
1130 * CM_WKUP_L4WKUP_CLKCTRL, CM_WKUP_RTC_CLKCTRL, CM_WKUP_SARRAM_CLKCTRL, 1325 * CM_WKUP_L4WKUP_CLKCTRL, CM_WKUP_SARRAM_CLKCTRL, CM_WKUP_SYNCTIMER_CLKCTRL,
1131 * CM_WKUP_SYNCTIMER_CLKCTRL, CM_WKUP_TIMER12_CLKCTRL, CM_WKUP_TIMER1_CLKCTRL, 1326 * CM_WKUP_TIMER12_CLKCTRL, CM_WKUP_TIMER1_CLKCTRL, CM_WKUP_USIM_CLKCTRL,
1132 * CM_WKUP_USIM_CLKCTRL, CM_WKUP_WDT1_CLKCTRL, CM_WKUP_WDT2_CLKCTRL 1327 * CM_WKUP_WDT1_CLKCTRL, CM_WKUP_WDT2_CLKCTRL
1133 */ 1328 */
1134#define OMAP4430_MODULEMODE_SHIFT 0 1329#define OMAP4430_MODULEMODE_SHIFT 0
1330#define OMAP4430_MODULEMODE_WIDTH 0x2
1135#define OMAP4430_MODULEMODE_MASK (0x3 << 0) 1331#define OMAP4430_MODULEMODE_MASK (0x3 << 0)
1136 1332
1137/* Used by CM_L4CFG_DYNAMICDEP */ 1333/* Used by CM_L4CFG_DYNAMICDEP */
1138#define OMAP4460_MPU_DYNDEP_SHIFT 19 1334#define OMAP4460_MPU_DYNDEP_SHIFT 19
1335#define OMAP4460_MPU_DYNDEP_WIDTH 0x1
1139#define OMAP4460_MPU_DYNDEP_MASK (1 << 19) 1336#define OMAP4460_MPU_DYNDEP_MASK (1 << 19)
1140 1337
1141/* Used by CM_DSS_DSS_CLKCTRL */ 1338/* Used by CM_DSS_DSS_CLKCTRL */
1142#define OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT 9 1339#define OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT 9
1340#define OMAP4430_OPTFCLKEN_48MHZ_CLK_WIDTH 0x1
1143#define OMAP4430_OPTFCLKEN_48MHZ_CLK_MASK (1 << 9) 1341#define OMAP4430_OPTFCLKEN_48MHZ_CLK_MASK (1 << 9)
1144 1342
1145/* Used by CM_WKUP_BANDGAP_CLKCTRL */ 1343/* Used by CM_WKUP_BANDGAP_CLKCTRL */
1146#define OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT 8 1344#define OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT 8
1345#define OMAP4430_OPTFCLKEN_BGAP_32K_WIDTH 0x1
1147#define OMAP4430_OPTFCLKEN_BGAP_32K_MASK (1 << 8) 1346#define OMAP4430_OPTFCLKEN_BGAP_32K_MASK (1 << 8)
1148 1347
1149/* Used by CM_ALWON_USBPHY_CLKCTRL */ 1348/* Used by CM_ALWON_USBPHY_CLKCTRL */
1150#define OMAP4430_OPTFCLKEN_CLK32K_SHIFT 8 1349#define OMAP4430_OPTFCLKEN_CLK32K_SHIFT 8
1350#define OMAP4430_OPTFCLKEN_CLK32K_WIDTH 0x1
1151#define OMAP4430_OPTFCLKEN_CLK32K_MASK (1 << 8) 1351#define OMAP4430_OPTFCLKEN_CLK32K_MASK (1 << 8)
1152 1352
1153/* Used by CM_CAM_ISS_CLKCTRL */ 1353/* Used by CM_CAM_ISS_CLKCTRL */
1154#define OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT 8 1354#define OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT 8
1355#define OMAP4430_OPTFCLKEN_CTRLCLK_WIDTH 0x1
1155#define OMAP4430_OPTFCLKEN_CTRLCLK_MASK (1 << 8) 1356#define OMAP4430_OPTFCLKEN_CTRLCLK_MASK (1 << 8)
1156 1357
1157/* 1358/*
@@ -1160,126 +1361,157 @@
1160 * CM_WKUP_GPIO1_CLKCTRL 1361 * CM_WKUP_GPIO1_CLKCTRL
1161 */ 1362 */
1162#define OMAP4430_OPTFCLKEN_DBCLK_SHIFT 8 1363#define OMAP4430_OPTFCLKEN_DBCLK_SHIFT 8
1364#define OMAP4430_OPTFCLKEN_DBCLK_WIDTH 0x1
1163#define OMAP4430_OPTFCLKEN_DBCLK_MASK (1 << 8) 1365#define OMAP4430_OPTFCLKEN_DBCLK_MASK (1 << 8)
1164 1366
1165/* Used by CM_MEMIF_DLL_CLKCTRL, CM_MEMIF_DLL_H_CLKCTRL */ 1367/* Used by CM_MEMIF_DLL_CLKCTRL, CM_MEMIF_DLL_H_CLKCTRL */
1166#define OMAP4430_OPTFCLKEN_DLL_CLK_SHIFT 8 1368#define OMAP4430_OPTFCLKEN_DLL_CLK_SHIFT 8
1369#define OMAP4430_OPTFCLKEN_DLL_CLK_WIDTH 0x1
1167#define OMAP4430_OPTFCLKEN_DLL_CLK_MASK (1 << 8) 1370#define OMAP4430_OPTFCLKEN_DLL_CLK_MASK (1 << 8)
1168 1371
1169/* Used by CM_DSS_DSS_CLKCTRL */ 1372/* Used by CM_DSS_DSS_CLKCTRL */
1170#define OMAP4430_OPTFCLKEN_DSSCLK_SHIFT 8 1373#define OMAP4430_OPTFCLKEN_DSSCLK_SHIFT 8
1374#define OMAP4430_OPTFCLKEN_DSSCLK_WIDTH 0x1
1171#define OMAP4430_OPTFCLKEN_DSSCLK_MASK (1 << 8) 1375#define OMAP4430_OPTFCLKEN_DSSCLK_MASK (1 << 8)
1172 1376
1173/* Used by CM_WKUP_USIM_CLKCTRL */ 1377/* Used by CM_WKUP_USIM_CLKCTRL */
1174#define OMAP4430_OPTFCLKEN_FCLK_SHIFT 8 1378#define OMAP4430_OPTFCLKEN_FCLK_SHIFT 8
1379#define OMAP4430_OPTFCLKEN_FCLK_WIDTH 0x1
1175#define OMAP4430_OPTFCLKEN_FCLK_MASK (1 << 8) 1380#define OMAP4430_OPTFCLKEN_FCLK_MASK (1 << 8)
1176 1381
1177/* Used by CM1_ABE_SLIMBUS_CLKCTRL */ 1382/* Used by CM1_ABE_SLIMBUS_CLKCTRL */
1178#define OMAP4430_OPTFCLKEN_FCLK0_SHIFT 8 1383#define OMAP4430_OPTFCLKEN_FCLK0_SHIFT 8
1384#define OMAP4430_OPTFCLKEN_FCLK0_WIDTH 0x1
1179#define OMAP4430_OPTFCLKEN_FCLK0_MASK (1 << 8) 1385#define OMAP4430_OPTFCLKEN_FCLK0_MASK (1 << 8)
1180 1386
1181/* Used by CM1_ABE_SLIMBUS_CLKCTRL */ 1387/* Used by CM1_ABE_SLIMBUS_CLKCTRL */
1182#define OMAP4430_OPTFCLKEN_FCLK1_SHIFT 9 1388#define OMAP4430_OPTFCLKEN_FCLK1_SHIFT 9
1389#define OMAP4430_OPTFCLKEN_FCLK1_WIDTH 0x1
1183#define OMAP4430_OPTFCLKEN_FCLK1_MASK (1 << 9) 1390#define OMAP4430_OPTFCLKEN_FCLK1_MASK (1 << 9)
1184 1391
1185/* Used by CM1_ABE_SLIMBUS_CLKCTRL */ 1392/* Used by CM1_ABE_SLIMBUS_CLKCTRL */
1186#define OMAP4430_OPTFCLKEN_FCLK2_SHIFT 10 1393#define OMAP4430_OPTFCLKEN_FCLK2_SHIFT 10
1394#define OMAP4430_OPTFCLKEN_FCLK2_WIDTH 0x1
1187#define OMAP4430_OPTFCLKEN_FCLK2_MASK (1 << 10) 1395#define OMAP4430_OPTFCLKEN_FCLK2_MASK (1 << 10)
1188 1396
1189/* Used by CM_L3INIT_USB_HOST_CLKCTRL */ 1397/* Used by CM_L3INIT_USB_HOST_CLKCTRL */
1190#define OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT 15 1398#define OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT 15
1399#define OMAP4430_OPTFCLKEN_FUNC48MCLK_WIDTH 0x1
1191#define OMAP4430_OPTFCLKEN_FUNC48MCLK_MASK (1 << 15) 1400#define OMAP4430_OPTFCLKEN_FUNC48MCLK_MASK (1 << 15)
1192 1401
1193/* Used by CM_L3INIT_USB_HOST_CLKCTRL */ 1402/* Used by CM_L3INIT_USB_HOST_CLKCTRL */
1194#define OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT 13 1403#define OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT 13
1404#define OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_WIDTH 0x1
1195#define OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_MASK (1 << 13) 1405#define OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_MASK (1 << 13)
1196 1406
1197/* Used by CM_L3INIT_USB_HOST_CLKCTRL */ 1407/* Used by CM_L3INIT_USB_HOST_CLKCTRL */
1198#define OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT 14 1408#define OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT 14
1409#define OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_WIDTH 0x1
1199#define OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_MASK (1 << 14) 1410#define OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_MASK (1 << 14)
1200 1411
1201/* Used by CM_L3INIT_USB_HOST_CLKCTRL */ 1412/* Used by CM_L3INIT_USB_HOST_CLKCTRL */
1202#define OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT 11 1413#define OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT 11
1414#define OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_WIDTH 0x1
1203#define OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_MASK (1 << 11) 1415#define OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_MASK (1 << 11)
1204 1416
1205/* Used by CM_L3INIT_USB_HOST_CLKCTRL */ 1417/* Used by CM_L3INIT_USB_HOST_CLKCTRL */
1206#define OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT 12 1418#define OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT 12
1419#define OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_WIDTH 0x1
1207#define OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_MASK (1 << 12) 1420#define OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_MASK (1 << 12)
1208 1421
1209/* Used by CM_L4PER_SLIMBUS2_CLKCTRL */ 1422/* Used by CM_L4PER_SLIMBUS2_CLKCTRL */
1210#define OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT 8 1423#define OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT 8
1424#define OMAP4430_OPTFCLKEN_PER24MC_GFCLK_WIDTH 0x1
1211#define OMAP4430_OPTFCLKEN_PER24MC_GFCLK_MASK (1 << 8) 1425#define OMAP4430_OPTFCLKEN_PER24MC_GFCLK_MASK (1 << 8)
1212 1426
1213/* Used by CM_L4PER_SLIMBUS2_CLKCTRL */ 1427/* Used by CM_L4PER_SLIMBUS2_CLKCTRL */
1214#define OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT 9 1428#define OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT 9
1429#define OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_WIDTH 0x1
1215#define OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_MASK (1 << 9) 1430#define OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_MASK (1 << 9)
1216 1431
1217/* Used by CM_L3INIT_USBPHYOCP2SCP_CLKCTRL */ 1432/* Used by CM_L3INIT_USBPHYOCP2SCP_CLKCTRL */
1218#define OMAP4430_OPTFCLKEN_PHY_48M_SHIFT 8 1433#define OMAP4430_OPTFCLKEN_PHY_48M_SHIFT 8
1434#define OMAP4430_OPTFCLKEN_PHY_48M_WIDTH 0x1
1219#define OMAP4430_OPTFCLKEN_PHY_48M_MASK (1 << 8) 1435#define OMAP4430_OPTFCLKEN_PHY_48M_MASK (1 << 8)
1220 1436
1221/* Used by CM_L4PER_SLIMBUS2_CLKCTRL */ 1437/* Used by CM_L4PER_SLIMBUS2_CLKCTRL */
1222#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT 10 1438#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT 10
1439#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_WIDTH 0x1
1223#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_MASK (1 << 10) 1440#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_MASK (1 << 10)
1224 1441
1225/* Renamed from OPTFCLKEN_SLIMBUS_CLK Used by CM1_ABE_SLIMBUS_CLKCTRL */ 1442/* Renamed from OPTFCLKEN_SLIMBUS_CLK Used by CM1_ABE_SLIMBUS_CLKCTRL */
1226#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT 11 1443#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT 11
1444#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_WIDTH 0x1
1227#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_MASK (1 << 11) 1445#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_MASK (1 << 11)
1228 1446
1229/* Used by CM_DSS_DSS_CLKCTRL */ 1447/* Used by CM_DSS_DSS_CLKCTRL */
1230#define OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT 10 1448#define OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT 10
1449#define OMAP4430_OPTFCLKEN_SYS_CLK_WIDTH 0x1
1231#define OMAP4430_OPTFCLKEN_SYS_CLK_MASK (1 << 10) 1450#define OMAP4430_OPTFCLKEN_SYS_CLK_MASK (1 << 10)
1232 1451
1233/* Used by CM_WKUP_BANDGAP_CLKCTRL */ 1452/* Used by CM_WKUP_BANDGAP_CLKCTRL */
1234#define OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT 8 1453#define OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT 8
1454#define OMAP4460_OPTFCLKEN_TS_FCLK_WIDTH 0x1
1235#define OMAP4460_OPTFCLKEN_TS_FCLK_MASK (1 << 8) 1455#define OMAP4460_OPTFCLKEN_TS_FCLK_MASK (1 << 8)
1236 1456
1237/* Used by CM_DSS_DSS_CLKCTRL */ 1457/* Used by CM_DSS_DSS_CLKCTRL */
1238#define OMAP4430_OPTFCLKEN_TV_CLK_SHIFT 11 1458#define OMAP4430_OPTFCLKEN_TV_CLK_SHIFT 11
1459#define OMAP4430_OPTFCLKEN_TV_CLK_WIDTH 0x1
1239#define OMAP4430_OPTFCLKEN_TV_CLK_MASK (1 << 11) 1460#define OMAP4430_OPTFCLKEN_TV_CLK_MASK (1 << 11)
1240 1461
1241/* Used by CM_L3INIT_UNIPRO1_CLKCTRL */ 1462/* Used by CM_L3INIT_UNIPRO1_CLKCTRL */
1242#define OMAP4430_OPTFCLKEN_TXPHYCLK_SHIFT 8 1463#define OMAP4430_OPTFCLKEN_TXPHYCLK_SHIFT 8
1464#define OMAP4430_OPTFCLKEN_TXPHYCLK_WIDTH 0x1
1243#define OMAP4430_OPTFCLKEN_TXPHYCLK_MASK (1 << 8) 1465#define OMAP4430_OPTFCLKEN_TXPHYCLK_MASK (1 << 8)
1244 1466
1245/* Used by CM_L3INIT_USB_TLL_CLKCTRL */ 1467/* Used by CM_L3INIT_USB_TLL_CLKCTRL */
1246#define OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT 8 1468#define OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT 8
1469#define OMAP4430_OPTFCLKEN_USB_CH0_CLK_WIDTH 0x1
1247#define OMAP4430_OPTFCLKEN_USB_CH0_CLK_MASK (1 << 8) 1470#define OMAP4430_OPTFCLKEN_USB_CH0_CLK_MASK (1 << 8)
1248 1471
1249/* Used by CM_L3INIT_USB_TLL_CLKCTRL */ 1472/* Used by CM_L3INIT_USB_TLL_CLKCTRL */
1250#define OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT 9 1473#define OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT 9
1474#define OMAP4430_OPTFCLKEN_USB_CH1_CLK_WIDTH 0x1
1251#define OMAP4430_OPTFCLKEN_USB_CH1_CLK_MASK (1 << 9) 1475#define OMAP4430_OPTFCLKEN_USB_CH1_CLK_MASK (1 << 9)
1252 1476
1253/* Used by CM_L3INIT_USB_TLL_CLKCTRL */ 1477/* Used by CM_L3INIT_USB_TLL_CLKCTRL */
1254#define OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT 10 1478#define OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT 10
1479#define OMAP4430_OPTFCLKEN_USB_CH2_CLK_WIDTH 0x1
1255#define OMAP4430_OPTFCLKEN_USB_CH2_CLK_MASK (1 << 10) 1480#define OMAP4430_OPTFCLKEN_USB_CH2_CLK_MASK (1 << 10)
1256 1481
1257/* Used by CM_L3INIT_USB_HOST_CLKCTRL */ 1482/* Used by CM_L3INIT_USB_HOST_CLKCTRL */
1258#define OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT 8 1483#define OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT 8
1484#define OMAP4430_OPTFCLKEN_UTMI_P1_CLK_WIDTH 0x1
1259#define OMAP4430_OPTFCLKEN_UTMI_P1_CLK_MASK (1 << 8) 1485#define OMAP4430_OPTFCLKEN_UTMI_P1_CLK_MASK (1 << 8)
1260 1486
1261/* Used by CM_L3INIT_USB_HOST_CLKCTRL */ 1487/* Used by CM_L3INIT_USB_HOST_CLKCTRL */
1262#define OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT 9 1488#define OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT 9
1489#define OMAP4430_OPTFCLKEN_UTMI_P2_CLK_WIDTH 0x1
1263#define OMAP4430_OPTFCLKEN_UTMI_P2_CLK_MASK (1 << 9) 1490#define OMAP4430_OPTFCLKEN_UTMI_P2_CLK_MASK (1 << 9)
1264 1491
1265/* Used by CM_L3INIT_USB_HOST_CLKCTRL */ 1492/* Used by CM_L3INIT_USB_HOST_CLKCTRL */
1266#define OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT 10 1493#define OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT 10
1494#define OMAP4430_OPTFCLKEN_UTMI_P3_CLK_WIDTH 0x1
1267#define OMAP4430_OPTFCLKEN_UTMI_P3_CLK_MASK (1 << 10) 1495#define OMAP4430_OPTFCLKEN_UTMI_P3_CLK_MASK (1 << 10)
1268 1496
1269/* Used by CM_L3INIT_USB_OTG_CLKCTRL */ 1497/* Used by CM_L3INIT_USB_OTG_CLKCTRL */
1270#define OMAP4430_OPTFCLKEN_XCLK_SHIFT 8 1498#define OMAP4430_OPTFCLKEN_XCLK_SHIFT 8
1499#define OMAP4430_OPTFCLKEN_XCLK_WIDTH 0x1
1271#define OMAP4430_OPTFCLKEN_XCLK_MASK (1 << 8) 1500#define OMAP4430_OPTFCLKEN_XCLK_MASK (1 << 8)
1272 1501
1273/* Used by CM_EMU_OVERRIDE_DPLL_CORE */ 1502/* Used by CM_EMU_OVERRIDE_DPLL_CORE */
1274#define OMAP4430_OVERRIDE_ENABLE_SHIFT 19 1503#define OMAP4430_OVERRIDE_ENABLE_SHIFT 19
1504#define OMAP4430_OVERRIDE_ENABLE_WIDTH 0x1
1275#define OMAP4430_OVERRIDE_ENABLE_MASK (1 << 19) 1505#define OMAP4430_OVERRIDE_ENABLE_MASK (1 << 19)
1276 1506
1277/* Used by CM_CLKSEL_ABE */ 1507/* Used by CM_CLKSEL_ABE */
1278#define OMAP4430_PAD_CLKS_GATE_SHIFT 8 1508#define OMAP4430_PAD_CLKS_GATE_SHIFT 8
1509#define OMAP4430_PAD_CLKS_GATE_WIDTH 0x1
1279#define OMAP4430_PAD_CLKS_GATE_MASK (1 << 8) 1510#define OMAP4430_PAD_CLKS_GATE_MASK (1 << 8)
1280 1511
1281/* Used by CM_CORE_DVFS_CURRENT, CM_IVA_DVFS_CURRENT */ 1512/* Used by CM_CORE_DVFS_CURRENT, CM_IVA_DVFS_CURRENT */
1282#define OMAP4430_PERF_CURRENT_SHIFT 0 1513#define OMAP4430_PERF_CURRENT_SHIFT 0
1514#define OMAP4430_PERF_CURRENT_WIDTH 0x8
1283#define OMAP4430_PERF_CURRENT_MASK (0xff << 0) 1515#define OMAP4430_PERF_CURRENT_MASK (0xff << 0)
1284 1516
1285/* 1517/*
@@ -1288,74 +1520,85 @@
1288 * CM_IVA_DVFS_PERF_TESLA 1520 * CM_IVA_DVFS_PERF_TESLA
1289 */ 1521 */
1290#define OMAP4430_PERF_REQ_SHIFT 0 1522#define OMAP4430_PERF_REQ_SHIFT 0
1523#define OMAP4430_PERF_REQ_WIDTH 0x8
1291#define OMAP4430_PERF_REQ_MASK (0xff << 0) 1524#define OMAP4430_PERF_REQ_MASK (0xff << 0)
1292 1525
1293/* Used by CM_RESTORE_ST */ 1526/* Used by CM_RESTORE_ST */
1294#define OMAP4430_PHASE1_COMPLETED_SHIFT 0 1527#define OMAP4430_PHASE1_COMPLETED_SHIFT 0
1528#define OMAP4430_PHASE1_COMPLETED_WIDTH 0x1
1295#define OMAP4430_PHASE1_COMPLETED_MASK (1 << 0) 1529#define OMAP4430_PHASE1_COMPLETED_MASK (1 << 0)
1296 1530
1297/* Used by CM_RESTORE_ST */ 1531/* Used by CM_RESTORE_ST */
1298#define OMAP4430_PHASE2A_COMPLETED_SHIFT 1 1532#define OMAP4430_PHASE2A_COMPLETED_SHIFT 1
1533#define OMAP4430_PHASE2A_COMPLETED_WIDTH 0x1
1299#define OMAP4430_PHASE2A_COMPLETED_MASK (1 << 1) 1534#define OMAP4430_PHASE2A_COMPLETED_MASK (1 << 1)
1300 1535
1301/* Used by CM_RESTORE_ST */ 1536/* Used by CM_RESTORE_ST */
1302#define OMAP4430_PHASE2B_COMPLETED_SHIFT 2 1537#define OMAP4430_PHASE2B_COMPLETED_SHIFT 2
1538#define OMAP4430_PHASE2B_COMPLETED_WIDTH 0x1
1303#define OMAP4430_PHASE2B_COMPLETED_MASK (1 << 2) 1539#define OMAP4430_PHASE2B_COMPLETED_MASK (1 << 2)
1304 1540
1305/* Used by CM_EMU_DEBUGSS_CLKCTRL */ 1541/* Used by CM_EMU_DEBUGSS_CLKCTRL */
1306#define OMAP4430_PMD_STM_MUX_CTRL_SHIFT 20 1542#define OMAP4430_PMD_STM_MUX_CTRL_SHIFT 20
1543#define OMAP4430_PMD_STM_MUX_CTRL_WIDTH 0x2
1307#define OMAP4430_PMD_STM_MUX_CTRL_MASK (0x3 << 20) 1544#define OMAP4430_PMD_STM_MUX_CTRL_MASK (0x3 << 20)
1308 1545
1309/* Used by CM_EMU_DEBUGSS_CLKCTRL */ 1546/* Used by CM_EMU_DEBUGSS_CLKCTRL */
1310#define OMAP4430_PMD_TRACE_MUX_CTRL_SHIFT 22 1547#define OMAP4430_PMD_TRACE_MUX_CTRL_SHIFT 22
1548#define OMAP4430_PMD_TRACE_MUX_CTRL_WIDTH 0x2
1311#define OMAP4430_PMD_TRACE_MUX_CTRL_MASK (0x3 << 22) 1549#define OMAP4430_PMD_TRACE_MUX_CTRL_MASK (0x3 << 22)
1312 1550
1313/* Used by CM_DYN_DEP_PRESCAL */ 1551/* Used by CM_DYN_DEP_PRESCAL */
1314#define OMAP4430_PRESCAL_SHIFT 0 1552#define OMAP4430_PRESCAL_SHIFT 0
1553#define OMAP4430_PRESCAL_WIDTH 0x6
1315#define OMAP4430_PRESCAL_MASK (0x3f << 0) 1554#define OMAP4430_PRESCAL_MASK (0x3f << 0)
1316 1555
1317/* Used by REVISION_CM1, REVISION_CM2 */ 1556/* Used by REVISION_CM1, REVISION_CM2 */
1318#define OMAP4430_R_RTL_SHIFT 11 1557#define OMAP4430_R_RTL_SHIFT 11
1558#define OMAP4430_R_RTL_WIDTH 0x5
1319#define OMAP4430_R_RTL_MASK (0x1f << 11) 1559#define OMAP4430_R_RTL_MASK (0x1f << 11)
1320 1560
1321/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_TLL_CLKCTRL */ 1561/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_TLL_CLKCTRL */
1322#define OMAP4430_SAR_MODE_SHIFT 4 1562#define OMAP4430_SAR_MODE_SHIFT 4
1563#define OMAP4430_SAR_MODE_WIDTH 0x1
1323#define OMAP4430_SAR_MODE_MASK (1 << 4) 1564#define OMAP4430_SAR_MODE_MASK (1 << 4)
1324 1565
1325/* Used by CM_SCALE_FCLK */ 1566/* Used by CM_SCALE_FCLK */
1326#define OMAP4430_SCALE_FCLK_SHIFT 0 1567#define OMAP4430_SCALE_FCLK_SHIFT 0
1568#define OMAP4430_SCALE_FCLK_WIDTH 0x1
1327#define OMAP4430_SCALE_FCLK_MASK (1 << 0) 1569#define OMAP4430_SCALE_FCLK_MASK (1 << 0)
1328 1570
1329/* Used by REVISION_CM1, REVISION_CM2 */ 1571/* Used by REVISION_CM1, REVISION_CM2 */
1330#define OMAP4430_SCHEME_SHIFT 30 1572#define OMAP4430_SCHEME_SHIFT 30
1573#define OMAP4430_SCHEME_WIDTH 0x2
1331#define OMAP4430_SCHEME_MASK (0x3 << 30) 1574#define OMAP4430_SCHEME_MASK (0x3 << 30)
1332 1575
1333/* Used by CM_L4CFG_DYNAMICDEP */ 1576/* Used by CM_L4CFG_DYNAMICDEP */
1334#define OMAP4430_SDMA_DYNDEP_SHIFT 11 1577#define OMAP4430_SDMA_DYNDEP_SHIFT 11
1578#define OMAP4430_SDMA_DYNDEP_WIDTH 0x1
1335#define OMAP4430_SDMA_DYNDEP_MASK (1 << 11) 1579#define OMAP4430_SDMA_DYNDEP_MASK (1 << 11)
1336 1580
1337/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP */ 1581/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP */
1338#define OMAP4430_SDMA_STATDEP_SHIFT 11 1582#define OMAP4430_SDMA_STATDEP_SHIFT 11
1583#define OMAP4430_SDMA_STATDEP_WIDTH 0x1
1339#define OMAP4430_SDMA_STATDEP_MASK (1 << 11) 1584#define OMAP4430_SDMA_STATDEP_MASK (1 << 11)
1340 1585
1341/* Used by CM_CLKSEL_ABE */ 1586/* Used by CM_CLKSEL_ABE */
1342#define OMAP4430_SLIMBUS_CLK_GATE_SHIFT 10 1587#define OMAP4430_SLIMBUS_CLK_GATE_SHIFT 10
1588#define OMAP4430_SLIMBUS_CLK_GATE_WIDTH 0x1
1343#define OMAP4430_SLIMBUS_CLK_GATE_MASK (1 << 10) 1589#define OMAP4430_SLIMBUS_CLK_GATE_MASK (1 << 10)
1344 1590
1345/* 1591/*
1346 * Used by CM1_ABE_AESS_CLKCTRL, CM_CAM_FDIF_CLKCTRL, CM_CAM_ISS_CLKCTRL, 1592 * Used by CM1_ABE_AESS_CLKCTRL, CM_CAM_FDIF_CLKCTRL, CM_CAM_ISS_CLKCTRL,
1347 * CM_D2D_SAD2D_CLKCTRL, CM_DSS_DEISS_CLKCTRL, CM_DSS_DSS_CLKCTRL, 1593 * CM_D2D_SAD2D_CLKCTRL, CM_DSS_DSS_CLKCTRL, CM_DUCATI_DUCATI_CLKCTRL,
1348 * CM_DUCATI_DUCATI_CLKCTRL, CM_EMU_DEBUGSS_CLKCTRL, CM_GFX_GFX_CLKCTRL, 1594 * CM_EMU_DEBUGSS_CLKCTRL, CM_GFX_GFX_CLKCTRL, CM_IVAHD_IVAHD_CLKCTRL,
1349 * CM_IVAHD_IVAHD_CLKCTRL, CM_L3INIT_CCPTX_CLKCTRL, CM_L3INIT_EMAC_CLKCTRL,
1350 * CM_L3INIT_HSI_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL, CM_L3INIT_MMC2_CLKCTRL, 1595 * CM_L3INIT_HSI_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL, CM_L3INIT_MMC2_CLKCTRL,
1351 * CM_L3INIT_MMC6_CLKCTRL, CM_L3INIT_P1500_CLKCTRL, CM_L3INIT_PCIESS_CLKCTRL,
1352 * CM_L3INIT_SATA_CLKCTRL, CM_L3INIT_TPPSS_CLKCTRL, CM_L3INIT_UNIPRO1_CLKCTRL,
1353 * CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_FS_CLKCTRL, 1596 * CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_FS_CLKCTRL,
1354 * CM_L3INIT_USB_OTG_CLKCTRL, CM_L3INIT_XHPI_CLKCTRL, 1597 * CM_L3INIT_USB_OTG_CLKCTRL, CM_L4SEC_CRYPTODMA_CLKCTRL, CM_MPU_MPU_CLKCTRL,
1355 * CM_L4SEC_CRYPTODMA_CLKCTRL, CM_MPU_MPU_CLKCTRL, CM_SDMA_SDMA_CLKCTRL, 1598 * CM_SDMA_SDMA_CLKCTRL, CM_TESLA_TESLA_CLKCTRL
1356 * CM_TESLA_TESLA_CLKCTRL
1357 */ 1599 */
1358#define OMAP4430_STBYST_SHIFT 18 1600#define OMAP4430_STBYST_SHIFT 18
1601#define OMAP4430_STBYST_WIDTH 0x1
1359#define OMAP4430_STBYST_MASK (1 << 18) 1602#define OMAP4430_STBYST_MASK (1 << 18)
1360 1603
1361/* 1604/*
@@ -1364,10 +1607,12 @@
1364 * CM_IDLEST_DPLL_UNIPRO, CM_IDLEST_DPLL_USB 1607 * CM_IDLEST_DPLL_UNIPRO, CM_IDLEST_DPLL_USB
1365 */ 1608 */
1366#define OMAP4430_ST_DPLL_CLK_SHIFT 0 1609#define OMAP4430_ST_DPLL_CLK_SHIFT 0
1610#define OMAP4430_ST_DPLL_CLK_WIDTH 0x1
1367#define OMAP4430_ST_DPLL_CLK_MASK (1 << 0) 1611#define OMAP4430_ST_DPLL_CLK_MASK (1 << 0)
1368 1612
1369/* Used by CM_CLKDCOLDO_DPLL_USB */ 1613/* Used by CM_CLKDCOLDO_DPLL_USB */
1370#define OMAP4430_ST_DPLL_CLKDCOLDO_SHIFT 9 1614#define OMAP4430_ST_DPLL_CLKDCOLDO_SHIFT 9
1615#define OMAP4430_ST_DPLL_CLKDCOLDO_WIDTH 0x1
1371#define OMAP4430_ST_DPLL_CLKDCOLDO_MASK (1 << 9) 1616#define OMAP4430_ST_DPLL_CLKDCOLDO_MASK (1 << 9)
1372 1617
1373/* 1618/*
@@ -1375,14 +1620,17 @@
1375 * CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_USB 1620 * CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_USB
1376 */ 1621 */
1377#define OMAP4430_ST_DPLL_CLKOUT_SHIFT 9 1622#define OMAP4430_ST_DPLL_CLKOUT_SHIFT 9
1623#define OMAP4430_ST_DPLL_CLKOUT_WIDTH 0x1
1378#define OMAP4430_ST_DPLL_CLKOUT_MASK (1 << 9) 1624#define OMAP4430_ST_DPLL_CLKOUT_MASK (1 << 9)
1379 1625
1380/* Used by CM_DIV_M3_DPLL_ABE, CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_PER */ 1626/* Used by CM_DIV_M3_DPLL_ABE, CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_PER */
1381#define OMAP4430_ST_DPLL_CLKOUTHIF_SHIFT 9 1627#define OMAP4430_ST_DPLL_CLKOUTHIF_SHIFT 9
1628#define OMAP4430_ST_DPLL_CLKOUTHIF_WIDTH 0x1
1382#define OMAP4430_ST_DPLL_CLKOUTHIF_MASK (1 << 9) 1629#define OMAP4430_ST_DPLL_CLKOUTHIF_MASK (1 << 9)
1383 1630
1384/* Used by CM_DIV_M2_DPLL_ABE, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO */ 1631/* Used by CM_DIV_M2_DPLL_ABE, CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO */
1385#define OMAP4430_ST_DPLL_CLKOUTX2_SHIFT 11 1632#define OMAP4430_ST_DPLL_CLKOUTX2_SHIFT 11
1633#define OMAP4430_ST_DPLL_CLKOUTX2_WIDTH 0x1
1386#define OMAP4430_ST_DPLL_CLKOUTX2_MASK (1 << 11) 1634#define OMAP4430_ST_DPLL_CLKOUTX2_MASK (1 << 11)
1387 1635
1388/* 1636/*
@@ -1390,6 +1638,7 @@
1390 * CM_DIV_M4_DPLL_PER 1638 * CM_DIV_M4_DPLL_PER
1391 */ 1639 */
1392#define OMAP4430_ST_HSDIVIDER_CLKOUT1_SHIFT 9 1640#define OMAP4430_ST_HSDIVIDER_CLKOUT1_SHIFT 9
1641#define OMAP4430_ST_HSDIVIDER_CLKOUT1_WIDTH 0x1
1393#define OMAP4430_ST_HSDIVIDER_CLKOUT1_MASK (1 << 9) 1642#define OMAP4430_ST_HSDIVIDER_CLKOUT1_MASK (1 << 9)
1394 1643
1395/* 1644/*
@@ -1397,14 +1646,17 @@
1397 * CM_DIV_M5_DPLL_PER 1646 * CM_DIV_M5_DPLL_PER
1398 */ 1647 */
1399#define OMAP4430_ST_HSDIVIDER_CLKOUT2_SHIFT 9 1648#define OMAP4430_ST_HSDIVIDER_CLKOUT2_SHIFT 9
1649#define OMAP4430_ST_HSDIVIDER_CLKOUT2_WIDTH 0x1
1400#define OMAP4430_ST_HSDIVIDER_CLKOUT2_MASK (1 << 9) 1650#define OMAP4430_ST_HSDIVIDER_CLKOUT2_MASK (1 << 9)
1401 1651
1402/* Used by CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY, CM_DIV_M6_DPLL_PER */ 1652/* Used by CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY, CM_DIV_M6_DPLL_PER */
1403#define OMAP4430_ST_HSDIVIDER_CLKOUT3_SHIFT 9 1653#define OMAP4430_ST_HSDIVIDER_CLKOUT3_SHIFT 9
1654#define OMAP4430_ST_HSDIVIDER_CLKOUT3_WIDTH 0x1
1404#define OMAP4430_ST_HSDIVIDER_CLKOUT3_MASK (1 << 9) 1655#define OMAP4430_ST_HSDIVIDER_CLKOUT3_MASK (1 << 9)
1405 1656
1406/* Used by CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_PER */ 1657/* Used by CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_PER */
1407#define OMAP4430_ST_HSDIVIDER_CLKOUT4_SHIFT 9 1658#define OMAP4430_ST_HSDIVIDER_CLKOUT4_SHIFT 9
1659#define OMAP4430_ST_HSDIVIDER_CLKOUT4_WIDTH 0x1
1408#define OMAP4430_ST_HSDIVIDER_CLKOUT4_MASK (1 << 9) 1660#define OMAP4430_ST_HSDIVIDER_CLKOUT4_MASK (1 << 9)
1409 1661
1410/* 1662/*
@@ -1413,18 +1665,22 @@
1413 * CM_IDLEST_DPLL_UNIPRO, CM_IDLEST_DPLL_USB 1665 * CM_IDLEST_DPLL_UNIPRO, CM_IDLEST_DPLL_USB
1414 */ 1666 */
1415#define OMAP4430_ST_MN_BYPASS_SHIFT 8 1667#define OMAP4430_ST_MN_BYPASS_SHIFT 8
1668#define OMAP4430_ST_MN_BYPASS_WIDTH 0x1
1416#define OMAP4430_ST_MN_BYPASS_MASK (1 << 8) 1669#define OMAP4430_ST_MN_BYPASS_MASK (1 << 8)
1417 1670
1418/* Used by CM_SYS_CLKSEL */ 1671/* Used by CM_SYS_CLKSEL */
1419#define OMAP4430_SYS_CLKSEL_SHIFT 0 1672#define OMAP4430_SYS_CLKSEL_SHIFT 0
1673#define OMAP4430_SYS_CLKSEL_WIDTH 0x3
1420#define OMAP4430_SYS_CLKSEL_MASK (0x7 << 0) 1674#define OMAP4430_SYS_CLKSEL_MASK (0x7 << 0)
1421 1675
1422/* Used by CM_L4CFG_DYNAMICDEP */ 1676/* Used by CM_L4CFG_DYNAMICDEP */
1423#define OMAP4430_TESLA_DYNDEP_SHIFT 1 1677#define OMAP4430_TESLA_DYNDEP_SHIFT 1
1678#define OMAP4430_TESLA_DYNDEP_WIDTH 0x1
1424#define OMAP4430_TESLA_DYNDEP_MASK (1 << 1) 1679#define OMAP4430_TESLA_DYNDEP_MASK (1 << 1)
1425 1680
1426/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP */ 1681/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP */
1427#define OMAP4430_TESLA_STATDEP_SHIFT 1 1682#define OMAP4430_TESLA_STATDEP_SHIFT 1
1683#define OMAP4430_TESLA_STATDEP_WIDTH 0x1
1428#define OMAP4430_TESLA_STATDEP_MASK (1 << 1) 1684#define OMAP4430_TESLA_STATDEP_MASK (1 << 1)
1429 1685
1430/* 1686/*
@@ -1433,13 +1689,16 @@
1433 * CM_L4PER_DYNAMICDEP, CM_MPU_DYNAMICDEP, CM_TESLA_DYNAMICDEP 1689 * CM_L4PER_DYNAMICDEP, CM_MPU_DYNAMICDEP, CM_TESLA_DYNAMICDEP
1434 */ 1690 */
1435#define OMAP4430_WINDOWSIZE_SHIFT 24 1691#define OMAP4430_WINDOWSIZE_SHIFT 24
1692#define OMAP4430_WINDOWSIZE_WIDTH 0x4
1436#define OMAP4430_WINDOWSIZE_MASK (0xf << 24) 1693#define OMAP4430_WINDOWSIZE_MASK (0xf << 24)
1437 1694
1438/* Used by REVISION_CM1, REVISION_CM2 */ 1695/* Used by REVISION_CM1, REVISION_CM2 */
1439#define OMAP4430_X_MAJOR_SHIFT 8 1696#define OMAP4430_X_MAJOR_SHIFT 8
1697#define OMAP4430_X_MAJOR_WIDTH 0x3
1440#define OMAP4430_X_MAJOR_MASK (0x7 << 8) 1698#define OMAP4430_X_MAJOR_MASK (0x7 << 8)
1441 1699
1442/* Used by REVISION_CM1, REVISION_CM2 */ 1700/* Used by REVISION_CM1, REVISION_CM2 */
1443#define OMAP4430_Y_MINOR_SHIFT 0 1701#define OMAP4430_Y_MINOR_SHIFT 0
1702#define OMAP4430_Y_MINOR_WIDTH 0x6
1444#define OMAP4430_Y_MINOR_MASK (0x3f << 0) 1703#define OMAP4430_Y_MINOR_MASK (0x3f << 0)
1445#endif 1704#endif
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.c b/arch/arm/mach-omap2/cm2xxx_3xxx.c
index a911e76b4ecf..7f07ab02a5b3 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.c
@@ -35,7 +35,7 @@
35#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3 35#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
36 36
37static const u8 cm_idlest_offs[] = { 37static const u8 cm_idlest_offs[] = {
38 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3 38 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
39}; 39};
40 40
41u32 omap2_cm_read_mod_reg(s16 module, u16 idx) 41u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.h b/arch/arm/mach-omap2/cm2xxx_3xxx.h
index 088bbad73db5..57b2f3c2fbf3 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.h
@@ -71,6 +71,7 @@
71#define OMAP24XX_CM_FCLKEN2 0x0004 71#define OMAP24XX_CM_FCLKEN2 0x0004
72#define OMAP24XX_CM_ICLKEN4 0x001c 72#define OMAP24XX_CM_ICLKEN4 0x001c
73#define OMAP24XX_CM_AUTOIDLE4 0x003c 73#define OMAP24XX_CM_AUTOIDLE4 0x003c
74#define OMAP24XX_CM_IDLEST4 0x002c
74 75
75#define OMAP2430_CM_IDLEST3 0x0028 76#define OMAP2430_CM_IDLEST3 0x0028
76 77
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index 123186ac7d2e..a89e8256fd0e 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -354,6 +354,7 @@
354 354
355/* AM33XX CONTROL_STATUS bitfields (partial) */ 355/* AM33XX CONTROL_STATUS bitfields (partial) */
356#define AM33XX_CONTROL_STATUS_SYSBOOT1_SHIFT 22 356#define AM33XX_CONTROL_STATUS_SYSBOOT1_SHIFT 22
357#define AM33XX_CONTROL_STATUS_SYSBOOT1_WIDTH 0x2
357#define AM33XX_CONTROL_STATUS_SYSBOOT1_MASK (0x3 << 22) 358#define AM33XX_CONTROL_STATUS_SYSBOOT1_MASK (0x3 << 22)
358 359
359/* CONTROL OMAP STATUS register to identify OMAP3 features */ 360/* CONTROL OMAP STATUS register to identify OMAP3 features */
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index d092d2a89ee0..c8c211731d26 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -433,35 +433,24 @@ static void omap_init_mcspi(void)
433static inline void omap_init_mcspi(void) {} 433static inline void omap_init_mcspi(void) {}
434#endif 434#endif
435 435
436static struct resource omap2_pmu_resource = { 436/**
437 .start = 3 + OMAP_INTC_START, 437 * omap_init_rng - bind the RNG hwmod to the RNG omap_device
438 .flags = IORESOURCE_IRQ, 438 *
439}; 439 * Bind the RNG hwmod to the RNG omap_device. No return value.
440 440 */
441static struct resource omap3_pmu_resource = { 441static void omap_init_rng(void)
442 .start = 3 + OMAP_INTC_START,
443 .flags = IORESOURCE_IRQ,
444};
445
446static struct platform_device omap_pmu_device = {
447 .name = "arm-pmu",
448 .id = -1,
449 .num_resources = 1,
450};
451
452static void omap_init_pmu(void)
453{ 442{
454 if (cpu_is_omap24xx()) 443 struct omap_hwmod *oh;
455 omap_pmu_device.resource = &omap2_pmu_resource; 444 struct platform_device *pdev;
456 else if (cpu_is_omap34xx()) 445
457 omap_pmu_device.resource = &omap3_pmu_resource; 446 oh = omap_hwmod_lookup("rng");
458 else 447 if (!oh)
459 return; 448 return;
460 449
461 platform_device_register(&omap_pmu_device); 450 pdev = omap_device_build("omap_rng", -1, oh, NULL, 0, NULL, 0, 0);
451 WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
462} 452}
463 453
464
465#if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE) 454#if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
466 455
467#ifdef CONFIG_ARCH_OMAP2 456#ifdef CONFIG_ARCH_OMAP2
@@ -646,8 +635,8 @@ static int __init omap2_init_devices(void)
646 omap_init_mcpdm(); 635 omap_init_mcpdm();
647 omap_init_mcspi(); 636 omap_init_mcspi();
648 } 637 }
649 omap_init_pmu();
650 omap_init_sti(); 638 omap_init_sti();
639 omap_init_rng();
651 omap_init_sham(); 640 omap_init_sham();
652 omap_init_aes(); 641 omap_init_aes();
653 omap_init_vout(); 642 omap_init_vout();
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index af1ed7d24a1f..7012068ccbf6 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -76,14 +76,14 @@ struct omap_dss_hwmod_data {
76 const int id; 76 const int id;
77}; 77};
78 78
79static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initdata = { 79static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initconst = {
80 { "dss_core", "omapdss_dss", -1 }, 80 { "dss_core", "omapdss_dss", -1 },
81 { "dss_dispc", "omapdss_dispc", -1 }, 81 { "dss_dispc", "omapdss_dispc", -1 },
82 { "dss_rfbi", "omapdss_rfbi", -1 }, 82 { "dss_rfbi", "omapdss_rfbi", -1 },
83 { "dss_venc", "omapdss_venc", -1 }, 83 { "dss_venc", "omapdss_venc", -1 },
84}; 84};
85 85
86static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initdata = { 86static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initconst = {
87 { "dss_core", "omapdss_dss", -1 }, 87 { "dss_core", "omapdss_dss", -1 },
88 { "dss_dispc", "omapdss_dispc", -1 }, 88 { "dss_dispc", "omapdss_dispc", -1 },
89 { "dss_rfbi", "omapdss_rfbi", -1 }, 89 { "dss_rfbi", "omapdss_rfbi", -1 },
@@ -91,7 +91,7 @@ static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initdata = {
91 { "dss_dsi1", "omapdss_dsi", 0 }, 91 { "dss_dsi1", "omapdss_dsi", 0 },
92}; 92};
93 93
94static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initdata = { 94static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initconst = {
95 { "dss_core", "omapdss_dss", -1 }, 95 { "dss_core", "omapdss_dss", -1 },
96 { "dss_dispc", "omapdss_dispc", -1 }, 96 { "dss_dispc", "omapdss_dispc", -1 },
97 { "dss_rfbi", "omapdss_rfbi", -1 }, 97 { "dss_rfbi", "omapdss_rfbi", -1 },
@@ -488,7 +488,7 @@ int omap_dss_reset(struct omap_hwmod *oh)
488 488
489 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) 489 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
490 if (oc->_clk) 490 if (oc->_clk)
491 clk_enable(oc->_clk); 491 clk_prepare_enable(oc->_clk);
492 492
493 dispc_disable_outputs(); 493 dispc_disable_outputs();
494 494
@@ -515,7 +515,7 @@ int omap_dss_reset(struct omap_hwmod *oh)
515 515
516 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) 516 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
517 if (oc->_clk) 517 if (oc->_clk)
518 clk_disable(oc->_clk); 518 clk_disable_unprepare(oc->_clk);
519 519
520 r = (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 0; 520 r = (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 0;
521 521
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 27d79deb4ba2..814e1808e158 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -63,8 +63,10 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
63 const struct dpll_data *dd; 63 const struct dpll_data *dd;
64 int i = 0; 64 int i = 0;
65 int ret = -EINVAL; 65 int ret = -EINVAL;
66 const char *clk_name;
66 67
67 dd = clk->dpll_data; 68 dd = clk->dpll_data;
69 clk_name = __clk_get_name(clk);
68 70
69 state <<= __ffs(dd->idlest_mask); 71 state <<= __ffs(dd->idlest_mask);
70 72
@@ -76,10 +78,10 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
76 78
77 if (i == MAX_DPLL_WAIT_TRIES) { 79 if (i == MAX_DPLL_WAIT_TRIES) {
78 printk(KERN_ERR "clock: %s failed transition to '%s'\n", 80 printk(KERN_ERR "clock: %s failed transition to '%s'\n",
79 clk->name, (state) ? "locked" : "bypassed"); 81 clk_name, (state) ? "locked" : "bypassed");
80 } else { 82 } else {
81 pr_debug("clock: %s transition to '%s' in %d loops\n", 83 pr_debug("clock: %s transition to '%s' in %d loops\n",
82 clk->name, (state) ? "locked" : "bypassed", i); 84 clk_name, (state) ? "locked" : "bypassed", i);
83 85
84 ret = 0; 86 ret = 0;
85 } 87 }
@@ -93,7 +95,7 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
93 unsigned long fint; 95 unsigned long fint;
94 u16 f = 0; 96 u16 f = 0;
95 97
96 fint = clk->dpll_data->clk_ref->rate / n; 98 fint = __clk_get_rate(clk->dpll_data->clk_ref) / n;
97 99
98 pr_debug("clock: fint is %lu\n", fint); 100 pr_debug("clock: fint is %lu\n", fint);
99 101
@@ -140,7 +142,7 @@ static int _omap3_noncore_dpll_lock(struct clk *clk)
140 u8 state = 1; 142 u8 state = 1;
141 int r = 0; 143 int r = 0;
142 144
143 pr_debug("clock: locking DPLL %s\n", clk->name); 145 pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk));
144 146
145 dd = clk->dpll_data; 147 dd = clk->dpll_data;
146 state <<= __ffs(dd->idlest_mask); 148 state <<= __ffs(dd->idlest_mask);
@@ -187,7 +189,7 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
187 return -EINVAL; 189 return -EINVAL;
188 190
189 pr_debug("clock: configuring DPLL %s for low-power bypass\n", 191 pr_debug("clock: configuring DPLL %s for low-power bypass\n",
190 clk->name); 192 __clk_get_name(clk));
191 193
192 ai = omap3_dpll_autoidle_read(clk); 194 ai = omap3_dpll_autoidle_read(clk);
193 195
@@ -217,7 +219,7 @@ static int _omap3_noncore_dpll_stop(struct clk *clk)
217 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) 219 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
218 return -EINVAL; 220 return -EINVAL;
219 221
220 pr_debug("clock: stopping DPLL %s\n", clk->name); 222 pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk));
221 223
222 ai = omap3_dpll_autoidle_read(clk); 224 ai = omap3_dpll_autoidle_read(clk);
223 225
@@ -245,7 +247,7 @@ static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n)
245{ 247{
246 unsigned long fint, clkinp; /* watch out for overflow */ 248 unsigned long fint, clkinp; /* watch out for overflow */
247 249
248 clkinp = clk->parent->rate; 250 clkinp = __clk_get_rate(__clk_get_parent(clk));
249 fint = (clkinp / n) * m; 251 fint = (clkinp / n) * m;
250 252
251 if (fint < 1000000000) 253 if (fint < 1000000000)
@@ -271,7 +273,7 @@ static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n)
271 unsigned long clkinp, sd; /* watch out for overflow */ 273 unsigned long clkinp, sd; /* watch out for overflow */
272 int mod1, mod2; 274 int mod1, mod2;
273 275
274 clkinp = clk->parent->rate; 276 clkinp = __clk_get_rate(__clk_get_parent(clk));
275 277
276 /* 278 /*
277 * target sigma-delta to near 250MHz 279 * target sigma-delta to near 250MHz
@@ -380,16 +382,19 @@ int omap3_noncore_dpll_enable(struct clk *clk)
380{ 382{
381 int r; 383 int r;
382 struct dpll_data *dd; 384 struct dpll_data *dd;
385 struct clk *parent;
383 386
384 dd = clk->dpll_data; 387 dd = clk->dpll_data;
385 if (!dd) 388 if (!dd)
386 return -EINVAL; 389 return -EINVAL;
387 390
388 if (clk->rate == dd->clk_bypass->rate) { 391 parent = __clk_get_parent(clk);
389 WARN_ON(clk->parent != dd->clk_bypass); 392
393 if (__clk_get_rate(clk) == __clk_get_rate(dd->clk_bypass)) {
394 WARN_ON(parent != dd->clk_bypass);
390 r = _omap3_noncore_dpll_bypass(clk); 395 r = _omap3_noncore_dpll_bypass(clk);
391 } else { 396 } else {
392 WARN_ON(clk->parent != dd->clk_ref); 397 WARN_ON(parent != dd->clk_ref);
393 r = _omap3_noncore_dpll_lock(clk); 398 r = _omap3_noncore_dpll_lock(clk);
394 } 399 }
395 /* 400 /*
@@ -432,7 +437,7 @@ void omap3_noncore_dpll_disable(struct clk *clk)
432int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate) 437int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
433{ 438{
434 struct clk *new_parent = NULL; 439 struct clk *new_parent = NULL;
435 unsigned long hw_rate; 440 unsigned long hw_rate, bypass_rate;
436 u16 freqsel = 0; 441 u16 freqsel = 0;
437 struct dpll_data *dd; 442 struct dpll_data *dd;
438 int ret; 443 int ret;
@@ -456,7 +461,8 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
456 omap2_clk_enable(dd->clk_bypass); 461 omap2_clk_enable(dd->clk_bypass);
457 omap2_clk_enable(dd->clk_ref); 462 omap2_clk_enable(dd->clk_ref);
458 463
459 if (dd->clk_bypass->rate == rate && 464 bypass_rate = __clk_get_rate(dd->clk_bypass);
465 if (bypass_rate == rate &&
460 (clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) { 466 (clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
461 pr_debug("clock: %s: set rate: entering bypass.\n", clk->name); 467 pr_debug("clock: %s: set rate: entering bypass.\n", clk->name);
462 468
@@ -479,7 +485,7 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
479 } 485 }
480 486
481 pr_debug("clock: %s: set rate: locking rate to %lu.\n", 487 pr_debug("clock: %s: set rate: locking rate to %lu.\n",
482 clk->name, rate); 488 __clk_get_name(clk), rate);
483 489
484 ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m, 490 ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m,
485 dd->last_rounded_n, freqsel); 491 dd->last_rounded_n, freqsel);
@@ -557,7 +563,7 @@ void omap3_dpll_allow_idle(struct clk *clk)
557 563
558 if (!dd->autoidle_reg) { 564 if (!dd->autoidle_reg) {
559 pr_debug("clock: DPLL %s: autoidle not supported\n", 565 pr_debug("clock: DPLL %s: autoidle not supported\n",
560 clk->name); 566 __clk_get_name(clk));
561 return; 567 return;
562 } 568 }
563 569
@@ -591,7 +597,7 @@ void omap3_dpll_deny_idle(struct clk *clk)
591 597
592 if (!dd->autoidle_reg) { 598 if (!dd->autoidle_reg) {
593 pr_debug("clock: DPLL %s: autoidle not supported\n", 599 pr_debug("clock: DPLL %s: autoidle not supported\n",
594 clk->name); 600 __clk_get_name(clk));
595 return; 601 return;
596 } 602 }
597 603
@@ -617,11 +623,12 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
617 unsigned long rate; 623 unsigned long rate;
618 u32 v; 624 u32 v;
619 struct clk *pclk; 625 struct clk *pclk;
626 unsigned long parent_rate;
620 627
621 /* Walk up the parents of clk, looking for a DPLL */ 628 /* Walk up the parents of clk, looking for a DPLL */
622 pclk = clk->parent; 629 pclk = __clk_get_parent(clk);
623 while (pclk && !pclk->dpll_data) 630 while (pclk && !pclk->dpll_data)
624 pclk = pclk->parent; 631 pclk = __clk_get_parent(pclk);
625 632
626 /* clk does not have a DPLL as a parent? error in the clock data */ 633 /* clk does not have a DPLL as a parent? error in the clock data */
627 if (!pclk) { 634 if (!pclk) {
@@ -633,12 +640,13 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
633 640
634 WARN_ON(!dd->enable_mask); 641 WARN_ON(!dd->enable_mask);
635 642
643 parent_rate = __clk_get_rate(__clk_get_parent(clk));
636 v = __raw_readl(dd->control_reg) & dd->enable_mask; 644 v = __raw_readl(dd->control_reg) & dd->enable_mask;
637 v >>= __ffs(dd->enable_mask); 645 v >>= __ffs(dd->enable_mask);
638 if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE)) 646 if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE))
639 rate = clk->parent->rate; 647 rate = parent_rate;
640 else 648 else
641 rate = clk->parent->rate * 2; 649 rate = parent_rate * 2;
642 return rate; 650 return rate;
643} 651}
644 652
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 72428bd45efc..8ab1e1bde5e9 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -24,6 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/platform_device.h>
27 28
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
29#include <plat/gpmc.h> 30#include <plat/gpmc.h>
@@ -31,10 +32,13 @@
31#include <plat/cpu.h> 32#include <plat/cpu.h>
32#include <plat/gpmc.h> 33#include <plat/gpmc.h>
33#include <plat/sdrc.h> 34#include <plat/sdrc.h>
35#include <plat/omap_device.h>
34 36
35#include "soc.h" 37#include "soc.h"
36#include "common.h" 38#include "common.h"
37 39
40#define DEVICE_NAME "omap-gpmc"
41
38/* GPMC register offsets */ 42/* GPMC register offsets */
39#define GPMC_REVISION 0x00 43#define GPMC_REVISION 0x00
40#define GPMC_SYSCONFIG 0x10 44#define GPMC_SYSCONFIG 0x10
@@ -83,6 +87,12 @@
83#define ENABLE_PREFETCH (0x1 << 7) 87#define ENABLE_PREFETCH (0x1 << 7)
84#define DMA_MPU_MODE 2 88#define DMA_MPU_MODE 2
85 89
90#define GPMC_REVISION_MAJOR(l) ((l >> 4) & 0xf)
91#define GPMC_REVISION_MINOR(l) (l & 0xf)
92
93#define GPMC_HAS_WR_ACCESS 0x1
94#define GPMC_HAS_WR_DATA_MUX_BUS 0x2
95
86/* XXX: Only NAND irq has been considered,currently these are the only ones used 96/* XXX: Only NAND irq has been considered,currently these are the only ones used
87 */ 97 */
88#define GPMC_NR_IRQ 2 98#define GPMC_NR_IRQ 2
@@ -128,7 +138,10 @@ static struct resource gpmc_cs_mem[GPMC_CS_NUM];
128static DEFINE_SPINLOCK(gpmc_mem_lock); 138static DEFINE_SPINLOCK(gpmc_mem_lock);
129static unsigned int gpmc_cs_map; /* flag for cs which are initialized */ 139static unsigned int gpmc_cs_map; /* flag for cs which are initialized */
130static int gpmc_ecc_used = -EINVAL; /* cs using ecc engine */ 140static int gpmc_ecc_used = -EINVAL; /* cs using ecc engine */
131 141static struct device *gpmc_dev;
142static int gpmc_irq;
143static resource_size_t phys_base, mem_size;
144static unsigned gpmc_capability;
132static void __iomem *gpmc_base; 145static void __iomem *gpmc_base;
133 146
134static struct clk *gpmc_l3_clk; 147static struct clk *gpmc_l3_clk;
@@ -318,10 +331,10 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
318 331
319 GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access); 332 GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access);
320 333
321 if (cpu_is_omap34xx()) { 334 if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS)
322 GPMC_SET_ONE(GPMC_CS_CONFIG6, 16, 19, wr_data_mux_bus); 335 GPMC_SET_ONE(GPMC_CS_CONFIG6, 16, 19, wr_data_mux_bus);
336 if (gpmc_capability & GPMC_HAS_WR_ACCESS)
323 GPMC_SET_ONE(GPMC_CS_CONFIG6, 24, 28, wr_access); 337 GPMC_SET_ONE(GPMC_CS_CONFIG6, 24, 28, wr_access);
324 }
325 338
326 /* caller is expected to have initialized CONFIG1 to cover 339 /* caller is expected to have initialized CONFIG1 to cover
327 * at least sync vs async 340 * at least sync vs async
@@ -431,6 +444,20 @@ static int gpmc_cs_insert_mem(int cs, unsigned long base, unsigned long size)
431 return r; 444 return r;
432} 445}
433 446
447static int gpmc_cs_delete_mem(int cs)
448{
449 struct resource *res = &gpmc_cs_mem[cs];
450 int r;
451
452 spin_lock(&gpmc_mem_lock);
453 r = release_resource(&gpmc_cs_mem[cs]);
454 res->start = 0;
455 res->end = 0;
456 spin_unlock(&gpmc_mem_lock);
457
458 return r;
459}
460
434int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) 461int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
435{ 462{
436 struct resource *res = &gpmc_cs_mem[cs]; 463 struct resource *res = &gpmc_cs_mem[cs];
@@ -767,7 +794,7 @@ static void gpmc_irq_noop(struct irq_data *data) { }
767 794
768static unsigned int gpmc_irq_noop_ret(struct irq_data *data) { return 0; } 795static unsigned int gpmc_irq_noop_ret(struct irq_data *data) { return 0; }
769 796
770static int gpmc_setup_irq(int gpmc_irq) 797static int gpmc_setup_irq(void)
771{ 798{
772 int i; 799 int i;
773 u32 regval; 800 u32 regval;
@@ -811,7 +838,37 @@ static int gpmc_setup_irq(int gpmc_irq)
811 return request_irq(gpmc_irq, gpmc_handle_irq, 0, "gpmc", NULL); 838 return request_irq(gpmc_irq, gpmc_handle_irq, 0, "gpmc", NULL);
812} 839}
813 840
814static void __init gpmc_mem_init(void) 841static __exit int gpmc_free_irq(void)
842{
843 int i;
844
845 if (gpmc_irq)
846 free_irq(gpmc_irq, NULL);
847
848 for (i = 0; i < GPMC_NR_IRQ; i++) {
849 irq_set_handler(gpmc_client_irq[i].irq, NULL);
850 irq_set_chip(gpmc_client_irq[i].irq, &no_irq_chip);
851 irq_modify_status(gpmc_client_irq[i].irq, 0, 0);
852 }
853
854 irq_free_descs(gpmc_irq_start, GPMC_NR_IRQ);
855
856 return 0;
857}
858
859static void __devexit gpmc_mem_exit(void)
860{
861 int cs;
862
863 for (cs = 0; cs < GPMC_CS_NUM; cs++) {
864 if (!gpmc_cs_mem_enabled(cs))
865 continue;
866 gpmc_cs_delete_mem(cs);
867 }
868
869}
870
871static void __devinit gpmc_mem_init(void)
815{ 872{
816 int cs; 873 int cs;
817 unsigned long boot_rom_space = 0; 874 unsigned long boot_rom_space = 0;
@@ -838,65 +895,104 @@ static void __init gpmc_mem_init(void)
838 } 895 }
839} 896}
840 897
841static int __init gpmc_init(void) 898static __devinit int gpmc_probe(struct platform_device *pdev)
842{ 899{
843 u32 l; 900 u32 l;
844 int ret = -EINVAL; 901 struct resource *res;
845 int gpmc_irq; 902
846 char *ck = NULL; 903 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
847 904 if (res == NULL)
848 if (cpu_is_omap24xx()) { 905 return -ENOENT;
849 ck = "core_l3_ck"; 906
850 if (cpu_is_omap2420()) 907 phys_base = res->start;
851 l = OMAP2420_GPMC_BASE; 908 mem_size = resource_size(res);
852 else 909
853 l = OMAP34XX_GPMC_BASE; 910 gpmc_base = devm_request_and_ioremap(&pdev->dev, res);
854 gpmc_irq = 20 + OMAP_INTC_START; 911 if (!gpmc_base) {
855 } else if (cpu_is_omap34xx()) { 912 dev_err(&pdev->dev, "error: request memory / ioremap\n");
856 ck = "gpmc_fck"; 913 return -EADDRNOTAVAIL;
857 l = OMAP34XX_GPMC_BASE;
858 gpmc_irq = 20 + OMAP_INTC_START;
859 } else if (cpu_is_omap44xx() || soc_is_omap54xx()) {
860 /* Base address and irq number are same for OMAP4/5 */
861 ck = "gpmc_ck";
862 l = OMAP44XX_GPMC_BASE;
863 gpmc_irq = 20 + OMAP44XX_IRQ_GIC_START;
864 } 914 }
865 915
866 if (WARN_ON(!ck)) 916 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
867 return ret; 917 if (res == NULL)
918 dev_warn(&pdev->dev, "Failed to get resource: irq\n");
919 else
920 gpmc_irq = res->start;
868 921
869 gpmc_l3_clk = clk_get(NULL, ck); 922 gpmc_l3_clk = clk_get(&pdev->dev, "fck");
870 if (IS_ERR(gpmc_l3_clk)) { 923 if (IS_ERR(gpmc_l3_clk)) {
871 printk(KERN_ERR "Could not get GPMC clock %s\n", ck); 924 dev_err(&pdev->dev, "error: clk_get\n");
872 BUG(); 925 gpmc_irq = 0;
926 return PTR_ERR(gpmc_l3_clk);
873 } 927 }
874 928
875 gpmc_base = ioremap(l, SZ_4K); 929 clk_prepare_enable(gpmc_l3_clk);
876 if (!gpmc_base) {
877 clk_put(gpmc_l3_clk);
878 printk(KERN_ERR "Could not get GPMC register memory\n");
879 BUG();
880 }
881 930
882 clk_enable(gpmc_l3_clk); 931 gpmc_dev = &pdev->dev;
883 932
884 l = gpmc_read_reg(GPMC_REVISION); 933 l = gpmc_read_reg(GPMC_REVISION);
885 printk(KERN_INFO "GPMC revision %d.%d\n", (l >> 4) & 0x0f, l & 0x0f); 934 if (GPMC_REVISION_MAJOR(l) > 0x4)
886 /* Set smart idle mode and automatic L3 clock gating */ 935 gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS;
887 l = gpmc_read_reg(GPMC_SYSCONFIG); 936 dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l),
888 l &= 0x03 << 3; 937 GPMC_REVISION_MINOR(l));
889 l |= (0x02 << 3) | (1 << 0); 938
890 gpmc_write_reg(GPMC_SYSCONFIG, l);
891 gpmc_mem_init(); 939 gpmc_mem_init();
892 940
893 ret = gpmc_setup_irq(gpmc_irq); 941 if (IS_ERR_VALUE(gpmc_setup_irq()))
894 if (ret) 942 dev_warn(gpmc_dev, "gpmc_setup_irq failed\n");
895 pr_err("gpmc: irq-%d could not claim: err %d\n", 943
896 gpmc_irq, ret); 944 return 0;
897 return ret;
898} 945}
946
947static __exit int gpmc_remove(struct platform_device *pdev)
948{
949 gpmc_free_irq();
950 gpmc_mem_exit();
951 gpmc_dev = NULL;
952 return 0;
953}
954
955static struct platform_driver gpmc_driver = {
956 .probe = gpmc_probe,
957 .remove = __devexit_p(gpmc_remove),
958 .driver = {
959 .name = DEVICE_NAME,
960 .owner = THIS_MODULE,
961 },
962};
963
964static __init int gpmc_init(void)
965{
966 return platform_driver_register(&gpmc_driver);
967}
968
969static __exit void gpmc_exit(void)
970{
971 platform_driver_unregister(&gpmc_driver);
972
973}
974
899postcore_initcall(gpmc_init); 975postcore_initcall(gpmc_init);
976module_exit(gpmc_exit);
977
978static int __init omap_gpmc_init(void)
979{
980 struct omap_hwmod *oh;
981 struct platform_device *pdev;
982 char *oh_name = "gpmc";
983
984 oh = omap_hwmod_lookup(oh_name);
985 if (!oh) {
986 pr_err("Could not look up %s\n", oh_name);
987 return -ENODEV;
988 }
989
990 pdev = omap_device_build(DEVICE_NAME, -1, oh, NULL, 0, NULL, 0, 0);
991 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
992
993 return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
994}
995postcore_initcall(omap_gpmc_init);
900 996
901static irqreturn_t gpmc_handle_irq(int irq, void *dev) 997static irqreturn_t gpmc_handle_irq(int irq, void *dev)
902{ 998{
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 00c006686b0d..299ca2821ad1 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -679,16 +679,25 @@ static int _init_main_clk(struct omap_hwmod *oh)
679 if (!oh->main_clk) 679 if (!oh->main_clk)
680 return 0; 680 return 0;
681 681
682 oh->_clk = omap_clk_get_by_name(oh->main_clk); 682 oh->_clk = clk_get(NULL, oh->main_clk);
683 if (!oh->_clk) { 683 if (IS_ERR(oh->_clk)) {
684 pr_warning("omap_hwmod: %s: cannot clk_get main_clk %s\n", 684 pr_warning("omap_hwmod: %s: cannot clk_get main_clk %s\n",
685 oh->name, oh->main_clk); 685 oh->name, oh->main_clk);
686 return -EINVAL; 686 return -EINVAL;
687 } 687 }
688 /*
689 * HACK: This needs a re-visit once clk_prepare() is implemented
690 * to do something meaningful. Today its just a no-op.
691 * If clk_prepare() is used at some point to do things like
692 * voltage scaling etc, then this would have to be moved to
693 * some point where subsystems like i2c and pmic become
694 * available.
695 */
696 clk_prepare(oh->_clk);
688 697
689 if (!oh->_clk->clkdm) 698 if (!oh->_clk->clkdm)
690 pr_warning("omap_hwmod: %s: missing clockdomain for %s.\n", 699 pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n",
691 oh->main_clk, oh->_clk->name); 700 oh->name, oh->main_clk);
692 701
693 return ret; 702 return ret;
694} 703}
@@ -715,13 +724,22 @@ static int _init_interface_clks(struct omap_hwmod *oh)
715 if (!os->clk) 724 if (!os->clk)
716 continue; 725 continue;
717 726
718 c = omap_clk_get_by_name(os->clk); 727 c = clk_get(NULL, os->clk);
719 if (!c) { 728 if (IS_ERR(c)) {
720 pr_warning("omap_hwmod: %s: cannot clk_get interface_clk %s\n", 729 pr_warning("omap_hwmod: %s: cannot clk_get interface_clk %s\n",
721 oh->name, os->clk); 730 oh->name, os->clk);
722 ret = -EINVAL; 731 ret = -EINVAL;
723 } 732 }
724 os->_clk = c; 733 os->_clk = c;
734 /*
735 * HACK: This needs a re-visit once clk_prepare() is implemented
736 * to do something meaningful. Today its just a no-op.
737 * If clk_prepare() is used at some point to do things like
738 * voltage scaling etc, then this would have to be moved to
739 * some point where subsystems like i2c and pmic become
740 * available.
741 */
742 clk_prepare(os->_clk);
725 } 743 }
726 744
727 return ret; 745 return ret;
@@ -742,13 +760,22 @@ static int _init_opt_clks(struct omap_hwmod *oh)
742 int ret = 0; 760 int ret = 0;
743 761
744 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) { 762 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) {
745 c = omap_clk_get_by_name(oc->clk); 763 c = clk_get(NULL, oc->clk);
746 if (!c) { 764 if (IS_ERR(c)) {
747 pr_warning("omap_hwmod: %s: cannot clk_get opt_clk %s\n", 765 pr_warning("omap_hwmod: %s: cannot clk_get opt_clk %s\n",
748 oh->name, oc->clk); 766 oh->name, oc->clk);
749 ret = -EINVAL; 767 ret = -EINVAL;
750 } 768 }
751 oc->_clk = c; 769 oc->_clk = c;
770 /*
771 * HACK: This needs a re-visit once clk_prepare() is implemented
772 * to do something meaningful. Today its just a no-op.
773 * If clk_prepare() is used at some point to do things like
774 * voltage scaling etc, then this would have to be moved to
775 * some point where subsystems like i2c and pmic become
776 * available.
777 */
778 clk_prepare(oc->_clk);
752 } 779 }
753 780
754 return ret; 781 return ret;
@@ -827,7 +854,7 @@ static void _enable_optional_clocks(struct omap_hwmod *oh)
827 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) 854 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
828 if (oc->_clk) { 855 if (oc->_clk) {
829 pr_debug("omap_hwmod: enable %s:%s\n", oc->role, 856 pr_debug("omap_hwmod: enable %s:%s\n", oc->role,
830 oc->_clk->name); 857 __clk_get_name(oc->_clk));
831 clk_enable(oc->_clk); 858 clk_enable(oc->_clk);
832 } 859 }
833} 860}
@@ -842,7 +869,7 @@ static void _disable_optional_clocks(struct omap_hwmod *oh)
842 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) 869 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
843 if (oc->_clk) { 870 if (oc->_clk) {
844 pr_debug("omap_hwmod: disable %s:%s\n", oc->role, 871 pr_debug("omap_hwmod: disable %s:%s\n", oc->role,
845 oc->_clk->name); 872 __clk_get_name(oc->_clk));
846 clk_disable(oc->_clk); 873 clk_disable(oc->_clk);
847 } 874 }
848} 875}
@@ -900,10 +927,10 @@ static void _am33xx_enable_module(struct omap_hwmod *oh)
900 */ 927 */
901static int _omap4_wait_target_disable(struct omap_hwmod *oh) 928static int _omap4_wait_target_disable(struct omap_hwmod *oh)
902{ 929{
903 if (!oh || !oh->clkdm) 930 if (!oh)
904 return -EINVAL; 931 return -EINVAL;
905 932
906 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) 933 if (oh->_int_flags & _HWMOD_NO_MPU_PORT || !oh->clkdm)
907 return 0; 934 return 0;
908 935
909 if (oh->flags & HWMOD_NO_IDLEST) 936 if (oh->flags & HWMOD_NO_IDLEST)
@@ -1427,8 +1454,10 @@ static struct omap_hwmod *_lookup(const char *name)
1427 */ 1454 */
1428static int _init_clkdm(struct omap_hwmod *oh) 1455static int _init_clkdm(struct omap_hwmod *oh)
1429{ 1456{
1430 if (!oh->clkdm_name) 1457 if (!oh->clkdm_name) {
1458 pr_debug("omap_hwmod: %s: missing clockdomain\n", oh->name);
1431 return 0; 1459 return 0;
1460 }
1432 1461
1433 oh->clkdm = clkdm_lookup(oh->clkdm_name); 1462 oh->clkdm = clkdm_lookup(oh->clkdm_name);
1434 if (!oh->clkdm) { 1463 if (!oh->clkdm) {
@@ -1556,6 +1585,7 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1556{ 1585{
1557 struct omap_hwmod_rst_info ohri; 1586 struct omap_hwmod_rst_info ohri;
1558 int ret = -EINVAL; 1587 int ret = -EINVAL;
1588 int hwsup = 0;
1559 1589
1560 if (!oh) 1590 if (!oh)
1561 return -EINVAL; 1591 return -EINVAL;
@@ -1567,10 +1597,46 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1567 if (IS_ERR_VALUE(ret)) 1597 if (IS_ERR_VALUE(ret))
1568 return ret; 1598 return ret;
1569 1599
1600 if (oh->clkdm) {
1601 /*
1602 * A clockdomain must be in SW_SUP otherwise reset
1603 * might not be completed. The clockdomain can be set
1604 * in HW_AUTO only when the module become ready.
1605 */
1606 hwsup = clkdm_in_hwsup(oh->clkdm);
1607 ret = clkdm_hwmod_enable(oh->clkdm, oh);
1608 if (ret) {
1609 WARN(1, "omap_hwmod: %s: could not enable clockdomain %s: %d\n",
1610 oh->name, oh->clkdm->name, ret);
1611 return ret;
1612 }
1613 }
1614
1615 _enable_clocks(oh);
1616 if (soc_ops.enable_module)
1617 soc_ops.enable_module(oh);
1618
1570 ret = soc_ops.deassert_hardreset(oh, &ohri); 1619 ret = soc_ops.deassert_hardreset(oh, &ohri);
1620
1621 if (soc_ops.disable_module)
1622 soc_ops.disable_module(oh);
1623 _disable_clocks(oh);
1624
1571 if (ret == -EBUSY) 1625 if (ret == -EBUSY)
1572 pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name); 1626 pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name);
1573 1627
1628 if (!ret) {
1629 /*
1630 * Set the clockdomain to HW_AUTO, assuming that the
1631 * previous state was HW_AUTO.
1632 */
1633 if (oh->clkdm && hwsup)
1634 clkdm_allow_idle(oh->clkdm);
1635 } else {
1636 if (oh->clkdm)
1637 clkdm_hwmod_disable(oh->clkdm, oh);
1638 }
1639
1574 return ret; 1640 return ret;
1575} 1641}
1576 1642
@@ -1605,25 +1671,28 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name)
1605} 1671}
1606 1672
1607/** 1673/**
1608 * _are_any_hardreset_lines_asserted - return true if part of @oh is hard-reset 1674 * _are_all_hardreset_lines_asserted - return true if the @oh is hard-reset
1609 * @oh: struct omap_hwmod * 1675 * @oh: struct omap_hwmod *
1610 * 1676 *
1611 * If any hardreset line associated with @oh is asserted, then return true. 1677 * If all hardreset lines associated with @oh are asserted, then return true.
1612 * Otherwise, if @oh has no hardreset lines associated with it, or if 1678 * Otherwise, if part of @oh is out hardreset or if no hardreset lines
1613 * no hardreset lines associated with @oh are asserted, then return false. 1679 * associated with @oh are asserted, then return false.
1614 * This function is used to avoid executing some parts of the IP block 1680 * This function is used to avoid executing some parts of the IP block
1615 * enable/disable sequence if a hardreset line is set. 1681 * enable/disable sequence if its hardreset line is set.
1616 */ 1682 */
1617static bool _are_any_hardreset_lines_asserted(struct omap_hwmod *oh) 1683static bool _are_all_hardreset_lines_asserted(struct omap_hwmod *oh)
1618{ 1684{
1619 int i; 1685 int i, rst_cnt = 0;
1620 1686
1621 if (oh->rst_lines_cnt == 0) 1687 if (oh->rst_lines_cnt == 0)
1622 return false; 1688 return false;
1623 1689
1624 for (i = 0; i < oh->rst_lines_cnt; i++) 1690 for (i = 0; i < oh->rst_lines_cnt; i++)
1625 if (_read_hardreset(oh, oh->rst_lines[i].name) > 0) 1691 if (_read_hardreset(oh, oh->rst_lines[i].name) > 0)
1626 return true; 1692 rst_cnt++;
1693
1694 if (oh->rst_lines_cnt == rst_cnt)
1695 return true;
1627 1696
1628 return false; 1697 return false;
1629} 1698}
@@ -1642,6 +1711,13 @@ static int _omap4_disable_module(struct omap_hwmod *oh)
1642 if (!oh->clkdm || !oh->prcm.omap4.modulemode) 1711 if (!oh->clkdm || !oh->prcm.omap4.modulemode)
1643 return -EINVAL; 1712 return -EINVAL;
1644 1713
1714 /*
1715 * Since integration code might still be doing something, only
1716 * disable if all lines are under hardreset.
1717 */
1718 if (!_are_all_hardreset_lines_asserted(oh))
1719 return 0;
1720
1645 pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__); 1721 pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__);
1646 1722
1647 omap4_cminst_module_disable(oh->clkdm->prcm_partition, 1723 omap4_cminst_module_disable(oh->clkdm->prcm_partition,
@@ -1649,9 +1725,6 @@ static int _omap4_disable_module(struct omap_hwmod *oh)
1649 oh->clkdm->clkdm_offs, 1725 oh->clkdm->clkdm_offs,
1650 oh->prcm.omap4.clkctrl_offs); 1726 oh->prcm.omap4.clkctrl_offs);
1651 1727
1652 if (_are_any_hardreset_lines_asserted(oh))
1653 return 0;
1654
1655 v = _omap4_wait_target_disable(oh); 1728 v = _omap4_wait_target_disable(oh);
1656 if (v) 1729 if (v)
1657 pr_warn("omap_hwmod: %s: _wait_target_disable failed\n", 1730 pr_warn("omap_hwmod: %s: _wait_target_disable failed\n",
@@ -1679,7 +1752,7 @@ static int _am33xx_disable_module(struct omap_hwmod *oh)
1679 am33xx_cm_module_disable(oh->clkdm->cm_inst, oh->clkdm->clkdm_offs, 1752 am33xx_cm_module_disable(oh->clkdm->cm_inst, oh->clkdm->clkdm_offs,
1680 oh->prcm.omap4.clkctrl_offs); 1753 oh->prcm.omap4.clkctrl_offs);
1681 1754
1682 if (_are_any_hardreset_lines_asserted(oh)) 1755 if (_are_all_hardreset_lines_asserted(oh))
1683 return 0; 1756 return 0;
1684 1757
1685 v = _am33xx_wait_target_disable(oh); 1758 v = _am33xx_wait_target_disable(oh);
@@ -1907,7 +1980,7 @@ static int _enable(struct omap_hwmod *oh)
1907 } 1980 }
1908 1981
1909 /* 1982 /*
1910 * If an IP block contains HW reset lines and any of them are 1983 * If an IP block contains HW reset lines and all of them are
1911 * asserted, we let integration code associated with that 1984 * asserted, we let integration code associated with that
1912 * block handle the enable. We've received very little 1985 * block handle the enable. We've received very little
1913 * information on what those driver authors need, and until 1986 * information on what those driver authors need, and until
@@ -1915,7 +1988,7 @@ static int _enable(struct omap_hwmod *oh)
1915 * posted to the public lists, this is probably the best we 1988 * posted to the public lists, this is probably the best we
1916 * can do. 1989 * can do.
1917 */ 1990 */
1918 if (_are_any_hardreset_lines_asserted(oh)) 1991 if (_are_all_hardreset_lines_asserted(oh))
1919 return 0; 1992 return 0;
1920 1993
1921 /* Mux pins for device runtime if populated */ 1994 /* Mux pins for device runtime if populated */
@@ -1934,7 +2007,8 @@ static int _enable(struct omap_hwmod *oh)
1934 * completely the module. The clockdomain can be set 2007 * completely the module. The clockdomain can be set
1935 * in HW_AUTO only when the module become ready. 2008 * in HW_AUTO only when the module become ready.
1936 */ 2009 */
1937 hwsup = clkdm_in_hwsup(oh->clkdm); 2010 hwsup = clkdm_in_hwsup(oh->clkdm) &&
2011 !clkdm_missing_idle_reporting(oh->clkdm);
1938 r = clkdm_hwmod_enable(oh->clkdm, oh); 2012 r = clkdm_hwmod_enable(oh->clkdm, oh);
1939 if (r) { 2013 if (r) {
1940 WARN(1, "omap_hwmod: %s: could not enable clockdomain %s: %d\n", 2014 WARN(1, "omap_hwmod: %s: could not enable clockdomain %s: %d\n",
@@ -1996,7 +2070,7 @@ static int _idle(struct omap_hwmod *oh)
1996 return -EINVAL; 2070 return -EINVAL;
1997 } 2071 }
1998 2072
1999 if (_are_any_hardreset_lines_asserted(oh)) 2073 if (_are_all_hardreset_lines_asserted(oh))
2000 return 0; 2074 return 0;
2001 2075
2002 if (oh->class->sysc) 2076 if (oh->class->sysc)
@@ -2084,7 +2158,7 @@ static int _shutdown(struct omap_hwmod *oh)
2084 return -EINVAL; 2158 return -EINVAL;
2085 } 2159 }
2086 2160
2087 if (_are_any_hardreset_lines_asserted(oh)) 2161 if (_are_all_hardreset_lines_asserted(oh))
2088 return 0; 2162 return 0;
2089 2163
2090 pr_debug("omap_hwmod: %s: disabling\n", oh->name); 2164 pr_debug("omap_hwmod: %s: disabling\n", oh->name);
@@ -2608,10 +2682,10 @@ static int _omap2_wait_target_ready(struct omap_hwmod *oh)
2608 */ 2682 */
2609static int _omap4_wait_target_ready(struct omap_hwmod *oh) 2683static int _omap4_wait_target_ready(struct omap_hwmod *oh)
2610{ 2684{
2611 if (!oh || !oh->clkdm) 2685 if (!oh)
2612 return -EINVAL; 2686 return -EINVAL;
2613 2687
2614 if (oh->flags & HWMOD_NO_IDLEST) 2688 if (oh->flags & HWMOD_NO_IDLEST || !oh->clkdm)
2615 return 0; 2689 return 0;
2616 2690
2617 if (!_find_mpu_rt_port(oh)) 2691 if (!_find_mpu_rt_port(oh))
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 10575a1bc1f1..b5db6007c523 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -536,6 +536,15 @@ static struct omap_hwmod_addr_space omap2420_counter_32k_addrs[] = {
536 { } 536 { }
537}; 537};
538 538
539static struct omap_hwmod_addr_space omap2420_gpmc_addrs[] = {
540 {
541 .pa_start = 0x6800a000,
542 .pa_end = 0x6800afff,
543 .flags = ADDR_TYPE_RT
544 },
545 { }
546};
547
539static struct omap_hwmod_ocp_if omap2420_l4_wkup__counter_32k = { 548static struct omap_hwmod_ocp_if omap2420_l4_wkup__counter_32k = {
540 .master = &omap2xxx_l4_wkup_hwmod, 549 .master = &omap2xxx_l4_wkup_hwmod,
541 .slave = &omap2xxx_counter_32k_hwmod, 550 .slave = &omap2xxx_counter_32k_hwmod,
@@ -544,6 +553,14 @@ static struct omap_hwmod_ocp_if omap2420_l4_wkup__counter_32k = {
544 .user = OCP_USER_MPU | OCP_USER_SDMA, 553 .user = OCP_USER_MPU | OCP_USER_SDMA,
545}; 554};
546 555
556static struct omap_hwmod_ocp_if omap2420_l3__gpmc = {
557 .master = &omap2xxx_l3_main_hwmod,
558 .slave = &omap2xxx_gpmc_hwmod,
559 .clk = "core_l3_ck",
560 .addr = omap2420_gpmc_addrs,
561 .user = OCP_USER_MPU | OCP_USER_SDMA,
562};
563
547static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = { 564static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = {
548 &omap2xxx_l3_main__l4_core, 565 &omap2xxx_l3_main__l4_core,
549 &omap2xxx_mpu__l3_main, 566 &omap2xxx_mpu__l3_main,
@@ -585,8 +602,10 @@ static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = {
585 &omap2420_l4_core__mcbsp1, 602 &omap2420_l4_core__mcbsp1,
586 &omap2420_l4_core__mcbsp2, 603 &omap2420_l4_core__mcbsp2,
587 &omap2420_l4_core__msdi1, 604 &omap2420_l4_core__msdi1,
605 &omap2xxx_l4_core__rng,
588 &omap2420_l4_core__hdq1w, 606 &omap2420_l4_core__hdq1w,
589 &omap2420_l4_wkup__counter_32k, 607 &omap2420_l4_wkup__counter_32k,
608 &omap2420_l3__gpmc,
590 NULL, 609 NULL,
591}; 610};
592 611
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 60de70feeae5..c455e41b0237 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -888,6 +888,15 @@ static struct omap_hwmod_addr_space omap2430_counter_32k_addrs[] = {
888 { } 888 { }
889}; 889};
890 890
891static struct omap_hwmod_addr_space omap2430_gpmc_addrs[] = {
892 {
893 .pa_start = 0x6e000000,
894 .pa_end = 0x6e000fff,
895 .flags = ADDR_TYPE_RT
896 },
897 { }
898};
899
891static struct omap_hwmod_ocp_if omap2430_l4_wkup__counter_32k = { 900static struct omap_hwmod_ocp_if omap2430_l4_wkup__counter_32k = {
892 .master = &omap2xxx_l4_wkup_hwmod, 901 .master = &omap2xxx_l4_wkup_hwmod,
893 .slave = &omap2xxx_counter_32k_hwmod, 902 .slave = &omap2xxx_counter_32k_hwmod,
@@ -896,6 +905,14 @@ static struct omap_hwmod_ocp_if omap2430_l4_wkup__counter_32k = {
896 .user = OCP_USER_MPU | OCP_USER_SDMA, 905 .user = OCP_USER_MPU | OCP_USER_SDMA,
897}; 906};
898 907
908static struct omap_hwmod_ocp_if omap2430_l3__gpmc = {
909 .master = &omap2xxx_l3_main_hwmod,
910 .slave = &omap2xxx_gpmc_hwmod,
911 .clk = "core_l3_ck",
912 .addr = omap2430_gpmc_addrs,
913 .user = OCP_USER_MPU | OCP_USER_SDMA,
914};
915
899static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = { 916static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = {
900 &omap2xxx_l3_main__l4_core, 917 &omap2xxx_l3_main__l4_core,
901 &omap2xxx_mpu__l3_main, 918 &omap2xxx_mpu__l3_main,
@@ -945,7 +962,9 @@ static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = {
945 &omap2430_l4_core__mcbsp4, 962 &omap2430_l4_core__mcbsp4,
946 &omap2430_l4_core__mcbsp5, 963 &omap2430_l4_core__mcbsp5,
947 &omap2430_l4_core__hdq1w, 964 &omap2430_l4_core__hdq1w,
965 &omap2xxx_l4_core__rng,
948 &omap2430_l4_wkup__counter_32k, 966 &omap2430_l4_wkup__counter_32k,
967 &omap2430_l3__gpmc,
949 NULL, 968 NULL,
950}; 969};
951 970
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
index f853a0b1d5ca..1a1287d62648 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
@@ -129,6 +129,15 @@ struct omap_hwmod_addr_space omap2xxx_mcbsp2_addrs[] = {
129 { } 129 { }
130}; 130};
131 131
132static struct omap_hwmod_addr_space omap2_rng_addr_space[] = {
133 {
134 .pa_start = 0x480a0000,
135 .pa_end = 0x480a004f,
136 .flags = ADDR_TYPE_RT
137 },
138 { }
139};
140
132/* 141/*
133 * Common interconnect data 142 * Common interconnect data
134 */ 143 */
@@ -372,3 +381,11 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc = {
372 .user = OCP_USER_MPU | OCP_USER_SDMA, 381 .user = OCP_USER_MPU | OCP_USER_SDMA,
373}; 382};
374 383
384/* l4_core -> rng */
385struct omap_hwmod_ocp_if omap2xxx_l4_core__rng = {
386 .master = &omap2xxx_l4_core_hwmod,
387 .slave = &omap2xxx_rng_hwmod,
388 .clk = "rng_ick",
389 .addr = omap2_rng_addr_space,
390 .user = OCP_USER_MPU | OCP_USER_SDMA,
391};
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index feeb401cf87e..35dcdb66a4e0 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -173,6 +173,26 @@ struct omap_hwmod_class omap2xxx_mcspi_class = {
173}; 173};
174 174
175/* 175/*
176 * 'gpmc' class
177 * general purpose memory controller
178 */
179
180static struct omap_hwmod_class_sysconfig omap2xxx_gpmc_sysc = {
181 .rev_offs = 0x0000,
182 .sysc_offs = 0x0010,
183 .syss_offs = 0x0014,
184 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
185 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
186 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
187 .sysc_fields = &omap_hwmod_sysc_type1,
188};
189
190static struct omap_hwmod_class omap2xxx_gpmc_hwmod_class = {
191 .name = "gpmc",
192 .sysc = &omap2xxx_gpmc_sysc,
193};
194
195/*
176 * IP blocks 196 * IP blocks
177 */ 197 */
178 198
@@ -198,8 +218,14 @@ struct omap_hwmod omap2xxx_l4_wkup_hwmod = {
198}; 218};
199 219
200/* MPU */ 220/* MPU */
221static struct omap_hwmod_irq_info omap2xxx_mpu_irqs[] = {
222 { .name = "pmu", .irq = 3 },
223 { .irq = -1 }
224};
225
201struct omap_hwmod omap2xxx_mpu_hwmod = { 226struct omap_hwmod omap2xxx_mpu_hwmod = {
202 .name = "mpu", 227 .name = "mpu",
228 .mpu_irqs = omap2xxx_mpu_irqs,
203 .class = &mpu_hwmod_class, 229 .class = &mpu_hwmod_class,
204 .main_clk = "mpu_ck", 230 .main_clk = "mpu_ck",
205}; 231};
@@ -220,6 +246,11 @@ static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
220 .timer_capability = OMAP_TIMER_HAS_PWM, 246 .timer_capability = OMAP_TIMER_HAS_PWM,
221}; 247};
222 248
249/* timers with DSP interrupt dev attribute */
250static struct omap_timer_capability_dev_attr capability_dsp_dev_attr = {
251 .timer_capability = OMAP_TIMER_HAS_DSP_IRQ,
252};
253
223/* timer1 */ 254/* timer1 */
224 255
225struct omap_hwmod omap2xxx_timer1_hwmod = { 256struct omap_hwmod omap2xxx_timer1_hwmod = {
@@ -308,6 +339,7 @@ struct omap_hwmod omap2xxx_timer5_hwmod = {
308 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT, 339 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
309 }, 340 },
310 }, 341 },
342 .dev_attr = &capability_dsp_dev_attr,
311 .class = &omap2xxx_timer_hwmod_class, 343 .class = &omap2xxx_timer_hwmod_class,
312}; 344};
313 345
@@ -326,6 +358,7 @@ struct omap_hwmod omap2xxx_timer6_hwmod = {
326 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT, 358 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
327 }, 359 },
328 }, 360 },
361 .dev_attr = &capability_dsp_dev_attr,
329 .class = &omap2xxx_timer_hwmod_class, 362 .class = &omap2xxx_timer_hwmod_class,
330}; 363};
331 364
@@ -344,6 +377,7 @@ struct omap_hwmod omap2xxx_timer7_hwmod = {
344 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT, 377 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
345 }, 378 },
346 }, 379 },
380 .dev_attr = &capability_dsp_dev_attr,
347 .class = &omap2xxx_timer_hwmod_class, 381 .class = &omap2xxx_timer_hwmod_class,
348}; 382};
349 383
@@ -362,6 +396,7 @@ struct omap_hwmod omap2xxx_timer8_hwmod = {
362 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT, 396 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
363 }, 397 },
364 }, 398 },
399 .dev_attr = &capability_dsp_dev_attr,
365 .class = &omap2xxx_timer_hwmod_class, 400 .class = &omap2xxx_timer_hwmod_class,
366}; 401};
367 402
@@ -724,7 +759,6 @@ struct omap_hwmod omap2xxx_mcspi2_hwmod = {
724 .dev_attr = &omap_mcspi2_dev_attr, 759 .dev_attr = &omap_mcspi2_dev_attr,
725}; 760};
726 761
727
728static struct omap_hwmod_class omap2xxx_counter_hwmod_class = { 762static struct omap_hwmod_class omap2xxx_counter_hwmod_class = {
729 .name = "counter", 763 .name = "counter",
730}; 764};
@@ -743,3 +777,77 @@ struct omap_hwmod omap2xxx_counter_32k_hwmod = {
743 }, 777 },
744 .class = &omap2xxx_counter_hwmod_class, 778 .class = &omap2xxx_counter_hwmod_class,
745}; 779};
780
781/* gpmc */
782static struct omap_hwmod_irq_info omap2xxx_gpmc_irqs[] = {
783 { .irq = 20 },
784 { .irq = -1 }
785};
786
787struct omap_hwmod omap2xxx_gpmc_hwmod = {
788 .name = "gpmc",
789 .class = &omap2xxx_gpmc_hwmod_class,
790 .mpu_irqs = omap2xxx_gpmc_irqs,
791 .main_clk = "gpmc_fck",
792 /*
793 * XXX HWMOD_INIT_NO_RESET should not be needed for this IP
794 * block. It is not being added due to any known bugs with
795 * resetting the GPMC IP block, but rather because any timings
796 * set by the bootloader are not being correctly programmed by
797 * the kernel from the board file or DT data.
798 * HWMOD_INIT_NO_RESET should be removed ASAP.
799 */
800 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET |
801 HWMOD_NO_IDLEST),
802 .prcm = {
803 .omap2 = {
804 .prcm_reg_id = 3,
805 .module_bit = OMAP24XX_EN_GPMC_MASK,
806 .module_offs = CORE_MOD,
807 },
808 },
809};
810
811/* RNG */
812
813static struct omap_hwmod_class_sysconfig omap2_rng_sysc = {
814 .rev_offs = 0x3c,
815 .sysc_offs = 0x40,
816 .syss_offs = 0x44,
817 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
818 SYSS_HAS_RESET_STATUS),
819 .sysc_fields = &omap_hwmod_sysc_type1,
820};
821
822static struct omap_hwmod_class omap2_rng_hwmod_class = {
823 .name = "rng",
824 .sysc = &omap2_rng_sysc,
825};
826
827static struct omap_hwmod_irq_info omap2_rng_mpu_irqs[] = {
828 { .irq = 52 },
829 { .irq = -1 }
830};
831
832struct omap_hwmod omap2xxx_rng_hwmod = {
833 .name = "rng",
834 .mpu_irqs = omap2_rng_mpu_irqs,
835 .main_clk = "l4_ck",
836 .prcm = {
837 .omap2 = {
838 .module_offs = CORE_MOD,
839 .prcm_reg_id = 4,
840 .module_bit = OMAP24XX_EN_RNG_SHIFT,
841 .idlest_reg_id = 4,
842 .idlest_idle_bit = OMAP24XX_ST_RNG_SHIFT,
843 },
844 },
845 /*
846 * XXX The first read from the SYSSTATUS register of the RNG
847 * after the SYSCONFIG SOFTRESET bit is set triggers an
848 * imprecise external abort. It's unclear why this happens.
849 * Until this is analyzed, skip the IP block reset.
850 */
851 .flags = HWMOD_INIT_NO_RESET,
852 .class = &omap2_rng_hwmod_class,
853};
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 94b38af17055..285777241d5a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -27,6 +27,7 @@
27#include <linux/platform_data/asoc-ti-mcbsp.h> 27#include <linux/platform_data/asoc-ti-mcbsp.h>
28#include <linux/platform_data/spi-omap2-mcspi.h> 28#include <linux/platform_data/spi-omap2-mcspi.h>
29#include <plat/dmtimer.h> 29#include <plat/dmtimer.h>
30#include <plat/iommu.h>
30 31
31#include "am35xx.h" 32#include "am35xx.h"
32 33
@@ -92,8 +93,14 @@ static struct omap_hwmod omap3xxx_l4_sec_hwmod = {
92}; 93};
93 94
94/* MPU */ 95/* MPU */
96static struct omap_hwmod_irq_info omap3xxx_mpu_irqs[] = {
97 { .name = "pmu", .irq = 3 },
98 { .irq = -1 }
99};
100
95static struct omap_hwmod omap3xxx_mpu_hwmod = { 101static struct omap_hwmod omap3xxx_mpu_hwmod = {
96 .name = "mpu", 102 .name = "mpu",
103 .mpu_irqs = omap3xxx_mpu_irqs,
97 .class = &mpu_hwmod_class, 104 .class = &mpu_hwmod_class,
98 .main_clk = "arm_fck", 105 .main_clk = "arm_fck",
99}; 106};
@@ -123,6 +130,24 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {
123 }, 130 },
124}; 131};
125 132
133/*
134 * 'debugss' class
135 * debug and emulation sub system
136 */
137
138static struct omap_hwmod_class omap3xxx_debugss_hwmod_class = {
139 .name = "debugss",
140};
141
142/* debugss */
143static struct omap_hwmod omap3xxx_debugss_hwmod = {
144 .name = "debugss",
145 .class = &omap3xxx_debugss_hwmod_class,
146 .clkdm_name = "emu_clkdm",
147 .main_clk = "emu_src_ck",
148 .flags = HWMOD_NO_IDLEST,
149};
150
126/* timer class */ 151/* timer class */
127static struct omap_hwmod_class_sysconfig omap3xxx_timer_1ms_sysc = { 152static struct omap_hwmod_class_sysconfig omap3xxx_timer_1ms_sysc = {
128 .rev_offs = 0x0000, 153 .rev_offs = 0x0000,
@@ -170,6 +195,16 @@ static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
170 .timer_capability = OMAP_TIMER_HAS_PWM, 195 .timer_capability = OMAP_TIMER_HAS_PWM,
171}; 196};
172 197
198/* timers with DSP interrupt dev attribute */
199static struct omap_timer_capability_dev_attr capability_dsp_dev_attr = {
200 .timer_capability = OMAP_TIMER_HAS_DSP_IRQ,
201};
202
203/* pwm timers with DSP interrupt dev attribute */
204static struct omap_timer_capability_dev_attr capability_dsp_pwm_dev_attr = {
205 .timer_capability = OMAP_TIMER_HAS_DSP_IRQ | OMAP_TIMER_HAS_PWM,
206};
207
173/* timer1 */ 208/* timer1 */
174static struct omap_hwmod omap3xxx_timer1_hwmod = { 209static struct omap_hwmod omap3xxx_timer1_hwmod = {
175 .name = "timer1", 210 .name = "timer1",
@@ -253,6 +288,7 @@ static struct omap_hwmod omap3xxx_timer5_hwmod = {
253 .idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT, 288 .idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT,
254 }, 289 },
255 }, 290 },
291 .dev_attr = &capability_dsp_dev_attr,
256 .class = &omap3xxx_timer_hwmod_class, 292 .class = &omap3xxx_timer_hwmod_class,
257}; 293};
258 294
@@ -270,6 +306,7 @@ static struct omap_hwmod omap3xxx_timer6_hwmod = {
270 .idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT, 306 .idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT,
271 }, 307 },
272 }, 308 },
309 .dev_attr = &capability_dsp_dev_attr,
273 .class = &omap3xxx_timer_hwmod_class, 310 .class = &omap3xxx_timer_hwmod_class,
274}; 311};
275 312
@@ -287,6 +324,7 @@ static struct omap_hwmod omap3xxx_timer7_hwmod = {
287 .idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT, 324 .idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT,
288 }, 325 },
289 }, 326 },
327 .dev_attr = &capability_dsp_dev_attr,
290 .class = &omap3xxx_timer_hwmod_class, 328 .class = &omap3xxx_timer_hwmod_class,
291}; 329};
292 330
@@ -304,7 +342,7 @@ static struct omap_hwmod omap3xxx_timer8_hwmod = {
304 .idlest_idle_bit = OMAP3430_ST_GPT8_SHIFT, 342 .idlest_idle_bit = OMAP3430_ST_GPT8_SHIFT,
305 }, 343 },
306 }, 344 },
307 .dev_attr = &capability_pwm_dev_attr, 345 .dev_attr = &capability_dsp_pwm_dev_attr,
308 .class = &omap3xxx_timer_hwmod_class, 346 .class = &omap3xxx_timer_hwmod_class,
309}; 347};
310 348
@@ -2033,6 +2071,33 @@ static struct omap_hwmod omap3xxx_hdq1w_hwmod = {
2033 .class = &omap2_hdq1w_class, 2071 .class = &omap2_hdq1w_class,
2034}; 2072};
2035 2073
2074/* SAD2D */
2075static struct omap_hwmod_rst_info omap3xxx_sad2d_resets[] = {
2076 { .name = "rst_modem_pwron_sw", .rst_shift = 0 },
2077 { .name = "rst_modem_sw", .rst_shift = 1 },
2078};
2079
2080static struct omap_hwmod_class omap3xxx_sad2d_class = {
2081 .name = "sad2d",
2082};
2083
2084static struct omap_hwmod omap3xxx_sad2d_hwmod = {
2085 .name = "sad2d",
2086 .rst_lines = omap3xxx_sad2d_resets,
2087 .rst_lines_cnt = ARRAY_SIZE(omap3xxx_sad2d_resets),
2088 .main_clk = "sad2d_ick",
2089 .prcm = {
2090 .omap2 = {
2091 .module_offs = CORE_MOD,
2092 .prcm_reg_id = 1,
2093 .module_bit = OMAP3430_EN_SAD2D_SHIFT,
2094 .idlest_reg_id = 1,
2095 .idlest_idle_bit = OMAP3430_ST_SAD2D_SHIFT,
2096 },
2097 },
2098 .class = &omap3xxx_sad2d_class,
2099};
2100
2036/* 2101/*
2037 * '32K sync counter' class 2102 * '32K sync counter' class
2038 * 32-bit ordinary counter, clocked by the falling edge of the 32 khz clock 2103 * 32-bit ordinary counter, clocked by the falling edge of the 32 khz clock
@@ -2068,6 +2133,49 @@ static struct omap_hwmod omap3xxx_counter_32k_hwmod = {
2068}; 2133};
2069 2134
2070/* 2135/*
2136 * 'gpmc' class
2137 * general purpose memory controller
2138 */
2139
2140static struct omap_hwmod_class_sysconfig omap3xxx_gpmc_sysc = {
2141 .rev_offs = 0x0000,
2142 .sysc_offs = 0x0010,
2143 .syss_offs = 0x0014,
2144 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
2145 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
2146 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
2147 .sysc_fields = &omap_hwmod_sysc_type1,
2148};
2149
2150static struct omap_hwmod_class omap3xxx_gpmc_hwmod_class = {
2151 .name = "gpmc",
2152 .sysc = &omap3xxx_gpmc_sysc,
2153};
2154
2155static struct omap_hwmod_irq_info omap3xxx_gpmc_irqs[] = {
2156 { .irq = 20 },
2157 { .irq = -1 }
2158};
2159
2160static struct omap_hwmod omap3xxx_gpmc_hwmod = {
2161 .name = "gpmc",
2162 .class = &omap3xxx_gpmc_hwmod_class,
2163 .clkdm_name = "core_l3_clkdm",
2164 .mpu_irqs = omap3xxx_gpmc_irqs,
2165 .main_clk = "gpmc_fck",
2166 /*
2167 * XXX HWMOD_INIT_NO_RESET should not be needed for this IP
2168 * block. It is not being added due to any known bugs with
2169 * resetting the GPMC IP block, but rather because any timings
2170 * set by the bootloader are not being correctly programmed by
2171 * the kernel from the board file or DT data.
2172 * HWMOD_INIT_NO_RESET should be removed ASAP.
2173 */
2174 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET |
2175 HWMOD_NO_IDLEST),
2176};
2177
2178/*
2071 * interfaces 2179 * interfaces
2072 */ 2180 */
2073 2181
@@ -2102,6 +2210,23 @@ static struct omap_hwmod_ocp_if omap3xxx_mpu__l3_main = {
2102 .user = OCP_USER_MPU, 2210 .user = OCP_USER_MPU,
2103}; 2211};
2104 2212
2213static struct omap_hwmod_addr_space omap3xxx_l4_emu_addrs[] = {
2214 {
2215 .pa_start = 0x54000000,
2216 .pa_end = 0x547fffff,
2217 .flags = ADDR_TYPE_RT,
2218 },
2219 { }
2220};
2221
2222/* l3 -> debugss */
2223static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_debugss = {
2224 .master = &omap3xxx_l3_main_hwmod,
2225 .slave = &omap3xxx_debugss_hwmod,
2226 .addr = omap3xxx_l4_emu_addrs,
2227 .user = OCP_USER_MPU,
2228};
2229
2105/* DSS -> l3 */ 2230/* DSS -> l3 */
2106static struct omap_hwmod_ocp_if omap3430es1_dss__l3 = { 2231static struct omap_hwmod_ocp_if omap3430es1_dss__l3 = {
2107 .master = &omap3430es1_dss_core_hwmod, 2232 .master = &omap3430es1_dss_core_hwmod,
@@ -2137,6 +2262,14 @@ static struct omap_hwmod_ocp_if am35xx_usbhsotg__l3 = {
2137 .user = OCP_USER_MPU, 2262 .user = OCP_USER_MPU,
2138}; 2263};
2139 2264
2265/* l3_core -> sad2d interface */
2266static struct omap_hwmod_ocp_if omap3xxx_sad2d__l3 = {
2267 .master = &omap3xxx_sad2d_hwmod,
2268 .slave = &omap3xxx_l3_main_hwmod,
2269 .clk = "core_l3_ick",
2270 .user = OCP_USER_MPU,
2271};
2272
2140/* L4_CORE -> L4_WKUP interface */ 2273/* L4_CORE -> L4_WKUP interface */
2141static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { 2274static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
2142 .master = &omap3xxx_l4_core_hwmod, 2275 .master = &omap3xxx_l4_core_hwmod,
@@ -2823,6 +2956,122 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 = {
2823 .user = OCP_USER_MPU | OCP_USER_SDMA, 2956 .user = OCP_USER_MPU | OCP_USER_SDMA,
2824}; 2957};
2825 2958
2959/*
2960 * 'mmu' class
2961 * The memory management unit performs virtual to physical address translation
2962 * for its requestors.
2963 */
2964
2965static struct omap_hwmod_class_sysconfig mmu_sysc = {
2966 .rev_offs = 0x000,
2967 .sysc_offs = 0x010,
2968 .syss_offs = 0x014,
2969 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
2970 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
2971 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
2972 .sysc_fields = &omap_hwmod_sysc_type1,
2973};
2974
2975static struct omap_hwmod_class omap3xxx_mmu_hwmod_class = {
2976 .name = "mmu",
2977 .sysc = &mmu_sysc,
2978};
2979
2980/* mmu isp */
2981
2982static struct omap_mmu_dev_attr mmu_isp_dev_attr = {
2983 .da_start = 0x0,
2984 .da_end = 0xfffff000,
2985 .nr_tlb_entries = 8,
2986};
2987
2988static struct omap_hwmod omap3xxx_mmu_isp_hwmod;
2989static struct omap_hwmod_irq_info omap3xxx_mmu_isp_irqs[] = {
2990 { .irq = 24 },
2991 { .irq = -1 }
2992};
2993
2994static struct omap_hwmod_addr_space omap3xxx_mmu_isp_addrs[] = {
2995 {
2996 .pa_start = 0x480bd400,
2997 .pa_end = 0x480bd47f,
2998 .flags = ADDR_TYPE_RT,
2999 },
3000 { }
3001};
3002
3003/* l4_core -> mmu isp */
3004static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmu_isp = {
3005 .master = &omap3xxx_l4_core_hwmod,
3006 .slave = &omap3xxx_mmu_isp_hwmod,
3007 .addr = omap3xxx_mmu_isp_addrs,
3008 .user = OCP_USER_MPU | OCP_USER_SDMA,
3009};
3010
3011static struct omap_hwmod omap3xxx_mmu_isp_hwmod = {
3012 .name = "mmu_isp",
3013 .class = &omap3xxx_mmu_hwmod_class,
3014 .mpu_irqs = omap3xxx_mmu_isp_irqs,
3015 .main_clk = "cam_ick",
3016 .dev_attr = &mmu_isp_dev_attr,
3017 .flags = HWMOD_NO_IDLEST,
3018};
3019
3020#ifdef CONFIG_OMAP_IOMMU_IVA2
3021
3022/* mmu iva */
3023
3024static struct omap_mmu_dev_attr mmu_iva_dev_attr = {
3025 .da_start = 0x11000000,
3026 .da_end = 0xfffff000,
3027 .nr_tlb_entries = 32,
3028};
3029
3030static struct omap_hwmod omap3xxx_mmu_iva_hwmod;
3031static struct omap_hwmod_irq_info omap3xxx_mmu_iva_irqs[] = {
3032 { .irq = 28 },
3033 { .irq = -1 }
3034};
3035
3036static struct omap_hwmod_rst_info omap3xxx_mmu_iva_resets[] = {
3037 { .name = "mmu", .rst_shift = 1, .st_shift = 9 },
3038};
3039
3040static struct omap_hwmod_addr_space omap3xxx_mmu_iva_addrs[] = {
3041 {
3042 .pa_start = 0x5d000000,
3043 .pa_end = 0x5d00007f,
3044 .flags = ADDR_TYPE_RT,
3045 },
3046 { }
3047};
3048
3049/* l3_main -> iva mmu */
3050static struct omap_hwmod_ocp_if omap3xxx_l3_main__mmu_iva = {
3051 .master = &omap3xxx_l3_main_hwmod,
3052 .slave = &omap3xxx_mmu_iva_hwmod,
3053 .addr = omap3xxx_mmu_iva_addrs,
3054 .user = OCP_USER_MPU | OCP_USER_SDMA,
3055};
3056
3057static struct omap_hwmod omap3xxx_mmu_iva_hwmod = {
3058 .name = "mmu_iva",
3059 .class = &omap3xxx_mmu_hwmod_class,
3060 .mpu_irqs = omap3xxx_mmu_iva_irqs,
3061 .rst_lines = omap3xxx_mmu_iva_resets,
3062 .rst_lines_cnt = ARRAY_SIZE(omap3xxx_mmu_iva_resets),
3063 .main_clk = "iva2_ck",
3064 .prcm = {
3065 .omap2 = {
3066 .module_offs = OMAP3430_IVA2_MOD,
3067 },
3068 },
3069 .dev_attr = &mmu_iva_dev_attr,
3070 .flags = HWMOD_NO_IDLEST,
3071};
3072
3073#endif
3074
2826/* l4_per -> gpio4 */ 3075/* l4_per -> gpio4 */
2827static struct omap_hwmod_addr_space omap3xxx_gpio4_addrs[] = { 3076static struct omap_hwmod_addr_space omap3xxx_gpio4_addrs[] = {
2828 { 3077 {
@@ -3168,6 +3417,15 @@ static struct omap_hwmod_addr_space omap3xxx_counter_32k_addrs[] = {
3168 { } 3417 { }
3169}; 3418};
3170 3419
3420static struct omap_hwmod_addr_space omap3xxx_gpmc_addrs[] = {
3421 {
3422 .pa_start = 0x6e000000,
3423 .pa_end = 0x6e000fff,
3424 .flags = ADDR_TYPE_RT
3425 },
3426 { }
3427};
3428
3171static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__counter_32k = { 3429static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__counter_32k = {
3172 .master = &omap3xxx_l4_wkup_hwmod, 3430 .master = &omap3xxx_l4_wkup_hwmod,
3173 .slave = &omap3xxx_counter_32k_hwmod, 3431 .slave = &omap3xxx_counter_32k_hwmod,
@@ -3277,10 +3535,19 @@ static struct omap_hwmod_ocp_if am35xx_l4_core__emac = {
3277 .user = OCP_USER_MPU, 3535 .user = OCP_USER_MPU,
3278}; 3536};
3279 3537
3538static struct omap_hwmod_ocp_if omap3xxx_l3_main__gpmc = {
3539 .master = &omap3xxx_l3_main_hwmod,
3540 .slave = &omap3xxx_gpmc_hwmod,
3541 .clk = "core_l3_ick",
3542 .addr = omap3xxx_gpmc_addrs,
3543 .user = OCP_USER_MPU | OCP_USER_SDMA,
3544};
3545
3280static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { 3546static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3281 &omap3xxx_l3_main__l4_core, 3547 &omap3xxx_l3_main__l4_core,
3282 &omap3xxx_l3_main__l4_per, 3548 &omap3xxx_l3_main__l4_per,
3283 &omap3xxx_mpu__l3_main, 3549 &omap3xxx_mpu__l3_main,
3550 &omap3xxx_l3_main__l4_debugss,
3284 &omap3xxx_l4_core__l4_wkup, 3551 &omap3xxx_l4_core__l4_wkup,
3285 &omap3xxx_l4_core__mmc3, 3552 &omap3xxx_l4_core__mmc3,
3286 &omap3_l4_core__uart1, 3553 &omap3_l4_core__uart1,
@@ -3322,6 +3589,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3322 &omap34xx_l4_core__mcspi3, 3589 &omap34xx_l4_core__mcspi3,
3323 &omap34xx_l4_core__mcspi4, 3590 &omap34xx_l4_core__mcspi4,
3324 &omap3xxx_l4_wkup__counter_32k, 3591 &omap3xxx_l4_wkup__counter_32k,
3592 &omap3xxx_l3_main__gpmc,
3325 NULL, 3593 NULL,
3326}; 3594};
3327 3595
@@ -3371,6 +3639,11 @@ static struct omap_hwmod_ocp_if *omap34xx_hwmod_ocp_ifs[] __initdata = {
3371 &omap34xx_l4_core__sr2, 3639 &omap34xx_l4_core__sr2,
3372 &omap3xxx_l4_core__mailbox, 3640 &omap3xxx_l4_core__mailbox,
3373 &omap3xxx_l4_core__hdq1w, 3641 &omap3xxx_l4_core__hdq1w,
3642 &omap3xxx_sad2d__l3,
3643 &omap3xxx_l4_core__mmu_isp,
3644#ifdef CONFIG_OMAP_IOMMU_IVA2
3645 &omap3xxx_l3_main__mmu_iva,
3646#endif
3374 NULL 3647 NULL
3375}; 3648};
3376 3649
@@ -3391,6 +3664,11 @@ static struct omap_hwmod_ocp_if *omap36xx_hwmod_ocp_ifs[] __initdata = {
3391 &omap3xxx_l4_core__es3plus_mmc1, 3664 &omap3xxx_l4_core__es3plus_mmc1,
3392 &omap3xxx_l4_core__es3plus_mmc2, 3665 &omap3xxx_l4_core__es3plus_mmc2,
3393 &omap3xxx_l4_core__hdq1w, 3666 &omap3xxx_l4_core__hdq1w,
3667 &omap3xxx_sad2d__l3,
3668 &omap3xxx_l4_core__mmu_isp,
3669#ifdef CONFIG_OMAP_IOMMU_IVA2
3670 &omap3xxx_l3_main__mmu_iva,
3671#endif
3394 NULL 3672 NULL
3395}; 3673};
3396 3674
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index c7dcb606cd0c..8d7a93525bc6 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -30,6 +30,7 @@
30#include <plat/mmc.h> 30#include <plat/mmc.h>
31#include <plat/dmtimer.h> 31#include <plat/dmtimer.h>
32#include <plat/common.h> 32#include <plat/common.h>
33#include <plat/iommu.h>
33 34
34#include "omap_hwmod_common_data.h" 35#include "omap_hwmod_common_data.h"
35#include "cm1_44xx.h" 36#include "cm1_44xx.h"
@@ -202,6 +203,9 @@ static struct omap_hwmod omap44xx_l4_abe_hwmod = {
202 .prcm = { 203 .prcm = {
203 .omap4 = { 204 .omap4 = {
204 .clkctrl_offs = OMAP4_CM1_ABE_L4ABE_CLKCTRL_OFFSET, 205 .clkctrl_offs = OMAP4_CM1_ABE_L4ABE_CLKCTRL_OFFSET,
206 .context_offs = OMAP4_RM_ABE_AESS_CONTEXT_OFFSET,
207 .lostcontext_mask = OMAP4430_LOSTMEM_AESSMEM_MASK,
208 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
205 }, 209 },
206 }, 210 },
207}; 211};
@@ -258,6 +262,11 @@ static struct omap_hwmod omap44xx_mpu_private_hwmod = {
258 .name = "mpu_private", 262 .name = "mpu_private",
259 .class = &omap44xx_mpu_bus_hwmod_class, 263 .class = &omap44xx_mpu_bus_hwmod_class,
260 .clkdm_name = "mpuss_clkdm", 264 .clkdm_name = "mpuss_clkdm",
265 .prcm = {
266 .omap4 = {
267 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
268 },
269 },
261}; 270};
262 271
263/* 272/*
@@ -342,6 +351,7 @@ static struct omap_hwmod omap44xx_aess_hwmod = {
342 .omap4 = { 351 .omap4 = {
343 .clkctrl_offs = OMAP4_CM1_ABE_AESS_CLKCTRL_OFFSET, 352 .clkctrl_offs = OMAP4_CM1_ABE_AESS_CLKCTRL_OFFSET,
344 .context_offs = OMAP4_RM_ABE_AESS_CONTEXT_OFFSET, 353 .context_offs = OMAP4_RM_ABE_AESS_CONTEXT_OFFSET,
354 .lostcontext_mask = OMAP4430_LOSTCONTEXT_DFF_MASK,
345 .modulemode = MODULEMODE_SWCTRL, 355 .modulemode = MODULEMODE_SWCTRL,
346 }, 356 },
347 }, 357 },
@@ -446,6 +456,11 @@ static struct omap_hwmod omap44xx_ctrl_module_core_hwmod = {
446 .class = &omap44xx_ctrl_module_hwmod_class, 456 .class = &omap44xx_ctrl_module_hwmod_class,
447 .clkdm_name = "l4_cfg_clkdm", 457 .clkdm_name = "l4_cfg_clkdm",
448 .mpu_irqs = omap44xx_ctrl_module_core_irqs, 458 .mpu_irqs = omap44xx_ctrl_module_core_irqs,
459 .prcm = {
460 .omap4 = {
461 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
462 },
463 },
449}; 464};
450 465
451/* ctrl_module_pad_core */ 466/* ctrl_module_pad_core */
@@ -453,6 +468,11 @@ static struct omap_hwmod omap44xx_ctrl_module_pad_core_hwmod = {
453 .name = "ctrl_module_pad_core", 468 .name = "ctrl_module_pad_core",
454 .class = &omap44xx_ctrl_module_hwmod_class, 469 .class = &omap44xx_ctrl_module_hwmod_class,
455 .clkdm_name = "l4_cfg_clkdm", 470 .clkdm_name = "l4_cfg_clkdm",
471 .prcm = {
472 .omap4 = {
473 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
474 },
475 },
456}; 476};
457 477
458/* ctrl_module_wkup */ 478/* ctrl_module_wkup */
@@ -460,6 +480,11 @@ static struct omap_hwmod omap44xx_ctrl_module_wkup_hwmod = {
460 .name = "ctrl_module_wkup", 480 .name = "ctrl_module_wkup",
461 .class = &omap44xx_ctrl_module_hwmod_class, 481 .class = &omap44xx_ctrl_module_hwmod_class,
462 .clkdm_name = "l4_wkup_clkdm", 482 .clkdm_name = "l4_wkup_clkdm",
483 .prcm = {
484 .omap4 = {
485 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
486 },
487 },
463}; 488};
464 489
465/* ctrl_module_pad_wkup */ 490/* ctrl_module_pad_wkup */
@@ -467,6 +492,11 @@ static struct omap_hwmod omap44xx_ctrl_module_pad_wkup_hwmod = {
467 .name = "ctrl_module_pad_wkup", 492 .name = "ctrl_module_pad_wkup",
468 .class = &omap44xx_ctrl_module_hwmod_class, 493 .class = &omap44xx_ctrl_module_hwmod_class,
469 .clkdm_name = "l4_wkup_clkdm", 494 .clkdm_name = "l4_wkup_clkdm",
495 .prcm = {
496 .omap4 = {
497 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
498 },
499 },
470}; 500};
471 501
472/* 502/*
@@ -611,7 +641,6 @@ static struct omap_hwmod_irq_info omap44xx_dsp_irqs[] = {
611 641
612static struct omap_hwmod_rst_info omap44xx_dsp_resets[] = { 642static struct omap_hwmod_rst_info omap44xx_dsp_resets[] = {
613 { .name = "dsp", .rst_shift = 0 }, 643 { .name = "dsp", .rst_shift = 0 },
614 { .name = "mmu_cache", .rst_shift = 1 },
615}; 644};
616 645
617static struct omap_hwmod omap44xx_dsp_hwmod = { 646static struct omap_hwmod omap44xx_dsp_hwmod = {
@@ -1323,6 +1352,14 @@ static struct omap_hwmod omap44xx_gpmc_hwmod = {
1323 .name = "gpmc", 1352 .name = "gpmc",
1324 .class = &omap44xx_gpmc_hwmod_class, 1353 .class = &omap44xx_gpmc_hwmod_class,
1325 .clkdm_name = "l3_2_clkdm", 1354 .clkdm_name = "l3_2_clkdm",
1355 /*
1356 * XXX HWMOD_INIT_NO_RESET should not be needed for this IP
1357 * block. It is not being added due to any known bugs with
1358 * resetting the GPMC IP block, but rather because any timings
1359 * set by the bootloader are not being correctly programmed by
1360 * the kernel from the board file or DT data.
1361 * HWMOD_INIT_NO_RESET should be removed ASAP.
1362 */
1326 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 1363 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
1327 .mpu_irqs = omap44xx_gpmc_irqs, 1364 .mpu_irqs = omap44xx_gpmc_irqs,
1328 .sdma_reqs = omap44xx_gpmc_sdma_reqs, 1365 .sdma_reqs = omap44xx_gpmc_sdma_reqs,
@@ -1631,7 +1668,6 @@ static struct omap_hwmod_irq_info omap44xx_ipu_irqs[] = {
1631static struct omap_hwmod_rst_info omap44xx_ipu_resets[] = { 1668static struct omap_hwmod_rst_info omap44xx_ipu_resets[] = {
1632 { .name = "cpu0", .rst_shift = 0 }, 1669 { .name = "cpu0", .rst_shift = 0 },
1633 { .name = "cpu1", .rst_shift = 1 }, 1670 { .name = "cpu1", .rst_shift = 1 },
1634 { .name = "mmu_cache", .rst_shift = 2 },
1635}; 1671};
1636 1672
1637static struct omap_hwmod omap44xx_ipu_hwmod = { 1673static struct omap_hwmod omap44xx_ipu_hwmod = {
@@ -2438,6 +2474,137 @@ static struct omap_hwmod omap44xx_mmc5_hwmod = {
2438}; 2474};
2439 2475
2440/* 2476/*
2477 * 'mmu' class
2478 * The memory management unit performs virtual to physical address translation
2479 * for its requestors.
2480 */
2481
2482static struct omap_hwmod_class_sysconfig mmu_sysc = {
2483 .rev_offs = 0x000,
2484 .sysc_offs = 0x010,
2485 .syss_offs = 0x014,
2486 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
2487 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
2488 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
2489 .sysc_fields = &omap_hwmod_sysc_type1,
2490};
2491
2492static struct omap_hwmod_class omap44xx_mmu_hwmod_class = {
2493 .name = "mmu",
2494 .sysc = &mmu_sysc,
2495};
2496
2497/* mmu ipu */
2498
2499static struct omap_mmu_dev_attr mmu_ipu_dev_attr = {
2500 .da_start = 0x0,
2501 .da_end = 0xfffff000,
2502 .nr_tlb_entries = 32,
2503};
2504
2505static struct omap_hwmod omap44xx_mmu_ipu_hwmod;
2506static struct omap_hwmod_irq_info omap44xx_mmu_ipu_irqs[] = {
2507 { .irq = 100 + OMAP44XX_IRQ_GIC_START, },
2508 { .irq = -1 }
2509};
2510
2511static struct omap_hwmod_rst_info omap44xx_mmu_ipu_resets[] = {
2512 { .name = "mmu_cache", .rst_shift = 2 },
2513};
2514
2515static struct omap_hwmod_addr_space omap44xx_mmu_ipu_addrs[] = {
2516 {
2517 .pa_start = 0x55082000,
2518 .pa_end = 0x550820ff,
2519 .flags = ADDR_TYPE_RT,
2520 },
2521 { }
2522};
2523
2524/* l3_main_2 -> mmu_ipu */
2525static struct omap_hwmod_ocp_if omap44xx_l3_main_2__mmu_ipu = {
2526 .master = &omap44xx_l3_main_2_hwmod,
2527 .slave = &omap44xx_mmu_ipu_hwmod,
2528 .clk = "l3_div_ck",
2529 .addr = omap44xx_mmu_ipu_addrs,
2530 .user = OCP_USER_MPU | OCP_USER_SDMA,
2531};
2532
2533static struct omap_hwmod omap44xx_mmu_ipu_hwmod = {
2534 .name = "mmu_ipu",
2535 .class = &omap44xx_mmu_hwmod_class,
2536 .clkdm_name = "ducati_clkdm",
2537 .mpu_irqs = omap44xx_mmu_ipu_irqs,
2538 .rst_lines = omap44xx_mmu_ipu_resets,
2539 .rst_lines_cnt = ARRAY_SIZE(omap44xx_mmu_ipu_resets),
2540 .main_clk = "ducati_clk_mux_ck",
2541 .prcm = {
2542 .omap4 = {
2543 .clkctrl_offs = OMAP4_CM_DUCATI_DUCATI_CLKCTRL_OFFSET,
2544 .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET,
2545 .context_offs = OMAP4_RM_DUCATI_DUCATI_CONTEXT_OFFSET,
2546 .modulemode = MODULEMODE_HWCTRL,
2547 },
2548 },
2549 .dev_attr = &mmu_ipu_dev_attr,
2550};
2551
2552/* mmu dsp */
2553
2554static struct omap_mmu_dev_attr mmu_dsp_dev_attr = {
2555 .da_start = 0x0,
2556 .da_end = 0xfffff000,
2557 .nr_tlb_entries = 32,
2558};
2559
2560static struct omap_hwmod omap44xx_mmu_dsp_hwmod;
2561static struct omap_hwmod_irq_info omap44xx_mmu_dsp_irqs[] = {
2562 { .irq = 28 + OMAP44XX_IRQ_GIC_START },
2563 { .irq = -1 }
2564};
2565
2566static struct omap_hwmod_rst_info omap44xx_mmu_dsp_resets[] = {
2567 { .name = "mmu_cache", .rst_shift = 1 },
2568};
2569
2570static struct omap_hwmod_addr_space omap44xx_mmu_dsp_addrs[] = {
2571 {
2572 .pa_start = 0x4a066000,
2573 .pa_end = 0x4a0660ff,
2574 .flags = ADDR_TYPE_RT,
2575 },
2576 { }
2577};
2578
2579/* l4_cfg -> dsp */
2580static struct omap_hwmod_ocp_if omap44xx_l4_cfg__mmu_dsp = {
2581 .master = &omap44xx_l4_cfg_hwmod,
2582 .slave = &omap44xx_mmu_dsp_hwmod,
2583 .clk = "l4_div_ck",
2584 .addr = omap44xx_mmu_dsp_addrs,
2585 .user = OCP_USER_MPU | OCP_USER_SDMA,
2586};
2587
2588static struct omap_hwmod omap44xx_mmu_dsp_hwmod = {
2589 .name = "mmu_dsp",
2590 .class = &omap44xx_mmu_hwmod_class,
2591 .clkdm_name = "tesla_clkdm",
2592 .mpu_irqs = omap44xx_mmu_dsp_irqs,
2593 .rst_lines = omap44xx_mmu_dsp_resets,
2594 .rst_lines_cnt = ARRAY_SIZE(omap44xx_mmu_dsp_resets),
2595 .main_clk = "dpll_iva_m4x2_ck",
2596 .prcm = {
2597 .omap4 = {
2598 .clkctrl_offs = OMAP4_CM_TESLA_TESLA_CLKCTRL_OFFSET,
2599 .rstctrl_offs = OMAP4_RM_TESLA_RSTCTRL_OFFSET,
2600 .context_offs = OMAP4_RM_TESLA_TESLA_CONTEXT_OFFSET,
2601 .modulemode = MODULEMODE_HWCTRL,
2602 },
2603 },
2604 .dev_attr = &mmu_dsp_dev_attr,
2605};
2606
2607/*
2441 * 'mpu' class 2608 * 'mpu' class
2442 * mpu sub-system 2609 * mpu sub-system
2443 */ 2610 */
@@ -2448,6 +2615,8 @@ static struct omap_hwmod_class omap44xx_mpu_hwmod_class = {
2448 2615
2449/* mpu */ 2616/* mpu */
2450static struct omap_hwmod_irq_info omap44xx_mpu_irqs[] = { 2617static struct omap_hwmod_irq_info omap44xx_mpu_irqs[] = {
2618 { .name = "pmu0", .irq = 54 + OMAP44XX_IRQ_GIC_START },
2619 { .name = "pmu1", .irq = 55 + OMAP44XX_IRQ_GIC_START },
2451 { .name = "pl310", .irq = 0 + OMAP44XX_IRQ_GIC_START }, 2620 { .name = "pl310", .irq = 0 + OMAP44XX_IRQ_GIC_START },
2452 { .name = "cti0", .irq = 1 + OMAP44XX_IRQ_GIC_START }, 2621 { .name = "cti0", .irq = 1 + OMAP44XX_IRQ_GIC_START },
2453 { .name = "cti1", .irq = 2 + OMAP44XX_IRQ_GIC_START }, 2622 { .name = "cti1", .irq = 2 + OMAP44XX_IRQ_GIC_START },
@@ -2497,19 +2666,27 @@ static struct omap_hwmod omap44xx_ocmc_ram_hwmod = {
2497 * protocol 2666 * protocol
2498 */ 2667 */
2499 2668
2669static struct omap_hwmod_class_sysconfig omap44xx_ocp2scp_sysc = {
2670 .rev_offs = 0x0000,
2671 .sysc_offs = 0x0010,
2672 .syss_offs = 0x0014,
2673 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
2674 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
2675 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
2676 .sysc_fields = &omap_hwmod_sysc_type1,
2677};
2678
2500static struct omap_hwmod_class omap44xx_ocp2scp_hwmod_class = { 2679static struct omap_hwmod_class omap44xx_ocp2scp_hwmod_class = {
2501 .name = "ocp2scp", 2680 .name = "ocp2scp",
2681 .sysc = &omap44xx_ocp2scp_sysc,
2502}; 2682};
2503 2683
2504/* ocp2scp_usb_phy */ 2684/* ocp2scp_usb_phy */
2505static struct omap_hwmod_opt_clk ocp2scp_usb_phy_opt_clks[] = {
2506 { .role = "phy_48m", .clk = "ocp2scp_usb_phy_phy_48m" },
2507};
2508
2509static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { 2685static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2510 .name = "ocp2scp_usb_phy", 2686 .name = "ocp2scp_usb_phy",
2511 .class = &omap44xx_ocp2scp_hwmod_class, 2687 .class = &omap44xx_ocp2scp_hwmod_class,
2512 .clkdm_name = "l3_init_clkdm", 2688 .clkdm_name = "l3_init_clkdm",
2689 .main_clk = "ocp2scp_usb_phy_phy_48m",
2513 .prcm = { 2690 .prcm = {
2514 .omap4 = { 2691 .omap4 = {
2515 .clkctrl_offs = OMAP4_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL_OFFSET, 2692 .clkctrl_offs = OMAP4_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL_OFFSET,
@@ -2517,8 +2694,6 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2517 .modulemode = MODULEMODE_HWCTRL, 2694 .modulemode = MODULEMODE_HWCTRL,
2518 }, 2695 },
2519 }, 2696 },
2520 .opt_clks = ocp2scp_usb_phy_opt_clks,
2521 .opt_clks_cnt = ARRAY_SIZE(ocp2scp_usb_phy_opt_clks),
2522}; 2697};
2523 2698
2524/* 2699/*
@@ -2536,18 +2711,36 @@ static struct omap_hwmod omap44xx_prcm_mpu_hwmod = {
2536 .name = "prcm_mpu", 2711 .name = "prcm_mpu",
2537 .class = &omap44xx_prcm_hwmod_class, 2712 .class = &omap44xx_prcm_hwmod_class,
2538 .clkdm_name = "l4_wkup_clkdm", 2713 .clkdm_name = "l4_wkup_clkdm",
2714 .flags = HWMOD_NO_IDLEST,
2715 .prcm = {
2716 .omap4 = {
2717 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
2718 },
2719 },
2539}; 2720};
2540 2721
2541/* cm_core_aon */ 2722/* cm_core_aon */
2542static struct omap_hwmod omap44xx_cm_core_aon_hwmod = { 2723static struct omap_hwmod omap44xx_cm_core_aon_hwmod = {
2543 .name = "cm_core_aon", 2724 .name = "cm_core_aon",
2544 .class = &omap44xx_prcm_hwmod_class, 2725 .class = &omap44xx_prcm_hwmod_class,
2726 .flags = HWMOD_NO_IDLEST,
2727 .prcm = {
2728 .omap4 = {
2729 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
2730 },
2731 },
2545}; 2732};
2546 2733
2547/* cm_core */ 2734/* cm_core */
2548static struct omap_hwmod omap44xx_cm_core_hwmod = { 2735static struct omap_hwmod omap44xx_cm_core_hwmod = {
2549 .name = "cm_core", 2736 .name = "cm_core",
2550 .class = &omap44xx_prcm_hwmod_class, 2737 .class = &omap44xx_prcm_hwmod_class,
2738 .flags = HWMOD_NO_IDLEST,
2739 .prcm = {
2740 .omap4 = {
2741 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
2742 },
2743 },
2551}; 2744};
2552 2745
2553/* prm */ 2746/* prm */
@@ -2583,6 +2776,11 @@ static struct omap_hwmod omap44xx_scrm_hwmod = {
2583 .name = "scrm", 2776 .name = "scrm",
2584 .class = &omap44xx_scrm_hwmod_class, 2777 .class = &omap44xx_scrm_hwmod_class,
2585 .clkdm_name = "l4_wkup_clkdm", 2778 .clkdm_name = "l4_wkup_clkdm",
2779 .prcm = {
2780 .omap4 = {
2781 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
2782 },
2783 },
2586}; 2784};
2587 2785
2588/* 2786/*
@@ -2901,6 +3099,16 @@ static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
2901 .timer_capability = OMAP_TIMER_HAS_PWM, 3099 .timer_capability = OMAP_TIMER_HAS_PWM,
2902}; 3100};
2903 3101
3102/* timers with DSP interrupt dev attribute */
3103static struct omap_timer_capability_dev_attr capability_dsp_dev_attr = {
3104 .timer_capability = OMAP_TIMER_HAS_DSP_IRQ,
3105};
3106
3107/* pwm timers with DSP interrupt dev attribute */
3108static struct omap_timer_capability_dev_attr capability_dsp_pwm_dev_attr = {
3109 .timer_capability = OMAP_TIMER_HAS_DSP_IRQ | OMAP_TIMER_HAS_PWM,
3110};
3111
2904/* timer1 */ 3112/* timer1 */
2905static struct omap_hwmod_irq_info omap44xx_timer1_irqs[] = { 3113static struct omap_hwmod_irq_info omap44xx_timer1_irqs[] = {
2906 { .irq = 37 + OMAP44XX_IRQ_GIC_START }, 3114 { .irq = 37 + OMAP44XX_IRQ_GIC_START },
@@ -3005,6 +3213,7 @@ static struct omap_hwmod omap44xx_timer5_hwmod = {
3005 .modulemode = MODULEMODE_SWCTRL, 3213 .modulemode = MODULEMODE_SWCTRL,
3006 }, 3214 },
3007 }, 3215 },
3216 .dev_attr = &capability_dsp_dev_attr,
3008}; 3217};
3009 3218
3010/* timer6 */ 3219/* timer6 */
@@ -3027,6 +3236,7 @@ static struct omap_hwmod omap44xx_timer6_hwmod = {
3027 .modulemode = MODULEMODE_SWCTRL, 3236 .modulemode = MODULEMODE_SWCTRL,
3028 }, 3237 },
3029 }, 3238 },
3239 .dev_attr = &capability_dsp_dev_attr,
3030}; 3240};
3031 3241
3032/* timer7 */ 3242/* timer7 */
@@ -3048,6 +3258,7 @@ static struct omap_hwmod omap44xx_timer7_hwmod = {
3048 .modulemode = MODULEMODE_SWCTRL, 3258 .modulemode = MODULEMODE_SWCTRL,
3049 }, 3259 },
3050 }, 3260 },
3261 .dev_attr = &capability_dsp_dev_attr,
3051}; 3262};
3052 3263
3053/* timer8 */ 3264/* timer8 */
@@ -3069,7 +3280,7 @@ static struct omap_hwmod omap44xx_timer8_hwmod = {
3069 .modulemode = MODULEMODE_SWCTRL, 3280 .modulemode = MODULEMODE_SWCTRL,
3070 }, 3281 },
3071 }, 3282 },
3072 .dev_attr = &capability_pwm_dev_attr, 3283 .dev_attr = &capability_dsp_pwm_dev_attr,
3073}; 3284};
3074 3285
3075/* timer9 */ 3286/* timer9 */
@@ -5262,11 +5473,21 @@ static struct omap_hwmod_ocp_if omap44xx_l3_main_2__ocmc_ram = {
5262 .user = OCP_USER_MPU | OCP_USER_SDMA, 5473 .user = OCP_USER_MPU | OCP_USER_SDMA,
5263}; 5474};
5264 5475
5476static struct omap_hwmod_addr_space omap44xx_ocp2scp_usb_phy_addrs[] = {
5477 {
5478 .pa_start = 0x4a0ad000,
5479 .pa_end = 0x4a0ad01f,
5480 .flags = ADDR_TYPE_RT
5481 },
5482 { }
5483};
5484
5265/* l4_cfg -> ocp2scp_usb_phy */ 5485/* l4_cfg -> ocp2scp_usb_phy */
5266static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ocp2scp_usb_phy = { 5486static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ocp2scp_usb_phy = {
5267 .master = &omap44xx_l4_cfg_hwmod, 5487 .master = &omap44xx_l4_cfg_hwmod,
5268 .slave = &omap44xx_ocp2scp_usb_phy_hwmod, 5488 .slave = &omap44xx_ocp2scp_usb_phy_hwmod,
5269 .clk = "l4_div_ck", 5489 .clk = "l4_div_ck",
5490 .addr = omap44xx_ocp2scp_usb_phy_addrs,
5270 .user = OCP_USER_MPU | OCP_USER_SDMA, 5491 .user = OCP_USER_MPU | OCP_USER_SDMA,
5271}; 5492};
5272 5493
@@ -5886,7 +6107,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_hs = {
5886static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = { 6107static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
5887 { 6108 {
5888 .pa_start = 0x4a0ab000, 6109 .pa_start = 0x4a0ab000,
5889 .pa_end = 0x4a0ab003, 6110 .pa_end = 0x4a0ab7ff,
5890 .flags = ADDR_TYPE_RT 6111 .flags = ADDR_TYPE_RT
5891 }, 6112 },
5892 { 6113 {
@@ -6097,6 +6318,8 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6097 &omap44xx_l4_per__mmc3, 6318 &omap44xx_l4_per__mmc3,
6098 &omap44xx_l4_per__mmc4, 6319 &omap44xx_l4_per__mmc4,
6099 &omap44xx_l4_per__mmc5, 6320 &omap44xx_l4_per__mmc5,
6321 &omap44xx_l3_main_2__mmu_ipu,
6322 &omap44xx_l4_cfg__mmu_dsp,
6100 &omap44xx_l3_main_2__ocmc_ram, 6323 &omap44xx_l3_main_2__ocmc_ram,
6101 &omap44xx_l4_cfg__ocp2scp_usb_phy, 6324 &omap44xx_l4_cfg__ocp2scp_usb_phy,
6102 &omap44xx_mpu_private__prcm_mpu, 6325 &omap44xx_mpu_private__prcm_mpu,
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index dddb677fed68..2bc8f1705d4a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h
@@ -2,9 +2,8 @@
2 * omap_hwmod_common_data.h - OMAP hwmod common macros and declarations 2 * omap_hwmod_common_data.h - OMAP hwmod common macros and declarations
3 * 3 *
4 * Copyright (C) 2010-2011 Nokia Corporation 4 * Copyright (C) 2010-2011 Nokia Corporation
5 * Copyright (C) 2010-2012 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
6 *
7 * Copyright (C) 2010-2011 Texas Instruments, Inc.
8 * Benoît Cousson 7 * Benoît Cousson
9 * 8 *
10 * 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
@@ -77,6 +76,8 @@ extern struct omap_hwmod omap2xxx_gpio4_hwmod;
77extern struct omap_hwmod omap2xxx_mcspi1_hwmod; 76extern struct omap_hwmod omap2xxx_mcspi1_hwmod;
78extern struct omap_hwmod omap2xxx_mcspi2_hwmod; 77extern struct omap_hwmod omap2xxx_mcspi2_hwmod;
79extern struct omap_hwmod omap2xxx_counter_32k_hwmod; 78extern struct omap_hwmod omap2xxx_counter_32k_hwmod;
79extern struct omap_hwmod omap2xxx_gpmc_hwmod;
80extern struct omap_hwmod omap2xxx_rng_hwmod;
80 81
81/* Common interface data across OMAP2xxx */ 82/* Common interface data across OMAP2xxx */
82extern struct omap_hwmod_ocp_if omap2xxx_l3_main__l4_core; 83extern struct omap_hwmod_ocp_if omap2xxx_l3_main__l4_core;
@@ -103,6 +104,7 @@ extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss;
103extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_dispc; 104extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_dispc;
104extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_rfbi; 105extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_rfbi;
105extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc; 106extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc;
107extern struct omap_hwmod_ocp_if omap2xxx_l4_core__rng;
106 108
107/* Common IP block data */ 109/* Common IP block data */
108extern struct omap_hwmod_dma_info omap2_uart1_sdma_reqs[]; 110extern struct omap_hwmod_dma_info omap2_uart1_sdma_reqs[];
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 939bd6f70b51..abefbc4d8e0b 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -80,7 +80,8 @@ static void __init omap2_init_processor_devices(void)
80 80
81int __init omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused) 81int __init omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused)
82{ 82{
83 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) 83 if ((clkdm->flags & CLKDM_CAN_ENABLE_AUTO) &&
84 !(clkdm->flags & CLKDM_MISSING_IDLE_REPORTING))
84 clkdm_allow_idle(clkdm); 85 clkdm_allow_idle(clkdm);
85 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && 86 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
86 atomic_read(&clkdm->usecount) == 0) 87 atomic_read(&clkdm->usecount) == 0)
@@ -188,7 +189,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
188 goto exit; 189 goto exit;
189 } 190 }
190 191
191 freq = clk->rate; 192 freq = clk_get_rate(clk);
192 clk_put(clk); 193 clk_put(clk);
193 194
194 rcu_read_lock(); 195 rcu_read_lock();
diff --git a/arch/arm/mach-omap2/pmu.c b/arch/arm/mach-omap2/pmu.c
new file mode 100644
index 000000000000..2a791766283d
--- /dev/null
+++ b/arch/arm/mach-omap2/pmu.c
@@ -0,0 +1,95 @@
1/*
2 * OMAP2 ARM Performance Monitoring Unit (PMU) Support
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
6 * Contacts:
7 * Jon Hunter <jon-hunter@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14#include <linux/pm_runtime.h>
15
16#include <asm/pmu.h>
17
18#include <plat/omap_hwmod.h>
19#include <plat/omap_device.h>
20
21static char *omap2_pmu_oh_names[] = {"mpu"};
22static char *omap3_pmu_oh_names[] = {"mpu", "debugss"};
23static char *omap4430_pmu_oh_names[] = {"l3_main_3", "l3_instr", "debugss"};
24static struct platform_device *omap_pmu_dev;
25
26/**
27 * omap2_init_pmu - creates and registers PMU platform device
28 * @oh_num: Number of OMAP HWMODs required to create PMU device
29 * @oh_names: Array of OMAP HWMODS names required to create PMU device
30 *
31 * Uses OMAP HWMOD framework to create and register an ARM PMU device
32 * from a list of HWMOD names passed. Currently supports OMAP2, OMAP3
33 * and OMAP4 devices.
34 */
35static int __init omap2_init_pmu(unsigned oh_num, char *oh_names[])
36{
37 int i;
38 struct omap_hwmod *oh[3];
39 char *dev_name = "arm-pmu";
40
41 if ((!oh_num) || (oh_num > 3))
42 return -EINVAL;
43
44 for (i = 0; i < oh_num; i++) {
45 oh[i] = omap_hwmod_lookup(oh_names[i]);
46 if (!oh[i]) {
47 pr_err("Could not look up %s hwmod\n", oh_names[i]);
48 return -ENODEV;
49 }
50 }
51
52 omap_pmu_dev = omap_device_build_ss(dev_name, -1, oh, oh_num, NULL, 0,
53 NULL, 0, 0);
54 WARN(IS_ERR(omap_pmu_dev), "Can't build omap_device for %s.\n",
55 dev_name);
56
57 if (IS_ERR(omap_pmu_dev))
58 return PTR_ERR(omap_pmu_dev);
59
60 pm_runtime_enable(&omap_pmu_dev->dev);
61
62 return 0;
63}
64
65static int __init omap_init_pmu(void)
66{
67 unsigned oh_num;
68 char **oh_names;
69
70 /*
71 * To create an ARM-PMU device the following HWMODs
72 * are required for the various OMAP2+ devices.
73 *
74 * OMAP24xx: mpu
75 * OMAP3xxx: mpu, debugss
76 * OMAP4430: l3_main_3, l3_instr, debugss
77 * OMAP4460/70: mpu, debugss
78 */
79 if (cpu_is_omap443x()) {
80 oh_num = ARRAY_SIZE(omap4430_pmu_oh_names);
81 oh_names = omap4430_pmu_oh_names;
82 /* XXX Remove the next two lines when CTI driver available */
83 pr_info("ARM PMU: not yet supported on OMAP4430 due to missing CTI driver\n");
84 return 0;
85 } else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
86 oh_num = ARRAY_SIZE(omap3_pmu_oh_names);
87 oh_names = omap3_pmu_oh_names;
88 } else {
89 oh_num = ARRAY_SIZE(omap2_pmu_oh_names);
90 oh_names = omap2_pmu_oh_names;
91 }
92
93 return omap2_init_pmu(oh_num, oh_names);
94}
95subsys_initcall(omap_init_pmu);
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c
index aeac6f35ca10..aceb4f464c9b 100644
--- a/arch/arm/mach-omap2/powerdomain44xx.c
+++ b/arch/arm/mach-omap2/powerdomain44xx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP4 powerdomain control 2 * OMAP4 powerdomain control
3 * 3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc. 4 * Copyright (C) 2009-2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation 5 * Copyright (C) 2007-2009 Nokia Corporation
6 * 6 *
7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley 7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
@@ -151,6 +151,34 @@ static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
151 return v; 151 return v;
152} 152}
153 153
154/**
155 * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate
156 * @pwrdm: struct powerdomain * to read the state for
157 *
158 * Reads the previous logic powerstate for a powerdomain. This
159 * function must determine the previous logic powerstate by first
160 * checking the previous powerstate for the domain. If that was OFF,
161 * then logic has been lost. If previous state was RETENTION, the
162 * function reads the setting for the next retention logic state to
163 * see the actual value. In every other case, the logic is
164 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
165 * depending whether the logic was retained or not.
166 */
167static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
168{
169 int state;
170
171 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
172
173 if (state == PWRDM_POWER_OFF)
174 return PWRDM_POWER_OFF;
175
176 if (state != PWRDM_POWER_RET)
177 return PWRDM_POWER_RET;
178
179 return omap4_pwrdm_read_logic_retst(pwrdm);
180}
181
154static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) 182static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
155{ 183{
156 u32 m, v; 184 u32 m, v;
@@ -179,6 +207,35 @@ static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
179 return v; 207 return v;
180} 208}
181 209
210/**
211 * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate
212 * @pwrdm: struct powerdomain * to read mem powerstate for
213 * @bank: memory bank index
214 *
215 * Reads the previous memory powerstate for a powerdomain. This
216 * function must determine the previous memory powerstate by first
217 * checking the previous powerstate for the domain. If that was OFF,
218 * then logic has been lost. If previous state was RETENTION, the
219 * function reads the setting for the next memory retention state to
220 * see the actual value. In every other case, the logic is
221 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
222 * depending whether logic was retained or not.
223 */
224static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
225{
226 int state;
227
228 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
229
230 if (state == PWRDM_POWER_OFF)
231 return PWRDM_POWER_OFF;
232
233 if (state != PWRDM_POWER_RET)
234 return PWRDM_POWER_RET;
235
236 return omap4_pwrdm_read_mem_retst(pwrdm, bank);
237}
238
182static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm) 239static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
183{ 240{
184 u32 c = 0; 241 u32 c = 0;
@@ -217,9 +274,11 @@ struct pwrdm_ops omap4_pwrdm_operations = {
217 .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst, 274 .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst,
218 .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst, 275 .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst,
219 .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst, 276 .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst,
277 .pwrdm_read_prev_logic_pwrst = omap4_pwrdm_read_prev_logic_pwrst,
220 .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst, 278 .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst,
221 .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst, 279 .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst,
222 .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst, 280 .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst,
281 .pwrdm_read_prev_mem_pwrst = omap4_pwrdm_read_prev_mem_pwrst,
223 .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst, 282 .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst,
224 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst, 283 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst,
225 .pwrdm_wait_transition = omap4_pwrdm_wait_transition, 284 .pwrdm_wait_transition = omap4_pwrdm_wait_transition,
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index e5f0503a68b0..72df97482cc0 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -109,6 +109,8 @@
109#define OMAP2430_EN_MDM_INTC_MASK (1 << 11) 109#define OMAP2430_EN_MDM_INTC_MASK (1 << 11)
110#define OMAP2430_EN_USBHS_SHIFT 6 110#define OMAP2430_EN_USBHS_SHIFT 6
111#define OMAP2430_EN_USBHS_MASK (1 << 6) 111#define OMAP2430_EN_USBHS_MASK (1 << 6)
112#define OMAP24XX_EN_GPMC_SHIFT 1
113#define OMAP24XX_EN_GPMC_MASK (1 << 1)
112 114
113/* CM_IDLEST1_CORE, PM_WKST1_CORE shared bits */ 115/* CM_IDLEST1_CORE, PM_WKST1_CORE shared bits */
114#define OMAP2420_ST_MMC_SHIFT 26 116#define OMAP2420_ST_MMC_SHIFT 26
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index ac95daaa4702..3c434498e12e 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -33,10 +33,12 @@
33#ifdef CONFIG_MFD_OMAP_USB_HOST 33#ifdef CONFIG_MFD_OMAP_USB_HOST
34 34
35#define OMAP_USBHS_DEVICE "usbhs_omap" 35#define OMAP_USBHS_DEVICE "usbhs_omap"
36#define OMAP_USBTLL_DEVICE "usbhs_tll"
36#define USBHS_UHH_HWMODNAME "usb_host_hs" 37#define USBHS_UHH_HWMODNAME "usb_host_hs"
37#define USBHS_TLL_HWMODNAME "usb_tll_hs" 38#define USBHS_TLL_HWMODNAME "usb_tll_hs"
38 39
39static struct usbhs_omap_platform_data usbhs_data; 40static struct usbhs_omap_platform_data usbhs_data;
41static struct usbtll_omap_platform_data usbtll_data;
40static struct ehci_hcd_omap_platform_data ehci_data; 42static struct ehci_hcd_omap_platform_data ehci_data;
41static struct ohci_hcd_omap_platform_data ohci_data; 43static struct ohci_hcd_omap_platform_data ohci_data;
42 44
@@ -485,13 +487,14 @@ void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
485 487
486void __init usbhs_init(const struct usbhs_omap_board_data *pdata) 488void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
487{ 489{
488 struct omap_hwmod *oh[2]; 490 struct omap_hwmod *uhh_hwm, *tll_hwm;
489 struct platform_device *pdev; 491 struct platform_device *pdev;
490 int bus_id = -1; 492 int bus_id = -1;
491 int i; 493 int i;
492 494
493 for (i = 0; i < OMAP3_HS_USB_PORTS; i++) { 495 for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
494 usbhs_data.port_mode[i] = pdata->port_mode[i]; 496 usbhs_data.port_mode[i] = pdata->port_mode[i];
497 usbtll_data.port_mode[i] = pdata->port_mode[i];
495 ohci_data.port_mode[i] = pdata->port_mode[i]; 498 ohci_data.port_mode[i] = pdata->port_mode[i];
496 ehci_data.port_mode[i] = pdata->port_mode[i]; 499 ehci_data.port_mode[i] = pdata->port_mode[i];
497 ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i]; 500 ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i];
@@ -510,25 +513,35 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
510 setup_4430ohci_io_mux(pdata->port_mode); 513 setup_4430ohci_io_mux(pdata->port_mode);
511 } 514 }
512 515
513 oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME); 516 uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
514 if (!oh[0]) { 517 if (!uhh_hwm) {
515 pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME); 518 pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
516 return; 519 return;
517 } 520 }
518 521
519 oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME); 522 tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
520 if (!oh[1]) { 523 if (!tll_hwm) {
521 pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME); 524 pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
522 return; 525 return;
523 } 526 }
524 527
525 pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2, 528 pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm,
526 (void *)&usbhs_data, sizeof(usbhs_data), 529 &usbtll_data, sizeof(usbtll_data),
527 omap_uhhtll_latency, 530 omap_uhhtll_latency,
528 ARRAY_SIZE(omap_uhhtll_latency), false); 531 ARRAY_SIZE(omap_uhhtll_latency), false);
529 if (IS_ERR(pdev)) { 532 if (IS_ERR(pdev)) {
530 pr_err("Could not build hwmod devices %s,%s\n", 533 pr_err("Could not build hwmod device %s\n",
531 USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME); 534 USBHS_TLL_HWMODNAME);
535 return;
536 }
537
538 pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm,
539 &usbhs_data, sizeof(usbhs_data),
540 omap_uhhtll_latency,
541 ARRAY_SIZE(omap_uhhtll_latency), false);
542 if (IS_ERR(pdev)) {
543 pr_err("Could not build hwmod devices %s\n",
544 USBHS_UHH_HWMODNAME);
532 return; 545 return;
533 } 546 }
534} 547}
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
index eaac83d1df6f..b5efc0fd31cb 100644
--- a/arch/arm/mach-orion5x/addr-map.c
+++ b/arch/arm/mach-orion5x/addr-map.c
@@ -113,7 +113,8 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
113 /* 113 /*
114 * Setup MBUS dram target info. 114 * Setup MBUS dram target info.
115 */ 115 */
116 orion_setup_cpu_mbus_target(&addr_map_cfg, ORION5X_DDR_WINDOW_CPU_BASE); 116 orion_setup_cpu_mbus_target(&addr_map_cfg,
117 (void __iomem *) ORION5X_DDR_WINDOW_CPU_BASE);
117} 118}
118 119
119void __init orion5x_setup_dev_boot_win(u32 base, u32 size) 120void __init orion5x_setup_dev_boot_win(u32 base, u32 size)
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 073c7d799068..b3eb3da01160 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -42,12 +42,12 @@
42 ****************************************************************************/ 42 ****************************************************************************/
43static struct map_desc orion5x_io_desc[] __initdata = { 43static struct map_desc orion5x_io_desc[] __initdata = {
44 { 44 {
45 .virtual = ORION5X_REGS_VIRT_BASE, 45 .virtual = (unsigned long) ORION5X_REGS_VIRT_BASE,
46 .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE), 46 .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE),
47 .length = ORION5X_REGS_SIZE, 47 .length = ORION5X_REGS_SIZE,
48 .type = MT_DEVICE, 48 .type = MT_DEVICE,
49 }, { 49 }, {
50 .virtual = ORION5X_PCIE_WA_VIRT_BASE, 50 .virtual = (unsigned long) ORION5X_PCIE_WA_VIRT_BASE,
51 .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE), 51 .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE),
52 .length = ORION5X_PCIE_WA_SIZE, 52 .length = ORION5X_PCIE_WA_SIZE,
53 .type = MT_DEVICE, 53 .type = MT_DEVICE,
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 0e19db69f5c4..e533588880ff 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -701,7 +701,7 @@ static void __init dns323_init(void)
701 * Note: AFAIK, rev B1 needs the same treatement but I'll let 701 * Note: AFAIK, rev B1 needs the same treatement but I'll let
702 * somebody else test it. 702 * somebody else test it.
703 */ 703 */
704 writel(0x5, ORION5X_SATA_VIRT_BASE | 0x2c); 704 writel(0x5, ORION5X_SATA_VIRT_BASE + 0x2c);
705 break; 705 break;
706 } 706 }
707} 707}
diff --git a/arch/arm/mach-orion5x/include/mach/bridge-regs.h b/arch/arm/mach-orion5x/include/mach/bridge-regs.h
index 11a3c1e9801f..461fd69a10ae 100644
--- a/arch/arm/mach-orion5x/include/mach/bridge-regs.h
+++ b/arch/arm/mach-orion5x/include/mach/bridge-regs.h
@@ -13,27 +13,27 @@
13 13
14#include <mach/orion5x.h> 14#include <mach/orion5x.h>
15 15
16#define CPU_CONF (ORION5X_BRIDGE_VIRT_BASE | 0x100) 16#define CPU_CONF (ORION5X_BRIDGE_VIRT_BASE + 0x100)
17 17
18#define CPU_CTRL (ORION5X_BRIDGE_VIRT_BASE | 0x104) 18#define CPU_CTRL (ORION5X_BRIDGE_VIRT_BASE + 0x104)
19 19
20#define RSTOUTn_MASK (ORION5X_BRIDGE_VIRT_BASE | 0x108) 20#define RSTOUTn_MASK (ORION5X_BRIDGE_VIRT_BASE + 0x108)
21#define WDT_RESET_OUT_EN 0x0002 21#define WDT_RESET_OUT_EN 0x0002
22 22
23#define CPU_SOFT_RESET (ORION5X_BRIDGE_VIRT_BASE | 0x10c) 23#define CPU_SOFT_RESET (ORION5X_BRIDGE_VIRT_BASE + 0x10c)
24 24
25#define BRIDGE_CAUSE (ORION5X_BRIDGE_VIRT_BASE | 0x110) 25#define BRIDGE_CAUSE (ORION5X_BRIDGE_VIRT_BASE + 0x110)
26 26
27#define POWER_MNG_CTRL_REG (ORION5X_BRIDGE_VIRT_BASE | 0x11C) 27#define POWER_MNG_CTRL_REG (ORION5X_BRIDGE_VIRT_BASE + 0x11C)
28 28
29#define WDT_INT_REQ 0x0008 29#define WDT_INT_REQ 0x0008
30 30
31#define BRIDGE_INT_TIMER1_CLR (~0x0004) 31#define BRIDGE_INT_TIMER1_CLR (~0x0004)
32 32
33#define MAIN_IRQ_CAUSE (ORION5X_BRIDGE_VIRT_BASE | 0x200) 33#define MAIN_IRQ_CAUSE (ORION5X_BRIDGE_VIRT_BASE + 0x200)
34 34
35#define MAIN_IRQ_MASK (ORION5X_BRIDGE_VIRT_BASE | 0x204) 35#define MAIN_IRQ_MASK (ORION5X_BRIDGE_VIRT_BASE + 0x204)
36 36
37#define TIMER_VIRT_BASE (ORION5X_BRIDGE_VIRT_BASE | 0x300) 37#define TIMER_VIRT_BASE (ORION5X_BRIDGE_VIRT_BASE + 0x300)
38#define TIMER_PHYS_BASE (ORION5X_BRIDGE_PHYS_BASE | 0x300) 38#define TIMER_PHYS_BASE (ORION5X_BRIDGE_PHYS_BASE + 0x300)
39#endif 39#endif
diff --git a/arch/arm/mach-orion5x/include/mach/orion5x.h b/arch/arm/mach-orion5x/include/mach/orion5x.h
index 1b60131b7f60..d265f5484a8e 100644
--- a/arch/arm/mach-orion5x/include/mach/orion5x.h
+++ b/arch/arm/mach-orion5x/include/mach/orion5x.h
@@ -37,7 +37,7 @@
37 * fd000000 f0000000 16M PCIe WA space (Orion-1/Orion-NAS only) 37 * fd000000 f0000000 16M PCIe WA space (Orion-1/Orion-NAS only)
38 ****************************************************************************/ 38 ****************************************************************************/
39#define ORION5X_REGS_PHYS_BASE 0xf1000000 39#define ORION5X_REGS_PHYS_BASE 0xf1000000
40#define ORION5X_REGS_VIRT_BASE 0xfe000000 40#define ORION5X_REGS_VIRT_BASE IOMEM(0xfe000000)
41#define ORION5X_REGS_SIZE SZ_1M 41#define ORION5X_REGS_SIZE SZ_1M
42 42
43#define ORION5X_PCIE_IO_PHYS_BASE 0xf2000000 43#define ORION5X_PCIE_IO_PHYS_BASE 0xf2000000
@@ -53,7 +53,7 @@
53 53
54/* Relevant only for Orion-1/Orion-NAS */ 54/* Relevant only for Orion-1/Orion-NAS */
55#define ORION5X_PCIE_WA_PHYS_BASE 0xf0000000 55#define ORION5X_PCIE_WA_PHYS_BASE 0xf0000000
56#define ORION5X_PCIE_WA_VIRT_BASE 0xfd000000 56#define ORION5X_PCIE_WA_VIRT_BASE IOMEM(0xfd000000)
57#define ORION5X_PCIE_WA_SIZE SZ_16M 57#define ORION5X_PCIE_WA_SIZE SZ_16M
58 58
59#define ORION5X_PCIE_MEM_PHYS_BASE 0xe0000000 59#define ORION5X_PCIE_MEM_PHYS_BASE 0xe0000000
@@ -66,42 +66,42 @@
66 * Orion Registers Map 66 * Orion Registers Map
67 ******************************************************************************/ 67 ******************************************************************************/
68 68
69#define ORION5X_DDR_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x00000) 69#define ORION5X_DDR_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x00000)
70#define ORION5X_DDR_WINDOW_CPU_BASE (ORION5X_DDR_VIRT_BASE | 0x1500) 70#define ORION5X_DDR_WINDOW_CPU_BASE (ORION5X_DDR_VIRT_BASE + 0x1500)
71#define ORION5X_DEV_BUS_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x10000) 71#define ORION5X_DEV_BUS_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x10000)
72#define ORION5X_DEV_BUS_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x10000) 72#define ORION5X_DEV_BUS_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x10000)
73#define ORION5X_DEV_BUS_REG(x) (ORION5X_DEV_BUS_VIRT_BASE | (x)) 73#define ORION5X_DEV_BUS_REG(x) (ORION5X_DEV_BUS_VIRT_BASE + (x))
74#define GPIO_VIRT_BASE ORION5X_DEV_BUS_REG(0x0100) 74#define GPIO_VIRT_BASE ORION5X_DEV_BUS_REG(0x0100)
75#define SPI_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE | 0x0600) 75#define SPI_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE + 0x0600)
76#define I2C_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE | 0x1000) 76#define I2C_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE + 0x1000)
77#define UART0_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE | 0x2000) 77#define UART0_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE + 0x2000)
78#define UART0_VIRT_BASE (ORION5X_DEV_BUS_VIRT_BASE | 0x2000) 78#define UART0_VIRT_BASE (ORION5X_DEV_BUS_VIRT_BASE + 0x2000)
79#define UART1_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE | 0x2100) 79#define UART1_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE + 0x2100)
80#define UART1_VIRT_BASE (ORION5X_DEV_BUS_VIRT_BASE | 0x2100) 80#define UART1_VIRT_BASE (ORION5X_DEV_BUS_VIRT_BASE + 0x2100)
81 81
82#define ORION5X_BRIDGE_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x20000) 82#define ORION5X_BRIDGE_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x20000)
83#define ORION5X_BRIDGE_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x20000) 83#define ORION5X_BRIDGE_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x20000)
84 84
85#define ORION5X_PCI_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x30000) 85#define ORION5X_PCI_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x30000)
86 86
87#define ORION5X_PCIE_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x40000) 87#define ORION5X_PCIE_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x40000)
88 88
89#define ORION5X_USB0_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x50000) 89#define ORION5X_USB0_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x50000)
90#define ORION5X_USB0_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x50000) 90#define ORION5X_USB0_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x50000)
91 91
92#define ORION5X_XOR_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x60900) 92#define ORION5X_XOR_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x60900)
93#define ORION5X_XOR_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x60900) 93#define ORION5X_XOR_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x60900)
94 94
95#define ORION5X_ETH_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x70000) 95#define ORION5X_ETH_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x70000)
96#define ORION5X_ETH_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x70000) 96#define ORION5X_ETH_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x70000)
97 97
98#define ORION5X_SATA_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x80000) 98#define ORION5X_SATA_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x80000)
99#define ORION5X_SATA_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x80000) 99#define ORION5X_SATA_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x80000)
100 100
101#define ORION5X_CRYPTO_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x90000) 101#define ORION5X_CRYPTO_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x90000)
102 102
103#define ORION5X_USB1_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0xa0000) 103#define ORION5X_USB1_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0xa0000)
104#define ORION5X_USB1_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0xa0000) 104#define ORION5X_USB1_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0xa0000)
105 105
106/******************************************************************************* 106/*******************************************************************************
107 * Device Bus Registers 107 * Device Bus Registers
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index e152641cdb0e..30a192b9c517 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -12,6 +12,7 @@
12#include <linux/gpio.h> 12#include <linux/gpio.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/io.h>
15#include <mach/bridge-regs.h> 16#include <mach/bridge-regs.h>
16#include <plat/orion-gpio.h> 17#include <plat/orion-gpio.h>
17#include <plat/irq.h> 18#include <plat/irq.h>
@@ -25,11 +26,11 @@ static int __initdata gpio0_irqs[4] = {
25 26
26void __init orion5x_init_irq(void) 27void __init orion5x_init_irq(void)
27{ 28{
28 orion_irq_init(0, (void __iomem *)MAIN_IRQ_MASK); 29 orion_irq_init(0, MAIN_IRQ_MASK);
29 30
30 /* 31 /*
31 * Initialize gpiolib for GPIOs 0-31. 32 * Initialize gpiolib for GPIOs 0-31.
32 */ 33 */
33 orion_gpio_init(NULL, 0, 32, (void __iomem *)GPIO_VIRT_BASE, 0, 34 orion_gpio_init(NULL, 0, 32, GPIO_VIRT_BASE, 0,
34 IRQ_ORION5X_GPIO_START, gpio0_irqs); 35 IRQ_ORION5X_GPIO_START, gpio0_irqs);
35} 36}
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index 6921d49b988d..cd50e328db2a 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -38,7 +38,7 @@
38/***************************************************************************** 38/*****************************************************************************
39 * PCIe controller 39 * PCIe controller
40 ****************************************************************************/ 40 ****************************************************************************/
41#define PCIE_BASE ((void __iomem *)ORION5X_PCIE_VIRT_BASE) 41#define PCIE_BASE (ORION5X_PCIE_VIRT_BASE)
42 42
43void __init orion5x_pcie_id(u32 *dev, u32 *rev) 43void __init orion5x_pcie_id(u32 *dev, u32 *rev)
44{ 44{
@@ -111,7 +111,7 @@ static int pcie_rd_conf_wa(struct pci_bus *bus, u32 devfn,
111 return PCIBIOS_DEVICE_NOT_FOUND; 111 return PCIBIOS_DEVICE_NOT_FOUND;
112 } 112 }
113 113
114 ret = orion_pcie_rd_conf_wa((void __iomem *)ORION5X_PCIE_WA_VIRT_BASE, 114 ret = orion_pcie_rd_conf_wa(ORION5X_PCIE_WA_VIRT_BASE,
115 bus, devfn, where, size, val); 115 bus, devfn, where, size, val);
116 116
117 return ret; 117 return ret;
@@ -188,7 +188,7 @@ static int __init pcie_setup(struct pci_sys_data *sys)
188/***************************************************************************** 188/*****************************************************************************
189 * PCI controller 189 * PCI controller
190 ****************************************************************************/ 190 ****************************************************************************/
191#define ORION5X_PCI_REG(x) (ORION5X_PCI_VIRT_BASE | (x)) 191#define ORION5X_PCI_REG(x) (ORION5X_PCI_VIRT_BASE + (x))
192#define PCI_MODE ORION5X_PCI_REG(0xd00) 192#define PCI_MODE ORION5X_PCI_REG(0xd00)
193#define PCI_CMD ORION5X_PCI_REG(0xc00) 193#define PCI_CMD ORION5X_PCI_REG(0xc00)
194#define PCI_P2P_CONF ORION5X_PCI_REG(0x1d14) 194#define PCI_P2P_CONF ORION5X_PCI_REG(0x1d14)
diff --git a/arch/arm/mach-sa1100/include/mach/SA-1111.h b/arch/arm/mach-sa1100/include/mach/SA-1111.h
deleted file mode 100644
index c38f60915cb6..000000000000
--- a/arch/arm/mach-sa1100/include/mach/SA-1111.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/*
2 * Moved to new location
3 */
4#warning using old SA-1111.h - update to <asm/hardware/sa1111.h>
5#include <asm/hardware/sa1111.h>
diff --git a/arch/arm/mach-sa1100/include/mach/lart.h b/arch/arm/mach-sa1100/include/mach/lart.h
deleted file mode 100644
index 8a5482d908db..000000000000
--- a/arch/arm/mach-sa1100/include/mach/lart.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _INCLUDE_LART_H
2#define _INCLUDE_LART_H
3
4#define LART_GPIO_ETH0 GPIO_GPIO0
5#define LART_IRQ_ETH0 IRQ_GPIO0
6
7#define LART_GPIO_IDE GPIO_GPIO1
8#define LART_IRQ_IDE IRQ_GPIO1
9
10#define LART_GPIO_UCB1200 GPIO_GPIO18
11#define LART_IRQ_UCB1200 IRQ_GPIO18
12
13#endif
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index f978c5d0e1ae..f67456286280 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -100,7 +100,7 @@ static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *
100 /* Tell ROM loader about our vector (in headsmp.S) */ 100 /* Tell ROM loader about our vector (in headsmp.S) */
101 emev2_set_boot_vector(__pa(shmobile_secondary_vector)); 101 emev2_set_boot_vector(__pa(shmobile_secondary_vector));
102 102
103 gic_raise_softirq(cpumask_of(cpu), 1); 103 gic_raise_softirq(cpumask_of(cpu), 0);
104 return 0; 104 return 0;
105} 105}
106 106
diff --git a/arch/arm/mach-tegra/include/mach/smmu.h b/arch/arm/mach-tegra/include/mach/smmu.h
deleted file mode 100644
index dad403a9cf00..000000000000
--- a/arch/arm/mach-tegra/include/mach/smmu.h
+++ /dev/null
@@ -1,63 +0,0 @@
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-u300/i2c.c b/arch/arm/mach-u300/i2c.c
index 0d4620ed853c..96800aa1316d 100644
--- a/arch/arm/mach-u300/i2c.c
+++ b/arch/arm/mach-u300/i2c.c
@@ -9,7 +9,7 @@
9 */ 9 */
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/i2c.h> 11#include <linux/i2c.h>
12#include <linux/mfd/abx500.h> 12#include <linux/mfd/ab3100.h>
13#include <linux/regulator/machine.h> 13#include <linux/regulator/machine.h>
14#include <linux/amba/bus.h> 14#include <linux/amba/bus.h>
15#include <mach/irqs.h> 15#include <mach/irqs.h>
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 5f6b7d543e55..560e0df728f8 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -659,6 +659,7 @@ static void __init v2m_dt_init(void)
659 659
660const static char *v2m_dt_match[] __initconst = { 660const static char *v2m_dt_match[] __initconst = {
661 "arm,vexpress", 661 "arm,vexpress",
662 "xen,xenvm",
662 NULL, 663 NULL,
663}; 664};
664 665
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 9107231aacc5..b9f60ebe3bc4 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -699,7 +699,6 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,
699 unsigned long instr = *pinstr; 699 unsigned long instr = *pinstr;
700 u16 tinst1 = (instr >> 16) & 0xffff; 700 u16 tinst1 = (instr >> 16) & 0xffff;
701 u16 tinst2 = instr & 0xffff; 701 u16 tinst2 = instr & 0xffff;
702 poffset->un = 0;
703 702
704 switch (tinst1 & 0xffe0) { 703 switch (tinst1 & 0xffe0) {
705 /* A6.3.5 Load/Store multiple */ 704 /* A6.3.5 Load/Store multiple */
@@ -854,9 +853,10 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
854 break; 853 break;
855 854
856 case 0x08000000: /* ldm or stm, or thumb-2 32bit instruction */ 855 case 0x08000000: /* ldm or stm, or thumb-2 32bit instruction */
857 if (thumb2_32b) 856 if (thumb2_32b) {
857 offset.un = 0;
858 handler = do_alignment_t32_to_handler(&instr, regs, &offset); 858 handler = do_alignment_t32_to_handler(&instr, regs, &offset);
859 else 859 } else
860 handler = do_alignment_ldmstm; 860 handler = do_alignment_ldmstm;
861 break; 861 break;
862 862
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 577baf7d0a8d..8a97e6443c62 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -368,14 +368,18 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
368 /* l2x0 controller is disabled */ 368 /* l2x0 controller is disabled */
369 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL); 369 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL);
370 370
371 l2x0_saved_regs.aux_ctrl = aux;
372
373 l2x0_inv_all(); 371 l2x0_inv_all();
374 372
375 /* enable L2X0 */ 373 /* enable L2X0 */
376 writel_relaxed(1, l2x0_base + L2X0_CTRL); 374 writel_relaxed(1, l2x0_base + L2X0_CTRL);
377 } 375 }
378 376
377 /* Re-read it in case some bits are reserved. */
378 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
379
380 /* Save the value for resuming. */
381 l2x0_saved_regs.aux_ctrl = aux;
382
379 outer_cache.inv_range = l2x0_inv_range; 383 outer_cache.inv_range = l2x0_inv_range;
380 outer_cache.clean_range = l2x0_clean_range; 384 outer_cache.clean_range = l2x0_clean_range;
381 outer_cache.flush_range = l2x0_flush_range; 385 outer_cache.flush_range = l2x0_flush_range;
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index 39e3fb3db801..3b172275262e 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -211,6 +211,9 @@ ENTRY(v7_coherent_user_range)
211 * isn't mapped, fail with -EFAULT. 211 * isn't mapped, fail with -EFAULT.
212 */ 212 */
2139001: 2139001:
214#ifdef CONFIG_ARM_ERRATA_775420
215 dsb
216#endif
214 mov r0, #-EFAULT 217 mov r0, #-EFAULT
215 mov pc, lr 218 mov pc, lr
216 UNWIND(.fnend ) 219 UNWIND(.fnend )
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 9aec41fa80ae..ad722f1208a5 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -324,7 +324,7 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
324 324
325 BUG_ON(!arm_memblock_steal_permitted); 325 BUG_ON(!arm_memblock_steal_permitted);
326 326
327 phys = memblock_alloc(size, align); 327 phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE);
328 memblock_free(phys, size); 328 memblock_free(phys, size);
329 memblock_remove(phys, size); 329 memblock_remove(phys, size);
330 330
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 9d869f93a3da..5dcc2fd46c46 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -248,6 +248,7 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
248 if (!area) 248 if (!area)
249 return NULL; 249 return NULL;
250 addr = (unsigned long)area->addr; 250 addr = (unsigned long)area->addr;
251 area->phys_addr = __pfn_to_phys(pfn);
251 252
252#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE) 253#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE)
253 if (DOMAIN_IO == 0 && 254 if (DOMAIN_IO == 0 &&
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index cb3e3eef55c0..6b46cee2f9cd 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -15,7 +15,11 @@ config IMX_HAVE_PLATFORM_GPIO_KEYS
15 15
16config IMX_HAVE_PLATFORM_IMX21_HCD 16config IMX_HAVE_PLATFORM_IMX21_HCD
17 bool 17 bool
18 18
19config IMX_HAVE_PLATFORM_IMX27_CODA
20 bool
21 default y if SOC_IMX27
22
19config IMX_HAVE_PLATFORM_IMX2_WDT 23config IMX_HAVE_PLATFORM_IMX2_WDT
20 bool 24 bool
21 25
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index c11ac8472beb..76f3195475d0 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o
4obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o 4obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
5obj-y += platform-gpio-mxc.o 5obj-y += platform-gpio-mxc.o
6obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o 6obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o
7obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX27_CODA) += platform-imx27-coda.o
7obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o 8obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
8obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o 9obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o
9obj-y += platform-imx-dma.o 10obj-y += platform-imx-dma.o
diff --git a/arch/arm/plat-mxc/devices/platform-imx27-coda.c b/arch/arm/plat-mxc/devices/platform-imx27-coda.c
new file mode 100644
index 000000000000..8b12aacdf396
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-imx27-coda.c
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2012 Vista Silicon
3 * Javier Martin <javier.martin@vista-silicon.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9
10#include <mach/hardware.h>
11#include <mach/devices-common.h>
12
13#ifdef CONFIG_SOC_IMX27
14const struct imx_imx27_coda_data imx27_coda_data __initconst = {
15 .iobase = MX27_VPU_BASE_ADDR,
16 .iosize = SZ_512,
17 .irq = MX27_INT_VPU,
18};
19#endif
20
21struct platform_device *__init imx_add_imx27_coda(
22 const struct imx_imx27_coda_data *data)
23{
24 struct resource res[] = {
25 {
26 .start = data->iobase,
27 .end = data->iobase + data->iosize - 1,
28 .flags = IORESOURCE_MEM,
29 }, {
30 .start = data->irq,
31 .end = data->irq,
32 .flags = IORESOURCE_IRQ,
33 },
34 };
35 return imx_add_platform_device_dmamask("coda-imx27", 0, res, 2, NULL,
36 0, DMA_BIT_MASK(32));
37}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 9e3e3d8ae8c2..eaf79d220c9a 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -83,6 +83,14 @@ struct platform_device *__init imx_add_imx21_hcd(
83 const struct imx_imx21_hcd_data *data, 83 const struct imx_imx21_hcd_data *data,
84 const struct mx21_usbh_platform_data *pdata); 84 const struct mx21_usbh_platform_data *pdata);
85 85
86struct imx_imx27_coda_data {
87 resource_size_t iobase;
88 resource_size_t iosize;
89 resource_size_t irq;
90};
91struct platform_device *__init imx_add_imx27_coda(
92 const struct imx_imx27_coda_data *data);
93
86struct imx_imx2_wdt_data { 94struct imx_imx2_wdt_data {
87 int id; 95 int id;
88 resource_size_t iobase; 96 resource_size_t iobase;
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 706b7e29397f..9d7ac20ef8f9 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -312,33 +312,6 @@ void clk_enable_init_clocks(void)
312 } 312 }
313} 313}
314 314
315/**
316 * omap_clk_get_by_name - locate OMAP struct clk by its name
317 * @name: name of the struct clk to locate
318 *
319 * Locate an OMAP struct clk by its name. Assumes that struct clk
320 * names are unique. Returns NULL if not found or a pointer to the
321 * struct clk if found.
322 */
323struct clk *omap_clk_get_by_name(const char *name)
324{
325 struct clk *c;
326 struct clk *ret = NULL;
327
328 mutex_lock(&clocks_mutex);
329
330 list_for_each_entry(c, &clocks, node) {
331 if (!strcmp(c->name, name)) {
332 ret = c;
333 break;
334 }
335 }
336
337 mutex_unlock(&clocks_mutex);
338
339 return ret;
340}
341
342int omap_clk_enable_autoidle_all(void) 315int omap_clk_enable_autoidle_all(void)
343{ 316{
344 struct clk *c; 317 struct clk *c;
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index 656b9862279e..e2e2d045e428 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -19,6 +19,11 @@ struct module;
19struct clk; 19struct clk;
20struct clockdomain; 20struct clockdomain;
21 21
22/* Temporary, needed during the common clock framework conversion */
23#define __clk_get_name(clk) (clk->name)
24#define __clk_get_parent(clk) (clk->parent)
25#define __clk_get_rate(clk) (clk->rate)
26
22/** 27/**
23 * struct clkops - some clock function pointers 28 * struct clkops - some clock function pointers
24 * @enable: fn ptr that enables the current clock in hardware 29 * @enable: fn ptr that enables the current clock in hardware
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 19e7fa577bd0..85868e98c11c 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -60,6 +60,7 @@
60#define OMAP_TIMER_ALWON 0x40000000 60#define OMAP_TIMER_ALWON 0x40000000
61#define OMAP_TIMER_HAS_PWM 0x20000000 61#define OMAP_TIMER_HAS_PWM 0x20000000
62#define OMAP_TIMER_NEEDS_RESET 0x10000000 62#define OMAP_TIMER_NEEDS_RESET 0x10000000
63#define OMAP_TIMER_HAS_DSP_IRQ 0x08000000
63 64
64struct omap_timer_capability_dev_attr { 65struct omap_timer_capability_dev_attr {
65 u32 timer_capability; 66 u32 timer_capability;
diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h
index 88be3e628b33..68b5f0362f35 100644
--- a/arch/arm/plat-omap/include/plat/iommu.h
+++ b/arch/arm/plat-omap/include/plat/iommu.h
@@ -103,6 +103,19 @@ struct iommu_functions {
103 ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len); 103 ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len);
104}; 104};
105 105
106/**
107 * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod
108 * @da_start: device address where the va space starts.
109 * @da_end: device address where the va space ends.
110 * @nr_tlb_entries: number of entries supported by the translation
111 * look-aside buffer (TLB).
112 */
113struct omap_mmu_dev_attr {
114 u32 da_start;
115 u32 da_end;
116 int nr_tlb_entries;
117};
118
106struct iommu_platform_data { 119struct iommu_platform_data {
107 const char *name; 120 const char *name;
108 const char *clk_name; 121 const char *clk_name;
@@ -126,6 +139,7 @@ struct omap_iommu_arch_data {
126 struct omap_iommu *iommu_dev; 139 struct omap_iommu *iommu_dev;
127}; 140};
128 141
142#ifdef CONFIG_IOMMU_API
129/** 143/**
130 * dev_to_omap_iommu() - retrieves an omap iommu object from a user device 144 * dev_to_omap_iommu() - retrieves an omap iommu object from a user device
131 * @dev: iommu client device 145 * @dev: iommu client device
@@ -136,6 +150,7 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
136 150
137 return arch_data->iommu_dev; 151 return arch_data->iommu_dev;
138} 152}
153#endif
139 154
140/* IOMMU errors */ 155/* IOMMU errors */
141#define OMAP_IOMMU_ERR_TLB_MISS (1 << 0) 156#define OMAP_IOMMU_ERR_TLB_MISS (1 << 0)
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index e7259c0d33ec..106f50665804 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -120,6 +120,10 @@ int omap_device_get_context_loss_count(struct platform_device *pdev);
120 120
121/* Other */ 121/* Other */
122 122
123int omap_device_assert_hardreset(struct platform_device *pdev,
124 const char *name);
125int omap_device_deassert_hardreset(struct platform_device *pdev,
126 const char *name);
123int omap_device_idle_hwmods(struct omap_device *od); 127int omap_device_idle_hwmods(struct omap_device *od);
124int omap_device_enable_hwmods(struct omap_device *od); 128int omap_device_enable_hwmods(struct omap_device *od);
125 129
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 05330735f23f..b3349f7b1a2c 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -2,7 +2,7 @@
2 * omap_hwmod macros, structures 2 * omap_hwmod macros, structures
3 * 3 *
4 * Copyright (C) 2009-2011 Nokia Corporation 4 * Copyright (C) 2009-2011 Nokia Corporation
5 * Copyright (C) 2011 Texas Instruments, Inc. 5 * Copyright (C) 2012 Texas Instruments, Inc.
6 * Paul Walmsley 6 * Paul Walmsley
7 * 7 *
8 * Created in collaboration with (alphabetical order): Benoît Cousson, 8 * Created in collaboration with (alphabetical order): Benoît Cousson,
@@ -384,21 +384,38 @@ struct omap_hwmod_omap2_prcm {
384 u8 idlest_stdby_bit; 384 u8 idlest_stdby_bit;
385}; 385};
386 386
387/*
388 * Possible values for struct omap_hwmod_omap4_prcm.flags
389 *
390 * HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT: Some IP blocks don't have a PRCM
391 * module-level context loss register associated with them; this
392 * flag bit should be set in those cases
393 */
394#define HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT (1 << 0)
387 395
388/** 396/**
389 * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data 397 * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data
390 * @clkctrl_reg: PRCM address of the clock control register 398 * @clkctrl_reg: PRCM address of the clock control register
391 * @rstctrl_reg: address of the XXX_RSTCTRL register located in the PRM 399 * @rstctrl_reg: address of the XXX_RSTCTRL register located in the PRM
400 * @lostcontext_mask: bitmask for selecting bits from RM_*_CONTEXT register
392 * @rstst_reg: (AM33XX only) address of the XXX_RSTST register in the PRM 401 * @rstst_reg: (AM33XX only) address of the XXX_RSTST register in the PRM
393 * @submodule_wkdep_bit: bit shift of the WKDEP range 402 * @submodule_wkdep_bit: bit shift of the WKDEP range
403 * @flags: PRCM register capabilities for this IP block
404 *
405 * If @lostcontext_mask is not defined, context loss check code uses
406 * whole register without masking. @lostcontext_mask should only be
407 * defined in cases where @context_offs register is shared by two or
408 * more hwmods.
394 */ 409 */
395struct omap_hwmod_omap4_prcm { 410struct omap_hwmod_omap4_prcm {
396 u16 clkctrl_offs; 411 u16 clkctrl_offs;
397 u16 rstctrl_offs; 412 u16 rstctrl_offs;
398 u16 rstst_offs; 413 u16 rstst_offs;
399 u16 context_offs; 414 u16 context_offs;
415 u32 lostcontext_mask;
400 u8 submodule_wkdep_bit; 416 u8 submodule_wkdep_bit;
401 u8 modulemode; 417 u8 modulemode;
418 u8 flags;
402}; 419};
403 420
404 421
@@ -591,9 +608,7 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
591int __init omap_hwmod_setup_one(const char *name); 608int __init omap_hwmod_setup_one(const char *name);
592 609
593int omap_hwmod_enable(struct omap_hwmod *oh); 610int omap_hwmod_enable(struct omap_hwmod *oh);
594int _omap_hwmod_enable(struct omap_hwmod *oh);
595int omap_hwmod_idle(struct omap_hwmod *oh); 611int omap_hwmod_idle(struct omap_hwmod *oh);
596int _omap_hwmod_idle(struct omap_hwmod *oh);
597int omap_hwmod_shutdown(struct omap_hwmod *oh); 612int omap_hwmod_shutdown(struct omap_hwmod *oh);
598 613
599int omap_hwmod_assert_hardreset(struct omap_hwmod *oh, const char *name); 614int omap_hwmod_assert_hardreset(struct omap_hwmod *oh, const char *name);
@@ -627,11 +642,6 @@ int omap_hwmod_add_initiator_dep(struct omap_hwmod *oh,
627int omap_hwmod_del_initiator_dep(struct omap_hwmod *oh, 642int omap_hwmod_del_initiator_dep(struct omap_hwmod *oh,
628 struct omap_hwmod *init_oh); 643 struct omap_hwmod *init_oh);
629 644
630int omap_hwmod_set_clockact_both(struct omap_hwmod *oh);
631int omap_hwmod_set_clockact_main(struct omap_hwmod *oh);
632int omap_hwmod_set_clockact_iclk(struct omap_hwmod *oh);
633int omap_hwmod_set_clockact_none(struct omap_hwmod *oh);
634
635int omap_hwmod_enable_wakeup(struct omap_hwmod *oh); 645int omap_hwmod_enable_wakeup(struct omap_hwmod *oh);
636int omap_hwmod_disable_wakeup(struct omap_hwmod *oh); 646int omap_hwmod_disable_wakeup(struct omap_hwmod *oh);
637 647
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index bd20588c356b..87ee140fefaa 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -4,6 +4,7 @@
4#define __ASM_ARCH_OMAP_USB_H 4#define __ASM_ARCH_OMAP_USB_H
5 5
6#include <linux/io.h> 6#include <linux/io.h>
7#include <linux/platform_device.h>
7#include <linux/usb/musb.h> 8#include <linux/usb/musb.h>
8 9
9#define OMAP3_HS_USB_PORTS 3 10#define OMAP3_HS_USB_PORTS 3
@@ -63,6 +64,10 @@ struct usbhs_omap_platform_data {
63 struct ehci_hcd_omap_platform_data *ehci_data; 64 struct ehci_hcd_omap_platform_data *ehci_data;
64 struct ohci_hcd_omap_platform_data *ohci_data; 65 struct ohci_hcd_omap_platform_data *ohci_data;
65}; 66};
67
68struct usbtll_omap_platform_data {
69 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
70};
66/*-------------------------------------------------------------------------*/ 71/*-------------------------------------------------------------------------*/
67 72
68struct omap_musb_board_data { 73struct omap_musb_board_data {
@@ -81,6 +86,8 @@ enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
81extern void usb_musb_init(struct omap_musb_board_data *board_data); 86extern void usb_musb_init(struct omap_musb_board_data *board_data);
82 87
83extern void usbhs_init(const struct usbhs_omap_board_data *pdata); 88extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
89extern int omap_tll_enable(void);
90extern int omap_tll_disable(void);
84 91
85extern int omap4430_phy_power(struct device *dev, int ID, int on); 92extern int omap4430_phy_power(struct device *dev, int ID, int on);
86extern int omap4430_phy_set_clk(struct device *dev, int on); 93extern int omap4430_phy_set_clk(struct device *dev, int on);
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index d5f617c542d3..cee85a55bd82 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -261,10 +261,10 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
261 return; 261 return;
262 } 262 }
263 263
264 r = omap_clk_get_by_name(clk_name); 264 r = clk_get(NULL, clk_name);
265 if (IS_ERR(r)) { 265 if (IS_ERR(r)) {
266 dev_err(&od->pdev->dev, 266 dev_err(&od->pdev->dev,
267 "omap_clk_get_by_name for %s failed\n", clk_name); 267 "clk_get for %s failed\n", clk_name);
268 return; 268 return;
269 } 269 }
270 270
@@ -983,6 +983,61 @@ int omap_device_shutdown(struct platform_device *pdev)
983} 983}
984 984
985/** 985/**
986 * omap_device_assert_hardreset - set a device's hardreset line
987 * @pdev: struct platform_device * to reset
988 * @name: const char * name of the reset line
989 *
990 * Set the hardreset line identified by @name on the IP blocks
991 * associated with the hwmods backing the platform_device @pdev. All
992 * of the hwmods associated with @pdev must have the same hardreset
993 * line linked to them for this to work. Passes along the return value
994 * of omap_hwmod_assert_hardreset() in the event of any failure, or
995 * returns 0 upon success.
996 */
997int omap_device_assert_hardreset(struct platform_device *pdev, const char *name)
998{
999 struct omap_device *od = to_omap_device(pdev);
1000 int ret = 0;
1001 int i;
1002
1003 for (i = 0; i < od->hwmods_cnt; i++) {
1004 ret = omap_hwmod_assert_hardreset(od->hwmods[i], name);
1005 if (ret)
1006 break;
1007 }
1008
1009 return ret;
1010}
1011
1012/**
1013 * omap_device_deassert_hardreset - release a device's hardreset line
1014 * @pdev: struct platform_device * to reset
1015 * @name: const char * name of the reset line
1016 *
1017 * Release the hardreset line identified by @name on the IP blocks
1018 * associated with the hwmods backing the platform_device @pdev. All
1019 * of the hwmods associated with @pdev must have the same hardreset
1020 * line linked to them for this to work. Passes along the return
1021 * value of omap_hwmod_deassert_hardreset() in the event of any
1022 * failure, or returns 0 upon success.
1023 */
1024int omap_device_deassert_hardreset(struct platform_device *pdev,
1025 const char *name)
1026{
1027 struct omap_device *od = to_omap_device(pdev);
1028 int ret = 0;
1029 int i;
1030
1031 for (i = 0; i < od->hwmods_cnt; i++) {
1032 ret = omap_hwmod_deassert_hardreset(od->hwmods[i], name);
1033 if (ret)
1034 break;
1035 }
1036
1037 return ret;
1038}
1039
1040/**
986 * omap_device_align_pm_lat - activate/deactivate device to match wakeup lat lim 1041 * omap_device_align_pm_lat - activate/deactivate device to match wakeup lat lim
987 * @od: struct omap_device * 1042 * @od: struct omap_device *
988 * 1043 *
diff --git a/arch/arm/plat-orion/Makefile b/arch/arm/plat-orion/Makefile
index c20ce0f5ce33..a82cecb84948 100644
--- a/arch/arm/plat-orion/Makefile
+++ b/arch/arm/plat-orion/Makefile
@@ -1,10 +1,10 @@
1# 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
4 5
5obj-y := irq.o pcie.o time.o common.o mpp.o addr-map.o 6obj-y += addr-map.o
6obj-m :=
7obj-n :=
8obj- :=
9 7
10obj-$(CONFIG_GENERIC_GPIO) += gpio.o 8orion-gpio-$(CONFIG_GENERIC_GPIO) += gpio.o
9obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o
10obj-$(CONFIG_PLAT_ORION_LEGACY) += $(orion-gpio-y)
diff --git a/arch/arm/plat-orion/addr-map.c b/arch/arm/plat-orion/addr-map.c
index 367ca89ac403..a7b8060c293a 100644
--- a/arch/arm/plat-orion/addr-map.c
+++ b/arch/arm/plat-orion/addr-map.c
@@ -48,7 +48,7 @@ EXPORT_SYMBOL_GPL(mv_mbus_dram_info);
48static void __init __iomem * 48static void __init __iomem *
49orion_win_cfg_base(const struct orion_addr_map_cfg *cfg, int win) 49orion_win_cfg_base(const struct orion_addr_map_cfg *cfg, int win)
50{ 50{
51 return (void __iomem *)(cfg->bridge_virt_base + (win << 4)); 51 return cfg->bridge_virt_base + (win << 4);
52} 52}
53 53
54/* 54/*
@@ -143,19 +143,16 @@ void __init orion_config_wins(struct orion_addr_map_cfg * cfg,
143 * Setup MBUS dram target info. 143 * Setup MBUS dram target info.
144 */ 144 */
145void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg, 145void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg,
146 const u32 ddr_window_cpu_base) 146 const void __iomem *ddr_window_cpu_base)
147{ 147{
148 void __iomem *addr;
149 int i; 148 int i;
150 int cs; 149 int cs;
151 150
152 orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR; 151 orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
153 152
154 addr = (void __iomem *)ddr_window_cpu_base;
155
156 for (i = 0, cs = 0; i < 4; i++) { 153 for (i = 0, cs = 0; i < 4; i++) {
157 u32 base = readl(addr + DDR_BASE_CS_OFF(i)); 154 u32 base = readl(ddr_window_cpu_base + DDR_BASE_CS_OFF(i));
158 u32 size = readl(addr + DDR_SIZE_CS_OFF(i)); 155 u32 size = readl(ddr_window_cpu_base + DDR_SIZE_CS_OFF(i));
159 156
160 /* 157 /*
161 * Chip select enabled? 158 * Chip select enabled?
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index 87f53caef655..b8a688cad4c2 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -86,13 +86,13 @@ static void __init uart_complete(
86 struct platform_device *orion_uart, 86 struct platform_device *orion_uart,
87 struct plat_serial8250_port *data, 87 struct plat_serial8250_port *data,
88 struct resource *resources, 88 struct resource *resources,
89 unsigned int membase, 89 void __iomem *membase,
90 resource_size_t mapbase, 90 resource_size_t mapbase,
91 unsigned int irq, 91 unsigned int irq,
92 struct clk *clk) 92 struct clk *clk)
93{ 93{
94 data->mapbase = mapbase; 94 data->mapbase = mapbase;
95 data->membase = (void __iomem *)membase; 95 data->membase = membase;
96 data->irq = irq; 96 data->irq = irq;
97 data->uartclk = uart_get_clk_rate(clk); 97 data->uartclk = uart_get_clk_rate(clk);
98 orion_uart->dev.platform_data = data; 98 orion_uart->dev.platform_data = data;
@@ -120,7 +120,7 @@ static struct platform_device orion_uart0 = {
120 .id = PLAT8250_DEV_PLATFORM, 120 .id = PLAT8250_DEV_PLATFORM,
121}; 121};
122 122
123void __init orion_uart0_init(unsigned int membase, 123void __init orion_uart0_init(void __iomem *membase,
124 resource_size_t mapbase, 124 resource_size_t mapbase,
125 unsigned int irq, 125 unsigned int irq,
126 struct clk *clk) 126 struct clk *clk)
@@ -148,7 +148,7 @@ static struct platform_device orion_uart1 = {
148 .id = PLAT8250_DEV_PLATFORM1, 148 .id = PLAT8250_DEV_PLATFORM1,
149}; 149};
150 150
151void __init orion_uart1_init(unsigned int membase, 151void __init orion_uart1_init(void __iomem *membase,
152 resource_size_t mapbase, 152 resource_size_t mapbase,
153 unsigned int irq, 153 unsigned int irq,
154 struct clk *clk) 154 struct clk *clk)
@@ -176,7 +176,7 @@ static struct platform_device orion_uart2 = {
176 .id = PLAT8250_DEV_PLATFORM2, 176 .id = PLAT8250_DEV_PLATFORM2,
177}; 177};
178 178
179void __init orion_uart2_init(unsigned int membase, 179void __init orion_uart2_init(void __iomem *membase,
180 resource_size_t mapbase, 180 resource_size_t mapbase,
181 unsigned int irq, 181 unsigned int irq,
182 struct clk *clk) 182 struct clk *clk)
@@ -204,7 +204,7 @@ static struct platform_device orion_uart3 = {
204 .id = 3, 204 .id = 3,
205}; 205};
206 206
207void __init orion_uart3_init(unsigned int membase, 207void __init orion_uart3_init(void __iomem *membase,
208 resource_size_t mapbase, 208 resource_size_t mapbase,
209 unsigned int irq, 209 unsigned int irq,
210 struct clk *clk) 210 struct clk *clk)
diff --git a/arch/arm/plat-orion/include/plat/addr-map.h b/arch/arm/plat-orion/include/plat/addr-map.h
index fd556f77562c..ec63e4a627d0 100644
--- a/arch/arm/plat-orion/include/plat/addr-map.h
+++ b/arch/arm/plat-orion/include/plat/addr-map.h
@@ -16,7 +16,7 @@ extern struct mbus_dram_target_info orion_mbus_dram_info;
16struct orion_addr_map_cfg { 16struct orion_addr_map_cfg {
17 const int num_wins; /* Total number of windows */ 17 const int num_wins; /* Total number of windows */
18 const int remappable_wins; 18 const int remappable_wins;
19 const u32 bridge_virt_base; 19 void __iomem *bridge_virt_base;
20 20
21 /* If NULL, the default cpu_win_can_remap will be used, using 21 /* If NULL, the default cpu_win_can_remap will be used, using
22 the value in remappable_wins */ 22 the value in remappable_wins */
@@ -49,5 +49,5 @@ void __init orion_setup_cpu_win(const struct orion_addr_map_cfg *cfg,
49 const u8 attr, const int remap); 49 const u8 attr, const int remap);
50 50
51void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg, 51void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg,
52 const u32 ddr_window_cpu_base); 52 const void __iomem *ddr_window_cpu_base);
53#endif 53#endif
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h
index ae2377ef63e5..6bbc3fe5f58e 100644
--- a/arch/arm/plat-orion/include/plat/common.h
+++ b/arch/arm/plat-orion/include/plat/common.h
@@ -13,22 +13,22 @@
13 13
14struct dsa_platform_data; 14struct dsa_platform_data;
15 15
16void __init orion_uart0_init(unsigned int membase, 16void __init orion_uart0_init(void __iomem *membase,
17 resource_size_t mapbase, 17 resource_size_t mapbase,
18 unsigned int irq, 18 unsigned int irq,
19 struct clk *clk); 19 struct clk *clk);
20 20
21void __init orion_uart1_init(unsigned int membase, 21void __init orion_uart1_init(void __iomem *membase,
22 resource_size_t mapbase, 22 resource_size_t mapbase,
23 unsigned int irq, 23 unsigned int irq,
24 struct clk *clk); 24 struct clk *clk);
25 25
26void __init orion_uart2_init(unsigned int membase, 26void __init orion_uart2_init(void __iomem *membase,
27 resource_size_t mapbase, 27 resource_size_t mapbase,
28 unsigned int irq, 28 unsigned int irq,
29 struct clk *clk); 29 struct clk *clk);
30 30
31void __init orion_uart3_init(unsigned int membase, 31void __init orion_uart3_init(void __iomem *membase,
32 resource_size_t mapbase, 32 resource_size_t mapbase,
33 unsigned int irq, 33 unsigned int irq,
34 struct clk *clk); 34 struct clk *clk);
diff --git a/arch/arm/plat-orion/include/plat/mpp.h b/arch/arm/plat-orion/include/plat/mpp.h
index 723adce99f41..254552fee889 100644
--- a/arch/arm/plat-orion/include/plat/mpp.h
+++ b/arch/arm/plat-orion/include/plat/mpp.h
@@ -29,6 +29,6 @@
29#define MPP_OUTPUT_MASK GENERIC_MPP(0, 0x0, 0, 1) 29#define MPP_OUTPUT_MASK GENERIC_MPP(0, 0x0, 0, 1)
30 30
31void __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask, 31void __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask,
32 unsigned int mpp_max, unsigned int dev_bus); 32 unsigned int mpp_max, void __iomem *dev_bus);
33 33
34#endif 34#endif
diff --git a/arch/arm/plat-orion/include/plat/time.h b/arch/arm/plat-orion/include/plat/time.h
index 4d5f1f6e18df..07527e417c62 100644
--- a/arch/arm/plat-orion/include/plat/time.h
+++ b/arch/arm/plat-orion/include/plat/time.h
@@ -11,9 +11,9 @@
11#ifndef __PLAT_TIME_H 11#ifndef __PLAT_TIME_H
12#define __PLAT_TIME_H 12#define __PLAT_TIME_H
13 13
14void orion_time_set_base(u32 timer_base); 14void orion_time_set_base(void __iomem *timer_base);
15 15
16void orion_time_init(u32 bridge_base, u32 bridge_timer1_clr_mask, 16void orion_time_init(void __iomem *bridge_base, u32 bridge_timer1_clr_mask,
17 unsigned int irq, unsigned int tclk); 17 unsigned int irq, unsigned int tclk);
18 18
19 19
diff --git a/arch/arm/plat-orion/mpp.c b/arch/arm/plat-orion/mpp.c
index 7740bb31d662..e686fe76a96b 100644
--- a/arch/arm/plat-orion/mpp.c
+++ b/arch/arm/plat-orion/mpp.c
@@ -18,15 +18,15 @@
18#include <plat/mpp.h> 18#include <plat/mpp.h>
19 19
20/* Address of the ith MPP control register */ 20/* Address of the ith MPP control register */
21static __init unsigned long mpp_ctrl_addr(unsigned int i, 21static __init void __iomem *mpp_ctrl_addr(unsigned int i,
22 unsigned long dev_bus) 22 void __iomem *dev_bus)
23{ 23{
24 return dev_bus + (i) * 4; 24 return dev_bus + (i) * 4;
25} 25}
26 26
27 27
28void __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask, 28void __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask,
29 unsigned int mpp_max, unsigned int dev_bus) 29 unsigned int mpp_max, void __iomem *dev_bus)
30{ 30{
31 unsigned int mpp_nr_regs = (1 + mpp_max/8); 31 unsigned int mpp_nr_regs = (1 + mpp_max/8);
32 u32 mpp_ctrl[mpp_nr_regs]; 32 u32 mpp_ctrl[mpp_nr_regs];
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 1ed8d1397fcf..0f4fa863dd55 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -180,13 +180,13 @@ static struct irqaction orion_timer_irq = {
180}; 180};
181 181
182void __init 182void __init
183orion_time_set_base(u32 _timer_base) 183orion_time_set_base(void __iomem *_timer_base)
184{ 184{
185 timer_base = (void __iomem *)_timer_base; 185 timer_base = _timer_base;
186} 186}
187 187
188void __init 188void __init
189orion_time_init(u32 _bridge_base, u32 _bridge_timer1_clr_mask, 189orion_time_init(void __iomem *_bridge_base, u32 _bridge_timer1_clr_mask,
190 unsigned int irq, unsigned int tclk) 190 unsigned int irq, unsigned int tclk)
191{ 191{
192 u32 u; 192 u32 u;
@@ -194,7 +194,7 @@ orion_time_init(u32 _bridge_base, u32 _bridge_timer1_clr_mask,
194 /* 194 /*
195 * Set SoC-specific data. 195 * Set SoC-specific data.
196 */ 196 */
197 bridge_base = (void __iomem *)_bridge_base; 197 bridge_base = _bridge_base;
198 bridge_timer1_clr_mask = _bridge_timer1_clr_mask; 198 bridge_timer1_clr_mask = _bridge_timer1_clr_mask;
199 199
200 ticks_per_jiffy = (tclk + HZ/2) / HZ; 200 ticks_per_jiffy = (tclk + HZ/2) / HZ;
diff --git a/arch/arm/plat-versatile/fpga-irq.c b/arch/arm/plat-versatile/fpga-irq.c
index 6e70d03824a1..091ae1030045 100644
--- a/arch/arm/plat-versatile/fpga-irq.c
+++ b/arch/arm/plat-versatile/fpga-irq.c
@@ -5,6 +5,8 @@
5#include <linux/io.h> 5#include <linux/io.h>
6#include <linux/irqdomain.h> 6#include <linux/irqdomain.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/of.h>
9#include <linux/of_address.h>
8 10
9#include <asm/exception.h> 11#include <asm/exception.h>
10#include <asm/mach/irq.h> 12#include <asm/mach/irq.h>
@@ -14,11 +16,17 @@
14#define IRQ_RAW_STATUS 0x04 16#define IRQ_RAW_STATUS 0x04
15#define IRQ_ENABLE_SET 0x08 17#define IRQ_ENABLE_SET 0x08
16#define IRQ_ENABLE_CLEAR 0x0c 18#define IRQ_ENABLE_CLEAR 0x0c
19#define INT_SOFT_SET 0x10
20#define INT_SOFT_CLEAR 0x14
21#define FIQ_STATUS 0x20
22#define FIQ_RAW_STATUS 0x24
23#define FIQ_ENABLE 0x28
24#define FIQ_ENABLE_SET 0x28
25#define FIQ_ENABLE_CLEAR 0x2C
17 26
18/** 27/**
19 * struct fpga_irq_data - irq data container for the FPGA IRQ controller 28 * struct fpga_irq_data - irq data container for the FPGA IRQ controller
20 * @base: memory offset in virtual memory 29 * @base: memory offset in virtual memory
21 * @irq_start: first IRQ number handled by this instance
22 * @chip: chip container for this instance 30 * @chip: chip container for this instance
23 * @domain: IRQ domain for this instance 31 * @domain: IRQ domain for this instance
24 * @valid: mask for valid IRQs on this controller 32 * @valid: mask for valid IRQs on this controller
@@ -26,7 +34,6 @@
26 */ 34 */
27struct fpga_irq_data { 35struct fpga_irq_data {
28 void __iomem *base; 36 void __iomem *base;
29 unsigned int irq_start;
30 struct irq_chip chip; 37 struct irq_chip chip;
31 u32 valid; 38 u32 valid;
32 struct irq_domain *domain; 39 struct irq_domain *domain;
@@ -125,34 +132,79 @@ static struct irq_domain_ops fpga_irqdomain_ops = {
125 .xlate = irq_domain_xlate_onetwocell, 132 .xlate = irq_domain_xlate_onetwocell,
126}; 133};
127 134
128void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start, 135static __init struct fpga_irq_data *
129 int parent_irq, u32 valid, struct device_node *node) 136fpga_irq_prep_struct(void __iomem *base, const char *name, u32 valid) {
130{
131 struct fpga_irq_data *f; 137 struct fpga_irq_data *f;
132 138
133 if (fpga_irq_id >= ARRAY_SIZE(fpga_irq_devices)) { 139 if (fpga_irq_id >= ARRAY_SIZE(fpga_irq_devices)) {
134 printk(KERN_ERR "%s: too few FPGA IRQ controllers, increase CONFIG_PLAT_VERSATILE_FPGA_IRQ_NR\n", __func__); 140 printk(KERN_ERR "%s: too few FPGA IRQ controllers, increase CONFIG_PLAT_VERSATILE_FPGA_IRQ_NR\n", __func__);
135 return; 141 return NULL;
136 } 142 }
137
138 f = &fpga_irq_devices[fpga_irq_id]; 143 f = &fpga_irq_devices[fpga_irq_id];
139 f->base = base; 144 f->base = base;
140 f->irq_start = irq_start;
141 f->chip.name = name; 145 f->chip.name = name;
142 f->chip.irq_ack = fpga_irq_mask; 146 f->chip.irq_ack = fpga_irq_mask;
143 f->chip.irq_mask = fpga_irq_mask; 147 f->chip.irq_mask = fpga_irq_mask;
144 f->chip.irq_unmask = fpga_irq_unmask; 148 f->chip.irq_unmask = fpga_irq_unmask;
145 f->valid = valid; 149 f->valid = valid;
150 fpga_irq_id++;
151
152 return f;
153}
154
155void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start,
156 int parent_irq, u32 valid, struct device_node *node)
157{
158 struct fpga_irq_data *f;
159
160 f = fpga_irq_prep_struct(base, name, valid);
161 if (!f)
162 return;
146 163
147 if (parent_irq != -1) { 164 if (parent_irq != -1) {
148 irq_set_handler_data(parent_irq, f); 165 irq_set_handler_data(parent_irq, f);
149 irq_set_chained_handler(parent_irq, fpga_irq_handle); 166 irq_set_chained_handler(parent_irq, fpga_irq_handle);
150 } 167 }
151 168
152 f->domain = irq_domain_add_legacy(node, fls(valid), f->irq_start, 0, 169 f->domain = irq_domain_add_legacy(node, fls(valid), irq_start, 0,
153 &fpga_irqdomain_ops, f); 170 &fpga_irqdomain_ops, f);
154 pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n", 171 pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n",
155 fpga_irq_id, name, base, f->used_irqs); 172 fpga_irq_id, name, base, f->used_irqs);
173}
156 174
157 fpga_irq_id++; 175#ifdef CONFIG_OF
176int __init fpga_irq_of_init(struct device_node *node,
177 struct device_node *parent)
178{
179 struct fpga_irq_data *f;
180 void __iomem *base;
181 u32 clear_mask;
182 u32 valid_mask;
183
184 if (WARN_ON(!node))
185 return -ENODEV;
186
187 base = of_iomap(node, 0);
188 WARN(!base, "unable to map fpga irq registers\n");
189
190 if (of_property_read_u32(node, "clear-mask", &clear_mask))
191 clear_mask = 0;
192
193 if (of_property_read_u32(node, "valid-mask", &valid_mask))
194 valid_mask = 0;
195
196 f = fpga_irq_prep_struct(base, node->name, valid_mask);
197 if (!f)
198 return -ENOMEM;
199
200 writel(clear_mask, base + IRQ_ENABLE_CLEAR);
201 writel(clear_mask, base + FIQ_ENABLE_CLEAR);
202
203 f->domain = irq_domain_add_linear(node, fls(valid_mask), &fpga_irqdomain_ops, f);
204 f->used_irqs = hweight32(valid_mask);
205
206 pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n",
207 fpga_irq_id, node->name, base, f->used_irqs);
208 return 0;
158} 209}
210#endif
diff --git a/arch/arm/plat-versatile/include/plat/fpga-irq.h b/arch/arm/plat-versatile/include/plat/fpga-irq.h
index 91bcfb67551d..1fac9651d3ca 100644
--- a/arch/arm/plat-versatile/include/plat/fpga-irq.h
+++ b/arch/arm/plat-versatile/include/plat/fpga-irq.h
@@ -7,5 +7,7 @@ struct pt_regs;
7void fpga_handle_irq(struct pt_regs *regs); 7void fpga_handle_irq(struct pt_regs *regs);
8void fpga_irq_init(void __iomem *, const char *, int, int, u32, 8void fpga_irq_init(void __iomem *, const char *, int, int, u32,
9 struct device_node *node); 9 struct device_node *node);
10int fpga_irq_of_init(struct device_node *node,
11 struct device_node *parent);
10 12
11#endif 13#endif
diff --git a/arch/arm/xen/Makefile b/arch/arm/xen/Makefile
new file mode 100644
index 000000000000..43841033afd3
--- /dev/null
+++ b/arch/arm/xen/Makefile
@@ -0,0 +1 @@
obj-y := enlighten.o hypercall.o grant-table.o
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
new file mode 100644
index 000000000000..59bcb96ac369
--- /dev/null
+++ b/arch/arm/xen/enlighten.c
@@ -0,0 +1,168 @@
1#include <xen/xen.h>
2#include <xen/events.h>
3#include <xen/grant_table.h>
4#include <xen/hvm.h>
5#include <xen/interface/xen.h>
6#include <xen/interface/memory.h>
7#include <xen/interface/hvm/params.h>
8#include <xen/features.h>
9#include <xen/platform_pci.h>
10#include <xen/xenbus.h>
11#include <asm/xen/hypervisor.h>
12#include <asm/xen/hypercall.h>
13#include <linux/interrupt.h>
14#include <linux/irqreturn.h>
15#include <linux/module.h>
16#include <linux/of.h>
17#include <linux/of_irq.h>
18#include <linux/of_address.h>
19
20struct start_info _xen_start_info;
21struct start_info *xen_start_info = &_xen_start_info;
22EXPORT_SYMBOL_GPL(xen_start_info);
23
24enum xen_domain_type xen_domain_type = XEN_NATIVE;
25EXPORT_SYMBOL_GPL(xen_domain_type);
26
27struct shared_info xen_dummy_shared_info;
28struct shared_info *HYPERVISOR_shared_info = (void *)&xen_dummy_shared_info;
29
30DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
31
32/* TODO: to be removed */
33__read_mostly int xen_have_vector_callback;
34EXPORT_SYMBOL_GPL(xen_have_vector_callback);
35
36int xen_platform_pci_unplug = XEN_UNPLUG_ALL;
37EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
38
39static __read_mostly int xen_events_irq = -1;
40
41int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
42 unsigned long addr,
43 unsigned long mfn, int nr,
44 pgprot_t prot, unsigned domid)
45{
46 return -ENOSYS;
47}
48EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range);
49
50/*
51 * see Documentation/devicetree/bindings/arm/xen.txt for the
52 * documentation of the Xen Device Tree format.
53 */
54#define GRANT_TABLE_PHYSADDR 0
55static int __init xen_guest_init(void)
56{
57 struct xen_add_to_physmap xatp;
58 static struct shared_info *shared_info_page = 0;
59 struct device_node *node;
60 int len;
61 const char *s = NULL;
62 const char *version = NULL;
63 const char *xen_prefix = "xen,xen-";
64 struct resource res;
65
66 node = of_find_compatible_node(NULL, NULL, "xen,xen");
67 if (!node) {
68 pr_debug("No Xen support\n");
69 return 0;
70 }
71 s = of_get_property(node, "compatible", &len);
72 if (strlen(xen_prefix) + 3 < len &&
73 !strncmp(xen_prefix, s, strlen(xen_prefix)))
74 version = s + strlen(xen_prefix);
75 if (version == NULL) {
76 pr_debug("Xen version not found\n");
77 return 0;
78 }
79 if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
80 return 0;
81 xen_hvm_resume_frames = res.start >> PAGE_SHIFT;
82 xen_events_irq = irq_of_parse_and_map(node, 0);
83 pr_info("Xen %s support found, events_irq=%d gnttab_frame_pfn=%lx\n",
84 version, xen_events_irq, xen_hvm_resume_frames);
85 xen_domain_type = XEN_HVM_DOMAIN;
86
87 xen_setup_features();
88 if (xen_feature(XENFEAT_dom0))
89 xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
90 else
91 xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
92
93 if (!shared_info_page)
94 shared_info_page = (struct shared_info *)
95 get_zeroed_page(GFP_KERNEL);
96 if (!shared_info_page) {
97 pr_err("not enough memory\n");
98 return -ENOMEM;
99 }
100 xatp.domid = DOMID_SELF;
101 xatp.idx = 0;
102 xatp.space = XENMAPSPACE_shared_info;
103 xatp.gpfn = __pa(shared_info_page) >> PAGE_SHIFT;
104 if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
105 BUG();
106
107 HYPERVISOR_shared_info = (struct shared_info *)shared_info_page;
108
109 /* xen_vcpu is a pointer to the vcpu_info struct in the shared_info
110 * page, we use it in the event channel upcall and in some pvclock
111 * related functions. We don't need the vcpu_info placement
112 * optimizations because we don't use any pv_mmu or pv_irq op on
113 * HVM.
114 * The shared info contains exactly 1 CPU (the boot CPU). The guest
115 * is required to use VCPUOP_register_vcpu_info to place vcpu info
116 * for secondary CPUs as they are brought up. */
117 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
118
119 gnttab_init();
120 if (!xen_initial_domain())
121 xenbus_probe(NULL);
122
123 return 0;
124}
125core_initcall(xen_guest_init);
126
127static irqreturn_t xen_arm_callback(int irq, void *arg)
128{
129 xen_hvm_evtchn_do_upcall();
130 return IRQ_HANDLED;
131}
132
133static int __init xen_init_events(void)
134{
135 if (!xen_domain() || xen_events_irq < 0)
136 return -ENODEV;
137
138 xen_init_IRQ();
139
140 if (request_percpu_irq(xen_events_irq, xen_arm_callback,
141 "events", xen_vcpu)) {
142 pr_err("Error requesting IRQ %d\n", xen_events_irq);
143 return -EINVAL;
144 }
145
146 enable_percpu_irq(xen_events_irq, 0);
147
148 return 0;
149}
150postcore_initcall(xen_init_events);
151
152/* XXX: only until balloon is properly working */
153int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem)
154{
155 *pages = alloc_pages(highmem ? GFP_HIGHUSER : GFP_KERNEL,
156 get_order(nr_pages));
157 if (*pages == NULL)
158 return -ENOMEM;
159 return 0;
160}
161EXPORT_SYMBOL_GPL(alloc_xenballooned_pages);
162
163void free_xenballooned_pages(int nr_pages, struct page **pages)
164{
165 kfree(*pages);
166 *pages = NULL;
167}
168EXPORT_SYMBOL_GPL(free_xenballooned_pages);
diff --git a/arch/arm/xen/grant-table.c b/arch/arm/xen/grant-table.c
new file mode 100644
index 000000000000..dbd1330c0196
--- /dev/null
+++ b/arch/arm/xen/grant-table.c
@@ -0,0 +1,53 @@
1/******************************************************************************
2 * grant_table.c
3 * ARM specific part
4 *
5 * Granting foreign access to our memory reservation.
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 version 2
9 * as published by the Free Software Foundation; or, when distributed
10 * separately from the Linux kernel or incorporated into other
11 * software packages, subject to the following license:
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a copy
14 * of this source file (the "Software"), to deal in the Software without
15 * restriction, including without limitation the rights to use, copy, modify,
16 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
17 * and to permit persons to whom the Software is furnished to do so, subject to
18 * the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included in
21 * all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
29 * IN THE SOFTWARE.
30 */
31
32#include <xen/interface/xen.h>
33#include <xen/page.h>
34#include <xen/grant_table.h>
35
36int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
37 unsigned long max_nr_gframes,
38 void **__shared)
39{
40 return -ENOSYS;
41}
42
43void arch_gnttab_unmap(void *shared, unsigned long nr_gframes)
44{
45 return;
46}
47
48int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
49 unsigned long max_nr_gframes,
50 grant_status_t **__shared)
51{
52 return -ENOSYS;
53}
diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S
new file mode 100644
index 000000000000..074f5ed101b9
--- /dev/null
+++ b/arch/arm/xen/hypercall.S
@@ -0,0 +1,106 @@
1/******************************************************************************
2 * hypercall.S
3 *
4 * Xen hypercall wrappers
5 *
6 * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33/*
34 * The Xen hypercall calling convention is very similar to the ARM
35 * procedure calling convention: the first paramter is passed in r0, the
36 * second in r1, the third in r2 and the fourth in r3. Considering that
37 * Xen hypercalls have 5 arguments at most, the fifth paramter is passed
38 * in r4, differently from the procedure calling convention of using the
39 * stack for that case.
40 *
41 * The hypercall number is passed in r12.
42 *
43 * The return value is in r0.
44 *
45 * The hvc ISS is required to be 0xEA1, that is the Xen specific ARM
46 * hypercall tag.
47 */
48
49#include <linux/linkage.h>
50#include <asm/assembler.h>
51#include <xen/interface/xen.h>
52
53
54/* HVC 0xEA1 */
55#ifdef CONFIG_THUMB2_KERNEL
56#define xen_hvc .word 0xf7e08ea1
57#else
58#define xen_hvc .word 0xe140ea71
59#endif
60
61#define HYPERCALL_SIMPLE(hypercall) \
62ENTRY(HYPERVISOR_##hypercall) \
63 mov r12, #__HYPERVISOR_##hypercall; \
64 xen_hvc; \
65 mov pc, lr; \
66ENDPROC(HYPERVISOR_##hypercall)
67
68#define HYPERCALL0 HYPERCALL_SIMPLE
69#define HYPERCALL1 HYPERCALL_SIMPLE
70#define HYPERCALL2 HYPERCALL_SIMPLE
71#define HYPERCALL3 HYPERCALL_SIMPLE
72#define HYPERCALL4 HYPERCALL_SIMPLE
73
74#define HYPERCALL5(hypercall) \
75ENTRY(HYPERVISOR_##hypercall) \
76 stmdb sp!, {r4} \
77 ldr r4, [sp, #4] \
78 mov r12, #__HYPERVISOR_##hypercall; \
79 xen_hvc \
80 ldm sp!, {r4} \
81 mov pc, lr \
82ENDPROC(HYPERVISOR_##hypercall)
83
84 .text
85
86HYPERCALL2(xen_version);
87HYPERCALL3(console_io);
88HYPERCALL3(grant_table_op);
89HYPERCALL2(sched_op);
90HYPERCALL2(event_channel_op);
91HYPERCALL2(hvm_op);
92HYPERCALL2(memory_op);
93HYPERCALL2(physdev_op);
94
95ENTRY(privcmd_call)
96 stmdb sp!, {r4}
97 mov r12, r0
98 mov r0, r1
99 mov r1, r2
100 mov r2, r3
101 ldr r3, [sp, #8]
102 ldr r4, [sp, #4]
103 xen_hvc
104 ldm sp!, {r4}
105 mov pc, lr
106ENDPROC(privcmd_call);
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
index a670a33ad736..37e610dc084e 100644
--- a/arch/arm64/include/asm/compat.h
+++ b/arch/arm64/include/asm/compat.h
@@ -55,6 +55,7 @@ typedef s64 compat_s64;
55typedef u32 compat_uint_t; 55typedef u32 compat_uint_t;
56typedef u32 compat_ulong_t; 56typedef u32 compat_ulong_t;
57typedef u64 compat_u64; 57typedef u64 compat_u64;
58typedef u32 compat_uptr_t;
58 59
59struct compat_timespec { 60struct compat_timespec {
60 compat_time_t tv_sec; 61 compat_time_t tv_sec;
@@ -130,6 +131,64 @@ typedef u32 compat_old_sigset_t;
130 131
131typedef u32 compat_sigset_word; 132typedef u32 compat_sigset_word;
132 133
134typedef union compat_sigval {
135 compat_int_t sival_int;
136 compat_uptr_t sival_ptr;
137} compat_sigval_t;
138
139typedef struct compat_siginfo {
140 int si_signo;
141 int si_errno;
142 int si_code;
143
144 union {
145 /* The padding is the same size as AArch64. */
146 int _pad[128/sizeof(int) - 3];
147
148 /* kill() */
149 struct {
150 compat_pid_t _pid; /* sender's pid */
151 __compat_uid32_t _uid; /* sender's uid */
152 } _kill;
153
154 /* POSIX.1b timers */
155 struct {
156 compat_timer_t _tid; /* timer id */
157 int _overrun; /* overrun count */
158 compat_sigval_t _sigval; /* same as below */
159 int _sys_private; /* not to be passed to user */
160 } _timer;
161
162 /* POSIX.1b signals */
163 struct {
164 compat_pid_t _pid; /* sender's pid */
165 __compat_uid32_t _uid; /* sender's uid */
166 compat_sigval_t _sigval;
167 } _rt;
168
169 /* SIGCHLD */
170 struct {
171 compat_pid_t _pid; /* which child */
172 __compat_uid32_t _uid; /* sender's uid */
173 int _status; /* exit code */
174 compat_clock_t _utime;
175 compat_clock_t _stime;
176 } _sigchld;
177
178 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
179 struct {
180 compat_uptr_t _addr; /* faulting insn/memory ref. */
181 short _addr_lsb; /* LSB of the reported address */
182 } _sigfault;
183
184 /* SIGPOLL */
185 struct {
186 compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */
187 int _fd;
188 } _sigpoll;
189 } _sifields;
190} compat_siginfo_t;
191
133#define COMPAT_OFF_T_MAX 0x7fffffff 192#define COMPAT_OFF_T_MAX 0x7fffffff
134#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 193#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
135 194
@@ -139,7 +198,6 @@ typedef u32 compat_sigset_word;
139 * as pointers because the syscall entry code will have 198 * as pointers because the syscall entry code will have
140 * appropriately converted them already. 199 * appropriately converted them already.
141 */ 200 */
142typedef u32 compat_uptr_t;
143 201
144static inline void __user *compat_ptr(compat_uptr_t uptr) 202static inline void __user *compat_ptr(compat_uptr_t uptr)
145{ 203{
diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h
index f8190ba45a3e..db05f9766112 100644
--- a/arch/arm64/include/asm/hwcap.h
+++ b/arch/arm64/include/asm/hwcap.h
@@ -35,7 +35,8 @@
35#define COMPAT_HWCAP_IDIVT (1 << 18) 35#define COMPAT_HWCAP_IDIVT (1 << 18)
36#define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT) 36#define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT)
37 37
38#if defined(__KERNEL__) && !defined(__ASSEMBLY__) 38#ifdef __KERNEL__
39#ifndef __ASSEMBLY__
39/* 40/*
40 * This yields a mask that user programs can use to figure out what 41 * This yields a mask that user programs can use to figure out what
41 * instruction set this cpu supports. 42 * instruction set this cpu supports.
@@ -49,5 +50,6 @@
49 50
50extern unsigned int elf_hwcap; 51extern unsigned int elf_hwcap;
51#endif 52#endif
53#endif
52 54
53#endif 55#endif
diff --git a/arch/arm64/include/asm/stat.h b/arch/arm64/include/asm/stat.h
index d87225cbead8..a9f580c28f7b 100644
--- a/arch/arm64/include/asm/stat.h
+++ b/arch/arm64/include/asm/stat.h
@@ -18,7 +18,8 @@
18 18
19#include <asm-generic/stat.h> 19#include <asm-generic/stat.h>
20 20
21#if defined(__KERNEL__) && defined(CONFIG_COMPAT) 21#ifdef __KERNEL__
22#ifdef CONFIG_COMPAT
22 23
23#include <asm/compat.h> 24#include <asm/compat.h>
24 25
@@ -58,5 +59,6 @@ struct stat64 {
58}; 59};
59 60
60#endif 61#endif
62#endif
61 63
62#endif 64#endif
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index fe18a683274f..8f03dee066ed 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -13,15 +13,13 @@
13 * You should have received a copy of the GNU General Public License 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/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#if !defined(__ASM_UNISTD_H) || defined(__SYSCALL)
17#define __ASM_UNISTD_H
18 16
19#ifndef __SYSCALL_COMPAT 17#ifndef __SYSCALL_COMPAT
20#include <asm-generic/unistd.h> 18#include <asm-generic/unistd.h>
21#endif 19#endif
22 20
23#if defined(__KERNEL__) && defined(CONFIG_COMPAT) 21#ifdef __KERNEL__
22#ifdef CONFIG_COMPAT
24#include <asm/unistd32.h> 23#include <asm/unistd32.h>
25#endif 24#endif
26 25#endif
27#endif /* __ASM_UNISTD_H */
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index a50405f5ee42..3ba1f1a90629 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -16,8 +16,6 @@
16 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19#if !defined(__ASM_UNISTD32_H) || defined(__SYSCALL)
20#define __ASM_UNISTD32_H
21 19
22#ifndef __SYSCALL 20#ifndef __SYSCALL
23#define __SYSCALL(x, y) 21#define __SYSCALL(x, y)
@@ -754,5 +752,3 @@ __SYSCALL(__NR_syncfs, sys_syncfs)
754#define __ARCH_WANT_SYS_SIGPENDING 752#define __ARCH_WANT_SYS_SIGPENDING
755#define __ARCH_WANT_SYS_SIGPROCMASK 753#define __ARCH_WANT_SYS_SIGPROCMASK
756#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 754#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
757
758#endif /* __ASM_UNISTD32_H */
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index ac74c2f261e3..0790a87a4346 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -30,59 +30,6 @@
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <asm/unistd.h> 31#include <asm/unistd.h>
32 32
33typedef struct compat_siginfo {
34 int si_signo;
35 int si_errno;
36 int si_code;
37
38 union {
39 /* The padding is the same size as AArch64. */
40 int _pad[SI_PAD_SIZE];
41
42 /* kill() */
43 struct {
44 compat_pid_t _pid; /* sender's pid */
45 __compat_uid32_t _uid; /* sender's uid */
46 } _kill;
47
48 /* POSIX.1b timers */
49 struct {
50 compat_timer_t _tid; /* timer id */
51 int _overrun; /* overrun count */
52 compat_sigval_t _sigval; /* same as below */
53 int _sys_private; /* not to be passed to user */
54 } _timer;
55
56 /* POSIX.1b signals */
57 struct {
58 compat_pid_t _pid; /* sender's pid */
59 __compat_uid32_t _uid; /* sender's uid */
60 compat_sigval_t _sigval;
61 } _rt;
62
63 /* SIGCHLD */
64 struct {
65 compat_pid_t _pid; /* which child */
66 __compat_uid32_t _uid; /* sender's uid */
67 int _status; /* exit code */
68 compat_clock_t _utime;
69 compat_clock_t _stime;
70 } _sigchld;
71
72 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
73 struct {
74 compat_uptr_t _addr; /* faulting insn/memory ref. */
75 short _addr_lsb; /* LSB of the reported address */
76 } _sigfault;
77
78 /* SIGPOLL */
79 struct {
80 compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */
81 int _fd;
82 } _sigpoll;
83 } _sifields;
84} compat_siginfo_t;
85
86struct compat_sigaction { 33struct compat_sigaction {
87 compat_uptr_t sa_handler; 34 compat_uptr_t sa_handler;
88 compat_ulong_t sa_flags; 35 compat_ulong_t sa_flags;
diff --git a/arch/avr32/include/asm/elf.h b/arch/avr32/include/asm/elf.h
index 3b3159b710d4..e2c328739808 100644
--- a/arch/avr32/include/asm/elf.h
+++ b/arch/avr32/include/asm/elf.h
@@ -102,6 +102,7 @@ typedef struct user_fpu_struct elf_fpregset_t;
102 102
103#define ELF_PLATFORM (NULL) 103#define ELF_PLATFORM (NULL)
104 104
105#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT) 105#define SET_PERSONALITY(ex) \
106 set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK)))
106 107
107#endif /* __ASM_AVR32_ELF_H */ 108#endif /* __ASM_AVR32_ELF_H */
diff --git a/arch/blackfin/include/asm/elf.h b/arch/blackfin/include/asm/elf.h
index e6c6812a9abd..14bc98ff668f 100644
--- a/arch/blackfin/include/asm/elf.h
+++ b/arch/blackfin/include/asm/elf.h
@@ -132,6 +132,7 @@ do { \
132 132
133#define ELF_PLATFORM (NULL) 133#define ELF_PLATFORM (NULL)
134 134
135#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 135#define SET_PERSONALITY(ex) \
136 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
136 137
137#endif 138#endif
diff --git a/arch/c6x/Makefile b/arch/c6x/Makefile
index 1d08dd070277..a9eb9597e03c 100644
--- a/arch/c6x/Makefile
+++ b/arch/c6x/Makefile
@@ -6,6 +6,8 @@
6# for more details. 6# for more details.
7# 7#
8 8
9KBUILD_DEFCONFIG := dsk6455_defconfig
10
9cflags-y += -mno-dsbt -msdata=none 11cflags-y += -mno-dsbt -msdata=none
10 12
11cflags-$(CONFIG_C6X_BIG_KERNEL) += -mlong-calls 13cflags-$(CONFIG_C6X_BIG_KERNEL) += -mlong-calls
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index f08e89183cda..277f1a4ecb09 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -40,6 +40,7 @@ generic-y += sembuf.h
40generic-y += shmbuf.h 40generic-y += shmbuf.h
41generic-y += shmparam.h 41generic-y += shmparam.h
42generic-y += siginfo.h 42generic-y += siginfo.h
43generic-y += signal.h
43generic-y += socket.h 44generic-y += socket.h
44generic-y += sockios.h 45generic-y += sockios.h
45generic-y += stat.h 46generic-y += stat.h
diff --git a/arch/c6x/include/asm/elf.h b/arch/c6x/include/asm/elf.h
index f4552db20b4a..32b997126adf 100644
--- a/arch/c6x/include/asm/elf.h
+++ b/arch/c6x/include/asm/elf.h
@@ -77,7 +77,8 @@ do { \
77 77
78#define ELF_PLATFORM (NULL) 78#define ELF_PLATFORM (NULL)
79 79
80#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 80#define SET_PERSONALITY(ex) \
81 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
81 82
82/* C6X specific section types */ 83/* C6X specific section types */
83#define SHT_C6000_UNWIND 0x70000001 84#define SHT_C6000_UNWIND 0x70000001
diff --git a/arch/c6x/include/asm/signal.h b/arch/c6x/include/asm/signal.h
deleted file mode 100644
index f1cd870596a3..000000000000
--- a/arch/c6x/include/asm/signal.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _ASM_C6X_SIGNAL_H
2#define _ASM_C6X_SIGNAL_H
3
4#include <asm-generic/signal.h>
5
6#ifndef __ASSEMBLY__
7#include <linux/linkage.h>
8
9struct pt_regs;
10
11extern asmlinkage int do_rt_sigreturn(struct pt_regs *regs);
12extern asmlinkage void do_notify_resume(struct pt_regs *regs,
13 u32 thread_info_flags,
14 int syscall);
15#endif
16
17#endif /* _ASM_C6X_SIGNAL_H */
diff --git a/arch/c6x/include/asm/unistd.h b/arch/c6x/include/asm/unistd.h
index 6d54ea4262eb..ed2259043eec 100644
--- a/arch/c6x/include/asm/unistd.h
+++ b/arch/c6x/include/asm/unistd.h
@@ -13,8 +13,6 @@
13 * NON INFRINGEMENT. See the GNU General Public License for 13 * NON INFRINGEMENT. See the GNU General Public License for
14 * more details. 14 * more details.
15 */ 15 */
16#if !defined(_ASM_C6X_UNISTD_H) || defined(__SYSCALL)
17#define _ASM_C6X_UNISTD_H
18 16
19/* Use the standard ABI for syscalls. */ 17/* Use the standard ABI for syscalls. */
20#include <asm-generic/unistd.h> 18#include <asm-generic/unistd.h>
@@ -22,5 +20,3 @@
22/* C6X-specific syscalls. */ 20/* C6X-specific syscalls. */
23#define __NR_cache_sync (__NR_arch_specific_syscall + 0) 21#define __NR_cache_sync (__NR_arch_specific_syscall + 0)
24__SYSCALL(__NR_cache_sync, sys_cache_sync) 22__SYSCALL(__NR_cache_sync, sys_cache_sync)
25
26#endif /* _ASM_C6X_UNISTD_H */
diff --git a/arch/cris/include/asm/elf.h b/arch/cris/include/asm/elf.h
index 8a3d8e2b33c1..8182f2dc89d0 100644
--- a/arch/cris/include/asm/elf.h
+++ b/arch/cris/include/asm/elf.h
@@ -86,6 +86,7 @@ typedef unsigned long elf_fpregset_t;
86 86
87#define ELF_PLATFORM (NULL) 87#define ELF_PLATFORM (NULL)
88 88
89#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 89#define SET_PERSONALITY(ex) \
90 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
90 91
91#endif 92#endif
diff --git a/arch/frv/include/asm/elf.h b/arch/frv/include/asm/elf.h
index c3819804a74b..9ccbc80f0b11 100644
--- a/arch/frv/include/asm/elf.h
+++ b/arch/frv/include/asm/elf.h
@@ -137,6 +137,7 @@ do { \
137 137
138#define ELF_PLATFORM (NULL) 138#define ELF_PLATFORM (NULL)
139 139
140#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 140#define SET_PERSONALITY(ex) \
141 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
141 142
142#endif 143#endif
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index 5fa3889d858b..0b579927439d 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -153,23 +153,22 @@ static int user_atoi(char __user *ubuf, size_t len)
153static int sysctl_pm_do_suspend(ctl_table *ctl, int write, 153static int sysctl_pm_do_suspend(ctl_table *ctl, int write,
154 void __user *buffer, size_t *lenp, loff_t *fpos) 154 void __user *buffer, size_t *lenp, loff_t *fpos)
155{ 155{
156 int retval, mode; 156 int mode;
157 157
158 if (*lenp <= 0) 158 if (*lenp <= 0)
159 return -EIO; 159 return -EIO;
160 160
161 mode = user_atoi(buffer, *lenp); 161 mode = user_atoi(buffer, *lenp);
162 if ((mode != 1) && (mode != 5)) 162 switch (mode) {
163 return -EINVAL; 163 case 1:
164 return pm_do_suspend();
164 165
165 if (retval == 0) { 166 case 5:
166 if (mode == 5) 167 return pm_do_bus_sleep();
167 retval = pm_do_bus_sleep();
168 else
169 retval = pm_do_suspend();
170 }
171 168
172 return retval; 169 default:
170 return -EINVAL;
171 }
173} 172}
174 173
175static int try_set_cmode(int new_cmode) 174static int try_set_cmode(int new_cmode)
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index 75cf7f4b2fa8..1f1e5efb3385 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -184,7 +184,7 @@ static struct clock_cmode __pminitdata clock_cmodes_fr555[16] = {
184 [6] = { _x1, _x1_5, _x1_5, _x4_5, _x0_375 }, 184 [6] = { _x1, _x1_5, _x1_5, _x4_5, _x0_375 },
185}; 185};
186 186
187static const struct clock_cmode __pminitdata *clock_cmodes; 187static const struct clock_cmode __pminitconst *clock_cmodes;
188static int __pminitdata clock_doubled; 188static int __pminitdata clock_doubled;
189 189
190static struct uart_port __pminitdata __frv_uart0 = { 190static struct uart_port __pminitdata __frv_uart0 = {
diff --git a/arch/frv/mb93090-mb00/pci-irq.c b/arch/frv/mb93090-mb00/pci-irq.c
index 20f6497b2cd5..c677b9d81d30 100644
--- a/arch/frv/mb93090-mb00/pci-irq.c
+++ b/arch/frv/mb93090-mb00/pci-irq.c
@@ -28,7 +28,7 @@
28 * 28 *
29 */ 29 */
30 30
31static const uint8_t __initdata pci_bus0_irq_routing[32][4] = { 31static const uint8_t __initconst pci_bus0_irq_routing[32][4] = {
32 [0 ] = { IRQ_FPGA_MB86943_PCI_INTA }, 32 [0 ] = { IRQ_FPGA_MB86943_PCI_INTA },
33 [16] = { IRQ_FPGA_RTL8029_INTA }, 33 [16] = { IRQ_FPGA_RTL8029_INTA },
34 [17] = { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB }, 34 [17] = { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB },
diff --git a/arch/h8300/include/asm/elf.h b/arch/h8300/include/asm/elf.h
index c24fa250d653..41193c396bff 100644
--- a/arch/h8300/include/asm/elf.h
+++ b/arch/h8300/include/asm/elf.h
@@ -54,7 +54,8 @@ typedef unsigned long elf_fpregset_t;
54 54
55#define ELF_PLATFORM (NULL) 55#define ELF_PLATFORM (NULL)
56 56
57#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 57#define SET_PERSONALITY(ex) \
58 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
58 59
59#define R_H8_NONE 0 60#define R_H8_NONE 0
60#define R_H8_DIR32 1 61#define R_H8_DIR32 1
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index aaf5e5a48f93..4bdc7311784e 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -51,6 +51,7 @@ asmlinkage void syscall_print(void *dummy,...)
51 * Do a system call from kernel instead of calling sys_execve so we 51 * Do a system call from kernel instead of calling sys_execve so we
52 * end up with proper pt_regs. 52 * end up with proper pt_regs.
53 */ 53 */
54asmlinkage
54int kernel_execve(const char *filename, 55int kernel_execve(const char *filename,
55 const char *const argv[], 56 const char *const argv[],
56 const char *const envp[]) 57 const char *const envp[])
diff --git a/arch/h8300/kernel/timer/itu.c b/arch/h8300/kernel/timer/itu.c
index a2ae5e952137..0a8b5cd5bf38 100644
--- a/arch/h8300/kernel/timer/itu.c
+++ b/arch/h8300/kernel/timer/itu.c
@@ -62,7 +62,7 @@ static struct irqaction itu_irq = {
62 .flags = IRQF_DISABLED | IRQF_TIMER, 62 .flags = IRQF_DISABLED | IRQF_TIMER,
63}; 63};
64 64
65static const int __initdata divide_rate[] = {1, 2, 4, 8}; 65static const int __initconst divide_rate[] = {1, 2, 4, 8};
66 66
67void __init h8300_timer_setup(void) 67void __init h8300_timer_setup(void)
68{ 68{
diff --git a/arch/h8300/kernel/timer/timer16.c b/arch/h8300/kernel/timer/timer16.c
index ae0d38161139..462d9f581719 100644
--- a/arch/h8300/kernel/timer/timer16.c
+++ b/arch/h8300/kernel/timer/timer16.c
@@ -57,7 +57,7 @@ static struct irqaction timer16_irq = {
57 .flags = IRQF_DISABLED | IRQF_TIMER, 57 .flags = IRQF_DISABLED | IRQF_TIMER,
58}; 58};
59 59
60static const int __initdata divide_rate[] = {1, 2, 4, 8}; 60static const int __initconst divide_rate[] = {1, 2, 4, 8};
61 61
62void __init h8300_timer_setup(void) 62void __init h8300_timer_setup(void)
63{ 63{
diff --git a/arch/h8300/kernel/timer/timer8.c b/arch/h8300/kernel/timer/timer8.c
index 7a1533fad47d..505f3415b40f 100644
--- a/arch/h8300/kernel/timer/timer8.c
+++ b/arch/h8300/kernel/timer/timer8.c
@@ -77,7 +77,7 @@ static struct irqaction timer8_irq = {
77 .flags = IRQF_DISABLED | IRQF_TIMER, 77 .flags = IRQF_DISABLED | IRQF_TIMER,
78}; 78};
79 79
80static const int __initdata divide_rate[] = {8, 64, 8192}; 80static const int __initconst divide_rate[] = {8, 64, 8192};
81 81
82void __init h8300_timer_setup(void) 82void __init h8300_timer_setup(void)
83{ 83{
diff --git a/arch/h8300/kernel/timer/tpu.c b/arch/h8300/kernel/timer/tpu.c
index 2193a2e2859a..0350f6204ecf 100644
--- a/arch/h8300/kernel/timer/tpu.c
+++ b/arch/h8300/kernel/timer/tpu.c
@@ -66,7 +66,7 @@ static struct irqaction tpu_irq = {
66 .flags = IRQF_DISABLED | IRQF_TIMER, 66 .flags = IRQF_DISABLED | IRQF_TIMER,
67}; 67};
68 68
69static const int __initdata divide_rate[] = { 69static const int __initconst divide_rate[] = {
70#if CONFIG_H8300_TPU_CH == 0 70#if CONFIG_H8300_TPU_CH == 0
71 1,4,16,64,0,0,0,0, 71 1,4,16,64,0,0,0,0,
72#elif (CONFIG_H8300_TPU_CH == 1) || (CONFIG_H8300_TPU_CH == 5) 72#elif (CONFIG_H8300_TPU_CH == 1) || (CONFIG_H8300_TPU_CH == 5)
diff --git a/arch/h8300/platform/h8300h/irq.c b/arch/h8300/platform/h8300h/irq.c
index bc4f51bceef5..0a50353e09d5 100644
--- a/arch/h8300/platform/h8300h/irq.c
+++ b/arch/h8300/platform/h8300h/irq.c
@@ -14,14 +14,14 @@
14#include <asm/gpio-internal.h> 14#include <asm/gpio-internal.h>
15#include <asm/regs306x.h> 15#include <asm/regs306x.h>
16 16
17const int __initdata h8300_saved_vectors[] = { 17const int __initconst h8300_saved_vectors[] = {
18#if defined(CONFIG_GDB_DEBUG) 18#if defined(CONFIG_GDB_DEBUG)
19 TRAP3_VEC, /* TRAPA #3 is GDB breakpoint */ 19 TRAP3_VEC, /* TRAPA #3 is GDB breakpoint */
20#endif 20#endif
21 -1, 21 -1,
22}; 22};
23 23
24const h8300_vector __initdata h8300_trap_table[] = { 24const h8300_vector __initconst h8300_trap_table[] = {
25 0, 0, 0, 0, 0, 0, 0, 0, 25 0, 0, 0, 0, 0, 0, 0, 0,
26 system_call, 26 system_call,
27 0, 27 0,
diff --git a/arch/h8300/platform/h8s/irq.c b/arch/h8300/platform/h8s/irq.c
index 7b5f29febc07..f3a5511c16b1 100644
--- a/arch/h8300/platform/h8s/irq.c
+++ b/arch/h8300/platform/h8s/irq.c
@@ -18,7 +18,7 @@
18#include <asm/regs267x.h> 18#include <asm/regs267x.h>
19 19
20/* saved vector list */ 20/* saved vector list */
21const int __initdata h8300_saved_vectors[]={ 21const int __initconst h8300_saved_vectors[] = {
22#if defined(CONFIG_GDB_DEBUG) 22#if defined(CONFIG_GDB_DEBUG)
23 TRACE_VEC, 23 TRACE_VEC,
24 TRAP3_VEC, 24 TRAP3_VEC,
@@ -27,7 +27,7 @@ const int __initdata h8300_saved_vectors[]={
27}; 27};
28 28
29/* trap entry table */ 29/* trap entry table */
30const H8300_VECTOR __initdata h8300_trap_table[] = { 30const H8300_VECTOR __initconst h8300_trap_table[] = {
31 0,0,0,0,0, 31 0,0,0,0,0,
32 trace_break, /* TRACE */ 32 trace_break, /* TRACE */
33 0,0, 33 0,0,
diff --git a/arch/hexagon/include/asm/elf.h b/arch/hexagon/include/asm/elf.h
index 37976a0d3650..82b499621e05 100644
--- a/arch/hexagon/include/asm/elf.h
+++ b/arch/hexagon/include/asm/elf.h
@@ -217,7 +217,8 @@ do { \
217#define ELF_PLATFORM (NULL) 217#define ELF_PLATFORM (NULL)
218 218
219#ifdef __KERNEL__ 219#ifdef __KERNEL__
220#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 220#define SET_PERSONALITY(ex) \
221 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
221#endif 222#endif
222 223
223#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 224#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
diff --git a/arch/hexagon/include/asm/unistd.h b/arch/hexagon/include/asm/unistd.h
index 4d0ecde3665f..c0d5565030ae 100644
--- a/arch/hexagon/include/asm/unistd.h
+++ b/arch/hexagon/include/asm/unistd.h
@@ -18,9 +18,6 @@
18 * 02110-1301, USA. 18 * 02110-1301, USA.
19 */ 19 */
20 20
21#if !defined(_ASM_HEXAGON_UNISTD_H) || defined(__SYSCALL)
22#define _ASM_HEXAGON_UNISTD_H
23
24/* 21/*
25 * The kernel pulls this unistd.h in three different ways: 22 * The kernel pulls this unistd.h in three different ways:
26 * 1. the "normal" way which gets all the __NR defines 23 * 1. the "normal" way which gets all the __NR defines
@@ -32,5 +29,3 @@
32#define sys_mmap2 sys_mmap_pgoff 29#define sys_mmap2 sys_mmap_pgoff
33 30
34#include <asm-generic/unistd.h> 31#include <asm-generic/unistd.h>
35
36#endif
diff --git a/arch/ia64/include/asm/xen/interface.h b/arch/ia64/include/asm/xen/interface.h
index 3d52a5bbd857..e88c5de27410 100644
--- a/arch/ia64/include/asm/xen/interface.h
+++ b/arch/ia64/include/asm/xen/interface.h
@@ -71,6 +71,7 @@
71 * with Xen so that we could have one ABI that works for 32 and 64 bit 71 * with Xen so that we could have one ABI that works for 32 and 64 bit
72 * guests. */ 72 * guests. */
73typedef unsigned long xen_pfn_t; 73typedef unsigned long xen_pfn_t;
74typedef unsigned long xen_ulong_t;
74/* Guest handles for primitive C types. */ 75/* Guest handles for primitive C types. */
75__DEFINE_GUEST_HANDLE(uchar, unsigned char); 76__DEFINE_GUEST_HANDLE(uchar, unsigned char);
76__DEFINE_GUEST_HANDLE(uint, unsigned int); 77__DEFINE_GUEST_HANDLE(uint, unsigned int);
diff --git a/arch/ia64/xen/irq_xen.c b/arch/ia64/xen/irq_xen.c
index 3bb12230721f..01f479ee1c43 100644
--- a/arch/ia64/xen/irq_xen.c
+++ b/arch/ia64/xen/irq_xen.c
@@ -433,7 +433,7 @@ xen_resend_irq(unsigned int vector)
433 (void)resend_irq_on_evtchn(vector); 433 (void)resend_irq_on_evtchn(vector);
434} 434}
435 435
436const struct pv_irq_ops xen_irq_ops __initdata = { 436const struct pv_irq_ops xen_irq_ops __initconst = {
437 .register_ipi = xen_register_ipi, 437 .register_ipi = xen_register_ipi,
438 438
439 .assign_irq_vector = xen_assign_irq_vector, 439 .assign_irq_vector = xen_assign_irq_vector,
diff --git a/arch/ia64/xen/irq_xen.h b/arch/ia64/xen/irq_xen.h
index 26110f330c87..1778517b90fe 100644
--- a/arch/ia64/xen/irq_xen.h
+++ b/arch/ia64/xen/irq_xen.h
@@ -27,7 +27,7 @@ extern void (*late_time_init)(void);
27extern char xen_event_callback; 27extern char xen_event_callback;
28void __init xen_init_IRQ(void); 28void __init xen_init_IRQ(void);
29 29
30extern const struct pv_irq_ops xen_irq_ops __initdata; 30extern const struct pv_irq_ops xen_irq_ops __initconst;
31extern void xen_smp_intr_init(void); 31extern void xen_smp_intr_init(void);
32extern void xen_send_ipi(int cpu, int vec); 32extern void xen_send_ipi(int cpu, int vec);
33 33
diff --git a/arch/m32r/include/asm/elf.h b/arch/m32r/include/asm/elf.h
index b8da7d0574d2..70896161c636 100644
--- a/arch/m32r/include/asm/elf.h
+++ b/arch/m32r/include/asm/elf.h
@@ -128,6 +128,7 @@ typedef elf_fpreg_t elf_fpregset_t;
128 intent than poking at uname or /proc/cpuinfo. */ 128 intent than poking at uname or /proc/cpuinfo. */
129#define ELF_PLATFORM (NULL) 129#define ELF_PLATFORM (NULL)
130 130
131#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 131#define SET_PERSONALITY(ex) \
132 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
132 133
133#endif /* _ASM_M32R__ELF_H */ 134#endif /* _ASM_M32R__ELF_H */
diff --git a/arch/m68k/include/asm/cacheflush_no.h b/arch/m68k/include/asm/cacheflush_no.h
index 7cafb537d03c..d2b3935ae147 100644
--- a/arch/m68k/include/asm/cacheflush_no.h
+++ b/arch/m68k/include/asm/cacheflush_no.h
@@ -34,10 +34,9 @@ static inline void __clear_cache_all(void)
34{ 34{
35#ifdef CACHE_INVALIDATE 35#ifdef CACHE_INVALIDATE
36 __asm__ __volatile__ ( 36 __asm__ __volatile__ (
37 "movel %0, %%d0\n\t" 37 "movec %0, %%CACR\n\t"
38 "movec %%d0, %%CACR\n\t"
39 "nop\n\t" 38 "nop\n\t"
40 : : "i" (CACHE_INVALIDATE) : "d0" ); 39 : : "r" (CACHE_INVALIDATE) );
41#endif 40#endif
42} 41}
43 42
@@ -58,10 +57,9 @@ static inline void __flush_icache_all(void)
58{ 57{
59#ifdef CACHE_INVALIDATEI 58#ifdef CACHE_INVALIDATEI
60 __asm__ __volatile__ ( 59 __asm__ __volatile__ (
61 "movel %0, %%d0\n\t" 60 "movec %0, %%CACR\n\t"
62 "movec %%d0, %%CACR\n\t"
63 "nop\n\t" 61 "nop\n\t"
64 : : "i" (CACHE_INVALIDATEI) : "d0" ); 62 : : "r" (CACHE_INVALIDATEI) );
65#endif 63#endif
66} 64}
67 65
@@ -72,19 +70,18 @@ static inline void __flush_dcache_all(void)
72#endif 70#endif
73#ifdef CACHE_INVALIDATED 71#ifdef CACHE_INVALIDATED
74 __asm__ __volatile__ ( 72 __asm__ __volatile__ (
75 "movel %0, %%d0\n\t" 73 "movec %0, %%CACR\n\t"
76 "movec %%d0, %%CACR\n\t"
77 "nop\n\t" 74 "nop\n\t"
78 : : "i" (CACHE_INVALIDATED) : "d0" ); 75 : : "r" (CACHE_INVALIDATED) );
79#else 76#else
80 /* Flush the wrtite buffer */ 77 /* Flush the write buffer */
81 __asm__ __volatile__ ( "nop" ); 78 __asm__ __volatile__ ( "nop" );
82#endif 79#endif
83} 80}
84 81
85/* 82/*
86 * Push cache entries at supplied address. We want to write back any dirty 83 * Push cache entries at supplied address. We want to write back any dirty
87 * data and the invalidate the cache lines associated with this address. 84 * data and then invalidate the cache lines associated with this address.
88 */ 85 */
89static inline void cache_push(unsigned long paddr, int len) 86static inline void cache_push(unsigned long paddr, int len)
90{ 87{
diff --git a/arch/m68k/include/asm/elf.h b/arch/m68k/include/asm/elf.h
index e9b7cda59744..f83c1d0a87cf 100644
--- a/arch/m68k/include/asm/elf.h
+++ b/arch/m68k/include/asm/elf.h
@@ -113,6 +113,7 @@ typedef struct user_m68kfp_struct elf_fpregset_t;
113 113
114#define ELF_PLATFORM (NULL) 114#define ELF_PLATFORM (NULL)
115 115
116#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 116#define SET_PERSONALITY(ex) \
117 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
117 118
118#endif 119#endif
diff --git a/arch/m68k/include/asm/m5206sim.h b/arch/m68k/include/asm/m5206sim.h
index 69722366b084..4cf864f5ea7a 100644
--- a/arch/m68k/include/asm/m5206sim.h
+++ b/arch/m68k/include/asm/m5206sim.h
@@ -21,33 +21,33 @@
21/* 21/*
22 * Define the 5206 SIM register set addresses. 22 * Define the 5206 SIM register set addresses.
23 */ 23 */
24#define MCFSIM_SIMR 0x03 /* SIM Config reg (r/w) */ 24#define MCFSIM_SIMR (MCF_MBAR + 0x03) /* SIM Config reg */
25#define MCFSIM_ICR1 0x14 /* Intr Ctrl reg 1 (r/w) */ 25#define MCFSIM_ICR1 (MCF_MBAR + 0x14) /* Intr Ctrl reg 1 */
26#define MCFSIM_ICR2 0x15 /* Intr Ctrl reg 2 (r/w) */ 26#define MCFSIM_ICR2 (MCF_MBAR + 0x15) /* Intr Ctrl reg 2 */
27#define MCFSIM_ICR3 0x16 /* Intr Ctrl reg 3 (r/w) */ 27#define MCFSIM_ICR3 (MCF_MBAR + 0x16) /* Intr Ctrl reg 3 */
28#define MCFSIM_ICR4 0x17 /* Intr Ctrl reg 4 (r/w) */ 28#define MCFSIM_ICR4 (MCF_MBAR + 0x17) /* Intr Ctrl reg 4 */
29#define MCFSIM_ICR5 0x18 /* Intr Ctrl reg 5 (r/w) */ 29#define MCFSIM_ICR5 (MCF_MBAR + 0x18) /* Intr Ctrl reg 5 */
30#define MCFSIM_ICR6 0x19 /* Intr Ctrl reg 6 (r/w) */ 30#define MCFSIM_ICR6 (MCF_MBAR + 0x19) /* Intr Ctrl reg 6 */
31#define MCFSIM_ICR7 0x1a /* Intr Ctrl reg 7 (r/w) */ 31#define MCFSIM_ICR7 (MCF_MBAR + 0x1a) /* Intr Ctrl reg 7 */
32#define MCFSIM_ICR8 0x1b /* Intr Ctrl reg 8 (r/w) */ 32#define MCFSIM_ICR8 (MCF_MBAR + 0x1b) /* Intr Ctrl reg 8 */
33#define MCFSIM_ICR9 0x1c /* Intr Ctrl reg 9 (r/w) */ 33#define MCFSIM_ICR9 (MCF_MBAR + 0x1c) /* Intr Ctrl reg 9 */
34#define MCFSIM_ICR10 0x1d /* Intr Ctrl reg 10 (r/w) */ 34#define MCFSIM_ICR10 (MCF_MBAR + 0x1d) /* Intr Ctrl reg 10 */
35#define MCFSIM_ICR11 0x1e /* Intr Ctrl reg 11 (r/w) */ 35#define MCFSIM_ICR11 (MCF_MBAR + 0x1e) /* Intr Ctrl reg 11 */
36#define MCFSIM_ICR12 0x1f /* Intr Ctrl reg 12 (r/w) */ 36#define MCFSIM_ICR12 (MCF_MBAR + 0x1f) /* Intr Ctrl reg 12 */
37#define MCFSIM_ICR13 0x20 /* Intr Ctrl reg 13 (r/w) */ 37#define MCFSIM_ICR13 (MCF_MBAR + 0x20) /* Intr Ctrl reg 13 */
38#ifdef CONFIG_M5206e 38#ifdef CONFIG_M5206e
39#define MCFSIM_ICR14 0x21 /* Intr Ctrl reg 14 (r/w) */ 39#define MCFSIM_ICR14 (MCF_MBAR + 0x21) /* Intr Ctrl reg 14 */
40#define MCFSIM_ICR15 0x22 /* Intr Ctrl reg 15 (r/w) */ 40#define MCFSIM_ICR15 (MCF_MBAR + 0x22) /* Intr Ctrl reg 15 */
41#endif 41#endif
42 42
43#define MCFSIM_IMR 0x36 /* Interrupt Mask reg (r/w) */ 43#define MCFSIM_IMR (MCF_MBAR + 0x36) /* Interrupt Mask */
44#define MCFSIM_IPR 0x3a /* Interrupt Pend reg (r/w) */ 44#define MCFSIM_IPR (MCF_MBAR + 0x3a) /* Interrupt Pending */
45 45
46#define MCFSIM_RSR 0x40 /* Reset Status reg (r/w) */ 46#define MCFSIM_RSR (MCF_MBAR + 0x40) /* Reset Status */
47#define MCFSIM_SYPCR 0x41 /* System Protection reg (r/w)*/ 47#define MCFSIM_SYPCR (MCF_MBAR + 0x41) /* System Protection */
48 48
49#define MCFSIM_SWIVR 0x42 /* SW Watchdog intr reg (r/w) */ 49#define MCFSIM_SWIVR (MCF_MBAR + 0x42) /* SW Watchdog intr */
50#define MCFSIM_SWSR 0x43 /* SW Watchdog service (r/w) */ 50#define MCFSIM_SWSR (MCF_MBAR + 0x43) /* SW Watchdog srv */
51 51
52#define MCFSIM_DCRR (MCF_MBAR + 0x46) /* DRAM Refresh reg (r/w) */ 52#define MCFSIM_DCRR (MCF_MBAR + 0x46) /* DRAM Refresh reg (r/w) */
53#define MCFSIM_DCTR (MCF_MBAR + 0x4a) /* DRAM Timing reg (r/w) */ 53#define MCFSIM_DCTR (MCF_MBAR + 0x4a) /* DRAM Timing reg (r/w) */
@@ -58,36 +58,36 @@
58#define MCFSIM_DMR1 (MCF_MBAR + 0x5c) /* DRAM 1 Mask reg (r/w) */ 58#define MCFSIM_DMR1 (MCF_MBAR + 0x5c) /* DRAM 1 Mask reg (r/w) */
59#define MCFSIM_DCR1 (MCF_MBAR + 0x63) /* DRAM 1 Control reg (r/w) */ 59#define MCFSIM_DCR1 (MCF_MBAR + 0x63) /* DRAM 1 Control reg (r/w) */
60 60
61#define MCFSIM_CSAR0 0x64 /* CS 0 Address 0 reg (r/w) */ 61#define MCFSIM_CSAR0 (MCF_MBAR + 0x64) /* CS 0 Address reg */
62#define MCFSIM_CSMR0 0x68 /* CS 0 Mask 0 reg (r/w) */ 62#define MCFSIM_CSMR0 (MCF_MBAR + 0x68) /* CS 0 Mask reg */
63#define MCFSIM_CSCR0 0x6e /* CS 0 Control reg (r/w) */ 63#define MCFSIM_CSCR0 (MCF_MBAR + 0x6e) /* CS 0 Control reg */
64#define MCFSIM_CSAR1 0x70 /* CS 1 Address reg (r/w) */ 64#define MCFSIM_CSAR1 (MCF_MBAR + 0x70) /* CS 1 Address reg */
65#define MCFSIM_CSMR1 0x74 /* CS 1 Mask reg (r/w) */ 65#define MCFSIM_CSMR1 (MCF_MBAR + 0x74) /* CS 1 Mask reg */
66#define MCFSIM_CSCR1 0x7a /* CS 1 Control reg (r/w) */ 66#define MCFSIM_CSCR1 (MCF_MBAR + 0x7a) /* CS 1 Control reg */
67#define MCFSIM_CSAR2 0x7c /* CS 2 Address reg (r/w) */ 67#define MCFSIM_CSAR2 (MCF_MBAR + 0x7c) /* CS 2 Address reg */
68#define MCFSIM_CSMR2 0x80 /* CS 2 Mask reg (r/w) */ 68#define MCFSIM_CSMR2 (MCF_MBAR + 0x80) /* CS 2 Mask reg */
69#define MCFSIM_CSCR2 0x86 /* CS 2 Control reg (r/w) */ 69#define MCFSIM_CSCR2 (MCF_MBAR + 0x86) /* CS 2 Control reg */
70#define MCFSIM_CSAR3 0x88 /* CS 3 Address reg (r/w) */ 70#define MCFSIM_CSAR3 (MCF_MBAR + 0x88) /* CS 3 Address reg */
71#define MCFSIM_CSMR3 0x8c /* CS 3 Mask reg (r/w) */ 71#define MCFSIM_CSMR3 (MCF_MBAR + 0x8c) /* CS 3 Mask reg */
72#define MCFSIM_CSCR3 0x92 /* CS 3 Control reg (r/w) */ 72#define MCFSIM_CSCR3 (MCF_MBAR + 0x92) /* CS 3 Control reg */
73#define MCFSIM_CSAR4 0x94 /* CS 4 Address reg (r/w) */ 73#define MCFSIM_CSAR4 (MCF_MBAR + 0x94) /* CS 4 Address reg */
74#define MCFSIM_CSMR4 0x98 /* CS 4 Mask reg (r/w) */ 74#define MCFSIM_CSMR4 (MCF_MBAR + 0x98) /* CS 4 Mask reg */
75#define MCFSIM_CSCR4 0x9e /* CS 4 Control reg (r/w) */ 75#define MCFSIM_CSCR4 (MCF_MBAR + 0x9e) /* CS 4 Control reg */
76#define MCFSIM_CSAR5 0xa0 /* CS 5 Address reg (r/w) */ 76#define MCFSIM_CSAR5 (MCF_MBAR + 0xa0) /* CS 5 Address reg */
77#define MCFSIM_CSMR5 0xa4 /* CS 5 Mask reg (r/w) */ 77#define MCFSIM_CSMR5 (MCF_MBAR + 0xa4) /* CS 5 Mask reg */
78#define MCFSIM_CSCR5 0xaa /* CS 5 Control reg (r/w) */ 78#define MCFSIM_CSCR5 (MCF_MBAR + 0xaa) /* CS 5 Control reg */
79#define MCFSIM_CSAR6 0xac /* CS 6 Address reg (r/w) */ 79#define MCFSIM_CSAR6 (MCF_MBAR + 0xac) /* CS 6 Address reg */
80#define MCFSIM_CSMR6 0xb0 /* CS 6 Mask reg (r/w) */ 80#define MCFSIM_CSMR6 (MCF_MBAR + 0xb0) /* CS 6 Mask reg */
81#define MCFSIM_CSCR6 0xb6 /* CS 6 Control reg (r/w) */ 81#define MCFSIM_CSCR6 (MCF_MBAR + 0xb6) /* CS 6 Control reg */
82#define MCFSIM_CSAR7 0xb8 /* CS 7 Address reg (r/w) */ 82#define MCFSIM_CSAR7 (MCF_MBAR + 0xb8) /* CS 7 Address reg */
83#define MCFSIM_CSMR7 0xbc /* CS 7 Mask reg (r/w) */ 83#define MCFSIM_CSMR7 (MCF_MBAR + 0xbc) /* CS 7 Mask reg */
84#define MCFSIM_CSCR7 0xc2 /* CS 7 Control reg (r/w) */ 84#define MCFSIM_CSCR7 (MCF_MBAR + 0xc2) /* CS 7 Control reg */
85#define MCFSIM_DMCR 0xc6 /* Default control */ 85#define MCFSIM_DMCR (MCF_MBAR + 0xc6) /* Default control */
86 86
87#ifdef CONFIG_M5206e 87#ifdef CONFIG_M5206e
88#define MCFSIM_PAR 0xca /* Pin Assignment reg (r/w) */ 88#define MCFSIM_PAR (MCF_MBAR + 0xca) /* Pin Assignment */
89#else 89#else
90#define MCFSIM_PAR 0xcb /* Pin Assignment reg (r/w) */ 90#define MCFSIM_PAR (MCF_MBAR + 0xcb) /* Pin Assignment */
91#endif 91#endif
92 92
93#define MCFTIMER_BASE1 (MCF_MBAR + 0x100) /* Base of TIMER1 */ 93#define MCFTIMER_BASE1 (MCF_MBAR + 0x100) /* Base of TIMER1 */
diff --git a/arch/m68k/include/asm/m523xsim.h b/arch/m68k/include/asm/m523xsim.h
index 91d3abc3f2a5..5e06b4eb57f3 100644
--- a/arch/m68k/include/asm/m523xsim.h
+++ b/arch/m68k/include/asm/m523xsim.h
@@ -176,21 +176,29 @@
176/* 176/*
177 * Generic GPIO support 177 * Generic GPIO support
178 */ 178 */
179#define MCFGPIO_PODR MCFGPIO_PODR_ADDR 179#define MCFGPIO_PODR MCFGPIO_PODR_ADDR
180#define MCFGPIO_PDDR MCFGPIO_PDDR_ADDR 180#define MCFGPIO_PDDR MCFGPIO_PDDR_ADDR
181#define MCFGPIO_PPDR MCFGPIO_PPDSDR_ADDR 181#define MCFGPIO_PPDR MCFGPIO_PPDSDR_ADDR
182#define MCFGPIO_SETR MCFGPIO_PPDSDR_ADDR 182#define MCFGPIO_SETR MCFGPIO_PPDSDR_ADDR
183#define MCFGPIO_CLRR MCFGPIO_PCLRR_ADDR 183#define MCFGPIO_CLRR MCFGPIO_PCLRR_ADDR
184 184
185#define MCFGPIO_PIN_MAX 107 185#define MCFGPIO_PIN_MAX 107
186#define MCFGPIO_IRQ_MAX 8 186#define MCFGPIO_IRQ_MAX 8
187#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 187#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
188 188
189/* 189/*
190 * Pin Assignment 190 * Pin Assignment
191*/ 191*/
192#define MCFGPIO_PAR_AD (MCF_IPSBAR + 0x100040)
193#define MCFGPIO_PAR_BUSCTL (MCF_IPSBAR + 0x100042)
194#define MCFGPIO_PAR_BS (MCF_IPSBAR + 0x100044)
195#define MCFGPIO_PAR_CS (MCF_IPSBAR + 0x100045)
196#define MCFGPIO_PAR_SDRAM (MCF_IPSBAR + 0x100046)
197#define MCFGPIO_PAR_FECI2C (MCF_IPSBAR + 0x100047)
198#define MCFGPIO_PAR_UART (MCF_IPSBAR + 0x100048)
192#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10004A) 199#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10004A)
193#define MCFGPIO_PAR_TIMER (MCF_IPSBAR + 0x10004C) 200#define MCFGPIO_PAR_TIMER (MCF_IPSBAR + 0x10004C)
201#define MCFGPIO_PAR_ETPU (MCF_IPSBAR + 0x10004E)
194 202
195/* 203/*
196 * DMA unit base addresses. 204 * DMA unit base addresses.
diff --git a/arch/m68k/include/asm/m5249sim.h b/arch/m68k/include/asm/m5249sim.h
index 7f0c2c3660fd..fdf45e6807c9 100644
--- a/arch/m68k/include/asm/m5249sim.h
+++ b/arch/m68k/include/asm/m5249sim.h
@@ -25,41 +25,41 @@
25/* 25/*
26 * Define the 5249 SIM register set addresses. 26 * Define the 5249 SIM register set addresses.
27 */ 27 */
28#define MCFSIM_RSR 0x00 /* Reset Status reg (r/w) */ 28#define MCFSIM_RSR (MCF_MBAR + 0x00) /* Reset Status */
29#define MCFSIM_SYPCR 0x01 /* System Protection reg (r/w)*/ 29#define MCFSIM_SYPCR (MCF_MBAR + 0x01) /* System Protection */
30#define MCFSIM_SWIVR 0x02 /* SW Watchdog intr reg (r/w) */ 30#define MCFSIM_SWIVR (MCF_MBAR + 0x02) /* SW Watchdog intr */
31#define MCFSIM_SWSR 0x03 /* SW Watchdog service (r/w) */ 31#define MCFSIM_SWSR (MCF_MBAR + 0x03) /* SW Watchdog srv */
32#define MCFSIM_PAR 0x04 /* Pin Assignment reg (r/w) */ 32#define MCFSIM_PAR (MCF_MBAR + 0x04) /* Pin Assignment */
33#define MCFSIM_IRQPAR 0x06 /* Interrupt Assignment reg (r/w) */ 33#define MCFSIM_IRQPAR (MCF_MBAR + 0x06) /* Intr Assignment */
34#define MCFSIM_MPARK 0x0C /* BUS Master Control Reg*/ 34#define MCFSIM_MPARK (MCF_MBAR + 0x0C) /* BUS Master Ctrl */
35#define MCFSIM_IPR 0x40 /* Interrupt Pend reg (r/w) */ 35#define MCFSIM_IPR (MCF_MBAR + 0x40) /* Interrupt Pending */
36#define MCFSIM_IMR 0x44 /* Interrupt Mask reg (r/w) */ 36#define MCFSIM_IMR (MCF_MBAR + 0x44) /* Interrupt Mask */
37#define MCFSIM_AVR 0x4b /* Autovector Ctrl reg (r/w) */ 37#define MCFSIM_AVR (MCF_MBAR + 0x4b) /* Autovector Ctrl */
38#define MCFSIM_ICR0 0x4c /* Intr Ctrl reg 0 (r/w) */ 38#define MCFSIM_ICR0 (MCF_MBAR + 0x4c) /* Intr Ctrl reg 0 */
39#define MCFSIM_ICR1 0x4d /* Intr Ctrl reg 1 (r/w) */ 39#define MCFSIM_ICR1 (MCF_MBAR + 0x4d) /* Intr Ctrl reg 1 */
40#define MCFSIM_ICR2 0x4e /* Intr Ctrl reg 2 (r/w) */ 40#define MCFSIM_ICR2 (MCF_MBAR + 0x4e) /* Intr Ctrl reg 2 */
41#define MCFSIM_ICR3 0x4f /* Intr Ctrl reg 3 (r/w) */ 41#define MCFSIM_ICR3 (MCF_MBAR + 0x4f) /* Intr Ctrl reg 3 */
42#define MCFSIM_ICR4 0x50 /* Intr Ctrl reg 4 (r/w) */ 42#define MCFSIM_ICR4 (MCF_MBAR + 0x50) /* Intr Ctrl reg 4 */
43#define MCFSIM_ICR5 0x51 /* Intr Ctrl reg 5 (r/w) */ 43#define MCFSIM_ICR5 (MCF_MBAR + 0x51) /* Intr Ctrl reg 5 */
44#define MCFSIM_ICR6 0x52 /* Intr Ctrl reg 6 (r/w) */ 44#define MCFSIM_ICR6 (MCF_MBAR + 0x52) /* Intr Ctrl reg 6 */
45#define MCFSIM_ICR7 0x53 /* Intr Ctrl reg 7 (r/w) */ 45#define MCFSIM_ICR7 (MCF_MBAR + 0x53) /* Intr Ctrl reg 7 */
46#define MCFSIM_ICR8 0x54 /* Intr Ctrl reg 8 (r/w) */ 46#define MCFSIM_ICR8 (MCF_MBAR + 0x54) /* Intr Ctrl reg 8 */
47#define MCFSIM_ICR9 0x55 /* Intr Ctrl reg 9 (r/w) */ 47#define MCFSIM_ICR9 (MCF_MBAR + 0x55) /* Intr Ctrl reg 9 */
48#define MCFSIM_ICR10 0x56 /* Intr Ctrl reg 10 (r/w) */ 48#define MCFSIM_ICR10 (MCF_MBAR + 0x56) /* Intr Ctrl reg 10 */
49#define MCFSIM_ICR11 0x57 /* Intr Ctrl reg 11 (r/w) */ 49#define MCFSIM_ICR11 (MCF_MBAR + 0x57) /* Intr Ctrl reg 11 */
50 50
51#define MCFSIM_CSAR0 0x80 /* CS 0 Address 0 reg (r/w) */ 51#define MCFSIM_CSAR0 (MCF_MBAR + 0x80) /* CS 0 Address reg */
52#define MCFSIM_CSMR0 0x84 /* CS 0 Mask 0 reg (r/w) */ 52#define MCFSIM_CSMR0 (MCF_MBAR + 0x84) /* CS 0 Mask reg */
53#define MCFSIM_CSCR0 0x8a /* CS 0 Control reg (r/w) */ 53#define MCFSIM_CSCR0 (MCF_MBAR + 0x8a) /* CS 0 Control reg */
54#define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ 54#define MCFSIM_CSAR1 (MCF_MBAR + 0x8c) /* CS 1 Address reg */
55#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ 55#define MCFSIM_CSMR1 (MCF_MBAR + 0x90) /* CS 1 Mask reg */
56#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ 56#define MCFSIM_CSCR1 (MCF_MBAR + 0x96) /* CS 1 Control reg */
57#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ 57#define MCFSIM_CSAR2 (MCF_MBAR + 0x98) /* CS 2 Address reg */
58#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 58#define MCFSIM_CSMR2 (MCF_MBAR + 0x9c) /* CS 2 Mask reg */
59#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 59#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
60#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ 60#define MCFSIM_CSAR3 (MCF_MBAR + 0xa4) /* CS 3 Address reg */
61#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 61#define MCFSIM_CSMR3 (MCF_MBAR + 0xa8) /* CS 3 Mask reg */
62#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 62#define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
63 63
64#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */ 64#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */
65#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */ 65#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */
@@ -134,23 +134,23 @@
134#define MCFSIM2_GPIO1ENABLE (MCF_MBAR2 + 0x0B8) /* GPIO1 enabled */ 134#define MCFSIM2_GPIO1ENABLE (MCF_MBAR2 + 0x0B8) /* GPIO1 enabled */
135#define MCFSIM2_GPIO1FUNC (MCF_MBAR2 + 0x0BC) /* GPIO1 function */ 135#define MCFSIM2_GPIO1FUNC (MCF_MBAR2 + 0x0BC) /* GPIO1 function */
136 136
137#define MCFSIM2_GPIOINTSTAT 0xc0 /* GPIO interrupt status */ 137#define MCFSIM2_GPIOINTSTAT (MCF_MBAR2 + 0xc0) /* GPIO intr status */
138#define MCFSIM2_GPIOINTCLEAR 0xc0 /* GPIO interrupt clear */ 138#define MCFSIM2_GPIOINTCLEAR (MCF_MBAR2 + 0xc0) /* GPIO intr clear */
139#define MCFSIM2_GPIOINTENABLE 0xc4 /* GPIO interrupt enable */ 139#define MCFSIM2_GPIOINTENABLE (MCF_MBAR2 + 0xc4) /* GPIO intr enable */
140 140
141#define MCFSIM2_INTLEVEL1 0x140 /* Interrupt level reg 1 */ 141#define MCFSIM2_INTLEVEL1 (MCF_MBAR2 + 0x140) /* Intr level reg 1 */
142#define MCFSIM2_INTLEVEL2 0x144 /* Interrupt level reg 2 */ 142#define MCFSIM2_INTLEVEL2 (MCF_MBAR2 + 0x144) /* Intr level reg 2 */
143#define MCFSIM2_INTLEVEL3 0x148 /* Interrupt level reg 3 */ 143#define MCFSIM2_INTLEVEL3 (MCF_MBAR2 + 0x148) /* Intr level reg 3 */
144#define MCFSIM2_INTLEVEL4 0x14c /* Interrupt level reg 4 */ 144#define MCFSIM2_INTLEVEL4 (MCF_MBAR2 + 0x14c) /* Intr level reg 4 */
145#define MCFSIM2_INTLEVEL5 0x150 /* Interrupt level reg 5 */ 145#define MCFSIM2_INTLEVEL5 (MCF_MBAR2 + 0x150) /* Intr level reg 5 */
146#define MCFSIM2_INTLEVEL6 0x154 /* Interrupt level reg 6 */ 146#define MCFSIM2_INTLEVEL6 (MCF_MBAR2 + 0x154) /* Intr level reg 6 */
147#define MCFSIM2_INTLEVEL7 0x158 /* Interrupt level reg 7 */ 147#define MCFSIM2_INTLEVEL7 (MCF_MBAR2 + 0x158) /* Intr level reg 7 */
148#define MCFSIM2_INTLEVEL8 0x15c /* Interrupt level reg 8 */ 148#define MCFSIM2_INTLEVEL8 (MCF_MBAR2 + 0x15c) /* Intr level reg 8 */
149 149
150#define MCFSIM2_DMAROUTE 0x188 /* DMA routing */ 150#define MCFSIM2_DMAROUTE (MCF_MBAR2 + 0x188) /* DMA routing */
151 151
152#define MCFSIM2_IDECONFIG1 0x18c /* IDEconfig1 */ 152#define MCFSIM2_IDECONFIG1 (MCF_MBAR2 + 0x18c) /* IDEconfig1 */
153#define MCFSIM2_IDECONFIG2 0x190 /* IDEconfig2 */ 153#define MCFSIM2_IDECONFIG2 (MCF_MBAR2 + 0x190) /* IDEconfig2 */
154 154
155/* 155/*
156 * Define the base interrupt for the second interrupt controller. 156 * Define the base interrupt for the second interrupt controller.
diff --git a/arch/m68k/include/asm/m525xsim.h b/arch/m68k/include/asm/m525xsim.h
index 6da24f653902..acab61cb91ed 100644
--- a/arch/m68k/include/asm/m525xsim.h
+++ b/arch/m68k/include/asm/m525xsim.h
@@ -26,41 +26,41 @@
26/* 26/*
27 * Define the 525x SIM register set addresses. 27 * Define the 525x SIM register set addresses.
28 */ 28 */
29#define MCFSIM_RSR 0x00 /* Reset Status reg (r/w) */ 29#define MCFSIM_RSR (MCF_MBAR + 0x00) /* Reset Status */
30#define MCFSIM_SYPCR 0x01 /* System Protection reg (r/w)*/ 30#define MCFSIM_SYPCR (MCF_MBAR + 0x01) /* System Protection */
31#define MCFSIM_SWIVR 0x02 /* SW Watchdog intr reg (r/w) */ 31#define MCFSIM_SWIVR (MCF_MBAR + 0x02) /* SW Watchdog intr */
32#define MCFSIM_SWSR 0x03 /* SW Watchdog service (r/w) */ 32#define MCFSIM_SWSR (MCF_MBAR + 0x03) /* SW Watchdog srv */
33#define MCFSIM_MPARK 0x0C /* BUS Master Control Reg*/ 33#define MCFSIM_MPARK (MCF_MBAR + 0x0C) /* BUS Master Ctrl */
34#define MCFSIM_IPR 0x40 /* Interrupt Pend reg (r/w) */ 34#define MCFSIM_IPR (MCF_MBAR + 0x40) /* Interrupt Pending */
35#define MCFSIM_IMR 0x44 /* Interrupt Mask reg (r/w) */ 35#define MCFSIM_IMR (MCF_MBAR + 0x44) /* Interrupt Mask */
36#define MCFSIM_ICR0 0x4c /* Intr Ctrl reg 0 (r/w) */ 36#define MCFSIM_ICR0 (MCF_MBAR + 0x4c) /* Intr Ctrl reg 0 */
37#define MCFSIM_ICR1 0x4d /* Intr Ctrl reg 1 (r/w) */ 37#define MCFSIM_ICR1 (MCF_MBAR + 0x4d) /* Intr Ctrl reg 1 */
38#define MCFSIM_ICR2 0x4e /* Intr Ctrl reg 2 (r/w) */ 38#define MCFSIM_ICR2 (MCF_MBAR + 0x4e) /* Intr Ctrl reg 2 */
39#define MCFSIM_ICR3 0x4f /* Intr Ctrl reg 3 (r/w) */ 39#define MCFSIM_ICR3 (MCF_MBAR + 0x4f) /* Intr Ctrl reg 3 */
40#define MCFSIM_ICR4 0x50 /* Intr Ctrl reg 4 (r/w) */ 40#define MCFSIM_ICR4 (MCF_MBAR + 0x50) /* Intr Ctrl reg 4 */
41#define MCFSIM_ICR5 0x51 /* Intr Ctrl reg 5 (r/w) */ 41#define MCFSIM_ICR5 (MCF_MBAR + 0x51) /* Intr Ctrl reg 5 */
42#define MCFSIM_ICR6 0x52 /* Intr Ctrl reg 6 (r/w) */ 42#define MCFSIM_ICR6 (MCF_MBAR + 0x52) /* Intr Ctrl reg 6 */
43#define MCFSIM_ICR7 0x53 /* Intr Ctrl reg 7 (r/w) */ 43#define MCFSIM_ICR7 (MCF_MBAR + 0x53) /* Intr Ctrl reg 7 */
44#define MCFSIM_ICR8 0x54 /* Intr Ctrl reg 8 (r/w) */ 44#define MCFSIM_ICR8 (MCF_MBAR + 0x54) /* Intr Ctrl reg 8 */
45#define MCFSIM_ICR9 0x55 /* Intr Ctrl reg 9 (r/w) */ 45#define MCFSIM_ICR9 (MCF_MBAR + 0x55) /* Intr Ctrl reg 9 */
46#define MCFSIM_ICR10 0x56 /* Intr Ctrl reg 10 (r/w) */ 46#define MCFSIM_ICR10 (MCF_MBAR + 0x56) /* Intr Ctrl reg 10 */
47#define MCFSIM_ICR11 0x57 /* Intr Ctrl reg 11 (r/w) */ 47#define MCFSIM_ICR11 (MCF_MBAR + 0x57) /* Intr Ctrl reg 11 */
48 48
49#define MCFSIM_CSAR0 0x80 /* CS 0 Address 0 reg (r/w) */ 49#define MCFSIM_CSAR0 (MCF_MBAR + 0x80) /* CS 0 Address reg */
50#define MCFSIM_CSMR0 0x84 /* CS 0 Mask 0 reg (r/w) */ 50#define MCFSIM_CSMR0 (MCF_MBAR + 0x84) /* CS 0 Mask reg */
51#define MCFSIM_CSCR0 0x8a /* CS 0 Control reg (r/w) */ 51#define MCFSIM_CSCR0 (MCF_MBAR + 0x8a) /* CS 0 Control reg */
52#define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ 52#define MCFSIM_CSAR1 (MCF_MBAR + 0x8c) /* CS 1 Address reg */
53#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ 53#define MCFSIM_CSMR1 (MCF_MBAR + 0x90) /* CS 1 Mask reg */
54#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ 54#define MCFSIM_CSCR1 (MCF_MBAR + 0x96) /* CS 1 Control reg */
55#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ 55#define MCFSIM_CSAR2 (MCF_MBAR + 0x98) /* CS 2 Address reg */
56#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 56#define MCFSIM_CSMR2 (MCF_MBAR + 0x9c) /* CS 2 Mask reg */
57#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 57#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
58#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ 58#define MCFSIM_CSAR3 (MCF_MBAR + 0xa4) /* CS 3 Address reg */
59#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 59#define MCFSIM_CSMR3 (MCF_MBAR + 0xa8) /* CS 3 Mask reg */
60#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 60#define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
61#define MCFSIM_CSAR4 0xb0 /* CS 4 Address reg (r/w) */ 61#define MCFSIM_CSAR4 (MCF_MBAR + 0xb0) /* CS 4 Address reg */
62#define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ 62#define MCFSIM_CSMR4 (MCF_MBAR + 0xb4) /* CS 4 Mask reg */
63#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ 63#define MCFSIM_CSCR4 (MCF_MBAR + 0xba) /* CS 4 Control reg */
64 64
65#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */ 65#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */
66#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */ 66#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */
diff --git a/arch/m68k/include/asm/m5272sim.h b/arch/m68k/include/asm/m5272sim.h
index a58f1760d858..1fb01bb05d6c 100644
--- a/arch/m68k/include/asm/m5272sim.h
+++ b/arch/m68k/include/asm/m5272sim.h
@@ -21,52 +21,52 @@
21/* 21/*
22 * Define the 5272 SIM register set addresses. 22 * Define the 5272 SIM register set addresses.
23 */ 23 */
24#define MCFSIM_SCR 0x04 /* SIM Config reg (r/w) */ 24#define MCFSIM_SCR (MCF_MBAR + 0x04) /* SIM Config reg */
25#define MCFSIM_SPR 0x06 /* System Protection reg (r/w)*/ 25#define MCFSIM_SPR (MCF_MBAR + 0x06) /* System Protection */
26#define MCFSIM_PMR 0x08 /* Power Management reg (r/w) */ 26#define MCFSIM_PMR (MCF_MBAR + 0x08) /* Power Management */
27#define MCFSIM_APMR 0x0e /* Active Low Power reg (r/w) */ 27#define MCFSIM_APMR (MCF_MBAR + 0x0e) /* Active Low Power */
28#define MCFSIM_DIR 0x10 /* Device Identity reg (r/w) */ 28#define MCFSIM_DIR (MCF_MBAR + 0x10) /* Device Identity */
29 29
30#define MCFSIM_ICR1 0x20 /* Intr Ctrl reg 1 (r/w) */ 30#define MCFSIM_ICR1 (MCF_MBAR + 0x20) /* Intr Ctrl reg 1 */
31#define MCFSIM_ICR2 0x24 /* Intr Ctrl reg 2 (r/w) */ 31#define MCFSIM_ICR2 (MCF_MBAR + 0x24) /* Intr Ctrl reg 2 */
32#define MCFSIM_ICR3 0x28 /* Intr Ctrl reg 3 (r/w) */ 32#define MCFSIM_ICR3 (MCF_MBAR + 0x28) /* Intr Ctrl reg 3 */
33#define MCFSIM_ICR4 0x2c /* Intr Ctrl reg 4 (r/w) */ 33#define MCFSIM_ICR4 (MCF_MBAR + 0x2c) /* Intr Ctrl reg 4 */
34 34
35#define MCFSIM_ISR 0x30 /* Interrupt Source reg (r/w) */ 35#define MCFSIM_ISR (MCF_MBAR + 0x30) /* Intr Source */
36#define MCFSIM_PITR 0x34 /* Interrupt Transition (r/w) */ 36#define MCFSIM_PITR (MCF_MBAR + 0x34) /* Intr Transition */
37#define MCFSIM_PIWR 0x38 /* Interrupt Wakeup reg (r/w) */ 37#define MCFSIM_PIWR (MCF_MBAR + 0x38) /* Intr Wakeup */
38#define MCFSIM_PIVR 0x3f /* Interrupt Vector reg (r/w( */ 38#define MCFSIM_PIVR (MCF_MBAR + 0x3f) /* Intr Vector */
39 39
40#define MCFSIM_WRRR 0x280 /* Watchdog reference (r/w) */ 40#define MCFSIM_WRRR (MCF_MBAR + 0x280) /* Watchdog reference */
41#define MCFSIM_WIRR 0x284 /* Watchdog interrupt (r/w) */ 41#define MCFSIM_WIRR (MCF_MBAR + 0x284) /* Watchdog interrupt */
42#define MCFSIM_WCR 0x288 /* Watchdog counter (r/w) */ 42#define MCFSIM_WCR (MCF_MBAR + 0x288) /* Watchdog counter */
43#define MCFSIM_WER 0x28c /* Watchdog event (r/w) */ 43#define MCFSIM_WER (MCF_MBAR + 0x28c) /* Watchdog event */
44 44
45#define MCFSIM_CSBR0 0x40 /* CS0 Base Address (r/w) */ 45#define MCFSIM_CSBR0 (MCF_MBAR + 0x40) /* CS0 Base Address */
46#define MCFSIM_CSOR0 0x44 /* CS0 Option (r/w) */ 46#define MCFSIM_CSOR0 (MCF_MBAR + 0x44) /* CS0 Option */
47#define MCFSIM_CSBR1 0x48 /* CS1 Base Address (r/w) */ 47#define MCFSIM_CSBR1 (MCF_MBAR + 0x48) /* CS1 Base Address */
48#define MCFSIM_CSOR1 0x4c /* CS1 Option (r/w) */ 48#define MCFSIM_CSOR1 (MCF_MBAR + 0x4c) /* CS1 Option */
49#define MCFSIM_CSBR2 0x50 /* CS2 Base Address (r/w) */ 49#define MCFSIM_CSBR2 (MCF_MBAR + 0x50) /* CS2 Base Address */
50#define MCFSIM_CSOR2 0x54 /* CS2 Option (r/w) */ 50#define MCFSIM_CSOR2 (MCF_MBAR + 0x54) /* CS2 Option */
51#define MCFSIM_CSBR3 0x58 /* CS3 Base Address (r/w) */ 51#define MCFSIM_CSBR3 (MCF_MBAR + 0x58) /* CS3 Base Address */
52#define MCFSIM_CSOR3 0x5c /* CS3 Option (r/w) */ 52#define MCFSIM_CSOR3 (MCF_MBAR + 0x5c) /* CS3 Option */
53#define MCFSIM_CSBR4 0x60 /* CS4 Base Address (r/w) */ 53#define MCFSIM_CSBR4 (MCF_MBAR + 0x60) /* CS4 Base Address */
54#define MCFSIM_CSOR4 0x64 /* CS4 Option (r/w) */ 54#define MCFSIM_CSOR4 (MCF_MBAR + 0x64) /* CS4 Option */
55#define MCFSIM_CSBR5 0x68 /* CS5 Base Address (r/w) */ 55#define MCFSIM_CSBR5 (MCF_MBAR + 0x68) /* CS5 Base Address */
56#define MCFSIM_CSOR5 0x6c /* CS5 Option (r/w) */ 56#define MCFSIM_CSOR5 (MCF_MBAR + 0x6c) /* CS5 Option */
57#define MCFSIM_CSBR6 0x70 /* CS6 Base Address (r/w) */ 57#define MCFSIM_CSBR6 (MCF_MBAR + 0x70) /* CS6 Base Address */
58#define MCFSIM_CSOR6 0x74 /* CS6 Option (r/w) */ 58#define MCFSIM_CSOR6 (MCF_MBAR + 0x74) /* CS6 Option */
59#define MCFSIM_CSBR7 0x78 /* CS7 Base Address (r/w) */ 59#define MCFSIM_CSBR7 (MCF_MBAR + 0x78) /* CS7 Base Address */
60#define MCFSIM_CSOR7 0x7c /* CS7 Option (r/w) */ 60#define MCFSIM_CSOR7 (MCF_MBAR + 0x7c) /* CS7 Option */
61 61
62#define MCFSIM_SDCR 0x180 /* SDRAM Configuration (r/w) */ 62#define MCFSIM_SDCR (MCF_MBAR + 0x180) /* SDRAM Config */
63#define MCFSIM_SDTR 0x184 /* SDRAM Timing (r/w) */ 63#define MCFSIM_SDTR (MCF_MBAR + 0x184) /* SDRAM Timing */
64#define MCFSIM_DCAR0 0x4c /* DRAM 0 Address reg(r/w) */ 64#define MCFSIM_DCAR0 (MCF_MBAR + 0x4c) /* DRAM 0 Address */
65#define MCFSIM_DCMR0 0x50 /* DRAM 0 Mask reg (r/w) */ 65#define MCFSIM_DCMR0 (MCF_MBAR + 0x50) /* DRAM 0 Mask */
66#define MCFSIM_DCCR0 0x57 /* DRAM 0 Control reg (r/w) */ 66#define MCFSIM_DCCR0 (MCF_MBAR + 0x57) /* DRAM 0 Control */
67#define MCFSIM_DCAR1 0x58 /* DRAM 1 Address reg (r/w) */ 67#define MCFSIM_DCAR1 (MCF_MBAR + 0x58) /* DRAM 1 Address */
68#define MCFSIM_DCMR1 0x5c /* DRAM 1 Mask reg (r/w) */ 68#define MCFSIM_DCMR1 (MCF_MBAR + 0x5c) /* DRAM 1 Mask reg */
69#define MCFSIM_DCCR1 0x63 /* DRAM 1 Control reg (r/w) */ 69#define MCFSIM_DCCR1 (MCF_MBAR + 0x63) /* DRAM 1 Control */
70 70
71#define MCFUART_BASE0 (MCF_MBAR + 0x100) /* Base address UART0 */ 71#define MCFUART_BASE0 (MCF_MBAR + 0x100) /* Base address UART0 */
72#define MCFUART_BASE1 (MCF_MBAR + 0x140) /* Base address UART1 */ 72#define MCFUART_BASE1 (MCF_MBAR + 0x140) /* Base address UART1 */
@@ -132,8 +132,9 @@
132/* 132/*
133 * Generic GPIO support 133 * Generic GPIO support
134 */ 134 */
135#define MCFGPIO_PIN_MAX 48 135#define MCFGPIO_PIN_MAX 48
136#define MCFGPIO_IRQ_MAX -1 136#define MCFGPIO_IRQ_MAX -1
137#define MCFGPIO_IRQ_VECBASE -1 137#define MCFGPIO_IRQ_VECBASE -1
138
138/****************************************************************************/ 139/****************************************************************************/
139#endif /* m5272sim_h */ 140#endif /* m5272sim_h */
diff --git a/arch/m68k/include/asm/m527xsim.h b/arch/m68k/include/asm/m527xsim.h
index 71aa5104d3d6..1bebbe78055a 100644
--- a/arch/m68k/include/asm/m527xsim.h
+++ b/arch/m68k/include/asm/m527xsim.h
@@ -184,19 +184,33 @@
184/* 184/*
185 * Generic GPIO support 185 * Generic GPIO support
186 */ 186 */
187#define MCFGPIO_PODR MCFGPIO_PODR_ADDR 187#define MCFGPIO_PODR MCFGPIO_PODR_ADDR
188#define MCFGPIO_PDDR MCFGPIO_PDDR_ADDR 188#define MCFGPIO_PDDR MCFGPIO_PDDR_ADDR
189#define MCFGPIO_PPDR MCFGPIO_PPDSDR_ADDR 189#define MCFGPIO_PPDR MCFGPIO_PPDSDR_ADDR
190#define MCFGPIO_SETR MCFGPIO_PPDSDR_ADDR 190#define MCFGPIO_SETR MCFGPIO_PPDSDR_ADDR
191#define MCFGPIO_CLRR MCFGPIO_PCLRR_ADDR 191#define MCFGPIO_CLRR MCFGPIO_PCLRR_ADDR
192 192
193#define MCFGPIO_PIN_MAX 100 193#define MCFGPIO_PIN_MAX 100
194#define MCFGPIO_IRQ_MAX 8 194#define MCFGPIO_IRQ_MAX 8
195#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 195#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
196 196
197/*
198 * Port Pin Assignment registers.
199 */
200#define MCFGPIO_PAR_AD (MCF_IPSBAR + 0x100040)
201#define MCFGPIO_PAR_BUSCTL (MCF_IPSBAR + 0x100042)
202#define MCFGPIO_PAR_BS (MCF_IPSBAR + 0x100044)
203#define MCFGPIO_PAR_CS (MCF_IPSBAR + 0x100045)
204#define MCFGPIO_PAR_SDRAM (MCF_IPSBAR + 0x100046)
205#define MCFGPIO_PAR_FECI2C (MCF_IPSBAR + 0x100047)
206#define MCFGPIO_PAR_UART (MCF_IPSBAR + 0x100048)
197#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10004A) 207#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10004A)
198#define MCFGPIO_PAR_TIMER (MCF_IPSBAR + 0x10004C) 208#define MCFGPIO_PAR_TIMER (MCF_IPSBAR + 0x10004C)
199#endif 209
210#define UART0_ENABLE_MASK 0x000f
211#define UART1_ENABLE_MASK 0x0ff0
212#define UART2_ENABLE_MASK 0x3000
213#endif /* CONFIG_M5271 */
200 214
201#ifdef CONFIG_M5275 215#ifdef CONFIG_M5275
202#define MCFGPIO_PODR_BUSCTL (MCF_IPSBAR + 0x100004) 216#define MCFGPIO_PODR_BUSCTL (MCF_IPSBAR + 0x100004)
@@ -279,18 +293,36 @@
279/* 293/*
280 * Generic GPIO support 294 * Generic GPIO support
281 */ 295 */
282#define MCFGPIO_PODR MCFGPIO_PODR_BUSCTL 296#define MCFGPIO_PODR MCFGPIO_PODR_BUSCTL
283#define MCFGPIO_PDDR MCFGPIO_PDDR_BUSCTL 297#define MCFGPIO_PDDR MCFGPIO_PDDR_BUSCTL
284#define MCFGPIO_PPDR MCFGPIO_PPDSDR_BUSCTL 298#define MCFGPIO_PPDR MCFGPIO_PPDSDR_BUSCTL
285#define MCFGPIO_SETR MCFGPIO_PPDSDR_BUSCTL 299#define MCFGPIO_SETR MCFGPIO_PPDSDR_BUSCTL
286#define MCFGPIO_CLRR MCFGPIO_PCLRR_BUSCTL 300#define MCFGPIO_CLRR MCFGPIO_PCLRR_BUSCTL
287 301
288#define MCFGPIO_PIN_MAX 148 302#define MCFGPIO_PIN_MAX 148
289#define MCFGPIO_IRQ_MAX 8 303#define MCFGPIO_IRQ_MAX 8
290#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 304#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
291 305
306/*
307 * Port Pin Assignment registers.
308 */
309#define MCFGPIO_PAR_AD (MCF_IPSBAR + 0x100070)
310#define MCFGPIO_PAR_CS (MCF_IPSBAR + 0x100071)
311#define MCFGPIO_PAR_BUSCTL (MCF_IPSBAR + 0x100072)
312#define MCFGPIO_PAR_USB (MCF_IPSBAR + 0x100076)
313#define MCFGPIO_PAR_FEC0HL (MCF_IPSBAR + 0x100078)
314#define MCFGPIO_PAR_FEC1HL (MCF_IPSBAR + 0x100079)
315#define MCFGPIO_PAR_TIMER (MCF_IPSBAR + 0x10007A)
316#define MCFGPIO_PAR_UART (MCF_IPSBAR + 0x10007C)
292#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10007E) 317#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10007E)
293#endif 318#define MCFGPIO_PAR_SDRAM (MCF_IPSBAR + 0x100080)
319#define MCFGPIO_PAR_FECI2C (MCF_IPSBAR + 0x100082)
320#define MCFGPIO_PAR_BS (MCF_IPSBAR + 0x100084)
321
322#define UART0_ENABLE_MASK 0x000f
323#define UART1_ENABLE_MASK 0x00f0
324#define UART2_ENABLE_MASK 0x3f00
325#endif /* CONFIG_M5275 */
294 326
295/* 327/*
296 * PIT timer base addresses. 328 * PIT timer base addresses.
@@ -311,22 +343,6 @@
311#define MCFEPORT_EPFR (MCF_IPSBAR + 0x130006) 343#define MCFEPORT_EPFR (MCF_IPSBAR + 0x130006)
312 344
313/* 345/*
314 * GPIO pins setups to enable the UARTs.
315 */
316#ifdef CONFIG_M5271
317#define MCF_GPIO_PAR_UART 0x100048 /* PAR UART address */
318#define UART0_ENABLE_MASK 0x000f
319#define UART1_ENABLE_MASK 0x0ff0
320#define UART2_ENABLE_MASK 0x3000
321#endif
322#ifdef CONFIG_M5275
323#define MCF_GPIO_PAR_UART 0x10007c /* PAR UART address */
324#define UART0_ENABLE_MASK 0x000f
325#define UART1_ENABLE_MASK 0x00f0
326#define UART2_ENABLE_MASK 0x3f00
327#endif
328
329/*
330 * Reset Control Unit (relative to IPSBAR). 346 * Reset Control Unit (relative to IPSBAR).
331 */ 347 */
332#define MCF_RCR (MCF_IPSBAR + 0x110000) 348#define MCF_RCR (MCF_IPSBAR + 0x110000)
diff --git a/arch/m68k/include/asm/m528xsim.h b/arch/m68k/include/asm/m528xsim.h
index 4acb3c0a642e..cf68ca0ac3a5 100644
--- a/arch/m68k/include/asm/m528xsim.h
+++ b/arch/m68k/include/asm/m528xsim.h
@@ -233,23 +233,6 @@
233#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 233#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
234#define MCFGPIO_PIN_MAX 180 234#define MCFGPIO_PIN_MAX 180
235 235
236
237/*
238 * Derek Cheung - 6 Feb 2005
239 * add I2C and QSPI register definition using Freescale's MCF5282
240 */
241/* set Port AS pin for I2C or UART */
242#define MCF5282_GPIO_PASPAR (volatile u16 *) (MCF_IPSBAR + 0x00100056)
243
244/* Port UA Pin Assignment Register (8 Bit) */
245#define MCF5282_GPIO_PUAPAR 0x10005C
246
247/* Interrupt Mask Register Register Low */
248#define MCF5282_INTC0_IMRL (volatile u32 *) (MCF_IPSBAR + 0x0C0C)
249/* Interrupt Control Register 7 */
250#define MCF5282_INTC0_ICR17 (volatile u8 *) (MCF_IPSBAR + 0x0C51)
251
252
253/* 236/*
254 * Reset Control Unit (relative to IPSBAR). 237 * Reset Control Unit (relative to IPSBAR).
255 */ 238 */
@@ -259,37 +242,5 @@
259#define MCF_RCR_SWRESET 0x80 /* Software reset bit */ 242#define MCF_RCR_SWRESET 0x80 /* Software reset bit */
260#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */ 243#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */
261 244
262/********************************************************************* 245/****************************************************************************/
263*
264* Inter-IC (I2C) Module
265*
266*********************************************************************/
267/* Read/Write access macros for general use */
268#define MCF5282_I2C_I2ADR (volatile u8 *) (MCF_IPSBAR + 0x0300) // Address
269#define MCF5282_I2C_I2FDR (volatile u8 *) (MCF_IPSBAR + 0x0304) // Freq Divider
270#define MCF5282_I2C_I2CR (volatile u8 *) (MCF_IPSBAR + 0x0308) // Control
271#define MCF5282_I2C_I2SR (volatile u8 *) (MCF_IPSBAR + 0x030C) // Status
272#define MCF5282_I2C_I2DR (volatile u8 *) (MCF_IPSBAR + 0x0310) // Data I/O
273
274/* Bit level definitions and macros */
275#define MCF5282_I2C_I2ADR_ADDR(x) (((x)&0x7F)<<0x01)
276
277#define MCF5282_I2C_I2FDR_IC(x) (((x)&0x3F))
278
279#define MCF5282_I2C_I2CR_IEN (0x80) // I2C enable
280#define MCF5282_I2C_I2CR_IIEN (0x40) // interrupt enable
281#define MCF5282_I2C_I2CR_MSTA (0x20) // master/slave mode
282#define MCF5282_I2C_I2CR_MTX (0x10) // transmit/receive mode
283#define MCF5282_I2C_I2CR_TXAK (0x08) // transmit acknowledge enable
284#define MCF5282_I2C_I2CR_RSTA (0x04) // repeat start
285
286#define MCF5282_I2C_I2SR_ICF (0x80) // data transfer bit
287#define MCF5282_I2C_I2SR_IAAS (0x40) // I2C addressed as a slave
288#define MCF5282_I2C_I2SR_IBB (0x20) // I2C bus busy
289#define MCF5282_I2C_I2SR_IAL (0x10) // aribitration lost
290#define MCF5282_I2C_I2SR_SRW (0x04) // slave read/write
291#define MCF5282_I2C_I2SR_IIF (0x02) // I2C interrupt
292#define MCF5282_I2C_I2SR_RXAK (0x01) // received acknowledge
293
294
295#endif /* m528xsim_h */ 246#endif /* m528xsim_h */
diff --git a/arch/m68k/include/asm/m5307sim.h b/arch/m68k/include/asm/m5307sim.h
index 3bc3adaa7ee0..5d0bb7ec31f8 100644
--- a/arch/m68k/include/asm/m5307sim.h
+++ b/arch/m68k/include/asm/m5307sim.h
@@ -23,71 +23,71 @@
23/* 23/*
24 * Define the 5307 SIM register set addresses. 24 * Define the 5307 SIM register set addresses.
25 */ 25 */
26#define MCFSIM_RSR 0x00 /* Reset Status reg (r/w) */ 26#define MCFSIM_RSR (MCF_MBAR + 0x00) /* Reset Status reg */
27#define MCFSIM_SYPCR 0x01 /* System Protection reg (r/w)*/ 27#define MCFSIM_SYPCR (MCF_MBAR + 0x01) /* System Protection */
28#define MCFSIM_SWIVR 0x02 /* SW Watchdog intr reg (r/w) */ 28#define MCFSIM_SWIVR (MCF_MBAR + 0x02) /* SW Watchdog intr */
29#define MCFSIM_SWSR 0x03 /* SW Watchdog service (r/w) */ 29#define MCFSIM_SWSR (MCF_MBAR + 0x03) /* SW Watchdog service*/
30#define MCFSIM_PAR 0x04 /* Pin Assignment reg (r/w) */ 30#define MCFSIM_PAR (MCF_MBAR + 0x04) /* Pin Assignment */
31#define MCFSIM_IRQPAR 0x06 /* Interrupt Assignment reg (r/w) */ 31#define MCFSIM_IRQPAR (MCF_MBAR + 0x06) /* Itr Assignment */
32#define MCFSIM_PLLCR 0x08 /* PLL Control Reg*/ 32#define MCFSIM_PLLCR (MCF_MBAR + 0x08) /* PLL Ctrl Reg */
33#define MCFSIM_MPARK 0x0C /* BUS Master Control Reg*/ 33#define MCFSIM_MPARK (MCF_MBAR + 0x0C) /* BUS Master Ctrl */
34#define MCFSIM_IPR 0x40 /* Interrupt Pend reg (r/w) */ 34#define MCFSIM_IPR (MCF_MBAR + 0x40) /* Interrupt Pend */
35#define MCFSIM_IMR 0x44 /* Interrupt Mask reg (r/w) */ 35#define MCFSIM_IMR (MCF_MBAR + 0x44) /* Interrupt Mask */
36#define MCFSIM_AVR 0x4b /* Autovector Ctrl reg (r/w) */ 36#define MCFSIM_AVR (MCF_MBAR + 0x4b) /* Autovector Ctrl */
37#define MCFSIM_ICR0 0x4c /* Intr Ctrl reg 0 (r/w) */ 37#define MCFSIM_ICR0 (MCF_MBAR + 0x4c) /* Intr Ctrl reg 0 */
38#define MCFSIM_ICR1 0x4d /* Intr Ctrl reg 1 (r/w) */ 38#define MCFSIM_ICR1 (MCF_MBAR + 0x4d) /* Intr Ctrl reg 1 */
39#define MCFSIM_ICR2 0x4e /* Intr Ctrl reg 2 (r/w) */ 39#define MCFSIM_ICR2 (MCF_MBAR + 0x4e) /* Intr Ctrl reg 2 */
40#define MCFSIM_ICR3 0x4f /* Intr Ctrl reg 3 (r/w) */ 40#define MCFSIM_ICR3 (MCF_MBAR + 0x4f) /* Intr Ctrl reg 3 */
41#define MCFSIM_ICR4 0x50 /* Intr Ctrl reg 4 (r/w) */ 41#define MCFSIM_ICR4 (MCF_MBAR + 0x50) /* Intr Ctrl reg 4 */
42#define MCFSIM_ICR5 0x51 /* Intr Ctrl reg 5 (r/w) */ 42#define MCFSIM_ICR5 (MCF_MBAR + 0x51) /* Intr Ctrl reg 5 */
43#define MCFSIM_ICR6 0x52 /* Intr Ctrl reg 6 (r/w) */ 43#define MCFSIM_ICR6 (MCF_MBAR + 0x52) /* Intr Ctrl reg 6 */
44#define MCFSIM_ICR7 0x53 /* Intr Ctrl reg 7 (r/w) */ 44#define MCFSIM_ICR7 (MCF_MBAR + 0x53) /* Intr Ctrl reg 7 */
45#define MCFSIM_ICR8 0x54 /* Intr Ctrl reg 8 (r/w) */ 45#define MCFSIM_ICR8 (MCF_MBAR + 0x54) /* Intr Ctrl reg 8 */
46#define MCFSIM_ICR9 0x55 /* Intr Ctrl reg 9 (r/w) */ 46#define MCFSIM_ICR9 (MCF_MBAR + 0x55) /* Intr Ctrl reg 9 */
47#define MCFSIM_ICR10 0x56 /* Intr Ctrl reg 10 (r/w) */ 47#define MCFSIM_ICR10 (MCF_MBAR + 0x56) /* Intr Ctrl reg 10 */
48#define MCFSIM_ICR11 0x57 /* Intr Ctrl reg 11 (r/w) */ 48#define MCFSIM_ICR11 (MCF_MBAR + 0x57) /* Intr Ctrl reg 11 */
49 49
50#define MCFSIM_CSAR0 0x80 /* CS 0 Address 0 reg (r/w) */ 50#define MCFSIM_CSAR0 (MCF_MBAR + 0x80) /* CS 0 Address reg */
51#define MCFSIM_CSMR0 0x84 /* CS 0 Mask 0 reg (r/w) */ 51#define MCFSIM_CSMR0 (MCF_MBAR + 0x84) /* CS 0 Mask reg */
52#define MCFSIM_CSCR0 0x8a /* CS 0 Control reg (r/w) */ 52#define MCFSIM_CSCR0 (MCF_MBAR + 0x8a) /* CS 0 Control reg */
53#define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ 53#define MCFSIM_CSAR1 (MCF_MBAR + 0x8c) /* CS 1 Address reg */
54#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ 54#define MCFSIM_CSMR1 (MCF_MBAR + 0x90) /* CS 1 Mask reg */
55#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ 55#define MCFSIM_CSCR1 (MCF_MBAR + 0x96) /* CS 1 Control reg */
56 56
57#ifdef CONFIG_OLDMASK 57#ifdef CONFIG_OLDMASK
58#define MCFSIM_CSBAR 0x98 /* CS Base Address reg (r/w) */ 58#define MCFSIM_CSBAR (MCF_MBAR + 0x98) /* CS Base Address */
59#define MCFSIM_CSBAMR 0x9c /* CS Base Mask reg (r/w) */ 59#define MCFSIM_CSBAMR (MCF_MBAR + 0x9c) /* CS Base Mask */
60#define MCFSIM_CSMR2 0x9e /* CS 2 Mask reg (r/w) */ 60#define MCFSIM_CSMR2 (MCF_MBAR + 0x9e) /* CS 2 Mask reg */
61#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 61#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
62#define MCFSIM_CSMR3 0xaa /* CS 3 Mask reg (r/w) */ 62#define MCFSIM_CSMR3 (MCF_MBAR + 0xaa) /* CS 3 Mask reg */
63#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 63#define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
64#define MCFSIM_CSMR4 0xb6 /* CS 4 Mask reg (r/w) */ 64#define MCFSIM_CSMR4 (MCF_MBAR + 0xb6) /* CS 4 Mask reg */
65#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ 65#define MCFSIM_CSCR4 (MCF_MBAR + 0xba) /* CS 4 Control reg */
66#define MCFSIM_CSMR5 0xc2 /* CS 5 Mask reg (r/w) */ 66#define MCFSIM_CSMR5 (MCF_MBAR + 0xc2) /* CS 5 Mask reg */
67#define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ 67#define MCFSIM_CSCR5 (MCF_MBAR + 0xc6) /* CS 5 Control reg */
68#define MCFSIM_CSMR6 0xce /* CS 6 Mask reg (r/w) */ 68#define MCFSIM_CSMR6 (MCF_MBAR + 0xce) /* CS 6 Mask reg */
69#define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ 69#define MCFSIM_CSCR6 (MCF_MBAR + 0xd2) /* CS 6 Control reg */
70#define MCFSIM_CSMR7 0xda /* CS 7 Mask reg (r/w) */ 70#define MCFSIM_CSMR7 (MCF_MBAR + 0xda) /* CS 7 Mask reg */
71#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ 71#define MCFSIM_CSCR7 (MCF_MBAR + 0xde) /* CS 7 Control reg */
72#else 72#else
73#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ 73#define MCFSIM_CSAR2 (MCF_MBAR + 0x98) /* CS 2 Address reg */
74#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 74#define MCFSIM_CSMR2 (MCF_MBAR + 0x9c) /* CS 2 Mask reg */
75#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 75#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
76#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ 76#define MCFSIM_CSAR3 (MCF_MBAR + 0xa4) /* CS 3 Address reg */
77#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 77#define MCFSIM_CSMR3 (MCF_MBAR + 0xa8) /* CS 3 Mask reg */
78#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 78#define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
79#define MCFSIM_CSAR4 0xb0 /* CS 4 Address reg (r/w) */ 79#define MCFSIM_CSAR4 (MCF_MBAR + 0xb0) /* CS 4 Address reg */
80#define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ 80#define MCFSIM_CSMR4 (MCF_MBAR + 0xb4) /* CS 4 Mask reg */
81#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ 81#define MCFSIM_CSCR4 (MCF_MBAR + 0xba) /* CS 4 Control reg */
82#define MCFSIM_CSAR5 0xbc /* CS 5 Address reg (r/w) */ 82#define MCFSIM_CSAR5 (MCF_MBAR + 0xbc) /* CS 5 Address reg */
83#define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */ 83#define MCFSIM_CSMR5 (MCF_MBAR + 0xc0) /* CS 5 Mask reg */
84#define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ 84#define MCFSIM_CSCR5 (MCF_MBAR + 0xc6) /* CS 5 Control reg */
85#define MCFSIM_CSAR6 0xc8 /* CS 6 Address reg (r/w) */ 85#define MCFSIM_CSAR6 (MCF_MBAR + 0xc8) /* CS 6 Address reg */
86#define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */ 86#define MCFSIM_CSMR6 (MCF_MBAR + 0xcc) /* CS 6 Mask reg */
87#define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ 87#define MCFSIM_CSCR6 (MCF_MBAR + 0xd2) /* CS 6 Control reg */
88#define MCFSIM_CSAR7 0xd4 /* CS 7 Address reg (r/w) */ 88#define MCFSIM_CSAR7 (MCF_MBAR + 0xd4) /* CS 7 Address reg */
89#define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */ 89#define MCFSIM_CSMR7 (MCF_MBAR + 0xd8) /* CS 7 Mask reg */
90#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ 90#define MCFSIM_CSCR7 (MCF_MBAR + 0xde) /* CS 7 Control reg */
91#endif /* CONFIG_OLDMASK */ 91#endif /* CONFIG_OLDMASK */
92 92
93#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */ 93#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */
@@ -127,9 +127,9 @@
127/* 127/*
128 * Generic GPIO support 128 * Generic GPIO support
129 */ 129 */
130#define MCFGPIO_PIN_MAX 16 130#define MCFGPIO_PIN_MAX 16
131#define MCFGPIO_IRQ_MAX -1 131#define MCFGPIO_IRQ_MAX -1
132#define MCFGPIO_IRQ_VECBASE -1 132#define MCFGPIO_IRQ_VECBASE -1
133 133
134 134
135/* Definition offset address for CS2-7 -- old mask 5307 */ 135/* Definition offset address for CS2-7 -- old mask 5307 */
@@ -167,9 +167,9 @@
167/* 167/*
168 * Defines for the IRQPAR Register 168 * Defines for the IRQPAR Register
169 */ 169 */
170#define IRQ5_LEVEL4 0x80 170#define IRQ5_LEVEL4 0x80
171#define IRQ3_LEVEL6 0x40 171#define IRQ3_LEVEL6 0x40
172#define IRQ1_LEVEL2 0x20 172#define IRQ1_LEVEL2 0x20
173 173
174/* 174/*
175 * Define system peripheral IRQ usage. 175 * Define system peripheral IRQ usage.
diff --git a/arch/m68k/include/asm/m532xsim.h b/arch/m68k/include/asm/m532xsim.h
index 5ca7b298c6eb..8668e47ced0e 100644
--- a/arch/m68k/include/asm/m532xsim.h
+++ b/arch/m68k/include/asm/m532xsim.h
@@ -15,10 +15,6 @@
15 15
16#include <asm/m53xxacr.h> 16#include <asm/m53xxacr.h>
17 17
18#define MCF_REG32(x) (*(volatile unsigned long *)(x))
19#define MCF_REG16(x) (*(volatile unsigned short *)(x))
20#define MCF_REG08(x) (*(volatile unsigned char *)(x))
21
22#define MCFINT_VECBASE 64 18#define MCFINT_VECBASE 64
23#define MCFINT_UART0 26 /* Interrupt number for UART0 */ 19#define MCFINT_UART0 26 /* Interrupt number for UART0 */
24#define MCFINT_UART1 27 /* Interrupt number for UART1 */ 20#define MCFINT_UART1 27 /* Interrupt number for UART1 */
@@ -38,7 +34,7 @@
38 34
39#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) 35#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI)
40 36
41#define MCF_WTM_WCR MCF_REG16(0xFC098000) 37#define MCF_WTM_WCR 0xFC098000
42 38
43/* 39/*
44 * Define the 532x SIM register set addresses. 40 * Define the 532x SIM register set addresses.
@@ -152,42 +148,6 @@
152#define MCFPM_PPMHR1 0xfc040038 148#define MCFPM_PPMHR1 0xfc040038
153#define MCFPM_LPCR 0xec090007 149#define MCFPM_LPCR 0xec090007
154 150
155/*********************************************************************
156 *
157 * Inter-IC (I2C) Module
158 *
159 *********************************************************************/
160
161/* Read/Write access macros for general use */
162#define MCF532x_I2C_I2ADR (volatile u8 *) (0xFC058000) // Address
163#define MCF532x_I2C_I2FDR (volatile u8 *) (0xFC058004) // Freq Divider
164#define MCF532x_I2C_I2CR (volatile u8 *) (0xFC058008) // Control
165#define MCF532x_I2C_I2SR (volatile u8 *) (0xFC05800C) // Status
166#define MCF532x_I2C_I2DR (volatile u8 *) (0xFC058010) // Data I/O
167
168/* Bit level definitions and macros */
169#define MCF532x_I2C_I2ADR_ADDR(x) (((x)&0x7F)<<0x01)
170
171#define MCF532x_I2C_I2FDR_IC(x) (((x)&0x3F))
172
173#define MCF532x_I2C_I2CR_IEN (0x80) // I2C enable
174#define MCF532x_I2C_I2CR_IIEN (0x40) // interrupt enable
175#define MCF532x_I2C_I2CR_MSTA (0x20) // master/slave mode
176#define MCF532x_I2C_I2CR_MTX (0x10) // transmit/receive mode
177#define MCF532x_I2C_I2CR_TXAK (0x08) // transmit acknowledge enable
178#define MCF532x_I2C_I2CR_RSTA (0x04) // repeat start
179
180#define MCF532x_I2C_I2SR_ICF (0x80) // data transfer bit
181#define MCF532x_I2C_I2SR_IAAS (0x40) // I2C addressed as a slave
182#define MCF532x_I2C_I2SR_IBB (0x20) // I2C bus busy
183#define MCF532x_I2C_I2SR_IAL (0x10) // aribitration lost
184#define MCF532x_I2C_I2SR_SRW (0x04) // slave read/write
185#define MCF532x_I2C_I2SR_IIF (0x02) // I2C interrupt
186#define MCF532x_I2C_I2SR_RXAK (0x01) // received acknowledge
187
188#define MCF532x_PAR_FECI2C (volatile u8 *) (0xFC0A4053)
189
190
191/* 151/*
192 * The M5329EVB board needs a help getting its devices initialized 152 * The M5329EVB board needs a help getting its devices initialized
193 * at kernel start time if dBUG doesn't set it up (for example 153 * at kernel start time if dBUG doesn't set it up (for example
@@ -217,13 +177,13 @@
217 *********************************************************************/ 177 *********************************************************************/
218 178
219/* Register read/write macros */ 179/* Register read/write macros */
220#define MCF_CCM_CCR MCF_REG16(0xFC0A0004) 180#define MCF_CCM_CCR 0xFC0A0004
221#define MCF_CCM_RCON MCF_REG16(0xFC0A0008) 181#define MCF_CCM_RCON 0xFC0A0008
222#define MCF_CCM_CIR MCF_REG16(0xFC0A000A) 182#define MCF_CCM_CIR 0xFC0A000A
223#define MCF_CCM_MISCCR MCF_REG16(0xFC0A0010) 183#define MCF_CCM_MISCCR 0xFC0A0010
224#define MCF_CCM_CDR MCF_REG16(0xFC0A0012) 184#define MCF_CCM_CDR 0xFC0A0012
225#define MCF_CCM_UHCSR MCF_REG16(0xFC0A0014) 185#define MCF_CCM_UHCSR 0xFC0A0014
226#define MCF_CCM_UOCSR MCF_REG16(0xFC0A0016) 186#define MCF_CCM_UOCSR 0xFC0A0016
227 187
228/* Bit definitions and macros for MCF_CCM_CCR */ 188/* Bit definitions and macros for MCF_CCM_CCR */
229#define MCF_CCM_CCR_RESERVED (0x0001) 189#define MCF_CCM_CCR_RESERVED (0x0001)
@@ -287,104 +247,29 @@
287 247
288/********************************************************************* 248/*********************************************************************
289 * 249 *
290 * DMA Timers (DTIM)
291 *
292 *********************************************************************/
293
294/* Register read/write macros */
295#define MCF_DTIM0_DTMR MCF_REG16(0xFC070000)
296#define MCF_DTIM0_DTXMR MCF_REG08(0xFC070002)
297#define MCF_DTIM0_DTER MCF_REG08(0xFC070003)
298#define MCF_DTIM0_DTRR MCF_REG32(0xFC070004)
299#define MCF_DTIM0_DTCR MCF_REG32(0xFC070008)
300#define MCF_DTIM0_DTCN MCF_REG32(0xFC07000C)
301#define MCF_DTIM1_DTMR MCF_REG16(0xFC074000)
302#define MCF_DTIM1_DTXMR MCF_REG08(0xFC074002)
303#define MCF_DTIM1_DTER MCF_REG08(0xFC074003)
304#define MCF_DTIM1_DTRR MCF_REG32(0xFC074004)
305#define MCF_DTIM1_DTCR MCF_REG32(0xFC074008)
306#define MCF_DTIM1_DTCN MCF_REG32(0xFC07400C)
307#define MCF_DTIM2_DTMR MCF_REG16(0xFC078000)
308#define MCF_DTIM2_DTXMR MCF_REG08(0xFC078002)
309#define MCF_DTIM2_DTER MCF_REG08(0xFC078003)
310#define MCF_DTIM2_DTRR MCF_REG32(0xFC078004)
311#define MCF_DTIM2_DTCR MCF_REG32(0xFC078008)
312#define MCF_DTIM2_DTCN MCF_REG32(0xFC07800C)
313#define MCF_DTIM3_DTMR MCF_REG16(0xFC07C000)
314#define MCF_DTIM3_DTXMR MCF_REG08(0xFC07C002)
315#define MCF_DTIM3_DTER MCF_REG08(0xFC07C003)
316#define MCF_DTIM3_DTRR MCF_REG32(0xFC07C004)
317#define MCF_DTIM3_DTCR MCF_REG32(0xFC07C008)
318#define MCF_DTIM3_DTCN MCF_REG32(0xFC07C00C)
319#define MCF_DTIM_DTMR(x) MCF_REG16(0xFC070000+((x)*0x4000))
320#define MCF_DTIM_DTXMR(x) MCF_REG08(0xFC070002+((x)*0x4000))
321#define MCF_DTIM_DTER(x) MCF_REG08(0xFC070003+((x)*0x4000))
322#define MCF_DTIM_DTRR(x) MCF_REG32(0xFC070004+((x)*0x4000))
323#define MCF_DTIM_DTCR(x) MCF_REG32(0xFC070008+((x)*0x4000))
324#define MCF_DTIM_DTCN(x) MCF_REG32(0xFC07000C+((x)*0x4000))
325
326/* Bit definitions and macros for MCF_DTIM_DTMR */
327#define MCF_DTIM_DTMR_RST (0x0001)
328#define MCF_DTIM_DTMR_CLK(x) (((x)&0x0003)<<1)
329#define MCF_DTIM_DTMR_FRR (0x0008)
330#define MCF_DTIM_DTMR_ORRI (0x0010)
331#define MCF_DTIM_DTMR_OM (0x0020)
332#define MCF_DTIM_DTMR_CE(x) (((x)&0x0003)<<6)
333#define MCF_DTIM_DTMR_PS(x) (((x)&0x00FF)<<8)
334#define MCF_DTIM_DTMR_CE_ANY (0x00C0)
335#define MCF_DTIM_DTMR_CE_FALL (0x0080)
336#define MCF_DTIM_DTMR_CE_RISE (0x0040)
337#define MCF_DTIM_DTMR_CE_NONE (0x0000)
338#define MCF_DTIM_DTMR_CLK_DTIN (0x0006)
339#define MCF_DTIM_DTMR_CLK_DIV16 (0x0004)
340#define MCF_DTIM_DTMR_CLK_DIV1 (0x0002)
341#define MCF_DTIM_DTMR_CLK_STOP (0x0000)
342
343/* Bit definitions and macros for MCF_DTIM_DTXMR */
344#define MCF_DTIM_DTXMR_MODE16 (0x01)
345#define MCF_DTIM_DTXMR_DMAEN (0x80)
346
347/* Bit definitions and macros for MCF_DTIM_DTER */
348#define MCF_DTIM_DTER_CAP (0x01)
349#define MCF_DTIM_DTER_REF (0x02)
350
351/* Bit definitions and macros for MCF_DTIM_DTRR */
352#define MCF_DTIM_DTRR_REF(x) (((x)&0xFFFFFFFF)<<0)
353
354/* Bit definitions and macros for MCF_DTIM_DTCR */
355#define MCF_DTIM_DTCR_CAP(x) (((x)&0xFFFFFFFF)<<0)
356
357/* Bit definitions and macros for MCF_DTIM_DTCN */
358#define MCF_DTIM_DTCN_CNT(x) (((x)&0xFFFFFFFF)<<0)
359
360/*********************************************************************
361 *
362 * FlexBus Chip Selects (FBCS) 250 * FlexBus Chip Selects (FBCS)
363 * 251 *
364 *********************************************************************/ 252 *********************************************************************/
365 253
366/* Register read/write macros */ 254/* Register read/write macros */
367#define MCF_FBCS0_CSAR MCF_REG32(0xFC008000) 255#define MCF_FBCS0_CSAR 0xFC008000
368#define MCF_FBCS0_CSMR MCF_REG32(0xFC008004) 256#define MCF_FBCS0_CSMR 0xFC008004
369#define MCF_FBCS0_CSCR MCF_REG32(0xFC008008) 257#define MCF_FBCS0_CSCR 0xFC008008
370#define MCF_FBCS1_CSAR MCF_REG32(0xFC00800C) 258#define MCF_FBCS1_CSAR 0xFC00800C
371#define MCF_FBCS1_CSMR MCF_REG32(0xFC008010) 259#define MCF_FBCS1_CSMR 0xFC008010
372#define MCF_FBCS1_CSCR MCF_REG32(0xFC008014) 260#define MCF_FBCS1_CSCR 0xFC008014
373#define MCF_FBCS2_CSAR MCF_REG32(0xFC008018) 261#define MCF_FBCS2_CSAR 0xFC008018
374#define MCF_FBCS2_CSMR MCF_REG32(0xFC00801C) 262#define MCF_FBCS2_CSMR 0xFC00801C
375#define MCF_FBCS2_CSCR MCF_REG32(0xFC008020) 263#define MCF_FBCS2_CSCR 0xFC008020
376#define MCF_FBCS3_CSAR MCF_REG32(0xFC008024) 264#define MCF_FBCS3_CSAR 0xFC008024
377#define MCF_FBCS3_CSMR MCF_REG32(0xFC008028) 265#define MCF_FBCS3_CSMR 0xFC008028
378#define MCF_FBCS3_CSCR MCF_REG32(0xFC00802C) 266#define MCF_FBCS3_CSCR 0xFC00802C
379#define MCF_FBCS4_CSAR MCF_REG32(0xFC008030) 267#define MCF_FBCS4_CSAR 0xFC008030
380#define MCF_FBCS4_CSMR MCF_REG32(0xFC008034) 268#define MCF_FBCS4_CSMR 0xFC008034
381#define MCF_FBCS4_CSCR MCF_REG32(0xFC008038) 269#define MCF_FBCS4_CSCR 0xFC008038
382#define MCF_FBCS5_CSAR MCF_REG32(0xFC00803C) 270#define MCF_FBCS5_CSAR 0xFC00803C
383#define MCF_FBCS5_CSMR MCF_REG32(0xFC008040) 271#define MCF_FBCS5_CSMR 0xFC008040
384#define MCF_FBCS5_CSCR MCF_REG32(0xFC008044) 272#define MCF_FBCS5_CSCR 0xFC008044
385#define MCF_FBCS_CSAR(x) MCF_REG32(0xFC008000+((x)*0x00C))
386#define MCF_FBCS_CSMR(x) MCF_REG32(0xFC008004+((x)*0x00C))
387#define MCF_FBCS_CSCR(x) MCF_REG32(0xFC008008+((x)*0x00C))
388 273
389/* Bit definitions and macros for MCF_FBCS_CSAR */ 274/* Bit definitions and macros for MCF_FBCS_CSAR */
390#define MCF_FBCS_CSAR_BA(x) ((x)&0xFFFF0000) 275#define MCF_FBCS_CSAR_BA(x) ((x)&0xFFFF0000)
@@ -501,32 +386,32 @@
501#define MCFGPIO_PCLRR_LCDDATAL (0xFC0A404B) 386#define MCFGPIO_PCLRR_LCDDATAL (0xFC0A404B)
502#define MCFGPIO_PCLRR_LCDCTLH (0xFC0A404C) 387#define MCFGPIO_PCLRR_LCDCTLH (0xFC0A404C)
503#define MCFGPIO_PCLRR_LCDCTLL (0xFC0A404D) 388#define MCFGPIO_PCLRR_LCDCTLL (0xFC0A404D)
504#define MCF_GPIO_PAR_FEC MCF_REG08(0xFC0A4050) 389#define MCFGPIO_PAR_FEC (0xFC0A4050)
505#define MCF_GPIO_PAR_PWM MCF_REG08(0xFC0A4051) 390#define MCFGPIO_PAR_PWM (0xFC0A4051)
506#define MCF_GPIO_PAR_BUSCTL MCF_REG08(0xFC0A4052) 391#define MCFGPIO_PAR_BUSCTL (0xFC0A4052)
507#define MCF_GPIO_PAR_FECI2C MCF_REG08(0xFC0A4053) 392#define MCFGPIO_PAR_FECI2C (0xFC0A4053)
508#define MCF_GPIO_PAR_BE MCF_REG08(0xFC0A4054) 393#define MCFGPIO_PAR_BE (0xFC0A4054)
509#define MCF_GPIO_PAR_CS MCF_REG08(0xFC0A4055) 394#define MCFGPIO_PAR_CS (0xFC0A4055)
510#define MCF_GPIO_PAR_SSI MCF_REG16(0xFC0A4056) 395#define MCFGPIO_PAR_SSI (0xFC0A4056)
511#define MCF_GPIO_PAR_UART MCF_REG16(0xFC0A4058) 396#define MCFGPIO_PAR_UART (0xFC0A4058)
512#define MCF_GPIO_PAR_QSPI MCF_REG16(0xFC0A405A) 397#define MCFGPIO_PAR_QSPI (0xFC0A405A)
513#define MCF_GPIO_PAR_TIMER MCF_REG08(0xFC0A405C) 398#define MCFGPIO_PAR_TIMER (0xFC0A405C)
514#define MCF_GPIO_PAR_LCDDATA MCF_REG08(0xFC0A405D) 399#define MCFGPIO_PAR_LCDDATA (0xFC0A405D)
515#define MCF_GPIO_PAR_LCDCTL MCF_REG16(0xFC0A405E) 400#define MCFGPIO_PAR_LCDCTL (0xFC0A405E)
516#define MCF_GPIO_PAR_IRQ MCF_REG16(0xFC0A4060) 401#define MCFGPIO_PAR_IRQ (0xFC0A4060)
517#define MCF_GPIO_MSCR_FLEXBUS MCF_REG08(0xFC0A4064) 402#define MCFGPIO_MSCR_FLEXBUS (0xFC0A4064)
518#define MCF_GPIO_MSCR_SDRAM MCF_REG08(0xFC0A4065) 403#define MCFGPIO_MSCR_SDRAM (0xFC0A4065)
519#define MCF_GPIO_DSCR_I2C MCF_REG08(0xFC0A4068) 404#define MCFGPIO_DSCR_I2C (0xFC0A4068)
520#define MCF_GPIO_DSCR_PWM MCF_REG08(0xFC0A4069) 405#define MCFGPIO_DSCR_PWM (0xFC0A4069)
521#define MCF_GPIO_DSCR_FEC MCF_REG08(0xFC0A406A) 406#define MCFGPIO_DSCR_FEC (0xFC0A406A)
522#define MCF_GPIO_DSCR_UART MCF_REG08(0xFC0A406B) 407#define MCFGPIO_DSCR_UART (0xFC0A406B)
523#define MCF_GPIO_DSCR_QSPI MCF_REG08(0xFC0A406C) 408#define MCFGPIO_DSCR_QSPI (0xFC0A406C)
524#define MCF_GPIO_DSCR_TIMER MCF_REG08(0xFC0A406D) 409#define MCFGPIO_DSCR_TIMER (0xFC0A406D)
525#define MCF_GPIO_DSCR_SSI MCF_REG08(0xFC0A406E) 410#define MCFGPIO_DSCR_SSI (0xFC0A406E)
526#define MCF_GPIO_DSCR_LCD MCF_REG08(0xFC0A406F) 411#define MCFGPIO_DSCR_LCD (0xFC0A406F)
527#define MCF_GPIO_DSCR_DEBUG MCF_REG08(0xFC0A4070) 412#define MCFGPIO_DSCR_DEBUG (0xFC0A4070)
528#define MCF_GPIO_DSCR_CLKRST MCF_REG08(0xFC0A4071) 413#define MCFGPIO_DSCR_CLKRST (0xFC0A4071)
529#define MCF_GPIO_DSCR_IRQ MCF_REG08(0xFC0A4072) 414#define MCFGPIO_DSCR_IRQ (0xFC0A4072)
530 415
531/* Bit definitions and macros for MCF_GPIO_PODR_FECH */ 416/* Bit definitions and macros for MCF_GPIO_PODR_FECH */
532#define MCF_GPIO_PODR_FECH_PODR_FECH0 (0x01) 417#define MCF_GPIO_PODR_FECH_PODR_FECH0 (0x01)
@@ -1215,709 +1100,6 @@
1215#define MCFGPIO_IRQ_MAX 8 1100#define MCFGPIO_IRQ_MAX 8
1216#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 1101#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
1217 1102
1218
1219/*********************************************************************
1220 *
1221 * Interrupt Controller (INTC)
1222 *
1223 *********************************************************************/
1224
1225/* Register read/write macros */
1226#define MCF_INTC0_IPRH MCF_REG32(0xFC048000)
1227#define MCF_INTC0_IPRL MCF_REG32(0xFC048004)
1228#define MCF_INTC0_IMRH MCF_REG32(0xFC048008)
1229#define MCF_INTC0_IMRL MCF_REG32(0xFC04800C)
1230#define MCF_INTC0_INTFRCH MCF_REG32(0xFC048010)
1231#define MCF_INTC0_INTFRCL MCF_REG32(0xFC048014)
1232#define MCF_INTC0_ICONFIG MCF_REG16(0xFC04801A)
1233#define MCF_INTC0_SIMR MCF_REG08(0xFC04801C)
1234#define MCF_INTC0_CIMR MCF_REG08(0xFC04801D)
1235#define MCF_INTC0_CLMASK MCF_REG08(0xFC04801E)
1236#define MCF_INTC0_SLMASK MCF_REG08(0xFC04801F)
1237#define MCF_INTC0_ICR0 MCF_REG08(0xFC048040)
1238#define MCF_INTC0_ICR1 MCF_REG08(0xFC048041)
1239#define MCF_INTC0_ICR2 MCF_REG08(0xFC048042)
1240#define MCF_INTC0_ICR3 MCF_REG08(0xFC048043)
1241#define MCF_INTC0_ICR4 MCF_REG08(0xFC048044)
1242#define MCF_INTC0_ICR5 MCF_REG08(0xFC048045)
1243#define MCF_INTC0_ICR6 MCF_REG08(0xFC048046)
1244#define MCF_INTC0_ICR7 MCF_REG08(0xFC048047)
1245#define MCF_INTC0_ICR8 MCF_REG08(0xFC048048)
1246#define MCF_INTC0_ICR9 MCF_REG08(0xFC048049)
1247#define MCF_INTC0_ICR10 MCF_REG08(0xFC04804A)
1248#define MCF_INTC0_ICR11 MCF_REG08(0xFC04804B)
1249#define MCF_INTC0_ICR12 MCF_REG08(0xFC04804C)
1250#define MCF_INTC0_ICR13 MCF_REG08(0xFC04804D)
1251#define MCF_INTC0_ICR14 MCF_REG08(0xFC04804E)
1252#define MCF_INTC0_ICR15 MCF_REG08(0xFC04804F)
1253#define MCF_INTC0_ICR16 MCF_REG08(0xFC048050)
1254#define MCF_INTC0_ICR17 MCF_REG08(0xFC048051)
1255#define MCF_INTC0_ICR18 MCF_REG08(0xFC048052)
1256#define MCF_INTC0_ICR19 MCF_REG08(0xFC048053)
1257#define MCF_INTC0_ICR20 MCF_REG08(0xFC048054)
1258#define MCF_INTC0_ICR21 MCF_REG08(0xFC048055)
1259#define MCF_INTC0_ICR22 MCF_REG08(0xFC048056)
1260#define MCF_INTC0_ICR23 MCF_REG08(0xFC048057)
1261#define MCF_INTC0_ICR24 MCF_REG08(0xFC048058)
1262#define MCF_INTC0_ICR25 MCF_REG08(0xFC048059)
1263#define MCF_INTC0_ICR26 MCF_REG08(0xFC04805A)
1264#define MCF_INTC0_ICR27 MCF_REG08(0xFC04805B)
1265#define MCF_INTC0_ICR28 MCF_REG08(0xFC04805C)
1266#define MCF_INTC0_ICR29 MCF_REG08(0xFC04805D)
1267#define MCF_INTC0_ICR30 MCF_REG08(0xFC04805E)
1268#define MCF_INTC0_ICR31 MCF_REG08(0xFC04805F)
1269#define MCF_INTC0_ICR32 MCF_REG08(0xFC048060)
1270#define MCF_INTC0_ICR33 MCF_REG08(0xFC048061)
1271#define MCF_INTC0_ICR34 MCF_REG08(0xFC048062)
1272#define MCF_INTC0_ICR35 MCF_REG08(0xFC048063)
1273#define MCF_INTC0_ICR36 MCF_REG08(0xFC048064)
1274#define MCF_INTC0_ICR37 MCF_REG08(0xFC048065)
1275#define MCF_INTC0_ICR38 MCF_REG08(0xFC048066)
1276#define MCF_INTC0_ICR39 MCF_REG08(0xFC048067)
1277#define MCF_INTC0_ICR40 MCF_REG08(0xFC048068)
1278#define MCF_INTC0_ICR41 MCF_REG08(0xFC048069)
1279#define MCF_INTC0_ICR42 MCF_REG08(0xFC04806A)
1280#define MCF_INTC0_ICR43 MCF_REG08(0xFC04806B)
1281#define MCF_INTC0_ICR44 MCF_REG08(0xFC04806C)
1282#define MCF_INTC0_ICR45 MCF_REG08(0xFC04806D)
1283#define MCF_INTC0_ICR46 MCF_REG08(0xFC04806E)
1284#define MCF_INTC0_ICR47 MCF_REG08(0xFC04806F)
1285#define MCF_INTC0_ICR48 MCF_REG08(0xFC048070)
1286#define MCF_INTC0_ICR49 MCF_REG08(0xFC048071)
1287#define MCF_INTC0_ICR50 MCF_REG08(0xFC048072)
1288#define MCF_INTC0_ICR51 MCF_REG08(0xFC048073)
1289#define MCF_INTC0_ICR52 MCF_REG08(0xFC048074)
1290#define MCF_INTC0_ICR53 MCF_REG08(0xFC048075)
1291#define MCF_INTC0_ICR54 MCF_REG08(0xFC048076)
1292#define MCF_INTC0_ICR55 MCF_REG08(0xFC048077)
1293#define MCF_INTC0_ICR56 MCF_REG08(0xFC048078)
1294#define MCF_INTC0_ICR57 MCF_REG08(0xFC048079)
1295#define MCF_INTC0_ICR58 MCF_REG08(0xFC04807A)
1296#define MCF_INTC0_ICR59 MCF_REG08(0xFC04807B)
1297#define MCF_INTC0_ICR60 MCF_REG08(0xFC04807C)
1298#define MCF_INTC0_ICR61 MCF_REG08(0xFC04807D)
1299#define MCF_INTC0_ICR62 MCF_REG08(0xFC04807E)
1300#define MCF_INTC0_ICR63 MCF_REG08(0xFC04807F)
1301#define MCF_INTC0_ICR(x) MCF_REG08(0xFC048040+((x)*0x001))
1302#define MCF_INTC0_SWIACK MCF_REG08(0xFC0480E0)
1303#define MCF_INTC0_L1IACK MCF_REG08(0xFC0480E4)
1304#define MCF_INTC0_L2IACK MCF_REG08(0xFC0480E8)
1305#define MCF_INTC0_L3IACK MCF_REG08(0xFC0480EC)
1306#define MCF_INTC0_L4IACK MCF_REG08(0xFC0480F0)
1307#define MCF_INTC0_L5IACK MCF_REG08(0xFC0480F4)
1308#define MCF_INTC0_L6IACK MCF_REG08(0xFC0480F8)
1309#define MCF_INTC0_L7IACK MCF_REG08(0xFC0480FC)
1310#define MCF_INTC0_LIACK(x) MCF_REG08(0xFC0480E4+((x)*0x004))
1311#define MCF_INTC1_IPRH MCF_REG32(0xFC04C000)
1312#define MCF_INTC1_IPRL MCF_REG32(0xFC04C004)
1313#define MCF_INTC1_IMRH MCF_REG32(0xFC04C008)
1314#define MCF_INTC1_IMRL MCF_REG32(0xFC04C00C)
1315#define MCF_INTC1_INTFRCH MCF_REG32(0xFC04C010)
1316#define MCF_INTC1_INTFRCL MCF_REG32(0xFC04C014)
1317#define MCF_INTC1_ICONFIG MCF_REG16(0xFC04C01A)
1318#define MCF_INTC1_SIMR MCF_REG08(0xFC04C01C)
1319#define MCF_INTC1_CIMR MCF_REG08(0xFC04C01D)
1320#define MCF_INTC1_CLMASK MCF_REG08(0xFC04C01E)
1321#define MCF_INTC1_SLMASK MCF_REG08(0xFC04C01F)
1322#define MCF_INTC1_ICR0 MCF_REG08(0xFC04C040)
1323#define MCF_INTC1_ICR1 MCF_REG08(0xFC04C041)
1324#define MCF_INTC1_ICR2 MCF_REG08(0xFC04C042)
1325#define MCF_INTC1_ICR3 MCF_REG08(0xFC04C043)
1326#define MCF_INTC1_ICR4 MCF_REG08(0xFC04C044)
1327#define MCF_INTC1_ICR5 MCF_REG08(0xFC04C045)
1328#define MCF_INTC1_ICR6 MCF_REG08(0xFC04C046)
1329#define MCF_INTC1_ICR7 MCF_REG08(0xFC04C047)
1330#define MCF_INTC1_ICR8 MCF_REG08(0xFC04C048)
1331#define MCF_INTC1_ICR9 MCF_REG08(0xFC04C049)
1332#define MCF_INTC1_ICR10 MCF_REG08(0xFC04C04A)
1333#define MCF_INTC1_ICR11 MCF_REG08(0xFC04C04B)
1334#define MCF_INTC1_ICR12 MCF_REG08(0xFC04C04C)
1335#define MCF_INTC1_ICR13 MCF_REG08(0xFC04C04D)
1336#define MCF_INTC1_ICR14 MCF_REG08(0xFC04C04E)
1337#define MCF_INTC1_ICR15 MCF_REG08(0xFC04C04F)
1338#define MCF_INTC1_ICR16 MCF_REG08(0xFC04C050)
1339#define MCF_INTC1_ICR17 MCF_REG08(0xFC04C051)
1340#define MCF_INTC1_ICR18 MCF_REG08(0xFC04C052)
1341#define MCF_INTC1_ICR19 MCF_REG08(0xFC04C053)
1342#define MCF_INTC1_ICR20 MCF_REG08(0xFC04C054)
1343#define MCF_INTC1_ICR21 MCF_REG08(0xFC04C055)
1344#define MCF_INTC1_ICR22 MCF_REG08(0xFC04C056)
1345#define MCF_INTC1_ICR23 MCF_REG08(0xFC04C057)
1346#define MCF_INTC1_ICR24 MCF_REG08(0xFC04C058)
1347#define MCF_INTC1_ICR25 MCF_REG08(0xFC04C059)
1348#define MCF_INTC1_ICR26 MCF_REG08(0xFC04C05A)
1349#define MCF_INTC1_ICR27 MCF_REG08(0xFC04C05B)
1350#define MCF_INTC1_ICR28 MCF_REG08(0xFC04C05C)
1351#define MCF_INTC1_ICR29 MCF_REG08(0xFC04C05D)
1352#define MCF_INTC1_ICR30 MCF_REG08(0xFC04C05E)
1353#define MCF_INTC1_ICR31 MCF_REG08(0xFC04C05F)
1354#define MCF_INTC1_ICR32 MCF_REG08(0xFC04C060)
1355#define MCF_INTC1_ICR33 MCF_REG08(0xFC04C061)
1356#define MCF_INTC1_ICR34 MCF_REG08(0xFC04C062)
1357#define MCF_INTC1_ICR35 MCF_REG08(0xFC04C063)
1358#define MCF_INTC1_ICR36 MCF_REG08(0xFC04C064)
1359#define MCF_INTC1_ICR37 MCF_REG08(0xFC04C065)
1360#define MCF_INTC1_ICR38 MCF_REG08(0xFC04C066)
1361#define MCF_INTC1_ICR39 MCF_REG08(0xFC04C067)
1362#define MCF_INTC1_ICR40 MCF_REG08(0xFC04C068)
1363#define MCF_INTC1_ICR41 MCF_REG08(0xFC04C069)
1364#define MCF_INTC1_ICR42 MCF_REG08(0xFC04C06A)
1365#define MCF_INTC1_ICR43 MCF_REG08(0xFC04C06B)
1366#define MCF_INTC1_ICR44 MCF_REG08(0xFC04C06C)
1367#define MCF_INTC1_ICR45 MCF_REG08(0xFC04C06D)
1368#define MCF_INTC1_ICR46 MCF_REG08(0xFC04C06E)
1369#define MCF_INTC1_ICR47 MCF_REG08(0xFC04C06F)
1370#define MCF_INTC1_ICR48 MCF_REG08(0xFC04C070)
1371#define MCF_INTC1_ICR49 MCF_REG08(0xFC04C071)
1372#define MCF_INTC1_ICR50 MCF_REG08(0xFC04C072)
1373#define MCF_INTC1_ICR51 MCF_REG08(0xFC04C073)
1374#define MCF_INTC1_ICR52 MCF_REG08(0xFC04C074)
1375#define MCF_INTC1_ICR53 MCF_REG08(0xFC04C075)
1376#define MCF_INTC1_ICR54 MCF_REG08(0xFC04C076)
1377#define MCF_INTC1_ICR55 MCF_REG08(0xFC04C077)
1378#define MCF_INTC1_ICR56 MCF_REG08(0xFC04C078)
1379#define MCF_INTC1_ICR57 MCF_REG08(0xFC04C079)
1380#define MCF_INTC1_ICR58 MCF_REG08(0xFC04C07A)
1381#define MCF_INTC1_ICR59 MCF_REG08(0xFC04C07B)
1382#define MCF_INTC1_ICR60 MCF_REG08(0xFC04C07C)
1383#define MCF_INTC1_ICR61 MCF_REG08(0xFC04C07D)
1384#define MCF_INTC1_ICR62 MCF_REG08(0xFC04C07E)
1385#define MCF_INTC1_ICR63 MCF_REG08(0xFC04C07F)
1386#define MCF_INTC1_ICR(x) MCF_REG08(0xFC04C040+((x)*0x001))
1387#define MCF_INTC1_SWIACK MCF_REG08(0xFC04C0E0)
1388#define MCF_INTC1_L1IACK MCF_REG08(0xFC04C0E4)
1389#define MCF_INTC1_L2IACK MCF_REG08(0xFC04C0E8)
1390#define MCF_INTC1_L3IACK MCF_REG08(0xFC04C0EC)
1391#define MCF_INTC1_L4IACK MCF_REG08(0xFC04C0F0)
1392#define MCF_INTC1_L5IACK MCF_REG08(0xFC04C0F4)
1393#define MCF_INTC1_L6IACK MCF_REG08(0xFC04C0F8)
1394#define MCF_INTC1_L7IACK MCF_REG08(0xFC04C0FC)
1395#define MCF_INTC1_LIACK(x) MCF_REG08(0xFC04C0E4+((x)*0x004))
1396#define MCF_INTC_IPRH(x) MCF_REG32(0xFC048000+((x)*0x4000))
1397#define MCF_INTC_IPRL(x) MCF_REG32(0xFC048004+((x)*0x4000))
1398#define MCF_INTC_IMRH(x) MCF_REG32(0xFC048008+((x)*0x4000))
1399#define MCF_INTC_IMRL(x) MCF_REG32(0xFC04800C+((x)*0x4000))
1400#define MCF_INTC_INTFRCH(x) MCF_REG32(0xFC048010+((x)*0x4000))
1401#define MCF_INTC_INTFRCL(x) MCF_REG32(0xFC048014+((x)*0x4000))
1402#define MCF_INTC_ICONFIG(x) MCF_REG16(0xFC04801A+((x)*0x4000))
1403#define MCF_INTC_SIMR(x) MCF_REG08(0xFC04801C+((x)*0x4000))
1404#define MCF_INTC_CIMR(x) MCF_REG08(0xFC04801D+((x)*0x4000))
1405#define MCF_INTC_CLMASK(x) MCF_REG08(0xFC04801E+((x)*0x4000))
1406#define MCF_INTC_SLMASK(x) MCF_REG08(0xFC04801F+((x)*0x4000))
1407#define MCF_INTC_ICR0(x) MCF_REG08(0xFC048040+((x)*0x4000))
1408#define MCF_INTC_ICR1(x) MCF_REG08(0xFC048041+((x)*0x4000))
1409#define MCF_INTC_ICR2(x) MCF_REG08(0xFC048042+((x)*0x4000))
1410#define MCF_INTC_ICR3(x) MCF_REG08(0xFC048043+((x)*0x4000))
1411#define MCF_INTC_ICR4(x) MCF_REG08(0xFC048044+((x)*0x4000))
1412#define MCF_INTC_ICR5(x) MCF_REG08(0xFC048045+((x)*0x4000))
1413#define MCF_INTC_ICR6(x) MCF_REG08(0xFC048046+((x)*0x4000))
1414#define MCF_INTC_ICR7(x) MCF_REG08(0xFC048047+((x)*0x4000))
1415#define MCF_INTC_ICR8(x) MCF_REG08(0xFC048048+((x)*0x4000))
1416#define MCF_INTC_ICR9(x) MCF_REG08(0xFC048049+((x)*0x4000))
1417#define MCF_INTC_ICR10(x) MCF_REG08(0xFC04804A+((x)*0x4000))
1418#define MCF_INTC_ICR11(x) MCF_REG08(0xFC04804B+((x)*0x4000))
1419#define MCF_INTC_ICR12(x) MCF_REG08(0xFC04804C+((x)*0x4000))
1420#define MCF_INTC_ICR13(x) MCF_REG08(0xFC04804D+((x)*0x4000))
1421#define MCF_INTC_ICR14(x) MCF_REG08(0xFC04804E+((x)*0x4000))
1422#define MCF_INTC_ICR15(x) MCF_REG08(0xFC04804F+((x)*0x4000))
1423#define MCF_INTC_ICR16(x) MCF_REG08(0xFC048050+((x)*0x4000))
1424#define MCF_INTC_ICR17(x) MCF_REG08(0xFC048051+((x)*0x4000))
1425#define MCF_INTC_ICR18(x) MCF_REG08(0xFC048052+((x)*0x4000))
1426#define MCF_INTC_ICR19(x) MCF_REG08(0xFC048053+((x)*0x4000))
1427#define MCF_INTC_ICR20(x) MCF_REG08(0xFC048054+((x)*0x4000))
1428#define MCF_INTC_ICR21(x) MCF_REG08(0xFC048055+((x)*0x4000))
1429#define MCF_INTC_ICR22(x) MCF_REG08(0xFC048056+((x)*0x4000))
1430#define MCF_INTC_ICR23(x) MCF_REG08(0xFC048057+((x)*0x4000))
1431#define MCF_INTC_ICR24(x) MCF_REG08(0xFC048058+((x)*0x4000))
1432#define MCF_INTC_ICR25(x) MCF_REG08(0xFC048059+((x)*0x4000))
1433#define MCF_INTC_ICR26(x) MCF_REG08(0xFC04805A+((x)*0x4000))
1434#define MCF_INTC_ICR27(x) MCF_REG08(0xFC04805B+((x)*0x4000))
1435#define MCF_INTC_ICR28(x) MCF_REG08(0xFC04805C+((x)*0x4000))
1436#define MCF_INTC_ICR29(x) MCF_REG08(0xFC04805D+((x)*0x4000))
1437#define MCF_INTC_ICR30(x) MCF_REG08(0xFC04805E+((x)*0x4000))
1438#define MCF_INTC_ICR31(x) MCF_REG08(0xFC04805F+((x)*0x4000))
1439#define MCF_INTC_ICR32(x) MCF_REG08(0xFC048060+((x)*0x4000))
1440#define MCF_INTC_ICR33(x) MCF_REG08(0xFC048061+((x)*0x4000))
1441#define MCF_INTC_ICR34(x) MCF_REG08(0xFC048062+((x)*0x4000))
1442#define MCF_INTC_ICR35(x) MCF_REG08(0xFC048063+((x)*0x4000))
1443#define MCF_INTC_ICR36(x) MCF_REG08(0xFC048064+((x)*0x4000))
1444#define MCF_INTC_ICR37(x) MCF_REG08(0xFC048065+((x)*0x4000))
1445#define MCF_INTC_ICR38(x) MCF_REG08(0xFC048066+((x)*0x4000))
1446#define MCF_INTC_ICR39(x) MCF_REG08(0xFC048067+((x)*0x4000))
1447#define MCF_INTC_ICR40(x) MCF_REG08(0xFC048068+((x)*0x4000))
1448#define MCF_INTC_ICR41(x) MCF_REG08(0xFC048069+((x)*0x4000))
1449#define MCF_INTC_ICR42(x) MCF_REG08(0xFC04806A+((x)*0x4000))
1450#define MCF_INTC_ICR43(x) MCF_REG08(0xFC04806B+((x)*0x4000))
1451#define MCF_INTC_ICR44(x) MCF_REG08(0xFC04806C+((x)*0x4000))
1452#define MCF_INTC_ICR45(x) MCF_REG08(0xFC04806D+((x)*0x4000))
1453#define MCF_INTC_ICR46(x) MCF_REG08(0xFC04806E+((x)*0x4000))
1454#define MCF_INTC_ICR47(x) MCF_REG08(0xFC04806F+((x)*0x4000))
1455#define MCF_INTC_ICR48(x) MCF_REG08(0xFC048070+((x)*0x4000))
1456#define MCF_INTC_ICR49(x) MCF_REG08(0xFC048071+((x)*0x4000))
1457#define MCF_INTC_ICR50(x) MCF_REG08(0xFC048072+((x)*0x4000))
1458#define MCF_INTC_ICR51(x) MCF_REG08(0xFC048073+((x)*0x4000))
1459#define MCF_INTC_ICR52(x) MCF_REG08(0xFC048074+((x)*0x4000))
1460#define MCF_INTC_ICR53(x) MCF_REG08(0xFC048075+((x)*0x4000))
1461#define MCF_INTC_ICR54(x) MCF_REG08(0xFC048076+((x)*0x4000))
1462#define MCF_INTC_ICR55(x) MCF_REG08(0xFC048077+((x)*0x4000))
1463#define MCF_INTC_ICR56(x) MCF_REG08(0xFC048078+((x)*0x4000))
1464#define MCF_INTC_ICR57(x) MCF_REG08(0xFC048079+((x)*0x4000))
1465#define MCF_INTC_ICR58(x) MCF_REG08(0xFC04807A+((x)*0x4000))
1466#define MCF_INTC_ICR59(x) MCF_REG08(0xFC04807B+((x)*0x4000))
1467#define MCF_INTC_ICR60(x) MCF_REG08(0xFC04807C+((x)*0x4000))
1468#define MCF_INTC_ICR61(x) MCF_REG08(0xFC04807D+((x)*0x4000))
1469#define MCF_INTC_ICR62(x) MCF_REG08(0xFC04807E+((x)*0x4000))
1470#define MCF_INTC_ICR63(x) MCF_REG08(0xFC04807F+((x)*0x4000))
1471#define MCF_INTC_SWIACK(x) MCF_REG08(0xFC0480E0+((x)*0x4000))
1472#define MCF_INTC_L1IACK(x) MCF_REG08(0xFC0480E4+((x)*0x4000))
1473#define MCF_INTC_L2IACK(x) MCF_REG08(0xFC0480E8+((x)*0x4000))
1474#define MCF_INTC_L3IACK(x) MCF_REG08(0xFC0480EC+((x)*0x4000))
1475#define MCF_INTC_L4IACK(x) MCF_REG08(0xFC0480F0+((x)*0x4000))
1476#define MCF_INTC_L5IACK(x) MCF_REG08(0xFC0480F4+((x)*0x4000))
1477#define MCF_INTC_L6IACK(x) MCF_REG08(0xFC0480F8+((x)*0x4000))
1478#define MCF_INTC_L7IACK(x) MCF_REG08(0xFC0480FC+((x)*0x4000))
1479
1480/* Bit definitions and macros for MCF_INTC_IPRH */
1481#define MCF_INTC_IPRH_INT32 (0x00000001)
1482#define MCF_INTC_IPRH_INT33 (0x00000002)
1483#define MCF_INTC_IPRH_INT34 (0x00000004)
1484#define MCF_INTC_IPRH_INT35 (0x00000008)
1485#define MCF_INTC_IPRH_INT36 (0x00000010)
1486#define MCF_INTC_IPRH_INT37 (0x00000020)
1487#define MCF_INTC_IPRH_INT38 (0x00000040)
1488#define MCF_INTC_IPRH_INT39 (0x00000080)
1489#define MCF_INTC_IPRH_INT40 (0x00000100)
1490#define MCF_INTC_IPRH_INT41 (0x00000200)
1491#define MCF_INTC_IPRH_INT42 (0x00000400)
1492#define MCF_INTC_IPRH_INT43 (0x00000800)
1493#define MCF_INTC_IPRH_INT44 (0x00001000)
1494#define MCF_INTC_IPRH_INT45 (0x00002000)
1495#define MCF_INTC_IPRH_INT46 (0x00004000)
1496#define MCF_INTC_IPRH_INT47 (0x00008000)
1497#define MCF_INTC_IPRH_INT48 (0x00010000)
1498#define MCF_INTC_IPRH_INT49 (0x00020000)
1499#define MCF_INTC_IPRH_INT50 (0x00040000)
1500#define MCF_INTC_IPRH_INT51 (0x00080000)
1501#define MCF_INTC_IPRH_INT52 (0x00100000)
1502#define MCF_INTC_IPRH_INT53 (0x00200000)
1503#define MCF_INTC_IPRH_INT54 (0x00400000)
1504#define MCF_INTC_IPRH_INT55 (0x00800000)
1505#define MCF_INTC_IPRH_INT56 (0x01000000)
1506#define MCF_INTC_IPRH_INT57 (0x02000000)
1507#define MCF_INTC_IPRH_INT58 (0x04000000)
1508#define MCF_INTC_IPRH_INT59 (0x08000000)
1509#define MCF_INTC_IPRH_INT60 (0x10000000)
1510#define MCF_INTC_IPRH_INT61 (0x20000000)
1511#define MCF_INTC_IPRH_INT62 (0x40000000)
1512#define MCF_INTC_IPRH_INT63 (0x80000000)
1513
1514/* Bit definitions and macros for MCF_INTC_IPRL */
1515#define MCF_INTC_IPRL_INT0 (0x00000001)
1516#define MCF_INTC_IPRL_INT1 (0x00000002)
1517#define MCF_INTC_IPRL_INT2 (0x00000004)
1518#define MCF_INTC_IPRL_INT3 (0x00000008)
1519#define MCF_INTC_IPRL_INT4 (0x00000010)
1520#define MCF_INTC_IPRL_INT5 (0x00000020)
1521#define MCF_INTC_IPRL_INT6 (0x00000040)
1522#define MCF_INTC_IPRL_INT7 (0x00000080)
1523#define MCF_INTC_IPRL_INT8 (0x00000100)
1524#define MCF_INTC_IPRL_INT9 (0x00000200)
1525#define MCF_INTC_IPRL_INT10 (0x00000400)
1526#define MCF_INTC_IPRL_INT11 (0x00000800)
1527#define MCF_INTC_IPRL_INT12 (0x00001000)
1528#define MCF_INTC_IPRL_INT13 (0x00002000)
1529#define MCF_INTC_IPRL_INT14 (0x00004000)
1530#define MCF_INTC_IPRL_INT15 (0x00008000)
1531#define MCF_INTC_IPRL_INT16 (0x00010000)
1532#define MCF_INTC_IPRL_INT17 (0x00020000)
1533#define MCF_INTC_IPRL_INT18 (0x00040000)
1534#define MCF_INTC_IPRL_INT19 (0x00080000)
1535#define MCF_INTC_IPRL_INT20 (0x00100000)
1536#define MCF_INTC_IPRL_INT21 (0x00200000)
1537#define MCF_INTC_IPRL_INT22 (0x00400000)
1538#define MCF_INTC_IPRL_INT23 (0x00800000)
1539#define MCF_INTC_IPRL_INT24 (0x01000000)
1540#define MCF_INTC_IPRL_INT25 (0x02000000)
1541#define MCF_INTC_IPRL_INT26 (0x04000000)
1542#define MCF_INTC_IPRL_INT27 (0x08000000)
1543#define MCF_INTC_IPRL_INT28 (0x10000000)
1544#define MCF_INTC_IPRL_INT29 (0x20000000)
1545#define MCF_INTC_IPRL_INT30 (0x40000000)
1546#define MCF_INTC_IPRL_INT31 (0x80000000)
1547
1548/* Bit definitions and macros for MCF_INTC_IMRH */
1549#define MCF_INTC_IMRH_INT_MASK32 (0x00000001)
1550#define MCF_INTC_IMRH_INT_MASK33 (0x00000002)
1551#define MCF_INTC_IMRH_INT_MASK34 (0x00000004)
1552#define MCF_INTC_IMRH_INT_MASK35 (0x00000008)
1553#define MCF_INTC_IMRH_INT_MASK36 (0x00000010)
1554#define MCF_INTC_IMRH_INT_MASK37 (0x00000020)
1555#define MCF_INTC_IMRH_INT_MASK38 (0x00000040)
1556#define MCF_INTC_IMRH_INT_MASK39 (0x00000080)
1557#define MCF_INTC_IMRH_INT_MASK40 (0x00000100)
1558#define MCF_INTC_IMRH_INT_MASK41 (0x00000200)
1559#define MCF_INTC_IMRH_INT_MASK42 (0x00000400)
1560#define MCF_INTC_IMRH_INT_MASK43 (0x00000800)
1561#define MCF_INTC_IMRH_INT_MASK44 (0x00001000)
1562#define MCF_INTC_IMRH_INT_MASK45 (0x00002000)
1563#define MCF_INTC_IMRH_INT_MASK46 (0x00004000)
1564#define MCF_INTC_IMRH_INT_MASK47 (0x00008000)
1565#define MCF_INTC_IMRH_INT_MASK48 (0x00010000)
1566#define MCF_INTC_IMRH_INT_MASK49 (0x00020000)
1567#define MCF_INTC_IMRH_INT_MASK50 (0x00040000)
1568#define MCF_INTC_IMRH_INT_MASK51 (0x00080000)
1569#define MCF_INTC_IMRH_INT_MASK52 (0x00100000)
1570#define MCF_INTC_IMRH_INT_MASK53 (0x00200000)
1571#define MCF_INTC_IMRH_INT_MASK54 (0x00400000)
1572#define MCF_INTC_IMRH_INT_MASK55 (0x00800000)
1573#define MCF_INTC_IMRH_INT_MASK56 (0x01000000)
1574#define MCF_INTC_IMRH_INT_MASK57 (0x02000000)
1575#define MCF_INTC_IMRH_INT_MASK58 (0x04000000)
1576#define MCF_INTC_IMRH_INT_MASK59 (0x08000000)
1577#define MCF_INTC_IMRH_INT_MASK60 (0x10000000)
1578#define MCF_INTC_IMRH_INT_MASK61 (0x20000000)
1579#define MCF_INTC_IMRH_INT_MASK62 (0x40000000)
1580#define MCF_INTC_IMRH_INT_MASK63 (0x80000000)
1581
1582/* Bit definitions and macros for MCF_INTC_IMRL */
1583#define MCF_INTC_IMRL_INT_MASK0 (0x00000001)
1584#define MCF_INTC_IMRL_INT_MASK1 (0x00000002)
1585#define MCF_INTC_IMRL_INT_MASK2 (0x00000004)
1586#define MCF_INTC_IMRL_INT_MASK3 (0x00000008)
1587#define MCF_INTC_IMRL_INT_MASK4 (0x00000010)
1588#define MCF_INTC_IMRL_INT_MASK5 (0x00000020)
1589#define MCF_INTC_IMRL_INT_MASK6 (0x00000040)
1590#define MCF_INTC_IMRL_INT_MASK7 (0x00000080)
1591#define MCF_INTC_IMRL_INT_MASK8 (0x00000100)
1592#define MCF_INTC_IMRL_INT_MASK9 (0x00000200)
1593#define MCF_INTC_IMRL_INT_MASK10 (0x00000400)
1594#define MCF_INTC_IMRL_INT_MASK11 (0x00000800)
1595#define MCF_INTC_IMRL_INT_MASK12 (0x00001000)
1596#define MCF_INTC_IMRL_INT_MASK13 (0x00002000)
1597#define MCF_INTC_IMRL_INT_MASK14 (0x00004000)
1598#define MCF_INTC_IMRL_INT_MASK15 (0x00008000)
1599#define MCF_INTC_IMRL_INT_MASK16 (0x00010000)
1600#define MCF_INTC_IMRL_INT_MASK17 (0x00020000)
1601#define MCF_INTC_IMRL_INT_MASK18 (0x00040000)
1602#define MCF_INTC_IMRL_INT_MASK19 (0x00080000)
1603#define MCF_INTC_IMRL_INT_MASK20 (0x00100000)
1604#define MCF_INTC_IMRL_INT_MASK21 (0x00200000)
1605#define MCF_INTC_IMRL_INT_MASK22 (0x00400000)
1606#define MCF_INTC_IMRL_INT_MASK23 (0x00800000)
1607#define MCF_INTC_IMRL_INT_MASK24 (0x01000000)
1608#define MCF_INTC_IMRL_INT_MASK25 (0x02000000)
1609#define MCF_INTC_IMRL_INT_MASK26 (0x04000000)
1610#define MCF_INTC_IMRL_INT_MASK27 (0x08000000)
1611#define MCF_INTC_IMRL_INT_MASK28 (0x10000000)
1612#define MCF_INTC_IMRL_INT_MASK29 (0x20000000)
1613#define MCF_INTC_IMRL_INT_MASK30 (0x40000000)
1614#define MCF_INTC_IMRL_INT_MASK31 (0x80000000)
1615
1616/* Bit definitions and macros for MCF_INTC_INTFRCH */
1617#define MCF_INTC_INTFRCH_INTFRC32 (0x00000001)
1618#define MCF_INTC_INTFRCH_INTFRC33 (0x00000002)
1619#define MCF_INTC_INTFRCH_INTFRC34 (0x00000004)
1620#define MCF_INTC_INTFRCH_INTFRC35 (0x00000008)
1621#define MCF_INTC_INTFRCH_INTFRC36 (0x00000010)
1622#define MCF_INTC_INTFRCH_INTFRC37 (0x00000020)
1623#define MCF_INTC_INTFRCH_INTFRC38 (0x00000040)
1624#define MCF_INTC_INTFRCH_INTFRC39 (0x00000080)
1625#define MCF_INTC_INTFRCH_INTFRC40 (0x00000100)
1626#define MCF_INTC_INTFRCH_INTFRC41 (0x00000200)
1627#define MCF_INTC_INTFRCH_INTFRC42 (0x00000400)
1628#define MCF_INTC_INTFRCH_INTFRC43 (0x00000800)
1629#define MCF_INTC_INTFRCH_INTFRC44 (0x00001000)
1630#define MCF_INTC_INTFRCH_INTFRC45 (0x00002000)
1631#define MCF_INTC_INTFRCH_INTFRC46 (0x00004000)
1632#define MCF_INTC_INTFRCH_INTFRC47 (0x00008000)
1633#define MCF_INTC_INTFRCH_INTFRC48 (0x00010000)
1634#define MCF_INTC_INTFRCH_INTFRC49 (0x00020000)
1635#define MCF_INTC_INTFRCH_INTFRC50 (0x00040000)
1636#define MCF_INTC_INTFRCH_INTFRC51 (0x00080000)
1637#define MCF_INTC_INTFRCH_INTFRC52 (0x00100000)
1638#define MCF_INTC_INTFRCH_INTFRC53 (0x00200000)
1639#define MCF_INTC_INTFRCH_INTFRC54 (0x00400000)
1640#define MCF_INTC_INTFRCH_INTFRC55 (0x00800000)
1641#define MCF_INTC_INTFRCH_INTFRC56 (0x01000000)
1642#define MCF_INTC_INTFRCH_INTFRC57 (0x02000000)
1643#define MCF_INTC_INTFRCH_INTFRC58 (0x04000000)
1644#define MCF_INTC_INTFRCH_INTFRC59 (0x08000000)
1645#define MCF_INTC_INTFRCH_INTFRC60 (0x10000000)
1646#define MCF_INTC_INTFRCH_INTFRC61 (0x20000000)
1647#define MCF_INTC_INTFRCH_INTFRC62 (0x40000000)
1648#define MCF_INTC_INTFRCH_INTFRC63 (0x80000000)
1649
1650/* Bit definitions and macros for MCF_INTC_INTFRCL */
1651#define MCF_INTC_INTFRCL_INTFRC0 (0x00000001)
1652#define MCF_INTC_INTFRCL_INTFRC1 (0x00000002)
1653#define MCF_INTC_INTFRCL_INTFRC2 (0x00000004)
1654#define MCF_INTC_INTFRCL_INTFRC3 (0x00000008)
1655#define MCF_INTC_INTFRCL_INTFRC4 (0x00000010)
1656#define MCF_INTC_INTFRCL_INTFRC5 (0x00000020)
1657#define MCF_INTC_INTFRCL_INTFRC6 (0x00000040)
1658#define MCF_INTC_INTFRCL_INTFRC7 (0x00000080)
1659#define MCF_INTC_INTFRCL_INTFRC8 (0x00000100)
1660#define MCF_INTC_INTFRCL_INTFRC9 (0x00000200)
1661#define MCF_INTC_INTFRCL_INTFRC10 (0x00000400)
1662#define MCF_INTC_INTFRCL_INTFRC11 (0x00000800)
1663#define MCF_INTC_INTFRCL_INTFRC12 (0x00001000)
1664#define MCF_INTC_INTFRCL_INTFRC13 (0x00002000)
1665#define MCF_INTC_INTFRCL_INTFRC14 (0x00004000)
1666#define MCF_INTC_INTFRCL_INTFRC15 (0x00008000)
1667#define MCF_INTC_INTFRCL_INTFRC16 (0x00010000)
1668#define MCF_INTC_INTFRCL_INTFRC17 (0x00020000)
1669#define MCF_INTC_INTFRCL_INTFRC18 (0x00040000)
1670#define MCF_INTC_INTFRCL_INTFRC19 (0x00080000)
1671#define MCF_INTC_INTFRCL_INTFRC20 (0x00100000)
1672#define MCF_INTC_INTFRCL_INTFRC21 (0x00200000)
1673#define MCF_INTC_INTFRCL_INTFRC22 (0x00400000)
1674#define MCF_INTC_INTFRCL_INTFRC23 (0x00800000)
1675#define MCF_INTC_INTFRCL_INTFRC24 (0x01000000)
1676#define MCF_INTC_INTFRCL_INTFRC25 (0x02000000)
1677#define MCF_INTC_INTFRCL_INTFRC26 (0x04000000)
1678#define MCF_INTC_INTFRCL_INTFRC27 (0x08000000)
1679#define MCF_INTC_INTFRCL_INTFRC28 (0x10000000)
1680#define MCF_INTC_INTFRCL_INTFRC29 (0x20000000)
1681#define MCF_INTC_INTFRCL_INTFRC30 (0x40000000)
1682#define MCF_INTC_INTFRCL_INTFRC31 (0x80000000)
1683
1684/* Bit definitions and macros for MCF_INTC_ICONFIG */
1685#define MCF_INTC_ICONFIG_EMASK (0x0020)
1686#define MCF_INTC_ICONFIG_ELVLPRI1 (0x0200)
1687#define MCF_INTC_ICONFIG_ELVLPRI2 (0x0400)
1688#define MCF_INTC_ICONFIG_ELVLPRI3 (0x0800)
1689#define MCF_INTC_ICONFIG_ELVLPRI4 (0x1000)
1690#define MCF_INTC_ICONFIG_ELVLPRI5 (0x2000)
1691#define MCF_INTC_ICONFIG_ELVLPRI6 (0x4000)
1692#define MCF_INTC_ICONFIG_ELVLPRI7 (0x8000)
1693
1694/* Bit definitions and macros for MCF_INTC_SIMR */
1695#define MCF_INTC_SIMR_SIMR(x) (((x)&0x7F)<<0)
1696
1697/* Bit definitions and macros for MCF_INTC_CIMR */
1698#define MCF_INTC_CIMR_CIMR(x) (((x)&0x7F)<<0)
1699
1700/* Bit definitions and macros for MCF_INTC_CLMASK */
1701#define MCF_INTC_CLMASK_CLMASK(x) (((x)&0x0F)<<0)
1702
1703/* Bit definitions and macros for MCF_INTC_SLMASK */
1704#define MCF_INTC_SLMASK_SLMASK(x) (((x)&0x0F)<<0)
1705
1706/* Bit definitions and macros for MCF_INTC_ICR */
1707#define MCF_INTC_ICR_IL(x) (((x)&0x07)<<0)
1708
1709/* Bit definitions and macros for MCF_INTC_SWIACK */
1710#define MCF_INTC_SWIACK_VECTOR(x) (((x)&0xFF)<<0)
1711
1712/* Bit definitions and macros for MCF_INTC_LIACK */
1713#define MCF_INTC_LIACK_VECTOR(x) (((x)&0xFF)<<0)
1714
1715/********************************************************************/
1716/*********************************************************************
1717*
1718* LCD Controller (LCDC)
1719*
1720*********************************************************************/
1721
1722/* Register read/write macros */
1723#define MCF_LCDC_LSSAR MCF_REG32(0xFC0AC000)
1724#define MCF_LCDC_LSR MCF_REG32(0xFC0AC004)
1725#define MCF_LCDC_LVPWR MCF_REG32(0xFC0AC008)
1726#define MCF_LCDC_LCPR MCF_REG32(0xFC0AC00C)
1727#define MCF_LCDC_LCWHBR MCF_REG32(0xFC0AC010)
1728#define MCF_LCDC_LCCMR MCF_REG32(0xFC0AC014)
1729#define MCF_LCDC_LPCR MCF_REG32(0xFC0AC018)
1730#define MCF_LCDC_LHCR MCF_REG32(0xFC0AC01C)
1731#define MCF_LCDC_LVCR MCF_REG32(0xFC0AC020)
1732#define MCF_LCDC_LPOR MCF_REG32(0xFC0AC024)
1733#define MCF_LCDC_LSCR MCF_REG32(0xFC0AC028)
1734#define MCF_LCDC_LPCCR MCF_REG32(0xFC0AC02C)
1735#define MCF_LCDC_LDCR MCF_REG32(0xFC0AC030)
1736#define MCF_LCDC_LRMCR MCF_REG32(0xFC0AC034)
1737#define MCF_LCDC_LICR MCF_REG32(0xFC0AC038)
1738#define MCF_LCDC_LIER MCF_REG32(0xFC0AC03C)
1739#define MCF_LCDC_LISR MCF_REG32(0xFC0AC040)
1740#define MCF_LCDC_LGWSAR MCF_REG32(0xFC0AC050)
1741#define MCF_LCDC_LGWSR MCF_REG32(0xFC0AC054)
1742#define MCF_LCDC_LGWVPWR MCF_REG32(0xFC0AC058)
1743#define MCF_LCDC_LGWPOR MCF_REG32(0xFC0AC05C)
1744#define MCF_LCDC_LGWPR MCF_REG32(0xFC0AC060)
1745#define MCF_LCDC_LGWCR MCF_REG32(0xFC0AC064)
1746#define MCF_LCDC_LGWDCR MCF_REG32(0xFC0AC068)
1747#define MCF_LCDC_BPLUT_BASE MCF_REG32(0xFC0AC800)
1748#define MCF_LCDC_GWLUT_BASE MCF_REG32(0xFC0ACC00)
1749
1750/* Bit definitions and macros for MCF_LCDC_LSSAR */
1751#define MCF_LCDC_LSSAR_SSA(x) (((x)&0x3FFFFFFF)<<2)
1752
1753/* Bit definitions and macros for MCF_LCDC_LSR */
1754#define MCF_LCDC_LSR_YMAX(x) (((x)&0x000003FF)<<0)
1755#define MCF_LCDC_LSR_XMAX(x) (((x)&0x0000003F)<<20)
1756
1757/* Bit definitions and macros for MCF_LCDC_LVPWR */
1758#define MCF_LCDC_LVPWR_VPW(x) (((x)&0x000003FF)<<0)
1759
1760/* Bit definitions and macros for MCF_LCDC_LCPR */
1761#define MCF_LCDC_LCPR_CYP(x) (((x)&0x000003FF)<<0)
1762#define MCF_LCDC_LCPR_CXP(x) (((x)&0x000003FF)<<16)
1763#define MCF_LCDC_LCPR_OP (0x10000000)
1764#define MCF_LCDC_LCPR_CC(x) (((x)&0x00000003)<<30)
1765#define MCF_LCDC_LCPR_CC_TRANSPARENT (0x00000000)
1766#define MCF_LCDC_LCPR_CC_OR (0x40000000)
1767#define MCF_LCDC_LCPR_CC_XOR (0x80000000)
1768#define MCF_LCDC_LCPR_CC_AND (0xC0000000)
1769#define MCF_LCDC_LCPR_OP_ON (0x10000000)
1770#define MCF_LCDC_LCPR_OP_OFF (0x00000000)
1771
1772/* Bit definitions and macros for MCF_LCDC_LCWHBR */
1773#define MCF_LCDC_LCWHBR_BD(x) (((x)&0x000000FF)<<0)
1774#define MCF_LCDC_LCWHBR_CH(x) (((x)&0x0000001F)<<16)
1775#define MCF_LCDC_LCWHBR_CW(x) (((x)&0x0000001F)<<24)
1776#define MCF_LCDC_LCWHBR_BK_EN (0x80000000)
1777#define MCF_LCDC_LCWHBR_BK_EN_ON (0x80000000)
1778#define MCF_LCDC_LCWHBR_BK_EN_OFF (0x00000000)
1779
1780/* Bit definitions and macros for MCF_LCDC_LCCMR */
1781#define MCF_LCDC_LCCMR_CUR_COL_B(x) (((x)&0x0000003F)<<0)
1782#define MCF_LCDC_LCCMR_CUR_COL_G(x) (((x)&0x0000003F)<<6)
1783#define MCF_LCDC_LCCMR_CUR_COL_R(x) (((x)&0x0000003F)<<12)
1784
1785/* Bit definitions and macros for MCF_LCDC_LPCR */
1786#define MCF_LCDC_LPCR_PCD(x) (((x)&0x0000003F)<<0)
1787#define MCF_LCDC_LPCR_SHARP (0x00000040)
1788#define MCF_LCDC_LPCR_SCLKSEL (0x00000080)
1789#define MCF_LCDC_LPCR_ACD(x) (((x)&0x0000007F)<<8)
1790#define MCF_LCDC_LPCR_ACDSEL (0x00008000)
1791#define MCF_LCDC_LPCR_REV_VS (0x00010000)
1792#define MCF_LCDC_LPCR_SWAP_SEL (0x00020000)
1793#define MCF_LCDC_LPCR_ENDSEL (0x00040000)
1794#define MCF_LCDC_LPCR_SCLKIDLE (0x00080000)
1795#define MCF_LCDC_LPCR_OEPOL (0x00100000)
1796#define MCF_LCDC_LPCR_CLKPOL (0x00200000)
1797#define MCF_LCDC_LPCR_LPPOL (0x00400000)
1798#define MCF_LCDC_LPCR_FLM (0x00800000)
1799#define MCF_LCDC_LPCR_PIXPOL (0x01000000)
1800#define MCF_LCDC_LPCR_BPIX(x) (((x)&0x00000007)<<25)
1801#define MCF_LCDC_LPCR_PBSIZ(x) (((x)&0x00000003)<<28)
1802#define MCF_LCDC_LPCR_COLOR (0x40000000)
1803#define MCF_LCDC_LPCR_TFT (0x80000000)
1804#define MCF_LCDC_LPCR_MODE_MONOCGROME (0x00000000)
1805#define MCF_LCDC_LPCR_MODE_CSTN (0x40000000)
1806#define MCF_LCDC_LPCR_MODE_TFT (0xC0000000)
1807#define MCF_LCDC_LPCR_PBSIZ_1 (0x00000000)
1808#define MCF_LCDC_LPCR_PBSIZ_2 (0x10000000)
1809#define MCF_LCDC_LPCR_PBSIZ_4 (0x20000000)
1810#define MCF_LCDC_LPCR_PBSIZ_8 (0x30000000)
1811#define MCF_LCDC_LPCR_BPIX_1bpp (0x00000000)
1812#define MCF_LCDC_LPCR_BPIX_2bpp (0x02000000)
1813#define MCF_LCDC_LPCR_BPIX_4bpp (0x04000000)
1814#define MCF_LCDC_LPCR_BPIX_8bpp (0x06000000)
1815#define MCF_LCDC_LPCR_BPIX_12bpp (0x08000000)
1816#define MCF_LCDC_LPCR_BPIX_16bpp (0x0A000000)
1817#define MCF_LCDC_LPCR_BPIX_18bpp (0x0C000000)
1818
1819#define MCF_LCDC_LPCR_PANEL_TYPE(x) (((x)&0x00000003)<<30)
1820
1821/* Bit definitions and macros for MCF_LCDC_LHCR */
1822#define MCF_LCDC_LHCR_H_WAIT_2(x) (((x)&0x000000FF)<<0)
1823#define MCF_LCDC_LHCR_H_WAIT_1(x) (((x)&0x000000FF)<<8)
1824#define MCF_LCDC_LHCR_H_WIDTH(x) (((x)&0x0000003F)<<26)
1825
1826/* Bit definitions and macros for MCF_LCDC_LVCR */
1827#define MCF_LCDC_LVCR_V_WAIT_2(x) (((x)&0x000000FF)<<0)
1828#define MCF_LCDC_LVCR_V_WAIT_1(x) (((x)&0x000000FF)<<8)
1829#define MCF_LCDC_LVCR_V_WIDTH(x) (((x)&0x0000003F)<<26)
1830
1831/* Bit definitions and macros for MCF_LCDC_LPOR */
1832#define MCF_LCDC_LPOR_POS(x) (((x)&0x0000001F)<<0)
1833
1834/* Bit definitions and macros for MCF_LCDC_LPCCR */
1835#define MCF_LCDC_LPCCR_PW(x) (((x)&0x000000FF)<<0)
1836#define MCF_LCDC_LPCCR_CC_EN (0x00000100)
1837#define MCF_LCDC_LPCCR_SCR(x) (((x)&0x00000003)<<9)
1838#define MCF_LCDC_LPCCR_LDMSK (0x00008000)
1839#define MCF_LCDC_LPCCR_CLS_HI_WIDTH(x) (((x)&0x000001FF)<<16)
1840#define MCF_LCDC_LPCCR_SCR_LINEPULSE (0x00000000)
1841#define MCF_LCDC_LPCCR_SCR_PIXELCLK (0x00002000)
1842#define MCF_LCDC_LPCCR_SCR_LCDCLOCK (0x00004000)
1843
1844/* Bit definitions and macros for MCF_LCDC_LDCR */
1845#define MCF_LCDC_LDCR_TM(x) (((x)&0x0000001F)<<0)
1846#define MCF_LCDC_LDCR_HM(x) (((x)&0x0000001F)<<16)
1847#define MCF_LCDC_LDCR_BURST (0x80000000)
1848
1849/* Bit definitions and macros for MCF_LCDC_LRMCR */
1850#define MCF_LCDC_LRMCR_SEL_REF (0x00000001)
1851
1852/* Bit definitions and macros for MCF_LCDC_LICR */
1853#define MCF_LCDC_LICR_INTCON (0x00000001)
1854#define MCF_LCDC_LICR_INTSYN (0x00000004)
1855#define MCF_LCDC_LICR_GW_INT_CON (0x00000010)
1856
1857/* Bit definitions and macros for MCF_LCDC_LIER */
1858#define MCF_LCDC_LIER_BOF_EN (0x00000001)
1859#define MCF_LCDC_LIER_EOF_EN (0x00000002)
1860#define MCF_LCDC_LIER_ERR_RES_EN (0x00000004)
1861#define MCF_LCDC_LIER_UDR_ERR_EN (0x00000008)
1862#define MCF_LCDC_LIER_GW_BOF_EN (0x00000010)
1863#define MCF_LCDC_LIER_GW_EOF_EN (0x00000020)
1864#define MCF_LCDC_LIER_GW_ERR_RES_EN (0x00000040)
1865#define MCF_LCDC_LIER_GW_UDR_ERR_EN (0x00000080)
1866
1867/* Bit definitions and macros for MCF_LCDC_LISR */
1868#define MCF_LCDC_LISR_BOF (0x00000001)
1869#define MCF_LCDC_LISR_EOF (0x00000002)
1870#define MCF_LCDC_LISR_ERR_RES (0x00000004)
1871#define MCF_LCDC_LISR_UDR_ERR (0x00000008)
1872#define MCF_LCDC_LISR_GW_BOF (0x00000010)
1873#define MCF_LCDC_LISR_GW_EOF (0x00000020)
1874#define MCF_LCDC_LISR_GW_ERR_RES (0x00000040)
1875#define MCF_LCDC_LISR_GW_UDR_ERR (0x00000080)
1876
1877/* Bit definitions and macros for MCF_LCDC_LGWSAR */
1878#define MCF_LCDC_LGWSAR_GWSA(x) (((x)&0x3FFFFFFF)<<2)
1879
1880/* Bit definitions and macros for MCF_LCDC_LGWSR */
1881#define MCF_LCDC_LGWSR_GWH(x) (((x)&0x000003FF)<<0)
1882#define MCF_LCDC_LGWSR_GWW(x) (((x)&0x0000003F)<<20)
1883
1884/* Bit definitions and macros for MCF_LCDC_LGWVPWR */
1885#define MCF_LCDC_LGWVPWR_GWVPW(x) (((x)&0x000003FF)<<0)
1886
1887/* Bit definitions and macros for MCF_LCDC_LGWPOR */
1888#define MCF_LCDC_LGWPOR_GWPO(x) (((x)&0x0000001F)<<0)
1889
1890/* Bit definitions and macros for MCF_LCDC_LGWPR */
1891#define MCF_LCDC_LGWPR_GWYP(x) (((x)&0x000003FF)<<0)
1892#define MCF_LCDC_LGWPR_GWXP(x) (((x)&0x000003FF)<<16)
1893
1894/* Bit definitions and macros for MCF_LCDC_LGWCR */
1895#define MCF_LCDC_LGWCR_GWCKB(x) (((x)&0x0000003F)<<0)
1896#define MCF_LCDC_LGWCR_GWCKG(x) (((x)&0x0000003F)<<6)
1897#define MCF_LCDC_LGWCR_GWCKR(x) (((x)&0x0000003F)<<12)
1898#define MCF_LCDC_LGWCR_GW_RVS (0x00200000)
1899#define MCF_LCDC_LGWCR_GWE (0x00400000)
1900#define MCF_LCDC_LGWCR_GWCKE (0x00800000)
1901#define MCF_LCDC_LGWCR_GWAV(x) (((x)&0x000000FF)<<24)
1902
1903/* Bit definitions and macros for MCF_LCDC_LGWDCR */
1904#define MCF_LCDC_LGWDCR_GWTM(x) (((x)&0x0000001F)<<0)
1905#define MCF_LCDC_LGWDCR_GWHM(x) (((x)&0x0000001F)<<16)
1906#define MCF_LCDC_LGWDCR_GWBT (0x80000000)
1907
1908/* Bit definitions and macros for MCF_LCDC_LSCR */
1909#define MCF_LCDC_LSCR_PS_RISE_DELAY(x) (((x)&0x0000003F)<<26)
1910#define MCF_LCDC_LSCR_CLS_RISE_DELAY(x) (((x)&0x000000FF)<<16)
1911#define MCF_LCDC_LSCR_REV_TOGGLE_DELAY(x) (((x)&0x0000000F)<<8)
1912#define MCF_LCDC_LSCR_GRAY_2(x) (((x)&0x0000000F)<<4)
1913#define MCF_LCDC_LSCR_GRAY_1(x) (((x)&0x0000000F)<<0)
1914
1915/* Bit definitions and macros for MCF_LCDC_BPLUT_BASE */
1916#define MCF_LCDC_BPLUT_BASE_BASE(x) (((x)&0xFFFFFFFF)<<0)
1917
1918/* Bit definitions and macros for MCF_LCDC_GWLUT_BASE */
1919#define MCF_LCDC_GWLUT_BASE_BASE(x) (((x)&0xFFFFFFFF)<<0)
1920
1921/********************************************************************* 1103/*********************************************************************
1922 * 1104 *
1923 * Phase Locked Loop (PLL) 1105 * Phase Locked Loop (PLL)
@@ -1925,10 +1107,10 @@
1925 *********************************************************************/ 1107 *********************************************************************/
1926 1108
1927/* Register read/write macros */ 1109/* Register read/write macros */
1928#define MCF_PLL_PODR MCF_REG08(0xFC0C0000) 1110#define MCF_PLL_PODR 0xFC0C0000
1929#define MCF_PLL_PLLCR MCF_REG08(0xFC0C0004) 1111#define MCF_PLL_PLLCR 0xFC0C0004
1930#define MCF_PLL_PMDR MCF_REG08(0xFC0C0008) 1112#define MCF_PLL_PMDR 0xFC0C0008
1931#define MCF_PLL_PFDR MCF_REG08(0xFC0C000C) 1113#define MCF_PLL_PFDR 0xFC0C000C
1932 1114
1933/* Bit definitions and macros for MCF_PLL_PODR */ 1115/* Bit definitions and macros for MCF_PLL_PODR */
1934#define MCF_PLL_PODR_BUSDIV(x) (((x)&0x0F)<<0) 1116#define MCF_PLL_PODR_BUSDIV(x) (((x)&0x0F)<<0)
@@ -1951,15 +1133,15 @@
1951 *********************************************************************/ 1133 *********************************************************************/
1952 1134
1953/* Register read/write macros */ 1135/* Register read/write macros */
1954#define MCF_SCM_MPR MCF_REG32(0xFC000000) 1136#define MCF_SCM_MPR 0xFC000000
1955#define MCF_SCM_PACRA MCF_REG32(0xFC000020) 1137#define MCF_SCM_PACRA 0xFC000020
1956#define MCF_SCM_PACRB MCF_REG32(0xFC000024) 1138#define MCF_SCM_PACRB 0xFC000024
1957#define MCF_SCM_PACRC MCF_REG32(0xFC000028) 1139#define MCF_SCM_PACRC 0xFC000028
1958#define MCF_SCM_PACRD MCF_REG32(0xFC00002C) 1140#define MCF_SCM_PACRD 0xFC00002C
1959#define MCF_SCM_PACRE MCF_REG32(0xFC000040) 1141#define MCF_SCM_PACRE 0xFC000040
1960#define MCF_SCM_PACRF MCF_REG32(0xFC000044) 1142#define MCF_SCM_PACRF 0xFC000044
1961 1143
1962#define MCF_SCM_BCR MCF_REG32(0xFC040024) 1144#define MCF_SCM_BCR 0xFC040024
1963 1145
1964/********************************************************************* 1146/*********************************************************************
1965 * 1147 *
@@ -1968,17 +1150,16 @@
1968 *********************************************************************/ 1150 *********************************************************************/
1969 1151
1970/* Register read/write macros */ 1152/* Register read/write macros */
1971#define MCF_SDRAMC_SDMR MCF_REG32(0xFC0B8000) 1153#define MCF_SDRAMC_SDMR 0xFC0B8000
1972#define MCF_SDRAMC_SDCR MCF_REG32(0xFC0B8004) 1154#define MCF_SDRAMC_SDCR 0xFC0B8004
1973#define MCF_SDRAMC_SDCFG1 MCF_REG32(0xFC0B8008) 1155#define MCF_SDRAMC_SDCFG1 0xFC0B8008
1974#define MCF_SDRAMC_SDCFG2 MCF_REG32(0xFC0B800C) 1156#define MCF_SDRAMC_SDCFG2 0xFC0B800C
1975#define MCF_SDRAMC_LIMP_FIX MCF_REG32(0xFC0B8080) 1157#define MCF_SDRAMC_LIMP_FIX 0xFC0B8080
1976#define MCF_SDRAMC_SDDS MCF_REG32(0xFC0B8100) 1158#define MCF_SDRAMC_SDDS 0xFC0B8100
1977#define MCF_SDRAMC_SDCS0 MCF_REG32(0xFC0B8110) 1159#define MCF_SDRAMC_SDCS0 0xFC0B8110
1978#define MCF_SDRAMC_SDCS1 MCF_REG32(0xFC0B8114) 1160#define MCF_SDRAMC_SDCS1 0xFC0B8114
1979#define MCF_SDRAMC_SDCS2 MCF_REG32(0xFC0B8118) 1161#define MCF_SDRAMC_SDCS2 0xFC0B8118
1980#define MCF_SDRAMC_SDCS3 MCF_REG32(0xFC0B811C) 1162#define MCF_SDRAMC_SDCS3 0xFC0B811C
1981#define MCF_SDRAMC_SDCS(x) MCF_REG32(0xFC0B8110+((x)*0x004))
1982 1163
1983/* Bit definitions and macros for MCF_SDRAMC_SDMR */ 1164/* Bit definitions and macros for MCF_SDRAMC_SDMR */
1984#define MCF_SDRAMC_SDMR_CMD (0x00010000) 1165#define MCF_SDRAMC_SDMR_CMD (0x00010000)
@@ -2046,143 +1227,9 @@
2046#define MCF_SDRAMC_SDCS_CSSZ_2GBYTE (0x0000001E) 1227#define MCF_SDRAMC_SDCS_CSSZ_2GBYTE (0x0000001E)
2047#define MCF_SDRAMC_SDCS_CSSZ_4GBYTE (0x0000001F) 1228#define MCF_SDRAMC_SDCS_CSSZ_4GBYTE (0x0000001F)
2048 1229
2049/*********************************************************************
2050 *
2051 * FlexCAN module registers
2052 *
2053 *********************************************************************/
2054#define MCF_FLEXCAN_BASEADDR(x) (0xFC020000+(x)*0x0800)
2055#define MCF_FLEXCAN_CANMCR(x) MCF_REG32(0xFC020000+(x)*0x0800+0x00)
2056#define MCF_FLEXCAN_CANCTRL(x) MCF_REG32(0xFC020000+(x)*0x0800+0x04)
2057#define MCF_FLEXCAN_TIMER(x) MCF_REG32(0xFC020000+(x)*0x0800+0x08)
2058#define MCF_FLEXCAN_RXGMASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x10)
2059#define MCF_FLEXCAN_RX14MASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x14)
2060#define MCF_FLEXCAN_RX15MASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x18)
2061#define MCF_FLEXCAN_ERRCNT(x) MCF_REG32(0xFC020000+(x)*0x0800+0x1C)
2062#define MCF_FLEXCAN_ERRSTAT(x) MCF_REG32(0xFC020000+(x)*0x0800+0x20)
2063#define MCF_FLEXCAN_IMASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x28)
2064#define MCF_FLEXCAN_IFLAG(x) MCF_REG32(0xFC020000+(x)*0x0800+0x30)
2065
2066#define MCF_FLEXCAN_MB_CNT(x,y) MCF_REG32(0xFC020080+(x)*0x0800+(y)*0x10+0x0)
2067#define MCF_FLEXCAN_MB_ID(x,y) MCF_REG32(0xFC020080+(x)*0x0800+(y)*0x10+0x4)
2068#define MCF_FLEXCAN_MB_DB(x,y,z) MCF_REG08(0xFC020080+(x)*0x0800+(y)*0x10+0x8+(z)*0x1)
2069
2070/*
2071 * FlexCAN Module Configuration Register
2072 */
2073#define CANMCR_MDIS (0x80000000)
2074#define CANMCR_FRZ (0x40000000)
2075#define CANMCR_HALT (0x10000000)
2076#define CANMCR_SOFTRST (0x02000000)
2077#define CANMCR_FRZACK (0x01000000)
2078#define CANMCR_SUPV (0x00800000)
2079#define CANMCR_MAXMB(x) ((x)&0x0F)
2080
2081/*
2082 * FlexCAN Control Register
2083 */
2084#define CANCTRL_PRESDIV(x) (((x)&0xFF)<<24)
2085#define CANCTRL_RJW(x) (((x)&0x03)<<22)
2086#define CANCTRL_PSEG1(x) (((x)&0x07)<<19)
2087#define CANCTRL_PSEG2(x) (((x)&0x07)<<16)
2088#define CANCTRL_BOFFMSK (0x00008000)
2089#define CANCTRL_ERRMSK (0x00004000)
2090#define CANCTRL_CLKSRC (0x00002000)
2091#define CANCTRL_LPB (0x00001000)
2092#define CANCTRL_SAMP (0x00000080)
2093#define CANCTRL_BOFFREC (0x00000040)
2094#define CANCTRL_TSYNC (0x00000020)
2095#define CANCTRL_LBUF (0x00000010)
2096#define CANCTRL_LOM (0x00000008)
2097#define CANCTRL_PROPSEG(x) ((x)&0x07)
2098
2099/*
2100 * FlexCAN Error Counter Register
2101 */
2102#define ERRCNT_RXECTR(x) (((x)&0xFF)<<8)
2103#define ERRCNT_TXECTR(x) ((x)&0xFF)
2104
2105/*
2106 * FlexCAN Error and Status Register
2107 */
2108#define ERRSTAT_BITERR(x) (((x)&0x03)<<14)
2109#define ERRSTAT_ACKERR (0x00002000)
2110#define ERRSTAT_CRCERR (0x00001000)
2111#define ERRSTAT_FRMERR (0x00000800)
2112#define ERRSTAT_STFERR (0x00000400)
2113#define ERRSTAT_TXWRN (0x00000200)
2114#define ERRSTAT_RXWRN (0x00000100)
2115#define ERRSTAT_IDLE (0x00000080)
2116#define ERRSTAT_TXRX (0x00000040)
2117#define ERRSTAT_FLTCONF(x) (((x)&0x03)<<4)
2118#define ERRSTAT_BOFFINT (0x00000004)
2119#define ERRSTAT_ERRINT (0x00000002)
2120
2121/* 1230/*
2122 * Interrupt Mask Register
2123 */
2124#define IMASK_BUF15M (0x8000)
2125#define IMASK_BUF14M (0x4000)
2126#define IMASK_BUF13M (0x2000)
2127#define IMASK_BUF12M (0x1000)
2128#define IMASK_BUF11M (0x0800)
2129#define IMASK_BUF10M (0x0400)
2130#define IMASK_BUF9M (0x0200)
2131#define IMASK_BUF8M (0x0100)
2132#define IMASK_BUF7M (0x0080)
2133#define IMASK_BUF6M (0x0040)
2134#define IMASK_BUF5M (0x0020)
2135#define IMASK_BUF4M (0x0010)
2136#define IMASK_BUF3M (0x0008)
2137#define IMASK_BUF2M (0x0004)
2138#define IMASK_BUF1M (0x0002)
2139#define IMASK_BUF0M (0x0001)
2140#define IMASK_BUFnM(x) (0x1<<(x))
2141#define IMASK_BUFF_ENABLE_ALL (0x1111)
2142#define IMASK_BUFF_DISABLE_ALL (0x0000)
2143
2144/*
2145 * Interrupt Flag Register
2146 */
2147#define IFLAG_BUF15M (0x8000)
2148#define IFLAG_BUF14M (0x4000)
2149#define IFLAG_BUF13M (0x2000)
2150#define IFLAG_BUF12M (0x1000)
2151#define IFLAG_BUF11M (0x0800)
2152#define IFLAG_BUF10M (0x0400)
2153#define IFLAG_BUF9M (0x0200)
2154#define IFLAG_BUF8M (0x0100)
2155#define IFLAG_BUF7M (0x0080)
2156#define IFLAG_BUF6M (0x0040)
2157#define IFLAG_BUF5M (0x0020)
2158#define IFLAG_BUF4M (0x0010)
2159#define IFLAG_BUF3M (0x0008)
2160#define IFLAG_BUF2M (0x0004)
2161#define IFLAG_BUF1M (0x0002)
2162#define IFLAG_BUF0M (0x0001)
2163#define IFLAG_BUFF_SET_ALL (0xFFFF)
2164#define IFLAG_BUFF_CLEAR_ALL (0x0000)
2165#define IFLAG_BUFnM(x) (0x1<<(x))
2166
2167/*
2168 * Message Buffers
2169 */
2170#define MB_CNT_CODE(x) (((x)&0x0F)<<24)
2171#define MB_CNT_SRR (0x00400000)
2172#define MB_CNT_IDE (0x00200000)
2173#define MB_CNT_RTR (0x00100000)
2174#define MB_CNT_LENGTH(x) (((x)&0x0F)<<16)
2175#define MB_CNT_TIMESTAMP(x) ((x)&0xFFFF)
2176#define MB_ID_STD(x) (((x)&0x07FF)<<18)
2177#define MB_ID_EXT(x) ((x)&0x3FFFF)
2178
2179/*********************************************************************
2180 *
2181 * Edge Port Module (EPORT) 1231 * Edge Port Module (EPORT)
2182 * 1232 */
2183 *********************************************************************/
2184
2185/* Register read/write macros */
2186#define MCFEPORT_EPPAR (0xFC094000) 1233#define MCFEPORT_EPPAR (0xFC094000)
2187#define MCFEPORT_EPDDR (0xFC094002) 1234#define MCFEPORT_EPDDR (0xFC094002)
2188#define MCFEPORT_EPIER (0xFC094003) 1235#define MCFEPORT_EPIER (0xFC094003)
@@ -2190,91 +1237,5 @@
2190#define MCFEPORT_EPPDR (0xFC094005) 1237#define MCFEPORT_EPPDR (0xFC094005)
2191#define MCFEPORT_EPFR (0xFC094006) 1238#define MCFEPORT_EPFR (0xFC094006)
2192 1239
2193/* Bit definitions and macros for MCF_EPORT_EPPAR */
2194#define MCF_EPORT_EPPAR_EPPA1(x) (((x)&0x0003)<<2)
2195#define MCF_EPORT_EPPAR_EPPA2(x) (((x)&0x0003)<<4)
2196#define MCF_EPORT_EPPAR_EPPA3(x) (((x)&0x0003)<<6)
2197#define MCF_EPORT_EPPAR_EPPA4(x) (((x)&0x0003)<<8)
2198#define MCF_EPORT_EPPAR_EPPA5(x) (((x)&0x0003)<<10)
2199#define MCF_EPORT_EPPAR_EPPA6(x) (((x)&0x0003)<<12)
2200#define MCF_EPORT_EPPAR_EPPA7(x) (((x)&0x0003)<<14)
2201#define MCF_EPORT_EPPAR_LEVEL (0)
2202#define MCF_EPORT_EPPAR_RISING (1)
2203#define MCF_EPORT_EPPAR_FALLING (2)
2204#define MCF_EPORT_EPPAR_BOTH (3)
2205#define MCF_EPORT_EPPAR_EPPA7_LEVEL (0x0000)
2206#define MCF_EPORT_EPPAR_EPPA7_RISING (0x4000)
2207#define MCF_EPORT_EPPAR_EPPA7_FALLING (0x8000)
2208#define MCF_EPORT_EPPAR_EPPA7_BOTH (0xC000)
2209#define MCF_EPORT_EPPAR_EPPA6_LEVEL (0x0000)
2210#define MCF_EPORT_EPPAR_EPPA6_RISING (0x1000)
2211#define MCF_EPORT_EPPAR_EPPA6_FALLING (0x2000)
2212#define MCF_EPORT_EPPAR_EPPA6_BOTH (0x3000)
2213#define MCF_EPORT_EPPAR_EPPA5_LEVEL (0x0000)
2214#define MCF_EPORT_EPPAR_EPPA5_RISING (0x0400)
2215#define MCF_EPORT_EPPAR_EPPA5_FALLING (0x0800)
2216#define MCF_EPORT_EPPAR_EPPA5_BOTH (0x0C00)
2217#define MCF_EPORT_EPPAR_EPPA4_LEVEL (0x0000)
2218#define MCF_EPORT_EPPAR_EPPA4_RISING (0x0100)
2219#define MCF_EPORT_EPPAR_EPPA4_FALLING (0x0200)
2220#define MCF_EPORT_EPPAR_EPPA4_BOTH (0x0300)
2221#define MCF_EPORT_EPPAR_EPPA3_LEVEL (0x0000)
2222#define MCF_EPORT_EPPAR_EPPA3_RISING (0x0040)
2223#define MCF_EPORT_EPPAR_EPPA3_FALLING (0x0080)
2224#define MCF_EPORT_EPPAR_EPPA3_BOTH (0x00C0)
2225#define MCF_EPORT_EPPAR_EPPA2_LEVEL (0x0000)
2226#define MCF_EPORT_EPPAR_EPPA2_RISING (0x0010)
2227#define MCF_EPORT_EPPAR_EPPA2_FALLING (0x0020)
2228#define MCF_EPORT_EPPAR_EPPA2_BOTH (0x0030)
2229#define MCF_EPORT_EPPAR_EPPA1_LEVEL (0x0000)
2230#define MCF_EPORT_EPPAR_EPPA1_RISING (0x0004)
2231#define MCF_EPORT_EPPAR_EPPA1_FALLING (0x0008)
2232#define MCF_EPORT_EPPAR_EPPA1_BOTH (0x000C)
2233
2234/* Bit definitions and macros for MCF_EPORT_EPDDR */
2235#define MCF_EPORT_EPDDR_EPDD1 (0x02)
2236#define MCF_EPORT_EPDDR_EPDD2 (0x04)
2237#define MCF_EPORT_EPDDR_EPDD3 (0x08)
2238#define MCF_EPORT_EPDDR_EPDD4 (0x10)
2239#define MCF_EPORT_EPDDR_EPDD5 (0x20)
2240#define MCF_EPORT_EPDDR_EPDD6 (0x40)
2241#define MCF_EPORT_EPDDR_EPDD7 (0x80)
2242
2243/* Bit definitions and macros for MCF_EPORT_EPIER */
2244#define MCF_EPORT_EPIER_EPIE1 (0x02)
2245#define MCF_EPORT_EPIER_EPIE2 (0x04)
2246#define MCF_EPORT_EPIER_EPIE3 (0x08)
2247#define MCF_EPORT_EPIER_EPIE4 (0x10)
2248#define MCF_EPORT_EPIER_EPIE5 (0x20)
2249#define MCF_EPORT_EPIER_EPIE6 (0x40)
2250#define MCF_EPORT_EPIER_EPIE7 (0x80)
2251
2252/* Bit definitions and macros for MCF_EPORT_EPDR */
2253#define MCF_EPORT_EPDR_EPD1 (0x02)
2254#define MCF_EPORT_EPDR_EPD2 (0x04)
2255#define MCF_EPORT_EPDR_EPD3 (0x08)
2256#define MCF_EPORT_EPDR_EPD4 (0x10)
2257#define MCF_EPORT_EPDR_EPD5 (0x20)
2258#define MCF_EPORT_EPDR_EPD6 (0x40)
2259#define MCF_EPORT_EPDR_EPD7 (0x80)
2260
2261/* Bit definitions and macros for MCF_EPORT_EPPDR */
2262#define MCF_EPORT_EPPDR_EPPD1 (0x02)
2263#define MCF_EPORT_EPPDR_EPPD2 (0x04)
2264#define MCF_EPORT_EPPDR_EPPD3 (0x08)
2265#define MCF_EPORT_EPPDR_EPPD4 (0x10)
2266#define MCF_EPORT_EPPDR_EPPD5 (0x20)
2267#define MCF_EPORT_EPPDR_EPPD6 (0x40)
2268#define MCF_EPORT_EPPDR_EPPD7 (0x80)
2269
2270/* Bit definitions and macros for MCF_EPORT_EPFR */
2271#define MCF_EPORT_EPFR_EPF1 (0x02)
2272#define MCF_EPORT_EPFR_EPF2 (0x04)
2273#define MCF_EPORT_EPFR_EPF3 (0x08)
2274#define MCF_EPORT_EPFR_EPF4 (0x10)
2275#define MCF_EPORT_EPFR_EPF5 (0x20)
2276#define MCF_EPORT_EPFR_EPF6 (0x40)
2277#define MCF_EPORT_EPFR_EPF7 (0x80)
2278
2279/********************************************************************/ 1240/********************************************************************/
2280#endif /* m532xsim_h */ 1241#endif /* m532xsim_h */
diff --git a/arch/m68k/include/asm/m5407sim.h b/arch/m68k/include/asm/m5407sim.h
index 79f58dd6a83d..a7550bc5cd1e 100644
--- a/arch/m68k/include/asm/m5407sim.h
+++ b/arch/m68k/include/asm/m5407sim.h
@@ -23,55 +23,55 @@
23/* 23/*
24 * Define the 5407 SIM register set addresses. 24 * Define the 5407 SIM register set addresses.
25 */ 25 */
26#define MCFSIM_RSR 0x00 /* Reset Status reg (r/w) */ 26#define MCFSIM_RSR (MCF_MBAR + 0x00) /* Reset Status */
27#define MCFSIM_SYPCR 0x01 /* System Protection reg (r/w)*/ 27#define MCFSIM_SYPCR (MCF_MBAR + 0x01) /* System Protection */
28#define MCFSIM_SWIVR 0x02 /* SW Watchdog intr reg (r/w) */ 28#define MCFSIM_SWIVR (MCF_MBAR + 0x02) /* SW Watchdog intr */
29#define MCFSIM_SWSR 0x03 /* SW Watchdog service (r/w) */ 29#define MCFSIM_SWSR (MCF_MBAR + 0x03) /* SW Watchdog service*/
30#define MCFSIM_PAR 0x04 /* Pin Assignment reg (r/w) */ 30#define MCFSIM_PAR (MCF_MBAR + 0x04) /* Pin Assignment */
31#define MCFSIM_IRQPAR 0x06 /* Interrupt Assignment reg (r/w) */ 31#define MCFSIM_IRQPAR (MCF_MBAR + 0x06) /* Intr Assignment */
32#define MCFSIM_PLLCR 0x08 /* PLL Control Reg*/ 32#define MCFSIM_PLLCR (MCF_MBAR + 0x08) /* PLL Ctrl */
33#define MCFSIM_MPARK 0x0C /* BUS Master Control Reg*/ 33#define MCFSIM_MPARK (MCF_MBAR + 0x0C) /* BUS Master Ctrl */
34#define MCFSIM_IPR 0x40 /* Interrupt Pend reg (r/w) */ 34#define MCFSIM_IPR (MCF_MBAR + 0x40) /* Interrupt Pending */
35#define MCFSIM_IMR 0x44 /* Interrupt Mask reg (r/w) */ 35#define MCFSIM_IMR (MCF_MBAR + 0x44) /* Interrupt Mask */
36#define MCFSIM_AVR 0x4b /* Autovector Ctrl reg (r/w) */ 36#define MCFSIM_AVR (MCF_MBAR + 0x4b) /* Autovector Ctrl */
37#define MCFSIM_ICR0 0x4c /* Intr Ctrl reg 0 (r/w) */ 37#define MCFSIM_ICR0 (MCF_MBAR + 0x4c) /* Intr Ctrl reg 0 */
38#define MCFSIM_ICR1 0x4d /* Intr Ctrl reg 1 (r/w) */ 38#define MCFSIM_ICR1 (MCF_MBAR + 0x4d) /* Intr Ctrl reg 1 */
39#define MCFSIM_ICR2 0x4e /* Intr Ctrl reg 2 (r/w) */ 39#define MCFSIM_ICR2 (MCF_MBAR + 0x4e) /* Intr Ctrl reg 2 */
40#define MCFSIM_ICR3 0x4f /* Intr Ctrl reg 3 (r/w) */ 40#define MCFSIM_ICR3 (MCF_MBAR + 0x4f) /* Intr Ctrl reg 3 */
41#define MCFSIM_ICR4 0x50 /* Intr Ctrl reg 4 (r/w) */ 41#define MCFSIM_ICR4 (MCF_MBAR + 0x50) /* Intr Ctrl reg 4 */
42#define MCFSIM_ICR5 0x51 /* Intr Ctrl reg 5 (r/w) */ 42#define MCFSIM_ICR5 (MCF_MBAR + 0x51) /* Intr Ctrl reg 5 */
43#define MCFSIM_ICR6 0x52 /* Intr Ctrl reg 6 (r/w) */ 43#define MCFSIM_ICR6 (MCF_MBAR + 0x52) /* Intr Ctrl reg 6 */
44#define MCFSIM_ICR7 0x53 /* Intr Ctrl reg 7 (r/w) */ 44#define MCFSIM_ICR7 (MCF_MBAR + 0x53) /* Intr Ctrl reg 7 */
45#define MCFSIM_ICR8 0x54 /* Intr Ctrl reg 8 (r/w) */ 45#define MCFSIM_ICR8 (MCF_MBAR + 0x54) /* Intr Ctrl reg 8 */
46#define MCFSIM_ICR9 0x55 /* Intr Ctrl reg 9 (r/w) */ 46#define MCFSIM_ICR9 (MCF_MBAR + 0x55) /* Intr Ctrl reg 9 */
47#define MCFSIM_ICR10 0x56 /* Intr Ctrl reg 10 (r/w) */ 47#define MCFSIM_ICR10 (MCF_MBAR + 0x56) /* Intr Ctrl reg 10 */
48#define MCFSIM_ICR11 0x57 /* Intr Ctrl reg 11 (r/w) */ 48#define MCFSIM_ICR11 (MCF_MBAR + 0x57) /* Intr Ctrl reg 11 */
49 49
50#define MCFSIM_CSAR0 0x80 /* CS 0 Address 0 reg (r/w) */ 50#define MCFSIM_CSAR0 (MCF_MBAR + 0x80) /* CS 0 Address reg */
51#define MCFSIM_CSMR0 0x84 /* CS 0 Mask 0 reg (r/w) */ 51#define MCFSIM_CSMR0 (MCF_MBAR + 0x84) /* CS 0 Mask reg */
52#define MCFSIM_CSCR0 0x8a /* CS 0 Control reg (r/w) */ 52#define MCFSIM_CSCR0 (MCF_MBAR + 0x8a) /* CS 0 Control reg */
53#define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ 53#define MCFSIM_CSAR1 (MCF_MBAR + 0x8c) /* CS 1 Address reg */
54#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ 54#define MCFSIM_CSMR1 (MCF_MBAR + 0x90) /* CS 1 Mask reg */
55#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ 55#define MCFSIM_CSCR1 (MCF_MBAR + 0x96) /* CS 1 Control reg */
56 56
57#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ 57#define MCFSIM_CSAR2 (MCF_MBAR + 0x98) /* CS 2 Address reg */
58#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 58#define MCFSIM_CSMR2 (MCF_MBAR + 0x9c) /* CS 2 Mask reg */
59#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 59#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
60#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ 60#define MCFSIM_CSAR3 (MCF_MBAR + 0xa4) /* CS 3 Address reg */
61#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 61#define MCFSIM_CSMR3 (MCF_MBAR + 0xa8) /* CS 3 Mask reg */
62#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 62#define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
63#define MCFSIM_CSAR4 0xb0 /* CS 4 Address reg (r/w) */ 63#define MCFSIM_CSAR4 (MCF_MBAR + 0xb0) /* CS 4 Address reg */
64#define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ 64#define MCFSIM_CSMR4 (MCF_MBAR + 0xb4) /* CS 4 Mask reg */
65#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ 65#define MCFSIM_CSCR4 (MCF_MBAR + 0xba) /* CS 4 Control reg */
66#define MCFSIM_CSAR5 0xbc /* CS 5 Address reg (r/w) */ 66#define MCFSIM_CSAR5 (MCF_MBAR + 0xbc) /* CS 5 Address reg */
67#define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */ 67#define MCFSIM_CSMR5 (MCF_MBAR + 0xc0) /* CS 5 Mask reg */
68#define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ 68#define MCFSIM_CSCR5 (MCF_MBAR + 0xc6) /* CS 5 Control reg */
69#define MCFSIM_CSAR6 0xc8 /* CS 6 Address reg (r/w) */ 69#define MCFSIM_CSAR6 (MCF_MBAR + 0xc8) /* CS 6 Address reg */
70#define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */ 70#define MCFSIM_CSMR6 (MCF_MBAR + 0xcc) /* CS 6 Mask reg */
71#define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ 71#define MCFSIM_CSCR6 (MCF_MBAR + 0xd2) /* CS 6 Control reg */
72#define MCFSIM_CSAR7 0xd4 /* CS 7 Address reg (r/w) */ 72#define MCFSIM_CSAR7 (MCF_MBAR + 0xd4) /* CS 7 Address reg */
73#define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */ 73#define MCFSIM_CSMR7 (MCF_MBAR + 0xd8) /* CS 7 Mask reg */
74#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ 74#define MCFSIM_CSCR7 (MCF_MBAR + 0xde) /* CS 7 Control reg */
75 75
76#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */ 76#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */
77#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */ 77#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */
@@ -102,9 +102,9 @@
102/* 102/*
103 * Generic GPIO support 103 * Generic GPIO support
104 */ 104 */
105#define MCFGPIO_PIN_MAX 16 105#define MCFGPIO_PIN_MAX 16
106#define MCFGPIO_IRQ_MAX -1 106#define MCFGPIO_IRQ_MAX -1
107#define MCFGPIO_IRQ_VECBASE -1 107#define MCFGPIO_IRQ_VECBASE -1
108 108
109/* 109/*
110 * Some symbol defines for the above... 110 * Some symbol defines for the above...
@@ -130,9 +130,9 @@
130/* 130/*
131 * Defines for the IRQPAR Register 131 * Defines for the IRQPAR Register
132 */ 132 */
133#define IRQ5_LEVEL4 0x80 133#define IRQ5_LEVEL4 0x80
134#define IRQ3_LEVEL6 0x40 134#define IRQ3_LEVEL6 0x40
135#define IRQ1_LEVEL2 0x20 135#define IRQ1_LEVEL2 0x20
136 136
137/* 137/*
138 * Define system peripheral IRQ usage. 138 * Define system peripheral IRQ usage.
diff --git a/arch/m68k/include/asm/m54xxgpt.h b/arch/m68k/include/asm/m54xxgpt.h
index df75dd87ae7a..0b69cd1ed0ed 100644
--- a/arch/m68k/include/asm/m54xxgpt.h
+++ b/arch/m68k/include/asm/m54xxgpt.h
@@ -16,26 +16,26 @@
16*********************************************************************/ 16*********************************************************************/
17 17
18/* Register read/write macros */ 18/* Register read/write macros */
19#define MCF_GPT_GMS0 0x000800 19#define MCF_GPT_GMS0 (MCF_MBAR + 0x000800)
20#define MCF_GPT_GCIR0 0x000804 20#define MCF_GPT_GCIR0 (MCF_MBAR + 0x000804)
21#define MCF_GPT_GPWM0 0x000808 21#define MCF_GPT_GPWM0 (MCF_MBAR + 0x000808)
22#define MCF_GPT_GSR0 0x00080C 22#define MCF_GPT_GSR0 (MCF_MBAR + 0x00080C)
23#define MCF_GPT_GMS1 0x000810 23#define MCF_GPT_GMS1 (MCF_MBAR + 0x000810)
24#define MCF_GPT_GCIR1 0x000814 24#define MCF_GPT_GCIR1 (MCF_MBAR + 0x000814)
25#define MCF_GPT_GPWM1 0x000818 25#define MCF_GPT_GPWM1 (MCF_MBAR + 0x000818)
26#define MCF_GPT_GSR1 0x00081C 26#define MCF_GPT_GSR1 (MCF_MBAR + 0x00081C)
27#define MCF_GPT_GMS2 0x000820 27#define MCF_GPT_GMS2 (MCF_MBAR + 0x000820)
28#define MCF_GPT_GCIR2 0x000824 28#define MCF_GPT_GCIR2 (MCF_MBAR + 0x000824)
29#define MCF_GPT_GPWM2 0x000828 29#define MCF_GPT_GPWM2 (MCF_MBAR + 0x000828)
30#define MCF_GPT_GSR2 0x00082C 30#define MCF_GPT_GSR2 (MCF_MBAR + 0x00082C)
31#define MCF_GPT_GMS3 0x000830 31#define MCF_GPT_GMS3 (MCF_MBAR + 0x000830)
32#define MCF_GPT_GCIR3 0x000834 32#define MCF_GPT_GCIR3 (MCF_MBAR + 0x000834)
33#define MCF_GPT_GPWM3 0x000838 33#define MCF_GPT_GPWM3 (MCF_MBAR + 0x000838)
34#define MCF_GPT_GSR3 0x00083C 34#define MCF_GPT_GSR3 (MCF_MBAR + 0x00083C)
35#define MCF_GPT_GMS(x) (0x000800+((x)*0x010)) 35#define MCF_GPT_GMS(x) (MCF_MBAR + 0x000800 + ((x) * 0x010))
36#define MCF_GPT_GCIR(x) (0x000804+((x)*0x010)) 36#define MCF_GPT_GCIR(x) (MCF_MBAR + 0x000804 + ((x) * 0x010))
37#define MCF_GPT_GPWM(x) (0x000808+((x)*0x010)) 37#define MCF_GPT_GPWM(x) (MCF_MBAR + 0x000808 + ((x) * 0x010))
38#define MCF_GPT_GSR(x) (0x00080C+((x)*0x010)) 38#define MCF_GPT_GSR(x) (MCF_MBAR + 0x00080C + ((x) * 0x010))
39 39
40/* Bit definitions and macros for MCF_GPT_GMS */ 40/* Bit definitions and macros for MCF_GPT_GMS */
41#define MCF_GPT_GMS_TMS(x) (((x)&0x00000007)<<0) 41#define MCF_GPT_GMS_TMS(x) (((x)&0x00000007)<<0)
diff --git a/arch/m68k/include/asm/m54xxsim.h b/arch/m68k/include/asm/m54xxsim.h
index d3c5e0dbdadf..d3bd83887429 100644
--- a/arch/m68k/include/asm/m54xxsim.h
+++ b/arch/m68k/include/asm/m54xxsim.h
@@ -47,6 +47,12 @@
47#define MCF_IRQ_UART3 (MCFINT_VECBASE + 32) 47#define MCF_IRQ_UART3 (MCFINT_VECBASE + 32)
48 48
49/* 49/*
50 * Slice Timer support.
51 */
52#define MCFSLT_TIMER0 (MCF_MBAR + 0x900) /* Base addr TIMER0 */
53#define MCFSLT_TIMER1 (MCF_MBAR + 0x910) /* Base addr TIMER1 */
54
55/*
50 * Generic GPIO support 56 * Generic GPIO support
51 */ 57 */
52#define MCFGPIO_PIN_MAX 0 /* I am too lazy to count */ 58#define MCFGPIO_PIN_MAX 0 /* I am too lazy to count */
@@ -64,15 +70,25 @@
64#define MCFEPORT_EPFR (MCF_MBAR + 0xf0c) /* Flags */ 70#define MCFEPORT_EPFR (MCF_MBAR + 0xf0c) /* Flags */
65 71
66/* 72/*
67 * Some PSC related definitions 73 * Pin Assignment register definitions
68 */ 74 */
69#define MCF_PAR_PSC(x) (0x000A4F-((x)&0x3)) 75#define MCFGPIO_PAR_FBCTL (MCF_MBAR + 0xA40)
76#define MCFGPIO_PAR_FBCS (MCF_MBAR + 0xA42)
77#define MCFGPIO_PAR_DMA (MCF_MBAR + 0xA43)
78#define MCFGPIO_PAR_FECI2CIRQ (MCF_MBAR + 0xA44)
79#define MCFGPIO_PAR_PCIBG (MCF_MBAR + 0xA48) /* PCI bus grant */
80#define MCFGPIO_PAR_PCIBR (MCF_MBAR + 0xA4A) /* PCI */
81#define MCFGPIO_PAR_PSC0 (MCF_MBAR + 0xA4F)
82#define MCFGPIO_PAR_PSC1 (MCF_MBAR + 0xA4E)
83#define MCFGPIO_PAR_PSC2 (MCF_MBAR + 0xA4D)
84#define MCFGPIO_PAR_PSC3 (MCF_MBAR + 0xA4C)
85#define MCFGPIO_PAR_DSPI (MCF_MBAR + 0xA50)
86#define MCFGPIO_PAR_TIMER (MCF_MBAR + 0xA52)
87
70#define MCF_PAR_SDA (0x0008) 88#define MCF_PAR_SDA (0x0008)
71#define MCF_PAR_SCL (0x0004) 89#define MCF_PAR_SCL (0x0004)
72#define MCF_PAR_PSC_TXD (0x04) 90#define MCF_PAR_PSC_TXD (0x04)
73#define MCF_PAR_PSC_RXD (0x08) 91#define MCF_PAR_PSC_RXD (0x08)
74#define MCF_PAR_PSC_RTS(x) (((x)&0x03)<<4)
75#define MCF_PAR_PSC_CTS(x) (((x)&0x03)<<6)
76#define MCF_PAR_PSC_CTS_GPIO (0x00) 92#define MCF_PAR_PSC_CTS_GPIO (0x00)
77#define MCF_PAR_PSC_CTS_BCLK (0x80) 93#define MCF_PAR_PSC_CTS_BCLK (0x80)
78#define MCF_PAR_PSC_CTS_CTS (0xC0) 94#define MCF_PAR_PSC_CTS_CTS (0xC0)
@@ -81,7 +97,4 @@
81#define MCF_PAR_PSC_RTS_RTS (0x30) 97#define MCF_PAR_PSC_RTS_RTS (0x30)
82#define MCF_PAR_PSC_CANRX (0x40) 98#define MCF_PAR_PSC_CANRX (0x40)
83 99
84#define MCF_PAR_PCIBG (CONFIG_MBAR + 0xa48) /* PCI bus grant */
85#define MCF_PAR_PCIBR (CONFIG_MBAR + 0xa4a) /* PCI */
86
87#endif /* m54xxsim_h */ 100#endif /* m54xxsim_h */
diff --git a/arch/m68k/include/asm/mcfslt.h b/arch/m68k/include/asm/mcfslt.h
index d0d0ecba5333..c2314b6f8caa 100644
--- a/arch/m68k/include/asm/mcfslt.h
+++ b/arch/m68k/include/asm/mcfslt.h
@@ -13,13 +13,6 @@
13/****************************************************************************/ 13/****************************************************************************/
14 14
15/* 15/*
16 * Get address specific defines for the 547x.
17 */
18#define MCFSLT_TIMER0 0x900 /* Base address of TIMER0 */
19#define MCFSLT_TIMER1 0x910 /* Base address of TIMER1 */
20
21
22/*
23 * Define the SLT timer register set addresses. 16 * Define the SLT timer register set addresses.
24 */ 17 */
25#define MCFSLT_STCNT 0x00 /* Terminal count */ 18#define MCFSLT_STCNT 0x00 /* Terminal count */
diff --git a/arch/m68k/include/asm/nettel.h b/arch/m68k/include/asm/nettel.h
index 4dec2d9fb994..2a7a7667d807 100644
--- a/arch/m68k/include/asm/nettel.h
+++ b/arch/m68k/include/asm/nettel.h
@@ -21,6 +21,7 @@
21#ifdef CONFIG_COLDFIRE 21#ifdef CONFIG_COLDFIRE
22#include <asm/coldfire.h> 22#include <asm/coldfire.h>
23#include <asm/mcfsim.h> 23#include <asm/mcfsim.h>
24#include <asm/io.h>
24#endif 25#endif
25 26
26/*---------------------------------------------------------------------------*/ 27/*---------------------------------------------------------------------------*/
@@ -86,16 +87,12 @@ static __inline__ void mcf_setppdata(unsigned int mask, unsigned int bits)
86 */ 87 */
87static __inline__ unsigned int mcf_getppdata(void) 88static __inline__ unsigned int mcf_getppdata(void)
88{ 89{
89 volatile unsigned short *pp; 90 return readw(MCFSIM_PBDAT);
90 pp = (volatile unsigned short *) (MCF_MBAR + MCFSIM_PBDAT);
91 return((unsigned int) *pp);
92} 91}
93 92
94static __inline__ void mcf_setppdata(unsigned int mask, unsigned int bits) 93static __inline__ void mcf_setppdata(unsigned int mask, unsigned int bits)
95{ 94{
96 volatile unsigned short *pp; 95 write((readw(MCFSIM_PBDAT) & ~mask) | bits, MCFSIM_PBDAT);
97 pp = (volatile unsigned short *) (MCF_MBAR + MCFSIM_PBDAT);
98 *pp = (*pp & ~mask) | bits;
99} 96}
100#endif 97#endif
101 98
diff --git a/arch/m68k/platform/68VZ328/Makefile b/arch/m68k/platform/68VZ328/Makefile
index a49d75e65489..816674164682 100644
--- a/arch/m68k/platform/68VZ328/Makefile
+++ b/arch/m68k/platform/68VZ328/Makefile
@@ -1,11 +1,5 @@
1# 1#
2# Makefile for arch/m68knommu/platform/68VZ328. 2# Makefile for arch/m68k/platform/68VZ328.
3# 3#
4 4
5obj-y := config.o 5obj-y := config.o
6extra-$(DRAGEN2):= screen.h
7
8$(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl
9 perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h
10
11clean-files := $(obj)/screen.h
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c
index 81f0fb5e51cf..71ea4c02795d 100644
--- a/arch/m68k/platform/coldfire/device.c
+++ b/arch/m68k/platform/coldfire/device.c
@@ -347,12 +347,12 @@ static void __init mcf_uart_set_irq(void)
347{ 347{
348#ifdef MCFUART_UIVR 348#ifdef MCFUART_UIVR
349 /* UART0 interrupt setup */ 349 /* UART0 interrupt setup */
350 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 350 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCFSIM_UART1ICR);
351 writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR); 351 writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
352 mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0); 352 mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
353 353
354 /* UART1 interrupt setup */ 354 /* UART1 interrupt setup */
355 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 355 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCFSIM_UART2ICR);
356 writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR); 356 writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
357 mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1); 357 mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
358#endif 358#endif
diff --git a/arch/m68k/platform/coldfire/head.S b/arch/m68k/platform/coldfire/head.S
index b88f5716f357..fa31be297b85 100644
--- a/arch/m68k/platform/coldfire/head.S
+++ b/arch/m68k/platform/coldfire/head.S
@@ -60,7 +60,7 @@
60 60
61#elif defined(CONFIG_M5272) 61#elif defined(CONFIG_M5272)
62.macro GET_MEM_SIZE 62.macro GET_MEM_SIZE
63 movel MCF_MBAR+MCFSIM_CSOR7,%d0 /* get SDRAM address mask */ 63 movel MCFSIM_CSOR7,%d0 /* get SDRAM address mask */
64 andil #0xfffff000,%d0 /* mask out chip select options */ 64 andil #0xfffff000,%d0 /* mask out chip select options */
65 negl %d0 /* negate bits */ 65 negl %d0 /* negate bits */
66.endm 66.endm
diff --git a/arch/m68k/platform/coldfire/intc-5249.c b/arch/m68k/platform/coldfire/intc-5249.c
index f343bf7bf5b0..0864b836699a 100644
--- a/arch/m68k/platform/coldfire/intc-5249.c
+++ b/arch/m68k/platform/coldfire/intc-5249.c
@@ -20,22 +20,22 @@
20static void intc2_irq_gpio_mask(struct irq_data *d) 20static void intc2_irq_gpio_mask(struct irq_data *d)
21{ 21{
22 u32 imr; 22 u32 imr;
23 imr = readl(MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 23 imr = readl(MCFSIM2_GPIOINTENABLE);
24 imr &= ~(0x1 << (d->irq - MCFINTC2_GPIOIRQ0)); 24 imr &= ~(0x1 << (d->irq - MCFINTC2_GPIOIRQ0));
25 writel(imr, MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 25 writel(imr, MCFSIM2_GPIOINTENABLE);
26} 26}
27 27
28static void intc2_irq_gpio_unmask(struct irq_data *d) 28static void intc2_irq_gpio_unmask(struct irq_data *d)
29{ 29{
30 u32 imr; 30 u32 imr;
31 imr = readl(MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 31 imr = readl(MCFSIM2_GPIOINTENABLE);
32 imr |= (0x1 << (d->irq - MCFINTC2_GPIOIRQ0)); 32 imr |= (0x1 << (d->irq - MCFINTC2_GPIOIRQ0));
33 writel(imr, MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 33 writel(imr, MCFSIM2_GPIOINTENABLE);
34} 34}
35 35
36static void intc2_irq_gpio_ack(struct irq_data *d) 36static void intc2_irq_gpio_ack(struct irq_data *d)
37{ 37{
38 writel(0x1 << (d->irq - MCFINTC2_GPIOIRQ0), MCF_MBAR2 + MCFSIM2_GPIOINTCLEAR); 38 writel(0x1 << (d->irq - MCFINTC2_GPIOIRQ0), MCFSIM2_GPIOINTCLEAR);
39} 39}
40 40
41static struct irq_chip intc2_irq_gpio_chip = { 41static struct irq_chip intc2_irq_gpio_chip = {
diff --git a/arch/m68k/platform/coldfire/intc-5272.c b/arch/m68k/platform/coldfire/intc-5272.c
index 7160e618b0a9..d7b695629a7e 100644
--- a/arch/m68k/platform/coldfire/intc-5272.c
+++ b/arch/m68k/platform/coldfire/intc-5272.c
@@ -86,7 +86,7 @@ static void intc_irq_mask(struct irq_data *d)
86 u32 v; 86 u32 v;
87 irq -= MCFINT_VECBASE; 87 irq -= MCFINT_VECBASE;
88 v = 0x8 << intc_irqmap[irq].index; 88 v = 0x8 << intc_irqmap[irq].index;
89 writel(v, MCF_MBAR + intc_irqmap[irq].icr); 89 writel(v, intc_irqmap[irq].icr);
90 } 90 }
91} 91}
92 92
@@ -98,7 +98,7 @@ static void intc_irq_unmask(struct irq_data *d)
98 u32 v; 98 u32 v;
99 irq -= MCFINT_VECBASE; 99 irq -= MCFINT_VECBASE;
100 v = 0xd << intc_irqmap[irq].index; 100 v = 0xd << intc_irqmap[irq].index;
101 writel(v, MCF_MBAR + intc_irqmap[irq].icr); 101 writel(v, intc_irqmap[irq].icr);
102 } 102 }
103} 103}
104 104
@@ -111,10 +111,10 @@ static void intc_irq_ack(struct irq_data *d)
111 irq -= MCFINT_VECBASE; 111 irq -= MCFINT_VECBASE;
112 if (intc_irqmap[irq].ack) { 112 if (intc_irqmap[irq].ack) {
113 u32 v; 113 u32 v;
114 v = readl(MCF_MBAR + intc_irqmap[irq].icr); 114 v = readl(intc_irqmap[irq].icr);
115 v &= (0x7 << intc_irqmap[irq].index); 115 v &= (0x7 << intc_irqmap[irq].index);
116 v |= (0x8 << intc_irqmap[irq].index); 116 v |= (0x8 << intc_irqmap[irq].index);
117 writel(v, MCF_MBAR + intc_irqmap[irq].icr); 117 writel(v, intc_irqmap[irq].icr);
118 } 118 }
119 } 119 }
120} 120}
@@ -127,12 +127,12 @@ static int intc_irq_set_type(struct irq_data *d, unsigned int type)
127 irq -= MCFINT_VECBASE; 127 irq -= MCFINT_VECBASE;
128 if (intc_irqmap[irq].ack) { 128 if (intc_irqmap[irq].ack) {
129 u32 v; 129 u32 v;
130 v = readl(MCF_MBAR + MCFSIM_PITR); 130 v = readl(MCFSIM_PITR);
131 if (type == IRQ_TYPE_EDGE_FALLING) 131 if (type == IRQ_TYPE_EDGE_FALLING)
132 v &= ~(0x1 << (32 - irq)); 132 v &= ~(0x1 << (32 - irq));
133 else 133 else
134 v |= (0x1 << (32 - irq)); 134 v |= (0x1 << (32 - irq));
135 writel(v, MCF_MBAR + MCFSIM_PITR); 135 writel(v, MCFSIM_PITR);
136 } 136 }
137 } 137 }
138 return 0; 138 return 0;
@@ -163,10 +163,10 @@ void __init init_IRQ(void)
163 int irq, edge; 163 int irq, edge;
164 164
165 /* Mask all interrupt sources */ 165 /* Mask all interrupt sources */
166 writel(0x88888888, MCF_MBAR + MCFSIM_ICR1); 166 writel(0x88888888, MCFSIM_ICR1);
167 writel(0x88888888, MCF_MBAR + MCFSIM_ICR2); 167 writel(0x88888888, MCFSIM_ICR2);
168 writel(0x88888888, MCF_MBAR + MCFSIM_ICR3); 168 writel(0x88888888, MCFSIM_ICR3);
169 writel(0x88888888, MCF_MBAR + MCFSIM_ICR4); 169 writel(0x88888888, MCFSIM_ICR4);
170 170
171 for (irq = 0; (irq < NR_IRQS); irq++) { 171 for (irq = 0; (irq < NR_IRQS); irq++) {
172 irq_set_chip(irq, &intc_irq_chip); 172 irq_set_chip(irq, &intc_irq_chip);
diff --git a/arch/m68k/platform/coldfire/intc.c b/arch/m68k/platform/coldfire/intc.c
index 5c0c150b4067..cce257420388 100644
--- a/arch/m68k/platform/coldfire/intc.c
+++ b/arch/m68k/platform/coldfire/intc.c
@@ -45,23 +45,23 @@ unsigned char mcf_irq2imr[NR_IRQS];
45void mcf_setimr(int index) 45void mcf_setimr(int index)
46{ 46{
47 u16 imr; 47 u16 imr;
48 imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); 48 imr = __raw_readw(MCFSIM_IMR);
49 __raw_writew(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR); 49 __raw_writew(imr | (0x1 << index), MCFSIM_IMR);
50} 50}
51 51
52void mcf_clrimr(int index) 52void mcf_clrimr(int index)
53{ 53{
54 u16 imr; 54 u16 imr;
55 imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); 55 imr = __raw_readw(MCFSIM_IMR);
56 __raw_writew(imr & ~(0x1 << index), MCF_MBAR + MCFSIM_IMR); 56 __raw_writew(imr & ~(0x1 << index), MCFSIM_IMR);
57} 57}
58 58
59void mcf_maskimr(unsigned int mask) 59void mcf_maskimr(unsigned int mask)
60{ 60{
61 u16 imr; 61 u16 imr;
62 imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); 62 imr = __raw_readw(MCFSIM_IMR);
63 imr |= mask; 63 imr |= mask;
64 __raw_writew(imr, MCF_MBAR + MCFSIM_IMR); 64 __raw_writew(imr, MCFSIM_IMR);
65} 65}
66 66
67#else 67#else
@@ -69,23 +69,23 @@ void mcf_maskimr(unsigned int mask)
69void mcf_setimr(int index) 69void mcf_setimr(int index)
70{ 70{
71 u32 imr; 71 u32 imr;
72 imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); 72 imr = __raw_readl(MCFSIM_IMR);
73 __raw_writel(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR); 73 __raw_writel(imr | (0x1 << index), MCFSIM_IMR);
74} 74}
75 75
76void mcf_clrimr(int index) 76void mcf_clrimr(int index)
77{ 77{
78 u32 imr; 78 u32 imr;
79 imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); 79 imr = __raw_readl(MCFSIM_IMR);
80 __raw_writel(imr & ~(0x1 << index), MCF_MBAR + MCFSIM_IMR); 80 __raw_writel(imr & ~(0x1 << index), MCFSIM_IMR);
81} 81}
82 82
83void mcf_maskimr(unsigned int mask) 83void mcf_maskimr(unsigned int mask)
84{ 84{
85 u32 imr; 85 u32 imr;
86 imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); 86 imr = __raw_readl(MCFSIM_IMR);
87 imr |= mask; 87 imr |= mask;
88 __raw_writel(imr, MCF_MBAR + MCFSIM_IMR); 88 __raw_writel(imr, MCFSIM_IMR);
89} 89}
90 90
91#endif 91#endif
@@ -104,9 +104,9 @@ void mcf_autovector(int irq)
104#ifdef MCFSIM_AVR 104#ifdef MCFSIM_AVR
105 if ((irq >= EIRQ1) && (irq <= EIRQ7)) { 105 if ((irq >= EIRQ1) && (irq <= EIRQ7)) {
106 u8 avec; 106 u8 avec;
107 avec = __raw_readb(MCF_MBAR + MCFSIM_AVR); 107 avec = __raw_readb(MCFSIM_AVR);
108 avec |= (0x1 << (irq - EIRQ1 + 1)); 108 avec |= (0x1 << (irq - EIRQ1 + 1));
109 __raw_writeb(avec, MCF_MBAR + MCFSIM_AVR); 109 __raw_writeb(avec, MCFSIM_AVR);
110 } 110 }
111#endif 111#endif
112} 112}
diff --git a/arch/m68k/platform/coldfire/m523x.c b/arch/m68k/platform/coldfire/m523x.c
index d47dfd8f50a2..ff37fe9553ea 100644
--- a/arch/m68k/platform/coldfire/m523x.c
+++ b/arch/m68k/platform/coldfire/m523x.c
@@ -42,14 +42,8 @@ static void __init m523x_qspi_init(void)
42 42
43static void __init m523x_fec_init(void) 43static void __init m523x_fec_init(void)
44{ 44{
45 u16 par;
46 u8 v;
47
48 /* Set multi-function pins to ethernet use */ 45 /* Set multi-function pins to ethernet use */
49 par = readw(MCF_IPSBAR + 0x100082); 46 writeb(readb(MCFGPIO_PAR_FECI2C) | 0xf0, MCFGPIO_PAR_FECI2C);
50 writew(par | 0xf00, MCF_IPSBAR + 0x100082);
51 v = readb(MCF_IPSBAR + 0x100078);
52 writeb(v | 0xc0, MCF_IPSBAR + 0x100078);
53} 47}
54 48
55/***************************************************************************/ 49/***************************************************************************/
diff --git a/arch/m68k/platform/coldfire/m5249.c b/arch/m68k/platform/coldfire/m5249.c
index 300e729a58d0..23b19cb7ab50 100644
--- a/arch/m68k/platform/coldfire/m5249.c
+++ b/arch/m68k/platform/coldfire/m5249.c
@@ -57,7 +57,7 @@ static void __init m5249_qspi_init(void)
57{ 57{
58 /* QSPI irq setup */ 58 /* QSPI irq setup */
59 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI0, 59 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI0,
60 MCF_MBAR + MCFSIM_QSPIICR); 60 MCFSIM_QSPIICR);
61 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI); 61 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI);
62} 62}
63 63
@@ -72,11 +72,11 @@ static void __init m5249_smc91x_init(void)
72 u32 gpio; 72 u32 gpio;
73 73
74 /* Set the GPIO line as interrupt source for smc91x device */ 74 /* Set the GPIO line as interrupt source for smc91x device */
75 gpio = readl(MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 75 gpio = readl(MCFSIM2_GPIOINTENABLE);
76 writel(gpio | 0x40, MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 76 writel(gpio | 0x40, MCFSIM2_GPIOINTENABLE);
77 77
78 gpio = readl(MCF_MBAR2 + MCFSIM2_INTLEVEL5); 78 gpio = readl(MCFSIM2_INTLEVEL5);
79 writel(gpio | 0x04000000, MCF_MBAR2 + MCFSIM2_INTLEVEL5); 79 writel(gpio | 0x04000000, MCFSIM2_INTLEVEL5);
80} 80}
81 81
82#endif /* CONFIG_M5249C3 */ 82#endif /* CONFIG_M5249C3 */
diff --git a/arch/m68k/platform/coldfire/m525x.c b/arch/m68k/platform/coldfire/m525x.c
index 8ce905f9b84f..fce8f8a45bf0 100644
--- a/arch/m68k/platform/coldfire/m525x.c
+++ b/arch/m68k/platform/coldfire/m525x.c
@@ -30,7 +30,7 @@ static void __init m525x_qspi_init(void)
30 30
31 /* QSPI irq setup */ 31 /* QSPI irq setup */
32 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI0, 32 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI0,
33 MCF_MBAR + MCFSIM_QSPIICR); 33 MCFSIM_QSPIICR);
34 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI); 34 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI);
35#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ 35#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
36} 36}
@@ -42,7 +42,7 @@ static void __init m525x_i2c_init(void)
42 42
43 /* first I2C controller uses regular irq setup */ 43 /* first I2C controller uses regular irq setup */
44 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL5 | MCFSIM_ICR_PRI0, 44 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL5 | MCFSIM_ICR_PRI0,
45 MCF_MBAR + MCFSIM_I2CICR); 45 MCFSIM_I2CICR);
46 mcf_mapirq2imr(MCF_IRQ_I2C0, MCFINTC_I2C); 46 mcf_mapirq2imr(MCF_IRQ_I2C0, MCFINTC_I2C);
47 47
48 /* second I2C controller is completely different */ 48 /* second I2C controller is completely different */
diff --git a/arch/m68k/platform/coldfire/m5272.c b/arch/m68k/platform/coldfire/m5272.c
index e68bc7a148eb..45b246d052ef 100644
--- a/arch/m68k/platform/coldfire/m5272.c
+++ b/arch/m68k/platform/coldfire/m5272.c
@@ -35,13 +35,13 @@ static void __init m5272_uarts_init(void)
35 u32 v; 35 u32 v;
36 36
37 /* Enable the output lines for the serial ports */ 37 /* Enable the output lines for the serial ports */
38 v = readl(MCF_MBAR + MCFSIM_PBCNT); 38 v = readl(MCFSIM_PBCNT);
39 v = (v & ~0x000000ff) | 0x00000055; 39 v = (v & ~0x000000ff) | 0x00000055;
40 writel(v, MCF_MBAR + MCFSIM_PBCNT); 40 writel(v, MCFSIM_PBCNT);
41 41
42 v = readl(MCF_MBAR + MCFSIM_PDCNT); 42 v = readl(MCFSIM_PDCNT);
43 v = (v & ~0x000003fc) | 0x000002a8; 43 v = (v & ~0x000003fc) | 0x000002a8;
44 writel(v, MCF_MBAR + MCFSIM_PDCNT); 44 writel(v, MCFSIM_PDCNT);
45} 45}
46 46
47/***************************************************************************/ 47/***************************************************************************/
@@ -50,9 +50,9 @@ static void m5272_cpu_reset(void)
50{ 50{
51 local_irq_disable(); 51 local_irq_disable();
52 /* Set watchdog to reset, and enabled */ 52 /* Set watchdog to reset, and enabled */
53 __raw_writew(0, MCF_MBAR + MCFSIM_WIRR); 53 __raw_writew(0, MCFSIM_WIRR);
54 __raw_writew(1, MCF_MBAR + MCFSIM_WRRR); 54 __raw_writew(1, MCFSIM_WRRR);
55 __raw_writew(0, MCF_MBAR + MCFSIM_WCR); 55 __raw_writew(0, MCFSIM_WCR);
56 for (;;) 56 for (;;)
57 /* wait for watchdog to timeout */; 57 /* wait for watchdog to timeout */;
58} 58}
@@ -62,11 +62,8 @@ static void m5272_cpu_reset(void)
62void __init config_BSP(char *commandp, int size) 62void __init config_BSP(char *commandp, int size)
63{ 63{
64#if defined (CONFIG_MOD5272) 64#if defined (CONFIG_MOD5272)
65 volatile unsigned char *pivrp;
66
67 /* Set base of device vectors to be 64 */ 65 /* Set base of device vectors to be 64 */
68 pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR); 66 writeb(0x40, MCFSIM_PIVR);
69 *pivrp = 0x40;
70#endif 67#endif
71 68
72#if defined(CONFIG_NETtel) || defined(CONFIG_SCALES) 69#if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
diff --git a/arch/m68k/platform/coldfire/m527x.c b/arch/m68k/platform/coldfire/m527x.c
index b3cb378c5e94..1431ba03c602 100644
--- a/arch/m68k/platform/coldfire/m527x.c
+++ b/arch/m68k/platform/coldfire/m527x.c
@@ -53,9 +53,9 @@ static void __init m527x_uarts_init(void)
53 /* 53 /*
54 * External Pin Mask Setting & Enable External Pin for Interface 54 * External Pin Mask Setting & Enable External Pin for Interface
55 */ 55 */
56 sepmask = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART); 56 sepmask = readw(MCFGPIO_PAR_UART);
57 sepmask |= UART0_ENABLE_MASK | UART1_ENABLE_MASK | UART2_ENABLE_MASK; 57 sepmask |= UART0_ENABLE_MASK | UART1_ENABLE_MASK | UART2_ENABLE_MASK;
58 writew(sepmask, MCF_IPSBAR + MCF_GPIO_PAR_UART); 58 writew(sepmask, MCFGPIO_PAR_UART);
59} 59}
60 60
61/***************************************************************************/ 61/***************************************************************************/
@@ -67,19 +67,19 @@ static void __init m527x_fec_init(void)
67 67
68 /* Set multi-function pins to ethernet mode for fec0 */ 68 /* Set multi-function pins to ethernet mode for fec0 */
69#if defined(CONFIG_M5271) 69#if defined(CONFIG_M5271)
70 v = readb(MCF_IPSBAR + 0x100047); 70 v = readb(MCFGPIO_PAR_FECI2C);
71 writeb(v | 0xf0, MCF_IPSBAR + 0x100047); 71 writeb(v | 0xf0, MCFGPIO_PAR_FECI2C);
72#else 72#else
73 par = readw(MCF_IPSBAR + 0x100082); 73 par = readw(MCFGPIO_PAR_FECI2C);
74 writew(par | 0xf00, MCF_IPSBAR + 0x100082); 74 writew(par | 0xf00, MCFGPIO_PAR_FECI2C);
75 v = readb(MCF_IPSBAR + 0x100078); 75 v = readb(MCFGPIO_PAR_FEC0HL);
76 writeb(v | 0xc0, MCF_IPSBAR + 0x100078); 76 writeb(v | 0xc0, MCFGPIO_PAR_FEC0HL);
77 77
78 /* Set multi-function pins to ethernet mode for fec1 */ 78 /* Set multi-function pins to ethernet mode for fec1 */
79 par = readw(MCF_IPSBAR + 0x100082); 79 par = readw(MCFGPIO_PAR_FECI2C);
80 writew(par | 0xa0, MCF_IPSBAR + 0x100082); 80 writew(par | 0xa0, MCFGPIO_PAR_FECI2C);
81 v = readb(MCF_IPSBAR + 0x100079); 81 v = readb(MCFGPIO_PAR_FEC1HL);
82 writeb(v | 0xc0, MCF_IPSBAR + 0x100079); 82 writeb(v | 0xc0, MCFGPIO_PAR_FEC1HL);
83#endif 83#endif
84} 84}
85 85
diff --git a/arch/m68k/platform/coldfire/m528x.c b/arch/m68k/platform/coldfire/m528x.c
index f1319e5d2546..f9f7e6a13d04 100644
--- a/arch/m68k/platform/coldfire/m528x.c
+++ b/arch/m68k/platform/coldfire/m528x.c
@@ -53,9 +53,9 @@ static void __init m528x_fec_init(void)
53 u16 v16; 53 u16 v16;
54 54
55 /* Set multi-function pins to ethernet mode for fec0 */ 55 /* Set multi-function pins to ethernet mode for fec0 */
56 v16 = readw(MCF_IPSBAR + 0x100056); 56 v16 = readw(MCFGPIO_PASPAR);
57 writew(v16 | 0xf00, MCF_IPSBAR + 0x100056); 57 writew(v16 | 0xf00, MCFGPIO_PASPAR);
58 writeb(0xc0, MCF_IPSBAR + 0x100058); 58 writeb(0xc0, MCFGPIO_PEHLPAR);
59} 59}
60 60
61/***************************************************************************/ 61/***************************************************************************/
diff --git a/arch/m68k/platform/coldfire/m532x.c b/arch/m68k/platform/coldfire/m532x.c
index 4819a44991ed..7951d1d43357 100644
--- a/arch/m68k/platform/coldfire/m532x.c
+++ b/arch/m68k/platform/coldfire/m532x.c
@@ -172,7 +172,7 @@ static void __init m532x_clk_init(void)
172static void __init m532x_qspi_init(void) 172static void __init m532x_qspi_init(void)
173{ 173{
174 /* setup QSPS pins for QSPI with gpio CS control */ 174 /* setup QSPS pins for QSPI with gpio CS control */
175 writew(0x01f0, MCF_GPIO_PAR_QSPI); 175 writew(0x01f0, MCFGPIO_PAR_QSPI);
176} 176}
177 177
178#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ 178#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
@@ -182,18 +182,24 @@ static void __init m532x_qspi_init(void)
182static void __init m532x_uarts_init(void) 182static void __init m532x_uarts_init(void)
183{ 183{
184 /* UART GPIO initialization */ 184 /* UART GPIO initialization */
185 MCF_GPIO_PAR_UART |= 0x0FFF; 185 writew(readw(MCFGPIO_PAR_UART) | 0x0FFF, MCFGPIO_PAR_UART);
186} 186}
187 187
188/***************************************************************************/ 188/***************************************************************************/
189 189
190static void __init m532x_fec_init(void) 190static void __init m532x_fec_init(void)
191{ 191{
192 u8 v;
193
192 /* Set multi-function pins to ethernet mode for fec0 */ 194 /* Set multi-function pins to ethernet mode for fec0 */
193 MCF_GPIO_PAR_FECI2C |= (MCF_GPIO_PAR_FECI2C_PAR_MDC_EMDC | 195 v = readb(MCFGPIO_PAR_FECI2C);
194 MCF_GPIO_PAR_FECI2C_PAR_MDIO_EMDIO); 196 v |= MCF_GPIO_PAR_FECI2C_PAR_MDC_EMDC |
195 MCF_GPIO_PAR_FEC = (MCF_GPIO_PAR_FEC_PAR_FEC_7W_FEC | 197 MCF_GPIO_PAR_FECI2C_PAR_MDIO_EMDIO;
196 MCF_GPIO_PAR_FEC_PAR_FEC_MII_FEC); 198 writeb(v, MCFGPIO_PAR_FECI2C);
199
200 v = readb(MCFGPIO_PAR_FEC);
201 v = MCF_GPIO_PAR_FEC_PAR_FEC_7W_FEC | MCF_GPIO_PAR_FEC_PAR_FEC_MII_FEC;
202 writeb(v, MCFGPIO_PAR_FEC);
197} 203}
198 204
199/***************************************************************************/ 205/***************************************************************************/
@@ -298,7 +304,7 @@ asmlinkage void __init sysinit(void)
298void wtm_init(void) 304void wtm_init(void)
299{ 305{
300 /* Disable watchdog timer */ 306 /* Disable watchdog timer */
301 MCF_WTM_WCR = 0; 307 writew(0, MCF_WTM_WCR);
302} 308}
303 309
304#define MCF_SCM_BCR_GBW (0x00000100) 310#define MCF_SCM_BCR_GBW (0x00000100)
@@ -307,53 +313,53 @@ void wtm_init(void)
307void scm_init(void) 313void scm_init(void)
308{ 314{
309 /* All masters are trusted */ 315 /* All masters are trusted */
310 MCF_SCM_MPR = 0x77777777; 316 writel(0x77777777, MCF_SCM_MPR);
311 317
312 /* Allow supervisor/user, read/write, and trusted/untrusted 318 /* Allow supervisor/user, read/write, and trusted/untrusted
313 access to all slaves */ 319 access to all slaves */
314 MCF_SCM_PACRA = 0; 320 writel(0, MCF_SCM_PACRA);
315 MCF_SCM_PACRB = 0; 321 writel(0, MCF_SCM_PACRB);
316 MCF_SCM_PACRC = 0; 322 writel(0, MCF_SCM_PACRC);
317 MCF_SCM_PACRD = 0; 323 writel(0, MCF_SCM_PACRD);
318 MCF_SCM_PACRE = 0; 324 writel(0, MCF_SCM_PACRE);
319 MCF_SCM_PACRF = 0; 325 writel(0, MCF_SCM_PACRF);
320 326
321 /* Enable bursts */ 327 /* Enable bursts */
322 MCF_SCM_BCR = (MCF_SCM_BCR_GBR | MCF_SCM_BCR_GBW); 328 writel(MCF_SCM_BCR_GBR | MCF_SCM_BCR_GBW, MCF_SCM_BCR);
323} 329}
324 330
325 331
326void fbcs_init(void) 332void fbcs_init(void)
327{ 333{
328 MCF_GPIO_PAR_CS = 0x0000003E; 334 writeb(0x3E, MCFGPIO_PAR_CS);
329 335
330 /* Latch chip select */ 336 /* Latch chip select */
331 MCF_FBCS1_CSAR = 0x10080000; 337 writel(0x10080000, MCF_FBCS1_CSAR);
332 338
333 MCF_FBCS1_CSCR = 0x002A3780; 339 writel(0x002A3780, MCF_FBCS1_CSCR);
334 MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_2M | MCF_FBCS_CSMR_V); 340 writel(MCF_FBCS_CSMR_BAM_2M | MCF_FBCS_CSMR_V, MCF_FBCS1_CSMR);
335 341
336 /* Initialize latch to drive signals to inactive states */ 342 /* Initialize latch to drive signals to inactive states */
337 *((u16 *)(0x10080000)) = 0xFFFF; 343 writew(0xffff, 0x10080000);
338 344
339 /* External SRAM */ 345 /* External SRAM */
340 MCF_FBCS1_CSAR = EXT_SRAM_ADDRESS; 346 writel(EXT_SRAM_ADDRESS, MCF_FBCS1_CSAR);
341 MCF_FBCS1_CSCR = (MCF_FBCS_CSCR_PS_16 347 writel(MCF_FBCS_CSCR_PS_16 |
342 | MCF_FBCS_CSCR_AA 348 MCF_FBCS_CSCR_AA |
343 | MCF_FBCS_CSCR_SBM 349 MCF_FBCS_CSCR_SBM |
344 | MCF_FBCS_CSCR_WS(1)); 350 MCF_FBCS_CSCR_WS(1),
345 MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_512K 351 MCF_FBCS1_CSCR);
346 | MCF_FBCS_CSMR_V); 352 writel(MCF_FBCS_CSMR_BAM_512K | MCF_FBCS_CSMR_V, MCF_FBCS1_CSMR);
347 353
348 /* Boot Flash connected to FBCS0 */ 354 /* Boot Flash connected to FBCS0 */
349 MCF_FBCS0_CSAR = FLASH_ADDRESS; 355 writel(FLASH_ADDRESS, MCF_FBCS0_CSAR);
350 MCF_FBCS0_CSCR = (MCF_FBCS_CSCR_PS_16 356 writel(MCF_FBCS_CSCR_PS_16 |
351 | MCF_FBCS_CSCR_BEM 357 MCF_FBCS_CSCR_BEM |
352 | MCF_FBCS_CSCR_AA 358 MCF_FBCS_CSCR_AA |
353 | MCF_FBCS_CSCR_SBM 359 MCF_FBCS_CSCR_SBM |
354 | MCF_FBCS_CSCR_WS(7)); 360 MCF_FBCS_CSCR_WS(7),
355 MCF_FBCS0_CSMR = (MCF_FBCS_CSMR_BAM_32M 361 MCF_FBCS0_CSCR);
356 | MCF_FBCS_CSMR_V); 362 writel(MCF_FBCS_CSMR_BAM_32M | MCF_FBCS_CSMR_V, MCF_FBCS0_CSMR);
357} 363}
358 364
359void sdramc_init(void) 365void sdramc_init(void)
@@ -362,102 +368,102 @@ void sdramc_init(void)
362 * Check to see if the SDRAM has already been initialized 368 * Check to see if the SDRAM has already been initialized
363 * by a run control tool 369 * by a run control tool
364 */ 370 */
365 if (!(MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF)) { 371 if (!(readl(MCF_SDRAMC_SDCR) & MCF_SDRAMC_SDCR_REF)) {
366 /* SDRAM chip select initialization */ 372 /* SDRAM chip select initialization */
367 373
368 /* Initialize SDRAM chip select */ 374 /* Initialize SDRAM chip select */
369 MCF_SDRAMC_SDCS0 = (0 375 writel(MCF_SDRAMC_SDCS_BA(SDRAM_ADDRESS) |
370 | MCF_SDRAMC_SDCS_BA(SDRAM_ADDRESS) 376 MCF_SDRAMC_SDCS_CSSZ(MCF_SDRAMC_SDCS_CSSZ_32MBYTE),
371 | MCF_SDRAMC_SDCS_CSSZ(MCF_SDRAMC_SDCS_CSSZ_32MBYTE)); 377 MCF_SDRAMC_SDCS0);
372 378
373 /* 379 /*
374 * Basic configuration and initialization 380 * Basic configuration and initialization
375 */ 381 */
376 MCF_SDRAMC_SDCFG1 = (0 382 writel(MCF_SDRAMC_SDCFG1_SRD2RW((int)((SDRAM_CASL + 2) + 0.5)) |
377 | MCF_SDRAMC_SDCFG1_SRD2RW((int)((SDRAM_CASL + 2) + 0.5 )) 383 MCF_SDRAMC_SDCFG1_SWT2RD(SDRAM_TWR + 1) |
378 | MCF_SDRAMC_SDCFG1_SWT2RD(SDRAM_TWR + 1) 384 MCF_SDRAMC_SDCFG1_RDLAT((int)((SDRAM_CASL * 2) + 2)) |
379 | MCF_SDRAMC_SDCFG1_RDLAT((int)((SDRAM_CASL*2) + 2)) 385 MCF_SDRAMC_SDCFG1_ACT2RW((int)(SDRAM_TRCD + 0.5)) |
380 | MCF_SDRAMC_SDCFG1_ACT2RW((int)((SDRAM_TRCD ) + 0.5)) 386 MCF_SDRAMC_SDCFG1_PRE2ACT((int)(SDRAM_TRP + 0.5)) |
381 | MCF_SDRAMC_SDCFG1_PRE2ACT((int)((SDRAM_TRP ) + 0.5)) 387 MCF_SDRAMC_SDCFG1_REF2ACT((int)(SDRAM_TRFC + 0.5)) |
382 | MCF_SDRAMC_SDCFG1_REF2ACT((int)(((SDRAM_TRFC) ) + 0.5)) 388 MCF_SDRAMC_SDCFG1_WTLAT(3),
383 | MCF_SDRAMC_SDCFG1_WTLAT(3)); 389 MCF_SDRAMC_SDCFG1);
384 MCF_SDRAMC_SDCFG2 = (0 390 writel(MCF_SDRAMC_SDCFG2_BRD2PRE(SDRAM_BL / 2 + 1) |
385 | MCF_SDRAMC_SDCFG2_BRD2PRE(SDRAM_BL/2 + 1) 391 MCF_SDRAMC_SDCFG2_BWT2RW(SDRAM_BL / 2 + SDRAM_TWR) |
386 | MCF_SDRAMC_SDCFG2_BWT2RW(SDRAM_BL/2 + SDRAM_TWR) 392 MCF_SDRAMC_SDCFG2_BRD2WT((int)((SDRAM_CASL + SDRAM_BL / 2 - 1.0) + 0.5)) |
387 | MCF_SDRAMC_SDCFG2_BRD2WT((int)((SDRAM_CASL+SDRAM_BL/2-1.0)+0.5)) 393 MCF_SDRAMC_SDCFG2_BL(SDRAM_BL - 1),
388 | MCF_SDRAMC_SDCFG2_BL(SDRAM_BL-1)); 394 MCF_SDRAMC_SDCFG2);
389 395
390 396
391 /* 397 /*
392 * Precharge and enable write to SDMR 398 * Precharge and enable write to SDMR
393 */ 399 */
394 MCF_SDRAMC_SDCR = (0 400 writel(MCF_SDRAMC_SDCR_MODE_EN |
395 | MCF_SDRAMC_SDCR_MODE_EN 401 MCF_SDRAMC_SDCR_CKE |
396 | MCF_SDRAMC_SDCR_CKE 402 MCF_SDRAMC_SDCR_DDR |
397 | MCF_SDRAMC_SDCR_DDR 403 MCF_SDRAMC_SDCR_MUX(1) |
398 | MCF_SDRAMC_SDCR_MUX(1) 404 MCF_SDRAMC_SDCR_RCNT((int)(((SDRAM_TREFI / (SYSTEM_PERIOD * 64)) - 1) + 0.5)) |
399 | MCF_SDRAMC_SDCR_RCNT((int)(((SDRAM_TREFI/(SYSTEM_PERIOD*64)) - 1) + 0.5)) 405 MCF_SDRAMC_SDCR_PS_16 |
400 | MCF_SDRAMC_SDCR_PS_16 406 MCF_SDRAMC_SDCR_IPALL,
401 | MCF_SDRAMC_SDCR_IPALL); 407 MCF_SDRAMC_SDCR);
402 408
403 /* 409 /*
404 * Write extended mode register 410 * Write extended mode register
405 */ 411 */
406 MCF_SDRAMC_SDMR = (0 412 writel(MCF_SDRAMC_SDMR_BNKAD_LEMR |
407 | MCF_SDRAMC_SDMR_BNKAD_LEMR 413 MCF_SDRAMC_SDMR_AD(0x0) |
408 | MCF_SDRAMC_SDMR_AD(0x0) 414 MCF_SDRAMC_SDMR_CMD,
409 | MCF_SDRAMC_SDMR_CMD); 415 MCF_SDRAMC_SDMR);
410 416
411 /* 417 /*
412 * Write mode register and reset DLL 418 * Write mode register and reset DLL
413 */ 419 */
414 MCF_SDRAMC_SDMR = (0 420 writel(MCF_SDRAMC_SDMR_BNKAD_LMR |
415 | MCF_SDRAMC_SDMR_BNKAD_LMR 421 MCF_SDRAMC_SDMR_AD(0x163) |
416 | MCF_SDRAMC_SDMR_AD(0x163) 422 MCF_SDRAMC_SDMR_CMD,
417 | MCF_SDRAMC_SDMR_CMD); 423 MCF_SDRAMC_SDMR);
418 424
419 /* 425 /*
420 * Execute a PALL command 426 * Execute a PALL command
421 */ 427 */
422 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IPALL; 428 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_IPALL, MCF_SDRAMC_SDCR);
423 429
424 /* 430 /*
425 * Perform two REF cycles 431 * Perform two REF cycles
426 */ 432 */
427 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IREF; 433 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_IREF, MCF_SDRAMC_SDCR);
428 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IREF; 434 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_IREF, MCF_SDRAMC_SDCR);
429 435
430 /* 436 /*
431 * Write mode register and clear reset DLL 437 * Write mode register and clear reset DLL
432 */ 438 */
433 MCF_SDRAMC_SDMR = (0 439 writel(MCF_SDRAMC_SDMR_BNKAD_LMR |
434 | MCF_SDRAMC_SDMR_BNKAD_LMR 440 MCF_SDRAMC_SDMR_AD(0x063) |
435 | MCF_SDRAMC_SDMR_AD(0x063) 441 MCF_SDRAMC_SDMR_CMD,
436 | MCF_SDRAMC_SDMR_CMD); 442 MCF_SDRAMC_SDMR);
437 443
438 /* 444 /*
439 * Enable auto refresh and lock SDMR 445 * Enable auto refresh and lock SDMR
440 */ 446 */
441 MCF_SDRAMC_SDCR &= ~MCF_SDRAMC_SDCR_MODE_EN; 447 writel(readl(MCF_SDRAMC_SDCR) & ~MCF_SDRAMC_SDCR_MODE_EN,
442 MCF_SDRAMC_SDCR |= (0 448 MCF_SDRAMC_SDCR);
443 | MCF_SDRAMC_SDCR_REF 449 writel(MCF_SDRAMC_SDCR_REF | MCF_SDRAMC_SDCR_DQS_OE(0xC),
444 | MCF_SDRAMC_SDCR_DQS_OE(0xC)); 450 MCF_SDRAMC_SDCR);
445 } 451 }
446} 452}
447 453
448void gpio_init(void) 454void gpio_init(void)
449{ 455{
450 /* Enable UART0 pins */ 456 /* Enable UART0 pins */
451 MCF_GPIO_PAR_UART = ( 0 457 writew(MCF_GPIO_PAR_UART_PAR_URXD0 | MCF_GPIO_PAR_UART_PAR_UTXD0,
452 | MCF_GPIO_PAR_UART_PAR_URXD0 458 MCFGPIO_PAR_UART);
453 | MCF_GPIO_PAR_UART_PAR_UTXD0);
454
455 /* Initialize TIN3 as a GPIO output to enable the write
456 half of the latch */
457 MCF_GPIO_PAR_TIMER = 0x00;
458 __raw_writeb(0x08, MCFGPIO_PDDR_TIMER);
459 __raw_writeb(0x00, MCFGPIO_PCLRR_TIMER);
460 459
460 /*
461 * Initialize TIN3 as a GPIO output to enable the write
462 * half of the latch.
463 */
464 writeb(0x00, MCFGPIO_PAR_TIMER);
465 writeb(0x08, MCFGPIO_PDDR_TIMER);
466 writeb(0x00, MCFGPIO_PCLRR_TIMER);
461} 467}
462 468
463int clock_pll(int fsys, int flags) 469int clock_pll(int fsys, int flags)
@@ -469,7 +475,7 @@ int clock_pll(int fsys, int flags)
469 475
470 if (fsys == 0) { 476 if (fsys == 0) {
471 /* Return current PLL output */ 477 /* Return current PLL output */
472 mfd = MCF_PLL_PFDR; 478 mfd = readb(MCF_PLL_PFDR);
473 479
474 return (fref * mfd / (BUSDIV * 4)); 480 return (fref * mfd / (BUSDIV * 4));
475 } 481 }
@@ -495,9 +501,10 @@ int clock_pll(int fsys, int flags)
495 * If it has then the SDRAM needs to be put into self refresh 501 * If it has then the SDRAM needs to be put into self refresh
496 * mode before reprogramming the PLL. 502 * mode before reprogramming the PLL.
497 */ 503 */
498 if (MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF) 504 if (readl(MCF_SDRAMC_SDCR) & MCF_SDRAMC_SDCR_REF)
499 /* Put SDRAM into self refresh mode */ 505 /* Put SDRAM into self refresh mode */
500 MCF_SDRAMC_SDCR &= ~MCF_SDRAMC_SDCR_CKE; 506 writel(readl(MCF_SDRAMC_SDCR) & ~MCF_SDRAMC_SDCR_CKE,
507 MCF_SDRAMC_SDCR);
501 508
502 /* 509 /*
503 * Initialize the PLL to generate the new system clock frequency. 510 * Initialize the PLL to generate the new system clock frequency.
@@ -508,11 +515,10 @@ int clock_pll(int fsys, int flags)
508 clock_limp(DEFAULT_LPD); 515 clock_limp(DEFAULT_LPD);
509 516
510 /* Reprogram PLL for desired fsys */ 517 /* Reprogram PLL for desired fsys */
511 MCF_PLL_PODR = (0 518 writeb(MCF_PLL_PODR_CPUDIV(BUSDIV/3) | MCF_PLL_PODR_BUSDIV(BUSDIV),
512 | MCF_PLL_PODR_CPUDIV(BUSDIV/3) 519 MCF_PLL_PODR);
513 | MCF_PLL_PODR_BUSDIV(BUSDIV));
514 520
515 MCF_PLL_PFDR = mfd; 521 writeb(mfd, MCF_PLL_PFDR);
516 522
517 /* Exit LIMP mode */ 523 /* Exit LIMP mode */
518 clock_exit_limp(); 524 clock_exit_limp();
@@ -520,12 +526,13 @@ int clock_pll(int fsys, int flags)
520 /* 526 /*
521 * Return the SDRAM to normal operation if it is in use. 527 * Return the SDRAM to normal operation if it is in use.
522 */ 528 */
523 if (MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF) 529 if (readl(MCF_SDRAMC_SDCR) & MCF_SDRAMC_SDCR_REF)
524 /* Exit self refresh mode */ 530 /* Exit self refresh mode */
525 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_CKE; 531 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_CKE,
532 MCF_SDRAMC_SDCR);
526 533
527 /* Errata - workaround for SDRAM opeartion after exiting LIMP mode */ 534 /* Errata - workaround for SDRAM opeartion after exiting LIMP mode */
528 MCF_SDRAMC_LIMP_FIX = MCF_SDRAMC_REFRESH; 535 writel(MCF_SDRAMC_REFRESH, MCF_SDRAMC_LIMP_FIX);
529 536
530 /* wait for DQS logic to relock */ 537 /* wait for DQS logic to relock */
531 for (i = 0; i < 0x200; i++) 538 for (i = 0; i < 0x200; i++)
@@ -546,14 +553,12 @@ int clock_limp(int div)
546 553
547 /* Save of the current value of the SSIDIV so we don't 554 /* Save of the current value of the SSIDIV so we don't
548 overwrite the value*/ 555 overwrite the value*/
549 temp = (MCF_CCM_CDR & MCF_CCM_CDR_SSIDIV(0xF)); 556 temp = readw(MCF_CCM_CDR) & MCF_CCM_CDR_SSIDIV(0xF);
550 557
551 /* Apply the divider to the system clock */ 558 /* Apply the divider to the system clock */
552 MCF_CCM_CDR = ( 0 559 writew(MCF_CCM_CDR_LPDIV(div) | MCF_CCM_CDR_SSIDIV(temp), MCF_CCM_CDR);
553 | MCF_CCM_CDR_LPDIV(div)
554 | MCF_CCM_CDR_SSIDIV(temp));
555 560
556 MCF_CCM_MISCCR |= MCF_CCM_MISCCR_LIMP; 561 writew(readw(MCF_CCM_MISCCR) | MCF_CCM_MISCCR_LIMP, MCF_CCM_MISCCR);
557 562
558 return (FREF/(3*(1 << div))); 563 return (FREF/(3*(1 << div)));
559} 564}
@@ -563,10 +568,10 @@ int clock_exit_limp(void)
563 int fout; 568 int fout;
564 569
565 /* Exit LIMP mode */ 570 /* Exit LIMP mode */
566 MCF_CCM_MISCCR = (MCF_CCM_MISCCR & ~ MCF_CCM_MISCCR_LIMP); 571 writew(readw(MCF_CCM_MISCCR) & ~MCF_CCM_MISCCR_LIMP, MCF_CCM_MISCCR);
567 572
568 /* Wait for PLL to lock */ 573 /* Wait for PLL to lock */
569 while (!(MCF_CCM_MISCCR & MCF_CCM_MISCCR_PLL_LOCK)) 574 while (!(readw(MCF_CCM_MISCCR) & MCF_CCM_MISCCR_PLL_LOCK))
570 ; 575 ;
571 576
572 fout = get_sys_clock(); 577 fout = get_sys_clock();
@@ -579,10 +584,10 @@ int get_sys_clock(void)
579 int divider; 584 int divider;
580 585
581 /* Test to see if device is in LIMP mode */ 586 /* Test to see if device is in LIMP mode */
582 if (MCF_CCM_MISCCR & MCF_CCM_MISCCR_LIMP) { 587 if (readw(MCF_CCM_MISCCR) & MCF_CCM_MISCCR_LIMP) {
583 divider = MCF_CCM_CDR & MCF_CCM_CDR_LPDIV(0xF); 588 divider = readw(MCF_CCM_CDR) & MCF_CCM_CDR_LPDIV(0xF);
584 return (FREF/(2 << divider)); 589 return (FREF/(2 << divider));
585 } 590 }
586 else 591 else
587 return ((FREF * MCF_PLL_PFDR) / (BUSDIV * 4)); 592 return (FREF * readb(MCF_PLL_PFDR)) / (BUSDIV * 4);
588} 593}
diff --git a/arch/m68k/platform/coldfire/m54xx.c b/arch/m68k/platform/coldfire/m54xx.c
index 2081c6cbb3de..b587bf35175b 100644
--- a/arch/m68k/platform/coldfire/m54xx.c
+++ b/arch/m68k/platform/coldfire/m54xx.c
@@ -30,14 +30,12 @@
30static void __init m54xx_uarts_init(void) 30static void __init m54xx_uarts_init(void)
31{ 31{
32 /* enable io pins */ 32 /* enable io pins */
33 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, 33 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC0);
34 MCF_MBAR + MCF_PAR_PSC(0));
35 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS, 34 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS,
36 MCF_MBAR + MCF_PAR_PSC(1)); 35 MCFGPIO_PAR_PSC1);
37 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS | 36 __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)); 37 MCF_PAR_PSC_CTS_CTS, MCFGPIO_PAR_PSC2);
39 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, 38 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC3);
40 MCF_MBAR + MCF_PAR_PSC(3));
41} 39}
42 40
43/***************************************************************************/ 41/***************************************************************************/
@@ -46,10 +44,10 @@ static void mcf54xx_reset(void)
46{ 44{
47 /* disable interrupts and enable the watchdog */ 45 /* disable interrupts and enable the watchdog */
48 asm("movew #0x2700, %sr\n"); 46 asm("movew #0x2700, %sr\n");
49 __raw_writel(0, MCF_MBAR + MCF_GPT_GMS0); 47 __raw_writel(0, MCF_GPT_GMS0);
50 __raw_writel(MCF_GPT_GCIR_CNT(1), MCF_MBAR + MCF_GPT_GCIR0); 48 __raw_writel(MCF_GPT_GCIR_CNT(1), MCF_GPT_GCIR0);
51 __raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4), 49 __raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4),
52 MCF_MBAR + MCF_GPT_GMS0); 50 MCF_GPT_GMS0);
53} 51}
54 52
55/***************************************************************************/ 53/***************************************************************************/
diff --git a/arch/m68k/platform/coldfire/nettel.c b/arch/m68k/platform/coldfire/nettel.c
index e925ea4602f8..ddc48ec1b800 100644
--- a/arch/m68k/platform/coldfire/nettel.c
+++ b/arch/m68k/platform/coldfire/nettel.c
@@ -121,14 +121,14 @@ static void __init nettel_smc91x_setmac(unsigned int ioaddr, unsigned int flasha
121 121
122static void __init nettel_smc91x_init(void) 122static void __init nettel_smc91x_init(void)
123{ 123{
124 writew(0x00ec, MCF_MBAR + MCFSIM_PADDR); 124 writew(0x00ec, MCFSIM_PADDR);
125 mcf_setppdata(0, 0x0080); 125 mcf_setppdata(0, 0x0080);
126 writew(1, NETTEL_SMC0_ADDR + SMC91xx_BANKSELECT); 126 writew(1, NETTEL_SMC0_ADDR + SMC91xx_BANKSELECT);
127 writew(0x0067, NETTEL_SMC0_ADDR + SMC91xx_BASEADDR); 127 writew(0x0067, NETTEL_SMC0_ADDR + SMC91xx_BASEADDR);
128 mcf_setppdata(0x0080, 0); 128 mcf_setppdata(0x0080, 0);
129 129
130 /* Set correct chip select timing for SMC9196 accesses */ 130 /* Set correct chip select timing for SMC9196 accesses */
131 writew(0x1180, MCF_MBAR + MCFSIM_CSCR3); 131 writew(0x1180, MCFSIM_CSCR3);
132 132
133 /* Set the SMC interrupts to be auto-vectored */ 133 /* Set the SMC interrupts to be auto-vectored */
134 mcf_autovector(NETTEL_SMC0_IRQ); 134 mcf_autovector(NETTEL_SMC0_IRQ);
diff --git a/arch/m68k/platform/coldfire/pci.c b/arch/m68k/platform/coldfire/pci.c
index 553210d3d4c1..8572246db84d 100644
--- a/arch/m68k/platform/coldfire/pci.c
+++ b/arch/m68k/platform/coldfire/pci.c
@@ -272,8 +272,8 @@ static int __init mcf_pci_init(void)
272 PACR_EXTMINTE(0x1f), PACR); 272 PACR_EXTMINTE(0x1f), PACR);
273 273
274 /* Set required multi-function pins for PCI bus use */ 274 /* Set required multi-function pins for PCI bus use */
275 __raw_writew(0x3ff, MCF_PAR_PCIBG); 275 __raw_writew(0x3ff, MCFGPIO_PAR_PCIBG);
276 __raw_writew(0x3ff, MCF_PAR_PCIBR); 276 __raw_writew(0x3ff, MCFGPIO_PAR_PCIBR);
277 277
278 /* Set up config space for local host bus controller */ 278 /* Set up config space for local host bus controller */
279 __raw_writel(PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | 279 __raw_writel(PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
diff --git a/arch/m68k/platform/coldfire/reset.c b/arch/m68k/platform/coldfire/reset.c
index 933e54eacc69..f30952f0cbe6 100644
--- a/arch/m68k/platform/coldfire/reset.c
+++ b/arch/m68k/platform/coldfire/reset.c
@@ -27,7 +27,7 @@ static void mcf_cpu_reset(void)
27{ 27{
28 local_irq_disable(); 28 local_irq_disable();
29 /* Set watchdog to soft reset, and enabled */ 29 /* Set watchdog to soft reset, and enabled */
30 __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); 30 __raw_writeb(0xc0, MCFSIM_SYPCR);
31 for (;;) 31 for (;;)
32 /* wait for watchdog to timeout */; 32 /* wait for watchdog to timeout */;
33} 33}
diff --git a/arch/m68k/platform/coldfire/sltimers.c b/arch/m68k/platform/coldfire/sltimers.c
index 2027fc20b876..bb5a25ada848 100644
--- a/arch/m68k/platform/coldfire/sltimers.c
+++ b/arch/m68k/platform/coldfire/sltimers.c
@@ -32,7 +32,7 @@
32/* 32/*
33 * By default use Slice Timer 1 as the profiler clock timer. 33 * By default use Slice Timer 1 as the profiler clock timer.
34 */ 34 */
35#define PA(a) (MCF_MBAR + MCFSLT_TIMER1 + (a)) 35#define PA(a) (MCFSLT_TIMER1 + (a))
36 36
37/* 37/*
38 * Choose a reasonably fast profile timer. Make it an odd value to 38 * Choose a reasonably fast profile timer. Make it an odd value to
@@ -76,7 +76,7 @@ void mcfslt_profile_init(void)
76/* 76/*
77 * By default use Slice Timer 0 as the system clock timer. 77 * By default use Slice Timer 0 as the system clock timer.
78 */ 78 */
79#define TA(a) (MCF_MBAR + MCFSLT_TIMER0 + (a)) 79#define TA(a) (MCFSLT_TIMER0 + (a))
80 80
81static u32 mcfslt_cycles_per_jiffy; 81static u32 mcfslt_cycles_per_jiffy;
82static u32 mcfslt_cnt; 82static u32 mcfslt_cnt;
diff --git a/arch/m68k/platform/coldfire/timers.c b/arch/m68k/platform/coldfire/timers.c
index 0a273e75408c..51f6d2af807f 100644
--- a/arch/m68k/platform/coldfire/timers.c
+++ b/arch/m68k/platform/coldfire/timers.c
@@ -56,13 +56,13 @@ static void init_timer_irq(void)
56#ifdef MCFSIM_ICR_AUTOVEC 56#ifdef MCFSIM_ICR_AUTOVEC
57 /* Timer1 is always used as system timer */ 57 /* Timer1 is always used as system timer */
58 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, 58 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
59 MCF_MBAR + MCFSIM_TIMER1ICR); 59 MCFSIM_TIMER1ICR);
60 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); 60 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
61 61
62#ifdef CONFIG_HIGHPROFILE 62#ifdef CONFIG_HIGHPROFILE
63 /* Timer2 is to be used as a high speed profile timer */ 63 /* Timer2 is to be used as a high speed profile timer */
64 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, 64 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
65 MCF_MBAR + MCFSIM_TIMER2ICR); 65 MCFSIM_TIMER2ICR);
66 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); 66 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
67#endif 67#endif
68#endif /* MCFSIM_ICR_AUTOVEC */ 68#endif /* MCFSIM_ICR_AUTOVEC */
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index ab9afcaa7f6a..6133bed2b855 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -243,14 +243,11 @@ choice
243config MICROBLAZE_4K_PAGES 243config MICROBLAZE_4K_PAGES
244 bool "4k page size" 244 bool "4k page size"
245 245
246config MICROBLAZE_8K_PAGES
247 bool "8k page size"
248
249config MICROBLAZE_16K_PAGES 246config MICROBLAZE_16K_PAGES
250 bool "16k page size" 247 bool "16k page size"
251 248
252config MICROBLAZE_32K_PAGES 249config MICROBLAZE_64K_PAGES
253 bool "32k page size" 250 bool "64k page size"
254 251
255endchoice 252endchoice
256 253
diff --git a/arch/microblaze/include/asm/clinkage.h b/arch/microblaze/include/asm/clinkage.h
deleted file mode 100644
index 9e218435a55c..000000000000
--- a/arch/microblaze/include/asm/clinkage.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <linux/linkage.h>
diff --git a/arch/microblaze/include/asm/elf.h b/arch/microblaze/include/asm/elf.h
index 834849f59ae8..640ddd4b6a9b 100644
--- a/arch/microblaze/include/asm/elf.h
+++ b/arch/microblaze/include/asm/elf.h
@@ -116,7 +116,8 @@ do { \
116} while (0) 116} while (0)
117 117
118#ifdef __KERNEL__ 118#ifdef __KERNEL__
119#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT) 119#define SET_PERSONALITY(ex) \
120 set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK)))
120#endif 121#endif
121 122
122#endif /* __uClinux__ */ 123#endif /* __uClinux__ */
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 8cdac14b55b0..4fbfdc1ac7f8 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -35,6 +35,10 @@ extern resource_size_t isa_mem_base;
35 35
36#define IO_SPACE_LIMIT (0xFFFFFFFF) 36#define IO_SPACE_LIMIT (0xFFFFFFFF)
37 37
38/* the following is needed to support PCI with some drivers */
39
40#define mmiowb()
41
38static inline unsigned char __raw_readb(const volatile void __iomem *addr) 42static inline unsigned char __raw_readb(const volatile void __iomem *addr)
39{ 43{
40 return *(volatile unsigned char __force *)addr; 44 return *(volatile unsigned char __force *)addr;
@@ -248,4 +252,94 @@ static inline void __iomem *__ioremap(phys_addr_t address, unsigned long size,
248#define ioport_map(port, nr) ((void __iomem *)(port)) 252#define ioport_map(port, nr) ((void __iomem *)(port))
249#define ioport_unmap(addr) 253#define ioport_unmap(addr)
250 254
255/* from asm-generic/io.h */
256#ifndef insb
257static inline void insb(unsigned long addr, void *buffer, int count)
258{
259 if (count) {
260 u8 *buf = buffer;
261 do {
262 u8 x = inb(addr);
263 *buf++ = x;
264 } while (--count);
265 }
266}
267#endif
268
269#ifndef insw
270static inline void insw(unsigned long addr, void *buffer, int count)
271{
272 if (count) {
273 u16 *buf = buffer;
274 do {
275 u16 x = inw(addr);
276 *buf++ = x;
277 } while (--count);
278 }
279}
280#endif
281
282#ifndef insl
283static inline void insl(unsigned long addr, void *buffer, int count)
284{
285 if (count) {
286 u32 *buf = buffer;
287 do {
288 u32 x = inl(addr);
289 *buf++ = x;
290 } while (--count);
291 }
292}
293#endif
294
295#ifndef outsb
296static inline void outsb(unsigned long addr, const void *buffer, int count)
297{
298 if (count) {
299 const u8 *buf = buffer;
300 do {
301 outb(*buf++, addr);
302 } while (--count);
303 }
304}
305#endif
306
307#ifndef outsw
308static inline void outsw(unsigned long addr, const void *buffer, int count)
309{
310 if (count) {
311 const u16 *buf = buffer;
312 do {
313 outw(*buf++, addr);
314 } while (--count);
315 }
316}
317#endif
318
319#ifndef outsl
320static inline void outsl(unsigned long addr, const void *buffer, int count)
321{
322 if (count) {
323 const u32 *buf = buffer;
324 do {
325 outl(*buf++, addr);
326 } while (--count);
327 }
328}
329#endif
330
331#define ioread8_rep(p, dst, count) \
332 insb((unsigned long) (p), (dst), (count))
333#define ioread16_rep(p, dst, count) \
334 insw((unsigned long) (p), (dst), (count))
335#define ioread32_rep(p, dst, count) \
336 insl((unsigned long) (p), (dst), (count))
337
338#define iowrite8_rep(p, src, count) \
339 outsb((unsigned long) (p), (src), (count))
340#define iowrite16_rep(p, src, count) \
341 outsw((unsigned long) (p), (src), (count))
342#define iowrite32_rep(p, src, count) \
343 outsl((unsigned long) (p), (src), (count))
344
251#endif /* _ASM_MICROBLAZE_IO_H */ 345#endif /* _ASM_MICROBLAZE_IO_H */
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h
index 287c5485d286..85a5ae8e9bd0 100644
--- a/arch/microblaze/include/asm/page.h
+++ b/arch/microblaze/include/asm/page.h
@@ -23,12 +23,10 @@
23#ifdef __KERNEL__ 23#ifdef __KERNEL__
24 24
25/* PAGE_SHIFT determines the page size */ 25/* PAGE_SHIFT determines the page size */
26#if defined(CONFIG_MICROBLAZE_32K_PAGES) 26#if defined(CONFIG_MICROBLAZE_64K_PAGES)
27#define PAGE_SHIFT 15 27#define PAGE_SHIFT 16
28#elif defined(CONFIG_MICROBLAZE_16K_PAGES) 28#elif defined(CONFIG_MICROBLAZE_16K_PAGES)
29#define PAGE_SHIFT 14 29#define PAGE_SHIFT 14
30#elif defined(CONFIG_MICROBLAZE_8K_PAGES)
31#define PAGE_SHIFT 13
32#else 30#else
33#define PAGE_SHIFT 12 31#define PAGE_SHIFT 12
34#endif 32#endif
@@ -37,6 +35,8 @@
37 35
38#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR)) 36#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))
39 37
38#define PTE_SHIFT (PAGE_SHIFT - 2) /* 1024 ptes per page */
39
40#ifndef __ASSEMBLY__ 40#ifndef __ASSEMBLY__
41 41
42/* MS be sure that SLAB allocates aligned objects */ 42/* MS be sure that SLAB allocates aligned objects */
@@ -71,7 +71,6 @@ extern unsigned int __page_offset;
71 * The basic type of a PTE - 32 bit physical addressing. 71 * The basic type of a PTE - 32 bit physical addressing.
72 */ 72 */
73typedef unsigned long pte_basic_t; 73typedef unsigned long pte_basic_t;
74#define PTE_SHIFT (PAGE_SHIFT - 2) /* 1024 ptes per page */
75#define PTE_FMT "%.8lx" 74#define PTE_FMT "%.8lx"
76 75
77#endif /* CONFIG_MMU */ 76#endif /* CONFIG_MMU */
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index a0da88bf70c5..41cc841091b0 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -22,6 +22,8 @@
22#include <asm/prom.h> 22#include <asm/prom.h>
23#include <asm/pci-bridge.h> 23#include <asm/pci-bridge.h>
24 24
25#include <asm-generic/pci-dma-compat.h>
26
25#define PCIBIOS_MIN_IO 0x1000 27#define PCIBIOS_MIN_IO 0x1000
26#define PCIBIOS_MIN_MEM 0x10000000 28#define PCIBIOS_MIN_MEM 0x10000000
27 29
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index 3ef7b9cafeca..a7311cd9dee0 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -234,12 +234,6 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
234#ifndef _PAGE_SHARED 234#ifndef _PAGE_SHARED
235#define _PAGE_SHARED 0 235#define _PAGE_SHARED 0
236#endif 236#endif
237#ifndef _PAGE_HWWRITE
238#define _PAGE_HWWRITE 0
239#endif
240#ifndef _PAGE_HWEXEC
241#define _PAGE_HWEXEC 0
242#endif
243#ifndef _PAGE_EXEC 237#ifndef _PAGE_EXEC
244#define _PAGE_EXEC 0 238#define _PAGE_EXEC 0
245#endif 239#endif
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index 98b17f9f904b..eef84de5e8c8 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -109,20 +109,24 @@ no_fdt_arg:
109#ifndef CONFIG_CMDLINE_BOOL 109#ifndef CONFIG_CMDLINE_BOOL
110/* 110/*
111 * handling command line 111 * handling command line
112 * copy command line to __init_end. There is space for storing command line. 112 * copy command line directly to cmd_line placed in data section.
113 */ 113 */
114 beqid r5, skip /* Skip if NULL pointer */
114 or r6, r0, r0 /* incremment */ 115 or r6, r0, r0 /* incremment */
115 ori r4, r0, __init_end /* load address of command line */ 116 ori r4, r0, cmd_line /* load address of command line */
116 tophys(r4,r4) /* convert to phys address */ 117 tophys(r4,r4) /* convert to phys address */
117 ori r3, r0, COMMAND_LINE_SIZE - 1 /* number of loops */ 118 ori r3, r0, COMMAND_LINE_SIZE - 1 /* number of loops */
118_copy_command_line: 119_copy_command_line:
119 lbu r2, r5, r6 /* r2=r5+r6 - r5 contain pointer to command line */ 120 /* r2=r5+r6 - r5 contain pointer to command line */
120 sb r2, r4, r6 /* addr[r4+r6]= r2*/ 121 lbu r2, r5, r6
122 beqid r2, skip /* Skip if no data */
123 sb r2, r4, r6 /* addr[r4+r6]= r2*/
121 addik r6, r6, 1 /* increment counting */ 124 addik r6, r6, 1 /* increment counting */
122 bgtid r3, _copy_command_line /* loop for all entries */ 125 bgtid r3, _copy_command_line /* loop for all entries */
123 addik r3, r3, -1 /* descrement loop */ 126 addik r3, r3, -1 /* decrement loop */
124 addik r5, r4, 0 /* add new space for command line */ 127 addik r5, r4, 0 /* add new space for command line */
125 tovirt(r5,r5) 128 tovirt(r5,r5)
129skip:
126#endif /* CONFIG_CMDLINE_BOOL */ 130#endif /* CONFIG_CMDLINE_BOOL */
127 131
128#ifdef NOT_COMPILE 132#ifdef NOT_COMPILE
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
index aa510f450ac6..61b3a1fed46f 100644
--- a/arch/microblaze/kernel/hw_exception_handler.S
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -75,6 +75,7 @@
75#include <asm/mmu.h> 75#include <asm/mmu.h>
76#include <asm/pgtable.h> 76#include <asm/pgtable.h>
77#include <asm/signal.h> 77#include <asm/signal.h>
78#include <asm/registers.h>
78#include <asm/asm-offsets.h> 79#include <asm/asm-offsets.h>
79 80
80#undef DEBUG 81#undef DEBUG
@@ -581,7 +582,7 @@ ex_handler_done:
581 * tried to access a kernel or read-protected page - always 582 * tried to access a kernel or read-protected page - always
582 * a SEGV). All other faults here must be stores, so no 583 * a SEGV). All other faults here must be stores, so no
583 * need to check ESR_S as well. */ 584 * need to check ESR_S as well. */
584 andi r4, r4, 0x800 /* ESR_Z - zone protection */ 585 andi r4, r4, ESR_DIZ /* ESR_Z - zone protection */
585 bnei r4, ex2 586 bnei r4, ex2
586 587
587 ori r4, r0, swapper_pg_dir 588 ori r4, r0, swapper_pg_dir
@@ -595,25 +596,25 @@ ex_handler_done:
595 * tried to access a kernel or read-protected page - always 596 * tried to access a kernel or read-protected page - always
596 * a SEGV). All other faults here must be stores, so no 597 * a SEGV). All other faults here must be stores, so no
597 * need to check ESR_S as well. */ 598 * need to check ESR_S as well. */
598 andi r4, r4, 0x800 /* ESR_Z */ 599 andi r4, r4, ESR_DIZ /* ESR_Z */
599 bnei r4, ex2 600 bnei r4, ex2
600 /* get current task address */ 601 /* get current task address */
601 addi r4 ,CURRENT_TASK, TOPHYS(0); 602 addi r4 ,CURRENT_TASK, TOPHYS(0);
602 lwi r4, r4, TASK_THREAD+PGDIR 603 lwi r4, r4, TASK_THREAD+PGDIR
603 ex4: 604 ex4:
604 tophys(r4,r4) 605 tophys(r4,r4)
605 BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */ 606 /* Create L1 (pgdir/pmd) address */
606 andi r5, r5, 0xffc 607 BSRLI(r5,r3, PGDIR_SHIFT - 2)
608 andi r5, r5, PAGE_SIZE - 4
607/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 609/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
608 or r4, r4, r5 610 or r4, r4, r5
609 lwi r4, r4, 0 /* Get L1 entry */ 611 lwi r4, r4, 0 /* Get L1 entry */
610 andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */ 612 andi r5, r4, PAGE_MASK /* Extract L2 (pte) base address */
611 beqi r5, ex2 /* Bail if no table */ 613 beqi r5, ex2 /* Bail if no table */
612 614
613 tophys(r5,r5) 615 tophys(r5,r5)
614 BSRLI(r6,r3,10) /* Compute PTE address */ 616 BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */
615 andi r6, r6, 0xffc 617 andi r6, r6, PAGE_SIZE - 4
616 andi r5, r5, 0xfffff003
617 or r5, r5, r6 618 or r5, r5, r6
618 lwi r4, r5, 0 /* Get Linux PTE */ 619 lwi r4, r5, 0 /* Get Linux PTE */
619 620
@@ -632,7 +633,9 @@ ex_handler_done:
632 * Many of these bits are software only. Bits we don't set 633 * Many of these bits are software only. Bits we don't set
633 * here we (properly should) assume have the appropriate value. 634 * here we (properly should) assume have the appropriate value.
634 */ 635 */
635 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */ 636/* Ignore memory coherent, just LSB on ZSEL is used + EX/WR */
637 andi r4, r4, PAGE_MASK | TLB_EX | TLB_WR | \
638 TLB_ZSEL(1) | TLB_ATTR_MASK
636 ori r4, r4, _PAGE_HWEXEC /* make it executable */ 639 ori r4, r4, _PAGE_HWEXEC /* make it executable */
637 640
638 /* find the TLB index that caused the fault. It has to be here*/ 641 /* find the TLB index that caused the fault. It has to be here*/
@@ -701,18 +704,18 @@ ex_handler_done:
701 lwi r4, r4, TASK_THREAD+PGDIR 704 lwi r4, r4, TASK_THREAD+PGDIR
702 ex6: 705 ex6:
703 tophys(r4,r4) 706 tophys(r4,r4)
704 BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */ 707 /* Create L1 (pgdir/pmd) address */
705 andi r5, r5, 0xffc 708 BSRLI(r5,r3, PGDIR_SHIFT - 2)
709 andi r5, r5, PAGE_SIZE - 4
706/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 710/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
707 or r4, r4, r5 711 or r4, r4, r5
708 lwi r4, r4, 0 /* Get L1 entry */ 712 lwi r4, r4, 0 /* Get L1 entry */
709 andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */ 713 andi r5, r4, PAGE_MASK /* Extract L2 (pte) base address */
710 beqi r5, ex7 /* Bail if no table */ 714 beqi r5, ex7 /* Bail if no table */
711 715
712 tophys(r5,r5) 716 tophys(r5,r5)
713 BSRLI(r6,r3,10) /* Compute PTE address */ 717 BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */
714 andi r6, r6, 0xffc 718 andi r6, r6, PAGE_SIZE - 4
715 andi r5, r5, 0xfffff003
716 or r5, r5, r6 719 or r5, r5, r6
717 lwi r4, r5, 0 /* Get Linux PTE */ 720 lwi r4, r5, 0 /* Get Linux PTE */
718 721
@@ -731,7 +734,8 @@ ex_handler_done:
731 * here we (properly should) assume have the appropriate value. 734 * here we (properly should) assume have the appropriate value.
732 */ 735 */
733 brid finish_tlb_load 736 brid finish_tlb_load
734 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */ 737 andi r4, r4, PAGE_MASK | TLB_EX | TLB_WR | \
738 TLB_ZSEL(1) | TLB_ATTR_MASK
735 ex7: 739 ex7:
736 /* The bailout. Restore registers to pre-exception conditions 740 /* The bailout. Restore registers to pre-exception conditions
737 * and call the heavyweights to help us out. 741 * and call the heavyweights to help us out.
@@ -771,18 +775,18 @@ ex_handler_done:
771 lwi r4, r4, TASK_THREAD+PGDIR 775 lwi r4, r4, TASK_THREAD+PGDIR
772 ex9: 776 ex9:
773 tophys(r4,r4) 777 tophys(r4,r4)
774 BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */ 778 /* Create L1 (pgdir/pmd) address */
775 andi r5, r5, 0xffc 779 BSRLI(r5,r3, PGDIR_SHIFT - 2)
780 andi r5, r5, PAGE_SIZE - 4
776/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 781/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
777 or r4, r4, r5 782 or r4, r4, r5
778 lwi r4, r4, 0 /* Get L1 entry */ 783 lwi r4, r4, 0 /* Get L1 entry */
779 andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */ 784 andi r5, r4, PAGE_MASK /* Extract L2 (pte) base address */
780 beqi r5, ex10 /* Bail if no table */ 785 beqi r5, ex10 /* Bail if no table */
781 786
782 tophys(r5,r5) 787 tophys(r5,r5)
783 BSRLI(r6,r3,10) /* Compute PTE address */ 788 BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */
784 andi r6, r6, 0xffc 789 andi r6, r6, PAGE_SIZE - 4
785 andi r5, r5, 0xfffff003
786 or r5, r5, r6 790 or r5, r5, r6
787 lwi r4, r5, 0 /* Get Linux PTE */ 791 lwi r4, r5, 0 /* Get Linux PTE */
788 792
@@ -801,7 +805,8 @@ ex_handler_done:
801 * here we (properly should) assume have the appropriate value. 805 * here we (properly should) assume have the appropriate value.
802 */ 806 */
803 brid finish_tlb_load 807 brid finish_tlb_load
804 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */ 808 andi r4, r4, PAGE_MASK | TLB_EX | TLB_WR | \
809 TLB_ZSEL(1) | TLB_ATTR_MASK
805 ex10: 810 ex10:
806 /* The bailout. Restore registers to pre-exception conditions 811 /* The bailout. Restore registers to pre-exception conditions
807 * and call the heavyweights to help us out. 812 * and call the heavyweights to help us out.
@@ -854,8 +859,14 @@ ex_handler_done:
854 * set of bits. These are size, valid, E, U0, and ensure 859 * set of bits. These are size, valid, E, U0, and ensure
855 * bits 20 and 21 are zero. 860 * bits 20 and 21 are zero.
856 */ 861 */
857 andi r3, r3, 0xfffff000 862 andi r3, r3, PAGE_MASK
858 ori r3, r3, 0x0c0 863#ifdef CONFIG_MICROBLAZE_64K_PAGES
864 ori r3, r3, TLB_VALID | TLB_PAGESZ(PAGESZ_64K)
865#elif CONFIG_MICROBLAZE_16K_PAGES
866 ori r3, r3, TLB_VALID | TLB_PAGESZ(PAGESZ_16K)
867#else
868 ori r3, r3, TLB_VALID | TLB_PAGESZ(PAGESZ_4K)
869#endif
859 mts rtlbhi, r3 /* Load TLB HI */ 870 mts rtlbhi, r3 /* Load TLB HI */
860 nop 871 nop
861 872
diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
index 88a01636f785..2e5079ab53d2 100644
--- a/arch/microblaze/kernel/reset.c
+++ b/arch/microblaze/kernel/reset.c
@@ -26,13 +26,14 @@ void of_platform_reset_gpio_probe(void)
26 "hard-reset-gpios", 0); 26 "hard-reset-gpios", 0);
27 27
28 if (!gpio_is_valid(handle)) { 28 if (!gpio_is_valid(handle)) {
29 printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n", 29 pr_info("Skipping unavailable RESET gpio %d (%s)\n",
30 handle, "reset"); 30 handle, "reset");
31 return;
31 } 32 }
32 33
33 ret = gpio_request(handle, "reset"); 34 ret = gpio_request(handle, "reset");
34 if (ret < 0) { 35 if (ret < 0) {
35 printk(KERN_INFO "GPIO pin is already allocated\n"); 36 pr_info("GPIO pin is already allocated\n");
36 return; 37 return;
37 } 38 }
38 39
@@ -49,7 +50,7 @@ void of_platform_reset_gpio_probe(void)
49 /* Setup output direction */ 50 /* Setup output direction */
50 gpio_set_value(handle, 0); 51 gpio_set_value(handle, 0);
51 52
52 printk(KERN_INFO "RESET: Registered gpio device: %d, current val: %d\n", 53 pr_info("RESET: Registered gpio device: %d, current val: %d\n",
53 handle, reset_val); 54 handle, reset_val);
54 return; 55 return;
55err: 56err:
@@ -60,7 +61,10 @@ err:
60 61
61static void gpio_system_reset(void) 62static void gpio_system_reset(void)
62{ 63{
63 gpio_set_value(handle, 1 - reset_val); 64 if (gpio_is_valid(handle))
65 gpio_set_value(handle, 1 - reset_val);
66 else
67 pr_notice("Reset GPIO unavailable - halting!\n");
64} 68}
65#else 69#else
66#define gpio_system_reset() do {} while (0) 70#define gpio_system_reset() do {} while (0)
@@ -72,30 +76,29 @@ void of_platform_reset_gpio_probe(void)
72 76
73void machine_restart(char *cmd) 77void machine_restart(char *cmd)
74{ 78{
75 printk(KERN_NOTICE "Machine restart...\n"); 79 pr_notice("Machine restart...\n");
76 gpio_system_reset(); 80 gpio_system_reset();
77 dump_stack();
78 while (1) 81 while (1)
79 ; 82 ;
80} 83}
81 84
82void machine_shutdown(void) 85void machine_shutdown(void)
83{ 86{
84 printk(KERN_NOTICE "Machine shutdown...\n"); 87 pr_notice("Machine shutdown...\n");
85 while (1) 88 while (1)
86 ; 89 ;
87} 90}
88 91
89void machine_halt(void) 92void machine_halt(void)
90{ 93{
91 printk(KERN_NOTICE "Machine halt...\n"); 94 pr_notice("Machine halt...\n");
92 while (1) 95 while (1)
93 ; 96 ;
94} 97}
95 98
96void machine_power_off(void) 99void machine_power_off(void)
97{ 100{
98 printk(KERN_NOTICE "Machine power off...\n"); 101 pr_notice("Machine power off...\n");
99 while (1) 102 while (1)
100 ; 103 ;
101} 104}
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 4da971d4392f..954348f83505 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -40,7 +40,12 @@ DEFINE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
40DEFINE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */ 40DEFINE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
41 41
42unsigned int boot_cpuid; 42unsigned int boot_cpuid;
43char cmd_line[COMMAND_LINE_SIZE]; 43/*
44 * Placed cmd_line to .data section because can be initialized from
45 * ASM code. Default position is BSS section which is cleared
46 * in machine_early_init().
47 */
48char cmd_line[COMMAND_LINE_SIZE] __attribute__ ((section(".data")));
44 49
45void __init setup_arch(char **cmdline_p) 50void __init setup_arch(char **cmdline_p)
46{ 51{
@@ -64,7 +69,7 @@ void __init setup_arch(char **cmdline_p)
64 xilinx_pci_init(); 69 xilinx_pci_init();
65 70
66#if defined(CONFIG_SELFMOD_INTC) || defined(CONFIG_SELFMOD_TIMER) 71#if defined(CONFIG_SELFMOD_INTC) || defined(CONFIG_SELFMOD_TIMER)
67 printk(KERN_NOTICE "Self modified code enable\n"); 72 pr_notice("Self modified code enable\n");
68#endif 73#endif
69 74
70#ifdef CONFIG_VT 75#ifdef CONFIG_VT
@@ -130,12 +135,6 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
130 memset(__bss_start, 0, __bss_stop-__bss_start); 135 memset(__bss_start, 0, __bss_stop-__bss_start);
131 memset(_ssbss, 0, _esbss-_ssbss); 136 memset(_ssbss, 0, _esbss-_ssbss);
132 137
133 /* Copy command line passed from bootloader */
134#ifndef CONFIG_CMDLINE_BOOL
135 if (cmdline && cmdline[0] != '\0')
136 strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE);
137#endif
138
139 lockdep_init(); 138 lockdep_init();
140 139
141/* initialize device tree for usage in early_printk */ 140/* initialize device tree for usage in early_printk */
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index 76b9722557db..c1220dbf87cd 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -290,15 +290,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
290 case -ERESTARTNOINTR: 290 case -ERESTARTNOINTR:
291do_restart: 291do_restart:
292 /* offset of 4 bytes to re-execute trap (brki) instruction */ 292 /* offset of 4 bytes to re-execute trap (brki) instruction */
293#ifndef CONFIG_MMU
294 regs->pc -= 4; 293 regs->pc -= 4;
295#else
296 /* offset of 8 bytes required = 4 for rtbd
297 offset, plus 4 for size of
298 "brki r14,8"
299 instruction. */
300 regs->pc -= 8;
301#endif
302 break; 294 break;
303 } 295 }
304} 296}
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index 522defa7d41f..aec5020a6e31 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -116,21 +116,21 @@ static void microblaze_timer_set_mode(enum clock_event_mode mode,
116{ 116{
117 switch (mode) { 117 switch (mode) {
118 case CLOCK_EVT_MODE_PERIODIC: 118 case CLOCK_EVT_MODE_PERIODIC:
119 printk(KERN_INFO "%s: periodic\n", __func__); 119 pr_info("%s: periodic\n", __func__);
120 microblaze_timer0_start_periodic(freq_div_hz); 120 microblaze_timer0_start_periodic(freq_div_hz);
121 break; 121 break;
122 case CLOCK_EVT_MODE_ONESHOT: 122 case CLOCK_EVT_MODE_ONESHOT:
123 printk(KERN_INFO "%s: oneshot\n", __func__); 123 pr_info("%s: oneshot\n", __func__);
124 break; 124 break;
125 case CLOCK_EVT_MODE_UNUSED: 125 case CLOCK_EVT_MODE_UNUSED:
126 printk(KERN_INFO "%s: unused\n", __func__); 126 pr_info("%s: unused\n", __func__);
127 break; 127 break;
128 case CLOCK_EVT_MODE_SHUTDOWN: 128 case CLOCK_EVT_MODE_SHUTDOWN:
129 printk(KERN_INFO "%s: shutdown\n", __func__); 129 pr_info("%s: shutdown\n", __func__);
130 microblaze_timer0_stop(); 130 microblaze_timer0_stop();
131 break; 131 break;
132 case CLOCK_EVT_MODE_RESUME: 132 case CLOCK_EVT_MODE_RESUME:
133 printk(KERN_INFO "%s: resume\n", __func__); 133 pr_info("%s: resume\n", __func__);
134 break; 134 break;
135 } 135 }
136} 136}
@@ -257,7 +257,15 @@ void __init time_init(void)
257 0 257 0
258 }; 258 };
259#endif 259#endif
260 timer = of_find_compatible_node(NULL, NULL, "xlnx,xps-timer-1.00.a"); 260 prop = of_get_property(of_chosen, "system-timer", NULL);
261 if (prop)
262 timer = of_find_node_by_phandle(be32_to_cpup(prop));
263 else
264 pr_info("No chosen timer found, using default\n");
265
266 if (!timer)
267 timer = of_find_compatible_node(NULL, NULL,
268 "xlnx,xps-timer-1.00.a");
261 BUG_ON(!timer); 269 BUG_ON(!timer);
262 270
263 timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL)); 271 timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL));
@@ -266,14 +274,14 @@ void __init time_init(void)
266 timer_num = be32_to_cpup(of_get_property(timer, 274 timer_num = be32_to_cpup(of_get_property(timer,
267 "xlnx,one-timer-only", NULL)); 275 "xlnx,one-timer-only", NULL));
268 if (timer_num) { 276 if (timer_num) {
269 printk(KERN_EMERG "Please enable two timers in HW\n"); 277 pr_emerg("Please enable two timers in HW\n");
270 BUG(); 278 BUG();
271 } 279 }
272 280
273#ifdef CONFIG_SELFMOD_TIMER 281#ifdef CONFIG_SELFMOD_TIMER
274 selfmod_function((int *) arr_func, timer_baseaddr); 282 selfmod_function((int *) arr_func, timer_baseaddr);
275#endif 283#endif
276 printk(KERN_INFO "%s #0 at 0x%08x, irq=%d\n", 284 pr_info("%s #0 at 0x%08x, irq=%d\n",
277 timer->name, timer_baseaddr, irq); 285 timer->name, timer_baseaddr, irq);
278 286
279 /* If there is clock-frequency property than use it */ 287 /* If there is clock-frequency property than use it */
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 764e37a9dbb3..654b1ad39f05 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -225,7 +225,7 @@ KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
225LDFLAGS += -m $(ld-emul) 225LDFLAGS += -m $(ld-emul)
226 226
227ifdef CONFIG_MIPS 227ifdef CONFIG_MIPS
228CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -xc /dev/null | \ 228CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
229 egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ 229 egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \
230 sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/") 230 sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/")
231ifdef CONFIG_64BIT 231ifdef CONFIG_64BIT
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index feb05258a4d1..dd18e4b761a8 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -632,7 +632,7 @@ static struct board_info __initdata board_DWVS0 = {
632/* 632/*
633 * all boards 633 * all boards
634 */ 634 */
635static const struct board_info __initdata *bcm963xx_boards[] = { 635static const struct board_info __initconst *bcm963xx_boards[] = {
636#ifdef CONFIG_BCM63XX_CPU_6328 636#ifdef CONFIG_BCM63XX_CPU_6328
637 &board_96328avng, 637 &board_96328avng,
638#endif 638#endif
diff --git a/arch/mips/include/asm/compat-signal.h b/arch/mips/include/asm/compat-signal.h
index 368a99e5c3e1..6599a901b63e 100644
--- a/arch/mips/include/asm/compat-signal.h
+++ b/arch/mips/include/asm/compat-signal.h
@@ -10,68 +10,6 @@
10 10
11#include <asm/uaccess.h> 11#include <asm/uaccess.h>
12 12
13#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
14
15typedef struct compat_siginfo {
16 int si_signo;
17 int si_code;
18 int si_errno;
19
20 union {
21 int _pad[SI_PAD_SIZE32];
22
23 /* kill() */
24 struct {
25 compat_pid_t _pid; /* sender's pid */
26 compat_uid_t _uid; /* sender's uid */
27 } _kill;
28
29 /* SIGCHLD */
30 struct {
31 compat_pid_t _pid; /* which child */
32 compat_uid_t _uid; /* sender's uid */
33 int _status; /* exit code */
34 compat_clock_t _utime;
35 compat_clock_t _stime;
36 } _sigchld;
37
38 /* IRIX SIGCHLD */
39 struct {
40 compat_pid_t _pid; /* which child */
41 compat_clock_t _utime;
42 int _status; /* exit code */
43 compat_clock_t _stime;
44 } _irix_sigchld;
45
46 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
47 struct {
48 s32 _addr; /* faulting insn/memory ref. */
49 } _sigfault;
50
51 /* SIGPOLL, SIGXFSZ (To do ...) */
52 struct {
53 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
54 int _fd;
55 } _sigpoll;
56
57 /* POSIX.1b timers */
58 struct {
59 timer_t _tid; /* timer id */
60 int _overrun; /* overrun count */
61 compat_sigval_t _sigval;/* same as below */
62 int _sys_private; /* not to be passed to user */
63 } _timer;
64
65 /* POSIX.1b signals */
66 struct {
67 compat_pid_t _pid; /* sender's pid */
68 compat_uid_t _uid; /* sender's uid */
69 compat_sigval_t _sigval;
70 } _rt;
71
72 } _sifields;
73} compat_siginfo_t;
74
75static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d, 13static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d,
76 const sigset_t *s) 14 const sigset_t *s)
77{ 15{
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
index b77df0366ee6..58277e0e9cd4 100644
--- a/arch/mips/include/asm/compat.h
+++ b/arch/mips/include/asm/compat.h
@@ -43,6 +43,7 @@ typedef s64 compat_s64;
43typedef u32 compat_uint_t; 43typedef u32 compat_uint_t;
44typedef u32 compat_ulong_t; 44typedef u32 compat_ulong_t;
45typedef u64 compat_u64; 45typedef u64 compat_u64;
46typedef u32 compat_uptr_t;
46 47
47struct compat_timespec { 48struct compat_timespec {
48 compat_time_t tv_sec; 49 compat_time_t tv_sec;
@@ -124,6 +125,73 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */
124 125
125typedef u32 compat_sigset_word; 126typedef u32 compat_sigset_word;
126 127
128typedef union compat_sigval {
129 compat_int_t sival_int;
130 compat_uptr_t sival_ptr;
131} compat_sigval_t;
132
133#define SI_PAD_SIZE32 (128/sizeof(int) - 3)
134
135typedef struct compat_siginfo {
136 int si_signo;
137 int si_code;
138 int si_errno;
139
140 union {
141 int _pad[SI_PAD_SIZE32];
142
143 /* kill() */
144 struct {
145 compat_pid_t _pid; /* sender's pid */
146 __compat_uid_t _uid; /* sender's uid */
147 } _kill;
148
149 /* SIGCHLD */
150 struct {
151 compat_pid_t _pid; /* which child */
152 __compat_uid_t _uid; /* sender's uid */
153 int _status; /* exit code */
154 compat_clock_t _utime;
155 compat_clock_t _stime;
156 } _sigchld;
157
158 /* IRIX SIGCHLD */
159 struct {
160 compat_pid_t _pid; /* which child */
161 compat_clock_t _utime;
162 int _status; /* exit code */
163 compat_clock_t _stime;
164 } _irix_sigchld;
165
166 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
167 struct {
168 s32 _addr; /* faulting insn/memory ref. */
169 } _sigfault;
170
171 /* SIGPOLL, SIGXFSZ (To do ...) */
172 struct {
173 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
174 int _fd;
175 } _sigpoll;
176
177 /* POSIX.1b timers */
178 struct {
179 timer_t _tid; /* timer id */
180 int _overrun; /* overrun count */
181 compat_sigval_t _sigval;/* same as below */
182 int _sys_private; /* not to be passed to user */
183 } _timer;
184
185 /* POSIX.1b signals */
186 struct {
187 compat_pid_t _pid; /* sender's pid */
188 __compat_uid_t _uid; /* sender's uid */
189 compat_sigval_t _sigval;
190 } _rt;
191
192 } _sifields;
193} compat_siginfo_t;
194
127#define COMPAT_OFF_T_MAX 0x7fffffff 195#define COMPAT_OFF_T_MAX 0x7fffffff
128#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 196#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
129 197
@@ -133,7 +201,6 @@ typedef u32 compat_sigset_word;
133 * as pointers because the syscall entry code will have 201 * as pointers because the syscall entry code will have
134 * appropriately converted them already. 202 * appropriately converted them already.
135 */ 203 */
136typedef u32 compat_uptr_t;
137 204
138static inline void __user *compat_ptr(compat_uptr_t uptr) 205static inline void __user *compat_ptr(compat_uptr_t uptr)
139{ 206{
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index fdaf65e1a99d..c6136cb4cd40 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -104,7 +104,7 @@ obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o
104 104
105obj-$(CONFIG_OF) += prom.o 105obj-$(CONFIG_OF) += prom.o
106 106
107CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) 107CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -x c /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
108 108
109obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o 109obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
110 110
diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c
index c5dfb2c87d44..4b0c347d7a82 100644
--- a/arch/mips/pci/pci-octeon.c
+++ b/arch/mips/pci/pci-octeon.c
@@ -58,7 +58,7 @@ union octeon_pci_address {
58 } s; 58 } s;
59}; 59};
60 60
61int __initdata (*octeon_pcibios_map_irq)(const struct pci_dev *dev, 61int __initconst (*octeon_pcibios_map_irq)(const struct pci_dev *dev,
62 u8 slot, u8 pin); 62 u8 slot, u8 pin);
63enum octeon_dma_bar_type octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_INVALID; 63enum octeon_dma_bar_type octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_INVALID;
64 64
diff --git a/arch/mn10300/Makefile b/arch/mn10300/Makefile
index 33188b6e81e4..a3d0fef3b126 100644
--- a/arch/mn10300/Makefile
+++ b/arch/mn10300/Makefile
@@ -26,7 +26,7 @@ CHECKFLAGS +=
26PROCESSOR := unset 26PROCESSOR := unset
27UNIT := unset 27UNIT := unset
28 28
29KBUILD_CFLAGS += -mam33 -mmem-funcs -DCPU=AM33 29KBUILD_CFLAGS += -mam33 -DCPU=AM33 $(call cc-option,-mmem-funcs,)
30KBUILD_AFLAGS += -mam33 -DCPU=AM33 30KBUILD_AFLAGS += -mam33 -DCPU=AM33
31 31
32ifeq ($(CONFIG_MN10300_CURRENT_IN_E2),y) 32ifeq ($(CONFIG_MN10300_CURRENT_IN_E2),y)
diff --git a/arch/mn10300/include/asm/elf.h b/arch/mn10300/include/asm/elf.h
index 8157c9267f42..4ebd6b3a0a1e 100644
--- a/arch/mn10300/include/asm/elf.h
+++ b/arch/mn10300/include/asm/elf.h
@@ -151,7 +151,8 @@ do { \
151#define ELF_PLATFORM (NULL) 151#define ELF_PLATFORM (NULL)
152 152
153#ifdef __KERNEL__ 153#ifdef __KERNEL__
154#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 154#define SET_PERSONALITY(ex) \
155 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
155#endif 156#endif
156 157
157#endif /* _ASM_ELF_H */ 158#endif /* _ASM_ELF_H */
diff --git a/arch/openrisc/include/asm/elf.h b/arch/openrisc/include/asm/elf.h
index a8fe2c513070..225a7ff320ad 100644
--- a/arch/openrisc/include/asm/elf.h
+++ b/arch/openrisc/include/asm/elf.h
@@ -110,7 +110,8 @@ extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt);
110 110
111#define ELF_PLATFORM (NULL) 111#define ELF_PLATFORM (NULL)
112 112
113#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 113#define SET_PERSONALITY(ex) \
114 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
114 115
115#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
116#endif 117#endif
diff --git a/arch/openrisc/include/asm/unistd.h b/arch/openrisc/include/asm/unistd.h
index 89af3ab5c2e9..437bdbb61b14 100644
--- a/arch/openrisc/include/asm/unistd.h
+++ b/arch/openrisc/include/asm/unistd.h
@@ -16,9 +16,6 @@
16 * (at your option) any later version. 16 * (at your option) any later version.
17 */ 17 */
18 18
19#if !defined(__ASM_OPENRISC_UNISTD_H) || defined(__SYSCALL)
20#define __ASM_OPENRISC_UNISTD_H
21
22#define __ARCH_HAVE_MMU 19#define __ARCH_HAVE_MMU
23 20
24#define sys_mmap2 sys_mmap_pgoff 21#define sys_mmap2 sys_mmap_pgoff
@@ -27,5 +24,3 @@
27 24
28#define __NR_or1k_atomic __NR_arch_specific_syscall 25#define __NR_or1k_atomic __NR_arch_specific_syscall
29__SYSCALL(__NR_or1k_atomic, sys_or1k_atomic) 26__SYSCALL(__NR_or1k_atomic, sys_or1k_atomic)
30
31#endif /* __ASM_OPENRISC_UNISTD_H */
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 3ff21b536f28..b87438bb3384 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -13,6 +13,7 @@ config PARISC
13 select HAVE_PERF_EVENTS 13 select HAVE_PERF_EVENTS
14 select GENERIC_ATOMIC64 if !64BIT 14 select GENERIC_ATOMIC64 if !64BIT
15 select HAVE_GENERIC_HARDIRQS 15 select HAVE_GENERIC_HARDIRQS
16 select BROKEN_RODATA
16 select GENERIC_IRQ_PROBE 17 select GENERIC_IRQ_PROBE
17 select GENERIC_PCI_IOMAP 18 select GENERIC_PCI_IOMAP
18 select IRQ_PER_CPU 19 select IRQ_PER_CPU
diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h
index 760f331d4fa3..db7a662691a8 100644
--- a/arch/parisc/include/asm/compat.h
+++ b/arch/parisc/include/asm/compat.h
@@ -36,6 +36,7 @@ typedef s64 compat_s64;
36typedef u32 compat_uint_t; 36typedef u32 compat_uint_t;
37typedef u32 compat_ulong_t; 37typedef u32 compat_ulong_t;
38typedef u64 compat_u64; 38typedef u64 compat_u64;
39typedef u32 compat_uptr_t;
39 40
40struct compat_timespec { 41struct compat_timespec {
41 compat_time_t tv_sec; 42 compat_time_t tv_sec;
@@ -127,6 +128,63 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */
127 128
128typedef u32 compat_sigset_word; 129typedef u32 compat_sigset_word;
129 130
131typedef union compat_sigval {
132 compat_int_t sival_int;
133 compat_uptr_t sival_ptr;
134} compat_sigval_t;
135
136typedef struct compat_siginfo {
137 int si_signo;
138 int si_errno;
139 int si_code;
140
141 union {
142 int _pad[128/sizeof(int) - 3];
143
144 /* kill() */
145 struct {
146 unsigned int _pid; /* sender's pid */
147 unsigned int _uid; /* sender's uid */
148 } _kill;
149
150 /* POSIX.1b timers */
151 struct {
152 compat_timer_t _tid; /* timer id */
153 int _overrun; /* overrun count */
154 char _pad[sizeof(unsigned int) - sizeof(int)];
155 compat_sigval_t _sigval; /* same as below */
156 int _sys_private; /* not to be passed to user */
157 } _timer;
158
159 /* POSIX.1b signals */
160 struct {
161 unsigned int _pid; /* sender's pid */
162 unsigned int _uid; /* sender's uid */
163 compat_sigval_t _sigval;
164 } _rt;
165
166 /* SIGCHLD */
167 struct {
168 unsigned int _pid; /* which child */
169 unsigned int _uid; /* sender's uid */
170 int _status; /* exit code */
171 compat_clock_t _utime;
172 compat_clock_t _stime;
173 } _sigchld;
174
175 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
176 struct {
177 unsigned int _addr; /* faulting insn/memory ref. */
178 } _sigfault;
179
180 /* SIGPOLL */
181 struct {
182 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
183 int _fd;
184 } _sigpoll;
185 } _sifields;
186} compat_siginfo_t;
187
130#define COMPAT_OFF_T_MAX 0x7fffffff 188#define COMPAT_OFF_T_MAX 0x7fffffff
131#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 189#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
132 190
@@ -136,7 +194,6 @@ typedef u32 compat_sigset_word;
136 * as pointers because the syscall entry code will have 194 * as pointers because the syscall entry code will have
137 * appropriately converted them already. 195 * appropriately converted them already.
138 */ 196 */
139typedef u32 compat_uptr_t;
140 197
141static inline void __user *compat_ptr(compat_uptr_t uptr) 198static inline void __user *compat_ptr(compat_uptr_t uptr)
142{ 199{
diff --git a/arch/parisc/kernel/signal32.h b/arch/parisc/kernel/signal32.h
index c7800846422c..08a88b5349a2 100644
--- a/arch/parisc/kernel/signal32.h
+++ b/arch/parisc/kernel/signal32.h
@@ -55,58 +55,6 @@ struct k_sigaction32 {
55 struct compat_sigaction sa; 55 struct compat_sigaction sa;
56}; 56};
57 57
58typedef struct compat_siginfo {
59 int si_signo;
60 int si_errno;
61 int si_code;
62
63 union {
64 int _pad[((128/sizeof(int)) - 3)];
65
66 /* kill() */
67 struct {
68 unsigned int _pid; /* sender's pid */
69 unsigned int _uid; /* sender's uid */
70 } _kill;
71
72 /* POSIX.1b timers */
73 struct {
74 compat_timer_t _tid; /* timer id */
75 int _overrun; /* overrun count */
76 char _pad[sizeof(unsigned int) - sizeof(int)];
77 compat_sigval_t _sigval; /* same as below */
78 int _sys_private; /* not to be passed to user */
79 } _timer;
80
81 /* POSIX.1b signals */
82 struct {
83 unsigned int _pid; /* sender's pid */
84 unsigned int _uid; /* sender's uid */
85 compat_sigval_t _sigval;
86 } _rt;
87
88 /* SIGCHLD */
89 struct {
90 unsigned int _pid; /* which child */
91 unsigned int _uid; /* sender's uid */
92 int _status; /* exit code */
93 compat_clock_t _utime;
94 compat_clock_t _stime;
95 } _sigchld;
96
97 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
98 struct {
99 unsigned int _addr; /* faulting insn/memory ref. */
100 } _sigfault;
101
102 /* SIGPOLL */
103 struct {
104 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
105 int _fd;
106 } _sigpoll;
107 } _sifields;
108} compat_siginfo_t;
109
110int copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from); 58int copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from);
111int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from); 59int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from);
112 60
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 352f416269ce..4ce0be32d153 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -215,7 +215,8 @@ config ARCH_HIBERNATION_POSSIBLE
215config ARCH_SUSPEND_POSSIBLE 215config ARCH_SUSPEND_POSSIBLE
216 def_bool y 216 def_bool y
217 depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \ 217 depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \
218 (PPC_85xx && !SMP) || PPC_86xx || PPC_PSERIES || 44x || 40x 218 (PPC_85xx && !PPC_E500MC) || PPC_86xx || PPC_PSERIES \
219 || 44x || 40x
219 220
220config PPC_DCR_NATIVE 221config PPC_DCR_NATIVE
221 bool 222 bool
@@ -239,6 +240,9 @@ config PPC_OF_PLATFORM_PCI
239config ARCH_SUPPORTS_DEBUG_PAGEALLOC 240config ARCH_SUPPORTS_DEBUG_PAGEALLOC
240 def_bool y 241 def_bool y
241 242
243config ARCH_SUPPORTS_UPROBES
244 def_bool y
245
242config PPC_ADV_DEBUG_REGS 246config PPC_ADV_DEBUG_REGS
243 bool 247 bool
244 depends on 40x || BOOKE 248 depends on 40x || BOOKE
@@ -325,7 +329,8 @@ config SWIOTLB
325 329
326config HOTPLUG_CPU 330config HOTPLUG_CPU
327 bool "Support for enabling/disabling CPUs" 331 bool "Support for enabling/disabling CPUs"
328 depends on SMP && HOTPLUG && EXPERIMENTAL && (PPC_PSERIES || PPC_PMAC || PPC_POWERNV) 332 depends on SMP && HOTPLUG && EXPERIMENTAL && (PPC_PSERIES || \
333 PPC_PMAC || PPC_POWERNV || (PPC_85xx && !PPC_E500MC))
329 ---help--- 334 ---help---
330 Say Y here to be able to disable and re-enable individual 335 Say Y here to be able to disable and re-enable individual
331 CPUs at runtime on SMP machines. 336 CPUs at runtime on SMP machines.
@@ -557,6 +562,14 @@ config SCHED_SMT
557 when dealing with POWER5 cpus at a cost of slightly increased 562 when dealing with POWER5 cpus at a cost of slightly increased
558 overhead in some places. If unsure say N here. 563 overhead in some places. If unsure say N here.
559 564
565config PPC_DENORMALISATION
566 bool "PowerPC denormalisation exception handling"
567 depends on PPC_BOOK3S_64
568 default "n"
569 ---help---
570 Add support for handling denormalisation of single precision
571 values. Useful for bare metal only. If unsure say Y here.
572
560config CMDLINE_BOOL 573config CMDLINE_BOOL
561 bool "Default bootloader kernel arguments" 574 bool "Default bootloader kernel arguments"
562 575
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index b7d833382be4..6a15c968d214 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -107,6 +107,7 @@ src-boot := $(addprefix $(obj)/, $(src-boot))
107obj-boot := $(addsuffix .o, $(basename $(src-boot))) 107obj-boot := $(addsuffix .o, $(basename $(src-boot)))
108obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) 108obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
109obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) 109obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
110obj-plat: $(libfdt)
110 111
111quiet_cmd_copy_zlib = COPY $@ 112quiet_cmd_copy_zlib = COPY $@
112 cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 113 cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
diff --git a/arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi b/arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi
new file mode 100644
index 000000000000..870c6535a053
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi
@@ -0,0 +1,58 @@
1/*
2 * e500mc Power ISA Device Tree Source (include)
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/ {
36 cpus {
37 power-isa-version = "2.06";
38 power-isa-b; // Base
39 power-isa-e; // Embedded
40 power-isa-atb; // Alternate Time Base
41 power-isa-cs; // Cache Specification
42 power-isa-ds; // Decorated Storage
43 power-isa-e.ed; // Embedded.Enhanced Debug
44 power-isa-e.pd; // Embedded.External PID
45 power-isa-e.hv; // Embedded.Hypervisor
46 power-isa-e.le; // Embedded.Little-Endian
47 power-isa-e.pm; // Embedded.Performance Monitor
48 power-isa-e.pc; // Embedded.Processor Control
49 power-isa-ecl; // Embedded Cache Locking
50 power-isa-exp; // External Proxy
51 power-isa-fp; // Floating Point
52 power-isa-fp.r; // Floating Point.Record
53 power-isa-mmc; // Memory Coherence
54 power-isa-scpm; // Store Conditional Page Mobility
55 power-isa-wt; // Wait
56 mmu-type = "power-embedded";
57 };
58};
diff --git a/arch/powerpc/boot/dts/fsl/e500v2_power_isa.dtsi b/arch/powerpc/boot/dts/fsl/e500v2_power_isa.dtsi
new file mode 100644
index 000000000000..f4928144d2c8
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/e500v2_power_isa.dtsi
@@ -0,0 +1,52 @@
1/*
2 * e500v2 Power ISA Device Tree Source (include)
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/ {
36 cpus {
37 power-isa-version = "2.03";
38 power-isa-b; // Base
39 power-isa-e; // Embedded
40 power-isa-atb; // Alternate Time Base
41 power-isa-cs; // Cache Specification
42 power-isa-e.le; // Embedded.Little-Endian
43 power-isa-e.pm; // Embedded.Performance Monitor
44 power-isa-ecl; // Embedded Cache Locking
45 power-isa-mmc; // Memory Coherence
46 power-isa-sp; // Signal Processing Engine
47 power-isa-sp.fd; // SPE.Embedded Float Scalar Double
48 power-isa-sp.fs; // SPE.Embedded Float Scalar Single
49 power-isa-sp.fv; // SPE.Embedded Float Vector
50 mmu-type = "power-embedded";
51 };
52};
diff --git a/arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi b/arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi
new file mode 100644
index 000000000000..3230212f7ad5
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi
@@ -0,0 +1,59 @@
1/*
2 * e5500 Power ISA Device Tree Source (include)
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/ {
36 cpus {
37 power-isa-version = "2.06";
38 power-isa-b; // Base
39 power-isa-e; // Embedded
40 power-isa-atb; // Alternate Time Base
41 power-isa-cs; // Cache Specification
42 power-isa-ds; // Decorated Storage
43 power-isa-e.ed; // Embedded.Enhanced Debug
44 power-isa-e.pd; // Embedded.External PID
45 power-isa-e.hv; // Embedded.Hypervisor
46 power-isa-e.le; // Embedded.Little-Endian
47 power-isa-e.pm; // Embedded.Performance Monitor
48 power-isa-e.pc; // Embedded.Processor Control
49 power-isa-ecl; // Embedded Cache Locking
50 power-isa-exp; // External Proxy
51 power-isa-fp; // Floating Point
52 power-isa-fp.r; // Floating Point.Record
53 power-isa-mmc; // Memory Coherence
54 power-isa-scpm; // Store Conditional Page Mobility
55 power-isa-wt; // Wait
56 power-isa-64; // 64-bit
57 mmu-type = "power-embedded";
58 };
59};
diff --git a/arch/powerpc/boot/dts/fsl/mpc8536si-pre.dtsi b/arch/powerpc/boot/dts/fsl/mpc8536si-pre.dtsi
index 7de45a784df6..152906f98a0f 100644
--- a/arch/powerpc/boot/dts/fsl/mpc8536si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8536si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,MPC8536"; 40 compatible = "fsl,MPC8536";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/mpc8544si-pre.dtsi b/arch/powerpc/boot/dts/fsl/mpc8544si-pre.dtsi
index 8777f9239d9e..5a69bafb652a 100644
--- a/arch/powerpc/boot/dts/fsl/mpc8544si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8544si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,MPC8544"; 40 compatible = "fsl,MPC8544";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi b/arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi
index 720422d83529..fc1ce977422b 100644
--- a/arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,MPC8548"; 40 compatible = "fsl,MPC8548";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/mpc8568si-pre.dtsi b/arch/powerpc/boot/dts/fsl/mpc8568si-pre.dtsi
index eacd62c5fe6c..122ca3bd0b03 100644
--- a/arch/powerpc/boot/dts/fsl/mpc8568si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8568si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,MPC8568"; 40 compatible = "fsl,MPC8568";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/mpc8569si-pre.dtsi b/arch/powerpc/boot/dts/fsl/mpc8569si-pre.dtsi
index b07064d11930..2cd15a2a0422 100644
--- a/arch/powerpc/boot/dts/fsl/mpc8569si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8569si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,MPC8569"; 40 compatible = "fsl,MPC8569";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/mpc8572si-pre.dtsi b/arch/powerpc/boot/dts/fsl/mpc8572si-pre.dtsi
index ca188326c2ca..28c2a862be96 100644
--- a/arch/powerpc/boot/dts/fsl/mpc8572si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8572si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,MPC8572"; 40 compatible = "fsl,MPC8572";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p1010si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p1010si-pre.dtsi
index 7354a8f90ea5..6e76f9b282a1 100644
--- a/arch/powerpc/boot/dts/fsl/p1010si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1010si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,P1010"; 40 compatible = "fsl,P1010";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p1020si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p1020si-pre.dtsi
index 6f0376e554eb..fed9c4c8d962 100644
--- a/arch/powerpc/boot/dts/fsl/p1020si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1020si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,P1020"; 40 compatible = "fsl,P1020";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p1021si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p1021si-pre.dtsi
index 4abd54bc3308..36161b500176 100644
--- a/arch/powerpc/boot/dts/fsl/p1021si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1021si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,P1021"; 40 compatible = "fsl,P1021";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi
index e930f4f7ca89..1956dea040cc 100644
--- a/arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,P1022"; 40 compatible = "fsl,P1022";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p1023si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p1023si-pre.dtsi
index ac45f6d93385..132a1521921a 100644
--- a/arch/powerpc/boot/dts/fsl/p1023si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1023si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,P1023"; 40 compatible = "fsl,P1023";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p2020si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p2020si-pre.dtsi
index 3213288641d1..42bf3c6d25ca 100644
--- a/arch/powerpc/boot/dts/fsl/p2020si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p2020si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,P2020"; 40 compatible = "fsl,P2020";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p2041si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p2041si-pre.dtsi
index 2d0a40d6b10f..7a2697d04549 100644
--- a/arch/powerpc/boot/dts/fsl/p2041si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p2041si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500mc_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,P2041"; 40 compatible = "fsl,P2041";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p3041si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p3041si-pre.dtsi
index 136def3536b6..c9ca2c305cfe 100644
--- a/arch/powerpc/boot/dts/fsl/p3041si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p3041si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500mc_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,P3041"; 40 compatible = "fsl,P3041";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p4080si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p4080si-pre.dtsi
index b9556ee3a639..493d9a056b5c 100644
--- a/arch/powerpc/boot/dts/fsl/p4080si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p4080si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500mc_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,P4080"; 40 compatible = "fsl,P4080";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi
index ae823a47584e..0a198b0a77e5 100644
--- a/arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e5500_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,P5020"; 40 compatible = "fsl,P5020";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/p5040si-post.dtsi b/arch/powerpc/boot/dts/fsl/p5040si-post.dtsi
new file mode 100644
index 000000000000..db2c9a7b3a0e
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/p5040si-post.dtsi
@@ -0,0 +1,320 @@
1/*
2 * P5040 Silicon/SoC Device Tree Source (post include)
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 compatible = "fsl,p5040-elbc", "fsl,elbc", "simple-bus";
37 interrupts = <25 2 0 0>;
38 #address-cells = <2>;
39 #size-cells = <1>;
40};
41
42/* controller at 0x200000 */
43&pci0 {
44 compatible = "fsl,p5040-pcie", "fsl,qoriq-pcie-v2.4";
45 device_type = "pci";
46 #size-cells = <2>;
47 #address-cells = <3>;
48 bus-range = <0x0 0xff>;
49 clock-frequency = <33333333>;
50 interrupts = <16 2 1 15>;
51 pcie@0 {
52 reg = <0 0 0 0 0>;
53 #interrupt-cells = <1>;
54 #size-cells = <2>;
55 #address-cells = <3>;
56 device_type = "pci";
57 interrupts = <16 2 1 15>;
58 interrupt-map-mask = <0xf800 0 0 7>;
59 interrupt-map = <
60 /* IDSEL 0x0 */
61 0000 0 0 1 &mpic 40 1 0 0
62 0000 0 0 2 &mpic 1 1 0 0
63 0000 0 0 3 &mpic 2 1 0 0
64 0000 0 0 4 &mpic 3 1 0 0
65 >;
66 };
67};
68
69/* controller at 0x201000 */
70&pci1 {
71 compatible = "fsl,p5040-pcie", "fsl,qoriq-pcie-v2.4";
72 device_type = "pci";
73 #size-cells = <2>;
74 #address-cells = <3>;
75 bus-range = <0 0xff>;
76 clock-frequency = <33333333>;
77 interrupts = <16 2 1 14>;
78 pcie@0 {
79 reg = <0 0 0 0 0>;
80 #interrupt-cells = <1>;
81 #size-cells = <2>;
82 #address-cells = <3>;
83 device_type = "pci";
84 interrupts = <16 2 1 14>;
85 interrupt-map-mask = <0xf800 0 0 7>;
86 interrupt-map = <
87 /* IDSEL 0x0 */
88 0000 0 0 1 &mpic 41 1 0 0
89 0000 0 0 2 &mpic 5 1 0 0
90 0000 0 0 3 &mpic 6 1 0 0
91 0000 0 0 4 &mpic 7 1 0 0
92 >;
93 };
94};
95
96/* controller at 0x202000 */
97&pci2 {
98 compatible = "fsl,p5040-pcie", "fsl,qoriq-pcie-v2.4";
99 device_type = "pci";
100 #size-cells = <2>;
101 #address-cells = <3>;
102 bus-range = <0x0 0xff>;
103 clock-frequency = <33333333>;
104 interrupts = <16 2 1 13>;
105 pcie@0 {
106 reg = <0 0 0 0 0>;
107 #interrupt-cells = <1>;
108 #size-cells = <2>;
109 #address-cells = <3>;
110 device_type = "pci";
111 interrupts = <16 2 1 13>;
112 interrupt-map-mask = <0xf800 0 0 7>;
113 interrupt-map = <
114 /* IDSEL 0x0 */
115 0000 0 0 1 &mpic 42 1 0 0
116 0000 0 0 2 &mpic 9 1 0 0
117 0000 0 0 3 &mpic 10 1 0 0
118 0000 0 0 4 &mpic 11 1 0 0
119 >;
120 };
121};
122
123&dcsr {
124 #address-cells = <1>;
125 #size-cells = <1>;
126 compatible = "fsl,dcsr", "simple-bus";
127
128 dcsr-epu@0 {
129 compatible = "fsl,dcsr-epu";
130 interrupts = <52 2 0 0
131 84 2 0 0
132 85 2 0 0>;
133 reg = <0x0 0x1000>;
134 };
135 dcsr-npc {
136 compatible = "fsl,dcsr-npc";
137 reg = <0x1000 0x1000 0x1000000 0x8000>;
138 };
139 dcsr-nxc@2000 {
140 compatible = "fsl,dcsr-nxc";
141 reg = <0x2000 0x1000>;
142 };
143 dcsr-corenet {
144 compatible = "fsl,dcsr-corenet";
145 reg = <0x8000 0x1000 0xB0000 0x1000>;
146 };
147 dcsr-dpaa@9000 {
148 compatible = "fsl,p5040-dcsr-dpaa", "fsl,dcsr-dpaa";
149 reg = <0x9000 0x1000>;
150 };
151 dcsr-ocn@11000 {
152 compatible = "fsl,p5040-dcsr-ocn", "fsl,dcsr-ocn";
153 reg = <0x11000 0x1000>;
154 };
155 dcsr-ddr@12000 {
156 compatible = "fsl,dcsr-ddr";
157 dev-handle = <&ddr1>;
158 reg = <0x12000 0x1000>;
159 };
160 dcsr-ddr@13000 {
161 compatible = "fsl,dcsr-ddr";
162 dev-handle = <&ddr2>;
163 reg = <0x13000 0x1000>;
164 };
165 dcsr-nal@18000 {
166 compatible = "fsl,p5040-dcsr-nal", "fsl,dcsr-nal";
167 reg = <0x18000 0x1000>;
168 };
169 dcsr-rcpm@22000 {
170 compatible = "fsl,p5040-dcsr-rcpm", "fsl,dcsr-rcpm";
171 reg = <0x22000 0x1000>;
172 };
173 dcsr-cpu-sb-proxy@40000 {
174 compatible = "fsl,dcsr-e5500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
175 cpu-handle = <&cpu0>;
176 reg = <0x40000 0x1000>;
177 };
178 dcsr-cpu-sb-proxy@41000 {
179 compatible = "fsl,dcsr-e5500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
180 cpu-handle = <&cpu1>;
181 reg = <0x41000 0x1000>;
182 };
183 dcsr-cpu-sb-proxy@42000 {
184 compatible = "fsl,dcsr-e5500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
185 cpu-handle = <&cpu2>;
186 reg = <0x42000 0x1000>;
187 };
188 dcsr-cpu-sb-proxy@43000 {
189 compatible = "fsl,dcsr-e5500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
190 cpu-handle = <&cpu3>;
191 reg = <0x43000 0x1000>;
192 };
193};
194
195&soc {
196 #address-cells = <1>;
197 #size-cells = <1>;
198 device_type = "soc";
199 compatible = "simple-bus";
200
201 soc-sram-error {
202 compatible = "fsl,soc-sram-error";
203 interrupts = <16 2 1 29>;
204 };
205
206 corenet-law@0 {
207 compatible = "fsl,corenet-law";
208 reg = <0x0 0x1000>;
209 fsl,num-laws = <32>;
210 };
211
212 ddr1: memory-controller@8000 {
213 compatible = "fsl,qoriq-memory-controller-v4.5", "fsl,qoriq-memory-controller";
214 reg = <0x8000 0x1000>;
215 interrupts = <16 2 1 23>;
216 };
217
218 ddr2: memory-controller@9000 {
219 compatible = "fsl,qoriq-memory-controller-v4.5","fsl,qoriq-memory-controller";
220 reg = <0x9000 0x1000>;
221 interrupts = <16 2 1 22>;
222 };
223
224 cpc: l3-cache-controller@10000 {
225 compatible = "fsl,p5040-l3-cache-controller", "fsl,p4080-l3-cache-controller", "cache";
226 reg = <0x10000 0x1000
227 0x11000 0x1000>;
228 interrupts = <16 2 1 27
229 16 2 1 26>;
230 };
231
232 corenet-cf@18000 {
233 compatible = "fsl,corenet-cf";
234 reg = <0x18000 0x1000>;
235 interrupts = <16 2 1 31>;
236 fsl,ccf-num-csdids = <32>;
237 fsl,ccf-num-snoopids = <32>;
238 };
239
240 iommu@20000 {
241 compatible = "fsl,pamu-v1.0", "fsl,pamu";
242 reg = <0x20000 0x5000>;
243 interrupts = <
244 24 2 0 0
245 16 2 1 30>;
246 };
247
248/include/ "qoriq-mpic.dtsi"
249
250 guts: global-utilities@e0000 {
251 compatible = "fsl,p5040-device-config", "fsl,qoriq-device-config-1.0";
252 reg = <0xe0000 0xe00>;
253 fsl,has-rstcr;
254 #sleep-cells = <1>;
255 fsl,liodn-bits = <12>;
256 };
257
258 pins: global-utilities@e0e00 {
259 compatible = "fsl,p5040-pin-control", "fsl,qoriq-pin-control-1.0";
260 reg = <0xe0e00 0x200>;
261 #sleep-cells = <2>;
262 };
263
264 clockgen: global-utilities@e1000 {
265 compatible = "fsl,p5040-clockgen", "fsl,qoriq-clockgen-1.0";
266 reg = <0xe1000 0x1000>;
267 clock-frequency = <0>;
268 };
269
270 rcpm: global-utilities@e2000 {
271 compatible = "fsl,p5040-rcpm", "fsl,qoriq-rcpm-1.0";
272 reg = <0xe2000 0x1000>;
273 #sleep-cells = <1>;
274 };
275
276 sfp: sfp@e8000 {
277 compatible = "fsl,p5040-sfp", "fsl,qoriq-sfp-1.0";
278 reg = <0xe8000 0x1000>;
279 };
280
281 serdes: serdes@ea000 {
282 compatible = "fsl,p5040-serdes";
283 reg = <0xea000 0x1000>;
284 };
285
286/include/ "qoriq-dma-0.dtsi"
287/include/ "qoriq-dma-1.dtsi"
288/include/ "qoriq-espi-0.dtsi"
289 spi@110000 {
290 fsl,espi-num-chipselects = <4>;
291 };
292
293/include/ "qoriq-esdhc-0.dtsi"
294 sdhc@114000 {
295 sdhci,auto-cmd12;
296 };
297
298/include/ "qoriq-i2c-0.dtsi"
299/include/ "qoriq-i2c-1.dtsi"
300/include/ "qoriq-duart-0.dtsi"
301/include/ "qoriq-duart-1.dtsi"
302/include/ "qoriq-gpio-0.dtsi"
303/include/ "qoriq-usb2-mph-0.dtsi"
304 usb0: usb@210000 {
305 compatible = "fsl-usb2-mph-v1.6", "fsl,mpc85xx-usb2-mph", "fsl-usb2-mph";
306 phy_type = "utmi";
307 port0;
308 };
309
310/include/ "qoriq-usb2-dr-0.dtsi"
311 usb1: usb@211000 {
312 compatible = "fsl-usb2-dr-v1.6", "fsl,mpc85xx-usb2-dr", "fsl-usb2-dr";
313 dr_mode = "host";
314 phy_type = "utmi";
315 };
316
317/include/ "qoriq-sata2-0.dtsi"
318/include/ "qoriq-sata2-1.dtsi"
319/include/ "qoriq-sec5.2-0.dtsi"
320};
diff --git a/arch/powerpc/boot/dts/fsl/p5040si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p5040si-pre.dtsi
new file mode 100644
index 000000000000..40ca943f5d1c
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/p5040si-pre.dtsi
@@ -0,0 +1,114 @@
1/*
2 * P5040 Silicon/SoC Device Tree Source (pre include)
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/dts-v1/;
36
37/include/ "e5500_power_isa.dtsi"
38
39/ {
40 compatible = "fsl,P5040";
41 #address-cells = <2>;
42 #size-cells = <2>;
43 interrupt-parent = <&mpic>;
44
45 aliases {
46 ccsr = &soc;
47 dcsr = &dcsr;
48
49 serial0 = &serial0;
50 serial1 = &serial1;
51 serial2 = &serial2;
52 serial3 = &serial3;
53 pci0 = &pci0;
54 pci1 = &pci1;
55 pci2 = &pci2;
56 usb0 = &usb0;
57 usb1 = &usb1;
58 dma0 = &dma0;
59 dma1 = &dma1;
60 sdhc = &sdhc;
61 msi0 = &msi0;
62 msi1 = &msi1;
63 msi2 = &msi2;
64
65 crypto = &crypto;
66 sec_jr0 = &sec_jr0;
67 sec_jr1 = &sec_jr1;
68 sec_jr2 = &sec_jr2;
69 sec_jr3 = &sec_jr3;
70 rtic_a = &rtic_a;
71 rtic_b = &rtic_b;
72 rtic_c = &rtic_c;
73 rtic_d = &rtic_d;
74 sec_mon = &sec_mon;
75 };
76
77 cpus {
78 #address-cells = <1>;
79 #size-cells = <0>;
80
81 cpu0: PowerPC,e5500@0 {
82 device_type = "cpu";
83 reg = <0>;
84 next-level-cache = <&L2_0>;
85 L2_0: l2-cache {
86 next-level-cache = <&cpc>;
87 };
88 };
89 cpu1: PowerPC,e5500@1 {
90 device_type = "cpu";
91 reg = <1>;
92 next-level-cache = <&L2_1>;
93 L2_1: l2-cache {
94 next-level-cache = <&cpc>;
95 };
96 };
97 cpu2: PowerPC,e5500@2 {
98 device_type = "cpu";
99 reg = <2>;
100 next-level-cache = <&L2_2>;
101 L2_2: l2-cache {
102 next-level-cache = <&cpc>;
103 };
104 };
105 cpu3: PowerPC,e5500@3 {
106 device_type = "cpu";
107 reg = <3>;
108 next-level-cache = <&L2_3>;
109 L2_3: l2-cache {
110 next-level-cache = <&cpc>;
111 };
112 };
113 };
114};
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-sec5.2-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-sec5.2-0.dtsi
new file mode 100644
index 000000000000..7b2ab8a8c1f4
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/qoriq-sec5.2-0.dtsi
@@ -0,0 +1,118 @@
1/*
2 * QorIQ Sec/Crypto 5.2 device tree stub [ controller @ offset 0x300000 ]
3 *
4 * Copyright 2011-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
35crypto: crypto@300000 {
36 compatible = "fsl,sec-v5.2", "fsl,sec-v5.0", "fsl,sec-v4.0";
37 #address-cells = <1>;
38 #size-cells = <1>;
39 reg = <0x300000 0x10000>;
40 ranges = <0 0x300000 0x10000>;
41 interrupts = <92 2 0 0>;
42
43 sec_jr0: jr@1000 {
44 compatible = "fsl,sec-v5.2-job-ring",
45 "fsl,sec-v5.0-job-ring",
46 "fsl,sec-v4.0-job-ring";
47 reg = <0x1000 0x1000>;
48 interrupts = <88 2 0 0>;
49 };
50
51 sec_jr1: jr@2000 {
52 compatible = "fsl,sec-v5.2-job-ring",
53 "fsl,sec-v5.0-job-ring",
54 "fsl,sec-v4.0-job-ring";
55 reg = <0x2000 0x1000>;
56 interrupts = <89 2 0 0>;
57 };
58
59 sec_jr2: jr@3000 {
60 compatible = "fsl,sec-v5.2-job-ring",
61 "fsl,sec-v5.0-job-ring",
62 "fsl,sec-v4.0-job-ring";
63 reg = <0x3000 0x1000>;
64 interrupts = <90 2 0 0>;
65 };
66
67 sec_jr3: jr@4000 {
68 compatible = "fsl,sec-v5.2-job-ring",
69 "fsl,sec-v5.0-job-ring",
70 "fsl,sec-v4.0-job-ring";
71 reg = <0x4000 0x1000>;
72 interrupts = <91 2 0 0>;
73 };
74
75 rtic@6000 {
76 compatible = "fsl,sec-v5.2-rtic",
77 "fsl,sec-v5.0-rtic",
78 "fsl,sec-v4.0-rtic";
79 #address-cells = <1>;
80 #size-cells = <1>;
81 reg = <0x6000 0x100>;
82 ranges = <0x0 0x6100 0xe00>;
83
84 rtic_a: rtic-a@0 {
85 compatible = "fsl,sec-v5.2-rtic-memory",
86 "fsl,sec-v5.0-rtic-memory",
87 "fsl,sec-v4.0-rtic-memory";
88 reg = <0x00 0x20 0x100 0x80>;
89 };
90
91 rtic_b: rtic-b@20 {
92 compatible = "fsl,sec-v5.2-rtic-memory",
93 "fsl,sec-v5.0-rtic-memory",
94 "fsl,sec-v4.0-rtic-memory";
95 reg = <0x20 0x20 0x200 0x80>;
96 };
97
98 rtic_c: rtic-c@40 {
99 compatible = "fsl,sec-v5.2-rtic-memory",
100 "fsl,sec-v5.0-rtic-memory",
101 "fsl,sec-v4.0-rtic-memory";
102 reg = <0x40 0x20 0x300 0x80>;
103 };
104
105 rtic_d: rtic-d@60 {
106 compatible = "fsl,sec-v5.2-rtic-memory",
107 "fsl,sec-v5.0-rtic-memory",
108 "fsl,sec-v4.0-rtic-memory";
109 reg = <0x60 0x20 0x500 0x80>;
110 };
111 };
112};
113
114sec_mon: sec_mon@314000 {
115 compatible = "fsl,sec-v5.2-mon", "fsl,sec-v5.0-mon", "fsl,sec-v4.0-mon";
116 reg = <0x314000 0x1000>;
117 interrupts = <93 2 0 0>;
118};
diff --git a/arch/powerpc/boot/dts/mpc8536ds.dtsi b/arch/powerpc/boot/dts/mpc8536ds.dtsi
index d304a2d68c62..7c3dde84d193 100644
--- a/arch/powerpc/boot/dts/mpc8536ds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8536ds.dtsi
@@ -132,6 +132,10 @@
132 reg = <0x68>; 132 reg = <0x68>;
133 interrupts = <0 0x1 0 0>; 133 interrupts = <0 0x1 0 0>;
134 }; 134 };
135 adt7461@4c {
136 compatible = "adi,adt7461";
137 reg = <0x4c>;
138 };
135 }; 139 };
136 140
137 spi@7000 { 141 spi@7000 {
diff --git a/arch/powerpc/boot/dts/mpc8540ads.dts b/arch/powerpc/boot/dts/mpc8540ads.dts
index f99fb110c97f..2d31863accf5 100644
--- a/arch/powerpc/boot/dts/mpc8540ads.dts
+++ b/arch/powerpc/boot/dts/mpc8540ads.dts
@@ -11,6 +11,8 @@
11 11
12/dts-v1/; 12/dts-v1/;
13 13
14/include/ "fsl/e500v2_power_isa.dtsi"
15
14/ { 16/ {
15 model = "MPC8540ADS"; 17 model = "MPC8540ADS";
16 compatible = "MPC8540ADS", "MPC85xxADS"; 18 compatible = "MPC8540ADS", "MPC85xxADS";
diff --git a/arch/powerpc/boot/dts/mpc8541cds.dts b/arch/powerpc/boot/dts/mpc8541cds.dts
index 0f5e93912799..1c03c2667373 100644
--- a/arch/powerpc/boot/dts/mpc8541cds.dts
+++ b/arch/powerpc/boot/dts/mpc8541cds.dts
@@ -11,6 +11,8 @@
11 11
12/dts-v1/; 12/dts-v1/;
13 13
14/include/ "fsl/e500v2_power_isa.dtsi"
15
14/ { 16/ {
15 model = "MPC8541CDS"; 17 model = "MPC8541CDS";
16 compatible = "MPC8541CDS", "MPC85xxCDS"; 18 compatible = "MPC8541CDS", "MPC85xxCDS";
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index e934987e882b..ed38874c3a36 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -20,8 +20,10 @@
20 reg = <0 0 0 0>; // Filled by U-Boot 20 reg = <0 0 0 0>; // Filled by U-Boot
21 }; 21 };
22 22
23 lbc: localbus@e0005000 { 23 board_lbc: lbc: localbus@e0005000 {
24 reg = <0 0xe0005000 0 0x1000>; 24 reg = <0 0xe0005000 0 0x1000>;
25
26 ranges = <0x0 0x0 0x0 0xff800000 0x800000>;
25 }; 27 };
26 28
27 board_soc: soc: soc8544@e0000000 { 29 board_soc: soc: soc8544@e0000000 {
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dtsi b/arch/powerpc/boot/dts/mpc8544ds.dtsi
index 77ebc9f1d37c..b219d035d794 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8544ds.dtsi
@@ -32,6 +32,45 @@
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&board_lbc {
36 nor@0,0 {
37 #address-cells = <1>;
38 #size-cells = <1>;
39 compatible = "cfi-flash";
40 reg = <0x0 0x0 0x800000>;
41 bank-width = <2>;
42 device-width = <1>;
43
44 partition@0 {
45 reg = <0x0 0x10000>;
46 label = "dtb-nor";
47 };
48
49 partition@20000 {
50 reg = <0x20000 0x30000>;
51 label = "diagnostic-nor";
52 read-only;
53 };
54
55 partition@200000 {
56 reg = <0x200000 0x200000>;
57 label = "dink-nor";
58 read-only;
59 };
60
61 partition@400000 {
62 reg = <0x400000 0x380000>;
63 label = "kernel-nor";
64 };
65
66 partition@780000 {
67 reg = <0x780000 0x80000>;
68 label = "u-boot-nor";
69 read-only;
70 };
71 };
72};
73
35&board_soc { 74&board_soc {
36 enet0: ethernet@24000 { 75 enet0: ethernet@24000 {
37 phy-handle = <&phy0>; 76 phy-handle = <&phy0>;
diff --git a/arch/powerpc/boot/dts/mpc8555cds.dts b/arch/powerpc/boot/dts/mpc8555cds.dts
index fe10438613d6..36a7ea138c2f 100644
--- a/arch/powerpc/boot/dts/mpc8555cds.dts
+++ b/arch/powerpc/boot/dts/mpc8555cds.dts
@@ -11,6 +11,8 @@
11 11
12/dts-v1/; 12/dts-v1/;
13 13
14/include/ "fsl/e500v2_power_isa.dtsi"
15
14/ { 16/ {
15 model = "MPC8555CDS"; 17 model = "MPC8555CDS";
16 compatible = "MPC8555CDS", "MPC85xxCDS"; 18 compatible = "MPC8555CDS", "MPC85xxCDS";
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts
index 6e85e1ba0851..1a43f5a968f5 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -11,6 +11,8 @@
11 11
12/dts-v1/; 12/dts-v1/;
13 13
14/include/ "fsl/e500v2_power_isa.dtsi"
15
14/ { 16/ {
15 model = "MPC8560ADS"; 17 model = "MPC8560ADS";
16 compatible = "MPC8560ADS", "MPC85xxADS"; 18 compatible = "MPC8560ADS", "MPC85xxADS";
diff --git a/arch/powerpc/boot/dts/o2d.dts b/arch/powerpc/boot/dts/o2d.dts
new file mode 100644
index 000000000000..9f6dd4d889b3
--- /dev/null
+++ b/arch/powerpc/boot/dts/o2d.dts
@@ -0,0 +1,47 @@
1/*
2 * O2D Device Tree Source
3 *
4 * Copyright (C) 2012 DENX Software Engineering
5 * Anatolij Gustschin <agust@denx.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13/include/ "o2d.dtsi"
14
15/ {
16 model = "ifm,o2d";
17 compatible = "ifm,o2d";
18
19 memory {
20 reg = <0x00000000 0x08000000>; // 128MB
21 };
22
23 localbus {
24 ranges = <0 0 0xfc000000 0x02000000
25 3 0 0xe3000000 0x00100000>;
26
27 flash@0,0 {
28 compatible = "cfi-flash";
29 reg = <0 0 0x02000000>;
30 bank-width = <2>;
31 device-width = <2>;
32 #size-cells = <1>;
33 #address-cells = <1>;
34
35 partition@60000 {
36 label = "kernel";
37 reg = <0x00060000 0x00260000>;
38 read-only;
39 };
40 /* o2d specific partitions */
41 partition@2c0000 {
42 label = "o2d user defined";
43 reg = <0x002c0000 0x01d40000>;
44 };
45 };
46 };
47};
diff --git a/arch/powerpc/boot/dts/o2d.dtsi b/arch/powerpc/boot/dts/o2d.dtsi
new file mode 100644
index 000000000000..3444eb8f0ade
--- /dev/null
+++ b/arch/powerpc/boot/dts/o2d.dtsi
@@ -0,0 +1,139 @@
1/*
2 * O2D base Device Tree Source
3 *
4 * Copyright (C) 2012 DENX Software Engineering
5 * Anatolij Gustschin <agust@denx.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13/include/ "mpc5200b.dtsi"
14
15/ {
16 model = "ifm,o2d";
17 compatible = "ifm,o2d";
18
19 memory {
20 reg = <0x00000000 0x04000000>; // 64MB
21 };
22
23 soc5200@f0000000 {
24
25 gpio_simple: gpio@b00 {
26 };
27
28 timer@600 { // General Purpose Timer
29 #gpio-cells = <2>;
30 gpio-controller;
31 fsl,has-wdt;
32 fsl,wdt-on-boot = <0>;
33 };
34
35 timer@610 {
36 #gpio-cells = <2>;
37 gpio-controller;
38 };
39
40 timer7: timer@670 {
41 };
42
43 rtc@800 {
44 status = "disabled";
45 };
46
47 psc@2000 { // PSC1
48 compatible = "fsl,mpc5200b-psc-spi","fsl,mpc5200-psc-spi";
49 #address-cells = <1>;
50 #size-cells = <0>;
51 cell-index = <0>;
52
53 spidev@0 {
54 compatible = "spidev";
55 spi-max-frequency = <250000>;
56 reg = <0>;
57 };
58 };
59
60 psc@2200 { // PSC2
61 status = "disabled";
62 };
63
64 psc@2400 { // PSC3
65 status = "disabled";
66 };
67
68 psc@2600 { // PSC4
69 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
70 };
71
72 psc@2800 { // PSC5
73 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
74 };
75
76 psc@2c00 { // PSC6
77 status = "disabled";
78 };
79
80 ethernet@3000 {
81 phy-handle = <&phy0>;
82 };
83
84 mdio@3000 {
85 phy0: ethernet-phy@0 {
86 reg = <0>;
87 };
88 };
89
90 sclpc@3c00 {
91 compatible = "fsl,mpc5200-lpbfifo";
92 reg = <0x3c00 0x60>;
93 interrupts = <3 23 0>;
94 };
95 };
96
97 localbus {
98 ranges = <0 0 0xff000000 0x01000000
99 3 0 0xe3000000 0x00100000>;
100
101 // flash device at LocalPlus Bus CS0
102 flash@0,0 {
103 compatible = "cfi-flash";
104 reg = <0 0 0x01000000>;
105 bank-width = <1>;
106 device-width = <2>;
107 #size-cells = <1>;
108 #address-cells = <1>;
109 no-unaligned-direct-access;
110
111 /* common layout for all machines */
112 partition@0 {
113 label = "u-boot";
114 reg = <0x00000000 0x00040000>;
115 read-only;
116 };
117 partition@40000 {
118 label = "env";
119 reg = <0x00040000 0x00020000>;
120 read-only;
121 };
122 };
123
124 csi@3,0 {
125 compatible = "ifm,o2d-csi";
126 reg = <3 0 0x00100000>;
127 ifm,csi-clk-handle = <&timer7>;
128 gpios = <&gpio_simple 23 0 /* imag_capture */
129 &gpio_simple 26 0 /* imag_reset */
130 &gpio_simple 29 0>; /* imag_master_en */
131
132 interrupts = <1 1 2>; /* IRQ1, edge falling */
133
134 ifm,csi-addr-bus-width = <24>;
135 ifm,csi-data-bus-width = <8>;
136 ifm,csi-wait-cycles = <0>;
137 };
138 };
139};
diff --git a/arch/powerpc/boot/dts/o2d300.dts b/arch/powerpc/boot/dts/o2d300.dts
new file mode 100644
index 000000000000..29affe0f0da3
--- /dev/null
+++ b/arch/powerpc/boot/dts/o2d300.dts
@@ -0,0 +1,52 @@
1/*
2 * O2D300 Device Tree Source
3 *
4 * Copyright (C) 2012 DENX Software Engineering
5 * Anatolij Gustschin <agust@denx.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13/include/ "o2d.dtsi"
14
15/ {
16 model = "ifm,o2d300";
17 compatible = "ifm,o2d";
18
19 localbus {
20 ranges = <0 0 0xfc000000 0x02000000
21 3 0 0xe3000000 0x00100000>;
22 flash@0,0 {
23 compatible = "cfi-flash";
24 reg = <0 0 0x02000000>;
25 bank-width = <2>;
26 device-width = <2>;
27 #size-cells = <1>;
28 #address-cells = <1>;
29
30 partition@40000 {
31 label = "env_1";
32 reg = <0x00040000 0x00020000>;
33 read-only;
34 };
35 partition@60000 {
36 label = "env_2";
37 reg = <0x00060000 0x00020000>;
38 read-only;
39 };
40 partition@80000 {
41 label = "kernel";
42 reg = <0x00080000 0x00260000>;
43 read-only;
44 };
45 /* o2d300 specific partitions */
46 partition@2e0000 {
47 label = "o2d300 user defined";
48 reg = <0x002e0000 0x01d20000>;
49 };
50 };
51 };
52};
diff --git a/arch/powerpc/boot/dts/o2dnt2.dts b/arch/powerpc/boot/dts/o2dnt2.dts
new file mode 100644
index 000000000000..a0f5b97a4f06
--- /dev/null
+++ b/arch/powerpc/boot/dts/o2dnt2.dts
@@ -0,0 +1,48 @@
1/*
2 * O2DNT2 Device Tree Source
3 *
4 * Copyright (C) 2012 DENX Software Engineering
5 * Anatolij Gustschin <agust@denx.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13/include/ "o2d.dtsi"
14
15/ {
16 model = "ifm,o2dnt2";
17 compatible = "ifm,o2d";
18
19 memory {
20 reg = <0x00000000 0x08000000>; // 128MB
21 };
22
23 localbus {
24 ranges = <0 0 0xfc000000 0x02000000
25 3 0 0xe3000000 0x00100000>;
26
27 flash@0,0 {
28 compatible = "cfi-flash";
29 reg = <0 0 0x02000000>;
30 bank-width = <2>;
31 device-width = <2>;
32 #size-cells = <1>;
33 #address-cells = <1>;
34
35 partition@60000 {
36 label = "kernel";
37 reg = <0x00060000 0x00260000>;
38 read-only;
39 };
40
41 /* o2dnt2 specific partitions */
42 partition@2c0000 {
43 label = "o2dnt2 user defined";
44 reg = <0x002c0000 0x01d40000>;
45 };
46 };
47 };
48};
diff --git a/arch/powerpc/boot/dts/o2i.dts b/arch/powerpc/boot/dts/o2i.dts
new file mode 100644
index 000000000000..e3cc99d1360b
--- /dev/null
+++ b/arch/powerpc/boot/dts/o2i.dts
@@ -0,0 +1,33 @@
1/*
2 * O2I Device Tree Source
3 *
4 * Copyright (C) 2012 DENX Software Engineering
5 * Anatolij Gustschin <agust@denx.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13/include/ "o2d.dtsi"
14
15/ {
16 model = "ifm,o2i";
17 compatible = "ifm,o2d";
18
19 localbus {
20 flash@0,0 {
21 partition@60000 {
22 label = "kernel";
23 reg = <0x00060000 0x00260000>;
24 read-only;
25 };
26 /* o2i specific partitions */
27 partition@2c0000 {
28 label = "o2i user defined";
29 reg = <0x002c0000 0x00d40000>;
30 };
31 };
32 };
33};
diff --git a/arch/powerpc/boot/dts/o2mnt.dts b/arch/powerpc/boot/dts/o2mnt.dts
new file mode 100644
index 000000000000..d91859a9e940
--- /dev/null
+++ b/arch/powerpc/boot/dts/o2mnt.dts
@@ -0,0 +1,33 @@
1/*
2 * O2MNT Device Tree Source
3 *
4 * Copyright (C) 2012 DENX Software Engineering
5 * Anatolij Gustschin <agust@denx.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13/include/ "o2d.dtsi"
14
15/ {
16 model = "ifm,o2mnt";
17 compatible = "ifm,o2d";
18
19 localbus {
20 flash@0,0 {
21 partition@60000 {
22 label = "kernel";
23 reg = <0x00060000 0x00260000>;
24 read-only;
25 };
26 /* add o2mnt specific partitions */
27 partition@2c0000 {
28 label = "o2mnt user defined";
29 reg = <0x002c0000 0x00d40000>;
30 };
31 };
32 };
33};
diff --git a/arch/powerpc/boot/dts/o3dnt.dts b/arch/powerpc/boot/dts/o3dnt.dts
new file mode 100644
index 000000000000..acce49326491
--- /dev/null
+++ b/arch/powerpc/boot/dts/o3dnt.dts
@@ -0,0 +1,48 @@
1/*
2 * O3DNT Device Tree Source
3 *
4 * Copyright (C) 2012 DENX Software Engineering
5 * Anatolij Gustschin <agust@denx.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13/include/ "o2d.dtsi"
14
15/ {
16 model = "ifm,o3dnt";
17 compatible = "ifm,o2d";
18
19 memory {
20 reg = <0x00000000 0x04000000>; // 64MB
21 };
22
23 localbus {
24 ranges = <0 0 0xfc000000 0x01000000
25 3 0 0xe3000000 0x00100000>;
26
27 flash@0,0 {
28 compatible = "cfi-flash";
29 reg = <0 0 0x01000000>;
30 bank-width = <2>;
31 device-width = <2>;
32 #size-cells = <1>;
33 #address-cells = <1>;
34
35 partition@60000 {
36 label = "kernel";
37 reg = <0x00060000 0x00260000>;
38 read-only;
39 };
40
41 /* o3dnt specific partitions */
42 partition@2c0000 {
43 label = "o3dnt user defined";
44 reg = <0x002c0000 0x00d40000>;
45 };
46 };
47 };
48};
diff --git a/arch/powerpc/boot/dts/p1020rdb_camp_core0.dts b/arch/powerpc/boot/dts/p1020rdb_camp_core0.dts
deleted file mode 100644
index 41b4585c5da8..000000000000
--- a/arch/powerpc/boot/dts/p1020rdb_camp_core0.dts
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * P1020 RDB 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 2011 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.dts"
20
21/ {
22 model = "fsl,P1020RDB";
23 compatible = "fsl,P1020RDB", "fsl,MPC85XXRDB-CAMP";
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 };
62 };
63};
diff --git a/arch/powerpc/boot/dts/p1020rdb_camp_core1.dts b/arch/powerpc/boot/dts/p1020rdb_camp_core1.dts
deleted file mode 100644
index 517453821884..000000000000
--- a/arch/powerpc/boot/dts/p1020rdb_camp_core1.dts
+++ /dev/null
@@ -1,141 +0,0 @@
1/*
2 * P1020 RDB 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 2011 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.dts"
19
20/ {
21 model = "fsl,P1020RDB";
22 compatible = "fsl,P1020RDB", "fsl,MPC85XXRDB-CAMP";
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 };
124
125 msi@41600 {
126 status = "disabled";
127 };
128
129 global-utilities@e0000 { //global utilities block
130 status = "disabled";
131 };
132 };
133
134 pci0: pcie@ffe09000 {
135 status = "disabled";
136 };
137
138 pci1: pcie@ffe0a000 {
139 status = "disabled";
140 };
141};
diff --git a/arch/powerpc/boot/dts/p1022ds.dtsi b/arch/powerpc/boot/dts/p1022ds.dtsi
index c3344b04d8ff..873da350d01b 100644
--- a/arch/powerpc/boot/dts/p1022ds.dtsi
+++ b/arch/powerpc/boot/dts/p1022ds.dtsi
@@ -149,6 +149,10 @@
149 compatible = "dallas,ds1339"; 149 compatible = "dallas,ds1339";
150 reg = <0x68>; 150 reg = <0x68>;
151 }; 151 };
152 adt7461@4c {
153 compatible = "adi,adt7461";
154 reg = <0x4c>;
155 };
152 }; 156 };
153 157
154 spi@7000 { 158 spi@7000 {
diff --git a/arch/powerpc/boot/dts/p1022rdk.dts b/arch/powerpc/boot/dts/p1022rdk.dts
new file mode 100644
index 000000000000..51d82de223f3
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1022rdk.dts
@@ -0,0 +1,188 @@
1/*
2 * P1022 RDK 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,P1022RDK";
38 compatible = "fsl,P1022RDK";
39
40 memory {
41 device_type = "memory";
42 };
43
44 board_lbc: lbc: localbus@ffe05000 {
45 /* The P1022 RDK does not have any localbus devices */
46 status = "disabled";
47 };
48
49 board_soc: soc: soc@ffe00000 {
50 ranges = <0x0 0x0 0xffe00000 0x100000>;
51
52 i2c@3100 {
53 wm8960:codec@1a {
54 compatible = "wlf,wm8960";
55 reg = <0x1a>;
56 /* MCLK source is a stand-alone oscillator */
57 clock-frequency = <12288000>;
58 };
59 rtc@68 {
60 compatible = "stm,m41t62";
61 reg = <0x68>;
62 };
63 adt7461@4c{
64 compatible = "adi,adt7461";
65 reg = <0x4c>;
66 };
67 zl6100@21{
68 compatible = "isil,zl6100";
69 reg = <0x21>;
70 };
71 zl6100@24{
72 compatible = "isil,zl6100";
73 reg = <0x24>;
74 };
75 zl6100@26{
76 compatible = "isil,zl6100";
77 reg = <0x26>;
78 };
79 zl6100@29{
80 compatible = "isil,zl6100";
81 reg = <0x29>;
82 };
83 };
84
85 spi@7000 {
86 flash@0 {
87 #address-cells = <1>;
88 #size-cells = <1>;
89 compatible = "spansion,m25p80";
90 reg = <0>;
91 spi-max-frequency = <1000000>;
92 partition@0 {
93 label = "full-spi-flash";
94 reg = <0x00000000 0x00100000>;
95 };
96 };
97 };
98
99 ssi@15000 {
100 fsl,mode = "i2s-slave";
101 codec-handle = <&wm8960>;
102 };
103
104 usb@22000 {
105 phy_type = "ulpi";
106 };
107
108 usb@23000 {
109 phy_type = "ulpi";
110 };
111
112 mdio@24000 {
113 phy0: ethernet-phy@0 {
114 interrupts = <3 1 0 0>;
115 reg = <0x1>;
116 };
117 phy1: ethernet-phy@1 {
118 interrupts = <9 1 0 0>;
119 reg = <0x2>;
120 };
121 };
122
123 mdio@25000 {
124 tbi0: tbi-phy@11 {
125 reg = <0x11>;
126 device_type = "tbi-phy";
127 };
128 };
129
130 ethernet@b0000 {
131 phy-handle = <&phy0>;
132 phy-connection-type = "rgmii-id";
133 };
134
135 ethernet@b1000 {
136 phy-handle = <&phy1>;
137 tbi-handle = <&tbi0>;
138 phy-connection-type = "sgmii";
139 };
140 };
141
142 pci0: pcie@ffe09000 {
143 ranges = <0x2000000 0x0 0xe0000000 0 0xa0000000 0x0 0x20000000
144 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
145 reg = <0x0 0xffe09000 0 0x1000>;
146 pcie@0 {
147 ranges = <0x2000000 0x0 0xe0000000
148 0x2000000 0x0 0xe0000000
149 0x0 0x20000000
150
151 0x1000000 0x0 0x0
152 0x1000000 0x0 0x0
153 0x0 0x100000>;
154 };
155 };
156
157 pci1: pcie@ffe0a000 {
158 ranges = <0x2000000 0x0 0xe0000000 0 0xc0000000 0x0 0x20000000
159 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x10000>;
160 reg = <0 0xffe0a000 0 0x1000>;
161 pcie@0 {
162 ranges = <0x2000000 0x0 0xe0000000
163 0x2000000 0x0 0xe0000000
164 0x0 0x20000000
165
166 0x1000000 0x0 0x0
167 0x1000000 0x0 0x0
168 0x0 0x100000>;
169 };
170 };
171
172 pci2: pcie@ffe0b000 {
173 ranges = <0x2000000 0x0 0xe0000000 0 0x80000000 0x0 0x20000000
174 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
175 reg = <0 0xffe0b000 0 0x1000>;
176 pcie@0 {
177 ranges = <0x2000000 0x0 0xe0000000
178 0x2000000 0x0 0xe0000000
179 0x0 0x20000000
180
181 0x1000000 0x0 0x0
182 0x1000000 0x0 0x0
183 0x0 0x100000>;
184 };
185 };
186};
187
188/include/ "fsl/p1022si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts b/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
deleted file mode 100644
index 66aac864c4cc..000000000000
--- a/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * P2020 RDB 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, dma1, usb,
7 * eth1, eth2, sdhc, crypto, global-util, pci0.
8 *
9 * Copyright 2009-2011 Freescale Semiconductor Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16
17/include/ "p2020rdb.dts"
18
19/ {
20 model = "fsl,P2020RDB";
21 compatible = "fsl,P2020RDB", "fsl,MPC85XXRDB-CAMP";
22
23 cpus {
24 PowerPC,P2020@1 {
25 status = "disabled";
26 };
27 };
28
29 localbus@ffe05000 {
30 status = "disabled";
31 };
32
33 soc@ffe00000 {
34 serial1: serial@4600 {
35 status = "disabled";
36 };
37
38 dma@c300 {
39 status = "disabled";
40 };
41
42 enet0: ethernet@24000 {
43 status = "disabled";
44 };
45
46 mpic: pic@40000 {
47 protected-sources = <
48 42 76 77 78 79 /* serial1 , dma2 */
49 29 30 34 26 /* enet0, pci1 */
50 0xe0 0xe1 0xe2 0xe3 /* msi */
51 0xe4 0xe5 0xe6 0xe7
52 >;
53 };
54
55 msi@41600 {
56 status = "disabled";
57 };
58 };
59
60 pci0: pcie@ffe08000 {
61 status = "disabled";
62 };
63
64 pci2: pcie@ffe0a000 {
65 status = "disabled";
66 };
67};
diff --git a/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts b/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts
deleted file mode 100644
index 9bd8ef493dd2..000000000000
--- a/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * P2020 RDB 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, dma2, eth0, pci1, msi.
7 *
8 * Please note to add "-b 1" for core1's dts compiling.
9 *
10 * Copyright 2009-2011 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/ "p2020rdb.dts"
19
20/ {
21 model = "fsl,P2020RDB";
22 compatible = "fsl,P2020RDB", "fsl,MPC85XXRDB-CAMP";
23
24 cpus {
25 PowerPC,P2020@0 {
26 status = "disabled";
27 };
28 };
29
30 localbus@ffe05000 {
31 status = "disabled";
32 };
33
34 soc@ffe00000 {
35 ecm-law@0 {
36 status = "disabled";
37 };
38
39 ecm@1000 {
40 status = "disabled";
41 };
42
43 memory-controller@2000 {
44 status = "disabled";
45 };
46
47 i2c@3000 {
48 status = "disabled";
49 };
50
51 i2c@3100 {
52 status = "disabled";
53 };
54
55 serial0: serial@4500 {
56 status = "disabled";
57 };
58
59 spi@7000 {
60 status = "disabled";
61 };
62
63 gpio: gpio-controller@f000 {
64 status = "disabled";
65 };
66
67 dma@21300 {
68 status = "disabled";
69 };
70
71 usb@22000 {
72 status = "disabled";
73 };
74
75 mdio@24520 {
76 status = "disabled";
77 };
78
79 mdio@25520 {
80 status = "disabled";
81 };
82
83 mdio@26520 {
84 status = "disabled";
85 };
86
87 enet1: ethernet@25000 {
88 status = "disabled";
89 };
90
91 enet2: ethernet@26000 {
92 status = "disabled";
93 };
94
95 sdhci@2e000 {
96 status = "disabled";
97 };
98
99 crypto@30000 {
100 status = "disabled";
101 };
102
103 mpic: pic@40000 {
104 protected-sources = <
105 17 18 43 42 59 47 /*ecm, mem, i2c, serial0, spi,gpio */
106 16 20 21 22 23 28 /* L2, dma1, USB */
107 03 35 36 40 31 32 33 /* mdio, enet1, enet2 */
108 72 45 58 25 /* sdhci, crypto , pci */
109 >;
110 };
111
112 global-utilities@e0000 { //global utilities block
113 status = "disabled";
114 };
115
116 };
117
118 pci0: pcie@ffe08000 {
119 status = "disabled";
120 };
121
122 pci1: pcie@ffe09000 {
123 status = "disabled";
124 };
125};
diff --git a/arch/powerpc/boot/dts/p2041rdb.dts b/arch/powerpc/boot/dts/p2041rdb.dts
index baab0347dab0..d97ad74c7279 100644
--- a/arch/powerpc/boot/dts/p2041rdb.dts
+++ b/arch/powerpc/boot/dts/p2041rdb.dts
@@ -94,6 +94,10 @@
94 compatible = "pericom,pt7c4338"; 94 compatible = "pericom,pt7c4338";
95 reg = <0x68>; 95 reg = <0x68>;
96 }; 96 };
97 adt7461@4c {
98 compatible = "adi,adt7461";
99 reg = <0x4c>;
100 };
97 }; 101 };
98 102
99 i2c@118100 { 103 i2c@118100 {
diff --git a/arch/powerpc/boot/dts/p3041ds.dts b/arch/powerpc/boot/dts/p3041ds.dts
index 6cdcadc80c30..2fed3bc0b990 100644
--- a/arch/powerpc/boot/dts/p3041ds.dts
+++ b/arch/powerpc/boot/dts/p3041ds.dts
@@ -98,6 +98,10 @@
98 reg = <0x68>; 98 reg = <0x68>;
99 interrupts = <0x1 0x1 0 0>; 99 interrupts = <0x1 0x1 0 0>;
100 }; 100 };
101 adt7461@4c {
102 compatible = "adi,adt7461";
103 reg = <0x4c>;
104 };
101 }; 105 };
102 }; 106 };
103 107
diff --git a/arch/powerpc/boot/dts/p4080ds.dts b/arch/powerpc/boot/dts/p4080ds.dts
index 3e204609d02e..1cf6148b8b05 100644
--- a/arch/powerpc/boot/dts/p4080ds.dts
+++ b/arch/powerpc/boot/dts/p4080ds.dts
@@ -96,6 +96,10 @@
96 reg = <0x68>; 96 reg = <0x68>;
97 interrupts = <0x1 0x1 0 0>; 97 interrupts = <0x1 0x1 0 0>;
98 }; 98 };
99 adt7461@4c {
100 compatible = "adi,adt7461";
101 reg = <0x4c>;
102 };
99 }; 103 };
100 104
101 usb0: usb@210000 { 105 usb0: usb@210000 {
diff --git a/arch/powerpc/boot/dts/p5020ds.dts b/arch/powerpc/boot/dts/p5020ds.dts
index 27c07ed6adc1..2869fea717dd 100644
--- a/arch/powerpc/boot/dts/p5020ds.dts
+++ b/arch/powerpc/boot/dts/p5020ds.dts
@@ -98,6 +98,10 @@
98 reg = <0x68>; 98 reg = <0x68>;
99 interrupts = <0x1 0x1 0 0>; 99 interrupts = <0x1 0x1 0 0>;
100 }; 100 };
101 adt7461@4c {
102 compatible = "adi,adt7461";
103 reg = <0x4c>;
104 };
101 }; 105 };
102 }; 106 };
103 107
diff --git a/arch/powerpc/boot/dts/p5040ds.dts b/arch/powerpc/boot/dts/p5040ds.dts
new file mode 100644
index 000000000000..860b5ccf76c0
--- /dev/null
+++ b/arch/powerpc/boot/dts/p5040ds.dts
@@ -0,0 +1,207 @@
1/*
2 * P5040DS 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/p5040si-pre.dtsi"
36
37/ {
38 model = "fsl,P5040DS";
39 compatible = "fsl,P5040DS";
40 #address-cells = <2>;
41 #size-cells = <2>;
42 interrupt-parent = <&mpic>;
43
44 memory {
45 device_type = "memory";
46 };
47
48 dcsr: dcsr@f00000000 {
49 ranges = <0x00000000 0xf 0x00000000 0x01008000>;
50 };
51
52 soc: soc@ffe000000 {
53 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
54 reg = <0xf 0xfe000000 0 0x00001000>;
55 spi@110000 {
56 flash@0 {
57 #address-cells = <1>;
58 #size-cells = <1>;
59 compatible = "spansion,s25sl12801";
60 reg = <0>;
61 spi-max-frequency = <40000000>; /* input clock */
62 partition@u-boot {
63 label = "u-boot";
64 reg = <0x00000000 0x00100000>;
65 };
66 partition@kernel {
67 label = "kernel";
68 reg = <0x00100000 0x00500000>;
69 };
70 partition@dtb {
71 label = "dtb";
72 reg = <0x00600000 0x00100000>;
73 };
74 partition@fs {
75 label = "file system";
76 reg = <0x00700000 0x00900000>;
77 };
78 };
79 };
80
81 i2c@118100 {
82 eeprom@51 {
83 compatible = "at24,24c256";
84 reg = <0x51>;
85 };
86 eeprom@52 {
87 compatible = "at24,24c256";
88 reg = <0x52>;
89 };
90 };
91
92 i2c@119100 {
93 rtc@68 {
94 compatible = "dallas,ds3232";
95 reg = <0x68>;
96 interrupts = <0x1 0x1 0 0>;
97 };
98 adt7461@4c {
99 compatible = "adi,adt7461";
100 reg = <0x4c>;
101 };
102 };
103 };
104
105 lbc: localbus@ffe124000 {
106 reg = <0xf 0xfe124000 0 0x1000>;
107 ranges = <0 0 0xf 0xe8000000 0x08000000
108 2 0 0xf 0xffa00000 0x00040000
109 3 0 0xf 0xffdf0000 0x00008000>;
110
111 flash@0,0 {
112 compatible = "cfi-flash";
113 reg = <0 0 0x08000000>;
114 bank-width = <2>;
115 device-width = <2>;
116 };
117
118 nand@2,0 {
119 #address-cells = <1>;
120 #size-cells = <1>;
121 compatible = "fsl,elbc-fcm-nand";
122 reg = <0x2 0x0 0x40000>;
123
124 partition@0 {
125 label = "NAND U-Boot Image";
126 reg = <0x0 0x02000000>;
127 };
128
129 partition@2000000 {
130 label = "NAND Root File System";
131 reg = <0x02000000 0x10000000>;
132 };
133
134 partition@12000000 {
135 label = "NAND Compressed RFS Image";
136 reg = <0x12000000 0x08000000>;
137 };
138
139 partition@1a000000 {
140 label = "NAND Linux Kernel Image";
141 reg = <0x1a000000 0x04000000>;
142 };
143
144 partition@1e000000 {
145 label = "NAND DTB Image";
146 reg = <0x1e000000 0x01000000>;
147 };
148
149 partition@1f000000 {
150 label = "NAND Writable User area";
151 reg = <0x1f000000 0x01000000>;
152 };
153 };
154
155 board-control@3,0 {
156 compatible = "fsl,p5040ds-fpga", "fsl,fpga-ngpixis";
157 reg = <3 0 0x40>;
158 };
159 };
160
161 pci0: pcie@ffe200000 {
162 reg = <0xf 0xfe200000 0 0x1000>;
163 ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000
164 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>;
165 pcie@0 {
166 ranges = <0x02000000 0 0xe0000000
167 0x02000000 0 0xe0000000
168 0 0x20000000
169
170 0x01000000 0 0x00000000
171 0x01000000 0 0x00000000
172 0 0x00010000>;
173 };
174 };
175
176 pci1: pcie@ffe201000 {
177 reg = <0xf 0xfe201000 0 0x1000>;
178 ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
179 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>;
180 pcie@0 {
181 ranges = <0x02000000 0 0xe0000000
182 0x02000000 0 0xe0000000
183 0 0x20000000
184
185 0x01000000 0 0x00000000
186 0x01000000 0 0x00000000
187 0 0x00010000>;
188 };
189 };
190
191 pci2: pcie@ffe202000 {
192 reg = <0xf 0xfe202000 0 0x1000>;
193 ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000
194 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>;
195 pcie@0 {
196 ranges = <0x02000000 0 0xe0000000
197 0x02000000 0 0xe0000000
198 0 0x20000000
199
200 0x01000000 0 0x00000000
201 0x01000000 0 0x00000000
202 0 0x00010000>;
203 };
204 };
205};
206
207/include/ "fsl/p5040si-post.dtsi"
diff --git a/arch/powerpc/configs/85xx/p1023rds_defconfig b/arch/powerpc/configs/85xx/p1023rds_defconfig
index 26e541c4662b..b80bcc69d1f7 100644
--- a/arch/powerpc/configs/85xx/p1023rds_defconfig
+++ b/arch/powerpc/configs/85xx/p1023rds_defconfig
@@ -112,6 +112,12 @@ CONFIG_SND=y
112CONFIG_SND_MIXER_OSS=y 112CONFIG_SND_MIXER_OSS=y
113CONFIG_SND_PCM_OSS=y 113CONFIG_SND_PCM_OSS=y
114# CONFIG_SND_SUPPORT_OLD_API is not set 114# CONFIG_SND_SUPPORT_OLD_API is not set
115CONFIG_USB=y
116CONFIG_USB_DEVICEFS=y
117CONFIG_USB_MON=y
118CONFIG_USB_EHCI_HCD=y
119CONFIG_USB_EHCI_FSL=y
120CONFIG_USB_STORAGE=y
115CONFIG_EDAC=y 121CONFIG_EDAC=y
116CONFIG_EDAC_MM_EDAC=y 122CONFIG_EDAC_MM_EDAC=y
117CONFIG_RTC_CLASS=y 123CONFIG_RTC_CLASS=y
diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig
index 8b3d57c1ebe8..1c0f2432ecdb 100644
--- a/arch/powerpc/configs/corenet32_smp_defconfig
+++ b/arch/powerpc/configs/corenet32_smp_defconfig
@@ -27,6 +27,7 @@ CONFIG_P2041_RDB=y
27CONFIG_P3041_DS=y 27CONFIG_P3041_DS=y
28CONFIG_P4080_DS=y 28CONFIG_P4080_DS=y
29CONFIG_P5020_DS=y 29CONFIG_P5020_DS=y
30CONFIG_P5040_DS=y
30CONFIG_HIGHMEM=y 31CONFIG_HIGHMEM=y
31# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
32CONFIG_BINFMT_MISC=m 33CONFIG_BINFMT_MISC=m
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig
index 0516e22ca3de..88fa5c46f66f 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -23,6 +23,7 @@ CONFIG_MODVERSIONS=y
23CONFIG_PARTITION_ADVANCED=y 23CONFIG_PARTITION_ADVANCED=y
24CONFIG_MAC_PARTITION=y 24CONFIG_MAC_PARTITION=y
25CONFIG_P5020_DS=y 25CONFIG_P5020_DS=y
26CONFIG_P5040_DS=y
26# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set 27# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set
27CONFIG_BINFMT_MISC=m 28CONFIG_BINFMT_MISC=m
28CONFIG_IRQ_ALL_CPUS=y 29CONFIG_IRQ_ALL_CPUS=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index 8b5bda27d248..cf815e847cdc 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -30,6 +30,7 @@ CONFIG_MPC85xx_DS=y
30CONFIG_MPC85xx_RDB=y 30CONFIG_MPC85xx_RDB=y
31CONFIG_P1010_RDB=y 31CONFIG_P1010_RDB=y
32CONFIG_P1022_DS=y 32CONFIG_P1022_DS=y
33CONFIG_P1022_RDK=y
33CONFIG_P1023_RDS=y 34CONFIG_P1023_RDS=y
34CONFIG_SOCRATES=y 35CONFIG_SOCRATES=y
35CONFIG_KSI8560=y 36CONFIG_KSI8560=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index b0974e7e98ae..502cd9e027e4 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -32,6 +32,7 @@ CONFIG_MPC85xx_DS=y
32CONFIG_MPC85xx_RDB=y 32CONFIG_MPC85xx_RDB=y
33CONFIG_P1010_RDB=y 33CONFIG_P1010_RDB=y
34CONFIG_P1022_DS=y 34CONFIG_P1022_DS=y
35CONFIG_P1022_RDK=y
35CONFIG_P1023_RDS=y 36CONFIG_P1023_RDS=y
36CONFIG_SOCRATES=y 37CONFIG_SOCRATES=y
37CONFIG_KSI8560=y 38CONFIG_KSI8560=y
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index de7c4c53f5cf..6d03530b7506 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -51,6 +51,7 @@ CONFIG_KEXEC=y
51CONFIG_IRQ_ALL_CPUS=y 51CONFIG_IRQ_ALL_CPUS=y
52CONFIG_MEMORY_HOTREMOVE=y 52CONFIG_MEMORY_HOTREMOVE=y
53CONFIG_SCHED_SMT=y 53CONFIG_SCHED_SMT=y
54CONFIG_PPC_DENORMALISATION=y
54CONFIG_PCCARD=y 55CONFIG_PCCARD=y
55CONFIG_ELECTRA_CF=y 56CONFIG_ELECTRA_CF=y
56CONFIG_HOTPLUG_PCI=m 57CONFIG_HOTPLUG_PCI=m
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 9f4a9368f51b..1f710a32ffae 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -48,6 +48,7 @@ CONFIG_MEMORY_HOTREMOVE=y
48CONFIG_PPC_64K_PAGES=y 48CONFIG_PPC_64K_PAGES=y
49CONFIG_PPC_SUBPAGE_PROT=y 49CONFIG_PPC_SUBPAGE_PROT=y
50CONFIG_SCHED_SMT=y 50CONFIG_SCHED_SMT=y
51CONFIG_PPC_DENORMALISATION=y
51CONFIG_HOTPLUG_PCI=m 52CONFIG_HOTPLUG_PCI=m
52CONFIG_HOTPLUG_PCI_RPA=m 53CONFIG_HOTPLUG_PCI_RPA=m
53CONFIG_HOTPLUG_PCI_RPA_DLPAR=m 54CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
diff --git a/arch/powerpc/include/asm/abs_addr.h b/arch/powerpc/include/asm/abs_addr.h
deleted file mode 100644
index 9d92ba04b033..000000000000
--- a/arch/powerpc/include/asm/abs_addr.h
+++ /dev/null
@@ -1,56 +0,0 @@
1#ifndef _ASM_POWERPC_ABS_ADDR_H
2#define _ASM_POWERPC_ABS_ADDR_H
3#ifdef __KERNEL__
4
5
6/*
7 * c 2001 PPC 64 Team, IBM Corp
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#include <linux/memblock.h>
16
17#include <asm/types.h>
18#include <asm/page.h>
19#include <asm/prom.h>
20
21struct mschunks_map {
22 unsigned long num_chunks;
23 unsigned long chunk_size;
24 unsigned long chunk_shift;
25 unsigned long chunk_mask;
26 u32 *mapping;
27};
28
29extern struct mschunks_map mschunks_map;
30
31/* Chunks are 256 KB */
32#define MSCHUNKS_CHUNK_SHIFT (18)
33#define MSCHUNKS_CHUNK_SIZE (1UL << MSCHUNKS_CHUNK_SHIFT)
34#define MSCHUNKS_OFFSET_MASK (MSCHUNKS_CHUNK_SIZE - 1)
35
36static inline unsigned long chunk_to_addr(unsigned long chunk)
37{
38 return chunk << MSCHUNKS_CHUNK_SHIFT;
39}
40
41static inline unsigned long addr_to_chunk(unsigned long addr)
42{
43 return addr >> MSCHUNKS_CHUNK_SHIFT;
44}
45
46static inline unsigned long phys_to_abs(unsigned long pa)
47{
48 return pa;
49}
50
51/* Convenience macros */
52#define virt_to_abs(va) phys_to_abs(__pa(va))
53#define abs_to_virt(aa) __va(aa)
54
55#endif /* __KERNEL__ */
56#endif /* _ASM_POWERPC_ABS_ADDR_H */
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h
index efdc92618b38..dc2cf9c6d9e6 100644
--- a/arch/powerpc/include/asm/bitops.h
+++ b/arch/powerpc/include/asm/bitops.h
@@ -288,6 +288,16 @@ static __inline__ int test_bit_le(unsigned long nr,
288 return (tmp[nr >> 3] >> (nr & 7)) & 1; 288 return (tmp[nr >> 3] >> (nr & 7)) & 1;
289} 289}
290 290
291static inline void set_bit_le(int nr, void *addr)
292{
293 set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
294}
295
296static inline void clear_bit_le(int nr, void *addr)
297{
298 clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
299}
300
291static inline void __set_bit_le(int nr, void *addr) 301static inline void __set_bit_le(int nr, void *addr)
292{ 302{
293 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr); 303 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
index ab9e402518e8..b843e35122e8 100644
--- a/arch/powerpc/include/asm/cacheflush.h
+++ b/arch/powerpc/include/asm/cacheflush.h
@@ -30,6 +30,8 @@ extern void flush_dcache_page(struct page *page);
30#define flush_dcache_mmap_lock(mapping) do { } while (0) 30#define flush_dcache_mmap_lock(mapping) do { } while (0)
31#define flush_dcache_mmap_unlock(mapping) do { } while (0) 31#define flush_dcache_mmap_unlock(mapping) do { } while (0)
32 32
33extern void __flush_disable_L1(void);
34
33extern void __flush_icache_range(unsigned long, unsigned long); 35extern void __flush_icache_range(unsigned long, unsigned long);
34static inline void flush_icache_range(unsigned long start, unsigned long stop) 36static inline void flush_icache_range(unsigned long start, unsigned long stop)
35{ 37{
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
index 88e602f6430d..84fdf6857c31 100644
--- a/arch/powerpc/include/asm/compat.h
+++ b/arch/powerpc/include/asm/compat.h
@@ -38,6 +38,7 @@ typedef s64 compat_s64;
38typedef u32 compat_uint_t; 38typedef u32 compat_uint_t;
39typedef u32 compat_ulong_t; 39typedef u32 compat_ulong_t;
40typedef u64 compat_u64; 40typedef u64 compat_u64;
41typedef u32 compat_uptr_t;
41 42
42struct compat_timespec { 43struct compat_timespec {
43 compat_time_t tv_sec; 44 compat_time_t tv_sec;
@@ -114,6 +115,64 @@ typedef u32 compat_old_sigset_t;
114 115
115typedef u32 compat_sigset_word; 116typedef u32 compat_sigset_word;
116 117
118typedef union compat_sigval {
119 compat_int_t sival_int;
120 compat_uptr_t sival_ptr;
121} compat_sigval_t;
122
123#define SI_PAD_SIZE32 (128/sizeof(int) - 3)
124
125typedef struct compat_siginfo {
126 int si_signo;
127 int si_errno;
128 int si_code;
129
130 union {
131 int _pad[SI_PAD_SIZE32];
132
133 /* kill() */
134 struct {
135 compat_pid_t _pid; /* sender's pid */
136 __compat_uid_t _uid; /* sender's uid */
137 } _kill;
138
139 /* POSIX.1b timers */
140 struct {
141 compat_timer_t _tid; /* timer id */
142 int _overrun; /* overrun count */
143 compat_sigval_t _sigval; /* same as below */
144 int _sys_private; /* not to be passed to user */
145 } _timer;
146
147 /* POSIX.1b signals */
148 struct {
149 compat_pid_t _pid; /* sender's pid */
150 __compat_uid_t _uid; /* sender's uid */
151 compat_sigval_t _sigval;
152 } _rt;
153
154 /* SIGCHLD */
155 struct {
156 compat_pid_t _pid; /* which child */
157 __compat_uid_t _uid; /* sender's uid */
158 int _status; /* exit code */
159 compat_clock_t _utime;
160 compat_clock_t _stime;
161 } _sigchld;
162
163 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
164 struct {
165 unsigned int _addr; /* faulting insn/memory ref. */
166 } _sigfault;
167
168 /* SIGPOLL */
169 struct {
170 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
171 int _fd;
172 } _sigpoll;
173 } _sifields;
174} compat_siginfo_t;
175
117#define COMPAT_OFF_T_MAX 0x7fffffff 176#define COMPAT_OFF_T_MAX 0x7fffffff
118#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 177#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
119 178
@@ -123,7 +182,6 @@ typedef u32 compat_sigset_word;
123 * as pointers because the syscall entry code will have 182 * as pointers because the syscall entry code will have
124 * appropriately converted them already. 183 * appropriately converted them already.
125 */ 184 */
126typedef u32 compat_uptr_t;
127 185
128static inline void __user *compat_ptr(compat_uptr_t uptr) 186static inline void __user *compat_ptr(compat_uptr_t uptr)
129{ 187{
diff --git a/arch/powerpc/include/asm/debug.h b/arch/powerpc/include/asm/debug.h
index 716d2f089eb6..32de2577bb6d 100644
--- a/arch/powerpc/include/asm/debug.h
+++ b/arch/powerpc/include/asm/debug.h
@@ -44,7 +44,7 @@ static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; }
44static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } 44static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
45#endif 45#endif
46 46
47extern int set_dabr(unsigned long dabr); 47extern int set_dabr(unsigned long dabr, unsigned long dabrx);
48#ifdef CONFIG_PPC_ADV_DEBUG_REGS 48#ifdef CONFIG_PPC_ADV_DEBUG_REGS
49extern void do_send_trap(struct pt_regs *regs, unsigned long address, 49extern void do_send_trap(struct pt_regs *regs, unsigned long address,
50 unsigned long error_code, int signal_code, int brkpt); 50 unsigned long error_code, int signal_code, int brkpt);
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index d60f99814ffb..b0ef73882b38 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -32,27 +32,62 @@ struct device_node;
32#ifdef CONFIG_EEH 32#ifdef CONFIG_EEH
33 33
34/* 34/*
35 * The struct is used to trace PE related EEH functionality.
36 * In theory, there will have one instance of the struct to
37 * be created against particular PE. In nature, PEs corelate
38 * to each other. the struct has to reflect that hierarchy in
39 * order to easily pick up those affected PEs when one particular
40 * PE has EEH errors.
41 *
42 * Also, one particular PE might be composed of PCI device, PCI
43 * bus and its subordinate components. The struct also need ship
44 * the information. Further more, one particular PE is only meaingful
45 * in the corresponding PHB. Therefore, the root PEs should be created
46 * against existing PHBs in on-to-one fashion.
47 */
48#define EEH_PE_INVALID (1 << 0) /* Invalid */
49#define EEH_PE_PHB (1 << 1) /* PHB PE */
50#define EEH_PE_DEVICE (1 << 2) /* Device PE */
51#define EEH_PE_BUS (1 << 3) /* Bus PE */
52
53#define EEH_PE_ISOLATED (1 << 0) /* Isolated PE */
54#define EEH_PE_RECOVERING (1 << 1) /* Recovering PE */
55
56struct eeh_pe {
57 int type; /* PE type: PHB/Bus/Device */
58 int state; /* PE EEH dependent mode */
59 int config_addr; /* Traditional PCI address */
60 int addr; /* PE configuration address */
61 struct pci_controller *phb; /* Associated PHB */
62 int check_count; /* Times of ignored error */
63 int freeze_count; /* Times of froze up */
64 int false_positives; /* Times of reported #ff's */
65 struct eeh_pe *parent; /* Parent PE */
66 struct list_head child_list; /* Link PE to the child list */
67 struct list_head edevs; /* Link list of EEH devices */
68 struct list_head child; /* Child PEs */
69};
70
71#define eeh_pe_for_each_dev(pe, edev) \
72 list_for_each_entry(edev, &pe->edevs, list)
73
74/*
35 * The struct is used to trace EEH state for the associated 75 * The struct is used to trace EEH state for the associated
36 * PCI device node or PCI device. In future, it might 76 * PCI device node or PCI device. In future, it might
37 * represent PE as well so that the EEH device to form 77 * represent PE as well so that the EEH device to form
38 * another tree except the currently existing tree of PCI 78 * another tree except the currently existing tree of PCI
39 * buses and PCI devices 79 * buses and PCI devices
40 */ 80 */
41#define EEH_MODE_SUPPORTED (1<<0) /* EEH supported on the device */ 81#define EEH_DEV_IRQ_DISABLED (1<<0) /* Interrupt disabled */
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 82
47struct eeh_dev { 83struct eeh_dev {
48 int mode; /* EEH mode */ 84 int mode; /* EEH mode */
49 int class_code; /* Class code of the device */ 85 int class_code; /* Class code of the device */
50 int config_addr; /* Config address */ 86 int config_addr; /* Config address */
51 int pe_config_addr; /* PE config address */ 87 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 */ 88 u32 config_space[16]; /* Saved PCI config space */
89 struct eeh_pe *pe; /* Associated PE */
90 struct list_head list; /* Form link list in the PE */
56 struct pci_controller *phb; /* Associated PHB */ 91 struct pci_controller *phb; /* Associated PHB */
57 struct device_node *dn; /* Associated device node */ 92 struct device_node *dn; /* Associated device node */
58 struct pci_dev *pdev; /* Associated PCI device */ 93 struct pci_dev *pdev; /* Associated PCI device */
@@ -95,19 +130,51 @@ static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
95struct eeh_ops { 130struct eeh_ops {
96 char *name; 131 char *name;
97 int (*init)(void); 132 int (*init)(void);
98 int (*set_option)(struct device_node *dn, int option); 133 void* (*of_probe)(struct device_node *dn, void *flag);
99 int (*get_pe_addr)(struct device_node *dn); 134 void* (*dev_probe)(struct pci_dev *dev, void *flag);
100 int (*get_state)(struct device_node *dn, int *state); 135 int (*set_option)(struct eeh_pe *pe, int option);
101 int (*reset)(struct device_node *dn, int option); 136 int (*get_pe_addr)(struct eeh_pe *pe);
102 int (*wait_state)(struct device_node *dn, int max_wait); 137 int (*get_state)(struct eeh_pe *pe, int *state);
103 int (*get_log)(struct device_node *dn, int severity, char *drv_log, unsigned long len); 138 int (*reset)(struct eeh_pe *pe, int option);
104 int (*configure_bridge)(struct device_node *dn); 139 int (*wait_state)(struct eeh_pe *pe, int max_wait);
140 int (*get_log)(struct eeh_pe *pe, int severity, char *drv_log, unsigned long len);
141 int (*configure_bridge)(struct eeh_pe *pe);
105 int (*read_config)(struct device_node *dn, int where, int size, u32 *val); 142 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); 143 int (*write_config)(struct device_node *dn, int where, int size, u32 val);
107}; 144};
108 145
109extern struct eeh_ops *eeh_ops; 146extern struct eeh_ops *eeh_ops;
110extern int eeh_subsystem_enabled; 147extern int eeh_subsystem_enabled;
148extern struct mutex eeh_mutex;
149extern int eeh_probe_mode;
150
151#define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */
152#define EEH_PROBE_MODE_DEVTREE (1<<1) /* From device tree */
153
154static inline void eeh_probe_mode_set(int flag)
155{
156 eeh_probe_mode = flag;
157}
158
159static inline int eeh_probe_mode_devtree(void)
160{
161 return (eeh_probe_mode == EEH_PROBE_MODE_DEVTREE);
162}
163
164static inline int eeh_probe_mode_dev(void)
165{
166 return (eeh_probe_mode == EEH_PROBE_MODE_DEV);
167}
168
169static inline void eeh_lock(void)
170{
171 mutex_lock(&eeh_mutex);
172}
173
174static inline void eeh_unlock(void)
175{
176 mutex_unlock(&eeh_mutex);
177}
111 178
112/* 179/*
113 * Max number of EEH freezes allowed before we consider the device 180 * Max number of EEH freezes allowed before we consider the device
@@ -115,22 +182,26 @@ extern int eeh_subsystem_enabled;
115 */ 182 */
116#define EEH_MAX_ALLOWED_FREEZES 5 183#define EEH_MAX_ALLOWED_FREEZES 5
117 184
185typedef void *(*eeh_traverse_func)(void *data, void *flag);
186int __devinit eeh_phb_pe_create(struct pci_controller *phb);
187int eeh_add_to_parent_pe(struct eeh_dev *edev);
188int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe);
189void *eeh_pe_dev_traverse(struct eeh_pe *root,
190 eeh_traverse_func fn, void *flag);
191void eeh_pe_restore_bars(struct eeh_pe *pe);
192struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
193
118void * __devinit eeh_dev_init(struct device_node *dn, void *data); 194void * __devinit eeh_dev_init(struct device_node *dn, void *data);
119void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb); 195void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb);
120void __init eeh_dev_phb_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); 196int __init eeh_ops_register(struct eeh_ops *ops);
126int __exit eeh_ops_unregister(const char *name); 197int __exit eeh_ops_unregister(const char *name);
127unsigned long eeh_check_failure(const volatile void __iomem *token, 198unsigned long eeh_check_failure(const volatile void __iomem *token,
128 unsigned long val); 199 unsigned long val);
129int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev); 200int eeh_dev_check_failure(struct eeh_dev *edev);
130void __init pci_addr_cache_build(void); 201void __init eeh_addr_cache_build(void);
131void eeh_add_device_tree_early(struct device_node *); 202void eeh_add_device_tree_early(struct device_node *);
132void eeh_add_device_tree_late(struct pci_bus *); 203void eeh_add_device_tree_late(struct pci_bus *);
133void eeh_remove_bus_device(struct pci_dev *); 204void eeh_remove_bus_device(struct pci_dev *, int);
134 205
135/** 206/**
136 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. 207 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
@@ -156,34 +227,24 @@ static inline void *eeh_dev_init(struct device_node *dn, void *data)
156 227
157static inline void eeh_dev_phb_init_dynamic(struct pci_controller *phb) { } 228static inline void eeh_dev_phb_init_dynamic(struct pci_controller *phb) { }
158 229
159static inline void eeh_dev_phb_init(void) { }
160
161static inline void eeh_init(void) { }
162
163#ifdef CONFIG_PPC_PSERIES
164static inline int eeh_pseries_init(void)
165{
166 return 0;
167}
168#endif /* CONFIG_PPC_PSERIES */
169
170static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) 230static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
171{ 231{
172 return val; 232 return val;
173} 233}
174 234
175static inline int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) 235#define eeh_dev_check_failure(x) (0)
176{
177 return 0;
178}
179 236
180static inline void pci_addr_cache_build(void) { } 237static inline void eeh_addr_cache_build(void) { }
181 238
182static inline void eeh_add_device_tree_early(struct device_node *dn) { } 239static inline void eeh_add_device_tree_early(struct device_node *dn) { }
183 240
184static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } 241static inline void eeh_add_device_tree_late(struct pci_bus *bus) { }
185 242
186static inline void eeh_remove_bus_device(struct pci_dev *dev) { } 243static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { }
244
245static inline void eeh_lock(void) { }
246static inline void eeh_unlock(void) { }
247
187#define EEH_POSSIBLE_ERROR(val, type) (0) 248#define EEH_POSSIBLE_ERROR(val, type) (0)
188#define EEH_IO_ERROR_VALUE(size) (-1UL) 249#define EEH_IO_ERROR_VALUE(size) (-1UL)
189#endif /* CONFIG_EEH */ 250#endif /* CONFIG_EEH */
diff --git a/arch/powerpc/include/asm/eeh_event.h b/arch/powerpc/include/asm/eeh_event.h
index c68b012b7797..de67d830151b 100644
--- a/arch/powerpc/include/asm/eeh_event.h
+++ b/arch/powerpc/include/asm/eeh_event.h
@@ -28,11 +28,11 @@
28 */ 28 */
29struct eeh_event { 29struct eeh_event {
30 struct list_head list; /* to form event queue */ 30 struct list_head list; /* to form event queue */
31 struct eeh_dev *edev; /* EEH device */ 31 struct eeh_pe *pe; /* EEH PE */
32}; 32};
33 33
34int eeh_send_failure_event(struct eeh_dev *edev); 34int eeh_send_failure_event(struct eeh_pe *pe);
35struct eeh_dev *handle_eeh_events(struct eeh_event *); 35void eeh_handle_event(struct eeh_pe *pe);
36 36
37#endif /* __KERNEL__ */ 37#endif /* __KERNEL__ */
38#endif /* ASM_POWERPC_EEH_EVENT_H */ 38#endif /* ASM_POWERPC_EEH_EVENT_H */
diff --git a/arch/powerpc/include/asm/exception-64e.h b/arch/powerpc/include/asm/exception-64e.h
index ac13addb8495..51fa43e536b9 100644
--- a/arch/powerpc/include/asm/exception-64e.h
+++ b/arch/powerpc/include/asm/exception-64e.h
@@ -37,6 +37,7 @@
37 * critical data 37 * critical data
38 */ 38 */
39 39
40#define PACA_EXGDBELL PACA_EXGEN
40 41
41/* We are out of SPRGs so we save some things in the PACA. The normal 42/* We are out of SPRGs so we save some things in the PACA. The normal
42 * exception frame is smaller than the CRIT or MC one though 43 * exception frame is smaller than the CRIT or MC one though
@@ -45,8 +46,9 @@
45#define EX_CR (1 * 8) 46#define EX_CR (1 * 8)
46#define EX_R10 (2 * 8) 47#define EX_R10 (2 * 8)
47#define EX_R11 (3 * 8) 48#define EX_R11 (3 * 8)
48#define EX_R14 (4 * 8) 49#define EX_R13 (4 * 8)
49#define EX_R15 (5 * 8) 50#define EX_R14 (5 * 8)
51#define EX_R15 (6 * 8)
50 52
51/* 53/*
52 * The TLB miss exception uses different slots. 54 * The TLB miss exception uses different slots.
diff --git a/arch/powerpc/include/asm/fsl_guts.h b/arch/powerpc/include/asm/fsl_guts.h
index aa4c488589ce..dd5ba2c22771 100644
--- a/arch/powerpc/include/asm/fsl_guts.h
+++ b/arch/powerpc/include/asm/fsl_guts.h
@@ -48,6 +48,8 @@ struct ccsr_guts {
48 __be32 dmuxcr; /* 0x.0068 - DMA Mux Control Register */ 48 __be32 dmuxcr; /* 0x.0068 - DMA Mux Control Register */
49 u8 res06c[0x70 - 0x6c]; 49 u8 res06c[0x70 - 0x6c];
50 __be32 devdisr; /* 0x.0070 - Device Disable Control */ 50 __be32 devdisr; /* 0x.0070 - Device Disable Control */
51#define CCSR_GUTS_DEVDISR_TB1 0x00001000
52#define CCSR_GUTS_DEVDISR_TB0 0x00004000
51 __be32 devdisr2; /* 0x.0074 - Device Disable Control 2 */ 53 __be32 devdisr2; /* 0x.0074 - Device Disable Control 2 */
52 u8 res078[0x7c - 0x78]; 54 u8 res078[0x7c - 0x78];
53 __be32 pmjcr; /* 0x.007c - 4 Power Management Jog Control Register */ 55 __be32 pmjcr; /* 0x.007c - 4 Power Management Jog Control Register */
diff --git a/arch/powerpc/include/asm/fsl_ifc.h b/arch/powerpc/include/asm/fsl_ifc.h
index b955012939a2..b8a4b9bc50b3 100644
--- a/arch/powerpc/include/asm/fsl_ifc.h
+++ b/arch/powerpc/include/asm/fsl_ifc.h
@@ -768,22 +768,24 @@ struct fsl_ifc_gpcm {
768 */ 768 */
769struct fsl_ifc_regs { 769struct fsl_ifc_regs {
770 __be32 ifc_rev; 770 __be32 ifc_rev;
771 u32 res1[0x3]; 771 u32 res1[0x2];
772 struct { 772 struct {
773 __be32 cspr_ext;
773 __be32 cspr; 774 __be32 cspr;
774 u32 res2[0x2]; 775 u32 res2;
775 } cspr_cs[FSL_IFC_BANK_COUNT]; 776 } cspr_cs[FSL_IFC_BANK_COUNT];
776 u32 res3[0x18]; 777 u32 res3[0x19];
777 struct { 778 struct {
778 __be32 amask; 779 __be32 amask;
779 u32 res4[0x2]; 780 u32 res4[0x2];
780 } amask_cs[FSL_IFC_BANK_COUNT]; 781 } amask_cs[FSL_IFC_BANK_COUNT];
781 u32 res5[0x18]; 782 u32 res5[0x17];
782 struct { 783 struct {
784 __be32 csor_ext;
783 __be32 csor; 785 __be32 csor;
784 u32 res6[0x2]; 786 u32 res6;
785 } csor_cs[FSL_IFC_BANK_COUNT]; 787 } csor_cs[FSL_IFC_BANK_COUNT];
786 u32 res7[0x18]; 788 u32 res7[0x19];
787 struct { 789 struct {
788 __be32 ftim[4]; 790 __be32 ftim[4];
789 u32 res8[0x8]; 791 u32 res8[0x8];
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 423cf9eaf4a4..7a867065db79 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -152,11 +152,6 @@
152#define H_VASI_RESUMED 5 152#define H_VASI_RESUMED 5
153#define H_VASI_COMPLETED 6 153#define H_VASI_COMPLETED 6
154 154
155/* DABRX flags */
156#define H_DABRX_HYPERVISOR (1UL<<(63-61))
157#define H_DABRX_KERNEL (1UL<<(63-62))
158#define H_DABRX_USER (1UL<<(63-63))
159
160/* Each control block has to be on a 4K boundary */ 155/* Each control block has to be on a 4K boundary */
161#define H_CB_ALIGNMENT 4096 156#define H_CB_ALIGNMENT 4096
162 157
diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h
index be04330af751..423424599dad 100644
--- a/arch/powerpc/include/asm/hw_breakpoint.h
+++ b/arch/powerpc/include/asm/hw_breakpoint.h
@@ -27,10 +27,11 @@
27#ifdef CONFIG_HAVE_HW_BREAKPOINT 27#ifdef CONFIG_HAVE_HW_BREAKPOINT
28 28
29struct arch_hw_breakpoint { 29struct arch_hw_breakpoint {
30 bool extraneous_interrupt;
31 u8 len; /* length of the target data symbol */
32 int type;
33 unsigned long address; 30 unsigned long address;
31 unsigned long dabrx;
32 int type;
33 u8 len; /* length of the target data symbol */
34 bool extraneous_interrupt;
34}; 35};
35 36
36#include <linux/kdebug.h> 37#include <linux/kdebug.h>
@@ -61,7 +62,7 @@ extern void ptrace_triggered(struct perf_event *bp,
61 struct perf_sample_data *data, struct pt_regs *regs); 62 struct perf_sample_data *data, struct pt_regs *regs);
62static inline void hw_breakpoint_disable(void) 63static inline void hw_breakpoint_disable(void)
63{ 64{
64 set_dabr(0); 65 set_dabr(0, 0);
65} 66}
66extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs); 67extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs);
67 68
diff --git a/arch/powerpc/include/asm/kprobes.h b/arch/powerpc/include/asm/kprobes.h
index be0171afdc0f..7b6feab6fd26 100644
--- a/arch/powerpc/include/asm/kprobes.h
+++ b/arch/powerpc/include/asm/kprobes.h
@@ -29,21 +29,16 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/ptrace.h> 30#include <linux/ptrace.h>
31#include <linux/percpu.h> 31#include <linux/percpu.h>
32#include <asm/probes.h>
32 33
33#define __ARCH_WANT_KPROBES_INSN_SLOT 34#define __ARCH_WANT_KPROBES_INSN_SLOT
34 35
35struct pt_regs; 36struct pt_regs;
36struct kprobe; 37struct kprobe;
37 38
38typedef unsigned int kprobe_opcode_t; 39typedef ppc_opcode_t kprobe_opcode_t;
39#define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */
40#define MAX_INSN_SIZE 1 40#define MAX_INSN_SIZE 1
41 41
42#define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008)
43#define IS_TD(instr) (((instr) & 0xfc0007fe) == 0x7c000088)
44#define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000)
45#define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000)
46
47#ifdef CONFIG_PPC64 42#ifdef CONFIG_PPC64
48/* 43/*
49 * 64bit powerpc uses function descriptors. 44 * 64bit powerpc uses function descriptors.
@@ -72,12 +67,6 @@ typedef unsigned int kprobe_opcode_t;
72 addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \ 67 addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \
73 } \ 68 } \
74} 69}
75
76#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \
77 IS_TWI(instr) || IS_TDI(instr))
78#else
79/* Use stock kprobe_lookup_name since ppc32 doesn't use function descriptors */
80#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
81#endif 70#endif
82 71
83#define flush_insn_slot(p) do { } while (0) 72#define flush_insn_slot(p) do { } while (0)
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index f0e0c6a66d97..7aefdb3e1ce4 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -59,7 +59,7 @@ struct hpte_cache {
59 struct hlist_node list_vpte; 59 struct hlist_node list_vpte;
60 struct hlist_node list_vpte_long; 60 struct hlist_node list_vpte_long;
61 struct rcu_head rcu_head; 61 struct rcu_head rcu_head;
62 u64 host_va; 62 u64 host_vpn;
63 u64 pfn; 63 u64 pfn;
64 ulong slot; 64 ulong slot;
65 struct kvmppc_pte pte; 65 struct kvmppc_pte pte;
diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h
index bfcd00c1485d..88609b23b775 100644
--- a/arch/powerpc/include/asm/kvm_book3s_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_asm.h
@@ -74,7 +74,6 @@ struct kvmppc_host_state {
74 ulong vmhandler; 74 ulong vmhandler;
75 ulong scratch0; 75 ulong scratch0;
76 ulong scratch1; 76 ulong scratch1;
77 ulong sprg3;
78 u8 in_guest; 77 u8 in_guest;
79 u8 restore_hid5; 78 u8 restore_hid5;
80 u8 napping; 79 u8 napping;
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index f7706d722b39..c4231973edd3 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -34,19 +34,19 @@ struct machdep_calls {
34 char *name; 34 char *name;
35#ifdef CONFIG_PPC64 35#ifdef CONFIG_PPC64
36 void (*hpte_invalidate)(unsigned long slot, 36 void (*hpte_invalidate)(unsigned long slot,
37 unsigned long va, 37 unsigned long vpn,
38 int psize, int ssize, 38 int psize, int ssize,
39 int local); 39 int local);
40 long (*hpte_updatepp)(unsigned long slot, 40 long (*hpte_updatepp)(unsigned long slot,
41 unsigned long newpp, 41 unsigned long newpp,
42 unsigned long va, 42 unsigned long vpn,
43 int psize, int ssize, 43 int psize, int ssize,
44 int local); 44 int local);
45 void (*hpte_updateboltedpp)(unsigned long newpp, 45 void (*hpte_updateboltedpp)(unsigned long newpp,
46 unsigned long ea, 46 unsigned long ea,
47 int psize, int ssize); 47 int psize, int ssize);
48 long (*hpte_insert)(unsigned long hpte_group, 48 long (*hpte_insert)(unsigned long hpte_group,
49 unsigned long va, 49 unsigned long vpn,
50 unsigned long prpn, 50 unsigned long prpn,
51 unsigned long rflags, 51 unsigned long rflags,
52 unsigned long vflags, 52 unsigned long vflags,
@@ -180,7 +180,8 @@ struct machdep_calls {
180 void (*enable_pmcs)(void); 180 void (*enable_pmcs)(void);
181 181
182 /* Set DABR for this platform, leave empty for default implemenation */ 182 /* Set DABR for this platform, leave empty for default implemenation */
183 int (*set_dabr)(unsigned long dabr); 183 int (*set_dabr)(unsigned long dabr,
184 unsigned long dabrx);
184 185
185#ifdef CONFIG_PPC32 /* XXX for now */ 186#ifdef CONFIG_PPC32 /* XXX for now */
186 /* A general init function, called by ppc_init in init/main.c. 187 /* A general init function, called by ppc_init in init/main.c.
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index 1c65a59881ea..9673f73eb8db 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -16,6 +16,13 @@
16#include <asm/page.h> 16#include <asm/page.h>
17 17
18/* 18/*
19 * This is necessary to get the definition of PGTABLE_RANGE which we
20 * need for various slices related matters. Note that this isn't the
21 * complete pgtable.h but only a portion of it.
22 */
23#include <asm/pgtable-ppc64.h>
24
25/*
19 * Segment table 26 * Segment table
20 */ 27 */
21 28
@@ -154,9 +161,25 @@ struct mmu_psize_def
154#define MMU_SEGSIZE_256M 0 161#define MMU_SEGSIZE_256M 0
155#define MMU_SEGSIZE_1T 1 162#define MMU_SEGSIZE_1T 1
156 163
164/*
165 * encode page number shift.
166 * in order to fit the 78 bit va in a 64 bit variable we shift the va by
167 * 12 bits. This enable us to address upto 76 bit va.
168 * For hpt hash from a va we can ignore the page size bits of va and for
169 * hpte encoding we ignore up to 23 bits of va. So ignoring lower 12 bits ensure
170 * we work in all cases including 4k page size.
171 */
172#define VPN_SHIFT 12
157 173
158#ifndef __ASSEMBLY__ 174#ifndef __ASSEMBLY__
159 175
176static inline int segment_shift(int ssize)
177{
178 if (ssize == MMU_SEGSIZE_256M)
179 return SID_SHIFT;
180 return SID_SHIFT_1T;
181}
182
160/* 183/*
161 * The current system page and segment sizes 184 * The current system page and segment sizes
162 */ 185 */
@@ -180,18 +203,39 @@ extern unsigned long tce_alloc_start, tce_alloc_end;
180extern int mmu_ci_restrictions; 203extern int mmu_ci_restrictions;
181 204
182/* 205/*
206 * This computes the AVPN and B fields of the first dword of a HPTE,
207 * for use when we want to match an existing PTE. The bottom 7 bits
208 * of the returned value are zero.
209 */
210static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,
211 int ssize)
212{
213 unsigned long v;
214 /*
215 * The AVA field omits the low-order 23 bits of the 78 bits VA.
216 * These bits are not needed in the PTE, because the
217 * low-order b of these bits are part of the byte offset
218 * into the virtual page and, if b < 23, the high-order
219 * 23-b of these bits are always used in selecting the
220 * PTEGs to be searched
221 */
222 v = (vpn >> (23 - VPN_SHIFT)) & ~(mmu_psize_defs[psize].avpnm);
223 v <<= HPTE_V_AVPN_SHIFT;
224 v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT;
225 return v;
226}
227
228/*
183 * This function sets the AVPN and L fields of the HPTE appropriately 229 * This function sets the AVPN and L fields of the HPTE appropriately
184 * for the page size 230 * for the page size
185 */ 231 */
186static inline unsigned long hpte_encode_v(unsigned long va, int psize, 232static inline unsigned long hpte_encode_v(unsigned long vpn,
187 int ssize) 233 int psize, int ssize)
188{ 234{
189 unsigned long v; 235 unsigned long v;
190 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm); 236 v = hpte_encode_avpn(vpn, psize, ssize);
191 v <<= HPTE_V_AVPN_SHIFT;
192 if (psize != MMU_PAGE_4K) 237 if (psize != MMU_PAGE_4K)
193 v |= HPTE_V_LARGE; 238 v |= HPTE_V_LARGE;
194 v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT;
195 return v; 239 return v;
196} 240}
197 241
@@ -216,30 +260,37 @@ static inline unsigned long hpte_encode_r(unsigned long pa, int psize)
216} 260}
217 261
218/* 262/*
219 * Build a VA given VSID, EA and segment size 263 * Build a VPN_SHIFT bit shifted va given VSID, EA and segment size.
220 */ 264 */
221static inline unsigned long hpt_va(unsigned long ea, unsigned long vsid, 265static inline unsigned long hpt_vpn(unsigned long ea,
222 int ssize) 266 unsigned long vsid, int ssize)
223{ 267{
224 if (ssize == MMU_SEGSIZE_256M) 268 unsigned long mask;
225 return (vsid << 28) | (ea & 0xfffffffUL); 269 int s_shift = segment_shift(ssize);
226 return (vsid << 40) | (ea & 0xffffffffffUL); 270
271 mask = (1ul << (s_shift - VPN_SHIFT)) - 1;
272 return (vsid << (s_shift - VPN_SHIFT)) | ((ea >> VPN_SHIFT) & mask);
227} 273}
228 274
229/* 275/*
230 * This hashes a virtual address 276 * This hashes a virtual address
231 */ 277 */
232 278static inline unsigned long hpt_hash(unsigned long vpn,
233static inline unsigned long hpt_hash(unsigned long va, unsigned int shift, 279 unsigned int shift, int ssize)
234 int ssize)
235{ 280{
281 int mask;
236 unsigned long hash, vsid; 282 unsigned long hash, vsid;
237 283
284 /* VPN_SHIFT can be atmost 12 */
238 if (ssize == MMU_SEGSIZE_256M) { 285 if (ssize == MMU_SEGSIZE_256M) {
239 hash = (va >> 28) ^ ((va & 0x0fffffffUL) >> shift); 286 mask = (1ul << (SID_SHIFT - VPN_SHIFT)) - 1;
287 hash = (vpn >> (SID_SHIFT - VPN_SHIFT)) ^
288 ((vpn & mask) >> (shift - VPN_SHIFT));
240 } else { 289 } else {
241 vsid = va >> 40; 290 mask = (1ul << (SID_SHIFT_1T - VPN_SHIFT)) - 1;
242 hash = vsid ^ (vsid << 25) ^ ((va & 0xffffffffffUL) >> shift); 291 vsid = vpn >> (SID_SHIFT_1T - VPN_SHIFT);
292 hash = vsid ^ (vsid << 25) ^
293 ((vpn & mask) >> (shift - VPN_SHIFT)) ;
243 } 294 }
244 return hash & 0x7fffffffffUL; 295 return hash & 0x7fffffffffUL;
245} 296}
@@ -280,63 +331,61 @@ extern void slb_set_size(u16 size);
280#endif /* __ASSEMBLY__ */ 331#endif /* __ASSEMBLY__ */
281 332
282/* 333/*
283 * VSID allocation 334 * VSID allocation (256MB segment)
335 *
336 * We first generate a 38-bit "proto-VSID". For kernel addresses this
337 * is equal to the ESID | 1 << 37, for user addresses it is:
338 * (context << USER_ESID_BITS) | (esid & ((1U << USER_ESID_BITS) - 1)
284 * 339 *
285 * We first generate a 36-bit "proto-VSID". For kernel addresses this 340 * This splits the proto-VSID into the below range
286 * is equal to the ESID, for user addresses it is: 341 * 0 - (2^(CONTEXT_BITS + USER_ESID_BITS) - 1) : User proto-VSID range
287 * (context << 15) | (esid & 0x7fff) 342 * 2^(CONTEXT_BITS + USER_ESID_BITS) - 2^(VSID_BITS) : Kernel proto-VSID range
288 * 343 *
289 * The two forms are distinguishable because the top bit is 0 for user 344 * We also have CONTEXT_BITS + USER_ESID_BITS = VSID_BITS - 1
290 * addresses, whereas the top two bits are 1 for kernel addresses. 345 * That is, we assign half of the space to user processes and half
291 * Proto-VSIDs with the top two bits equal to 0b10 are reserved for 346 * to the kernel.
292 * now.
293 * 347 *
294 * The proto-VSIDs are then scrambled into real VSIDs with the 348 * The proto-VSIDs are then scrambled into real VSIDs with the
295 * multiplicative hash: 349 * multiplicative hash:
296 * 350 *
297 * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS 351 * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS
298 * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7
299 * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF
300 * 352 *
301 * This scramble is only well defined for proto-VSIDs below 353 * VSID_MULTIPLIER is prime, so in particular it is
302 * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are
303 * reserved. VSID_MULTIPLIER is prime, so in particular it is
304 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function. 354 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function.
305 * Because the modulus is 2^n-1 we can compute it efficiently without 355 * Because the modulus is 2^n-1 we can compute it efficiently without
306 * a divide or extra multiply (see below). 356 * a divide or extra multiply (see below).
307 * 357 *
308 * This scheme has several advantages over older methods: 358 * This scheme has several advantages over older methods:
309 * 359 *
310 * - We have VSIDs allocated for every kernel address 360 * - We have VSIDs allocated for every kernel address
311 * (i.e. everything above 0xC000000000000000), except the very top 361 * (i.e. everything above 0xC000000000000000), except the very top
312 * segment, which simplifies several things. 362 * segment, which simplifies several things.
313 * 363 *
314 * - We allow for 16 significant bits of ESID and 19 bits of 364 * - We allow for USER_ESID_BITS significant bits of ESID and
315 * context for user addresses. i.e. 16T (44 bits) of address space for 365 * CONTEXT_BITS bits of context for user addresses.
316 * up to half a million contexts. 366 * i.e. 64T (46 bits) of address space for up to half a million contexts.
317 * 367 *
318 * - The scramble function gives robust scattering in the hash 368 * - The scramble function gives robust scattering in the hash
319 * table (at least based on some initial results). The previous 369 * table (at least based on some initial results). The previous
320 * method was more susceptible to pathological cases giving excessive 370 * method was more susceptible to pathological cases giving excessive
321 * hash collisions. 371 * hash collisions.
322 */ 372 */
373
323/* 374/*
324 * WARNING - If you change these you must make sure the asm 375 * This should be computed such that protovosid * vsid_mulitplier
325 * implementations in slb_allocate (slb_low.S), do_stab_bolted 376 * doesn't overflow 64 bits. It should also be co-prime to vsid_modulus
326 * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly.
327 */ 377 */
328 378#define VSID_MULTIPLIER_256M ASM_CONST(12538073) /* 24-bit prime */
329#define VSID_MULTIPLIER_256M ASM_CONST(200730139) /* 28-bit prime */ 379#define VSID_BITS_256M 38
330#define VSID_BITS_256M 36
331#define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1) 380#define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1)
332 381
333#define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */ 382#define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */
334#define VSID_BITS_1T 24 383#define VSID_BITS_1T 26
335#define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1) 384#define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1)
336 385
337#define CONTEXT_BITS 19 386#define CONTEXT_BITS 19
338#define USER_ESID_BITS 16 387#define USER_ESID_BITS 18
339#define USER_ESID_BITS_1T 4 388#define USER_ESID_BITS_1T 6
340 389
341#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT)) 390#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT))
342 391
@@ -372,6 +421,8 @@ extern void slb_set_size(u16 size);
372 srdi rx,rx,VSID_BITS_##size; /* extract 2^VSID_BITS bit */ \ 421 srdi rx,rx,VSID_BITS_##size; /* extract 2^VSID_BITS bit */ \
373 add rt,rt,rx 422 add rt,rt,rx
374 423
424/* 4 bits per slice and we have one slice per 1TB */
425#define SLICE_ARRAY_SIZE (PGTABLE_RANGE >> 41)
375 426
376#ifndef __ASSEMBLY__ 427#ifndef __ASSEMBLY__
377 428
@@ -416,7 +467,7 @@ typedef struct {
416 467
417#ifdef CONFIG_PPC_MM_SLICES 468#ifdef CONFIG_PPC_MM_SLICES
418 u64 low_slices_psize; /* SLB page size encodings */ 469 u64 low_slices_psize; /* SLB page size encodings */
419 u64 high_slices_psize; /* 4 bits per slice for now */ 470 unsigned char high_slices_psize[SLICE_ARRAY_SIZE];
420#else 471#else
421 u16 sllp; /* SLB page size encoding */ 472 u16 sllp; /* SLB page size encoding */
422#endif 473#endif
@@ -452,12 +503,32 @@ typedef struct {
452 }) 503 })
453#endif /* 1 */ 504#endif /* 1 */
454 505
455/* This is only valid for addresses >= PAGE_OFFSET */ 506/*
507 * This is only valid for addresses >= PAGE_OFFSET
508 * The proto-VSID space is divided into two class
509 * User: 0 to 2^(CONTEXT_BITS + USER_ESID_BITS) -1
510 * kernel: 2^(CONTEXT_BITS + USER_ESID_BITS) to 2^(VSID_BITS) - 1
511 *
512 * With KERNEL_START at 0xc000000000000000, the proto vsid for
513 * the kernel ends up with 0xc00000000 (36 bits). With 64TB
514 * support we need to have kernel proto-VSID in the
515 * [2^37 to 2^38 - 1] range due to the increased USER_ESID_BITS.
516 */
456static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize) 517static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
457{ 518{
458 if (ssize == MMU_SEGSIZE_256M) 519 unsigned long proto_vsid;
459 return vsid_scramble(ea >> SID_SHIFT, 256M); 520 /*
460 return vsid_scramble(ea >> SID_SHIFT_1T, 1T); 521 * We need to make sure proto_vsid for the kernel is
522 * >= 2^(CONTEXT_BITS + USER_ESID_BITS[_1T])
523 */
524 if (ssize == MMU_SEGSIZE_256M) {
525 proto_vsid = ea >> SID_SHIFT;
526 proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS));
527 return vsid_scramble(proto_vsid, 256M);
528 }
529 proto_vsid = ea >> SID_SHIFT_1T;
530 proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS_1T));
531 return vsid_scramble(proto_vsid, 1T);
461} 532}
462 533
463/* Returns the segment size indicator for a user address */ 534/* Returns the segment size indicator for a user address */
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index e8a26db2e8f3..5e38eedea218 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -146,6 +146,15 @@ extern void setup_initial_memory_limit(phys_addr_t first_memblock_base,
146extern u64 ppc64_rma_size; 146extern u64 ppc64_rma_size;
147#endif /* CONFIG_PPC64 */ 147#endif /* CONFIG_PPC64 */
148 148
149struct mm_struct;
150#ifdef CONFIG_DEBUG_VM
151extern void assert_pte_locked(struct mm_struct *mm, unsigned long addr);
152#else /* CONFIG_DEBUG_VM */
153static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
154{
155}
156#endif /* !CONFIG_DEBUG_VM */
157
149#endif /* !__ASSEMBLY__ */ 158#endif /* !__ASSEMBLY__ */
150 159
151/* The kernel use the constants below to index in the page sizes array. 160/* The kernel use the constants below to index in the page sizes array.
diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
index 1f41382eda38..0acc7c7c28d1 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -307,6 +307,7 @@ struct mpc52xx_lpbfifo_request {
307 size_t size; 307 size_t size;
308 size_t pos; /* current position of transfer */ 308 size_t pos; /* current position of transfer */
309 int flags; 309 int flags;
310 int defer_xfer_start;
310 311
311 /* What to do when finished */ 312 /* What to do when finished */
312 void (*callback)(struct mpc52xx_lpbfifo_request *); 313 void (*callback)(struct mpc52xx_lpbfifo_request *);
@@ -323,6 +324,7 @@ struct mpc52xx_lpbfifo_request {
323extern int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req); 324extern int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req);
324extern void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req); 325extern void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req);
325extern void mpc52xx_lpbfifo_poll(void); 326extern void mpc52xx_lpbfifo_poll(void);
327extern int mpc52xx_lpbfifo_start_xfer(struct mpc52xx_lpbfifo_request *req);
326 328
327/* mpc52xx_pic.c */ 329/* mpc52xx_pic.c */
328extern void mpc52xx_init_irq(void); 330extern void mpc52xx_init_irq(void);
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
index c9f698a994be..c0f9ef90f0b8 100644
--- a/arch/powerpc/include/asm/mpic.h
+++ b/arch/powerpc/include/asm/mpic.h
@@ -63,6 +63,7 @@
63 */ 63 */
64#define MPIC_TIMER_BASE 0x01100 64#define MPIC_TIMER_BASE 0x01100
65#define MPIC_TIMER_STRIDE 0x40 65#define MPIC_TIMER_STRIDE 0x40
66#define MPIC_TIMER_GROUP_STRIDE 0x1000
66 67
67#define MPIC_TIMER_CURRENT_CNT 0x00000 68#define MPIC_TIMER_CURRENT_CNT 0x00000
68#define MPIC_TIMER_BASE_CNT 0x00010 69#define MPIC_TIMER_BASE_CNT 0x00010
@@ -110,10 +111,16 @@
110#define MPIC_VECPRI_SENSE_MASK 0x00400000 111#define MPIC_VECPRI_SENSE_MASK 0x00400000
111#define MPIC_IRQ_DESTINATION 0x00010 112#define MPIC_IRQ_DESTINATION 0x00010
112 113
114#define MPIC_FSL_BRR1 0x00000
115#define MPIC_FSL_BRR1_VER 0x0000ffff
116
113#define MPIC_MAX_IRQ_SOURCES 2048 117#define MPIC_MAX_IRQ_SOURCES 2048
114#define MPIC_MAX_CPUS 32 118#define MPIC_MAX_CPUS 32
115#define MPIC_MAX_ISU 32 119#define MPIC_MAX_ISU 32
116 120
121#define MPIC_MAX_ERR 32
122#define MPIC_FSL_ERR_INT 16
123
117/* 124/*
118 * Tsi108 implementation of MPIC has many differences from the original one 125 * Tsi108 implementation of MPIC has many differences from the original one
119 */ 126 */
@@ -266,6 +273,7 @@ struct mpic
266 struct irq_chip hc_ipi; 273 struct irq_chip hc_ipi;
267#endif 274#endif
268 struct irq_chip hc_tm; 275 struct irq_chip hc_tm;
276 struct irq_chip hc_err;
269 const char *name; 277 const char *name;
270 /* Flags */ 278 /* Flags */
271 unsigned int flags; 279 unsigned int flags;
@@ -279,6 +287,8 @@ struct mpic
279 /* vector numbers used for internal sources (ipi/timers) */ 287 /* vector numbers used for internal sources (ipi/timers) */
280 unsigned int ipi_vecs[4]; 288 unsigned int ipi_vecs[4];
281 unsigned int timer_vecs[8]; 289 unsigned int timer_vecs[8];
290 /* vector numbers used for FSL MPIC error interrupts */
291 unsigned int err_int_vecs[MPIC_MAX_ERR];
282 292
283 /* Spurious vector to program into unused sources */ 293 /* Spurious vector to program into unused sources */
284 unsigned int spurious_vec; 294 unsigned int spurious_vec;
@@ -296,11 +306,15 @@ struct mpic
296 phys_addr_t paddr; 306 phys_addr_t paddr;
297 307
298 /* The various ioremap'ed bases */ 308 /* The various ioremap'ed bases */
309 struct mpic_reg_bank thiscpuregs;
299 struct mpic_reg_bank gregs; 310 struct mpic_reg_bank gregs;
300 struct mpic_reg_bank tmregs; 311 struct mpic_reg_bank tmregs;
301 struct mpic_reg_bank cpuregs[MPIC_MAX_CPUS]; 312 struct mpic_reg_bank cpuregs[MPIC_MAX_CPUS];
302 struct mpic_reg_bank isus[MPIC_MAX_ISU]; 313 struct mpic_reg_bank isus[MPIC_MAX_ISU];
303 314
315 /* ioremap'ed base for error interrupt registers */
316 u32 __iomem *err_regs;
317
304 /* Protected sources */ 318 /* Protected sources */
305 unsigned long *protected; 319 unsigned long *protected;
306 320
@@ -365,6 +379,11 @@ struct mpic
365#define MPIC_NO_RESET 0x00004000 379#define MPIC_NO_RESET 0x00004000
366/* Freescale MPIC (compatible includes "fsl,mpic") */ 380/* Freescale MPIC (compatible includes "fsl,mpic") */
367#define MPIC_FSL 0x00008000 381#define MPIC_FSL 0x00008000
382/* Freescale MPIC supports EIMR (error interrupt mask register).
383 * This flag is set for MPIC version >= 4.1 (version determined
384 * from the BRR1 register).
385*/
386#define MPIC_FSL_HAS_EIMR 0x00010000
368 387
369/* MPIC HW modification ID */ 388/* MPIC HW modification ID */
370#define MPIC_REGSET_MASK 0xf0000000 389#define MPIC_REGSET_MASK 0xf0000000
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index daf813fea91f..e9e7a6999bb8 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -100,7 +100,7 @@ struct paca_struct {
100 /* SLB related definitions */ 100 /* SLB related definitions */
101 u16 vmalloc_sllp; 101 u16 vmalloc_sllp;
102 u16 slb_cache_ptr; 102 u16 slb_cache_ptr;
103 u16 slb_cache[SLB_CACHE_ENTRIES]; 103 u32 slb_cache[SLB_CACHE_ENTRIES];
104#endif /* CONFIG_PPC_STD_MMU_64 */ 104#endif /* CONFIG_PPC_STD_MMU_64 */
105 105
106#ifdef CONFIG_PPC_BOOK3E 106#ifdef CONFIG_PPC_BOOK3E
@@ -136,6 +136,7 @@ struct paca_struct {
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 */
139 u64 sprg3; /* Saved user-visible sprg */
139 140
140#ifdef CONFIG_PPC_POWERNV 141#ifdef CONFIG_PPC_POWERNV
141 /* Pointer to OPAL machine check event structure set by the 142 /* Pointer to OPAL machine check event structure set by the
diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h
index fed85e6290e1..cd915d6b093d 100644
--- a/arch/powerpc/include/asm/page_64.h
+++ b/arch/powerpc/include/asm/page_64.h
@@ -78,11 +78,19 @@ extern u64 ppc64_pft_size;
78#define GET_LOW_SLICE_INDEX(addr) ((addr) >> SLICE_LOW_SHIFT) 78#define GET_LOW_SLICE_INDEX(addr) ((addr) >> SLICE_LOW_SHIFT)
79#define GET_HIGH_SLICE_INDEX(addr) ((addr) >> SLICE_HIGH_SHIFT) 79#define GET_HIGH_SLICE_INDEX(addr) ((addr) >> SLICE_HIGH_SHIFT)
80 80
81/*
82 * 1 bit per slice and we have one slice per 1TB
83 * Right now we support only 64TB.
84 * IF we change this we will have to change the type
85 * of high_slices
86 */
87#define SLICE_MASK_SIZE 8
88
81#ifndef __ASSEMBLY__ 89#ifndef __ASSEMBLY__
82 90
83struct slice_mask { 91struct slice_mask {
84 u16 low_slices; 92 u16 low_slices;
85 u16 high_slices; 93 u64 high_slices;
86}; 94};
87 95
88struct mm_struct; 96struct mm_struct;
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 8cccbee61519..025a130729bc 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -182,14 +182,25 @@ static inline int pci_device_from_OF_node(struct device_node *np,
182#if defined(CONFIG_EEH) 182#if defined(CONFIG_EEH)
183static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn) 183static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
184{ 184{
185 /*
186 * For those OF nodes whose parent isn't PCI bridge, they
187 * don't have PCI_DN actually. So we have to skip them for
188 * any EEH operations.
189 */
190 if (!dn || !PCI_DN(dn))
191 return NULL;
192
185 return PCI_DN(dn)->edev; 193 return PCI_DN(dn)->edev;
186} 194}
195#else
196#define of_node_to_eeh_dev(x) (NULL)
187#endif 197#endif
188 198
189/** Find the bus corresponding to the indicated device node */ 199/** Find the bus corresponding to the indicated device node */
190extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn); 200extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn);
191 201
192/** Remove all of the PCI devices under this bus */ 202/** Remove all of the PCI devices under this bus */
203extern void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe);
193extern void pcibios_remove_pci_devices(struct pci_bus *bus); 204extern void pcibios_remove_pci_devices(struct pci_bus *bus);
194 205
195/** Discover new pci devices under this bus, and add them */ 206/** Discover new pci devices under this bus, and add them */
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index 078019b5b353..9710be3a2d17 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -49,6 +49,7 @@ struct power_pmu {
49#define PPMU_ALT_SIPR 2 /* uses alternate posn for SIPR/HV */ 49#define PPMU_ALT_SIPR 2 /* uses alternate posn for SIPR/HV */
50#define PPMU_NO_SIPR 4 /* no SIPR/HV in MMCRA at all */ 50#define PPMU_NO_SIPR 4 /* no SIPR/HV in MMCRA at all */
51#define PPMU_NO_CONT_SAMPLING 8 /* no continuous sampling */ 51#define PPMU_NO_CONT_SAMPLING 8 /* no continuous sampling */
52#define PPMU_SIAR_VALID 16 /* Processor has SIAR Valid bit */
52 53
53/* 54/*
54 * Values for flags to get_alternatives() 55 * Values for flags to get_alternatives()
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-4k.h b/arch/powerpc/include/asm/pgtable-ppc64-4k.h
index 6eefdcffa359..12798c9d4b4b 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-4k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-4k.h
@@ -7,7 +7,7 @@
7 */ 7 */
8#define PTE_INDEX_SIZE 9 8#define PTE_INDEX_SIZE 9
9#define PMD_INDEX_SIZE 7 9#define PMD_INDEX_SIZE 7
10#define PUD_INDEX_SIZE 7 10#define PUD_INDEX_SIZE 9
11#define PGD_INDEX_SIZE 9 11#define PGD_INDEX_SIZE 9
12 12
13#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
@@ -19,7 +19,7 @@
19 19
20#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) 20#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
21#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) 21#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
22#define PTRS_PER_PUD (1 << PMD_INDEX_SIZE) 22#define PTRS_PER_PUD (1 << PUD_INDEX_SIZE)
23#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) 23#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
24 24
25/* PMD_SHIFT determines what a second-level page table entry can map */ 25/* PMD_SHIFT determines what a second-level page table entry can map */
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-64k.h b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
index 90533ddcd703..be4e2878fbc0 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-64k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
@@ -7,7 +7,7 @@
7#define PTE_INDEX_SIZE 12 7#define PTE_INDEX_SIZE 12
8#define PMD_INDEX_SIZE 12 8#define PMD_INDEX_SIZE 12
9#define PUD_INDEX_SIZE 0 9#define PUD_INDEX_SIZE 0
10#define PGD_INDEX_SIZE 4 10#define PGD_INDEX_SIZE 6
11 11
12#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
13#define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE) 13#define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE)
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index c4205616dfb5..0182c203e411 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -21,17 +21,6 @@
21#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE) 21#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE)
22 22
23 23
24/* Some sanity checking */
25#if TASK_SIZE_USER64 > PGTABLE_RANGE
26#error TASK_SIZE_USER64 exceeds pagetable range
27#endif
28
29#ifdef CONFIG_PPC_STD_MMU_64
30#if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT))
31#error TASK_SIZE_USER64 exceeds user VSID range
32#endif
33#endif
34
35/* 24/*
36 * Define the address range of the kernel non-linear virtual area 25 * Define the address range of the kernel non-linear virtual area
37 */ 26 */
@@ -41,7 +30,7 @@
41#else 30#else
42#define KERN_VIRT_START ASM_CONST(0xD000000000000000) 31#define KERN_VIRT_START ASM_CONST(0xD000000000000000)
43#endif 32#endif
44#define KERN_VIRT_SIZE PGTABLE_RANGE 33#define KERN_VIRT_SIZE ASM_CONST(0x0000100000000000)
45 34
46/* 35/*
47 * The vmalloc space starts at the beginning of that region, and 36 * The vmalloc space starts at the beginning of that region, and
@@ -117,9 +106,6 @@
117 106
118#ifndef __ASSEMBLY__ 107#ifndef __ASSEMBLY__
119 108
120#include <linux/stddef.h>
121#include <asm/tlbflush.h>
122
123/* 109/*
124 * This is the default implementation of various PTE accessors, it's 110 * This is the default implementation of various PTE accessors, it's
125 * used in all cases except Book3S with 64K pages where we have a 111 * used in all cases except Book3S with 64K pages where we have a
@@ -198,7 +184,8 @@
198/* to find an entry in a kernel page-table-directory */ 184/* to find an entry in a kernel page-table-directory */
199/* This now only contains the vmalloc pages */ 185/* This now only contains the vmalloc pages */
200#define pgd_offset_k(address) pgd_offset(&init_mm, address) 186#define pgd_offset_k(address) pgd_offset(&init_mm, address)
201 187extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
188 pte_t *ptep, unsigned long pte, int huge);
202 189
203/* Atomic PTE updates */ 190/* Atomic PTE updates */
204static inline unsigned long pte_update(struct mm_struct *mm, 191static inline unsigned long pte_update(struct mm_struct *mm,
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 2e0e4110f7ae..a9cbd3ba5c33 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -9,14 +9,6 @@
9 9
10struct mm_struct; 10struct mm_struct;
11 11
12#ifdef CONFIG_DEBUG_VM
13extern void assert_pte_locked(struct mm_struct *mm, unsigned long addr);
14#else /* CONFIG_DEBUG_VM */
15static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
16{
17}
18#endif /* !CONFIG_DEBUG_VM */
19
20#endif /* !__ASSEMBLY__ */ 12#endif /* !__ASSEMBLY__ */
21 13
22#if defined(CONFIG_PPC64) 14#if defined(CONFIG_PPC64)
@@ -27,6 +19,8 @@ static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
27 19
28#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
29 21
22#include <asm/tlbflush.h>
23
30/* Generic accessors to PTE bits */ 24/* Generic accessors to PTE bits */
31static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 25static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
32static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 26static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 4c25319f2fbc..5f73ce63fcae 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -126,6 +126,7 @@
126#define PPC_INST_TLBIVAX 0x7c000624 126#define PPC_INST_TLBIVAX 0x7c000624
127#define PPC_INST_TLBSRX_DOT 0x7c0006a5 127#define PPC_INST_TLBSRX_DOT 0x7c0006a5
128#define PPC_INST_XXLOR 0xf0000510 128#define PPC_INST_XXLOR 0xf0000510
129#define PPC_INST_XVCPSGNDP 0xf0000780
129 130
130#define PPC_INST_NAP 0x4c000364 131#define PPC_INST_NAP 0x4c000364
131#define PPC_INST_SLEEP 0x4c0003a4 132#define PPC_INST_SLEEP 0x4c0003a4
@@ -277,6 +278,8 @@
277 VSX_XX1((s), a, b)) 278 VSX_XX1((s), a, b))
278#define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \ 279#define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \
279 VSX_XX3((t), a, b)) 280 VSX_XX3((t), a, b))
281#define XVCPSGNDP(t, a, b) stringify_in_c(.long (PPC_INST_XVCPSGNDP | \
282 VSX_XX3((t), (a), (b))))
280 283
281#define PPC_NAP stringify_in_c(.long PPC_INST_NAP) 284#define PPC_NAP stringify_in_c(.long PPC_INST_NAP)
282#define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP) 285#define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP)
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index 80fa704d410f..ed57fa7920c8 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -47,19 +47,17 @@ extern int rtas_setup_phb(struct pci_controller *phb);
47 47
48#ifdef CONFIG_EEH 48#ifdef CONFIG_EEH
49 49
50void pci_addr_cache_build(void); 50void eeh_addr_cache_insert_dev(struct pci_dev *dev);
51void pci_addr_cache_insert_device(struct pci_dev *dev); 51void eeh_addr_cache_rmv_dev(struct pci_dev *dev);
52void pci_addr_cache_remove_device(struct pci_dev *dev); 52struct eeh_dev *eeh_addr_cache_get_dev(unsigned long addr);
53struct pci_dev *pci_addr_cache_get_device(unsigned long addr); 53void eeh_slot_error_detail(struct eeh_pe *pe, int severity);
54void eeh_slot_error_detail(struct eeh_dev *edev, int severity); 54int eeh_pci_enable(struct eeh_pe *pe, int function);
55int eeh_pci_enable(struct eeh_dev *edev, int function); 55int eeh_reset_pe(struct eeh_pe *);
56int eeh_reset_pe(struct eeh_dev *); 56void eeh_save_bars(struct eeh_dev *edev);
57void eeh_restore_bars(struct eeh_dev *);
58int rtas_write_config(struct pci_dn *, int where, int size, u32 val); 57int rtas_write_config(struct pci_dn *, int where, int size, u32 val);
59int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); 58int rtas_read_config(struct pci_dn *, int where, int size, u32 *val);
60void eeh_mark_slot(struct device_node *dn, int mode_flag); 59void eeh_pe_state_mark(struct eeh_pe *pe, int state);
61void eeh_clear_slot(struct device_node *dn, int mode_flag); 60void eeh_pe_state_clear(struct eeh_pe *pe, int state);
62struct device_node *eeh_find_device_pe(struct device_node *dn);
63 61
64void eeh_sysfs_add_device(struct pci_dev *pdev); 62void eeh_sysfs_add_device(struct pci_dev *pdev);
65void eeh_sysfs_remove_device(struct pci_dev *pdev); 63void eeh_sysfs_remove_device(struct pci_dev *pdev);
diff --git a/arch/powerpc/include/asm/probes.h b/arch/powerpc/include/asm/probes.h
new file mode 100644
index 000000000000..5f1e15b68704
--- /dev/null
+++ b/arch/powerpc/include/asm/probes.h
@@ -0,0 +1,42 @@
1#ifndef _ASM_POWERPC_PROBES_H
2#define _ASM_POWERPC_PROBES_H
3#ifdef __KERNEL__
4/*
5 * Definitions common to probes files
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 * Copyright IBM Corporation, 2012
22 */
23#include <linux/types.h>
24
25typedef u32 ppc_opcode_t;
26#define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */
27
28/* Trap definitions per ISA */
29#define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008)
30#define IS_TD(instr) (((instr) & 0xfc0007fe) == 0x7c000088)
31#define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000)
32#define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000)
33
34#ifdef CONFIG_PPC64
35#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \
36 IS_TWI(instr) || IS_TDI(instr))
37#else
38#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
39#endif /* CONFIG_PPC64 */
40
41#endif /* __KERNEL__ */
42#endif /* _ASM_POWERPC_PROBES_H */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 54b73a28c205..9dc5cd1fde1a 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -97,8 +97,8 @@ extern struct task_struct *last_task_used_spe;
97#endif 97#endif
98 98
99#ifdef CONFIG_PPC64 99#ifdef CONFIG_PPC64
100/* 64-bit user address space is 44-bits (16TB user VM) */ 100/* 64-bit user address space is 46-bits (64TB user VM) */
101#define TASK_SIZE_USER64 (0x0000100000000000UL) 101#define TASK_SIZE_USER64 (0x0000400000000000UL)
102 102
103/* 103/*
104 * 32-bit user address space is 4GB - 1 page 104 * 32-bit user address space is 4GB - 1 page
@@ -219,6 +219,8 @@ struct thread_struct {
219#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 219#endif /* CONFIG_HAVE_HW_BREAKPOINT */
220#endif 220#endif
221 unsigned long dabr; /* Data address breakpoint register */ 221 unsigned long dabr; /* Data address breakpoint register */
222 unsigned long dabrx; /* ... extension */
223 unsigned long trap_nr; /* last trap # on this thread */
222#ifdef CONFIG_ALTIVEC 224#ifdef CONFIG_ALTIVEC
223 /* Complete AltiVec register set */ 225 /* Complete AltiVec register set */
224 vector128 vr[32] __attribute__((aligned(16))); 226 vector128 vr[32] __attribute__((aligned(16)));
diff --git a/arch/powerpc/include/asm/pte-hash64-64k.h b/arch/powerpc/include/asm/pte-hash64-64k.h
index 59247e816ac5..eedf427c9124 100644
--- a/arch/powerpc/include/asm/pte-hash64-64k.h
+++ b/arch/powerpc/include/asm/pte-hash64-64k.h
@@ -58,14 +58,16 @@
58/* Trick: we set __end to va + 64k, which happens works for 58/* Trick: we set __end to va + 64k, which happens works for
59 * a 16M page as well as we want only one iteration 59 * a 16M page as well as we want only one iteration
60 */ 60 */
61#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \ 61#define pte_iterate_hashed_subpages(rpte, psize, vpn, index, shift) \
62 do { \ 62 do { \
63 unsigned long __end = va + PAGE_SIZE; \ 63 unsigned long __end = vpn + (1UL << (PAGE_SHIFT - VPN_SHIFT)); \
64 unsigned __split = (psize == MMU_PAGE_4K || \ 64 unsigned __split = (psize == MMU_PAGE_4K || \
65 psize == MMU_PAGE_64K_AP); \ 65 psize == MMU_PAGE_64K_AP); \
66 shift = mmu_psize_defs[psize].shift; \ 66 shift = mmu_psize_defs[psize].shift; \
67 for (index = 0; va < __end; index++, va += (1L << shift)) { \ 67 for (index = 0; vpn < __end; index++, \
68 if (!__split || __rpte_sub_valid(rpte, index)) do { \ 68 vpn += (1L << (shift - VPN_SHIFT))) { \
69 if (!__split || __rpte_sub_valid(rpte, index)) \
70 do {
69 71
70#define pte_iterate_hashed_end() } while(0); } } while(0) 72#define pte_iterate_hashed_end() } while(0); } } while(0)
71 73
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 638608677e2a..d24c14163966 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -208,6 +208,9 @@
208#define SPRN_DABRX 0x3F7 /* Data Address Breakpoint Register Extension */ 208#define SPRN_DABRX 0x3F7 /* Data Address Breakpoint Register Extension */
209#define DABRX_USER (1UL << 0) 209#define DABRX_USER (1UL << 0)
210#define DABRX_KERNEL (1UL << 1) 210#define DABRX_KERNEL (1UL << 1)
211#define DABRX_HYP (1UL << 2)
212#define DABRX_BTI (1UL << 3)
213#define DABRX_ALL (DABRX_BTI | DABRX_HYP | DABRX_KERNEL | DABRX_USER)
211#define SPRN_DAR 0x013 /* Data Address Register */ 214#define SPRN_DAR 0x013 /* Data Address Register */
212#define SPRN_DBCR 0x136 /* e300 Data Breakpoint Control Reg */ 215#define SPRN_DBCR 0x136 /* e300 Data Breakpoint Control Reg */
213#define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */ 216#define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */
@@ -521,6 +524,7 @@
521 524
522#define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */ 525#define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */
523#define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */ 526#define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */
527#define HSRR1_DENORM 0x00100000 /* Denorm exception */
524 528
525#define SPRN_TBCTL 0x35f /* PA6T Timebase control register */ 529#define SPRN_TBCTL 0x35f /* PA6T Timebase control register */
526#define TBCTL_FREEZE 0x0000000000000000ull /* Freeze all tbs */ 530#define TBCTL_FREEZE 0x0000000000000000ull /* Freeze all tbs */
@@ -602,6 +606,10 @@
602#define POWER6_MMCRA_SIPR 0x0000020000000000ULL 606#define POWER6_MMCRA_SIPR 0x0000020000000000ULL
603#define POWER6_MMCRA_THRM 0x00000020UL 607#define POWER6_MMCRA_THRM 0x00000020UL
604#define POWER6_MMCRA_OTHER 0x0000000EUL 608#define POWER6_MMCRA_OTHER 0x0000000EUL
609
610#define POWER7P_MMCRA_SIAR_VALID 0x10000000 /* P7+ SIAR contents valid */
611#define POWER7P_MMCRA_SDAR_VALID 0x08000000 /* P7+ SDAR contents valid */
612
605#define SPRN_PMC1 787 613#define SPRN_PMC1 787
606#define SPRN_PMC2 788 614#define SPRN_PMC2 788
607#define SPRN_PMC3 789 615#define SPRN_PMC3 789
@@ -761,7 +769,8 @@
761 * 64-bit embedded 769 * 64-bit embedded
762 * - SPRG0 generic exception scratch 770 * - SPRG0 generic exception scratch
763 * - SPRG2 TLB exception stack 771 * - SPRG2 TLB exception stack
764 * - SPRG3 CPU and NUMA node for VDSO getcpu (user visible) 772 * - SPRG3 critical exception scratch and
773 * CPU and NUMA node for VDSO getcpu (user visible)
765 * - SPRG4 unused (user visible) 774 * - SPRG4 unused (user visible)
766 * - SPRG6 TLB miss scratch (user visible, sorry !) 775 * - SPRG6 TLB miss scratch (user visible, sorry !)
767 * - SPRG7 critical exception scratch 776 * - SPRG7 critical exception scratch
@@ -858,11 +867,12 @@
858 867
859#ifdef CONFIG_PPC_BOOK3E_64 868#ifdef CONFIG_PPC_BOOK3E_64
860#define SPRN_SPRG_MC_SCRATCH SPRN_SPRG8 869#define SPRN_SPRG_MC_SCRATCH SPRN_SPRG8
861#define SPRN_SPRG_CRIT_SCRATCH SPRN_SPRG7 870#define SPRN_SPRG_CRIT_SCRATCH SPRN_SPRG3
862#define SPRN_SPRG_DBG_SCRATCH SPRN_SPRG9 871#define SPRN_SPRG_DBG_SCRATCH SPRN_SPRG9
863#define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2 872#define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2
864#define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6 873#define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6
865#define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0 874#define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0
875#define SPRN_SPRG_GDBELL_SCRATCH SPRN_SPRG_GEN_SCRATCH
866 876
867#define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX 877#define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX
868#define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA 878#define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA
@@ -937,7 +947,7 @@
937#define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ 947#define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */
938#define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ 948#define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */
939 949
940#define __is_processor(pv) (PVR_VER(mfspr(SPRN_PVR)) == (pv)) 950#define pvr_version_is(pvr) (PVR_VER(mfspr(SPRN_PVR)) == (pvr))
941 951
942/* 952/*
943 * IBM has further subdivided the standard PowerPC 16-bit version and 953 * IBM has further subdivided the standard PowerPC 16-bit version and
@@ -1002,25 +1012,25 @@
1002#define PVR_476_ISS 0x00052000 1012#define PVR_476_ISS 0x00052000
1003 1013
1004/* 64-bit processors */ 1014/* 64-bit processors */
1005/* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */ 1015#define PVR_NORTHSTAR 0x0033
1006#define PV_NORTHSTAR 0x0033 1016#define PVR_PULSAR 0x0034
1007#define PV_PULSAR 0x0034 1017#define PVR_POWER4 0x0035
1008#define PV_POWER4 0x0035 1018#define PVR_ICESTAR 0x0036
1009#define PV_ICESTAR 0x0036 1019#define PVR_SSTAR 0x0037
1010#define PV_SSTAR 0x0037 1020#define PVR_POWER4p 0x0038
1011#define PV_POWER4p 0x0038 1021#define PVR_970 0x0039
1012#define PV_970 0x0039 1022#define PVR_POWER5 0x003A
1013#define PV_POWER5 0x003A 1023#define PVR_POWER5p 0x003B
1014#define PV_POWER5p 0x003B 1024#define PVR_970FX 0x003C
1015#define PV_970FX 0x003C 1025#define PVR_POWER6 0x003E
1016#define PV_POWER6 0x003E 1026#define PVR_POWER7 0x003F
1017#define PV_POWER7 0x003F 1027#define PVR_630 0x0040
1018#define PV_630 0x0040 1028#define PVR_630p 0x0041
1019#define PV_630p 0x0041 1029#define PVR_970MP 0x0044
1020#define PV_970MP 0x0044 1030#define PVR_970GX 0x0045
1021#define PV_970GX 0x0045 1031#define PVR_POWER7p 0x004A
1022#define PV_BE 0x0070 1032#define PVR_BE 0x0070
1023#define PV_PA6T 0x0090 1033#define PVR_PA6T 0x0090
1024 1034
1025/* Macros for setting and retrieving special purpose registers */ 1035/* Macros for setting and retrieving special purpose registers */
1026#ifndef __ASSEMBLY__ 1036#ifndef __ASSEMBLY__
diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
index d084ce195fc3..8b9a306260b2 100644
--- a/arch/powerpc/include/asm/setup.h
+++ b/arch/powerpc/include/asm/setup.h
@@ -9,7 +9,7 @@ extern void ppc_printk_progress(char *s, unsigned short hex);
9extern unsigned int rtas_data; 9extern unsigned int rtas_data;
10extern int mem_init_done; /* set on boot once kmalloc can be called */ 10extern int mem_init_done; /* set on boot once kmalloc can be called */
11extern int init_bootmem_done; /* set once bootmem is available */ 11extern int init_bootmem_done; /* set once bootmem is available */
12extern phys_addr_t memory_limit; 12extern unsigned long long memory_limit;
13extern unsigned long klimit; 13extern unsigned long klimit;
14extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); 14extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
15 15
diff --git a/arch/powerpc/include/asm/siginfo.h b/arch/powerpc/include/asm/siginfo.h
index 49495b0534ed..ccce3ef5cd86 100644
--- a/arch/powerpc/include/asm/siginfo.h
+++ b/arch/powerpc/include/asm/siginfo.h
@@ -10,7 +10,6 @@
10 10
11#ifdef __powerpc64__ 11#ifdef __powerpc64__
12# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) 12# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
13# define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
14#endif 13#endif
15 14
16#include <asm-generic/siginfo.h> 15#include <asm-generic/siginfo.h>
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index ebc24dc5b1a1..e807e9d8e3f7 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -65,6 +65,7 @@ int generic_cpu_disable(void);
65void generic_cpu_die(unsigned int cpu); 65void generic_cpu_die(unsigned int cpu);
66void generic_mach_cpu_die(void); 66void generic_mach_cpu_die(void);
67void generic_set_cpu_dead(unsigned int cpu); 67void generic_set_cpu_dead(unsigned int cpu);
68void generic_set_cpu_up(unsigned int cpu);
68int generic_check_cpu_restart(unsigned int cpu); 69int generic_check_cpu_restart(unsigned int cpu);
69#endif 70#endif
70 71
@@ -190,6 +191,7 @@ extern unsigned long __secondary_hold_spinloop;
190extern unsigned long __secondary_hold_acknowledge; 191extern unsigned long __secondary_hold_acknowledge;
191extern char __secondary_hold; 192extern char __secondary_hold;
192 193
194extern void __early_start(void);
193#endif /* __ASSEMBLY__ */ 195#endif /* __ASSEMBLY__ */
194 196
195#endif /* __KERNEL__ */ 197#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/sparsemem.h b/arch/powerpc/include/asm/sparsemem.h
index 0c5fa3145615..f6fc0ee813d7 100644
--- a/arch/powerpc/include/asm/sparsemem.h
+++ b/arch/powerpc/include/asm/sparsemem.h
@@ -10,8 +10,8 @@
10 */ 10 */
11#define SECTION_SIZE_BITS 24 11#define SECTION_SIZE_BITS 24
12 12
13#define MAX_PHYSADDR_BITS 44 13#define MAX_PHYSADDR_BITS 46
14#define MAX_PHYSMEM_BITS 44 14#define MAX_PHYSMEM_BITS 46
15 15
16#endif /* CONFIG_SPARSEMEM */ 16#endif /* CONFIG_SPARSEMEM */
17 17
diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
index 8979d4cd3d70..de99d6e29430 100644
--- a/arch/powerpc/include/asm/swiotlb.h
+++ b/arch/powerpc/include/asm/swiotlb.h
@@ -22,4 +22,10 @@ int __init swiotlb_setup_bus_notifier(void);
22 22
23extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev); 23extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev);
24 24
25#ifdef CONFIG_SWIOTLB
26void swiotlb_detect_4g(void);
27#else
28static inline void swiotlb_detect_4g(void) {}
29#endif
30
25#endif /* __ASM_SWIOTLB_H */ 31#endif /* __ASM_SWIOTLB_H */
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index faf93529cbf0..8ceea14d6fe4 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -102,7 +102,10 @@ static inline struct thread_info *current_thread_info(void)
102#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ 102#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */
103#define TIF_NOERROR 12 /* Force successful syscall return */ 103#define TIF_NOERROR 12 /* Force successful syscall return */
104#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ 104#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */
105#define TIF_UPROBE 14 /* breakpointed or single-stepping */
105#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */ 106#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */
107#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation
108 for stack store? */
106 109
107/* as above, but as bit values */ 110/* as above, but as bit values */
108#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 111#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -118,12 +121,14 @@ static inline struct thread_info *current_thread_info(void)
118#define _TIF_RESTOREALL (1<<TIF_RESTOREALL) 121#define _TIF_RESTOREALL (1<<TIF_RESTOREALL)
119#define _TIF_NOERROR (1<<TIF_NOERROR) 122#define _TIF_NOERROR (1<<TIF_NOERROR)
120#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 123#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
124#define _TIF_UPROBE (1<<TIF_UPROBE)
121#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 125#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
126#define _TIF_EMULATE_STACK_STORE (1<<TIF_EMULATE_STACK_STORE)
122#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ 127#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
123 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT) 128 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
124 129
125#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ 130#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
126 _TIF_NOTIFY_RESUME) 131 _TIF_NOTIFY_RESUME | _TIF_UPROBE)
127#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) 132#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR)
128 133
129/* Bits in local_flags */ 134/* Bits in local_flags */
diff --git a/arch/powerpc/include/asm/tlbflush.h b/arch/powerpc/include/asm/tlbflush.h
index 81143fcbd113..61a59271665b 100644
--- a/arch/powerpc/include/asm/tlbflush.h
+++ b/arch/powerpc/include/asm/tlbflush.h
@@ -95,7 +95,7 @@ struct ppc64_tlb_batch {
95 unsigned long index; 95 unsigned long index;
96 struct mm_struct *mm; 96 struct mm_struct *mm;
97 real_pte_t pte[PPC64_TLB_BATCH_NR]; 97 real_pte_t pte[PPC64_TLB_BATCH_NR];
98 unsigned long vaddr[PPC64_TLB_BATCH_NR]; 98 unsigned long vpn[PPC64_TLB_BATCH_NR];
99 unsigned int psize; 99 unsigned int psize;
100 int ssize; 100 int ssize;
101}; 101};
@@ -103,9 +103,6 @@ DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
103 103
104extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch); 104extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch);
105 105
106extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
107 pte_t *ptep, unsigned long pte, int huge);
108
109#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 106#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
110 107
111static inline void arch_enter_lazy_mmu_mode(void) 108static inline void arch_enter_lazy_mmu_mode(void)
@@ -127,7 +124,7 @@ static inline void arch_leave_lazy_mmu_mode(void)
127#define arch_flush_lazy_mmu_mode() do {} while (0) 124#define arch_flush_lazy_mmu_mode() do {} while (0)
128 125
129 126
130extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize, 127extern void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize,
131 int ssize, int local); 128 int ssize, int local);
132extern void flush_hash_range(unsigned long number, int local); 129extern void flush_hash_range(unsigned long number, int local);
133 130
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 17bb40cad5bf..4db49590acf5 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -98,11 +98,6 @@ struct exception_table_entry {
98 * PowerPC, we can just do these as direct assignments. (Of course, the 98 * PowerPC, we can just do these as direct assignments. (Of course, the
99 * exception handling means that it's no longer "just"...) 99 * exception handling means that it's no longer "just"...)
100 * 100 *
101 * The "user64" versions of the user access functions are versions that
102 * allow access of 64-bit data. The "get_user" functions do not
103 * properly handle 64-bit data because the value gets down cast to a long.
104 * The "put_user" functions already handle 64-bit data properly but we add
105 * "user64" versions for completeness
106 */ 101 */
107#define get_user(x, ptr) \ 102#define get_user(x, ptr) \
108 __get_user_check((x), (ptr), sizeof(*(ptr))) 103 __get_user_check((x), (ptr), sizeof(*(ptr)))
@@ -114,12 +109,6 @@ struct exception_table_entry {
114#define __put_user(x, ptr) \ 109#define __put_user(x, ptr) \
115 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) 110 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
116 111
117#ifndef __powerpc64__
118#define __get_user64(x, ptr) \
119 __get_user64_nocheck((x), (ptr), sizeof(*(ptr)))
120#define __put_user64(x, ptr) __put_user(x, ptr)
121#endif
122
123#define __get_user_inatomic(x, ptr) \ 112#define __get_user_inatomic(x, ptr) \
124 __get_user_nosleep((x), (ptr), sizeof(*(ptr))) 113 __get_user_nosleep((x), (ptr), sizeof(*(ptr)))
125#define __put_user_inatomic(x, ptr) \ 114#define __put_user_inatomic(x, ptr) \
diff --git a/arch/powerpc/include/asm/uprobes.h b/arch/powerpc/include/asm/uprobes.h
new file mode 100644
index 000000000000..b532060d0916
--- /dev/null
+++ b/arch/powerpc/include/asm/uprobes.h
@@ -0,0 +1,54 @@
1#ifndef _ASM_UPROBES_H
2#define _ASM_UPROBES_H
3/*
4 * User-space Probes (UProbes) for powerpc
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 * Copyright IBM Corporation, 2007-2012
21 *
22 * Adapted from the x86 port by Ananth N Mavinakayanahalli <ananth@in.ibm.com>
23 */
24
25#include <linux/notifier.h>
26#include <asm/probes.h>
27
28typedef ppc_opcode_t uprobe_opcode_t;
29
30#define MAX_UINSN_BYTES 4
31#define UPROBE_XOL_SLOT_BYTES (MAX_UINSN_BYTES)
32
33/* The following alias is needed for reference from arch-agnostic code */
34#define UPROBE_SWBP_INSN BREAKPOINT_INSTRUCTION
35#define UPROBE_SWBP_INSN_SIZE 4 /* swbp insn size in bytes */
36
37struct arch_uprobe {
38 union {
39 u8 insn[MAX_UINSN_BYTES];
40 u32 ainsn;
41 };
42};
43
44struct arch_uprobe_task {
45 unsigned long saved_trap_nr;
46};
47
48extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr);
49extern int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs);
50extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
51extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
52extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
53extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
54#endif /* _ASM_UPROBES_H */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index bb282dd81612..cde12f8a4ebc 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -96,6 +96,7 @@ obj-$(CONFIG_MODULES) += ppc_ksyms.o
96obj-$(CONFIG_BOOTX_TEXT) += btext.o 96obj-$(CONFIG_BOOTX_TEXT) += btext.o
97obj-$(CONFIG_SMP) += smp.o 97obj-$(CONFIG_SMP) += smp.o
98obj-$(CONFIG_KPROBES) += kprobes.o 98obj-$(CONFIG_KPROBES) += kprobes.o
99obj-$(CONFIG_UPROBES) += uprobes.o
99obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o 100obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o
100obj-$(CONFIG_STACKTRACE) += stacktrace.o 101obj-$(CONFIG_STACKTRACE) += stacktrace.o
101obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o 102obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index e8995727b1c1..7523539cfe9f 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -206,6 +206,7 @@ int main(void)
206 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); 206 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
207 DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); 207 DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save));
208 DEFINE(PACA_NAPSTATELOST, offsetof(struct paca_struct, nap_state_lost)); 208 DEFINE(PACA_NAPSTATELOST, offsetof(struct paca_struct, nap_state_lost));
209 DEFINE(PACA_SPRG3, offsetof(struct paca_struct, sprg3));
209#endif /* CONFIG_PPC64 */ 210#endif /* CONFIG_PPC64 */
210 211
211 /* RTAS */ 212 /* RTAS */
@@ -534,7 +535,6 @@ int main(void)
534 HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler); 535 HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler);
535 HSTATE_FIELD(HSTATE_SCRATCH0, scratch0); 536 HSTATE_FIELD(HSTATE_SCRATCH0, scratch0);
536 HSTATE_FIELD(HSTATE_SCRATCH1, scratch1); 537 HSTATE_FIELD(HSTATE_SCRATCH1, scratch1);
537 HSTATE_FIELD(HSTATE_SPRG3, sprg3);
538 HSTATE_FIELD(HSTATE_IN_GUEST, in_guest); 538 HSTATE_FIELD(HSTATE_IN_GUEST, in_guest);
539 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5); 539 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5);
540 HSTATE_FIELD(HSTATE_NAPPING, napping); 540 HSTATE_FIELD(HSTATE_NAPPING, napping);
diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
index 69fdd2322a66..dcd881937f7a 100644
--- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S
+++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
@@ -16,6 +16,8 @@
16#include <asm/processor.h> 16#include <asm/processor.h>
17#include <asm/cputable.h> 17#include <asm/cputable.h>
18#include <asm/ppc_asm.h> 18#include <asm/ppc_asm.h>
19#include <asm/mmu-book3e.h>
20#include <asm/asm-offsets.h>
19 21
20_GLOBAL(__e500_icache_setup) 22_GLOBAL(__e500_icache_setup)
21 mfspr r0, SPRN_L1CSR1 23 mfspr r0, SPRN_L1CSR1
@@ -73,27 +75,81 @@ _GLOBAL(__setup_cpu_e500v2)
73 mtlr r4 75 mtlr r4
74 blr 76 blr
75_GLOBAL(__setup_cpu_e500mc) 77_GLOBAL(__setup_cpu_e500mc)
76 mr r5, r4 78_GLOBAL(__setup_cpu_e5500)
77 mflr r4 79 mflr r5
78 bl __e500_icache_setup 80 bl __e500_icache_setup
79 bl __e500_dcache_setup 81 bl __e500_dcache_setup
80 bl __setup_e500mc_ivors 82 bl __setup_e500mc_ivors
81 mtlr r4 83 /*
84 * We only want to touch IVOR38-41 if we're running on hardware
85 * that supports category E.HV. The architectural way to determine
86 * this is MMUCFG[LPIDSIZE].
87 */
88 mfspr r3, SPRN_MMUCFG
89 rlwinm. r3, r3, 0, MMUCFG_LPIDSIZE
90 beq 1f
91 bl __setup_ehv_ivors
92 b 2f
931:
94 lwz r3, CPU_SPEC_FEATURES(r4)
95 /* We need this check as cpu_setup is also called for
96 * the secondary cores. So, if we have already cleared
97 * the feature on the primary core, avoid doing it on the
98 * secondary core.
99 */
100 andis. r6, r3, CPU_FTR_EMB_HV@h
101 beq 2f
102 rlwinm r3, r3, 0, ~CPU_FTR_EMB_HV
103 stw r3, CPU_SPEC_FEATURES(r4)
1042:
105 mtlr r5
82 blr 106 blr
83#endif 107#endif
84/* Right now, restore and setup are the same thing */ 108
109#ifdef CONFIG_PPC_BOOK3E_64
85_GLOBAL(__restore_cpu_e5500) 110_GLOBAL(__restore_cpu_e5500)
86_GLOBAL(__setup_cpu_e5500)
87 mflr r4 111 mflr r4
88 bl __e500_icache_setup 112 bl __e500_icache_setup
89 bl __e500_dcache_setup 113 bl __e500_dcache_setup
90#ifdef CONFIG_PPC_BOOK3E_64
91 bl .__setup_base_ivors 114 bl .__setup_base_ivors
92 bl .setup_perfmon_ivor 115 bl .setup_perfmon_ivor
93 bl .setup_doorbell_ivors 116 bl .setup_doorbell_ivors
117 /*
118 * We only want to touch IVOR38-41 if we're running on hardware
119 * that supports category E.HV. The architectural way to determine
120 * this is MMUCFG[LPIDSIZE].
121 */
122 mfspr r10,SPRN_MMUCFG
123 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
124 beq 1f
94 bl .setup_ehv_ivors 125 bl .setup_ehv_ivors
95#else 1261:
96 bl __setup_e500mc_ivors
97#endif
98 mtlr r4 127 mtlr r4
99 blr 128 blr
129
130_GLOBAL(__setup_cpu_e5500)
131 mflr r5
132 bl __e500_icache_setup
133 bl __e500_dcache_setup
134 bl .__setup_base_ivors
135 bl .setup_perfmon_ivor
136 bl .setup_doorbell_ivors
137 /*
138 * We only want to touch IVOR38-41 if we're running on hardware
139 * that supports category E.HV. The architectural way to determine
140 * this is MMUCFG[LPIDSIZE].
141 */
142 mfspr r10,SPRN_MMUCFG
143 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
144 beq 1f
145 bl .setup_ehv_ivors
146 b 2f
1471:
148 ld r10,CPU_SPEC_FEATURES(r4)
149 LOAD_REG_IMMEDIATE(r9,CPU_FTR_EMB_HV)
150 andc r10,r10,r9
151 std r10,CPU_SPEC_FEATURES(r4)
1522:
153 mtlr r5
154 blr
155#endif
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 455faa389876..0514c21f138b 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2016,7 +2016,9 @@ static struct cpu_spec __initdata cpu_specs[] = {
2016 .oprofile_cpu_type = "ppc/e500mc", 2016 .oprofile_cpu_type = "ppc/e500mc",
2017 .oprofile_type = PPC_OPROFILE_FSL_EMB, 2017 .oprofile_type = PPC_OPROFILE_FSL_EMB,
2018 .cpu_setup = __setup_cpu_e5500, 2018 .cpu_setup = __setup_cpu_e5500,
2019#ifndef CONFIG_PPC32
2019 .cpu_restore = __restore_cpu_e5500, 2020 .cpu_restore = __restore_cpu_e5500,
2021#endif
2020 .machine_check = machine_check_e500mc, 2022 .machine_check = machine_check_e500mc,
2021 .platform = "ppce5500", 2023 .platform = "ppce5500",
2022 }, 2024 },
@@ -2034,7 +2036,9 @@ static struct cpu_spec __initdata cpu_specs[] = {
2034 .oprofile_cpu_type = "ppc/e6500", 2036 .oprofile_cpu_type = "ppc/e6500",
2035 .oprofile_type = PPC_OPROFILE_FSL_EMB, 2037 .oprofile_type = PPC_OPROFILE_FSL_EMB,
2036 .cpu_setup = __setup_cpu_e5500, 2038 .cpu_setup = __setup_cpu_e5500,
2039#ifndef CONFIG_PPC32
2037 .cpu_restore = __restore_cpu_e5500, 2040 .cpu_restore = __restore_cpu_e5500,
2041#endif
2038 .machine_check = machine_check_e500mc, 2042 .machine_check = machine_check_e500mc,
2039 .platform = "ppce6500", 2043 .platform = "ppce6500",
2040 }, 2044 },
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index 46943651da23..bd1a2aba599f 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/memblock.h>
15#include <linux/pfn.h> 16#include <linux/pfn.h>
16#include <linux/of_platform.h> 17#include <linux/of_platform.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -20,7 +21,6 @@
20#include <asm/machdep.h> 21#include <asm/machdep.h>
21#include <asm/swiotlb.h> 22#include <asm/swiotlb.h>
22#include <asm/dma.h> 23#include <asm/dma.h>
23#include <asm/abs_addr.h>
24 24
25unsigned int ppc_swiotlb_enable; 25unsigned int ppc_swiotlb_enable;
26 26
@@ -105,3 +105,23 @@ int __init swiotlb_setup_bus_notifier(void)
105 &ppc_swiotlb_plat_bus_notifier); 105 &ppc_swiotlb_plat_bus_notifier);
106 return 0; 106 return 0;
107} 107}
108
109void swiotlb_detect_4g(void)
110{
111 if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
112 ppc_swiotlb_enable = 1;
113}
114
115static int __init swiotlb_late_init(void)
116{
117 if (ppc_swiotlb_enable) {
118 swiotlb_print_info();
119 set_pci_dma_ops(&swiotlb_dma_ops);
120 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
121 } else {
122 swiotlb_free();
123 }
124
125 return 0;
126}
127subsys_initcall(swiotlb_late_init);
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 355b9d84b0f8..8032b97ccdcb 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -14,7 +14,6 @@
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <asm/vio.h> 15#include <asm/vio.h>
16#include <asm/bug.h> 16#include <asm/bug.h>
17#include <asm/abs_addr.h>
18#include <asm/machdep.h> 17#include <asm/machdep.h>
19 18
20/* 19/*
@@ -50,7 +49,7 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size,
50 return NULL; 49 return NULL;
51 ret = page_address(page); 50 ret = page_address(page);
52 memset(ret, 0, size); 51 memset(ret, 0, size);
53 *dma_handle = virt_to_abs(ret) + get_dma_offset(dev); 52 *dma_handle = __pa(ret) + get_dma_offset(dev);
54 53
55 return ret; 54 return ret;
56#endif 55#endif
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index ead5016b02d0..af37528da49f 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -831,19 +831,56 @@ restore_user:
831 bnel- load_dbcr0 831 bnel- load_dbcr0
832#endif 832#endif
833 833
834#ifdef CONFIG_PREEMPT
835 b restore 834 b restore
836 835
837/* N.B. the only way to get here is from the beq following ret_from_except. */ 836/* N.B. the only way to get here is from the beq following ret_from_except. */
838resume_kernel: 837resume_kernel:
839 /* check current_thread_info->preempt_count */ 838 /* check current_thread_info, _TIF_EMULATE_STACK_STORE */
840 CURRENT_THREAD_INFO(r9, r1) 839 CURRENT_THREAD_INFO(r9, r1)
840 lwz r8,TI_FLAGS(r9)
841 andis. r8,r8,_TIF_EMULATE_STACK_STORE@h
842 beq+ 1f
843
844 addi r8,r1,INT_FRAME_SIZE /* Get the kprobed function entry */
845
846 lwz r3,GPR1(r1)
847 subi r3,r3,INT_FRAME_SIZE /* dst: Allocate a trampoline exception frame */
848 mr r4,r1 /* src: current exception frame */
849 mr r1,r3 /* Reroute the trampoline frame to r1 */
850
851 /* Copy from the original to the trampoline. */
852 li r5,INT_FRAME_SIZE/4 /* size: INT_FRAME_SIZE */
853 li r6,0 /* start offset: 0 */
854 mtctr r5
8552: lwzx r0,r6,r4
856 stwx r0,r6,r3
857 addi r6,r6,4
858 bdnz 2b
859
860 /* Do real store operation to complete stwu */
861 lwz r5,GPR1(r1)
862 stw r8,0(r5)
863
864 /* Clear _TIF_EMULATE_STACK_STORE flag */
865 lis r11,_TIF_EMULATE_STACK_STORE@h
866 addi r5,r9,TI_FLAGS
8670: lwarx r8,0,r5
868 andc r8,r8,r11
869#ifdef CONFIG_IBM405_ERR77
870 dcbt 0,r5
871#endif
872 stwcx. r8,0,r5
873 bne- 0b
8741:
875
876#ifdef CONFIG_PREEMPT
877 /* check current_thread_info->preempt_count */
841 lwz r0,TI_PREEMPT(r9) 878 lwz r0,TI_PREEMPT(r9)
842 cmpwi 0,r0,0 /* if non-zero, just restore regs and return */ 879 cmpwi 0,r0,0 /* if non-zero, just restore regs and return */
843 bne restore 880 bne restore
844 lwz r0,TI_FLAGS(r9) 881 andi. r8,r8,_TIF_NEED_RESCHED
845 andi. r0,r0,_TIF_NEED_RESCHED
846 beq+ restore 882 beq+ restore
883 lwz r3,_MSR(r1)
847 andi. r0,r3,MSR_EE /* interrupts off? */ 884 andi. r0,r3,MSR_EE /* interrupts off? */
848 beq restore /* don't schedule if so */ 885 beq restore /* don't schedule if so */
849#ifdef CONFIG_TRACE_IRQFLAGS 886#ifdef CONFIG_TRACE_IRQFLAGS
@@ -864,8 +901,6 @@ resume_kernel:
864 */ 901 */
865 bl trace_hardirqs_on 902 bl trace_hardirqs_on
866#endif 903#endif
867#else
868resume_kernel:
869#endif /* CONFIG_PREEMPT */ 904#endif /* CONFIG_PREEMPT */
870 905
871 /* interrupts are hard-disabled at this point */ 906 /* interrupts are hard-disabled at this point */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index b40e0b4815b3..0e931aaffca2 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -593,6 +593,41 @@ _GLOBAL(ret_from_except_lite)
593 b .ret_from_except 593 b .ret_from_except
594 594
595resume_kernel: 595resume_kernel:
596 /* check current_thread_info, _TIF_EMULATE_STACK_STORE */
597 CURRENT_THREAD_INFO(r9, r1)
598 ld r8,TI_FLAGS(r9)
599 andis. r8,r8,_TIF_EMULATE_STACK_STORE@h
600 beq+ 1f
601
602 addi r8,r1,INT_FRAME_SIZE /* Get the kprobed function entry */
603
604 lwz r3,GPR1(r1)
605 subi r3,r3,INT_FRAME_SIZE /* dst: Allocate a trampoline exception frame */
606 mr r4,r1 /* src: current exception frame */
607 mr r1,r3 /* Reroute the trampoline frame to r1 */
608
609 /* Copy from the original to the trampoline. */
610 li r5,INT_FRAME_SIZE/8 /* size: INT_FRAME_SIZE */
611 li r6,0 /* start offset: 0 */
612 mtctr r5
6132: ldx r0,r6,r4
614 stdx r0,r6,r3
615 addi r6,r6,8
616 bdnz 2b
617
618 /* Do real store operation to complete stwu */
619 lwz r5,GPR1(r1)
620 std r8,0(r5)
621
622 /* Clear _TIF_EMULATE_STACK_STORE flag */
623 lis r11,_TIF_EMULATE_STACK_STORE@h
624 addi r5,r9,TI_FLAGS
625 ldarx r4,0,r5
626 andc r4,r4,r11
627 stdcx. r4,0,r5
628 bne- 0b
6291:
630
596#ifdef CONFIG_PREEMPT 631#ifdef CONFIG_PREEMPT
597 /* Check if we need to preempt */ 632 /* Check if we need to preempt */
598 andi. r0,r4,_TIF_NEED_RESCHED 633 andi. r0,r4,_TIF_NEED_RESCHED
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 98be7f0cd227..4684e33a26c3 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -25,6 +25,8 @@
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#include <asm/hw_irq.h>
28#include <asm/kvm_asm.h>
29#include <asm/kvm_booke_hv_asm.h>
28 30
29/* XXX This will ultimately add space for a special exception save 31/* XXX This will ultimately add space for a special exception save
30 * structure used to save things like SRR0/SRR1, SPRGs, MAS, etc... 32 * structure used to save things like SRR0/SRR1, SPRGs, MAS, etc...
@@ -35,16 +37,18 @@
35#define SPECIAL_EXC_FRAME_SIZE INT_FRAME_SIZE 37#define SPECIAL_EXC_FRAME_SIZE INT_FRAME_SIZE
36 38
37/* Exception prolog code for all exceptions */ 39/* Exception prolog code for all exceptions */
38#define EXCEPTION_PROLOG(n, type, addition) \ 40#define EXCEPTION_PROLOG(n, intnum, type, addition) \
39 mtspr SPRN_SPRG_##type##_SCRATCH,r13; /* get spare registers */ \ 41 mtspr SPRN_SPRG_##type##_SCRATCH,r13; /* get spare registers */ \
40 mfspr r13,SPRN_SPRG_PACA; /* get PACA */ \ 42 mfspr r13,SPRN_SPRG_PACA; /* get PACA */ \
41 std r10,PACA_EX##type+EX_R10(r13); \ 43 std r10,PACA_EX##type+EX_R10(r13); \
42 std r11,PACA_EX##type+EX_R11(r13); \ 44 std r11,PACA_EX##type+EX_R11(r13); \
45 PROLOG_STORE_RESTORE_SCRATCH_##type; \
43 mfcr r10; /* save CR */ \ 46 mfcr r10; /* save CR */ \
47 mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \
48 DO_KVM intnum,SPRN_##type##_SRR1; /* KVM hook */ \
49 stw r10,PACA_EX##type+EX_CR(r13); /* save old CR in the PACA */ \
44 addition; /* additional code for that exc. */ \ 50 addition; /* additional code for that exc. */ \
45 std r1,PACA_EX##type+EX_R1(r13); /* save old r1 in the PACA */ \ 51 std r1,PACA_EX##type+EX_R1(r13); /* save old r1 in the PACA */ \
46 stw r10,PACA_EX##type+EX_CR(r13); /* save old CR in the PACA */ \
47 mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \
48 type##_SET_KSTACK; /* get special stack if necessary */\ 52 type##_SET_KSTACK; /* get special stack if necessary */\
49 andi. r10,r11,MSR_PR; /* save stack pointer */ \ 53 andi. r10,r11,MSR_PR; /* save stack pointer */ \
50 beq 1f; /* branch around if supervisor */ \ 54 beq 1f; /* branch around if supervisor */ \
@@ -59,6 +63,10 @@
59#define SPRN_GEN_SRR0 SPRN_SRR0 63#define SPRN_GEN_SRR0 SPRN_SRR0
60#define SPRN_GEN_SRR1 SPRN_SRR1 64#define SPRN_GEN_SRR1 SPRN_SRR1
61 65
66#define GDBELL_SET_KSTACK GEN_SET_KSTACK
67#define SPRN_GDBELL_SRR0 SPRN_GSRR0
68#define SPRN_GDBELL_SRR1 SPRN_GSRR1
69
62#define CRIT_SET_KSTACK \ 70#define CRIT_SET_KSTACK \
63 ld r1,PACA_CRIT_STACK(r13); \ 71 ld r1,PACA_CRIT_STACK(r13); \
64 subi r1,r1,SPECIAL_EXC_FRAME_SIZE; 72 subi r1,r1,SPECIAL_EXC_FRAME_SIZE;
@@ -77,29 +85,46 @@
77#define SPRN_MC_SRR0 SPRN_MCSRR0 85#define SPRN_MC_SRR0 SPRN_MCSRR0
78#define SPRN_MC_SRR1 SPRN_MCSRR1 86#define SPRN_MC_SRR1 SPRN_MCSRR1
79 87
80#define NORMAL_EXCEPTION_PROLOG(n, addition) \ 88#define NORMAL_EXCEPTION_PROLOG(n, intnum, addition) \
81 EXCEPTION_PROLOG(n, GEN, addition##_GEN(n)) 89 EXCEPTION_PROLOG(n, intnum, GEN, addition##_GEN(n))
90
91#define CRIT_EXCEPTION_PROLOG(n, intnum, addition) \
92 EXCEPTION_PROLOG(n, intnum, CRIT, addition##_CRIT(n))
82 93
83#define CRIT_EXCEPTION_PROLOG(n, addition) \ 94#define DBG_EXCEPTION_PROLOG(n, intnum, addition) \
84 EXCEPTION_PROLOG(n, CRIT, addition##_CRIT(n)) 95 EXCEPTION_PROLOG(n, intnum, DBG, addition##_DBG(n))
85 96
86#define DBG_EXCEPTION_PROLOG(n, addition) \ 97#define MC_EXCEPTION_PROLOG(n, intnum, addition) \
87 EXCEPTION_PROLOG(n, DBG, addition##_DBG(n)) 98 EXCEPTION_PROLOG(n, intnum, MC, addition##_MC(n))
88 99
89#define MC_EXCEPTION_PROLOG(n, addition) \ 100#define GDBELL_EXCEPTION_PROLOG(n, intnum, addition) \
90 EXCEPTION_PROLOG(n, MC, addition##_MC(n)) 101 EXCEPTION_PROLOG(n, intnum, GDBELL, addition##_GDBELL(n))
91 102
103/*
104 * Store user-visible scratch in PACA exception slots and restore proper value
105 */
106#define PROLOG_STORE_RESTORE_SCRATCH_GEN
107#define PROLOG_STORE_RESTORE_SCRATCH_GDBELL
108#define PROLOG_STORE_RESTORE_SCRATCH_DBG
109#define PROLOG_STORE_RESTORE_SCRATCH_MC
110
111#define PROLOG_STORE_RESTORE_SCRATCH_CRIT \
112 mfspr r10,SPRN_SPRG_CRIT_SCRATCH; /* get r13 */ \
113 std r10,PACA_EXCRIT+EX_R13(r13); \
114 ld r11,PACA_SPRG3(r13); \
115 mtspr SPRN_SPRG_CRIT_SCRATCH,r11;
92 116
93/* Variants of the "addition" argument for the prolog 117/* Variants of the "addition" argument for the prolog
94 */ 118 */
95#define PROLOG_ADDITION_NONE_GEN(n) 119#define PROLOG_ADDITION_NONE_GEN(n)
120#define PROLOG_ADDITION_NONE_GDBELL(n)
96#define PROLOG_ADDITION_NONE_CRIT(n) 121#define PROLOG_ADDITION_NONE_CRIT(n)
97#define PROLOG_ADDITION_NONE_DBG(n) 122#define PROLOG_ADDITION_NONE_DBG(n)
98#define PROLOG_ADDITION_NONE_MC(n) 123#define PROLOG_ADDITION_NONE_MC(n)
99 124
100#define PROLOG_ADDITION_MASKABLE_GEN(n) \ 125#define PROLOG_ADDITION_MASKABLE_GEN(n) \
101 lbz r11,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \ 126 lbz r10,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \
102 cmpwi cr0,r11,0; /* yes -> go out of line */ \ 127 cmpwi cr0,r10,0; /* yes -> go out of line */ \
103 beq masked_interrupt_book3e_##n 128 beq masked_interrupt_book3e_##n
104 129
105#define PROLOG_ADDITION_2REGS_GEN(n) \ 130#define PROLOG_ADDITION_2REGS_GEN(n) \
@@ -233,9 +258,9 @@ exc_##n##_bad_stack: \
2331: 2581:
234 259
235 260
236#define MASKABLE_EXCEPTION(trapnum, label, hdlr, ack) \ 261#define MASKABLE_EXCEPTION(trapnum, intnum, label, hdlr, ack) \
237 START_EXCEPTION(label); \ 262 START_EXCEPTION(label); \
238 NORMAL_EXCEPTION_PROLOG(trapnum, PROLOG_ADDITION_MASKABLE) \ 263 NORMAL_EXCEPTION_PROLOG(trapnum, intnum, PROLOG_ADDITION_MASKABLE)\
239 EXCEPTION_COMMON(trapnum, PACA_EXGEN, INTS_DISABLE) \ 264 EXCEPTION_COMMON(trapnum, PACA_EXGEN, INTS_DISABLE) \
240 ack(r8); \ 265 ack(r8); \
241 CHECK_NAPPING(); \ 266 CHECK_NAPPING(); \
@@ -286,7 +311,8 @@ interrupt_end_book3e:
286 311
287/* Critical Input Interrupt */ 312/* Critical Input Interrupt */
288 START_EXCEPTION(critical_input); 313 START_EXCEPTION(critical_input);
289 CRIT_EXCEPTION_PROLOG(0x100, PROLOG_ADDITION_NONE) 314 CRIT_EXCEPTION_PROLOG(0x100, BOOKE_INTERRUPT_CRITICAL,
315 PROLOG_ADDITION_NONE)
290// EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE) 316// EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE)
291// bl special_reg_save_crit 317// bl special_reg_save_crit
292// CHECK_NAPPING(); 318// CHECK_NAPPING();
@@ -297,7 +323,8 @@ interrupt_end_book3e:
297 323
298/* Machine Check Interrupt */ 324/* Machine Check Interrupt */
299 START_EXCEPTION(machine_check); 325 START_EXCEPTION(machine_check);
300 CRIT_EXCEPTION_PROLOG(0x200, PROLOG_ADDITION_NONE) 326 MC_EXCEPTION_PROLOG(0x200, BOOKE_INTERRUPT_MACHINE_CHECK,
327 PROLOG_ADDITION_NONE)
301// EXCEPTION_COMMON(0x200, PACA_EXMC, INTS_DISABLE) 328// EXCEPTION_COMMON(0x200, PACA_EXMC, INTS_DISABLE)
302// bl special_reg_save_mc 329// bl special_reg_save_mc
303// addi r3,r1,STACK_FRAME_OVERHEAD 330// addi r3,r1,STACK_FRAME_OVERHEAD
@@ -308,7 +335,8 @@ interrupt_end_book3e:
308 335
309/* Data Storage Interrupt */ 336/* Data Storage Interrupt */
310 START_EXCEPTION(data_storage) 337 START_EXCEPTION(data_storage)
311 NORMAL_EXCEPTION_PROLOG(0x300, PROLOG_ADDITION_2REGS) 338 NORMAL_EXCEPTION_PROLOG(0x300, BOOKE_INTERRUPT_DATA_STORAGE,
339 PROLOG_ADDITION_2REGS)
312 mfspr r14,SPRN_DEAR 340 mfspr r14,SPRN_DEAR
313 mfspr r15,SPRN_ESR 341 mfspr r15,SPRN_ESR
314 EXCEPTION_COMMON(0x300, PACA_EXGEN, INTS_DISABLE) 342 EXCEPTION_COMMON(0x300, PACA_EXGEN, INTS_DISABLE)
@@ -316,18 +344,21 @@ interrupt_end_book3e:
316 344
317/* Instruction Storage Interrupt */ 345/* Instruction Storage Interrupt */
318 START_EXCEPTION(instruction_storage); 346 START_EXCEPTION(instruction_storage);
319 NORMAL_EXCEPTION_PROLOG(0x400, PROLOG_ADDITION_2REGS) 347 NORMAL_EXCEPTION_PROLOG(0x400, BOOKE_INTERRUPT_INST_STORAGE,
348 PROLOG_ADDITION_2REGS)
320 li r15,0 349 li r15,0
321 mr r14,r10 350 mr r14,r10
322 EXCEPTION_COMMON(0x400, PACA_EXGEN, INTS_DISABLE) 351 EXCEPTION_COMMON(0x400, PACA_EXGEN, INTS_DISABLE)
323 b storage_fault_common 352 b storage_fault_common
324 353
325/* External Input Interrupt */ 354/* External Input Interrupt */
326 MASKABLE_EXCEPTION(0x500, external_input, .do_IRQ, ACK_NONE) 355 MASKABLE_EXCEPTION(0x500, BOOKE_INTERRUPT_EXTERNAL,
356 external_input, .do_IRQ, ACK_NONE)
327 357
328/* Alignment */ 358/* Alignment */
329 START_EXCEPTION(alignment); 359 START_EXCEPTION(alignment);
330 NORMAL_EXCEPTION_PROLOG(0x600, PROLOG_ADDITION_2REGS) 360 NORMAL_EXCEPTION_PROLOG(0x600, BOOKE_INTERRUPT_ALIGNMENT,
361 PROLOG_ADDITION_2REGS)
331 mfspr r14,SPRN_DEAR 362 mfspr r14,SPRN_DEAR
332 mfspr r15,SPRN_ESR 363 mfspr r15,SPRN_ESR
333 EXCEPTION_COMMON(0x600, PACA_EXGEN, INTS_KEEP) 364 EXCEPTION_COMMON(0x600, PACA_EXGEN, INTS_KEEP)
@@ -335,7 +366,8 @@ interrupt_end_book3e:
335 366
336/* Program Interrupt */ 367/* Program Interrupt */
337 START_EXCEPTION(program); 368 START_EXCEPTION(program);
338 NORMAL_EXCEPTION_PROLOG(0x700, PROLOG_ADDITION_1REG) 369 NORMAL_EXCEPTION_PROLOG(0x700, BOOKE_INTERRUPT_PROGRAM,
370 PROLOG_ADDITION_1REG)
339 mfspr r14,SPRN_ESR 371 mfspr r14,SPRN_ESR
340 EXCEPTION_COMMON(0x700, PACA_EXGEN, INTS_DISABLE) 372 EXCEPTION_COMMON(0x700, PACA_EXGEN, INTS_DISABLE)
341 std r14,_DSISR(r1) 373 std r14,_DSISR(r1)
@@ -347,7 +379,8 @@ interrupt_end_book3e:
347 379
348/* Floating Point Unavailable Interrupt */ 380/* Floating Point Unavailable Interrupt */
349 START_EXCEPTION(fp_unavailable); 381 START_EXCEPTION(fp_unavailable);
350 NORMAL_EXCEPTION_PROLOG(0x800, PROLOG_ADDITION_NONE) 382 NORMAL_EXCEPTION_PROLOG(0x800, BOOKE_INTERRUPT_FP_UNAVAIL,
383 PROLOG_ADDITION_NONE)
351 /* we can probably do a shorter exception entry for that one... */ 384 /* we can probably do a shorter exception entry for that one... */
352 EXCEPTION_COMMON(0x800, PACA_EXGEN, INTS_KEEP) 385 EXCEPTION_COMMON(0x800, PACA_EXGEN, INTS_KEEP)
353 ld r12,_MSR(r1) 386 ld r12,_MSR(r1)
@@ -362,14 +395,17 @@ interrupt_end_book3e:
362 b .ret_from_except 395 b .ret_from_except
363 396
364/* Decrementer Interrupt */ 397/* Decrementer Interrupt */
365 MASKABLE_EXCEPTION(0x900, decrementer, .timer_interrupt, ACK_DEC) 398 MASKABLE_EXCEPTION(0x900, BOOKE_INTERRUPT_DECREMENTER,
399 decrementer, .timer_interrupt, ACK_DEC)
366 400
367/* Fixed Interval Timer Interrupt */ 401/* Fixed Interval Timer Interrupt */
368 MASKABLE_EXCEPTION(0x980, fixed_interval, .unknown_exception, ACK_FIT) 402 MASKABLE_EXCEPTION(0x980, BOOKE_INTERRUPT_FIT,
403 fixed_interval, .unknown_exception, ACK_FIT)
369 404
370/* Watchdog Timer Interrupt */ 405/* Watchdog Timer Interrupt */
371 START_EXCEPTION(watchdog); 406 START_EXCEPTION(watchdog);
372 CRIT_EXCEPTION_PROLOG(0x9f0, PROLOG_ADDITION_NONE) 407 CRIT_EXCEPTION_PROLOG(0x9f0, BOOKE_INTERRUPT_WATCHDOG,
408 PROLOG_ADDITION_NONE)
373// EXCEPTION_COMMON(0x9f0, PACA_EXCRIT, INTS_DISABLE) 409// EXCEPTION_COMMON(0x9f0, PACA_EXCRIT, INTS_DISABLE)
374// bl special_reg_save_crit 410// bl special_reg_save_crit
375// CHECK_NAPPING(); 411// CHECK_NAPPING();
@@ -388,7 +424,8 @@ interrupt_end_book3e:
388 424
389/* Auxiliary Processor Unavailable Interrupt */ 425/* Auxiliary Processor Unavailable Interrupt */
390 START_EXCEPTION(ap_unavailable); 426 START_EXCEPTION(ap_unavailable);
391 NORMAL_EXCEPTION_PROLOG(0xf20, PROLOG_ADDITION_NONE) 427 NORMAL_EXCEPTION_PROLOG(0xf20, BOOKE_INTERRUPT_AP_UNAVAIL,
428 PROLOG_ADDITION_NONE)
392 EXCEPTION_COMMON(0xf20, PACA_EXGEN, INTS_DISABLE) 429 EXCEPTION_COMMON(0xf20, PACA_EXGEN, INTS_DISABLE)
393 bl .save_nvgprs 430 bl .save_nvgprs
394 addi r3,r1,STACK_FRAME_OVERHEAD 431 addi r3,r1,STACK_FRAME_OVERHEAD
@@ -397,7 +434,8 @@ interrupt_end_book3e:
397 434
398/* Debug exception as a critical interrupt*/ 435/* Debug exception as a critical interrupt*/
399 START_EXCEPTION(debug_crit); 436 START_EXCEPTION(debug_crit);
400 CRIT_EXCEPTION_PROLOG(0xd00, PROLOG_ADDITION_2REGS) 437 CRIT_EXCEPTION_PROLOG(0xd00, BOOKE_INTERRUPT_DEBUG,
438 PROLOG_ADDITION_2REGS)
401 439
402 /* 440 /*
403 * If there is a single step or branch-taken exception in an 441 * If there is a single step or branch-taken exception in an
@@ -431,7 +469,7 @@ interrupt_end_book3e:
431 mtcr r10 469 mtcr r10
432 ld r10,PACA_EXCRIT+EX_R10(r13) /* restore registers */ 470 ld r10,PACA_EXCRIT+EX_R10(r13) /* restore registers */
433 ld r11,PACA_EXCRIT+EX_R11(r13) 471 ld r11,PACA_EXCRIT+EX_R11(r13)
434 mfspr r13,SPRN_SPRG_CRIT_SCRATCH 472 ld r13,PACA_EXCRIT+EX_R13(r13)
435 rfci 473 rfci
436 474
437 /* Normal debug exception */ 475 /* Normal debug exception */
@@ -444,7 +482,7 @@ interrupt_end_book3e:
444 /* Now we mash up things to make it look like we are coming on a 482 /* Now we mash up things to make it look like we are coming on a
445 * normal exception 483 * normal exception
446 */ 484 */
447 mfspr r15,SPRN_SPRG_CRIT_SCRATCH 485 ld r15,PACA_EXCRIT+EX_R13(r13)
448 mtspr SPRN_SPRG_GEN_SCRATCH,r15 486 mtspr SPRN_SPRG_GEN_SCRATCH,r15
449 mfspr r14,SPRN_DBSR 487 mfspr r14,SPRN_DBSR
450 EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE) 488 EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE)
@@ -462,7 +500,8 @@ kernel_dbg_exc:
462 500
463/* Debug exception as a debug interrupt*/ 501/* Debug exception as a debug interrupt*/
464 START_EXCEPTION(debug_debug); 502 START_EXCEPTION(debug_debug);
465 DBG_EXCEPTION_PROLOG(0xd08, PROLOG_ADDITION_2REGS) 503 DBG_EXCEPTION_PROLOG(0xd00, BOOKE_INTERRUPT_DEBUG,
504 PROLOG_ADDITION_2REGS)
466 505
467 /* 506 /*
468 * If there is a single step or branch-taken exception in an 507 * If there is a single step or branch-taken exception in an
@@ -523,18 +562,21 @@ kernel_dbg_exc:
523 b .ret_from_except 562 b .ret_from_except
524 563
525 START_EXCEPTION(perfmon); 564 START_EXCEPTION(perfmon);
526 NORMAL_EXCEPTION_PROLOG(0x260, PROLOG_ADDITION_NONE) 565 NORMAL_EXCEPTION_PROLOG(0x260, BOOKE_INTERRUPT_PERFORMANCE_MONITOR,
566 PROLOG_ADDITION_NONE)
527 EXCEPTION_COMMON(0x260, PACA_EXGEN, INTS_DISABLE) 567 EXCEPTION_COMMON(0x260, PACA_EXGEN, INTS_DISABLE)
528 addi r3,r1,STACK_FRAME_OVERHEAD 568 addi r3,r1,STACK_FRAME_OVERHEAD
529 bl .performance_monitor_exception 569 bl .performance_monitor_exception
530 b .ret_from_except_lite 570 b .ret_from_except_lite
531 571
532/* Doorbell interrupt */ 572/* Doorbell interrupt */
533 MASKABLE_EXCEPTION(0x280, doorbell, .doorbell_exception, ACK_NONE) 573 MASKABLE_EXCEPTION(0x280, BOOKE_INTERRUPT_DOORBELL,
574 doorbell, .doorbell_exception, ACK_NONE)
534 575
535/* Doorbell critical Interrupt */ 576/* Doorbell critical Interrupt */
536 START_EXCEPTION(doorbell_crit); 577 START_EXCEPTION(doorbell_crit);
537 CRIT_EXCEPTION_PROLOG(0x2a0, PROLOG_ADDITION_NONE) 578 CRIT_EXCEPTION_PROLOG(0x2a0, BOOKE_INTERRUPT_DOORBELL_CRITICAL,
579 PROLOG_ADDITION_NONE)
538// EXCEPTION_COMMON(0x2a0, PACA_EXCRIT, INTS_DISABLE) 580// EXCEPTION_COMMON(0x2a0, PACA_EXCRIT, INTS_DISABLE)
539// bl special_reg_save_crit 581// bl special_reg_save_crit
540// CHECK_NAPPING(); 582// CHECK_NAPPING();
@@ -543,12 +585,24 @@ kernel_dbg_exc:
543// b ret_from_crit_except 585// b ret_from_crit_except
544 b . 586 b .
545 587
546/* Guest Doorbell */ 588/*
547 MASKABLE_EXCEPTION(0x2c0, guest_doorbell, .unknown_exception, ACK_NONE) 589 * Guest doorbell interrupt
590 * This general exception use GSRRx save/restore registers
591 */
592 START_EXCEPTION(guest_doorbell);
593 GDBELL_EXCEPTION_PROLOG(0x2c0, BOOKE_INTERRUPT_GUEST_DBELL,
594 PROLOG_ADDITION_NONE)
595 EXCEPTION_COMMON(0x2c0, PACA_EXGEN, INTS_KEEP)
596 addi r3,r1,STACK_FRAME_OVERHEAD
597 bl .save_nvgprs
598 INTS_RESTORE_HARD
599 bl .unknown_exception
600 b .ret_from_except
548 601
549/* Guest Doorbell critical Interrupt */ 602/* Guest Doorbell critical Interrupt */
550 START_EXCEPTION(guest_doorbell_crit); 603 START_EXCEPTION(guest_doorbell_crit);
551 CRIT_EXCEPTION_PROLOG(0x2e0, PROLOG_ADDITION_NONE) 604 CRIT_EXCEPTION_PROLOG(0x2e0, BOOKE_INTERRUPT_GUEST_DBELL_CRIT,
605 PROLOG_ADDITION_NONE)
552// EXCEPTION_COMMON(0x2e0, PACA_EXCRIT, INTS_DISABLE) 606// EXCEPTION_COMMON(0x2e0, PACA_EXCRIT, INTS_DISABLE)
553// bl special_reg_save_crit 607// bl special_reg_save_crit
554// CHECK_NAPPING(); 608// CHECK_NAPPING();
@@ -559,7 +613,8 @@ kernel_dbg_exc:
559 613
560/* Hypervisor call */ 614/* Hypervisor call */
561 START_EXCEPTION(hypercall); 615 START_EXCEPTION(hypercall);
562 NORMAL_EXCEPTION_PROLOG(0x310, PROLOG_ADDITION_NONE) 616 NORMAL_EXCEPTION_PROLOG(0x310, BOOKE_INTERRUPT_HV_SYSCALL,
617 PROLOG_ADDITION_NONE)
563 EXCEPTION_COMMON(0x310, PACA_EXGEN, INTS_KEEP) 618 EXCEPTION_COMMON(0x310, PACA_EXGEN, INTS_KEEP)
564 addi r3,r1,STACK_FRAME_OVERHEAD 619 addi r3,r1,STACK_FRAME_OVERHEAD
565 bl .save_nvgprs 620 bl .save_nvgprs
@@ -569,7 +624,8 @@ kernel_dbg_exc:
569 624
570/* Embedded Hypervisor priviledged */ 625/* Embedded Hypervisor priviledged */
571 START_EXCEPTION(ehpriv); 626 START_EXCEPTION(ehpriv);
572 NORMAL_EXCEPTION_PROLOG(0x320, PROLOG_ADDITION_NONE) 627 NORMAL_EXCEPTION_PROLOG(0x320, BOOKE_INTERRUPT_HV_PRIV,
628 PROLOG_ADDITION_NONE)
573 EXCEPTION_COMMON(0x320, PACA_EXGEN, INTS_KEEP) 629 EXCEPTION_COMMON(0x320, PACA_EXGEN, INTS_KEEP)
574 addi r3,r1,STACK_FRAME_OVERHEAD 630 addi r3,r1,STACK_FRAME_OVERHEAD
575 bl .save_nvgprs 631 bl .save_nvgprs
@@ -582,44 +638,42 @@ kernel_dbg_exc:
582 * accordingly and if the interrupt is level sensitive, we hard disable 638 * accordingly and if the interrupt is level sensitive, we hard disable
583 */ 639 */
584 640
641.macro masked_interrupt_book3e paca_irq full_mask
642 lbz r10,PACAIRQHAPPENED(r13)
643 ori r10,r10,\paca_irq
644 stb r10,PACAIRQHAPPENED(r13)
645
646 .if \full_mask == 1
647 rldicl r10,r11,48,1 /* clear MSR_EE */
648 rotldi r11,r10,16
649 mtspr SPRN_SRR1,r11
650 .endif
651
652 lwz r11,PACA_EXGEN+EX_CR(r13)
653 mtcr r11
654 ld r10,PACA_EXGEN+EX_R10(r13)
655 ld r11,PACA_EXGEN+EX_R11(r13)
656 mfspr r13,SPRN_SPRG_GEN_SCRATCH
657 rfi
658 b .
659.endm
660
585masked_interrupt_book3e_0x500: 661masked_interrupt_book3e_0x500:
586 /* XXX When adding support for EPR, use PACA_IRQ_EE_EDGE */ 662 // XXX When adding support for EPR, use PACA_IRQ_EE_EDGE
587 li r11,PACA_IRQ_EE 663 masked_interrupt_book3e PACA_IRQ_EE 1
588 b masked_interrupt_book3e_full_mask
589 664
590masked_interrupt_book3e_0x900: 665masked_interrupt_book3e_0x900:
591 ACK_DEC(r11); 666 ACK_DEC(r10);
592 li r11,PACA_IRQ_DEC 667 masked_interrupt_book3e PACA_IRQ_DEC 0
593 b masked_interrupt_book3e_no_mask 668
594masked_interrupt_book3e_0x980: 669masked_interrupt_book3e_0x980:
595 ACK_FIT(r11); 670 ACK_FIT(r10);
596 li r11,PACA_IRQ_DEC 671 masked_interrupt_book3e PACA_IRQ_DEC 0
597 b masked_interrupt_book3e_no_mask 672
598masked_interrupt_book3e_0x280: 673masked_interrupt_book3e_0x280:
599masked_interrupt_book3e_0x2c0: 674masked_interrupt_book3e_0x2c0:
600 li r11,PACA_IRQ_DBELL 675 masked_interrupt_book3e PACA_IRQ_DBELL 0
601 b masked_interrupt_book3e_no_mask
602 676
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:
610 mtcr r10
611 lbz r10,PACAIRQHAPPENED(r13)
612 or r10,r10,r11
613 stb r10,PACAIRQHAPPENED(r13)
614 mfspr r10,SPRN_SRR1
615 rldicl r11,r10,48,1 /* clear MSR_EE */
616 rotldi r10,r11,16
617 mtspr SPRN_SRR1,r10
6181: ld r10,PACA_EXGEN+EX_R10(r13);
619 ld r11,PACA_EXGEN+EX_R11(r13);
620 mfspr r13,SPRN_SPRG_GEN_SCRATCH;
621 rfi
622 b .
623/* 677/*
624 * Called from arch_local_irq_enable when an interrupt needs 678 * Called from arch_local_irq_enable when an interrupt needs
625 * to be resent. r3 contains either 0x500,0x900,0x260 or 0x280 679 * to be resent. r3 contains either 0x500,0x900,0x260 or 0x280
@@ -1302,25 +1356,11 @@ _GLOBAL(setup_perfmon_ivor)
1302_GLOBAL(setup_doorbell_ivors) 1356_GLOBAL(setup_doorbell_ivors)
1303 SET_IVOR(36, 0x280) /* Processor Doorbell */ 1357 SET_IVOR(36, 0x280) /* Processor Doorbell */
1304 SET_IVOR(37, 0x2a0) /* Processor Doorbell Crit */ 1358 SET_IVOR(37, 0x2a0) /* Processor Doorbell Crit */
1305
1306 /* Check MMUCFG[LPIDSIZE] to determine if we have category E.HV */
1307 mfspr r10,SPRN_MMUCFG
1308 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
1309 beqlr
1310
1311 SET_IVOR(38, 0x2c0) /* Guest Processor Doorbell */
1312 SET_IVOR(39, 0x2e0) /* Guest Processor Doorbell Crit/MC */
1313 blr 1359 blr
1314 1360
1315_GLOBAL(setup_ehv_ivors) 1361_GLOBAL(setup_ehv_ivors)
1316 /*
1317 * We may be running as a guest and lack E.HV even on a chip
1318 * that normally has it.
1319 */
1320 mfspr r10,SPRN_MMUCFG
1321 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
1322 beqlr
1323
1324 SET_IVOR(40, 0x300) /* Embedded Hypervisor System Call */ 1362 SET_IVOR(40, 0x300) /* Embedded Hypervisor System Call */
1325 SET_IVOR(41, 0x320) /* Embedded Hypervisor Privilege */ 1363 SET_IVOR(41, 0x320) /* Embedded Hypervisor Privilege */
1364 SET_IVOR(38, 0x2c0) /* Guest Processor Doorbell */
1365 SET_IVOR(39, 0x2e0) /* Guest Processor Doorbell Crit/MC */
1326 blr 1366 blr
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 39aa97d3ff88..10b658ad65e1 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -275,6 +275,31 @@ vsx_unavailable_pSeries_1:
275 STD_EXCEPTION_PSERIES(0x1300, 0x1300, instruction_breakpoint) 275 STD_EXCEPTION_PSERIES(0x1300, 0x1300, instruction_breakpoint)
276 KVM_HANDLER_PR_SKIP(PACA_EXGEN, EXC_STD, 0x1300) 276 KVM_HANDLER_PR_SKIP(PACA_EXGEN, EXC_STD, 0x1300)
277 277
278 . = 0x1500
279 .global denorm_Hypervisor
280denorm_exception_hv:
281 HMT_MEDIUM
282 mtspr SPRN_SPRG_HSCRATCH0,r13
283 mfspr r13,SPRN_SPRG_HPACA
284 std r9,PACA_EXGEN+EX_R9(r13)
285 std r10,PACA_EXGEN+EX_R10(r13)
286 std r11,PACA_EXGEN+EX_R11(r13)
287 std r12,PACA_EXGEN+EX_R12(r13)
288 mfspr r9,SPRN_SPRG_HSCRATCH0
289 std r9,PACA_EXGEN+EX_R13(r13)
290 mfcr r9
291
292#ifdef CONFIG_PPC_DENORMALISATION
293 mfspr r10,SPRN_HSRR1
294 mfspr r11,SPRN_HSRR0 /* save HSRR0 */
295 andis. r10,r10,(HSRR1_DENORM)@h /* denorm? */
296 addi r11,r11,-4 /* HSRR0 is next instruction */
297 bne+ denorm_assist
298#endif
299
300 EXCEPTION_PROLOG_PSERIES_1(denorm_common, EXC_HV)
301 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x1500)
302
278#ifdef CONFIG_CBE_RAS 303#ifdef CONFIG_CBE_RAS
279 STD_EXCEPTION_HV(0x1600, 0x1602, cbe_maintenance) 304 STD_EXCEPTION_HV(0x1600, 0x1602, cbe_maintenance)
280 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1602) 305 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1602)
@@ -336,6 +361,103 @@ do_stab_bolted_pSeries:
336 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x900) 361 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x900)
337 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x982) 362 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x982)
338 363
364#ifdef CONFIG_PPC_DENORMALISATION
365denorm_assist:
366BEGIN_FTR_SECTION
367/*
368 * To denormalise we need to move a copy of the register to itself.
369 * For POWER6 do that here for all FP regs.
370 */
371 mfmsr r10
372 ori r10,r10,(MSR_FP|MSR_FE0|MSR_FE1)
373 xori r10,r10,(MSR_FE0|MSR_FE1)
374 mtmsrd r10
375 sync
376 fmr 0,0
377 fmr 1,1
378 fmr 2,2
379 fmr 3,3
380 fmr 4,4
381 fmr 5,5
382 fmr 6,6
383 fmr 7,7
384 fmr 8,8
385 fmr 9,9
386 fmr 10,10
387 fmr 11,11
388 fmr 12,12
389 fmr 13,13
390 fmr 14,14
391 fmr 15,15
392 fmr 16,16
393 fmr 17,17
394 fmr 18,18
395 fmr 19,19
396 fmr 20,20
397 fmr 21,21
398 fmr 22,22
399 fmr 23,23
400 fmr 24,24
401 fmr 25,25
402 fmr 26,26
403 fmr 27,27
404 fmr 28,28
405 fmr 29,29
406 fmr 30,30
407 fmr 31,31
408FTR_SECTION_ELSE
409/*
410 * To denormalise we need to move a copy of the register to itself.
411 * For POWER7 do that here for the first 32 VSX registers only.
412 */
413 mfmsr r10
414 oris r10,r10,MSR_VSX@h
415 mtmsrd r10
416 sync
417 XVCPSGNDP(0,0,0)
418 XVCPSGNDP(1,1,1)
419 XVCPSGNDP(2,2,2)
420 XVCPSGNDP(3,3,3)
421 XVCPSGNDP(4,4,4)
422 XVCPSGNDP(5,5,5)
423 XVCPSGNDP(6,6,6)
424 XVCPSGNDP(7,7,7)
425 XVCPSGNDP(8,8,8)
426 XVCPSGNDP(9,9,9)
427 XVCPSGNDP(10,10,10)
428 XVCPSGNDP(11,11,11)
429 XVCPSGNDP(12,12,12)
430 XVCPSGNDP(13,13,13)
431 XVCPSGNDP(14,14,14)
432 XVCPSGNDP(15,15,15)
433 XVCPSGNDP(16,16,16)
434 XVCPSGNDP(17,17,17)
435 XVCPSGNDP(18,18,18)
436 XVCPSGNDP(19,19,19)
437 XVCPSGNDP(20,20,20)
438 XVCPSGNDP(21,21,21)
439 XVCPSGNDP(22,22,22)
440 XVCPSGNDP(23,23,23)
441 XVCPSGNDP(24,24,24)
442 XVCPSGNDP(25,25,25)
443 XVCPSGNDP(26,26,26)
444 XVCPSGNDP(27,27,27)
445 XVCPSGNDP(28,28,28)
446 XVCPSGNDP(29,29,29)
447 XVCPSGNDP(30,30,30)
448 XVCPSGNDP(31,31,31)
449ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_206)
450 mtspr SPRN_HSRR0,r11
451 mtcrf 0x80,r9
452 ld r9,PACA_EXGEN+EX_R9(r13)
453 ld r10,PACA_EXGEN+EX_R10(r13)
454 ld r11,PACA_EXGEN+EX_R11(r13)
455 ld r12,PACA_EXGEN+EX_R12(r13)
456 ld r13,PACA_EXGEN+EX_R13(r13)
457 HRFID
458 b .
459#endif
460
339 .align 7 461 .align 7
340 /* moved from 0xe00 */ 462 /* moved from 0xe00 */
341 STD_EXCEPTION_HV(., 0xe02, h_data_storage) 463 STD_EXCEPTION_HV(., 0xe02, h_data_storage)
@@ -495,6 +617,7 @@ machine_check_common:
495 STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception) 617 STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception)
496 STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, .performance_monitor_exception) 618 STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, .performance_monitor_exception)
497 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception) 619 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception)
620 STD_EXCEPTION_COMMON(0x1502, denorm, .unknown_exception)
498#ifdef CONFIG_ALTIVEC 621#ifdef CONFIG_ALTIVEC
499 STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception) 622 STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception)
500#else 623#else
@@ -960,7 +1083,9 @@ _GLOBAL(do_stab_bolted)
960 rldimi r10,r11,7,52 /* r10 = first ste of the group */ 1083 rldimi r10,r11,7,52 /* r10 = first ste of the group */
961 1084
962 /* Calculate VSID */ 1085 /* Calculate VSID */
963 /* This is a kernel address, so protovsid = ESID */ 1086 /* This is a kernel address, so protovsid = ESID | 1 << 37 */
1087 li r9,0x1
1088 rldimi r11,r9,(CONTEXT_BITS + USER_ESID_BITS),0
964 ASM_VSID_SCRAMBLE(r11, r9, 256M) 1089 ASM_VSID_SCRAMBLE(r11, r9, 256M)
965 rldic r9,r11,12,16 /* r9 = vsid << 12 */ 1090 rldic r9,r11,12,16 /* r9 = vsid << 12 */
966 1091
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 18bdf74fa164..06c8202a69cf 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -289,8 +289,7 @@ int __init fadump_reserve_mem(void)
289 else 289 else
290 memory_limit = memblock_end_of_DRAM(); 290 memory_limit = memblock_end_of_DRAM();
291 printk(KERN_INFO "Adjusted memory_limit for firmware-assisted" 291 printk(KERN_INFO "Adjusted memory_limit for firmware-assisted"
292 " dump, now %#016llx\n", 292 " dump, now %#016llx\n", memory_limit);
293 (unsigned long long)memory_limit);
294 } 293 }
295 if (memory_limit) 294 if (memory_limit)
296 memory_boundary = memory_limit; 295 memory_boundary = memory_limit;
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 0f59863c3ade..6f62a737f607 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -895,15 +895,11 @@ _GLOBAL(__setup_e500mc_ivors)
895 mtspr SPRN_IVOR36,r3 895 mtspr SPRN_IVOR36,r3
896 li r3,CriticalDoorbell@l 896 li r3,CriticalDoorbell@l
897 mtspr SPRN_IVOR37,r3 897 mtspr SPRN_IVOR37,r3
898 sync
899 blr
898 900
899 /* 901/* setup ehv ivors for */
900 * We only want to touch IVOR38-41 if we're running on hardware 902_GLOBAL(__setup_ehv_ivors)
901 * that supports category E.HV. The architectural way to determine
902 * this is MMUCFG[LPIDSIZE].
903 */
904 mfspr r3, SPRN_MMUCFG
905 andis. r3, r3, MMUCFG_LPIDSIZE@h
906 beq no_hv
907 li r3,GuestDoorbell@l 903 li r3,GuestDoorbell@l
908 mtspr SPRN_IVOR38,r3 904 mtspr SPRN_IVOR38,r3
909 li r3,CriticalGuestDoorbell@l 905 li r3,CriticalGuestDoorbell@l
@@ -912,14 +908,8 @@ _GLOBAL(__setup_e500mc_ivors)
912 mtspr SPRN_IVOR40,r3 908 mtspr SPRN_IVOR40,r3
913 li r3,Ehvpriv@l 909 li r3,Ehvpriv@l
914 mtspr SPRN_IVOR41,r3 910 mtspr SPRN_IVOR41,r3
915skip_hv_ivors:
916 sync 911 sync
917 blr 912 blr
918no_hv:
919 lwz r3, CPU_SPEC_FEATURES(r5)
920 rlwinm r3, r3, 0, ~CPU_FTR_EMB_HV
921 stw r3, CPU_SPEC_FEATURES(r5)
922 b skip_hv_ivors
923 913
924#ifdef CONFIG_SPE 914#ifdef CONFIG_SPE
925/* 915/*
@@ -1043,6 +1033,34 @@ _GLOBAL(flush_dcache_L1)
1043 1033
1044 blr 1034 blr
1045 1035
1036/* Flush L1 d-cache, invalidate and disable d-cache and i-cache */
1037_GLOBAL(__flush_disable_L1)
1038 mflr r10
1039 bl flush_dcache_L1 /* Flush L1 d-cache */
1040 mtlr r10
1041
1042 mfspr r4, SPRN_L1CSR0 /* Invalidate and disable d-cache */
1043 li r5, 2
1044 rlwimi r4, r5, 0, 3
1045
1046 msync
1047 isync
1048 mtspr SPRN_L1CSR0, r4
1049 isync
1050
10511: mfspr r4, SPRN_L1CSR0 /* Wait for the invalidate to finish */
1052 andi. r4, r4, 2
1053 bne 1b
1054
1055 mfspr r4, SPRN_L1CSR1 /* Invalidate and disable i-cache */
1056 li r5, 2
1057 rlwimi r4, r5, 0, 3
1058
1059 mtspr SPRN_L1CSR1, r4
1060 isync
1061
1062 blr
1063
1046#ifdef CONFIG_SMP 1064#ifdef CONFIG_SMP
1047/* When we get here, r24 needs to hold the CPU # */ 1065/* When we get here, r24 needs to hold the CPU # */
1048 .globl __secondary_start 1066 .globl __secondary_start
diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 956a4c496de9..a89cae481b04 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -73,7 +73,7 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
73 * If so, DABR will be populated in single_step_dabr_instruction(). 73 * If so, DABR will be populated in single_step_dabr_instruction().
74 */ 74 */
75 if (current->thread.last_hit_ubp != bp) 75 if (current->thread.last_hit_ubp != bp)
76 set_dabr(info->address | info->type | DABR_TRANSLATION); 76 set_dabr(info->address | info->type | DABR_TRANSLATION, info->dabrx);
77 77
78 return 0; 78 return 0;
79} 79}
@@ -97,7 +97,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
97 } 97 }
98 98
99 *slot = NULL; 99 *slot = NULL;
100 set_dabr(0); 100 set_dabr(0, 0);
101} 101}
102 102
103/* 103/*
@@ -170,6 +170,13 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
170 170
171 info->address = bp->attr.bp_addr; 171 info->address = bp->attr.bp_addr;
172 info->len = bp->attr.bp_len; 172 info->len = bp->attr.bp_len;
173 info->dabrx = DABRX_ALL;
174 if (bp->attr.exclude_user)
175 info->dabrx &= ~DABRX_USER;
176 if (bp->attr.exclude_kernel)
177 info->dabrx &= ~DABRX_KERNEL;
178 if (bp->attr.exclude_hv)
179 info->dabrx &= ~DABRX_HYP;
173 180
174 /* 181 /*
175 * Since breakpoint length can be a maximum of HW_BREAKPOINT_LEN(8) 182 * Since breakpoint length can be a maximum of HW_BREAKPOINT_LEN(8)
@@ -197,7 +204,7 @@ void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs)
197 204
198 info = counter_arch_bp(tsk->thread.last_hit_ubp); 205 info = counter_arch_bp(tsk->thread.last_hit_ubp);
199 regs->msr &= ~MSR_SE; 206 regs->msr &= ~MSR_SE;
200 set_dabr(info->address | info->type | DABR_TRANSLATION); 207 set_dabr(info->address | info->type | DABR_TRANSLATION, info->dabrx);
201 tsk->thread.last_hit_ubp = NULL; 208 tsk->thread.last_hit_ubp = NULL;
202} 209}
203 210
@@ -215,7 +222,7 @@ int __kprobes hw_breakpoint_handler(struct die_args *args)
215 unsigned long dar = regs->dar; 222 unsigned long dar = regs->dar;
216 223
217 /* Disable breakpoints during exception handling */ 224 /* Disable breakpoints during exception handling */
218 set_dabr(0); 225 set_dabr(0, 0);
219 226
220 /* 227 /*
221 * The counter may be concurrently released but that can only 228 * The counter may be concurrently released but that can only
@@ -281,7 +288,7 @@ int __kprobes hw_breakpoint_handler(struct die_args *args)
281 if (!info->extraneous_interrupt) 288 if (!info->extraneous_interrupt)
282 perf_bp_event(bp, regs); 289 perf_bp_event(bp, regs);
283 290
284 set_dabr(info->address | info->type | DABR_TRANSLATION); 291 set_dabr(info->address | info->type | DABR_TRANSLATION, info->dabrx);
285out: 292out:
286 rcu_read_unlock(); 293 rcu_read_unlock();
287 return rc; 294 return rc;
@@ -294,7 +301,7 @@ int __kprobes single_step_dabr_instruction(struct die_args *args)
294{ 301{
295 struct pt_regs *regs = args->regs; 302 struct pt_regs *regs = args->regs;
296 struct perf_event *bp = NULL; 303 struct perf_event *bp = NULL;
297 struct arch_hw_breakpoint *bp_info; 304 struct arch_hw_breakpoint *info;
298 305
299 bp = current->thread.last_hit_ubp; 306 bp = current->thread.last_hit_ubp;
300 /* 307 /*
@@ -304,16 +311,16 @@ int __kprobes single_step_dabr_instruction(struct die_args *args)
304 if (!bp) 311 if (!bp)
305 return NOTIFY_DONE; 312 return NOTIFY_DONE;
306 313
307 bp_info = counter_arch_bp(bp); 314 info = counter_arch_bp(bp);
308 315
309 /* 316 /*
310 * We shall invoke the user-defined callback function in the single 317 * We shall invoke the user-defined callback function in the single
311 * stepping handler to confirm to 'trigger-after-execute' semantics 318 * stepping handler to confirm to 'trigger-after-execute' semantics
312 */ 319 */
313 if (!bp_info->extraneous_interrupt) 320 if (!info->extraneous_interrupt)
314 perf_bp_event(bp, regs); 321 perf_bp_event(bp, regs);
315 322
316 set_dabr(bp_info->address | bp_info->type | DABR_TRANSLATION); 323 set_dabr(info->address | info->type | DABR_TRANSLATION, info->dabrx);
317 current->thread.last_hit_ubp = NULL; 324 current->thread.last_hit_ubp = NULL;
318 325
319 /* 326 /*
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index b01d14eeca8d..8220baa46faf 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -47,7 +47,6 @@
47#include <linux/stat.h> 47#include <linux/stat.h>
48#include <linux/of_platform.h> 48#include <linux/of_platform.h>
49#include <asm/ibmebus.h> 49#include <asm/ibmebus.h>
50#include <asm/abs_addr.h>
51 50
52static struct device ibmebus_bus_device = { /* fake "parent" device */ 51static struct device ibmebus_bus_device = { /* fake "parent" device */
53 .init_name = "ibmebus", 52 .init_name = "ibmebus",
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index ff5a6ce027b8..8226c6cb348a 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -215,7 +215,8 @@ static unsigned long iommu_range_alloc(struct device *dev,
215 spin_lock_irqsave(&(pool->lock), flags); 215 spin_lock_irqsave(&(pool->lock), flags);
216 216
217again: 217again:
218 if ((pass == 0) && handle && *handle) 218 if ((pass == 0) && handle && *handle &&
219 (*handle >= pool->start) && (*handle < pool->end))
219 start = *handle; 220 start = *handle;
220 else 221 else
221 start = pool->hint; 222 start = pool->hint;
@@ -236,7 +237,9 @@ again:
236 * but on second pass, start at 0 in pool 0. 237 * but on second pass, start at 0 in pool 0.
237 */ 238 */
238 if ((start & mask) >= limit || pass > 0) { 239 if ((start & mask) >= limit || pass > 0) {
240 spin_unlock(&(pool->lock));
239 pool = &(tbl->pools[0]); 241 pool = &(tbl->pools[0]);
242 spin_lock(&(pool->lock));
240 start = pool->start; 243 start = pool->start;
241 } else { 244 } else {
242 start &= mask; 245 start &= mask;
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 1f017bb7a7ce..71413f41278f 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -489,10 +489,10 @@ void do_IRQ(struct pt_regs *regs)
489 struct pt_regs *old_regs = set_irq_regs(regs); 489 struct pt_regs *old_regs = set_irq_regs(regs);
490 unsigned int irq; 490 unsigned int irq;
491 491
492 trace_irq_entry(regs);
493
494 irq_enter(); 492 irq_enter();
495 493
494 trace_irq_entry(regs);
495
496 check_stack_overflow(); 496 check_stack_overflow();
497 497
498 /* 498 /*
@@ -511,10 +511,10 @@ void do_IRQ(struct pt_regs *regs)
511 else 511 else
512 __get_cpu_var(irq_stat).spurious_irqs++; 512 __get_cpu_var(irq_stat).spurious_irqs++;
513 513
514 trace_irq_exit(regs);
515
514 irq_exit(); 516 irq_exit();
515 set_irq_regs(old_regs); 517 set_irq_regs(old_regs);
516
517 trace_irq_exit(regs);
518} 518}
519 519
520void __init init_IRQ(void) 520void __init init_IRQ(void)
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 5df777794403..fa9f6c72f557 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -165,7 +165,7 @@ void __init reserve_crashkernel(void)
165 if (memory_limit && memory_limit <= crashk_res.end) { 165 if (memory_limit && memory_limit <= crashk_res.end) {
166 memory_limit = crashk_res.end + 1; 166 memory_limit = crashk_res.end + 1;
167 printk("Adjusted memory limit for crashkernel, now 0x%llx\n", 167 printk("Adjusted memory limit for crashkernel, now 0x%llx\n",
168 (unsigned long long)memory_limit); 168 memory_limit);
169 } 169 }
170 170
171 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " 171 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
@@ -204,6 +204,12 @@ static struct property crashk_size_prop = {
204 .value = &crashk_size, 204 .value = &crashk_size,
205}; 205};
206 206
207static struct property memory_limit_prop = {
208 .name = "linux,memory-limit",
209 .length = sizeof(unsigned long long),
210 .value = &memory_limit,
211};
212
207static void __init export_crashk_values(struct device_node *node) 213static void __init export_crashk_values(struct device_node *node)
208{ 214{
209 struct property *prop; 215 struct property *prop;
@@ -223,6 +229,12 @@ static void __init export_crashk_values(struct device_node *node)
223 crashk_size = resource_size(&crashk_res); 229 crashk_size = resource_size(&crashk_res);
224 prom_add_property(node, &crashk_size_prop); 230 prom_add_property(node, &crashk_size_prop);
225 } 231 }
232
233 /*
234 * memory_limit is required by the kexec-tools to limit the
235 * crash regions to the actual memory used.
236 */
237 prom_update_property(node, &memory_limit_prop);
226} 238}
227 239
228static int __init kexec_setup(void) 240static int __init kexec_setup(void)
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index fbe1a12dc7f1..cd6da855090c 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -142,6 +142,7 @@ void __init initialise_paca(struct paca_struct *new_paca, int cpu)
142 new_paca->hw_cpu_id = 0xffff; 142 new_paca->hw_cpu_id = 0xffff;
143 new_paca->kexec_state = KEXEC_STATE_NONE; 143 new_paca->kexec_state = KEXEC_STATE_NONE;
144 new_paca->__current = &init_task; 144 new_paca->__current = &init_task;
145 new_paca->data_offset = 0xfeeeeeeeeeeeeeeeULL;
145#ifdef CONFIG_PPC_STD_MMU_64 146#ifdef CONFIG_PPC_STD_MMU_64
146 new_paca->slb_shadow_ptr = &slb_shadow[cpu]; 147 new_paca->slb_shadow_ptr = &slb_shadow[cpu];
147#endif /* CONFIG_PPC_STD_MMU_64 */ 148#endif /* CONFIG_PPC_STD_MMU_64 */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 43fea543d686..7f94f760dd0c 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -980,13 +980,14 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
980 if (i >= 3 && bus->self->transparent) 980 if (i >= 3 && bus->self->transparent)
981 continue; 981 continue;
982 982
983 /* If we are going to re-assign everything, mark the resource 983 /* If we're going to reassign everything, we can
984 * as unset and move it down to 0 984 * shrink the P2P resource to have size as being
985 * of 0 in order to save space.
985 */ 986 */
986 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC)) { 987 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC)) {
987 res->flags |= IORESOURCE_UNSET; 988 res->flags |= IORESOURCE_UNSET;
988 res->end -= res->start;
989 res->start = 0; 989 res->start = 0;
990 res->end = -1;
990 continue; 991 continue;
991 } 992 }
992 993
@@ -1248,7 +1249,14 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
1248 pr_warning("PCI: Cannot allocate resource region " 1249 pr_warning("PCI: Cannot allocate resource region "
1249 "%d of PCI bridge %d, will remap\n", i, bus->number); 1250 "%d of PCI bridge %d, will remap\n", i, bus->number);
1250 clear_resource: 1251 clear_resource:
1251 res->start = res->end = 0; 1252 /* The resource might be figured out when doing
1253 * reassignment based on the resources required
1254 * by the downstream PCI devices. Here we set
1255 * the size of the resource to be 0 in order to
1256 * save more space.
1257 */
1258 res->start = 0;
1259 res->end = -1;
1252 res->flags = 0; 1260 res->flags = 0;
1253 } 1261 }
1254 1262
diff --git a/arch/powerpc/kernel/ppc32.h b/arch/powerpc/kernel/ppc32.h
index dc16aefe1dd0..02fb0ee26093 100644
--- a/arch/powerpc/kernel/ppc32.h
+++ b/arch/powerpc/kernel/ppc32.h
@@ -16,57 +16,6 @@
16 16
17/* These are here to support 32-bit syscalls on a 64-bit kernel. */ 17/* These are here to support 32-bit syscalls on a 64-bit kernel. */
18 18
19typedef struct compat_siginfo {
20 int si_signo;
21 int si_errno;
22 int si_code;
23
24 union {
25 int _pad[SI_PAD_SIZE32];
26
27 /* kill() */
28 struct {
29 compat_pid_t _pid; /* sender's pid */
30 compat_uid_t _uid; /* sender's uid */
31 } _kill;
32
33 /* POSIX.1b timers */
34 struct {
35 compat_timer_t _tid; /* timer id */
36 int _overrun; /* overrun count */
37 compat_sigval_t _sigval; /* same as below */
38 int _sys_private; /* not to be passed to user */
39 } _timer;
40
41 /* POSIX.1b signals */
42 struct {
43 compat_pid_t _pid; /* sender's pid */
44 compat_uid_t _uid; /* sender's uid */
45 compat_sigval_t _sigval;
46 } _rt;
47
48 /* SIGCHLD */
49 struct {
50 compat_pid_t _pid; /* which child */
51 compat_uid_t _uid; /* sender's uid */
52 int _status; /* exit code */
53 compat_clock_t _utime;
54 compat_clock_t _stime;
55 } _sigchld;
56
57 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
58 struct {
59 unsigned int _addr; /* faulting insn/memory ref. */
60 } _sigfault;
61
62 /* SIGPOLL */
63 struct {
64 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
65 int _fd;
66 } _sigpoll;
67 } _sifields;
68} compat_siginfo_t;
69
70#define __old_sigaction32 old_sigaction32 19#define __old_sigaction32 old_sigaction32
71 20
72struct __old_sigaction32 { 21struct __old_sigaction32 {
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index e9cb51f5f801..d5ad666efd8b 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -258,6 +258,7 @@ void do_send_trap(struct pt_regs *regs, unsigned long address,
258{ 258{
259 siginfo_t info; 259 siginfo_t info;
260 260
261 current->thread.trap_nr = signal_code;
261 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, 262 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
262 11, SIGSEGV) == NOTIFY_STOP) 263 11, SIGSEGV) == NOTIFY_STOP)
263 return; 264 return;
@@ -275,6 +276,7 @@ void do_dabr(struct pt_regs *regs, unsigned long address,
275{ 276{
276 siginfo_t info; 277 siginfo_t info;
277 278
279 current->thread.trap_nr = TRAP_HWBKPT;
278 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, 280 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
279 11, SIGSEGV) == NOTIFY_STOP) 281 11, SIGSEGV) == NOTIFY_STOP)
280 return; 282 return;
@@ -283,7 +285,7 @@ void do_dabr(struct pt_regs *regs, unsigned long address,
283 return; 285 return;
284 286
285 /* Clear the DABR */ 287 /* Clear the DABR */
286 set_dabr(0); 288 set_dabr(0, 0);
287 289
288 /* Deliver the signal to userspace */ 290 /* Deliver the signal to userspace */
289 info.si_signo = SIGTRAP; 291 info.si_signo = SIGTRAP;
@@ -364,18 +366,19 @@ static void set_debug_reg_defaults(struct thread_struct *thread)
364{ 366{
365 if (thread->dabr) { 367 if (thread->dabr) {
366 thread->dabr = 0; 368 thread->dabr = 0;
367 set_dabr(0); 369 thread->dabrx = 0;
370 set_dabr(0, 0);
368 } 371 }
369} 372}
370#endif /* !CONFIG_HAVE_HW_BREAKPOINT */ 373#endif /* !CONFIG_HAVE_HW_BREAKPOINT */
371#endif /* CONFIG_PPC_ADV_DEBUG_REGS */ 374#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
372 375
373int set_dabr(unsigned long dabr) 376int set_dabr(unsigned long dabr, unsigned long dabrx)
374{ 377{
375 __get_cpu_var(current_dabr) = dabr; 378 __get_cpu_var(current_dabr) = dabr;
376 379
377 if (ppc_md.set_dabr) 380 if (ppc_md.set_dabr)
378 return ppc_md.set_dabr(dabr); 381 return ppc_md.set_dabr(dabr, dabrx);
379 382
380 /* XXX should we have a CPU_FTR_HAS_DABR ? */ 383 /* XXX should we have a CPU_FTR_HAS_DABR ? */
381#ifdef CONFIG_PPC_ADV_DEBUG_REGS 384#ifdef CONFIG_PPC_ADV_DEBUG_REGS
@@ -385,9 +388,8 @@ int set_dabr(unsigned long dabr)
385#endif 388#endif
386#elif defined(CONFIG_PPC_BOOK3S) 389#elif defined(CONFIG_PPC_BOOK3S)
387 mtspr(SPRN_DABR, dabr); 390 mtspr(SPRN_DABR, dabr);
391 mtspr(SPRN_DABRX, dabrx);
388#endif 392#endif
389
390
391 return 0; 393 return 0;
392} 394}
393 395
@@ -480,7 +482,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
480 */ 482 */
481#ifndef CONFIG_HAVE_HW_BREAKPOINT 483#ifndef CONFIG_HAVE_HW_BREAKPOINT
482 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) 484 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
483 set_dabr(new->thread.dabr); 485 set_dabr(new->thread.dabr, new->thread.dabrx);
484#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 486#endif /* CONFIG_HAVE_HW_BREAKPOINT */
485#endif 487#endif
486 488
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index f191bf02943a..37725e86651e 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -78,7 +78,7 @@ static int __init early_parse_mem(char *p)
78 return 1; 78 return 1;
79 79
80 memory_limit = PAGE_ALIGN(memparse(p, &p)); 80 memory_limit = PAGE_ALIGN(memparse(p, &p));
81 DBG("memory limit = 0x%llx\n", (unsigned long long)memory_limit); 81 DBG("memory limit = 0x%llx\n", memory_limit);
82 82
83 return 0; 83 return 0;
84} 84}
@@ -661,7 +661,7 @@ void __init early_init_devtree(void *params)
661 661
662 /* make sure we've parsed cmdline for mem= before this */ 662 /* make sure we've parsed cmdline for mem= before this */
663 if (memory_limit) 663 if (memory_limit)
664 first_memblock_size = min(first_memblock_size, memory_limit); 664 first_memblock_size = min_t(u64, first_memblock_size, memory_limit);
665 setup_initial_memory_limit(memstart_addr, first_memblock_size); 665 setup_initial_memory_limit(memstart_addr, first_memblock_size);
666 /* Reserve MEMBLOCK regions used by kernel, initrd, dt, etc... */ 666 /* Reserve MEMBLOCK regions used by kernel, initrd, dt, etc... */
667 memblock_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START); 667 memblock_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 47834a3f4938..cb6c123722a2 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1748,7 +1748,7 @@ static void __init prom_initialize_tce_table(void)
1748 * else will impact performance, so we always allocate 8MB. 1748 * else will impact performance, so we always allocate 8MB.
1749 * Anton 1749 * Anton
1750 */ 1750 */
1751 if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p)) 1751 if (pvr_version_is(PVR_POWER4) || pvr_version_is(PVR_POWER4p))
1752 minsize = 8UL << 20; 1752 minsize = 8UL << 20;
1753 else 1753 else
1754 minsize = 4UL << 20; 1754 minsize = 4UL << 20;
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index c10fc28b9092..79d8e56470df 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -960,6 +960,7 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
960 thread->ptrace_bps[0] = bp; 960 thread->ptrace_bps[0] = bp;
961 ptrace_put_breakpoints(task); 961 ptrace_put_breakpoints(task);
962 thread->dabr = data; 962 thread->dabr = data;
963 thread->dabrx = DABRX_ALL;
963 return 0; 964 return 0;
964 } 965 }
965 966
@@ -983,6 +984,7 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
983 984
984 /* Move contents to the DABR register */ 985 /* Move contents to the DABR register */
985 task->thread.dabr = data; 986 task->thread.dabr = data;
987 task->thread.dabrx = DABRX_ALL;
986#else /* CONFIG_PPC_ADV_DEBUG_REGS */ 988#else /* CONFIG_PPC_ADV_DEBUG_REGS */
987 /* As described above, it was assumed 3 bits were passed with the data 989 /* As described above, it was assumed 3 bits were passed with the data
988 * address, but we will assume only the mode bits will be passed 990 * address, but we will assume only the mode bits will be passed
@@ -1397,6 +1399,7 @@ static long ppc_set_hwdebug(struct task_struct *child,
1397 dabr |= DABR_DATA_WRITE; 1399 dabr |= DABR_DATA_WRITE;
1398 1400
1399 child->thread.dabr = dabr; 1401 child->thread.dabr = dabr;
1402 child->thread.dabrx = DABRX_ALL;
1400 1403
1401 return 1; 1404 return 1;
1402#endif /* !CONFIG_PPC_ADV_DEBUG_DVCS */ 1405#endif /* !CONFIG_PPC_ADV_DEBUG_DVCS */
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 2c0ee6405633..20b0120db0c3 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -21,7 +21,6 @@
21#include <asm/delay.h> 21#include <asm/delay.h>
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <asm/rtas.h> 23#include <asm/rtas.h>
24#include <asm/abs_addr.h>
25 24
26#define MODULE_VERS "1.0" 25#define MODULE_VERS "1.0"
27#define MODULE_NAME "rtas_flash" 26#define MODULE_NAME "rtas_flash"
@@ -582,7 +581,7 @@ static void rtas_flash_firmware(int reboot_type)
582 flist = (struct flash_block_list *)&rtas_data_buf[0]; 581 flist = (struct flash_block_list *)&rtas_data_buf[0];
583 flist->num_blocks = 0; 582 flist->num_blocks = 0;
584 flist->next = rtas_firmware_flash_list; 583 flist->next = rtas_firmware_flash_list;
585 rtas_block_list = virt_to_abs(flist); 584 rtas_block_list = __pa(flist);
586 if (rtas_block_list >= 4UL*1024*1024*1024) { 585 if (rtas_block_list >= 4UL*1024*1024*1024) {
587 printk(KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n"); 586 printk(KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n");
588 spin_unlock(&rtas_data_buf_lock); 587 spin_unlock(&rtas_data_buf_lock);
@@ -596,13 +595,13 @@ static void rtas_flash_firmware(int reboot_type)
596 for (f = flist; f; f = next) { 595 for (f = flist; f; f = next) {
597 /* Translate data addrs to absolute */ 596 /* Translate data addrs to absolute */
598 for (i = 0; i < f->num_blocks; i++) { 597 for (i = 0; i < f->num_blocks; i++) {
599 f->blocks[i].data = (char *)virt_to_abs(f->blocks[i].data); 598 f->blocks[i].data = (char *)__pa(f->blocks[i].data);
600 image_size += f->blocks[i].length; 599 image_size += f->blocks[i].length;
601 } 600 }
602 next = f->next; 601 next = f->next;
603 /* Don't translate NULL pointer for last entry */ 602 /* Don't translate NULL pointer for last entry */
604 if (f->next) 603 if (f->next)
605 f->next = (struct flash_block_list *)virt_to_abs(f->next); 604 f->next = (struct flash_block_list *)__pa(f->next);
606 else 605 else
607 f->next = NULL; 606 f->next = NULL;
608 /* make num_blocks into the version/length field */ 607 /* make num_blocks into the version/length field */
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 179af906dcda..6de63e3250bb 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -81,7 +81,7 @@ int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val)
81 return PCIBIOS_DEVICE_NOT_FOUND; 81 return PCIBIOS_DEVICE_NOT_FOUND;
82 82
83 if (returnval == EEH_IO_ERROR_VALUE(size) && 83 if (returnval == EEH_IO_ERROR_VALUE(size) &&
84 eeh_dn_check_failure (pdn->node, NULL)) 84 eeh_dev_check_failure(of_node_to_eeh_dev(pdn->node)))
85 return PCIBIOS_DEVICE_NOT_FOUND; 85 return PCIBIOS_DEVICE_NOT_FOUND;
86 86
87 return PCIBIOS_SUCCESSFUL; 87 return PCIBIOS_SUCCESSFUL;
@@ -275,9 +275,6 @@ 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
281 /* 278 /*
282 * PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties 279 * PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties
283 * in chosen. 280 * in chosen.
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 389bd4f0cdb1..efb6a41b3131 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -208,6 +208,8 @@ void __init early_setup(unsigned long dt_ptr)
208 208
209 /* Fix up paca fields required for the boot cpu */ 209 /* Fix up paca fields required for the boot cpu */
210 get_paca()->cpu_start = 1; 210 get_paca()->cpu_start = 1;
211 /* Allow percpu accesses to "work" until we setup percpu data */
212 get_paca()->data_offset = 0;
211 213
212 /* Probe the machine type */ 214 /* Probe the machine type */
213 probe_machine(); 215 probe_machine();
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index 5c023c9cf16e..a2dc75793bd5 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/tracehook.h> 12#include <linux/tracehook.h>
13#include <linux/signal.h> 13#include <linux/signal.h>
14#include <linux/uprobes.h>
14#include <linux/key.h> 15#include <linux/key.h>
15#include <asm/hw_breakpoint.h> 16#include <asm/hw_breakpoint.h>
16#include <asm/uaccess.h> 17#include <asm/uaccess.h>
@@ -130,7 +131,7 @@ static int do_signal(struct pt_regs *regs)
130 * triggered inside the kernel. 131 * triggered inside the kernel.
131 */ 132 */
132 if (current->thread.dabr) 133 if (current->thread.dabr)
133 set_dabr(current->thread.dabr); 134 set_dabr(current->thread.dabr, current->thread.dabrx);
134#endif 135#endif
135 /* Re-enable the breakpoints for the signal stack */ 136 /* Re-enable the breakpoints for the signal stack */
136 thread_change_pc(current, regs); 137 thread_change_pc(current, regs);
@@ -157,6 +158,11 @@ static int do_signal(struct pt_regs *regs)
157 158
158void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 159void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
159{ 160{
161 if (thread_info_flags & _TIF_UPROBE) {
162 clear_thread_flag(TIF_UPROBE);
163 uprobe_notify_resume(regs);
164 }
165
160 if (thread_info_flags & _TIF_SIGPENDING) 166 if (thread_info_flags & _TIF_SIGPENDING)
161 do_signal(regs); 167 do_signal(regs);
162 168
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 8d4214afc21d..2b952b5386fd 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -102,7 +102,7 @@ int __devinit smp_generic_kick_cpu(int nr)
102 * Ok it's not there, so it might be soft-unplugged, let's 102 * Ok it's not there, so it might be soft-unplugged, let's
103 * try to bring it back 103 * try to bring it back
104 */ 104 */
105 per_cpu(cpu_state, nr) = CPU_UP_PREPARE; 105 generic_set_cpu_up(nr);
106 smp_wmb(); 106 smp_wmb();
107 smp_send_reschedule(nr); 107 smp_send_reschedule(nr);
108#endif /* CONFIG_HOTPLUG_CPU */ 108#endif /* CONFIG_HOTPLUG_CPU */
@@ -171,7 +171,7 @@ int smp_request_message_ipi(int virq, int msg)
171 } 171 }
172#endif 172#endif
173 err = request_irq(virq, smp_ipi_action[msg], 173 err = request_irq(virq, smp_ipi_action[msg],
174 IRQF_PERCPU | IRQF_NO_THREAD, 174 IRQF_PERCPU | IRQF_NO_THREAD | IRQF_NO_SUSPEND,
175 smp_ipi_name[msg], 0); 175 smp_ipi_name[msg], 0);
176 WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n", 176 WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n",
177 virq, smp_ipi_name[msg], err); 177 virq, smp_ipi_name[msg], err);
@@ -413,6 +413,16 @@ void generic_set_cpu_dead(unsigned int cpu)
413 per_cpu(cpu_state, cpu) = CPU_DEAD; 413 per_cpu(cpu_state, cpu) = CPU_DEAD;
414} 414}
415 415
416/*
417 * The cpu_state should be set to CPU_UP_PREPARE in kick_cpu(), otherwise
418 * the cpu_state is always CPU_DEAD after calling generic_set_cpu_dead(),
419 * which makes the delay in generic_cpu_die() not happen.
420 */
421void generic_set_cpu_up(unsigned int cpu)
422{
423 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
424}
425
416int generic_check_cpu_restart(unsigned int cpu) 426int generic_check_cpu_restart(unsigned int cpu)
417{ 427{
418 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE; 428 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE;
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index eaa9d0e6abca..c9986fd400d8 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -508,8 +508,6 @@ void timer_interrupt(struct pt_regs * regs)
508 */ 508 */
509 may_hard_irq_enable(); 509 may_hard_irq_enable();
510 510
511 trace_timer_interrupt_entry(regs);
512
513 __get_cpu_var(irq_stat).timer_irqs++; 511 __get_cpu_var(irq_stat).timer_irqs++;
514 512
515#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC) 513#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC)
@@ -520,6 +518,8 @@ void timer_interrupt(struct pt_regs * regs)
520 old_regs = set_irq_regs(regs); 518 old_regs = set_irq_regs(regs);
521 irq_enter(); 519 irq_enter();
522 520
521 trace_timer_interrupt_entry(regs);
522
523 if (test_irq_work_pending()) { 523 if (test_irq_work_pending()) {
524 clear_irq_work_pending(); 524 clear_irq_work_pending();
525 irq_work_run(); 525 irq_work_run();
@@ -544,10 +544,10 @@ void timer_interrupt(struct pt_regs * regs)
544 } 544 }
545#endif 545#endif
546 546
547 trace_timer_interrupt_exit(regs);
548
547 irq_exit(); 549 irq_exit();
548 set_irq_regs(old_regs); 550 set_irq_regs(old_regs);
549
550 trace_timer_interrupt_exit(regs);
551} 551}
552 552
553/* 553/*
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index ae0843fa7a61..32518401af68 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -251,6 +251,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
251 if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs)) 251 if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs))
252 local_irq_enable(); 252 local_irq_enable();
253 253
254 current->thread.trap_nr = code;
254 memset(&info, 0, sizeof(info)); 255 memset(&info, 0, sizeof(info));
255 info.si_signo = signr; 256 info.si_signo = signr;
256 info.si_code = code; 257 info.si_code = code;
diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
new file mode 100644
index 000000000000..d2d46d1014f8
--- /dev/null
+++ b/arch/powerpc/kernel/uprobes.c
@@ -0,0 +1,184 @@
1/*
2 * User-space Probes (UProbes) for powerpc
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 IBM Corporation, 2007-2012
19 *
20 * Adapted from the x86 port by Ananth N Mavinakayanahalli <ananth@in.ibm.com>
21 */
22#include <linux/kernel.h>
23#include <linux/sched.h>
24#include <linux/ptrace.h>
25#include <linux/uprobes.h>
26#include <linux/uaccess.h>
27#include <linux/kdebug.h>
28
29#include <asm/sstep.h>
30
31#define UPROBE_TRAP_NR UINT_MAX
32
33/**
34 * arch_uprobe_analyze_insn
35 * @mm: the probed address space.
36 * @arch_uprobe: the probepoint information.
37 * @addr: vaddr to probe.
38 * Return 0 on success or a -ve number on error.
39 */
40int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,
41 struct mm_struct *mm, unsigned long addr)
42{
43 if (addr & 0x03)
44 return -EINVAL;
45
46 /*
47 * We currently don't support a uprobe on an already
48 * existing breakpoint instruction underneath
49 */
50 if (is_trap(auprobe->ainsn))
51 return -ENOTSUPP;
52 return 0;
53}
54
55/*
56 * arch_uprobe_pre_xol - prepare to execute out of line.
57 * @auprobe: the probepoint information.
58 * @regs: reflects the saved user state of current task.
59 */
60int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
61{
62 struct arch_uprobe_task *autask = &current->utask->autask;
63
64 autask->saved_trap_nr = current->thread.trap_nr;
65 current->thread.trap_nr = UPROBE_TRAP_NR;
66 regs->nip = current->utask->xol_vaddr;
67 return 0;
68}
69
70/**
71 * uprobe_get_swbp_addr - compute address of swbp given post-swbp regs
72 * @regs: Reflects the saved state of the task after it has hit a breakpoint
73 * instruction.
74 * Return the address of the breakpoint instruction.
75 */
76unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
77{
78 return instruction_pointer(regs);
79}
80
81/*
82 * If xol insn itself traps and generates a signal (SIGILL/SIGSEGV/etc),
83 * then detect the case where a singlestepped instruction jumps back to its
84 * own address. It is assumed that anything like do_page_fault/do_trap/etc
85 * sets thread.trap_nr != UINT_MAX.
86 *
87 * arch_uprobe_pre_xol/arch_uprobe_post_xol save/restore thread.trap_nr,
88 * arch_uprobe_xol_was_trapped() simply checks that ->trap_nr is not equal to
89 * UPROBE_TRAP_NR == UINT_MAX set by arch_uprobe_pre_xol().
90 */
91bool arch_uprobe_xol_was_trapped(struct task_struct *t)
92{
93 if (t->thread.trap_nr != UPROBE_TRAP_NR)
94 return true;
95
96 return false;
97}
98
99/*
100 * Called after single-stepping. To avoid the SMP problems that can
101 * occur when we temporarily put back the original opcode to
102 * single-step, we single-stepped a copy of the instruction.
103 *
104 * This function prepares to resume execution after the single-step.
105 */
106int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
107{
108 struct uprobe_task *utask = current->utask;
109
110 WARN_ON_ONCE(current->thread.trap_nr != UPROBE_TRAP_NR);
111
112 current->thread.trap_nr = utask->autask.saved_trap_nr;
113
114 /*
115 * On powerpc, except for loads and stores, most instructions
116 * including ones that alter code flow (branches, calls, returns)
117 * are emulated in the kernel. We get here only if the emulation
118 * support doesn't exist and have to fix-up the next instruction
119 * to be executed.
120 */
121 regs->nip = utask->vaddr + MAX_UINSN_BYTES;
122 return 0;
123}
124
125/* callback routine for handling exceptions. */
126int arch_uprobe_exception_notify(struct notifier_block *self,
127 unsigned long val, void *data)
128{
129 struct die_args *args = data;
130 struct pt_regs *regs = args->regs;
131
132 /* regs == NULL is a kernel bug */
133 if (WARN_ON(!regs))
134 return NOTIFY_DONE;
135
136 /* We are only interested in userspace traps */
137 if (!user_mode(regs))
138 return NOTIFY_DONE;
139
140 switch (val) {
141 case DIE_BPT:
142 if (uprobe_pre_sstep_notifier(regs))
143 return NOTIFY_STOP;
144 break;
145 case DIE_SSTEP:
146 if (uprobe_post_sstep_notifier(regs))
147 return NOTIFY_STOP;
148 default:
149 break;
150 }
151 return NOTIFY_DONE;
152}
153
154/*
155 * This function gets called when XOL instruction either gets trapped or
156 * the thread has a fatal signal, so reset the instruction pointer to its
157 * probed address.
158 */
159void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
160{
161 struct uprobe_task *utask = current->utask;
162
163 current->thread.trap_nr = utask->autask.saved_trap_nr;
164 instruction_pointer_set(regs, utask->vaddr);
165}
166
167/*
168 * See if the instruction can be emulated.
169 * Returns true if instruction was emulated, false otherwise.
170 */
171bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
172{
173 int ret;
174
175 /*
176 * emulate_step() returns 1 if the insn was successfully emulated.
177 * For all other cases, we need to single-step in hardware.
178 */
179 ret = emulate_step(regs, auprobe->ainsn);
180 if (ret > 0)
181 return true;
182
183 return false;
184}
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index b67db22e102d..1b2076f049ce 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -723,9 +723,7 @@ int __cpuinit vdso_getcpu_init(void)
723 723
724 val = (cpu & 0xfff) | ((node & 0xffff) << 16); 724 val = (cpu & 0xfff) | ((node & 0xffff) << 16);
725 mtspr(SPRN_SPRG3, val); 725 mtspr(SPRN_SPRG3, val);
726#ifdef CONFIG_KVM_BOOK3S_HANDLER 726 get_paca()->sprg3 = val;
727 get_paca()->kvm_hstate.sprg3 = val;
728#endif
729 727
730 put_cpu(); 728 put_cpu();
731 729
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 02b32216bbc3..201ba59738be 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -33,7 +33,6 @@
33#include <asm/prom.h> 33#include <asm/prom.h>
34#include <asm/firmware.h> 34#include <asm/firmware.h>
35#include <asm/tce.h> 35#include <asm/tce.h>
36#include <asm/abs_addr.h>
37#include <asm/page.h> 36#include <asm/page.h>
38#include <asm/hvcall.h> 37#include <asm/hvcall.h>
39 38
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 837f13e7b6bf..00aa61268e0d 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -141,7 +141,7 @@ extern char etext[];
141int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte) 141int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
142{ 142{
143 pfn_t hpaddr; 143 pfn_t hpaddr;
144 u64 va; 144 u64 vpn;
145 u64 vsid; 145 u64 vsid;
146 struct kvmppc_sid_map *map; 146 struct kvmppc_sid_map *map;
147 volatile u32 *pteg; 147 volatile u32 *pteg;
@@ -173,7 +173,7 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
173 BUG_ON(!map); 173 BUG_ON(!map);
174 174
175 vsid = map->host_vsid; 175 vsid = map->host_vsid;
176 va = (vsid << SID_SHIFT) | (eaddr & ~ESID_MASK); 176 vpn = (vsid << (SID_SHIFT - VPN_SHIFT)) | ((eaddr & ~ESID_MASK) >> VPN_SHIFT)
177 177
178next_pteg: 178next_pteg:
179 if (rr == 16) { 179 if (rr == 16) {
@@ -244,11 +244,11 @@ next_pteg:
244 dprintk_mmu("KVM: %c%c Map 0x%llx: [%lx] 0x%llx (0x%llx) -> %lx\n", 244 dprintk_mmu("KVM: %c%c Map 0x%llx: [%lx] 0x%llx (0x%llx) -> %lx\n",
245 orig_pte->may_write ? 'w' : '-', 245 orig_pte->may_write ? 'w' : '-',
246 orig_pte->may_execute ? 'x' : '-', 246 orig_pte->may_execute ? 'x' : '-',
247 orig_pte->eaddr, (ulong)pteg, va, 247 orig_pte->eaddr, (ulong)pteg, vpn,
248 orig_pte->vpage, hpaddr); 248 orig_pte->vpage, hpaddr);
249 249
250 pte->slot = (ulong)&pteg[rr]; 250 pte->slot = (ulong)&pteg[rr];
251 pte->host_va = va; 251 pte->host_vpn = vpn;
252 pte->pte = *orig_pte; 252 pte->pte = *orig_pte;
253 pte->pfn = hpaddr >> PAGE_SHIFT; 253 pte->pfn = hpaddr >> PAGE_SHIFT;
254 254
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
index 0688b6b39585..4d72f9ebc554 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -33,7 +33,7 @@
33 33
34void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte) 34void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte)
35{ 35{
36 ppc_md.hpte_invalidate(pte->slot, pte->host_va, 36 ppc_md.hpte_invalidate(pte->slot, pte->host_vpn,
37 MMU_PAGE_4K, MMU_SEGSIZE_256M, 37 MMU_PAGE_4K, MMU_SEGSIZE_256M,
38 false); 38 false);
39} 39}
@@ -80,8 +80,9 @@ static struct kvmppc_sid_map *find_sid_vsid(struct kvm_vcpu *vcpu, u64 gvsid)
80 80
81int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte) 81int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
82{ 82{
83 unsigned long vpn;
83 pfn_t hpaddr; 84 pfn_t hpaddr;
84 ulong hash, hpteg, va; 85 ulong hash, hpteg;
85 u64 vsid; 86 u64 vsid;
86 int ret; 87 int ret;
87 int rflags = 0x192; 88 int rflags = 0x192;
@@ -117,7 +118,7 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
117 } 118 }
118 119
119 vsid = map->host_vsid; 120 vsid = map->host_vsid;
120 va = hpt_va(orig_pte->eaddr, vsid, MMU_SEGSIZE_256M); 121 vpn = hpt_vpn(orig_pte->eaddr, vsid, MMU_SEGSIZE_256M);
121 122
122 if (!orig_pte->may_write) 123 if (!orig_pte->may_write)
123 rflags |= HPTE_R_PP; 124 rflags |= HPTE_R_PP;
@@ -129,7 +130,7 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
129 else 130 else
130 kvmppc_mmu_flush_icache(hpaddr >> PAGE_SHIFT); 131 kvmppc_mmu_flush_icache(hpaddr >> PAGE_SHIFT);
131 132
132 hash = hpt_hash(va, PTE_SIZE, MMU_SEGSIZE_256M); 133 hash = hpt_hash(vpn, PTE_SIZE, MMU_SEGSIZE_256M);
133 134
134map_again: 135map_again:
135 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 136 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
@@ -141,7 +142,8 @@ map_again:
141 goto out; 142 goto out;
142 } 143 }
143 144
144 ret = ppc_md.hpte_insert(hpteg, va, hpaddr, rflags, vflags, MMU_PAGE_4K, MMU_SEGSIZE_256M); 145 ret = ppc_md.hpte_insert(hpteg, vpn, hpaddr, rflags, vflags,
146 MMU_PAGE_4K, MMU_SEGSIZE_256M);
145 147
146 if (ret < 0) { 148 if (ret < 0) {
147 /* If we couldn't map a primary PTE, try a secondary */ 149 /* If we couldn't map a primary PTE, try a secondary */
@@ -152,7 +154,8 @@ map_again:
152 } else { 154 } else {
153 struct hpte_cache *pte = kvmppc_mmu_hpte_cache_next(vcpu); 155 struct hpte_cache *pte = kvmppc_mmu_hpte_cache_next(vcpu);
154 156
155 trace_kvm_book3s_64_mmu_map(rflags, hpteg, va, hpaddr, orig_pte); 157 trace_kvm_book3s_64_mmu_map(rflags, hpteg,
158 vpn, hpaddr, orig_pte);
156 159
157 /* The ppc_md code may give us a secondary entry even though we 160 /* The ppc_md code may give us a secondary entry even though we
158 asked for a primary. Fix up. */ 161 asked for a primary. Fix up. */
@@ -162,7 +165,7 @@ map_again:
162 } 165 }
163 166
164 pte->slot = hpteg + (ret & 7); 167 pte->slot = hpteg + (ret & 7);
165 pte->host_va = va; 168 pte->host_vpn = vpn;
166 pte->pte = *orig_pte; 169 pte->pte = *orig_pte;
167 pte->pfn = hpaddr >> PAGE_SHIFT; 170 pte->pfn = hpaddr >> PAGE_SHIFT;
168 171
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 44b72feaff7d..74a24bbb9637 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1065,7 +1065,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1065 mtspr SPRN_DABRX,r6 1065 mtspr SPRN_DABRX,r6
1066 1066
1067 /* Restore SPRG3 */ 1067 /* Restore SPRG3 */
1068 ld r3,HSTATE_SPRG3(r13) 1068 ld r3,PACA_SPRG3(r13)
1069 mtspr SPRN_SPRG3,r3 1069 mtspr SPRN_SPRG3,r3
1070 1070
1071 /* 1071 /*
diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
index 877186b7b1c3..ddb6a2149d44 100644
--- a/arch/powerpc/kvm/trace.h
+++ b/arch/powerpc/kvm/trace.h
@@ -189,7 +189,7 @@ TRACE_EVENT(kvm_book3s_mmu_map,
189 TP_ARGS(pte), 189 TP_ARGS(pte),
190 190
191 TP_STRUCT__entry( 191 TP_STRUCT__entry(
192 __field( u64, host_va ) 192 __field( u64, host_vpn )
193 __field( u64, pfn ) 193 __field( u64, pfn )
194 __field( ulong, eaddr ) 194 __field( ulong, eaddr )
195 __field( u64, vpage ) 195 __field( u64, vpage )
@@ -198,7 +198,7 @@ TRACE_EVENT(kvm_book3s_mmu_map,
198 ), 198 ),
199 199
200 TP_fast_assign( 200 TP_fast_assign(
201 __entry->host_va = pte->host_va; 201 __entry->host_vpn = pte->host_vpn;
202 __entry->pfn = pte->pfn; 202 __entry->pfn = pte->pfn;
203 __entry->eaddr = pte->pte.eaddr; 203 __entry->eaddr = pte->pte.eaddr;
204 __entry->vpage = pte->pte.vpage; 204 __entry->vpage = pte->pte.vpage;
@@ -208,8 +208,8 @@ TRACE_EVENT(kvm_book3s_mmu_map,
208 (pte->pte.may_execute ? 0x1 : 0); 208 (pte->pte.may_execute ? 0x1 : 0);
209 ), 209 ),
210 210
211 TP_printk("Map: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]", 211 TP_printk("Map: hvpn=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
212 __entry->host_va, __entry->pfn, __entry->eaddr, 212 __entry->host_vpn, __entry->pfn, __entry->eaddr,
213 __entry->vpage, __entry->raddr, __entry->flags) 213 __entry->vpage, __entry->raddr, __entry->flags)
214); 214);
215 215
@@ -218,7 +218,7 @@ TRACE_EVENT(kvm_book3s_mmu_invalidate,
218 TP_ARGS(pte), 218 TP_ARGS(pte),
219 219
220 TP_STRUCT__entry( 220 TP_STRUCT__entry(
221 __field( u64, host_va ) 221 __field( u64, host_vpn )
222 __field( u64, pfn ) 222 __field( u64, pfn )
223 __field( ulong, eaddr ) 223 __field( ulong, eaddr )
224 __field( u64, vpage ) 224 __field( u64, vpage )
@@ -227,7 +227,7 @@ TRACE_EVENT(kvm_book3s_mmu_invalidate,
227 ), 227 ),
228 228
229 TP_fast_assign( 229 TP_fast_assign(
230 __entry->host_va = pte->host_va; 230 __entry->host_vpn = pte->host_vpn;
231 __entry->pfn = pte->pfn; 231 __entry->pfn = pte->pfn;
232 __entry->eaddr = pte->pte.eaddr; 232 __entry->eaddr = pte->pte.eaddr;
233 __entry->vpage = pte->pte.vpage; 233 __entry->vpage = pte->pte.vpage;
@@ -238,7 +238,7 @@ TRACE_EVENT(kvm_book3s_mmu_invalidate,
238 ), 238 ),
239 239
240 TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]", 240 TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
241 __entry->host_va, __entry->pfn, __entry->eaddr, 241 __entry->host_vpn, __entry->pfn, __entry->eaddr,
242 __entry->vpage, __entry->raddr, __entry->flags) 242 __entry->vpage, __entry->raddr, __entry->flags)
243); 243);
244 244
diff --git a/arch/powerpc/lib/memcpy_power7.S b/arch/powerpc/lib/memcpy_power7.S
index 7ba6c96de778..0663630baf3b 100644
--- a/arch/powerpc/lib/memcpy_power7.S
+++ b/arch/powerpc/lib/memcpy_power7.S
@@ -239,8 +239,8 @@ _GLOBAL(memcpy_power7)
239 ori r9,r9,1 /* stream=1 */ 239 ori r9,r9,1 /* stream=1 */
240 240
241 srdi r7,r5,7 /* length in cachelines, capped at 0x3FF */ 241 srdi r7,r5,7 /* length in cachelines, capped at 0x3FF */
242 cmpldi cr1,r7,0x3FF 242 cmpldi r7,0x3FF
243 ble cr1,1f 243 ble 1f
244 li r7,0x3FF 244 li r7,0x3FF
2451: lis r0,0x0E00 /* depth=7 */ 2451: lis r0,0x0E00 /* depth=7 */
246 sldi r7,r7,7 246 sldi r7,r7,7
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 9a52349874ee..e15c521846ca 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -566,7 +566,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
566 unsigned long int ea; 566 unsigned long int ea;
567 unsigned int cr, mb, me, sh; 567 unsigned int cr, mb, me, sh;
568 int err; 568 int err;
569 unsigned long old_ra; 569 unsigned long old_ra, val3;
570 long ival; 570 long ival;
571 571
572 opcode = instr >> 26; 572 opcode = instr >> 26;
@@ -1486,11 +1486,43 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
1486 goto ldst_done; 1486 goto ldst_done;
1487 1487
1488 case 36: /* stw */ 1488 case 36: /* stw */
1489 case 37: /* stwu */
1490 val = regs->gpr[rd]; 1489 val = regs->gpr[rd];
1491 err = write_mem(val, dform_ea(instr, regs), 4, regs); 1490 err = write_mem(val, dform_ea(instr, regs), 4, regs);
1492 goto ldst_done; 1491 goto ldst_done;
1493 1492
1493 case 37: /* stwu */
1494 val = regs->gpr[rd];
1495 val3 = dform_ea(instr, regs);
1496 /*
1497 * For PPC32 we always use stwu to change stack point with r1. So
1498 * this emulated store may corrupt the exception frame, now we
1499 * have to provide the exception frame trampoline, which is pushed
1500 * below the kprobed function stack. So we only update gpr[1] but
1501 * don't emulate the real store operation. We will do real store
1502 * operation safely in exception return code by checking this flag.
1503 */
1504 if ((ra == 1) && !(regs->msr & MSR_PR) \
1505 && (val3 >= (regs->gpr[1] - STACK_INT_FRAME_SIZE))) {
1506 /*
1507 * Check if we will touch kernel sack overflow
1508 */
1509 if (val3 - STACK_INT_FRAME_SIZE <= current->thread.ksp_limit) {
1510 printk(KERN_CRIT "Can't kprobe this since Kernel stack overflow.\n");
1511 err = -EINVAL;
1512 break;
1513 }
1514
1515 /*
1516 * Check if we already set since that means we'll
1517 * lose the previous value.
1518 */
1519 WARN_ON(test_thread_flag(TIF_EMULATE_STACK_STORE));
1520 set_thread_flag(TIF_EMULATE_STACK_STORE);
1521 err = 0;
1522 } else
1523 err = write_mem(val, val3, 4, regs);
1524 goto ldst_done;
1525
1494 case 38: /* stb */ 1526 case 38: /* stb */
1495 case 39: /* stbu */ 1527 case 39: /* stbu */
1496 val = regs->gpr[rd]; 1528 val = regs->gpr[rd];
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index e5f028b5794e..5495ebe983a2 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -133,6 +133,7 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address)
133 up_read(&current->mm->mmap_sem); 133 up_read(&current->mm->mmap_sem);
134 134
135 if (user_mode(regs)) { 135 if (user_mode(regs)) {
136 current->thread.trap_nr = BUS_ADRERR;
136 info.si_signo = SIGBUS; 137 info.si_signo = SIGBUS;
137 info.si_errno = 0; 138 info.si_errno = 0;
138 info.si_code = BUS_ADRERR; 139 info.si_code = BUS_ADRERR;
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index 602aeb06d298..56585086413a 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -63,7 +63,7 @@ _GLOBAL(__hash_page_4K)
63 /* Save non-volatile registers. 63 /* Save non-volatile registers.
64 * r31 will hold "old PTE" 64 * r31 will hold "old PTE"
65 * r30 is "new PTE" 65 * r30 is "new PTE"
66 * r29 is "va" 66 * r29 is vpn
67 * r28 is a hash value 67 * r28 is a hash value
68 * r27 is hashtab mask (maybe dynamic patched instead ?) 68 * r27 is hashtab mask (maybe dynamic patched instead ?)
69 */ 69 */
@@ -111,10 +111,10 @@ BEGIN_FTR_SECTION
111 cmpdi r9,0 /* check segment size */ 111 cmpdi r9,0 /* check segment size */
112 bne 3f 112 bne 3f
113END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) 113END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
114 /* Calc va and put it in r29 */ 114 /* Calc vpn and put it in r29 */
115 rldicr r29,r5,28,63-28 115 sldi r29,r5,SID_SHIFT - VPN_SHIFT
116 rldicl r3,r3,0,36 116 rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT - VPN_SHIFT)
117 or r29,r3,r29 117 or r29,r28,r29
118 118
119 /* Calculate hash value for primary slot and store it in r28 */ 119 /* Calculate hash value for primary slot and store it in r28 */
120 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */ 120 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */
@@ -122,14 +122,19 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
122 xor r28,r5,r0 122 xor r28,r5,r0
123 b 4f 123 b 4f
124 124
1253: /* Calc VA and hash in r29 and r28 for 1T segment */ 1253: /* Calc vpn and put it in r29 */
126 sldi r29,r5,40 /* vsid << 40 */ 126 sldi r29,r5,SID_SHIFT_1T - VPN_SHIFT
127 clrldi r3,r3,24 /* ea & 0xffffffffff */ 127 rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT_1T - VPN_SHIFT)
128 or r29,r28,r29
129
130 /*
131 * calculate hash value for primary slot and
132 * store it in r28 for 1T segment
133 */
128 rldic r28,r5,25,25 /* (vsid << 25) & 0x7fffffffff */ 134 rldic r28,r5,25,25 /* (vsid << 25) & 0x7fffffffff */
129 clrldi r5,r5,40 /* vsid & 0xffffff */ 135 clrldi r5,r5,40 /* vsid & 0xffffff */
130 rldicl r0,r3,64-12,36 /* (ea >> 12) & 0xfffffff */ 136 rldicl r0,r3,64-12,36 /* (ea >> 12) & 0xfffffff */
131 xor r28,r28,r5 137 xor r28,r28,r5
132 or r29,r3,r29 /* VA */
133 xor r28,r28,r0 /* hash */ 138 xor r28,r28,r0 /* hash */
134 139
135 /* Convert linux PTE bits into HW equivalents */ 140 /* Convert linux PTE bits into HW equivalents */
@@ -185,7 +190,7 @@ htab_insert_pte:
185 190
186 /* Call ppc_md.hpte_insert */ 191 /* Call ppc_md.hpte_insert */
187 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 192 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
188 mr r4,r29 /* Retrieve va */ 193 mr r4,r29 /* Retrieve vpn */
189 li r7,0 /* !bolted, !secondary */ 194 li r7,0 /* !bolted, !secondary */
190 li r8,MMU_PAGE_4K /* page size */ 195 li r8,MMU_PAGE_4K /* page size */
191 ld r9,STK_PARAM(R9)(r1) /* segment size */ 196 ld r9,STK_PARAM(R9)(r1) /* segment size */
@@ -208,7 +213,7 @@ _GLOBAL(htab_call_hpte_insert1)
208 213
209 /* Call ppc_md.hpte_insert */ 214 /* Call ppc_md.hpte_insert */
210 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 215 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
211 mr r4,r29 /* Retrieve va */ 216 mr r4,r29 /* Retrieve vpn */
212 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 217 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
213 li r8,MMU_PAGE_4K /* page size */ 218 li r8,MMU_PAGE_4K /* page size */
214 ld r9,STK_PARAM(R9)(r1) /* segment size */ 219 ld r9,STK_PARAM(R9)(r1) /* segment size */
@@ -278,7 +283,7 @@ htab_modify_pte:
278 add r3,r0,r3 /* add slot idx */ 283 add r3,r0,r3 /* add slot idx */
279 284
280 /* Call ppc_md.hpte_updatepp */ 285 /* Call ppc_md.hpte_updatepp */
281 mr r5,r29 /* va */ 286 mr r5,r29 /* vpn */
282 li r6,MMU_PAGE_4K /* page size */ 287 li r6,MMU_PAGE_4K /* page size */
283 ld r7,STK_PARAM(R9)(r1) /* segment size */ 288 ld r7,STK_PARAM(R9)(r1) /* segment size */
284 ld r8,STK_PARAM(R8)(r1) /* get "local" param */ 289 ld r8,STK_PARAM(R8)(r1) /* get "local" param */
@@ -339,7 +344,7 @@ _GLOBAL(__hash_page_4K)
339 /* Save non-volatile registers. 344 /* Save non-volatile registers.
340 * r31 will hold "old PTE" 345 * r31 will hold "old PTE"
341 * r30 is "new PTE" 346 * r30 is "new PTE"
342 * r29 is "va" 347 * r29 is vpn
343 * r28 is a hash value 348 * r28 is a hash value
344 * r27 is hashtab mask (maybe dynamic patched instead ?) 349 * r27 is hashtab mask (maybe dynamic patched instead ?)
345 * r26 is the hidx mask 350 * r26 is the hidx mask
@@ -394,10 +399,14 @@ BEGIN_FTR_SECTION
394 cmpdi r9,0 /* check segment size */ 399 cmpdi r9,0 /* check segment size */
395 bne 3f 400 bne 3f
396END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) 401END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
397 /* Calc va and put it in r29 */ 402 /* Calc vpn and put it in r29 */
398 rldicr r29,r5,28,63-28 /* r29 = (vsid << 28) */ 403 sldi r29,r5,SID_SHIFT - VPN_SHIFT
399 rldicl r3,r3,0,36 /* r3 = (ea & 0x0fffffff) */ 404 /*
400 or r29,r3,r29 /* r29 = va */ 405 * clrldi r3,r3,64 - SID_SHIFT --> ea & 0xfffffff
406 * srdi r28,r3,VPN_SHIFT
407 */
408 rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT - VPN_SHIFT)
409 or r29,r28,r29
401 410
402 /* Calculate hash value for primary slot and store it in r28 */ 411 /* Calculate hash value for primary slot and store it in r28 */
403 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */ 412 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */
@@ -405,14 +414,23 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
405 xor r28,r5,r0 414 xor r28,r5,r0
406 b 4f 415 b 4f
407 416
4083: /* Calc VA and hash in r29 and r28 for 1T segment */ 4173: /* Calc vpn and put it in r29 */
409 sldi r29,r5,40 /* vsid << 40 */ 418 sldi r29,r5,SID_SHIFT_1T - VPN_SHIFT
410 clrldi r3,r3,24 /* ea & 0xffffffffff */ 419 /*
420 * clrldi r3,r3,64 - SID_SHIFT_1T --> ea & 0xffffffffff
421 * srdi r28,r3,VPN_SHIFT
422 */
423 rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT_1T - VPN_SHIFT)
424 or r29,r28,r29
425
426 /*
427 * Calculate hash value for primary slot and
428 * store it in r28 for 1T segment
429 */
411 rldic r28,r5,25,25 /* (vsid << 25) & 0x7fffffffff */ 430 rldic r28,r5,25,25 /* (vsid << 25) & 0x7fffffffff */
412 clrldi r5,r5,40 /* vsid & 0xffffff */ 431 clrldi r5,r5,40 /* vsid & 0xffffff */
413 rldicl r0,r3,64-12,36 /* (ea >> 12) & 0xfffffff */ 432 rldicl r0,r3,64-12,36 /* (ea >> 12) & 0xfffffff */
414 xor r28,r28,r5 433 xor r28,r28,r5
415 or r29,r3,r29 /* VA */
416 xor r28,r28,r0 /* hash */ 434 xor r28,r28,r0 /* hash */
417 435
418 /* Convert linux PTE bits into HW equivalents */ 436 /* Convert linux PTE bits into HW equivalents */
@@ -488,7 +506,7 @@ htab_special_pfn:
488 506
489 /* Call ppc_md.hpte_insert */ 507 /* Call ppc_md.hpte_insert */
490 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 508 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
491 mr r4,r29 /* Retrieve va */ 509 mr r4,r29 /* Retrieve vpn */
492 li r7,0 /* !bolted, !secondary */ 510 li r7,0 /* !bolted, !secondary */
493 li r8,MMU_PAGE_4K /* page size */ 511 li r8,MMU_PAGE_4K /* page size */
494 ld r9,STK_PARAM(R9)(r1) /* segment size */ 512 ld r9,STK_PARAM(R9)(r1) /* segment size */
@@ -515,7 +533,7 @@ _GLOBAL(htab_call_hpte_insert1)
515 533
516 /* Call ppc_md.hpte_insert */ 534 /* Call ppc_md.hpte_insert */
517 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 535 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
518 mr r4,r29 /* Retrieve va */ 536 mr r4,r29 /* Retrieve vpn */
519 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 537 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
520 li r8,MMU_PAGE_4K /* page size */ 538 li r8,MMU_PAGE_4K /* page size */
521 ld r9,STK_PARAM(R9)(r1) /* segment size */ 539 ld r9,STK_PARAM(R9)(r1) /* segment size */
@@ -547,7 +565,7 @@ _GLOBAL(htab_call_hpte_remove)
547 * useless now that the segment has been switched to 4k pages. 565 * useless now that the segment has been switched to 4k pages.
548 */ 566 */
549htab_inval_old_hpte: 567htab_inval_old_hpte:
550 mr r3,r29 /* virtual addr */ 568 mr r3,r29 /* vpn */
551 mr r4,r31 /* PTE.pte */ 569 mr r4,r31 /* PTE.pte */
552 li r5,0 /* PTE.hidx */ 570 li r5,0 /* PTE.hidx */
553 li r6,MMU_PAGE_64K /* psize */ 571 li r6,MMU_PAGE_64K /* psize */
@@ -620,7 +638,7 @@ htab_modify_pte:
620 add r3,r0,r3 /* add slot idx */ 638 add r3,r0,r3 /* add slot idx */
621 639
622 /* Call ppc_md.hpte_updatepp */ 640 /* Call ppc_md.hpte_updatepp */
623 mr r5,r29 /* va */ 641 mr r5,r29 /* vpn */
624 li r6,MMU_PAGE_4K /* page size */ 642 li r6,MMU_PAGE_4K /* page size */
625 ld r7,STK_PARAM(R9)(r1) /* segment size */ 643 ld r7,STK_PARAM(R9)(r1) /* segment size */
626 ld r8,STK_PARAM(R8)(r1) /* get "local" param */ 644 ld r8,STK_PARAM(R8)(r1) /* get "local" param */
@@ -676,7 +694,7 @@ _GLOBAL(__hash_page_64K)
676 /* Save non-volatile registers. 694 /* Save non-volatile registers.
677 * r31 will hold "old PTE" 695 * r31 will hold "old PTE"
678 * r30 is "new PTE" 696 * r30 is "new PTE"
679 * r29 is "va" 697 * r29 is vpn
680 * r28 is a hash value 698 * r28 is a hash value
681 * r27 is hashtab mask (maybe dynamic patched instead ?) 699 * r27 is hashtab mask (maybe dynamic patched instead ?)
682 */ 700 */
@@ -729,10 +747,10 @@ BEGIN_FTR_SECTION
729 cmpdi r9,0 /* check segment size */ 747 cmpdi r9,0 /* check segment size */
730 bne 3f 748 bne 3f
731END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) 749END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
732 /* Calc va and put it in r29 */ 750 /* Calc vpn and put it in r29 */
733 rldicr r29,r5,28,63-28 751 sldi r29,r5,SID_SHIFT - VPN_SHIFT
734 rldicl r3,r3,0,36 752 rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT - VPN_SHIFT)
735 or r29,r3,r29 753 or r29,r28,r29
736 754
737 /* Calculate hash value for primary slot and store it in r28 */ 755 /* Calculate hash value for primary slot and store it in r28 */
738 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */ 756 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */
@@ -740,14 +758,19 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
740 xor r28,r5,r0 758 xor r28,r5,r0
741 b 4f 759 b 4f
742 760
7433: /* Calc VA and hash in r29 and r28 for 1T segment */ 7613: /* Calc vpn and put it in r29 */
744 sldi r29,r5,40 /* vsid << 40 */ 762 sldi r29,r5,SID_SHIFT_1T - VPN_SHIFT
745 clrldi r3,r3,24 /* ea & 0xffffffffff */ 763 rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT_1T - VPN_SHIFT)
764 or r29,r28,r29
765
766 /*
767 * calculate hash value for primary slot and
768 * store it in r28 for 1T segment
769 */
746 rldic r28,r5,25,25 /* (vsid << 25) & 0x7fffffffff */ 770 rldic r28,r5,25,25 /* (vsid << 25) & 0x7fffffffff */
747 clrldi r5,r5,40 /* vsid & 0xffffff */ 771 clrldi r5,r5,40 /* vsid & 0xffffff */
748 rldicl r0,r3,64-16,40 /* (ea >> 16) & 0xffffff */ 772 rldicl r0,r3,64-16,40 /* (ea >> 16) & 0xffffff */
749 xor r28,r28,r5 773 xor r28,r28,r5
750 or r29,r3,r29 /* VA */
751 xor r28,r28,r0 /* hash */ 774 xor r28,r28,r0 /* hash */
752 775
753 /* Convert linux PTE bits into HW equivalents */ 776 /* Convert linux PTE bits into HW equivalents */
@@ -806,7 +829,7 @@ ht64_insert_pte:
806 829
807 /* Call ppc_md.hpte_insert */ 830 /* Call ppc_md.hpte_insert */
808 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 831 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
809 mr r4,r29 /* Retrieve va */ 832 mr r4,r29 /* Retrieve vpn */
810 li r7,0 /* !bolted, !secondary */ 833 li r7,0 /* !bolted, !secondary */
811 li r8,MMU_PAGE_64K 834 li r8,MMU_PAGE_64K
812 ld r9,STK_PARAM(R9)(r1) /* segment size */ 835 ld r9,STK_PARAM(R9)(r1) /* segment size */
@@ -829,7 +852,7 @@ _GLOBAL(ht64_call_hpte_insert1)
829 852
830 /* Call ppc_md.hpte_insert */ 853 /* Call ppc_md.hpte_insert */
831 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 854 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
832 mr r4,r29 /* Retrieve va */ 855 mr r4,r29 /* Retrieve vpn */
833 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 856 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
834 li r8,MMU_PAGE_64K 857 li r8,MMU_PAGE_64K
835 ld r9,STK_PARAM(R9)(r1) /* segment size */ 858 ld r9,STK_PARAM(R9)(r1) /* segment size */
@@ -899,7 +922,7 @@ ht64_modify_pte:
899 add r3,r0,r3 /* add slot idx */ 922 add r3,r0,r3 /* add slot idx */
900 923
901 /* Call ppc_md.hpte_updatepp */ 924 /* Call ppc_md.hpte_updatepp */
902 mr r5,r29 /* va */ 925 mr r5,r29 /* vpn */
903 li r6,MMU_PAGE_64K 926 li r6,MMU_PAGE_64K
904 ld r7,STK_PARAM(R9)(r1) /* segment size */ 927 ld r7,STK_PARAM(R9)(r1) /* segment size */
905 ld r8,STK_PARAM(R8)(r1) /* get "local" param */ 928 ld r8,STK_PARAM(R8)(r1) /* get "local" param */
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index 90039bc64119..ffc1e00f7a22 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -14,10 +14,10 @@
14 14
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17#include <linux/of.h>
17#include <linux/threads.h> 18#include <linux/threads.h>
18#include <linux/smp.h> 19#include <linux/smp.h>
19 20
20#include <asm/abs_addr.h>
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22#include <asm/mmu.h> 22#include <asm/mmu.h>
23#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
@@ -39,22 +39,35 @@
39 39
40DEFINE_RAW_SPINLOCK(native_tlbie_lock); 40DEFINE_RAW_SPINLOCK(native_tlbie_lock);
41 41
42static inline void __tlbie(unsigned long va, int psize, int ssize) 42static inline void __tlbie(unsigned long vpn, int psize, int ssize)
43{ 43{
44 unsigned long va;
44 unsigned int penc; 45 unsigned int penc;
45 46
46 /* clear top 16 bits, non SLS segment */ 47 /*
48 * We need 14 to 65 bits of va for a tlibe of 4K page
49 * With vpn we ignore the lower VPN_SHIFT bits already.
50 * And top two bits are already ignored because we can
51 * only accomadate 76 bits in a 64 bit vpn with a VPN_SHIFT
52 * of 12.
53 */
54 va = vpn << VPN_SHIFT;
55 /*
56 * clear top 16 bits of 64bit va, non SLS segment
57 * Older versions of the architecture (2.02 and earler) require the
58 * masking of the top 16 bits.
59 */
47 va &= ~(0xffffULL << 48); 60 va &= ~(0xffffULL << 48);
48 61
49 switch (psize) { 62 switch (psize) {
50 case MMU_PAGE_4K: 63 case MMU_PAGE_4K:
51 va &= ~0xffful;
52 va |= ssize << 8; 64 va |= ssize << 8;
53 asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0), %2) 65 asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0), %2)
54 : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) 66 : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206)
55 : "memory"); 67 : "memory");
56 break; 68 break;
57 default: 69 default:
70 /* We need 14 to 14 + i bits of va */
58 penc = mmu_psize_defs[psize].penc; 71 penc = mmu_psize_defs[psize].penc;
59 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 72 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1);
60 va |= penc << 12; 73 va |= penc << 12;
@@ -67,21 +80,28 @@ static inline void __tlbie(unsigned long va, int psize, int ssize)
67 } 80 }
68} 81}
69 82
70static inline void __tlbiel(unsigned long va, int psize, int ssize) 83static inline void __tlbiel(unsigned long vpn, int psize, int ssize)
71{ 84{
85 unsigned long va;
72 unsigned int penc; 86 unsigned int penc;
73 87
74 /* clear top 16 bits, non SLS segment */ 88 /* VPN_SHIFT can be atmost 12 */
89 va = vpn << VPN_SHIFT;
90 /*
91 * clear top 16 bits of 64 bit va, non SLS segment
92 * Older versions of the architecture (2.02 and earler) require the
93 * masking of the top 16 bits.
94 */
75 va &= ~(0xffffULL << 48); 95 va &= ~(0xffffULL << 48);
76 96
77 switch (psize) { 97 switch (psize) {
78 case MMU_PAGE_4K: 98 case MMU_PAGE_4K:
79 va &= ~0xffful;
80 va |= ssize << 8; 99 va |= ssize << 8;
81 asm volatile(".long 0x7c000224 | (%0 << 11) | (0 << 21)" 100 asm volatile(".long 0x7c000224 | (%0 << 11) | (0 << 21)"
82 : : "r"(va) : "memory"); 101 : : "r"(va) : "memory");
83 break; 102 break;
84 default: 103 default:
104 /* We need 14 to 14 + i bits of va */
85 penc = mmu_psize_defs[psize].penc; 105 penc = mmu_psize_defs[psize].penc;
86 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 106 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1);
87 va |= penc << 12; 107 va |= penc << 12;
@@ -94,7 +114,7 @@ static inline void __tlbiel(unsigned long va, int psize, int ssize)
94 114
95} 115}
96 116
97static inline void tlbie(unsigned long va, int psize, int ssize, int local) 117static inline void tlbie(unsigned long vpn, int psize, int ssize, int local)
98{ 118{
99 unsigned int use_local = local && mmu_has_feature(MMU_FTR_TLBIEL); 119 unsigned int use_local = local && mmu_has_feature(MMU_FTR_TLBIEL);
100 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); 120 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
@@ -105,10 +125,10 @@ static inline void tlbie(unsigned long va, int psize, int ssize, int local)
105 raw_spin_lock(&native_tlbie_lock); 125 raw_spin_lock(&native_tlbie_lock);
106 asm volatile("ptesync": : :"memory"); 126 asm volatile("ptesync": : :"memory");
107 if (use_local) { 127 if (use_local) {
108 __tlbiel(va, psize, ssize); 128 __tlbiel(vpn, psize, ssize);
109 asm volatile("ptesync": : :"memory"); 129 asm volatile("ptesync": : :"memory");
110 } else { 130 } else {
111 __tlbie(va, psize, ssize); 131 __tlbie(vpn, psize, ssize);
112 asm volatile("eieio; tlbsync; ptesync": : :"memory"); 132 asm volatile("eieio; tlbsync; ptesync": : :"memory");
113 } 133 }
114 if (lock_tlbie && !use_local) 134 if (lock_tlbie && !use_local)
@@ -134,7 +154,7 @@ static inline void native_unlock_hpte(struct hash_pte *hptep)
134 clear_bit_unlock(HPTE_LOCK_BIT, word); 154 clear_bit_unlock(HPTE_LOCK_BIT, word);
135} 155}
136 156
137static long native_hpte_insert(unsigned long hpte_group, unsigned long va, 157static long native_hpte_insert(unsigned long hpte_group, unsigned long vpn,
138 unsigned long pa, unsigned long rflags, 158 unsigned long pa, unsigned long rflags,
139 unsigned long vflags, int psize, int ssize) 159 unsigned long vflags, int psize, int ssize)
140{ 160{
@@ -143,9 +163,9 @@ static long native_hpte_insert(unsigned long hpte_group, unsigned long va,
143 int i; 163 int i;
144 164
145 if (!(vflags & HPTE_V_BOLTED)) { 165 if (!(vflags & HPTE_V_BOLTED)) {
146 DBG_LOW(" insert(group=%lx, va=%016lx, pa=%016lx," 166 DBG_LOW(" insert(group=%lx, vpn=%016lx, pa=%016lx,"
147 " rflags=%lx, vflags=%lx, psize=%d)\n", 167 " rflags=%lx, vflags=%lx, psize=%d)\n",
148 hpte_group, va, pa, rflags, vflags, psize); 168 hpte_group, vpn, pa, rflags, vflags, psize);
149 } 169 }
150 170
151 for (i = 0; i < HPTES_PER_GROUP; i++) { 171 for (i = 0; i < HPTES_PER_GROUP; i++) {
@@ -163,7 +183,7 @@ static long native_hpte_insert(unsigned long hpte_group, unsigned long va,
163 if (i == HPTES_PER_GROUP) 183 if (i == HPTES_PER_GROUP)
164 return -1; 184 return -1;
165 185
166 hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID; 186 hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID;
167 hpte_r = hpte_encode_r(pa, psize) | rflags; 187 hpte_r = hpte_encode_r(pa, psize) | rflags;
168 188
169 if (!(vflags & HPTE_V_BOLTED)) { 189 if (!(vflags & HPTE_V_BOLTED)) {
@@ -225,17 +245,17 @@ static long native_hpte_remove(unsigned long hpte_group)
225} 245}
226 246
227static long native_hpte_updatepp(unsigned long slot, unsigned long newpp, 247static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
228 unsigned long va, int psize, int ssize, 248 unsigned long vpn, int psize, int ssize,
229 int local) 249 int local)
230{ 250{
231 struct hash_pte *hptep = htab_address + slot; 251 struct hash_pte *hptep = htab_address + slot;
232 unsigned long hpte_v, want_v; 252 unsigned long hpte_v, want_v;
233 int ret = 0; 253 int ret = 0;
234 254
235 want_v = hpte_encode_v(va, psize, ssize); 255 want_v = hpte_encode_v(vpn, psize, ssize);
236 256
237 DBG_LOW(" update(va=%016lx, avpnv=%016lx, hash=%016lx, newpp=%x)", 257 DBG_LOW(" update(vpn=%016lx, avpnv=%016lx, group=%lx, newpp=%lx)",
238 va, want_v & HPTE_V_AVPN, slot, newpp); 258 vpn, want_v & HPTE_V_AVPN, slot, newpp);
239 259
240 native_lock_hpte(hptep); 260 native_lock_hpte(hptep);
241 261
@@ -254,12 +274,12 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
254 native_unlock_hpte(hptep); 274 native_unlock_hpte(hptep);
255 275
256 /* Ensure it is out of the tlb too. */ 276 /* Ensure it is out of the tlb too. */
257 tlbie(va, psize, ssize, local); 277 tlbie(vpn, psize, ssize, local);
258 278
259 return ret; 279 return ret;
260} 280}
261 281
262static long native_hpte_find(unsigned long va, int psize, int ssize) 282static long native_hpte_find(unsigned long vpn, int psize, int ssize)
263{ 283{
264 struct hash_pte *hptep; 284 struct hash_pte *hptep;
265 unsigned long hash; 285 unsigned long hash;
@@ -267,8 +287,8 @@ static long native_hpte_find(unsigned long va, int psize, int ssize)
267 long slot; 287 long slot;
268 unsigned long want_v, hpte_v; 288 unsigned long want_v, hpte_v;
269 289
270 hash = hpt_hash(va, mmu_psize_defs[psize].shift, ssize); 290 hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, ssize);
271 want_v = hpte_encode_v(va, psize, ssize); 291 want_v = hpte_encode_v(vpn, psize, ssize);
272 292
273 /* Bolted mappings are only ever in the primary group */ 293 /* Bolted mappings are only ever in the primary group */
274 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 294 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
@@ -295,14 +315,15 @@ static long native_hpte_find(unsigned long va, int psize, int ssize)
295static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, 315static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,
296 int psize, int ssize) 316 int psize, int ssize)
297{ 317{
298 unsigned long vsid, va; 318 unsigned long vpn;
319 unsigned long vsid;
299 long slot; 320 long slot;
300 struct hash_pte *hptep; 321 struct hash_pte *hptep;
301 322
302 vsid = get_kernel_vsid(ea, ssize); 323 vsid = get_kernel_vsid(ea, ssize);
303 va = hpt_va(ea, vsid, ssize); 324 vpn = hpt_vpn(ea, vsid, ssize);
304 325
305 slot = native_hpte_find(va, psize, ssize); 326 slot = native_hpte_find(vpn, psize, ssize);
306 if (slot == -1) 327 if (slot == -1)
307 panic("could not find page to bolt\n"); 328 panic("could not find page to bolt\n");
308 hptep = htab_address + slot; 329 hptep = htab_address + slot;
@@ -312,10 +333,10 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,
312 (newpp & (HPTE_R_PP | HPTE_R_N)); 333 (newpp & (HPTE_R_PP | HPTE_R_N));
313 334
314 /* Ensure it is out of the tlb too. */ 335 /* Ensure it is out of the tlb too. */
315 tlbie(va, psize, ssize, 0); 336 tlbie(vpn, psize, ssize, 0);
316} 337}
317 338
318static void native_hpte_invalidate(unsigned long slot, unsigned long va, 339static void native_hpte_invalidate(unsigned long slot, unsigned long vpn,
319 int psize, int ssize, int local) 340 int psize, int ssize, int local)
320{ 341{
321 struct hash_pte *hptep = htab_address + slot; 342 struct hash_pte *hptep = htab_address + slot;
@@ -325,9 +346,9 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long va,
325 346
326 local_irq_save(flags); 347 local_irq_save(flags);
327 348
328 DBG_LOW(" invalidate(va=%016lx, hash: %x)\n", va, slot); 349 DBG_LOW(" invalidate(vpn=%016lx, hash: %lx)\n", vpn, slot);
329 350
330 want_v = hpte_encode_v(va, psize, ssize); 351 want_v = hpte_encode_v(vpn, psize, ssize);
331 native_lock_hpte(hptep); 352 native_lock_hpte(hptep);
332 hpte_v = hptep->v; 353 hpte_v = hptep->v;
333 354
@@ -339,7 +360,7 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long va,
339 hptep->v = 0; 360 hptep->v = 0;
340 361
341 /* Invalidate the TLB */ 362 /* Invalidate the TLB */
342 tlbie(va, psize, ssize, local); 363 tlbie(vpn, psize, ssize, local);
343 364
344 local_irq_restore(flags); 365 local_irq_restore(flags);
345} 366}
@@ -349,11 +370,12 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long va,
349#define LP_MASK(i) ((0xFF >> (i)) << LP_SHIFT) 370#define LP_MASK(i) ((0xFF >> (i)) << LP_SHIFT)
350 371
351static void hpte_decode(struct hash_pte *hpte, unsigned long slot, 372static void hpte_decode(struct hash_pte *hpte, unsigned long slot,
352 int *psize, int *ssize, unsigned long *va) 373 int *psize, int *ssize, unsigned long *vpn)
353{ 374{
375 unsigned long avpn, pteg, vpi;
354 unsigned long hpte_r = hpte->r; 376 unsigned long hpte_r = hpte->r;
355 unsigned long hpte_v = hpte->v; 377 unsigned long hpte_v = hpte->v;
356 unsigned long avpn; 378 unsigned long vsid, seg_off;
357 int i, size, shift, penc; 379 int i, size, shift, penc;
358 380
359 if (!(hpte_v & HPTE_V_LARGE)) 381 if (!(hpte_v & HPTE_V_LARGE))
@@ -380,32 +402,38 @@ static void hpte_decode(struct hash_pte *hpte, unsigned long slot,
380 } 402 }
381 403
382 /* This works for all page sizes, and for 256M and 1T segments */ 404 /* This works for all page sizes, and for 256M and 1T segments */
405 *ssize = hpte_v >> HPTE_V_SSIZE_SHIFT;
383 shift = mmu_psize_defs[size].shift; 406 shift = mmu_psize_defs[size].shift;
384 avpn = (HPTE_V_AVPN_VAL(hpte_v) & ~mmu_psize_defs[size].avpnm) << 23;
385
386 if (shift < 23) {
387 unsigned long vpi, vsid, pteg;
388 407
389 pteg = slot / HPTES_PER_GROUP; 408 avpn = (HPTE_V_AVPN_VAL(hpte_v) & ~mmu_psize_defs[size].avpnm);
390 if (hpte_v & HPTE_V_SECONDARY) 409 pteg = slot / HPTES_PER_GROUP;
391 pteg = ~pteg; 410 if (hpte_v & HPTE_V_SECONDARY)
392 switch (hpte_v >> HPTE_V_SSIZE_SHIFT) { 411 pteg = ~pteg;
393 case MMU_SEGSIZE_256M: 412
394 vpi = ((avpn >> 28) ^ pteg) & htab_hash_mask; 413 switch (*ssize) {
395 break; 414 case MMU_SEGSIZE_256M:
396 case MMU_SEGSIZE_1T: 415 /* We only have 28 - 23 bits of seg_off in avpn */
397 vsid = avpn >> 40; 416 seg_off = (avpn & 0x1f) << 23;
417 vsid = avpn >> 5;
418 /* We can find more bits from the pteg value */
419 if (shift < 23) {
420 vpi = (vsid ^ pteg) & htab_hash_mask;
421 seg_off |= vpi << shift;
422 }
423 *vpn = vsid << (SID_SHIFT - VPN_SHIFT) | seg_off >> VPN_SHIFT;
424 case MMU_SEGSIZE_1T:
425 /* We only have 40 - 23 bits of seg_off in avpn */
426 seg_off = (avpn & 0x1ffff) << 23;
427 vsid = avpn >> 17;
428 if (shift < 23) {
398 vpi = (vsid ^ (vsid << 25) ^ pteg) & htab_hash_mask; 429 vpi = (vsid ^ (vsid << 25) ^ pteg) & htab_hash_mask;
399 break; 430 seg_off |= vpi << shift;
400 default:
401 avpn = vpi = size = 0;
402 } 431 }
403 avpn |= (vpi << mmu_psize_defs[size].shift); 432 *vpn = vsid << (SID_SHIFT_1T - VPN_SHIFT) | seg_off >> VPN_SHIFT;
433 default:
434 *vpn = size = 0;
404 } 435 }
405
406 *va = avpn;
407 *psize = size; 436 *psize = size;
408 *ssize = hpte_v >> HPTE_V_SSIZE_SHIFT;
409} 437}
410 438
411/* 439/*
@@ -418,9 +446,10 @@ static void hpte_decode(struct hash_pte *hpte, unsigned long slot,
418 */ 446 */
419static void native_hpte_clear(void) 447static void native_hpte_clear(void)
420{ 448{
449 unsigned long vpn = 0;
421 unsigned long slot, slots, flags; 450 unsigned long slot, slots, flags;
422 struct hash_pte *hptep = htab_address; 451 struct hash_pte *hptep = htab_address;
423 unsigned long hpte_v, va; 452 unsigned long hpte_v;
424 unsigned long pteg_count; 453 unsigned long pteg_count;
425 int psize, ssize; 454 int psize, ssize;
426 455
@@ -448,9 +477,9 @@ static void native_hpte_clear(void)
448 * already hold the native_tlbie_lock. 477 * already hold the native_tlbie_lock.
449 */ 478 */
450 if (hpte_v & HPTE_V_VALID) { 479 if (hpte_v & HPTE_V_VALID) {
451 hpte_decode(hptep, slot, &psize, &ssize, &va); 480 hpte_decode(hptep, slot, &psize, &ssize, &vpn);
452 hptep->v = 0; 481 hptep->v = 0;
453 __tlbie(va, psize, ssize); 482 __tlbie(vpn, psize, ssize);
454 } 483 }
455 } 484 }
456 485
@@ -465,7 +494,8 @@ static void native_hpte_clear(void)
465 */ 494 */
466static void native_flush_hash_range(unsigned long number, int local) 495static void native_flush_hash_range(unsigned long number, int local)
467{ 496{
468 unsigned long va, hash, index, hidx, shift, slot; 497 unsigned long vpn;
498 unsigned long hash, index, hidx, shift, slot;
469 struct hash_pte *hptep; 499 struct hash_pte *hptep;
470 unsigned long hpte_v; 500 unsigned long hpte_v;
471 unsigned long want_v; 501 unsigned long want_v;
@@ -479,18 +509,18 @@ static void native_flush_hash_range(unsigned long number, int local)
479 local_irq_save(flags); 509 local_irq_save(flags);
480 510
481 for (i = 0; i < number; i++) { 511 for (i = 0; i < number; i++) {
482 va = batch->vaddr[i]; 512 vpn = batch->vpn[i];
483 pte = batch->pte[i]; 513 pte = batch->pte[i];
484 514
485 pte_iterate_hashed_subpages(pte, psize, va, index, shift) { 515 pte_iterate_hashed_subpages(pte, psize, vpn, index, shift) {
486 hash = hpt_hash(va, shift, ssize); 516 hash = hpt_hash(vpn, shift, ssize);
487 hidx = __rpte_to_hidx(pte, index); 517 hidx = __rpte_to_hidx(pte, index);
488 if (hidx & _PTEIDX_SECONDARY) 518 if (hidx & _PTEIDX_SECONDARY)
489 hash = ~hash; 519 hash = ~hash;
490 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 520 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
491 slot += hidx & _PTEIDX_GROUP_IX; 521 slot += hidx & _PTEIDX_GROUP_IX;
492 hptep = htab_address + slot; 522 hptep = htab_address + slot;
493 want_v = hpte_encode_v(va, psize, ssize); 523 want_v = hpte_encode_v(vpn, psize, ssize);
494 native_lock_hpte(hptep); 524 native_lock_hpte(hptep);
495 hpte_v = hptep->v; 525 hpte_v = hptep->v;
496 if (!HPTE_V_COMPARE(hpte_v, want_v) || 526 if (!HPTE_V_COMPARE(hpte_v, want_v) ||
@@ -505,12 +535,12 @@ static void native_flush_hash_range(unsigned long number, int local)
505 mmu_psize_defs[psize].tlbiel && local) { 535 mmu_psize_defs[psize].tlbiel && local) {
506 asm volatile("ptesync":::"memory"); 536 asm volatile("ptesync":::"memory");
507 for (i = 0; i < number; i++) { 537 for (i = 0; i < number; i++) {
508 va = batch->vaddr[i]; 538 vpn = batch->vpn[i];
509 pte = batch->pte[i]; 539 pte = batch->pte[i];
510 540
511 pte_iterate_hashed_subpages(pte, psize, va, index, 541 pte_iterate_hashed_subpages(pte, psize,
512 shift) { 542 vpn, index, shift) {
513 __tlbiel(va, psize, ssize); 543 __tlbiel(vpn, psize, ssize);
514 } pte_iterate_hashed_end(); 544 } pte_iterate_hashed_end();
515 } 545 }
516 asm volatile("ptesync":::"memory"); 546 asm volatile("ptesync":::"memory");
@@ -522,12 +552,12 @@ static void native_flush_hash_range(unsigned long number, int local)
522 552
523 asm volatile("ptesync":::"memory"); 553 asm volatile("ptesync":::"memory");
524 for (i = 0; i < number; i++) { 554 for (i = 0; i < number; i++) {
525 va = batch->vaddr[i]; 555 vpn = batch->vpn[i];
526 pte = batch->pte[i]; 556 pte = batch->pte[i];
527 557
528 pte_iterate_hashed_subpages(pte, psize, va, index, 558 pte_iterate_hashed_subpages(pte, psize,
529 shift) { 559 vpn, index, shift) {
530 __tlbie(va, psize, ssize); 560 __tlbie(vpn, psize, ssize);
531 } pte_iterate_hashed_end(); 561 } pte_iterate_hashed_end();
532 } 562 }
533 asm volatile("eieio; tlbsync; ptesync":::"memory"); 563 asm volatile("eieio; tlbsync; ptesync":::"memory");
@@ -539,29 +569,6 @@ static void native_flush_hash_range(unsigned long number, int local)
539 local_irq_restore(flags); 569 local_irq_restore(flags);
540} 570}
541 571
542#ifdef CONFIG_PPC_PSERIES
543/* Disable TLB batching on nighthawk */
544static inline int tlb_batching_enabled(void)
545{
546 struct device_node *root = of_find_node_by_path("/");
547 int enabled = 1;
548
549 if (root) {
550 const char *model = of_get_property(root, "model", NULL);
551 if (model && !strcmp(model, "IBM,9076-N81"))
552 enabled = 0;
553 of_node_put(root);
554 }
555
556 return enabled;
557}
558#else
559static inline int tlb_batching_enabled(void)
560{
561 return 1;
562}
563#endif
564
565void __init hpte_init_native(void) 572void __init hpte_init_native(void)
566{ 573{
567 ppc_md.hpte_invalidate = native_hpte_invalidate; 574 ppc_md.hpte_invalidate = native_hpte_invalidate;
@@ -570,6 +577,5 @@ void __init hpte_init_native(void)
570 ppc_md.hpte_insert = native_hpte_insert; 577 ppc_md.hpte_insert = native_hpte_insert;
571 ppc_md.hpte_remove = native_hpte_remove; 578 ppc_md.hpte_remove = native_hpte_remove;
572 ppc_md.hpte_clear_all = native_hpte_clear; 579 ppc_md.hpte_clear_all = native_hpte_clear;
573 if (tlb_batching_enabled()) 580 ppc_md.flush_hash_range = native_flush_hash_range;
574 ppc_md.flush_hash_range = native_flush_hash_range;
575} 581}
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 377e5cbedbbb..3a292be2e079 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -43,7 +43,6 @@
43#include <asm/uaccess.h> 43#include <asm/uaccess.h>
44#include <asm/machdep.h> 44#include <asm/machdep.h>
45#include <asm/prom.h> 45#include <asm/prom.h>
46#include <asm/abs_addr.h>
47#include <asm/tlbflush.h> 46#include <asm/tlbflush.h>
48#include <asm/io.h> 47#include <asm/io.h>
49#include <asm/eeh.h> 48#include <asm/eeh.h>
@@ -192,18 +191,18 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
192 vaddr += step, paddr += step) { 191 vaddr += step, paddr += step) {
193 unsigned long hash, hpteg; 192 unsigned long hash, hpteg;
194 unsigned long vsid = get_kernel_vsid(vaddr, ssize); 193 unsigned long vsid = get_kernel_vsid(vaddr, ssize);
195 unsigned long va = hpt_va(vaddr, vsid, ssize); 194 unsigned long vpn = hpt_vpn(vaddr, vsid, ssize);
196 unsigned long tprot = prot; 195 unsigned long tprot = prot;
197 196
198 /* Make kernel text executable */ 197 /* Make kernel text executable */
199 if (overlaps_kernel_text(vaddr, vaddr + step)) 198 if (overlaps_kernel_text(vaddr, vaddr + step))
200 tprot &= ~HPTE_R_N; 199 tprot &= ~HPTE_R_N;
201 200
202 hash = hpt_hash(va, shift, ssize); 201 hash = hpt_hash(vpn, shift, ssize);
203 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 202 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
204 203
205 BUG_ON(!ppc_md.hpte_insert); 204 BUG_ON(!ppc_md.hpte_insert);
206 ret = ppc_md.hpte_insert(hpteg, va, paddr, tprot, 205 ret = ppc_md.hpte_insert(hpteg, vpn, paddr, tprot,
207 HPTE_V_BOLTED, psize, ssize); 206 HPTE_V_BOLTED, psize, ssize);
208 207
209 if (ret < 0) 208 if (ret < 0)
@@ -651,7 +650,7 @@ static void __init htab_initialize(void)
651 DBG("Hash table allocated at %lx, size: %lx\n", table, 650 DBG("Hash table allocated at %lx, size: %lx\n", table,
652 htab_size_bytes); 651 htab_size_bytes);
653 652
654 htab_address = abs_to_virt(table); 653 htab_address = __va(table);
655 654
656 /* htab absolute addr + encoded htabsize */ 655 /* htab absolute addr + encoded htabsize */
657 _SDR1 = table + __ilog2(pteg_count) - 11; 656 _SDR1 = table + __ilog2(pteg_count) - 11;
@@ -804,16 +803,19 @@ unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap)
804#ifdef CONFIG_PPC_MM_SLICES 803#ifdef CONFIG_PPC_MM_SLICES
805unsigned int get_paca_psize(unsigned long addr) 804unsigned int get_paca_psize(unsigned long addr)
806{ 805{
807 unsigned long index, slices; 806 u64 lpsizes;
807 unsigned char *hpsizes;
808 unsigned long index, mask_index;
808 809
809 if (addr < SLICE_LOW_TOP) { 810 if (addr < SLICE_LOW_TOP) {
810 slices = get_paca()->context.low_slices_psize; 811 lpsizes = get_paca()->context.low_slices_psize;
811 index = GET_LOW_SLICE_INDEX(addr); 812 index = GET_LOW_SLICE_INDEX(addr);
812 } else { 813 return (lpsizes >> (index * 4)) & 0xF;
813 slices = get_paca()->context.high_slices_psize;
814 index = GET_HIGH_SLICE_INDEX(addr);
815 } 814 }
816 return (slices >> (index * 4)) & 0xF; 815 hpsizes = get_paca()->context.high_slices_psize;
816 index = GET_HIGH_SLICE_INDEX(addr);
817 mask_index = index & 0x1;
818 return (hpsizes[index >> 1] >> (mask_index * 4)) & 0xF;
817} 819}
818 820
819#else 821#else
@@ -1153,21 +1155,21 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
1153/* WARNING: This is called from hash_low_64.S, if you change this prototype, 1155/* WARNING: This is called from hash_low_64.S, if you change this prototype,
1154 * do not forget to update the assembly call site ! 1156 * do not forget to update the assembly call site !
1155 */ 1157 */
1156void flush_hash_page(unsigned long va, real_pte_t pte, int psize, int ssize, 1158void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, int ssize,
1157 int local) 1159 int local)
1158{ 1160{
1159 unsigned long hash, index, shift, hidx, slot; 1161 unsigned long hash, index, shift, hidx, slot;
1160 1162
1161 DBG_LOW("flush_hash_page(va=%016lx)\n", va); 1163 DBG_LOW("flush_hash_page(vpn=%016lx)\n", vpn);
1162 pte_iterate_hashed_subpages(pte, psize, va, index, shift) { 1164 pte_iterate_hashed_subpages(pte, psize, vpn, index, shift) {
1163 hash = hpt_hash(va, shift, ssize); 1165 hash = hpt_hash(vpn, shift, ssize);
1164 hidx = __rpte_to_hidx(pte, index); 1166 hidx = __rpte_to_hidx(pte, index);
1165 if (hidx & _PTEIDX_SECONDARY) 1167 if (hidx & _PTEIDX_SECONDARY)
1166 hash = ~hash; 1168 hash = ~hash;
1167 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 1169 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
1168 slot += hidx & _PTEIDX_GROUP_IX; 1170 slot += hidx & _PTEIDX_GROUP_IX;
1169 DBG_LOW(" sub %ld: hash=%lx, hidx=%lx\n", index, slot, hidx); 1171 DBG_LOW(" sub %ld: hash=%lx, hidx=%lx\n", index, slot, hidx);
1170 ppc_md.hpte_invalidate(slot, va, psize, ssize, local); 1172 ppc_md.hpte_invalidate(slot, vpn, psize, ssize, local);
1171 } pte_iterate_hashed_end(); 1173 } pte_iterate_hashed_end();
1172} 1174}
1173 1175
@@ -1181,7 +1183,7 @@ void flush_hash_range(unsigned long number, int local)
1181 &__get_cpu_var(ppc64_tlb_batch); 1183 &__get_cpu_var(ppc64_tlb_batch);
1182 1184
1183 for (i = 0; i < number; i++) 1185 for (i = 0; i < number; i++)
1184 flush_hash_page(batch->vaddr[i], batch->pte[i], 1186 flush_hash_page(batch->vpn[i], batch->pte[i],
1185 batch->psize, batch->ssize, local); 1187 batch->psize, batch->ssize, local);
1186 } 1188 }
1187} 1189}
@@ -1208,14 +1210,14 @@ static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi)
1208{ 1210{
1209 unsigned long hash, hpteg; 1211 unsigned long hash, hpteg;
1210 unsigned long vsid = get_kernel_vsid(vaddr, mmu_kernel_ssize); 1212 unsigned long vsid = get_kernel_vsid(vaddr, mmu_kernel_ssize);
1211 unsigned long va = hpt_va(vaddr, vsid, mmu_kernel_ssize); 1213 unsigned long vpn = hpt_vpn(vaddr, vsid, mmu_kernel_ssize);
1212 unsigned long mode = htab_convert_pte_flags(PAGE_KERNEL); 1214 unsigned long mode = htab_convert_pte_flags(PAGE_KERNEL);
1213 int ret; 1215 int ret;
1214 1216
1215 hash = hpt_hash(va, PAGE_SHIFT, mmu_kernel_ssize); 1217 hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize);
1216 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 1218 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
1217 1219
1218 ret = ppc_md.hpte_insert(hpteg, va, __pa(vaddr), 1220 ret = ppc_md.hpte_insert(hpteg, vpn, __pa(vaddr),
1219 mode, HPTE_V_BOLTED, 1221 mode, HPTE_V_BOLTED,
1220 mmu_linear_psize, mmu_kernel_ssize); 1222 mmu_linear_psize, mmu_kernel_ssize);
1221 BUG_ON (ret < 0); 1223 BUG_ON (ret < 0);
@@ -1229,9 +1231,9 @@ static void kernel_unmap_linear_page(unsigned long vaddr, unsigned long lmi)
1229{ 1231{
1230 unsigned long hash, hidx, slot; 1232 unsigned long hash, hidx, slot;
1231 unsigned long vsid = get_kernel_vsid(vaddr, mmu_kernel_ssize); 1233 unsigned long vsid = get_kernel_vsid(vaddr, mmu_kernel_ssize);
1232 unsigned long va = hpt_va(vaddr, vsid, mmu_kernel_ssize); 1234 unsigned long vpn = hpt_vpn(vaddr, vsid, mmu_kernel_ssize);
1233 1235
1234 hash = hpt_hash(va, PAGE_SHIFT, mmu_kernel_ssize); 1236 hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize);
1235 spin_lock(&linear_map_hash_lock); 1237 spin_lock(&linear_map_hash_lock);
1236 BUG_ON(!(linear_map_hash_slots[lmi] & 0x80)); 1238 BUG_ON(!(linear_map_hash_slots[lmi] & 0x80));
1237 hidx = linear_map_hash_slots[lmi] & 0x7f; 1239 hidx = linear_map_hash_slots[lmi] & 0x7f;
@@ -1241,7 +1243,7 @@ static void kernel_unmap_linear_page(unsigned long vaddr, unsigned long lmi)
1241 hash = ~hash; 1243 hash = ~hash;
1242 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 1244 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
1243 slot += hidx & _PTEIDX_GROUP_IX; 1245 slot += hidx & _PTEIDX_GROUP_IX;
1244 ppc_md.hpte_invalidate(slot, va, mmu_linear_psize, mmu_kernel_ssize, 0); 1246 ppc_md.hpte_invalidate(slot, vpn, mmu_linear_psize, mmu_kernel_ssize, 0);
1245} 1247}
1246 1248
1247void kernel_map_pages(struct page *page, int numpages, int enable) 1249void kernel_map_pages(struct page *page, int numpages, int enable)
diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
index cc5c273086cf..cecad348f604 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -18,14 +18,15 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
18 pte_t *ptep, unsigned long trap, int local, int ssize, 18 pte_t *ptep, unsigned long trap, int local, int ssize,
19 unsigned int shift, unsigned int mmu_psize) 19 unsigned int shift, unsigned int mmu_psize)
20{ 20{
21 unsigned long vpn;
21 unsigned long old_pte, new_pte; 22 unsigned long old_pte, new_pte;
22 unsigned long va, rflags, pa, sz; 23 unsigned long rflags, pa, sz;
23 long slot; 24 long slot;
24 25
25 BUG_ON(shift != mmu_psize_defs[mmu_psize].shift); 26 BUG_ON(shift != mmu_psize_defs[mmu_psize].shift);
26 27
27 /* Search the Linux page table for a match with va */ 28 /* Search the Linux page table for a match with va */
28 va = hpt_va(ea, vsid, ssize); 29 vpn = hpt_vpn(ea, vsid, ssize);
29 30
30 /* At this point, we have a pte (old_pte) which can be used to build 31 /* At this point, we have a pte (old_pte) which can be used to build
31 * or update an HPTE. There are 2 cases: 32 * or update an HPTE. There are 2 cases:
@@ -69,19 +70,19 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
69 /* There MIGHT be an HPTE for this pte */ 70 /* There MIGHT be an HPTE for this pte */
70 unsigned long hash, slot; 71 unsigned long hash, slot;
71 72
72 hash = hpt_hash(va, shift, ssize); 73 hash = hpt_hash(vpn, shift, ssize);
73 if (old_pte & _PAGE_F_SECOND) 74 if (old_pte & _PAGE_F_SECOND)
74 hash = ~hash; 75 hash = ~hash;
75 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 76 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
76 slot += (old_pte & _PAGE_F_GIX) >> 12; 77 slot += (old_pte & _PAGE_F_GIX) >> 12;
77 78
78 if (ppc_md.hpte_updatepp(slot, rflags, va, mmu_psize, 79 if (ppc_md.hpte_updatepp(slot, rflags, vpn, mmu_psize,
79 ssize, local) == -1) 80 ssize, local) == -1)
80 old_pte &= ~_PAGE_HPTEFLAGS; 81 old_pte &= ~_PAGE_HPTEFLAGS;
81 } 82 }
82 83
83 if (likely(!(old_pte & _PAGE_HASHPTE))) { 84 if (likely(!(old_pte & _PAGE_HASHPTE))) {
84 unsigned long hash = hpt_hash(va, shift, ssize); 85 unsigned long hash = hpt_hash(vpn, shift, ssize);
85 unsigned long hpte_group; 86 unsigned long hpte_group;
86 87
87 pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT; 88 pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT;
@@ -101,14 +102,14 @@ repeat:
101 _PAGE_COHERENT | _PAGE_GUARDED)); 102 _PAGE_COHERENT | _PAGE_GUARDED));
102 103
103 /* Insert into the hash table, primary slot */ 104 /* Insert into the hash table, primary slot */
104 slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, 0, 105 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0,
105 mmu_psize, ssize); 106 mmu_psize, ssize);
106 107
107 /* Primary is full, try the secondary */ 108 /* Primary is full, try the secondary */
108 if (unlikely(slot == -1)) { 109 if (unlikely(slot == -1)) {
109 hpte_group = ((~hash & htab_hash_mask) * 110 hpte_group = ((~hash & htab_hash_mask) *
110 HPTES_PER_GROUP) & ~0x7UL; 111 HPTES_PER_GROUP) & ~0x7UL;
111 slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, 112 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags,
112 HPTE_V_SECONDARY, 113 HPTE_V_SECONDARY,
113 mmu_psize, ssize); 114 mmu_psize, ssize);
114 if (slot == -1) { 115 if (slot == -1) {
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 620b7acd2fdf..95a45293e5ac 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -62,7 +62,6 @@
62#include <asm/cputable.h> 62#include <asm/cputable.h>
63#include <asm/sections.h> 63#include <asm/sections.h>
64#include <asm/iommu.h> 64#include <asm/iommu.h>
65#include <asm/abs_addr.h>
66#include <asm/vdso.h> 65#include <asm/vdso.h>
67 66
68#include "mmu_decl.h" 67#include "mmu_decl.h"
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index fbdad0e3929a..0dba5066c22a 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -62,7 +62,7 @@
62 62
63int init_bootmem_done; 63int init_bootmem_done;
64int mem_init_done; 64int mem_init_done;
65phys_addr_t memory_limit; 65unsigned long long memory_limit;
66 66
67#ifdef CONFIG_HIGHMEM 67#ifdef CONFIG_HIGHMEM
68pte_t *kmap_pte; 68pte_t *kmap_pte;
@@ -300,8 +300,7 @@ void __init mem_init(void)
300 unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize; 300 unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
301 301
302#ifdef CONFIG_SWIOTLB 302#ifdef CONFIG_SWIOTLB
303 if (ppc_swiotlb_enable) 303 swiotlb_init(0);
304 swiotlb_init(1);
305#endif 304#endif
306 305
307 num_physpages = memblock_phys_mem_size() >> PAGE_SHIFT; 306 num_physpages = memblock_phys_mem_size() >> PAGE_SHIFT;
diff --git a/arch/powerpc/mm/mmu_context_hash64.c b/arch/powerpc/mm/mmu_context_hash64.c
index 40677aa0190e..40bc5b0ace54 100644
--- a/arch/powerpc/mm/mmu_context_hash64.c
+++ b/arch/powerpc/mm/mmu_context_hash64.c
@@ -30,11 +30,13 @@ static DEFINE_SPINLOCK(mmu_context_lock);
30static DEFINE_IDA(mmu_context_ida); 30static DEFINE_IDA(mmu_context_ida);
31 31
32/* 32/*
33 * The proto-VSID space has 2^35 - 1 segments available for user mappings. 33 * 256MB segment
34 * Each segment contains 2^28 bytes. Each context maps 2^44 bytes, 34 * The proto-VSID space has 2^(CONTEX_BITS + USER_ESID_BITS) - 1 segments
35 * so we can support 2^19-1 contexts (19 == 35 + 28 - 44). 35 * available for user mappings. Each segment contains 2^28 bytes. Each
36 * context maps 2^46 bytes (64TB) so we can support 2^19-1 contexts
37 * (19 == 37 + 28 - 46).
36 */ 38 */
37#define MAX_CONTEXT ((1UL << 19) - 1) 39#define MAX_CONTEXT ((1UL << CONTEXT_BITS) - 1)
38 40
39int __init_new_context(void) 41int __init_new_context(void)
40{ 42{
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 249a0631c4db..e212a271c7a4 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -51,13 +51,22 @@
51#include <asm/processor.h> 51#include <asm/processor.h>
52#include <asm/cputable.h> 52#include <asm/cputable.h>
53#include <asm/sections.h> 53#include <asm/sections.h>
54#include <asm/abs_addr.h>
55#include <asm/firmware.h> 54#include <asm/firmware.h>
56 55
57#include "mmu_decl.h" 56#include "mmu_decl.h"
58 57
59unsigned long ioremap_bot = IOREMAP_BASE; 58/* Some sanity checking */
59#if TASK_SIZE_USER64 > PGTABLE_RANGE
60#error TASK_SIZE_USER64 exceeds pagetable range
61#endif
62
63#ifdef CONFIG_PPC_STD_MMU_64
64#if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT))
65#error TASK_SIZE_USER64 exceeds user VSID range
66#endif
67#endif
60 68
69unsigned long ioremap_bot = IOREMAP_BASE;
61 70
62#ifdef CONFIG_PPC_MMU_NOHASH 71#ifdef CONFIG_PPC_MMU_NOHASH
63static void *early_alloc_pgtable(unsigned long size) 72static void *early_alloc_pgtable(unsigned long size)
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index b9ee79ce2200..1a16ca227757 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -56,6 +56,12 @@ _GLOBAL(slb_allocate_realmode)
56 */ 56 */
57_GLOBAL(slb_miss_kernel_load_linear) 57_GLOBAL(slb_miss_kernel_load_linear)
58 li r11,0 58 li r11,0
59 li r9,0x1
60 /*
61 * for 1T we shift 12 bits more. slb_finish_load_1T will do
62 * the necessary adjustment
63 */
64 rldimi r10,r9,(CONTEXT_BITS + USER_ESID_BITS),0
59BEGIN_FTR_SECTION 65BEGIN_FTR_SECTION
60 b slb_finish_load 66 b slb_finish_load
61END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) 67END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
@@ -85,6 +91,12 @@ _GLOBAL(slb_miss_kernel_load_vmemmap)
85 _GLOBAL(slb_miss_kernel_load_io) 91 _GLOBAL(slb_miss_kernel_load_io)
86 li r11,0 92 li r11,0
876: 936:
94 li r9,0x1
95 /*
96 * for 1T we shift 12 bits more. slb_finish_load_1T will do
97 * the necessary adjustment
98 */
99 rldimi r10,r9,(CONTEXT_BITS + USER_ESID_BITS),0
88BEGIN_FTR_SECTION 100BEGIN_FTR_SECTION
89 b slb_finish_load 101 b slb_finish_load
90END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) 102END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
@@ -108,17 +120,31 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
108 * between 4k and 64k standard page size 120 * between 4k and 64k standard page size
109 */ 121 */
110#ifdef CONFIG_PPC_MM_SLICES 122#ifdef CONFIG_PPC_MM_SLICES
123 /* r10 have esid */
111 cmpldi r10,16 124 cmpldi r10,16
112 125 /* below SLICE_LOW_TOP */
113 /* Get the slice index * 4 in r11 and matching slice size mask in r9 */
114 ld r9,PACALOWSLICESPSIZE(r13)
115 sldi r11,r10,2
116 blt 5f 126 blt 5f
117 ld r9,PACAHIGHSLICEPSIZE(r13) 127 /*
118 srdi r11,r10,(SLICE_HIGH_SHIFT - SLICE_LOW_SHIFT - 2) 128 * Handle hpsizes,
119 andi. r11,r11,0x3c 129 * r9 is get_paca()->context.high_slices_psize[index], r11 is mask_index
130 */
131 srdi r11,r10,(SLICE_HIGH_SHIFT - SLICE_LOW_SHIFT + 1) /* index */
132 addi r9,r11,PACAHIGHSLICEPSIZE
133 lbzx r9,r13,r9 /* r9 is hpsizes[r11] */
134 /* r11 = (r10 >> (SLICE_HIGH_SHIFT - SLICE_LOW_SHIFT)) & 0x1 */
135 rldicl r11,r10,(64 - (SLICE_HIGH_SHIFT - SLICE_LOW_SHIFT)),63
136 b 6f
120 137
1215: /* Extract the psize and multiply to get an array offset */ 1385:
139 /*
140 * Handle lpsizes
141 * r9 is get_paca()->context.low_slices_psize, r11 is index
142 */
143 ld r9,PACALOWSLICESPSIZE(r13)
144 mr r11,r10
1456:
146 sldi r11,r11,2 /* index * 4 */
147 /* Extract the psize and multiply to get an array offset */
122 srd r9,r9,r11 148 srd r9,r9,r11
123 andi. r9,r9,0xf 149 andi. r9,r9,0xf
124 mulli r9,r9,MMUPSIZEDEFSIZE 150 mulli r9,r9,MMUPSIZEDEFSIZE
@@ -209,7 +235,11 @@ _GLOBAL(slb_allocate_user)
209 */ 235 */
210slb_finish_load: 236slb_finish_load:
211 ASM_VSID_SCRAMBLE(r10,r9,256M) 237 ASM_VSID_SCRAMBLE(r10,r9,256M)
212 rldimi r11,r10,SLB_VSID_SHIFT,16 /* combine VSID and flags */ 238 /*
239 * bits above VSID_BITS_256M need to be ignored from r10
240 * also combine VSID and flags
241 */
242 rldimi r11,r10,SLB_VSID_SHIFT,(64 - (SLB_VSID_SHIFT + VSID_BITS_256M))
213 243
214 /* r3 = EA, r11 = VSID data */ 244 /* r3 = EA, r11 = VSID data */
215 /* 245 /*
@@ -252,10 +282,10 @@ _GLOBAL(slb_compare_rr_to_size)
252 bge 1f 282 bge 1f
253 283
254 /* still room in the slb cache */ 284 /* still room in the slb cache */
255 sldi r11,r3,1 /* r11 = offset * sizeof(u16) */ 285 sldi r11,r3,2 /* r11 = offset * sizeof(u32) */
256 rldicl r10,r10,36,28 /* get low 16 bits of the ESID */ 286 srdi r10,r10,28 /* get the 36 bits of the ESID */
257 add r11,r11,r13 /* r11 = (u16 *)paca + offset */ 287 add r11,r11,r13 /* r11 = (u32 *)paca + offset */
258 sth r10,PACASLBCACHE(r11) /* paca->slb_cache[offset] = esid */ 288 stw r10,PACASLBCACHE(r11) /* paca->slb_cache[offset] = esid */
259 addi r3,r3,1 /* offset++ */ 289 addi r3,r3,1 /* offset++ */
260 b 2f 290 b 2f
2611: /* offset >= SLB_CACHE_ENTRIES */ 2911: /* offset >= SLB_CACHE_ENTRIES */
@@ -273,7 +303,11 @@ _GLOBAL(slb_compare_rr_to_size)
273slb_finish_load_1T: 303slb_finish_load_1T:
274 srdi r10,r10,40-28 /* get 1T ESID */ 304 srdi r10,r10,40-28 /* get 1T ESID */
275 ASM_VSID_SCRAMBLE(r10,r9,1T) 305 ASM_VSID_SCRAMBLE(r10,r9,1T)
276 rldimi r11,r10,SLB_VSID_SHIFT_1T,16 /* combine VSID and flags */ 306 /*
307 * bits above VSID_BITS_1T need to be ignored from r10
308 * also combine VSID and flags
309 */
310 rldimi r11,r10,SLB_VSID_SHIFT_1T,(64 - (SLB_VSID_SHIFT_1T + VSID_BITS_1T))
277 li r10,MMU_SEGSIZE_1T 311 li r10,MMU_SEGSIZE_1T
278 rldimi r11,r10,SLB_VSID_SSIZE_SHIFT,0 /* insert segment size */ 312 rldimi r11,r10,SLB_VSID_SSIZE_SHIFT,0 /* insert segment size */
279 313
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 73709f7ce92c..5829d2a950d4 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -34,6 +34,11 @@
34#include <asm/mmu.h> 34#include <asm/mmu.h>
35#include <asm/spu.h> 35#include <asm/spu.h>
36 36
37/* some sanity checks */
38#if (PGTABLE_RANGE >> 43) > SLICE_MASK_SIZE
39#error PGTABLE_RANGE exceeds slice_mask high_slices size
40#endif
41
37static DEFINE_SPINLOCK(slice_convert_lock); 42static DEFINE_SPINLOCK(slice_convert_lock);
38 43
39 44
@@ -42,7 +47,7 @@ int _slice_debug = 1;
42 47
43static void slice_print_mask(const char *label, struct slice_mask mask) 48static void slice_print_mask(const char *label, struct slice_mask mask)
44{ 49{
45 char *p, buf[16 + 3 + 16 + 1]; 50 char *p, buf[16 + 3 + 64 + 1];
46 int i; 51 int i;
47 52
48 if (!_slice_debug) 53 if (!_slice_debug)
@@ -54,7 +59,7 @@ static void slice_print_mask(const char *label, struct slice_mask mask)
54 *(p++) = '-'; 59 *(p++) = '-';
55 *(p++) = ' '; 60 *(p++) = ' ';
56 for (i = 0; i < SLICE_NUM_HIGH; i++) 61 for (i = 0; i < SLICE_NUM_HIGH; i++)
57 *(p++) = (mask.high_slices & (1 << i)) ? '1' : '0'; 62 *(p++) = (mask.high_slices & (1ul << i)) ? '1' : '0';
58 *(p++) = 0; 63 *(p++) = 0;
59 64
60 printk(KERN_DEBUG "%s:%s\n", label, buf); 65 printk(KERN_DEBUG "%s:%s\n", label, buf);
@@ -84,8 +89,8 @@ static struct slice_mask slice_range_to_mask(unsigned long start,
84 } 89 }
85 90
86 if ((start + len) > SLICE_LOW_TOP) 91 if ((start + len) > SLICE_LOW_TOP)
87 ret.high_slices = (1u << (GET_HIGH_SLICE_INDEX(end) + 1)) 92 ret.high_slices = (1ul << (GET_HIGH_SLICE_INDEX(end) + 1))
88 - (1u << GET_HIGH_SLICE_INDEX(start)); 93 - (1ul << GET_HIGH_SLICE_INDEX(start));
89 94
90 return ret; 95 return ret;
91} 96}
@@ -135,26 +140,31 @@ static struct slice_mask slice_mask_for_free(struct mm_struct *mm)
135 140
136 for (i = 0; i < SLICE_NUM_HIGH; i++) 141 for (i = 0; i < SLICE_NUM_HIGH; i++)
137 if (!slice_high_has_vma(mm, i)) 142 if (!slice_high_has_vma(mm, i))
138 ret.high_slices |= 1u << i; 143 ret.high_slices |= 1ul << i;
139 144
140 return ret; 145 return ret;
141} 146}
142 147
143static struct slice_mask slice_mask_for_size(struct mm_struct *mm, int psize) 148static struct slice_mask slice_mask_for_size(struct mm_struct *mm, int psize)
144{ 149{
150 unsigned char *hpsizes;
151 int index, mask_index;
145 struct slice_mask ret = { 0, 0 }; 152 struct slice_mask ret = { 0, 0 };
146 unsigned long i; 153 unsigned long i;
147 u64 psizes; 154 u64 lpsizes;
148 155
149 psizes = mm->context.low_slices_psize; 156 lpsizes = mm->context.low_slices_psize;
150 for (i = 0; i < SLICE_NUM_LOW; i++) 157 for (i = 0; i < SLICE_NUM_LOW; i++)
151 if (((psizes >> (i * 4)) & 0xf) == psize) 158 if (((lpsizes >> (i * 4)) & 0xf) == psize)
152 ret.low_slices |= 1u << i; 159 ret.low_slices |= 1u << i;
153 160
154 psizes = mm->context.high_slices_psize; 161 hpsizes = mm->context.high_slices_psize;
155 for (i = 0; i < SLICE_NUM_HIGH; i++) 162 for (i = 0; i < SLICE_NUM_HIGH; i++) {
156 if (((psizes >> (i * 4)) & 0xf) == psize) 163 mask_index = i & 0x1;
157 ret.high_slices |= 1u << i; 164 index = i >> 1;
165 if (((hpsizes[index] >> (mask_index * 4)) & 0xf) == psize)
166 ret.high_slices |= 1ul << i;
167 }
158 168
159 return ret; 169 return ret;
160} 170}
@@ -183,8 +193,10 @@ static void slice_flush_segments(void *parm)
183 193
184static void slice_convert(struct mm_struct *mm, struct slice_mask mask, int psize) 194static void slice_convert(struct mm_struct *mm, struct slice_mask mask, int psize)
185{ 195{
196 int index, mask_index;
186 /* Write the new slice psize bits */ 197 /* Write the new slice psize bits */
187 u64 lpsizes, hpsizes; 198 unsigned char *hpsizes;
199 u64 lpsizes;
188 unsigned long i, flags; 200 unsigned long i, flags;
189 201
190 slice_dbg("slice_convert(mm=%p, psize=%d)\n", mm, psize); 202 slice_dbg("slice_convert(mm=%p, psize=%d)\n", mm, psize);
@@ -201,14 +213,18 @@ static void slice_convert(struct mm_struct *mm, struct slice_mask mask, int psiz
201 lpsizes = (lpsizes & ~(0xful << (i * 4))) | 213 lpsizes = (lpsizes & ~(0xful << (i * 4))) |
202 (((unsigned long)psize) << (i * 4)); 214 (((unsigned long)psize) << (i * 4));
203 215
204 hpsizes = mm->context.high_slices_psize; 216 /* Assign the value back */
205 for (i = 0; i < SLICE_NUM_HIGH; i++)
206 if (mask.high_slices & (1u << i))
207 hpsizes = (hpsizes & ~(0xful << (i * 4))) |
208 (((unsigned long)psize) << (i * 4));
209
210 mm->context.low_slices_psize = lpsizes; 217 mm->context.low_slices_psize = lpsizes;
211 mm->context.high_slices_psize = hpsizes; 218
219 hpsizes = mm->context.high_slices_psize;
220 for (i = 0; i < SLICE_NUM_HIGH; i++) {
221 mask_index = i & 0x1;
222 index = i >> 1;
223 if (mask.high_slices & (1ul << i))
224 hpsizes[index] = (hpsizes[index] &
225 ~(0xf << (mask_index * 4))) |
226 (((unsigned long)psize) << (mask_index * 4));
227 }
212 228
213 slice_dbg(" lsps=%lx, hsps=%lx\n", 229 slice_dbg(" lsps=%lx, hsps=%lx\n",
214 mm->context.low_slices_psize, 230 mm->context.low_slices_psize,
@@ -587,18 +603,19 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp,
587 603
588unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr) 604unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr)
589{ 605{
590 u64 psizes; 606 unsigned char *hpsizes;
591 int index; 607 int index, mask_index;
592 608
593 if (addr < SLICE_LOW_TOP) { 609 if (addr < SLICE_LOW_TOP) {
594 psizes = mm->context.low_slices_psize; 610 u64 lpsizes;
611 lpsizes = mm->context.low_slices_psize;
595 index = GET_LOW_SLICE_INDEX(addr); 612 index = GET_LOW_SLICE_INDEX(addr);
596 } else { 613 return (lpsizes >> (index * 4)) & 0xf;
597 psizes = mm->context.high_slices_psize;
598 index = GET_HIGH_SLICE_INDEX(addr);
599 } 614 }
600 615 hpsizes = mm->context.high_slices_psize;
601 return (psizes >> (index * 4)) & 0xf; 616 index = GET_HIGH_SLICE_INDEX(addr);
617 mask_index = index & 0x1;
618 return (hpsizes[index >> 1] >> (mask_index * 4)) & 0xf;
602} 619}
603EXPORT_SYMBOL_GPL(get_slice_psize); 620EXPORT_SYMBOL_GPL(get_slice_psize);
604 621
@@ -618,7 +635,9 @@ EXPORT_SYMBOL_GPL(get_slice_psize);
618 */ 635 */
619void slice_set_user_psize(struct mm_struct *mm, unsigned int psize) 636void slice_set_user_psize(struct mm_struct *mm, unsigned int psize)
620{ 637{
621 unsigned long flags, lpsizes, hpsizes; 638 int index, mask_index;
639 unsigned char *hpsizes;
640 unsigned long flags, lpsizes;
622 unsigned int old_psize; 641 unsigned int old_psize;
623 int i; 642 int i;
624 643
@@ -639,15 +658,21 @@ void slice_set_user_psize(struct mm_struct *mm, unsigned int psize)
639 if (((lpsizes >> (i * 4)) & 0xf) == old_psize) 658 if (((lpsizes >> (i * 4)) & 0xf) == old_psize)
640 lpsizes = (lpsizes & ~(0xful << (i * 4))) | 659 lpsizes = (lpsizes & ~(0xful << (i * 4))) |
641 (((unsigned long)psize) << (i * 4)); 660 (((unsigned long)psize) << (i * 4));
661 /* Assign the value back */
662 mm->context.low_slices_psize = lpsizes;
642 663
643 hpsizes = mm->context.high_slices_psize; 664 hpsizes = mm->context.high_slices_psize;
644 for (i = 0; i < SLICE_NUM_HIGH; i++) 665 for (i = 0; i < SLICE_NUM_HIGH; i++) {
645 if (((hpsizes >> (i * 4)) & 0xf) == old_psize) 666 mask_index = i & 0x1;
646 hpsizes = (hpsizes & ~(0xful << (i * 4))) | 667 index = i >> 1;
647 (((unsigned long)psize) << (i * 4)); 668 if (((hpsizes[index] >> (mask_index * 4)) & 0xf) == old_psize)
669 hpsizes[index] = (hpsizes[index] &
670 ~(0xf << (mask_index * 4))) |
671 (((unsigned long)psize) << (mask_index * 4));
672 }
673
674
648 675
649 mm->context.low_slices_psize = lpsizes;
650 mm->context.high_slices_psize = hpsizes;
651 676
652 slice_dbg(" lsps=%lx, hsps=%lx\n", 677 slice_dbg(" lsps=%lx, hsps=%lx\n",
653 mm->context.low_slices_psize, 678 mm->context.low_slices_psize,
@@ -660,18 +685,27 @@ void slice_set_user_psize(struct mm_struct *mm, unsigned int psize)
660void slice_set_psize(struct mm_struct *mm, unsigned long address, 685void slice_set_psize(struct mm_struct *mm, unsigned long address,
661 unsigned int psize) 686 unsigned int psize)
662{ 687{
688 unsigned char *hpsizes;
663 unsigned long i, flags; 689 unsigned long i, flags;
664 u64 *p; 690 u64 *lpsizes;
665 691
666 spin_lock_irqsave(&slice_convert_lock, flags); 692 spin_lock_irqsave(&slice_convert_lock, flags);
667 if (address < SLICE_LOW_TOP) { 693 if (address < SLICE_LOW_TOP) {
668 i = GET_LOW_SLICE_INDEX(address); 694 i = GET_LOW_SLICE_INDEX(address);
669 p = &mm->context.low_slices_psize; 695 lpsizes = &mm->context.low_slices_psize;
696 *lpsizes = (*lpsizes & ~(0xful << (i * 4))) |
697 ((unsigned long) psize << (i * 4));
670 } else { 698 } else {
699 int index, mask_index;
671 i = GET_HIGH_SLICE_INDEX(address); 700 i = GET_HIGH_SLICE_INDEX(address);
672 p = &mm->context.high_slices_psize; 701 hpsizes = mm->context.high_slices_psize;
702 mask_index = i & 0x1;
703 index = i >> 1;
704 hpsizes[index] = (hpsizes[index] &
705 ~(0xf << (mask_index * 4))) |
706 (((unsigned long)psize) << (mask_index * 4));
673 } 707 }
674 *p = (*p & ~(0xful << (i * 4))) | ((unsigned long) psize << (i * 4)); 708
675 spin_unlock_irqrestore(&slice_convert_lock, flags); 709 spin_unlock_irqrestore(&slice_convert_lock, flags);
676 710
677#ifdef CONFIG_SPU_BASE 711#ifdef CONFIG_SPU_BASE
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 9106ebb118f5..3f8efa6f2997 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -20,7 +20,6 @@
20#include <asm/paca.h> 20#include <asm/paca.h>
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>
24 23
25struct stab_entry { 24struct stab_entry {
26 unsigned long esid_data; 25 unsigned long esid_data;
@@ -257,7 +256,7 @@ void __init stabs_alloc(void)
257 memset((void *)newstab, 0, HW_PAGE_SIZE); 256 memset((void *)newstab, 0, HW_PAGE_SIZE);
258 257
259 paca[cpu].stab_addr = newstab; 258 paca[cpu].stab_addr = newstab;
260 paca[cpu].stab_real = virt_to_abs(newstab); 259 paca[cpu].stab_real = __pa(newstab);
261 printk(KERN_INFO "Segment table for CPU %d at 0x%llx " 260 printk(KERN_INFO "Segment table for CPU %d at 0x%llx "
262 "virtual, 0x%llx absolute\n", 261 "virtual, 0x%llx absolute\n",
263 cpu, paca[cpu].stab_addr, paca[cpu].stab_real); 262 cpu, paca[cpu].stab_addr, paca[cpu].stab_real);
diff --git a/arch/powerpc/mm/subpage-prot.c b/arch/powerpc/mm/subpage-prot.c
index e4f8f1fc81a5..7c415ddde948 100644
--- a/arch/powerpc/mm/subpage-prot.c
+++ b/arch/powerpc/mm/subpage-prot.c
@@ -95,7 +95,8 @@ static void subpage_prot_clear(unsigned long addr, unsigned long len)
95 struct mm_struct *mm = current->mm; 95 struct mm_struct *mm = current->mm;
96 struct subpage_prot_table *spt = &mm->context.spt; 96 struct subpage_prot_table *spt = &mm->context.spt;
97 u32 **spm, *spp; 97 u32 **spm, *spp;
98 int i, nw; 98 unsigned long i;
99 size_t nw;
99 unsigned long next, limit; 100 unsigned long next, limit;
100 101
101 down_write(&mm->mmap_sem); 102 down_write(&mm->mmap_sem);
@@ -144,7 +145,8 @@ long sys_subpage_prot(unsigned long addr, unsigned long len, u32 __user *map)
144 struct mm_struct *mm = current->mm; 145 struct mm_struct *mm = current->mm;
145 struct subpage_prot_table *spt = &mm->context.spt; 146 struct subpage_prot_table *spt = &mm->context.spt;
146 u32 **spm, *spp; 147 u32 **spm, *spp;
147 int i, nw; 148 unsigned long i;
149 size_t nw;
148 unsigned long next, limit; 150 unsigned long next, limit;
149 int err; 151 int err;
150 152
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
index 31f18207970b..ae758b3ff72c 100644
--- a/arch/powerpc/mm/tlb_hash64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -42,8 +42,9 @@ DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
42void hpte_need_flush(struct mm_struct *mm, unsigned long addr, 42void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
43 pte_t *ptep, unsigned long pte, int huge) 43 pte_t *ptep, unsigned long pte, int huge)
44{ 44{
45 unsigned long vpn;
45 struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch); 46 struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch);
46 unsigned long vsid, vaddr; 47 unsigned long vsid;
47 unsigned int psize; 48 unsigned int psize;
48 int ssize; 49 int ssize;
49 real_pte_t rpte; 50 real_pte_t rpte;
@@ -86,7 +87,7 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
86 vsid = get_kernel_vsid(addr, mmu_kernel_ssize); 87 vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
87 ssize = mmu_kernel_ssize; 88 ssize = mmu_kernel_ssize;
88 } 89 }
89 vaddr = hpt_va(addr, vsid, ssize); 90 vpn = hpt_vpn(addr, vsid, ssize);
90 rpte = __real_pte(__pte(pte), ptep); 91 rpte = __real_pte(__pte(pte), ptep);
91 92
92 /* 93 /*
@@ -96,7 +97,7 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
96 * and decide to use local invalidates instead... 97 * and decide to use local invalidates instead...
97 */ 98 */
98 if (!batch->active) { 99 if (!batch->active) {
99 flush_hash_page(vaddr, rpte, psize, ssize, 0); 100 flush_hash_page(vpn, rpte, psize, ssize, 0);
100 put_cpu_var(ppc64_tlb_batch); 101 put_cpu_var(ppc64_tlb_batch);
101 return; 102 return;
102 } 103 }
@@ -122,7 +123,7 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
122 batch->ssize = ssize; 123 batch->ssize = ssize;
123 } 124 }
124 batch->pte[i] = rpte; 125 batch->pte[i] = rpte;
125 batch->vaddr[i] = vaddr; 126 batch->vpn[i] = vpn;
126 batch->index = ++i; 127 batch->index = ++i;
127 if (i >= PPC64_TLB_BATCH_NR) 128 if (i >= PPC64_TLB_BATCH_NR)
128 __flush_tlb_pending(batch); 129 __flush_tlb_pending(batch);
@@ -146,7 +147,7 @@ void __flush_tlb_pending(struct ppc64_tlb_batch *batch)
146 if (cpumask_equal(mm_cpumask(batch->mm), tmp)) 147 if (cpumask_equal(mm_cpumask(batch->mm), tmp))
147 local = 1; 148 local = 1;
148 if (i == 1) 149 if (i == 1)
149 flush_hash_page(batch->vaddr[0], batch->pte[0], 150 flush_hash_page(batch->vpn[0], batch->pte[0],
150 batch->psize, batch->ssize, local); 151 batch->psize, batch->ssize, local);
151 else 152 else
152 flush_hash_range(i, local); 153 flush_hash_range(i, local);
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index f09d48e3268d..b4113bf86353 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -20,6 +20,8 @@
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21#include <asm/exception-64e.h> 21#include <asm/exception-64e.h>
22#include <asm/ppc-opcode.h> 22#include <asm/ppc-opcode.h>
23#include <asm/kvm_asm.h>
24#include <asm/kvm_booke_hv_asm.h>
23 25
24#ifdef CONFIG_PPC_64K_PAGES 26#ifdef CONFIG_PPC_64K_PAGES
25#define VPTE_PMD_SHIFT (PTE_INDEX_SIZE+1) 27#define VPTE_PMD_SHIFT (PTE_INDEX_SIZE+1)
@@ -37,12 +39,18 @@
37 * * 39 * *
38 **********************************************************************/ 40 **********************************************************************/
39 41
40.macro tlb_prolog_bolted addr 42.macro tlb_prolog_bolted intnum addr
41 mtspr SPRN_SPRG_TLB_SCRATCH,r13 43 mtspr SPRN_SPRG_GEN_SCRATCH,r13
42 mfspr r13,SPRN_SPRG_PACA 44 mfspr r13,SPRN_SPRG_PACA
43 std r10,PACA_EXTLB+EX_TLB_R10(r13) 45 std r10,PACA_EXTLB+EX_TLB_R10(r13)
44 mfcr r10 46 mfcr r10
45 std r11,PACA_EXTLB+EX_TLB_R11(r13) 47 std r11,PACA_EXTLB+EX_TLB_R11(r13)
48#ifdef CONFIG_KVM_BOOKE_HV
49BEGIN_FTR_SECTION
50 mfspr r11, SPRN_SRR1
51END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
52#endif
53 DO_KVM \intnum, SPRN_SRR1
46 std r16,PACA_EXTLB+EX_TLB_R16(r13) 54 std r16,PACA_EXTLB+EX_TLB_R16(r13)
47 mfspr r16,\addr /* get faulting address */ 55 mfspr r16,\addr /* get faulting address */
48 std r14,PACA_EXTLB+EX_TLB_R14(r13) 56 std r14,PACA_EXTLB+EX_TLB_R14(r13)
@@ -61,12 +69,12 @@
61 ld r15,PACA_EXTLB+EX_TLB_R15(r13) 69 ld r15,PACA_EXTLB+EX_TLB_R15(r13)
62 TLB_MISS_RESTORE_STATS_BOLTED 70 TLB_MISS_RESTORE_STATS_BOLTED
63 ld r16,PACA_EXTLB+EX_TLB_R16(r13) 71 ld r16,PACA_EXTLB+EX_TLB_R16(r13)
64 mfspr r13,SPRN_SPRG_TLB_SCRATCH 72 mfspr r13,SPRN_SPRG_GEN_SCRATCH
65.endm 73.endm
66 74
67/* Data TLB miss */ 75/* Data TLB miss */
68 START_EXCEPTION(data_tlb_miss_bolted) 76 START_EXCEPTION(data_tlb_miss_bolted)
69 tlb_prolog_bolted SPRN_DEAR 77 tlb_prolog_bolted BOOKE_INTERRUPT_DTLB_MISS SPRN_DEAR
70 78
71 /* We need _PAGE_PRESENT and _PAGE_ACCESSED set */ 79 /* We need _PAGE_PRESENT and _PAGE_ACCESSED set */
72 80
@@ -214,7 +222,7 @@ itlb_miss_fault_bolted:
214 222
215/* Instruction TLB miss */ 223/* Instruction TLB miss */
216 START_EXCEPTION(instruction_tlb_miss_bolted) 224 START_EXCEPTION(instruction_tlb_miss_bolted)
217 tlb_prolog_bolted SPRN_SRR0 225 tlb_prolog_bolted BOOKE_INTERRUPT_ITLB_MISS SPRN_SRR0
218 226
219 rldicl. r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4 227 rldicl. r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4
220 srdi r15,r16,60 /* get region */ 228 srdi r15,r16,60 /* get region */
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 95ae77dec3f6..315f9495e9b2 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -21,6 +21,13 @@
21#include <asm/reg.h> 21#include <asm/reg.h>
22 22
23#define dbg(args...) 23#define dbg(args...)
24#define OPROFILE_PM_PMCSEL_MSK 0xffULL
25#define OPROFILE_PM_UNIT_SHIFT 60
26#define OPROFILE_PM_UNIT_MSK 0xfULL
27#define OPROFILE_MAX_PMC_NUM 3
28#define OPROFILE_PMSEL_FIELD_WIDTH 8
29#define OPROFILE_UNIT_FIELD_WIDTH 4
30#define MMCRA_SIAR_VALID_MASK 0x10000000ULL
24 31
25static unsigned long reset_value[OP_MAX_COUNTER]; 32static unsigned long reset_value[OP_MAX_COUNTER];
26 33
@@ -31,6 +38,61 @@ static int use_slot_nums;
31static u32 mmcr0_val; 38static u32 mmcr0_val;
32static u64 mmcr1_val; 39static u64 mmcr1_val;
33static u64 mmcra_val; 40static u64 mmcra_val;
41static u32 cntr_marked_events;
42
43static int power7_marked_instr_event(u64 mmcr1)
44{
45 u64 psel, unit;
46 int pmc, cntr_marked_events = 0;
47
48 /* Given the MMCR1 value, look at the field for each counter to
49 * determine if it is a marked event. Code based on the function
50 * power7_marked_instr_event() in file arch/powerpc/perf/power7-pmu.c.
51 */
52 for (pmc = 0; pmc < 4; pmc++) {
53 psel = mmcr1 & (OPROFILE_PM_PMCSEL_MSK
54 << (OPROFILE_MAX_PMC_NUM - pmc)
55 * OPROFILE_MAX_PMC_NUM);
56 psel = (psel >> ((OPROFILE_MAX_PMC_NUM - pmc)
57 * OPROFILE_PMSEL_FIELD_WIDTH)) & ~1ULL;
58 unit = mmcr1 & (OPROFILE_PM_UNIT_MSK
59 << (OPROFILE_PM_UNIT_SHIFT
60 - (pmc * OPROFILE_PMSEL_FIELD_WIDTH )));
61 unit = unit >> (OPROFILE_PM_UNIT_SHIFT
62 - (pmc * OPROFILE_PMSEL_FIELD_WIDTH));
63
64 switch (psel >> 4) {
65 case 2:
66 cntr_marked_events |= (pmc == 1 || pmc == 3) << pmc;
67 break;
68 case 3:
69 if (psel == 0x3c) {
70 cntr_marked_events |= (pmc == 0) << pmc;
71 break;
72 }
73
74 if (psel == 0x3e) {
75 cntr_marked_events |= (pmc != 1) << pmc;
76 break;
77 }
78
79 cntr_marked_events |= 1 << pmc;
80 break;
81 case 4:
82 case 5:
83 cntr_marked_events |= (unit == 0xd) << pmc;
84 break;
85 case 6:
86 if (psel == 0x64)
87 cntr_marked_events |= (pmc >= 2) << pmc;
88 break;
89 case 8:
90 cntr_marked_events |= (unit == 0xd) << pmc;
91 break;
92 }
93 }
94 return cntr_marked_events;
95}
34 96
35static int power4_reg_setup(struct op_counter_config *ctr, 97static int power4_reg_setup(struct op_counter_config *ctr,
36 struct op_system_config *sys, 98 struct op_system_config *sys,
@@ -47,6 +109,23 @@ static int power4_reg_setup(struct op_counter_config *ctr,
47 mmcr1_val = sys->mmcr1; 109 mmcr1_val = sys->mmcr1;
48 mmcra_val = sys->mmcra; 110 mmcra_val = sys->mmcra;
49 111
112 /* Power 7+ and newer architectures:
113 * Determine which counter events in the group (the group of events is
114 * specified by the bit settings in the MMCR1 register) are marked
115 * events for use in the interrupt handler. Do the calculation once
116 * before OProfile starts. Information is used in the interrupt
117 * handler. Starting with Power 7+ we only record the sample for
118 * marked events if the SIAR valid bit is set. For non marked events
119 * the sample is always recorded.
120 */
121 if (pvr_version_is(PVR_POWER7p))
122 cntr_marked_events = power7_marked_instr_event(mmcr1_val);
123 else
124 cntr_marked_events = 0; /* For older processors, set the bit map
125 * to zero so the sample will always be
126 * be recorded.
127 */
128
50 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) 129 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i)
51 reset_value[i] = 0x80000000UL - ctr[i].count; 130 reset_value[i] = 0x80000000UL - ctr[i].count;
52 131
@@ -61,10 +140,10 @@ static int power4_reg_setup(struct op_counter_config *ctr,
61 else 140 else
62 mmcr0_val |= MMCR0_PROBLEM_DISABLE; 141 mmcr0_val |= MMCR0_PROBLEM_DISABLE;
63 142
64 if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p) || 143 if (pvr_version_is(PVR_POWER4) || pvr_version_is(PVR_POWER4p) ||
65 __is_processor(PV_970) || __is_processor(PV_970FX) || 144 pvr_version_is(PVR_970) || pvr_version_is(PVR_970FX) ||
66 __is_processor(PV_970MP) || __is_processor(PV_970GX) || 145 pvr_version_is(PVR_970MP) || pvr_version_is(PVR_970GX) ||
67 __is_processor(PV_POWER5) || __is_processor(PV_POWER5p)) 146 pvr_version_is(PVR_POWER5) || pvr_version_is(PVR_POWER5p))
68 use_slot_nums = 1; 147 use_slot_nums = 1;
69 148
70 return 0; 149 return 0;
@@ -84,9 +163,9 @@ extern void ppc_enable_pmcs(void);
84 */ 163 */
85static inline int mmcra_must_set_sample(void) 164static inline int mmcra_must_set_sample(void)
86{ 165{
87 if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p) || 166 if (pvr_version_is(PVR_POWER4) || pvr_version_is(PVR_POWER4p) ||
88 __is_processor(PV_970) || __is_processor(PV_970FX) || 167 pvr_version_is(PVR_970) || pvr_version_is(PVR_970FX) ||
89 __is_processor(PV_970MP) || __is_processor(PV_970GX)) 168 pvr_version_is(PVR_970MP) || pvr_version_is(PVR_970GX))
90 return 1; 169 return 1;
91 170
92 return 0; 171 return 0;
@@ -276,7 +355,7 @@ static bool pmc_overflow(unsigned long val)
276 * PMCs because a user might set a period of less than 256 and we 355 * PMCs because a user might set a period of less than 256 and we
277 * don't want to mistakenly reset them. 356 * don't want to mistakenly reset them.
278 */ 357 */
279 if (__is_processor(PV_POWER7) && ((0x80000000 - val) <= 256)) 358 if (pvr_version_is(PVR_POWER7) && ((0x80000000 - val) <= 256))
280 return true; 359 return true;
281 360
282 return false; 361 return false;
@@ -291,6 +370,7 @@ static void power4_handle_interrupt(struct pt_regs *regs,
291 int i; 370 int i;
292 unsigned int mmcr0; 371 unsigned int mmcr0;
293 unsigned long mmcra; 372 unsigned long mmcra;
373 bool siar_valid = false;
294 374
295 mmcra = mfspr(SPRN_MMCRA); 375 mmcra = mfspr(SPRN_MMCRA);
296 376
@@ -300,11 +380,29 @@ static void power4_handle_interrupt(struct pt_regs *regs,
300 /* set the PMM bit (see comment below) */ 380 /* set the PMM bit (see comment below) */
301 mtmsrd(mfmsr() | MSR_PMM); 381 mtmsrd(mfmsr() | MSR_PMM);
302 382
383 /* Check that the SIAR valid bit in MMCRA is set to 1. */
384 if ((mmcra & MMCRA_SIAR_VALID_MASK) == MMCRA_SIAR_VALID_MASK)
385 siar_valid = true;
386
303 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) { 387 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) {
304 val = classic_ctr_read(i); 388 val = classic_ctr_read(i);
305 if (pmc_overflow(val)) { 389 if (pmc_overflow(val)) {
306 if (oprofile_running && ctr[i].enabled) { 390 if (oprofile_running && ctr[i].enabled) {
307 oprofile_add_ext_sample(pc, regs, i, is_kernel); 391 /* Power 7+ and newer architectures:
392 * If the event is a marked event, then only
393 * save the sample if the SIAR valid bit is
394 * set. If the event is not marked, then
395 * always save the sample.
396 * Note, the Sample enable bit in the MMCRA
397 * register must be set to 1 if the group
398 * contains a marked event.
399 */
400 if ((siar_valid &&
401 (cntr_marked_events & (1 << i)))
402 || !(cntr_marked_events & (1 << i)))
403 oprofile_add_ext_sample(pc, regs, i,
404 is_kernel);
405
308 classic_ctr_write(i, reset_value[i]); 406 classic_ctr_write(i, reset_value[i]);
309 } else { 407 } else {
310 classic_ctr_write(i, 0); 408 classic_ctr_write(i, 0);
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 7cd2dbd6e4c4..0db88f501f91 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -82,6 +82,11 @@ static inline int perf_intr_is_nmi(struct pt_regs *regs)
82 return 0; 82 return 0;
83} 83}
84 84
85static inline int siar_valid(struct pt_regs *regs)
86{
87 return 1;
88}
89
85#endif /* CONFIG_PPC32 */ 90#endif /* CONFIG_PPC32 */
86 91
87/* 92/*
@@ -106,14 +111,20 @@ static inline unsigned long perf_ip_adjust(struct pt_regs *regs)
106 * If we're not doing instruction sampling, give them the SDAR 111 * If we're not doing instruction sampling, give them the SDAR
107 * (sampled data address). If we are doing instruction sampling, then 112 * (sampled data address). If we are doing instruction sampling, then
108 * only give them the SDAR if it corresponds to the instruction 113 * only give them the SDAR if it corresponds to the instruction
109 * pointed to by SIAR; this is indicated by the [POWER6_]MMCRA_SDSYNC 114 * pointed to by SIAR; this is indicated by the [POWER6_]MMCRA_SDSYNC or
110 * bit in MMCRA. 115 * the [POWER7P_]MMCRA_SDAR_VALID bit in MMCRA.
111 */ 116 */
112static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp) 117static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
113{ 118{
114 unsigned long mmcra = regs->dsisr; 119 unsigned long mmcra = regs->dsisr;
115 unsigned long sdsync = (ppmu->flags & PPMU_ALT_SIPR) ? 120 unsigned long sdsync;
116 POWER6_MMCRA_SDSYNC : MMCRA_SDSYNC; 121
122 if (ppmu->flags & PPMU_SIAR_VALID)
123 sdsync = POWER7P_MMCRA_SDAR_VALID;
124 else if (ppmu->flags & PPMU_ALT_SIPR)
125 sdsync = POWER6_MMCRA_SDSYNC;
126 else
127 sdsync = MMCRA_SDSYNC;
117 128
118 if (!(mmcra & MMCRA_SAMPLE_ENABLE) || (mmcra & sdsync)) 129 if (!(mmcra & MMCRA_SAMPLE_ENABLE) || (mmcra & sdsync))
119 *addrp = mfspr(SPRN_SDAR); 130 *addrp = mfspr(SPRN_SDAR);
@@ -230,6 +241,24 @@ static inline int perf_intr_is_nmi(struct pt_regs *regs)
230 return !regs->softe; 241 return !regs->softe;
231} 242}
232 243
244/*
245 * On processors like P7+ that have the SIAR-Valid bit, marked instructions
246 * must be sampled only if the SIAR-valid bit is set.
247 *
248 * For unmarked instructions and for processors that don't have the SIAR-Valid
249 * bit, assume that SIAR is valid.
250 */
251static inline int siar_valid(struct pt_regs *regs)
252{
253 unsigned long mmcra = regs->dsisr;
254 int marked = mmcra & MMCRA_SAMPLE_ENABLE;
255
256 if ((ppmu->flags & PPMU_SIAR_VALID) && marked)
257 return mmcra & POWER7P_MMCRA_SIAR_VALID;
258
259 return 1;
260}
261
233#endif /* CONFIG_PPC64 */ 262#endif /* CONFIG_PPC64 */
234 263
235static void perf_event_interrupt(struct pt_regs *regs); 264static void perf_event_interrupt(struct pt_regs *regs);
@@ -1291,6 +1320,7 @@ struct pmu power_pmu = {
1291 .event_idx = power_pmu_event_idx, 1320 .event_idx = power_pmu_event_idx,
1292}; 1321};
1293 1322
1323
1294/* 1324/*
1295 * A counter has overflowed; update its count and record 1325 * A counter has overflowed; update its count and record
1296 * things if requested. Note that interrupts are hard-disabled 1326 * things if requested. Note that interrupts are hard-disabled
@@ -1324,7 +1354,7 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
1324 left += period; 1354 left += period;
1325 if (left <= 0) 1355 if (left <= 0)
1326 left = period; 1356 left = period;
1327 record = 1; 1357 record = siar_valid(regs);
1328 event->hw.last_period = event->hw.sample_period; 1358 event->hw.last_period = event->hw.sample_period;
1329 } 1359 }
1330 if (left < 0x80000000LL) 1360 if (left < 0x80000000LL)
@@ -1374,8 +1404,10 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs)
1374{ 1404{
1375 unsigned long use_siar = regs->result; 1405 unsigned long use_siar = regs->result;
1376 1406
1377 if (use_siar) 1407 if (use_siar && siar_valid(regs))
1378 return mfspr(SPRN_SIAR) + perf_ip_adjust(regs); 1408 return mfspr(SPRN_SIAR) + perf_ip_adjust(regs);
1409 else if (use_siar)
1410 return 0; // no valid instruction pointer
1379 else 1411 else
1380 return regs->nip; 1412 return regs->nip;
1381} 1413}
@@ -1396,7 +1428,7 @@ static bool pmc_overflow(unsigned long val)
1396 * PMCs because a user might set a period of less than 256 and we 1428 * PMCs because a user might set a period of less than 256 and we
1397 * don't want to mistakenly reset them. 1429 * don't want to mistakenly reset them.
1398 */ 1430 */
1399 if (__is_processor(PV_POWER7) && ((0x80000000 - val) <= 256)) 1431 if (pvr_version_is(PVR_POWER7) && ((0x80000000 - val) <= 256))
1400 return true; 1432 return true;
1401 1433
1402 return false; 1434 return false;
diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c
index 1251e4d7e262..441af08edf43 100644
--- a/arch/powerpc/perf/power7-pmu.c
+++ b/arch/powerpc/perf/power7-pmu.c
@@ -373,6 +373,9 @@ static int __init init_power7_pmu(void)
373 strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power7")) 373 strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power7"))
374 return -ENODEV; 374 return -ENODEV;
375 375
376 if (pvr_version_is(PVR_POWER7p))
377 power7_pmu.flags |= PPMU_SIAR_VALID;
378
376 return register_power_pmu(&power7_pmu); 379 return register_power_pmu(&power7_pmu);
377} 380}
378 381
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index 97612068fae3..969dddcf3320 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -50,7 +50,7 @@ machine_device_initcall(ppc40x_simple, ppc40x_device_probe);
50 * Again, if your board needs to do things differently then create a 50 * Again, if your board needs to do things differently then create a
51 * board.c file for it rather than adding it to this list. 51 * board.c file for it rather than adding it to this list.
52 */ 52 */
53static const char *board[] __initdata = { 53static const char * const board[] __initconst = {
54 "amcc,acadia", 54 "amcc,acadia",
55 "amcc,haleakala", 55 "amcc,haleakala",
56 "amcc,kilauea", 56 "amcc,kilauea",
diff --git a/arch/powerpc/platforms/44x/currituck.c b/arch/powerpc/platforms/44x/currituck.c
index 9f6c33d63a42..6bd89a0e0dea 100644
--- a/arch/powerpc/platforms/44x/currituck.c
+++ b/arch/powerpc/platforms/44x/currituck.c
@@ -21,7 +21,6 @@
21 */ 21 */
22 22
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/memblock.h>
25#include <linux/of.h> 24#include <linux/of.h>
26#include <linux/of_platform.h> 25#include <linux/of_platform.h>
27#include <linux/rtc.h> 26#include <linux/rtc.h>
@@ -159,13 +158,8 @@ static void __init ppc47x_setup_arch(void)
159 158
160 /* No need to check the DMA config as we /know/ our windows are all of 159 /* No need to check the DMA config as we /know/ our windows are all of
161 * RAM. Lets hope that doesn't change */ 160 * RAM. Lets hope that doesn't change */
162#ifdef CONFIG_SWIOTLB 161 swiotlb_detect_4g();
163 if ((memblock_end_of_DRAM() - 1) > 0xffffffff) { 162
164 ppc_swiotlb_enable = 1;
165 set_pci_dma_ops(&swiotlb_dma_ops);
166 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
167 }
168#endif
169 ppc47x_smp_init(); 163 ppc47x_smp_init();
170} 164}
171 165
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index c16999802ecf..b62508b113db 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -2,6 +2,7 @@ config PPC_MPC512x
2 bool "512x-based boards" 2 bool "512x-based boards"
3 depends on 6xx 3 depends on 6xx
4 select FSL_SOC 4 select FSL_SOC
5 select FB_FSL_DIU
5 select IPIC 6 select IPIC
6 select PPC_CLOCK 7 select PPC_CLOCK
7 select PPC_PCI_CHOICE 8 select PPC_PCI_CHOICE
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index 1d8700ff60b0..9f771e05457c 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -54,14 +54,16 @@ static DEFINE_MUTEX(clocks_mutex);
54static struct clk *mpc5121_clk_get(struct device *dev, const char *id) 54static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
55{ 55{
56 struct clk *p, *clk = ERR_PTR(-ENOENT); 56 struct clk *p, *clk = ERR_PTR(-ENOENT);
57 int dev_match = 0; 57 int dev_match;
58 int id_match = 0; 58 int id_match;
59 59
60 if (dev == NULL || id == NULL) 60 if (dev == NULL || id == NULL)
61 return clk; 61 return clk;
62 62
63 mutex_lock(&clocks_mutex); 63 mutex_lock(&clocks_mutex);
64 list_for_each_entry(p, &clocks, node) { 64 list_for_each_entry(p, &clocks, node) {
65 dev_match = id_match = 0;
66
65 if (dev == p->dev) 67 if (dev == p->dev)
66 dev_match++; 68 dev_match++;
67 if (strcmp(id, p->name) == 0) 69 if (strcmp(id, p->name) == 0)
diff --git a/arch/powerpc/platforms/512x/mpc5121_generic.c b/arch/powerpc/platforms/512x/mpc5121_generic.c
index 926731f1ff01..ca1ca6669990 100644
--- a/arch/powerpc/platforms/512x/mpc5121_generic.c
+++ b/arch/powerpc/platforms/512x/mpc5121_generic.c
@@ -26,7 +26,7 @@
26/* 26/*
27 * list of supported boards 27 * list of supported boards
28 */ 28 */
29static const char *board[] __initdata = { 29static const char * const board[] __initconst = {
30 "prt,prtlvt", 30 "prt,prtlvt",
31 NULL 31 NULL
32}; 32};
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index cfe958e94e1e..1650e090ef3a 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -191,8 +191,6 @@ mpc512x_valid_monitor_port(enum fsl_diu_monitor_port port)
191 191
192static struct fsl_diu_shared_fb __attribute__ ((__aligned__(8))) diu_shared_fb; 192static struct fsl_diu_shared_fb __attribute__ ((__aligned__(8))) diu_shared_fb;
193 193
194#if defined(CONFIG_FB_FSL_DIU) || \
195 defined(CONFIG_FB_FSL_DIU_MODULE)
196static inline void mpc512x_free_bootmem(struct page *page) 194static inline void mpc512x_free_bootmem(struct page *page)
197{ 195{
198 __ClearPageReserved(page); 196 __ClearPageReserved(page);
@@ -220,7 +218,6 @@ void mpc512x_release_bootmem(void)
220 } 218 }
221 diu_ops.release_bootmem = NULL; 219 diu_ops.release_bootmem = NULL;
222} 220}
223#endif
224 221
225/* 222/*
226 * Check if DIU was pre-initialized. If so, perform steps 223 * Check if DIU was pre-initialized. If so, perform steps
@@ -323,15 +320,12 @@ void __init mpc512x_setup_diu(void)
323 } 320 }
324 } 321 }
325 322
326#if defined(CONFIG_FB_FSL_DIU) || \
327 defined(CONFIG_FB_FSL_DIU_MODULE)
328 diu_ops.get_pixel_format = mpc512x_get_pixel_format; 323 diu_ops.get_pixel_format = mpc512x_get_pixel_format;
329 diu_ops.set_gamma_table = mpc512x_set_gamma_table; 324 diu_ops.set_gamma_table = mpc512x_set_gamma_table;
330 diu_ops.set_monitor_port = mpc512x_set_monitor_port; 325 diu_ops.set_monitor_port = mpc512x_set_monitor_port;
331 diu_ops.set_pixel_clock = mpc512x_set_pixel_clock; 326 diu_ops.set_pixel_clock = mpc512x_set_pixel_clock;
332 diu_ops.valid_monitor_port = mpc512x_valid_monitor_port; 327 diu_ops.valid_monitor_port = mpc512x_valid_monitor_port;
333 diu_ops.release_bootmem = mpc512x_release_bootmem; 328 diu_ops.release_bootmem = mpc512x_release_bootmem;
334#endif
335} 329}
336 330
337void __init mpc512x_init_IRQ(void) 331void __init mpc512x_init_IRQ(void)
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 01ffa64d2aa7..448d862bcf3d 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -172,7 +172,7 @@ static void __init lite5200_setup_arch(void)
172 mpc52xx_setup_pci(); 172 mpc52xx_setup_pci();
173} 173}
174 174
175static const char *board[] __initdata = { 175static const char * const board[] __initconst = {
176 "fsl,lite5200", 176 "fsl,lite5200",
177 "fsl,lite5200b", 177 "fsl,lite5200b",
178 NULL, 178 NULL,
diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c
index 17d91b7da315..070d315dd6cd 100644
--- a/arch/powerpc/platforms/52xx/media5200.c
+++ b/arch/powerpc/platforms/52xx/media5200.c
@@ -232,7 +232,7 @@ static void __init media5200_setup_arch(void)
232} 232}
233 233
234/* list of the supported boards */ 234/* list of the supported boards */
235static const char *board[] __initdata = { 235static const char * const board[] __initconst = {
236 "fsl,media5200", 236 "fsl,media5200",
237 NULL 237 NULL
238}; 238};
diff --git a/arch/powerpc/platforms/52xx/mpc5200_simple.c b/arch/powerpc/platforms/52xx/mpc5200_simple.c
index c0aa04068d69..9cf36020cf0d 100644
--- a/arch/powerpc/platforms/52xx/mpc5200_simple.c
+++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c
@@ -52,6 +52,7 @@ static void __init mpc5200_simple_setup_arch(void)
52static const char *board[] __initdata = { 52static const char *board[] __initdata = {
53 "anonymous,a4m072", 53 "anonymous,a4m072",
54 "anon,charon", 54 "anon,charon",
55 "ifm,o2d",
55 "intercontrol,digsy-mtc", 56 "intercontrol,digsy-mtc",
56 "manroland,mucmc52", 57 "manroland,mucmc52",
57 "manroland,uc101", 58 "manroland,uc101",
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index d61fb1c0c1a0..2351f9e0fb6f 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -170,7 +170,8 @@ static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo_request *req)
170 out_be32(lpbfifo.regs + LPBFIFO_REG_CONTROL, bit_fields); 170 out_be32(lpbfifo.regs + LPBFIFO_REG_CONTROL, bit_fields);
171 171
172 /* Kick it off */ 172 /* Kick it off */
173 out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01); 173 if (!lpbfifo.req->defer_xfer_start)
174 out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01);
174 if (dma) 175 if (dma)
175 bcom_enable(lpbfifo.bcom_cur_task); 176 bcom_enable(lpbfifo.bcom_cur_task);
176} 177}
@@ -421,6 +422,38 @@ int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req)
421} 422}
422EXPORT_SYMBOL(mpc52xx_lpbfifo_submit); 423EXPORT_SYMBOL(mpc52xx_lpbfifo_submit);
423 424
425int mpc52xx_lpbfifo_start_xfer(struct mpc52xx_lpbfifo_request *req)
426{
427 unsigned long flags;
428
429 if (!lpbfifo.regs)
430 return -ENODEV;
431
432 spin_lock_irqsave(&lpbfifo.lock, flags);
433
434 /*
435 * If the req pointer is already set and a transfer was
436 * started on submit, then this transfer is in progress
437 */
438 if (lpbfifo.req && !lpbfifo.req->defer_xfer_start) {
439 spin_unlock_irqrestore(&lpbfifo.lock, flags);
440 return -EBUSY;
441 }
442
443 /*
444 * If the req was previously submitted but not
445 * started, start it now
446 */
447 if (lpbfifo.req && lpbfifo.req == req &&
448 lpbfifo.req->defer_xfer_start) {
449 out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01);
450 }
451
452 spin_unlock_irqrestore(&lpbfifo.lock, flags);
453 return 0;
454}
455EXPORT_SYMBOL(mpc52xx_lpbfifo_start_xfer);
456
424void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req) 457void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req)
425{ 458{
426 unsigned long flags; 459 unsigned long flags;
diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
index 16c9c9cbbb7f..eca1f0960fff 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
@@ -60,7 +60,7 @@ static void __init mpc837x_rdb_setup_arch(void)
60 60
61machine_device_initcall(mpc837x_rdb, mpc83xx_declare_of_platform_devices); 61machine_device_initcall(mpc837x_rdb, mpc83xx_declare_of_platform_devices);
62 62
63static const char *board[] __initdata = { 63static const char * const board[] __initconst = {
64 "fsl,mpc8377rdb", 64 "fsl,mpc8377rdb",
65 "fsl,mpc8378rdb", 65 "fsl,mpc8378rdb",
66 "fsl,mpc8379rdb", 66 "fsl,mpc8379rdb",
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 159c01e91463..02d02a09942d 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -104,6 +104,13 @@ config P1022_DS
104 help 104 help
105 This option enables support for the Freescale P1022DS reference board. 105 This option enables support for the Freescale P1022DS reference board.
106 106
107config P1022_RDK
108 bool "Freescale / iVeia P1022 RDK"
109 select DEFAULT_UIMAGE
110 help
111 This option enables support for the Freescale / iVeia P1022RDK
112 reference board.
113
107config P1023_RDS 114config P1023_RDS
108 bool "Freescale P1023 RDS" 115 bool "Freescale P1023 RDS"
109 select DEFAULT_UIMAGE 116 select DEFAULT_UIMAGE
@@ -254,6 +261,20 @@ config P5020_DS
254 help 261 help
255 This option enables support for the P5020 DS board 262 This option enables support for the P5020 DS board
256 263
264config P5040_DS
265 bool "Freescale P5040 DS"
266 select DEFAULT_UIMAGE
267 select E500
268 select PPC_E500MC
269 select PHYS_64BIT
270 select SWIOTLB
271 select ARCH_REQUIRE_GPIOLIB
272 select GPIO_MPC8XXX
273 select HAS_RAPIDIO
274 select PPC_EPAPR_HV_PIC
275 help
276 This option enables support for the P5040 DS board
277
257config PPC_QEMU_E500 278config PPC_QEMU_E500
258 bool "QEMU generic e500 platform" 279 bool "QEMU generic e500 platform"
259 depends on EXPERIMENTAL 280 depends on EXPERIMENTAL
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 3dfe81175036..76f679cb04a0 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -15,11 +15,13 @@ obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
15obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o 15obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o
16obj-$(CONFIG_P1010_RDB) += p1010rdb.o 16obj-$(CONFIG_P1010_RDB) += p1010rdb.o
17obj-$(CONFIG_P1022_DS) += p1022_ds.o 17obj-$(CONFIG_P1022_DS) += p1022_ds.o
18obj-$(CONFIG_P1022_RDK) += p1022_rdk.o
18obj-$(CONFIG_P1023_RDS) += p1023_rds.o 19obj-$(CONFIG_P1023_RDS) += p1023_rds.o
19obj-$(CONFIG_P2041_RDB) += p2041_rdb.o corenet_ds.o 20obj-$(CONFIG_P2041_RDB) += p2041_rdb.o corenet_ds.o
20obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o 21obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o
21obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o 22obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o
22obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o 23obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o
24obj-$(CONFIG_P5040_DS) += p5040_ds.o corenet_ds.o
23obj-$(CONFIG_STX_GP3) += stx_gp3.o 25obj-$(CONFIG_STX_GP3) += stx_gp3.o
24obj-$(CONFIG_TQM85xx) += tqm85xx.o 26obj-$(CONFIG_TQM85xx) += tqm85xx.o
25obj-$(CONFIG_SBC8548) += sbc8548.o 27obj-$(CONFIG_SBC8548) += sbc8548.o
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index 67dac22b4363..d0861a0d8360 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -27,6 +27,16 @@ static struct of_device_id __initdata mpc85xx_common_ids[] = {
27 { .compatible = "fsl,mpc8548-guts", }, 27 { .compatible = "fsl,mpc8548-guts", },
28 /* Probably unnecessary? */ 28 /* Probably unnecessary? */
29 { .compatible = "gpio-leds", }, 29 { .compatible = "gpio-leds", },
30 /* For all PCI controllers */
31 { .compatible = "fsl,mpc8540-pci", },
32 { .compatible = "fsl,mpc8548-pcie", },
33 { .compatible = "fsl,p1022-pcie", },
34 { .compatible = "fsl,p1010-pcie", },
35 { .compatible = "fsl,p1023-pcie", },
36 { .compatible = "fsl,p4080-pcie", },
37 { .compatible = "fsl,qoriq-pcie-v2.4", },
38 { .compatible = "fsl,qoriq-pcie-v2.3", },
39 { .compatible = "fsl,qoriq-pcie-v2.2", },
30 {}, 40 {},
31}; 41};
32 42
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
index 925b02874233..ed69c9250717 100644
--- a/arch/powerpc/platforms/85xx/corenet_ds.c
+++ b/arch/powerpc/platforms/85xx/corenet_ds.c
@@ -16,7 +16,6 @@
16#include <linux/kdev_t.h> 16#include <linux/kdev_t.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/memblock.h>
20 19
21#include <asm/time.h> 20#include <asm/time.h>
22#include <asm/machdep.h> 21#include <asm/machdep.h>
@@ -52,37 +51,16 @@ void __init corenet_ds_pic_init(void)
52 */ 51 */
53void __init corenet_ds_setup_arch(void) 52void __init corenet_ds_setup_arch(void)
54{ 53{
55#ifdef CONFIG_PCI
56 struct device_node *np;
57 struct pci_controller *hose;
58#endif
59 dma_addr_t max = 0xffffffff;
60
61 mpc85xx_smp_init(); 54 mpc85xx_smp_init();
62 55
63#ifdef CONFIG_PCI 56#if defined(CONFIG_PCI) && defined(CONFIG_PPC64)
64 for_each_node_by_type(np, "pci") {
65 if (of_device_is_compatible(np, "fsl,p4080-pcie") ||
66 of_device_is_compatible(np, "fsl,qoriq-pcie-v2.2")) {
67 fsl_add_bridge(np, 0);
68 hose = pci_find_hose_for_OF_device(np);
69 max = min(max, hose->dma_window_base_cur +
70 hose->dma_window_size);
71 }
72 }
73
74#ifdef CONFIG_PPC64
75 pci_devs_phb_init(); 57 pci_devs_phb_init();
76#endif 58#endif
77#endif
78 59
79#ifdef CONFIG_SWIOTLB 60 fsl_pci_assign_primary();
80 if ((memblock_end_of_DRAM() - 1) > max) { 61
81 ppc_swiotlb_enable = 1; 62 swiotlb_detect_4g();
82 set_pci_dma_ops(&swiotlb_dma_ops); 63
83 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
84 }
85#endif
86 pr_info("%s board from Freescale Semiconductor\n", ppc_md.name); 64 pr_info("%s board from Freescale Semiconductor\n", ppc_md.name);
87} 65}
88 66
@@ -99,6 +77,12 @@ static const struct of_device_id of_device_ids[] __devinitconst = {
99 { 77 {
100 .compatible = "fsl,qoriq-pcie-v2.2", 78 .compatible = "fsl,qoriq-pcie-v2.2",
101 }, 79 },
80 {
81 .compatible = "fsl,qoriq-pcie-v2.3",
82 },
83 {
84 .compatible = "fsl,qoriq-pcie-v2.4",
85 },
102 /* The following two are for the Freescale hypervisor */ 86 /* The following two are for the Freescale hypervisor */
103 { 87 {
104 .name = "hypervisor", 88 .name = "hypervisor",
diff --git a/arch/powerpc/platforms/85xx/ge_imp3a.c b/arch/powerpc/platforms/85xx/ge_imp3a.c
index b6a728b0a8ca..e6285ae6f423 100644
--- a/arch/powerpc/platforms/85xx/ge_imp3a.c
+++ b/arch/powerpc/platforms/85xx/ge_imp3a.c
@@ -22,7 +22,6 @@
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/memblock.h>
26 25
27#include <asm/time.h> 26#include <asm/time.h>
28#include <asm/machdep.h> 27#include <asm/machdep.h>
@@ -84,53 +83,39 @@ void __init ge_imp3a_pic_init(void)
84 of_node_put(cascade_node); 83 of_node_put(cascade_node);
85} 84}
86 85
87#ifdef CONFIG_PCI 86static void ge_imp3a_pci_assign_primary(void)
88static int primary_phb_addr;
89#endif /* CONFIG_PCI */
90
91/*
92 * Setup the architecture
93 */
94static void __init ge_imp3a_setup_arch(void)
95{ 87{
96 struct device_node *regs;
97#ifdef CONFIG_PCI 88#ifdef CONFIG_PCI
98 struct device_node *np; 89 struct device_node *np;
99 struct pci_controller *hose; 90 struct resource rsrc;
100#endif
101 dma_addr_t max = 0xffffffff;
102 91
103 if (ppc_md.progress)
104 ppc_md.progress("ge_imp3a_setup_arch()", 0);
105
106#ifdef CONFIG_PCI
107 for_each_node_by_type(np, "pci") { 92 for_each_node_by_type(np, "pci") {
108 if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 93 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
109 of_device_is_compatible(np, "fsl,mpc8548-pcie") || 94 of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
110 of_device_is_compatible(np, "fsl,p2020-pcie")) { 95 of_device_is_compatible(np, "fsl,p2020-pcie")) {
111 struct resource rsrc;
112 of_address_to_resource(np, 0, &rsrc); 96 of_address_to_resource(np, 0, &rsrc);
113 if ((rsrc.start & 0xfffff) == primary_phb_addr) 97 if ((rsrc.start & 0xfffff) == 0x9000)
114 fsl_add_bridge(np, 1); 98 fsl_pci_primary = np;
115 else
116 fsl_add_bridge(np, 0);
117
118 hose = pci_find_hose_for_OF_device(np);
119 max = min(max, hose->dma_window_base_cur +
120 hose->dma_window_size);
121 } 99 }
122 } 100 }
123#endif 101#endif
102}
103
104/*
105 * Setup the architecture
106 */
107static void __init ge_imp3a_setup_arch(void)
108{
109 struct device_node *regs;
110
111 if (ppc_md.progress)
112 ppc_md.progress("ge_imp3a_setup_arch()", 0);
124 113
125 mpc85xx_smp_init(); 114 mpc85xx_smp_init();
126 115
127#ifdef CONFIG_SWIOTLB 116 ge_imp3a_pci_assign_primary();
128 if ((memblock_end_of_DRAM() - 1) > max) { 117
129 ppc_swiotlb_enable = 1; 118 swiotlb_detect_4g();
130 set_pci_dma_ops(&swiotlb_dma_ops);
131 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
132 }
133#endif
134 119
135 /* Remap basic board registers */ 120 /* Remap basic board registers */
136 regs = of_find_compatible_node(NULL, NULL, "ge,imp3a-fpga-regs"); 121 regs = of_find_compatible_node(NULL, NULL, "ge,imp3a-fpga-regs");
@@ -215,17 +200,10 @@ static int __init ge_imp3a_probe(void)
215{ 200{
216 unsigned long root = of_get_flat_dt_root(); 201 unsigned long root = of_get_flat_dt_root();
217 202
218 if (of_flat_dt_is_compatible(root, "ge,IMP3A")) { 203 return of_flat_dt_is_compatible(root, "ge,IMP3A");
219#ifdef CONFIG_PCI
220 primary_phb_addr = 0x9000;
221#endif
222 return 1;
223 }
224
225 return 0;
226} 204}
227 205
228machine_device_initcall(ge_imp3a, mpc85xx_common_publish_devices); 206machine_arch_initcall(ge_imp3a, mpc85xx_common_publish_devices);
229 207
230machine_arch_initcall(ge_imp3a, swiotlb_setup_bus_notifier); 208machine_arch_initcall(ge_imp3a, swiotlb_setup_bus_notifier);
231 209
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index 767c7cf18a9c..15ce4b55f117 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -17,7 +17,6 @@
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <linux/memblock.h>
21 20
22#include <asm/time.h> 21#include <asm/time.h>
23#include <asm/machdep.h> 22#include <asm/machdep.h>
@@ -46,46 +45,17 @@ void __init mpc8536_ds_pic_init(void)
46 */ 45 */
47static void __init mpc8536_ds_setup_arch(void) 46static void __init mpc8536_ds_setup_arch(void)
48{ 47{
49#ifdef CONFIG_PCI
50 struct device_node *np;
51 struct pci_controller *hose;
52#endif
53 dma_addr_t max = 0xffffffff;
54
55 if (ppc_md.progress) 48 if (ppc_md.progress)
56 ppc_md.progress("mpc8536_ds_setup_arch()", 0); 49 ppc_md.progress("mpc8536_ds_setup_arch()", 0);
57 50
58#ifdef CONFIG_PCI 51 fsl_pci_assign_primary();
59 for_each_node_by_type(np, "pci") {
60 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
61 of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
62 struct resource rsrc;
63 of_address_to_resource(np, 0, &rsrc);
64 if ((rsrc.start & 0xfffff) == 0x8000)
65 fsl_add_bridge(np, 1);
66 else
67 fsl_add_bridge(np, 0);
68
69 hose = pci_find_hose_for_OF_device(np);
70 max = min(max, hose->dma_window_base_cur +
71 hose->dma_window_size);
72 }
73 }
74
75#endif
76 52
77#ifdef CONFIG_SWIOTLB 53 swiotlb_detect_4g();
78 if ((memblock_end_of_DRAM() - 1) > max) {
79 ppc_swiotlb_enable = 1;
80 set_pci_dma_ops(&swiotlb_dma_ops);
81 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
82 }
83#endif
84 54
85 printk("MPC8536 DS board from Freescale Semiconductor\n"); 55 printk("MPC8536 DS board from Freescale Semiconductor\n");
86} 56}
87 57
88machine_device_initcall(mpc8536_ds, mpc85xx_common_publish_devices); 58machine_arch_initcall(mpc8536_ds, mpc85xx_common_publish_devices);
89 59
90machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier); 60machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier);
91 61
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 29ee8fcd75a2..7d12a19aa7ee 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -137,10 +137,6 @@ static void __init init_ioports(void)
137 137
138static void __init mpc85xx_ads_setup_arch(void) 138static void __init mpc85xx_ads_setup_arch(void)
139{ 139{
140#ifdef CONFIG_PCI
141 struct device_node *np;
142#endif
143
144 if (ppc_md.progress) 140 if (ppc_md.progress)
145 ppc_md.progress("mpc85xx_ads_setup_arch()", 0); 141 ppc_md.progress("mpc85xx_ads_setup_arch()", 0);
146 142
@@ -150,11 +146,10 @@ static void __init mpc85xx_ads_setup_arch(void)
150#endif 146#endif
151 147
152#ifdef CONFIG_PCI 148#ifdef CONFIG_PCI
153 for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
154 fsl_add_bridge(np, 1);
155
156 ppc_md.pci_exclude_device = mpc85xx_exclude_device; 149 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
157#endif 150#endif
151
152 fsl_pci_assign_primary();
158} 153}
159 154
160static void mpc85xx_ads_show_cpuinfo(struct seq_file *m) 155static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
@@ -173,7 +168,7 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
173 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 168 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
174} 169}
175 170
176machine_device_initcall(mpc85xx_ads, mpc85xx_common_publish_devices); 171machine_arch_initcall(mpc85xx_ads, mpc85xx_common_publish_devices);
177 172
178/* 173/*
179 * Called very early, device-tree isn't unflattened 174 * Called very early, device-tree isn't unflattened
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 11156fb53d83..c474505ad0d0 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -276,6 +276,33 @@ machine_device_initcall(mpc85xx_cds, mpc85xx_cds_8259_attach);
276 276
277#endif /* CONFIG_PPC_I8259 */ 277#endif /* CONFIG_PPC_I8259 */
278 278
279static void mpc85xx_cds_pci_assign_primary(void)
280{
281#ifdef CONFIG_PCI
282 struct device_node *np;
283
284 if (fsl_pci_primary)
285 return;
286
287 /*
288 * MPC85xx_CDS has ISA bridge but unfortunately there is no
289 * isa node in device tree. We now looking for i8259 node as
290 * a workaround for such a broken device tree. This routine
291 * is for complying to all device trees.
292 */
293 np = of_find_node_by_name(NULL, "i8259");
294 while ((fsl_pci_primary = of_get_parent(np))) {
295 of_node_put(np);
296 np = fsl_pci_primary;
297
298 if ((of_device_is_compatible(np, "fsl,mpc8540-pci") ||
299 of_device_is_compatible(np, "fsl,mpc8548-pcie")) &&
300 of_device_is_available(np))
301 return;
302 }
303#endif
304}
305
279/* 306/*
280 * Setup the architecture 307 * Setup the architecture
281 */ 308 */
@@ -309,21 +336,12 @@ static void __init mpc85xx_cds_setup_arch(void)
309 } 336 }
310 337
311#ifdef CONFIG_PCI 338#ifdef CONFIG_PCI
312 for_each_node_by_type(np, "pci") {
313 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
314 of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
315 struct resource rsrc;
316 of_address_to_resource(np, 0, &rsrc);
317 if ((rsrc.start & 0xfffff) == 0x8000)
318 fsl_add_bridge(np, 1);
319 else
320 fsl_add_bridge(np, 0);
321 }
322 }
323
324 ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup; 339 ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup;
325 ppc_md.pci_exclude_device = mpc85xx_exclude_device; 340 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
326#endif 341#endif
342
343 mpc85xx_cds_pci_assign_primary();
344 fsl_pci_assign_primary();
327} 345}
328 346
329static void mpc85xx_cds_show_cpuinfo(struct seq_file *m) 347static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)
@@ -355,7 +373,7 @@ static int __init mpc85xx_cds_probe(void)
355 return of_flat_dt_is_compatible(root, "MPC85xxCDS"); 373 return of_flat_dt_is_compatible(root, "MPC85xxCDS");
356} 374}
357 375
358machine_device_initcall(mpc85xx_cds, mpc85xx_common_publish_devices); 376machine_arch_initcall(mpc85xx_cds, mpc85xx_common_publish_devices);
359 377
360define_machine(mpc85xx_cds) { 378define_machine(mpc85xx_cds) {
361 .name = "MPC85xx CDS", 379 .name = "MPC85xx CDS",
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 6d3265fe7718..9ebb91ed96a3 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -20,7 +20,6 @@
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/memblock.h>
24 23
25#include <asm/time.h> 24#include <asm/time.h>
26#include <asm/machdep.h> 25#include <asm/machdep.h>
@@ -129,13 +128,11 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
129} 128}
130#endif /* CONFIG_PCI */ 129#endif /* CONFIG_PCI */
131 130
132static void __init mpc85xx_ds_pci_init(void) 131static void __init mpc85xx_ds_uli_init(void)
133{ 132{
134#ifdef CONFIG_PCI 133#ifdef CONFIG_PCI
135 struct device_node *node; 134 struct device_node *node;
136 135
137 fsl_pci_init();
138
139 /* See if we have a ULI under the primary */ 136 /* See if we have a ULI under the primary */
140 137
141 node = of_find_node_by_name(NULL, "uli1575"); 138 node = of_find_node_by_name(NULL, "uli1575");
@@ -159,7 +156,9 @@ static void __init mpc85xx_ds_setup_arch(void)
159 if (ppc_md.progress) 156 if (ppc_md.progress)
160 ppc_md.progress("mpc85xx_ds_setup_arch()", 0); 157 ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
161 158
162 mpc85xx_ds_pci_init(); 159 swiotlb_detect_4g();
160 fsl_pci_assign_primary();
161 mpc85xx_ds_uli_init();
163 mpc85xx_smp_init(); 162 mpc85xx_smp_init();
164 163
165 printk("MPC85xx DS board from Freescale Semiconductor\n"); 164 printk("MPC85xx DS board from Freescale Semiconductor\n");
@@ -175,9 +174,9 @@ static int __init mpc8544_ds_probe(void)
175 return !!of_flat_dt_is_compatible(root, "MPC8544DS"); 174 return !!of_flat_dt_is_compatible(root, "MPC8544DS");
176} 175}
177 176
178machine_device_initcall(mpc8544_ds, mpc85xx_common_publish_devices); 177machine_arch_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
179machine_device_initcall(mpc8572_ds, mpc85xx_common_publish_devices); 178machine_arch_initcall(mpc8572_ds, mpc85xx_common_publish_devices);
180machine_device_initcall(p2020_ds, mpc85xx_common_publish_devices); 179machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices);
181 180
182machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier); 181machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier);
183machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier); 182machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 8e4b094c553b..8498f7323470 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -327,44 +327,16 @@ static void __init mpc85xx_mds_qeic_init(void) { }
327 327
328static void __init mpc85xx_mds_setup_arch(void) 328static void __init mpc85xx_mds_setup_arch(void)
329{ 329{
330#ifdef CONFIG_PCI
331 struct pci_controller *hose;
332 struct device_node *np;
333#endif
334 dma_addr_t max = 0xffffffff;
335
336 if (ppc_md.progress) 330 if (ppc_md.progress)
337 ppc_md.progress("mpc85xx_mds_setup_arch()", 0); 331 ppc_md.progress("mpc85xx_mds_setup_arch()", 0);
338 332
339#ifdef CONFIG_PCI
340 for_each_node_by_type(np, "pci") {
341 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
342 of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
343 struct resource rsrc;
344 of_address_to_resource(np, 0, &rsrc);
345 if ((rsrc.start & 0xfffff) == 0x8000)
346 fsl_add_bridge(np, 1);
347 else
348 fsl_add_bridge(np, 0);
349
350 hose = pci_find_hose_for_OF_device(np);
351 max = min(max, hose->dma_window_base_cur +
352 hose->dma_window_size);
353 }
354 }
355#endif
356
357 mpc85xx_smp_init(); 333 mpc85xx_smp_init();
358 334
359 mpc85xx_mds_qe_init(); 335 mpc85xx_mds_qe_init();
360 336
361#ifdef CONFIG_SWIOTLB 337 fsl_pci_assign_primary();
362 if ((memblock_end_of_DRAM() - 1) > max) { 338
363 ppc_swiotlb_enable = 1; 339 swiotlb_detect_4g();
364 set_pci_dma_ops(&swiotlb_dma_ops);
365 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
366 }
367#endif
368} 340}
369 341
370 342
@@ -409,9 +381,9 @@ static int __init mpc85xx_publish_devices(void)
409 return mpc85xx_common_publish_devices(); 381 return mpc85xx_common_publish_devices();
410} 382}
411 383
412machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices); 384machine_arch_initcall(mpc8568_mds, mpc85xx_publish_devices);
413machine_device_initcall(mpc8569_mds, mpc85xx_publish_devices); 385machine_arch_initcall(mpc8569_mds, mpc85xx_publish_devices);
414machine_device_initcall(p1021_mds, mpc85xx_common_publish_devices); 386machine_arch_initcall(p1021_mds, mpc85xx_common_publish_devices);
415 387
416machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier); 388machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier);
417machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier); 389machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index 1910fdcb75b2..ede8771d6f02 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -86,23 +86,17 @@ void __init mpc85xx_rdb_pic_init(void)
86 */ 86 */
87static void __init mpc85xx_rdb_setup_arch(void) 87static void __init mpc85xx_rdb_setup_arch(void)
88{ 88{
89#if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE) 89#ifdef CONFIG_QUICC_ENGINE
90 struct device_node *np; 90 struct device_node *np;
91#endif 91#endif
92 92
93 if (ppc_md.progress) 93 if (ppc_md.progress)
94 ppc_md.progress("mpc85xx_rdb_setup_arch()", 0); 94 ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
95 95
96#ifdef CONFIG_PCI
97 for_each_node_by_type(np, "pci") {
98 if (of_device_is_compatible(np, "fsl,mpc8548-pcie"))
99 fsl_add_bridge(np, 0);
100 }
101
102#endif
103
104 mpc85xx_smp_init(); 96 mpc85xx_smp_init();
105 97
98 fsl_pci_assign_primary();
99
106#ifdef CONFIG_QUICC_ENGINE 100#ifdef CONFIG_QUICC_ENGINE
107 np = of_find_compatible_node(NULL, NULL, "fsl,qe"); 101 np = of_find_compatible_node(NULL, NULL, "fsl,qe");
108 if (!np) { 102 if (!np) {
@@ -161,15 +155,15 @@ qe_fail:
161 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); 155 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
162} 156}
163 157
164machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices); 158machine_arch_initcall(p2020_rdb, mpc85xx_common_publish_devices);
165machine_device_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices); 159machine_arch_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices);
166machine_device_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices); 160machine_arch_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices);
167machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices); 161machine_arch_initcall(p1020_rdb, mpc85xx_common_publish_devices);
168machine_device_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices); 162machine_arch_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices);
169machine_device_initcall(p1020_utm_pc, mpc85xx_common_publish_devices); 163machine_arch_initcall(p1020_utm_pc, mpc85xx_common_publish_devices);
170machine_device_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices); 164machine_arch_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices);
171machine_device_initcall(p1025_rdb, mpc85xx_common_publish_devices); 165machine_arch_initcall(p1025_rdb, mpc85xx_common_publish_devices);
172machine_device_initcall(p1024_rdb, mpc85xx_common_publish_devices); 166machine_arch_initcall(p1024_rdb, mpc85xx_common_publish_devices);
173 167
174/* 168/*
175 * Called very early, device-tree isn't unflattened 169 * Called very early, device-tree isn't unflattened
diff --git a/arch/powerpc/platforms/85xx/p1010rdb.c b/arch/powerpc/platforms/85xx/p1010rdb.c
index dbaf44354f0d..0252961392d5 100644
--- a/arch/powerpc/platforms/85xx/p1010rdb.c
+++ b/arch/powerpc/platforms/85xx/p1010rdb.c
@@ -46,25 +46,15 @@ void __init p1010_rdb_pic_init(void)
46 */ 46 */
47static void __init p1010_rdb_setup_arch(void) 47static void __init p1010_rdb_setup_arch(void)
48{ 48{
49#ifdef CONFIG_PCI
50 struct device_node *np;
51#endif
52
53 if (ppc_md.progress) 49 if (ppc_md.progress)
54 ppc_md.progress("p1010_rdb_setup_arch()", 0); 50 ppc_md.progress("p1010_rdb_setup_arch()", 0);
55 51
56#ifdef CONFIG_PCI 52 fsl_pci_assign_primary();
57 for_each_node_by_type(np, "pci") {
58 if (of_device_is_compatible(np, "fsl,p1010-pcie"))
59 fsl_add_bridge(np, 0);
60 }
61
62#endif
63 53
64 printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n"); 54 printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n");
65} 55}
66 56
67machine_device_initcall(p1010_rdb, mpc85xx_common_publish_devices); 57machine_arch_initcall(p1010_rdb, mpc85xx_common_publish_devices);
68machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier); 58machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier);
69 59
70/* 60/*
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index 3c732acf331d..848a3e98e1c1 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -18,7 +18,6 @@
18 18
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21#include <linux/memblock.h>
22#include <asm/div64.h> 21#include <asm/div64.h>
23#include <asm/mpic.h> 22#include <asm/mpic.h>
24#include <asm/swiotlb.h> 23#include <asm/swiotlb.h>
@@ -507,32 +506,9 @@ early_param("video", early_video_setup);
507 */ 506 */
508static void __init p1022_ds_setup_arch(void) 507static void __init p1022_ds_setup_arch(void)
509{ 508{
510#ifdef CONFIG_PCI
511 struct device_node *np;
512#endif
513 dma_addr_t max = 0xffffffff;
514
515 if (ppc_md.progress) 509 if (ppc_md.progress)
516 ppc_md.progress("p1022_ds_setup_arch()", 0); 510 ppc_md.progress("p1022_ds_setup_arch()", 0);
517 511
518#ifdef CONFIG_PCI
519 for_each_compatible_node(np, "pci", "fsl,p1022-pcie") {
520 struct resource rsrc;
521 struct pci_controller *hose;
522
523 of_address_to_resource(np, 0, &rsrc);
524
525 if ((rsrc.start & 0xfffff) == 0x8000)
526 fsl_add_bridge(np, 1);
527 else
528 fsl_add_bridge(np, 0);
529
530 hose = pci_find_hose_for_OF_device(np);
531 max = min(max, hose->dma_window_base_cur +
532 hose->dma_window_size);
533 }
534#endif
535
536#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 512#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
537 diu_ops.get_pixel_format = p1022ds_get_pixel_format; 513 diu_ops.get_pixel_format = p1022ds_get_pixel_format;
538 diu_ops.set_gamma_table = p1022ds_set_gamma_table; 514 diu_ops.set_gamma_table = p1022ds_set_gamma_table;
@@ -601,18 +577,14 @@ static void __init p1022_ds_setup_arch(void)
601 577
602 mpc85xx_smp_init(); 578 mpc85xx_smp_init();
603 579
604#ifdef CONFIG_SWIOTLB 580 fsl_pci_assign_primary();
605 if ((memblock_end_of_DRAM() - 1) > max) { 581
606 ppc_swiotlb_enable = 1; 582 swiotlb_detect_4g();
607 set_pci_dma_ops(&swiotlb_dma_ops);
608 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
609 }
610#endif
611 583
612 pr_info("Freescale P1022 DS reference board\n"); 584 pr_info("Freescale P1022 DS reference board\n");
613} 585}
614 586
615machine_device_initcall(p1022_ds, mpc85xx_common_publish_devices); 587machine_arch_initcall(p1022_ds, mpc85xx_common_publish_devices);
616 588
617machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier); 589machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier);
618 590
diff --git a/arch/powerpc/platforms/85xx/p1022_rdk.c b/arch/powerpc/platforms/85xx/p1022_rdk.c
new file mode 100644
index 000000000000..55ffa1cc380c
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/p1022_rdk.c
@@ -0,0 +1,167 @@
1/*
2 * P1022 RDK board specific routines
3 *
4 * Copyright 2012 Freescale Semiconductor, Inc.
5 *
6 * Author: Timur Tabi <timur@freescale.com>
7 *
8 * Based on p1022_ds.c
9 *
10 * This file is licensed under the terms of the GNU General Public License
11 * version 2. This program is licensed "as is" without any warranty of any
12 * kind, whether express or implied.
13 */
14
15#include <linux/pci.h>
16#include <linux/of_platform.h>
17#include <asm/div64.h>
18#include <asm/mpic.h>
19#include <asm/swiotlb.h>
20
21#include <sysdev/fsl_soc.h>
22#include <sysdev/fsl_pci.h>
23#include <asm/udbg.h>
24#include <asm/fsl_guts.h>
25#include "smp.h"
26
27#include "mpc85xx.h"
28
29#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
30
31/* DIU Pixel Clock bits of the CLKDVDR Global Utilities register */
32#define CLKDVDR_PXCKEN 0x80000000
33#define CLKDVDR_PXCKINV 0x10000000
34#define CLKDVDR_PXCKDLY 0x06000000
35#define CLKDVDR_PXCLK_MASK 0x00FF0000
36
37/**
38 * p1022rdk_set_monitor_port: switch the output to a different monitor port
39 */
40static void p1022rdk_set_monitor_port(enum fsl_diu_monitor_port port)
41{
42 if (port != FSL_DIU_PORT_DVI) {
43 pr_err("p1022rdk: unsupported monitor port %i\n", port);
44 return;
45 }
46}
47
48/**
49 * p1022rdk_set_pixel_clock: program the DIU's clock
50 *
51 * @pixclock: the wavelength, in picoseconds, of the clock
52 */
53void p1022rdk_set_pixel_clock(unsigned int pixclock)
54{
55 struct device_node *guts_np = NULL;
56 struct ccsr_guts __iomem *guts;
57 unsigned long freq;
58 u64 temp;
59 u32 pxclk;
60
61 /* Map the global utilities registers. */
62 guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts");
63 if (!guts_np) {
64 pr_err("p1022rdk: missing global utilties device node\n");
65 return;
66 }
67
68 guts = of_iomap(guts_np, 0);
69 of_node_put(guts_np);
70 if (!guts) {
71 pr_err("p1022rdk: could not map global utilties device\n");
72 return;
73 }
74
75 /* Convert pixclock from a wavelength to a frequency */
76 temp = 1000000000000ULL;
77 do_div(temp, pixclock);
78 freq = temp;
79
80 /*
81 * 'pxclk' is the ratio of the platform clock to the pixel clock.
82 * This number is programmed into the CLKDVDR register, and the valid
83 * range of values is 2-255.
84 */
85 pxclk = DIV_ROUND_CLOSEST(fsl_get_sys_freq(), freq);
86 pxclk = clamp_t(u32, pxclk, 2, 255);
87
88 /* Disable the pixel clock, and set it to non-inverted and no delay */
89 clrbits32(&guts->clkdvdr,
90 CLKDVDR_PXCKEN | CLKDVDR_PXCKDLY | CLKDVDR_PXCLK_MASK);
91
92 /* Enable the clock and set the pxclk */
93 setbits32(&guts->clkdvdr, CLKDVDR_PXCKEN | (pxclk << 16));
94
95 iounmap(guts);
96}
97
98/**
99 * p1022rdk_valid_monitor_port: set the monitor port for sysfs
100 */
101enum fsl_diu_monitor_port
102p1022rdk_valid_monitor_port(enum fsl_diu_monitor_port port)
103{
104 return FSL_DIU_PORT_DVI;
105}
106
107#endif
108
109void __init p1022_rdk_pic_init(void)
110{
111 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
112 MPIC_SINGLE_DEST_CPU,
113 0, 256, " OpenPIC ");
114 BUG_ON(mpic == NULL);
115 mpic_init(mpic);
116}
117
118/*
119 * Setup the architecture
120 */
121static void __init p1022_rdk_setup_arch(void)
122{
123 if (ppc_md.progress)
124 ppc_md.progress("p1022_rdk_setup_arch()", 0);
125
126#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
127 diu_ops.set_monitor_port = p1022rdk_set_monitor_port;
128 diu_ops.set_pixel_clock = p1022rdk_set_pixel_clock;
129 diu_ops.valid_monitor_port = p1022rdk_valid_monitor_port;
130#endif
131
132 mpc85xx_smp_init();
133
134 fsl_pci_assign_primary();
135
136 swiotlb_detect_4g();
137
138 pr_info("Freescale / iVeia P1022 RDK reference board\n");
139}
140
141machine_arch_initcall(p1022_rdk, mpc85xx_common_publish_devices);
142
143machine_arch_initcall(p1022_rdk, swiotlb_setup_bus_notifier);
144
145/*
146 * Called very early, device-tree isn't unflattened
147 */
148static int __init p1022_rdk_probe(void)
149{
150 unsigned long root = of_get_flat_dt_root();
151
152 return of_flat_dt_is_compatible(root, "fsl,p1022rdk");
153}
154
155define_machine(p1022_rdk) {
156 .name = "P1022 RDK",
157 .probe = p1022_rdk_probe,
158 .setup_arch = p1022_rdk_setup_arch,
159 .init_IRQ = p1022_rdk_pic_init,
160#ifdef CONFIG_PCI
161 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
162#endif
163 .get_irq = mpic_get_irq,
164 .restart = fsl_rstcr_restart,
165 .calibrate_decr = generic_calibrate_decr,
166 .progress = udbg_progress,
167};
diff --git a/arch/powerpc/platforms/85xx/p1023_rds.c b/arch/powerpc/platforms/85xx/p1023_rds.c
index 2990e8b13dc9..9cc60a738834 100644
--- a/arch/powerpc/platforms/85xx/p1023_rds.c
+++ b/arch/powerpc/platforms/85xx/p1023_rds.c
@@ -80,15 +80,12 @@ static void __init mpc85xx_rds_setup_arch(void)
80 } 80 }
81 } 81 }
82 82
83#ifdef CONFIG_PCI
84 for_each_compatible_node(np, "pci", "fsl,p1023-pcie")
85 fsl_add_bridge(np, 0);
86#endif
87
88 mpc85xx_smp_init(); 83 mpc85xx_smp_init();
84
85 fsl_pci_assign_primary();
89} 86}
90 87
91machine_device_initcall(p1023_rds, mpc85xx_common_publish_devices); 88machine_arch_initcall(p1023_rds, mpc85xx_common_publish_devices);
92 89
93static void __init mpc85xx_rds_pic_init(void) 90static void __init mpc85xx_rds_pic_init(void)
94{ 91{
diff --git a/arch/powerpc/platforms/85xx/p2041_rdb.c b/arch/powerpc/platforms/85xx/p2041_rdb.c
index 6541fa2630c0..000c0892fc40 100644
--- a/arch/powerpc/platforms/85xx/p2041_rdb.c
+++ b/arch/powerpc/platforms/85xx/p2041_rdb.c
@@ -80,7 +80,7 @@ define_machine(p2041_rdb) {
80 .power_save = e500_idle, 80 .power_save = e500_idle,
81}; 81};
82 82
83machine_device_initcall(p2041_rdb, corenet_ds_publish_devices); 83machine_arch_initcall(p2041_rdb, corenet_ds_publish_devices);
84 84
85#ifdef CONFIG_SWIOTLB 85#ifdef CONFIG_SWIOTLB
86machine_arch_initcall(p2041_rdb, swiotlb_setup_bus_notifier); 86machine_arch_initcall(p2041_rdb, swiotlb_setup_bus_notifier);
diff --git a/arch/powerpc/platforms/85xx/p3041_ds.c b/arch/powerpc/platforms/85xx/p3041_ds.c
index f238efa75891..b3edc205daa9 100644
--- a/arch/powerpc/platforms/85xx/p3041_ds.c
+++ b/arch/powerpc/platforms/85xx/p3041_ds.c
@@ -82,7 +82,7 @@ define_machine(p3041_ds) {
82 .power_save = e500_idle, 82 .power_save = e500_idle,
83}; 83};
84 84
85machine_device_initcall(p3041_ds, corenet_ds_publish_devices); 85machine_arch_initcall(p3041_ds, corenet_ds_publish_devices);
86 86
87#ifdef CONFIG_SWIOTLB 87#ifdef CONFIG_SWIOTLB
88machine_arch_initcall(p3041_ds, swiotlb_setup_bus_notifier); 88machine_arch_initcall(p3041_ds, swiotlb_setup_bus_notifier);
diff --git a/arch/powerpc/platforms/85xx/p4080_ds.c b/arch/powerpc/platforms/85xx/p4080_ds.c
index c92417dc6574..54df10632aea 100644
--- a/arch/powerpc/platforms/85xx/p4080_ds.c
+++ b/arch/powerpc/platforms/85xx/p4080_ds.c
@@ -81,7 +81,7 @@ define_machine(p4080_ds) {
81 .power_save = e500_idle, 81 .power_save = e500_idle,
82}; 82};
83 83
84machine_device_initcall(p4080_ds, corenet_ds_publish_devices); 84machine_arch_initcall(p4080_ds, corenet_ds_publish_devices);
85#ifdef CONFIG_SWIOTLB 85#ifdef CONFIG_SWIOTLB
86machine_arch_initcall(p4080_ds, swiotlb_setup_bus_notifier); 86machine_arch_initcall(p4080_ds, swiotlb_setup_bus_notifier);
87#endif 87#endif
diff --git a/arch/powerpc/platforms/85xx/p5020_ds.c b/arch/powerpc/platforms/85xx/p5020_ds.c
index 17bef15a85ed..753a42c29d4d 100644
--- a/arch/powerpc/platforms/85xx/p5020_ds.c
+++ b/arch/powerpc/platforms/85xx/p5020_ds.c
@@ -91,7 +91,7 @@ define_machine(p5020_ds) {
91#endif 91#endif
92}; 92};
93 93
94machine_device_initcall(p5020_ds, corenet_ds_publish_devices); 94machine_arch_initcall(p5020_ds, corenet_ds_publish_devices);
95 95
96#ifdef CONFIG_SWIOTLB 96#ifdef CONFIG_SWIOTLB
97machine_arch_initcall(p5020_ds, swiotlb_setup_bus_notifier); 97machine_arch_initcall(p5020_ds, swiotlb_setup_bus_notifier);
diff --git a/arch/powerpc/platforms/85xx/p5040_ds.c b/arch/powerpc/platforms/85xx/p5040_ds.c
new file mode 100644
index 000000000000..11381851828e
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/p5040_ds.c
@@ -0,0 +1,89 @@
1/*
2 * P5040 DS Setup
3 *
4 * Copyright 2009-2010 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/pci.h>
14
15#include <asm/machdep.h>
16#include <asm/udbg.h>
17#include <asm/mpic.h>
18
19#include <linux/of_fdt.h>
20
21#include <sysdev/fsl_soc.h>
22#include <sysdev/fsl_pci.h>
23#include <asm/ehv_pic.h>
24
25#include "corenet_ds.h"
26
27/*
28 * Called very early, device-tree isn't unflattened
29 */
30static int __init p5040_ds_probe(void)
31{
32 unsigned long root = of_get_flat_dt_root();
33#ifdef CONFIG_SMP
34 extern struct smp_ops_t smp_85xx_ops;
35#endif
36
37 if (of_flat_dt_is_compatible(root, "fsl,P5040DS"))
38 return 1;
39
40 /* Check if we're running under the Freescale hypervisor */
41 if (of_flat_dt_is_compatible(root, "fsl,P5040DS-hv")) {
42 ppc_md.init_IRQ = ehv_pic_init;
43 ppc_md.get_irq = ehv_pic_get_irq;
44 ppc_md.restart = fsl_hv_restart;
45 ppc_md.power_off = fsl_hv_halt;
46 ppc_md.halt = fsl_hv_halt;
47#ifdef CONFIG_SMP
48 /*
49 * Disable the timebase sync operations because we can't write
50 * to the timebase registers under the hypervisor.
51 */
52 smp_85xx_ops.give_timebase = NULL;
53 smp_85xx_ops.take_timebase = NULL;
54#endif
55 return 1;
56 }
57
58 return 0;
59}
60
61define_machine(p5040_ds) {
62 .name = "P5040 DS",
63 .probe = p5040_ds_probe,
64 .setup_arch = corenet_ds_setup_arch,
65 .init_IRQ = corenet_ds_pic_init,
66#ifdef CONFIG_PCI
67 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
68#endif
69/* coreint doesn't play nice with lazy EE, use legacy mpic for now */
70#ifdef CONFIG_PPC64
71 .get_irq = mpic_get_irq,
72#else
73 .get_irq = mpic_get_coreint_irq,
74#endif
75 .restart = fsl_rstcr_restart,
76 .calibrate_decr = generic_calibrate_decr,
77 .progress = udbg_progress,
78#ifdef CONFIG_PPC64
79 .power_save = book3e_idle,
80#else
81 .power_save = e500_idle,
82#endif
83};
84
85machine_arch_initcall(p5040_ds, corenet_ds_publish_devices);
86
87#ifdef CONFIG_SWIOTLB
88machine_arch_initcall(p5040_ds, swiotlb_setup_bus_notifier);
89#endif
diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c b/arch/powerpc/platforms/85xx/qemu_e500.c
index 95a2e53af71b..f6ea5618c733 100644
--- a/arch/powerpc/platforms/85xx/qemu_e500.c
+++ b/arch/powerpc/platforms/85xx/qemu_e500.c
@@ -41,7 +41,8 @@ static void __init qemu_e500_setup_arch(void)
41{ 41{
42 ppc_md.progress("qemu_e500_setup_arch()", 0); 42 ppc_md.progress("qemu_e500_setup_arch()", 0);
43 43
44 fsl_pci_init(); 44 fsl_pci_assign_primary();
45 swiotlb_detect_4g();
45 mpc85xx_smp_init(); 46 mpc85xx_smp_init();
46} 47}
47 48
@@ -55,7 +56,7 @@ static int __init qemu_e500_probe(void)
55 return !!of_flat_dt_is_compatible(root, "fsl,qemu-e500"); 56 return !!of_flat_dt_is_compatible(root, "fsl,qemu-e500");
56} 57}
57 58
58machine_device_initcall(qemu_e500, mpc85xx_common_publish_devices); 59machine_arch_initcall(qemu_e500, mpc85xx_common_publish_devices);
59 60
60define_machine(qemu_e500) { 61define_machine(qemu_e500) {
61 .name = "QEMU e500", 62 .name = "QEMU e500",
diff --git a/arch/powerpc/platforms/85xx/sbc8548.c b/arch/powerpc/platforms/85xx/sbc8548.c
index cd3a66bdb54b..f62121825914 100644
--- a/arch/powerpc/platforms/85xx/sbc8548.c
+++ b/arch/powerpc/platforms/85xx/sbc8548.c
@@ -88,26 +88,11 @@ static int __init sbc8548_hw_rev(void)
88 */ 88 */
89static void __init sbc8548_setup_arch(void) 89static void __init sbc8548_setup_arch(void)
90{ 90{
91#ifdef CONFIG_PCI
92 struct device_node *np;
93#endif
94
95 if (ppc_md.progress) 91 if (ppc_md.progress)
96 ppc_md.progress("sbc8548_setup_arch()", 0); 92 ppc_md.progress("sbc8548_setup_arch()", 0);
97 93
98#ifdef CONFIG_PCI 94 fsl_pci_assign_primary();
99 for_each_node_by_type(np, "pci") { 95
100 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
101 of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
102 struct resource rsrc;
103 of_address_to_resource(np, 0, &rsrc);
104 if ((rsrc.start & 0xfffff) == 0x8000)
105 fsl_add_bridge(np, 1);
106 else
107 fsl_add_bridge(np, 0);
108 }
109 }
110#endif
111 sbc_rev = sbc8548_hw_rev(); 96 sbc_rev = sbc8548_hw_rev();
112} 97}
113 98
@@ -128,7 +113,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
128 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 113 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
129} 114}
130 115
131machine_device_initcall(sbc8548, mpc85xx_common_publish_devices); 116machine_arch_initcall(sbc8548, mpc85xx_common_publish_devices);
132 117
133/* 118/*
134 * Called very early, device-tree isn't unflattened 119 * Called very early, device-tree isn't unflattened
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index ff4249044a3c..6fcfa12e5c56 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -2,7 +2,7 @@
2 * Author: Andy Fleming <afleming@freescale.com> 2 * Author: Andy Fleming <afleming@freescale.com>
3 * Kumar Gala <galak@kernel.crashing.org> 3 * Kumar Gala <galak@kernel.crashing.org>
4 * 4 *
5 * Copyright 2006-2008, 2011 Freescale Semiconductor Inc. 5 * Copyright 2006-2008, 2011-2012 Freescale Semiconductor Inc.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
@@ -17,6 +17,7 @@
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/kexec.h> 18#include <linux/kexec.h>
19#include <linux/highmem.h> 19#include <linux/highmem.h>
20#include <linux/cpu.h>
20 21
21#include <asm/machdep.h> 22#include <asm/machdep.h>
22#include <asm/pgtable.h> 23#include <asm/pgtable.h>
@@ -24,33 +25,118 @@
24#include <asm/mpic.h> 25#include <asm/mpic.h>
25#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
26#include <asm/dbell.h> 27#include <asm/dbell.h>
28#include <asm/fsl_guts.h>
27 29
28#include <sysdev/fsl_soc.h> 30#include <sysdev/fsl_soc.h>
29#include <sysdev/mpic.h> 31#include <sysdev/mpic.h>
30#include "smp.h" 32#include "smp.h"
31 33
32extern void __early_start(void); 34struct epapr_spin_table {
33 35 u32 addr_h;
34#define BOOT_ENTRY_ADDR_UPPER 0 36 u32 addr_l;
35#define BOOT_ENTRY_ADDR_LOWER 1 37 u32 r3_h;
36#define BOOT_ENTRY_R3_UPPER 2 38 u32 r3_l;
37#define BOOT_ENTRY_R3_LOWER 3 39 u32 reserved;
38#define BOOT_ENTRY_RESV 4 40 u32 pir;
39#define BOOT_ENTRY_PIR 5 41};
40#define BOOT_ENTRY_R6_UPPER 6 42
41#define BOOT_ENTRY_R6_LOWER 7 43static struct ccsr_guts __iomem *guts;
42#define NUM_BOOT_ENTRY 8 44static u64 timebase;
43#define SIZE_BOOT_ENTRY (NUM_BOOT_ENTRY * sizeof(u32)) 45static int tb_req;
44 46static int tb_valid;
45static int __init 47
46smp_85xx_kick_cpu(int nr) 48static void mpc85xx_timebase_freeze(int freeze)
49{
50 uint32_t mask;
51
52 mask = CCSR_GUTS_DEVDISR_TB0 | CCSR_GUTS_DEVDISR_TB1;
53 if (freeze)
54 setbits32(&guts->devdisr, mask);
55 else
56 clrbits32(&guts->devdisr, mask);
57
58 in_be32(&guts->devdisr);
59}
60
61static void mpc85xx_give_timebase(void)
62{
63 unsigned long flags;
64
65 local_irq_save(flags);
66
67 while (!tb_req)
68 barrier();
69 tb_req = 0;
70
71 mpc85xx_timebase_freeze(1);
72 timebase = get_tb();
73 mb();
74 tb_valid = 1;
75
76 while (tb_valid)
77 barrier();
78
79 mpc85xx_timebase_freeze(0);
80
81 local_irq_restore(flags);
82}
83
84static void mpc85xx_take_timebase(void)
85{
86 unsigned long flags;
87
88 local_irq_save(flags);
89
90 tb_req = 1;
91 while (!tb_valid)
92 barrier();
93
94 set_tb(timebase >> 32, timebase & 0xffffffff);
95 isync();
96 tb_valid = 0;
97
98 local_irq_restore(flags);
99}
100
101#ifdef CONFIG_HOTPLUG_CPU
102static void __cpuinit smp_85xx_mach_cpu_die(void)
103{
104 unsigned int cpu = smp_processor_id();
105 u32 tmp;
106
107 local_irq_disable();
108 idle_task_exit();
109 generic_set_cpu_dead(cpu);
110 mb();
111
112 mtspr(SPRN_TCR, 0);
113
114 __flush_disable_L1();
115 tmp = (mfspr(SPRN_HID0) & ~(HID0_DOZE|HID0_SLEEP)) | HID0_NAP;
116 mtspr(SPRN_HID0, tmp);
117 isync();
118
119 /* Enter NAP mode. */
120 tmp = mfmsr();
121 tmp |= MSR_WE;
122 mb();
123 mtmsr(tmp);
124 isync();
125
126 while (1)
127 ;
128}
129#endif
130
131static int __cpuinit smp_85xx_kick_cpu(int nr)
47{ 132{
48 unsigned long flags; 133 unsigned long flags;
49 const u64 *cpu_rel_addr; 134 const u64 *cpu_rel_addr;
50 __iomem u32 *bptr_vaddr; 135 __iomem struct epapr_spin_table *spin_table;
51 struct device_node *np; 136 struct device_node *np;
52 int n = 0, hw_cpu = get_hard_smp_processor_id(nr); 137 int hw_cpu = get_hard_smp_processor_id(nr);
53 int ioremappable; 138 int ioremappable;
139 int ret = 0;
54 140
55 WARN_ON(nr < 0 || nr >= NR_CPUS); 141 WARN_ON(nr < 0 || nr >= NR_CPUS);
56 WARN_ON(hw_cpu < 0 || hw_cpu >= NR_CPUS); 142 WARN_ON(hw_cpu < 0 || hw_cpu >= NR_CPUS);
@@ -75,46 +161,81 @@ smp_85xx_kick_cpu(int nr)
75 161
76 /* Map the spin table */ 162 /* Map the spin table */
77 if (ioremappable) 163 if (ioremappable)
78 bptr_vaddr = ioremap(*cpu_rel_addr, SIZE_BOOT_ENTRY); 164 spin_table = ioremap(*cpu_rel_addr,
165 sizeof(struct epapr_spin_table));
79 else 166 else
80 bptr_vaddr = phys_to_virt(*cpu_rel_addr); 167 spin_table = phys_to_virt(*cpu_rel_addr);
81 168
82 local_irq_save(flags); 169 local_irq_save(flags);
83
84 out_be32(bptr_vaddr + BOOT_ENTRY_PIR, hw_cpu);
85#ifdef CONFIG_PPC32 170#ifdef CONFIG_PPC32
86 out_be32(bptr_vaddr + BOOT_ENTRY_ADDR_LOWER, __pa(__early_start)); 171#ifdef CONFIG_HOTPLUG_CPU
172 /* Corresponding to generic_set_cpu_dead() */
173 generic_set_cpu_up(nr);
174
175 if (system_state == SYSTEM_RUNNING) {
176 out_be32(&spin_table->addr_l, 0);
177
178 /*
179 * We don't set the BPTR register here since it already points
180 * to the boot page properly.
181 */
182 mpic_reset_core(hw_cpu);
183
184 /* wait until core is ready... */
185 if (!spin_event_timeout(in_be32(&spin_table->addr_l) == 1,
186 10000, 100)) {
187 pr_err("%s: timeout waiting for core %d to reset\n",
188 __func__, hw_cpu);
189 ret = -ENOENT;
190 goto out;
191 }
192
193 /* clear the acknowledge status */
194 __secondary_hold_acknowledge = -1;
195 }
196#endif
197 out_be32(&spin_table->pir, hw_cpu);
198 out_be32(&spin_table->addr_l, __pa(__early_start));
87 199
88 if (!ioremappable) 200 if (!ioremappable)
89 flush_dcache_range((ulong)bptr_vaddr, 201 flush_dcache_range((ulong)spin_table,
90 (ulong)(bptr_vaddr + SIZE_BOOT_ENTRY)); 202 (ulong)spin_table + sizeof(struct epapr_spin_table));
91 203
92 /* Wait a bit for the CPU to ack. */ 204 /* Wait a bit for the CPU to ack. */
93 while ((__secondary_hold_acknowledge != hw_cpu) && (++n < 1000)) 205 if (!spin_event_timeout(__secondary_hold_acknowledge == hw_cpu,
94 mdelay(1); 206 10000, 100)) {
207 pr_err("%s: timeout waiting for core %d to ack\n",
208 __func__, hw_cpu);
209 ret = -ENOENT;
210 goto out;
211 }
212out:
95#else 213#else
96 smp_generic_kick_cpu(nr); 214 smp_generic_kick_cpu(nr);
97 215
98 out_be64((u64 *)(bptr_vaddr + BOOT_ENTRY_ADDR_UPPER), 216 out_be32(&spin_table->pir, hw_cpu);
99 __pa((u64)*((unsigned long long *) generic_secondary_smp_init))); 217 out_be64((u64 *)(&spin_table->addr_h),
218 __pa((u64)*((unsigned long long *)generic_secondary_smp_init)));
100 219
101 if (!ioremappable) 220 if (!ioremappable)
102 flush_dcache_range((ulong)bptr_vaddr, 221 flush_dcache_range((ulong)spin_table,
103 (ulong)(bptr_vaddr + SIZE_BOOT_ENTRY)); 222 (ulong)spin_table + sizeof(struct epapr_spin_table));
104#endif 223#endif
105 224
106 local_irq_restore(flags); 225 local_irq_restore(flags);
107 226
108 if (ioremappable) 227 if (ioremappable)
109 iounmap(bptr_vaddr); 228 iounmap(spin_table);
110
111 pr_debug("waited %d msecs for CPU #%d.\n", n, nr);
112 229
113 return 0; 230 return ret;
114} 231}
115 232
116struct smp_ops_t smp_85xx_ops = { 233struct smp_ops_t smp_85xx_ops = {
117 .kick_cpu = smp_85xx_kick_cpu, 234 .kick_cpu = smp_85xx_kick_cpu,
235#ifdef CONFIG_HOTPLUG_CPU
236 .cpu_disable = generic_cpu_disable,
237 .cpu_die = generic_cpu_die,
238#endif
118#ifdef CONFIG_KEXEC 239#ifdef CONFIG_KEXEC
119 .give_timebase = smp_generic_give_timebase, 240 .give_timebase = smp_generic_give_timebase,
120 .take_timebase = smp_generic_take_timebase, 241 .take_timebase = smp_generic_take_timebase,
@@ -218,8 +339,7 @@ static void mpc85xx_smp_machine_kexec(struct kimage *image)
218} 339}
219#endif /* CONFIG_KEXEC */ 340#endif /* CONFIG_KEXEC */
220 341
221static void __init 342static void __cpuinit smp_85xx_setup_cpu(int cpu_nr)
222smp_85xx_setup_cpu(int cpu_nr)
223{ 343{
224 if (smp_85xx_ops.probe == smp_mpic_probe) 344 if (smp_85xx_ops.probe == smp_mpic_probe)
225 mpic_setup_this_cpu(); 345 mpic_setup_this_cpu();
@@ -228,6 +348,16 @@ smp_85xx_setup_cpu(int cpu_nr)
228 doorbell_setup_this_cpu(); 348 doorbell_setup_this_cpu();
229} 349}
230 350
351static const struct of_device_id mpc85xx_smp_guts_ids[] = {
352 { .compatible = "fsl,mpc8572-guts", },
353 { .compatible = "fsl,p1020-guts", },
354 { .compatible = "fsl,p1021-guts", },
355 { .compatible = "fsl,p1022-guts", },
356 { .compatible = "fsl,p1023-guts", },
357 { .compatible = "fsl,p2020-guts", },
358 {},
359};
360
231void __init mpc85xx_smp_init(void) 361void __init mpc85xx_smp_init(void)
232{ 362{
233 struct device_node *np; 363 struct device_node *np;
@@ -249,6 +379,22 @@ void __init mpc85xx_smp_init(void)
249 smp_85xx_ops.cause_ipi = doorbell_cause_ipi; 379 smp_85xx_ops.cause_ipi = doorbell_cause_ipi;
250 } 380 }
251 381
382 np = of_find_matching_node(NULL, mpc85xx_smp_guts_ids);
383 if (np) {
384 guts = of_iomap(np, 0);
385 of_node_put(np);
386 if (!guts) {
387 pr_err("%s: Could not map guts node address\n",
388 __func__);
389 return;
390 }
391 smp_85xx_ops.give_timebase = mpc85xx_give_timebase;
392 smp_85xx_ops.take_timebase = mpc85xx_take_timebase;
393#ifdef CONFIG_HOTPLUG_CPU
394 ppc_md.cpu_die = smp_85xx_mach_cpu_die;
395#endif
396 }
397
252 smp_ops = &smp_85xx_ops; 398 smp_ops = &smp_85xx_ops;
253 399
254#ifdef CONFIG_KEXEC 400#ifdef CONFIG_KEXEC
diff --git a/arch/powerpc/platforms/85xx/socrates.c b/arch/powerpc/platforms/85xx/socrates.c
index b9c6daa07b66..ae368e0e1076 100644
--- a/arch/powerpc/platforms/85xx/socrates.c
+++ b/arch/powerpc/platforms/85xx/socrates.c
@@ -66,20 +66,13 @@ static void __init socrates_pic_init(void)
66 */ 66 */
67static void __init socrates_setup_arch(void) 67static void __init socrates_setup_arch(void)
68{ 68{
69#ifdef CONFIG_PCI
70 struct device_node *np;
71#endif
72
73 if (ppc_md.progress) 69 if (ppc_md.progress)
74 ppc_md.progress("socrates_setup_arch()", 0); 70 ppc_md.progress("socrates_setup_arch()", 0);
75 71
76#ifdef CONFIG_PCI 72 fsl_pci_assign_primary();
77 for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
78 fsl_add_bridge(np, 1);
79#endif
80} 73}
81 74
82machine_device_initcall(socrates, mpc85xx_common_publish_devices); 75machine_arch_initcall(socrates, mpc85xx_common_publish_devices);
83 76
84/* 77/*
85 * Called very early, device-tree isn't unflattened 78 * Called very early, device-tree isn't unflattened
diff --git a/arch/powerpc/platforms/85xx/stx_gp3.c b/arch/powerpc/platforms/85xx/stx_gp3.c
index e0508002b086..6f4939b6309e 100644
--- a/arch/powerpc/platforms/85xx/stx_gp3.c
+++ b/arch/powerpc/platforms/85xx/stx_gp3.c
@@ -60,21 +60,14 @@ static void __init stx_gp3_pic_init(void)
60 */ 60 */
61static void __init stx_gp3_setup_arch(void) 61static void __init stx_gp3_setup_arch(void)
62{ 62{
63#ifdef CONFIG_PCI
64 struct device_node *np;
65#endif
66
67 if (ppc_md.progress) 63 if (ppc_md.progress)
68 ppc_md.progress("stx_gp3_setup_arch()", 0); 64 ppc_md.progress("stx_gp3_setup_arch()", 0);
69 65
66 fsl_pci_assign_primary();
67
70#ifdef CONFIG_CPM2 68#ifdef CONFIG_CPM2
71 cpm2_reset(); 69 cpm2_reset();
72#endif 70#endif
73
74#ifdef CONFIG_PCI
75 for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
76 fsl_add_bridge(np, 1);
77#endif
78} 71}
79 72
80static void stx_gp3_show_cpuinfo(struct seq_file *m) 73static void stx_gp3_show_cpuinfo(struct seq_file *m)
@@ -93,7 +86,7 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m)
93 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 86 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
94} 87}
95 88
96machine_device_initcall(stx_gp3, mpc85xx_common_publish_devices); 89machine_arch_initcall(stx_gp3, mpc85xx_common_publish_devices);
97 90
98/* 91/*
99 * Called very early, device-tree isn't unflattened 92 * Called very early, device-tree isn't unflattened
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c
index 3e70a2035e53..b4e58cdc09a5 100644
--- a/arch/powerpc/platforms/85xx/tqm85xx.c
+++ b/arch/powerpc/platforms/85xx/tqm85xx.c
@@ -59,10 +59,6 @@ static void __init tqm85xx_pic_init(void)
59 */ 59 */
60static void __init tqm85xx_setup_arch(void) 60static void __init tqm85xx_setup_arch(void)
61{ 61{
62#ifdef CONFIG_PCI
63 struct device_node *np;
64#endif
65
66 if (ppc_md.progress) 62 if (ppc_md.progress)
67 ppc_md.progress("tqm85xx_setup_arch()", 0); 63 ppc_md.progress("tqm85xx_setup_arch()", 0);
68 64
@@ -70,20 +66,7 @@ static void __init tqm85xx_setup_arch(void)
70 cpm2_reset(); 66 cpm2_reset();
71#endif 67#endif
72 68
73#ifdef CONFIG_PCI 69 fsl_pci_assign_primary();
74 for_each_node_by_type(np, "pci") {
75 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
76 of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
77 struct resource rsrc;
78 if (!of_address_to_resource(np, 0, &rsrc)) {
79 if ((rsrc.start & 0xfffff) == 0x8000)
80 fsl_add_bridge(np, 1);
81 else
82 fsl_add_bridge(np, 0);
83 }
84 }
85 }
86#endif
87} 70}
88 71
89static void tqm85xx_show_cpuinfo(struct seq_file *m) 72static void tqm85xx_show_cpuinfo(struct seq_file *m)
@@ -123,9 +106,9 @@ static void __devinit tqm85xx_ti1520_fixup(struct pci_dev *pdev)
123DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520, 106DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520,
124 tqm85xx_ti1520_fixup); 107 tqm85xx_ti1520_fixup);
125 108
126machine_device_initcall(tqm85xx, mpc85xx_common_publish_devices); 109machine_arch_initcall(tqm85xx, mpc85xx_common_publish_devices);
127 110
128static const char *board[] __initdata = { 111static const char * const board[] __initconst = {
129 "tqc,tqm8540", 112 "tqc,tqm8540",
130 "tqc,tqm8541", 113 "tqc,tqm8541",
131 "tqc,tqm8548", 114 "tqc,tqm8548",
diff --git a/arch/powerpc/platforms/85xx/xes_mpc85xx.c b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
index 41c687550ea7..dcbf7e42dce7 100644
--- a/arch/powerpc/platforms/85xx/xes_mpc85xx.c
+++ b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
@@ -111,18 +111,11 @@ static void xes_mpc85xx_fixups(void)
111 } 111 }
112} 112}
113 113
114#ifdef CONFIG_PCI
115static int primary_phb_addr;
116#endif
117
118/* 114/*
119 * Setup the architecture 115 * Setup the architecture
120 */ 116 */
121static void __init xes_mpc85xx_setup_arch(void) 117static void __init xes_mpc85xx_setup_arch(void)
122{ 118{
123#ifdef CONFIG_PCI
124 struct device_node *np;
125#endif
126 struct device_node *root; 119 struct device_node *root;
127 const char *model = "Unknown"; 120 const char *model = "Unknown";
128 121
@@ -137,26 +130,14 @@ static void __init xes_mpc85xx_setup_arch(void)
137 130
138 xes_mpc85xx_fixups(); 131 xes_mpc85xx_fixups();
139 132
140#ifdef CONFIG_PCI
141 for_each_node_by_type(np, "pci") {
142 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
143 of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
144 struct resource rsrc;
145 of_address_to_resource(np, 0, &rsrc);
146 if ((rsrc.start & 0xfffff) == primary_phb_addr)
147 fsl_add_bridge(np, 1);
148 else
149 fsl_add_bridge(np, 0);
150 }
151 }
152#endif
153
154 mpc85xx_smp_init(); 133 mpc85xx_smp_init();
134
135 fsl_pci_assign_primary();
155} 136}
156 137
157machine_device_initcall(xes_mpc8572, mpc85xx_common_publish_devices); 138machine_arch_initcall(xes_mpc8572, mpc85xx_common_publish_devices);
158machine_device_initcall(xes_mpc8548, mpc85xx_common_publish_devices); 139machine_arch_initcall(xes_mpc8548, mpc85xx_common_publish_devices);
159machine_device_initcall(xes_mpc8540, mpc85xx_common_publish_devices); 140machine_arch_initcall(xes_mpc8540, mpc85xx_common_publish_devices);
160 141
161/* 142/*
162 * Called very early, device-tree isn't unflattened 143 * Called very early, device-tree isn't unflattened
@@ -165,42 +146,21 @@ static int __init xes_mpc8572_probe(void)
165{ 146{
166 unsigned long root = of_get_flat_dt_root(); 147 unsigned long root = of_get_flat_dt_root();
167 148
168 if (of_flat_dt_is_compatible(root, "xes,MPC8572")) { 149 return of_flat_dt_is_compatible(root, "xes,MPC8572");
169#ifdef CONFIG_PCI
170 primary_phb_addr = 0x8000;
171#endif
172 return 1;
173 } else {
174 return 0;
175 }
176} 150}
177 151
178static int __init xes_mpc8548_probe(void) 152static int __init xes_mpc8548_probe(void)
179{ 153{
180 unsigned long root = of_get_flat_dt_root(); 154 unsigned long root = of_get_flat_dt_root();
181 155
182 if (of_flat_dt_is_compatible(root, "xes,MPC8548")) { 156 return of_flat_dt_is_compatible(root, "xes,MPC8548");
183#ifdef CONFIG_PCI
184 primary_phb_addr = 0xb000;
185#endif
186 return 1;
187 } else {
188 return 0;
189 }
190} 157}
191 158
192static int __init xes_mpc8540_probe(void) 159static int __init xes_mpc8540_probe(void)
193{ 160{
194 unsigned long root = of_get_flat_dt_root(); 161 unsigned long root = of_get_flat_dt_root();
195 162
196 if (of_flat_dt_is_compatible(root, "xes,MPC8540")) { 163 return of_flat_dt_is_compatible(root, "xes,MPC8540");
197#ifdef CONFIG_PCI
198 primary_phb_addr = 0xb000;
199#endif
200 return 1;
201 } else {
202 return 0;
203 }
204} 164}
205 165
206define_machine(xes_mpc8572) { 166define_machine(xes_mpc8572) {
diff --git a/arch/powerpc/platforms/86xx/gef_ppc9a.c b/arch/powerpc/platforms/86xx/gef_ppc9a.c
index 563aafa8629c..bf5338754c5a 100644
--- a/arch/powerpc/platforms/86xx/gef_ppc9a.c
+++ b/arch/powerpc/platforms/86xx/gef_ppc9a.c
@@ -73,13 +73,6 @@ static void __init gef_ppc9a_init_irq(void)
73static void __init gef_ppc9a_setup_arch(void) 73static void __init gef_ppc9a_setup_arch(void)
74{ 74{
75 struct device_node *regs; 75 struct device_node *regs;
76#ifdef CONFIG_PCI
77 struct device_node *np;
78
79 for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
80 fsl_add_bridge(np, 1);
81 }
82#endif
83 76
84 printk(KERN_INFO "GE Intelligent Platforms PPC9A 6U VME SBC\n"); 77 printk(KERN_INFO "GE Intelligent Platforms PPC9A 6U VME SBC\n");
85 78
@@ -87,6 +80,8 @@ static void __init gef_ppc9a_setup_arch(void)
87 mpc86xx_smp_init(); 80 mpc86xx_smp_init();
88#endif 81#endif
89 82
83 fsl_pci_assign_primary();
84
90 /* Remap basic board registers */ 85 /* Remap basic board registers */
91 regs = of_find_compatible_node(NULL, NULL, "gef,ppc9a-fpga-regs"); 86 regs = of_find_compatible_node(NULL, NULL, "gef,ppc9a-fpga-regs");
92 if (regs) { 87 if (regs) {
@@ -221,6 +216,7 @@ static long __init mpc86xx_time_init(void)
221static __initdata struct of_device_id of_bus_ids[] = { 216static __initdata struct of_device_id of_bus_ids[] = {
222 { .compatible = "simple-bus", }, 217 { .compatible = "simple-bus", },
223 { .compatible = "gianfar", }, 218 { .compatible = "gianfar", },
219 { .compatible = "fsl,mpc8641-pcie", },
224 {}, 220 {},
225}; 221};
226 222
@@ -231,7 +227,7 @@ static int __init declare_of_platform_devices(void)
231 227
232 return 0; 228 return 0;
233} 229}
234machine_device_initcall(gef_ppc9a, declare_of_platform_devices); 230machine_arch_initcall(gef_ppc9a, declare_of_platform_devices);
235 231
236define_machine(gef_ppc9a) { 232define_machine(gef_ppc9a) {
237 .name = "GE PPC9A", 233 .name = "GE PPC9A",
diff --git a/arch/powerpc/platforms/86xx/gef_sbc310.c b/arch/powerpc/platforms/86xx/gef_sbc310.c
index cc6a91ae0889..0b7851330a07 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc310.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc310.c
@@ -73,20 +73,14 @@ static void __init gef_sbc310_init_irq(void)
73static void __init gef_sbc310_setup_arch(void) 73static void __init gef_sbc310_setup_arch(void)
74{ 74{
75 struct device_node *regs; 75 struct device_node *regs;
76#ifdef CONFIG_PCI
77 struct device_node *np;
78
79 for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
80 fsl_add_bridge(np, 1);
81 }
82#endif
83
84 printk(KERN_INFO "GE Intelligent Platforms SBC310 6U VPX SBC\n"); 76 printk(KERN_INFO "GE Intelligent Platforms SBC310 6U VPX SBC\n");
85 77
86#ifdef CONFIG_SMP 78#ifdef CONFIG_SMP
87 mpc86xx_smp_init(); 79 mpc86xx_smp_init();
88#endif 80#endif
89 81
82 fsl_pci_assign_primary();
83
90 /* Remap basic board registers */ 84 /* Remap basic board registers */
91 regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs"); 85 regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs");
92 if (regs) { 86 if (regs) {
@@ -209,6 +203,7 @@ static long __init mpc86xx_time_init(void)
209static __initdata struct of_device_id of_bus_ids[] = { 203static __initdata struct of_device_id of_bus_ids[] = {
210 { .compatible = "simple-bus", }, 204 { .compatible = "simple-bus", },
211 { .compatible = "gianfar", }, 205 { .compatible = "gianfar", },
206 { .compatible = "fsl,mpc8641-pcie", },
212 {}, 207 {},
213}; 208};
214 209
@@ -219,7 +214,7 @@ static int __init declare_of_platform_devices(void)
219 214
220 return 0; 215 return 0;
221} 216}
222machine_device_initcall(gef_sbc310, declare_of_platform_devices); 217machine_arch_initcall(gef_sbc310, declare_of_platform_devices);
223 218
224define_machine(gef_sbc310) { 219define_machine(gef_sbc310) {
225 .name = "GE SBC310", 220 .name = "GE SBC310",
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
index aead6b337f4a..b9eb174897b1 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc610.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -73,13 +73,6 @@ static void __init gef_sbc610_init_irq(void)
73static void __init gef_sbc610_setup_arch(void) 73static void __init gef_sbc610_setup_arch(void)
74{ 74{
75 struct device_node *regs; 75 struct device_node *regs;
76#ifdef CONFIG_PCI
77 struct device_node *np;
78
79 for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
80 fsl_add_bridge(np, 1);
81 }
82#endif
83 76
84 printk(KERN_INFO "GE Intelligent Platforms SBC610 6U VPX SBC\n"); 77 printk(KERN_INFO "GE Intelligent Platforms SBC610 6U VPX SBC\n");
85 78
@@ -87,6 +80,8 @@ static void __init gef_sbc610_setup_arch(void)
87 mpc86xx_smp_init(); 80 mpc86xx_smp_init();
88#endif 81#endif
89 82
83 fsl_pci_assign_primary();
84
90 /* Remap basic board registers */ 85 /* Remap basic board registers */
91 regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs"); 86 regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs");
92 if (regs) { 87 if (regs) {
@@ -198,6 +193,7 @@ static long __init mpc86xx_time_init(void)
198static __initdata struct of_device_id of_bus_ids[] = { 193static __initdata struct of_device_id of_bus_ids[] = {
199 { .compatible = "simple-bus", }, 194 { .compatible = "simple-bus", },
200 { .compatible = "gianfar", }, 195 { .compatible = "gianfar", },
196 { .compatible = "fsl,mpc8641-pcie", },
201 {}, 197 {},
202}; 198};
203 199
@@ -208,7 +204,7 @@ static int __init declare_of_platform_devices(void)
208 204
209 return 0; 205 return 0;
210} 206}
211machine_device_initcall(gef_sbc610, declare_of_platform_devices); 207machine_arch_initcall(gef_sbc610, declare_of_platform_devices);
212 208
213define_machine(gef_sbc610) { 209define_machine(gef_sbc610) {
214 .name = "GE SBC610", 210 .name = "GE SBC610",
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index 62cd3c555bfb..a817398a56da 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -91,6 +91,9 @@ static struct of_device_id __initdata mpc8610_ids[] = {
91 { .compatible = "simple-bus", }, 91 { .compatible = "simple-bus", },
92 /* So that the DMA channel nodes can be probed individually: */ 92 /* So that the DMA channel nodes can be probed individually: */
93 { .compatible = "fsl,eloplus-dma", }, 93 { .compatible = "fsl,eloplus-dma", },
94 /* PCI controllers */
95 { .compatible = "fsl,mpc8610-pci", },
96 { .compatible = "fsl,mpc8641-pcie", },
94 {} 97 {}
95}; 98};
96 99
@@ -107,7 +110,7 @@ static int __init mpc8610_declare_of_platform_devices(void)
107 110
108 return 0; 111 return 0;
109} 112}
110machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices); 113machine_arch_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices);
111 114
112#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 115#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
113 116
@@ -278,25 +281,13 @@ mpc8610hpcd_valid_monitor_port(enum fsl_diu_monitor_port port)
278static void __init mpc86xx_hpcd_setup_arch(void) 281static void __init mpc86xx_hpcd_setup_arch(void)
279{ 282{
280 struct resource r; 283 struct resource r;
281 struct device_node *np;
282 unsigned char *pixis; 284 unsigned char *pixis;
283 285
284 if (ppc_md.progress) 286 if (ppc_md.progress)
285 ppc_md.progress("mpc86xx_hpcd_setup_arch()", 0); 287 ppc_md.progress("mpc86xx_hpcd_setup_arch()", 0);
286 288
287#ifdef CONFIG_PCI 289 fsl_pci_assign_primary();
288 for_each_node_by_type(np, "pci") { 290
289 if (of_device_is_compatible(np, "fsl,mpc8610-pci")
290 || of_device_is_compatible(np, "fsl,mpc8641-pcie")) {
291 struct resource rsrc;
292 of_address_to_resource(np, 0, &rsrc);
293 if ((rsrc.start & 0xfffff) == 0xa000)
294 fsl_add_bridge(np, 1);
295 else
296 fsl_add_bridge(np, 0);
297 }
298 }
299#endif
300#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 291#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
301 diu_ops.get_pixel_format = mpc8610hpcd_get_pixel_format; 292 diu_ops.get_pixel_format = mpc8610hpcd_get_pixel_format;
302 diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table; 293 diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table;
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 817245bc0219..e8bf3fae5606 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -19,7 +19,6 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/of_platform.h> 21#include <linux/of_platform.h>
22#include <linux/memblock.h>
23 22
24#include <asm/time.h> 23#include <asm/time.h>
25#include <asm/machdep.h> 24#include <asm/machdep.h>
@@ -51,15 +50,8 @@ extern int uli_exclude_device(struct pci_controller *hose,
51static int mpc86xx_exclude_device(struct pci_controller *hose, 50static int mpc86xx_exclude_device(struct pci_controller *hose,
52 u_char bus, u_char devfn) 51 u_char bus, u_char devfn)
53{ 52{
54 struct device_node* node; 53 if (hose->dn == fsl_pci_primary)
55 struct resource rsrc;
56
57 node = hose->dn;
58 of_address_to_resource(node, 0, &rsrc);
59
60 if ((rsrc.start & 0xfffff) == 0x8000) {
61 return uli_exclude_device(hose, bus, devfn); 54 return uli_exclude_device(hose, bus, devfn);
62 }
63 55
64 return PCIBIOS_SUCCESSFUL; 56 return PCIBIOS_SUCCESSFUL;
65} 57}
@@ -69,30 +61,11 @@ static int mpc86xx_exclude_device(struct pci_controller *hose,
69static void __init 61static void __init
70mpc86xx_hpcn_setup_arch(void) 62mpc86xx_hpcn_setup_arch(void)
71{ 63{
72#ifdef CONFIG_PCI
73 struct device_node *np;
74 struct pci_controller *hose;
75#endif
76 dma_addr_t max = 0xffffffff;
77
78 if (ppc_md.progress) 64 if (ppc_md.progress)
79 ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0); 65 ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
80 66
81#ifdef CONFIG_PCI 67#ifdef CONFIG_PCI
82 for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
83 struct resource rsrc;
84 of_address_to_resource(np, 0, &rsrc);
85 if ((rsrc.start & 0xfffff) == 0x8000)
86 fsl_add_bridge(np, 1);
87 else
88 fsl_add_bridge(np, 0);
89 hose = pci_find_hose_for_OF_device(np);
90 max = min(max, hose->dma_window_base_cur +
91 hose->dma_window_size);
92 }
93
94 ppc_md.pci_exclude_device = mpc86xx_exclude_device; 68 ppc_md.pci_exclude_device = mpc86xx_exclude_device;
95
96#endif 69#endif
97 70
98 printk("MPC86xx HPCN board from Freescale Semiconductor\n"); 71 printk("MPC86xx HPCN board from Freescale Semiconductor\n");
@@ -101,13 +74,9 @@ mpc86xx_hpcn_setup_arch(void)
101 mpc86xx_smp_init(); 74 mpc86xx_smp_init();
102#endif 75#endif
103 76
104#ifdef CONFIG_SWIOTLB 77 fsl_pci_assign_primary();
105 if ((memblock_end_of_DRAM() - 1) > max) { 78
106 ppc_swiotlb_enable = 1; 79 swiotlb_detect_4g();
107 set_pci_dma_ops(&swiotlb_dma_ops);
108 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
109 }
110#endif
111} 80}
112 81
113 82
@@ -162,6 +131,7 @@ static __initdata struct of_device_id of_bus_ids[] = {
162 { .compatible = "simple-bus", }, 131 { .compatible = "simple-bus", },
163 { .compatible = "fsl,srio", }, 132 { .compatible = "fsl,srio", },
164 { .compatible = "gianfar", }, 133 { .compatible = "gianfar", },
134 { .compatible = "fsl,mpc8641-pcie", },
165 {}, 135 {},
166}; 136};
167 137
@@ -171,7 +141,7 @@ static int __init declare_of_platform_devices(void)
171 141
172 return 0; 142 return 0;
173} 143}
174machine_device_initcall(mpc86xx_hpcn, declare_of_platform_devices); 144machine_arch_initcall(mpc86xx_hpcn, declare_of_platform_devices);
175machine_arch_initcall(mpc86xx_hpcn, swiotlb_setup_bus_notifier); 145machine_arch_initcall(mpc86xx_hpcn, swiotlb_setup_bus_notifier);
176 146
177define_machine(mpc86xx_hpcn) { 147define_machine(mpc86xx_hpcn) {
diff --git a/arch/powerpc/platforms/86xx/sbc8641d.c b/arch/powerpc/platforms/86xx/sbc8641d.c
index e7007d0d949e..b47a8fd0f3d3 100644
--- a/arch/powerpc/platforms/86xx/sbc8641d.c
+++ b/arch/powerpc/platforms/86xx/sbc8641d.c
@@ -38,23 +38,16 @@
38static void __init 38static void __init
39sbc8641_setup_arch(void) 39sbc8641_setup_arch(void)
40{ 40{
41#ifdef CONFIG_PCI
42 struct device_node *np;
43#endif
44
45 if (ppc_md.progress) 41 if (ppc_md.progress)
46 ppc_md.progress("sbc8641_setup_arch()", 0); 42 ppc_md.progress("sbc8641_setup_arch()", 0);
47 43
48#ifdef CONFIG_PCI
49 for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie")
50 fsl_add_bridge(np, 0);
51#endif
52
53 printk("SBC8641 board from Wind River\n"); 44 printk("SBC8641 board from Wind River\n");
54 45
55#ifdef CONFIG_SMP 46#ifdef CONFIG_SMP
56 mpc86xx_smp_init(); 47 mpc86xx_smp_init();
57#endif 48#endif
49
50 fsl_pci_assign_primary();
58} 51}
59 52
60 53
@@ -102,6 +95,7 @@ mpc86xx_time_init(void)
102static __initdata struct of_device_id of_bus_ids[] = { 95static __initdata struct of_device_id of_bus_ids[] = {
103 { .compatible = "simple-bus", }, 96 { .compatible = "simple-bus", },
104 { .compatible = "gianfar", }, 97 { .compatible = "gianfar", },
98 { .compatible = "fsl,mpc8641-pcie", },
105 {}, 99 {},
106}; 100};
107 101
@@ -111,7 +105,7 @@ static int __init declare_of_platform_devices(void)
111 105
112 return 0; 106 return 0;
113} 107}
114machine_device_initcall(sbc8641, declare_of_platform_devices); 108machine_arch_initcall(sbc8641, declare_of_platform_devices);
115 109
116define_machine(sbc8641) { 110define_machine(sbc8641) {
117 .name = "SBC8641D", 111 .name = "SBC8641D",
diff --git a/arch/powerpc/platforms/cell/beat.c b/arch/powerpc/platforms/cell/beat.c
index 852592b2b712..affcf566d460 100644
--- a/arch/powerpc/platforms/cell/beat.c
+++ b/arch/powerpc/platforms/cell/beat.c
@@ -136,9 +136,9 @@ ssize_t beat_nvram_get_size(void)
136 return BEAT_NVRAM_SIZE; 136 return BEAT_NVRAM_SIZE;
137} 137}
138 138
139int beat_set_xdabr(unsigned long dabr) 139int beat_set_xdabr(unsigned long dabr, unsigned long dabrx)
140{ 140{
141 if (beat_set_dabr(dabr, DABRX_KERNEL | DABRX_USER)) 141 if (beat_set_dabr(dabr, dabrx))
142 return -1; 142 return -1;
143 return 0; 143 return 0;
144} 144}
diff --git a/arch/powerpc/platforms/cell/beat.h b/arch/powerpc/platforms/cell/beat.h
index 32c8efcedc80..bfcb8e351ae5 100644
--- a/arch/powerpc/platforms/cell/beat.h
+++ b/arch/powerpc/platforms/cell/beat.h
@@ -32,7 +32,7 @@ void beat_get_rtc_time(struct rtc_time *);
32ssize_t beat_nvram_get_size(void); 32ssize_t beat_nvram_get_size(void);
33ssize_t beat_nvram_read(char *, size_t, loff_t *); 33ssize_t beat_nvram_read(char *, size_t, loff_t *);
34ssize_t beat_nvram_write(char *, size_t, loff_t *); 34ssize_t beat_nvram_write(char *, size_t, loff_t *);
35int beat_set_xdabr(unsigned long); 35int beat_set_xdabr(unsigned long, unsigned long);
36void beat_power_save(void); 36void beat_power_save(void);
37void beat_kexec_cpu_down(int, int); 37void beat_kexec_cpu_down(int, int);
38 38
diff --git a/arch/powerpc/platforms/cell/beat_htab.c b/arch/powerpc/platforms/cell/beat_htab.c
index 943c9d39aa16..0f6f83988b3d 100644
--- a/arch/powerpc/platforms/cell/beat_htab.c
+++ b/arch/powerpc/platforms/cell/beat_htab.c
@@ -88,7 +88,7 @@ static inline unsigned int beat_read_mask(unsigned hpte_group)
88} 88}
89 89
90static long beat_lpar_hpte_insert(unsigned long hpte_group, 90static long beat_lpar_hpte_insert(unsigned long hpte_group,
91 unsigned long va, unsigned long pa, 91 unsigned long vpn, unsigned long pa,
92 unsigned long rflags, unsigned long vflags, 92 unsigned long rflags, unsigned long vflags,
93 int psize, int ssize) 93 int psize, int ssize)
94{ 94{
@@ -103,7 +103,7 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group,
103 "rflags=%lx, vflags=%lx, psize=%d)\n", 103 "rflags=%lx, vflags=%lx, psize=%d)\n",
104 hpte_group, va, pa, rflags, vflags, psize); 104 hpte_group, va, pa, rflags, vflags, psize);
105 105
106 hpte_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M) | 106 hpte_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M) |
107 vflags | HPTE_V_VALID; 107 vflags | HPTE_V_VALID;
108 hpte_r = hpte_encode_r(pa, psize) | rflags; 108 hpte_r = hpte_encode_r(pa, psize) | rflags;
109 109
@@ -184,14 +184,14 @@ static void beat_lpar_hptab_clear(void)
184 */ 184 */
185static long beat_lpar_hpte_updatepp(unsigned long slot, 185static long beat_lpar_hpte_updatepp(unsigned long slot,
186 unsigned long newpp, 186 unsigned long newpp,
187 unsigned long va, 187 unsigned long vpn,
188 int psize, int ssize, int local) 188 int psize, int ssize, int local)
189{ 189{
190 unsigned long lpar_rc; 190 unsigned long lpar_rc;
191 u64 dummy0, dummy1; 191 u64 dummy0, dummy1;
192 unsigned long want_v; 192 unsigned long want_v;
193 193
194 want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); 194 want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M);
195 195
196 DBG_LOW(" update: " 196 DBG_LOW(" update: "
197 "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ", 197 "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ",
@@ -220,15 +220,15 @@ static long beat_lpar_hpte_updatepp(unsigned long slot,
220 return 0; 220 return 0;
221} 221}
222 222
223static long beat_lpar_hpte_find(unsigned long va, int psize) 223static long beat_lpar_hpte_find(unsigned long vpn, int psize)
224{ 224{
225 unsigned long hash; 225 unsigned long hash;
226 unsigned long i, j; 226 unsigned long i, j;
227 long slot; 227 long slot;
228 unsigned long want_v, hpte_v; 228 unsigned long want_v, hpte_v;
229 229
230 hash = hpt_hash(va, mmu_psize_defs[psize].shift, MMU_SEGSIZE_256M); 230 hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, MMU_SEGSIZE_256M);
231 want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); 231 want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M);
232 232
233 for (j = 0; j < 2; j++) { 233 for (j = 0; j < 2; j++) {
234 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 234 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
@@ -255,14 +255,15 @@ static void beat_lpar_hpte_updateboltedpp(unsigned long newpp,
255 unsigned long ea, 255 unsigned long ea,
256 int psize, int ssize) 256 int psize, int ssize)
257{ 257{
258 unsigned long lpar_rc, slot, vsid, va; 258 unsigned long vpn;
259 unsigned long lpar_rc, slot, vsid;
259 u64 dummy0, dummy1; 260 u64 dummy0, dummy1;
260 261
261 vsid = get_kernel_vsid(ea, MMU_SEGSIZE_256M); 262 vsid = get_kernel_vsid(ea, MMU_SEGSIZE_256M);
262 va = (vsid << 28) | (ea & 0x0fffffff); 263 vpn = hpt_vpn(ea, vsid, MMU_SEGSIZE_256M);
263 264
264 raw_spin_lock(&beat_htab_lock); 265 raw_spin_lock(&beat_htab_lock);
265 slot = beat_lpar_hpte_find(va, psize); 266 slot = beat_lpar_hpte_find(vpn, psize);
266 BUG_ON(slot == -1); 267 BUG_ON(slot == -1);
267 268
268 lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7, 269 lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7,
@@ -272,7 +273,7 @@ static void beat_lpar_hpte_updateboltedpp(unsigned long newpp,
272 BUG_ON(lpar_rc != 0); 273 BUG_ON(lpar_rc != 0);
273} 274}
274 275
275static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long va, 276static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn,
276 int psize, int ssize, int local) 277 int psize, int ssize, int local)
277{ 278{
278 unsigned long want_v; 279 unsigned long want_v;
@@ -282,7 +283,7 @@ static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long va,
282 283
283 DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", 284 DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n",
284 slot, va, psize, local); 285 slot, va, psize, local);
285 want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); 286 want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M);
286 287
287 raw_spin_lock_irqsave(&beat_htab_lock, flags); 288 raw_spin_lock_irqsave(&beat_htab_lock, flags);
288 dummy1 = beat_lpar_hpte_getword0(slot); 289 dummy1 = beat_lpar_hpte_getword0(slot);
@@ -311,7 +312,7 @@ void __init hpte_init_beat(void)
311} 312}
312 313
313static long beat_lpar_hpte_insert_v3(unsigned long hpte_group, 314static long beat_lpar_hpte_insert_v3(unsigned long hpte_group,
314 unsigned long va, unsigned long pa, 315 unsigned long vpn, unsigned long pa,
315 unsigned long rflags, unsigned long vflags, 316 unsigned long rflags, unsigned long vflags,
316 int psize, int ssize) 317 int psize, int ssize)
317{ 318{
@@ -322,11 +323,11 @@ static long beat_lpar_hpte_insert_v3(unsigned long hpte_group,
322 return -1; 323 return -1;
323 324
324 if (!(vflags & HPTE_V_BOLTED)) 325 if (!(vflags & HPTE_V_BOLTED))
325 DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " 326 DBG_LOW("hpte_insert(group=%lx, vpn=%016lx, pa=%016lx, "
326 "rflags=%lx, vflags=%lx, psize=%d)\n", 327 "rflags=%lx, vflags=%lx, psize=%d)\n",
327 hpte_group, va, pa, rflags, vflags, psize); 328 hpte_group, vpn, pa, rflags, vflags, psize);
328 329
329 hpte_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M) | 330 hpte_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M) |
330 vflags | HPTE_V_VALID; 331 vflags | HPTE_V_VALID;
331 hpte_r = hpte_encode_r(pa, psize) | rflags; 332 hpte_r = hpte_encode_r(pa, psize) | rflags;
332 333
@@ -364,14 +365,14 @@ static long beat_lpar_hpte_insert_v3(unsigned long hpte_group,
364 */ 365 */
365static long beat_lpar_hpte_updatepp_v3(unsigned long slot, 366static long beat_lpar_hpte_updatepp_v3(unsigned long slot,
366 unsigned long newpp, 367 unsigned long newpp,
367 unsigned long va, 368 unsigned long vpn,
368 int psize, int ssize, int local) 369 int psize, int ssize, int local)
369{ 370{
370 unsigned long lpar_rc; 371 unsigned long lpar_rc;
371 unsigned long want_v; 372 unsigned long want_v;
372 unsigned long pss; 373 unsigned long pss;
373 374
374 want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); 375 want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M);
375 pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc; 376 pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc;
376 377
377 DBG_LOW(" update: " 378 DBG_LOW(" update: "
@@ -392,16 +393,16 @@ static long beat_lpar_hpte_updatepp_v3(unsigned long slot,
392 return 0; 393 return 0;
393} 394}
394 395
395static void beat_lpar_hpte_invalidate_v3(unsigned long slot, unsigned long va, 396static void beat_lpar_hpte_invalidate_v3(unsigned long slot, unsigned long vpn,
396 int psize, int ssize, int local) 397 int psize, int ssize, int local)
397{ 398{
398 unsigned long want_v; 399 unsigned long want_v;
399 unsigned long lpar_rc; 400 unsigned long lpar_rc;
400 unsigned long pss; 401 unsigned long pss;
401 402
402 DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", 403 DBG_LOW(" inval : slot=%lx, vpn=%016lx, psize: %d, local: %d\n",
403 slot, va, psize, local); 404 slot, vpn, psize, local);
404 want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); 405 want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M);
405 pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc; 406 pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc;
406 407
407 lpar_rc = beat_invalidate_htab_entry3(0, slot, want_v, pss); 408 lpar_rc = beat_invalidate_htab_entry3(0, slot, want_v, pss);
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 14943ef01918..7d2d036754b5 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -19,12 +19,12 @@
19 19
20#undef DEBUG 20#undef DEBUG
21 21
22#include <linux/memblock.h>
22#include <linux/types.h> 23#include <linux/types.h>
23#include <linux/spinlock.h> 24#include <linux/spinlock.h>
24#include <linux/pci.h> 25#include <linux/pci.h>
25#include <asm/iommu.h> 26#include <asm/iommu.h>
26#include <asm/machdep.h> 27#include <asm/machdep.h>
27#include <asm/abs_addr.h>
28#include <asm/firmware.h> 28#include <asm/firmware.h>
29 29
30#define IOBMAP_PAGE_SHIFT 12 30#define IOBMAP_PAGE_SHIFT 12
@@ -99,7 +99,7 @@ static int iobmap_build(struct iommu_table *tbl, long index,
99 ip = ((u32 *)tbl->it_base) + index; 99 ip = ((u32 *)tbl->it_base) + index;
100 100
101 while (npages--) { 101 while (npages--) {
102 rpn = virt_to_abs(uaddr) >> IOBMAP_PAGE_SHIFT; 102 rpn = __pa(uaddr) >> IOBMAP_PAGE_SHIFT;
103 103
104 *(ip++) = IOBMAP_L2E_V | rpn; 104 *(ip++) = IOBMAP_L2E_V | rpn;
105 /* invalidate tlb, can be optimized more */ 105 /* invalidate tlb, can be optimized more */
@@ -258,7 +258,7 @@ void __init alloc_iobmap_l2(void)
258 return; 258 return;
259#endif 259#endif
260 /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */ 260 /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */
261 iob_l2_base = (u32 *)abs_to_virt(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000)); 261 iob_l2_base = (u32 *)__va(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000));
262 262
263 printk(KERN_INFO "IOBMAP L2 allocated at: %p\n", iob_l2_base); 263 printk(KERN_INFO "IOBMAP L2 allocated at: %p\n", iob_l2_base);
264} 264}
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 0e7eccc0f88d..471aa3ccd9fd 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -30,19 +30,10 @@
30#include <asm/opal.h> 30#include <asm/opal.h>
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>
34 33
35#include "powernv.h" 34#include "powernv.h"
36#include "pci.h" 35#include "pci.h"
37 36
38struct resource_wrap {
39 struct list_head link;
40 resource_size_t size;
41 resource_size_t align;
42 struct pci_dev *dev; /* Set if it's a device */
43 struct pci_bus *bus; /* Set if it's a bridge */
44};
45
46static int __pe_printk(const char *level, const struct pnv_ioda_pe *pe, 37static int __pe_printk(const char *level, const struct pnv_ioda_pe *pe,
47 struct va_format *vaf) 38 struct va_format *vaf)
48{ 39{
@@ -78,273 +69,6 @@ define_pe_printk_level(pe_err, KERN_ERR);
78define_pe_printk_level(pe_warn, KERN_WARNING); 69define_pe_printk_level(pe_warn, KERN_WARNING);
79define_pe_printk_level(pe_info, KERN_INFO); 70define_pe_printk_level(pe_info, KERN_INFO);
80 71
81
82/* Calculate resource usage & alignment requirement of a single
83 * device. This will also assign all resources within the device
84 * for a given type starting at 0 for the biggest one and then
85 * assigning in decreasing order of size.
86 */
87static void __devinit pnv_ioda_calc_dev(struct pci_dev *dev, unsigned int flags,
88 resource_size_t *size,
89 resource_size_t *align)
90{
91 resource_size_t start;
92 struct resource *r;
93 int i;
94
95 pr_devel(" -> CDR %s\n", pci_name(dev));
96
97 *size = *align = 0;
98
99 /* Clear the resources out and mark them all unset */
100 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
101 r = &dev->resource[i];
102 if (!(r->flags & flags))
103 continue;
104 if (r->start) {
105 r->end -= r->start;
106 r->start = 0;
107 }
108 r->flags |= IORESOURCE_UNSET;
109 }
110
111 /* We currently keep all memory resources together, we
112 * will handle prefetch & 64-bit separately in the future
113 * but for now we stick everybody in M32
114 */
115 start = 0;
116 for (;;) {
117 resource_size_t max_size = 0;
118 int max_no = -1;
119
120 /* Find next biggest resource */
121 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
122 r = &dev->resource[i];
123 if (!(r->flags & IORESOURCE_UNSET) ||
124 !(r->flags & flags))
125 continue;
126 if (resource_size(r) > max_size) {
127 max_size = resource_size(r);
128 max_no = i;
129 }
130 }
131 if (max_no < 0)
132 break;
133 r = &dev->resource[max_no];
134 if (max_size > *align)
135 *align = max_size;
136 *size += max_size;
137 r->start = start;
138 start += max_size;
139 r->end = r->start + max_size - 1;
140 r->flags &= ~IORESOURCE_UNSET;
141 pr_devel(" -> R%d %016llx..%016llx\n",
142 max_no, r->start, r->end);
143 }
144 pr_devel(" <- CDR %s size=%llx align=%llx\n",
145 pci_name(dev), *size, *align);
146}
147
148/* Allocate a resource "wrap" for a given device or bridge and
149 * insert it at the right position in the sorted list
150 */
151static void __devinit pnv_ioda_add_wrap(struct list_head *list,
152 struct pci_bus *bus,
153 struct pci_dev *dev,
154 resource_size_t size,
155 resource_size_t align)
156{
157 struct resource_wrap *w1, *w = kzalloc(sizeof(*w), GFP_KERNEL);
158
159 w->size = size;
160 w->align = align;
161 w->dev = dev;
162 w->bus = bus;
163
164 list_for_each_entry(w1, list, link) {
165 if (w1->align < align) {
166 list_add_tail(&w->link, &w1->link);
167 return;
168 }
169 }
170 list_add_tail(&w->link, list);
171}
172
173/* Offset device resources of a given type */
174static void __devinit pnv_ioda_offset_dev(struct pci_dev *dev,
175 unsigned int flags,
176 resource_size_t offset)
177{
178 struct resource *r;
179 int i;
180
181 pr_devel(" -> ODR %s [%x] +%016llx\n", pci_name(dev), flags, offset);
182
183 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
184 r = &dev->resource[i];
185 if (r->flags & flags) {
186 dev->resource[i].start += offset;
187 dev->resource[i].end += offset;
188 }
189 }
190
191 pr_devel(" <- ODR %s [%x] +%016llx\n", pci_name(dev), flags, offset);
192}
193
194/* Offset bus resources (& all children) of a given type */
195static void __devinit pnv_ioda_offset_bus(struct pci_bus *bus,
196 unsigned int flags,
197 resource_size_t offset)
198{
199 struct resource *r;
200 struct pci_dev *dev;
201 struct pci_bus *cbus;
202 int i;
203
204 pr_devel(" -> OBR %s [%x] +%016llx\n",
205 bus->self ? pci_name(bus->self) : "root", flags, offset);
206
207 pci_bus_for_each_resource(bus, r, i) {
208 if (r && (r->flags & flags)) {
209 r->start += offset;
210 r->end += offset;
211 }
212 }
213 list_for_each_entry(dev, &bus->devices, bus_list)
214 pnv_ioda_offset_dev(dev, flags, offset);
215 list_for_each_entry(cbus, &bus->children, node)
216 pnv_ioda_offset_bus(cbus, flags, offset);
217
218 pr_devel(" <- OBR %s [%x]\n",
219 bus->self ? pci_name(bus->self) : "root", flags);
220}
221
222/* This is the guts of our IODA resource allocation. This is called
223 * recursively for each bus in the system. It calculates all the
224 * necessary size and requirements for children and assign them
225 * resources such that:
226 *
227 * - Each function fits in it's own contiguous set of IO/M32
228 * segment
229 *
230 * - All segments behind a P2P bridge are contiguous and obey
231 * alignment constraints of those bridges
232 */
233static void __devinit pnv_ioda_calc_bus(struct pci_bus *bus, unsigned int flags,
234 resource_size_t *size,
235 resource_size_t *align)
236{
237 struct pci_controller *hose = pci_bus_to_host(bus);
238 struct pnv_phb *phb = hose->private_data;
239 resource_size_t dev_size, dev_align, start;
240 resource_size_t min_align, min_balign;
241 struct pci_dev *cdev;
242 struct pci_bus *cbus;
243 struct list_head head;
244 struct resource_wrap *w;
245 unsigned int bres;
246
247 *size = *align = 0;
248
249 pr_devel("-> CBR %s [%x]\n",
250 bus->self ? pci_name(bus->self) : "root", flags);
251
252 /* Calculate alignment requirements based on the type
253 * of resource we are working on
254 */
255 if (flags & IORESOURCE_IO) {
256 bres = 0;
257 min_align = phb->ioda.io_segsize;
258 min_balign = 0x1000;
259 } else {
260 bres = 1;
261 min_align = phb->ioda.m32_segsize;
262 min_balign = 0x100000;
263 }
264
265 /* Gather all our children resources ordered by alignment */
266 INIT_LIST_HEAD(&head);
267
268 /* - Busses */
269 list_for_each_entry(cbus, &bus->children, node) {
270 pnv_ioda_calc_bus(cbus, flags, &dev_size, &dev_align);
271 pnv_ioda_add_wrap(&head, cbus, NULL, dev_size, dev_align);
272 }
273
274 /* - Devices */
275 list_for_each_entry(cdev, &bus->devices, bus_list) {
276 pnv_ioda_calc_dev(cdev, flags, &dev_size, &dev_align);
277 /* Align them to segment size */
278 if (dev_align < min_align)
279 dev_align = min_align;
280 pnv_ioda_add_wrap(&head, NULL, cdev, dev_size, dev_align);
281 }
282 if (list_empty(&head))
283 goto empty;
284
285 /* Now we can do two things: assign offsets to them within that
286 * level and get our total alignment & size requirements. The
287 * assignment algorithm is going to be uber-trivial for now, we
288 * can try to be smarter later at filling out holes.
289 */
290 if (bus->self) {
291 /* No offset for downstream bridges */
292 start = 0;
293 } else {
294 /* Offset from the root */
295 if (flags & IORESOURCE_IO)
296 /* Don't hand out IO 0 */
297 start = hose->io_resource.start + 0x1000;
298 else
299 start = hose->mem_resources[0].start;
300 }
301 while(!list_empty(&head)) {
302 w = list_first_entry(&head, struct resource_wrap, link);
303 list_del(&w->link);
304 if (w->size) {
305 if (start) {
306 start = ALIGN(start, w->align);
307 if (w->dev)
308 pnv_ioda_offset_dev(w->dev,flags,start);
309 else if (w->bus)
310 pnv_ioda_offset_bus(w->bus,flags,start);
311 }
312 if (w->align > *align)
313 *align = w->align;
314 }
315 start += w->size;
316 kfree(w);
317 }
318 *size = start;
319
320 /* Align and setup bridge resources */
321 *align = max_t(resource_size_t, *align,
322 max_t(resource_size_t, min_align, min_balign));
323 *size = ALIGN(*size,
324 max_t(resource_size_t, min_align, min_balign));
325 empty:
326 /* Only setup P2P's, not the PHB itself */
327 if (bus->self) {
328 struct resource *res = bus->resource[bres];
329
330 if (WARN_ON(res == NULL))
331 return;
332
333 /*
334 * FIXME: We should probably export and call
335 * pci_bridge_check_ranges() to properly re-initialize
336 * the PCI portion of the flags here, and to detect
337 * what the bridge actually supports.
338 */
339 res->start = 0;
340 res->flags = (*size) ? flags : 0;
341 res->end = (*size) ? (*size - 1) : 0;
342 }
343
344 pr_devel("<- CBR %s [%x] *size=%016llx *align=%016llx\n",
345 bus->self ? pci_name(bus->self) : "root", flags,*size,*align);
346}
347
348static struct pci_dn *pnv_ioda_get_pdn(struct pci_dev *dev) 72static struct pci_dn *pnv_ioda_get_pdn(struct pci_dev *dev)
349{ 73{
350 struct device_node *np; 74 struct device_node *np;
@@ -355,172 +79,6 @@ static struct pci_dn *pnv_ioda_get_pdn(struct pci_dev *dev)
355 return PCI_DN(np); 79 return PCI_DN(np);
356} 80}
357 81
358static void __devinit pnv_ioda_setup_pe_segments(struct pci_dev *dev)
359{
360 struct pci_controller *hose = pci_bus_to_host(dev->bus);
361 struct pnv_phb *phb = hose->private_data;
362 struct pci_dn *pdn = pnv_ioda_get_pdn(dev);
363 unsigned int pe, i;
364 resource_size_t pos;
365 struct resource io_res;
366 struct resource m32_res;
367 struct pci_bus_region region;
368 int rc;
369
370 /* Anything not referenced in the device-tree gets PE#0 */
371 pe = pdn ? pdn->pe_number : 0;
372
373 /* Calculate the device min/max */
374 io_res.start = m32_res.start = (resource_size_t)-1;
375 io_res.end = m32_res.end = 0;
376 io_res.flags = IORESOURCE_IO;
377 m32_res.flags = IORESOURCE_MEM;
378
379 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
380 struct resource *r = NULL;
381 if (dev->resource[i].flags & IORESOURCE_IO)
382 r = &io_res;
383 if (dev->resource[i].flags & IORESOURCE_MEM)
384 r = &m32_res;
385 if (!r)
386 continue;
387 if (dev->resource[i].start < r->start)
388 r->start = dev->resource[i].start;
389 if (dev->resource[i].end > r->end)
390 r->end = dev->resource[i].end;
391 }
392
393 /* Setup IO segments */
394 if (io_res.start < io_res.end) {
395 pcibios_resource_to_bus(dev, &region, &io_res);
396 pos = region.start;
397 i = pos / phb->ioda.io_segsize;
398 while(i < phb->ioda.total_pe && pos <= region.end) {
399 if (phb->ioda.io_segmap[i]) {
400 pr_err("%s: Trying to use IO seg #%d which is"
401 " already used by PE# %d\n",
402 pci_name(dev), i,
403 phb->ioda.io_segmap[i]);
404 /* XXX DO SOMETHING TO DISABLE DEVICE ? */
405 break;
406 }
407 phb->ioda.io_segmap[i] = pe;
408 rc = opal_pci_map_pe_mmio_window(phb->opal_id, pe,
409 OPAL_IO_WINDOW_TYPE,
410 0, i);
411 if (rc != OPAL_SUCCESS) {
412 pr_err("%s: OPAL error %d setting up mapping"
413 " for IO seg# %d\n",
414 pci_name(dev), rc, i);
415 /* XXX DO SOMETHING TO DISABLE DEVICE ? */
416 break;
417 }
418 pos += phb->ioda.io_segsize;
419 i++;
420 };
421 }
422
423 /* Setup M32 segments */
424 if (m32_res.start < m32_res.end) {
425 pcibios_resource_to_bus(dev, &region, &m32_res);
426 pos = region.start;
427 i = pos / phb->ioda.m32_segsize;
428 while(i < phb->ioda.total_pe && pos <= region.end) {
429 if (phb->ioda.m32_segmap[i]) {
430 pr_err("%s: Trying to use M32 seg #%d which is"
431 " already used by PE# %d\n",
432 pci_name(dev), i,
433 phb->ioda.m32_segmap[i]);
434 /* XXX DO SOMETHING TO DISABLE DEVICE ? */
435 break;
436 }
437 phb->ioda.m32_segmap[i] = pe;
438 rc = opal_pci_map_pe_mmio_window(phb->opal_id, pe,
439 OPAL_M32_WINDOW_TYPE,
440 0, i);
441 if (rc != OPAL_SUCCESS) {
442 pr_err("%s: OPAL error %d setting up mapping"
443 " for M32 seg# %d\n",
444 pci_name(dev), rc, i);
445 /* XXX DO SOMETHING TO DISABLE DEVICE ? */
446 break;
447 }
448 pos += phb->ioda.m32_segsize;
449 i++;
450 }
451 }
452}
453
454/* Check if a resource still fits in the total IO or M32 range
455 * for a given PHB
456 */
457static int __devinit pnv_ioda_resource_fit(struct pci_controller *hose,
458 struct resource *r)
459{
460 struct resource *bounds;
461
462 if (r->flags & IORESOURCE_IO)
463 bounds = &hose->io_resource;
464 else if (r->flags & IORESOURCE_MEM)
465 bounds = &hose->mem_resources[0];
466 else
467 return 1;
468
469 if (r->start >= bounds->start && r->end <= bounds->end)
470 return 1;
471 r->flags = 0;
472 return 0;
473}
474
475static void __devinit pnv_ioda_update_resources(struct pci_bus *bus)
476{
477 struct pci_controller *hose = pci_bus_to_host(bus);
478 struct pci_bus *cbus;
479 struct pci_dev *cdev;
480 unsigned int i;
481
482 /* We used to clear all device enables here. However it looks like
483 * clearing MEM enable causes Obsidian (IPR SCS) to go bonkers,
484 * and shoot fatal errors to the PHB which in turns fences itself
485 * and we can't recover from that ... yet. So for now, let's leave
486 * the enables as-is and hope for the best.
487 */
488
489 /* Check if bus resources fit in our IO or M32 range */
490 for (i = 0; bus->self && (i < 2); i++) {
491 struct resource *r = bus->resource[i];
492 if (r && !pnv_ioda_resource_fit(hose, r))
493 pr_err("%s: Bus %d resource %d disabled, no room\n",
494 pci_name(bus->self), bus->number, i);
495 }
496
497 /* Update self if it's not a PHB */
498 if (bus->self)
499 pci_setup_bridge(bus);
500
501 /* Update child devices */
502 list_for_each_entry(cdev, &bus->devices, bus_list) {
503 /* Check if resource fits, if not, disabled it */
504 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
505 struct resource *r = &cdev->resource[i];
506 if (!pnv_ioda_resource_fit(hose, r))
507 pr_err("%s: Resource %d disabled, no room\n",
508 pci_name(cdev), i);
509 }
510
511 /* Assign segments */
512 pnv_ioda_setup_pe_segments(cdev);
513
514 /* Update HW BARs */
515 for (i = 0; i <= PCI_ROM_RESOURCE; i++)
516 pci_update_resource(cdev, i);
517 }
518
519 /* Update child busses */
520 list_for_each_entry(cbus, &bus->children, node)
521 pnv_ioda_update_resources(cbus);
522}
523
524static int __devinit pnv_ioda_alloc_pe(struct pnv_phb *phb) 82static int __devinit pnv_ioda_alloc_pe(struct pnv_phb *phb)
525{ 83{
526 unsigned long pe; 84 unsigned long pe;
@@ -548,7 +106,7 @@ static void __devinit pnv_ioda_free_pe(struct pnv_phb *phb, int pe)
548 * but in the meantime, we need to protect them to avoid warnings 106 * but in the meantime, we need to protect them to avoid warnings
549 */ 107 */
550#ifdef CONFIG_PCI_MSI 108#ifdef CONFIG_PCI_MSI
551static struct pnv_ioda_pe * __devinit __pnv_ioda_get_one_pe(struct pci_dev *dev) 109static struct pnv_ioda_pe * __devinit pnv_ioda_get_pe(struct pci_dev *dev)
552{ 110{
553 struct pci_controller *hose = pci_bus_to_host(dev->bus); 111 struct pci_controller *hose = pci_bus_to_host(dev->bus);
554 struct pnv_phb *phb = hose->private_data; 112 struct pnv_phb *phb = hose->private_data;
@@ -560,19 +118,6 @@ static struct pnv_ioda_pe * __devinit __pnv_ioda_get_one_pe(struct pci_dev *dev)
560 return NULL; 118 return NULL;
561 return &phb->ioda.pe_array[pdn->pe_number]; 119 return &phb->ioda.pe_array[pdn->pe_number];
562} 120}
563
564static struct pnv_ioda_pe * __devinit pnv_ioda_get_pe(struct pci_dev *dev)
565{
566 struct pnv_ioda_pe *pe = __pnv_ioda_get_one_pe(dev);
567
568 while (!pe && dev->bus->self) {
569 dev = dev->bus->self;
570 pe = __pnv_ioda_get_one_pe(dev);
571 if (pe)
572 pe = pe->bus_pe;
573 }
574 return pe;
575}
576#endif /* CONFIG_PCI_MSI */ 121#endif /* CONFIG_PCI_MSI */
577 122
578static int __devinit pnv_ioda_configure_pe(struct pnv_phb *phb, 123static int __devinit pnv_ioda_configure_pe(struct pnv_phb *phb,
@@ -589,7 +134,11 @@ static int __devinit pnv_ioda_configure_pe(struct pnv_phb *phb,
589 dcomp = OPAL_IGNORE_RID_DEVICE_NUMBER; 134 dcomp = OPAL_IGNORE_RID_DEVICE_NUMBER;
590 fcomp = OPAL_IGNORE_RID_FUNCTION_NUMBER; 135 fcomp = OPAL_IGNORE_RID_FUNCTION_NUMBER;
591 parent = pe->pbus->self; 136 parent = pe->pbus->self;
592 count = pe->pbus->busn_res.end - pe->pbus->busn_res.start + 1; 137 if (pe->flags & PNV_IODA_PE_BUS_ALL)
138 count = pe->pbus->busn_res.end - pe->pbus->busn_res.start + 1;
139 else
140 count = 1;
141
593 switch(count) { 142 switch(count) {
594 case 1: bcomp = OpalPciBusAll; break; 143 case 1: bcomp = OpalPciBusAll; break;
595 case 2: bcomp = OpalPciBus7Bits; break; 144 case 2: bcomp = OpalPciBus7Bits; break;
@@ -666,13 +215,13 @@ static void __devinit pnv_ioda_link_pe_by_weight(struct pnv_phb *phb,
666{ 215{
667 struct pnv_ioda_pe *lpe; 216 struct pnv_ioda_pe *lpe;
668 217
669 list_for_each_entry(lpe, &phb->ioda.pe_list, link) { 218 list_for_each_entry(lpe, &phb->ioda.pe_dma_list, dma_link) {
670 if (lpe->dma_weight < pe->dma_weight) { 219 if (lpe->dma_weight < pe->dma_weight) {
671 list_add_tail(&pe->link, &lpe->link); 220 list_add_tail(&pe->dma_link, &lpe->dma_link);
672 return; 221 return;
673 } 222 }
674 } 223 }
675 list_add_tail(&pe->link, &phb->ioda.pe_list); 224 list_add_tail(&pe->dma_link, &phb->ioda.pe_dma_list);
676} 225}
677 226
678static unsigned int pnv_ioda_dma_weight(struct pci_dev *dev) 227static unsigned int pnv_ioda_dma_weight(struct pci_dev *dev)
@@ -699,6 +248,7 @@ static unsigned int pnv_ioda_dma_weight(struct pci_dev *dev)
699 return 10; 248 return 10;
700} 249}
701 250
251#if 0
702static struct pnv_ioda_pe * __devinit pnv_ioda_setup_dev_PE(struct pci_dev *dev) 252static struct pnv_ioda_pe * __devinit pnv_ioda_setup_dev_PE(struct pci_dev *dev)
703{ 253{
704 struct pci_controller *hose = pci_bus_to_host(dev->bus); 254 struct pci_controller *hose = pci_bus_to_host(dev->bus);
@@ -767,6 +317,7 @@ static struct pnv_ioda_pe * __devinit pnv_ioda_setup_dev_PE(struct pci_dev *dev)
767 317
768 return pe; 318 return pe;
769} 319}
320#endif /* Useful for SRIOV case */
770 321
771static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe) 322static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe)
772{ 323{
@@ -784,34 +335,33 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe)
784 pdn->pcidev = dev; 335 pdn->pcidev = dev;
785 pdn->pe_number = pe->pe_number; 336 pdn->pe_number = pe->pe_number;
786 pe->dma_weight += pnv_ioda_dma_weight(dev); 337 pe->dma_weight += pnv_ioda_dma_weight(dev);
787 if (dev->subordinate) 338 if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate)
788 pnv_ioda_setup_same_PE(dev->subordinate, pe); 339 pnv_ioda_setup_same_PE(dev->subordinate, pe);
789 } 340 }
790} 341}
791 342
792static void __devinit pnv_ioda_setup_bus_PE(struct pci_dev *dev, 343/*
793 struct pnv_ioda_pe *ppe) 344 * There're 2 types of PCI bus sensitive PEs: One that is compromised of
345 * single PCI bus. Another one that contains the primary PCI bus and its
346 * subordinate PCI devices and buses. The second type of PE is normally
347 * orgiriated by PCIe-to-PCI bridge or PLX switch downstream ports.
348 */
349static void __devinit pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all)
794{ 350{
795 struct pci_controller *hose = pci_bus_to_host(dev->bus); 351 struct pci_controller *hose = pci_bus_to_host(bus);
796 struct pnv_phb *phb = hose->private_data; 352 struct pnv_phb *phb = hose->private_data;
797 struct pci_bus *bus = dev->subordinate;
798 struct pnv_ioda_pe *pe; 353 struct pnv_ioda_pe *pe;
799 int pe_num; 354 int pe_num;
800 355
801 if (!bus) {
802 pr_warning("%s: Bridge without a subordinate bus !\n",
803 pci_name(dev));
804 return;
805 }
806 pe_num = pnv_ioda_alloc_pe(phb); 356 pe_num = pnv_ioda_alloc_pe(phb);
807 if (pe_num == IODA_INVALID_PE) { 357 if (pe_num == IODA_INVALID_PE) {
808 pr_warning("%s: Not enough PE# available, disabling bus\n", 358 pr_warning("%s: Not enough PE# available for PCI bus %04x:%02x\n",
809 pci_name(dev)); 359 __func__, pci_domain_nr(bus), bus->number);
810 return; 360 return;
811 } 361 }
812 362
813 pe = &phb->ioda.pe_array[pe_num]; 363 pe = &phb->ioda.pe_array[pe_num];
814 ppe->bus_pe = pe; 364 pe->flags = (all ? PNV_IODA_PE_BUS_ALL : PNV_IODA_PE_BUS);
815 pe->pbus = bus; 365 pe->pbus = bus;
816 pe->pdev = NULL; 366 pe->pdev = NULL;
817 pe->tce32_seg = -1; 367 pe->tce32_seg = -1;
@@ -819,8 +369,12 @@ static void __devinit pnv_ioda_setup_bus_PE(struct pci_dev *dev,
819 pe->rid = bus->busn_res.start << 8; 369 pe->rid = bus->busn_res.start << 8;
820 pe->dma_weight = 0; 370 pe->dma_weight = 0;
821 371
822 pe_info(pe, "Secondary busses %pR associated with PE\n", 372 if (all)
823 &bus->busn_res); 373 pe_info(pe, "Secondary bus %d..%d associated with PE#%d\n",
374 bus->busn_res.start, bus->busn_res.end, pe_num);
375 else
376 pe_info(pe, "Secondary bus %d associated with PE#%d\n",
377 bus->busn_res.start, pe_num);
824 378
825 if (pnv_ioda_configure_pe(phb, pe)) { 379 if (pnv_ioda_configure_pe(phb, pe)) {
826 /* XXX What do we do here ? */ 380 /* XXX What do we do here ? */
@@ -833,6 +387,9 @@ static void __devinit pnv_ioda_setup_bus_PE(struct pci_dev *dev,
833 /* Associate it with all child devices */ 387 /* Associate it with all child devices */
834 pnv_ioda_setup_same_PE(bus, pe); 388 pnv_ioda_setup_same_PE(bus, pe);
835 389
390 /* Put PE to the list */
391 list_add_tail(&pe->list, &phb->ioda.pe_list);
392
836 /* Account for one DMA PE if at least one DMA capable device exist 393 /* Account for one DMA PE if at least one DMA capable device exist
837 * below the bridge 394 * below the bridge
838 */ 395 */
@@ -848,17 +405,33 @@ static void __devinit pnv_ioda_setup_bus_PE(struct pci_dev *dev,
848static void __devinit pnv_ioda_setup_PEs(struct pci_bus *bus) 405static void __devinit pnv_ioda_setup_PEs(struct pci_bus *bus)
849{ 406{
850 struct pci_dev *dev; 407 struct pci_dev *dev;
851 struct pnv_ioda_pe *pe; 408
409 pnv_ioda_setup_bus_PE(bus, 0);
852 410
853 list_for_each_entry(dev, &bus->devices, bus_list) { 411 list_for_each_entry(dev, &bus->devices, bus_list) {
854 pe = pnv_ioda_setup_dev_PE(dev); 412 if (dev->subordinate) {
855 if (pe == NULL) 413 if (pci_pcie_type(dev) == PCI_EXP_TYPE_PCI_BRIDGE)
856 continue; 414 pnv_ioda_setup_bus_PE(dev->subordinate, 1);
857 /* Leaving the PCIe domain ... single PE# */ 415 else
858 if (pci_pcie_type(dev) == PCI_EXP_TYPE_PCI_BRIDGE) 416 pnv_ioda_setup_PEs(dev->subordinate);
859 pnv_ioda_setup_bus_PE(dev, pe); 417 }
860 else if (dev->subordinate) 418 }
861 pnv_ioda_setup_PEs(dev->subordinate); 419}
420
421/*
422 * Configure PEs so that the downstream PCI buses and devices
423 * could have their associated PE#. Unfortunately, we didn't
424 * figure out the way to identify the PLX bridge yet. So we
425 * simply put the PCI bus and the subordinate behind the root
426 * port to PE# here. The game rule here is expected to be changed
427 * as soon as we can detected PLX bridge correctly.
428 */
429static void __devinit pnv_pci_ioda_setup_PEs(void)
430{
431 struct pci_controller *hose, *tmp;
432
433 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
434 pnv_ioda_setup_PEs(hose->bus);
862 } 435 }
863} 436}
864 437
@@ -1000,7 +573,7 @@ static void __devinit pnv_ioda_setup_dma(struct pnv_phb *phb)
1000 remaining = phb->ioda.tce32_count; 573 remaining = phb->ioda.tce32_count;
1001 tw = phb->ioda.dma_weight; 574 tw = phb->ioda.dma_weight;
1002 base = 0; 575 base = 0;
1003 list_for_each_entry(pe, &phb->ioda.pe_list, link) { 576 list_for_each_entry(pe, &phb->ioda.pe_dma_list, dma_link) {
1004 if (!pe->dma_weight) 577 if (!pe->dma_weight)
1005 continue; 578 continue;
1006 if (!remaining) { 579 if (!remaining) {
@@ -1109,36 +682,115 @@ static void pnv_pci_init_ioda_msis(struct pnv_phb *phb)
1109static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) { } 682static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) { }
1110#endif /* CONFIG_PCI_MSI */ 683#endif /* CONFIG_PCI_MSI */
1111 684
1112/* This is the starting point of our IODA specific resource 685/*
1113 * allocation process 686 * This function is supposed to be called on basis of PE from top
687 * to bottom style. So the the I/O or MMIO segment assigned to
688 * parent PE could be overrided by its child PEs if necessary.
1114 */ 689 */
1115static void __devinit pnv_pci_ioda_fixup_phb(struct pci_controller *hose) 690static void __devinit pnv_ioda_setup_pe_seg(struct pci_controller *hose,
691 struct pnv_ioda_pe *pe)
1116{ 692{
1117 resource_size_t size, align; 693 struct pnv_phb *phb = hose->private_data;
1118 struct pci_bus *child; 694 struct pci_bus_region region;
695 struct resource *res;
696 int i, index;
697 int rc;
1119 698
1120 /* Associate PEs per functions */ 699 /*
1121 pnv_ioda_setup_PEs(hose->bus); 700 * NOTE: We only care PCI bus based PE for now. For PCI
701 * device based PE, for example SRIOV sensitive VF should
702 * be figured out later.
703 */
704 BUG_ON(!(pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL)));
1122 705
1123 /* Calculate all resources */ 706 pci_bus_for_each_resource(pe->pbus, res, i) {
1124 pnv_ioda_calc_bus(hose->bus, IORESOURCE_IO, &size, &align); 707 if (!res || !res->flags ||
1125 pnv_ioda_calc_bus(hose->bus, IORESOURCE_MEM, &size, &align); 708 res->start > res->end)
709 continue;
1126 710
1127 /* Apply then to HW */ 711 if (res->flags & IORESOURCE_IO) {
1128 pnv_ioda_update_resources(hose->bus); 712 region.start = res->start - phb->ioda.io_pci_base;
713 region.end = res->end - phb->ioda.io_pci_base;
714 index = region.start / phb->ioda.io_segsize;
715
716 while (index < phb->ioda.total_pe &&
717 region.start <= region.end) {
718 phb->ioda.io_segmap[index] = pe->pe_number;
719 rc = opal_pci_map_pe_mmio_window(phb->opal_id,
720 pe->pe_number, OPAL_IO_WINDOW_TYPE, 0, index);
721 if (rc != OPAL_SUCCESS) {
722 pr_err("%s: OPAL error %d when mapping IO "
723 "segment #%d to PE#%d\n",
724 __func__, rc, index, pe->pe_number);
725 break;
726 }
727
728 region.start += phb->ioda.io_segsize;
729 index++;
730 }
731 } else if (res->flags & IORESOURCE_MEM) {
732 region.start = res->start -
733 hose->pci_mem_offset -
734 phb->ioda.m32_pci_base;
735 region.end = res->end -
736 hose->pci_mem_offset -
737 phb->ioda.m32_pci_base;
738 index = region.start / phb->ioda.m32_segsize;
739
740 while (index < phb->ioda.total_pe &&
741 region.start <= region.end) {
742 phb->ioda.m32_segmap[index] = pe->pe_number;
743 rc = opal_pci_map_pe_mmio_window(phb->opal_id,
744 pe->pe_number, OPAL_M32_WINDOW_TYPE, 0, index);
745 if (rc != OPAL_SUCCESS) {
746 pr_err("%s: OPAL error %d when mapping M32 "
747 "segment#%d to PE#%d",
748 __func__, rc, index, pe->pe_number);
749 break;
750 }
751
752 region.start += phb->ioda.m32_segsize;
753 index++;
754 }
755 }
756 }
757}
1129 758
1130 /* Setup DMA */ 759static void __devinit pnv_pci_ioda_setup_seg(void)
1131 pnv_ioda_setup_dma(hose->private_data); 760{
761 struct pci_controller *tmp, *hose;
762 struct pnv_phb *phb;
763 struct pnv_ioda_pe *pe;
1132 764
1133 /* Configure PCI Express settings */ 765 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
1134 list_for_each_entry(child, &hose->bus->children, node) { 766 phb = hose->private_data;
1135 struct pci_dev *self = child->self; 767 list_for_each_entry(pe, &phb->ioda.pe_list, list) {
1136 if (!self) 768 pnv_ioda_setup_pe_seg(hose, pe);
1137 continue; 769 }
1138 pcie_bus_configure_settings(child, self->pcie_mpss); 770 }
771}
772
773static void __devinit pnv_pci_ioda_setup_DMA(void)
774{
775 struct pci_controller *hose, *tmp;
776 struct pnv_phb *phb;
777
778 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
779 pnv_ioda_setup_dma(hose->private_data);
780
781 /* Mark the PHB initialization done */
782 phb = hose->private_data;
783 phb->initialized = 1;
1139 } 784 }
1140} 785}
1141 786
787static void __devinit pnv_pci_ioda_fixup(void)
788{
789 pnv_pci_ioda_setup_PEs();
790 pnv_pci_ioda_setup_seg();
791 pnv_pci_ioda_setup_DMA();
792}
793
1142/* 794/*
1143 * Returns the alignment for I/O or memory windows for P2P 795 * Returns the alignment for I/O or memory windows for P2P
1144 * bridges. That actually depends on how PEs are segmented. 796 * bridges. That actually depends on how PEs are segmented.
@@ -1182,10 +834,22 @@ static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus,
1182 */ 834 */
1183static int __devinit pnv_pci_enable_device_hook(struct pci_dev *dev) 835static int __devinit pnv_pci_enable_device_hook(struct pci_dev *dev)
1184{ 836{
1185 struct pci_dn *pdn = pnv_ioda_get_pdn(dev); 837 struct pci_controller *hose = pci_bus_to_host(dev->bus);
838 struct pnv_phb *phb = hose->private_data;
839 struct pci_dn *pdn;
1186 840
841 /* The function is probably called while the PEs have
842 * not be created yet. For example, resource reassignment
843 * during PCI probe period. We just skip the check if
844 * PEs isn't ready.
845 */
846 if (!phb->initialized)
847 return 0;
848
849 pdn = pnv_ioda_get_pdn(dev);
1187 if (!pdn || pdn->pe_number == IODA_INVALID_PE) 850 if (!pdn || pdn->pe_number == IODA_INVALID_PE)
1188 return -EINVAL; 851 return -EINVAL;
852
1189 return 0; 853 return 0;
1190} 854}
1191 855
@@ -1276,9 +940,9 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
1276 /* Allocate aux data & arrays */ 940 /* Allocate aux data & arrays */
1277 size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long)); 941 size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long));
1278 m32map_off = size; 942 m32map_off = size;
1279 size += phb->ioda.total_pe; 943 size += phb->ioda.total_pe * sizeof(phb->ioda.m32_segmap[0]);
1280 iomap_off = size; 944 iomap_off = size;
1281 size += phb->ioda.total_pe; 945 size += phb->ioda.total_pe * sizeof(phb->ioda.io_segmap[0]);
1282 pemap_off = size; 946 pemap_off = size;
1283 size += phb->ioda.total_pe * sizeof(struct pnv_ioda_pe); 947 size += phb->ioda.total_pe * sizeof(struct pnv_ioda_pe);
1284 aux = alloc_bootmem(size); 948 aux = alloc_bootmem(size);
@@ -1289,6 +953,7 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
1289 phb->ioda.pe_array = aux + pemap_off; 953 phb->ioda.pe_array = aux + pemap_off;
1290 set_bit(0, phb->ioda.pe_alloc); 954 set_bit(0, phb->ioda.pe_alloc);
1291 955
956 INIT_LIST_HEAD(&phb->ioda.pe_dma_list);
1292 INIT_LIST_HEAD(&phb->ioda.pe_list); 957 INIT_LIST_HEAD(&phb->ioda.pe_list);
1293 958
1294 /* Calculate how many 32-bit TCE segments we have */ 959 /* Calculate how many 32-bit TCE segments we have */
@@ -1337,15 +1002,17 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
1337 /* Setup MSI support */ 1002 /* Setup MSI support */
1338 pnv_pci_init_ioda_msis(phb); 1003 pnv_pci_init_ioda_msis(phb);
1339 1004
1340 /* We set both PCI_PROBE_ONLY and PCI_REASSIGN_ALL_RSRC. This is an 1005 /*
1341 * odd combination which essentially means that we skip all resource 1006 * We pass the PCI probe flag PCI_REASSIGN_ALL_RSRC here
1342 * fixups and assignments in the generic code, and do it all 1007 * to let the PCI core do resource assignment. It's supposed
1343 * ourselves here 1008 * that the PCI core will do correct I/O and MMIO alignment
1009 * for the P2P bridge bars so that each PCI bus (excluding
1010 * the child P2P bridges) can form individual PE.
1344 */ 1011 */
1345 ppc_md.pcibios_fixup_phb = pnv_pci_ioda_fixup_phb; 1012 ppc_md.pcibios_fixup = pnv_pci_ioda_fixup;
1346 ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook; 1013 ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook;
1347 ppc_md.pcibios_window_alignment = pnv_pci_window_alignment; 1014 ppc_md.pcibios_window_alignment = pnv_pci_window_alignment;
1348 pci_add_flags(PCI_PROBE_ONLY | PCI_REASSIGN_ALL_RSRC); 1015 pci_add_flags(PCI_REASSIGN_ALL_RSRC);
1349 1016
1350 /* Reset IODA tables to a clean state */ 1017 /* Reset IODA tables to a clean state */
1351 rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET); 1018 rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET);
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
index 264967770c3a..6b4bef4e9d82 100644
--- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
+++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
@@ -30,7 +30,6 @@
30#include <asm/opal.h> 30#include <asm/opal.h>
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>
34 33
35#include "powernv.h" 34#include "powernv.h"
36#include "pci.h" 35#include "pci.h"
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index be3cfc5ceabb..c01688a1a741 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -30,7 +30,6 @@
30#include <asm/opal.h> 30#include <asm/opal.h>
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>
34#include <asm/firmware.h> 33#include <asm/firmware.h>
35 34
36#include "powernv.h" 35#include "powernv.h"
@@ -447,6 +446,11 @@ static void pnv_tce_free(struct iommu_table *tbl, long index, long npages)
447 pnv_tce_invalidate(tbl, tces, tcep - 1); 446 pnv_tce_invalidate(tbl, tces, tcep - 1);
448} 447}
449 448
449static unsigned long pnv_tce_get(struct iommu_table *tbl, long index)
450{
451 return ((u64 *)tbl->it_base)[index - tbl->it_offset];
452}
453
450void pnv_pci_setup_iommu_table(struct iommu_table *tbl, 454void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
451 void *tce_mem, u64 tce_size, 455 void *tce_mem, u64 tce_size,
452 u64 dma_offset) 456 u64 dma_offset)
@@ -597,6 +601,7 @@ void __init pnv_pci_init(void)
597 ppc_md.pci_dma_dev_setup = pnv_pci_dma_dev_setup; 601 ppc_md.pci_dma_dev_setup = pnv_pci_dma_dev_setup;
598 ppc_md.tce_build = pnv_tce_build; 602 ppc_md.tce_build = pnv_tce_build;
599 ppc_md.tce_free = pnv_tce_free; 603 ppc_md.tce_free = pnv_tce_free;
604 ppc_md.tce_get = pnv_tce_get;
600 ppc_md.pci_probe_mode = pnv_pci_probe_mode; 605 ppc_md.pci_probe_mode = pnv_pci_probe_mode;
601 set_pci_dma_ops(&dma_iommu_ops); 606 set_pci_dma_ops(&dma_iommu_ops);
602 607
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 8bc479634643..7cfb7c883deb 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -17,9 +17,14 @@ enum pnv_phb_model {
17}; 17};
18 18
19#define PNV_PCI_DIAG_BUF_SIZE 4096 19#define PNV_PCI_DIAG_BUF_SIZE 4096
20#define PNV_IODA_PE_DEV (1 << 0) /* PE has single PCI device */
21#define PNV_IODA_PE_BUS (1 << 1) /* PE has primary PCI bus */
22#define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */
20 23
21/* Data associated with a PE, including IOMMU tracking etc.. */ 24/* Data associated with a PE, including IOMMU tracking etc.. */
22struct pnv_ioda_pe { 25struct pnv_ioda_pe {
26 unsigned long flags;
27
23 /* A PE can be associated with a single device or an 28 /* A PE can be associated with a single device or an
24 * entire bus (& children). In the former case, pdev 29 * entire bus (& children). In the former case, pdev
25 * is populated, in the later case, pbus is. 30 * is populated, in the later case, pbus is.
@@ -40,11 +45,6 @@ struct pnv_ioda_pe {
40 */ 45 */
41 unsigned int dma_weight; 46 unsigned int dma_weight;
42 47
43 /* This is a PCI-E -> PCI-X bridge, this points to the
44 * corresponding bus PE
45 */
46 struct pnv_ioda_pe *bus_pe;
47
48 /* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */ 48 /* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */
49 int tce32_seg; 49 int tce32_seg;
50 int tce32_segcount; 50 int tce32_segcount;
@@ -59,7 +59,8 @@ struct pnv_ioda_pe {
59 int mve_number; 59 int mve_number;
60 60
61 /* Link in list of PE#s */ 61 /* Link in list of PE#s */
62 struct list_head link; 62 struct list_head dma_link;
63 struct list_head list;
63}; 64};
64 65
65struct pnv_phb { 66struct pnv_phb {
@@ -68,6 +69,7 @@ struct pnv_phb {
68 enum pnv_phb_model model; 69 enum pnv_phb_model model;
69 u64 opal_id; 70 u64 opal_id;
70 void __iomem *regs; 71 void __iomem *regs;
72 int initialized;
71 spinlock_t lock; 73 spinlock_t lock;
72 74
73#ifdef CONFIG_PCI_MSI 75#ifdef CONFIG_PCI_MSI
@@ -107,6 +109,11 @@ struct pnv_phb {
107 unsigned int *io_segmap; 109 unsigned int *io_segmap;
108 struct pnv_ioda_pe *pe_array; 110 struct pnv_ioda_pe *pe_array;
109 111
112 /* Sorted list of used PE's based
113 * on the sequence of creation
114 */
115 struct list_head pe_list;
116
110 /* Reverse map of PEs, will have to extend if 117 /* Reverse map of PEs, will have to extend if
111 * we are to support more than 256 PEs, indexed 118 * we are to support more than 256 PEs, indexed
112 * bus { bus, devfn } 119 * bus { bus, devfn }
@@ -125,7 +132,7 @@ struct pnv_phb {
125 /* Sorted list of used PE's, sorted at 132 /* Sorted list of used PE's, sorted at
126 * boot for resource allocation purposes 133 * boot for resource allocation purposes
127 */ 134 */
128 struct list_head pe_list; 135 struct list_head pe_dma_list;
129 } ioda; 136 } ioda;
130 }; 137 };
131 138
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index 3124cf791ebb..d00d7b0a3bda 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -43,7 +43,7 @@ enum ps3_lpar_vas_id {
43 43
44static DEFINE_SPINLOCK(ps3_htab_lock); 44static DEFINE_SPINLOCK(ps3_htab_lock);
45 45
46static long ps3_hpte_insert(unsigned long hpte_group, unsigned long va, 46static long ps3_hpte_insert(unsigned long hpte_group, unsigned long vpn,
47 unsigned long pa, unsigned long rflags, unsigned long vflags, 47 unsigned long pa, unsigned long rflags, unsigned long vflags,
48 int psize, int ssize) 48 int psize, int ssize)
49{ 49{
@@ -61,7 +61,7 @@ static long ps3_hpte_insert(unsigned long hpte_group, unsigned long va,
61 */ 61 */
62 vflags &= ~HPTE_V_SECONDARY; 62 vflags &= ~HPTE_V_SECONDARY;
63 63
64 hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID; 64 hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID;
65 hpte_r = hpte_encode_r(ps3_mm_phys_to_lpar(pa), psize) | rflags; 65 hpte_r = hpte_encode_r(ps3_mm_phys_to_lpar(pa), psize) | rflags;
66 66
67 spin_lock_irqsave(&ps3_htab_lock, flags); 67 spin_lock_irqsave(&ps3_htab_lock, flags);
@@ -75,8 +75,8 @@ static long ps3_hpte_insert(unsigned long hpte_group, unsigned long va,
75 75
76 if (result) { 76 if (result) {
77 /* all entries bolted !*/ 77 /* all entries bolted !*/
78 pr_info("%s:result=%d va=%lx pa=%lx ix=%lx v=%llx r=%llx\n", 78 pr_info("%s:result=%d vpn=%lx pa=%lx ix=%lx v=%llx r=%llx\n",
79 __func__, result, va, pa, hpte_group, hpte_v, hpte_r); 79 __func__, result, vpn, pa, hpte_group, hpte_v, hpte_r);
80 BUG(); 80 BUG();
81 } 81 }
82 82
@@ -107,7 +107,7 @@ static long ps3_hpte_remove(unsigned long hpte_group)
107} 107}
108 108
109static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp, 109static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp,
110 unsigned long va, int psize, int ssize, int local) 110 unsigned long vpn, int psize, int ssize, int local)
111{ 111{
112 int result; 112 int result;
113 u64 hpte_v, want_v, hpte_rs; 113 u64 hpte_v, want_v, hpte_rs;
@@ -115,7 +115,7 @@ static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp,
115 unsigned long flags; 115 unsigned long flags;
116 long ret; 116 long ret;
117 117
118 want_v = hpte_encode_v(va, psize, ssize); 118 want_v = hpte_encode_v(vpn, psize, ssize);
119 119
120 spin_lock_irqsave(&ps3_htab_lock, flags); 120 spin_lock_irqsave(&ps3_htab_lock, flags);
121 121
@@ -125,8 +125,8 @@ static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp,
125 &hpte_rs); 125 &hpte_rs);
126 126
127 if (result) { 127 if (result) {
128 pr_info("%s: res=%d read va=%lx slot=%lx psize=%d\n", 128 pr_info("%s: res=%d read vpn=%lx slot=%lx psize=%d\n",
129 __func__, result, va, slot, psize); 129 __func__, result, vpn, slot, psize);
130 BUG(); 130 BUG();
131 } 131 }
132 132
@@ -159,7 +159,7 @@ static void ps3_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,
159 panic("ps3_hpte_updateboltedpp() not implemented"); 159 panic("ps3_hpte_updateboltedpp() not implemented");
160} 160}
161 161
162static void ps3_hpte_invalidate(unsigned long slot, unsigned long va, 162static void ps3_hpte_invalidate(unsigned long slot, unsigned long vpn,
163 int psize, int ssize, int local) 163 int psize, int ssize, int local)
164{ 164{
165 unsigned long flags; 165 unsigned long flags;
@@ -170,8 +170,8 @@ static void ps3_hpte_invalidate(unsigned long slot, unsigned long va,
170 result = lv1_write_htab_entry(PS3_LPAR_VAS_ID_CURRENT, slot, 0, 0); 170 result = lv1_write_htab_entry(PS3_LPAR_VAS_ID_CURRENT, slot, 0, 0);
171 171
172 if (result) { 172 if (result) {
173 pr_info("%s: res=%d va=%lx slot=%lx psize=%d\n", 173 pr_info("%s: res=%d vpn=%lx slot=%lx psize=%d\n",
174 __func__, result, va, slot, psize); 174 __func__, result, vpn, slot, psize);
175 BUG(); 175 BUG();
176 } 176 }
177 177
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 2d664c5a83b0..3f509f86432c 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -184,11 +184,15 @@ early_param("ps3flash", early_parse_ps3flash);
184#define prealloc_ps3flash_bounce_buffer() do { } while (0) 184#define prealloc_ps3flash_bounce_buffer() do { } while (0)
185#endif 185#endif
186 186
187static int ps3_set_dabr(unsigned long dabr) 187static int ps3_set_dabr(unsigned long dabr, unsigned long dabrx)
188{ 188{
189 enum {DABR_USER = 1, DABR_KERNEL = 2,}; 189 /* Have to set at least one bit in the DABRX */
190 if (dabrx == 0 && dabr == 0)
191 dabrx = DABRX_USER;
192 /* hypervisor only allows us to set BTI, Kernel and user */
193 dabrx &= DABRX_BTI | DABRX_KERNEL | DABRX_USER;
190 194
191 return lv1_set_dabr(dabr, DABR_KERNEL | DABR_USER) ? -1 : 0; 195 return lv1_set_dabr(dabr, dabrx) ? -1 : 0;
192} 196}
193 197
194static void __init ps3_setup_arch(void) 198static void __init ps3_setup_arch(void)
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index c222189f5bb2..890622b87c8f 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -6,8 +6,9 @@ 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_dev.o eeh_cache.o eeh_driver.o \ 9obj-$(CONFIG_EEH) += eeh.o eeh_pe.o eeh_dev.o eeh_cache.o \
10 eeh_event.o eeh_sysfs.o eeh_pseries.o 10 eeh_driver.o eeh_event.o eeh_sysfs.o \
11 eeh_pseries.o
11obj-$(CONFIG_KEXEC) += kexec.o 12obj-$(CONFIG_KEXEC) += kexec.o
12obj-$(CONFIG_PCI) += pci.o pci_dlpar.o 13obj-$(CONFIG_PCI) += pci.o pci_dlpar.o
13obj-$(CONFIG_PSERIES_MSI) += msi.o 14obj-$(CONFIG_PSERIES_MSI) += msi.o
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index ecd394cf34e6..9a04322b1736 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -92,6 +92,20 @@ struct eeh_ops *eeh_ops = NULL;
92int eeh_subsystem_enabled; 92int eeh_subsystem_enabled;
93EXPORT_SYMBOL(eeh_subsystem_enabled); 93EXPORT_SYMBOL(eeh_subsystem_enabled);
94 94
95/*
96 * EEH probe mode support. The intention is to support multiple
97 * platforms for EEH. Some platforms like pSeries do PCI emunation
98 * based on device tree. However, other platforms like powernv probe
99 * PCI devices from hardware. The flag is used to distinguish that.
100 * In addition, struct eeh_ops::probe would be invoked for particular
101 * OF node or PCI device so that the corresponding PE would be created
102 * there.
103 */
104int eeh_probe_mode;
105
106/* Global EEH mutex */
107DEFINE_MUTEX(eeh_mutex);
108
95/* Lock to avoid races due to multiple reports of an error */ 109/* Lock to avoid races due to multiple reports of an error */
96static DEFINE_RAW_SPINLOCK(confirm_error_lock); 110static DEFINE_RAW_SPINLOCK(confirm_error_lock);
97 111
@@ -204,22 +218,12 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
204 } 218 }
205 } 219 }
206 220
207 /* Gather status on devices under the bridge */
208 if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) {
209 struct device_node *child;
210
211 for_each_child_of_node(dn, child) {
212 if (of_node_to_eeh_dev(child))
213 n += eeh_gather_pci_data(of_node_to_eeh_dev(child), buf+n, len-n);
214 }
215 }
216
217 return n; 221 return n;
218} 222}
219 223
220/** 224/**
221 * eeh_slot_error_detail - Generate combined log including driver log and error log 225 * eeh_slot_error_detail - Generate combined log including driver log and error log
222 * @edev: device to report error log for 226 * @pe: EEH PE
223 * @severity: temporary or permanent error log 227 * @severity: temporary or permanent error log
224 * 228 *
225 * This routine should be called to generate the combined log, which 229 * This routine should be called to generate the combined log, which
@@ -227,17 +231,22 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
227 * out from the config space of the corresponding PCI device, while 231 * out from the config space of the corresponding PCI device, while
228 * the error log is fetched through platform dependent function call. 232 * the error log is fetched through platform dependent function call.
229 */ 233 */
230void eeh_slot_error_detail(struct eeh_dev *edev, int severity) 234void eeh_slot_error_detail(struct eeh_pe *pe, int severity)
231{ 235{
232 size_t loglen = 0; 236 size_t loglen = 0;
233 pci_regs_buf[0] = 0; 237 struct eeh_dev *edev;
234 238
235 eeh_pci_enable(edev, EEH_OPT_THAW_MMIO); 239 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
236 eeh_ops->configure_bridge(eeh_dev_to_of_node(edev)); 240 eeh_ops->configure_bridge(pe);
237 eeh_restore_bars(edev); 241 eeh_pe_restore_bars(pe);
238 loglen = eeh_gather_pci_data(edev, pci_regs_buf, EEH_PCI_REGS_LOG_LEN);
239 242
240 eeh_ops->get_log(eeh_dev_to_of_node(edev), severity, pci_regs_buf, loglen); 243 pci_regs_buf[0] = 0;
244 eeh_pe_for_each_dev(pe, edev) {
245 loglen += eeh_gather_pci_data(edev, pci_regs_buf,
246 EEH_PCI_REGS_LOG_LEN);
247 }
248
249 eeh_ops->get_log(pe, severity, pci_regs_buf, loglen);
241} 250}
242 251
243/** 252/**
@@ -261,126 +270,8 @@ static inline unsigned long eeh_token_to_phys(unsigned long token)
261} 270}
262 271
263/** 272/**
264 * eeh_find_device_pe - Retrieve the PE for the given device 273 * eeh_dev_check_failure - Check if all 1's data is due to EEH slot freeze
265 * @dn: device node 274 * @edev: eeh device
266 *
267 * Return the PE under which this device lies
268 */
269struct device_node *eeh_find_device_pe(struct device_node *dn)
270{
271 while (dn->parent && of_node_to_eeh_dev(dn->parent) &&
272 (of_node_to_eeh_dev(dn->parent)->mode & EEH_MODE_SUPPORTED)) {
273 dn = dn->parent;
274 }
275 return dn;
276}
277
278/**
279 * __eeh_mark_slot - Mark all child devices as failed
280 * @parent: parent device
281 * @mode_flag: failure flag
282 *
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.
289 */
290static void __eeh_mark_slot(struct device_node *parent, int mode_flag)
291{
292 struct device_node *dn;
293
294 for_each_child_of_node(parent, dn) {
295 if (of_node_to_eeh_dev(dn)) {
296 /* Mark the pci device driver too */
297 struct pci_dev *dev = of_node_to_eeh_dev(dn)->pdev;
298
299 of_node_to_eeh_dev(dn)->mode |= mode_flag;
300
301 if (dev && dev->driver)
302 dev->error_state = pci_channel_io_frozen;
303
304 __eeh_mark_slot(dn, mode_flag);
305 }
306 }
307}
308
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)
318{
319 struct pci_dev *dev;
320 dn = eeh_find_device_pe(dn);
321
322 /* Back up one, since config addrs might be shared */
323 if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent))
324 dn = dn->parent;
325
326 of_node_to_eeh_dev(dn)->mode |= mode_flag;
327
328 /* Mark the pci device too */
329 dev = of_node_to_eeh_dev(dn)->pdev;
330 if (dev)
331 dev->error_state = pci_channel_io_frozen;
332
333 __eeh_mark_slot(dn, mode_flag);
334}
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 */
343static void __eeh_clear_slot(struct device_node *parent, int mode_flag)
344{
345 struct device_node *dn;
346
347 for_each_child_of_node(parent, dn) {
348 if (of_node_to_eeh_dev(dn)) {
349 of_node_to_eeh_dev(dn)->mode &= ~mode_flag;
350 of_node_to_eeh_dev(dn)->check_count = 0;
351 __eeh_clear_slot(dn, mode_flag);
352 }
353 }
354}
355
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)
364{
365 unsigned long flags;
366 raw_spin_lock_irqsave(&confirm_error_lock, flags);
367
368 dn = eeh_find_device_pe(dn);
369
370 /* Back up one, since config addrs might be shared */
371 if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent))
372 dn = dn->parent;
373
374 of_node_to_eeh_dev(dn)->mode &= ~mode_flag;
375 of_node_to_eeh_dev(dn)->check_count = 0;
376 __eeh_clear_slot(dn, mode_flag);
377 raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
378}
379
380/**
381 * eeh_dn_check_failure - Check if all 1's data is due to EEH slot freeze
382 * @dn: device node
383 * @dev: pci device, if known
384 * 275 *
385 * Check for an EEH failure for the given device node. Call this 276 * Check for an EEH failure for the given device node. Call this
386 * routine if the result of a read was all 0xff's and you want to 277 * routine if the result of a read was all 0xff's and you want to
@@ -392,11 +283,13 @@ void eeh_clear_slot(struct device_node *dn, int mode_flag)
392 * 283 *
393 * It is safe to call this routine in an interrupt context. 284 * It is safe to call this routine in an interrupt context.
394 */ 285 */
395int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) 286int eeh_dev_check_failure(struct eeh_dev *edev)
396{ 287{
397 int ret; 288 int ret;
398 unsigned long flags; 289 unsigned long flags;
399 struct eeh_dev *edev; 290 struct device_node *dn;
291 struct pci_dev *dev;
292 struct eeh_pe *pe;
400 int rc = 0; 293 int rc = 0;
401 const char *location; 294 const char *location;
402 295
@@ -405,23 +298,23 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
405 if (!eeh_subsystem_enabled) 298 if (!eeh_subsystem_enabled)
406 return 0; 299 return 0;
407 300
408 if (!dn) { 301 if (!edev) {
409 eeh_stats.no_dn++; 302 eeh_stats.no_dn++;
410 return 0; 303 return 0;
411 } 304 }
412 dn = eeh_find_device_pe(dn); 305 dn = eeh_dev_to_of_node(edev);
413 edev = of_node_to_eeh_dev(dn); 306 dev = eeh_dev_to_pci_dev(edev);
307 pe = edev->pe;
414 308
415 /* Access to IO BARs might get this far and still not want checking. */ 309 /* Access to IO BARs might get this far and still not want checking. */
416 if (!(edev->mode & EEH_MODE_SUPPORTED) || 310 if (!pe) {
417 edev->mode & EEH_MODE_NOCHECK) {
418 eeh_stats.ignored_check++; 311 eeh_stats.ignored_check++;
419 pr_debug("EEH: Ignored check (%x) for %s %s\n", 312 pr_debug("EEH: Ignored check for %s %s\n",
420 edev->mode, eeh_pci_name(dev), dn->full_name); 313 eeh_pci_name(dev), dn->full_name);
421 return 0; 314 return 0;
422 } 315 }
423 316
424 if (!edev->config_addr && !edev->pe_config_addr) { 317 if (!pe->addr && !pe->config_addr) {
425 eeh_stats.no_cfg_addr++; 318 eeh_stats.no_cfg_addr++;
426 return 0; 319 return 0;
427 } 320 }
@@ -434,13 +327,13 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
434 */ 327 */
435 raw_spin_lock_irqsave(&confirm_error_lock, flags); 328 raw_spin_lock_irqsave(&confirm_error_lock, flags);
436 rc = 1; 329 rc = 1;
437 if (edev->mode & EEH_MODE_ISOLATED) { 330 if (pe->state & EEH_PE_ISOLATED) {
438 edev->check_count++; 331 pe->check_count++;
439 if (edev->check_count % EEH_MAX_FAILS == 0) { 332 if (pe->check_count % EEH_MAX_FAILS == 0) {
440 location = of_get_property(dn, "ibm,loc-code", NULL); 333 location = of_get_property(dn, "ibm,loc-code", NULL);
441 printk(KERN_ERR "EEH: %d reads ignored for recovering device at " 334 printk(KERN_ERR "EEH: %d reads ignored for recovering device at "
442 "location=%s driver=%s pci addr=%s\n", 335 "location=%s driver=%s pci addr=%s\n",
443 edev->check_count, location, 336 pe->check_count, location,
444 eeh_driver_name(dev), eeh_pci_name(dev)); 337 eeh_driver_name(dev), eeh_pci_name(dev));
445 printk(KERN_ERR "EEH: Might be infinite loop in %s driver\n", 338 printk(KERN_ERR "EEH: Might be infinite loop in %s driver\n",
446 eeh_driver_name(dev)); 339 eeh_driver_name(dev));
@@ -456,7 +349,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
456 * function zero of a multi-function device. 349 * function zero of a multi-function device.
457 * In any case they must share a common PHB. 350 * In any case they must share a common PHB.
458 */ 351 */
459 ret = eeh_ops->get_state(dn, NULL); 352 ret = eeh_ops->get_state(pe, NULL);
460 353
461 /* Note that config-io to empty slots may fail; 354 /* Note that config-io to empty slots may fail;
462 * they are empty when they don't have children. 355 * they are empty when they don't have children.
@@ -469,7 +362,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
469 (ret & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) == 362 (ret & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) ==
470 (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) { 363 (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) {
471 eeh_stats.false_positives++; 364 eeh_stats.false_positives++;
472 edev->false_positives ++; 365 pe->false_positives++;
473 rc = 0; 366 rc = 0;
474 goto dn_unlock; 367 goto dn_unlock;
475 } 368 }
@@ -480,10 +373,10 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
480 * with other functions on this device, and functions under 373 * with other functions on this device, and functions under
481 * bridges. 374 * bridges.
482 */ 375 */
483 eeh_mark_slot(dn, EEH_MODE_ISOLATED); 376 eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
484 raw_spin_unlock_irqrestore(&confirm_error_lock, flags); 377 raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
485 378
486 eeh_send_failure_event(edev); 379 eeh_send_failure_event(pe);
487 380
488 /* Most EEH events are due to device driver bugs. Having 381 /* Most EEH events are due to device driver bugs. Having
489 * a stack trace will help the device-driver authors figure 382 * a stack trace will help the device-driver authors figure
@@ -497,7 +390,7 @@ dn_unlock:
497 return rc; 390 return rc;
498} 391}
499 392
500EXPORT_SYMBOL_GPL(eeh_dn_check_failure); 393EXPORT_SYMBOL_GPL(eeh_dev_check_failure);
501 394
502/** 395/**
503 * eeh_check_failure - Check if all 1's data is due to EEH slot freeze 396 * eeh_check_failure - Check if all 1's data is due to EEH slot freeze
@@ -514,21 +407,19 @@ EXPORT_SYMBOL_GPL(eeh_dn_check_failure);
514unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) 407unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
515{ 408{
516 unsigned long addr; 409 unsigned long addr;
517 struct pci_dev *dev; 410 struct eeh_dev *edev;
518 struct device_node *dn;
519 411
520 /* Finding the phys addr + pci device; this is pretty quick. */ 412 /* Finding the phys addr + pci device; this is pretty quick. */
521 addr = eeh_token_to_phys((unsigned long __force) token); 413 addr = eeh_token_to_phys((unsigned long __force) token);
522 dev = pci_addr_cache_get_device(addr); 414 edev = eeh_addr_cache_get_dev(addr);
523 if (!dev) { 415 if (!edev) {
524 eeh_stats.no_device++; 416 eeh_stats.no_device++;
525 return val; 417 return val;
526 } 418 }
527 419
528 dn = pci_device_to_OF_node(dev); 420 eeh_dev_check_failure(edev);
529 eeh_dn_check_failure(dn, dev);
530 421
531 pci_dev_put(dev); 422 pci_dev_put(eeh_dev_to_pci_dev(edev));
532 return val; 423 return val;
533} 424}
534 425
@@ -537,23 +428,22 @@ EXPORT_SYMBOL(eeh_check_failure);
537 428
538/** 429/**
539 * eeh_pci_enable - Enable MMIO or DMA transfers for this slot 430 * eeh_pci_enable - Enable MMIO or DMA transfers for this slot
540 * @edev: pci device node 431 * @pe: EEH PE
541 * 432 *
542 * This routine should be called to reenable frozen MMIO or DMA 433 * This routine should be called to reenable frozen MMIO or DMA
543 * so that it would work correctly again. It's useful while doing 434 * so that it would work correctly again. It's useful while doing
544 * recovery or log collection on the indicated device. 435 * recovery or log collection on the indicated device.
545 */ 436 */
546int eeh_pci_enable(struct eeh_dev *edev, int function) 437int eeh_pci_enable(struct eeh_pe *pe, int function)
547{ 438{
548 int rc; 439 int rc;
549 struct device_node *dn = eeh_dev_to_of_node(edev);
550 440
551 rc = eeh_ops->set_option(dn, function); 441 rc = eeh_ops->set_option(pe, function);
552 if (rc) 442 if (rc)
553 printk(KERN_WARNING "EEH: Unexpected state change %d, err=%d dn=%s\n", 443 pr_warning("%s: Unexpected state change %d on PHB#%d-PE#%x, err=%d\n",
554 function, rc, dn->full_name); 444 __func__, function, pe->phb->global_number, pe->addr, rc);
555 445
556 rc = eeh_ops->wait_state(dn, PCI_BUS_RESET_WAIT_MSEC); 446 rc = eeh_ops->wait_state(pe, PCI_BUS_RESET_WAIT_MSEC);
557 if (rc > 0 && (rc & EEH_STATE_MMIO_ENABLED) && 447 if (rc > 0 && (rc & EEH_STATE_MMIO_ENABLED) &&
558 (function == EEH_OPT_THAW_MMIO)) 448 (function == EEH_OPT_THAW_MMIO))
559 return 0; 449 return 0;
@@ -571,17 +461,24 @@ int eeh_pci_enable(struct eeh_dev *edev, int function)
571 */ 461 */
572int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state) 462int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state)
573{ 463{
574 struct device_node *dn = pci_device_to_OF_node(dev); 464 struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
465 struct eeh_pe *pe = edev->pe;
466
467 if (!pe) {
468 pr_err("%s: No PE found on PCI device %s\n",
469 __func__, pci_name(dev));
470 return -EINVAL;
471 }
575 472
576 switch (state) { 473 switch (state) {
577 case pcie_deassert_reset: 474 case pcie_deassert_reset:
578 eeh_ops->reset(dn, EEH_RESET_DEACTIVATE); 475 eeh_ops->reset(pe, EEH_RESET_DEACTIVATE);
579 break; 476 break;
580 case pcie_hot_reset: 477 case pcie_hot_reset:
581 eeh_ops->reset(dn, EEH_RESET_HOT); 478 eeh_ops->reset(pe, EEH_RESET_HOT);
582 break; 479 break;
583 case pcie_warm_reset: 480 case pcie_warm_reset:
584 eeh_ops->reset(dn, EEH_RESET_FUNDAMENTAL); 481 eeh_ops->reset(pe, EEH_RESET_FUNDAMENTAL);
585 break; 482 break;
586 default: 483 default:
587 return -EINVAL; 484 return -EINVAL;
@@ -591,66 +488,37 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
591} 488}
592 489
593/** 490/**
594 * __eeh_set_pe_freset - Check the required reset for child devices 491 * eeh_set_pe_freset - Check the required reset for the indicated device
595 * @parent: parent device 492 * @data: EEH device
596 * @freset: return value 493 * @flag: 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 * 494 *
623 * Each device might have its preferred reset type: fundamental or 495 * Each device might have its preferred reset type: fundamental or
624 * hot reset. The routine is used to collected the information for 496 * hot reset. The routine is used to collected the information for
625 * the indicated device and its children so that the bunch of the 497 * the indicated device and its children so that the bunch of the
626 * devices could be reset properly. 498 * devices could be reset properly.
627 */ 499 */
628void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset) 500static void *eeh_set_dev_freset(void *data, void *flag)
629{ 501{
630 struct pci_dev *dev; 502 struct pci_dev *dev;
631 dn = eeh_find_device_pe(dn); 503 unsigned int *freset = (unsigned int *)flag;
632 504 struct eeh_dev *edev = (struct eeh_dev *)data;
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 505
637 dev = of_node_to_eeh_dev(dn)->pdev; 506 dev = eeh_dev_to_pci_dev(edev);
638 if (dev) 507 if (dev)
639 *freset |= dev->needs_freset; 508 *freset |= dev->needs_freset;
640 509
641 __eeh_set_pe_freset(dn, freset); 510 return NULL;
642} 511}
643 512
644/** 513/**
645 * eeh_reset_pe_once - Assert the pci #RST line for 1/4 second 514 * eeh_reset_pe_once - Assert the pci #RST line for 1/4 second
646 * @edev: pci device node to be reset. 515 * @pe: EEH PE
647 * 516 *
648 * Assert the PCI #RST line for 1/4 second. 517 * Assert the PCI #RST line for 1/4 second.
649 */ 518 */
650static void eeh_reset_pe_once(struct eeh_dev *edev) 519static void eeh_reset_pe_once(struct eeh_pe *pe)
651{ 520{
652 unsigned int freset = 0; 521 unsigned int freset = 0;
653 struct device_node *dn = eeh_dev_to_of_node(edev);
654 522
655 /* Determine type of EEH reset required for 523 /* Determine type of EEH reset required for
656 * Partitionable Endpoint, a hot-reset (1) 524 * Partitionable Endpoint, a hot-reset (1)
@@ -658,12 +526,12 @@ static void eeh_reset_pe_once(struct eeh_dev *edev)
658 * A fundamental reset required by any device under 526 * A fundamental reset required by any device under
659 * Partitionable Endpoint trumps hot-reset. 527 * Partitionable Endpoint trumps hot-reset.
660 */ 528 */
661 eeh_set_pe_freset(dn, &freset); 529 eeh_pe_dev_traverse(pe, eeh_set_dev_freset, &freset);
662 530
663 if (freset) 531 if (freset)
664 eeh_ops->reset(dn, EEH_RESET_FUNDAMENTAL); 532 eeh_ops->reset(pe, EEH_RESET_FUNDAMENTAL);
665 else 533 else
666 eeh_ops->reset(dn, EEH_RESET_HOT); 534 eeh_ops->reset(pe, EEH_RESET_HOT);
667 535
668 /* The PCI bus requires that the reset be held high for at least 536 /* The PCI bus requires that the reset be held high for at least
669 * a 100 milliseconds. We wait a bit longer 'just in case'. 537 * a 100 milliseconds. We wait a bit longer 'just in case'.
@@ -675,9 +543,9 @@ static void eeh_reset_pe_once(struct eeh_dev *edev)
675 * pci slot reset line is dropped. Make sure we don't miss 543 * pci slot reset line is dropped. Make sure we don't miss
676 * these, and clear the flag now. 544 * these, and clear the flag now.
677 */ 545 */
678 eeh_clear_slot(dn, EEH_MODE_ISOLATED); 546 eeh_pe_state_clear(pe, EEH_PE_ISOLATED);
679 547
680 eeh_ops->reset(dn, EEH_RESET_DEACTIVATE); 548 eeh_ops->reset(pe, EEH_RESET_DEACTIVATE);
681 549
682 /* After a PCI slot has been reset, the PCI Express spec requires 550 /* After a PCI slot has been reset, the PCI Express spec requires
683 * a 1.5 second idle time for the bus to stabilize, before starting 551 * a 1.5 second idle time for the bus to stabilize, before starting
@@ -689,116 +557,36 @@ static void eeh_reset_pe_once(struct eeh_dev *edev)
689 557
690/** 558/**
691 * eeh_reset_pe - Reset the indicated PE 559 * eeh_reset_pe - Reset the indicated PE
692 * @edev: PCI device associated EEH device 560 * @pe: EEH PE
693 * 561 *
694 * This routine should be called to reset indicated device, including 562 * This routine should be called to reset indicated device, including
695 * PE. A PE might include multiple PCI devices and sometimes PCI bridges 563 * PE. A PE might include multiple PCI devices and sometimes PCI bridges
696 * might be involved as well. 564 * might be involved as well.
697 */ 565 */
698int eeh_reset_pe(struct eeh_dev *edev) 566int eeh_reset_pe(struct eeh_pe *pe)
699{ 567{
700 int i, rc; 568 int i, rc;
701 struct device_node *dn = eeh_dev_to_of_node(edev);
702 569
703 /* Take three shots at resetting the bus */ 570 /* Take three shots at resetting the bus */
704 for (i=0; i<3; i++) { 571 for (i=0; i<3; i++) {
705 eeh_reset_pe_once(edev); 572 eeh_reset_pe_once(pe);
706 573
707 rc = eeh_ops->wait_state(dn, PCI_BUS_RESET_WAIT_MSEC); 574 rc = eeh_ops->wait_state(pe, PCI_BUS_RESET_WAIT_MSEC);
708 if (rc == (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) 575 if (rc == (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE))
709 return 0; 576 return 0;
710 577
711 if (rc < 0) { 578 if (rc < 0) {
712 printk(KERN_ERR "EEH: unrecoverable slot failure %s\n", 579 pr_err("%s: Unrecoverable slot failure on PHB#%d-PE#%x",
713 dn->full_name); 580 __func__, pe->phb->global_number, pe->addr);
714 return -1; 581 return -1;
715 } 582 }
716 printk(KERN_ERR "EEH: bus reset %d failed on slot %s, rc=%d\n", 583 pr_err("EEH: bus reset %d failed on PHB#%d-PE#%x, rc=%d\n",
717 i+1, dn->full_name, rc); 584 i+1, pe->phb->global_number, pe->addr, rc);
718 } 585 }
719 586
720 return -1; 587 return -1;
721} 588}
722 589
723/** Save and restore of PCI BARs
724 *
725 * Although firmware will set up BARs during boot, it doesn't
726 * set up device BAR's after a device reset, although it will,
727 * if requested, set up bridge configuration. Thus, we need to
728 * configure the PCI devices ourselves.
729 */
730
731/**
732 * eeh_restore_one_device_bars - Restore the Base Address Registers for one device
733 * @edev: PCI device associated EEH device
734 *
735 * Loads the PCI configuration space base address registers,
736 * the expansion ROM base address, the latency timer, and etc.
737 * from the saved values in the device node.
738 */
739static inline void eeh_restore_one_device_bars(struct eeh_dev *edev)
740{
741 int i;
742 u32 cmd;
743 struct device_node *dn = eeh_dev_to_of_node(edev);
744
745 if (!edev->phb)
746 return;
747
748 for (i=4; i<10; i++) {
749 eeh_ops->write_config(dn, i*4, 4, edev->config_space[i]);
750 }
751
752 /* 12 == Expansion ROM Address */
753 eeh_ops->write_config(dn, 12*4, 4, edev->config_space[12]);
754
755#define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF))
756#define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)])
757
758 eeh_ops->write_config(dn, PCI_CACHE_LINE_SIZE, 1,
759 SAVED_BYTE(PCI_CACHE_LINE_SIZE));
760
761 eeh_ops->write_config(dn, PCI_LATENCY_TIMER, 1,
762 SAVED_BYTE(PCI_LATENCY_TIMER));
763
764 /* max latency, min grant, interrupt pin and line */
765 eeh_ops->write_config(dn, 15*4, 4, edev->config_space[15]);
766
767 /* Restore PERR & SERR bits, some devices require it,
768 * don't touch the other command bits
769 */
770 eeh_ops->read_config(dn, PCI_COMMAND, 4, &cmd);
771 if (edev->config_space[1] & PCI_COMMAND_PARITY)
772 cmd |= PCI_COMMAND_PARITY;
773 else
774 cmd &= ~PCI_COMMAND_PARITY;
775 if (edev->config_space[1] & PCI_COMMAND_SERR)
776 cmd |= PCI_COMMAND_SERR;
777 else
778 cmd &= ~PCI_COMMAND_SERR;
779 eeh_ops->write_config(dn, PCI_COMMAND, 4, cmd);
780}
781
782/**
783 * eeh_restore_bars - Restore the PCI config space info
784 * @edev: EEH device
785 *
786 * This routine performs a recursive walk to the children
787 * of this device as well.
788 */
789void eeh_restore_bars(struct eeh_dev *edev)
790{
791 struct device_node *dn;
792 if (!edev)
793 return;
794
795 if ((edev->mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(edev->class_code))
796 eeh_restore_one_device_bars(edev);
797
798 for_each_child_of_node(eeh_dev_to_of_node(edev), dn)
799 eeh_restore_bars(of_node_to_eeh_dev(dn));
800}
801
802/** 590/**
803 * eeh_save_bars - Save device bars 591 * eeh_save_bars - Save device bars
804 * @edev: PCI device associated EEH device 592 * @edev: PCI device associated EEH device
@@ -808,7 +596,7 @@ void eeh_restore_bars(struct eeh_dev *edev)
808 * PCI devices are added individually; but, for the restore, 596 * PCI devices are added individually; but, for the restore,
809 * an entire slot is reset at a time. 597 * an entire slot is reset at a time.
810 */ 598 */
811static void eeh_save_bars(struct eeh_dev *edev) 599void eeh_save_bars(struct eeh_dev *edev)
812{ 600{
813 int i; 601 int i;
814 struct device_node *dn; 602 struct device_node *dn;
@@ -822,102 +610,6 @@ static void eeh_save_bars(struct eeh_dev *edev)
822} 610}
823 611
824/** 612/**
825 * eeh_early_enable - Early enable EEH on the indicated device
826 * @dn: device node
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.
832 */
833static void *eeh_early_enable(struct device_node *dn, void *data)
834{
835 int ret;
836 const u32 *class_code = of_get_property(dn, "class-code", NULL);
837 const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL);
838 const u32 *device_id = of_get_property(dn, "device-id", NULL);
839 const u32 *regs;
840 int enable;
841 struct eeh_dev *edev = of_node_to_eeh_dev(dn);
842
843 edev->class_code = 0;
844 edev->mode = 0;
845 edev->check_count = 0;
846 edev->freeze_count = 0;
847 edev->false_positives = 0;
848
849 if (!of_device_is_available(dn))
850 return NULL;
851
852 /* Ignore bad nodes. */
853 if (!class_code || !vendor_id || !device_id)
854 return NULL;
855
856 /* There is nothing to check on PCI to ISA bridges */
857 if (dn->type && !strcmp(dn->type, "isa")) {
858 edev->mode |= EEH_MODE_NOCHECK;
859 return NULL;
860 }
861 edev->class_code = *class_code;
862
863 /* Ok... see if this device supports EEH. Some do, some don't,
864 * and the only way to find out is to check each and every one.
865 */
866 regs = of_get_property(dn, "reg", NULL);
867 if (regs) {
868 /* First register entry is addr (00BBSS00) */
869 /* Try to enable eeh */
870 ret = eeh_ops->set_option(dn, EEH_OPT_ENABLE);
871
872 enable = 0;
873 if (ret == 0) {
874 edev->config_addr = regs[0];
875
876 /* If the newer, better, ibm,get-config-addr-info is supported,
877 * then use that instead.
878 */
879 edev->pe_config_addr = eeh_ops->get_pe_addr(dn);
880
881 /* Some older systems (Power4) allow the
882 * ibm,set-eeh-option call to succeed even on nodes
883 * where EEH is not supported. Verify support
884 * explicitly.
885 */
886 ret = eeh_ops->get_state(dn, NULL);
887 if (ret > 0 && ret != EEH_STATE_NOT_SUPPORT)
888 enable = 1;
889 }
890
891 if (enable) {
892 eeh_subsystem_enabled = 1;
893 edev->mode |= EEH_MODE_SUPPORTED;
894
895 pr_debug("EEH: %s: eeh enabled, config=%x pe_config=%x\n",
896 dn->full_name, edev->config_addr,
897 edev->pe_config_addr);
898 } else {
899
900 /* This device doesn't support EEH, but it may have an
901 * EEH parent, in which case we mark it as supported.
902 */
903 if (dn->parent && of_node_to_eeh_dev(dn->parent) &&
904 (of_node_to_eeh_dev(dn->parent)->mode & EEH_MODE_SUPPORTED)) {
905 /* Parent supports EEH. */
906 edev->mode |= EEH_MODE_SUPPORTED;
907 edev->config_addr = of_node_to_eeh_dev(dn->parent)->config_addr;
908 return NULL;
909 }
910 }
911 } else {
912 printk(KERN_WARNING "EEH: %s: unable to get reg property.\n",
913 dn->full_name);
914 }
915
916 eeh_save_bars(edev);
917 return NULL;
918}
919
920/**
921 * eeh_ops_register - Register platform dependent EEH operations 613 * eeh_ops_register - Register platform dependent EEH operations
922 * @ops: platform dependent EEH operations 614 * @ops: platform dependent EEH operations
923 * 615 *
@@ -982,7 +674,7 @@ int __exit eeh_ops_unregister(const char *name)
982 * Even if force-off is set, the EEH hardware is still enabled, so that 674 * Even if force-off is set, the EEH hardware is still enabled, so that
983 * newer systems can boot. 675 * newer systems can boot.
984 */ 676 */
985void __init eeh_init(void) 677static int __init eeh_init(void)
986{ 678{
987 struct pci_controller *hose, *tmp; 679 struct pci_controller *hose, *tmp;
988 struct device_node *phb; 680 struct device_node *phb;
@@ -992,27 +684,34 @@ void __init eeh_init(void)
992 if (!eeh_ops) { 684 if (!eeh_ops) {
993 pr_warning("%s: Platform EEH operation not found\n", 685 pr_warning("%s: Platform EEH operation not found\n",
994 __func__); 686 __func__);
995 return; 687 return -EEXIST;
996 } else if ((ret = eeh_ops->init())) { 688 } else if ((ret = eeh_ops->init())) {
997 pr_warning("%s: Failed to call platform init function (%d)\n", 689 pr_warning("%s: Failed to call platform init function (%d)\n",
998 __func__, ret); 690 __func__, ret);
999 return; 691 return ret;
1000 } 692 }
1001 693
1002 raw_spin_lock_init(&confirm_error_lock); 694 raw_spin_lock_init(&confirm_error_lock);
1003 695
1004 /* Enable EEH for all adapters */ 696 /* Enable EEH for all adapters */
1005 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 697 if (eeh_probe_mode_devtree()) {
1006 phb = hose->dn; 698 list_for_each_entry_safe(hose, tmp,
1007 traverse_pci_devices(phb, eeh_early_enable, NULL); 699 &hose_list, list_node) {
700 phb = hose->dn;
701 traverse_pci_devices(phb, eeh_ops->of_probe, NULL);
702 }
1008 } 703 }
1009 704
1010 if (eeh_subsystem_enabled) 705 if (eeh_subsystem_enabled)
1011 printk(KERN_INFO "EEH: PCI Enhanced I/O Error Handling Enabled\n"); 706 pr_info("EEH: PCI Enhanced I/O Error Handling Enabled\n");
1012 else 707 else
1013 printk(KERN_WARNING "EEH: No capable adapters found\n"); 708 pr_warning("EEH: No capable adapters found\n");
709
710 return ret;
1014} 711}
1015 712
713core_initcall_sync(eeh_init);
714
1016/** 715/**
1017 * eeh_add_device_early - Enable EEH for the indicated device_node 716 * eeh_add_device_early - Enable EEH for the indicated device_node
1018 * @dn: device node for which to set up EEH 717 * @dn: device node for which to set up EEH
@@ -1029,7 +728,7 @@ static void eeh_add_device_early(struct device_node *dn)
1029{ 728{
1030 struct pci_controller *phb; 729 struct pci_controller *phb;
1031 730
1032 if (!dn || !of_node_to_eeh_dev(dn)) 731 if (!of_node_to_eeh_dev(dn))
1033 return; 732 return;
1034 phb = of_node_to_eeh_dev(dn)->phb; 733 phb = of_node_to_eeh_dev(dn)->phb;
1035 734
@@ -1037,7 +736,8 @@ static void eeh_add_device_early(struct device_node *dn)
1037 if (NULL == phb || 0 == phb->buid) 736 if (NULL == phb || 0 == phb->buid)
1038 return; 737 return;
1039 738
1040 eeh_early_enable(dn, NULL); 739 /* FIXME: hotplug support on POWERNV */
740 eeh_ops->of_probe(dn, NULL);
1041} 741}
1042 742
1043/** 743/**
@@ -1087,7 +787,7 @@ static void eeh_add_device_late(struct pci_dev *dev)
1087 edev->pdev = dev; 787 edev->pdev = dev;
1088 dev->dev.archdata.edev = edev; 788 dev->dev.archdata.edev = edev;
1089 789
1090 pci_addr_cache_insert_device(dev); 790 eeh_addr_cache_insert_dev(dev);
1091 eeh_sysfs_add_device(dev); 791 eeh_sysfs_add_device(dev);
1092} 792}
1093 793
@@ -1117,6 +817,7 @@ EXPORT_SYMBOL_GPL(eeh_add_device_tree_late);
1117/** 817/**
1118 * eeh_remove_device - Undo EEH setup for the indicated pci device 818 * eeh_remove_device - Undo EEH setup for the indicated pci device
1119 * @dev: pci device to be removed 819 * @dev: pci device to be removed
820 * @purge_pe: remove the PE or not
1120 * 821 *
1121 * This routine should be called when a device is removed from 822 * This routine should be called when a device is removed from
1122 * a running system (e.g. by hotplug or dlpar). It unregisters 823 * a running system (e.g. by hotplug or dlpar). It unregisters
@@ -1124,7 +825,7 @@ EXPORT_SYMBOL_GPL(eeh_add_device_tree_late);
1124 * this device will no longer be detected after this call; thus, 825 * this device will no longer be detected after this call; thus,
1125 * i/o errors affecting this slot may leave this device unusable. 826 * i/o errors affecting this slot may leave this device unusable.
1126 */ 827 */
1127static void eeh_remove_device(struct pci_dev *dev) 828static void eeh_remove_device(struct pci_dev *dev, int purge_pe)
1128{ 829{
1129 struct eeh_dev *edev; 830 struct eeh_dev *edev;
1130 831
@@ -1143,28 +844,30 @@ static void eeh_remove_device(struct pci_dev *dev)
1143 dev->dev.archdata.edev = NULL; 844 dev->dev.archdata.edev = NULL;
1144 pci_dev_put(dev); 845 pci_dev_put(dev);
1145 846
1146 pci_addr_cache_remove_device(dev); 847 eeh_rmv_from_parent_pe(edev, purge_pe);
848 eeh_addr_cache_rmv_dev(dev);
1147 eeh_sysfs_remove_device(dev); 849 eeh_sysfs_remove_device(dev);
1148} 850}
1149 851
1150/** 852/**
1151 * eeh_remove_bus_device - Undo EEH setup for the indicated PCI device 853 * eeh_remove_bus_device - Undo EEH setup for the indicated PCI device
1152 * @dev: PCI device 854 * @dev: PCI device
855 * @purge_pe: remove the corresponding PE or not
1153 * 856 *
1154 * This routine must be called when a device is removed from the 857 * This routine must be called when a device is removed from the
1155 * running system through hotplug or dlpar. The corresponding 858 * running system through hotplug or dlpar. The corresponding
1156 * PCI address cache will be removed. 859 * PCI address cache will be removed.
1157 */ 860 */
1158void eeh_remove_bus_device(struct pci_dev *dev) 861void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe)
1159{ 862{
1160 struct pci_bus *bus = dev->subordinate; 863 struct pci_bus *bus = dev->subordinate;
1161 struct pci_dev *child, *tmp; 864 struct pci_dev *child, *tmp;
1162 865
1163 eeh_remove_device(dev); 866 eeh_remove_device(dev, purge_pe);
1164 867
1165 if (bus && dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { 868 if (bus && dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
1166 list_for_each_entry_safe(child, tmp, &bus->devices, bus_list) 869 list_for_each_entry_safe(child, tmp, &bus->devices, bus_list)
1167 eeh_remove_bus_device(child); 870 eeh_remove_bus_device(child, purge_pe);
1168 } 871 }
1169} 872}
1170EXPORT_SYMBOL_GPL(eeh_remove_bus_device); 873EXPORT_SYMBOL_GPL(eeh_remove_bus_device);
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index e5ae1c687c66..5a4c87903057 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -50,6 +50,7 @@ struct pci_io_addr_range {
50 struct rb_node rb_node; 50 struct rb_node rb_node;
51 unsigned long addr_lo; 51 unsigned long addr_lo;
52 unsigned long addr_hi; 52 unsigned long addr_hi;
53 struct eeh_dev *edev;
53 struct pci_dev *pcidev; 54 struct pci_dev *pcidev;
54 unsigned int flags; 55 unsigned int flags;
55}; 56};
@@ -59,7 +60,7 @@ static struct pci_io_addr_cache {
59 spinlock_t piar_lock; 60 spinlock_t piar_lock;
60} pci_io_addr_cache_root; 61} pci_io_addr_cache_root;
61 62
62static inline struct pci_dev *__pci_addr_cache_get_device(unsigned long addr) 63static inline struct eeh_dev *__eeh_addr_cache_get_device(unsigned long addr)
63{ 64{
64 struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node; 65 struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node;
65 66
@@ -74,7 +75,7 @@ static inline struct pci_dev *__pci_addr_cache_get_device(unsigned long addr)
74 n = n->rb_right; 75 n = n->rb_right;
75 } else { 76 } else {
76 pci_dev_get(piar->pcidev); 77 pci_dev_get(piar->pcidev);
77 return piar->pcidev; 78 return piar->edev;
78 } 79 }
79 } 80 }
80 } 81 }
@@ -83,7 +84,7 @@ static inline struct pci_dev *__pci_addr_cache_get_device(unsigned long addr)
83} 84}
84 85
85/** 86/**
86 * pci_addr_cache_get_device - Get device, given only address 87 * eeh_addr_cache_get_dev - Get device, given only address
87 * @addr: mmio (PIO) phys address or i/o port number 88 * @addr: mmio (PIO) phys address or i/o port number
88 * 89 *
89 * Given an mmio phys address, or a port number, find a pci device 90 * Given an mmio phys address, or a port number, find a pci device
@@ -92,15 +93,15 @@ static inline struct pci_dev *__pci_addr_cache_get_device(unsigned long addr)
92 * from zero (that is, they do *not* have pci_io_addr added in). 93 * from zero (that is, they do *not* have pci_io_addr added in).
93 * It is safe to call this function within an interrupt. 94 * It is safe to call this function within an interrupt.
94 */ 95 */
95struct pci_dev *pci_addr_cache_get_device(unsigned long addr) 96struct eeh_dev *eeh_addr_cache_get_dev(unsigned long addr)
96{ 97{
97 struct pci_dev *dev; 98 struct eeh_dev *edev;
98 unsigned long flags; 99 unsigned long flags;
99 100
100 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 101 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
101 dev = __pci_addr_cache_get_device(addr); 102 edev = __eeh_addr_cache_get_device(addr);
102 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 103 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
103 return dev; 104 return edev;
104} 105}
105 106
106#ifdef DEBUG 107#ifdef DEBUG
@@ -108,7 +109,7 @@ struct pci_dev *pci_addr_cache_get_device(unsigned long addr)
108 * Handy-dandy debug print routine, does nothing more 109 * Handy-dandy debug print routine, does nothing more
109 * than print out the contents of our addr cache. 110 * than print out the contents of our addr cache.
110 */ 111 */
111static void pci_addr_cache_print(struct pci_io_addr_cache *cache) 112static void eeh_addr_cache_print(struct pci_io_addr_cache *cache)
112{ 113{
113 struct rb_node *n; 114 struct rb_node *n;
114 int cnt = 0; 115 int cnt = 0;
@@ -117,7 +118,7 @@ static void pci_addr_cache_print(struct pci_io_addr_cache *cache)
117 while (n) { 118 while (n) {
118 struct pci_io_addr_range *piar; 119 struct pci_io_addr_range *piar;
119 piar = rb_entry(n, struct pci_io_addr_range, rb_node); 120 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
120 printk(KERN_DEBUG "PCI: %s addr range %d [%lx-%lx]: %s\n", 121 pr_debug("PCI: %s addr range %d [%lx-%lx]: %s\n",
121 (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt, 122 (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt,
122 piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev)); 123 piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev));
123 cnt++; 124 cnt++;
@@ -128,7 +129,7 @@ static void pci_addr_cache_print(struct pci_io_addr_cache *cache)
128 129
129/* Insert address range into the rb tree. */ 130/* Insert address range into the rb tree. */
130static struct pci_io_addr_range * 131static struct pci_io_addr_range *
131pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, 132eeh_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
132 unsigned long ahi, unsigned int flags) 133 unsigned long ahi, unsigned int flags)
133{ 134{
134 struct rb_node **p = &pci_io_addr_cache_root.rb_root.rb_node; 135 struct rb_node **p = &pci_io_addr_cache_root.rb_root.rb_node;
@@ -146,23 +147,24 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
146 } else { 147 } else {
147 if (dev != piar->pcidev || 148 if (dev != piar->pcidev ||
148 alo != piar->addr_lo || ahi != piar->addr_hi) { 149 alo != piar->addr_lo || ahi != piar->addr_hi) {
149 printk(KERN_WARNING "PIAR: overlapping address range\n"); 150 pr_warning("PIAR: overlapping address range\n");
150 } 151 }
151 return piar; 152 return piar;
152 } 153 }
153 } 154 }
154 piar = kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); 155 piar = kzalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC);
155 if (!piar) 156 if (!piar)
156 return NULL; 157 return NULL;
157 158
158 pci_dev_get(dev); 159 pci_dev_get(dev);
159 piar->addr_lo = alo; 160 piar->addr_lo = alo;
160 piar->addr_hi = ahi; 161 piar->addr_hi = ahi;
162 piar->edev = pci_dev_to_eeh_dev(dev);
161 piar->pcidev = dev; 163 piar->pcidev = dev;
162 piar->flags = flags; 164 piar->flags = flags;
163 165
164#ifdef DEBUG 166#ifdef DEBUG
165 printk(KERN_DEBUG "PIAR: insert range=[%lx:%lx] dev=%s\n", 167 pr_debug("PIAR: insert range=[%lx:%lx] dev=%s\n",
166 alo, ahi, pci_name(dev)); 168 alo, ahi, pci_name(dev));
167#endif 169#endif
168 170
@@ -172,7 +174,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
172 return piar; 174 return piar;
173} 175}
174 176
175static void __pci_addr_cache_insert_device(struct pci_dev *dev) 177static void __eeh_addr_cache_insert_dev(struct pci_dev *dev)
176{ 178{
177 struct device_node *dn; 179 struct device_node *dn;
178 struct eeh_dev *edev; 180 struct eeh_dev *edev;
@@ -180,7 +182,7 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev)
180 182
181 dn = pci_device_to_OF_node(dev); 183 dn = pci_device_to_OF_node(dev);
182 if (!dn) { 184 if (!dn) {
183 printk(KERN_WARNING "PCI: no pci dn found for dev=%s\n", pci_name(dev)); 185 pr_warning("PCI: no pci dn found for dev=%s\n", pci_name(dev));
184 return; 186 return;
185 } 187 }
186 188
@@ -192,8 +194,7 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev)
192 } 194 }
193 195
194 /* Skip any devices for which EEH is not enabled. */ 196 /* Skip any devices for which EEH is not enabled. */
195 if (!(edev->mode & EEH_MODE_SUPPORTED) || 197 if (!edev->pe) {
196 edev->mode & EEH_MODE_NOCHECK) {
197#ifdef DEBUG 198#ifdef DEBUG
198 pr_info("PCI: skip building address cache for=%s - %s\n", 199 pr_info("PCI: skip building address cache for=%s - %s\n",
199 pci_name(dev), dn->full_name); 200 pci_name(dev), dn->full_name);
@@ -212,19 +213,19 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev)
212 continue; 213 continue;
213 if (start == 0 || ~start == 0 || end == 0 || ~end == 0) 214 if (start == 0 || ~start == 0 || end == 0 || ~end == 0)
214 continue; 215 continue;
215 pci_addr_cache_insert(dev, start, end, flags); 216 eeh_addr_cache_insert(dev, start, end, flags);
216 } 217 }
217} 218}
218 219
219/** 220/**
220 * pci_addr_cache_insert_device - Add a device to the address cache 221 * eeh_addr_cache_insert_dev - Add a device to the address cache
221 * @dev: PCI device whose I/O addresses we are interested in. 222 * @dev: PCI device whose I/O addresses we are interested in.
222 * 223 *
223 * In order to support the fast lookup of devices based on addresses, 224 * In order to support the fast lookup of devices based on addresses,
224 * we maintain a cache of devices that can be quickly searched. 225 * we maintain a cache of devices that can be quickly searched.
225 * This routine adds a device to that cache. 226 * This routine adds a device to that cache.
226 */ 227 */
227void pci_addr_cache_insert_device(struct pci_dev *dev) 228void eeh_addr_cache_insert_dev(struct pci_dev *dev)
228{ 229{
229 unsigned long flags; 230 unsigned long flags;
230 231
@@ -233,11 +234,11 @@ void pci_addr_cache_insert_device(struct pci_dev *dev)
233 return; 234 return;
234 235
235 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 236 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
236 __pci_addr_cache_insert_device(dev); 237 __eeh_addr_cache_insert_dev(dev);
237 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 238 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
238} 239}
239 240
240static inline void __pci_addr_cache_remove_device(struct pci_dev *dev) 241static inline void __eeh_addr_cache_rmv_dev(struct pci_dev *dev)
241{ 242{
242 struct rb_node *n; 243 struct rb_node *n;
243 244
@@ -258,7 +259,7 @@ restart:
258} 259}
259 260
260/** 261/**
261 * pci_addr_cache_remove_device - remove pci device from addr cache 262 * eeh_addr_cache_rmv_dev - remove pci device from addr cache
262 * @dev: device to remove 263 * @dev: device to remove
263 * 264 *
264 * Remove a device from the addr-cache tree. 265 * Remove a device from the addr-cache tree.
@@ -266,17 +267,17 @@ restart:
266 * the tree multiple times (once per resource). 267 * the tree multiple times (once per resource).
267 * But so what; device removal doesn't need to be that fast. 268 * But so what; device removal doesn't need to be that fast.
268 */ 269 */
269void pci_addr_cache_remove_device(struct pci_dev *dev) 270void eeh_addr_cache_rmv_dev(struct pci_dev *dev)
270{ 271{
271 unsigned long flags; 272 unsigned long flags;
272 273
273 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 274 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
274 __pci_addr_cache_remove_device(dev); 275 __eeh_addr_cache_rmv_dev(dev);
275 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 276 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
276} 277}
277 278
278/** 279/**
279 * pci_addr_cache_build - Build a cache of I/O addresses 280 * eeh_addr_cache_build - Build a cache of I/O addresses
280 * 281 *
281 * Build a cache of pci i/o addresses. This cache will be used to 282 * Build a cache of pci i/o addresses. This cache will be used to
282 * find the pci device that corresponds to a given address. 283 * find the pci device that corresponds to a given address.
@@ -284,7 +285,7 @@ void pci_addr_cache_remove_device(struct pci_dev *dev)
284 * Must be run late in boot process, after the pci controllers 285 * Must be run late in boot process, after the pci controllers
285 * have been scanned for devices (after all device resources are known). 286 * have been scanned for devices (after all device resources are known).
286 */ 287 */
287void __init pci_addr_cache_build(void) 288void __init eeh_addr_cache_build(void)
288{ 289{
289 struct device_node *dn; 290 struct device_node *dn;
290 struct eeh_dev *edev; 291 struct eeh_dev *edev;
@@ -293,7 +294,7 @@ void __init pci_addr_cache_build(void)
293 spin_lock_init(&pci_io_addr_cache_root.piar_lock); 294 spin_lock_init(&pci_io_addr_cache_root.piar_lock);
294 295
295 for_each_pci_dev(dev) { 296 for_each_pci_dev(dev) {
296 pci_addr_cache_insert_device(dev); 297 eeh_addr_cache_insert_dev(dev);
297 298
298 dn = pci_device_to_OF_node(dev); 299 dn = pci_device_to_OF_node(dev);
299 if (!dn) 300 if (!dn)
@@ -312,7 +313,7 @@ void __init pci_addr_cache_build(void)
312 313
313#ifdef DEBUG 314#ifdef DEBUG
314 /* Verify tree built up above, echo back the list of addrs. */ 315 /* Verify tree built up above, echo back the list of addrs. */
315 pci_addr_cache_print(&pci_io_addr_cache_root); 316 eeh_addr_cache_print(&pci_io_addr_cache_root);
316#endif 317#endif
317} 318}
318 319
diff --git a/arch/powerpc/platforms/pseries/eeh_dev.c b/arch/powerpc/platforms/pseries/eeh_dev.c
index c4507d095900..66442341d3a6 100644
--- a/arch/powerpc/platforms/pseries/eeh_dev.c
+++ b/arch/powerpc/platforms/pseries/eeh_dev.c
@@ -55,7 +55,7 @@ void * __devinit eeh_dev_init(struct device_node *dn, void *data)
55 struct eeh_dev *edev; 55 struct eeh_dev *edev;
56 56
57 /* Allocate EEH device */ 57 /* Allocate EEH device */
58 edev = zalloc_maybe_bootmem(sizeof(*edev), GFP_KERNEL); 58 edev = kzalloc(sizeof(*edev), GFP_KERNEL);
59 if (!edev) { 59 if (!edev) {
60 pr_warning("%s: out of memory\n", __func__); 60 pr_warning("%s: out of memory\n", __func__);
61 return NULL; 61 return NULL;
@@ -65,6 +65,7 @@ void * __devinit eeh_dev_init(struct device_node *dn, void *data)
65 PCI_DN(dn)->edev = edev; 65 PCI_DN(dn)->edev = edev;
66 edev->dn = dn; 66 edev->dn = dn;
67 edev->phb = phb; 67 edev->phb = phb;
68 INIT_LIST_HEAD(&edev->list);
68 69
69 return NULL; 70 return NULL;
70} 71}
@@ -80,6 +81,9 @@ void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb)
80{ 81{
81 struct device_node *dn = phb->dn; 82 struct device_node *dn = phb->dn;
82 83
84 /* EEH PE for PHB */
85 eeh_phb_pe_create(phb);
86
83 /* EEH device for PHB */ 87 /* EEH device for PHB */
84 eeh_dev_init(dn, phb); 88 eeh_dev_init(dn, phb);
85 89
@@ -93,10 +97,16 @@ void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb)
93 * Scan all the existing PHBs and create EEH devices for their OF 97 * Scan all the existing PHBs and create EEH devices for their OF
94 * nodes and their children OF nodes 98 * nodes and their children OF nodes
95 */ 99 */
96void __init eeh_dev_phb_init(void) 100static int __init eeh_dev_phb_init(void)
97{ 101{
98 struct pci_controller *phb, *tmp; 102 struct pci_controller *phb, *tmp;
99 103
100 list_for_each_entry_safe(phb, tmp, &hose_list, list_node) 104 list_for_each_entry_safe(phb, tmp, &hose_list, list_node)
101 eeh_dev_phb_init_dynamic(phb); 105 eeh_dev_phb_init_dynamic(phb);
106
107 pr_info("EEH: devices created\n");
108
109 return 0;
102} 110}
111
112core_initcall(eeh_dev_phb_init);
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index baf92cd9dfab..a3fefb61097c 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -25,6 +25,7 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <linux/module.h>
28#include <linux/pci.h> 29#include <linux/pci.h>
29#include <asm/eeh.h> 30#include <asm/eeh.h>
30#include <asm/eeh_event.h> 31#include <asm/eeh_event.h>
@@ -47,6 +48,41 @@ static inline const char *eeh_pcid_name(struct pci_dev *pdev)
47 return ""; 48 return "";
48} 49}
49 50
51/**
52 * eeh_pcid_get - Get the PCI device driver
53 * @pdev: PCI device
54 *
55 * The function is used to retrieve the PCI device driver for
56 * the indicated PCI device. Besides, we will increase the reference
57 * of the PCI device driver to prevent that being unloaded on
58 * the fly. Otherwise, kernel crash would be seen.
59 */
60static inline struct pci_driver *eeh_pcid_get(struct pci_dev *pdev)
61{
62 if (!pdev || !pdev->driver)
63 return NULL;
64
65 if (!try_module_get(pdev->driver->driver.owner))
66 return NULL;
67
68 return pdev->driver;
69}
70
71/**
72 * eeh_pcid_put - Dereference on the PCI device driver
73 * @pdev: PCI device
74 *
75 * The function is called to do dereference on the PCI device
76 * driver of the indicated PCI device.
77 */
78static inline void eeh_pcid_put(struct pci_dev *pdev)
79{
80 if (!pdev || !pdev->driver)
81 return;
82
83 module_put(pdev->driver->driver.owner);
84}
85
50#if 0 86#if 0
51static void print_device_node_tree(struct pci_dn *pdn, int dent) 87static void print_device_node_tree(struct pci_dn *pdn, int dent)
52{ 88{
@@ -93,7 +129,7 @@ static void eeh_disable_irq(struct pci_dev *dev)
93 if (!irq_has_action(dev->irq)) 129 if (!irq_has_action(dev->irq))
94 return; 130 return;
95 131
96 edev->mode |= EEH_MODE_IRQ_DISABLED; 132 edev->mode |= EEH_DEV_IRQ_DISABLED;
97 disable_irq_nosync(dev->irq); 133 disable_irq_nosync(dev->irq);
98} 134}
99 135
@@ -108,36 +144,44 @@ static void eeh_enable_irq(struct pci_dev *dev)
108{ 144{
109 struct eeh_dev *edev = pci_dev_to_eeh_dev(dev); 145 struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
110 146
111 if ((edev->mode) & EEH_MODE_IRQ_DISABLED) { 147 if ((edev->mode) & EEH_DEV_IRQ_DISABLED) {
112 edev->mode &= ~EEH_MODE_IRQ_DISABLED; 148 edev->mode &= ~EEH_DEV_IRQ_DISABLED;
113 enable_irq(dev->irq); 149 enable_irq(dev->irq);
114 } 150 }
115} 151}
116 152
117/** 153/**
118 * eeh_report_error - Report pci error to each device driver 154 * eeh_report_error - Report pci error to each device driver
119 * @dev: PCI device 155 * @data: eeh device
120 * @userdata: return value 156 * @userdata: return value
121 * 157 *
122 * Report an EEH error to each device driver, collect up and 158 * Report an EEH error to each device driver, collect up and
123 * merge the device driver responses. Cumulative response 159 * merge the device driver responses. Cumulative response
124 * passed back in "userdata". 160 * passed back in "userdata".
125 */ 161 */
126static int eeh_report_error(struct pci_dev *dev, void *userdata) 162static void *eeh_report_error(void *data, void *userdata)
127{ 163{
164 struct eeh_dev *edev = (struct eeh_dev *)data;
165 struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
128 enum pci_ers_result rc, *res = userdata; 166 enum pci_ers_result rc, *res = userdata;
129 struct pci_driver *driver = dev->driver; 167 struct pci_driver *driver;
130 168
169 /* We might not have the associated PCI device,
170 * then we should continue for next one.
171 */
172 if (!dev) return NULL;
131 dev->error_state = pci_channel_io_frozen; 173 dev->error_state = pci_channel_io_frozen;
132 174
133 if (!driver) 175 driver = eeh_pcid_get(dev);
134 return 0; 176 if (!driver) return NULL;
135 177
136 eeh_disable_irq(dev); 178 eeh_disable_irq(dev);
137 179
138 if (!driver->err_handler || 180 if (!driver->err_handler ||
139 !driver->err_handler->error_detected) 181 !driver->err_handler->error_detected) {
140 return 0; 182 eeh_pcid_put(dev);
183 return NULL;
184 }
141 185
142 rc = driver->err_handler->error_detected(dev, pci_channel_io_frozen); 186 rc = driver->err_handler->error_detected(dev, pci_channel_io_frozen);
143 187
@@ -145,27 +189,34 @@ static int eeh_report_error(struct pci_dev *dev, void *userdata)
145 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 189 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
146 if (*res == PCI_ERS_RESULT_NONE) *res = rc; 190 if (*res == PCI_ERS_RESULT_NONE) *res = rc;
147 191
148 return 0; 192 eeh_pcid_put(dev);
193 return NULL;
149} 194}
150 195
151/** 196/**
152 * eeh_report_mmio_enabled - Tell drivers that MMIO has been enabled 197 * eeh_report_mmio_enabled - Tell drivers that MMIO has been enabled
153 * @dev: PCI device 198 * @data: eeh device
154 * @userdata: return value 199 * @userdata: return value
155 * 200 *
156 * Tells each device driver that IO ports, MMIO and config space I/O 201 * Tells each device driver that IO ports, MMIO and config space I/O
157 * are now enabled. Collects up and merges the device driver responses. 202 * are now enabled. Collects up and merges the device driver responses.
158 * Cumulative response passed back in "userdata". 203 * Cumulative response passed back in "userdata".
159 */ 204 */
160static int eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata) 205static void *eeh_report_mmio_enabled(void *data, void *userdata)
161{ 206{
207 struct eeh_dev *edev = (struct eeh_dev *)data;
208 struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
162 enum pci_ers_result rc, *res = userdata; 209 enum pci_ers_result rc, *res = userdata;
163 struct pci_driver *driver = dev->driver; 210 struct pci_driver *driver;
164 211
165 if (!driver || 212 driver = eeh_pcid_get(dev);
166 !driver->err_handler || 213 if (!driver) return NULL;
167 !driver->err_handler->mmio_enabled) 214
168 return 0; 215 if (!driver->err_handler ||
216 !driver->err_handler->mmio_enabled) {
217 eeh_pcid_put(dev);
218 return NULL;
219 }
169 220
170 rc = driver->err_handler->mmio_enabled(dev); 221 rc = driver->err_handler->mmio_enabled(dev);
171 222
@@ -173,12 +224,13 @@ static int eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata)
173 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 224 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
174 if (*res == PCI_ERS_RESULT_NONE) *res = rc; 225 if (*res == PCI_ERS_RESULT_NONE) *res = rc;
175 226
176 return 0; 227 eeh_pcid_put(dev);
228 return NULL;
177} 229}
178 230
179/** 231/**
180 * eeh_report_reset - Tell device that slot has been reset 232 * eeh_report_reset - Tell device that slot has been reset
181 * @dev: PCI device 233 * @data: eeh device
182 * @userdata: return value 234 * @userdata: return value
183 * 235 *
184 * This routine must be called while EEH tries to reset particular 236 * This routine must be called while EEH tries to reset particular
@@ -186,21 +238,26 @@ static int eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata)
186 * some actions, usually to save data the driver needs so that the 238 * some actions, usually to save data the driver needs so that the
187 * driver can work again while the device is recovered. 239 * driver can work again while the device is recovered.
188 */ 240 */
189static int eeh_report_reset(struct pci_dev *dev, void *userdata) 241static void *eeh_report_reset(void *data, void *userdata)
190{ 242{
243 struct eeh_dev *edev = (struct eeh_dev *)data;
244 struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
191 enum pci_ers_result rc, *res = userdata; 245 enum pci_ers_result rc, *res = userdata;
192 struct pci_driver *driver = dev->driver; 246 struct pci_driver *driver;
193
194 if (!driver)
195 return 0;
196 247
248 if (!dev) return NULL;
197 dev->error_state = pci_channel_io_normal; 249 dev->error_state = pci_channel_io_normal;
198 250
251 driver = eeh_pcid_get(dev);
252 if (!driver) return NULL;
253
199 eeh_enable_irq(dev); 254 eeh_enable_irq(dev);
200 255
201 if (!driver->err_handler || 256 if (!driver->err_handler ||
202 !driver->err_handler->slot_reset) 257 !driver->err_handler->slot_reset) {
203 return 0; 258 eeh_pcid_put(dev);
259 return NULL;
260 }
204 261
205 rc = driver->err_handler->slot_reset(dev); 262 rc = driver->err_handler->slot_reset(dev);
206 if ((*res == PCI_ERS_RESULT_NONE) || 263 if ((*res == PCI_ERS_RESULT_NONE) ||
@@ -208,109 +265,115 @@ static int eeh_report_reset(struct pci_dev *dev, void *userdata)
208 if (*res == PCI_ERS_RESULT_DISCONNECT && 265 if (*res == PCI_ERS_RESULT_DISCONNECT &&
209 rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 266 rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
210 267
211 return 0; 268 eeh_pcid_put(dev);
269 return NULL;
212} 270}
213 271
214/** 272/**
215 * eeh_report_resume - Tell device to resume normal operations 273 * eeh_report_resume - Tell device to resume normal operations
216 * @dev: PCI device 274 * @data: eeh device
217 * @userdata: return value 275 * @userdata: return value
218 * 276 *
219 * This routine must be called to notify the device driver that it 277 * This routine must be called to notify the device driver that it
220 * could resume so that the device driver can do some initialization 278 * could resume so that the device driver can do some initialization
221 * to make the recovered device work again. 279 * to make the recovered device work again.
222 */ 280 */
223static int eeh_report_resume(struct pci_dev *dev, void *userdata) 281static void *eeh_report_resume(void *data, void *userdata)
224{ 282{
225 struct pci_driver *driver = dev->driver; 283 struct eeh_dev *edev = (struct eeh_dev *)data;
284 struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
285 struct pci_driver *driver;
226 286
287 if (!dev) return NULL;
227 dev->error_state = pci_channel_io_normal; 288 dev->error_state = pci_channel_io_normal;
228 289
229 if (!driver) 290 driver = eeh_pcid_get(dev);
230 return 0; 291 if (!driver) return NULL;
231 292
232 eeh_enable_irq(dev); 293 eeh_enable_irq(dev);
233 294
234 if (!driver->err_handler || 295 if (!driver->err_handler ||
235 !driver->err_handler->resume) 296 !driver->err_handler->resume) {
236 return 0; 297 eeh_pcid_put(dev);
298 return NULL;
299 }
237 300
238 driver->err_handler->resume(dev); 301 driver->err_handler->resume(dev);
239 302
240 return 0; 303 eeh_pcid_put(dev);
304 return NULL;
241} 305}
242 306
243/** 307/**
244 * eeh_report_failure - Tell device driver that device is dead. 308 * eeh_report_failure - Tell device driver that device is dead.
245 * @dev: PCI device 309 * @data: eeh device
246 * @userdata: return value 310 * @userdata: return value
247 * 311 *
248 * This informs the device driver that the device is permanently 312 * This informs the device driver that the device is permanently
249 * dead, and that no further recovery attempts will be made on it. 313 * dead, and that no further recovery attempts will be made on it.
250 */ 314 */
251static int eeh_report_failure(struct pci_dev *dev, void *userdata) 315static void *eeh_report_failure(void *data, void *userdata)
252{ 316{
253 struct pci_driver *driver = dev->driver; 317 struct eeh_dev *edev = (struct eeh_dev *)data;
318 struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
319 struct pci_driver *driver;
254 320
321 if (!dev) return NULL;
255 dev->error_state = pci_channel_io_perm_failure; 322 dev->error_state = pci_channel_io_perm_failure;
256 323
257 if (!driver) 324 driver = eeh_pcid_get(dev);
258 return 0; 325 if (!driver) return NULL;
259 326
260 eeh_disable_irq(dev); 327 eeh_disable_irq(dev);
261 328
262 if (!driver->err_handler || 329 if (!driver->err_handler ||
263 !driver->err_handler->error_detected) 330 !driver->err_handler->error_detected) {
264 return 0; 331 eeh_pcid_put(dev);
332 return NULL;
333 }
265 334
266 driver->err_handler->error_detected(dev, pci_channel_io_perm_failure); 335 driver->err_handler->error_detected(dev, pci_channel_io_perm_failure);
267 336
268 return 0; 337 eeh_pcid_put(dev);
338 return NULL;
269} 339}
270 340
271/** 341/**
272 * eeh_reset_device - Perform actual reset of a pci slot 342 * eeh_reset_device - Perform actual reset of a pci slot
273 * @edev: PE associated EEH device 343 * @pe: EEH PE
274 * @bus: PCI bus corresponding to the isolcated slot 344 * @bus: PCI bus corresponding to the isolcated slot
275 * 345 *
276 * This routine must be called to do reset on the indicated PE. 346 * This routine must be called to do reset on the indicated PE.
277 * During the reset, udev might be invoked because those affected 347 * During the reset, udev might be invoked because those affected
278 * PCI devices will be removed and then added. 348 * PCI devices will be removed and then added.
279 */ 349 */
280static int eeh_reset_device(struct eeh_dev *edev, struct pci_bus *bus) 350static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
281{ 351{
282 struct device_node *dn;
283 int cnt, rc; 352 int cnt, rc;
284 353
285 /* pcibios will clear the counter; save the value */ 354 /* pcibios will clear the counter; save the value */
286 cnt = edev->freeze_count; 355 cnt = pe->freeze_count;
287 356
357 /*
358 * We don't remove the corresponding PE instances because
359 * we need the information afterwords. The attached EEH
360 * devices are expected to be attached soon when calling
361 * into pcibios_add_pci_devices().
362 */
288 if (bus) 363 if (bus)
289 pcibios_remove_pci_devices(bus); 364 __pcibios_remove_pci_devices(bus, 0);
290 365
291 /* Reset the pci controller. (Asserts RST#; resets config space). 366 /* Reset the pci controller. (Asserts RST#; resets config space).
292 * Reconfigure bridges and devices. Don't try to bring the system 367 * Reconfigure bridges and devices. Don't try to bring the system
293 * up if the reset failed for some reason. 368 * up if the reset failed for some reason.
294 */ 369 */
295 rc = eeh_reset_pe(edev); 370 rc = eeh_reset_pe(pe);
296 if (rc) 371 if (rc)
297 return rc; 372 return rc;
298 373
299 /* Walk over all functions on this device. */ 374 /* Restore PE */
300 dn = eeh_dev_to_of_node(edev); 375 eeh_ops->configure_bridge(pe);
301 if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent)) 376 eeh_pe_restore_bars(pe);
302 dn = dn->parent->child;
303
304 while (dn) {
305 struct eeh_dev *pedev = of_node_to_eeh_dev(dn);
306
307 /* On Power4, always true because eeh_pe_config_addr=0 */
308 if (edev->pe_config_addr == pedev->pe_config_addr) {
309 eeh_ops->configure_bridge(dn);
310 eeh_restore_bars(pedev);
311 }
312 dn = dn->sibling;
313 }
314 377
315 /* Give the system 5 seconds to finish running the user-space 378 /* Give the system 5 seconds to finish running the user-space
316 * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes, 379 * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes,
@@ -322,7 +385,7 @@ static int eeh_reset_device(struct eeh_dev *edev, struct pci_bus *bus)
322 ssleep(5); 385 ssleep(5);
323 pcibios_add_pci_devices(bus); 386 pcibios_add_pci_devices(bus);
324 } 387 }
325 edev->freeze_count = cnt; 388 pe->freeze_count = cnt;
326 389
327 return 0; 390 return 0;
328} 391}
@@ -334,7 +397,7 @@ static int eeh_reset_device(struct eeh_dev *edev, struct pci_bus *bus)
334 397
335/** 398/**
336 * eeh_handle_event - Reset a PCI device after hard lockup. 399 * eeh_handle_event - Reset a PCI device after hard lockup.
337 * @event: EEH event 400 * @pe: EEH PE
338 * 401 *
339 * While PHB detects address or data parity errors on particular PCI 402 * While PHB detects address or data parity errors on particular PCI
340 * slot, the associated PE will be frozen. Besides, DMA's occurring 403 * slot, the associated PE will be frozen. Besides, DMA's occurring
@@ -349,69 +412,24 @@ static int eeh_reset_device(struct eeh_dev *edev, struct pci_bus *bus)
349 * drivers (which cause a second set of hotplug events to go out to 412 * drivers (which cause a second set of hotplug events to go out to
350 * userspace). 413 * userspace).
351 */ 414 */
352struct eeh_dev *handle_eeh_events(struct eeh_event *event) 415void eeh_handle_event(struct eeh_pe *pe)
353{ 416{
354 struct device_node *frozen_dn;
355 struct eeh_dev *frozen_edev;
356 struct pci_bus *frozen_bus; 417 struct pci_bus *frozen_bus;
357 int rc = 0; 418 int rc = 0;
358 enum pci_ers_result result = PCI_ERS_RESULT_NONE; 419 enum pci_ers_result result = PCI_ERS_RESULT_NONE;
359 const char *location, *pci_str, *drv_str, *bus_pci_str, *bus_drv_str;
360
361 frozen_dn = eeh_find_device_pe(eeh_dev_to_of_node(event->edev));
362 if (!frozen_dn) {
363 location = of_get_property(eeh_dev_to_of_node(event->edev), "ibm,loc-code", NULL);
364 location = location ? location : "unknown";
365 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint "
366 "for location=%s pci addr=%s\n",
367 location, eeh_pci_name(eeh_dev_to_pci_dev(event->edev)));
368 return NULL;
369 }
370
371 frozen_bus = pcibios_find_pci_bus(frozen_dn);
372 location = of_get_property(frozen_dn, "ibm,loc-code", NULL);
373 location = location ? location : "unknown";
374
375 /* There are two different styles for coming up with the PE.
376 * In the old style, it was the highest EEH-capable device
377 * which was always an EADS pci bridge. In the new style,
378 * there might not be any EADS bridges, and even when there are,
379 * the firmware marks them as "EEH incapable". So another
380 * two-step is needed to find the pci bus..
381 */
382 if (!frozen_bus)
383 frozen_bus = pcibios_find_pci_bus(frozen_dn->parent);
384 420
421 frozen_bus = eeh_pe_bus_get(pe);
385 if (!frozen_bus) { 422 if (!frozen_bus) {
386 printk(KERN_ERR "EEH: Cannot find PCI bus " 423 pr_err("%s: Cannot find PCI bus for PHB#%d-PE#%x\n",
387 "for location=%s dn=%s\n", 424 __func__, pe->phb->global_number, pe->addr);
388 location, frozen_dn->full_name); 425 return;
389 return NULL;
390 } 426 }
391 427
392 frozen_edev = of_node_to_eeh_dev(frozen_dn); 428 pe->freeze_count++;
393 frozen_edev->freeze_count++; 429 if (pe->freeze_count > EEH_MAX_ALLOWED_FREEZES)
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));
396
397 if (frozen_edev->freeze_count > EEH_MAX_ALLOWED_FREEZES)
398 goto excess_failures; 430 goto excess_failures;
399 431 pr_warning("EEH: This PCI device has failed %d times in the last hour\n",
400 printk(KERN_WARNING 432 pe->freeze_count);
401 "EEH: This PCI device has failed %d times in the last hour:\n",
402 frozen_edev->freeze_count);
403
404 if (frozen_edev->pdev) {
405 bus_pci_str = pci_name(frozen_edev->pdev);
406 bus_drv_str = eeh_pcid_name(frozen_edev->pdev);
407 printk(KERN_WARNING
408 "EEH: Bus location=%s driver=%s pci addr=%s\n",
409 location, bus_drv_str, bus_pci_str);
410 }
411
412 printk(KERN_WARNING
413 "EEH: Device location=%s driver=%s pci addr=%s\n",
414 location, drv_str, pci_str);
415 433
416 /* Walk the various device drivers attached to this slot through 434 /* Walk the various device drivers attached to this slot through
417 * a reset sequence, giving each an opportunity to do what it needs 435 * a reset sequence, giving each an opportunity to do what it needs
@@ -419,12 +437,12 @@ struct eeh_dev *handle_eeh_events(struct eeh_event *event)
419 * status ... if any child can't handle the reset, then the entire 437 * status ... if any child can't handle the reset, then the entire
420 * slot is dlpar removed and added. 438 * slot is dlpar removed and added.
421 */ 439 */
422 pci_walk_bus(frozen_bus, eeh_report_error, &result); 440 eeh_pe_dev_traverse(pe, eeh_report_error, &result);
423 441
424 /* Get the current PCI slot state. This can take a long time, 442 /* Get the current PCI slot state. This can take a long time,
425 * sometimes over 3 seconds for certain systems. 443 * sometimes over 3 seconds for certain systems.
426 */ 444 */
427 rc = eeh_ops->wait_state(eeh_dev_to_of_node(frozen_edev), MAX_WAIT_FOR_RECOVERY*1000); 445 rc = eeh_ops->wait_state(pe, MAX_WAIT_FOR_RECOVERY*1000);
428 if (rc < 0 || rc == EEH_STATE_NOT_SUPPORT) { 446 if (rc < 0 || rc == EEH_STATE_NOT_SUPPORT) {
429 printk(KERN_WARNING "EEH: Permanent failure\n"); 447 printk(KERN_WARNING "EEH: Permanent failure\n");
430 goto hard_fail; 448 goto hard_fail;
@@ -434,14 +452,14 @@ struct eeh_dev *handle_eeh_events(struct eeh_event *event)
434 * don't post the error log until after all dev drivers 452 * don't post the error log until after all dev drivers
435 * have been informed. 453 * have been informed.
436 */ 454 */
437 eeh_slot_error_detail(frozen_edev, EEH_LOG_TEMP); 455 eeh_slot_error_detail(pe, EEH_LOG_TEMP);
438 456
439 /* If all device drivers were EEH-unaware, then shut 457 /* If all device drivers were EEH-unaware, then shut
440 * down all of the device drivers, and hope they 458 * down all of the device drivers, and hope they
441 * go down willingly, without panicing the system. 459 * go down willingly, without panicing the system.
442 */ 460 */
443 if (result == PCI_ERS_RESULT_NONE) { 461 if (result == PCI_ERS_RESULT_NONE) {
444 rc = eeh_reset_device(frozen_edev, frozen_bus); 462 rc = eeh_reset_device(pe, frozen_bus);
445 if (rc) { 463 if (rc) {
446 printk(KERN_WARNING "EEH: Unable to reset, rc=%d\n", rc); 464 printk(KERN_WARNING "EEH: Unable to reset, rc=%d\n", rc);
447 goto hard_fail; 465 goto hard_fail;
@@ -450,7 +468,7 @@ struct eeh_dev *handle_eeh_events(struct eeh_event *event)
450 468
451 /* If all devices reported they can proceed, then re-enable MMIO */ 469 /* If all devices reported they can proceed, then re-enable MMIO */
452 if (result == PCI_ERS_RESULT_CAN_RECOVER) { 470 if (result == PCI_ERS_RESULT_CAN_RECOVER) {
453 rc = eeh_pci_enable(frozen_edev, EEH_OPT_THAW_MMIO); 471 rc = eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
454 472
455 if (rc < 0) 473 if (rc < 0)
456 goto hard_fail; 474 goto hard_fail;
@@ -458,13 +476,13 @@ struct eeh_dev *handle_eeh_events(struct eeh_event *event)
458 result = PCI_ERS_RESULT_NEED_RESET; 476 result = PCI_ERS_RESULT_NEED_RESET;
459 } else { 477 } else {
460 result = PCI_ERS_RESULT_NONE; 478 result = PCI_ERS_RESULT_NONE;
461 pci_walk_bus(frozen_bus, eeh_report_mmio_enabled, &result); 479 eeh_pe_dev_traverse(pe, eeh_report_mmio_enabled, &result);
462 } 480 }
463 } 481 }
464 482
465 /* If all devices reported they can proceed, then re-enable DMA */ 483 /* If all devices reported they can proceed, then re-enable DMA */
466 if (result == PCI_ERS_RESULT_CAN_RECOVER) { 484 if (result == PCI_ERS_RESULT_CAN_RECOVER) {
467 rc = eeh_pci_enable(frozen_edev, EEH_OPT_THAW_DMA); 485 rc = eeh_pci_enable(pe, EEH_OPT_THAW_DMA);
468 486
469 if (rc < 0) 487 if (rc < 0)
470 goto hard_fail; 488 goto hard_fail;
@@ -482,13 +500,13 @@ struct eeh_dev *handle_eeh_events(struct eeh_event *event)
482 500
483 /* If any device called out for a reset, then reset the slot */ 501 /* If any device called out for a reset, then reset the slot */
484 if (result == PCI_ERS_RESULT_NEED_RESET) { 502 if (result == PCI_ERS_RESULT_NEED_RESET) {
485 rc = eeh_reset_device(frozen_edev, NULL); 503 rc = eeh_reset_device(pe, NULL);
486 if (rc) { 504 if (rc) {
487 printk(KERN_WARNING "EEH: Cannot reset, rc=%d\n", rc); 505 printk(KERN_WARNING "EEH: Cannot reset, rc=%d\n", rc);
488 goto hard_fail; 506 goto hard_fail;
489 } 507 }
490 result = PCI_ERS_RESULT_NONE; 508 result = PCI_ERS_RESULT_NONE;
491 pci_walk_bus(frozen_bus, eeh_report_reset, &result); 509 eeh_pe_dev_traverse(pe, eeh_report_reset, &result);
492 } 510 }
493 511
494 /* All devices should claim they have recovered by now. */ 512 /* All devices should claim they have recovered by now. */
@@ -499,9 +517,9 @@ struct eeh_dev *handle_eeh_events(struct eeh_event *event)
499 } 517 }
500 518
501 /* Tell all device drivers that they can resume operations */ 519 /* Tell all device drivers that they can resume operations */
502 pci_walk_bus(frozen_bus, eeh_report_resume, NULL); 520 eeh_pe_dev_traverse(pe, eeh_report_resume, NULL);
503 521
504 return frozen_edev; 522 return;
505 523
506excess_failures: 524excess_failures:
507 /* 525 /*
@@ -509,30 +527,26 @@ excess_failures:
509 * are due to poorly seated PCI cards. Only 10% or so are 527 * are due to poorly seated PCI cards. Only 10% or so are
510 * due to actual, failed cards. 528 * due to actual, failed cards.
511 */ 529 */
512 printk(KERN_ERR 530 pr_err("EEH: PHB#%d-PE#%x has failed %d times in the\n"
513 "EEH: PCI device at location=%s driver=%s pci addr=%s\n" 531 "last hour and has been permanently disabled.\n"
514 "has failed %d times in the last hour " 532 "Please try reseating or replacing it.\n",
515 "and has been permanently disabled.\n" 533 pe->phb->global_number, pe->addr,
516 "Please try reseating this device or replacing it.\n", 534 pe->freeze_count);
517 location, drv_str, pci_str, frozen_edev->freeze_count);
518 goto perm_error; 535 goto perm_error;
519 536
520hard_fail: 537hard_fail:
521 printk(KERN_ERR 538 pr_err("EEH: Unable to recover from failure from PHB#%d-PE#%x.\n"
522 "EEH: Unable to recover from failure of PCI device " 539 "Please try reseating or replacing it\n",
523 "at location=%s driver=%s pci addr=%s\n" 540 pe->phb->global_number, pe->addr);
524 "Please try reseating this device or replacing it.\n",
525 location, drv_str, pci_str);
526 541
527perm_error: 542perm_error:
528 eeh_slot_error_detail(frozen_edev, EEH_LOG_PERM); 543 eeh_slot_error_detail(pe, EEH_LOG_PERM);
529 544
530 /* Notify all devices that they're about to go down. */ 545 /* Notify all devices that they're about to go down. */
531 pci_walk_bus(frozen_bus, eeh_report_failure, NULL); 546 eeh_pe_dev_traverse(pe, eeh_report_failure, NULL);
532 547
533 /* Shut down the device drivers for good. */ 548 /* Shut down the device drivers for good. */
534 pcibios_remove_pci_devices(frozen_bus); 549 if (frozen_bus)
535 550 pcibios_remove_pci_devices(frozen_bus);
536 return NULL;
537} 551}
538 552
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c
index fb506317ebb0..51faaac8abe6 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -57,7 +57,7 @@ static int eeh_event_handler(void * dummy)
57{ 57{
58 unsigned long flags; 58 unsigned long flags;
59 struct eeh_event *event; 59 struct eeh_event *event;
60 struct eeh_dev *edev; 60 struct eeh_pe *pe;
61 61
62 set_task_comm(current, "eehd"); 62 set_task_comm(current, "eehd");
63 63
@@ -76,28 +76,23 @@ static int eeh_event_handler(void * dummy)
76 76
77 /* Serialize processing of EEH events */ 77 /* Serialize processing of EEH events */
78 mutex_lock(&eeh_event_mutex); 78 mutex_lock(&eeh_event_mutex);
79 edev = event->edev; 79 pe = event->pe;
80 eeh_mark_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING); 80 eeh_pe_state_mark(pe, EEH_PE_RECOVERING);
81 81 pr_info("EEH: Detected PCI bus error on PHB#%d-PE#%x\n",
82 printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n", 82 pe->phb->global_number, pe->addr);
83 eeh_pci_name(edev->pdev));
84 83
85 set_current_state(TASK_INTERRUPTIBLE); /* Don't add to load average */ 84 set_current_state(TASK_INTERRUPTIBLE); /* Don't add to load average */
86 edev = handle_eeh_events(event); 85 eeh_handle_event(pe);
87 86 eeh_pe_state_clear(pe, EEH_PE_RECOVERING);
88 if (edev) {
89 eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING);
90 pci_dev_put(edev->pdev);
91 }
92 87
93 kfree(event); 88 kfree(event);
94 mutex_unlock(&eeh_event_mutex); 89 mutex_unlock(&eeh_event_mutex);
95 90
96 /* If there are no new errors after an hour, clear the counter. */ 91 /* If there are no new errors after an hour, clear the counter. */
97 if (edev && edev->freeze_count>0) { 92 if (pe && pe->freeze_count > 0) {
98 msleep_interruptible(3600*1000); 93 msleep_interruptible(3600*1000);
99 if (edev->freeze_count>0) 94 if (pe->freeze_count > 0)
100 edev->freeze_count--; 95 pe->freeze_count--;
101 96
102 } 97 }
103 98
@@ -119,36 +114,23 @@ static void eeh_thread_launcher(struct work_struct *dummy)
119 114
120/** 115/**
121 * eeh_send_failure_event - Generate a PCI error event 116 * eeh_send_failure_event - Generate a PCI error event
122 * @edev: EEH device 117 * @pe: EEH PE
123 * 118 *
124 * This routine can be called within an interrupt context; 119 * This routine can be called within an interrupt context;
125 * the actual event will be delivered in a normal context 120 * the actual event will be delivered in a normal context
126 * (from a workqueue). 121 * (from a workqueue).
127 */ 122 */
128int eeh_send_failure_event(struct eeh_dev *edev) 123int eeh_send_failure_event(struct eeh_pe *pe)
129{ 124{
130 unsigned long flags; 125 unsigned long flags;
131 struct eeh_event *event; 126 struct eeh_event *event;
132 struct device_node *dn = eeh_dev_to_of_node(edev);
133 const char *location;
134
135 if (!mem_init_done) {
136 printk(KERN_ERR "EEH: event during early boot not handled\n");
137 location = of_get_property(dn, "ibm,loc-code", NULL);
138 printk(KERN_ERR "EEH: device node = %s\n", dn->full_name);
139 printk(KERN_ERR "EEH: PCI location = %s\n", location);
140 return 1;
141 }
142 event = kmalloc(sizeof(*event), GFP_ATOMIC);
143 if (event == NULL) {
144 printk(KERN_ERR "EEH: out of memory, event not handled\n");
145 return 1;
146 }
147
148 if (edev->pdev)
149 pci_dev_get(edev->pdev);
150 127
151 event->edev = edev; 128 event = kzalloc(sizeof(*event), GFP_ATOMIC);
129 if (!event) {
130 pr_err("EEH: out of memory, event not handled\n");
131 return -ENOMEM;
132 }
133 event->pe = pe;
152 134
153 /* We may or may not be called in an interrupt context */ 135 /* We may or may not be called in an interrupt context */
154 spin_lock_irqsave(&eeh_eventlist_lock, flags); 136 spin_lock_irqsave(&eeh_eventlist_lock, flags);
diff --git a/arch/powerpc/platforms/pseries/eeh_pe.c b/arch/powerpc/platforms/pseries/eeh_pe.c
new file mode 100644
index 000000000000..797cd181dc3f
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/eeh_pe.c
@@ -0,0 +1,652 @@
1/*
2 * The file intends to implement PE based on the information from
3 * platforms. Basically, there have 3 types of PEs: PHB/Bus/Device.
4 * All the PEs should be organized as hierarchy tree. The first level
5 * of the tree will be associated to existing PHBs since the particular
6 * PE is only meaningful in one PHB domain.
7 *
8 * Copyright Benjamin Herrenschmidt & Gavin Shan, IBM Corporation 2012.
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 Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#include <linux/export.h>
26#include <linux/gfp.h>
27#include <linux/init.h>
28#include <linux/kernel.h>
29#include <linux/pci.h>
30#include <linux/string.h>
31
32#include <asm/pci-bridge.h>
33#include <asm/ppc-pci.h>
34
35static LIST_HEAD(eeh_phb_pe);
36
37/**
38 * eeh_pe_alloc - Allocate PE
39 * @phb: PCI controller
40 * @type: PE type
41 *
42 * Allocate PE instance dynamically.
43 */
44static struct eeh_pe *eeh_pe_alloc(struct pci_controller *phb, int type)
45{
46 struct eeh_pe *pe;
47
48 /* Allocate PHB PE */
49 pe = kzalloc(sizeof(struct eeh_pe), GFP_KERNEL);
50 if (!pe) return NULL;
51
52 /* Initialize PHB PE */
53 pe->type = type;
54 pe->phb = phb;
55 INIT_LIST_HEAD(&pe->child_list);
56 INIT_LIST_HEAD(&pe->child);
57 INIT_LIST_HEAD(&pe->edevs);
58
59 return pe;
60}
61
62/**
63 * eeh_phb_pe_create - Create PHB PE
64 * @phb: PCI controller
65 *
66 * The function should be called while the PHB is detected during
67 * system boot or PCI hotplug in order to create PHB PE.
68 */
69int __devinit eeh_phb_pe_create(struct pci_controller *phb)
70{
71 struct eeh_pe *pe;
72
73 /* Allocate PHB PE */
74 pe = eeh_pe_alloc(phb, EEH_PE_PHB);
75 if (!pe) {
76 pr_err("%s: out of memory!\n", __func__);
77 return -ENOMEM;
78 }
79
80 /* Put it into the list */
81 eeh_lock();
82 list_add_tail(&pe->child, &eeh_phb_pe);
83 eeh_unlock();
84
85 pr_debug("EEH: Add PE for PHB#%d\n", phb->global_number);
86
87 return 0;
88}
89
90/**
91 * eeh_phb_pe_get - Retrieve PHB PE based on the given PHB
92 * @phb: PCI controller
93 *
94 * The overall PEs form hierarchy tree. The first layer of the
95 * hierarchy tree is composed of PHB PEs. The function is used
96 * to retrieve the corresponding PHB PE according to the given PHB.
97 */
98static struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb)
99{
100 struct eeh_pe *pe;
101
102 list_for_each_entry(pe, &eeh_phb_pe, child) {
103 /*
104 * Actually, we needn't check the type since
105 * the PE for PHB has been determined when that
106 * was created.
107 */
108 if ((pe->type & EEH_PE_PHB) && pe->phb == phb)
109 return pe;
110 }
111
112 return NULL;
113}
114
115/**
116 * eeh_pe_next - Retrieve the next PE in the tree
117 * @pe: current PE
118 * @root: root PE
119 *
120 * The function is used to retrieve the next PE in the
121 * hierarchy PE tree.
122 */
123static struct eeh_pe *eeh_pe_next(struct eeh_pe *pe,
124 struct eeh_pe *root)
125{
126 struct list_head *next = pe->child_list.next;
127
128 if (next == &pe->child_list) {
129 while (1) {
130 if (pe == root)
131 return NULL;
132 next = pe->child.next;
133 if (next != &pe->parent->child_list)
134 break;
135 pe = pe->parent;
136 }
137 }
138
139 return list_entry(next, struct eeh_pe, child);
140}
141
142/**
143 * eeh_pe_traverse - Traverse PEs in the specified PHB
144 * @root: root PE
145 * @fn: callback
146 * @flag: extra parameter to callback
147 *
148 * The function is used to traverse the specified PE and its
149 * child PEs. The traversing is to be terminated once the
150 * callback returns something other than NULL, or no more PEs
151 * to be traversed.
152 */
153static void *eeh_pe_traverse(struct eeh_pe *root,
154 eeh_traverse_func fn, void *flag)
155{
156 struct eeh_pe *pe;
157 void *ret;
158
159 for (pe = root; pe; pe = eeh_pe_next(pe, root)) {
160 ret = fn(pe, flag);
161 if (ret) return ret;
162 }
163
164 return NULL;
165}
166
167/**
168 * eeh_pe_dev_traverse - Traverse the devices from the PE
169 * @root: EEH PE
170 * @fn: function callback
171 * @flag: extra parameter to callback
172 *
173 * The function is used to traverse the devices of the specified
174 * PE and its child PEs.
175 */
176void *eeh_pe_dev_traverse(struct eeh_pe *root,
177 eeh_traverse_func fn, void *flag)
178{
179 struct eeh_pe *pe;
180 struct eeh_dev *edev;
181 void *ret;
182
183 if (!root) {
184 pr_warning("%s: Invalid PE %p\n", __func__, root);
185 return NULL;
186 }
187
188 eeh_lock();
189
190 /* Traverse root PE */
191 for (pe = root; pe; pe = eeh_pe_next(pe, root)) {
192 eeh_pe_for_each_dev(pe, edev) {
193 ret = fn(edev, flag);
194 if (ret) {
195 eeh_unlock();
196 return ret;
197 }
198 }
199 }
200
201 eeh_unlock();
202
203 return NULL;
204}
205
206/**
207 * __eeh_pe_get - Check the PE address
208 * @data: EEH PE
209 * @flag: EEH device
210 *
211 * For one particular PE, it can be identified by PE address
212 * or tranditional BDF address. BDF address is composed of
213 * Bus/Device/Function number. The extra data referred by flag
214 * indicates which type of address should be used.
215 */
216static void *__eeh_pe_get(void *data, void *flag)
217{
218 struct eeh_pe *pe = (struct eeh_pe *)data;
219 struct eeh_dev *edev = (struct eeh_dev *)flag;
220
221 /* Unexpected PHB PE */
222 if (pe->type & EEH_PE_PHB)
223 return NULL;
224
225 /* We prefer PE address */
226 if (edev->pe_config_addr &&
227 (edev->pe_config_addr == pe->addr))
228 return pe;
229
230 /* Try BDF address */
231 if (edev->pe_config_addr &&
232 (edev->config_addr == pe->config_addr))
233 return pe;
234
235 return NULL;
236}
237
238/**
239 * eeh_pe_get - Search PE based on the given address
240 * @edev: EEH device
241 *
242 * Search the corresponding PE based on the specified address which
243 * is included in the eeh device. The function is used to check if
244 * the associated PE has been created against the PE address. It's
245 * notable that the PE address has 2 format: traditional PE address
246 * which is composed of PCI bus/device/function number, or unified
247 * PE address.
248 */
249static struct eeh_pe *eeh_pe_get(struct eeh_dev *edev)
250{
251 struct eeh_pe *root = eeh_phb_pe_get(edev->phb);
252 struct eeh_pe *pe;
253
254 pe = eeh_pe_traverse(root, __eeh_pe_get, edev);
255
256 return pe;
257}
258
259/**
260 * eeh_pe_get_parent - Retrieve the parent PE
261 * @edev: EEH device
262 *
263 * The whole PEs existing in the system are organized as hierarchy
264 * tree. The function is used to retrieve the parent PE according
265 * to the parent EEH device.
266 */
267static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev *edev)
268{
269 struct device_node *dn;
270 struct eeh_dev *parent;
271
272 /*
273 * It might have the case for the indirect parent
274 * EEH device already having associated PE, but
275 * the direct parent EEH device doesn't have yet.
276 */
277 dn = edev->dn->parent;
278 while (dn) {
279 /* We're poking out of PCI territory */
280 if (!PCI_DN(dn)) return NULL;
281
282 parent = of_node_to_eeh_dev(dn);
283 /* We're poking out of PCI territory */
284 if (!parent) return NULL;
285
286 if (parent->pe)
287 return parent->pe;
288
289 dn = dn->parent;
290 }
291
292 return NULL;
293}
294
295/**
296 * eeh_add_to_parent_pe - Add EEH device to parent PE
297 * @edev: EEH device
298 *
299 * Add EEH device to the parent PE. If the parent PE already
300 * exists, the PE type will be changed to EEH_PE_BUS. Otherwise,
301 * we have to create new PE to hold the EEH device and the new
302 * PE will be linked to its parent PE as well.
303 */
304int eeh_add_to_parent_pe(struct eeh_dev *edev)
305{
306 struct eeh_pe *pe, *parent;
307
308 eeh_lock();
309
310 /*
311 * Search the PE has been existing or not according
312 * to the PE address. If that has been existing, the
313 * PE should be composed of PCI bus and its subordinate
314 * components.
315 */
316 pe = eeh_pe_get(edev);
317 if (pe && !(pe->type & EEH_PE_INVALID)) {
318 if (!edev->pe_config_addr) {
319 eeh_unlock();
320 pr_err("%s: PE with addr 0x%x already exists\n",
321 __func__, edev->config_addr);
322 return -EEXIST;
323 }
324
325 /* Mark the PE as type of PCI bus */
326 pe->type = EEH_PE_BUS;
327 edev->pe = pe;
328
329 /* Put the edev to PE */
330 list_add_tail(&edev->list, &pe->edevs);
331 eeh_unlock();
332 pr_debug("EEH: Add %s to Bus PE#%x\n",
333 edev->dn->full_name, pe->addr);
334
335 return 0;
336 } else if (pe && (pe->type & EEH_PE_INVALID)) {
337 list_add_tail(&edev->list, &pe->edevs);
338 edev->pe = pe;
339 /*
340 * We're running to here because of PCI hotplug caused by
341 * EEH recovery. We need clear EEH_PE_INVALID until the top.
342 */
343 parent = pe;
344 while (parent) {
345 if (!(parent->type & EEH_PE_INVALID))
346 break;
347 parent->type &= ~EEH_PE_INVALID;
348 parent = parent->parent;
349 }
350 eeh_unlock();
351 pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n",
352 edev->dn->full_name, pe->addr, pe->parent->addr);
353
354 return 0;
355 }
356
357 /* Create a new EEH PE */
358 pe = eeh_pe_alloc(edev->phb, EEH_PE_DEVICE);
359 if (!pe) {
360 eeh_unlock();
361 pr_err("%s: out of memory!\n", __func__);
362 return -ENOMEM;
363 }
364 pe->addr = edev->pe_config_addr;
365 pe->config_addr = edev->config_addr;
366
367 /*
368 * Put the new EEH PE into hierarchy tree. If the parent
369 * can't be found, the newly created PE will be attached
370 * to PHB directly. Otherwise, we have to associate the
371 * PE with its parent.
372 */
373 parent = eeh_pe_get_parent(edev);
374 if (!parent) {
375 parent = eeh_phb_pe_get(edev->phb);
376 if (!parent) {
377 eeh_unlock();
378 pr_err("%s: No PHB PE is found (PHB Domain=%d)\n",
379 __func__, edev->phb->global_number);
380 edev->pe = NULL;
381 kfree(pe);
382 return -EEXIST;
383 }
384 }
385 pe->parent = parent;
386
387 /*
388 * Put the newly created PE into the child list and
389 * link the EEH device accordingly.
390 */
391 list_add_tail(&pe->child, &parent->child_list);
392 list_add_tail(&edev->list, &pe->edevs);
393 edev->pe = pe;
394 eeh_unlock();
395 pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n",
396 edev->dn->full_name, pe->addr, pe->parent->addr);
397
398 return 0;
399}
400
401/**
402 * eeh_rmv_from_parent_pe - Remove one EEH device from the associated PE
403 * @edev: EEH device
404 * @purge_pe: remove PE or not
405 *
406 * The PE hierarchy tree might be changed when doing PCI hotplug.
407 * Also, the PCI devices or buses could be removed from the system
408 * during EEH recovery. So we have to call the function remove the
409 * corresponding PE accordingly if necessary.
410 */
411int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe)
412{
413 struct eeh_pe *pe, *parent, *child;
414 int cnt;
415
416 if (!edev->pe) {
417 pr_warning("%s: No PE found for EEH device %s\n",
418 __func__, edev->dn->full_name);
419 return -EEXIST;
420 }
421
422 eeh_lock();
423
424 /* Remove the EEH device */
425 pe = edev->pe;
426 edev->pe = NULL;
427 list_del(&edev->list);
428
429 /*
430 * Check if the parent PE includes any EEH devices.
431 * If not, we should delete that. Also, we should
432 * delete the parent PE if it doesn't have associated
433 * child PEs and EEH devices.
434 */
435 while (1) {
436 parent = pe->parent;
437 if (pe->type & EEH_PE_PHB)
438 break;
439
440 if (purge_pe) {
441 if (list_empty(&pe->edevs) &&
442 list_empty(&pe->child_list)) {
443 list_del(&pe->child);
444 kfree(pe);
445 } else {
446 break;
447 }
448 } else {
449 if (list_empty(&pe->edevs)) {
450 cnt = 0;
451 list_for_each_entry(child, &pe->child_list, child) {
452 if (!(pe->type & EEH_PE_INVALID)) {
453 cnt++;
454 break;
455 }
456 }
457
458 if (!cnt)
459 pe->type |= EEH_PE_INVALID;
460 else
461 break;
462 }
463 }
464
465 pe = parent;
466 }
467
468 eeh_unlock();
469
470 return 0;
471}
472
473/**
474 * __eeh_pe_state_mark - Mark the state for the PE
475 * @data: EEH PE
476 * @flag: state
477 *
478 * The function is used to mark the indicated state for the given
479 * PE. Also, the associated PCI devices will be put into IO frozen
480 * state as well.
481 */
482static void *__eeh_pe_state_mark(void *data, void *flag)
483{
484 struct eeh_pe *pe = (struct eeh_pe *)data;
485 int state = *((int *)flag);
486 struct eeh_dev *tmp;
487 struct pci_dev *pdev;
488
489 /*
490 * Mark the PE with the indicated state. Also,
491 * the associated PCI device will be put into
492 * I/O frozen state to avoid I/O accesses from
493 * the PCI device driver.
494 */
495 pe->state |= state;
496 eeh_pe_for_each_dev(pe, tmp) {
497 pdev = eeh_dev_to_pci_dev(tmp);
498 if (pdev)
499 pdev->error_state = pci_channel_io_frozen;
500 }
501
502 return NULL;
503}
504
505/**
506 * eeh_pe_state_mark - Mark specified state for PE and its associated device
507 * @pe: EEH PE
508 *
509 * EEH error affects the current PE and its child PEs. The function
510 * is used to mark appropriate state for the affected PEs and the
511 * associated devices.
512 */
513void eeh_pe_state_mark(struct eeh_pe *pe, int state)
514{
515 eeh_lock();
516 eeh_pe_traverse(pe, __eeh_pe_state_mark, &state);
517 eeh_unlock();
518}
519
520/**
521 * __eeh_pe_state_clear - Clear state for the PE
522 * @data: EEH PE
523 * @flag: state
524 *
525 * The function is used to clear the indicated state from the
526 * given PE. Besides, we also clear the check count of the PE
527 * as well.
528 */
529static void *__eeh_pe_state_clear(void *data, void *flag)
530{
531 struct eeh_pe *pe = (struct eeh_pe *)data;
532 int state = *((int *)flag);
533
534 pe->state &= ~state;
535 pe->check_count = 0;
536
537 return NULL;
538}
539
540/**
541 * eeh_pe_state_clear - Clear state for the PE and its children
542 * @pe: PE
543 * @state: state to be cleared
544 *
545 * When the PE and its children has been recovered from error,
546 * we need clear the error state for that. The function is used
547 * for the purpose.
548 */
549void eeh_pe_state_clear(struct eeh_pe *pe, int state)
550{
551 eeh_lock();
552 eeh_pe_traverse(pe, __eeh_pe_state_clear, &state);
553 eeh_unlock();
554}
555
556/**
557 * eeh_restore_one_device_bars - Restore the Base Address Registers for one device
558 * @data: EEH device
559 * @flag: Unused
560 *
561 * Loads the PCI configuration space base address registers,
562 * the expansion ROM base address, the latency timer, and etc.
563 * from the saved values in the device node.
564 */
565static void *eeh_restore_one_device_bars(void *data, void *flag)
566{
567 int i;
568 u32 cmd;
569 struct eeh_dev *edev = (struct eeh_dev *)data;
570 struct device_node *dn = eeh_dev_to_of_node(edev);
571
572 for (i = 4; i < 10; i++)
573 eeh_ops->write_config(dn, i*4, 4, edev->config_space[i]);
574 /* 12 == Expansion ROM Address */
575 eeh_ops->write_config(dn, 12*4, 4, edev->config_space[12]);
576
577#define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF))
578#define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)])
579
580 eeh_ops->write_config(dn, PCI_CACHE_LINE_SIZE, 1,
581 SAVED_BYTE(PCI_CACHE_LINE_SIZE));
582 eeh_ops->write_config(dn, PCI_LATENCY_TIMER, 1,
583 SAVED_BYTE(PCI_LATENCY_TIMER));
584
585 /* max latency, min grant, interrupt pin and line */
586 eeh_ops->write_config(dn, 15*4, 4, edev->config_space[15]);
587
588 /*
589 * Restore PERR & SERR bits, some devices require it,
590 * don't touch the other command bits
591 */
592 eeh_ops->read_config(dn, PCI_COMMAND, 4, &cmd);
593 if (edev->config_space[1] & PCI_COMMAND_PARITY)
594 cmd |= PCI_COMMAND_PARITY;
595 else
596 cmd &= ~PCI_COMMAND_PARITY;
597 if (edev->config_space[1] & PCI_COMMAND_SERR)
598 cmd |= PCI_COMMAND_SERR;
599 else
600 cmd &= ~PCI_COMMAND_SERR;
601 eeh_ops->write_config(dn, PCI_COMMAND, 4, cmd);
602
603 return NULL;
604}
605
606/**
607 * eeh_pe_restore_bars - Restore the PCI config space info
608 * @pe: EEH PE
609 *
610 * This routine performs a recursive walk to the children
611 * of this device as well.
612 */
613void eeh_pe_restore_bars(struct eeh_pe *pe)
614{
615 /*
616 * We needn't take the EEH lock since eeh_pe_dev_traverse()
617 * will take that.
618 */
619 eeh_pe_dev_traverse(pe, eeh_restore_one_device_bars, NULL);
620}
621
622/**
623 * eeh_pe_bus_get - Retrieve PCI bus according to the given PE
624 * @pe: EEH PE
625 *
626 * Retrieve the PCI bus according to the given PE. Basically,
627 * there're 3 types of PEs: PHB/Bus/Device. For PHB PE, the
628 * primary PCI bus will be retrieved. The parent bus will be
629 * returned for BUS PE. However, we don't have associated PCI
630 * bus for DEVICE PE.
631 */
632struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
633{
634 struct pci_bus *bus = NULL;
635 struct eeh_dev *edev;
636 struct pci_dev *pdev;
637
638 eeh_lock();
639
640 if (pe->type & EEH_PE_PHB) {
641 bus = pe->phb->bus;
642 } else if (pe->type & EEH_PE_BUS) {
643 edev = list_first_entry(&pe->edevs, struct eeh_dev, list);
644 pdev = eeh_dev_to_pci_dev(edev);
645 if (pdev)
646 bus = pdev->bus;
647 }
648
649 eeh_unlock();
650
651 return bus;
652}
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index c33360ec4f4f..19506f935737 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -129,27 +129,117 @@ static int pseries_eeh_init(void)
129 eeh_error_buf_size = RTAS_ERROR_LOG_MAX; 129 eeh_error_buf_size = RTAS_ERROR_LOG_MAX;
130 } 130 }
131 131
132 /* Set EEH probe mode */
133 eeh_probe_mode_set(EEH_PROBE_MODE_DEVTREE);
134
132 return 0; 135 return 0;
133} 136}
134 137
135/** 138/**
139 * pseries_eeh_of_probe - EEH probe on the given device
140 * @dn: OF node
141 * @flag: Unused
142 *
143 * When EEH module is installed during system boot, all PCI devices
144 * are checked one by one to see if it supports EEH. The function
145 * is introduced for the purpose.
146 */
147static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
148{
149 struct eeh_dev *edev;
150 struct eeh_pe pe;
151 const u32 *class_code, *vendor_id, *device_id;
152 const u32 *regs;
153 int enable = 0;
154 int ret;
155
156 /* Retrieve OF node and eeh device */
157 edev = of_node_to_eeh_dev(dn);
158 if (!of_device_is_available(dn))
159 return NULL;
160
161 /* Retrieve class/vendor/device IDs */
162 class_code = of_get_property(dn, "class-code", NULL);
163 vendor_id = of_get_property(dn, "vendor-id", NULL);
164 device_id = of_get_property(dn, "device-id", NULL);
165
166 /* Skip for bad OF node or PCI-ISA bridge */
167 if (!class_code || !vendor_id || !device_id)
168 return NULL;
169 if (dn->type && !strcmp(dn->type, "isa"))
170 return NULL;
171
172 /* Update class code and mode of eeh device */
173 edev->class_code = *class_code;
174 edev->mode = 0;
175
176 /* Retrieve the device address */
177 regs = of_get_property(dn, "reg", NULL);
178 if (!regs) {
179 pr_warning("%s: OF node property %s::reg not found\n",
180 __func__, dn->full_name);
181 return NULL;
182 }
183
184 /* Initialize the fake PE */
185 memset(&pe, 0, sizeof(struct eeh_pe));
186 pe.phb = edev->phb;
187 pe.config_addr = regs[0];
188
189 /* Enable EEH on the device */
190 ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE);
191 if (!ret) {
192 edev->config_addr = regs[0];
193 /* Retrieve PE address */
194 edev->pe_config_addr = eeh_ops->get_pe_addr(&pe);
195 pe.addr = edev->pe_config_addr;
196
197 /* Some older systems (Power4) allow the ibm,set-eeh-option
198 * call to succeed even on nodes where EEH is not supported.
199 * Verify support explicitly.
200 */
201 ret = eeh_ops->get_state(&pe, NULL);
202 if (ret > 0 && ret != EEH_STATE_NOT_SUPPORT)
203 enable = 1;
204
205 if (enable) {
206 eeh_subsystem_enabled = 1;
207 eeh_add_to_parent_pe(edev);
208
209 pr_debug("%s: EEH enabled on %s PHB#%d-PE#%x, config addr#%x\n",
210 __func__, dn->full_name, pe.phb->global_number,
211 pe.addr, pe.config_addr);
212 } else if (dn->parent && of_node_to_eeh_dev(dn->parent) &&
213 (of_node_to_eeh_dev(dn->parent))->pe) {
214 /* This device doesn't support EEH, but it may have an
215 * EEH parent, in which case we mark it as supported.
216 */
217 edev->config_addr = of_node_to_eeh_dev(dn->parent)->config_addr;
218 edev->pe_config_addr = of_node_to_eeh_dev(dn->parent)->pe_config_addr;
219 eeh_add_to_parent_pe(edev);
220 }
221 }
222
223 /* Save memory bars */
224 eeh_save_bars(edev);
225
226 return NULL;
227}
228
229/**
136 * pseries_eeh_set_option - Initialize EEH or MMIO/DMA reenable 230 * pseries_eeh_set_option - Initialize EEH or MMIO/DMA reenable
137 * @dn: device node 231 * @pe: EEH PE
138 * @option: operation to be issued 232 * @option: operation to be issued
139 * 233 *
140 * The function is used to control the EEH functionality globally. 234 * The function is used to control the EEH functionality globally.
141 * Currently, following options are support according to PAPR: 235 * Currently, following options are support according to PAPR:
142 * Enable EEH, Disable EEH, Enable MMIO and Enable DMA 236 * Enable EEH, Disable EEH, Enable MMIO and Enable DMA
143 */ 237 */
144static int pseries_eeh_set_option(struct device_node *dn, int option) 238static int pseries_eeh_set_option(struct eeh_pe *pe, int option)
145{ 239{
146 int ret = 0; 240 int ret = 0;
147 struct eeh_dev *edev;
148 const u32 *reg;
149 int config_addr; 241 int config_addr;
150 242
151 edev = of_node_to_eeh_dev(dn);
152
153 /* 243 /*
154 * When we're enabling or disabling EEH functioality on 244 * When we're enabling or disabling EEH functioality on
155 * the particular PE, the PE config address is possibly 245 * the particular PE, the PE config address is possibly
@@ -159,15 +249,11 @@ static int pseries_eeh_set_option(struct device_node *dn, int option)
159 switch (option) { 249 switch (option) {
160 case EEH_OPT_DISABLE: 250 case EEH_OPT_DISABLE:
161 case EEH_OPT_ENABLE: 251 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: 252 case EEH_OPT_THAW_MMIO:
167 case EEH_OPT_THAW_DMA: 253 case EEH_OPT_THAW_DMA:
168 config_addr = edev->config_addr; 254 config_addr = pe->config_addr;
169 if (edev->pe_config_addr) 255 if (pe->addr)
170 config_addr = edev->pe_config_addr; 256 config_addr = pe->addr;
171 break; 257 break;
172 258
173 default: 259 default:
@@ -177,15 +263,15 @@ static int pseries_eeh_set_option(struct device_node *dn, int option)
177 } 263 }
178 264
179 ret = rtas_call(ibm_set_eeh_option, 4, 1, NULL, 265 ret = rtas_call(ibm_set_eeh_option, 4, 1, NULL,
180 config_addr, BUID_HI(edev->phb->buid), 266 config_addr, BUID_HI(pe->phb->buid),
181 BUID_LO(edev->phb->buid), option); 267 BUID_LO(pe->phb->buid), option);
182 268
183 return ret; 269 return ret;
184} 270}
185 271
186/** 272/**
187 * pseries_eeh_get_pe_addr - Retrieve PE address 273 * pseries_eeh_get_pe_addr - Retrieve PE address
188 * @dn: device node 274 * @pe: EEH PE
189 * 275 *
190 * Retrieve the assocated PE address. Actually, there're 2 RTAS 276 * Retrieve the assocated PE address. Actually, there're 2 RTAS
191 * function calls dedicated for the purpose. We need implement 277 * function calls dedicated for the purpose. We need implement
@@ -196,14 +282,11 @@ static int pseries_eeh_set_option(struct device_node *dn, int option)
196 * It's notable that zero'ed return value means invalid PE config 282 * It's notable that zero'ed return value means invalid PE config
197 * address. 283 * address.
198 */ 284 */
199static int pseries_eeh_get_pe_addr(struct device_node *dn) 285static int pseries_eeh_get_pe_addr(struct eeh_pe *pe)
200{ 286{
201 struct eeh_dev *edev;
202 int ret = 0; 287 int ret = 0;
203 int rets[3]; 288 int rets[3];
204 289
205 edev = of_node_to_eeh_dev(dn);
206
207 if (ibm_get_config_addr_info2 != RTAS_UNKNOWN_SERVICE) { 290 if (ibm_get_config_addr_info2 != RTAS_UNKNOWN_SERVICE) {
208 /* 291 /*
209 * First of all, we need to make sure there has one PE 292 * First of all, we need to make sure there has one PE
@@ -211,18 +294,18 @@ static int pseries_eeh_get_pe_addr(struct device_node *dn)
211 * meaningless. 294 * meaningless.
212 */ 295 */
213 ret = rtas_call(ibm_get_config_addr_info2, 4, 2, rets, 296 ret = rtas_call(ibm_get_config_addr_info2, 4, 2, rets,
214 edev->config_addr, BUID_HI(edev->phb->buid), 297 pe->config_addr, BUID_HI(pe->phb->buid),
215 BUID_LO(edev->phb->buid), 1); 298 BUID_LO(pe->phb->buid), 1);
216 if (ret || (rets[0] == 0)) 299 if (ret || (rets[0] == 0))
217 return 0; 300 return 0;
218 301
219 /* Retrieve the associated PE config address */ 302 /* Retrieve the associated PE config address */
220 ret = rtas_call(ibm_get_config_addr_info2, 4, 2, rets, 303 ret = rtas_call(ibm_get_config_addr_info2, 4, 2, rets,
221 edev->config_addr, BUID_HI(edev->phb->buid), 304 pe->config_addr, BUID_HI(pe->phb->buid),
222 BUID_LO(edev->phb->buid), 0); 305 BUID_LO(pe->phb->buid), 0);
223 if (ret) { 306 if (ret) {
224 pr_warning("%s: Failed to get PE address for %s\n", 307 pr_warning("%s: Failed to get address for PHB#%d-PE#%x\n",
225 __func__, dn->full_name); 308 __func__, pe->phb->global_number, pe->config_addr);
226 return 0; 309 return 0;
227 } 310 }
228 311
@@ -231,11 +314,11 @@ static int pseries_eeh_get_pe_addr(struct device_node *dn)
231 314
232 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) { 315 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) {
233 ret = rtas_call(ibm_get_config_addr_info, 4, 2, rets, 316 ret = rtas_call(ibm_get_config_addr_info, 4, 2, rets,
234 edev->config_addr, BUID_HI(edev->phb->buid), 317 pe->config_addr, BUID_HI(pe->phb->buid),
235 BUID_LO(edev->phb->buid), 0); 318 BUID_LO(pe->phb->buid), 0);
236 if (ret) { 319 if (ret) {
237 pr_warning("%s: Failed to get PE address for %s\n", 320 pr_warning("%s: Failed to get address for PHB#%d-PE#%x\n",
238 __func__, dn->full_name); 321 __func__, pe->phb->global_number, pe->config_addr);
239 return 0; 322 return 0;
240 } 323 }
241 324
@@ -247,7 +330,7 @@ static int pseries_eeh_get_pe_addr(struct device_node *dn)
247 330
248/** 331/**
249 * pseries_eeh_get_state - Retrieve PE state 332 * pseries_eeh_get_state - Retrieve PE state
250 * @dn: PE associated device node 333 * @pe: EEH PE
251 * @state: return value 334 * @state: return value
252 * 335 *
253 * Retrieve the state of the specified PE. On RTAS compliant 336 * Retrieve the state of the specified PE. On RTAS compliant
@@ -258,30 +341,28 @@ static int pseries_eeh_get_pe_addr(struct device_node *dn)
258 * RTAS calls for the purpose, we need to try the new one and back 341 * 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. 342 * to the old one if the new one couldn't work properly.
260 */ 343 */
261static int pseries_eeh_get_state(struct device_node *dn, int *state) 344static int pseries_eeh_get_state(struct eeh_pe *pe, int *state)
262{ 345{
263 struct eeh_dev *edev;
264 int config_addr; 346 int config_addr;
265 int ret; 347 int ret;
266 int rets[4]; 348 int rets[4];
267 int result; 349 int result;
268 350
269 /* Figure out PE config address if possible */ 351 /* Figure out PE config address if possible */
270 edev = of_node_to_eeh_dev(dn); 352 config_addr = pe->config_addr;
271 config_addr = edev->config_addr; 353 if (pe->addr)
272 if (edev->pe_config_addr) 354 config_addr = pe->addr;
273 config_addr = edev->pe_config_addr;
274 355
275 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) { 356 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) {
276 ret = rtas_call(ibm_read_slot_reset_state2, 3, 4, rets, 357 ret = rtas_call(ibm_read_slot_reset_state2, 3, 4, rets,
277 config_addr, BUID_HI(edev->phb->buid), 358 config_addr, BUID_HI(pe->phb->buid),
278 BUID_LO(edev->phb->buid)); 359 BUID_LO(pe->phb->buid));
279 } else if (ibm_read_slot_reset_state != RTAS_UNKNOWN_SERVICE) { 360 } else if (ibm_read_slot_reset_state != RTAS_UNKNOWN_SERVICE) {
280 /* Fake PE unavailable info */ 361 /* Fake PE unavailable info */
281 rets[2] = 0; 362 rets[2] = 0;
282 ret = rtas_call(ibm_read_slot_reset_state, 3, 3, rets, 363 ret = rtas_call(ibm_read_slot_reset_state, 3, 3, rets,
283 config_addr, BUID_HI(edev->phb->buid), 364 config_addr, BUID_HI(pe->phb->buid),
284 BUID_LO(edev->phb->buid)); 365 BUID_LO(pe->phb->buid));
285 } else { 366 } else {
286 return EEH_STATE_NOT_SUPPORT; 367 return EEH_STATE_NOT_SUPPORT;
287 } 368 }
@@ -333,34 +414,32 @@ static int pseries_eeh_get_state(struct device_node *dn, int *state)
333 414
334/** 415/**
335 * pseries_eeh_reset - Reset the specified PE 416 * pseries_eeh_reset - Reset the specified PE
336 * @dn: PE associated device node 417 * @pe: EEH PE
337 * @option: reset option 418 * @option: reset option
338 * 419 *
339 * Reset the specified PE 420 * Reset the specified PE
340 */ 421 */
341static int pseries_eeh_reset(struct device_node *dn, int option) 422static int pseries_eeh_reset(struct eeh_pe *pe, int option)
342{ 423{
343 struct eeh_dev *edev;
344 int config_addr; 424 int config_addr;
345 int ret; 425 int ret;
346 426
347 /* Figure out PE address */ 427 /* Figure out PE address */
348 edev = of_node_to_eeh_dev(dn); 428 config_addr = pe->config_addr;
349 config_addr = edev->config_addr; 429 if (pe->addr)
350 if (edev->pe_config_addr) 430 config_addr = pe->addr;
351 config_addr = edev->pe_config_addr;
352 431
353 /* Reset PE through RTAS call */ 432 /* Reset PE through RTAS call */
354 ret = rtas_call(ibm_set_slot_reset, 4, 1, NULL, 433 ret = rtas_call(ibm_set_slot_reset, 4, 1, NULL,
355 config_addr, BUID_HI(edev->phb->buid), 434 config_addr, BUID_HI(pe->phb->buid),
356 BUID_LO(edev->phb->buid), option); 435 BUID_LO(pe->phb->buid), option);
357 436
358 /* If fundamental-reset not supported, try hot-reset */ 437 /* If fundamental-reset not supported, try hot-reset */
359 if (option == EEH_RESET_FUNDAMENTAL && 438 if (option == EEH_RESET_FUNDAMENTAL &&
360 ret == -8) { 439 ret == -8) {
361 ret = rtas_call(ibm_set_slot_reset, 4, 1, NULL, 440 ret = rtas_call(ibm_set_slot_reset, 4, 1, NULL,
362 config_addr, BUID_HI(edev->phb->buid), 441 config_addr, BUID_HI(pe->phb->buid),
363 BUID_LO(edev->phb->buid), EEH_RESET_HOT); 442 BUID_LO(pe->phb->buid), EEH_RESET_HOT);
364 } 443 }
365 444
366 return ret; 445 return ret;
@@ -368,13 +447,13 @@ static int pseries_eeh_reset(struct device_node *dn, int option)
368 447
369/** 448/**
370 * pseries_eeh_wait_state - Wait for PE state 449 * pseries_eeh_wait_state - Wait for PE state
371 * @dn: PE associated device node 450 * @pe: EEH PE
372 * @max_wait: maximal period in microsecond 451 * @max_wait: maximal period in microsecond
373 * 452 *
374 * Wait for the state of associated PE. It might take some time 453 * Wait for the state of associated PE. It might take some time
375 * to retrieve the PE's state. 454 * to retrieve the PE's state.
376 */ 455 */
377static int pseries_eeh_wait_state(struct device_node *dn, int max_wait) 456static int pseries_eeh_wait_state(struct eeh_pe *pe, int max_wait)
378{ 457{
379 int ret; 458 int ret;
380 int mwait; 459 int mwait;
@@ -391,7 +470,7 @@ static int pseries_eeh_wait_state(struct device_node *dn, int max_wait)
391#define EEH_STATE_MAX_WAIT_TIME (300 * 1000) 470#define EEH_STATE_MAX_WAIT_TIME (300 * 1000)
392 471
393 while (1) { 472 while (1) {
394 ret = pseries_eeh_get_state(dn, &mwait); 473 ret = pseries_eeh_get_state(pe, &mwait);
395 474
396 /* 475 /*
397 * If the PE's state is temporarily unavailable, 476 * If the PE's state is temporarily unavailable,
@@ -426,7 +505,7 @@ static int pseries_eeh_wait_state(struct device_node *dn, int max_wait)
426 505
427/** 506/**
428 * pseries_eeh_get_log - Retrieve error log 507 * pseries_eeh_get_log - Retrieve error log
429 * @dn: device node 508 * @pe: EEH PE
430 * @severity: temporary or permanent error log 509 * @severity: temporary or permanent error log
431 * @drv_log: driver log to be combined with retrieved error log 510 * @drv_log: driver log to be combined with retrieved error log
432 * @len: length of driver log 511 * @len: length of driver log
@@ -435,24 +514,22 @@ static int pseries_eeh_wait_state(struct device_node *dn, int max_wait)
435 * Actually, the error will be retrieved through the dedicated 514 * Actually, the error will be retrieved through the dedicated
436 * RTAS call. 515 * RTAS call.
437 */ 516 */
438static int pseries_eeh_get_log(struct device_node *dn, int severity, char *drv_log, unsigned long len) 517static int pseries_eeh_get_log(struct eeh_pe *pe, int severity, char *drv_log, unsigned long len)
439{ 518{
440 struct eeh_dev *edev;
441 int config_addr; 519 int config_addr;
442 unsigned long flags; 520 unsigned long flags;
443 int ret; 521 int ret;
444 522
445 edev = of_node_to_eeh_dev(dn);
446 spin_lock_irqsave(&slot_errbuf_lock, flags); 523 spin_lock_irqsave(&slot_errbuf_lock, flags);
447 memset(slot_errbuf, 0, eeh_error_buf_size); 524 memset(slot_errbuf, 0, eeh_error_buf_size);
448 525
449 /* Figure out the PE address */ 526 /* Figure out the PE address */
450 config_addr = edev->config_addr; 527 config_addr = pe->config_addr;
451 if (edev->pe_config_addr) 528 if (pe->addr)
452 config_addr = edev->pe_config_addr; 529 config_addr = pe->addr;
453 530
454 ret = rtas_call(ibm_slot_error_detail, 8, 1, NULL, config_addr, 531 ret = rtas_call(ibm_slot_error_detail, 8, 1, NULL, config_addr,
455 BUID_HI(edev->phb->buid), BUID_LO(edev->phb->buid), 532 BUID_HI(pe->phb->buid), BUID_LO(pe->phb->buid),
456 virt_to_phys(drv_log), len, 533 virt_to_phys(drv_log), len,
457 virt_to_phys(slot_errbuf), eeh_error_buf_size, 534 virt_to_phys(slot_errbuf), eeh_error_buf_size,
458 severity); 535 severity);
@@ -465,40 +542,38 @@ static int pseries_eeh_get_log(struct device_node *dn, int severity, char *drv_l
465 542
466/** 543/**
467 * pseries_eeh_configure_bridge - Configure PCI bridges in the indicated PE 544 * pseries_eeh_configure_bridge - Configure PCI bridges in the indicated PE
468 * @dn: PE associated device node 545 * @pe: EEH PE
469 * 546 *
470 * The function will be called to reconfigure the bridges included 547 * The function will be called to reconfigure the bridges included
471 * in the specified PE so that the mulfunctional PE would be recovered 548 * in the specified PE so that the mulfunctional PE would be recovered
472 * again. 549 * again.
473 */ 550 */
474static int pseries_eeh_configure_bridge(struct device_node *dn) 551static int pseries_eeh_configure_bridge(struct eeh_pe *pe)
475{ 552{
476 struct eeh_dev *edev;
477 int config_addr; 553 int config_addr;
478 int ret; 554 int ret;
479 555
480 /* Figure out the PE address */ 556 /* Figure out the PE address */
481 edev = of_node_to_eeh_dev(dn); 557 config_addr = pe->config_addr;
482 config_addr = edev->config_addr; 558 if (pe->addr)
483 if (edev->pe_config_addr) 559 config_addr = pe->addr;
484 config_addr = edev->pe_config_addr;
485 560
486 /* Use new configure-pe function, if supported */ 561 /* Use new configure-pe function, if supported */
487 if (ibm_configure_pe != RTAS_UNKNOWN_SERVICE) { 562 if (ibm_configure_pe != RTAS_UNKNOWN_SERVICE) {
488 ret = rtas_call(ibm_configure_pe, 3, 1, NULL, 563 ret = rtas_call(ibm_configure_pe, 3, 1, NULL,
489 config_addr, BUID_HI(edev->phb->buid), 564 config_addr, BUID_HI(pe->phb->buid),
490 BUID_LO(edev->phb->buid)); 565 BUID_LO(pe->phb->buid));
491 } else if (ibm_configure_bridge != RTAS_UNKNOWN_SERVICE) { 566 } else if (ibm_configure_bridge != RTAS_UNKNOWN_SERVICE) {
492 ret = rtas_call(ibm_configure_bridge, 3, 1, NULL, 567 ret = rtas_call(ibm_configure_bridge, 3, 1, NULL,
493 config_addr, BUID_HI(edev->phb->buid), 568 config_addr, BUID_HI(pe->phb->buid),
494 BUID_LO(edev->phb->buid)); 569 BUID_LO(pe->phb->buid));
495 } else { 570 } else {
496 return -EFAULT; 571 return -EFAULT;
497 } 572 }
498 573
499 if (ret) 574 if (ret)
500 pr_warning("%s: Unable to configure bridge %d for %s\n", 575 pr_warning("%s: Unable to configure bridge PHB#%d-PE#%x (%d)\n",
501 __func__, ret, dn->full_name); 576 __func__, pe->phb->global_number, pe->addr, ret);
502 577
503 return ret; 578 return ret;
504} 579}
@@ -542,6 +617,8 @@ static int pseries_eeh_write_config(struct device_node *dn, int where, int size,
542static struct eeh_ops pseries_eeh_ops = { 617static struct eeh_ops pseries_eeh_ops = {
543 .name = "pseries", 618 .name = "pseries",
544 .init = pseries_eeh_init, 619 .init = pseries_eeh_init,
620 .of_probe = pseries_eeh_of_probe,
621 .dev_probe = NULL,
545 .set_option = pseries_eeh_set_option, 622 .set_option = pseries_eeh_set_option,
546 .get_pe_addr = pseries_eeh_get_pe_addr, 623 .get_pe_addr = pseries_eeh_get_pe_addr,
547 .get_state = pseries_eeh_get_state, 624 .get_state = pseries_eeh_get_state,
@@ -559,7 +636,21 @@ static struct eeh_ops pseries_eeh_ops = {
559 * EEH initialization on pseries platform. This function should be 636 * EEH initialization on pseries platform. This function should be
560 * called before any EEH related functions. 637 * called before any EEH related functions.
561 */ 638 */
562int __init eeh_pseries_init(void) 639static int __init eeh_pseries_init(void)
563{ 640{
564 return eeh_ops_register(&pseries_eeh_ops); 641 int ret = -EINVAL;
642
643 if (!machine_is(pseries))
644 return ret;
645
646 ret = eeh_ops_register(&pseries_eeh_ops);
647 if (!ret)
648 pr_info("EEH: pSeries platform initialized\n");
649 else
650 pr_info("EEH: pSeries platform initialization failure (%d)\n",
651 ret);
652
653 return ret;
565} 654}
655
656early_initcall(eeh_pseries_init);
diff --git a/arch/powerpc/platforms/pseries/eeh_sysfs.c b/arch/powerpc/platforms/pseries/eeh_sysfs.c
index 243b3510d70f..d37708360f2e 100644
--- a/arch/powerpc/platforms/pseries/eeh_sysfs.c
+++ b/arch/powerpc/platforms/pseries/eeh_sysfs.c
@@ -53,9 +53,6 @@ static DEVICE_ATTR(_name, S_IRUGO, eeh_show_##_name, NULL);
53EEH_SHOW_ATTR(eeh_mode, mode, "0x%x"); 53EEH_SHOW_ATTR(eeh_mode, mode, "0x%x");
54EEH_SHOW_ATTR(eeh_config_addr, config_addr, "0x%x"); 54EEH_SHOW_ATTR(eeh_config_addr, config_addr, "0x%x");
55EEH_SHOW_ATTR(eeh_pe_config_addr, pe_config_addr, "0x%x"); 55EEH_SHOW_ATTR(eeh_pe_config_addr, pe_config_addr, "0x%x");
56EEH_SHOW_ATTR(eeh_check_count, check_count, "%d" );
57EEH_SHOW_ATTR(eeh_freeze_count, freeze_count, "%d" );
58EEH_SHOW_ATTR(eeh_false_positives, false_positives, "%d" );
59 56
60void eeh_sysfs_add_device(struct pci_dev *pdev) 57void eeh_sysfs_add_device(struct pci_dev *pdev)
61{ 58{
@@ -64,9 +61,6 @@ void eeh_sysfs_add_device(struct pci_dev *pdev)
64 rc += device_create_file(&pdev->dev, &dev_attr_eeh_mode); 61 rc += device_create_file(&pdev->dev, &dev_attr_eeh_mode);
65 rc += device_create_file(&pdev->dev, &dev_attr_eeh_config_addr); 62 rc += device_create_file(&pdev->dev, &dev_attr_eeh_config_addr);
66 rc += device_create_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); 63 rc += device_create_file(&pdev->dev, &dev_attr_eeh_pe_config_addr);
67 rc += device_create_file(&pdev->dev, &dev_attr_eeh_check_count);
68 rc += device_create_file(&pdev->dev, &dev_attr_eeh_false_positives);
69 rc += device_create_file(&pdev->dev, &dev_attr_eeh_freeze_count);
70 64
71 if (rc) 65 if (rc)
72 printk(KERN_WARNING "EEH: Unable to create sysfs entries\n"); 66 printk(KERN_WARNING "EEH: Unable to create sysfs entries\n");
@@ -77,8 +71,5 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev)
77 device_remove_file(&pdev->dev, &dev_attr_eeh_mode); 71 device_remove_file(&pdev->dev, &dev_attr_eeh_mode);
78 device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr); 72 device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr);
79 device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); 73 device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr);
80 device_remove_file(&pdev->dev, &dev_attr_eeh_check_count);
81 device_remove_file(&pdev->dev, &dev_attr_eeh_false_positives);
82 device_remove_file(&pdev->dev, &dev_attr_eeh_freeze_count);
83} 74}
84 75
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index bca220f2873c..6153eea27ce7 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -28,6 +28,7 @@
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/memblock.h>
31#include <linux/spinlock.h> 32#include <linux/spinlock.h>
32#include <linux/sched.h> /* for show_stack */ 33#include <linux/sched.h> /* for show_stack */
33#include <linux/string.h> 34#include <linux/string.h>
@@ -41,7 +42,6 @@
41#include <asm/iommu.h> 42#include <asm/iommu.h>
42#include <asm/pci-bridge.h> 43#include <asm/pci-bridge.h>
43#include <asm/machdep.h> 44#include <asm/machdep.h>
44#include <asm/abs_addr.h>
45#include <asm/pSeries_reconfig.h> 45#include <asm/pSeries_reconfig.h>
46#include <asm/firmware.h> 46#include <asm/firmware.h>
47#include <asm/tce.h> 47#include <asm/tce.h>
@@ -99,7 +99,7 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index,
99 99
100 while (npages--) { 100 while (npages--) {
101 /* can't move this out since we might cross MEMBLOCK boundary */ 101 /* can't move this out since we might cross MEMBLOCK boundary */
102 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 102 rpn = __pa(uaddr) >> TCE_SHIFT;
103 *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT; 103 *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
104 104
105 uaddr += TCE_PAGE_SIZE; 105 uaddr += TCE_PAGE_SIZE;
@@ -148,7 +148,7 @@ static int tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
148 int ret = 0; 148 int ret = 0;
149 long tcenum_start = tcenum, npages_start = npages; 149 long tcenum_start = tcenum, npages_start = npages;
150 150
151 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 151 rpn = __pa(uaddr) >> TCE_SHIFT;
152 proto_tce = TCE_PCI_READ; 152 proto_tce = TCE_PCI_READ;
153 if (direction != DMA_TO_DEVICE) 153 if (direction != DMA_TO_DEVICE)
154 proto_tce |= TCE_PCI_WRITE; 154 proto_tce |= TCE_PCI_WRITE;
@@ -217,7 +217,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
217 __get_cpu_var(tce_page) = tcep; 217 __get_cpu_var(tce_page) = tcep;
218 } 218 }
219 219
220 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 220 rpn = __pa(uaddr) >> TCE_SHIFT;
221 proto_tce = TCE_PCI_READ; 221 proto_tce = TCE_PCI_READ;
222 if (direction != DMA_TO_DEVICE) 222 if (direction != DMA_TO_DEVICE)
223 proto_tce |= TCE_PCI_WRITE; 223 proto_tce |= TCE_PCI_WRITE;
@@ -237,7 +237,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
237 237
238 rc = plpar_tce_put_indirect((u64)tbl->it_index, 238 rc = plpar_tce_put_indirect((u64)tbl->it_index,
239 (u64)tcenum << 12, 239 (u64)tcenum << 12,
240 (u64)virt_to_abs(tcep), 240 (u64)__pa(tcep),
241 limit); 241 limit);
242 242
243 npages -= limit; 243 npages -= limit;
@@ -441,7 +441,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn,
441 441
442 rc = plpar_tce_put_indirect(liobn, 442 rc = plpar_tce_put_indirect(liobn,
443 dma_offset, 443 dma_offset,
444 (u64)virt_to_abs(tcep), 444 (u64)__pa(tcep),
445 limit); 445 limit);
446 446
447 num_tce -= limit; 447 num_tce -= limit;
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 5f3ef876ded2..0da39fed355a 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -31,7 +31,6 @@
31#include <asm/page.h> 31#include <asm/page.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/machdep.h> 33#include <asm/machdep.h>
34#include <asm/abs_addr.h>
35#include <asm/mmu_context.h> 34#include <asm/mmu_context.h>
36#include <asm/iommu.h> 35#include <asm/iommu.h>
37#include <asm/tlbflush.h> 36#include <asm/tlbflush.h>
@@ -108,9 +107,9 @@ void vpa_init(int cpu)
108} 107}
109 108
110static long pSeries_lpar_hpte_insert(unsigned long hpte_group, 109static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
111 unsigned long va, unsigned long pa, 110 unsigned long vpn, unsigned long pa,
112 unsigned long rflags, unsigned long vflags, 111 unsigned long rflags, unsigned long vflags,
113 int psize, int ssize) 112 int psize, int ssize)
114{ 113{
115 unsigned long lpar_rc; 114 unsigned long lpar_rc;
116 unsigned long flags; 115 unsigned long flags;
@@ -118,11 +117,11 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
118 unsigned long hpte_v, hpte_r; 117 unsigned long hpte_v, hpte_r;
119 118
120 if (!(vflags & HPTE_V_BOLTED)) 119 if (!(vflags & HPTE_V_BOLTED))
121 pr_devel("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " 120 pr_devel("hpte_insert(group=%lx, vpn=%016lx, "
122 "rflags=%lx, vflags=%lx, psize=%d)\n", 121 "pa=%016lx, rflags=%lx, vflags=%lx, psize=%d)\n",
123 hpte_group, va, pa, rflags, vflags, psize); 122 hpte_group, vpn, pa, rflags, vflags, psize);
124 123
125 hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID; 124 hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID;
126 hpte_r = hpte_encode_r(pa, psize) | rflags; 125 hpte_r = hpte_encode_r(pa, psize) | rflags;
127 126
128 if (!(vflags & HPTE_V_BOLTED)) 127 if (!(vflags & HPTE_V_BOLTED))
@@ -227,22 +226,6 @@ static void pSeries_lpar_hptab_clear(void)
227} 226}
228 227
229/* 228/*
230 * This computes the AVPN and B fields of the first dword of a HPTE,
231 * for use when we want to match an existing PTE. The bottom 7 bits
232 * of the returned value are zero.
233 */
234static inline unsigned long hpte_encode_avpn(unsigned long va, int psize,
235 int ssize)
236{
237 unsigned long v;
238
239 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm);
240 v <<= HPTE_V_AVPN_SHIFT;
241 v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT;
242 return v;
243}
244
245/*
246 * NOTE: for updatepp ops we are fortunate that the linux "newpp" bits and 229 * NOTE: for updatepp ops we are fortunate that the linux "newpp" bits and
247 * the low 3 bits of flags happen to line up. So no transform is needed. 230 * the low 3 bits of flags happen to line up. So no transform is needed.
248 * We can probably optimize here and assume the high bits of newpp are 231 * We can probably optimize here and assume the high bits of newpp are
@@ -250,14 +233,14 @@ static inline unsigned long hpte_encode_avpn(unsigned long va, int psize,
250 */ 233 */
251static long pSeries_lpar_hpte_updatepp(unsigned long slot, 234static long pSeries_lpar_hpte_updatepp(unsigned long slot,
252 unsigned long newpp, 235 unsigned long newpp,
253 unsigned long va, 236 unsigned long vpn,
254 int psize, int ssize, int local) 237 int psize, int ssize, int local)
255{ 238{
256 unsigned long lpar_rc; 239 unsigned long lpar_rc;
257 unsigned long flags = (newpp & 7) | H_AVPN; 240 unsigned long flags = (newpp & 7) | H_AVPN;
258 unsigned long want_v; 241 unsigned long want_v;
259 242
260 want_v = hpte_encode_avpn(va, psize, ssize); 243 want_v = hpte_encode_avpn(vpn, psize, ssize);
261 244
262 pr_devel(" update: avpnv=%016lx, hash=%016lx, f=%lx, psize: %d ...", 245 pr_devel(" update: avpnv=%016lx, hash=%016lx, f=%lx, psize: %d ...",
263 want_v, slot, flags, psize); 246 want_v, slot, flags, psize);
@@ -295,15 +278,15 @@ static unsigned long pSeries_lpar_hpte_getword0(unsigned long slot)
295 return dword0; 278 return dword0;
296} 279}
297 280
298static long pSeries_lpar_hpte_find(unsigned long va, int psize, int ssize) 281static long pSeries_lpar_hpte_find(unsigned long vpn, int psize, int ssize)
299{ 282{
300 unsigned long hash; 283 unsigned long hash;
301 unsigned long i; 284 unsigned long i;
302 long slot; 285 long slot;
303 unsigned long want_v, hpte_v; 286 unsigned long want_v, hpte_v;
304 287
305 hash = hpt_hash(va, mmu_psize_defs[psize].shift, ssize); 288 hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, ssize);
306 want_v = hpte_encode_avpn(va, psize, ssize); 289 want_v = hpte_encode_avpn(vpn, psize, ssize);
307 290
308 /* Bolted entries are always in the primary group */ 291 /* Bolted entries are always in the primary group */
309 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 292 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
@@ -323,12 +306,13 @@ static void pSeries_lpar_hpte_updateboltedpp(unsigned long newpp,
323 unsigned long ea, 306 unsigned long ea,
324 int psize, int ssize) 307 int psize, int ssize)
325{ 308{
326 unsigned long lpar_rc, slot, vsid, va, flags; 309 unsigned long vpn;
310 unsigned long lpar_rc, slot, vsid, flags;
327 311
328 vsid = get_kernel_vsid(ea, ssize); 312 vsid = get_kernel_vsid(ea, ssize);
329 va = hpt_va(ea, vsid, ssize); 313 vpn = hpt_vpn(ea, vsid, ssize);
330 314
331 slot = pSeries_lpar_hpte_find(va, psize, ssize); 315 slot = pSeries_lpar_hpte_find(vpn, psize, ssize);
332 BUG_ON(slot == -1); 316 BUG_ON(slot == -1);
333 317
334 flags = newpp & 7; 318 flags = newpp & 7;
@@ -337,17 +321,17 @@ static void pSeries_lpar_hpte_updateboltedpp(unsigned long newpp,
337 BUG_ON(lpar_rc != H_SUCCESS); 321 BUG_ON(lpar_rc != H_SUCCESS);
338} 322}
339 323
340static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va, 324static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn,
341 int psize, int ssize, int local) 325 int psize, int ssize, int local)
342{ 326{
343 unsigned long want_v; 327 unsigned long want_v;
344 unsigned long lpar_rc; 328 unsigned long lpar_rc;
345 unsigned long dummy1, dummy2; 329 unsigned long dummy1, dummy2;
346 330
347 pr_devel(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", 331 pr_devel(" inval : slot=%lx, vpn=%016lx, psize: %d, local: %d\n",
348 slot, va, psize, local); 332 slot, vpn, psize, local);
349 333
350 want_v = hpte_encode_avpn(va, psize, ssize); 334 want_v = hpte_encode_avpn(vpn, psize, ssize);
351 lpar_rc = plpar_pte_remove(H_AVPN, slot, want_v, &dummy1, &dummy2); 335 lpar_rc = plpar_pte_remove(H_AVPN, slot, want_v, &dummy1, &dummy2);
352 if (lpar_rc == H_NOT_FOUND) 336 if (lpar_rc == H_NOT_FOUND)
353 return; 337 return;
@@ -358,15 +342,16 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va,
358static void pSeries_lpar_hpte_removebolted(unsigned long ea, 342static void pSeries_lpar_hpte_removebolted(unsigned long ea,
359 int psize, int ssize) 343 int psize, int ssize)
360{ 344{
361 unsigned long slot, vsid, va; 345 unsigned long vpn;
346 unsigned long slot, vsid;
362 347
363 vsid = get_kernel_vsid(ea, ssize); 348 vsid = get_kernel_vsid(ea, ssize);
364 va = hpt_va(ea, vsid, ssize); 349 vpn = hpt_vpn(ea, vsid, ssize);
365 350
366 slot = pSeries_lpar_hpte_find(va, psize, ssize); 351 slot = pSeries_lpar_hpte_find(vpn, psize, ssize);
367 BUG_ON(slot == -1); 352 BUG_ON(slot == -1);
368 353
369 pSeries_lpar_hpte_invalidate(slot, va, psize, ssize, 0); 354 pSeries_lpar_hpte_invalidate(slot, vpn, psize, ssize, 0);
370} 355}
371 356
372/* Flag bits for H_BULK_REMOVE */ 357/* Flag bits for H_BULK_REMOVE */
@@ -382,12 +367,12 @@ static void pSeries_lpar_hpte_removebolted(unsigned long ea,
382 */ 367 */
383static void pSeries_lpar_flush_hash_range(unsigned long number, int local) 368static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
384{ 369{
370 unsigned long vpn;
385 unsigned long i, pix, rc; 371 unsigned long i, pix, rc;
386 unsigned long flags = 0; 372 unsigned long flags = 0;
387 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 373 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
388 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); 374 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
389 unsigned long param[9]; 375 unsigned long param[9];
390 unsigned long va;
391 unsigned long hash, index, shift, hidx, slot; 376 unsigned long hash, index, shift, hidx, slot;
392 real_pte_t pte; 377 real_pte_t pte;
393 int psize, ssize; 378 int psize, ssize;
@@ -399,21 +384,21 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
399 ssize = batch->ssize; 384 ssize = batch->ssize;
400 pix = 0; 385 pix = 0;
401 for (i = 0; i < number; i++) { 386 for (i = 0; i < number; i++) {
402 va = batch->vaddr[i]; 387 vpn = batch->vpn[i];
403 pte = batch->pte[i]; 388 pte = batch->pte[i];
404 pte_iterate_hashed_subpages(pte, psize, va, index, shift) { 389 pte_iterate_hashed_subpages(pte, psize, vpn, index, shift) {
405 hash = hpt_hash(va, shift, ssize); 390 hash = hpt_hash(vpn, shift, ssize);
406 hidx = __rpte_to_hidx(pte, index); 391 hidx = __rpte_to_hidx(pte, index);
407 if (hidx & _PTEIDX_SECONDARY) 392 if (hidx & _PTEIDX_SECONDARY)
408 hash = ~hash; 393 hash = ~hash;
409 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 394 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
410 slot += hidx & _PTEIDX_GROUP_IX; 395 slot += hidx & _PTEIDX_GROUP_IX;
411 if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) { 396 if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) {
412 pSeries_lpar_hpte_invalidate(slot, va, psize, 397 pSeries_lpar_hpte_invalidate(slot, vpn, psize,
413 ssize, local); 398 ssize, local);
414 } else { 399 } else {
415 param[pix] = HBR_REQUEST | HBR_AVPN | slot; 400 param[pix] = HBR_REQUEST | HBR_AVPN | slot;
416 param[pix+1] = hpte_encode_avpn(va, psize, 401 param[pix+1] = hpte_encode_avpn(vpn, psize,
417 ssize); 402 ssize);
418 pix += 2; 403 pix += 2;
419 if (pix == 8) { 404 if (pix == 8) {
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 109fdb75578d..d19f4977c834 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -210,6 +210,7 @@ static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total)
210static struct device_node *find_pe_dn(struct pci_dev *dev, int *total) 210static struct device_node *find_pe_dn(struct pci_dev *dev, int *total)
211{ 211{
212 struct device_node *dn; 212 struct device_node *dn;
213 struct eeh_dev *edev;
213 214
214 /* Found our PE and assume 8 at that point. */ 215 /* Found our PE and assume 8 at that point. */
215 216
@@ -217,7 +218,10 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total)
217 if (!dn) 218 if (!dn)
218 return NULL; 219 return NULL;
219 220
220 dn = eeh_find_device_pe(dn); 221 /* Get the top level device in the PE */
222 edev = of_node_to_eeh_dev(dn);
223 edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list);
224 dn = eeh_dev_to_of_node(edev);
221 if (!dn) 225 if (!dn)
222 return NULL; 226 return NULL;
223 227
@@ -387,12 +391,13 @@ static int check_msix_entries(struct pci_dev *pdev)
387 return 0; 391 return 0;
388} 392}
389 393
390static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) 394static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
391{ 395{
392 struct pci_dn *pdn; 396 struct pci_dn *pdn;
393 int hwirq, virq, i, rc; 397 int hwirq, virq, i, rc;
394 struct msi_desc *entry; 398 struct msi_desc *entry;
395 struct msi_msg msg; 399 struct msi_msg msg;
400 int nvec = nvec_in;
396 401
397 pdn = get_pdn(pdev); 402 pdn = get_pdn(pdev);
398 if (!pdn) 403 if (!pdn)
@@ -402,10 +407,23 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
402 return -EINVAL; 407 return -EINVAL;
403 408
404 /* 409 /*
410 * Firmware currently refuse any non power of two allocation
411 * so we round up if the quota will allow it.
412 */
413 if (type == PCI_CAP_ID_MSIX) {
414 int m = roundup_pow_of_two(nvec);
415 int quota = msi_quota_for_device(pdev, m);
416
417 if (quota >= m)
418 nvec = m;
419 }
420
421 /*
405 * Try the new more explicit firmware interface, if that fails fall 422 * Try the new more explicit firmware interface, if that fails fall
406 * back to the old interface. The old interface is known to never 423 * back to the old interface. The old interface is known to never
407 * return MSI-Xs. 424 * return MSI-Xs.
408 */ 425 */
426again:
409 if (type == PCI_CAP_ID_MSI) { 427 if (type == PCI_CAP_ID_MSI) {
410 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec); 428 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec);
411 429
@@ -417,6 +435,10 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
417 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec); 435 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec);
418 436
419 if (rc != nvec) { 437 if (rc != nvec) {
438 if (nvec != nvec_in) {
439 nvec = nvec_in;
440 goto again;
441 }
420 pr_debug("rtas_msi: rtas_change_msi() failed\n"); 442 pr_debug("rtas_msi: rtas_change_msi() failed\n");
421 return rc; 443 return rc;
422 } 444 }
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 2c6ded29f73d..56b864d777ee 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -73,7 +73,7 @@ void __init pSeries_final_fixup(void)
73{ 73{
74 pSeries_request_regions(); 74 pSeries_request_regions();
75 75
76 pci_addr_cache_build(); 76 eeh_addr_cache_build();
77} 77}
78 78
79/* 79/*
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 3ccebc83dc02..261a577a3dd2 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -65,27 +65,43 @@ pcibios_find_pci_bus(struct device_node *dn)
65EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); 65EXPORT_SYMBOL_GPL(pcibios_find_pci_bus);
66 66
67/** 67/**
68 * pcibios_remove_pci_devices - remove all devices under this bus 68 * __pcibios_remove_pci_devices - remove all devices under this bus
69 * @bus: the indicated PCI bus
70 * @purge_pe: destroy the PE on removal of PCI devices
69 * 71 *
70 * Remove all of the PCI devices under this bus both from the 72 * Remove all of the PCI devices under this bus both from the
71 * linux pci device tree, and from the powerpc EEH address cache. 73 * linux pci device tree, and from the powerpc EEH address cache.
74 * By default, the corresponding PE will be destroied during the
75 * normal PCI hotplug path. For PCI hotplug during EEH recovery,
76 * the corresponding PE won't be destroied and deallocated.
72 */ 77 */
73void pcibios_remove_pci_devices(struct pci_bus *bus) 78void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe)
74{ 79{
75 struct pci_dev *dev, *tmp; 80 struct pci_dev *dev, *tmp;
76 struct pci_bus *child_bus; 81 struct pci_bus *child_bus;
77 82
78 /* First go down child busses */ 83 /* First go down child busses */
79 list_for_each_entry(child_bus, &bus->children, node) 84 list_for_each_entry(child_bus, &bus->children, node)
80 pcibios_remove_pci_devices(child_bus); 85 __pcibios_remove_pci_devices(child_bus, purge_pe);
81 86
82 pr_debug("PCI: Removing devices on bus %04x:%02x\n", 87 pr_debug("PCI: Removing devices on bus %04x:%02x\n",
83 pci_domain_nr(bus), bus->number); 88 pci_domain_nr(bus), bus->number);
84 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { 89 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
85 pr_debug(" * Removing %s...\n", pci_name(dev)); 90 pr_debug(" * Removing %s...\n", pci_name(dev));
86 eeh_remove_bus_device(dev); 91 eeh_remove_bus_device(dev, purge_pe);
87 pci_stop_and_remove_bus_device(dev); 92 pci_stop_and_remove_bus_device(dev);
88 } 93 }
94}
95
96/**
97 * pcibios_remove_pci_devices - remove all devices under this bus
98 *
99 * Remove all of the PCI devices under this bus both from the
100 * linux pci device tree, and from the powerpc EEH address cache.
101 */
102void pcibios_remove_pci_devices(struct pci_bus *bus)
103{
104 __pcibios_remove_pci_devices(bus, 1);
89} 105}
90EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices); 106EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices);
91 107
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 51ecac920dd8..e3cb7ae61658 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -388,10 +388,8 @@ static void __init pSeries_setup_arch(void)
388 388
389 /* Find and initialize PCI host bridges */ 389 /* Find and initialize PCI host bridges */
390 init_pci_config_tokens(); 390 init_pci_config_tokens();
391 eeh_pseries_init();
392 find_and_init_phbs(); 391 find_and_init_phbs();
393 pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb); 392 pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
394 eeh_init();
395 393
396 pSeries_nvram_init(); 394 pSeries_nvram_init();
397 395
@@ -416,16 +414,20 @@ static int __init pSeries_init_panel(void)
416} 414}
417machine_arch_initcall(pseries, pSeries_init_panel); 415machine_arch_initcall(pseries, pSeries_init_panel);
418 416
419static int pseries_set_dabr(unsigned long dabr) 417static int pseries_set_dabr(unsigned long dabr, unsigned long dabrx)
420{ 418{
421 return plpar_hcall_norets(H_SET_DABR, dabr); 419 return plpar_hcall_norets(H_SET_DABR, dabr);
422} 420}
423 421
424static int pseries_set_xdabr(unsigned long dabr) 422static int pseries_set_xdabr(unsigned long dabr, unsigned long dabrx)
425{ 423{
426 /* We want to catch accesses from kernel and userspace */ 424 /* Have to set at least one bit in the DABRX according to PAPR */
427 return plpar_hcall_norets(H_SET_XDABR, dabr, 425 if (dabrx == 0 && dabr == 0)
428 H_DABRX_KERNEL | H_DABRX_USER); 426 dabrx = DABRX_USER;
427 /* PAPR says we can only set kernel and user bits */
428 dabrx &= DABRX_KERNEL | DABRX_USER;
429
430 return plpar_hcall_norets(H_SET_XDABR, dabr, dabrx);
429} 431}
430 432
431#define CMO_CHARACTERISTICS_TOKEN 44 433#define CMO_CHARACTERISTICS_TOKEN 44
@@ -529,10 +531,10 @@ static void __init pSeries_init_early(void)
529 if (firmware_has_feature(FW_FEATURE_LPAR)) 531 if (firmware_has_feature(FW_FEATURE_LPAR))
530 hvc_vio_init_early(); 532 hvc_vio_init_early();
531#endif 533#endif
532 if (firmware_has_feature(FW_FEATURE_DABR)) 534 if (firmware_has_feature(FW_FEATURE_XDABR))
533 ppc_md.set_dabr = pseries_set_dabr;
534 else if (firmware_has_feature(FW_FEATURE_XDABR))
535 ppc_md.set_dabr = pseries_set_xdabr; 535 ppc_md.set_dabr = pseries_set_xdabr;
536 else if (firmware_has_feature(FW_FEATURE_DABR))
537 ppc_md.set_dabr = pseries_set_dabr;
536 538
537 pSeries_cmo_feature_init(); 539 pSeries_cmo_feature_init();
538 iommu_init_early_pSeries(); 540 iommu_init_early_pSeries();
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 1bd7ecb24620..a57600b3a4e3 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -15,7 +15,7 @@ obj-$(CONFIG_PPC_DCR_NATIVE) += dcr-low.o
15obj-$(CONFIG_PPC_PMI) += pmi.o 15obj-$(CONFIG_PPC_PMI) += pmi.o
16obj-$(CONFIG_U3_DART) += dart_iommu.o 16obj-$(CONFIG_U3_DART) += dart_iommu.o
17obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o 17obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o
18obj-$(CONFIG_FSL_SOC) += fsl_soc.o 18obj-$(CONFIG_FSL_SOC) += fsl_soc.o fsl_mpic_err.o
19obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y) 19obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y)
20obj-$(CONFIG_FSL_PMC) += fsl_pmc.o 20obj-$(CONFIG_FSL_PMC) += fsl_pmc.o
21obj-$(CONFIG_FSL_LBC) += fsl_lbc.o 21obj-$(CONFIG_FSL_LBC) += fsl_lbc.o
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 4f2680f431b5..bd968a43a48b 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -43,7 +43,6 @@
43#include <asm/iommu.h> 43#include <asm/iommu.h>
44#include <asm/pci-bridge.h> 44#include <asm/pci-bridge.h>
45#include <asm/machdep.h> 45#include <asm/machdep.h>
46#include <asm/abs_addr.h>
47#include <asm/cacheflush.h> 46#include <asm/cacheflush.h>
48#include <asm/ppc-pci.h> 47#include <asm/ppc-pci.h>
49 48
@@ -74,11 +73,16 @@ static int dart_is_u4;
74 73
75#define DBG(...) 74#define DBG(...)
76 75
76static DEFINE_SPINLOCK(invalidate_lock);
77
77static inline void dart_tlb_invalidate_all(void) 78static inline void dart_tlb_invalidate_all(void)
78{ 79{
79 unsigned long l = 0; 80 unsigned long l = 0;
80 unsigned int reg, inv_bit; 81 unsigned int reg, inv_bit;
81 unsigned long limit; 82 unsigned long limit;
83 unsigned long flags;
84
85 spin_lock_irqsave(&invalidate_lock, flags);
82 86
83 DBG("dart: flush\n"); 87 DBG("dart: flush\n");
84 88
@@ -111,12 +115,17 @@ retry:
111 panic("DART: TLB did not flush after waiting a long " 115 panic("DART: TLB did not flush after waiting a long "
112 "time. Buggy U3 ?"); 116 "time. Buggy U3 ?");
113 } 117 }
118
119 spin_unlock_irqrestore(&invalidate_lock, flags);
114} 120}
115 121
116static inline void dart_tlb_invalidate_one(unsigned long bus_rpn) 122static inline void dart_tlb_invalidate_one(unsigned long bus_rpn)
117{ 123{
118 unsigned int reg; 124 unsigned int reg;
119 unsigned int l, limit; 125 unsigned int l, limit;
126 unsigned long flags;
127
128 spin_lock_irqsave(&invalidate_lock, flags);
120 129
121 reg = DART_CNTL_U4_ENABLE | DART_CNTL_U4_IONE | 130 reg = DART_CNTL_U4_ENABLE | DART_CNTL_U4_IONE |
122 (bus_rpn & DART_CNTL_U4_IONE_MASK); 131 (bus_rpn & DART_CNTL_U4_IONE_MASK);
@@ -138,6 +147,8 @@ wait_more:
138 panic("DART: TLB did not flush after waiting a long " 147 panic("DART: TLB did not flush after waiting a long "
139 "time. Buggy U4 ?"); 148 "time. Buggy U4 ?");
140 } 149 }
150
151 spin_unlock_irqrestore(&invalidate_lock, flags);
141} 152}
142 153
143static void dart_flush(struct iommu_table *tbl) 154static void dart_flush(struct iommu_table *tbl)
@@ -167,7 +178,7 @@ static int dart_build(struct iommu_table *tbl, long index,
167 */ 178 */
168 l = npages; 179 l = npages;
169 while (l--) { 180 while (l--) {
170 rpn = virt_to_abs(uaddr) >> DART_PAGE_SHIFT; 181 rpn = __pa(uaddr) >> DART_PAGE_SHIFT;
171 182
172 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK); 183 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK);
173 184
@@ -244,7 +255,7 @@ static int __init dart_init(struct device_node *dart_node)
244 panic("DART: Cannot map registers!"); 255 panic("DART: Cannot map registers!");
245 256
246 /* Map in DART table */ 257 /* Map in DART table */
247 dart_vbase = ioremap(virt_to_abs(dart_tablebase), dart_tablesize); 258 dart_vbase = ioremap(__pa(dart_tablebase), dart_tablesize);
248 259
249 /* Fill initial table */ 260 /* Fill initial table */
250 for (i = 0; i < dart_tablesize/4; i++) 261 for (i = 0; i < dart_tablesize/4; i++)
@@ -463,7 +474,7 @@ void __init alloc_dart_table(void)
463 * will blow up an entire large page anyway in the kernel mapping 474 * will blow up an entire large page anyway in the kernel mapping
464 */ 475 */
465 dart_tablebase = (unsigned long) 476 dart_tablebase = (unsigned long)
466 abs_to_virt(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); 477 __va(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L));
467 478
468 printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); 479 printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase);
469} 480}
diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
index 68ac3aacb191..d131c8a1cb15 100644
--- a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
+++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
@@ -193,6 +193,16 @@ static struct of_device_id mpc85xx_l2ctlr_of_match[] = {
193 { 193 {
194 .compatible = "fsl,mpc8548-l2-cache-controller", 194 .compatible = "fsl,mpc8548-l2-cache-controller",
195 }, 195 },
196 { .compatible = "fsl,mpc8544-l2-cache-controller",},
197 { .compatible = "fsl,mpc8572-l2-cache-controller",},
198 { .compatible = "fsl,mpc8536-l2-cache-controller",},
199 { .compatible = "fsl,p1021-l2-cache-controller",},
200 { .compatible = "fsl,p1012-l2-cache-controller",},
201 { .compatible = "fsl,p1025-l2-cache-controller",},
202 { .compatible = "fsl,p1016-l2-cache-controller",},
203 { .compatible = "fsl,p1024-l2-cache-controller",},
204 { .compatible = "fsl,p1015-l2-cache-controller",},
205 { .compatible = "fsl,p1010-l2-cache-controller",},
196 {}, 206 {},
197}; 207};
198 208
diff --git a/arch/powerpc/sysdev/fsl_ifc.c b/arch/powerpc/sysdev/fsl_ifc.c
index b31f19f61031..097cc9d2585b 100644
--- a/arch/powerpc/sysdev/fsl_ifc.c
+++ b/arch/powerpc/sysdev/fsl_ifc.c
@@ -244,12 +244,6 @@ static int __devinit fsl_ifc_ctrl_probe(struct platform_device *dev)
244 /* get the nand machine irq */ 244 /* get the nand machine irq */
245 fsl_ifc_ctrl_dev->nand_irq = 245 fsl_ifc_ctrl_dev->nand_irq =
246 irq_of_parse_and_map(dev->dev.of_node, 1); 246 irq_of_parse_and_map(dev->dev.of_node, 1);
247 if (fsl_ifc_ctrl_dev->nand_irq == NO_IRQ) {
248 dev_err(&dev->dev, "failed to get irq resource "
249 "for NAND Machine\n");
250 ret = -ENODEV;
251 goto err;
252 }
253 247
254 fsl_ifc_ctrl_dev->dev = &dev->dev; 248 fsl_ifc_ctrl_dev->dev = &dev->dev;
255 249
@@ -267,12 +261,14 @@ static int __devinit fsl_ifc_ctrl_probe(struct platform_device *dev)
267 goto err_irq; 261 goto err_irq;
268 } 262 }
269 263
270 ret = request_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_nand_irq, 0, 264 if (fsl_ifc_ctrl_dev->nand_irq) {
271 "fsl-ifc-nand", fsl_ifc_ctrl_dev); 265 ret = request_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_nand_irq,
272 if (ret != 0) { 266 0, "fsl-ifc-nand", fsl_ifc_ctrl_dev);
273 dev_err(&dev->dev, "failed to install irq (%d)\n", 267 if (ret != 0) {
274 fsl_ifc_ctrl_dev->nand_irq); 268 dev_err(&dev->dev, "failed to install irq (%d)\n",
275 goto err_nandirq; 269 fsl_ifc_ctrl_dev->nand_irq);
270 goto err_nandirq;
271 }
276 } 272 }
277 273
278 return 0; 274 return 0;
diff --git a/arch/powerpc/sysdev/fsl_mpic_err.c b/arch/powerpc/sysdev/fsl_mpic_err.c
new file mode 100644
index 000000000000..b83f32562a37
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_mpic_err.c
@@ -0,0 +1,149 @@
1/*
2 * Copyright (C) 2012 Freescale Semiconductor, Inc.
3 *
4 * Author: Varun Sethi <varun.sethi@freescale.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; version 2 of the
9 * License.
10 *
11 */
12
13#include <linux/irq.h>
14#include <linux/smp.h>
15#include <linux/interrupt.h>
16
17#include <asm/io.h>
18#include <asm/irq.h>
19#include <asm/mpic.h>
20
21#include "mpic.h"
22
23#define MPIC_ERR_INT_BASE 0x3900
24#define MPIC_ERR_INT_EISR 0x0000
25#define MPIC_ERR_INT_EIMR 0x0010
26
27static inline u32 mpic_fsl_err_read(u32 __iomem *base, unsigned int err_reg)
28{
29 return in_be32(base + (err_reg >> 2));
30}
31
32static inline void mpic_fsl_err_write(u32 __iomem *base, u32 value)
33{
34 out_be32(base + (MPIC_ERR_INT_EIMR >> 2), value);
35}
36
37static void fsl_mpic_mask_err(struct irq_data *d)
38{
39 u32 eimr;
40 struct mpic *mpic = irq_data_get_irq_chip_data(d);
41 unsigned int src = virq_to_hw(d->irq) - mpic->err_int_vecs[0];
42
43 eimr = mpic_fsl_err_read(mpic->err_regs, MPIC_ERR_INT_EIMR);
44 eimr |= (1 << (31 - src));
45 mpic_fsl_err_write(mpic->err_regs, eimr);
46}
47
48static void fsl_mpic_unmask_err(struct irq_data *d)
49{
50 u32 eimr;
51 struct mpic *mpic = irq_data_get_irq_chip_data(d);
52 unsigned int src = virq_to_hw(d->irq) - mpic->err_int_vecs[0];
53
54 eimr = mpic_fsl_err_read(mpic->err_regs, MPIC_ERR_INT_EIMR);
55 eimr &= ~(1 << (31 - src));
56 mpic_fsl_err_write(mpic->err_regs, eimr);
57}
58
59static struct irq_chip fsl_mpic_err_chip = {
60 .irq_disable = fsl_mpic_mask_err,
61 .irq_mask = fsl_mpic_mask_err,
62 .irq_unmask = fsl_mpic_unmask_err,
63};
64
65int mpic_setup_error_int(struct mpic *mpic, int intvec)
66{
67 int i;
68
69 mpic->err_regs = ioremap(mpic->paddr + MPIC_ERR_INT_BASE, 0x1000);
70 if (!mpic->err_regs) {
71 pr_err("could not map mpic error registers\n");
72 return -ENOMEM;
73 }
74 mpic->hc_err = fsl_mpic_err_chip;
75 mpic->hc_err.name = mpic->name;
76 mpic->flags |= MPIC_FSL_HAS_EIMR;
77 /* allocate interrupt vectors for error interrupts */
78 for (i = MPIC_MAX_ERR - 1; i >= 0; i--)
79 mpic->err_int_vecs[i] = --intvec;
80
81 return 0;
82}
83
84int mpic_map_error_int(struct mpic *mpic, unsigned int virq, irq_hw_number_t hw)
85{
86 if ((mpic->flags & MPIC_FSL_HAS_EIMR) &&
87 (hw >= mpic->err_int_vecs[0] &&
88 hw <= mpic->err_int_vecs[MPIC_MAX_ERR - 1])) {
89 WARN_ON(mpic->flags & MPIC_SECONDARY);
90
91 pr_debug("mpic: mapping as Error Interrupt\n");
92 irq_set_chip_data(virq, mpic);
93 irq_set_chip_and_handler(virq, &mpic->hc_err,
94 handle_level_irq);
95 return 1;
96 }
97
98 return 0;
99}
100
101static irqreturn_t fsl_error_int_handler(int irq, void *data)
102{
103 struct mpic *mpic = (struct mpic *) data;
104 u32 eisr, eimr;
105 int errint;
106 unsigned int cascade_irq;
107
108 eisr = mpic_fsl_err_read(mpic->err_regs, MPIC_ERR_INT_EISR);
109 eimr = mpic_fsl_err_read(mpic->err_regs, MPIC_ERR_INT_EIMR);
110
111 if (!(eisr & ~eimr))
112 return IRQ_NONE;
113
114 while (eisr) {
115 errint = __builtin_clz(eisr);
116 cascade_irq = irq_linear_revmap(mpic->irqhost,
117 mpic->err_int_vecs[errint]);
118 WARN_ON(cascade_irq == NO_IRQ);
119 if (cascade_irq != NO_IRQ) {
120 generic_handle_irq(cascade_irq);
121 } else {
122 eimr |= 1 << (31 - errint);
123 mpic_fsl_err_write(mpic->err_regs, eimr);
124 }
125 eisr &= ~(1 << (31 - errint));
126 }
127
128 return IRQ_HANDLED;
129}
130
131void mpic_err_int_init(struct mpic *mpic, irq_hw_number_t irqnum)
132{
133 unsigned int virq;
134 int ret;
135
136 virq = irq_create_mapping(mpic->irqhost, irqnum);
137 if (virq == NO_IRQ) {
138 pr_err("Error interrupt setup failed\n");
139 return;
140 }
141
142 /* Mask all error interrupts */
143 mpic_fsl_err_write(mpic->err_regs, ~0);
144
145 ret = request_irq(virq, fsl_error_int_handler, IRQF_NO_THREAD,
146 "mpic-error-int", mpic);
147 if (ret)
148 pr_err("Failed to register error interrupt handler\n");
149}
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index c37f46136321..ffb93ae9379b 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -38,15 +38,15 @@ static int fsl_pcie_bus_fixup, is_mpc83xx_pci;
38 38
39static void __devinit quirk_fsl_pcie_header(struct pci_dev *dev) 39static void __devinit quirk_fsl_pcie_header(struct pci_dev *dev)
40{ 40{
41 u8 progif; 41 u8 hdr_type;
42 42
43 /* if we aren't a PCIe don't bother */ 43 /* if we aren't a PCIe don't bother */
44 if (!pci_find_capability(dev, PCI_CAP_ID_EXP)) 44 if (!pci_find_capability(dev, PCI_CAP_ID_EXP))
45 return; 45 return;
46 46
47 /* if we aren't in host mode don't bother */ 47 /* if we aren't in host mode don't bother */
48 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); 48 pci_read_config_byte(dev, PCI_HEADER_TYPE, &hdr_type);
49 if (progif & 0x1) 49 if ((hdr_type & 0x7f) != PCI_HEADER_TYPE_BRIDGE)
50 return; 50 return;
51 51
52 dev->class = PCI_CLASS_BRIDGE_PCI << 8; 52 dev->class = PCI_CLASS_BRIDGE_PCI << 8;
@@ -143,18 +143,20 @@ static void __init setup_pci_atmu(struct pci_controller *hose,
143 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n", 143 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n",
144 (u64)rsrc->start, (u64)resource_size(rsrc)); 144 (u64)rsrc->start, (u64)resource_size(rsrc));
145 145
146 if (of_device_is_compatible(hose->dn, "fsl,qoriq-pcie-v2.2")) {
147 win_idx = 2;
148 start_idx = 0;
149 end_idx = 3;
150 }
151
152 pci = ioremap(rsrc->start, resource_size(rsrc)); 146 pci = ioremap(rsrc->start, resource_size(rsrc));
153 if (!pci) { 147 if (!pci) {
154 dev_err(hose->parent, "Unable to map ATMU registers\n"); 148 dev_err(hose->parent, "Unable to map ATMU registers\n");
155 return; 149 return;
156 } 150 }
157 151
152 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) {
153 if (in_be32(&pci->block_rev1) >= PCIE_IP_REV_2_2) {
154 win_idx = 2;
155 start_idx = 0;
156 end_idx = 3;
157 }
158 }
159
158 /* Disable all windows (except powar0 since it's ignored) */ 160 /* Disable all windows (except powar0 since it's ignored) */
159 for(i = 1; i < 5; i++) 161 for(i = 1; i < 5; i++)
160 out_be32(&pci->pow[i].powar, 0); 162 out_be32(&pci->pow[i].powar, 0);
@@ -425,7 +427,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
425 struct pci_controller *hose; 427 struct pci_controller *hose;
426 struct resource rsrc; 428 struct resource rsrc;
427 const int *bus_range; 429 const int *bus_range;
428 u8 progif; 430 u8 hdr_type, progif;
429 431
430 if (!of_device_is_available(dev)) { 432 if (!of_device_is_available(dev)) {
431 pr_warning("%s: disabled\n", dev->full_name); 433 pr_warning("%s: disabled\n", dev->full_name);
@@ -457,15 +459,17 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
457 setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4, 459 setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4,
458 PPC_INDIRECT_TYPE_BIG_ENDIAN); 460 PPC_INDIRECT_TYPE_BIG_ENDIAN);
459 461
460 early_read_config_byte(hose, 0, 0, PCI_CLASS_PROG, &progif); 462 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) {
461 if ((progif & 1) == 1) { 463 /* For PCIE read HEADER_TYPE to identify controler mode */
462 /* unmap cfg_data & cfg_addr separately if not on same page */ 464 early_read_config_byte(hose, 0, 0, PCI_HEADER_TYPE, &hdr_type);
463 if (((unsigned long)hose->cfg_data & PAGE_MASK) != 465 if ((hdr_type & 0x7f) != PCI_HEADER_TYPE_BRIDGE)
464 ((unsigned long)hose->cfg_addr & PAGE_MASK)) 466 goto no_bridge;
465 iounmap(hose->cfg_data); 467
466 iounmap(hose->cfg_addr); 468 } else {
467 pcibios_free_controller(hose); 469 /* For PCI read PROG to identify controller mode */
468 return -ENODEV; 470 early_read_config_byte(hose, 0, 0, PCI_CLASS_PROG, &progif);
471 if ((progif & 1) == 1)
472 goto no_bridge;
469 } 473 }
470 474
471 setup_pci_cmd(hose); 475 setup_pci_cmd(hose);
@@ -494,6 +498,15 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
494 setup_pci_atmu(hose, &rsrc); 498 setup_pci_atmu(hose, &rsrc);
495 499
496 return 0; 500 return 0;
501
502no_bridge:
503 /* unmap cfg_data & cfg_addr separately if not on same page */
504 if (((unsigned long)hose->cfg_data & PAGE_MASK) !=
505 ((unsigned long)hose->cfg_addr & PAGE_MASK))
506 iounmap(hose->cfg_data);
507 iounmap(hose->cfg_addr);
508 pcibios_free_controller(hose);
509 return -ENODEV;
497} 510}
498#endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */ 511#endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */
499 512
@@ -818,6 +831,7 @@ static const struct of_device_id pci_ids[] = {
818 { .compatible = "fsl,p1010-pcie", }, 831 { .compatible = "fsl,p1010-pcie", },
819 { .compatible = "fsl,p1023-pcie", }, 832 { .compatible = "fsl,p1023-pcie", },
820 { .compatible = "fsl,p4080-pcie", }, 833 { .compatible = "fsl,p4080-pcie", },
834 { .compatible = "fsl,qoriq-pcie-v2.4", },
821 { .compatible = "fsl,qoriq-pcie-v2.3", }, 835 { .compatible = "fsl,qoriq-pcie-v2.3", },
822 { .compatible = "fsl,qoriq-pcie-v2.2", }, 836 { .compatible = "fsl,qoriq-pcie-v2.2", },
823 {}, 837 {},
@@ -825,57 +839,80 @@ static const struct of_device_id pci_ids[] = {
825 839
826struct device_node *fsl_pci_primary; 840struct device_node *fsl_pci_primary;
827 841
828void __devinit fsl_pci_init(void) 842void fsl_pci_assign_primary(void)
829{ 843{
830 int ret; 844 struct device_node *np;
831 struct device_node *node;
832 struct pci_controller *hose;
833 dma_addr_t max = 0xffffffff;
834 845
835 /* Callers can specify the primary bus using other means. */ 846 /* Callers can specify the primary bus using other means. */
836 if (!fsl_pci_primary) { 847 if (fsl_pci_primary)
837 /* If a PCI host bridge contains an ISA node, it's primary. */ 848 return;
838 node = of_find_node_by_type(NULL, "isa"); 849
839 while ((fsl_pci_primary = of_get_parent(node))) { 850 /* If a PCI host bridge contains an ISA node, it's primary. */
840 of_node_put(node); 851 np = of_find_node_by_type(NULL, "isa");
841 node = fsl_pci_primary; 852 while ((fsl_pci_primary = of_get_parent(np))) {
842 853 of_node_put(np);
843 if (of_match_node(pci_ids, node)) 854 np = fsl_pci_primary;
844 break; 855
845 } 856 if (of_match_node(pci_ids, np) && of_device_is_available(np))
857 return;
846 } 858 }
847 859
848 node = NULL; 860 /*
849 for_each_node_by_type(node, "pci") { 861 * If there's no PCI host bridge with ISA, arbitrarily
850 if (of_match_node(pci_ids, node)) { 862 * designate one as primary. This can go away once
851 /* 863 * various bugs with primary-less systems are fixed.
852 * If there's no PCI host bridge with ISA, arbitrarily 864 */
853 * designate one as primary. This can go away once 865 for_each_matching_node(np, pci_ids) {
854 * various bugs with primary-less systems are fixed. 866 if (of_device_is_available(np)) {
855 */ 867 fsl_pci_primary = np;
856 if (!fsl_pci_primary) 868 of_node_put(np);
857 fsl_pci_primary = node; 869 return;
858
859 ret = fsl_add_bridge(node, fsl_pci_primary == node);
860 if (ret == 0) {
861 hose = pci_find_hose_for_OF_device(node);
862 max = min(max, hose->dma_window_base_cur +
863 hose->dma_window_size);
864 }
865 } 870 }
866 } 871 }
872}
867 873
874static int __devinit fsl_pci_probe(struct platform_device *pdev)
875{
876 int ret;
877 struct device_node *node;
868#ifdef CONFIG_SWIOTLB 878#ifdef CONFIG_SWIOTLB
869 /* 879 struct pci_controller *hose;
870 * if we couldn't map all of DRAM via the dma windows 880#endif
871 * we need SWIOTLB to handle buffers located outside of 881
872 * dma capable memory region 882 node = pdev->dev.of_node;
873 */ 883 ret = fsl_add_bridge(node, fsl_pci_primary == node);
874 if (memblock_end_of_DRAM() - 1 > max) { 884
875 ppc_swiotlb_enable = 1; 885#ifdef CONFIG_SWIOTLB
876 set_pci_dma_ops(&swiotlb_dma_ops); 886 if (ret == 0) {
877 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 887 hose = pci_find_hose_for_OF_device(pdev->dev.of_node);
888
889 /*
890 * if we couldn't map all of DRAM via the dma windows
891 * we need SWIOTLB to handle buffers located outside of
892 * dma capable memory region
893 */
894 if (memblock_end_of_DRAM() - 1 > hose->dma_window_base_cur +
895 hose->dma_window_size)
896 ppc_swiotlb_enable = 1;
878 } 897 }
879#endif 898#endif
899
900 mpc85xx_pci_err_probe(pdev);
901
902 return 0;
903}
904
905static struct platform_driver fsl_pci_driver = {
906 .driver = {
907 .name = "fsl-pci",
908 .of_match_table = pci_ids,
909 },
910 .probe = fsl_pci_probe,
911};
912
913static int __init fsl_pci_init(void)
914{
915 return platform_driver_register(&fsl_pci_driver);
880} 916}
917arch_initcall(fsl_pci_init);
881#endif 918#endif
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index baa0fd18289f..d078537adece 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -16,6 +16,7 @@
16 16
17#define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */ 17#define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */
18#define PCIE_LTSSM_L0 0x16 /* L0 state */ 18#define PCIE_LTSSM_L0 0x16 /* L0 state */
19#define PCIE_IP_REV_2_2 0x02080202 /* PCIE IP block version Rev2.2 */
19#define PIWAR_EN 0x80000000 /* Enable */ 20#define PIWAR_EN 0x80000000 /* Enable */
20#define PIWAR_PF 0x20000000 /* prefetch */ 21#define PIWAR_PF 0x20000000 /* prefetch */
21#define PIWAR_TGI_LOCAL 0x00f00000 /* target - local memory */ 22#define PIWAR_TGI_LOCAL 0x00f00000 /* target - local memory */
@@ -57,7 +58,9 @@ struct ccsr_pci {
57 __be32 pex_pme_mes_disr; /* 0x.024 - PCIE PME and message disable register */ 58 __be32 pex_pme_mes_disr; /* 0x.024 - PCIE PME and message disable register */
58 __be32 pex_pme_mes_ier; /* 0x.028 - PCIE PME and message interrupt enable register */ 59 __be32 pex_pme_mes_ier; /* 0x.028 - PCIE PME and message interrupt enable register */
59 __be32 pex_pmcr; /* 0x.02c - PCIE power management command register */ 60 __be32 pex_pmcr; /* 0x.02c - PCIE power management command register */
60 u8 res3[3024]; 61 u8 res3[3016];
62 __be32 block_rev1; /* 0x.bf8 - PCIE Block Revision register 1 */
63 __be32 block_rev2; /* 0x.bfc - PCIE Block Revision register 2 */
61 64
62/* PCI/PCI Express outbound window 0-4 65/* PCI/PCI Express outbound window 0-4
63 * Window 0 is the default window and is the only window enabled upon reset. 66 * Window 0 is the default window and is the only window enabled upon reset.
@@ -95,10 +98,19 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose);
95 98
96extern struct device_node *fsl_pci_primary; 99extern struct device_node *fsl_pci_primary;
97 100
98#ifdef CONFIG_FSL_PCI 101#ifdef CONFIG_PCI
99void fsl_pci_init(void); 102void fsl_pci_assign_primary(void);
100#else 103#else
101static inline void fsl_pci_init(void) {} 104static inline void fsl_pci_assign_primary(void) {}
105#endif
106
107#ifdef CONFIG_EDAC_MPC85XX
108int mpc85xx_pci_err_probe(struct platform_device *op);
109#else
110static inline int mpc85xx_pci_err_probe(struct platform_device *op)
111{
112 return -ENOTSUPP;
113}
102#endif 114#endif
103 115
104#endif /* __POWERPC_FSL_PCI_H */ 116#endif /* __POWERPC_FSL_PCI_H */
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index bfc6211e5422..9c6e535daad2 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -6,7 +6,7 @@
6 * with various broken implementations of this HW. 6 * with various broken implementations of this HW.
7 * 7 *
8 * Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp. 8 * Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp.
9 * Copyright 2010-2011 Freescale Semiconductor, Inc. 9 * Copyright 2010-2012 Freescale Semiconductor, Inc.
10 * 10 *
11 * This file is subject to the terms and conditions of the GNU General Public 11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file COPYING in the main directory of this archive 12 * License. See the file COPYING in the main directory of this archive
@@ -221,24 +221,24 @@ static inline void _mpic_ipi_write(struct mpic *mpic, unsigned int ipi, u32 valu
221 _mpic_write(mpic->reg_type, &mpic->gregs, offset, value); 221 _mpic_write(mpic->reg_type, &mpic->gregs, offset, value);
222} 222}
223 223
224static inline u32 _mpic_tm_read(struct mpic *mpic, unsigned int tm) 224static inline unsigned int mpic_tm_offset(struct mpic *mpic, unsigned int tm)
225{ 225{
226 unsigned int offset = MPIC_INFO(TIMER_VECTOR_PRI) + 226 return (tm >> 2) * MPIC_TIMER_GROUP_STRIDE +
227 ((tm & 3) * MPIC_INFO(TIMER_STRIDE)); 227 (tm & 3) * MPIC_INFO(TIMER_STRIDE);
228}
228 229
229 if (tm >= 4) 230static inline u32 _mpic_tm_read(struct mpic *mpic, unsigned int tm)
230 offset += 0x1000 / 4; 231{
232 unsigned int offset = mpic_tm_offset(mpic, tm) +
233 MPIC_INFO(TIMER_VECTOR_PRI);
231 234
232 return _mpic_read(mpic->reg_type, &mpic->tmregs, offset); 235 return _mpic_read(mpic->reg_type, &mpic->tmregs, offset);
233} 236}
234 237
235static inline void _mpic_tm_write(struct mpic *mpic, unsigned int tm, u32 value) 238static inline void _mpic_tm_write(struct mpic *mpic, unsigned int tm, u32 value)
236{ 239{
237 unsigned int offset = MPIC_INFO(TIMER_VECTOR_PRI) + 240 unsigned int offset = mpic_tm_offset(mpic, tm) +
238 ((tm & 3) * MPIC_INFO(TIMER_STRIDE)); 241 MPIC_INFO(TIMER_VECTOR_PRI);
239
240 if (tm >= 4)
241 offset += 0x1000 / 4;
242 242
243 _mpic_write(mpic->reg_type, &mpic->tmregs, offset, value); 243 _mpic_write(mpic->reg_type, &mpic->tmregs, offset, value);
244} 244}
@@ -1026,6 +1026,9 @@ static int mpic_host_map(struct irq_domain *h, unsigned int virq,
1026 return 0; 1026 return 0;
1027 } 1027 }
1028 1028
1029 if (mpic_map_error_int(mpic, virq, hw))
1030 return 0;
1031
1029 if (hw >= mpic->num_sources) 1032 if (hw >= mpic->num_sources)
1030 return -EINVAL; 1033 return -EINVAL;
1031 1034
@@ -1085,7 +1088,16 @@ static int mpic_host_xlate(struct irq_domain *h, struct device_node *ct,
1085 */ 1088 */
1086 switch (intspec[2]) { 1089 switch (intspec[2]) {
1087 case 0: 1090 case 0:
1088 case 1: /* no EISR/EIMR support for now, treat as shared IRQ */ 1091 break;
1092 case 1:
1093 if (!(mpic->flags & MPIC_FSL_HAS_EIMR))
1094 break;
1095
1096 if (intspec[3] >= ARRAY_SIZE(mpic->err_int_vecs))
1097 return -EINVAL;
1098
1099 *out_hwirq = mpic->err_int_vecs[intspec[3]];
1100
1089 break; 1101 break;
1090 case 2: 1102 case 2:
1091 if (intspec[0] >= ARRAY_SIZE(mpic->ipi_vecs)) 1103 if (intspec[0] >= ARRAY_SIZE(mpic->ipi_vecs))
@@ -1301,6 +1313,42 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1301 mpic_map(mpic, mpic->paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000); 1313 mpic_map(mpic, mpic->paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
1302 mpic_map(mpic, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000); 1314 mpic_map(mpic, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
1303 1315
1316 if (mpic->flags & MPIC_FSL) {
1317 u32 brr1, version;
1318 int ret;
1319
1320 /*
1321 * Yes, Freescale really did put global registers in the
1322 * magic per-cpu area -- and they don't even show up in the
1323 * non-magic per-cpu copies that this driver normally uses.
1324 */
1325 mpic_map(mpic, mpic->paddr, &mpic->thiscpuregs,
1326 MPIC_CPU_THISBASE, 0x1000);
1327
1328 brr1 = _mpic_read(mpic->reg_type, &mpic->thiscpuregs,
1329 MPIC_FSL_BRR1);
1330 version = brr1 & MPIC_FSL_BRR1_VER;
1331
1332 /* Error interrupt mask register (EIMR) is required for
1333 * handling individual device error interrupts. EIMR
1334 * was added in MPIC version 4.1.
1335 *
1336 * Over here we reserve vector number space for error
1337 * interrupt vectors. This space is stolen from the
1338 * global vector number space, as in case of ipis
1339 * and timer interrupts.
1340 *
1341 * Available vector space = intvec_top - 12, where 12
1342 * is the number of vectors which have been consumed by
1343 * ipis and timer interrupts.
1344 */
1345 if (version >= 0x401) {
1346 ret = mpic_setup_error_int(mpic, intvec_top - 12);
1347 if (ret)
1348 return NULL;
1349 }
1350 }
1351
1304 /* Reset */ 1352 /* Reset */
1305 1353
1306 /* When using a device-node, reset requests are only honored if the MPIC 1354 /* When using a device-node, reset requests are only honored if the MPIC
@@ -1440,6 +1488,7 @@ void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
1440void __init mpic_init(struct mpic *mpic) 1488void __init mpic_init(struct mpic *mpic)
1441{ 1489{
1442 int i, cpu; 1490 int i, cpu;
1491 int num_timers = 4;
1443 1492
1444 BUG_ON(mpic->num_sources == 0); 1493 BUG_ON(mpic->num_sources == 0);
1445 1494
@@ -1448,15 +1497,34 @@ void __init mpic_init(struct mpic *mpic)
1448 /* Set current processor priority to max */ 1497 /* Set current processor priority to max */
1449 mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), 0xf); 1498 mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), 0xf);
1450 1499
1500 if (mpic->flags & MPIC_FSL) {
1501 u32 brr1 = _mpic_read(mpic->reg_type, &mpic->thiscpuregs,
1502 MPIC_FSL_BRR1);
1503 u32 version = brr1 & MPIC_FSL_BRR1_VER;
1504
1505 /*
1506 * Timer group B is present at the latest in MPIC 3.1 (e.g.
1507 * mpc8536). It is not present in MPIC 2.0 (e.g. mpc8544).
1508 * I don't know about the status of intermediate versions (or
1509 * whether they even exist).
1510 */
1511 if (version >= 0x0301)
1512 num_timers = 8;
1513 }
1514
1515 /* FSL mpic error interrupt intialization */
1516 if (mpic->flags & MPIC_FSL_HAS_EIMR)
1517 mpic_err_int_init(mpic, MPIC_FSL_ERR_INT);
1518
1451 /* Initialize timers to our reserved vectors and mask them for now */ 1519 /* Initialize timers to our reserved vectors and mask them for now */
1452 for (i = 0; i < 4; i++) { 1520 for (i = 0; i < num_timers; i++) {
1521 unsigned int offset = mpic_tm_offset(mpic, i);
1522
1453 mpic_write(mpic->tmregs, 1523 mpic_write(mpic->tmregs,
1454 i * MPIC_INFO(TIMER_STRIDE) + 1524 offset + MPIC_INFO(TIMER_DESTINATION),
1455 MPIC_INFO(TIMER_DESTINATION),
1456 1 << hard_smp_processor_id()); 1525 1 << hard_smp_processor_id());
1457 mpic_write(mpic->tmregs, 1526 mpic_write(mpic->tmregs,
1458 i * MPIC_INFO(TIMER_STRIDE) + 1527 offset + MPIC_INFO(TIMER_VECTOR_PRI),
1459 MPIC_INFO(TIMER_VECTOR_PRI),
1460 MPIC_VECPRI_MASK | 1528 MPIC_VECPRI_MASK |
1461 (9 << MPIC_VECPRI_PRIORITY_SHIFT) | 1529 (9 << MPIC_VECPRI_PRIORITY_SHIFT) |
1462 (mpic->timer_vecs[0] + i)); 1530 (mpic->timer_vecs[0] + i));
diff --git a/arch/powerpc/sysdev/mpic.h b/arch/powerpc/sysdev/mpic.h
index 13f3e8913a93..24bf07a63924 100644
--- a/arch/powerpc/sysdev/mpic.h
+++ b/arch/powerpc/sysdev/mpic.h
@@ -40,4 +40,26 @@ extern int mpic_set_affinity(struct irq_data *d,
40 const struct cpumask *cpumask, bool force); 40 const struct cpumask *cpumask, bool force);
41extern void mpic_reset_core(int cpu); 41extern void mpic_reset_core(int cpu);
42 42
43#ifdef CONFIG_FSL_SOC
44extern int mpic_map_error_int(struct mpic *mpic, unsigned int virq, irq_hw_number_t hw);
45extern void mpic_err_int_init(struct mpic *mpic, irq_hw_number_t irqnum);
46extern int mpic_setup_error_int(struct mpic *mpic, int intvec);
47#else
48static inline int mpic_map_error_int(struct mpic *mpic, unsigned int virq, irq_hw_number_t hw)
49{
50 return 0;
51}
52
53
54static inline void mpic_err_int_init(struct mpic *mpic, irq_hw_number_t irqnum)
55{
56 return;
57}
58
59static inline int mpic_setup_error_int(struct mpic *mpic, int intvec)
60{
61 return -1;
62}
63#endif
64
43#endif /* _POWERPC_SYSDEV_MPIC_H */ 65#endif /* _POWERPC_SYSDEV_MPIC_H */
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 9b49c65ee7a4..3a56a639a92e 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -60,6 +60,8 @@ static cpumask_t cpus_in_xmon = CPU_MASK_NONE;
60static unsigned long xmon_taken = 1; 60static unsigned long xmon_taken = 1;
61static int xmon_owner; 61static int xmon_owner;
62static int xmon_gate; 62static int xmon_gate;
63#else
64#define xmon_owner 0
63#endif /* CONFIG_SMP */ 65#endif /* CONFIG_SMP */
64 66
65static unsigned long in_xmon __read_mostly = 0; 67static unsigned long in_xmon __read_mostly = 0;
@@ -202,7 +204,13 @@ Commands:\n\
202 di dump instructions\n\ 204 di dump instructions\n\
203 df dump float values\n\ 205 df dump float values\n\
204 dd dump double values\n\ 206 dd dump double values\n\
205 dl dump the kernel log buffer\n\ 207 dl dump the kernel log buffer\n"
208#ifdef CONFIG_PPC64
209 "\
210 dp[#] dump paca for current cpu, or cpu #\n\
211 dpa dump paca for all possible cpus\n"
212#endif
213 "\
206 dr dump stream of raw bytes\n\ 214 dr dump stream of raw bytes\n\
207 e print exception information\n\ 215 e print exception information\n\
208 f flush cache\n\ 216 f flush cache\n\
@@ -740,7 +748,7 @@ static void insert_bpts(void)
740static void insert_cpu_bpts(void) 748static void insert_cpu_bpts(void)
741{ 749{
742 if (dabr.enabled) 750 if (dabr.enabled)
743 set_dabr(dabr.address | (dabr.enabled & 7)); 751 set_dabr(dabr.address | (dabr.enabled & 7), DABRX_ALL);
744 if (iabr && cpu_has_feature(CPU_FTR_IABR)) 752 if (iabr && cpu_has_feature(CPU_FTR_IABR))
745 mtspr(SPRN_IABR, iabr->address 753 mtspr(SPRN_IABR, iabr->address
746 | (iabr->enabled & (BP_IABR|BP_IABR_TE))); 754 | (iabr->enabled & (BP_IABR|BP_IABR_TE)));
@@ -768,7 +776,7 @@ static void remove_bpts(void)
768 776
769static void remove_cpu_bpts(void) 777static void remove_cpu_bpts(void)
770{ 778{
771 set_dabr(0); 779 set_dabr(0, 0);
772 if (cpu_has_feature(CPU_FTR_IABR)) 780 if (cpu_has_feature(CPU_FTR_IABR))
773 mtspr(SPRN_IABR, 0); 781 mtspr(SPRN_IABR, 0);
774} 782}
@@ -2009,6 +2017,95 @@ static void xmon_rawdump (unsigned long adrs, long ndump)
2009 printf("\n"); 2017 printf("\n");
2010} 2018}
2011 2019
2020#ifdef CONFIG_PPC64
2021static void dump_one_paca(int cpu)
2022{
2023 struct paca_struct *p;
2024
2025 if (setjmp(bus_error_jmp) != 0) {
2026 printf("*** Error dumping paca for cpu 0x%x!\n", cpu);
2027 return;
2028 }
2029
2030 catch_memory_errors = 1;
2031 sync();
2032
2033 p = &paca[cpu];
2034
2035 printf("paca for cpu 0x%x @ %p:\n", cpu, p);
2036
2037 printf(" %-*s = %s\n", 16, "possible", cpu_possible(cpu) ? "yes" : "no");
2038 printf(" %-*s = %s\n", 16, "present", cpu_present(cpu) ? "yes" : "no");
2039 printf(" %-*s = %s\n", 16, "online", cpu_online(cpu) ? "yes" : "no");
2040
2041#define DUMP(paca, name, format) \
2042 printf(" %-*s = %#-*"format"\t(0x%lx)\n", 16, #name, 18, paca->name, \
2043 offsetof(struct paca_struct, name));
2044
2045 DUMP(p, lock_token, "x");
2046 DUMP(p, paca_index, "x");
2047 DUMP(p, kernel_toc, "lx");
2048 DUMP(p, kernelbase, "lx");
2049 DUMP(p, kernel_msr, "lx");
2050#ifdef CONFIG_PPC_STD_MMU_64
2051 DUMP(p, stab_real, "lx");
2052 DUMP(p, stab_addr, "lx");
2053#endif
2054 DUMP(p, emergency_sp, "p");
2055 DUMP(p, data_offset, "lx");
2056 DUMP(p, hw_cpu_id, "x");
2057 DUMP(p, cpu_start, "x");
2058 DUMP(p, kexec_state, "x");
2059 DUMP(p, __current, "p");
2060 DUMP(p, kstack, "lx");
2061 DUMP(p, stab_rr, "lx");
2062 DUMP(p, saved_r1, "lx");
2063 DUMP(p, trap_save, "x");
2064 DUMP(p, soft_enabled, "x");
2065 DUMP(p, irq_happened, "x");
2066 DUMP(p, io_sync, "x");
2067 DUMP(p, irq_work_pending, "x");
2068 DUMP(p, nap_state_lost, "x");
2069
2070#undef DUMP
2071
2072 catch_memory_errors = 0;
2073 sync();
2074}
2075
2076static void dump_all_pacas(void)
2077{
2078 int cpu;
2079
2080 if (num_possible_cpus() == 0) {
2081 printf("No possible cpus, use 'dp #' to dump individual cpus\n");
2082 return;
2083 }
2084
2085 for_each_possible_cpu(cpu)
2086 dump_one_paca(cpu);
2087}
2088
2089static void dump_pacas(void)
2090{
2091 unsigned long num;
2092 int c;
2093
2094 c = inchar();
2095 if (c == 'a') {
2096 dump_all_pacas();
2097 return;
2098 }
2099
2100 termch = c; /* Put c back, it wasn't 'a' */
2101
2102 if (scanhex(&num))
2103 dump_one_paca(num);
2104 else
2105 dump_one_paca(xmon_owner);
2106}
2107#endif
2108
2012#define isxdigit(c) (('0' <= (c) && (c) <= '9') \ 2109#define isxdigit(c) (('0' <= (c) && (c) <= '9') \
2013 || ('a' <= (c) && (c) <= 'f') \ 2110 || ('a' <= (c) && (c) <= 'f') \
2014 || ('A' <= (c) && (c) <= 'F')) 2111 || ('A' <= (c) && (c) <= 'F'))
@@ -2018,6 +2115,14 @@ dump(void)
2018 int c; 2115 int c;
2019 2116
2020 c = inchar(); 2117 c = inchar();
2118
2119#ifdef CONFIG_PPC64
2120 if (c == 'p') {
2121 dump_pacas();
2122 return;
2123 }
2124#endif
2125
2021 if ((isxdigit(c) && c != 'f' && c != 'd') || c == '\n') 2126 if ((isxdigit(c) && c != 'f' && c != 'd') || c == '\n')
2022 termch = c; 2127 termch = c;
2023 scanhex((void *)&adrs); 2128 scanhex((void *)&adrs);
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index f9acddd9ace3..c8af429991d9 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -656,7 +656,6 @@ config S390_GUEST
656 depends on 64BIT && EXPERIMENTAL 656 depends on 64BIT && EXPERIMENTAL
657 select VIRTUALIZATION 657 select VIRTUALIZATION
658 select VIRTIO 658 select VIRTIO
659 select VIRTIO_RING
660 select VIRTIO_CONSOLE 659 select VIRTIO_CONSOLE
661 help 660 help
662 Enabling this option adds support for virtio based paravirtual device 661 Enabling this option adds support for virtio based paravirtual device
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index 234f1d859cea..a34a9d612fc0 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -65,6 +65,7 @@ typedef s64 compat_s64;
65typedef u32 compat_uint_t; 65typedef u32 compat_uint_t;
66typedef u32 compat_ulong_t; 66typedef u32 compat_ulong_t;
67typedef u64 compat_u64; 67typedef u64 compat_u64;
68typedef u32 compat_uptr_t;
68 69
69struct compat_timespec { 70struct compat_timespec {
70 compat_time_t tv_sec; 71 compat_time_t tv_sec;
@@ -144,6 +145,79 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */
144 145
145typedef u32 compat_sigset_word; 146typedef u32 compat_sigset_word;
146 147
148typedef union compat_sigval {
149 compat_int_t sival_int;
150 compat_uptr_t sival_ptr;
151} compat_sigval_t;
152
153typedef struct compat_siginfo {
154 int si_signo;
155 int si_errno;
156 int si_code;
157
158 union {
159 int _pad[128/sizeof(int) - 3];
160
161 /* kill() */
162 struct {
163 pid_t _pid; /* sender's pid */
164 uid_t _uid; /* sender's uid */
165 } _kill;
166
167 /* POSIX.1b timers */
168 struct {
169 compat_timer_t _tid; /* timer id */
170 int _overrun; /* overrun count */
171 compat_sigval_t _sigval; /* same as below */
172 int _sys_private; /* not to be passed to user */
173 } _timer;
174
175 /* POSIX.1b signals */
176 struct {
177 pid_t _pid; /* sender's pid */
178 uid_t _uid; /* sender's uid */
179 compat_sigval_t _sigval;
180 } _rt;
181
182 /* SIGCHLD */
183 struct {
184 pid_t _pid; /* which child */
185 uid_t _uid; /* sender's uid */
186 int _status;/* exit code */
187 compat_clock_t _utime;
188 compat_clock_t _stime;
189 } _sigchld;
190
191 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
192 struct {
193 __u32 _addr; /* faulting insn/memory ref. - pointer */
194 } _sigfault;
195
196 /* SIGPOLL */
197 struct {
198 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
199 int _fd;
200 } _sigpoll;
201 } _sifields;
202} compat_siginfo_t;
203
204/*
205 * How these fields are to be accessed.
206 */
207#define si_pid _sifields._kill._pid
208#define si_uid _sifields._kill._uid
209#define si_status _sifields._sigchld._status
210#define si_utime _sifields._sigchld._utime
211#define si_stime _sifields._sigchld._stime
212#define si_value _sifields._rt._sigval
213#define si_int _sifields._rt._sigval.sival_int
214#define si_ptr _sifields._rt._sigval.sival_ptr
215#define si_addr _sifields._sigfault._addr
216#define si_band _sifields._sigpoll._band
217#define si_fd _sifields._sigpoll._fd
218#define si_tid _sifields._timer._tid
219#define si_overrun _sifields._timer._overrun
220
147#define COMPAT_OFF_T_MAX 0x7fffffff 221#define COMPAT_OFF_T_MAX 0x7fffffff
148#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 222#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
149 223
@@ -153,7 +227,6 @@ typedef u32 compat_sigset_word;
153 * as pointers because the syscall entry code will have 227 * as pointers because the syscall entry code will have
154 * appropriately converted them already. 228 * appropriately converted them already.
155 */ 229 */
156typedef u32 compat_uptr_t;
157 230
158static inline void __user *compat_ptr(compat_uptr_t uptr) 231static inline void __user *compat_ptr(compat_uptr_t uptr)
159{ 232{
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 9635d759c2b9..90887bd98cf0 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -23,74 +23,6 @@ struct old_sigaction32 {
23 __u32 sa_flags; 23 __u32 sa_flags;
24 __u32 sa_restorer; /* Another 32 bit pointer */ 24 __u32 sa_restorer; /* Another 32 bit pointer */
25}; 25};
26
27typedef struct compat_siginfo {
28 int si_signo;
29 int si_errno;
30 int si_code;
31
32 union {
33 int _pad[((128/sizeof(int)) - 3)];
34
35 /* kill() */
36 struct {
37 pid_t _pid; /* sender's pid */
38 uid_t _uid; /* sender's uid */
39 } _kill;
40
41 /* POSIX.1b timers */
42 struct {
43 compat_timer_t _tid; /* timer id */
44 int _overrun; /* overrun count */
45 compat_sigval_t _sigval; /* same as below */
46 int _sys_private; /* not to be passed to user */
47 } _timer;
48
49 /* POSIX.1b signals */
50 struct {
51 pid_t _pid; /* sender's pid */
52 uid_t _uid; /* sender's uid */
53 compat_sigval_t _sigval;
54 } _rt;
55
56 /* SIGCHLD */
57 struct {
58 pid_t _pid; /* which child */
59 uid_t _uid; /* sender's uid */
60 int _status;/* exit code */
61 compat_clock_t _utime;
62 compat_clock_t _stime;
63 } _sigchld;
64
65 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
66 struct {
67 __u32 _addr; /* faulting insn/memory ref. - pointer */
68 } _sigfault;
69
70 /* SIGPOLL */
71 struct {
72 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
73 int _fd;
74 } _sigpoll;
75 } _sifields;
76} compat_siginfo_t;
77
78/*
79 * How these fields are to be accessed.
80 */
81#define si_pid _sifields._kill._pid
82#define si_uid _sifields._kill._uid
83#define si_status _sifields._sigchld._status
84#define si_utime _sifields._sigchld._utime
85#define si_stime _sifields._sigchld._stime
86#define si_value _sifields._rt._sigval
87#define si_int _sifields._rt._sigval.sival_int
88#define si_ptr _sifields._rt._sigval.sival_ptr
89#define si_addr _sifields._sigfault._addr
90#define si_band _sifields._sigpoll._band
91#define si_fd _sifields._sigpoll._fd
92#define si_tid _sifields._timer._tid
93#define si_overrun _sifields._timer._overrun
94 26
95/* asm/sigcontext.h */ 27/* asm/sigcontext.h */
96typedef union 28typedef union
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index ba0f412920be..461c23747491 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -5,6 +5,7 @@ config SCORE
5 select HAVE_GENERIC_HARDIRQS 5 select HAVE_GENERIC_HARDIRQS
6 select GENERIC_IRQ_SHOW 6 select GENERIC_IRQ_SHOW
7 select GENERIC_IOMAP 7 select GENERIC_IOMAP
8 select GENERIC_ATOMIC64
8 select HAVE_MEMBLOCK 9 select HAVE_MEMBLOCK
9 select HAVE_MEMBLOCK_NODE_MAP 10 select HAVE_MEMBLOCK_NODE_MAP
10 select ARCH_DISCARD_MEMBLOCK 11 select ARCH_DISCARD_MEMBLOCK
diff --git a/arch/score/include/asm/elf.h b/arch/score/include/asm/elf.h
index f478ce94181f..5d566c7a0af2 100644
--- a/arch/score/include/asm/elf.h
+++ b/arch/score/include/asm/elf.h
@@ -54,7 +54,7 @@ typedef elf_fpreg_t elf_fpregset_t;
54 54
55#define SET_PERSONALITY(ex) \ 55#define SET_PERSONALITY(ex) \
56do { \ 56do { \
57 set_personality(PER_LINUX); \ 57 set_personality(PER_LINUX | (current->personality & (~PER_MASK))); \
58} while (0) 58} while (0)
59 59
60struct task_struct; 60struct task_struct;
diff --git a/arch/score/include/asm/unistd.h b/arch/score/include/asm/unistd.h
index 4aa957364d4d..a862384e9c16 100644
--- a/arch/score/include/asm/unistd.h
+++ b/arch/score/include/asm/unistd.h
@@ -1,6 +1,3 @@
1#if !defined(_ASM_SCORE_UNISTD_H) || defined(__SYSCALL)
2#define _ASM_SCORE_UNISTD_H
3
4#define __ARCH_HAVE_MMU 1#define __ARCH_HAVE_MMU
5 2
6#define __ARCH_WANT_SYSCALL_NO_AT 3#define __ARCH_WANT_SYSCALL_NO_AT
@@ -9,5 +6,3 @@
9#define __ARCH_WANT_SYSCALL_DEPRECATED 6#define __ARCH_WANT_SYSCALL_DEPRECATED
10 7
11#include <asm-generic/unistd.h> 8#include <asm-generic/unistd.h>
12
13#endif /* _ASM_SCORE_UNISTD_H */
diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c
index e478bf9a7e91..21e867974066 100644
--- a/arch/score/kernel/sys_score.c
+++ b/arch/score/kernel/sys_score.c
@@ -112,6 +112,7 @@ score_execve(struct pt_regs *regs)
112 * Do a system call from kernel instead of calling sys_execve so we 112 * Do a system call from kernel instead of calling sys_execve so we
113 * end up with proper pt_regs. 113 * end up with proper pt_regs.
114 */ 114 */
115asmlinkage
115int kernel_execve(const char *filename, 116int kernel_execve(const char *filename,
116 const char *const argv[], 117 const char *const argv[],
117 const char *const envp[]) 118 const char *const envp[])
diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
index f38112be67d2..37924afa8d8a 100644
--- a/arch/sh/include/asm/elf.h
+++ b/arch/sh/include/asm/elf.h
@@ -183,7 +183,8 @@ do { \
183} while (0) 183} while (0)
184#endif 184#endif
185 185
186#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT) 186#define SET_PERSONALITY(ex) \
187 set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK)))
187 188
188#ifdef CONFIG_VSYSCALL 189#ifdef CONFIG_VSYSCALL
189/* vDSO has arch_setup_additional_pages */ 190/* vDSO has arch_setup_additional_pages */
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 0cf60a628814..73a23f4617a3 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -134,7 +134,7 @@ __BUILD_MEMORY_STRING(__raw_, q, u64)
134 * load/store instructions. sh_io_port_base is the virtual address to 134 * load/store instructions. sh_io_port_base is the virtual address to
135 * which all ports are being mapped. 135 * which all ports are being mapped.
136 */ 136 */
137extern const unsigned long sh_io_port_base; 137extern unsigned long sh_io_port_base;
138 138
139static inline void __set_io_port_base(unsigned long pbase) 139static inline void __set_io_port_base(unsigned long pbase)
140{ 140{
diff --git a/arch/sh/kernel/ioport.c b/arch/sh/kernel/ioport.c
index e3ad6103e7c1..cca14ba84a37 100644
--- a/arch/sh/kernel/ioport.c
+++ b/arch/sh/kernel/ioport.c
@@ -11,7 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/io.h> 12#include <linux/io.h>
13 13
14const unsigned long sh_io_port_base __read_mostly = -1; 14unsigned long sh_io_port_base __read_mostly = -1;
15EXPORT_SYMBOL(sh_io_port_base); 15EXPORT_SYMBOL(sh_io_port_base);
16 16
17void __iomem *__ioport_map(unsigned long addr, unsigned int size) 17void __iomem *__ioport_map(unsigned long addr, unsigned int size)
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
index b8be20d42a0a..cef99fbc0a21 100644
--- a/arch/sparc/include/asm/compat.h
+++ b/arch/sparc/include/asm/compat.h
@@ -36,6 +36,7 @@ typedef s64 compat_s64;
36typedef u32 compat_uint_t; 36typedef u32 compat_uint_t;
37typedef u32 compat_ulong_t; 37typedef u32 compat_ulong_t;
38typedef u64 compat_u64; 38typedef u64 compat_u64;
39typedef u32 compat_uptr_t;
39 40
40struct compat_timespec { 41struct compat_timespec {
41 compat_time_t tv_sec; 42 compat_time_t tv_sec;
@@ -147,6 +148,65 @@ typedef u32 compat_old_sigset_t;
147 148
148typedef u32 compat_sigset_word; 149typedef u32 compat_sigset_word;
149 150
151typedef union compat_sigval {
152 compat_int_t sival_int;
153 compat_uptr_t sival_ptr;
154} compat_sigval_t;
155
156#define SI_PAD_SIZE32 (128/sizeof(int) - 3)
157
158typedef struct compat_siginfo {
159 int si_signo;
160 int si_errno;
161 int si_code;
162
163 union {
164 int _pad[SI_PAD_SIZE32];
165
166 /* kill() */
167 struct {
168 compat_pid_t _pid; /* sender's pid */
169 unsigned int _uid; /* sender's uid */
170 } _kill;
171
172 /* POSIX.1b timers */
173 struct {
174 compat_timer_t _tid; /* timer id */
175 int _overrun; /* overrun count */
176 compat_sigval_t _sigval; /* same as below */
177 int _sys_private; /* not to be passed to user */
178 } _timer;
179
180 /* POSIX.1b signals */
181 struct {
182 compat_pid_t _pid; /* sender's pid */
183 unsigned int _uid; /* sender's uid */
184 compat_sigval_t _sigval;
185 } _rt;
186
187 /* SIGCHLD */
188 struct {
189 compat_pid_t _pid; /* which child */
190 unsigned int _uid; /* sender's uid */
191 int _status; /* exit code */
192 compat_clock_t _utime;
193 compat_clock_t _stime;
194 } _sigchld;
195
196 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
197 struct {
198 u32 _addr; /* faulting insn/memory ref. */
199 int _trapno;
200 } _sigfault;
201
202 /* SIGPOLL */
203 struct {
204 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
205 int _fd;
206 } _sigpoll;
207 } _sifields;
208} compat_siginfo_t;
209
150#define COMPAT_OFF_T_MAX 0x7fffffff 210#define COMPAT_OFF_T_MAX 0x7fffffff
151#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 211#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
152 212
@@ -156,7 +216,6 @@ typedef u32 compat_sigset_word;
156 * as pointers because the syscall entry code will have 216 * as pointers because the syscall entry code will have
157 * appropriately converted them already. 217 * appropriately converted them already.
158 */ 218 */
159typedef u32 compat_uptr_t;
160 219
161static inline void __user *compat_ptr(compat_uptr_t uptr) 220static inline void __user *compat_ptr(compat_uptr_t uptr)
162{ 221{
diff --git a/arch/sparc/include/asm/elf_32.h b/arch/sparc/include/asm/elf_32.h
index 2d4d755cba9e..ac74a2c98e6d 100644
--- a/arch/sparc/include/asm/elf_32.h
+++ b/arch/sparc/include/asm/elf_32.h
@@ -128,6 +128,7 @@ typedef struct {
128 128
129#define ELF_PLATFORM (NULL) 129#define ELF_PLATFORM (NULL)
130 130
131#define SET_PERSONALITY(ex) set_personality(PER_LINUX) 131#define SET_PERSONALITY(ex) \
132 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
132 133
133#endif /* !(__ASMSPARC_ELF_H) */ 134#endif /* !(__ASMSPARC_ELF_H) */
diff --git a/arch/sparc/include/asm/siginfo.h b/arch/sparc/include/asm/siginfo.h
index 215900fce21b..dbc182c438b4 100644
--- a/arch/sparc/include/asm/siginfo.h
+++ b/arch/sparc/include/asm/siginfo.h
@@ -3,7 +3,6 @@
3 3
4#if defined(__sparc__) && defined(__arch64__) 4#if defined(__sparc__) && defined(__arch64__)
5 5
6#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
7#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) 6#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
8#define __ARCH_SI_BAND_T int 7#define __ARCH_SI_BAND_T int
9 8
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index a53e0a5fd3a3..53e48f721ce3 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -54,58 +54,6 @@ struct signal_frame32 {
54 /* __siginfo_rwin_t * */u32 rwin_save; 54 /* __siginfo_rwin_t * */u32 rwin_save;
55} __attribute__((aligned(8))); 55} __attribute__((aligned(8)));
56 56
57typedef struct compat_siginfo{
58 int si_signo;
59 int si_errno;
60 int si_code;
61
62 union {
63 int _pad[SI_PAD_SIZE32];
64
65 /* kill() */
66 struct {
67 compat_pid_t _pid; /* sender's pid */
68 unsigned int _uid; /* sender's uid */
69 } _kill;
70
71 /* POSIX.1b timers */
72 struct {
73 compat_timer_t _tid; /* timer id */
74 int _overrun; /* overrun count */
75 compat_sigval_t _sigval; /* same as below */
76 int _sys_private; /* not to be passed to user */
77 } _timer;
78
79 /* POSIX.1b signals */
80 struct {
81 compat_pid_t _pid; /* sender's pid */
82 unsigned int _uid; /* sender's uid */
83 compat_sigval_t _sigval;
84 } _rt;
85
86 /* SIGCHLD */
87 struct {
88 compat_pid_t _pid; /* which child */
89 unsigned int _uid; /* sender's uid */
90 int _status; /* exit code */
91 compat_clock_t _utime;
92 compat_clock_t _stime;
93 } _sigchld;
94
95 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
96 struct {
97 u32 _addr; /* faulting insn/memory ref. */
98 int _trapno;
99 } _sigfault;
100
101 /* SIGPOLL */
102 struct {
103 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
104 int _fd;
105 } _sigpoll;
106 } _sifields;
107}compat_siginfo_t;
108
109struct rt_signal_frame32 { 57struct rt_signal_frame32 {
110 struct sparc_stackf32 ss; 58 struct sparc_stackf32 ss;
111 compat_siginfo_t info; 59 compat_siginfo_t info;
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h
index 6e74450ff0a1..3063e6fc8daa 100644
--- a/arch/tile/include/asm/compat.h
+++ b/arch/tile/include/asm/compat.h
@@ -110,6 +110,68 @@ struct compat_flock64 {
110 110
111typedef u32 compat_sigset_word; 111typedef u32 compat_sigset_word;
112 112
113typedef union compat_sigval {
114 compat_int_t sival_int;
115 compat_uptr_t sival_ptr;
116} compat_sigval_t;
117
118#define COMPAT_SI_PAD_SIZE (128/sizeof(int) - 3)
119
120typedef struct compat_siginfo {
121 int si_signo;
122 int si_errno;
123 int si_code;
124
125 union {
126 int _pad[COMPAT_SI_PAD_SIZE];
127
128 /* kill() */
129 struct {
130 unsigned int _pid; /* sender's pid */
131 unsigned int _uid; /* sender's uid */
132 } _kill;
133
134 /* POSIX.1b timers */
135 struct {
136 compat_timer_t _tid; /* timer id */
137 int _overrun; /* overrun count */
138 compat_sigval_t _sigval; /* same as below */
139 int _sys_private; /* not to be passed to user */
140 int _overrun_incr; /* amount to add to overrun */
141 } _timer;
142
143 /* POSIX.1b signals */
144 struct {
145 unsigned int _pid; /* sender's pid */
146 unsigned int _uid; /* sender's uid */
147 compat_sigval_t _sigval;
148 } _rt;
149
150 /* SIGCHLD */
151 struct {
152 unsigned int _pid; /* which child */
153 unsigned int _uid; /* sender's uid */
154 int _status; /* exit code */
155 compat_clock_t _utime;
156 compat_clock_t _stime;
157 } _sigchld;
158
159 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
160 struct {
161 unsigned int _addr; /* faulting insn/memory ref. */
162#ifdef __ARCH_SI_TRAPNO
163 int _trapno; /* TRAP # which caused the signal */
164#endif
165 } _sigfault;
166
167 /* SIGPOLL */
168 struct {
169 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
170 int _fd;
171 } _sigpoll;
172 } _sifields;
173} compat_siginfo_t;
174
113#define COMPAT_OFF_T_MAX 0x7fffffff 175#define COMPAT_OFF_T_MAX 0x7fffffff
114#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 176#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
115 177
diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index d16d006d660e..f8ccf08f6934 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -156,12 +156,12 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
156#undef SET_PERSONALITY 156#undef SET_PERSONALITY
157#define SET_PERSONALITY(ex) \ 157#define SET_PERSONALITY(ex) \
158do { \ 158do { \
159 current->personality = PER_LINUX; \ 159 set_personality(PER_LINUX | (current->personality & (~PER_MASK))); \
160 current_thread_info()->status &= ~TS_COMPAT; \ 160 current_thread_info()->status &= ~TS_COMPAT; \
161} while (0) 161} while (0)
162#define COMPAT_SET_PERSONALITY(ex) \ 162#define COMPAT_SET_PERSONALITY(ex) \
163do { \ 163do { \
164 current->personality = PER_LINUX_32BIT; \ 164 set_personality(PER_LINUX | (current->personality & (~PER_MASK))); \
165 current_thread_info()->status |= TS_COMPAT; \ 165 current_thread_info()->status |= TS_COMPAT; \
166} while (0) 166} while (0)
167 167
diff --git a/arch/tile/include/asm/unistd.h b/arch/tile/include/asm/unistd.h
index a017246ca0ce..0e1f3e66e492 100644
--- a/arch/tile/include/asm/unistd.h
+++ b/arch/tile/include/asm/unistd.h
@@ -12,9 +12,6 @@
12 * more details. 12 * more details.
13 */ 13 */
14 14
15#if !defined(_ASM_TILE_UNISTD_H) || defined(__SYSCALL)
16#define _ASM_TILE_UNISTD_H
17
18#if !defined(__LP64__) || defined(__SYSCALL_COMPAT) 15#if !defined(__LP64__) || defined(__SYSCALL_COMPAT)
19/* Use the flavor of this syscall that matches the 32-bit API better. */ 16/* Use the flavor of this syscall that matches the 32-bit API better. */
20#define __ARCH_WANT_SYNC_FILE_RANGE2 17#define __ARCH_WANT_SYNC_FILE_RANGE2
@@ -43,5 +40,3 @@ __SYSCALL(__NR_cmpxchg_badaddr, sys_cmpxchg_badaddr)
43#endif 40#endif
44#define __ARCH_WANT_SYS_NEWFSTATAT 41#define __ARCH_WANT_SYS_NEWFSTATAT
45#endif 42#endif
46
47#endif /* _ASM_TILE_UNISTD_H */
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c
index 474571b84085..7bc0859a9f5e 100644
--- a/arch/tile/kernel/compat_signal.c
+++ b/arch/tile/kernel/compat_signal.c
@@ -55,63 +55,6 @@ struct compat_ucontext {
55 sigset_t uc_sigmask; /* mask last for extensibility */ 55 sigset_t uc_sigmask; /* mask last for extensibility */
56}; 56};
57 57
58#define COMPAT_SI_PAD_SIZE ((SI_MAX_SIZE - 3 * sizeof(int)) / sizeof(int))
59
60struct compat_siginfo {
61 int si_signo;
62 int si_errno;
63 int si_code;
64
65 union {
66 int _pad[COMPAT_SI_PAD_SIZE];
67
68 /* kill() */
69 struct {
70 unsigned int _pid; /* sender's pid */
71 unsigned int _uid; /* sender's uid */
72 } _kill;
73
74 /* POSIX.1b timers */
75 struct {
76 compat_timer_t _tid; /* timer id */
77 int _overrun; /* overrun count */
78 compat_sigval_t _sigval; /* same as below */
79 int _sys_private; /* not to be passed to user */
80 int _overrun_incr; /* amount to add to overrun */
81 } _timer;
82
83 /* POSIX.1b signals */
84 struct {
85 unsigned int _pid; /* sender's pid */
86 unsigned int _uid; /* sender's uid */
87 compat_sigval_t _sigval;
88 } _rt;
89
90 /* SIGCHLD */
91 struct {
92 unsigned int _pid; /* which child */
93 unsigned int _uid; /* sender's uid */
94 int _status; /* exit code */
95 compat_clock_t _utime;
96 compat_clock_t _stime;
97 } _sigchld;
98
99 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
100 struct {
101 unsigned int _addr; /* faulting insn/memory ref. */
102#ifdef __ARCH_SI_TRAPNO
103 int _trapno; /* TRAP # which caused the signal */
104#endif
105 } _sigfault;
106
107 /* SIGPOLL */
108 struct {
109 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
110 int _fd;
111 } _sigpoll;
112 } _sifields;
113};
114
115struct compat_rt_sigframe { 58struct compat_rt_sigframe {
116 unsigned char save_area[C_ABI_SAVE_AREA_SIZE]; /* caller save area */ 59 unsigned char save_area[C_ABI_SAVE_AREA_SIZE]; /* caller save area */
117 struct compat_siginfo info; 60 struct compat_siginfo info;
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index b0a47433341e..1e638e75a6b7 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -6,6 +6,7 @@ config UNICORE32
6 select HAVE_DMA_ATTRS 6 select HAVE_DMA_ATTRS
7 select HAVE_KERNEL_GZIP 7 select HAVE_KERNEL_GZIP
8 select HAVE_KERNEL_BZIP2 8 select HAVE_KERNEL_BZIP2
9 select GENERIC_ATOMIC64
9 select HAVE_KERNEL_LZO 10 select HAVE_KERNEL_LZO
10 select HAVE_KERNEL_LZMA 11 select HAVE_KERNEL_LZMA
11 select ARCH_HAVE_CUSTOM_GPIO_H 12 select ARCH_HAVE_CUSTOM_GPIO_H
diff --git a/arch/unicore32/include/asm/unistd.h b/arch/unicore32/include/asm/unistd.h
index 9b2428019961..2abcf61c615d 100644
--- a/arch/unicore32/include/asm/unistd.h
+++ b/arch/unicore32/include/asm/unistd.h
@@ -9,10 +9,6 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12#if !defined(__UNICORE_UNISTD_H__) || defined(__SYSCALL)
13#define __UNICORE_UNISTD_H__
14 12
15/* Use the standard ABI for syscalls. */ 13/* Use the standard ABI for syscalls. */
16#include <asm-generic/unistd.h> 14#include <asm-generic/unistd.h>
17
18#endif /* __UNICORE_UNISTD_H__ */
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 474ca35b1bce..58790bd85c1d 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -92,7 +92,7 @@ endif
92ifdef CONFIG_X86_X32 92ifdef CONFIG_X86_X32
93 x32_ld_ok := $(call try-run,\ 93 x32_ld_ok := $(call try-run,\
94 /bin/echo -e '1: .quad 1b' | \ 94 /bin/echo -e '1: .quad 1b' | \
95 $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" - && \ 95 $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \
96 $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \ 96 $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \
97 $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n) 97 $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n)
98 ifeq ($(x32_ld_ok),y) 98 ifeq ($(x32_ld_ok),y)
@@ -142,7 +142,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
142KBUILD_CFLAGS += $(mflags-y) 142KBUILD_CFLAGS += $(mflags-y)
143KBUILD_AFLAGS += $(mflags-y) 143KBUILD_AFLAGS += $(mflags-y)
144 144
145archscripts: scripts_basic 145archscripts:
146 $(Q)$(MAKE) $(build)=arch/x86/tools relocs 146 $(Q)$(MAKE) $(build)=arch/x86/tools relocs
147 147
148### 148###
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index f34261296ffb..338803422239 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -409,7 +409,7 @@ extern struct apic *apic;
409 * to enforce the order with in them. 409 * to enforce the order with in them.
410 */ 410 */
411#define apic_driver(sym) \ 411#define apic_driver(sym) \
412 static struct apic *__apicdrivers_##sym __used \ 412 static const struct apic *__apicdrivers_##sym __used \
413 __aligned(sizeof(struct apic *)) \ 413 __aligned(sizeof(struct apic *)) \
414 __section(.apicdrivers) = { &sym } 414 __section(.apicdrivers) = { &sym }
415 415
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index fedf32b73e65..59c6c401f79f 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -41,6 +41,7 @@ typedef s64 __attribute__((aligned(4))) compat_s64;
41typedef u32 compat_uint_t; 41typedef u32 compat_uint_t;
42typedef u32 compat_ulong_t; 42typedef u32 compat_ulong_t;
43typedef u64 __attribute__((aligned(4))) compat_u64; 43typedef u64 __attribute__((aligned(4))) compat_u64;
44typedef u32 compat_uptr_t;
44 45
45struct compat_timespec { 46struct compat_timespec {
46 compat_time_t tv_sec; 47 compat_time_t tv_sec;
@@ -124,6 +125,78 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */
124 125
125typedef u32 compat_sigset_word; 126typedef u32 compat_sigset_word;
126 127
128typedef union compat_sigval {
129 compat_int_t sival_int;
130 compat_uptr_t sival_ptr;
131} compat_sigval_t;
132
133typedef struct compat_siginfo {
134 int si_signo;
135 int si_errno;
136 int si_code;
137
138 union {
139 int _pad[128/sizeof(int) - 3];
140
141 /* kill() */
142 struct {
143 unsigned int _pid; /* sender's pid */
144 unsigned int _uid; /* sender's uid */
145 } _kill;
146
147 /* POSIX.1b timers */
148 struct {
149 compat_timer_t _tid; /* timer id */
150 int _overrun; /* overrun count */
151 compat_sigval_t _sigval; /* same as below */
152 int _sys_private; /* not to be passed to user */
153 int _overrun_incr; /* amount to add to overrun */
154 } _timer;
155
156 /* POSIX.1b signals */
157 struct {
158 unsigned int _pid; /* sender's pid */
159 unsigned int _uid; /* sender's uid */
160 compat_sigval_t _sigval;
161 } _rt;
162
163 /* SIGCHLD */
164 struct {
165 unsigned int _pid; /* which child */
166 unsigned int _uid; /* sender's uid */
167 int _status; /* exit code */
168 compat_clock_t _utime;
169 compat_clock_t _stime;
170 } _sigchld;
171
172 /* SIGCHLD (x32 version) */
173 struct {
174 unsigned int _pid; /* which child */
175 unsigned int _uid; /* sender's uid */
176 int _status; /* exit code */
177 compat_s64 _utime;
178 compat_s64 _stime;
179 } _sigchld_x32;
180
181 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
182 struct {
183 unsigned int _addr; /* faulting insn/memory ref. */
184 } _sigfault;
185
186 /* SIGPOLL */
187 struct {
188 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
189 int _fd;
190 } _sigpoll;
191
192 struct {
193 unsigned int _call_addr; /* calling insn */
194 int _syscall; /* triggering system call number */
195 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
196 } _sigsys;
197 } _sifields;
198} compat_siginfo_t;
199
127#define COMPAT_OFF_T_MAX 0x7fffffff 200#define COMPAT_OFF_T_MAX 0x7fffffff
128#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 201#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
129 202
@@ -209,7 +282,6 @@ typedef struct user_regs_struct32 compat_elf_gregset_t;
209 * as pointers because the syscall entry code will have 282 * as pointers because the syscall entry code will have
210 * appropriately converted them already. 283 * appropriately converted them already.
211 */ 284 */
212typedef u32 compat_uptr_t;
213 285
214static inline void __user *compat_ptr(compat_uptr_t uptr) 286static inline void __user *compat_ptr(compat_uptr_t uptr)
215{ 287{
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index b04cbdb138cd..e6232773ce49 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -86,73 +86,6 @@ struct stat64 {
86 unsigned long long st_ino; 86 unsigned long long st_ino;
87} __attribute__((packed)); 87} __attribute__((packed));
88 88
89typedef struct compat_siginfo {
90 int si_signo;
91 int si_errno;
92 int si_code;
93
94 union {
95 int _pad[((128 / sizeof(int)) - 3)];
96
97 /* kill() */
98 struct {
99 unsigned int _pid; /* sender's pid */
100 unsigned int _uid; /* sender's uid */
101 } _kill;
102
103 /* POSIX.1b timers */
104 struct {
105 compat_timer_t _tid; /* timer id */
106 int _overrun; /* overrun count */
107 compat_sigval_t _sigval; /* same as below */
108 int _sys_private; /* not to be passed to user */
109 int _overrun_incr; /* amount to add to overrun */
110 } _timer;
111
112 /* POSIX.1b signals */
113 struct {
114 unsigned int _pid; /* sender's pid */
115 unsigned int _uid; /* sender's uid */
116 compat_sigval_t _sigval;
117 } _rt;
118
119 /* SIGCHLD */
120 struct {
121 unsigned int _pid; /* which child */
122 unsigned int _uid; /* sender's uid */
123 int _status; /* exit code */
124 compat_clock_t _utime;
125 compat_clock_t _stime;
126 } _sigchld;
127
128 /* SIGCHLD (x32 version) */
129 struct {
130 unsigned int _pid; /* which child */
131 unsigned int _uid; /* sender's uid */
132 int _status; /* exit code */
133 compat_s64 _utime;
134 compat_s64 _stime;
135 } _sigchld_x32;
136
137 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
138 struct {
139 unsigned int _addr; /* faulting insn/memory ref. */
140 } _sigfault;
141
142 /* SIGPOLL */
143 struct {
144 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
145 int _fd;
146 } _sigpoll;
147
148 struct {
149 unsigned int _call_addr; /* calling insn */
150 int _syscall; /* triggering system call number */
151 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
152 } _sigsys;
153 } _sifields;
154} compat_siginfo_t;
155
156#define IA32_STACK_TOP IA32_PAGE_OFFSET 89#define IA32_STACK_TOP IA32_PAGE_OFFSET
157 90
158#ifdef __KERNEL__ 91#ifdef __KERNEL__
diff --git a/arch/x86/include/asm/xen/interface.h b/arch/x86/include/asm/xen/interface.h
index 1707cfa928fb..6d2f75a82a14 100644
--- a/arch/x86/include/asm/xen/interface.h
+++ b/arch/x86/include/asm/xen/interface.h
@@ -51,6 +51,7 @@
51 * with Xen so that on ARM we can have one ABI that works for 32 and 64 51 * with Xen so that on ARM we can have one ABI that works for 32 and 64
52 * bit guests. */ 52 * bit guests. */
53typedef unsigned long xen_pfn_t; 53typedef unsigned long xen_pfn_t;
54typedef unsigned long xen_ulong_t;
54/* Guest handles for primitive C types. */ 55/* Guest handles for primitive C types. */
55__DEFINE_GUEST_HANDLE(uchar, unsigned char); 56__DEFINE_GUEST_HANDLE(uchar, unsigned char);
56__DEFINE_GUEST_HANDLE(uint, unsigned int); 57__DEFINE_GUEST_HANDLE(uint, unsigned int);
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index bc552cff2578..a65829ac2b9a 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -30,7 +30,7 @@
30 30
31static int numachip_system __read_mostly; 31static int numachip_system __read_mostly;
32 32
33static struct apic apic_numachip __read_mostly; 33static const struct apic apic_numachip __read_mostly;
34 34
35static unsigned int get_apic_id(unsigned long x) 35static unsigned int get_apic_id(unsigned long x)
36{ 36{
@@ -199,7 +199,7 @@ static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
199 return 0; 199 return 0;
200} 200}
201 201
202static struct apic apic_numachip __refconst = { 202static const struct apic apic_numachip __refconst = {
203 203
204 .name = "NumaConnect system", 204 .name = "NumaConnect system",
205 .probe = numachip_probe, 205 .probe = numachip_probe,
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index af6db6ec5b2a..4929c1be0ac0 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -225,7 +225,7 @@ static struct platform_device rtc_device = {
225static __init int add_rtc_cmos(void) 225static __init int add_rtc_cmos(void)
226{ 226{
227#ifdef CONFIG_PNP 227#ifdef CONFIG_PNP
228 static const char *ids[] __initconst = 228 static const char * const const ids[] __initconst =
229 { "PNP0b00", "PNP0b01", "PNP0b02", }; 229 { "PNP0b00", "PNP0b01", "PNP0b02", };
230 struct pnp_dev *dev; 230 struct pnp_dev *dev;
231 struct pnp_id *id; 231 struct pnp_id *id;
diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig
index 6e121a2a49e1..7872a3330fb5 100644
--- a/arch/x86/lguest/Kconfig
+++ b/arch/x86/lguest/Kconfig
@@ -4,7 +4,6 @@ config LGUEST_GUEST
4 depends on X86_32 4 depends on X86_32
5 select VIRTUALIZATION 5 select VIRTUALIZATION
6 select VIRTIO 6 select VIRTIO
7 select VIRTIO_RING
8 select VIRTIO_CONSOLE 7 select VIRTIO_CONSOLE
9 help 8 help
10 Lguest is a tiny in-kernel hypervisor. Selecting this will 9 Lguest is a tiny in-kernel hypervisor. Selecting this will
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 2d932c351f91..bf788d34530d 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -33,6 +33,7 @@
33#include <linux/memblock.h> 33#include <linux/memblock.h>
34 34
35#include <xen/xen.h> 35#include <xen/xen.h>
36#include <xen/events.h>
36#include <xen/interface/xen.h> 37#include <xen/interface/xen.h>
37#include <xen/interface/version.h> 38#include <xen/interface/version.h>
38#include <xen/interface/physdev.h> 39#include <xen/interface/physdev.h>
diff --git a/arch/x86/xen/irq.c b/arch/x86/xen/irq.c
index 157337657971..01a4dc015ae1 100644
--- a/arch/x86/xen/irq.c
+++ b/arch/x86/xen/irq.c
@@ -5,6 +5,7 @@
5#include <xen/interface/xen.h> 5#include <xen/interface/xen.h>
6#include <xen/interface/sched.h> 6#include <xen/interface/sched.h>
7#include <xen/interface/vcpu.h> 7#include <xen/interface/vcpu.h>
8#include <xen/events.h>
8 9
9#include <asm/xen/hypercall.h> 10#include <asm/xen/hypercall.h>
10#include <asm/xen/hypervisor.h> 11#include <asm/xen/hypervisor.h>
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index bb5a8105ea86..a95b41744ad0 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -35,7 +35,6 @@ void xen_set_pat(u64);
35 35
36char * __init xen_memory_setup(void); 36char * __init xen_memory_setup(void);
37void __init xen_arch_setup(void); 37void __init xen_arch_setup(void);
38void __init xen_init_IRQ(void);
39void xen_enable_sysenter(void); 38void xen_enable_sysenter(void);
40void xen_enable_syscall(void); 39void xen_enable_syscall(void);
41void xen_vcpu_restore(void); 40void xen_vcpu_restore(void);
diff --git a/arch/xtensa/include/asm/elf.h b/arch/xtensa/include/asm/elf.h
index 6e65eadaae14..5293312bc6a4 100644
--- a/arch/xtensa/include/asm/elf.h
+++ b/arch/xtensa/include/asm/elf.h
@@ -189,7 +189,8 @@ typedef struct {
189#endif 189#endif
190} elf_xtregs_t; 190} elf_xtregs_t;
191 191
192#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT) 192#define SET_PERSONALITY(ex) \
193 set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK)))
193 194
194struct task_struct; 195struct task_struct;
195 196